Debian Codegraph @

test-suite/bugs/bug_3427.v

raw
1 Require Import TestSuite.admit.
2 (* -*- mode: coq; coq-prog-args: ("-indices-matter") -*- *)
3 (* File reduced by coq-bug-finder from original input, then from 0 lines to 7171 lines, then from 7184 lines to 558 lines, then from 556 lines to 209 lines *)
4 Generalizable All Variables.
5 Set Universe Polymorphism.
6 Notation Type0 := Set.
7 Notation idmap := (fun x => x).
8 Definition compose {A B C : Type} (g : B -> C) (f : A -> B) := fun x => g (f x).
9 Notation "g 'o' f" := (compose g f) (at level 40, left associativity) : function_scope.
10 Open Scope function_scope.
11 Inductive paths {A : Type} (a : A) : A -> Type := idpath : paths a a where "x = y" := (@paths _ x y) : type_scope.
12 Arguments idpath {A a} , [A] a.
13 Delimit Scope path_scope with path.
14 Local Open Scope path_scope.
15 Definition concat {A : Type} {x y z : A} (p : x = y) (q : y = z) : x = z := match p, q with idpath, idpath => idpath end.
16 Definition inverse {A : Type} {x y : A} (p : x = y) : y = x := match p with idpath => idpath end.
17 Notation "1" := idpath : path_scope.
18 Notation "p @ q" := (concat p q) (at level 20) : path_scope.
19 Notation "p ^" := (inverse p) (at level 3) : path_scope.
20 Definition transport {A : Type} (P : A -> Type) {x y : A} (p : x = y) (u : P x) : P y := match p with idpath => u end.
21 Notation "p # x" := (transport _ p x) (right associativity, at level 65, only parsing) : path_scope.
22 Definition ap {A B:Type} (f:A -> B) {x y:A} (p:x = y) : f x = f y := match p with idpath => idpath end.
23 Definition pointwise_paths {A} {P:A->Type} (f g:forall x:A, P x) := forall x:A, f x = g x.
24 Notation "f == g" := (pointwise_paths f g) (at level 70, no associativity) : type_scope.
25 Definition apD10 {A} {B:A->Type} {f g : forall x, B x} (h:f=g) : forall x, f x = g x := fun x => match h with idpath => idpath end.
26 Definition Sect {A B : Type} (s : A -> B) (r : B -> A) := forall x : A, r (s x) = x.
27 Class IsEquiv {A B : Type} (f : A -> B) := BuildIsEquiv {
28 equiv_inv : B -> A ;
29 eisretr : Sect equiv_inv f;
30 eissect : Sect f equiv_inv;
31 eisadj : forall x : A, eisretr (f x) = ap f (eissect x)
32 }.
33 Record Equiv A B := BuildEquiv {
34 equiv_fun :> A -> B ;
35 equiv_isequiv :> IsEquiv equiv_fun
36 }.
37
38 Delimit Scope equiv_scope with equiv.
39
40 Notation "A <~> B" := (Equiv A B) (at level 85) : equiv_scope.
41
42 Notation "f ^-1" := (@equiv_inv _ _ f _) (at level 3) : equiv_scope.
43
44 Class Contr_internal (A : Type) := BuildContr {
45 center : A ;
46 contr : (forall y : A, center = y)
47 }.
48
49 Inductive trunc_index : Type :=
50 | minus_two : trunc_index
51 | trunc_S : trunc_index -> trunc_index.
52
53 Fixpoint nat_to_trunc_index (n : nat) : trunc_index
54 := match n with
55 | 0 => trunc_S (trunc_S minus_two)
56 | S n' => trunc_S (nat_to_trunc_index n')
57 end.
58
59 Coercion nat_to_trunc_index : nat >-> trunc_index.
60
61 Fixpoint IsTrunc_internal (n : trunc_index) (A : Type) : Type :=
62 match n with
63 | minus_two => Contr_internal A
64 | trunc_S n' => forall (x y : A), IsTrunc_internal n' (x = y)
65 end.
66
67 Notation minus_one:=(trunc_S minus_two).
68
69 Class IsTrunc (n : trunc_index) (A : Type) : Type :=
70 Trunc_is_trunc : IsTrunc_internal n A.
71
72 Notation Contr := (IsTrunc minus_two).
73 Notation IsHProp := (IsTrunc minus_one).
74 Notation IsHSet := (IsTrunc 0).
75
76 Class Funext :=
77 { isequiv_apD10 :: forall (A : Type) (P : A -> Type) f g, IsEquiv (@apD10 A P f g) }.
78
79 Definition concat_pV {A : Type} {x y : A} (p : x = y) :
80 p @ p^ = 1
81 :=
82 match p with idpath => 1 end.
83
84 Definition concat_Vp {A : Type} {x y : A} (p : x = y) :
85 p^ @ p = 1
86 :=
87 match p with idpath => 1 end.
88
89 Definition transport_pp {A : Type} (P : A -> Type) {x y z : A} (p : x = y) (q : y = z) (u : P x) :
90 p @ q # u = q # p # u :=
91 match q with idpath =>
92 match p with idpath => 1 end
93 end.
94
95 Definition transport2 {A : Type} (P : A -> Type) {x y : A} {p q : x = y}
96 (r : p = q) (z : P x)
97 : p # z = q # z
98 := ap (fun p' => p' # z) r.
99
100 Inductive Unit : Type0 :=
101 tt : Unit.
102
103 #[export] Instance contr_unit : Contr Unit | 0 := let x := {|
104 center := tt;
105 contr := fun t : Unit => match t with tt => 1 end
106 |} in x.
107
108 #[export] Instance trunc_succ `{IsTrunc n A} : IsTrunc (trunc_S n) A | 1000.
109 admit.
110 Defined.
111
112 Record hProp := hp { hproptype :> Type ; isp : IsHProp hproptype}.
113 Definition Unit_hp:hProp:=(hp Unit _).
114
115 Global Instance isequiv_ap_hproptype `{Funext} X Y : IsEquiv (@ap _ _ hproptype X Y).
116 admit.
117 Defined.
118
119 Definition path_hprop `{Funext} X Y := ((@ap _ _ hproptype X Y)^-1)%equiv.
120
121 Record hSet := BuildhSet {setT:> Type; iss :> IsHSet setT}.
122 Local Open Scope equiv_scope.
123
124 #[export] Instance isequiv_path {A B : Type} (p : A = B)
125 : IsEquiv (transport (fun X:Type => X) p) | 0
126 := BuildIsEquiv _ _ _ (transport (fun X:Type => X) p^)
127 (fun b => ((transport_pp idmap p^ p b)^ @ transport2 idmap (concat_Vp p) b))
128 (fun a => ((transport_pp idmap p p^ a)^ @ transport2 idmap (concat_pV p) a))
129 (fun a => match p in _ = C return
130 (transport_pp idmap p^ p (transport idmap p a))^ @
131 transport2 idmap (concat_Vp p) (transport idmap p a) =
132 ap (transport idmap p) ((transport_pp idmap p p^ a) ^ @
133 transport2 idmap (concat_pV p) a) with idpath => 1 end).
134
135 Definition equiv_path (A B : Type) (p : A = B) : A <~> B
136 := BuildEquiv _ _ (transport (fun X:Type => X) p) _.
137
138 Class Univalence := {
139 isequiv_equiv_path :: forall (A B : Type), IsEquiv (equiv_path A B)
140 }.
141
142 Section Univalence.
143 Context `{Univalence}.
144
145 Definition path_universe_uncurried {A B : Type} (f : A <~> B) : A = B
146 := (equiv_path A B)^-1 f.
147 End Univalence.
148
149 Inductive minus1Trunc (A :Type) : Type :=
150 min1 : A -> minus1Trunc A.
151
152 #[export] Instance minus1Trunc_is_prop {A : Type} : IsHProp (minus1Trunc A) | 0.
153 admit.
154 Defined.
155
156 Definition hexists {X} (P:X->Type):Type:= minus1Trunc (sigT P).
157
158 Section AssumingUA.
159
160 Definition isepi {X Y} `(f:X->Y) := forall Z: hSet,
161 forall g h: Y -> Z, g o f = h o f -> g = h.
162 Context {X Y : hSet} (f : X -> Y) (Hisepi : isepi f).
163
164 Goal forall (X Y : hSet) (f : forall _ : setT X, setT Y),
165 let fib :=
166 fun y : setT Y =>
167 hp (@hexists (setT X) (fun x : setT X => @paths (setT Y) (f x) y))
168 (@minus1Trunc_is_prop
169 (@sigT (setT X) (fun x : setT X => @paths (setT Y) (f x) y))) in
170 forall (x : setT X) (_ : Univalence) (_ : Funext),
171 @paths hProp (fib (f x)) Unit_hp.
172 intros.
173
174 apply path_hprop.
175 simpl.
176 Set Printing Universes.
177 Set Printing All.
178 refine (path_universe_uncurried _).
179 Undo.
180 apply path_universe_uncurried. (* Toplevel input, characters 21-44:
181 Error: Refiner was given an argument
182 "@path_universe_uncurried (* Top.425 Top.426 Top.427 Top.428 Top.429 *) X1
183 (@hexists (* Top.405 Top.404 Set Set *) (setT (* Top.405 *) X0)
184 (fun x0 : setT (* Top.405 *) X0 =>
185 @paths (* Top.404 *) (setT (* Top.404 *) Y0) (f0 x0) (f0 x))) Unit
186 ?63" of type
187 "@paths (* Top.428 *) Type (* Top.425 *)
188 (@hexists (* Top.405 Top.404 Set Set *) (setT (* Top.405 *) X0)
189 (fun x0 : setT (* Top.405 *) X0 =>
190 @paths (* Top.404 *) (setT (* Top.404 *) Y0) (f0 x0) (f0 x))) Unit"
191 instead of
192 "@paths (* Top.413 *) Type (* Set *)
193 (@hexists (* Top.405 Top.404 Set Set *) (setT (* Top.405 *) X0)
194 (fun x0 : setT (* Top.405 *) X0 =>
195 @paths (* Top.404 *) (setT (* Top.404 *) Y0) (f0 x0) (f0 x))) Unit".
196 *)
197 Abort.
198 End AssumingUA.