Debian Codegraph @

test-suite/bugs/HoTT_coq_058.v

raw
1 Require Import TestSuite.admit.
2 (* File reduced by coq-bug-finder from 10044 lines to 493 lines, then from 425 lines to 160 lines. *)
3 Set Universe Polymorphism.
4 Notation idmap := (fun x => x).
5 Notation "( x ; y )" := (existT _ x y) : fibration_scope.
6 Open Scope fibration_scope.
7 Notation "x .1" := (projT1 x) : fibration_scope.
8 Inductive paths {A : Type} (a : A) : A -> Type :=
9 idpath : paths a a.
10 Arguments idpath {A a} , [A] a.
11 Scheme Rewriting for paths.
12 Notation "x = y :> A" := (@paths A x y) : type_scope.
13 Notation "x = y" := (x = y :>_) : type_scope.
14 Delimit Scope path_scope with path.
15 Local Open Scope path_scope.
16
17 Definition transport {A : Type} (P : A -> Type) {x y : A} (p : x = y) (u : P x) : P y :=
18 match p with idpath => u end.
19
20 Definition ap {A B:Type} (f:A -> B) {x y:A} (p:x = y) : f x = f y
21 := match p with idpath => idpath end.
22
23 Definition apD10 {A} {B:A->Type} {f g : forall x, B x} (h:f=g)
24 : forall x, f x = g x
25 := fun x => match h with idpath => idpath end.
26
27 Class IsEquiv {A B : Type} (f : A -> B) := BuildIsEquiv { equiv_inv : B -> A }.
28
29 Delimit Scope equiv_scope with equiv.
30 Local Open Scope equiv_scope.
31
32 Notation "f ^-1" := (@equiv_inv _ _ f _) (at level 3) : equiv_scope.
33
34 Class Funext := { isequiv_apD10 :: forall (A : Type) (P : A -> Type) f g, IsEquiv (@apD10 A P f g) }.
35
36 Definition path_forall `{Funext} {A : Type} {P : A -> Type} (f g : forall x : A, P x) :
37 (forall x, f x = g x) -> f = g
38 := (@apD10 A P f g)^-1.
39
40 Inductive Unit : Set :=
41 tt : Unit.
42
43 Definition path_prod_uncurried {A B : Type} (z z' : A * B)
44 (pq : (fst z = fst z') * (snd z = snd z'))
45 : (z = z')
46 := match pq with (p,q) =>
47 match z, z' return
48 (fst z = fst z') -> (snd z = snd z') -> (z = z') with
49 | (a,b), (a',b') => fun p q =>
50 match p, q with
51 idpath, idpath => idpath
52 end
53 end p q
54 end.
55
56 Definition path_prod {A B : Type} (z z' : A * B) :
57 (fst z = fst z') -> (snd z = snd z') -> (z = z')
58 := fun p q => path_prod_uncurried z z' (p,q).
59
60 Definition path_prod' {A B : Type} {x x' : A} {y y' : B}
61 : (x = x') -> (y = y') -> ((x,y) = (x',y'))
62 := fun p q => path_prod (x,y) (x',y') p q.
63
64 Lemma path_forall_recr_beta `{Funext} A B x0 P f g e Px
65 : @transport (forall a : A, B a)
66 (fun f => P f (f x0))
67 f
68 g
69 (@path_forall _ _ _ _ _ e)
70 Px
71 = @transport ((forall a, B a) * B x0)%type
72 (fun x => P (fst x) (snd x))
73 (f, f x0)
74 (g, g x0)
75 (path_prod' (@path_forall _ _ _ _ _ e) (e x0))
76 Px.
77
78 admit.
79 Defined.
80 Definition transport_path_prod'_beta' A B P (x x' : A) (y y' : B) (HA : x = x') (HB : y = y') (Px : P x y)
81 : @transport (A * B) (fun xy => P (fst xy) (snd xy)) (x, y) (x', y') (@path_prod' A B x x' y y' HA HB) Px
82 = @transport A (fun x => P x y') x x' HA
83 (@transport B (fun y => P x y) y y' HB Px).
84 admit.
85 Defined.
86 Goal forall (T : Type) (T0 : T -> T -> Type)
87 (Pmor : forall s d : T, T0 s d -> Type) (x x0 : T)
88 (x1 : T0 x x0) (p : Pmor x x0 x1) (H : Funext),
89 transport
90 (fun x2 : {_ : T & Unit} -> {_ : T & Unit} =>
91 { x1 : _ & Pmor (x2 (x; tt)) .1 (x2 (x0; tt)) .1 x1})
92 (path_forall (fun c : {_ : T & Unit} => (c .1; tt)) idmap
93 (fun x2 : {_ : T & Unit} =>
94 let (x3, y) as s return ((s .1; tt) = s) := x2 in
95 match y as y0 return ((x3; tt) = (x3; y0)) with
96 | tt => idpath
97 end)) (x1; p) = (x1; p).
98 intros.
99 let F := match goal with |- context[@transport _ (fun x0 => @?F x0) _ _ (@path_forall ?H ?X ?T ?f ?g ?e)] => constr:(F) end in
100 let H := match goal with |- context[@transport _ (fun x0 => @?F x0) _ _ (@path_forall ?H ?X ?T ?f ?g ?e)] => constr:(H) end in
101 let X := match goal with |- context[@transport _ (fun x0 => @?F x0) _ _ (@path_forall ?H ?X ?T ?f ?g ?e)] => constr:(X) end in
102 let T := match goal with |- context[@transport _ (fun x0 => @?F x0) _ _ (@path_forall ?H ?X ?T ?f ?g ?e)] => constr:(T) end in
103 let t0 := fresh "t0" in
104 let t1 := fresh "t1" in
105 let T1 := lazymatch type of F with (?T -> _) -> _ => constr:(T) end in
106 evar (t1 : T1);
107 let T0 := lazymatch type of F with (forall a : ?A, @?B a) -> ?C => constr:((forall a : A, B a) -> B t1 -> C) end in
108 evar (t0 : T0);
109
110 let dummy := fresh in
111 assert (dummy : forall x0, F x0 = t0 x0 (x0 t1));
112 [ let x0 := fresh in
113 intro x0;
114 simpl in *;
115 let GL0 := lazymatch goal with |- ?GL0 = _ => constr:(GL0) end in
116 let GL0' := fresh in
117 let GL1' := fresh in
118 set (GL0' := GL0);
119
120 let arg := match GL0 with context[x0 ?arg] => constr:(arg) end in
121 assert (t1 = arg) by (subst t1; reflexivity); subst t1;
122 pattern (x0 arg) in GL0';
123 match goal with
124 | [ GL0'' := ?GR _ |- _ ] => constr_eq GL0' GL0'';
125 pose GR as GL1'
126 end;
127
128 pattern x0 in GL1';
129 match goal with
130 | [ GL1'' := ?GR _ |- _ ] => constr_eq GL1' GL1'';
131 assert (t0 = GR)
132 end;
133 subst t0; [ reflexivity | reflexivity ]
134 | clear dummy ];
135 let p := fresh in
136 pose (@path_forall_recr_beta H X T t1 t0) as p;
137 simpl in *;
138 rewrite p;
139 subst t0 t1 p.
140 rewrite transport_path_prod'_beta'.
141 (* Anomaly: Uncaught exception Invalid_argument("to_constraints: non-trivial algebraic constraint between universes", _).
142 Please report. *)
143 Abort.