(** * Scott encoding of terms *)

Fixpoint tenc t :=
  lambda ( (* var *) lambda ( (* app *) lambda ( (* lambda *)
     match t with
       | var n => (var 2) (enc n)
       | app s t => (var 1) (tenc s) (tenc t)
       | lambda s => (var 0) (tenc s)
     end
  ))).

(* Specifications: *)
Lemma tenc_proc s : proc (tenc s).
Lemma tenc_injective s t : tenc s = tenc t -> s = t.