Skip to content
This repository was archived by the owner on Jul 24, 2024. It is now read-only.

Commit 51c9b60

Browse files
committed
feat(category_theory/biproducts): additional lemmas (#6881)
Co-authored-by: Scott Morrison <scott.morrison@gmail.com>
1 parent 6c59845 commit 51c9b60

File tree

1 file changed

+105
-13
lines changed

1 file changed

+105
-13
lines changed

src/category_theory/limits/shapes/biproducts.lean

Lines changed: 105 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -163,12 +163,12 @@ attribute [instance, priority 100] has_finite_biproducts.has_biproducts_of_shape
163163
@[priority 100]
164164
instance has_finite_products_of_has_finite_biproducts [has_finite_biproducts C] :
165165
has_finite_products C :=
166-
λ J _ _, ⟨λ F, by exactI has_limit_of_iso discrete.nat_iso_functor.symm⟩
166+
{ out := λ J _ _, ⟨λ F, by exactI has_limit_of_iso discrete.nat_iso_functor.symm⟩ }
167167

168168
@[priority 100]
169169
instance has_finite_coproducts_of_has_finite_biproducts [has_finite_biproducts C] :
170170
has_finite_coproducts C :=
171-
λ J _ _, ⟨λ F, by exactI has_colimit_of_iso discrete.nat_iso_functor⟩
171+
{ out := λ J _ _, ⟨λ F, by exactI has_colimit_of_iso discrete.nat_iso_functor⟩ }
172172

173173
variables {J C}
174174

@@ -264,7 +264,7 @@ is_colimit.map (biproduct.is_colimit f) (biproduct.bicone g).to_cocone (discrete
264264

265265
@[ext] lemma biproduct.hom_ext' {f : J → C} [has_biproduct f]
266266
{Z : C} (g h : ⨁ f ⟶ Z)
267-
(w : ∀ j, biproduct.ι f j ≫ g = biproduct.ι f j ≫ h) : g = h :=
267+
(w : ∀ j, biproduct.ι f j ≫ g = biproduct.ι f j ≫ h) : g = h :=
268268
(biproduct.is_colimit f).hom_ext w
269269

270270
lemma biproduct.map_eq_map' [fintype J] {f g : J → C} [has_finite_biproducts C]
@@ -280,16 +280,6 @@ begin
280280
{ simp, },
281281
end
282282

283-
instance biproduct.ι_mono (f : J → C) [has_biproduct f]
284-
(b : J) : split_mono (biproduct.ι f b) :=
285-
{ retraction := biproduct.desc $
286-
λ b', if h : b' = b then eq_to_hom (congr_arg f h) else biproduct.ι f b' ≫ biproduct.π f b }
287-
288-
instance biproduct.π_epi (f : J → C) [has_biproduct f]
289-
(b : J) : split_epi (biproduct.π f b) :=
290-
{ section_ := biproduct.lift $
291-
λ b', if h : b = b' then eq_to_hom (congr_arg f h) else biproduct.ι f b ≫ biproduct.π f b' }
292-
293283
@[simp, reassoc]
294284
lemma biproduct.map_π [fintype J] {f g : J → C} [has_finite_biproducts C]
295285
(p : Π j, f j ⟶ g j) (j : J) :
@@ -305,6 +295,80 @@ begin
305295
convert limits.is_colimit.ι_map _ _ _ _; refl
306296
end
307297

298+
@[simp, reassoc]
299+
lemma biproduct.map_desc [fintype J] {f g : J → C} [has_finite_biproducts C]
300+
(p : Π j, f j ⟶ g j) {P : C} (k : Π j, g j ⟶ P) :
301+
biproduct.map p ≫ biproduct.desc k = biproduct.desc (λ j, p j ≫ k j) :=
302+
by { ext, simp, }
303+
304+
@[simp, reassoc]
305+
lemma biproduct.lift_map [fintype J] {f g : J → C} [has_finite_biproducts C]
306+
{P : C} (k : Π j, P ⟶ f j) (p : Π j, f j ⟶ g j) :
307+
biproduct.lift k ≫ biproduct.map p = biproduct.lift (λ j, k j ≫ p j) :=
308+
by { ext, simp, }
309+
310+
/-- Given a collection of isomorphisms between corresponding summands of a pair of biproducts
311+
indexed by the same type, we obtain an isomorphism between the biproducts. -/
312+
@[simps]
313+
def biproduct.map_iso [fintype J] {f g : J → C} [has_finite_biproducts C]
314+
(p : Π b, f b ≅ g b) : ⨁ f ≅ ⨁ g :=
315+
{ hom := biproduct.map (λ b, (p b).hom),
316+
inv := biproduct.map (λ b, (p b).inv), }
317+
318+
section
319+
variables [fintype J] {K : Type v} [fintype K] [decidable_eq K] {f : J → C} {g : K → C}
320+
[has_finite_biproducts C]
321+
322+
/--
323+
Convert a (dependently typed) matrix to a morphism of biproducts.
324+
-/
325+
def biproduct.matrix (m : Π j k, f j ⟶ g k) : ⨁ f ⟶ ⨁ g :=
326+
biproduct.desc (λ j, biproduct.lift (λ k, m j k))
327+
328+
@[simp, reassoc]
329+
lemma biproduct.matrix_π (m : Π j k, f j ⟶ g k) (k : K) :
330+
biproduct.matrix m ≫ biproduct.π g k = biproduct.desc (λ j, m j k) :=
331+
by { ext, simp [biproduct.matrix], }
332+
333+
@[simp, reassoc]
334+
lemma biproduct.ι_matrix (m : Π j k, f j ⟶ g k) (j : J) :
335+
biproduct.ι f j ≫ biproduct.matrix m = biproduct.lift (λ k, m j k) :=
336+
by { ext, simp [biproduct.matrix], }
337+
338+
/--
339+
Extract the matrix components from a morphism of biproducts.
340+
-/
341+
def biproduct.components (m : ⨁ f ⟶ ⨁ g) (j : J) (k : K) : f j ⟶ g k :=
342+
biproduct.ι f j ≫ m ≫ biproduct.π g k
343+
344+
@[simp] lemma biproduct.matrix_components (m : Π j k, f j ⟶ g k) (j : J) (k : K) :
345+
biproduct.components (biproduct.matrix m) j k = m j k :=
346+
by simp [biproduct.components]
347+
348+
@[simp] lemma biproduct.components_matrix (m : ⨁ f ⟶ ⨁ g) :
349+
biproduct.matrix (λ j k, biproduct.components m j k) = m :=
350+
by { ext, simp [biproduct.components], }
351+
352+
/-- Morphisms between direct sums are matrices. -/
353+
@[simps]
354+
def biproduct.matrix_equiv : (⨁ f ⟶ ⨁ g) ≃ (Π j k, f j ⟶ g k) :=
355+
{ to_fun := biproduct.components,
356+
inv_fun := biproduct.matrix,
357+
left_inv := biproduct.components_matrix,
358+
right_inv := λ m, by { ext, apply biproduct.matrix_components } }
359+
360+
end
361+
362+
instance biproduct.ι_mono (f : J → C) [has_biproduct f]
363+
(b : J) : split_mono (biproduct.ι f b) :=
364+
{ retraction := biproduct.desc $
365+
λ b', if h : b' = b then eq_to_hom (congr_arg f h) else biproduct.ι f b' ≫ biproduct.π f b }
366+
367+
instance biproduct.π_epi (f : J → C) [has_biproduct f]
368+
(b : J) : split_epi (biproduct.π f b) :=
369+
{ section_ := biproduct.lift $
370+
λ b', if h : b = b' then eq_to_hom (congr_arg f h) else biproduct.ι f b ≫ biproduct.π f b' }
371+
308372
variables {C}
309373

310374
/--
@@ -881,6 +945,34 @@ begin
881945
simp [biproduct.ι_π, biproduct.ι_π_assoc, comp_sum, sum_comp, comp_dite, dite_comp],
882946
end
883947

948+
@[simp, reassoc]
949+
lemma biproduct.matrix_desc
950+
{K : Type v} [fintype K] [decidable_eq K] [has_finite_biproducts C]
951+
{f : J → C} {g : K → C} (m : Π j k, f j ⟶ g k) {P} (x : Π k, g k ⟶ P) :
952+
biproduct.matrix m ≫ biproduct.desc x = biproduct.desc (λ j, ∑ k, m j k ≫ x k) :=
953+
by { ext, simp, }
954+
955+
@[simp, reassoc]
956+
lemma biproduct.lift_matrix
957+
{K : Type v} [fintype K] [decidable_eq K] [has_finite_biproducts C]
958+
{f : J → C} {g : K → C} {P} (x : Π j, P ⟶ f j) (m : Π j k, f j ⟶ g k) :
959+
biproduct.lift x ≫ biproduct.matrix m = biproduct.lift (λ k, ∑ j, x j ≫ m j k) :=
960+
by { ext, simp, }
961+
962+
@[reassoc]
963+
lemma biproduct.matrix_map
964+
{K : Type v} [fintype K] [decidable_eq K] [has_finite_biproducts C]
965+
{f : J → C} {g : K → C} {h : K → C} (m : Π j k, f j ⟶ g k) (n : Π k, g k ⟶ h k) :
966+
biproduct.matrix m ≫ biproduct.map n = biproduct.matrix (λ j k, m j k ≫ n k) :=
967+
by { ext, simp, }
968+
969+
@[reassoc]
970+
lemma biproduct.map_matrix
971+
{K : Type v} [fintype K] [decidable_eq K] [has_finite_biproducts C]
972+
{f : J → C} {g : J → C} {h : K → C} (m : Π k, f k ⟶ g k) (n : Π j k, g j ⟶ h k) :
973+
biproduct.map m ≫ biproduct.matrix n = biproduct.matrix (λ j k, m j ≫ n j k) :=
974+
by { ext, simp, }
975+
884976
end
885977

886978
/--

0 commit comments

Comments
 (0)