@@ -6,6 +6,7 @@ Authors: Scott Morrison
6
6
import Mathlib.Algebra.Category.GroupCat.Preadditive
7
7
import Mathlib.GroupTheory.QuotientGroup
8
8
import Mathlib.CategoryTheory.Limits.Shapes.Kernels
9
+ import Mathlib.CategoryTheory.Limits.Shapes.FiniteLimits
9
10
import Mathlib.CategoryTheory.ConcreteCategory.Elementwise
10
11
11
12
#align_import algebra.category.Group.colimits from "leanprover-community/mathlib" @"70fd9563a21e7b963887c9360bd29b2393e6225a"
@@ -25,16 +26,18 @@ of finitely supported functions, and we really should implement this as well (or
25
26
-- porting note: `AddCommGroup` in all the names
26
27
set_option linter.uppercaseLean3 false
27
28
28
- universe u v
29
+ universe w u v
29
30
30
- open CategoryTheory
31
-
32
- open CategoryTheory.Limits
31
+ open CategoryTheory Limits
33
32
34
33
-- [ROBOT VOICE]:
35
34
-- You should pretend for now that this file was automatically generated.
36
35
-- It follows the same template as colimits in Mon.
37
- namespace AddCommGroupCat.Colimits
36
+ namespace AddCommGroupCat
37
+
38
+ variable {J : Type u} [Category.{v} J] (F : J ⥤ AddCommGroupCat.{max u v w})
39
+
40
+ namespace Colimits
38
41
39
42
/-!
40
43
We build the colimit of a diagram in `AddCommGroupCat` by constructing the
@@ -43,9 +46,6 @@ then taking the quotient by the abelian group laws within each abelian group,
43
46
and the identifications given by the morphisms in the diagram.
44
47
-/
45
48
46
-
47
- variable {J : Type v} [SmallCategory J] (F : J ⥤ AddCommGroupCat.{v})
48
-
49
49
/-- An inductive type representing all group expressions (without relations)
50
50
on a collection of types indexed by the objects of `J`.
51
51
-/
@@ -58,7 +58,7 @@ inductive Prequotient
58
58
| add : Prequotient → Prequotient → Prequotient
59
59
#align AddCommGroup.colimits.prequotient AddCommGroupCat.Colimits.Prequotient
60
60
61
- instance : Inhabited (Prequotient F) :=
61
+ instance : Inhabited (Prequotient.{w} F) :=
62
62
⟨Prequotient.zero⟩
63
63
64
64
open Prequotient
@@ -67,7 +67,7 @@ open Prequotient
67
67
because of the abelian group laws, or
68
68
because one element is mapped to another by a morphism in the diagram.
69
69
-/
70
- inductive Relation : Prequotient F → Prequotient F → Prop
70
+ inductive Relation : Prequotient.{w} F → Prequotient.{w} F → Prop
71
71
-- Make it an equivalence relation:
72
72
| refl : ∀ x, Relation x x
73
73
| symm : ∀ (x y) (_ : Relation x y), Relation y x
@@ -95,7 +95,7 @@ inductive Relation : Prequotient F → Prequotient F → Prop
95
95
/--
96
96
The setoid corresponding to group expressions modulo abelian group relations and identifications.
97
97
-/
98
- def colimitSetoid : Setoid (Prequotient F) where
98
+ def colimitSetoid : Setoid (Prequotient.{w} F) where
99
99
r := Relation F
100
100
iseqv := ⟨Relation.refl, fun r => Relation.symm _ _ r, fun r => Relation.trans _ _ _ r⟩
101
101
#align AddCommGroup.colimits.colimit_setoid AddCommGroupCat.Colimits.colimitSetoid
@@ -104,11 +104,11 @@ attribute [instance] colimitSetoid
104
104
105
105
/-- The underlying type of the colimit of a diagram in `AddCommGroupCat`.
106
106
-/
107
- def ColimitType : Type v :=
108
- Quotient (colimitSetoid F)
107
+ def ColimitType : Type max u v w :=
108
+ Quotient (colimitSetoid.{w} F)
109
109
#align AddCommGroup.colimits.colimit_type AddCommGroupCat.Colimits.ColimitType
110
110
111
- instance : AddCommGroup (ColimitType F) where
111
+ instance : AddCommGroup (ColimitType.{w} F) where
112
112
zero := Quotient.mk _ zero
113
113
neg := Quotient.map neg Relation.neg_1
114
114
add := Quotient.map₂ add <| fun x x' rx y y' ry =>
@@ -120,79 +120,79 @@ instance : AddCommGroup (ColimitType F) where
120
120
add_assoc := Quotient.ind <| fun _ => Quotient.ind₂ <| fun _ _ =>
121
121
Quotient.sound <| Relation.add_assoc _ _ _
122
122
123
- instance ColimitTypeInhabited : Inhabited (ColimitType.{v } F) := ⟨0 ⟩
123
+ instance ColimitTypeInhabited : Inhabited (ColimitType.{w } F) := ⟨0 ⟩
124
124
125
125
@[simp]
126
- theorem quot_zero : Quot.mk Setoid.r zero = (0 : ColimitType F) :=
126
+ theorem quot_zero : Quot.mk Setoid.r zero = (0 : ColimitType.{w} F) :=
127
127
rfl
128
128
#align AddCommGroup.colimits.quot_zero AddCommGroupCat.Colimits.quot_zero
129
129
130
130
@[simp]
131
131
theorem quot_neg (x) : Quot.mk Setoid.r (neg x) =
132
132
-- Porting note : force Lean to treat `ColimitType F` no as `Quot _`
133
- Neg.neg (α := ColimitType.{v } F) (Quot.mk Setoid.r x : ColimitType.{v } F) :=
133
+ Neg.neg (α := ColimitType.{w } F) (Quot.mk Setoid.r x : ColimitType.{w } F) :=
134
134
rfl
135
135
#align AddCommGroup.colimits.quot_neg AddCommGroupCat.Colimits.quot_neg
136
136
137
137
@[simp]
138
138
theorem quot_add (x y) :
139
139
Quot.mk Setoid.r (add x y) =
140
140
-- Porting note : force Lean to treat `ColimitType F` no as `Quot _`
141
- Add.add (α := ColimitType.{v } F) (Quot.mk Setoid.r x) (Quot.mk Setoid.r y) :=
141
+ Add.add (α := ColimitType.{w } F) (Quot.mk Setoid.r x) (Quot.mk Setoid.r y) :=
142
142
rfl
143
143
#align AddCommGroup.colimits.quot_add AddCommGroupCat.Colimits.quot_add
144
144
145
145
/-- The bundled abelian group giving the colimit of a diagram. -/
146
146
def colimit : AddCommGroupCat :=
147
- AddCommGroupCat.of (ColimitType F)
147
+ AddCommGroupCat.of (ColimitType.{w} F)
148
148
#align AddCommGroup.colimits.colimit AddCommGroupCat.Colimits.colimit
149
149
150
150
/-- The function from a given abelian group in the diagram to the colimit abelian group. -/
151
- def coconeFun (j : J) (x : F.obj j) : ColimitType F :=
151
+ def coconeFun (j : J) (x : F.obj j) : ColimitType.{w} F :=
152
152
Quot.mk _ (Prequotient.of j x)
153
153
#align AddCommGroup.colimits.cocone_fun AddCommGroupCat.Colimits.coconeFun
154
154
155
155
/-- The group homomorphism from a given abelian group in the diagram to the colimit abelian
156
156
group. -/
157
- def coconeMorphism (j : J) : F.obj j ⟶ colimit F where
157
+ def coconeMorphism (j : J) : F.obj j ⟶ colimit.{w} F where
158
158
toFun := coconeFun F j
159
159
map_zero' := by apply Quot.sound; apply Relation.zero
160
160
map_add' := by intros; apply Quot.sound; apply Relation.add
161
161
#align AddCommGroup.colimits.cocone_morphism AddCommGroupCat.Colimits.coconeMorphism
162
162
163
163
@[simp]
164
164
theorem cocone_naturality {j j' : J} (f : j ⟶ j') :
165
- F.map f ≫ coconeMorphism F j' = coconeMorphism F j := by
165
+ F.map f ≫ coconeMorphism.{w} F j' = coconeMorphism F j := by
166
166
ext
167
167
apply Quot.sound
168
168
apply Relation.map
169
169
#align AddCommGroup.colimits.cocone_naturality AddCommGroupCat.Colimits.cocone_naturality
170
170
171
171
@[simp]
172
172
theorem cocone_naturality_components (j j' : J) (f : j ⟶ j') (x : F.obj j) :
173
- (coconeMorphism F j') (F.map f x) = (coconeMorphism F j) x := by
173
+ (coconeMorphism.{w} F j') (F.map f x) = (coconeMorphism F j) x := by
174
174
rw [← cocone_naturality F f]
175
175
rfl
176
176
#align AddCommGroup.colimits.cocone_naturality_components AddCommGroupCat.Colimits.cocone_naturality_components
177
177
178
178
/-- The cocone over the proposed colimit abelian group. -/
179
179
def colimitCocone : Cocone F where
180
- pt := colimit F
180
+ pt := colimit.{w} F
181
181
ι := { app := coconeMorphism F }
182
182
#align AddCommGroup.colimits.colimit_cocone AddCommGroupCat.Colimits.colimitCocone
183
183
184
184
/-- The function from the free abelian group on the diagram to the cone point of any other
185
185
cocone. -/
186
186
@[simp]
187
- def descFunLift (s : Cocone F) : Prequotient F → s.pt
187
+ def descFunLift (s : Cocone F) : Prequotient.{w} F → s.pt
188
188
| Prequotient.of j x => (s.ι.app j) x
189
189
| zero => 0
190
190
| neg x => -descFunLift s x
191
191
| add x y => descFunLift s x + descFunLift s y
192
192
#align AddCommGroup.colimits.desc_fun_lift AddCommGroupCat.Colimits.descFunLift
193
193
194
194
/-- The function from the colimit abelian group to the cone point of any other cocone. -/
195
- def descFun (s : Cocone F) : ColimitType F → s.pt := by
195
+ def descFun (s : Cocone F) : ColimitType.{w} F → s.pt := by
196
196
fapply Quot.lift
197
197
· exact descFunLift F s
198
198
· intro x y r
@@ -216,15 +216,15 @@ def descFun (s : Cocone F) : ColimitType F → s.pt := by
216
216
#align AddCommGroup.colimits.desc_fun AddCommGroupCat.Colimits.descFun
217
217
218
218
/-- The group homomorphism from the colimit abelian group to the cone point of any other cocone. -/
219
- def descMorphism (s : Cocone F) : colimit.{v } F ⟶ s.pt where
219
+ def descMorphism (s : Cocone F) : colimit.{w } F ⟶ s.pt where
220
220
toFun := descFun F s
221
221
map_zero' := rfl
222
222
-- Porting note : in `mathlib3`, nothing needs to be done after `induction`
223
223
map_add' x y := Quot.induction_on₂ x y fun _ _ => by dsimp [(· + ·)]; rw [←quot_add F]; rfl
224
224
#align AddCommGroup.colimits.desc_morphism AddCommGroupCat.Colimits.descMorphism
225
225
226
226
/-- Evidence that the proposed colimit is the colimit. -/
227
- def colimitCoconeIsColimit : IsColimit (colimitCocone.{v } F) where
227
+ def colimitCoconeIsColimit : IsColimit (colimitCocone.{w } F) where
228
228
desc s := descMorphism F s
229
229
uniq s m w := FunLike.ext _ _ <| fun x => Quot.inductionOn x fun x => by
230
230
change (m : ColimitType F →+ s.pt) _ = (descMorphism F s : ColimitType F →+ s.pt) _
@@ -241,15 +241,37 @@ def colimitCoconeIsColimit : IsColimit (colimitCocone.{v} F) where
241
241
erw [m.map_add, (descMorphism F s).map_add, ihx, ihy]
242
242
#align AddCommGroup.colimits.colimit_cocone_is_colimit AddCommGroupCat.Colimits.colimitCoconeIsColimit
243
243
244
- instance hasColimits_addCommGroupCat : HasColimits AddCommGroupCat
245
- where has_colimits_of_shape {_ _} :=
246
- { has_colimit := fun F =>
247
- HasColimit.mk
248
- { cocone := colimitCocone F
249
- isColimit := colimitCoconeIsColimit F } }
250
- #align AddCommGroup.colimits.has_colimits_AddCommGroup AddCommGroupCat.Colimits.hasColimits_addCommGroupCat
244
+ end Colimits
245
+
246
+ lemma hasColimit : HasColimit F := ⟨_, Colimits.colimitCoconeIsColimit.{w} F⟩
247
+
248
+ variable (J)
251
249
252
- end AddCommGroupCat.Colimits
250
+ lemma hasColimitsOfShape : HasColimitsOfShape J AddCommGroupCat.{max u v w} where
251
+ has_colimit F := hasColimit.{w} F
252
+
253
+ lemma hasColimitsOfSize : HasColimitsOfSize.{v, u} AddCommGroupCat.{max u v w} :=
254
+ ⟨fun _ => hasColimitsOfShape.{w} _⟩
255
+
256
+ instance hasColimits : HasColimits AddCommGroupCat.{w} := hasColimitsOfSize.{w}
257
+ #align AddCommGroup.colimits.has_colimits_AddCommGroup AddCommGroupCat.hasColimits
258
+
259
+ instance : HasColimitsOfSize.{v, v} (AddCommGroupCatMax.{u, v}) := hasColimitsOfSize.{u}
260
+ instance : HasColimitsOfSize.{u, u} (AddCommGroupCatMax.{u, v}) := hasColimitsOfSize.{v}
261
+ instance : HasColimitsOfSize.{u, v} (AddCommGroupCatMax.{u, v}) := hasColimitsOfSize.{u}
262
+ instance : HasColimitsOfSize.{v, u} (AddCommGroupCatMax.{u, v}) := hasColimitsOfSize.{u}
263
+ instance : HasColimitsOfSize.{0 , 0 } (AddCommGroupCat.{u}) := hasColimitsOfSize.{u, 0 , 0 }
264
+
265
+ example : HasColimits AddCommGroupCatMax.{v, u} :=
266
+ inferInstance
267
+
268
+ example : HasColimits AddCommGroupCatMax.{u, v} :=
269
+ inferInstance
270
+
271
+ example : HasColimits AddCommGroupCat.{u} :=
272
+ inferInstance
273
+
274
+ end AddCommGroupCat
253
275
254
276
namespace AddCommGroupCat
255
277
0 commit comments