Require Import Base.
(* Definitions from earlier chapters: *)
Definition XM : Prop := ∀ X : Prop, X ∨ ¬X.
Definition surjective (X Y : Type) (f : X → Y) : Prop := ∀ y, ∃ x, f x = y.
(* Definitions from earlier chapters: *)
Definition XM : Prop := ∀ X : Prop, X ∨ ¬X.
Definition surjective (X Y : Type) (f : X → Y) : Prop := ∀ y, ∃ x, f x = y.
Definition TVS : Prop := ∀ X : Prop, X=True ∨ X=False.
Goal TVS → XM.
Proof. intros A X. destruct (A X) as [B|B] ; rewrite B ; auto. Qed.
Definition PI : Prop := ∀ (X : Prop) (A B : X), A=B.
Goal TVS → PI.
Proof.
intros A X B C. destruct (A X) ; subst X.
- destruct B, C. reflexivity.
- contradiction B.
Qed.
Definition PE : Prop := ∀ X Y : Prop, (X ↔ Y) → X=Y.
Goal TVS → PE.
Proof. intros A X Y B. destruct (A X), (A Y) ; subst X Y ; tauto. Qed.
Goal XM → PE → TVS.
Proof.
intros xm pe X. destruct (xm X) as [A|A].
- left. apply pe. tauto.
- right. apply pe. tauto.
Qed.
(* Exercise 5.1.1 *)
Goal TVS ↔ XM ∧ PE.
Abort.
(* Exercise 5.1.2 *)
Goal TVS → PE.
Abort.
Goal TVS → XM.
Proof. intros A X. destruct (A X) as [B|B] ; rewrite B ; auto. Qed.
Definition PI : Prop := ∀ (X : Prop) (A B : X), A=B.
Goal TVS → PI.
Proof.
intros A X B C. destruct (A X) ; subst X.
- destruct B, C. reflexivity.
- contradiction B.
Qed.
Definition PE : Prop := ∀ X Y : Prop, (X ↔ Y) → X=Y.
Goal TVS → PE.
Proof. intros A X Y B. destruct (A X), (A Y) ; subst X Y ; tauto. Qed.
Goal XM → PE → TVS.
Proof.
intros xm pe X. destruct (xm X) as [A|A].
- left. apply pe. tauto.
- right. apply pe. tauto.
Qed.
(* Exercise 5.1.1 *)
Goal TVS ↔ XM ∧ PE.
Abort.
(* Exercise 5.1.2 *)
Goal TVS → PE.
Abort.
Goal ∀ X (f : X → bool), surjective f → ∃ x y : X, x ≠ y.
Proof.
intros X f A. destruct (A true) as [x B]. destruct (A false) as [y C].
∃ x, y. congruence.
Qed.
Inductive bp : Prop := P1 : bp | P2 : bp.
(* This Check produced an "Incorrect elimination" error, because the function violates the elim restriction:
Check fun x : bp => match x with P1 => true | P2 => false end. *)
Lemma Prop_Skolem (X : Type) (Y : Prop) (p : X → Y → Prop) :
(∀ x, ∃ y, p x y) → ∃ f, ∀ x, p x (f x).
Proof.
intros A.
∃ (fun x ⇒ let (y,_) := A x in y).
intros x.
destruct (A x) as [y B].
exact B.
Qed.
(* Exercise 5.2.1 *)
Goal (∀ X: Type, X = True ∨ X = False) → False.
Abort.
Lemma sur_fixpoint X Y (f : X → X → Y) (g : Y → Y) :
surjective f → ∃ y, g y = y.
Proof.
intros A.
pose (h x := g (f x x)).
destruct (A h) as [x B].
∃ (h x). unfold h at 2. rewrite <- B. reflexivity.
Qed.
Goal PE → PI.
Proof.
intros pe.
cut (P1=P2).
{ intros A X B C.
change (B = match P1 with P1 ⇒ C | P2 ⇒ B end).
rewrite A. reflexivity. }
pose (neg x := match x with P1 ⇒ P2 | P2 ⇒ P1 end).
cut (∃ P, neg P = P).
{ unfold neg. intros [[|] C].
- symmetry. exact C.
- exact C. }
cut (∃ f : bp → bp → bp, surjective f).
{ intros [f A]. apply (sur_fixpoint (f:=f)). exact A. }
cut (bp = (bp → bp)).
{ intros A. rewrite <- A. ∃ (fun x ⇒ x). intros x. ∃ x. reflexivity. }
apply pe. split ; auto using P1.
Qed.
(* Exercise 5.3.1 *)
Lemma Cantor X :
¬ ∃ f : X → X → Prop, surjective f.
Abort.
(* Exercise 5.3.2 *)
Definition iso (X Y : Type) : Prop :=
∃ f : X → Y, ∃ g : Y → X, ∀ x y, g (f x) = x ∧ f (g y) = y.
Definition PU : Prop := ∀ X Y : Prop, iso X Y → X = Y.
Goal PE ↔ PU ∧ PI.
Abort.