(** * Ramsey theorem (with the necessary set-theoretic definitions) *)

Definition intersection {X} (A B : X -> Prop) := fun x => A x /\ B x.Definition minus {X} (A B : X -> Prop) := fun x => A x /\ ~B x.Definition subset {X} (A B : X -> Prop) := forall x, A x -> B x.Definition finite {X} (A : X -> Prop) := exists n f, forall x, A x -> exists i, i < n /\ f i = x.Definition infinite (A : nat -> Prop) := forall b, exists a, b <= a /\ A a.Definition image {X Y} (f : X -> Y) (A : X -> Prop) : Y -> Prop := fun y => exists x, A x /\ y = f x.Definition preimage {X Y} (f : X -> Y) (B : Y -> Prop) : X -> Prop := fun x => B (f x).

(* Specifications: *)
Lemma infinite_subset (A B : nat -> Prop) : subset A B -> infinite A -> infinite B.
Lemma infinite_minus A B : (forall P, ~~P -> P) -> infinite A -> ~ infinite (intersection A B) -> infinite (minus A B).
Lemma image_subset {X Y} A B (f : X -> Y) : subset A B -> subset (image f A) (image f B).
Lemma ramsey_preimage {X} (N : nat -> Prop) (f : nat -> X) : (forall P, P \/ ~P) -> finite (image f N) -> infinite N -> exists x, infinite (intersection N (preimage f (eq x))).
Lemma EM_ABS : (forall P, P \/ ~P) <-> (forall P, ~~P -> P).