(** *** Step-indexed self-interpreter *)
Definition E := Eval cbv in
rho (.\ "Eval","n","u";"u"
(.\"";!none)
(.\"s","t"; "n" !none
(.\"n"; "Eval" "n" "s"
(.\"s"; "Eval" "n" "t"
(.\"t"; "s"
(.\""; !none)
(.\"",""; !none)
(.\"s"; "Eval" "n" (!Subst "s" !Zero "t")))
!none)
!none))
(.\"s"; !some (!Lam "s"))).
Definition cLam s := lambda(lambda(lambda(0 s))).
Hint Unfold cLam : cbv.

Lemma E_correct k s : E (enc k) (tenc s) ≡ oenc (eval k s).
Proof with value.