Skip to content

Commit 0e09f45

Browse files
committed
feat(CategoryTheory/Preadditive): the comma category is preadditive (leanprover-community#40890)
If we have additive functors `L : A ⥤ T` and `R : B ⥤ T` between preadditive categories, then there is a structure of preadditive category on `Comma L R` such that addition commutes with the left and right projections. We then specialize to the arrow category of a preadditive category. Co-authored-by: morel <sophie.morel@ens-lyon.fr>
1 parent c3bb4de commit 0e09f45

2 files changed

Lines changed: 123 additions & 0 deletions

File tree

Mathlib.lean

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3226,6 +3226,7 @@ public import Mathlib.CategoryTheory.Preadditive.AdditiveFunctor
32263226
public import Mathlib.CategoryTheory.Preadditive.Basic
32273227
public import Mathlib.CategoryTheory.Preadditive.Biproducts
32283228
public import Mathlib.CategoryTheory.Preadditive.CommGrp_
3229+
public import Mathlib.CategoryTheory.Preadditive.Comma
32293230
public import Mathlib.CategoryTheory.Preadditive.EilenbergMoore
32303231
public import Mathlib.CategoryTheory.Preadditive.EndoFunctor
32313232
public import Mathlib.CategoryTheory.Preadditive.FunctorCategory
Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
/-
2+
Copyright (c) 2026 Sophie Morel. All rights reserved.
3+
Released under Apache 2.0 license as described in the file LICENSE.
4+
Authors: Sophie Morel
5+
-/
6+
module
7+
8+
public import Mathlib.CategoryTheory.Preadditive.AdditiveFunctor
9+
10+
/-!
11+
# The comma category is preadditive
12+
13+
If we have additive functors `L : A ⥤ T` and `R : B ⥤ T` between preadditive categories,
14+
then there is a structure of preadditive category on `Comma L R` such that addition commutes
15+
with the left and right projections.
16+
17+
We then apply this to `Arrow T` for `T` a preadditive category.
18+
19+
## Tags
20+
21+
comma, arrow, preadditive
22+
-/
23+
24+
@[expose] public section
25+
26+
namespace CategoryTheory
27+
28+
open Category
29+
30+
universe v₁ v₂ v₃ u₁ u₂ u₃
31+
32+
variable {A : Type u₁} [Category.{v₁} A] [Preadditive A]
33+
variable {B : Type u₂} [Category.{v₂} B] [Preadditive B]
34+
variable {T : Type u₃} [Category.{v₃} T] [Preadditive T]
35+
variable (L : A ⥤ T) [L.Additive] (R : B ⥤ T) [R.Additive]
36+
variable {u v : Comma L R}
37+
38+
section Comma
39+
40+
namespace CommaMorphism
41+
42+
@[simps!]
43+
instance : Add (u ⟶ v) where
44+
add α β := CommaMorphism.mk (α.left + β.left) (α.right + β.right) (by simp)
45+
46+
@[simps!]
47+
instance : Sub (u ⟶ v) where
48+
sub α β := CommaMorphism.mk (α.left - β.left) (α.right - β.right) (by simp)
49+
50+
@[simps!]
51+
instance : Zero (u ⟶ v) where
52+
zero := CommaMorphism.mk 0 0
53+
54+
@[simps!]
55+
instance : Neg (u ⟶ v) where
56+
neg α := CommaMorphism.mk (-α.left) (-α.right)
57+
58+
end CommaMorphism
59+
60+
instance : AddCommGroup (u ⟶ v) where
61+
add_assoc _ _ _ := by ext <;> simp [add_assoc]
62+
zero_add _ := by cat_disch
63+
add_zero _ := by cat_disch
64+
add_comm _ _ := by ext <;> simp [add_comm]
65+
neg_add_cancel _ := by cat_disch
66+
sub_eq_add_neg _ _ := by ext <;> simp [sub_eq_add_neg]
67+
nsmul n α := CommaMorphism.mk (n • α.left) (n • α.right)
68+
(by simp [Functor.map_nsmul, Preadditive.comp_nsmul, Preadditive.nsmul_comp])
69+
zsmul n α := CommaMorphism.mk (n • α.left) (n • α.right)
70+
(by simp [Functor.map_zsmul, Preadditive.comp_zsmul, Preadditive.zsmul_comp])
71+
nsmul_zero := by cat_disch
72+
nsmul_succ _ _ := by ext <;> dsimp <;> simp [add_nsmul]
73+
zsmul_zero' := by cat_disch
74+
zsmul_succ' _ _ := by ext <;> dsimp <;> simp [add_zsmul]
75+
zsmul_neg' _ _ := by ext <;> dsimp <;> simp [add_nsmul, add_zsmul]
76+
77+
/-- If we have additive functors `L : A ⥤ T` and `R : B ⥤ T` between preadditive categories,
78+
then the category `Comma L R` is preadditive.
79+
-/
80+
instance : Preadditive (Comma L R) where
81+
82+
instance : (Comma.fst L R).Additive where
83+
84+
instance : (Comma.snd L R).Additive where
85+
86+
end Comma
87+
88+
section Arrow
89+
90+
/-- If a category `T` is preadditive, then so is its category of arrows.
91+
-/
92+
instance : Preadditive (Arrow T) := inferInstanceAs (Preadditive (Comma (𝟭 T) (𝟭 T)))
93+
94+
instance : (Arrow.leftFunc (C := T)).Additive :=
95+
inferInstanceAs ((Comma.fst (𝟭 T) (𝟭 T))).Additive
96+
97+
instance : (Arrow.rightFunc (C := T)).Additive :=
98+
inferInstanceAs ((Comma.snd (𝟭 T) (𝟭 T))).Additive
99+
100+
variable {u v : Arrow T}
101+
102+
@[simp]
103+
lemma Arrow.Hom.add_left (α β : u ⟶ v) : (α + β).left = α.left + β.left := rfl
104+
105+
@[simp]
106+
lemma Arrow.Hom.add_right (α β : u ⟶ v) : (α + β).right = α.right + β.right := rfl
107+
108+
@[simp]
109+
lemma Arrow.Hom.zero_left : (0 : u ⟶ v).left = 0 := rfl
110+
111+
@[simp]
112+
lemma Arrow.Hom.zero_right : (0 : u ⟶ v).right = 0 := rfl
113+
114+
@[simp]
115+
lemma Arrow.Hom.neg_left (α : u ⟶ v) : (-α).left = -α.left := rfl
116+
117+
@[simp]
118+
lemma Arrow.Hom.neg_right (α : u ⟶ v) : (-α).right = -α.right := rfl
119+
120+
end Arrow
121+
122+
end CategoryTheory

0 commit comments

Comments
 (0)