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

Commit 7848f28

Browse files
committed
feat(category_theory): Mon_ (Type u) ≌ Mon.{u} (#3562)
Verifying that internal monoid objects in Type are the same thing as bundled monoid objects. Co-authored-by: Scott Morrison <scott.morrison@gmail.com>
1 parent 9e841c8 commit 7848f28

File tree

7 files changed

+421
-10
lines changed

7 files changed

+421
-10
lines changed

src/algebra/category/Group/zero.lean

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ namespace Group
2323
@[to_additive AddGroup.has_zero_object]
2424
instance : has_zero_object Group :=
2525
{ zero := 1,
26-
unique_to := λ X, ⟨⟨1⟩, λ f, begin ext, cases x, erw monoid_hom.map_one, refl end⟩,
27-
unique_from := λ X, ⟨⟨1⟩, λ f, begin ext, apply subsingleton.elim, end⟩, }
26+
unique_to := λ X, ⟨⟨1⟩, λ f, by { ext, cases x, erw monoid_hom.map_one, refl, }⟩,
27+
unique_from := λ X, ⟨⟨1⟩, λ f, by ext⟩, }
2828

2929
end Group
3030

@@ -33,7 +33,7 @@ namespace CommGroup
3333
@[to_additive AddCommGroup.has_zero_object]
3434
instance : has_zero_object CommGroup :=
3535
{ zero := 1,
36-
unique_to := λ X, ⟨⟨1⟩, λ f, begin ext, cases x, erw monoid_hom.map_one, refl end⟩,
37-
unique_from := λ X, ⟨⟨1⟩, λ f, begin ext, apply subsingleton.elim, end⟩, }
36+
unique_to := λ X, ⟨⟨1⟩, λ f, by { ext, cases x, erw monoid_hom.map_one, refl, }⟩,
37+
unique_from := λ X, ⟨⟨1⟩, λ f, by ext⟩, }
3838

3939
end CommGroup
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
/-
2+
Copyright (c) 2020 Scott Morrison. All rights reserved.
3+
Released under Apache 2.0 license as described in the file LICENSE.
4+
Authors: Scott Morrison
5+
-/
6+
import category_theory.limits.types
7+
import category_theory.limits.shapes.products
8+
import category_theory.limits.shapes.binary_products
9+
import category_theory.limits.shapes.terminal
10+
11+
/-!
12+
# Special shapes for limits in `Type`.
13+
14+
The general shape (co)limits defined in `category_theory.limits.types`
15+
are intended for use through the limits API,
16+
and the actual implementation should mostly be considered "sealed".
17+
18+
In this file, we provide definitions of the "standard" special shapes of limits in `Type`,
19+
giving the expected definitional implementation:
20+
* the terminal object is `punit`
21+
* the binary product of `X` and `Y` is `X × Y`
22+
* the product of a family `f : J → Type` is `Π j, f j`.
23+
24+
It is not intended that these definitions will be global instances:
25+
they should be turned on as needed.
26+
27+
The exception to this rule is that the monoidal category structure on `Type`
28+
uses these definitions.
29+
-/
30+
31+
universes u
32+
33+
open category_theory
34+
open category_theory.limits
35+
36+
namespace category_theory.limits.types
37+
38+
/-- The category of types has `punit` as a terminal object. -/
39+
def types_has_terminal : has_terminal (Type u) :=
40+
{ has_limits_of_shape :=
41+
{ has_limit := λ F,
42+
{ cone :=
43+
{ X := punit,
44+
π := by tidy, },
45+
is_limit := by tidy, } } }
46+
47+
open category_theory.limits.walking_pair
48+
49+
local attribute [tidy] tactic.case_bash
50+
51+
/--
52+
The category of types has `X × Y`, the usual cartesian product,
53+
as the binary product of `X` and `Y`.
54+
-/
55+
def types_has_binary_products : has_binary_products (Type u) :=
56+
{ has_limits_of_shape :=
57+
{ has_limit := λ F,
58+
{ cone :=
59+
{ X := F.obj left × F.obj right,
60+
π :=
61+
{ app := by { rintro ⟨_|_⟩, exact prod.fst, exact prod.snd, } }, },
62+
is_limit :=
63+
{ lift := λ s x, (s.π.app left x, s.π.app right x),
64+
uniq' := λ s m w,
65+
begin
66+
ext,
67+
exact congr_fun (w left) x,
68+
exact congr_fun (w right) x,
69+
end }, } } }
70+
71+
/--
72+
The category of types has `Π j, f j` as the product of a type family `f : J → Type`.
73+
-/
74+
def types_has_products : has_products (Type u) :=
75+
{ has_limits_of_shape := λ J,
76+
{ has_limit := λ F,
77+
{ cone :=
78+
{ X := Π j, F.obj j,
79+
π :=
80+
{ app := λ j f, f j }, },
81+
is_limit :=
82+
{ lift := λ s x j, s.π.app j x,
83+
uniq' := λ s m w,
84+
begin
85+
ext x j,
86+
have := congr_fun (w j) x,
87+
exact this,
88+
end }, } } }
89+
90+
local attribute [instance] types_has_terminal types_has_binary_products types_has_products
91+
92+
@[simp] lemma terminal : (⊤_ (Type u)) = punit := rfl
93+
lemma terminal_from {P : Type u} (f : P ⟶ ⊤_ (Type u)) (p : P) : f p = punit.star :=
94+
by ext
95+
96+
@[simp] lemma prod (X Y : Type u) : limits.prod X Y = prod X Y := rfl
97+
@[simp] lemma prod_fst {X Y : Type u} (p : limits.prod X Y) :
98+
(@limits.prod.fst.{u} _ _ X Y _ : limits.prod X Y → X) p = p.1 := rfl
99+
@[simp] lemma prod_snd {X Y : Type u} (p : limits.prod X Y) :
100+
(@limits.prod.snd.{u} _ _ X Y _ : limits.prod X Y → Y) p = p.2 := rfl
101+
102+
@[simp] lemma prod_lift {X Y Z : Type u} {f : X ⟶ Y} {g : X ⟶ Z} :
103+
limits.prod.lift f g = (λ x, (f x, g x)) := rfl
104+
@[simp] lemma prod_map {W X Y Z : Type u} {f : W ⟶ X} {g : Y ⟶ Z} :
105+
limits.prod.map f g = (λ p : W × Y, (f p.1, g p.2)) := rfl
106+
107+
end category_theory.limits.types
Lines changed: 207 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,207 @@
1+
/-
2+
Copyright (c) 2020 Scott Morrison. All rights reserved.
3+
Released under Apache 2.0 license as described in the file LICENSE.
4+
Authors: Scott Morrison
5+
-/
6+
import category_theory.monoidal.category
7+
8+
/-!
9+
# The category of monoids in a monoidal category, and modules over an internal monoid.
10+
-/
11+
12+
universes v u
13+
14+
open category_theory
15+
16+
variables (C : Type u) [category.{v} C] [monoidal_category.{v} C]
17+
18+
/--
19+
A monoid object internal to a monoidal category.
20+
21+
When the monoidal category is preadditive, this is also sometimes called an "algebra object".
22+
-/
23+
structure Mon_ :=
24+
(X : C)
25+
(one : 𝟙_ C ⟶ X)
26+
(mul : X ⊗ X ⟶ X)
27+
(one_mul' : (one ⊗ 𝟙 X) ≫ mul = (λ_ X).hom . obviously)
28+
(mul_one' : (𝟙 X ⊗ one) ≫ mul = (ρ_ X).hom . obviously)
29+
-- Obviously there is some flexibility stating this axiom.
30+
-- This one has left- and right-hand sides matching the statement of `monoid.mul_assoc`,
31+
-- and chooses to place the associator on the right-hand side.
32+
-- The heuristic is that unitors and associators "don't have much weight".
33+
(mul_assoc' : (mul ⊗ 𝟙 X) ≫ mul = (α_ X X X).hom ≫ (𝟙 X ⊗ mul) ≫ mul . obviously)
34+
35+
restate_axiom Mon_.one_mul'
36+
restate_axiom Mon_.mul_one'
37+
restate_axiom Mon_.mul_assoc'
38+
attribute [simp, reassoc] Mon_.one_mul Mon_.mul_one Mon_.mul_assoc
39+
40+
namespace Mon_
41+
42+
variables {C}
43+
44+
variables {M : Mon_ C}
45+
46+
lemma assoc_flip : (𝟙 M.X ⊗ M.mul) ≫ M.mul = (α_ M.X M.X M.X).inv ≫ (M.mul ⊗ 𝟙 M.X) ≫ M.mul :=
47+
by simp
48+
49+
/-- A morphism of monoid objects. -/
50+
@[ext]
51+
structure hom (M N : Mon_ C) :=
52+
(hom : M.X ⟶ N.X)
53+
(one_hom' : M.one ≫ hom = N.one . obviously)
54+
(mul_hom' : M.mul ≫ hom = (hom ⊗ hom) ≫ N.mul . obviously)
55+
56+
restate_axiom hom.one_hom'
57+
restate_axiom hom.mul_hom'
58+
attribute [simp, reassoc] hom.one_hom hom.mul_hom
59+
60+
/-- The identity morphism on a monoid object. -/
61+
@[simps]
62+
def id (M : Mon_ C) : hom M M :=
63+
{ hom := 𝟙 M.X, }
64+
65+
instance hom_inhabited (M : Mon_ C) : inhabited (hom M M) := ⟨id M⟩
66+
67+
/-- Composition of morphisms of monoid objects. -/
68+
@[simps]
69+
def comp {M N O : Mon_ C} (f : hom M N) (g : hom N O) : hom M O :=
70+
{ hom := f.hom ≫ g.hom, }
71+
72+
instance : category (Mon_ C) :=
73+
{ hom := λ M N, hom M N,
74+
id := id,
75+
comp := λ M N O f g, comp f g, }
76+
77+
@[simp] lemma id_hom' (M : Mon_ C) : (𝟙 M : hom M M).hom = 𝟙 M.X := rfl
78+
@[simp] lemma comp_hom' {M N K : Mon_ C} (f : M ⟶ N) (g : N ⟶ K) :
79+
(f ≫ g : hom M K).hom = f.hom ≫ g.hom := rfl
80+
81+
/-- The forgetful functor from monoid objects to the ambient category. -/
82+
def forget : Mon_ C ⥤ C :=
83+
{ obj := λ A, A.X,
84+
map := λ A B f, f.hom, }
85+
86+
end Mon_
87+
88+
-- PROJECT: lax monoidal functors `C ⥤ D` induce functors `Mon_ C ⥤ Mon_ D`.
89+
90+
variables {C}
91+
92+
/-- A module object for a monoid object, all internal to some monoidal category. -/
93+
structure Mod (A : Mon_ C) :=
94+
(X : C)
95+
(act : A.X ⊗ X ⟶ X)
96+
(one_act' : (A.one ⊗ 𝟙 X) ≫ act = (λ_ X).hom . obviously)
97+
(assoc' : (A.mul ⊗ 𝟙 X) ≫ act = (α_ A.X A.X X).hom ≫ (𝟙 A.X ⊗ act) ≫ act . obviously)
98+
99+
restate_axiom Mod.one_act'
100+
restate_axiom Mod.assoc'
101+
attribute [simp, reassoc] Mod.one_act Mod.assoc
102+
103+
namespace Mod
104+
105+
variables {A : Mon_ C} (M : Mod A)
106+
107+
lemma assoc_flip : (𝟙 A.X ⊗ M.act) ≫ M.act = (α_ A.X A.X M.X).inv ≫ (A.mul ⊗ 𝟙 M.X) ≫ M.act :=
108+
by simp
109+
110+
/-- A morphism of module objects. -/
111+
@[ext]
112+
structure hom (M N : Mod A) :=
113+
(hom : M.X ⟶ N.X)
114+
(act_hom' : M.act ≫ hom = (𝟙 A.X ⊗ hom) ≫ N.act . obviously)
115+
116+
restate_axiom hom.act_hom'
117+
attribute [simp, reassoc] hom.act_hom
118+
119+
/-- The identity morphism on a module object. -/
120+
@[simps]
121+
def id (M : Mod A) : hom M M :=
122+
{ hom := 𝟙 M.X, }
123+
124+
instance hom_inhabited (M : Mod A) : inhabited (hom M M) := ⟨id M⟩
125+
126+
/-- Composition of module object morphisms. -/
127+
@[simps]
128+
def comp {M N O : Mod A} (f : hom M N) (g : hom N O) : hom M O :=
129+
{ hom := f.hom ≫ g.hom, }
130+
131+
instance : category (Mod A) :=
132+
{ hom := λ M N, hom M N,
133+
id := id,
134+
comp := λ M N O f g, comp f g, }
135+
136+
@[simp] lemma id_hom' (M : Mod A) : (𝟙 M : hom M M).hom = 𝟙 M.X := rfl
137+
@[simp] lemma comp_hom' {M N K : Mod A} (f : M ⟶ N) (g : N ⟶ K) :
138+
(f ≫ g : hom M K).hom = f.hom ≫ g.hom := rfl
139+
140+
variables (A)
141+
142+
/-- A monoid object as a module over itself. -/
143+
@[simps]
144+
def regular : Mod A :=
145+
{ X := A.X,
146+
act := A.mul, }
147+
148+
instance : inhabited (Mod A) := ⟨regular A⟩
149+
150+
open category_theory.monoidal_category
151+
152+
/--
153+
A morphism of monoid objects induces a "restriction" or "comap" functor
154+
between the categories of module objects.
155+
-/
156+
@[simps]
157+
def comap {A B : Mon_ C} (f : A ⟶ B) : Mod B ⥤ Mod A :=
158+
{ obj := λ M,
159+
{ X := M.X,
160+
act := (f.hom ⊗ 𝟙 M.X) ≫ M.act,
161+
one_act' :=
162+
begin
163+
slice_lhs 1 2 { rw [←comp_tensor_id], },
164+
rw [f.one_hom, one_act],
165+
end,
166+
assoc' :=
167+
begin
168+
-- oh, for homotopy.io in a widget!
169+
slice_rhs 2 3 { rw [id_tensor_comp_tensor_id, ←tensor_id_comp_id_tensor], },
170+
rw id_tensor_comp,
171+
slice_rhs 4 5 { rw Mod.assoc_flip, },
172+
slice_rhs 3 4 { rw associator_inv_naturality, },
173+
slice_rhs 2 3 { rw [←tensor_id, associator_inv_naturality], },
174+
slice_rhs 1 3 { rw [iso.hom_inv_id_assoc], },
175+
slice_rhs 1 2 { rw [←comp_tensor_id, tensor_id_comp_id_tensor], },
176+
slice_rhs 1 2 { rw [←comp_tensor_id, ←f.mul_hom], },
177+
rw [comp_tensor_id, category.assoc],
178+
end, },
179+
map := λ M N g,
180+
{ hom := g.hom,
181+
act_hom' :=
182+
begin
183+
dsimp,
184+
slice_rhs 1 2 { rw [id_tensor_comp_tensor_id, ←tensor_id_comp_id_tensor], },
185+
slice_rhs 2 3 { rw ←g.act_hom, },
186+
rw category.assoc,
187+
end }, }
188+
189+
-- Lots more could be said about `comap`, e.g. how it interacts with
190+
-- identities, compositions, and equalities of monoid object morphisms.
191+
192+
end Mod
193+
194+
/-!
195+
Projects:
196+
* Check that `Mon_ Mon ≌ CommMon`, via the Eckmann-Hilton argument.
197+
(You'll have to hook up the cartesian monoidal structure on `Mon` first, available in #3463)
198+
* Check that `Mon_ Top ≌ [bundled topological monoids]`.
199+
* Check that `Mon_ AddCommGroup ≌ Ring`.
200+
(You'll have to hook up the monoidal structure on `AddCommGroup`.
201+
Currently we have the monoidal structure on `Module R`; perhaps one could specialize to `R = ℤ`
202+
and transport the monoidal structure across an equivalence? This sounds like some work!)
203+
* Check that `Mon_ (Module R) ≌ Algebra R`.
204+
* Show that if `C` is braided (see #3550) then `Mon_ C` is naturally monoidal.
205+
* Can you transport this monoidal structure to `Ring` or `Algebra R`?
206+
How does it compare to the "native" one?
207+
-/

0 commit comments

Comments
 (0)