(** * 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).
Hint Resolve tenc_proc : cbv.
Lemma tenc_injective s t : tenc s = tenc t -> s = t.
Lemma tenc_inj s t : tenc s ≡ tenc t -> s = t.
Definition Var : term := .\"n";     .\"v","a","l"; "v" "n".