From Undecidability.L Require Import DecidableRecognisable InterpreterResults.
Open Scope list_scope.
Implicit Types s t : term.
(** * Enumerable classes *)
(** ** Definition of enumerable classes *)
Definition enumerable p := exists u, proc u /\ (forall n, u(enc n) ≡ none \/ exists s, u (enc n) ≡ oenc (Some s) /\ p s) /\ forall s, p s -> exists n, u (enc n) ≡ oenc (Some s).
(** ** Enumerable classes are recognisable *)
(** *** Equality of encoded terms *)
Definition Eq := rho (.\ "Eq", "s", "t"; "s" (.\"n";        "t" (.\"m"; !EqN "n" "m") !(lambda (lambda F)) !(lambda F))
(.\"s1", "s2"; "t" !(lambda F) (.\"t1","t2"; ("Eq" "s1" "t1") ("Eq" "s2" "t2") !F) !(lambda F))
(.\"s1";       "t" !(lambda F) !(lambda (lambda F)) (.\"t1"; "Eq" "s1" "t1")) ).
Hint Unfold Eq : cbv.
Definition term_eq_bool s t := if decision (s = t) then true else false.

Lemma Eq_correct' s t :
Eq (tenc s) (tenc t) ≡ benc (term_eq_bool s t).