From Undecidability.L Require Export L.
(** * Step-indexed interpreter and modesty *)
(** ** Step-indexed interpreter *)
Fixpoint eval (n : nat) (u : term) :=
match u with
| var n => None
| lambda s => Some (lambda s)
| app s t => match n with
| 0   => None
| S n => match eval n s, eval n t with
| Some (lambda s), Some t => eval n (subst s 0 t)
|   _ , _ => None
end
end
end.

Lemma decidable_dec p : decidable p -> exists f, forall s, f s = true <-> p s.
Proof with try tauto; try (eexists; reflexivity).