| 1 |
Unset Strict Universe Declaration. |
| 2 |
Require Import TestSuite.admit. |
| 3 |
(* File reduced by coq-bug-finder from original input, then from 9113 lines to 279 lines *) |
| 4 |
(* coqc version trunk (October 2014) compiled on Oct 19 2014 18:56:9 with OCaml 3.12.1 |
| 5 |
coqtop version trunk (October 2014) *) |
| 6 |
|
| 7 |
Notation Type0 := Set. |
| 8 |
|
| 9 |
Notation idmap := (fun x => x). |
| 10 |
|
| 11 |
Notation "( x ; y )" := (existT _ x y) : fibration_scope. |
| 12 |
Open Scope fibration_scope. |
| 13 |
|
| 14 |
Notation pr1 := projT1. |
| 15 |
|
| 16 |
Notation "x .1" := (pr1 x) : fibration_scope. |
| 17 |
|
| 18 |
Definition compose {A B C : Type} (g : B -> C) (f : A -> B) := |
| 19 |
fun x => g (f x). |
| 20 |
|
| 21 |
Notation "g 'o' f" := (compose g f) (at level 40, left associativity) : function_scope. |
| 22 |
Open Scope function_scope. |
| 23 |
|
| 24 |
Inductive paths {A : Type} (a : A) : A -> Type := |
| 25 |
idpath : paths a a. |
| 26 |
|
| 27 |
Arguments idpath {A a} , [A] a. |
| 28 |
Scheme Rewriting for paths. |
| 29 |
|
| 30 |
Notation "x = y :> A" := (@paths A x y) : type_scope. |
| 31 |
Notation "x = y" := (x = y :>_) : type_scope. |
| 32 |
Definition inverse {A : Type} {x y : A} (p : x = y) : y = x. |
| 33 |
admit. |
| 34 |
Defined. |
| 35 |
|
| 36 |
Definition concat {A : Type} {x y z : A} (p : x = y) (q : y = z) : x = z := |
| 37 |
match p, q with idpath, idpath => idpath end. |
| 38 |
|
| 39 |
Notation "1" := idpath : path_scope. |
| 40 |
|
| 41 |
Notation "p @ q" := (concat p q) (at level 20, left associativity) : path_scope. |
| 42 |
|
| 43 |
Notation "p ^" := (inverse p) (at level 3, format "p '^'") : path_scope. |
| 44 |
|
| 45 |
Notation "p @' q" := (concat p q) (at level 21, left associativity, |
| 46 |
format "'[v' p '/' '@'' q ']'") : long_path_scope. |
| 47 |
Definition transport {A : Type} (P : A -> Type) {x y : A} (p : x = y) (u : P x) : P y. |
| 48 |
exact (match p with idpath => u end). |
| 49 |
Defined. |
| 50 |
|
| 51 |
Notation "p # x" := (transport _ p x) (right associativity, at level 65, only parsing) : path_scope. |
| 52 |
Definition ap {A B:Type} (f:A -> B) {x y:A} (p:x = y) : f x = f y. |
| 53 |
exact (match p with idpath => idpath end). |
| 54 |
Defined. |
| 55 |
|
| 56 |
Definition pointwise_paths {A} {P:A->Type} (f g:forall x:A, P x) |
| 57 |
:= forall x:A, f x = g x. |
| 58 |
|
| 59 |
Notation "f == g" := (pointwise_paths f g) (at level 70, no associativity) : type_scope. |
| 60 |
|
| 61 |
Definition Sect {A B : Type} (s : A -> B) (r : B -> A) := |
| 62 |
forall x : A, r (s x) = x. |
| 63 |
|
| 64 |
Class IsEquiv {A B : Type} (f : A -> B) := BuildIsEquiv { |
| 65 |
equiv_inv : B -> A ; |
| 66 |
eisretr : Sect equiv_inv f; |
| 67 |
eissect : Sect f equiv_inv; |
| 68 |
eisadj : forall x : A, eisretr (f x) = ap f (eissect x) |
| 69 |
}. |
| 70 |
|
| 71 |
Arguments eisretr {A B} f {_} _. |
| 72 |
|
| 73 |
Record Equiv A B := BuildEquiv { |
| 74 |
equiv_fun : A -> B ; |
| 75 |
equiv_isequiv : IsEquiv equiv_fun |
| 76 |
}. |
| 77 |
|
| 78 |
Coercion equiv_fun : Equiv >-> Funclass. |
| 79 |
|
| 80 |
Global Existing Instance equiv_isequiv. |
| 81 |
|
| 82 |
Notation "A <~> B" := (Equiv A B) (at level 85) : equiv_scope. |
| 83 |
|
| 84 |
Notation "f ^-1" := (@equiv_inv _ _ f _) (at level 3, format "f '^-1'") : equiv_scope. |
| 85 |
|
| 86 |
Class Contr_internal (A : Type) := BuildContr { |
| 87 |
center : A ; |
| 88 |
contr : (forall y : A, center = y) |
| 89 |
}. |
| 90 |
|
| 91 |
Inductive trunc_index : Type := |
| 92 |
| minus_two : trunc_index |
| 93 |
| trunc_S : trunc_index -> trunc_index. |
| 94 |
|
| 95 |
Notation "n .+1" := (trunc_S n) (at level 2, left associativity, format "n .+1") : trunc_scope. |
| 96 |
Local Open Scope trunc_scope. |
| 97 |
Notation "-2" := minus_two (at level 0) : trunc_scope. |
| 98 |
Notation "-1" := (-2.+1) (at level 0) : trunc_scope. |
| 99 |
|
| 100 |
Fixpoint IsTrunc_internal (n : trunc_index) (A : Type) : Type := |
| 101 |
match n with |
| 102 |
| -2 => Contr_internal A |
| 103 |
| n'.+1 => forall (x y : A), IsTrunc_internal n' (x = y) |
| 104 |
end. |
| 105 |
|
| 106 |
Class IsTrunc (n : trunc_index) (A : Type) : Type := |
| 107 |
Trunc_is_trunc : IsTrunc_internal n A. |
| 108 |
Notation IsHProp := (IsTrunc -1). |
| 109 |
|
| 110 |
Monomorphic Axiom dummy_funext_type : Type0. |
| 111 |
Monomorphic Class Funext := { dummy_funext_value : dummy_funext_type }. |
| 112 |
|
| 113 |
Local Open Scope path_scope. |
| 114 |
|
| 115 |
Definition concat_p1 {A : Type} {x y : A} (p : x = y) : |
| 116 |
p @ 1 = p |
| 117 |
:= |
| 118 |
match p with idpath => 1 end. |
| 119 |
|
| 120 |
Definition concat_1p {A : Type} {x y : A} (p : x = y) : |
| 121 |
1 @ p = p |
| 122 |
:= |
| 123 |
match p with idpath => 1 end. |
| 124 |
|
| 125 |
Definition concat_p_pp {A : Type} {x y z t : A} (p : x = y) (q : y = z) (r : z = t) : |
| 126 |
p @ (q @ r) = (p @ q) @ r := |
| 127 |
match r with idpath => |
| 128 |
match q with idpath => |
| 129 |
match p with idpath => 1 |
| 130 |
end end end. |
| 131 |
|
| 132 |
Definition concat_pp_p {A : Type} {x y z t : A} (p : x = y) (q : y = z) (r : z = t) : |
| 133 |
(p @ q) @ r = p @ (q @ r) := |
| 134 |
match r with idpath => |
| 135 |
match q with idpath => |
| 136 |
match p with idpath => 1 |
| 137 |
end end end. |
| 138 |
|
| 139 |
Definition moveL_Mp {A : Type} {x y z : A} (p : x = z) (q : y = z) (r : y = x) : |
| 140 |
r^ @ q = p -> q = r @ p. |
| 141 |
admit. |
| 142 |
Defined. |
| 143 |
|
| 144 |
Ltac with_rassoc tac := |
| 145 |
repeat rewrite concat_pp_p; |
| 146 |
tac; |
| 147 |
|
| 148 |
repeat rewrite concat_p_pp. |
| 149 |
|
| 150 |
Ltac rewrite_moveL_Mp_p := with_rassoc ltac:(apply moveL_Mp). |
| 151 |
|
| 152 |
Definition ap_p_pp {A B : Type} (f : A -> B) {w : B} {x y z : A} |
| 153 |
(r : w = f x) (p : x = y) (q : y = z) : |
| 154 |
r @ (ap f (p @ q)) = (r @ ap f p) @ (ap f q). |
| 155 |
admit. |
| 156 |
Defined. |
| 157 |
|
| 158 |
Definition ap_compose {A B C : Type} (f : A -> B) (g : B -> C) {x y : A} (p : x = y) : |
| 159 |
ap (g o f) p = ap g (ap f p) |
| 160 |
:= |
| 161 |
match p with idpath => 1 end. |
| 162 |
|
| 163 |
Definition concat_Ap {A B : Type} {f g : A -> B} (p : forall x, f x = g x) {x y : A} (q : x = y) : |
| 164 |
(ap f q) @ (p y) = (p x) @ (ap g q) |
| 165 |
:= |
| 166 |
match q with |
| 167 |
| idpath => concat_1p _ @ ((concat_p1 _) ^) |
| 168 |
end. |
| 169 |
|
| 170 |
Definition transportD2 {A : Type} (B C : A -> Type) (D : forall a:A, B a -> C a -> Type) |
| 171 |
{x1 x2 : A} (p : x1 = x2) (y : B x1) (z : C x1) (w : D x1 y z) |
| 172 |
: D x2 (p # y) (p # z) |
| 173 |
:= |
| 174 |
match p with idpath => w end. |
| 175 |
Local Open Scope equiv_scope. |
| 176 |
|
| 177 |
Definition transport_arrow_toconst {A : Type} {B : A -> Type} {C : Type} |
| 178 |
{x1 x2 : A} (p : x1 = x2) (f : B x1 -> C) (y : B x2) |
| 179 |
: (transport (fun x => B x -> C) p f) y = f (p^ # y). |
| 180 |
admit. |
| 181 |
Defined. |
| 182 |
|
| 183 |
Definition transport_arrow_fromconst {A B : Type} {C : A -> Type} |
| 184 |
{x1 x2 : A} (p : x1 = x2) (f : B -> C x1) (y : B) |
| 185 |
: (transport (fun x => B -> C x) p f) y = p # (f y). |
| 186 |
admit. |
| 187 |
Defined. |
| 188 |
|
| 189 |
Definition ap_transport_arrow_toconst {A : Type} {B : A -> Type} {C : Type} |
| 190 |
{x1 x2 : A} (p : x1 = x2) (f : B x1 -> C) {y1 y2 : B x2} (q : y1 = y2) |
| 191 |
: ap (transport (fun x => B x -> C) p f) q |
| 192 |
@ transport_arrow_toconst p f y2 |
| 193 |
= transport_arrow_toconst p f y1 |
| 194 |
@ ap (fun y => f (p^ # y)) q. |
| 195 |
admit. |
| 196 |
Defined. |
| 197 |
|
| 198 |
Class Univalence. |
| 199 |
Definition path_universe {A B : Type} (f : A -> B) {feq : IsEquiv f} : (A = B). |
| 200 |
admit. |
| 201 |
Defined. |
| 202 |
Definition transport_path_universe |
| 203 |
{A B : Type} (f : A -> B) {feq : IsEquiv f} (z : A) |
| 204 |
: transport (fun X:Type => X) (path_universe f) z = f z. |
| 205 |
admit. |
| 206 |
Defined. |
| 207 |
Definition transport_path_universe_V `{Funext} |
| 208 |
{A B : Type} (f : A -> B) {feq : IsEquiv f} (z : B) |
| 209 |
: transport (fun X:Type => X) (path_universe f)^ z = f^-1 z. |
| 210 |
admit. |
| 211 |
Defined. |
| 212 |
|
| 213 |
Ltac simpl_do_clear tac term := |
| 214 |
let H := fresh in |
| 215 |
assert (H := term); |
| 216 |
simpl in H |- *; |
| 217 |
tac H; |
| 218 |
clear H. |
| 219 |
|
| 220 |
Tactic Notation "simpl" "rewrite" constr(term) := simpl_do_clear ltac:(fun H => rewrite H) term. |
| 221 |
|
| 222 |
Global Instance Univalence_implies_Funext `{Univalence} : Funext. |
| 223 |
Admitted. |
| 224 |
|
| 225 |
Section Factorization. |
| 226 |
|
| 227 |
Context {class1 class2 : forall (X Y : Type@{i}), (X -> Y) -> Type@{i}} |
| 228 |
`{forall (X Y : Type@{i}) (g:X->Y), IsHProp (class1 _ _ g)} |
| 229 |
`{forall (X Y : Type@{i}) (g:X->Y), IsHProp (class2 _ _ g)} |
| 230 |
{A B : Type@{i}} {f : A -> B}. |
| 231 |
|
| 232 |
Record Factorization := |
| 233 |
{ intermediate : Type ; |
| 234 |
factor1 : A -> intermediate ; |
| 235 |
factor2 : intermediate -> B ; |
| 236 |
fact_factors : factor2 o factor1 == f ; |
| 237 |
inclass1 : class1 _ _ factor1 ; |
| 238 |
inclass2 : class2 _ _ factor2 |
| 239 |
}. |
| 240 |
|
| 241 |
Record PathFactorization {fact fact' : Factorization} := |
| 242 |
{ path_intermediate : intermediate fact <~> intermediate fact' ; |
| 243 |
path_factor1 : path_intermediate o factor1 fact == factor1 fact' ; |
| 244 |
path_factor2 : factor2 fact == factor2 fact' o path_intermediate ; |
| 245 |
path_fact_factors : forall a, path_factor2 (factor1 fact a) |
| 246 |
@ ap (factor2 fact') (path_factor1 a) |
| 247 |
@ fact_factors fact' a |
| 248 |
= fact_factors fact a |
| 249 |
}. |
| 250 |
Context `{Univalence} {fact fact' : Factorization} |
| 251 |
(pf : @PathFactorization fact fact'). |
| 252 |
|
| 253 |
Let II := path_intermediate pf. |
| 254 |
Let ff1 := path_factor1 pf. |
| 255 |
Let ff2 := path_factor2 pf. |
| 256 |
Local Definition II' : intermediate fact = intermediate fact'. |
| 257 |
admit. |
| 258 |
Defined. |
| 259 |
|
| 260 |
Local Definition fff' (a : A) |
| 261 |
: (transportD2 (fun X => A -> X) (fun X => X -> B) |
| 262 |
(fun X g h => {_ : forall a : A, h (g a) = f a & |
| 263 |
{_ : class1 A X g & class2 X B h}}) |
| 264 |
II' (factor1 fact) (factor2 fact) |
| 265 |
(fact_factors fact; (inclass1 fact; inclass2 fact))).1 a = |
| 266 |
ap (transport (fun X => X -> B) II' (factor2 fact)) |
| 267 |
(transport_arrow_fromconst II' (factor1 fact) a |
| 268 |
@ transport_path_universe II (factor1 fact a) |
| 269 |
@ ff1 a) |
| 270 |
@ transport_arrow_toconst II' (factor2 fact) (factor1 fact' a) |
| 271 |
@ ap (factor2 fact) (transport_path_universe_V II (factor1 fact' a)) |
| 272 |
@ ff2 (II^-1 (factor1 fact' a)) |
| 273 |
@ ap (factor2 fact') (eisretr II (factor1 fact' a)) |
| 274 |
@ fact_factors fact' a. |
| 275 |
Proof. |
| 276 |
|
| 277 |
Open Scope long_path_scope. |
| 278 |
|
| 279 |
rewrite (ap_transport_arrow_toconst (B := idmap) (C := B)). |
| 280 |
|
| 281 |
simpl rewrite (@ap_compose _ _ _ (transport idmap (path_universe II)^) |
| 282 |
(factor2 fact)). |
| 283 |
rewrite <- ap_p_pp; rewrite_moveL_Mp_p. |
| 284 |
Set Debug Tactic Unification. |
| 285 |
rewrite (concat_Ap ff2). |
| 286 |
Abort. |
| 287 |
|
| 288 |
End Factorization. |