| 1 |
|
| 2 |
|
| 3 |
Open Scope type_scope. |
| 4 |
|
| 5 |
Notation idmap := (fun x => x). |
| 6 |
Notation compose := (fun g f x => g (f x)). |
| 7 |
Notation " g 'o' f " := (compose g f) (at level 40, left associativity) : core_scope. |
| 8 |
(* Notation " g 'o' f " := (fun x => g (f x)) (at level 40, left associativity) : core_scope. *) |
| 9 |
|
| 10 |
(* sigma { & } *) |
| 11 |
(* Notation "{ x & P }" := (sigT (fun x => P)) (only parsing) : type_scope. *) |
| 12 |
(* Notation "{ x : A & P }" := (sigT (A:=A) (fun x => P)) (only parsing) : type_scope. *) |
| 13 |
Notation "( x ; y )" := (existT _ x y) : core_scope. |
| 14 |
Notation "( x ; y ; z )" := (x ; (y ; z)) : core_scope. |
| 15 |
Notation pr1 := (@projT1 _ _). |
| 16 |
Notation pr2 := (@projT2 _ _). |
| 17 |
Notation "x .1" := (@projT1 _ _ x) : core_scope. |
| 18 |
Notation "x .2" := (@projT2 _ _ x) : core_scope. |
| 19 |
Notation "'exists' x .. y , P" |
| 20 |
:= (sigT (fun x => .. (sigT (fun y => P)) ..)) |
| 21 |
(at level 200, x binder, y binder, right associativity) : type_scope. |
| 22 |
Notation "∃ x .. y , P" |
| 23 |
:= (sigT (fun x => .. (sigT (fun y => P)) ..)) |
| 24 |
(at level 200, x binder, y binder, right associativity) : type_scope. |
| 25 |
|
| 26 |
Definition prod A B := sigT (fun _ : A => B). |
| 27 |
Notation "A * B" := (prod A B) (at level 40, left associativity) : type_scope. |
| 28 |
Notation "A × B" := (sigT (fun _ : A => B)) (at level 90, right associativity) : type_scope. |
| 29 |
Notation "A × B" := (prod A B) (at level 90, right associativity) : type_scope. |
| 30 |
Definition pair {A B} : A -> B -> A × B := fun x y => (x; y). |
| 31 |
Notation "( x , y , .. , z )" := (pair .. (pair x y) .. z) : core_scope. |
| 32 |
Definition fst {A B} : A × B -> A := @projT1 _ _. |
| 33 |
Definition snd {A B} : A × B -> B := @projT2 _ _. |
| 34 |
|
| 35 |
(* Notation " ( a | b ) " := (exist _ a b). (* subtype { | } *) *) |
| 36 |
(* Notation "x ..1" := (@proj1_sig _ _ x) (at level 3, format "x '..1'"). *) |
| 37 |
(* Notation "x ..2" := (@proj2_sig _ _ x) (at level 3, format "x '..2'"). *) |
| 38 |
|
| 39 |
(* Notation " ( a , b ) " := (conj a b). *) |
| 40 |
|
| 41 |
Definition iff (A B : Type) := (A -> B) × (B -> A). |
| 42 |
Notation "A <-> B" := (iff A B)%type : type_scope. |
| 43 |
|
| 44 |
Definition transitive_iff {A B C} |
| 45 |
: A <-> B -> B <-> C -> A <-> C. |
| 46 |
Proof. |
| 47 |
intros H1 H2. split; firstorder. |
| 48 |
Defined. |
| 49 |
|
| 50 |
(* ********* Strict Eq ********* *) |
| 51 |
Delimit Scope eq_scope with eq. |
| 52 |
Open Scope eq_scope. |
| 53 |
Bind Scope eq_scope with eq. |
| 54 |
|
| 55 |
Definition Einverse {A : Type} {x y : A} (p : x = y) : y = x. |
| 56 |
symmetry; assumption. |
| 57 |
Defined. |
| 58 |
Arguments Einverse {A x y} p : simpl nomatch. |
| 59 |
|
| 60 |
Definition Econcat {A : Type} {x y z : A} (p : x = y) (q : y = z) : x = z := |
| 61 |
match p, q with eq_refl, eq_refl => eq_refl end. |
| 62 |
Arguments Econcat {A x y z} p q : simpl nomatch. |
| 63 |
|
| 64 |
Notation "'E1'" := eq_refl : eq_scope. |
| 65 |
Notation "p E@ q" := (Econcat p%eq q%eq) (at level 20) : eq_scope. |
| 66 |
Notation "p ^E" := (Einverse p%eq) (at level 3, format "p '^E'") : eq_scope. |
| 67 |
|
| 68 |
Definition Etransport {A : Type} (P : A -> Type) {x y : A} (p : x = y) (u : P x) : P y := |
| 69 |
match p with eq_refl => u end. |
| 70 |
Arguments Etransport {A}%_type_scope P {x y} p%_eq_scope u : simpl nomatch. |
| 71 |
|
| 72 |
Notation "p E# x" |
| 73 |
:= (Etransport _ p x) (right associativity, at level 65, only parsing) : eq_scope. |
| 74 |
|
| 75 |
Notation coe := (Etransport idmap). |
| 76 |
|
| 77 |
Notation "f == g" := (forall x, f x = g x) (at level 70, no associativity) : type_scope. |
| 78 |
|
| 79 |
Definition Eap {A B:Type} (f:A -> B) {x y:A} (p:x = y) : f x = f y |
| 80 |
:= match p with eq_refl => eq_refl end. |
| 81 |
Global Arguments Eap {A B}%_type_scope f {x y} p%_eq_scope. |
| 82 |
|
| 83 |
|
| 84 |
Definition Econcat_Vp {A} {x y : A} (p : x = y) |
| 85 |
: p^E E@ p = E1. |
| 86 |
Proof. |
| 87 |
now destruct p. |
| 88 |
Defined. |
| 89 |
|
| 90 |
|
| 91 |
(* subtypes ? *) |
| 92 |
|
| 93 |
Axiom I : Type. |
| 94 |
Axiom inf sup : I -> I -> I. |
| 95 |
Axiom not : I -> I. |
| 96 |
Axiom zero one : I. |
| 97 |
Notation "0" := zero. |
| 98 |
Notation "1" := one. |
| 99 |
|
| 100 |
Axiom (zero_inf : forall {i}, inf 0 i = 0) |
| 101 |
(inf_zero : forall {i}, inf i 0 = 0) |
| 102 |
(one_inf : forall {i}, inf 1 i = i) |
| 103 |
(inf_one : forall {i}, inf i 1 = i) |
| 104 |
(not_not : forall {i}, not (not i) = i) |
| 105 |
(not_zero : not 0 = 1). |
| 106 |
|
| 107 |
Axiom Face : Type. |
| 108 |
Axiom El : Face -> Type. |
| 109 |
Axiom is0 is1 : I -> Face. |
| 110 |
Axiom bot top : Face. |
| 111 |
Axiom and or : Face -> Face -> Face. |
| 112 |
Axiom (El_bot : El bot = False) |
| 113 |
(El_top : El top = True) |
| 114 |
(El_and : forall {φ φ'}, El (and φ φ') = @sigT (El φ) (fun _ => El φ')) |
| 115 |
(El_or : forall {φ φ'}, El (or φ φ') = (El φ) + (El φ')) |
| 116 |
(El_is0 : forall {i}, El (is0 i) = (i = 0)) |
| 117 |
(El_is1 : forall {i}, El (is1 i) = (i = 1)) |
| 118 |
(is1_zero : is1 0 = bot) |
| 119 |
(is0_one : is0 1 = bot) |
| 120 |
(is0_zero : is0 0 = top) |
| 121 |
(is1_one : is1 1 = top) |
| 122 |
(and_bot : forall {φ}, and φ bot = bot) |
| 123 |
(and_top : forall {φ}, and φ top = φ) |
| 124 |
. |
| 125 |
|
| 126 |
|
| 127 |
|
| 128 |
Definition paths A (a b : A) := { p : I -> A & p 0 = a × p 1 = b }. |
| 129 |
|
| 130 |
Notation " a ~ b " := (paths _ a b) (at level 30). |
| 131 |
|
| 132 |
Tactic Notation "path" := simple refine (fun i => _; _; _). |
| 133 |
Tactic Notation "path" ident(i) := simple refine (fun i => _; _; _). |
| 134 |
|
| 135 |
Definition Contr A := { x : A & forall y, x ~ y }. |
| 136 |
|
| 137 |
Definition partial A := { φ : Face & El φ -> A }. |
| 138 |
|
| 139 |
Definition empty {A} : partial A. |
| 140 |
Admitted. |
| 141 |
|
| 142 |
Definition Etransport_pp {A : Type} (P : A -> Type) {x y z : A} (p : x = y) (q : y = z) (u : P x) : |
| 143 |
p E@ q E# u = q E# p E# u. |
| 144 |
Admitted. |
| 145 |
|
| 146 |
Definition extends {A} (u : partial A) (a : A) |
| 147 |
:= forall x, u.2 x = a. |
| 148 |
|
| 149 |
Definition Contr' A |
| 150 |
:= forall u : partial A, exists a, extends u a. |
| 151 |
|
| 152 |
Definition Contr'_Contr A : Contr' A -> Contr A. |
| 153 |
intro H. pose (x := (H empty).1). exists x. |
| 154 |
intro y. path i. |
| 155 |
- refine (H (or (is0 i) (is1 i); _)).1. |
| 156 |
refine (_ o coe El_or). apply sum_rect; intros _. exact x. exact y. |
| 157 |
- cbn. match goal with |
| 158 |
| |- (H ?X).1 = _ => set X |
| 159 |
end. |
| 160 |
etransitivity. symmetry; unshelve eapply (H s).2. |
| 161 |
+ unfold s; cbn. refine (coe El_or^E _). left. |
| 162 |
refine (coe _ Logic.I). exact (Eap El is0_zero E@ El_top)^E. |
| 163 |
+ subst s; cbn. rewrite <- Etransport_pp. |
| 164 |
rewrite Econcat_Vp. reflexivity. |
| 165 |
- cbn. match goal with |
| 166 |
| |- (H ?X).1 = _ => set X |
| 167 |
end. |
| 168 |
etransitivity. symmetry; unshelve eapply (H s).2. |
| 169 |
+ unfold s; cbn. refine (coe El_or^E _). right. |
| 170 |
refine (coe _ Logic.I). exact (Eap El is1_one E@ El_top)^E. |
| 171 |
+ subst s; cbn. rewrite <- Etransport_pp. |
| 172 |
rewrite Econcat_Vp. reflexivity. |
| 173 |
Defined. (* stack overflow *) |