Opaque bs2nat.
Opaque Cond.
Definition False_e n :=
Comp n (Succ false) [Zero_e n].
Opaque Zero_e One_e False_e Rev_e RemoveLSZ_e.
Definition Normalize_e : Cobham :=
Comp 1 Rev_e [Comp 1 RemoveLSZ_e [Rev_e]].
Opaque Normalize_e.
(** Def 1 of (Rose) *)
Definition Succ_e : Cobham :=
Rec
(Comp 0 (Succ true) [Zero])
(Comp 2 (Succ true) [Proj 2 0])
(Comp 2 (Succ false) [Proj 2 1])
(Comp 1 (Succ true) [Proj 1 0]).
Opaque Succ_e.
(** Def 2 of (Rose) *)
Definition Pred'_e : Cobham :=
Rec
Zero
(Comp 2 (Succ true) [Proj 2 1])
(Comp 2 (Succ false) [Proj 2 0])
(Proj 1 0).
Opaque Pred'_e.
Definition Pred_e : Cobham :=
Comp 1 Pred'_e [Normalize_e].
Opaque Pred_e.
(** Def 3 of (Rose) *)
Definition OneMinus'_e : Cobham :=
Rec2
(One_e 0)
(Zero_e 2)
(One_e 1).
Opaque OneMinus'_e.
Definition OneMinus_e : Cobham :=
Comp 1 OneMinus'_e [Normalize_e].
Opaque OneMinus_e.
(** Def 4 of (Rose) *)
Definition Div2_e : Cobham :=
Rec2
Zero
(Proj 2 0)
(Proj 1 0).
Opaque Div2_e.
(** Def 5 of (Rose) *)
Definition Mod2_e : Cobham :=
Rec
Zero
(False_e 2)
(One_e 2)
(One_e 1).
Opaque Mod2_e.
(** Def 6 of (Rose) *)
Definition Length_e : Cobham :=
Rec2
Zero
(Comp 2 Succ_e [Proj 2 1])
(Proj 1 0).

Lemma Length_correct : forall l,
bs2nat (Sem Length_e l) = length (hd nil l).