Debian Codegraph @

test-suite/bugs/HoTT_coq_029.v

raw
1 Require Import TestSuite.admit.
2 Module FirstComment.
3 Set Implicit Arguments.
4 Generalizable All Variables.
5 Set Asymmetric Patterns.
6 Set Universe Polymorphism.
7
8 Reserved Notation "x # y" (at level 40, left associativity).
9 Reserved Notation "x #m y" (at level 40, left associativity).
10
11 Delimit Scope object_scope with object.
12 Delimit Scope morphism_scope with morphism.
13 Delimit Scope category_scope with category.
14
15 Record Category (obj : Type) :=
16 {
17 Object :> _ := obj;
18 Morphism : obj -> obj -> Type;
19
20 Identity : forall x, Morphism x x;
21 Compose : forall s d d', Morphism d d' -> Morphism s d -> Morphism s d'
22 }.
23
24 Bind Scope object_scope with Object.
25 Bind Scope morphism_scope with Morphism.
26
27 Arguments Object {obj%_type} C%_category / : rename.
28 Arguments Morphism {obj%_type} !C%_category s d : rename. (* , simpl nomatch. *)
29 Arguments Identity {obj%_type} [!C%_category] x%_object : rename.
30 Arguments Compose {obj%_type} [!C%_category s%_object d%_object d'%_object] m1%_morphism m2%_morphism : rename.
31
32 Bind Scope category_scope with Category.
33
34 Record Functor
35 `(C : @Category objC)
36 `(D : @Category objD)
37 := {
38 ObjectOf :> objC -> objD;
39 MorphismOf : forall s d, C.(Morphism) s d -> D.(Morphism) (ObjectOf s) (ObjectOf d)
40 }.
41
42 Record NaturalTransformation
43 `(C : @Category objC)
44 `(D : @Category objD)
45 (F G : Functor C D)
46 := {
47 ComponentsOf :> forall c, D.(Morphism) (F c) (G c)
48 }.
49
50 Definition ProductCategory
51 `(C : @Category objC)
52 `(D : @Category objD)
53 : @Category (objC * objD)%type.
54 refine (@Build_Category _
55 (fun s d => (C.(Morphism) (fst s) (fst d) * D.(Morphism) (snd s) (snd d))%type)
56 (fun o => (Identity (fst o), Identity (snd o)))
57 (fun s d d' m2 m1 => (Compose (fst m2) (fst m1), Compose (snd m2) (snd m1)))).
58
59 Defined.
60
61 Infix "*" := ProductCategory : category_scope.
62
63 Record IsomorphismOf `{C : @Category objC} {s d} (m : C.(Morphism) s d) :=
64 {
65 IsomorphismOf_Morphism :> C.(Morphism) s d := m;
66 Inverse : C.(Morphism) d s
67 }.
68
69 Record NaturalIsomorphism
70 `(C : @Category objC)
71 `(D : @Category objD)
72 (F G : Functor C D)
73 := {
74 NaturalIsomorphism_Transformation :> NaturalTransformation F G;
75 NaturalIsomorphism_Isomorphism : forall x : objC, IsomorphismOf (NaturalIsomorphism_Transformation x)
76 }.
77
78 Section PreMonoidalCategory.
79 Context `(C : @Category objC).
80
81 Variable TensorProduct : Functor (C * C) C.
82
83 Let src {C : @Category objC} {s d} (_ : Morphism C s d) := s.
84 Let dst {C : @Category objC} {s d} (_ : Morphism C s d) := d.
85
86 Local Notation "A # B" := (TensorProduct (A, B)).
87 Local Notation "A #m B" := (TensorProduct.(MorphismOf) ((@src _ _ _ A, @src _ _ _ B)) ((@dst _ _ _ A, @dst _ _ _ B)) (A, B)%morphism).
88
89 Let TriMonoidalProductL_ObjectOf (abc : C * C * C) : C :=
90 (fst (fst abc) # snd (fst abc)) # snd abc.
91
92 Let TriMonoidalProductR_ObjectOf (abc : C * C * C) : C :=
93 fst (fst abc) # (snd (fst abc) # snd abc).
94
95 Let TriMonoidalProductL_MorphismOf (s d : C * C * C) (m : Morphism (C * C * C) s d) :
96 Morphism C (TriMonoidalProductL_ObjectOf s) (TriMonoidalProductL_ObjectOf d).
97 Admitted.
98
99 Let TriMonoidalProductR_MorphismOf (s d : C * C * C) (m : Morphism (C * C * C) s d) :
100 Morphism C (TriMonoidalProductR_ObjectOf s) (TriMonoidalProductR_ObjectOf d).
101 Admitted.
102
103 Definition TriMonoidalProductL : Functor (C * C * C) C.
104 refine (Build_Functor (C * C * C) C
105 TriMonoidalProductL_ObjectOf
106 TriMonoidalProductL_MorphismOf).
107 Defined.
108
109 Definition TriMonoidalProductR : Functor (C * C * C) C.
110 refine (Build_Functor (C * C * C) C
111 TriMonoidalProductR_ObjectOf
112 TriMonoidalProductR_MorphismOf).
113 Defined.
114
115 Variable Associator : NaturalIsomorphism TriMonoidalProductL TriMonoidalProductR.
116
117 Section AssociatorCoherenceCondition.
118 Variables a b c d : C.
119
120 (* going from top-left *)
121 Let AssociatorCoherenceConditionT0 : Morphism C (((a # b) # c) # d) ((a # (b # c)) # d)
122 := Associator (a, b, c) #m Identity (C := C) d.
123 Let AssociatorCoherenceConditionT1 : Morphism C ((a # (b # c)) # d) (a # ((b # c) # d))
124 := Associator (a, b # c, d).
125 Let AssociatorCoherenceConditionT2 : Morphism C (a # ((b # c) # d)) (a # (b # (c # d)))
126 := Identity (C := C) a #m Associator (b, c, d).
127 Let AssociatorCoherenceConditionB0 : Morphism C (((a # b) # c) # d) ((a # b) # (c # d))
128 := Associator (a # b, c, d).
129 Let AssociatorCoherenceConditionB1 : Morphism C ((a # b) # (c # d)) (a # (b # (c # d)))
130 := Associator (a, b, c # d).
131
132 Definition AssociatorCoherenceCondition' :=
133 Compose AssociatorCoherenceConditionT2 (Compose AssociatorCoherenceConditionT1 AssociatorCoherenceConditionT0)
134 = Compose AssociatorCoherenceConditionB1 AssociatorCoherenceConditionB0.
135 End AssociatorCoherenceCondition.
136
137 Definition AssociatorCoherenceCondition := Eval unfold AssociatorCoherenceCondition' in
138 forall a b c d : C, AssociatorCoherenceCondition' a b c d.
139 End PreMonoidalCategory.
140
141 Section MonoidalCategory.
142 Variable objC : Type.
143
144 Let AssociatorCoherenceCondition' := Eval unfold AssociatorCoherenceCondition in @AssociatorCoherenceCondition.
145
146 Record MonoidalCategory :=
147 {
148 MonoidalUnderlyingCategory :> @Category objC;
149 TensorProduct : Functor (MonoidalUnderlyingCategory * MonoidalUnderlyingCategory) MonoidalUnderlyingCategory;
150 IdentityObject : objC;
151 Associator : NaturalIsomorphism (TriMonoidalProductL TensorProduct) (TriMonoidalProductR TensorProduct);
152 AssociatorCoherent : AssociatorCoherenceCondition' Associator
153 }.
154 End MonoidalCategory.
155
156 Section EnrichedCategory.
157 Context `(M : @MonoidalCategory objM).
158 Let x : M := IdentityObject M.
159 (* Anomaly: apply_coercion_args: mismatch between arguments and coercion. Please report. *)
160 End EnrichedCategory.
161 End FirstComment.
162
163 Module SecondComment.
164 Set Implicit Arguments.
165 Set Universe Polymorphism.
166 Generalizable All Variables.
167
168 Record prod (A B : Type) := pair { fst : A; snd : B }.
169 Arguments fst {A B} _.
170 Arguments snd {A B} _.
171 Infix "*" := prod : type_scope.
172 Notation " ( x , y ) " := (@pair _ _ x y).
173 Record Category (obj : Type) :=
174 Build_Category {
175 Object :> _ := obj;
176 Morphism : obj -> obj -> Type;
177
178 Identity : forall x, Morphism x x;
179 Compose : forall s d d', Morphism d d' -> Morphism s d -> Morphism s d'
180 }.
181
182 Arguments Identity {obj%_type} [!C] x : rename.
183 Arguments Compose {obj%_type} [!C s d d'] m1 m2 : rename.
184
185 Record > Category' :=
186 {
187 LSObject : Type;
188
189 LSUnderlyingCategory :> @Category LSObject
190 }.
191
192 Section Functor.
193 Context `(C : @Category objC).
194 Context `(D : @Category objD).
195
196
197 Record Functor :=
198 {
199 ObjectOf :> objC -> objD;
200 MorphismOf : forall s d, C.(Morphism) s d -> D.(Morphism) (ObjectOf s) (ObjectOf d)
201 }.
202 End Functor.
203
204 Arguments MorphismOf {objC%_type} [C] {objD%_type} [D] F [s d] m : rename, simpl nomatch.
205
206 Section FunctorComposition.
207 Context `(C : @Category objC).
208 Context `(D : @Category objD).
209 Context `(E : @Category objE).
210
211 Definition ComposeFunctors (G : Functor D E) (F : Functor C D) : Functor C E.
212 Admitted.
213 End FunctorComposition.
214
215 Section IdentityFunctor.
216 Context `(C : @Category objC).
217
218
219 Definition IdentityFunctor : Functor C C.
220 refine {| ObjectOf := (fun x => x);
221 MorphismOf := (fun _ _ x => x)
222 |}.
223 Defined.
224 End IdentityFunctor.
225
226 Section ProductCategory.
227 Context `(C : @Category objC).
228 Context `(D : @Category objD).
229
230 Definition ProductCategory : @Category (objC * objD)%type.
231 refine (@Build_Category _
232 (fun s d => (C.(Morphism) (fst s) (fst d) * D.(Morphism) (snd s) (snd d))%type)
233 (fun o => (Identity (fst o), Identity (snd o)))
234 (fun s d d' m2 m1 => (Compose (fst m2) (fst m1), Compose (snd m2) (snd m1)))).
235 Defined.
236 End ProductCategory.
237
238 Definition OppositeCategory `(C : @Category objC) : Category objC :=
239 @Build_Category objC
240 (fun s d => Morphism C d s)
241 (Identity (C := C))
242 (fun _ _ _ m1 m2 => Compose m2 m1).
243
244 Parameter FunctorCategory : forall `(C : @Category objC) `(D : @Category objD), @Category (Functor C D).
245
246 Parameter TerminalCategory : Category unit.
247
248 Section ComputableCategory.
249 Variable I : Type.
250 Variable Index2Object : I -> Type.
251 Variable Index2Cat : forall i : I, @Category (@Index2Object i).
252
253 Local Coercion Index2Cat : I >-> Category.
254
255 Definition ComputableCategory : @Category I.
256 refine (@Build_Category _
257 (fun C D : I => Functor C D)
258 (fun o : I => IdentityFunctor o)
259 (fun C D E : I => ComposeFunctors (C := C) (D := D) (E := E))).
260 Defined.
261 End ComputableCategory.
262
263 Section SmallCat.
264 Definition LocallySmallCat := ComputableCategory _ LSUnderlyingCategory.
265 End SmallCat.
266
267 Section CommaCategory.
268 Context `(A : @Category objA).
269 Context `(B : @Category objB).
270 Context `(C : @Category objC).
271 Variable S : Functor A C.
272 Variable T : Functor B C.
273
274 Record CommaCategory_Object := { CommaCategory_Object_Member :> { ab : objA * objB & C.(Morphism) (S (fst ab)) (T (snd ab)) } }.
275
276 Let SortPolymorphic_Helper (A T : Type) (Build_T : A -> T) := A.
277
278 Definition CommaCategory_ObjectT := Eval hnf in SortPolymorphic_Helper Build_CommaCategory_Object.
279 Definition Build_CommaCategory_Object' (mem : CommaCategory_ObjectT) := Build_CommaCategory_Object mem.
280 Global Coercion Build_CommaCategory_Object' : CommaCategory_ObjectT >-> CommaCategory_Object.
281
282 Definition CommaCategory : @Category CommaCategory_Object.
283 Admitted.
284 End CommaCategory.
285
286 Definition SliceCategory_Functor `(C : @Category objC) (a : C) : Functor TerminalCategory C
287 := {| ObjectOf := (fun _ => a);
288 MorphismOf := (fun _ _ _ => Identity a)
289 |}.
290
291 Definition SliceCategoryOver
292 : forall (objC : Type) (C : Category objC) (a : C),
293 Category
294 (CommaCategory_Object (IdentityFunctor C)
295 (SliceCategory_Functor C a)).
296 admit.
297 Defined.
298
299 Section CommaCategoryProjectionFunctor.
300 Context `(A : Category objA).
301 Context `(B : Category objB).
302 Context `(C : Category objC).
303
304 Variable S : (OppositeCategory (FunctorCategory A C)).
305 Variable T : (FunctorCategory B C).
306
307 Definition CommaCategoryProjection : Functor (CommaCategory S T) (ProductCategory A B).
308 Admitted.
309
310 Definition CommaCategoryProjectionFunctor_ObjectOf
311 : @SliceCategoryOver _ LocallySmallCat (ProductCategory A B)
312 :=
313 existT _
314 ((CommaCategory S T) : Category', tt)
315 (CommaCategoryProjection) :
316 CommaCategory_ObjectT (IdentityFunctor _)
317 (SliceCategory_Functor LocallySmallCat
318 (ProductCategory A B)).
319 (* Anomaly: apply_coercion_args: mismatch between arguments and coercion. Please report. *)
320 (* Toplevel input, characters 110-142:
321 Error:
322 In environment
323 objA : Type
324 A : Category objA
325 objB : Type
326 B : Category objB
327 objC : Type
328 C : Category objC
329 S : OppositeCategory (FunctorCategory A C)
330 T : FunctorCategory B C
331 The term "ProductCategory A B:Category (objA * objB)" has type
332 "Category (objA * objB)" while it is expected to have type
333 "Object LocallySmallCat".
334 *)
335 End CommaCategoryProjectionFunctor.
336 End SecondComment.