(** ** Definition of recognisable classes *)
Definition recognisable p :=
exists u, proc u /\ forall s, p s <-> eva (u (tenc s)).
(* * Complement, intersection and union of predicates *)
Definition complement p := fun t => ~ p t.
Definition intersection p q := fun t => p t /\ q t.
Definition union p q := fun t => p t \/ q t.
(** ** Decidable classes are closed under union, intersection and complement *)
Definition tcompl (u : term) : term := .\"x"; (!u "x") !F !T.
Definition tintersection u v : term := .\"x"; (!u "x") (!v "x") !F.
Definition tunion u v : term := .\"x"; (!u "x") !T (!v "x").

(* Specifications: *)
Lemma decidable_intersection p q : decidable p -> decidable q -> decidable (intersection p q).
Lemma decidable_union p q : decidable p -> decidable q -> decidable (union p q).
Lemma decidable_complement p : decidable p -> decidable (complement p).
(** ** There is an undecidable class *)
Lemma undecidable_russell : ~ decidable (fun s => ~ s (tenc s) ▷ T).
Definition recinter u v : term := .\"x"; !F (!u "x") (!v "x").