(** ** Procedural realisation of enumeration *)
(** ** Some list procedures *)
Variable X : Type.
Variable enc : X -> term.
Hypothesis enc_proc : (forall x, proc (enc x)).
Fixpoint lenc (A : list X) :=
match A with
| nil => lambda (lambda 1)
| a::A => lambda(lambda (0 (enc a) (lenc A)))
end.
Definition Nil : term := .\ "n", "c"; "n".
Definition Cons: term := .\ "a", "A", "n", "c"; "c" "a" "A".

(* Specifications: *)
Lemma lenc_proc A : proc (lenc A).
Hint Resolve lenc_proc : cbv.
Lemma Cons_correct a A : Cons (enc a) (lenc A) ≡ lenc(a::A).
Definition Append := rho (.\ "app", "A", "B";
"A" "B" (.\"a", "A"; !Cons "a" ("app" "A" "B"))).