-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathFunctorCategoryFunctorial.v
264 lines (223 loc) · 11.3 KB
/
FunctorCategoryFunctorial.v
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
Require Export FunctorCategory NaturalTransformation.
Require Import Common Notations SmallCat ProductCategory Duals ExponentialLaws CanonicalStructureSimplification FEqualDep.
Set Implicit Arguments.
Generalizable All Variables.
Set Asymmetric Patterns.
Set Universe Polymorphism.
Local Open Scope category_scope.
Section FunctorCategoryParts.
Section MorphismOf.
Context `(C : @SpecializedCategory objC).
Context `(D : @SpecializedCategory objD).
Context `(C' : @SpecializedCategory objC').
Context `(D' : @SpecializedCategory objD').
Variable F : SpecializedFunctor C C'.
Variable G : SpecializedFunctor D' D.
Definition FunctorCategoryFunctor_MorphismOf_ObjectOf : (C ^ D)%functor -> (C' ^ D')%functor
:= fun H => ComposeFunctors F (ComposeFunctors H G).
Global Arguments FunctorCategoryFunctor_MorphismOf_ObjectOf _ / .
Definition FunctorCategoryFunctor_MorphismOf_MorphismOf s d (m : Morphism (C ^ D) s d) :
Morphism (C' ^ D') (FunctorCategoryFunctor_MorphismOf_ObjectOf s) (FunctorCategoryFunctor_MorphismOf_ObjectOf d)
:= NTComposeF (IdentityNaturalTransformation _) (NTComposeF m (IdentityNaturalTransformation _)).
Global Arguments FunctorCategoryFunctor_MorphismOf_MorphismOf _ _ _ / .
Definition FunctorCategoryFunctor_MorphismOf : SpecializedFunctor (C ^ D) (C' ^ D').
refine (Build_SpecializedFunctor
(C ^ D) (C' ^ D')
FunctorCategoryFunctor_MorphismOf_ObjectOf
FunctorCategoryFunctor_MorphismOf_MorphismOf
_
_);
abstract (
intros; simpl;
apply NaturalTransformation_eq;
rsimplify_morphisms;
reflexivity
).
Defined.
End MorphismOf.
Section FIdentityOf.
Context `(C : @SpecializedCategory objC).
Context `(D : @SpecializedCategory objD).
Lemma FunctorCategoryFunctor_FIdentityOf : FunctorCategoryFunctor_MorphismOf (IdentityFunctor C) (IdentityFunctor D) = IdentityFunctor _.
repeat (intro || apply Functor_eq || nt_eq); simpl; subst; JMeq_eq; rsimplify_morphisms; reflexivity.
Qed.
End FIdentityOf.
Section FCompositionOf.
Context `(C : @SpecializedCategory objC).
Context `(D : @SpecializedCategory objD).
Context `(C' : @SpecializedCategory objC').
Context `(D' : @SpecializedCategory objD').
Context `(C'' : @SpecializedCategory objC'').
Context `(D'' : @SpecializedCategory objD'').
Variable F' : SpecializedFunctor C' C''.
Variable G : SpecializedFunctor D D'.
Variable F : SpecializedFunctor C C'.
Variable G' : SpecializedFunctor D' D''.
Lemma FunctorCategoryFunctor_FCompositionOf : FunctorCategoryFunctor_MorphismOf (ComposeFunctors F' F) (ComposeFunctors G' G)
= ComposeFunctors (FunctorCategoryFunctor_MorphismOf F' G) (FunctorCategoryFunctor_MorphismOf F G').
abstract (repeat (intro || apply Functor_eq || nt_eq); simpl; subst; JMeq_eq; rsimplify_morphisms; reflexivity).
Qed.
End FCompositionOf.
End FunctorCategoryParts.
Section FunctorCategoryFunctor.
Definition FunctorCategoryFunctor : SpecializedFunctor (LocallySmallCat * (OppositeCategory LocallySmallCat)) LocallySmallCat.
refine (Build_SpecializedFunctor (LocallySmallCat * (OppositeCategory LocallySmallCat)) LocallySmallCat
(fun CD => (fst CD) ^ (snd CD) : LocallySmallSpecializedCategory _)
(fun s d m => FunctorCategoryFunctor_MorphismOf (fst m) (snd m))
_
_);
simpl;
abstract (intros; apply FunctorCategoryFunctor_FCompositionOf || apply FunctorCategoryFunctor_FIdentityOf).
Defined.
(* Definition FunctorCategoryFunctor : ((LocallySmallCat ^ LocallySmallCat) ^ (OppositeCategory LocallySmallCat))%category
:= ExponentialLaw4Functor_Inverse _ _ _ FunctorCategoryUncurriedFunctor. *)
End FunctorCategoryFunctor.
Notation "F ^ G" := (FunctorCategoryFunctor_MorphismOf F G) : functor_scope.
Section NaturalTransformation.
Context `(C : @SpecializedCategory objC).
Context `(D : @SpecializedCategory objD).
Context `(C' : @SpecializedCategory objC').
Context `(D' : @SpecializedCategory objD').
Variables F G : SpecializedFunctor C D.
Variables F' G' : SpecializedFunctor C' D'.
Variable T : SpecializedNaturalTransformation F G.
Variable T' : SpecializedNaturalTransformation F' G'.
Definition LiftNaturalTransformationPointwise : SpecializedNaturalTransformation (F ^ F') (G ^ G').
match goal with
| [ |- SpecializedNaturalTransformation ?F ?G ] =>
refine (Build_SpecializedNaturalTransformation F G
(fun _ => NTComposeF T (NTComposeF (IdentityNaturalTransformation _) T'))
_)
end.
abstract (
intros;
simpl;
apply NaturalTransformation_eq;
simpl in *;
intros;
rsimplify_morphisms;
autorewrite with morphism;
repeat (
reflexivity
|| (progress repeat rewrite <- FCompositionOf)
|| (progress repeat rewrite Commutes)
|| (progress try_associativity ltac:(apply f_equal2; try reflexivity; [])))
).
Defined.
End NaturalTransformation.
Notation "T ^ U" := (LiftNaturalTransformationPointwise T U) : natural_transformation_scope.
Section NaturalTransformation_Properties.
Section identity.
Context `(C : @SpecializedCategory objC).
Context `(D : @SpecializedCategory objD).
Local Ltac t := intros; simpl; nt_eq; rsimplify_morphisms; try reflexivity.
Section lift.
Let LiftIdentityPointwise'
: SpecializedNaturalTransformation (IdentityFunctor (C ^ D)) (IdentityFunctor C ^ IdentityFunctor D).
match goal with
| [ |- SpecializedNaturalTransformation ?F ?G ] =>
refine (Build_SpecializedNaturalTransformation F G
(fun x => (Build_SpecializedNaturalTransformation (F x) (G x)
(fun y => Identity (x y))
_))
_)
end;
t.
Grab Existential Variables.
abstract t.
Defined.
Let LiftIdentityPointwise''
: SpecializedNaturalTransformation (IdentityFunctor (C ^ D)) (IdentityFunctor C ^ IdentityFunctor D).
nt_simpl_abstract_trailing_props LiftIdentityPointwise'.
Defined.
Definition LiftIdentityPointwise
: SpecializedNaturalTransformation (IdentityFunctor (C ^ D)) (IdentityFunctor C ^ IdentityFunctor D)
:= Eval hnf in LiftIdentityPointwise''.
End lift.
Section inverse.
Let LiftIdentityPointwise'_Inverse
: SpecializedNaturalTransformation (IdentityFunctor C ^ IdentityFunctor D) (IdentityFunctor (C ^ D)).
match goal with
| [ |- SpecializedNaturalTransformation ?F ?G ] =>
refine (Build_SpecializedNaturalTransformation F G
(fun x => (Build_SpecializedNaturalTransformation (F x) (G x)
(fun y => Identity (x y))
_))
_)
end;
t.
Grab Existential Variables.
abstract t.
Defined.
Let LiftIdentityPointwise''_Inverse
: SpecializedNaturalTransformation (IdentityFunctor C ^ IdentityFunctor D) (IdentityFunctor (C ^ D)).
nt_simpl_abstract_trailing_props LiftIdentityPointwise'_Inverse.
Defined.
Definition LiftIdentityPointwise_Inverse
: SpecializedNaturalTransformation (IdentityFunctor C ^ IdentityFunctor D) (IdentityFunctor (C ^ D))
:= Eval hnf in LiftIdentityPointwise''_Inverse.
End inverse.
Section theorem.
Theorem LiftIdentityPointwise_Isomorphism
: NTComposeT LiftIdentityPointwise LiftIdentityPointwise_Inverse = IdentityNaturalTransformation _
/\ NTComposeT LiftIdentityPointwise_Inverse LiftIdentityPointwise = IdentityNaturalTransformation _.
abstract (split; nt_eq; autorewrite with morphism; reflexivity).
Qed.
End theorem.
End identity.
Section compose.
Context `(C : @SpecializedCategory objC).
Context `(D : @SpecializedCategory objD).
Context `(E : @SpecializedCategory objE).
Context `(C' : @SpecializedCategory objC').
Context `(D' : @SpecializedCategory objD').
Context `(E' : @SpecializedCategory objE').
Variable G : SpecializedFunctor D E.
Variable F : SpecializedFunctor C D.
Variable F' : SpecializedFunctor D' E'.
Variable G' : SpecializedFunctor C' D'.
Section lift.
Let LiftComposeFunctorsPointwise_ComponentsOf x
: SpecializedNaturalTransformation
(ComposeFunctors (ComposeFunctors G F)
(ComposeFunctors x (ComposeFunctors F' G')))
(ComposeFunctors G
(ComposeFunctors (ComposeFunctors F (ComposeFunctors x F')) G')).
nt_solve_associator.
Defined.
Definition LiftComposeFunctorsPointwise : SpecializedNaturalTransformation (ComposeFunctors G F ^ ComposeFunctors F' G')
(ComposeFunctors (G ^ G') (F ^ F')).
exists LiftComposeFunctorsPointwise_ComponentsOf;
subst_body; simpl.
abstract (intros; apply NaturalTransformation_eq; rsimplify_morphisms; reflexivity).
Defined.
End lift.
Section inverse.
Let LiftComposeFunctorsPointwise_Inverse_ComponentsOf x
: SpecializedNaturalTransformation
(ComposeFunctors G
(ComposeFunctors (ComposeFunctors F (ComposeFunctors x F')) G'))
(ComposeFunctors (ComposeFunctors G F)
(ComposeFunctors x (ComposeFunctors F' G'))).
nt_solve_associator.
Defined.
Definition LiftComposeFunctorsPointwise_Inverse : SpecializedNaturalTransformation (ComposeFunctors (G ^ G') (F ^ F'))
(ComposeFunctors G F ^ ComposeFunctors F' G').
exists LiftComposeFunctorsPointwise_Inverse_ComponentsOf;
subst_body; simpl.
abstract (intros; apply NaturalTransformation_eq; rsimplify_morphisms; reflexivity).
Defined.
End inverse.
Section theorem.
Theorem LiftComposeFunctorsPointwise_Isomorphism
: NTComposeT LiftComposeFunctorsPointwise LiftComposeFunctorsPointwise_Inverse = IdentityNaturalTransformation _
/\ NTComposeT LiftComposeFunctorsPointwise_Inverse LiftComposeFunctorsPointwise = IdentityNaturalTransformation _.
abstract (
split;
repeat (apply NaturalTransformation_eq || intro || simpl);
rsimplify_morphisms; reflexivity
).
Qed.
End theorem.
End compose.
End NaturalTransformation_Properties.