Debian Codegraph @

test-suite/bugs/HoTT_coq_014.v

raw
1 Require Import TestSuite.admit.
2 Set Implicit Arguments.
3 Generalizable All Variables.
4 Set Universe Polymorphism.
5
6 Polymorphic Record SpecializedCategory@{l k} (obj : Type@{l}) := Build_SpecializedCategory' {
7 Object :> Type@{l} := obj;
8 Morphism' : obj -> obj -> Type@{k};
9
10 Identity' : forall o, Morphism' o o;
11 Compose' : forall s d d', Morphism' d d' -> Morphism' s d -> Morphism' s d'
12 }.
13
14 Polymorphic Definition Morphism obj (C : @SpecializedCategory obj) : forall s d : C, _ := Eval cbv beta delta [Morphism'] in C.(Morphism').
15
16 (* eh, I'm not terribly happy. meh. *)
17 Polymorphic Definition SmallSpecializedCategory (obj : Set) (*mor : obj -> obj -> Set*) := SpecializedCategory@{Set Set} obj.
18 Polymorphic Identity Coercion SmallSpecializedCategory_LocallySmallSpecializedCategory_Id : SmallSpecializedCategory >-> SpecializedCategory.
19
20 Polymorphic Record Category := {
21 CObject : Type;
22
23 UnderlyingCategory :> @SpecializedCategory CObject
24 }.
25
26 Polymorphic Definition GeneralizeCategory `(C : @SpecializedCategory obj) : Category.
27 refine {| CObject := C.(Object) |}; auto.
28 Defined.
29
30 Coercion GeneralizeCategory : SpecializedCategory >-> Category.
31
32
33
34 Section SpecializedFunctor.
35 Set Universe Polymorphism.
36 Context `(C : @SpecializedCategory objC).
37 Context `(D : @SpecializedCategory objD).
38 Unset Universe Polymorphism.
39
40 Polymorphic Record SpecializedFunctor := {
41 ObjectOf' : objC -> objD;
42 MorphismOf' : forall s d, C.(Morphism') s d -> D.(Morphism') (ObjectOf' s) (ObjectOf' d);
43 FCompositionOf' : forall s d d' (m1 : C.(Morphism') s d) (m2: C.(Morphism') d d'),
44 MorphismOf' _ _ (C.(Compose') _ _ _ m2 m1) = D.(Compose') _ _ _ (MorphismOf' _ _ m2) (MorphismOf' _ _ m1);
45 FIdentityOf' : forall o, MorphismOf' _ _ (C.(Identity') o) = D.(Identity') (ObjectOf' o)
46 }.
47 End SpecializedFunctor.
48
49 Global Coercion ObjectOf' : SpecializedFunctor >-> Funclass.
50 Set Universe Polymorphism.
51 Section Functor.
52 Variable C D : Category.
53
54 Polymorphic Definition Functor := SpecializedFunctor C D.
55 End Functor.
56 Unset Universe Polymorphism.
57
58 Polymorphic Identity Coercion Functor_SpecializedFunctor_Id : Functor >-> SpecializedFunctor.
59 Polymorphic Definition GeneralizeFunctor objC C objD D (F : @SpecializedFunctor objC C objD D) : Functor C D := F.
60 Coercion GeneralizeFunctor : SpecializedFunctor >-> Functor.
61
62 Arguments SpecializedFunctor {objC} C {objD} D.
63
64
65 Polymorphic Record SmallCategory := {
66 SObject : Set;
67
68 SUnderlyingCategory :> @SmallSpecializedCategory SObject
69 }.
70
71 Polymorphic Definition GeneralizeSmallCategory `(C : @SmallSpecializedCategory obj) : SmallCategory.
72 refine {| SObject := obj |}; destruct C; econstructor; eassumption.
73 Defined.
74
75 Coercion GeneralizeSmallCategory : SmallSpecializedCategory >-> SmallCategory.
76
77 Bind Scope category_scope with SmallCategory.
78
79
80 Polymorphic Definition TypeCat : @SpecializedCategory Type := (@Build_SpecializedCategory' Type
81 (fun s d => s -> d)
82 (fun _ => (fun x => x))
83 (fun _ _ _ f g => (fun x => f (g x)))).
84 (*Unset Universe Polymorphism.*)
85 Polymorphic Definition FunctorCategory objC (C : @SpecializedCategory objC) objD (D : @SpecializedCategory objD) :
86 @SpecializedCategory (SpecializedFunctor C D).
87 Admitted.
88
89 Polymorphic Definition DiscreteCategory (O : Type) : @SpecializedCategory O.
90 Admitted.
91
92 Polymorphic Definition ComputableCategory (I : Type) (Index2Object : I -> Type) (Index2Cat : forall i : I, @SpecializedCategory (@Index2Object i)) :
93 @SpecializedCategory I.
94 Admitted.
95
96 Polymorphic Definition is_unique (A : Type) (x : A) := forall x' : A, x' = x.
97
98 Polymorphic Definition InitialObject obj {C : SpecializedCategory obj} (o : C) :=
99 forall o', { m : Morphism C o o' | is_unique m }.
100
101 Polymorphic Definition SmallCat := ComputableCategory _ SUnderlyingCategory.
102
103 Lemma InitialCategory_Initial : InitialObject (C := SmallCat) (DiscreteCategory Empty_set : SmallSpecializedCategory _).
104 admit.
105 Qed.
106
107 Set Universe Polymorphism.
108 Section GraphObj.
109 Context `(C : @SpecializedCategory objC).
110
111 Inductive GraphIndex := GraphIndexSource | GraphIndexTarget.
112
113 Definition GraphIndex_Morphism (a b : GraphIndex) : Set :=
114 match (a, b) with
115 | (GraphIndexSource, GraphIndexSource) => unit
116 | (GraphIndexTarget, GraphIndexTarget) => unit
117 | (GraphIndexTarget, GraphIndexSource) => Empty_set
118 | (GraphIndexSource, GraphIndexTarget) => GraphIndex
119 end.
120
121 Global Arguments GraphIndex_Morphism a b /.
122
123 Definition GraphIndex_Compose s d d' (m1 : GraphIndex_Morphism d d') (m2 : GraphIndex_Morphism s d) :
124 GraphIndex_Morphism s d'.
125 Proof using. (* This makes no sense, but it makes this test behave as before the no admit commit *)
126 Admitted.
127
128 Definition GraphIndexingCategory : @SpecializedCategory GraphIndex.
129 refine {|
130 Morphism' := GraphIndex_Morphism;
131 Identity' := (fun x => match x with GraphIndexSource => tt | GraphIndexTarget => tt end);
132 Compose' := GraphIndex_Compose
133 |};
134 admit.
135 Defined.
136
137 Definition UnderlyingGraph_ObjectOf x :=
138 match x with
139 | GraphIndexSource => { sd : objC * objC & Morphism C (fst sd) (snd sd) }
140 | GraphIndexTarget => objC
141 end.
142
143 Global Arguments UnderlyingGraph_ObjectOf x /.
144
145 Definition UnderlyingGraph_MorphismOf s d (m : Morphism GraphIndexingCategory s d) :
146 UnderlyingGraph_ObjectOf s -> UnderlyingGraph_ObjectOf d.
147 Admitted.
148
149 Definition UnderlyingGraph : SpecializedFunctor GraphIndexingCategory TypeCat.
150 Proof.
151 match goal with
152 | [ |- SpecializedFunctor ?C ?D ] =>
153 refine (Build_SpecializedFunctor C D
154 UnderlyingGraph_ObjectOf
155 UnderlyingGraph_MorphismOf
156 _
157 _
158 )
159 end;
160 admit.
161 Defined.
162 End GraphObj.
163
164 Set Printing Universes.
165 Set Printing All.
166
167 Print Coercions.
168
169 Section test.
170
171 Fail Polymorphic Definition UnderlyingGraphFunctor_MorphismOf' (C D : SmallCategory) (F : SpecializedFunctor C D) :
172 Morphism (FunctorCategory TypeCat GraphIndexingCategory)
173 (@UnderlyingGraph (SObject C)
174 (SmallSpecializedCategory_LocallySmallSpecializedCategory_Id (SUnderlyingCategory C)))
175 (UnderlyingGraph D).
176 (* Toplevel input, characters 216-249:
177 Error:
178 In environment
179 C : SmallCategory (* Top.594 *)
180 D : SmallCategory (* Top.595 *)
181 F :
182 @SpecializedFunctor (* Top.25 Set Top.25 Set *) (SObject (* Top.25 *) C)
183 (SUnderlyingCategory (* Top.25 *) C) (SObject (* Top.25 *) D)
184 (SUnderlyingCategory (* Top.25 *) D)
185 The term
186 "SUnderlyingCategory (* Top.25 *) C
187 :SpecializedCategory (* Top.25 Set *) (SObject (* Top.25 *) C)" has type
188 "SpecializedCategory (* Top.618 Top.619 *) (SObject (* Top.25 *) C)"
189 while it is expected to have type
190 "SpecializedCategory (* Top.224 Top.225 *) (SObject (* Top.617 *) C)"
191 (Universe inconsistency: Cannot enforce Set = Top.225)).
192 *)
193 Fail Admitted.
194
195 Fail Polymorphic Definition UnderlyingGraphFunctor_MorphismOf (C D : SmallCategory) (F : SpecializedFunctor C D) :
196 Morphism (FunctorCategory TypeCat GraphIndexingCategory) (UnderlyingGraph C) (UnderlyingGraph D). (* Anomaly: apply_coercion. Please report.*)
197 Fail Admitted.
198
199 Polymorphic Definition UnderlyingGraphFunctor_MorphismOf (C D : SmallCategory) (F : SpecializedFunctor C D) :
200 Morphism (FunctorCategory GraphIndexingCategory TypeCat) (UnderlyingGraph C) (UnderlyingGraph D). (* Anomaly: apply_coercion. Please report.*)
201 Proof.
202 Admitted.
203 End test.