Definition Zero_e (n:nat) : Cobham :=
Comp n Zero nil.
Definition One_e (n:nat) : Cobham :=
Comp n (Comp 0 (Succ true) [Zero]) nil.
(** Def 12 of (Rose) *)
Definition App_e : Cobham :=
Rec (Proj 1 0)
(Comp 3 (Succ false) [Proj 3 1])
(Comp 3 (Succ true) [Proj 3 1])
(Comp 2 Smash [Comp 2 (Succ true) [Proj 2 0]; Comp 2 (Succ true) [Proj 2 1] ]).
Opaque App_e.
Definition Rev_e : Cobham :=
Rec
Zero
(Comp 2 App_e [Proj 2 1; Comp 2 (Succ false) [Zero_e 2]])
(Comp 2 App_e [Proj 2 1; Comp 2 (Succ true) [Zero_e 2]])
(Proj 1 0).
Definition RemoveLSZ_e : Cobham :=
Rec
Zero
(Proj 2 1)
(Comp 2 (Succ true) [Proj 2 0])
(Proj 1 0).
Definition Cond : Cobham :=
Rec (Proj 3 0) (Proj 5 4) (Proj 5 3) (
Comp 4 Smash [
Comp 4 (Succ true) [Proj 4 1];
Comp 4 Smash [
Comp 4 (Succ true) [Proj 4 2];
Comp 4 (Succ true) [Proj 4 3]
]
]
).

Lemma Cond_correct : forall l,
Sem Cond l =
match hd nil l with
| nil => hd nil (tl l)
| true::_ => hd nil (tl (tl l))
| false::_ => hd nil (tl (tl (tl l)))
end.