rewrite O_rec. intros H0.
assert (eva (C (H (tenc s) (tenc t)))) by now eapply app_eva in H0.
eapply C_sound in H1 as [n H1 % H_inv]; value; eauto using H_test.
assert (H2 := H1). eapply H_inv in H1.
eapply C_complete in H1 as (k & H1 & sat); value; eauto using H_test.
eapply H_inv in sat. destruct (eval k s) eqn:Eq; try congruence.
- left. split. exists t0. eapply eval_evaluates. eauto.
rewrite H1. eapply evaluates_equiv; split; value.
transitivity (E (enc k) (tenc s) (lambda T) (E (enc k) (tenc t) (lambda F) I)). solveeq.
rewrite !E_correct, Eq. destruct (eval k t); solveeq.
- destruct sat; try congruence.
destruct (eval k t) eqn:E2; try congruence. right.
split. exists t0. eapply eval_evaluates. eauto.
rewrite H1. eapply evaluates_equiv; split; value.
transitivity (E (enc k) (tenc s) (lambda T) (E (enc k) (tenc t) (lambda F) I)). solveeq.
rewrite !E_correct, Eq. destruct (eval k t); solveeq.
Qed.
From Undecidability.L Require Import DecidableRecognisable.
(** ** Post's theorem *)

Theorem Post p : (forall x, p x \/ ~ p x) -> recognisable p -> recognisable (complement p) -> decidable p.