@@ -38,6 +38,34 @@ instance fintype_walking_pair : fintype walking_pair :=
38
38
{ elems := {left, right},
39
39
complete := λ x, by { cases x; simp } }
40
40
41
+ /--
42
+ The equivalence swapping left and right.
43
+ -/
44
+ def walking_pair.swap : walking_pair ≃ walking_pair :=
45
+ { to_fun := λ j, walking_pair.rec_on j right left,
46
+ inv_fun := λ j, walking_pair.rec_on j right left,
47
+ left_inv := λ j, by { cases j; refl, },
48
+ right_inv := λ j, by { cases j; refl, }, }
49
+
50
+ @[simp] lemma walking_pair.swap_apply_left : walking_pair.swap left = right := rfl
51
+ @[simp] lemma walking_pair.swap_apply_right : walking_pair.swap right = left := rfl
52
+ @[simp] lemma walking_pair.swap_symm_apply_tt : walking_pair.swap.symm left = right := rfl
53
+ @[simp] lemma walking_pair.swap_symm_apply_ff : walking_pair.swap.symm right = left := rfl
54
+
55
+ /--
56
+ An equivalence from `walking_pair` to `bool`, sometimes useful when reindexing limits.
57
+ -/
58
+ def walking_pair.equiv_bool : walking_pair ≃ bool :=
59
+ { to_fun := λ j, walking_pair.rec_on j tt ff, -- to match equiv.sum_equiv_sigma_bool
60
+ inv_fun := λ b, bool.rec_on b right left,
61
+ left_inv := λ j, by { cases j; refl, },
62
+ right_inv := λ b, by { cases b; refl, }, }
63
+
64
+ @[simp] lemma walking_pair.equiv_bool_apply_left : walking_pair.equiv_bool left = tt := rfl
65
+ @[simp] lemma walking_pair.equiv_bool_apply_right : walking_pair.equiv_bool right = ff := rfl
66
+ @[simp] lemma walking_pair.equiv_bool_symm_apply_tt : walking_pair.equiv_bool.symm tt = left := rfl
67
+ @[simp] lemma walking_pair.equiv_bool_symm_apply_ff : walking_pair.equiv_bool.symm ff = right := rfl
68
+
41
69
variables {C : Type u} [category.{v} C]
42
70
43
71
/-- The diagram on the walking pair, sending the two points to `X` and `Y`. -/
@@ -143,109 +171,114 @@ def binary_cofan.is_colimit.desc' {W X Y : C} {s : binary_cofan X Y} (h : is_col
143
171
(g : Y ⟶ W) : {l : s.X ⟶ W // s.inl ≫ l = f ∧ s.inr ≫ l = g} :=
144
172
⟨h.desc $ binary_cofan.mk f g, h.fac _ _, h.fac _ _⟩
145
173
174
+ /-- An abbreviation for `has_limit (pair X Y)`. -/
175
+ abbreviation has_binary_product (X Y : C) := has_limit (pair X Y)
176
+ /-- An abbreviation for `has_colimit (pair X Y)`. -/
177
+ abbreviation has_binary_coproduct (X Y : C) := has_colimit (pair X Y)
178
+
146
179
/-- If we have chosen a product of `X` and `Y`, we can access it using `prod X Y` or
147
180
`X ⨯ Y`. -/
148
- abbreviation prod (X Y : C) [has_limit (pair X Y) ] := limit (pair X Y)
181
+ abbreviation prod (X Y : C) [has_binary_product X Y] := limit (pair X Y)
149
182
150
183
/-- If we have chosen a coproduct of `X` and `Y`, we can access it using `coprod X Y ` or
151
184
`X ⨿ Y`. -/
152
- abbreviation coprod (X Y : C) [has_colimit (pair X Y) ] := colimit (pair X Y)
185
+ abbreviation coprod (X Y : C) [has_binary_coproduct X Y] := colimit (pair X Y)
153
186
154
187
notation X ` ⨯ `:20 Y:20 := prod X Y
155
188
notation X ` ⨿ `:20 Y:20 := coprod X Y
156
189
157
190
/-- The projection map to the first component of the product. -/
158
- abbreviation prod.fst {X Y : C} [has_limit (pair X Y) ] : X ⨯ Y ⟶ X :=
191
+ abbreviation prod.fst {X Y : C} [has_binary_product X Y] : X ⨯ Y ⟶ X :=
159
192
limit.π (pair X Y) walking_pair.left
160
193
161
194
/-- The projecton map to the second component of the product. -/
162
- abbreviation prod.snd {X Y : C} [has_limit (pair X Y) ] : X ⨯ Y ⟶ Y :=
195
+ abbreviation prod.snd {X Y : C} [has_binary_product X Y] : X ⨯ Y ⟶ Y :=
163
196
limit.π (pair X Y) walking_pair.right
164
197
165
198
/-- The inclusion map from the first component of the coproduct. -/
166
- abbreviation coprod.inl {X Y : C} [has_colimit (pair X Y) ] : X ⟶ X ⨿ Y :=
199
+ abbreviation coprod.inl {X Y : C} [has_binary_coproduct X Y] : X ⟶ X ⨿ Y :=
167
200
colimit.ι (pair X Y) walking_pair.left
168
201
169
202
/-- The inclusion map from the second component of the coproduct. -/
170
- abbreviation coprod.inr {X Y : C} [has_colimit (pair X Y) ] : Y ⟶ X ⨿ Y :=
203
+ abbreviation coprod.inr {X Y : C} [has_binary_coproduct X Y] : Y ⟶ X ⨿ Y :=
171
204
colimit.ι (pair X Y) walking_pair.right
172
205
173
- @[ext] lemma prod.hom_ext {W X Y : C} [has_limit (pair X Y) ] {f g : W ⟶ X ⨯ Y}
206
+ @[ext] lemma prod.hom_ext {W X Y : C} [has_binary_product X Y] {f g : W ⟶ X ⨯ Y}
174
207
(h₁ : f ≫ prod.fst = g ≫ prod.fst) (h₂ : f ≫ prod.snd = g ≫ prod.snd) : f = g :=
175
208
binary_fan.is_limit.hom_ext (limit.is_limit _) h₁ h₂
176
209
177
- @[ext] lemma coprod.hom_ext {W X Y : C} [has_colimit (pair X Y) ] {f g : X ⨿ Y ⟶ W}
210
+ @[ext] lemma coprod.hom_ext {W X Y : C} [has_binary_coproduct X Y] {f g : X ⨿ Y ⟶ W}
178
211
(h₁ : coprod.inl ≫ f = coprod.inl ≫ g) (h₂ : coprod.inr ≫ f = coprod.inr ≫ g) : f = g :=
179
212
binary_cofan.is_colimit.hom_ext (colimit.is_colimit _) h₁ h₂
180
213
181
214
/-- If the product of `X` and `Y` exists, then every pair of morphisms `f : W ⟶ X` and `g : W ⟶ Y`
182
215
induces a morphism `prod.lift f g : W ⟶ X ⨯ Y`. -/
183
- abbreviation prod.lift {W X Y : C} [has_limit (pair X Y) ] (f : W ⟶ X) (g : W ⟶ Y) : W ⟶ X ⨯ Y :=
216
+ abbreviation prod.lift {W X Y : C} [has_binary_product X Y] (f : W ⟶ X) (g : W ⟶ Y) : W ⟶ X ⨯ Y :=
184
217
limit.lift _ (binary_fan.mk f g)
185
218
186
219
/-- If the coproduct of `X` and `Y` exists, then every pair of morphisms `f : X ⟶ W` and
187
220
`g : Y ⟶ W` induces a morphism `coprod.desc f g : X ⨿ Y ⟶ W`. -/
188
- abbreviation coprod.desc {W X Y : C} [has_colimit (pair X Y) ] (f : X ⟶ W) (g : Y ⟶ W) : X ⨿ Y ⟶ W :=
221
+ abbreviation coprod.desc {W X Y : C} [has_binary_coproduct X Y] (f : X ⟶ W) (g : Y ⟶ W) : X ⨿ Y ⟶ W :=
189
222
colimit.desc _ (binary_cofan.mk f g)
190
223
191
224
@[simp, reassoc]
192
- lemma prod.lift_fst {W X Y : C} [has_limit (pair X Y) ] (f : W ⟶ X) (g : W ⟶ Y) :
225
+ lemma prod.lift_fst {W X Y : C} [has_binary_product X Y] (f : W ⟶ X) (g : W ⟶ Y) :
193
226
prod.lift f g ≫ prod.fst = f :=
194
227
limit.lift_π _ _
195
228
196
229
@[simp, reassoc]
197
- lemma prod.lift_snd {W X Y : C} [has_limit (pair X Y) ] (f : W ⟶ X) (g : W ⟶ Y) :
230
+ lemma prod.lift_snd {W X Y : C} [has_binary_product X Y] (f : W ⟶ X) (g : W ⟶ Y) :
198
231
prod.lift f g ≫ prod.snd = g :=
199
232
limit.lift_π _ _
200
233
201
234
/- The redundant simp lemma linter says that simp can prove the reassoc version of this lemma. -/
202
235
@[reassoc, simp]
203
- lemma prod.lift_comp_comp {V W X Y : C} [has_limit (pair X Y) ] (f : V ⟶ W) (g : W ⟶ X) (h : W ⟶ Y) :
236
+ lemma prod.lift_comp_comp {V W X Y : C} [has_binary_product X Y] (f : V ⟶ W) (g : W ⟶ X) (h : W ⟶ Y) :
204
237
prod.lift (f ≫ g) (f ≫ h) = f ≫ prod.lift g h :=
205
238
by tidy
206
239
207
240
@[simp, reassoc]
208
- lemma coprod.inl_desc {W X Y : C} [has_colimit (pair X Y) ] (f : X ⟶ W) (g : Y ⟶ W) :
241
+ lemma coprod.inl_desc {W X Y : C} [has_binary_coproduct X Y] (f : X ⟶ W) (g : Y ⟶ W) :
209
242
coprod.inl ≫ coprod.desc f g = f :=
210
243
colimit.ι_desc _ _
211
244
212
245
@[simp, reassoc]
213
- lemma coprod.inr_desc {W X Y : C} [has_colimit (pair X Y) ] (f : X ⟶ W) (g : Y ⟶ W) :
246
+ lemma coprod.inr_desc {W X Y : C} [has_binary_coproduct X Y] (f : X ⟶ W) (g : Y ⟶ W) :
214
247
coprod.inr ≫ coprod.desc f g = g :=
215
248
colimit.ι_desc _ _
216
249
217
250
/- The redundant simp lemma linter says that simp can prove the reassoc version of this lemma. -/
218
251
@[reassoc, simp]
219
- lemma coprod.desc_comp_comp {V W X Y : C} [has_colimit (pair X Y) ] (f : V ⟶ W) (g : X ⟶ V)
252
+ lemma coprod.desc_comp_comp {V W X Y : C} [has_binary_coproduct X Y] (f : V ⟶ W) (g : X ⟶ V)
220
253
(h : Y ⟶ V) : coprod.desc (g ≫ f) (h ≫ f) = coprod.desc g h ≫ f :=
221
254
by tidy
222
255
223
- instance prod.mono_lift_of_mono_left {W X Y : C} [has_limit (pair X Y) ] (f : W ⟶ X) (g : W ⟶ Y)
256
+ instance prod.mono_lift_of_mono_left {W X Y : C} [has_binary_product X Y] (f : W ⟶ X) (g : W ⟶ Y)
224
257
[mono f] : mono (prod.lift f g) :=
225
258
mono_of_mono_fac $ prod.lift_fst _ _
226
259
227
- instance prod.mono_lift_of_mono_right {W X Y : C} [has_limit (pair X Y) ] (f : W ⟶ X) (g : W ⟶ Y)
260
+ instance prod.mono_lift_of_mono_right {W X Y : C} [has_binary_product X Y] (f : W ⟶ X) (g : W ⟶ Y)
228
261
[mono g] : mono (prod.lift f g) :=
229
262
mono_of_mono_fac $ prod.lift_snd _ _
230
263
231
- instance coprod.epi_desc_of_epi_left {W X Y : C} [has_colimit (pair X Y) ] (f : X ⟶ W) (g : Y ⟶ W)
264
+ instance coprod.epi_desc_of_epi_left {W X Y : C} [has_binary_coproduct X Y] (f : X ⟶ W) (g : Y ⟶ W)
232
265
[epi f] : epi (coprod.desc f g) :=
233
266
epi_of_epi_fac $ coprod.inl_desc _ _
234
267
235
- instance coprod.epi_desc_of_epi_right {W X Y : C} [has_colimit (pair X Y) ] (f : X ⟶ W) (g : Y ⟶ W)
268
+ instance coprod.epi_desc_of_epi_right {W X Y : C} [has_binary_coproduct X Y] (f : X ⟶ W) (g : Y ⟶ W)
236
269
[epi g] : epi (coprod.desc f g) :=
237
270
epi_of_epi_fac $ coprod.inr_desc _ _
238
271
239
272
/-- If the product of `X` and `Y` exists, then every pair of morphisms `f : W ⟶ X` and `g : W ⟶ Y`
240
273
induces a morphism `l : W ⟶ X ⨯ Y` satisfying `l ≫ prod.fst = f` and `l ≫ prod.snd = g`. -/
241
- def prod.lift' {W X Y : C} [has_limit (pair X Y) ] (f : W ⟶ X) (g : W ⟶ Y) :
274
+ def prod.lift' {W X Y : C} [has_binary_product X Y] (f : W ⟶ X) (g : W ⟶ Y) :
242
275
{l : W ⟶ X ⨯ Y // l ≫ prod.fst = f ∧ l ≫ prod.snd = g} :=
243
276
⟨prod.lift f g, prod.lift_fst _ _, prod.lift_snd _ _⟩
244
277
245
278
/-- If the coproduct of `X` and `Y` exists, then every pair of morphisms `f : X ⟶ W` and
246
279
`g : Y ⟶ W` induces a morphism `l : X ⨿ Y ⟶ W` satisfying `coprod.inl ≫ l = f` and
247
280
`coprod.inr ≫ l = g`. -/
248
- def coprod.desc' {W X Y : C} [has_colimit (pair X Y) ] (f : X ⟶ W) (g : Y ⟶ W) :
281
+ def coprod.desc' {W X Y : C} [has_binary_coproduct X Y] (f : X ⟶ W) (g : Y ⟶ W) :
249
282
{l : X ⨿ Y ⟶ W // coprod.inl ≫ l = f ∧ coprod.inr ≫ l = g} :=
250
283
⟨coprod.desc f g, coprod.inl_desc _ _, coprod.inr_desc _ _⟩
251
284
@@ -255,12 +288,41 @@ abbreviation prod.map {W X Y Z : C} [has_limits_of_shape.{v} (discrete walking_p
255
288
(f : W ⟶ Y) (g : X ⟶ Z) : W ⨯ X ⟶ Y ⨯ Z :=
256
289
lim.map (map_pair f g)
257
290
291
+ /-- If the products `W ⨯ X` and `Y ⨯ Z` exist, then every pair of isomorphisms `f : W ≅ Y` and
292
+ `g : X ≅ Z` induces a isomorphism `prod.map_iso f g : W ⨯ X ≅ Y ⨯ Z`. -/
293
+ abbreviation prod.map_iso {W X Y Z : C} [has_limits_of_shape.{v} (discrete walking_pair) C]
294
+ (f : W ≅ Y) (g : X ≅ Z) : W ⨯ X ≅ Y ⨯ Z :=
295
+ lim.map_iso (map_pair_iso f g)
296
+
297
+ -- Note that the next two `simp` lemmas are proved by `simp`,
298
+ -- but nevertheless are useful,
299
+ -- because they state the right hand side in terms of `prod.map`
300
+ -- rather than `lim.map`.
301
+ @[simp] lemma prod.map_iso_hom {W X Y Z : C} [has_limits_of_shape.{v} (discrete walking_pair) C]
302
+ (f : W ≅ Y) (g : X ≅ Z) : (prod.map_iso f g).hom = prod.map f.hom g.hom := by simp
303
+
304
+ @[simp] lemma prod.map_iso_inv {W X Y Z : C} [has_limits_of_shape.{v} (discrete walking_pair) C]
305
+ (f : W ≅ Y) (g : X ≅ Z) : (prod.map_iso f g).inv = prod.map f.inv g.inv := by simp
306
+
258
307
/-- If the coproducts `W ⨿ X` and `Y ⨿ Z` exist, then every pair of morphisms `f : W ⟶ Y` and
259
308
`g : W ⟶ Z` induces a morphism `coprod.map f g : W ⨿ X ⟶ Y ⨿ Z`. -/
260
309
abbreviation coprod.map {W X Y Z : C} [has_colimits_of_shape.{v} (discrete walking_pair) C]
261
310
(f : W ⟶ Y) (g : X ⟶ Z) : W ⨿ X ⟶ Y ⨿ Z :=
262
311
colim.map (map_pair f g)
263
312
313
+ /-- If the coproducts `W ⨿ X` and `Y ⨿ Z` exist, then every pair of isomorphisms `f : W ≅ Y` and
314
+ `g : W ≅ Z` induces a isomorphism `coprod.map_iso f g : W ⨿ X ≅ Y ⨿ Z`. -/
315
+ abbreviation coprod.map_iso {W X Y Z : C} [has_colimits_of_shape.{v} (discrete walking_pair) C]
316
+ (f : W ≅ Y) (g : X ≅ Z) : W ⨿ X ≅ Y ⨿ Z :=
317
+ colim.map_iso (map_pair_iso f g)
318
+
319
+ @[simp] lemma coprod.map_iso_hom {W X Y Z : C} [has_colimits_of_shape.{v} (discrete walking_pair) C]
320
+ (f : W ≅ Y) (g : X ≅ Z) : (coprod.map_iso f g).hom = coprod.map f.hom g.hom := by simp
321
+
322
+ @[simp] lemma coprod.map_iso_inv {W X Y Z : C} [has_colimits_of_shape.{v} (discrete walking_pair) C]
323
+ (f : W ≅ Y) (g : X ≅ Z) : (coprod.map_iso f g).inv = coprod.map f.inv g.inv := by simp
324
+
325
+
264
326
section prod_lemmas
265
327
variable [has_limits_of_shape.{v} (discrete walking_pair) C]
266
328
0 commit comments