Debian Codegraph @

test-suite/bugs/HoTT_coq_123.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 4988 lines to 856 lines, then from 648 lines to 398 lines, then from 401 lines to 332 lines, then from 287 lines to 250 lines, then from 257 lines to 241 lines, then from 223 lines to 175 lines *)
4 Set Universe Polymorphism.
5 Set Asymmetric Patterns.
6 Reserved Notation "g 'o' f" (at level 40, left associativity).
7 Generalizable All Variables.
8 Definition admit {T} : T.
9 Admitted.
10 Inductive paths {A : Type} (a : A) : A -> Type :=
11 idpath : paths a a.
12 Arguments idpath {A a} , [A] a.
13 Notation "x = y" := (@paths _ x y) : type_scope.
14 Definition pointwise_paths {A} {P:A->Type} (f g:forall x:A, P x) : Type
15 := forall x:A, f x = g x.
16 #[export] Hint Unfold pointwise_paths : typeclass_instances.
17 Notation "f == g" := (pointwise_paths f g) (at level 70, no associativity) : type_scope.
18 Definition apD10 {A} {B:A->Type} {f g : forall x, B x} (h:f=g)
19 : forall x, f x = g x
20 := fun x => match h with idpath => idpath end.
21
22 Class IsEquiv {A B : Type} (f : A -> B) := BuildIsEquiv { equiv_inv : B -> A }.
23
24 Record Equiv A B := BuildEquiv { equiv_fun :> A -> B ; equiv_isequiv :> IsEquiv equiv_fun }.
25 Notation "A <~> B" := (Equiv A B) (at level 85) : equiv_scope.
26
27 Notation "f ^-1" := (@equiv_inv _ _ f _) (at level 3) : equiv_scope.
28 Class Contr_internal (A : Type) := {}.
29 Inductive trunc_index : Type :=
30 | minus_two : trunc_index
31 | trunc_S : trunc_index -> trunc_index.
32
33 Fixpoint IsTrunc_internal (n : trunc_index) (A : Type) : Type :=
34 match n with
35 | minus_two => Contr_internal A
36 | trunc_S n' => forall (x y : A), IsTrunc_internal n' (x = y)
37 end.
38
39 Class IsTrunc (n : trunc_index) (A : Type) : Type :=
40 Trunc_is_trunc : IsTrunc_internal n A.
41
42 #[export] Instance istrunc_paths (A : Type) n `{H : IsTrunc (trunc_S n) A} (x y : A)
43 : IsTrunc n (x = y)
44 := H x y.
45
46 Notation IsHSet := (IsTrunc minus_two).
47
48 Class Funext :=
49 { isequiv_apD10 :: forall (A : Type) (P : A -> Type) f g, IsEquiv (@apD10 A P f g) }.
50
51 Local Open Scope equiv_scope.
52
53 Global Instance isequiv_inverse `{IsEquiv A B f} : IsEquiv f^-1 | 10000
54 := BuildIsEquiv B A f^-1 f.
55 #[export] Instance trunc_succ `{IsTrunc n A} : IsTrunc (trunc_S n) A | 1000.
56
57 admit.
58
59 Defined.
60 Definition trunc_equiv `(f : A -> B)
61 `{IsTrunc n A} `{IsEquiv A B f}
62 : IsTrunc n B.
63 admit.
64 Defined.
65 Definition trunc_equiv' `(f : A <~> B) `{IsTrunc n A}
66 : IsTrunc n B
67 := admit.
68 Set Implicit Arguments.
69 Delimit Scope morphism_scope with morphism.
70 Delimit Scope category_scope with category.
71 Delimit Scope object_scope with object.
72 Record PreCategory :=
73 Build_PreCategory {
74 object :> Type;
75 morphism : object -> object -> Type;
76
77 identity : forall x, morphism x x;
78 compose : forall s d d',
79 morphism d d'
80 -> morphism s d
81 -> morphism s d'
82 where "f 'o' g" := (compose f g);
83
84 associativity : forall x1 x2 x3 x4
85 (m1 : morphism x1 x2)
86 (m2 : morphism x2 x3)
87 (m3 : morphism x3 x4),
88 (m3 o m2) o m1 = m3 o (m2 o m1);
89
90 left_identity : forall a b (f : morphism a b), identity b o f = f;
91 right_identity : forall a b (f : morphism a b), f o identity a = f;
92
93 trunc_morphism : forall s d, IsHSet (morphism s d)
94 }.
95 #[export] Existing Instance trunc_morphism.
96
97 Infix "o" := (@compose _ _ _ _) : morphism_scope.
98 Delimit Scope functor_scope with functor.
99
100 Local Open Scope morphism_scope.
101 Record Functor (C D : PreCategory) :=
102 {
103 object_of :> C -> D;
104 morphism_of : forall s d, morphism C s d -> morphism D (object_of s) (object_of d)
105 }.
106
107 (** Workaround to simpl losing universe constraints, see bug #5645. *)
108 Ltac simpl' :=
109 simpl; match goal with [ |- ?P ] => let T := type of P in idtac end.
110
111 Global Instance trunc_forall `{Funext} `{P : A -> Type} `{forall a, IsTrunc n (P a)}
112 : IsTrunc n (forall a, P a) | 100.
113 Proof.
114 generalize dependent P.
115 induction n as [ | n' IH]; (simpl'; intros P ?).
116 - admit.
117 - pose (fun f g => trunc_equiv (@apD10 A P f g) ^-1); admit.
118 Defined.
119 #[export] Instance trunc_sigma `{P : A -> Type}
120 `{IsTrunc n A} `{forall a, IsTrunc n (P a)}
121 : IsTrunc n (sigT P) | 100.
122 admit.
123 Defined.
124 Record NaturalTransformation C D (F G : Functor C D) :=
125 Build_NaturalTransformation' {
126 components_of :> forall c, morphism D (F c) (G c)
127 }.
128 Section path_natural_transformation.
129 Context `{Funext}.
130 Variable C : PreCategory.
131 Variable D : PreCategory.
132 Variables F G : Functor C D.
133 Lemma equiv_sig_natural_transformation
134 : { CO : forall x, morphism D (F x) (G x)
135 & forall s d (m : morphism C s d),
136 CO d o morphism_of F _ _ m = morphism_of G _ _ m o CO s }
137 <~> NaturalTransformation F G.
138
139 admit.
140 Defined.
141 Global Instance trunc_natural_transformation
142 : IsHSet (NaturalTransformation F G).
143 Proof.
144 eapply trunc_equiv'; [ exact equiv_sig_natural_transformation | ].
145 typeclasses eauto.
146 Qed.
147 Lemma path_natural_transformation (T U : NaturalTransformation F G)
148 : components_of T == components_of U
149 -> T = U.
150 admit.
151 Defined.
152 End path_natural_transformation.
153 Ltac path_natural_transformation :=
154 repeat match goal with
155 | _ => intro
156 | _ => apply path_natural_transformation; simpl
157 end.
158
159 Section FunctorSectionCategory.
160 Context `{Funext}.
161 Variable C : PreCategory.
162 Variable D : PreCategory.
163
164 Definition category_of_sections : PreCategory.
165 Proof.
166 refine (@Build_PreCategory
167 (Functor D C)
168 (fun F G => NaturalTransformation F G)
169 admit
170 admit
171 _
172 _
173 _
174 _);
175 abstract (path_natural_transformation; admit).
176 Defined. (* Stack overflow *)
177 End FunctorSectionCategory.