Skip to content

Commit d410bf6

Browse files
committed
feat(CategoryTheory): commutative group objects (#21508)
Co-authored-by: Markus Himmel <markus@lean-fro.org>
1 parent 482c515 commit d410bf6

File tree

2 files changed

+177
-0
lines changed

2 files changed

+177
-0
lines changed

Mathlib.lean

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2129,6 +2129,7 @@ import Mathlib.CategoryTheory.Monoidal.Cartesian.Mon_
21292129
import Mathlib.CategoryTheory.Monoidal.Category
21302130
import Mathlib.CategoryTheory.Monoidal.Center
21312131
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
2132+
import Mathlib.CategoryTheory.Monoidal.CommGrp_
21322133
import Mathlib.CategoryTheory.Monoidal.CommMon_
21332134
import Mathlib.CategoryTheory.Monoidal.Comon_
21342135
import Mathlib.CategoryTheory.Monoidal.Conv
Lines changed: 176 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,176 @@
1+
/-
2+
Copyright (c) 2025 Markus Himmel. All rights reserved.
3+
Released under Apache 2.0 license as described in the file LICENSE.
4+
Authors: Markus Himmel
5+
-/
6+
import Mathlib.CategoryTheory.Monoidal.Grp_
7+
import Mathlib.CategoryTheory.Monoidal.CommMon_
8+
9+
/-!
10+
# The category of commutative groups in a cartesian monoidal category
11+
-/
12+
13+
universe v₁ v₂ u₁ u₂ u
14+
15+
open CategoryTheory Category Limits MonoidalCategory ChosenFiniteProducts Mon_ Grp_ CommMon_
16+
17+
variable (C : Type u₁) [Category.{v₁} C] [ChosenFiniteProducts.{v₁} C]
18+
19+
/-- A commutative group object internal to a cartesian monoidal category. -/
20+
structure CommGrp_ extends Grp_ C, CommMon_ C where
21+
22+
/-- Turn a commutative group object into a commutative monoid object. -/
23+
add_decl_doc CommGrp_.toCommMon_
24+
25+
attribute [reassoc (attr := simp)] CommGrp_.mul_comm
26+
27+
namespace CommGrp_
28+
29+
/-- The trivial commutative group object. -/
30+
@[simps!]
31+
def trivial : CommGrp_ C :=
32+
{ Grp_.trivial C with mul_comm := by simpa using unitors_equal.symm }
33+
34+
instance : Inhabited (CommGrp_ C) where
35+
default := trivial C
36+
37+
variable {C}
38+
39+
instance : Category (CommGrp_ C) :=
40+
InducedCategory.category CommGrp_.toGrp_
41+
42+
@[simp]
43+
theorem id_hom (A : Grp_ C) : Mon_.Hom.hom (𝟙 A) = 𝟙 A.X :=
44+
rfl
45+
46+
@[simp]
47+
theorem comp_hom {R S T : CommGrp_ C} (f : R ⟶ S) (g : S ⟶ T) :
48+
Mon_.Hom.hom (f ≫ g) = f.hom ≫ g.hom :=
49+
rfl
50+
51+
@[ext]
52+
theorem hom_ext {A B : CommGrp_ C} (f g : A ⟶ B) (h : f.hom = g.hom) : f = g :=
53+
Mon_.Hom.ext h
54+
55+
@[simp]
56+
lemma id' (A : CommGrp_ C) : (𝟙 A : A.toMon_ ⟶ A.toMon_) = 𝟙 (A.toMon_) := rfl
57+
58+
@[simp]
59+
lemma comp' {A₁ A₂ A₃ : CommGrp_ C} (f : A₁ ⟶ A₂) (g : A₂ ⟶ A₃) :
60+
((f ≫ g : A₁ ⟶ A₃) : A₁.toMon_ ⟶ A₃.toMon_) = @CategoryStruct.comp (Mon_ C) _ _ _ _ f g := rfl
61+
62+
section
63+
64+
variable (C)
65+
66+
/-- The forgetful functor from commutative group objects to group objects. -/
67+
def forget₂Grp_ : CommGrp_ C ⥤ Grp_ C :=
68+
inducedFunctor CommGrp_.toGrp_
69+
70+
/-- The forgetful functor from commutative group objects to group objects is fully faithful. -/
71+
def fullyFaithfulForget₂Grp_ : (forget₂Grp_ C).FullyFaithful :=
72+
fullyFaithfulInducedFunctor _
73+
74+
instance : (forget₂Grp_ C).Full := InducedCategory.full _
75+
instance : (forget₂Grp_ C).Faithful := InducedCategory.faithful _
76+
77+
@[simp]
78+
theorem forget₂Grp_obj_one (A : CommGrp_ C) : ((forget₂Grp_ C).obj A).one = A.one :=
79+
rfl
80+
81+
@[simp]
82+
theorem forget₂Grp_obj_mul (A : CommGrp_ C) : ((forget₂Grp_ C).obj A).mul = A.mul :=
83+
rfl
84+
85+
@[simp]
86+
theorem forget₂Grp_map_hom {A B : CommGrp_ C} (f : A ⟶ B) : ((forget₂Grp_ C).map f).hom = f.hom :=
87+
rfl
88+
89+
/-- The forgetful functor from commutative group objects to commutative monoid objects. -/
90+
def forget₂CommMon_ : CommGrp_ C ⥤ CommMon_ C :=
91+
inducedFunctor CommGrp_.toCommMon_
92+
93+
/-- The forgetful functor from commutative group objects to commutative monoid objects is fully
94+
faithful. -/
95+
def fullyFaithfulForget₂CommMon_ : (forget₂CommMon_ C).FullyFaithful :=
96+
fullyFaithfulInducedFunctor _
97+
98+
instance : (forget₂CommMon_ C).Full := InducedCategory.full _
99+
instance : (forget₂CommMon_ C).Faithful := InducedCategory.faithful _
100+
101+
@[simp]
102+
theorem forget₂CommMon_obj_one (A : CommGrp_ C) : ((forget₂CommMon_ C).obj A).one = A.one :=
103+
rfl
104+
105+
@[simp]
106+
theorem forget₂CommMon_obj_mul (A : CommGrp_ C) : ((forget₂CommMon_ C).obj A).mul = A.mul :=
107+
rfl
108+
109+
@[simp]
110+
theorem forget₂CommMon_map_hom {A B : CommGrp_ C} (f : A ⟶ B) :
111+
((forget₂CommMon_ C).map f).hom = f.hom :=
112+
rfl
113+
114+
/-- The forgetful functor from commutative group objects to the ambient category. -/
115+
@[simps!]
116+
def forget : CommGrp_ C ⥤ C :=
117+
forget₂Grp_ C ⋙ Grp_.forget C
118+
119+
instance : (forget C).Faithful where
120+
121+
@[simp]
122+
theorem forget₂Grp_comp_forget : forget₂Grp_ C ⋙ Grp_.forget C = forget C := rfl
123+
124+
@[simp]
125+
theorem forget₂CommMon_comp_forget : forget₂CommMon_ C ⋙ CommMon_.forget C = forget C := rfl
126+
127+
end
128+
129+
section
130+
131+
variable {M N : CommGrp_ C} (f : M.X ≅ N.X) (one_f : M.one ≫ f.hom = N.one := by aesop_cat)
132+
(mul_f : M.mul ≫ f.hom = (f.hom ⊗ f.hom) ≫ N.mul := by aesop_cat)
133+
134+
/-- Constructor for isomorphisms in the category `Grp_ C`. -/
135+
def mkIso : M ≅ N :=
136+
(fullyFaithfulForget₂Grp_ C).preimageIso (Grp_.mkIso f one_f mul_f)
137+
138+
@[simp] lemma mkIso_hom_hom : (mkIso f one_f mul_f).hom.hom = f.hom := rfl
139+
@[simp] lemma mkIso_inv_hom : (mkIso f one_f mul_f).inv.hom = f.inv := rfl
140+
141+
end
142+
143+
instance uniqueHomFromTrivial (A : CommGrp_ C) : Unique (trivial C ⟶ A) :=
144+
Mon_.uniqueHomFromTrivial A.toMon_
145+
146+
instance : HasInitial (CommGrp_ C) :=
147+
hasInitial_of_unique (trivial C)
148+
149+
end CommGrp_
150+
151+
namespace CategoryTheory.Functor
152+
153+
variable {C} {D : Type u₂} [Category.{v₂} D] [ChosenFiniteProducts.{v₂} D] (F : C ⥤ D)
154+
variable [PreservesFiniteProducts F]
155+
156+
attribute [local instance] braidedOfChosenFiniteProducts
157+
158+
/-- A finite-product-preserving functor takes commutative group objects to commutative group
159+
objects. -/
160+
@[simps!]
161+
noncomputable def mapCommGrp : CommGrp_ C ⥤ CommGrp_ D where
162+
obj A :=
163+
{ F.mapGrp.obj A.toGrp_ with
164+
mul_comm := by
165+
dsimp
166+
rw [← Functor.LaxBraided.braided_assoc, ← Functor.map_comp, A.mul_comm] }
167+
map f := F.mapMon.map f
168+
169+
attribute [local instance] NatTrans.monoidal_of_preservesFiniteProducts in
170+
/-- `mapGrp` is functorial in the left-exact functor. -/
171+
@[simps]
172+
noncomputable def mapCommGrpFunctor : (C ⥤ₗ D) ⥤ CommGrp_ C ⥤ CommGrp_ D where
173+
obj F := F.1.mapCommGrp
174+
map {F G} α := { app := fun A => { hom := α.app A.X } }
175+
176+
end CategoryTheory.Functor

0 commit comments

Comments
 (0)