state
stringlengths 0
159k
| srcUpToTactic
stringlengths 387
167k
| nextTactic
stringlengths 3
9k
| declUpToTactic
stringlengths 22
11.5k
| declId
stringlengths 38
95
| decl
stringlengths 16
1.89k
| file_tag
stringlengths 17
73
|
---|---|---|---|---|---|---|
C : Type u₁
inst✝³ : Category.{v₁, u₁} C
inst✝² : MonoidalCategory C
D : Type u₂
inst✝¹ : Category.{v₂, u₂} D
inst✝ : MonoidalCategory D
F : LaxMonoidalFunctor C D
A : Mon_ C
⊢ (𝟙 (F.obj A.X) ⊗ F.ε ≫ F.map A.one) ≫ μ F A.X A.X ≫ F.map A.mul = (ρ_ (F.obj A.X)).hom | /-
Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/
import Mathlib.CategoryTheory.Monoidal.Braided
import Mathlib.CategoryTheory.Monoidal.Discrete
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
import Mathlib.Algebra.PUnitInstances
#align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c"
/-!
# The category of monoids in a monoidal category.
We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to
the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if
`C` is braided, then the category of monoids is naturally monoidal.
-/
set_option linter.uppercaseLean3 false
universe v₁ v₂ u₁ u₂ u
open CategoryTheory MonoidalCategory
variable (C : Type u₁) [Category.{v₁} C] [MonoidalCategory.{v₁} C]
/-- A monoid object internal to a monoidal category.
When the monoidal category is preadditive, this is also sometimes called an "algebra object".
-/
structure Mon_ where
X : C
one : 𝟙_ C ⟶ X
mul : X ⊗ X ⟶ X
one_mul : (one ⊗ 𝟙 X) ≫ mul = (λ_ X).hom := by aesop_cat
mul_one : (𝟙 X ⊗ one) ≫ mul = (ρ_ X).hom := by aesop_cat
-- Obviously there is some flexibility stating this axiom.
-- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`,
-- and chooses to place the associator on the right-hand side.
-- The heuristic is that unitors and associators "don't have much weight".
mul_assoc : (mul ⊗ 𝟙 X) ≫ mul = (α_ X X X).hom ≫ (𝟙 X ⊗ mul) ≫ mul := by aesop_cat
#align Mon_ Mon_
attribute [reassoc] Mon_.one_mul Mon_.mul_one
-- We prove a more general `@[simp]` lemma below.
attribute [reassoc (attr := simp)] Mon_.mul_assoc
namespace Mon_
/-- The trivial monoid object. We later show this is initial in `Mon_ C`.
-/
@[simps]
def trivial : Mon_ C where
X := 𝟙_ C
one := 𝟙 _
mul := (λ_ _).hom
mul_assoc := by coherence
mul_one := by coherence
#align Mon_.trivial Mon_.trivial
instance : Inhabited (Mon_ C) :=
⟨trivial C⟩
variable {C}
variable {M : Mon_ C}
@[simp]
theorem one_mul_hom {Z : C} (f : Z ⟶ M.X) : (M.one ⊗ f) ≫ M.mul = (λ_ Z).hom ≫ f := by
rw [← id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality]
#align Mon_.one_mul_hom Mon_.one_mul_hom
@[simp]
theorem mul_one_hom {Z : C} (f : Z ⟶ M.X) : (f ⊗ M.one) ≫ M.mul = (ρ_ Z).hom ≫ f := by
rw [← tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality]
#align Mon_.mul_one_hom Mon_.mul_one_hom
theorem assoc_flip :
(𝟙 M.X ⊗ M.mul) ≫ M.mul = (α_ M.X M.X M.X).inv ≫ (M.mul ⊗ 𝟙 M.X) ≫ M.mul := by simp
#align Mon_.assoc_flip Mon_.assoc_flip
/-- A morphism of monoid objects. -/
@[ext]
structure Hom (M N : Mon_ C) where
hom : M.X ⟶ N.X
one_hom : M.one ≫ hom = N.one := by aesop_cat
mul_hom : M.mul ≫ hom = (hom ⊗ hom) ≫ N.mul := by aesop_cat
#align Mon_.hom Mon_.Hom
attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom
/-- The identity morphism on a monoid object. -/
@[simps]
def id (M : Mon_ C) : Hom M M where
hom := 𝟙 M.X
#align Mon_.id Mon_.id
instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) :=
⟨id M⟩
#align Mon_.hom_inhabited Mon_.homInhabited
/-- Composition of morphisms of monoid objects. -/
@[simps]
def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where
hom := f.hom ≫ g.hom
#align Mon_.comp Mon_.comp
instance : Category (Mon_ C) where
Hom M N := Hom M N
id := id
comp f g := comp f g
-- Porting note: added, as `Hom.ext` does not apply to a morphism.
@[ext]
lemma ext {X Y : Mon_ C} {f g : X ⟶ Y} (w : f.hom = g.hom) : f = g :=
Hom.ext _ _ w
@[simp]
theorem id_hom' (M : Mon_ C) : (𝟙 M : Hom M M).hom = 𝟙 M.X :=
rfl
#align Mon_.id_hom' Mon_.id_hom'
@[simp]
theorem comp_hom' {M N K : Mon_ C} (f : M ⟶ N) (g : N ⟶ K) :
(f ≫ g : Hom M K).hom = f.hom ≫ g.hom :=
rfl
#align Mon_.comp_hom' Mon_.comp_hom'
section
variable (C)
/-- The forgetful functor from monoid objects to the ambient category. -/
@[simps]
def forget : Mon_ C ⥤ C where
obj A := A.X
map f := f.hom
#align Mon_.forget Mon_.forget
end
instance forget_faithful : Faithful (@forget C _ _) where
#align Mon_.forget_faithful Mon_.forget_faithful
instance {A B : Mon_ C} (f : A ⟶ B) [e : IsIso ((forget C).map f)] : IsIso f.hom :=
e
/-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/
instance : ReflectsIsomorphisms (forget C) where
reflects f e :=
⟨⟨{ hom := inv f.hom
mul_hom := by
simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, ← tensor_comp_assoc,
IsIso.inv_hom_id, tensor_id, Category.id_comp] },
by aesop_cat⟩⟩
/-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X ≅ N.X) (one_f : M.one ≫ f.hom = N.one)
(mul_f : M.mul ≫ f.hom = (f.hom ⊗ f.hom) ≫ N.mul) : M ≅ N where
hom :=
{ hom := f.hom
one_hom := one_f
mul_hom := mul_f }
inv :=
{ hom := f.inv
one_hom := by rw [← one_f]; simp
mul_hom := by
rw [← cancel_mono f.hom]
slice_rhs 2 3 => rw [mul_f]
simp }
#align Mon_.iso_of_iso Mon_.isoOfIso
instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C ⟶ A) where
default :=
{ hom := A.one
one_hom := by dsimp; simp
mul_hom := by dsimp; simp [A.one_mul, unitors_equal] }
uniq f := by
ext; simp
rw [← Category.id_comp f.hom]
erw [f.one_hom]
#align Mon_.unique_hom_from_trivial Mon_.uniqueHomFromTrivial
open CategoryTheory.Limits
instance : HasInitial (Mon_ C) :=
hasInitial_of_unique (trivial C)
end Mon_
namespace CategoryTheory.LaxMonoidalFunctor
variable {C} {D : Type u₂} [Category.{v₂} D] [MonoidalCategory.{v₂} D]
-- TODO: mapMod F A : Mod A ⥤ Mod (F.mapMon A)
/-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
| conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id] | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
| Mathlib.CategoryTheory.Monoidal.Mon_.202_0.NTUMzhXPwXsmsYt | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A | Mathlib_CategoryTheory_Monoidal_Mon_ |
C : Type u₁
inst✝³ : Category.{v₁, u₁} C
inst✝² : MonoidalCategory C
D : Type u₂
inst✝¹ : Category.{v₂, u₂} D
inst✝ : MonoidalCategory D
F : LaxMonoidalFunctor C D
A : Mon_ C
| (𝟙 (F.obj A.X) ⊗ F.ε ≫ F.map A.one) ≫ μ F A.X A.X ≫ F.map A.mul | /-
Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/
import Mathlib.CategoryTheory.Monoidal.Braided
import Mathlib.CategoryTheory.Monoidal.Discrete
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
import Mathlib.Algebra.PUnitInstances
#align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c"
/-!
# The category of monoids in a monoidal category.
We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to
the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if
`C` is braided, then the category of monoids is naturally monoidal.
-/
set_option linter.uppercaseLean3 false
universe v₁ v₂ u₁ u₂ u
open CategoryTheory MonoidalCategory
variable (C : Type u₁) [Category.{v₁} C] [MonoidalCategory.{v₁} C]
/-- A monoid object internal to a monoidal category.
When the monoidal category is preadditive, this is also sometimes called an "algebra object".
-/
structure Mon_ where
X : C
one : 𝟙_ C ⟶ X
mul : X ⊗ X ⟶ X
one_mul : (one ⊗ 𝟙 X) ≫ mul = (λ_ X).hom := by aesop_cat
mul_one : (𝟙 X ⊗ one) ≫ mul = (ρ_ X).hom := by aesop_cat
-- Obviously there is some flexibility stating this axiom.
-- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`,
-- and chooses to place the associator on the right-hand side.
-- The heuristic is that unitors and associators "don't have much weight".
mul_assoc : (mul ⊗ 𝟙 X) ≫ mul = (α_ X X X).hom ≫ (𝟙 X ⊗ mul) ≫ mul := by aesop_cat
#align Mon_ Mon_
attribute [reassoc] Mon_.one_mul Mon_.mul_one
-- We prove a more general `@[simp]` lemma below.
attribute [reassoc (attr := simp)] Mon_.mul_assoc
namespace Mon_
/-- The trivial monoid object. We later show this is initial in `Mon_ C`.
-/
@[simps]
def trivial : Mon_ C where
X := 𝟙_ C
one := 𝟙 _
mul := (λ_ _).hom
mul_assoc := by coherence
mul_one := by coherence
#align Mon_.trivial Mon_.trivial
instance : Inhabited (Mon_ C) :=
⟨trivial C⟩
variable {C}
variable {M : Mon_ C}
@[simp]
theorem one_mul_hom {Z : C} (f : Z ⟶ M.X) : (M.one ⊗ f) ≫ M.mul = (λ_ Z).hom ≫ f := by
rw [← id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality]
#align Mon_.one_mul_hom Mon_.one_mul_hom
@[simp]
theorem mul_one_hom {Z : C} (f : Z ⟶ M.X) : (f ⊗ M.one) ≫ M.mul = (ρ_ Z).hom ≫ f := by
rw [← tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality]
#align Mon_.mul_one_hom Mon_.mul_one_hom
theorem assoc_flip :
(𝟙 M.X ⊗ M.mul) ≫ M.mul = (α_ M.X M.X M.X).inv ≫ (M.mul ⊗ 𝟙 M.X) ≫ M.mul := by simp
#align Mon_.assoc_flip Mon_.assoc_flip
/-- A morphism of monoid objects. -/
@[ext]
structure Hom (M N : Mon_ C) where
hom : M.X ⟶ N.X
one_hom : M.one ≫ hom = N.one := by aesop_cat
mul_hom : M.mul ≫ hom = (hom ⊗ hom) ≫ N.mul := by aesop_cat
#align Mon_.hom Mon_.Hom
attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom
/-- The identity morphism on a monoid object. -/
@[simps]
def id (M : Mon_ C) : Hom M M where
hom := 𝟙 M.X
#align Mon_.id Mon_.id
instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) :=
⟨id M⟩
#align Mon_.hom_inhabited Mon_.homInhabited
/-- Composition of morphisms of monoid objects. -/
@[simps]
def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where
hom := f.hom ≫ g.hom
#align Mon_.comp Mon_.comp
instance : Category (Mon_ C) where
Hom M N := Hom M N
id := id
comp f g := comp f g
-- Porting note: added, as `Hom.ext` does not apply to a morphism.
@[ext]
lemma ext {X Y : Mon_ C} {f g : X ⟶ Y} (w : f.hom = g.hom) : f = g :=
Hom.ext _ _ w
@[simp]
theorem id_hom' (M : Mon_ C) : (𝟙 M : Hom M M).hom = 𝟙 M.X :=
rfl
#align Mon_.id_hom' Mon_.id_hom'
@[simp]
theorem comp_hom' {M N K : Mon_ C} (f : M ⟶ N) (g : N ⟶ K) :
(f ≫ g : Hom M K).hom = f.hom ≫ g.hom :=
rfl
#align Mon_.comp_hom' Mon_.comp_hom'
section
variable (C)
/-- The forgetful functor from monoid objects to the ambient category. -/
@[simps]
def forget : Mon_ C ⥤ C where
obj A := A.X
map f := f.hom
#align Mon_.forget Mon_.forget
end
instance forget_faithful : Faithful (@forget C _ _) where
#align Mon_.forget_faithful Mon_.forget_faithful
instance {A B : Mon_ C} (f : A ⟶ B) [e : IsIso ((forget C).map f)] : IsIso f.hom :=
e
/-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/
instance : ReflectsIsomorphisms (forget C) where
reflects f e :=
⟨⟨{ hom := inv f.hom
mul_hom := by
simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, ← tensor_comp_assoc,
IsIso.inv_hom_id, tensor_id, Category.id_comp] },
by aesop_cat⟩⟩
/-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X ≅ N.X) (one_f : M.one ≫ f.hom = N.one)
(mul_f : M.mul ≫ f.hom = (f.hom ⊗ f.hom) ≫ N.mul) : M ≅ N where
hom :=
{ hom := f.hom
one_hom := one_f
mul_hom := mul_f }
inv :=
{ hom := f.inv
one_hom := by rw [← one_f]; simp
mul_hom := by
rw [← cancel_mono f.hom]
slice_rhs 2 3 => rw [mul_f]
simp }
#align Mon_.iso_of_iso Mon_.isoOfIso
instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C ⟶ A) where
default :=
{ hom := A.one
one_hom := by dsimp; simp
mul_hom := by dsimp; simp [A.one_mul, unitors_equal] }
uniq f := by
ext; simp
rw [← Category.id_comp f.hom]
erw [f.one_hom]
#align Mon_.unique_hom_from_trivial Mon_.uniqueHomFromTrivial
open CategoryTheory.Limits
instance : HasInitial (Mon_ C) :=
hasInitial_of_unique (trivial C)
end Mon_
namespace CategoryTheory.LaxMonoidalFunctor
variable {C} {D : Type u₂} [Category.{v₂} D] [MonoidalCategory.{v₂} D]
-- TODO: mapMod F A : Mod A ⥤ Mod (F.mapMon A)
/-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => | rw [id_tensor_comp, ← F.toFunctor.map_id] | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => | Mathlib.CategoryTheory.Monoidal.Mon_.202_0.NTUMzhXPwXsmsYt | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A | Mathlib_CategoryTheory_Monoidal_Mon_ |
C : Type u₁
inst✝³ : Category.{v₁, u₁} C
inst✝² : MonoidalCategory C
D : Type u₂
inst✝¹ : Category.{v₂, u₂} D
inst✝ : MonoidalCategory D
F : LaxMonoidalFunctor C D
A : Mon_ C
| (𝟙 (F.obj A.X) ⊗ F.ε ≫ F.map A.one) ≫ μ F A.X A.X ≫ F.map A.mul | /-
Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/
import Mathlib.CategoryTheory.Monoidal.Braided
import Mathlib.CategoryTheory.Monoidal.Discrete
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
import Mathlib.Algebra.PUnitInstances
#align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c"
/-!
# The category of monoids in a monoidal category.
We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to
the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if
`C` is braided, then the category of monoids is naturally monoidal.
-/
set_option linter.uppercaseLean3 false
universe v₁ v₂ u₁ u₂ u
open CategoryTheory MonoidalCategory
variable (C : Type u₁) [Category.{v₁} C] [MonoidalCategory.{v₁} C]
/-- A monoid object internal to a monoidal category.
When the monoidal category is preadditive, this is also sometimes called an "algebra object".
-/
structure Mon_ where
X : C
one : 𝟙_ C ⟶ X
mul : X ⊗ X ⟶ X
one_mul : (one ⊗ 𝟙 X) ≫ mul = (λ_ X).hom := by aesop_cat
mul_one : (𝟙 X ⊗ one) ≫ mul = (ρ_ X).hom := by aesop_cat
-- Obviously there is some flexibility stating this axiom.
-- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`,
-- and chooses to place the associator on the right-hand side.
-- The heuristic is that unitors and associators "don't have much weight".
mul_assoc : (mul ⊗ 𝟙 X) ≫ mul = (α_ X X X).hom ≫ (𝟙 X ⊗ mul) ≫ mul := by aesop_cat
#align Mon_ Mon_
attribute [reassoc] Mon_.one_mul Mon_.mul_one
-- We prove a more general `@[simp]` lemma below.
attribute [reassoc (attr := simp)] Mon_.mul_assoc
namespace Mon_
/-- The trivial monoid object. We later show this is initial in `Mon_ C`.
-/
@[simps]
def trivial : Mon_ C where
X := 𝟙_ C
one := 𝟙 _
mul := (λ_ _).hom
mul_assoc := by coherence
mul_one := by coherence
#align Mon_.trivial Mon_.trivial
instance : Inhabited (Mon_ C) :=
⟨trivial C⟩
variable {C}
variable {M : Mon_ C}
@[simp]
theorem one_mul_hom {Z : C} (f : Z ⟶ M.X) : (M.one ⊗ f) ≫ M.mul = (λ_ Z).hom ≫ f := by
rw [← id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality]
#align Mon_.one_mul_hom Mon_.one_mul_hom
@[simp]
theorem mul_one_hom {Z : C} (f : Z ⟶ M.X) : (f ⊗ M.one) ≫ M.mul = (ρ_ Z).hom ≫ f := by
rw [← tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality]
#align Mon_.mul_one_hom Mon_.mul_one_hom
theorem assoc_flip :
(𝟙 M.X ⊗ M.mul) ≫ M.mul = (α_ M.X M.X M.X).inv ≫ (M.mul ⊗ 𝟙 M.X) ≫ M.mul := by simp
#align Mon_.assoc_flip Mon_.assoc_flip
/-- A morphism of monoid objects. -/
@[ext]
structure Hom (M N : Mon_ C) where
hom : M.X ⟶ N.X
one_hom : M.one ≫ hom = N.one := by aesop_cat
mul_hom : M.mul ≫ hom = (hom ⊗ hom) ≫ N.mul := by aesop_cat
#align Mon_.hom Mon_.Hom
attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom
/-- The identity morphism on a monoid object. -/
@[simps]
def id (M : Mon_ C) : Hom M M where
hom := 𝟙 M.X
#align Mon_.id Mon_.id
instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) :=
⟨id M⟩
#align Mon_.hom_inhabited Mon_.homInhabited
/-- Composition of morphisms of monoid objects. -/
@[simps]
def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where
hom := f.hom ≫ g.hom
#align Mon_.comp Mon_.comp
instance : Category (Mon_ C) where
Hom M N := Hom M N
id := id
comp f g := comp f g
-- Porting note: added, as `Hom.ext` does not apply to a morphism.
@[ext]
lemma ext {X Y : Mon_ C} {f g : X ⟶ Y} (w : f.hom = g.hom) : f = g :=
Hom.ext _ _ w
@[simp]
theorem id_hom' (M : Mon_ C) : (𝟙 M : Hom M M).hom = 𝟙 M.X :=
rfl
#align Mon_.id_hom' Mon_.id_hom'
@[simp]
theorem comp_hom' {M N K : Mon_ C} (f : M ⟶ N) (g : N ⟶ K) :
(f ≫ g : Hom M K).hom = f.hom ≫ g.hom :=
rfl
#align Mon_.comp_hom' Mon_.comp_hom'
section
variable (C)
/-- The forgetful functor from monoid objects to the ambient category. -/
@[simps]
def forget : Mon_ C ⥤ C where
obj A := A.X
map f := f.hom
#align Mon_.forget Mon_.forget
end
instance forget_faithful : Faithful (@forget C _ _) where
#align Mon_.forget_faithful Mon_.forget_faithful
instance {A B : Mon_ C} (f : A ⟶ B) [e : IsIso ((forget C).map f)] : IsIso f.hom :=
e
/-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/
instance : ReflectsIsomorphisms (forget C) where
reflects f e :=
⟨⟨{ hom := inv f.hom
mul_hom := by
simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, ← tensor_comp_assoc,
IsIso.inv_hom_id, tensor_id, Category.id_comp] },
by aesop_cat⟩⟩
/-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X ≅ N.X) (one_f : M.one ≫ f.hom = N.one)
(mul_f : M.mul ≫ f.hom = (f.hom ⊗ f.hom) ≫ N.mul) : M ≅ N where
hom :=
{ hom := f.hom
one_hom := one_f
mul_hom := mul_f }
inv :=
{ hom := f.inv
one_hom := by rw [← one_f]; simp
mul_hom := by
rw [← cancel_mono f.hom]
slice_rhs 2 3 => rw [mul_f]
simp }
#align Mon_.iso_of_iso Mon_.isoOfIso
instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C ⟶ A) where
default :=
{ hom := A.one
one_hom := by dsimp; simp
mul_hom := by dsimp; simp [A.one_mul, unitors_equal] }
uniq f := by
ext; simp
rw [← Category.id_comp f.hom]
erw [f.one_hom]
#align Mon_.unique_hom_from_trivial Mon_.uniqueHomFromTrivial
open CategoryTheory.Limits
instance : HasInitial (Mon_ C) :=
hasInitial_of_unique (trivial C)
end Mon_
namespace CategoryTheory.LaxMonoidalFunctor
variable {C} {D : Type u₂} [Category.{v₂} D] [MonoidalCategory.{v₂} D]
-- TODO: mapMod F A : Mod A ⥤ Mod (F.mapMon A)
/-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => | rw [id_tensor_comp, ← F.toFunctor.map_id] | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => | Mathlib.CategoryTheory.Monoidal.Mon_.202_0.NTUMzhXPwXsmsYt | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A | Mathlib_CategoryTheory_Monoidal_Mon_ |
C : Type u₁
inst✝³ : Category.{v₁, u₁} C
inst✝² : MonoidalCategory C
D : Type u₂
inst✝¹ : Category.{v₂, u₂} D
inst✝ : MonoidalCategory D
F : LaxMonoidalFunctor C D
A : Mon_ C
| (𝟙 (F.obj A.X) ⊗ F.ε ≫ F.map A.one) ≫ μ F A.X A.X ≫ F.map A.mul | /-
Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/
import Mathlib.CategoryTheory.Monoidal.Braided
import Mathlib.CategoryTheory.Monoidal.Discrete
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
import Mathlib.Algebra.PUnitInstances
#align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c"
/-!
# The category of monoids in a monoidal category.
We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to
the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if
`C` is braided, then the category of monoids is naturally monoidal.
-/
set_option linter.uppercaseLean3 false
universe v₁ v₂ u₁ u₂ u
open CategoryTheory MonoidalCategory
variable (C : Type u₁) [Category.{v₁} C] [MonoidalCategory.{v₁} C]
/-- A monoid object internal to a monoidal category.
When the monoidal category is preadditive, this is also sometimes called an "algebra object".
-/
structure Mon_ where
X : C
one : 𝟙_ C ⟶ X
mul : X ⊗ X ⟶ X
one_mul : (one ⊗ 𝟙 X) ≫ mul = (λ_ X).hom := by aesop_cat
mul_one : (𝟙 X ⊗ one) ≫ mul = (ρ_ X).hom := by aesop_cat
-- Obviously there is some flexibility stating this axiom.
-- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`,
-- and chooses to place the associator on the right-hand side.
-- The heuristic is that unitors and associators "don't have much weight".
mul_assoc : (mul ⊗ 𝟙 X) ≫ mul = (α_ X X X).hom ≫ (𝟙 X ⊗ mul) ≫ mul := by aesop_cat
#align Mon_ Mon_
attribute [reassoc] Mon_.one_mul Mon_.mul_one
-- We prove a more general `@[simp]` lemma below.
attribute [reassoc (attr := simp)] Mon_.mul_assoc
namespace Mon_
/-- The trivial monoid object. We later show this is initial in `Mon_ C`.
-/
@[simps]
def trivial : Mon_ C where
X := 𝟙_ C
one := 𝟙 _
mul := (λ_ _).hom
mul_assoc := by coherence
mul_one := by coherence
#align Mon_.trivial Mon_.trivial
instance : Inhabited (Mon_ C) :=
⟨trivial C⟩
variable {C}
variable {M : Mon_ C}
@[simp]
theorem one_mul_hom {Z : C} (f : Z ⟶ M.X) : (M.one ⊗ f) ≫ M.mul = (λ_ Z).hom ≫ f := by
rw [← id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality]
#align Mon_.one_mul_hom Mon_.one_mul_hom
@[simp]
theorem mul_one_hom {Z : C} (f : Z ⟶ M.X) : (f ⊗ M.one) ≫ M.mul = (ρ_ Z).hom ≫ f := by
rw [← tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality]
#align Mon_.mul_one_hom Mon_.mul_one_hom
theorem assoc_flip :
(𝟙 M.X ⊗ M.mul) ≫ M.mul = (α_ M.X M.X M.X).inv ≫ (M.mul ⊗ 𝟙 M.X) ≫ M.mul := by simp
#align Mon_.assoc_flip Mon_.assoc_flip
/-- A morphism of monoid objects. -/
@[ext]
structure Hom (M N : Mon_ C) where
hom : M.X ⟶ N.X
one_hom : M.one ≫ hom = N.one := by aesop_cat
mul_hom : M.mul ≫ hom = (hom ⊗ hom) ≫ N.mul := by aesop_cat
#align Mon_.hom Mon_.Hom
attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom
/-- The identity morphism on a monoid object. -/
@[simps]
def id (M : Mon_ C) : Hom M M where
hom := 𝟙 M.X
#align Mon_.id Mon_.id
instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) :=
⟨id M⟩
#align Mon_.hom_inhabited Mon_.homInhabited
/-- Composition of morphisms of monoid objects. -/
@[simps]
def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where
hom := f.hom ≫ g.hom
#align Mon_.comp Mon_.comp
instance : Category (Mon_ C) where
Hom M N := Hom M N
id := id
comp f g := comp f g
-- Porting note: added, as `Hom.ext` does not apply to a morphism.
@[ext]
lemma ext {X Y : Mon_ C} {f g : X ⟶ Y} (w : f.hom = g.hom) : f = g :=
Hom.ext _ _ w
@[simp]
theorem id_hom' (M : Mon_ C) : (𝟙 M : Hom M M).hom = 𝟙 M.X :=
rfl
#align Mon_.id_hom' Mon_.id_hom'
@[simp]
theorem comp_hom' {M N K : Mon_ C} (f : M ⟶ N) (g : N ⟶ K) :
(f ≫ g : Hom M K).hom = f.hom ≫ g.hom :=
rfl
#align Mon_.comp_hom' Mon_.comp_hom'
section
variable (C)
/-- The forgetful functor from monoid objects to the ambient category. -/
@[simps]
def forget : Mon_ C ⥤ C where
obj A := A.X
map f := f.hom
#align Mon_.forget Mon_.forget
end
instance forget_faithful : Faithful (@forget C _ _) where
#align Mon_.forget_faithful Mon_.forget_faithful
instance {A B : Mon_ C} (f : A ⟶ B) [e : IsIso ((forget C).map f)] : IsIso f.hom :=
e
/-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/
instance : ReflectsIsomorphisms (forget C) where
reflects f e :=
⟨⟨{ hom := inv f.hom
mul_hom := by
simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, ← tensor_comp_assoc,
IsIso.inv_hom_id, tensor_id, Category.id_comp] },
by aesop_cat⟩⟩
/-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X ≅ N.X) (one_f : M.one ≫ f.hom = N.one)
(mul_f : M.mul ≫ f.hom = (f.hom ⊗ f.hom) ≫ N.mul) : M ≅ N where
hom :=
{ hom := f.hom
one_hom := one_f
mul_hom := mul_f }
inv :=
{ hom := f.inv
one_hom := by rw [← one_f]; simp
mul_hom := by
rw [← cancel_mono f.hom]
slice_rhs 2 3 => rw [mul_f]
simp }
#align Mon_.iso_of_iso Mon_.isoOfIso
instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C ⟶ A) where
default :=
{ hom := A.one
one_hom := by dsimp; simp
mul_hom := by dsimp; simp [A.one_mul, unitors_equal] }
uniq f := by
ext; simp
rw [← Category.id_comp f.hom]
erw [f.one_hom]
#align Mon_.unique_hom_from_trivial Mon_.uniqueHomFromTrivial
open CategoryTheory.Limits
instance : HasInitial (Mon_ C) :=
hasInitial_of_unique (trivial C)
end Mon_
namespace CategoryTheory.LaxMonoidalFunctor
variable {C} {D : Type u₂} [Category.{v₂} D] [MonoidalCategory.{v₂} D]
-- TODO: mapMod F A : Mod A ⥤ Mod (F.mapMon A)
/-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => | rw [id_tensor_comp, ← F.toFunctor.map_id] | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => | Mathlib.CategoryTheory.Monoidal.Mon_.202_0.NTUMzhXPwXsmsYt | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A | Mathlib_CategoryTheory_Monoidal_Mon_ |
C : Type u₁
inst✝³ : Category.{v₁, u₁} C
inst✝² : MonoidalCategory C
D : Type u₂
inst✝¹ : Category.{v₂, u₂} D
inst✝ : MonoidalCategory D
F : LaxMonoidalFunctor C D
A : Mon_ C
⊢ ((F.map (𝟙 A.X) ⊗ F.ε) ≫ (F.map (𝟙 A.X) ⊗ F.map A.one)) ≫ μ F A.X A.X ≫ F.map A.mul = (ρ_ (F.obj A.X)).hom | /-
Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/
import Mathlib.CategoryTheory.Monoidal.Braided
import Mathlib.CategoryTheory.Monoidal.Discrete
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
import Mathlib.Algebra.PUnitInstances
#align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c"
/-!
# The category of monoids in a monoidal category.
We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to
the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if
`C` is braided, then the category of monoids is naturally monoidal.
-/
set_option linter.uppercaseLean3 false
universe v₁ v₂ u₁ u₂ u
open CategoryTheory MonoidalCategory
variable (C : Type u₁) [Category.{v₁} C] [MonoidalCategory.{v₁} C]
/-- A monoid object internal to a monoidal category.
When the monoidal category is preadditive, this is also sometimes called an "algebra object".
-/
structure Mon_ where
X : C
one : 𝟙_ C ⟶ X
mul : X ⊗ X ⟶ X
one_mul : (one ⊗ 𝟙 X) ≫ mul = (λ_ X).hom := by aesop_cat
mul_one : (𝟙 X ⊗ one) ≫ mul = (ρ_ X).hom := by aesop_cat
-- Obviously there is some flexibility stating this axiom.
-- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`,
-- and chooses to place the associator on the right-hand side.
-- The heuristic is that unitors and associators "don't have much weight".
mul_assoc : (mul ⊗ 𝟙 X) ≫ mul = (α_ X X X).hom ≫ (𝟙 X ⊗ mul) ≫ mul := by aesop_cat
#align Mon_ Mon_
attribute [reassoc] Mon_.one_mul Mon_.mul_one
-- We prove a more general `@[simp]` lemma below.
attribute [reassoc (attr := simp)] Mon_.mul_assoc
namespace Mon_
/-- The trivial monoid object. We later show this is initial in `Mon_ C`.
-/
@[simps]
def trivial : Mon_ C where
X := 𝟙_ C
one := 𝟙 _
mul := (λ_ _).hom
mul_assoc := by coherence
mul_one := by coherence
#align Mon_.trivial Mon_.trivial
instance : Inhabited (Mon_ C) :=
⟨trivial C⟩
variable {C}
variable {M : Mon_ C}
@[simp]
theorem one_mul_hom {Z : C} (f : Z ⟶ M.X) : (M.one ⊗ f) ≫ M.mul = (λ_ Z).hom ≫ f := by
rw [← id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality]
#align Mon_.one_mul_hom Mon_.one_mul_hom
@[simp]
theorem mul_one_hom {Z : C} (f : Z ⟶ M.X) : (f ⊗ M.one) ≫ M.mul = (ρ_ Z).hom ≫ f := by
rw [← tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality]
#align Mon_.mul_one_hom Mon_.mul_one_hom
theorem assoc_flip :
(𝟙 M.X ⊗ M.mul) ≫ M.mul = (α_ M.X M.X M.X).inv ≫ (M.mul ⊗ 𝟙 M.X) ≫ M.mul := by simp
#align Mon_.assoc_flip Mon_.assoc_flip
/-- A morphism of monoid objects. -/
@[ext]
structure Hom (M N : Mon_ C) where
hom : M.X ⟶ N.X
one_hom : M.one ≫ hom = N.one := by aesop_cat
mul_hom : M.mul ≫ hom = (hom ⊗ hom) ≫ N.mul := by aesop_cat
#align Mon_.hom Mon_.Hom
attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom
/-- The identity morphism on a monoid object. -/
@[simps]
def id (M : Mon_ C) : Hom M M where
hom := 𝟙 M.X
#align Mon_.id Mon_.id
instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) :=
⟨id M⟩
#align Mon_.hom_inhabited Mon_.homInhabited
/-- Composition of morphisms of monoid objects. -/
@[simps]
def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where
hom := f.hom ≫ g.hom
#align Mon_.comp Mon_.comp
instance : Category (Mon_ C) where
Hom M N := Hom M N
id := id
comp f g := comp f g
-- Porting note: added, as `Hom.ext` does not apply to a morphism.
@[ext]
lemma ext {X Y : Mon_ C} {f g : X ⟶ Y} (w : f.hom = g.hom) : f = g :=
Hom.ext _ _ w
@[simp]
theorem id_hom' (M : Mon_ C) : (𝟙 M : Hom M M).hom = 𝟙 M.X :=
rfl
#align Mon_.id_hom' Mon_.id_hom'
@[simp]
theorem comp_hom' {M N K : Mon_ C} (f : M ⟶ N) (g : N ⟶ K) :
(f ≫ g : Hom M K).hom = f.hom ≫ g.hom :=
rfl
#align Mon_.comp_hom' Mon_.comp_hom'
section
variable (C)
/-- The forgetful functor from monoid objects to the ambient category. -/
@[simps]
def forget : Mon_ C ⥤ C where
obj A := A.X
map f := f.hom
#align Mon_.forget Mon_.forget
end
instance forget_faithful : Faithful (@forget C _ _) where
#align Mon_.forget_faithful Mon_.forget_faithful
instance {A B : Mon_ C} (f : A ⟶ B) [e : IsIso ((forget C).map f)] : IsIso f.hom :=
e
/-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/
instance : ReflectsIsomorphisms (forget C) where
reflects f e :=
⟨⟨{ hom := inv f.hom
mul_hom := by
simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, ← tensor_comp_assoc,
IsIso.inv_hom_id, tensor_id, Category.id_comp] },
by aesop_cat⟩⟩
/-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X ≅ N.X) (one_f : M.one ≫ f.hom = N.one)
(mul_f : M.mul ≫ f.hom = (f.hom ⊗ f.hom) ≫ N.mul) : M ≅ N where
hom :=
{ hom := f.hom
one_hom := one_f
mul_hom := mul_f }
inv :=
{ hom := f.inv
one_hom := by rw [← one_f]; simp
mul_hom := by
rw [← cancel_mono f.hom]
slice_rhs 2 3 => rw [mul_f]
simp }
#align Mon_.iso_of_iso Mon_.isoOfIso
instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C ⟶ A) where
default :=
{ hom := A.one
one_hom := by dsimp; simp
mul_hom := by dsimp; simp [A.one_mul, unitors_equal] }
uniq f := by
ext; simp
rw [← Category.id_comp f.hom]
erw [f.one_hom]
#align Mon_.unique_hom_from_trivial Mon_.uniqueHomFromTrivial
open CategoryTheory.Limits
instance : HasInitial (Mon_ C) :=
hasInitial_of_unique (trivial C)
end Mon_
namespace CategoryTheory.LaxMonoidalFunctor
variable {C} {D : Type u₂} [Category.{v₂} D] [MonoidalCategory.{v₂} D]
-- TODO: mapMod F A : Mod A ⥤ Mod (F.mapMon A)
/-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
| slice_lhs 2 3 => rw [F.μ_natural] | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
| Mathlib.CategoryTheory.Monoidal.Mon_.202_0.NTUMzhXPwXsmsYt | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A | Mathlib_CategoryTheory_Monoidal_Mon_ |
case a.a
C : Type u₁
inst✝³ : Category.{v₁, u₁} C
inst✝² : MonoidalCategory C
D : Type u₂
inst✝¹ : Category.{v₂, u₂} D
inst✝ : MonoidalCategory D
F : LaxMonoidalFunctor C D
A : Mon_ C
| (F.map (𝟙 A.X) ⊗ F.map A.one) ≫ μ F A.X A.X
case a.a
C : Type u₁
inst✝³ : Category.{v₁, u₁} C
inst✝² : MonoidalCategory C
D : Type u₂
inst✝¹ : Category.{v₂, u₂} D
inst✝ : MonoidalCategory D
F : LaxMonoidalFunctor C D
A : Mon_ C
| F.map A.mul
case a
C : Type u₁
inst✝³ : Category.{v₁, u₁} C
inst✝² : MonoidalCategory C
D : Type u₂
inst✝¹ : Category.{v₂, u₂} D
inst✝ : MonoidalCategory D
F : LaxMonoidalFunctor C D
A : Mon_ C
| F.map (𝟙 A.X) ⊗ F.ε | /-
Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/
import Mathlib.CategoryTheory.Monoidal.Braided
import Mathlib.CategoryTheory.Monoidal.Discrete
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
import Mathlib.Algebra.PUnitInstances
#align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c"
/-!
# The category of monoids in a monoidal category.
We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to
the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if
`C` is braided, then the category of monoids is naturally monoidal.
-/
set_option linter.uppercaseLean3 false
universe v₁ v₂ u₁ u₂ u
open CategoryTheory MonoidalCategory
variable (C : Type u₁) [Category.{v₁} C] [MonoidalCategory.{v₁} C]
/-- A monoid object internal to a monoidal category.
When the monoidal category is preadditive, this is also sometimes called an "algebra object".
-/
structure Mon_ where
X : C
one : 𝟙_ C ⟶ X
mul : X ⊗ X ⟶ X
one_mul : (one ⊗ 𝟙 X) ≫ mul = (λ_ X).hom := by aesop_cat
mul_one : (𝟙 X ⊗ one) ≫ mul = (ρ_ X).hom := by aesop_cat
-- Obviously there is some flexibility stating this axiom.
-- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`,
-- and chooses to place the associator on the right-hand side.
-- The heuristic is that unitors and associators "don't have much weight".
mul_assoc : (mul ⊗ 𝟙 X) ≫ mul = (α_ X X X).hom ≫ (𝟙 X ⊗ mul) ≫ mul := by aesop_cat
#align Mon_ Mon_
attribute [reassoc] Mon_.one_mul Mon_.mul_one
-- We prove a more general `@[simp]` lemma below.
attribute [reassoc (attr := simp)] Mon_.mul_assoc
namespace Mon_
/-- The trivial monoid object. We later show this is initial in `Mon_ C`.
-/
@[simps]
def trivial : Mon_ C where
X := 𝟙_ C
one := 𝟙 _
mul := (λ_ _).hom
mul_assoc := by coherence
mul_one := by coherence
#align Mon_.trivial Mon_.trivial
instance : Inhabited (Mon_ C) :=
⟨trivial C⟩
variable {C}
variable {M : Mon_ C}
@[simp]
theorem one_mul_hom {Z : C} (f : Z ⟶ M.X) : (M.one ⊗ f) ≫ M.mul = (λ_ Z).hom ≫ f := by
rw [← id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality]
#align Mon_.one_mul_hom Mon_.one_mul_hom
@[simp]
theorem mul_one_hom {Z : C} (f : Z ⟶ M.X) : (f ⊗ M.one) ≫ M.mul = (ρ_ Z).hom ≫ f := by
rw [← tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality]
#align Mon_.mul_one_hom Mon_.mul_one_hom
theorem assoc_flip :
(𝟙 M.X ⊗ M.mul) ≫ M.mul = (α_ M.X M.X M.X).inv ≫ (M.mul ⊗ 𝟙 M.X) ≫ M.mul := by simp
#align Mon_.assoc_flip Mon_.assoc_flip
/-- A morphism of monoid objects. -/
@[ext]
structure Hom (M N : Mon_ C) where
hom : M.X ⟶ N.X
one_hom : M.one ≫ hom = N.one := by aesop_cat
mul_hom : M.mul ≫ hom = (hom ⊗ hom) ≫ N.mul := by aesop_cat
#align Mon_.hom Mon_.Hom
attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom
/-- The identity morphism on a monoid object. -/
@[simps]
def id (M : Mon_ C) : Hom M M where
hom := 𝟙 M.X
#align Mon_.id Mon_.id
instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) :=
⟨id M⟩
#align Mon_.hom_inhabited Mon_.homInhabited
/-- Composition of morphisms of monoid objects. -/
@[simps]
def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where
hom := f.hom ≫ g.hom
#align Mon_.comp Mon_.comp
instance : Category (Mon_ C) where
Hom M N := Hom M N
id := id
comp f g := comp f g
-- Porting note: added, as `Hom.ext` does not apply to a morphism.
@[ext]
lemma ext {X Y : Mon_ C} {f g : X ⟶ Y} (w : f.hom = g.hom) : f = g :=
Hom.ext _ _ w
@[simp]
theorem id_hom' (M : Mon_ C) : (𝟙 M : Hom M M).hom = 𝟙 M.X :=
rfl
#align Mon_.id_hom' Mon_.id_hom'
@[simp]
theorem comp_hom' {M N K : Mon_ C} (f : M ⟶ N) (g : N ⟶ K) :
(f ≫ g : Hom M K).hom = f.hom ≫ g.hom :=
rfl
#align Mon_.comp_hom' Mon_.comp_hom'
section
variable (C)
/-- The forgetful functor from monoid objects to the ambient category. -/
@[simps]
def forget : Mon_ C ⥤ C where
obj A := A.X
map f := f.hom
#align Mon_.forget Mon_.forget
end
instance forget_faithful : Faithful (@forget C _ _) where
#align Mon_.forget_faithful Mon_.forget_faithful
instance {A B : Mon_ C} (f : A ⟶ B) [e : IsIso ((forget C).map f)] : IsIso f.hom :=
e
/-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/
instance : ReflectsIsomorphisms (forget C) where
reflects f e :=
⟨⟨{ hom := inv f.hom
mul_hom := by
simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, ← tensor_comp_assoc,
IsIso.inv_hom_id, tensor_id, Category.id_comp] },
by aesop_cat⟩⟩
/-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X ≅ N.X) (one_f : M.one ≫ f.hom = N.one)
(mul_f : M.mul ≫ f.hom = (f.hom ⊗ f.hom) ≫ N.mul) : M ≅ N where
hom :=
{ hom := f.hom
one_hom := one_f
mul_hom := mul_f }
inv :=
{ hom := f.inv
one_hom := by rw [← one_f]; simp
mul_hom := by
rw [← cancel_mono f.hom]
slice_rhs 2 3 => rw [mul_f]
simp }
#align Mon_.iso_of_iso Mon_.isoOfIso
instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C ⟶ A) where
default :=
{ hom := A.one
one_hom := by dsimp; simp
mul_hom := by dsimp; simp [A.one_mul, unitors_equal] }
uniq f := by
ext; simp
rw [← Category.id_comp f.hom]
erw [f.one_hom]
#align Mon_.unique_hom_from_trivial Mon_.uniqueHomFromTrivial
open CategoryTheory.Limits
instance : HasInitial (Mon_ C) :=
hasInitial_of_unique (trivial C)
end Mon_
namespace CategoryTheory.LaxMonoidalFunctor
variable {C} {D : Type u₂} [Category.{v₂} D] [MonoidalCategory.{v₂} D]
-- TODO: mapMod F A : Mod A ⥤ Mod (F.mapMon A)
/-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => | rw [F.μ_natural] | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => | Mathlib.CategoryTheory.Monoidal.Mon_.202_0.NTUMzhXPwXsmsYt | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A | Mathlib_CategoryTheory_Monoidal_Mon_ |
case a.a
C : Type u₁
inst✝³ : Category.{v₁, u₁} C
inst✝² : MonoidalCategory C
D : Type u₂
inst✝¹ : Category.{v₂, u₂} D
inst✝ : MonoidalCategory D
F : LaxMonoidalFunctor C D
A : Mon_ C
| (F.map (𝟙 A.X) ⊗ F.map A.one) ≫ μ F A.X A.X
case a.a
C : Type u₁
inst✝³ : Category.{v₁, u₁} C
inst✝² : MonoidalCategory C
D : Type u₂
inst✝¹ : Category.{v₂, u₂} D
inst✝ : MonoidalCategory D
F : LaxMonoidalFunctor C D
A : Mon_ C
| F.map A.mul
case a
C : Type u₁
inst✝³ : Category.{v₁, u₁} C
inst✝² : MonoidalCategory C
D : Type u₂
inst✝¹ : Category.{v₂, u₂} D
inst✝ : MonoidalCategory D
F : LaxMonoidalFunctor C D
A : Mon_ C
| F.map (𝟙 A.X) ⊗ F.ε | /-
Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/
import Mathlib.CategoryTheory.Monoidal.Braided
import Mathlib.CategoryTheory.Monoidal.Discrete
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
import Mathlib.Algebra.PUnitInstances
#align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c"
/-!
# The category of monoids in a monoidal category.
We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to
the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if
`C` is braided, then the category of monoids is naturally monoidal.
-/
set_option linter.uppercaseLean3 false
universe v₁ v₂ u₁ u₂ u
open CategoryTheory MonoidalCategory
variable (C : Type u₁) [Category.{v₁} C] [MonoidalCategory.{v₁} C]
/-- A monoid object internal to a monoidal category.
When the monoidal category is preadditive, this is also sometimes called an "algebra object".
-/
structure Mon_ where
X : C
one : 𝟙_ C ⟶ X
mul : X ⊗ X ⟶ X
one_mul : (one ⊗ 𝟙 X) ≫ mul = (λ_ X).hom := by aesop_cat
mul_one : (𝟙 X ⊗ one) ≫ mul = (ρ_ X).hom := by aesop_cat
-- Obviously there is some flexibility stating this axiom.
-- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`,
-- and chooses to place the associator on the right-hand side.
-- The heuristic is that unitors and associators "don't have much weight".
mul_assoc : (mul ⊗ 𝟙 X) ≫ mul = (α_ X X X).hom ≫ (𝟙 X ⊗ mul) ≫ mul := by aesop_cat
#align Mon_ Mon_
attribute [reassoc] Mon_.one_mul Mon_.mul_one
-- We prove a more general `@[simp]` lemma below.
attribute [reassoc (attr := simp)] Mon_.mul_assoc
namespace Mon_
/-- The trivial monoid object. We later show this is initial in `Mon_ C`.
-/
@[simps]
def trivial : Mon_ C where
X := 𝟙_ C
one := 𝟙 _
mul := (λ_ _).hom
mul_assoc := by coherence
mul_one := by coherence
#align Mon_.trivial Mon_.trivial
instance : Inhabited (Mon_ C) :=
⟨trivial C⟩
variable {C}
variable {M : Mon_ C}
@[simp]
theorem one_mul_hom {Z : C} (f : Z ⟶ M.X) : (M.one ⊗ f) ≫ M.mul = (λ_ Z).hom ≫ f := by
rw [← id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality]
#align Mon_.one_mul_hom Mon_.one_mul_hom
@[simp]
theorem mul_one_hom {Z : C} (f : Z ⟶ M.X) : (f ⊗ M.one) ≫ M.mul = (ρ_ Z).hom ≫ f := by
rw [← tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality]
#align Mon_.mul_one_hom Mon_.mul_one_hom
theorem assoc_flip :
(𝟙 M.X ⊗ M.mul) ≫ M.mul = (α_ M.X M.X M.X).inv ≫ (M.mul ⊗ 𝟙 M.X) ≫ M.mul := by simp
#align Mon_.assoc_flip Mon_.assoc_flip
/-- A morphism of monoid objects. -/
@[ext]
structure Hom (M N : Mon_ C) where
hom : M.X ⟶ N.X
one_hom : M.one ≫ hom = N.one := by aesop_cat
mul_hom : M.mul ≫ hom = (hom ⊗ hom) ≫ N.mul := by aesop_cat
#align Mon_.hom Mon_.Hom
attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom
/-- The identity morphism on a monoid object. -/
@[simps]
def id (M : Mon_ C) : Hom M M where
hom := 𝟙 M.X
#align Mon_.id Mon_.id
instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) :=
⟨id M⟩
#align Mon_.hom_inhabited Mon_.homInhabited
/-- Composition of morphisms of monoid objects. -/
@[simps]
def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where
hom := f.hom ≫ g.hom
#align Mon_.comp Mon_.comp
instance : Category (Mon_ C) where
Hom M N := Hom M N
id := id
comp f g := comp f g
-- Porting note: added, as `Hom.ext` does not apply to a morphism.
@[ext]
lemma ext {X Y : Mon_ C} {f g : X ⟶ Y} (w : f.hom = g.hom) : f = g :=
Hom.ext _ _ w
@[simp]
theorem id_hom' (M : Mon_ C) : (𝟙 M : Hom M M).hom = 𝟙 M.X :=
rfl
#align Mon_.id_hom' Mon_.id_hom'
@[simp]
theorem comp_hom' {M N K : Mon_ C} (f : M ⟶ N) (g : N ⟶ K) :
(f ≫ g : Hom M K).hom = f.hom ≫ g.hom :=
rfl
#align Mon_.comp_hom' Mon_.comp_hom'
section
variable (C)
/-- The forgetful functor from monoid objects to the ambient category. -/
@[simps]
def forget : Mon_ C ⥤ C where
obj A := A.X
map f := f.hom
#align Mon_.forget Mon_.forget
end
instance forget_faithful : Faithful (@forget C _ _) where
#align Mon_.forget_faithful Mon_.forget_faithful
instance {A B : Mon_ C} (f : A ⟶ B) [e : IsIso ((forget C).map f)] : IsIso f.hom :=
e
/-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/
instance : ReflectsIsomorphisms (forget C) where
reflects f e :=
⟨⟨{ hom := inv f.hom
mul_hom := by
simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, ← tensor_comp_assoc,
IsIso.inv_hom_id, tensor_id, Category.id_comp] },
by aesop_cat⟩⟩
/-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X ≅ N.X) (one_f : M.one ≫ f.hom = N.one)
(mul_f : M.mul ≫ f.hom = (f.hom ⊗ f.hom) ≫ N.mul) : M ≅ N where
hom :=
{ hom := f.hom
one_hom := one_f
mul_hom := mul_f }
inv :=
{ hom := f.inv
one_hom := by rw [← one_f]; simp
mul_hom := by
rw [← cancel_mono f.hom]
slice_rhs 2 3 => rw [mul_f]
simp }
#align Mon_.iso_of_iso Mon_.isoOfIso
instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C ⟶ A) where
default :=
{ hom := A.one
one_hom := by dsimp; simp
mul_hom := by dsimp; simp [A.one_mul, unitors_equal] }
uniq f := by
ext; simp
rw [← Category.id_comp f.hom]
erw [f.one_hom]
#align Mon_.unique_hom_from_trivial Mon_.uniqueHomFromTrivial
open CategoryTheory.Limits
instance : HasInitial (Mon_ C) :=
hasInitial_of_unique (trivial C)
end Mon_
namespace CategoryTheory.LaxMonoidalFunctor
variable {C} {D : Type u₂} [Category.{v₂} D] [MonoidalCategory.{v₂} D]
-- TODO: mapMod F A : Mod A ⥤ Mod (F.mapMon A)
/-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => | rw [F.μ_natural] | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => | Mathlib.CategoryTheory.Monoidal.Mon_.202_0.NTUMzhXPwXsmsYt | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A | Mathlib_CategoryTheory_Monoidal_Mon_ |
case a.a
C : Type u₁
inst✝³ : Category.{v₁, u₁} C
inst✝² : MonoidalCategory C
D : Type u₂
inst✝¹ : Category.{v₂, u₂} D
inst✝ : MonoidalCategory D
F : LaxMonoidalFunctor C D
A : Mon_ C
| (F.map (𝟙 A.X) ⊗ F.map A.one) ≫ μ F A.X A.X
case a.a
C : Type u₁
inst✝³ : Category.{v₁, u₁} C
inst✝² : MonoidalCategory C
D : Type u₂
inst✝¹ : Category.{v₂, u₂} D
inst✝ : MonoidalCategory D
F : LaxMonoidalFunctor C D
A : Mon_ C
| F.map A.mul
case a
C : Type u₁
inst✝³ : Category.{v₁, u₁} C
inst✝² : MonoidalCategory C
D : Type u₂
inst✝¹ : Category.{v₂, u₂} D
inst✝ : MonoidalCategory D
F : LaxMonoidalFunctor C D
A : Mon_ C
| F.map (𝟙 A.X) ⊗ F.ε | /-
Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/
import Mathlib.CategoryTheory.Monoidal.Braided
import Mathlib.CategoryTheory.Monoidal.Discrete
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
import Mathlib.Algebra.PUnitInstances
#align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c"
/-!
# The category of monoids in a monoidal category.
We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to
the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if
`C` is braided, then the category of monoids is naturally monoidal.
-/
set_option linter.uppercaseLean3 false
universe v₁ v₂ u₁ u₂ u
open CategoryTheory MonoidalCategory
variable (C : Type u₁) [Category.{v₁} C] [MonoidalCategory.{v₁} C]
/-- A monoid object internal to a monoidal category.
When the monoidal category is preadditive, this is also sometimes called an "algebra object".
-/
structure Mon_ where
X : C
one : 𝟙_ C ⟶ X
mul : X ⊗ X ⟶ X
one_mul : (one ⊗ 𝟙 X) ≫ mul = (λ_ X).hom := by aesop_cat
mul_one : (𝟙 X ⊗ one) ≫ mul = (ρ_ X).hom := by aesop_cat
-- Obviously there is some flexibility stating this axiom.
-- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`,
-- and chooses to place the associator on the right-hand side.
-- The heuristic is that unitors and associators "don't have much weight".
mul_assoc : (mul ⊗ 𝟙 X) ≫ mul = (α_ X X X).hom ≫ (𝟙 X ⊗ mul) ≫ mul := by aesop_cat
#align Mon_ Mon_
attribute [reassoc] Mon_.one_mul Mon_.mul_one
-- We prove a more general `@[simp]` lemma below.
attribute [reassoc (attr := simp)] Mon_.mul_assoc
namespace Mon_
/-- The trivial monoid object. We later show this is initial in `Mon_ C`.
-/
@[simps]
def trivial : Mon_ C where
X := 𝟙_ C
one := 𝟙 _
mul := (λ_ _).hom
mul_assoc := by coherence
mul_one := by coherence
#align Mon_.trivial Mon_.trivial
instance : Inhabited (Mon_ C) :=
⟨trivial C⟩
variable {C}
variable {M : Mon_ C}
@[simp]
theorem one_mul_hom {Z : C} (f : Z ⟶ M.X) : (M.one ⊗ f) ≫ M.mul = (λ_ Z).hom ≫ f := by
rw [← id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality]
#align Mon_.one_mul_hom Mon_.one_mul_hom
@[simp]
theorem mul_one_hom {Z : C} (f : Z ⟶ M.X) : (f ⊗ M.one) ≫ M.mul = (ρ_ Z).hom ≫ f := by
rw [← tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality]
#align Mon_.mul_one_hom Mon_.mul_one_hom
theorem assoc_flip :
(𝟙 M.X ⊗ M.mul) ≫ M.mul = (α_ M.X M.X M.X).inv ≫ (M.mul ⊗ 𝟙 M.X) ≫ M.mul := by simp
#align Mon_.assoc_flip Mon_.assoc_flip
/-- A morphism of monoid objects. -/
@[ext]
structure Hom (M N : Mon_ C) where
hom : M.X ⟶ N.X
one_hom : M.one ≫ hom = N.one := by aesop_cat
mul_hom : M.mul ≫ hom = (hom ⊗ hom) ≫ N.mul := by aesop_cat
#align Mon_.hom Mon_.Hom
attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom
/-- The identity morphism on a monoid object. -/
@[simps]
def id (M : Mon_ C) : Hom M M where
hom := 𝟙 M.X
#align Mon_.id Mon_.id
instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) :=
⟨id M⟩
#align Mon_.hom_inhabited Mon_.homInhabited
/-- Composition of morphisms of monoid objects. -/
@[simps]
def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where
hom := f.hom ≫ g.hom
#align Mon_.comp Mon_.comp
instance : Category (Mon_ C) where
Hom M N := Hom M N
id := id
comp f g := comp f g
-- Porting note: added, as `Hom.ext` does not apply to a morphism.
@[ext]
lemma ext {X Y : Mon_ C} {f g : X ⟶ Y} (w : f.hom = g.hom) : f = g :=
Hom.ext _ _ w
@[simp]
theorem id_hom' (M : Mon_ C) : (𝟙 M : Hom M M).hom = 𝟙 M.X :=
rfl
#align Mon_.id_hom' Mon_.id_hom'
@[simp]
theorem comp_hom' {M N K : Mon_ C} (f : M ⟶ N) (g : N ⟶ K) :
(f ≫ g : Hom M K).hom = f.hom ≫ g.hom :=
rfl
#align Mon_.comp_hom' Mon_.comp_hom'
section
variable (C)
/-- The forgetful functor from monoid objects to the ambient category. -/
@[simps]
def forget : Mon_ C ⥤ C where
obj A := A.X
map f := f.hom
#align Mon_.forget Mon_.forget
end
instance forget_faithful : Faithful (@forget C _ _) where
#align Mon_.forget_faithful Mon_.forget_faithful
instance {A B : Mon_ C} (f : A ⟶ B) [e : IsIso ((forget C).map f)] : IsIso f.hom :=
e
/-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/
instance : ReflectsIsomorphisms (forget C) where
reflects f e :=
⟨⟨{ hom := inv f.hom
mul_hom := by
simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, ← tensor_comp_assoc,
IsIso.inv_hom_id, tensor_id, Category.id_comp] },
by aesop_cat⟩⟩
/-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X ≅ N.X) (one_f : M.one ≫ f.hom = N.one)
(mul_f : M.mul ≫ f.hom = (f.hom ⊗ f.hom) ≫ N.mul) : M ≅ N where
hom :=
{ hom := f.hom
one_hom := one_f
mul_hom := mul_f }
inv :=
{ hom := f.inv
one_hom := by rw [← one_f]; simp
mul_hom := by
rw [← cancel_mono f.hom]
slice_rhs 2 3 => rw [mul_f]
simp }
#align Mon_.iso_of_iso Mon_.isoOfIso
instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C ⟶ A) where
default :=
{ hom := A.one
one_hom := by dsimp; simp
mul_hom := by dsimp; simp [A.one_mul, unitors_equal] }
uniq f := by
ext; simp
rw [← Category.id_comp f.hom]
erw [f.one_hom]
#align Mon_.unique_hom_from_trivial Mon_.uniqueHomFromTrivial
open CategoryTheory.Limits
instance : HasInitial (Mon_ C) :=
hasInitial_of_unique (trivial C)
end Mon_
namespace CategoryTheory.LaxMonoidalFunctor
variable {C} {D : Type u₂} [Category.{v₂} D] [MonoidalCategory.{v₂} D]
-- TODO: mapMod F A : Mod A ⥤ Mod (F.mapMon A)
/-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => | rw [F.μ_natural] | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => | Mathlib.CategoryTheory.Monoidal.Mon_.202_0.NTUMzhXPwXsmsYt | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A | Mathlib_CategoryTheory_Monoidal_Mon_ |
C : Type u₁
inst✝³ : Category.{v₁, u₁} C
inst✝² : MonoidalCategory C
D : Type u₂
inst✝¹ : Category.{v₂, u₂} D
inst✝ : MonoidalCategory D
F : LaxMonoidalFunctor C D
A : Mon_ C
⊢ (F.map (𝟙 A.X) ⊗ F.ε) ≫ (μ F A.X (𝟙_ C) ≫ F.map (𝟙 A.X ⊗ A.one)) ≫ F.map A.mul = (ρ_ (F.obj A.X)).hom | /-
Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/
import Mathlib.CategoryTheory.Monoidal.Braided
import Mathlib.CategoryTheory.Monoidal.Discrete
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
import Mathlib.Algebra.PUnitInstances
#align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c"
/-!
# The category of monoids in a monoidal category.
We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to
the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if
`C` is braided, then the category of monoids is naturally monoidal.
-/
set_option linter.uppercaseLean3 false
universe v₁ v₂ u₁ u₂ u
open CategoryTheory MonoidalCategory
variable (C : Type u₁) [Category.{v₁} C] [MonoidalCategory.{v₁} C]
/-- A monoid object internal to a monoidal category.
When the monoidal category is preadditive, this is also sometimes called an "algebra object".
-/
structure Mon_ where
X : C
one : 𝟙_ C ⟶ X
mul : X ⊗ X ⟶ X
one_mul : (one ⊗ 𝟙 X) ≫ mul = (λ_ X).hom := by aesop_cat
mul_one : (𝟙 X ⊗ one) ≫ mul = (ρ_ X).hom := by aesop_cat
-- Obviously there is some flexibility stating this axiom.
-- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`,
-- and chooses to place the associator on the right-hand side.
-- The heuristic is that unitors and associators "don't have much weight".
mul_assoc : (mul ⊗ 𝟙 X) ≫ mul = (α_ X X X).hom ≫ (𝟙 X ⊗ mul) ≫ mul := by aesop_cat
#align Mon_ Mon_
attribute [reassoc] Mon_.one_mul Mon_.mul_one
-- We prove a more general `@[simp]` lemma below.
attribute [reassoc (attr := simp)] Mon_.mul_assoc
namespace Mon_
/-- The trivial monoid object. We later show this is initial in `Mon_ C`.
-/
@[simps]
def trivial : Mon_ C where
X := 𝟙_ C
one := 𝟙 _
mul := (λ_ _).hom
mul_assoc := by coherence
mul_one := by coherence
#align Mon_.trivial Mon_.trivial
instance : Inhabited (Mon_ C) :=
⟨trivial C⟩
variable {C}
variable {M : Mon_ C}
@[simp]
theorem one_mul_hom {Z : C} (f : Z ⟶ M.X) : (M.one ⊗ f) ≫ M.mul = (λ_ Z).hom ≫ f := by
rw [← id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality]
#align Mon_.one_mul_hom Mon_.one_mul_hom
@[simp]
theorem mul_one_hom {Z : C} (f : Z ⟶ M.X) : (f ⊗ M.one) ≫ M.mul = (ρ_ Z).hom ≫ f := by
rw [← tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality]
#align Mon_.mul_one_hom Mon_.mul_one_hom
theorem assoc_flip :
(𝟙 M.X ⊗ M.mul) ≫ M.mul = (α_ M.X M.X M.X).inv ≫ (M.mul ⊗ 𝟙 M.X) ≫ M.mul := by simp
#align Mon_.assoc_flip Mon_.assoc_flip
/-- A morphism of monoid objects. -/
@[ext]
structure Hom (M N : Mon_ C) where
hom : M.X ⟶ N.X
one_hom : M.one ≫ hom = N.one := by aesop_cat
mul_hom : M.mul ≫ hom = (hom ⊗ hom) ≫ N.mul := by aesop_cat
#align Mon_.hom Mon_.Hom
attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom
/-- The identity morphism on a monoid object. -/
@[simps]
def id (M : Mon_ C) : Hom M M where
hom := 𝟙 M.X
#align Mon_.id Mon_.id
instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) :=
⟨id M⟩
#align Mon_.hom_inhabited Mon_.homInhabited
/-- Composition of morphisms of monoid objects. -/
@[simps]
def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where
hom := f.hom ≫ g.hom
#align Mon_.comp Mon_.comp
instance : Category (Mon_ C) where
Hom M N := Hom M N
id := id
comp f g := comp f g
-- Porting note: added, as `Hom.ext` does not apply to a morphism.
@[ext]
lemma ext {X Y : Mon_ C} {f g : X ⟶ Y} (w : f.hom = g.hom) : f = g :=
Hom.ext _ _ w
@[simp]
theorem id_hom' (M : Mon_ C) : (𝟙 M : Hom M M).hom = 𝟙 M.X :=
rfl
#align Mon_.id_hom' Mon_.id_hom'
@[simp]
theorem comp_hom' {M N K : Mon_ C} (f : M ⟶ N) (g : N ⟶ K) :
(f ≫ g : Hom M K).hom = f.hom ≫ g.hom :=
rfl
#align Mon_.comp_hom' Mon_.comp_hom'
section
variable (C)
/-- The forgetful functor from monoid objects to the ambient category. -/
@[simps]
def forget : Mon_ C ⥤ C where
obj A := A.X
map f := f.hom
#align Mon_.forget Mon_.forget
end
instance forget_faithful : Faithful (@forget C _ _) where
#align Mon_.forget_faithful Mon_.forget_faithful
instance {A B : Mon_ C} (f : A ⟶ B) [e : IsIso ((forget C).map f)] : IsIso f.hom :=
e
/-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/
instance : ReflectsIsomorphisms (forget C) where
reflects f e :=
⟨⟨{ hom := inv f.hom
mul_hom := by
simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, ← tensor_comp_assoc,
IsIso.inv_hom_id, tensor_id, Category.id_comp] },
by aesop_cat⟩⟩
/-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X ≅ N.X) (one_f : M.one ≫ f.hom = N.one)
(mul_f : M.mul ≫ f.hom = (f.hom ⊗ f.hom) ≫ N.mul) : M ≅ N where
hom :=
{ hom := f.hom
one_hom := one_f
mul_hom := mul_f }
inv :=
{ hom := f.inv
one_hom := by rw [← one_f]; simp
mul_hom := by
rw [← cancel_mono f.hom]
slice_rhs 2 3 => rw [mul_f]
simp }
#align Mon_.iso_of_iso Mon_.isoOfIso
instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C ⟶ A) where
default :=
{ hom := A.one
one_hom := by dsimp; simp
mul_hom := by dsimp; simp [A.one_mul, unitors_equal] }
uniq f := by
ext; simp
rw [← Category.id_comp f.hom]
erw [f.one_hom]
#align Mon_.unique_hom_from_trivial Mon_.uniqueHomFromTrivial
open CategoryTheory.Limits
instance : HasInitial (Mon_ C) :=
hasInitial_of_unique (trivial C)
end Mon_
namespace CategoryTheory.LaxMonoidalFunctor
variable {C} {D : Type u₂} [Category.{v₂} D] [MonoidalCategory.{v₂} D]
-- TODO: mapMod F A : Mod A ⥤ Mod (F.mapMon A)
/-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
| slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one] | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
| Mathlib.CategoryTheory.Monoidal.Mon_.202_0.NTUMzhXPwXsmsYt | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A | Mathlib_CategoryTheory_Monoidal_Mon_ |
case a.a
C : Type u₁
inst✝³ : Category.{v₁, u₁} C
inst✝² : MonoidalCategory C
D : Type u₂
inst✝¹ : Category.{v₂, u₂} D
inst✝ : MonoidalCategory D
F : LaxMonoidalFunctor C D
A : Mon_ C
| F.map (𝟙 A.X ⊗ A.one) ≫ F.map A.mul
case a
C : Type u₁
inst✝³ : Category.{v₁, u₁} C
inst✝² : MonoidalCategory C
D : Type u₂
inst✝¹ : Category.{v₂, u₂} D
inst✝ : MonoidalCategory D
F : LaxMonoidalFunctor C D
A : Mon_ C
| F.map (𝟙 A.X) ⊗ F.ε
case a.a
C : Type u₁
inst✝³ : Category.{v₁, u₁} C
inst✝² : MonoidalCategory C
D : Type u₂
inst✝¹ : Category.{v₂, u₂} D
inst✝ : MonoidalCategory D
F : LaxMonoidalFunctor C D
A : Mon_ C
| μ F A.X (𝟙_ C) | /-
Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/
import Mathlib.CategoryTheory.Monoidal.Braided
import Mathlib.CategoryTheory.Monoidal.Discrete
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
import Mathlib.Algebra.PUnitInstances
#align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c"
/-!
# The category of monoids in a monoidal category.
We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to
the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if
`C` is braided, then the category of monoids is naturally monoidal.
-/
set_option linter.uppercaseLean3 false
universe v₁ v₂ u₁ u₂ u
open CategoryTheory MonoidalCategory
variable (C : Type u₁) [Category.{v₁} C] [MonoidalCategory.{v₁} C]
/-- A monoid object internal to a monoidal category.
When the monoidal category is preadditive, this is also sometimes called an "algebra object".
-/
structure Mon_ where
X : C
one : 𝟙_ C ⟶ X
mul : X ⊗ X ⟶ X
one_mul : (one ⊗ 𝟙 X) ≫ mul = (λ_ X).hom := by aesop_cat
mul_one : (𝟙 X ⊗ one) ≫ mul = (ρ_ X).hom := by aesop_cat
-- Obviously there is some flexibility stating this axiom.
-- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`,
-- and chooses to place the associator on the right-hand side.
-- The heuristic is that unitors and associators "don't have much weight".
mul_assoc : (mul ⊗ 𝟙 X) ≫ mul = (α_ X X X).hom ≫ (𝟙 X ⊗ mul) ≫ mul := by aesop_cat
#align Mon_ Mon_
attribute [reassoc] Mon_.one_mul Mon_.mul_one
-- We prove a more general `@[simp]` lemma below.
attribute [reassoc (attr := simp)] Mon_.mul_assoc
namespace Mon_
/-- The trivial monoid object. We later show this is initial in `Mon_ C`.
-/
@[simps]
def trivial : Mon_ C where
X := 𝟙_ C
one := 𝟙 _
mul := (λ_ _).hom
mul_assoc := by coherence
mul_one := by coherence
#align Mon_.trivial Mon_.trivial
instance : Inhabited (Mon_ C) :=
⟨trivial C⟩
variable {C}
variable {M : Mon_ C}
@[simp]
theorem one_mul_hom {Z : C} (f : Z ⟶ M.X) : (M.one ⊗ f) ≫ M.mul = (λ_ Z).hom ≫ f := by
rw [← id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality]
#align Mon_.one_mul_hom Mon_.one_mul_hom
@[simp]
theorem mul_one_hom {Z : C} (f : Z ⟶ M.X) : (f ⊗ M.one) ≫ M.mul = (ρ_ Z).hom ≫ f := by
rw [← tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality]
#align Mon_.mul_one_hom Mon_.mul_one_hom
theorem assoc_flip :
(𝟙 M.X ⊗ M.mul) ≫ M.mul = (α_ M.X M.X M.X).inv ≫ (M.mul ⊗ 𝟙 M.X) ≫ M.mul := by simp
#align Mon_.assoc_flip Mon_.assoc_flip
/-- A morphism of monoid objects. -/
@[ext]
structure Hom (M N : Mon_ C) where
hom : M.X ⟶ N.X
one_hom : M.one ≫ hom = N.one := by aesop_cat
mul_hom : M.mul ≫ hom = (hom ⊗ hom) ≫ N.mul := by aesop_cat
#align Mon_.hom Mon_.Hom
attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom
/-- The identity morphism on a monoid object. -/
@[simps]
def id (M : Mon_ C) : Hom M M where
hom := 𝟙 M.X
#align Mon_.id Mon_.id
instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) :=
⟨id M⟩
#align Mon_.hom_inhabited Mon_.homInhabited
/-- Composition of morphisms of monoid objects. -/
@[simps]
def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where
hom := f.hom ≫ g.hom
#align Mon_.comp Mon_.comp
instance : Category (Mon_ C) where
Hom M N := Hom M N
id := id
comp f g := comp f g
-- Porting note: added, as `Hom.ext` does not apply to a morphism.
@[ext]
lemma ext {X Y : Mon_ C} {f g : X ⟶ Y} (w : f.hom = g.hom) : f = g :=
Hom.ext _ _ w
@[simp]
theorem id_hom' (M : Mon_ C) : (𝟙 M : Hom M M).hom = 𝟙 M.X :=
rfl
#align Mon_.id_hom' Mon_.id_hom'
@[simp]
theorem comp_hom' {M N K : Mon_ C} (f : M ⟶ N) (g : N ⟶ K) :
(f ≫ g : Hom M K).hom = f.hom ≫ g.hom :=
rfl
#align Mon_.comp_hom' Mon_.comp_hom'
section
variable (C)
/-- The forgetful functor from monoid objects to the ambient category. -/
@[simps]
def forget : Mon_ C ⥤ C where
obj A := A.X
map f := f.hom
#align Mon_.forget Mon_.forget
end
instance forget_faithful : Faithful (@forget C _ _) where
#align Mon_.forget_faithful Mon_.forget_faithful
instance {A B : Mon_ C} (f : A ⟶ B) [e : IsIso ((forget C).map f)] : IsIso f.hom :=
e
/-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/
instance : ReflectsIsomorphisms (forget C) where
reflects f e :=
⟨⟨{ hom := inv f.hom
mul_hom := by
simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, ← tensor_comp_assoc,
IsIso.inv_hom_id, tensor_id, Category.id_comp] },
by aesop_cat⟩⟩
/-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X ≅ N.X) (one_f : M.one ≫ f.hom = N.one)
(mul_f : M.mul ≫ f.hom = (f.hom ⊗ f.hom) ≫ N.mul) : M ≅ N where
hom :=
{ hom := f.hom
one_hom := one_f
mul_hom := mul_f }
inv :=
{ hom := f.inv
one_hom := by rw [← one_f]; simp
mul_hom := by
rw [← cancel_mono f.hom]
slice_rhs 2 3 => rw [mul_f]
simp }
#align Mon_.iso_of_iso Mon_.isoOfIso
instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C ⟶ A) where
default :=
{ hom := A.one
one_hom := by dsimp; simp
mul_hom := by dsimp; simp [A.one_mul, unitors_equal] }
uniq f := by
ext; simp
rw [← Category.id_comp f.hom]
erw [f.one_hom]
#align Mon_.unique_hom_from_trivial Mon_.uniqueHomFromTrivial
open CategoryTheory.Limits
instance : HasInitial (Mon_ C) :=
hasInitial_of_unique (trivial C)
end Mon_
namespace CategoryTheory.LaxMonoidalFunctor
variable {C} {D : Type u₂} [Category.{v₂} D] [MonoidalCategory.{v₂} D]
-- TODO: mapMod F A : Mod A ⥤ Mod (F.mapMon A)
/-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => | rw [← F.toFunctor.map_comp, A.mul_one] | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => | Mathlib.CategoryTheory.Monoidal.Mon_.202_0.NTUMzhXPwXsmsYt | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A | Mathlib_CategoryTheory_Monoidal_Mon_ |
case a.a
C : Type u₁
inst✝³ : Category.{v₁, u₁} C
inst✝² : MonoidalCategory C
D : Type u₂
inst✝¹ : Category.{v₂, u₂} D
inst✝ : MonoidalCategory D
F : LaxMonoidalFunctor C D
A : Mon_ C
| F.map (𝟙 A.X ⊗ A.one) ≫ F.map A.mul
case a
C : Type u₁
inst✝³ : Category.{v₁, u₁} C
inst✝² : MonoidalCategory C
D : Type u₂
inst✝¹ : Category.{v₂, u₂} D
inst✝ : MonoidalCategory D
F : LaxMonoidalFunctor C D
A : Mon_ C
| F.map (𝟙 A.X) ⊗ F.ε
case a.a
C : Type u₁
inst✝³ : Category.{v₁, u₁} C
inst✝² : MonoidalCategory C
D : Type u₂
inst✝¹ : Category.{v₂, u₂} D
inst✝ : MonoidalCategory D
F : LaxMonoidalFunctor C D
A : Mon_ C
| μ F A.X (𝟙_ C) | /-
Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/
import Mathlib.CategoryTheory.Monoidal.Braided
import Mathlib.CategoryTheory.Monoidal.Discrete
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
import Mathlib.Algebra.PUnitInstances
#align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c"
/-!
# The category of monoids in a monoidal category.
We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to
the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if
`C` is braided, then the category of monoids is naturally monoidal.
-/
set_option linter.uppercaseLean3 false
universe v₁ v₂ u₁ u₂ u
open CategoryTheory MonoidalCategory
variable (C : Type u₁) [Category.{v₁} C] [MonoidalCategory.{v₁} C]
/-- A monoid object internal to a monoidal category.
When the monoidal category is preadditive, this is also sometimes called an "algebra object".
-/
structure Mon_ where
X : C
one : 𝟙_ C ⟶ X
mul : X ⊗ X ⟶ X
one_mul : (one ⊗ 𝟙 X) ≫ mul = (λ_ X).hom := by aesop_cat
mul_one : (𝟙 X ⊗ one) ≫ mul = (ρ_ X).hom := by aesop_cat
-- Obviously there is some flexibility stating this axiom.
-- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`,
-- and chooses to place the associator on the right-hand side.
-- The heuristic is that unitors and associators "don't have much weight".
mul_assoc : (mul ⊗ 𝟙 X) ≫ mul = (α_ X X X).hom ≫ (𝟙 X ⊗ mul) ≫ mul := by aesop_cat
#align Mon_ Mon_
attribute [reassoc] Mon_.one_mul Mon_.mul_one
-- We prove a more general `@[simp]` lemma below.
attribute [reassoc (attr := simp)] Mon_.mul_assoc
namespace Mon_
/-- The trivial monoid object. We later show this is initial in `Mon_ C`.
-/
@[simps]
def trivial : Mon_ C where
X := 𝟙_ C
one := 𝟙 _
mul := (λ_ _).hom
mul_assoc := by coherence
mul_one := by coherence
#align Mon_.trivial Mon_.trivial
instance : Inhabited (Mon_ C) :=
⟨trivial C⟩
variable {C}
variable {M : Mon_ C}
@[simp]
theorem one_mul_hom {Z : C} (f : Z ⟶ M.X) : (M.one ⊗ f) ≫ M.mul = (λ_ Z).hom ≫ f := by
rw [← id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality]
#align Mon_.one_mul_hom Mon_.one_mul_hom
@[simp]
theorem mul_one_hom {Z : C} (f : Z ⟶ M.X) : (f ⊗ M.one) ≫ M.mul = (ρ_ Z).hom ≫ f := by
rw [← tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality]
#align Mon_.mul_one_hom Mon_.mul_one_hom
theorem assoc_flip :
(𝟙 M.X ⊗ M.mul) ≫ M.mul = (α_ M.X M.X M.X).inv ≫ (M.mul ⊗ 𝟙 M.X) ≫ M.mul := by simp
#align Mon_.assoc_flip Mon_.assoc_flip
/-- A morphism of monoid objects. -/
@[ext]
structure Hom (M N : Mon_ C) where
hom : M.X ⟶ N.X
one_hom : M.one ≫ hom = N.one := by aesop_cat
mul_hom : M.mul ≫ hom = (hom ⊗ hom) ≫ N.mul := by aesop_cat
#align Mon_.hom Mon_.Hom
attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom
/-- The identity morphism on a monoid object. -/
@[simps]
def id (M : Mon_ C) : Hom M M where
hom := 𝟙 M.X
#align Mon_.id Mon_.id
instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) :=
⟨id M⟩
#align Mon_.hom_inhabited Mon_.homInhabited
/-- Composition of morphisms of monoid objects. -/
@[simps]
def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where
hom := f.hom ≫ g.hom
#align Mon_.comp Mon_.comp
instance : Category (Mon_ C) where
Hom M N := Hom M N
id := id
comp f g := comp f g
-- Porting note: added, as `Hom.ext` does not apply to a morphism.
@[ext]
lemma ext {X Y : Mon_ C} {f g : X ⟶ Y} (w : f.hom = g.hom) : f = g :=
Hom.ext _ _ w
@[simp]
theorem id_hom' (M : Mon_ C) : (𝟙 M : Hom M M).hom = 𝟙 M.X :=
rfl
#align Mon_.id_hom' Mon_.id_hom'
@[simp]
theorem comp_hom' {M N K : Mon_ C} (f : M ⟶ N) (g : N ⟶ K) :
(f ≫ g : Hom M K).hom = f.hom ≫ g.hom :=
rfl
#align Mon_.comp_hom' Mon_.comp_hom'
section
variable (C)
/-- The forgetful functor from monoid objects to the ambient category. -/
@[simps]
def forget : Mon_ C ⥤ C where
obj A := A.X
map f := f.hom
#align Mon_.forget Mon_.forget
end
instance forget_faithful : Faithful (@forget C _ _) where
#align Mon_.forget_faithful Mon_.forget_faithful
instance {A B : Mon_ C} (f : A ⟶ B) [e : IsIso ((forget C).map f)] : IsIso f.hom :=
e
/-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/
instance : ReflectsIsomorphisms (forget C) where
reflects f e :=
⟨⟨{ hom := inv f.hom
mul_hom := by
simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, ← tensor_comp_assoc,
IsIso.inv_hom_id, tensor_id, Category.id_comp] },
by aesop_cat⟩⟩
/-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X ≅ N.X) (one_f : M.one ≫ f.hom = N.one)
(mul_f : M.mul ≫ f.hom = (f.hom ⊗ f.hom) ≫ N.mul) : M ≅ N where
hom :=
{ hom := f.hom
one_hom := one_f
mul_hom := mul_f }
inv :=
{ hom := f.inv
one_hom := by rw [← one_f]; simp
mul_hom := by
rw [← cancel_mono f.hom]
slice_rhs 2 3 => rw [mul_f]
simp }
#align Mon_.iso_of_iso Mon_.isoOfIso
instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C ⟶ A) where
default :=
{ hom := A.one
one_hom := by dsimp; simp
mul_hom := by dsimp; simp [A.one_mul, unitors_equal] }
uniq f := by
ext; simp
rw [← Category.id_comp f.hom]
erw [f.one_hom]
#align Mon_.unique_hom_from_trivial Mon_.uniqueHomFromTrivial
open CategoryTheory.Limits
instance : HasInitial (Mon_ C) :=
hasInitial_of_unique (trivial C)
end Mon_
namespace CategoryTheory.LaxMonoidalFunctor
variable {C} {D : Type u₂} [Category.{v₂} D] [MonoidalCategory.{v₂} D]
-- TODO: mapMod F A : Mod A ⥤ Mod (F.mapMon A)
/-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => | rw [← F.toFunctor.map_comp, A.mul_one] | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => | Mathlib.CategoryTheory.Monoidal.Mon_.202_0.NTUMzhXPwXsmsYt | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A | Mathlib_CategoryTheory_Monoidal_Mon_ |
case a.a
C : Type u₁
inst✝³ : Category.{v₁, u₁} C
inst✝² : MonoidalCategory C
D : Type u₂
inst✝¹ : Category.{v₂, u₂} D
inst✝ : MonoidalCategory D
F : LaxMonoidalFunctor C D
A : Mon_ C
| F.map (𝟙 A.X ⊗ A.one) ≫ F.map A.mul
case a
C : Type u₁
inst✝³ : Category.{v₁, u₁} C
inst✝² : MonoidalCategory C
D : Type u₂
inst✝¹ : Category.{v₂, u₂} D
inst✝ : MonoidalCategory D
F : LaxMonoidalFunctor C D
A : Mon_ C
| F.map (𝟙 A.X) ⊗ F.ε
case a.a
C : Type u₁
inst✝³ : Category.{v₁, u₁} C
inst✝² : MonoidalCategory C
D : Type u₂
inst✝¹ : Category.{v₂, u₂} D
inst✝ : MonoidalCategory D
F : LaxMonoidalFunctor C D
A : Mon_ C
| μ F A.X (𝟙_ C) | /-
Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/
import Mathlib.CategoryTheory.Monoidal.Braided
import Mathlib.CategoryTheory.Monoidal.Discrete
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
import Mathlib.Algebra.PUnitInstances
#align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c"
/-!
# The category of monoids in a monoidal category.
We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to
the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if
`C` is braided, then the category of monoids is naturally monoidal.
-/
set_option linter.uppercaseLean3 false
universe v₁ v₂ u₁ u₂ u
open CategoryTheory MonoidalCategory
variable (C : Type u₁) [Category.{v₁} C] [MonoidalCategory.{v₁} C]
/-- A monoid object internal to a monoidal category.
When the monoidal category is preadditive, this is also sometimes called an "algebra object".
-/
structure Mon_ where
X : C
one : 𝟙_ C ⟶ X
mul : X ⊗ X ⟶ X
one_mul : (one ⊗ 𝟙 X) ≫ mul = (λ_ X).hom := by aesop_cat
mul_one : (𝟙 X ⊗ one) ≫ mul = (ρ_ X).hom := by aesop_cat
-- Obviously there is some flexibility stating this axiom.
-- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`,
-- and chooses to place the associator on the right-hand side.
-- The heuristic is that unitors and associators "don't have much weight".
mul_assoc : (mul ⊗ 𝟙 X) ≫ mul = (α_ X X X).hom ≫ (𝟙 X ⊗ mul) ≫ mul := by aesop_cat
#align Mon_ Mon_
attribute [reassoc] Mon_.one_mul Mon_.mul_one
-- We prove a more general `@[simp]` lemma below.
attribute [reassoc (attr := simp)] Mon_.mul_assoc
namespace Mon_
/-- The trivial monoid object. We later show this is initial in `Mon_ C`.
-/
@[simps]
def trivial : Mon_ C where
X := 𝟙_ C
one := 𝟙 _
mul := (λ_ _).hom
mul_assoc := by coherence
mul_one := by coherence
#align Mon_.trivial Mon_.trivial
instance : Inhabited (Mon_ C) :=
⟨trivial C⟩
variable {C}
variable {M : Mon_ C}
@[simp]
theorem one_mul_hom {Z : C} (f : Z ⟶ M.X) : (M.one ⊗ f) ≫ M.mul = (λ_ Z).hom ≫ f := by
rw [← id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality]
#align Mon_.one_mul_hom Mon_.one_mul_hom
@[simp]
theorem mul_one_hom {Z : C} (f : Z ⟶ M.X) : (f ⊗ M.one) ≫ M.mul = (ρ_ Z).hom ≫ f := by
rw [← tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality]
#align Mon_.mul_one_hom Mon_.mul_one_hom
theorem assoc_flip :
(𝟙 M.X ⊗ M.mul) ≫ M.mul = (α_ M.X M.X M.X).inv ≫ (M.mul ⊗ 𝟙 M.X) ≫ M.mul := by simp
#align Mon_.assoc_flip Mon_.assoc_flip
/-- A morphism of monoid objects. -/
@[ext]
structure Hom (M N : Mon_ C) where
hom : M.X ⟶ N.X
one_hom : M.one ≫ hom = N.one := by aesop_cat
mul_hom : M.mul ≫ hom = (hom ⊗ hom) ≫ N.mul := by aesop_cat
#align Mon_.hom Mon_.Hom
attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom
/-- The identity morphism on a monoid object. -/
@[simps]
def id (M : Mon_ C) : Hom M M where
hom := 𝟙 M.X
#align Mon_.id Mon_.id
instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) :=
⟨id M⟩
#align Mon_.hom_inhabited Mon_.homInhabited
/-- Composition of morphisms of monoid objects. -/
@[simps]
def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where
hom := f.hom ≫ g.hom
#align Mon_.comp Mon_.comp
instance : Category (Mon_ C) where
Hom M N := Hom M N
id := id
comp f g := comp f g
-- Porting note: added, as `Hom.ext` does not apply to a morphism.
@[ext]
lemma ext {X Y : Mon_ C} {f g : X ⟶ Y} (w : f.hom = g.hom) : f = g :=
Hom.ext _ _ w
@[simp]
theorem id_hom' (M : Mon_ C) : (𝟙 M : Hom M M).hom = 𝟙 M.X :=
rfl
#align Mon_.id_hom' Mon_.id_hom'
@[simp]
theorem comp_hom' {M N K : Mon_ C} (f : M ⟶ N) (g : N ⟶ K) :
(f ≫ g : Hom M K).hom = f.hom ≫ g.hom :=
rfl
#align Mon_.comp_hom' Mon_.comp_hom'
section
variable (C)
/-- The forgetful functor from monoid objects to the ambient category. -/
@[simps]
def forget : Mon_ C ⥤ C where
obj A := A.X
map f := f.hom
#align Mon_.forget Mon_.forget
end
instance forget_faithful : Faithful (@forget C _ _) where
#align Mon_.forget_faithful Mon_.forget_faithful
instance {A B : Mon_ C} (f : A ⟶ B) [e : IsIso ((forget C).map f)] : IsIso f.hom :=
e
/-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/
instance : ReflectsIsomorphisms (forget C) where
reflects f e :=
⟨⟨{ hom := inv f.hom
mul_hom := by
simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, ← tensor_comp_assoc,
IsIso.inv_hom_id, tensor_id, Category.id_comp] },
by aesop_cat⟩⟩
/-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X ≅ N.X) (one_f : M.one ≫ f.hom = N.one)
(mul_f : M.mul ≫ f.hom = (f.hom ⊗ f.hom) ≫ N.mul) : M ≅ N where
hom :=
{ hom := f.hom
one_hom := one_f
mul_hom := mul_f }
inv :=
{ hom := f.inv
one_hom := by rw [← one_f]; simp
mul_hom := by
rw [← cancel_mono f.hom]
slice_rhs 2 3 => rw [mul_f]
simp }
#align Mon_.iso_of_iso Mon_.isoOfIso
instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C ⟶ A) where
default :=
{ hom := A.one
one_hom := by dsimp; simp
mul_hom := by dsimp; simp [A.one_mul, unitors_equal] }
uniq f := by
ext; simp
rw [← Category.id_comp f.hom]
erw [f.one_hom]
#align Mon_.unique_hom_from_trivial Mon_.uniqueHomFromTrivial
open CategoryTheory.Limits
instance : HasInitial (Mon_ C) :=
hasInitial_of_unique (trivial C)
end Mon_
namespace CategoryTheory.LaxMonoidalFunctor
variable {C} {D : Type u₂} [Category.{v₂} D] [MonoidalCategory.{v₂} D]
-- TODO: mapMod F A : Mod A ⥤ Mod (F.mapMon A)
/-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => | rw [← F.toFunctor.map_comp, A.mul_one] | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => | Mathlib.CategoryTheory.Monoidal.Mon_.202_0.NTUMzhXPwXsmsYt | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A | Mathlib_CategoryTheory_Monoidal_Mon_ |
C : Type u₁
inst✝³ : Category.{v₁, u₁} C
inst✝² : MonoidalCategory C
D : Type u₂
inst✝¹ : Category.{v₂, u₂} D
inst✝ : MonoidalCategory D
F : LaxMonoidalFunctor C D
A : Mon_ C
⊢ (F.map (𝟙 A.X) ⊗ F.ε) ≫ μ F A.X (𝟙_ C) ≫ F.map (ρ_ A.X).hom = (ρ_ (F.obj A.X)).hom | /-
Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/
import Mathlib.CategoryTheory.Monoidal.Braided
import Mathlib.CategoryTheory.Monoidal.Discrete
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
import Mathlib.Algebra.PUnitInstances
#align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c"
/-!
# The category of monoids in a monoidal category.
We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to
the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if
`C` is braided, then the category of monoids is naturally monoidal.
-/
set_option linter.uppercaseLean3 false
universe v₁ v₂ u₁ u₂ u
open CategoryTheory MonoidalCategory
variable (C : Type u₁) [Category.{v₁} C] [MonoidalCategory.{v₁} C]
/-- A monoid object internal to a monoidal category.
When the monoidal category is preadditive, this is also sometimes called an "algebra object".
-/
structure Mon_ where
X : C
one : 𝟙_ C ⟶ X
mul : X ⊗ X ⟶ X
one_mul : (one ⊗ 𝟙 X) ≫ mul = (λ_ X).hom := by aesop_cat
mul_one : (𝟙 X ⊗ one) ≫ mul = (ρ_ X).hom := by aesop_cat
-- Obviously there is some flexibility stating this axiom.
-- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`,
-- and chooses to place the associator on the right-hand side.
-- The heuristic is that unitors and associators "don't have much weight".
mul_assoc : (mul ⊗ 𝟙 X) ≫ mul = (α_ X X X).hom ≫ (𝟙 X ⊗ mul) ≫ mul := by aesop_cat
#align Mon_ Mon_
attribute [reassoc] Mon_.one_mul Mon_.mul_one
-- We prove a more general `@[simp]` lemma below.
attribute [reassoc (attr := simp)] Mon_.mul_assoc
namespace Mon_
/-- The trivial monoid object. We later show this is initial in `Mon_ C`.
-/
@[simps]
def trivial : Mon_ C where
X := 𝟙_ C
one := 𝟙 _
mul := (λ_ _).hom
mul_assoc := by coherence
mul_one := by coherence
#align Mon_.trivial Mon_.trivial
instance : Inhabited (Mon_ C) :=
⟨trivial C⟩
variable {C}
variable {M : Mon_ C}
@[simp]
theorem one_mul_hom {Z : C} (f : Z ⟶ M.X) : (M.one ⊗ f) ≫ M.mul = (λ_ Z).hom ≫ f := by
rw [← id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality]
#align Mon_.one_mul_hom Mon_.one_mul_hom
@[simp]
theorem mul_one_hom {Z : C} (f : Z ⟶ M.X) : (f ⊗ M.one) ≫ M.mul = (ρ_ Z).hom ≫ f := by
rw [← tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality]
#align Mon_.mul_one_hom Mon_.mul_one_hom
theorem assoc_flip :
(𝟙 M.X ⊗ M.mul) ≫ M.mul = (α_ M.X M.X M.X).inv ≫ (M.mul ⊗ 𝟙 M.X) ≫ M.mul := by simp
#align Mon_.assoc_flip Mon_.assoc_flip
/-- A morphism of monoid objects. -/
@[ext]
structure Hom (M N : Mon_ C) where
hom : M.X ⟶ N.X
one_hom : M.one ≫ hom = N.one := by aesop_cat
mul_hom : M.mul ≫ hom = (hom ⊗ hom) ≫ N.mul := by aesop_cat
#align Mon_.hom Mon_.Hom
attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom
/-- The identity morphism on a monoid object. -/
@[simps]
def id (M : Mon_ C) : Hom M M where
hom := 𝟙 M.X
#align Mon_.id Mon_.id
instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) :=
⟨id M⟩
#align Mon_.hom_inhabited Mon_.homInhabited
/-- Composition of morphisms of monoid objects. -/
@[simps]
def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where
hom := f.hom ≫ g.hom
#align Mon_.comp Mon_.comp
instance : Category (Mon_ C) where
Hom M N := Hom M N
id := id
comp f g := comp f g
-- Porting note: added, as `Hom.ext` does not apply to a morphism.
@[ext]
lemma ext {X Y : Mon_ C} {f g : X ⟶ Y} (w : f.hom = g.hom) : f = g :=
Hom.ext _ _ w
@[simp]
theorem id_hom' (M : Mon_ C) : (𝟙 M : Hom M M).hom = 𝟙 M.X :=
rfl
#align Mon_.id_hom' Mon_.id_hom'
@[simp]
theorem comp_hom' {M N K : Mon_ C} (f : M ⟶ N) (g : N ⟶ K) :
(f ≫ g : Hom M K).hom = f.hom ≫ g.hom :=
rfl
#align Mon_.comp_hom' Mon_.comp_hom'
section
variable (C)
/-- The forgetful functor from monoid objects to the ambient category. -/
@[simps]
def forget : Mon_ C ⥤ C where
obj A := A.X
map f := f.hom
#align Mon_.forget Mon_.forget
end
instance forget_faithful : Faithful (@forget C _ _) where
#align Mon_.forget_faithful Mon_.forget_faithful
instance {A B : Mon_ C} (f : A ⟶ B) [e : IsIso ((forget C).map f)] : IsIso f.hom :=
e
/-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/
instance : ReflectsIsomorphisms (forget C) where
reflects f e :=
⟨⟨{ hom := inv f.hom
mul_hom := by
simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, ← tensor_comp_assoc,
IsIso.inv_hom_id, tensor_id, Category.id_comp] },
by aesop_cat⟩⟩
/-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X ≅ N.X) (one_f : M.one ≫ f.hom = N.one)
(mul_f : M.mul ≫ f.hom = (f.hom ⊗ f.hom) ≫ N.mul) : M ≅ N where
hom :=
{ hom := f.hom
one_hom := one_f
mul_hom := mul_f }
inv :=
{ hom := f.inv
one_hom := by rw [← one_f]; simp
mul_hom := by
rw [← cancel_mono f.hom]
slice_rhs 2 3 => rw [mul_f]
simp }
#align Mon_.iso_of_iso Mon_.isoOfIso
instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C ⟶ A) where
default :=
{ hom := A.one
one_hom := by dsimp; simp
mul_hom := by dsimp; simp [A.one_mul, unitors_equal] }
uniq f := by
ext; simp
rw [← Category.id_comp f.hom]
erw [f.one_hom]
#align Mon_.unique_hom_from_trivial Mon_.uniqueHomFromTrivial
open CategoryTheory.Limits
instance : HasInitial (Mon_ C) :=
hasInitial_of_unique (trivial C)
end Mon_
namespace CategoryTheory.LaxMonoidalFunctor
variable {C} {D : Type u₂} [Category.{v₂} D] [MonoidalCategory.{v₂} D]
-- TODO: mapMod F A : Mod A ⥤ Mod (F.mapMon A)
/-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one]
| rw [F.toFunctor.map_id] | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one]
| Mathlib.CategoryTheory.Monoidal.Mon_.202_0.NTUMzhXPwXsmsYt | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A | Mathlib_CategoryTheory_Monoidal_Mon_ |
C : Type u₁
inst✝³ : Category.{v₁, u₁} C
inst✝² : MonoidalCategory C
D : Type u₂
inst✝¹ : Category.{v₂, u₂} D
inst✝ : MonoidalCategory D
F : LaxMonoidalFunctor C D
A : Mon_ C
⊢ (𝟙 (F.obj A.X) ⊗ F.ε) ≫ μ F A.X (𝟙_ C) ≫ F.map (ρ_ A.X).hom = (ρ_ (F.obj A.X)).hom | /-
Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/
import Mathlib.CategoryTheory.Monoidal.Braided
import Mathlib.CategoryTheory.Monoidal.Discrete
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
import Mathlib.Algebra.PUnitInstances
#align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c"
/-!
# The category of monoids in a monoidal category.
We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to
the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if
`C` is braided, then the category of monoids is naturally monoidal.
-/
set_option linter.uppercaseLean3 false
universe v₁ v₂ u₁ u₂ u
open CategoryTheory MonoidalCategory
variable (C : Type u₁) [Category.{v₁} C] [MonoidalCategory.{v₁} C]
/-- A monoid object internal to a monoidal category.
When the monoidal category is preadditive, this is also sometimes called an "algebra object".
-/
structure Mon_ where
X : C
one : 𝟙_ C ⟶ X
mul : X ⊗ X ⟶ X
one_mul : (one ⊗ 𝟙 X) ≫ mul = (λ_ X).hom := by aesop_cat
mul_one : (𝟙 X ⊗ one) ≫ mul = (ρ_ X).hom := by aesop_cat
-- Obviously there is some flexibility stating this axiom.
-- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`,
-- and chooses to place the associator on the right-hand side.
-- The heuristic is that unitors and associators "don't have much weight".
mul_assoc : (mul ⊗ 𝟙 X) ≫ mul = (α_ X X X).hom ≫ (𝟙 X ⊗ mul) ≫ mul := by aesop_cat
#align Mon_ Mon_
attribute [reassoc] Mon_.one_mul Mon_.mul_one
-- We prove a more general `@[simp]` lemma below.
attribute [reassoc (attr := simp)] Mon_.mul_assoc
namespace Mon_
/-- The trivial monoid object. We later show this is initial in `Mon_ C`.
-/
@[simps]
def trivial : Mon_ C where
X := 𝟙_ C
one := 𝟙 _
mul := (λ_ _).hom
mul_assoc := by coherence
mul_one := by coherence
#align Mon_.trivial Mon_.trivial
instance : Inhabited (Mon_ C) :=
⟨trivial C⟩
variable {C}
variable {M : Mon_ C}
@[simp]
theorem one_mul_hom {Z : C} (f : Z ⟶ M.X) : (M.one ⊗ f) ≫ M.mul = (λ_ Z).hom ≫ f := by
rw [← id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality]
#align Mon_.one_mul_hom Mon_.one_mul_hom
@[simp]
theorem mul_one_hom {Z : C} (f : Z ⟶ M.X) : (f ⊗ M.one) ≫ M.mul = (ρ_ Z).hom ≫ f := by
rw [← tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality]
#align Mon_.mul_one_hom Mon_.mul_one_hom
theorem assoc_flip :
(𝟙 M.X ⊗ M.mul) ≫ M.mul = (α_ M.X M.X M.X).inv ≫ (M.mul ⊗ 𝟙 M.X) ≫ M.mul := by simp
#align Mon_.assoc_flip Mon_.assoc_flip
/-- A morphism of monoid objects. -/
@[ext]
structure Hom (M N : Mon_ C) where
hom : M.X ⟶ N.X
one_hom : M.one ≫ hom = N.one := by aesop_cat
mul_hom : M.mul ≫ hom = (hom ⊗ hom) ≫ N.mul := by aesop_cat
#align Mon_.hom Mon_.Hom
attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom
/-- The identity morphism on a monoid object. -/
@[simps]
def id (M : Mon_ C) : Hom M M where
hom := 𝟙 M.X
#align Mon_.id Mon_.id
instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) :=
⟨id M⟩
#align Mon_.hom_inhabited Mon_.homInhabited
/-- Composition of morphisms of monoid objects. -/
@[simps]
def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where
hom := f.hom ≫ g.hom
#align Mon_.comp Mon_.comp
instance : Category (Mon_ C) where
Hom M N := Hom M N
id := id
comp f g := comp f g
-- Porting note: added, as `Hom.ext` does not apply to a morphism.
@[ext]
lemma ext {X Y : Mon_ C} {f g : X ⟶ Y} (w : f.hom = g.hom) : f = g :=
Hom.ext _ _ w
@[simp]
theorem id_hom' (M : Mon_ C) : (𝟙 M : Hom M M).hom = 𝟙 M.X :=
rfl
#align Mon_.id_hom' Mon_.id_hom'
@[simp]
theorem comp_hom' {M N K : Mon_ C} (f : M ⟶ N) (g : N ⟶ K) :
(f ≫ g : Hom M K).hom = f.hom ≫ g.hom :=
rfl
#align Mon_.comp_hom' Mon_.comp_hom'
section
variable (C)
/-- The forgetful functor from monoid objects to the ambient category. -/
@[simps]
def forget : Mon_ C ⥤ C where
obj A := A.X
map f := f.hom
#align Mon_.forget Mon_.forget
end
instance forget_faithful : Faithful (@forget C _ _) where
#align Mon_.forget_faithful Mon_.forget_faithful
instance {A B : Mon_ C} (f : A ⟶ B) [e : IsIso ((forget C).map f)] : IsIso f.hom :=
e
/-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/
instance : ReflectsIsomorphisms (forget C) where
reflects f e :=
⟨⟨{ hom := inv f.hom
mul_hom := by
simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, ← tensor_comp_assoc,
IsIso.inv_hom_id, tensor_id, Category.id_comp] },
by aesop_cat⟩⟩
/-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X ≅ N.X) (one_f : M.one ≫ f.hom = N.one)
(mul_f : M.mul ≫ f.hom = (f.hom ⊗ f.hom) ≫ N.mul) : M ≅ N where
hom :=
{ hom := f.hom
one_hom := one_f
mul_hom := mul_f }
inv :=
{ hom := f.inv
one_hom := by rw [← one_f]; simp
mul_hom := by
rw [← cancel_mono f.hom]
slice_rhs 2 3 => rw [mul_f]
simp }
#align Mon_.iso_of_iso Mon_.isoOfIso
instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C ⟶ A) where
default :=
{ hom := A.one
one_hom := by dsimp; simp
mul_hom := by dsimp; simp [A.one_mul, unitors_equal] }
uniq f := by
ext; simp
rw [← Category.id_comp f.hom]
erw [f.one_hom]
#align Mon_.unique_hom_from_trivial Mon_.uniqueHomFromTrivial
open CategoryTheory.Limits
instance : HasInitial (Mon_ C) :=
hasInitial_of_unique (trivial C)
end Mon_
namespace CategoryTheory.LaxMonoidalFunctor
variable {C} {D : Type u₂} [Category.{v₂} D] [MonoidalCategory.{v₂} D]
-- TODO: mapMod F A : Mod A ⥤ Mod (F.mapMon A)
/-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one]
rw [F.toFunctor.map_id]
| rw [F.right_unitality] | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one]
rw [F.toFunctor.map_id]
| Mathlib.CategoryTheory.Monoidal.Mon_.202_0.NTUMzhXPwXsmsYt | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A | Mathlib_CategoryTheory_Monoidal_Mon_ |
C : Type u₁
inst✝³ : Category.{v₁, u₁} C
inst✝² : MonoidalCategory C
D : Type u₂
inst✝¹ : Category.{v₂, u₂} D
inst✝ : MonoidalCategory D
F : LaxMonoidalFunctor C D
A : Mon_ C
⊢ (μ F A.X A.X ≫ F.map A.mul ⊗ 𝟙 (F.obj A.X)) ≫ μ F A.X A.X ≫ F.map A.mul =
(α_ (F.obj A.X) (F.obj A.X) (F.obj A.X)).hom ≫
(𝟙 (F.obj A.X) ⊗ μ F A.X A.X ≫ F.map A.mul) ≫ μ F A.X A.X ≫ F.map A.mul | /-
Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/
import Mathlib.CategoryTheory.Monoidal.Braided
import Mathlib.CategoryTheory.Monoidal.Discrete
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
import Mathlib.Algebra.PUnitInstances
#align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c"
/-!
# The category of monoids in a monoidal category.
We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to
the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if
`C` is braided, then the category of monoids is naturally monoidal.
-/
set_option linter.uppercaseLean3 false
universe v₁ v₂ u₁ u₂ u
open CategoryTheory MonoidalCategory
variable (C : Type u₁) [Category.{v₁} C] [MonoidalCategory.{v₁} C]
/-- A monoid object internal to a monoidal category.
When the monoidal category is preadditive, this is also sometimes called an "algebra object".
-/
structure Mon_ where
X : C
one : 𝟙_ C ⟶ X
mul : X ⊗ X ⟶ X
one_mul : (one ⊗ 𝟙 X) ≫ mul = (λ_ X).hom := by aesop_cat
mul_one : (𝟙 X ⊗ one) ≫ mul = (ρ_ X).hom := by aesop_cat
-- Obviously there is some flexibility stating this axiom.
-- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`,
-- and chooses to place the associator on the right-hand side.
-- The heuristic is that unitors and associators "don't have much weight".
mul_assoc : (mul ⊗ 𝟙 X) ≫ mul = (α_ X X X).hom ≫ (𝟙 X ⊗ mul) ≫ mul := by aesop_cat
#align Mon_ Mon_
attribute [reassoc] Mon_.one_mul Mon_.mul_one
-- We prove a more general `@[simp]` lemma below.
attribute [reassoc (attr := simp)] Mon_.mul_assoc
namespace Mon_
/-- The trivial monoid object. We later show this is initial in `Mon_ C`.
-/
@[simps]
def trivial : Mon_ C where
X := 𝟙_ C
one := 𝟙 _
mul := (λ_ _).hom
mul_assoc := by coherence
mul_one := by coherence
#align Mon_.trivial Mon_.trivial
instance : Inhabited (Mon_ C) :=
⟨trivial C⟩
variable {C}
variable {M : Mon_ C}
@[simp]
theorem one_mul_hom {Z : C} (f : Z ⟶ M.X) : (M.one ⊗ f) ≫ M.mul = (λ_ Z).hom ≫ f := by
rw [← id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality]
#align Mon_.one_mul_hom Mon_.one_mul_hom
@[simp]
theorem mul_one_hom {Z : C} (f : Z ⟶ M.X) : (f ⊗ M.one) ≫ M.mul = (ρ_ Z).hom ≫ f := by
rw [← tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality]
#align Mon_.mul_one_hom Mon_.mul_one_hom
theorem assoc_flip :
(𝟙 M.X ⊗ M.mul) ≫ M.mul = (α_ M.X M.X M.X).inv ≫ (M.mul ⊗ 𝟙 M.X) ≫ M.mul := by simp
#align Mon_.assoc_flip Mon_.assoc_flip
/-- A morphism of monoid objects. -/
@[ext]
structure Hom (M N : Mon_ C) where
hom : M.X ⟶ N.X
one_hom : M.one ≫ hom = N.one := by aesop_cat
mul_hom : M.mul ≫ hom = (hom ⊗ hom) ≫ N.mul := by aesop_cat
#align Mon_.hom Mon_.Hom
attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom
/-- The identity morphism on a monoid object. -/
@[simps]
def id (M : Mon_ C) : Hom M M where
hom := 𝟙 M.X
#align Mon_.id Mon_.id
instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) :=
⟨id M⟩
#align Mon_.hom_inhabited Mon_.homInhabited
/-- Composition of morphisms of monoid objects. -/
@[simps]
def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where
hom := f.hom ≫ g.hom
#align Mon_.comp Mon_.comp
instance : Category (Mon_ C) where
Hom M N := Hom M N
id := id
comp f g := comp f g
-- Porting note: added, as `Hom.ext` does not apply to a morphism.
@[ext]
lemma ext {X Y : Mon_ C} {f g : X ⟶ Y} (w : f.hom = g.hom) : f = g :=
Hom.ext _ _ w
@[simp]
theorem id_hom' (M : Mon_ C) : (𝟙 M : Hom M M).hom = 𝟙 M.X :=
rfl
#align Mon_.id_hom' Mon_.id_hom'
@[simp]
theorem comp_hom' {M N K : Mon_ C} (f : M ⟶ N) (g : N ⟶ K) :
(f ≫ g : Hom M K).hom = f.hom ≫ g.hom :=
rfl
#align Mon_.comp_hom' Mon_.comp_hom'
section
variable (C)
/-- The forgetful functor from monoid objects to the ambient category. -/
@[simps]
def forget : Mon_ C ⥤ C where
obj A := A.X
map f := f.hom
#align Mon_.forget Mon_.forget
end
instance forget_faithful : Faithful (@forget C _ _) where
#align Mon_.forget_faithful Mon_.forget_faithful
instance {A B : Mon_ C} (f : A ⟶ B) [e : IsIso ((forget C).map f)] : IsIso f.hom :=
e
/-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/
instance : ReflectsIsomorphisms (forget C) where
reflects f e :=
⟨⟨{ hom := inv f.hom
mul_hom := by
simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, ← tensor_comp_assoc,
IsIso.inv_hom_id, tensor_id, Category.id_comp] },
by aesop_cat⟩⟩
/-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X ≅ N.X) (one_f : M.one ≫ f.hom = N.one)
(mul_f : M.mul ≫ f.hom = (f.hom ⊗ f.hom) ≫ N.mul) : M ≅ N where
hom :=
{ hom := f.hom
one_hom := one_f
mul_hom := mul_f }
inv :=
{ hom := f.inv
one_hom := by rw [← one_f]; simp
mul_hom := by
rw [← cancel_mono f.hom]
slice_rhs 2 3 => rw [mul_f]
simp }
#align Mon_.iso_of_iso Mon_.isoOfIso
instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C ⟶ A) where
default :=
{ hom := A.one
one_hom := by dsimp; simp
mul_hom := by dsimp; simp [A.one_mul, unitors_equal] }
uniq f := by
ext; simp
rw [← Category.id_comp f.hom]
erw [f.one_hom]
#align Mon_.unique_hom_from_trivial Mon_.uniqueHomFromTrivial
open CategoryTheory.Limits
instance : HasInitial (Mon_ C) :=
hasInitial_of_unique (trivial C)
end Mon_
namespace CategoryTheory.LaxMonoidalFunctor
variable {C} {D : Type u₂} [Category.{v₂} D] [MonoidalCategory.{v₂} D]
-- TODO: mapMod F A : Mod A ⥤ Mod (F.mapMon A)
/-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one]
rw [F.toFunctor.map_id]
rw [F.right_unitality]
mul_assoc := by
| conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id] | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one]
rw [F.toFunctor.map_id]
rw [F.right_unitality]
mul_assoc := by
| Mathlib.CategoryTheory.Monoidal.Mon_.202_0.NTUMzhXPwXsmsYt | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A | Mathlib_CategoryTheory_Monoidal_Mon_ |
C : Type u₁
inst✝³ : Category.{v₁, u₁} C
inst✝² : MonoidalCategory C
D : Type u₂
inst✝¹ : Category.{v₂, u₂} D
inst✝ : MonoidalCategory D
F : LaxMonoidalFunctor C D
A : Mon_ C
| (μ F A.X A.X ≫ F.map A.mul ⊗ 𝟙 (F.obj A.X)) ≫ μ F A.X A.X ≫ F.map A.mul | /-
Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/
import Mathlib.CategoryTheory.Monoidal.Braided
import Mathlib.CategoryTheory.Monoidal.Discrete
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
import Mathlib.Algebra.PUnitInstances
#align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c"
/-!
# The category of monoids in a monoidal category.
We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to
the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if
`C` is braided, then the category of monoids is naturally monoidal.
-/
set_option linter.uppercaseLean3 false
universe v₁ v₂ u₁ u₂ u
open CategoryTheory MonoidalCategory
variable (C : Type u₁) [Category.{v₁} C] [MonoidalCategory.{v₁} C]
/-- A monoid object internal to a monoidal category.
When the monoidal category is preadditive, this is also sometimes called an "algebra object".
-/
structure Mon_ where
X : C
one : 𝟙_ C ⟶ X
mul : X ⊗ X ⟶ X
one_mul : (one ⊗ 𝟙 X) ≫ mul = (λ_ X).hom := by aesop_cat
mul_one : (𝟙 X ⊗ one) ≫ mul = (ρ_ X).hom := by aesop_cat
-- Obviously there is some flexibility stating this axiom.
-- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`,
-- and chooses to place the associator on the right-hand side.
-- The heuristic is that unitors and associators "don't have much weight".
mul_assoc : (mul ⊗ 𝟙 X) ≫ mul = (α_ X X X).hom ≫ (𝟙 X ⊗ mul) ≫ mul := by aesop_cat
#align Mon_ Mon_
attribute [reassoc] Mon_.one_mul Mon_.mul_one
-- We prove a more general `@[simp]` lemma below.
attribute [reassoc (attr := simp)] Mon_.mul_assoc
namespace Mon_
/-- The trivial monoid object. We later show this is initial in `Mon_ C`.
-/
@[simps]
def trivial : Mon_ C where
X := 𝟙_ C
one := 𝟙 _
mul := (λ_ _).hom
mul_assoc := by coherence
mul_one := by coherence
#align Mon_.trivial Mon_.trivial
instance : Inhabited (Mon_ C) :=
⟨trivial C⟩
variable {C}
variable {M : Mon_ C}
@[simp]
theorem one_mul_hom {Z : C} (f : Z ⟶ M.X) : (M.one ⊗ f) ≫ M.mul = (λ_ Z).hom ≫ f := by
rw [← id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality]
#align Mon_.one_mul_hom Mon_.one_mul_hom
@[simp]
theorem mul_one_hom {Z : C} (f : Z ⟶ M.X) : (f ⊗ M.one) ≫ M.mul = (ρ_ Z).hom ≫ f := by
rw [← tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality]
#align Mon_.mul_one_hom Mon_.mul_one_hom
theorem assoc_flip :
(𝟙 M.X ⊗ M.mul) ≫ M.mul = (α_ M.X M.X M.X).inv ≫ (M.mul ⊗ 𝟙 M.X) ≫ M.mul := by simp
#align Mon_.assoc_flip Mon_.assoc_flip
/-- A morphism of monoid objects. -/
@[ext]
structure Hom (M N : Mon_ C) where
hom : M.X ⟶ N.X
one_hom : M.one ≫ hom = N.one := by aesop_cat
mul_hom : M.mul ≫ hom = (hom ⊗ hom) ≫ N.mul := by aesop_cat
#align Mon_.hom Mon_.Hom
attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom
/-- The identity morphism on a monoid object. -/
@[simps]
def id (M : Mon_ C) : Hom M M where
hom := 𝟙 M.X
#align Mon_.id Mon_.id
instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) :=
⟨id M⟩
#align Mon_.hom_inhabited Mon_.homInhabited
/-- Composition of morphisms of monoid objects. -/
@[simps]
def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where
hom := f.hom ≫ g.hom
#align Mon_.comp Mon_.comp
instance : Category (Mon_ C) where
Hom M N := Hom M N
id := id
comp f g := comp f g
-- Porting note: added, as `Hom.ext` does not apply to a morphism.
@[ext]
lemma ext {X Y : Mon_ C} {f g : X ⟶ Y} (w : f.hom = g.hom) : f = g :=
Hom.ext _ _ w
@[simp]
theorem id_hom' (M : Mon_ C) : (𝟙 M : Hom M M).hom = 𝟙 M.X :=
rfl
#align Mon_.id_hom' Mon_.id_hom'
@[simp]
theorem comp_hom' {M N K : Mon_ C} (f : M ⟶ N) (g : N ⟶ K) :
(f ≫ g : Hom M K).hom = f.hom ≫ g.hom :=
rfl
#align Mon_.comp_hom' Mon_.comp_hom'
section
variable (C)
/-- The forgetful functor from monoid objects to the ambient category. -/
@[simps]
def forget : Mon_ C ⥤ C where
obj A := A.X
map f := f.hom
#align Mon_.forget Mon_.forget
end
instance forget_faithful : Faithful (@forget C _ _) where
#align Mon_.forget_faithful Mon_.forget_faithful
instance {A B : Mon_ C} (f : A ⟶ B) [e : IsIso ((forget C).map f)] : IsIso f.hom :=
e
/-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/
instance : ReflectsIsomorphisms (forget C) where
reflects f e :=
⟨⟨{ hom := inv f.hom
mul_hom := by
simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, ← tensor_comp_assoc,
IsIso.inv_hom_id, tensor_id, Category.id_comp] },
by aesop_cat⟩⟩
/-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X ≅ N.X) (one_f : M.one ≫ f.hom = N.one)
(mul_f : M.mul ≫ f.hom = (f.hom ⊗ f.hom) ≫ N.mul) : M ≅ N where
hom :=
{ hom := f.hom
one_hom := one_f
mul_hom := mul_f }
inv :=
{ hom := f.inv
one_hom := by rw [← one_f]; simp
mul_hom := by
rw [← cancel_mono f.hom]
slice_rhs 2 3 => rw [mul_f]
simp }
#align Mon_.iso_of_iso Mon_.isoOfIso
instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C ⟶ A) where
default :=
{ hom := A.one
one_hom := by dsimp; simp
mul_hom := by dsimp; simp [A.one_mul, unitors_equal] }
uniq f := by
ext; simp
rw [← Category.id_comp f.hom]
erw [f.one_hom]
#align Mon_.unique_hom_from_trivial Mon_.uniqueHomFromTrivial
open CategoryTheory.Limits
instance : HasInitial (Mon_ C) :=
hasInitial_of_unique (trivial C)
end Mon_
namespace CategoryTheory.LaxMonoidalFunctor
variable {C} {D : Type u₂} [Category.{v₂} D] [MonoidalCategory.{v₂} D]
-- TODO: mapMod F A : Mod A ⥤ Mod (F.mapMon A)
/-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one]
rw [F.toFunctor.map_id]
rw [F.right_unitality]
mul_assoc := by
conv_lhs => | rw [comp_tensor_id, ← F.toFunctor.map_id] | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one]
rw [F.toFunctor.map_id]
rw [F.right_unitality]
mul_assoc := by
conv_lhs => | Mathlib.CategoryTheory.Monoidal.Mon_.202_0.NTUMzhXPwXsmsYt | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A | Mathlib_CategoryTheory_Monoidal_Mon_ |
C : Type u₁
inst✝³ : Category.{v₁, u₁} C
inst✝² : MonoidalCategory C
D : Type u₂
inst✝¹ : Category.{v₂, u₂} D
inst✝ : MonoidalCategory D
F : LaxMonoidalFunctor C D
A : Mon_ C
| (μ F A.X A.X ≫ F.map A.mul ⊗ 𝟙 (F.obj A.X)) ≫ μ F A.X A.X ≫ F.map A.mul | /-
Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/
import Mathlib.CategoryTheory.Monoidal.Braided
import Mathlib.CategoryTheory.Monoidal.Discrete
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
import Mathlib.Algebra.PUnitInstances
#align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c"
/-!
# The category of monoids in a monoidal category.
We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to
the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if
`C` is braided, then the category of monoids is naturally monoidal.
-/
set_option linter.uppercaseLean3 false
universe v₁ v₂ u₁ u₂ u
open CategoryTheory MonoidalCategory
variable (C : Type u₁) [Category.{v₁} C] [MonoidalCategory.{v₁} C]
/-- A monoid object internal to a monoidal category.
When the monoidal category is preadditive, this is also sometimes called an "algebra object".
-/
structure Mon_ where
X : C
one : 𝟙_ C ⟶ X
mul : X ⊗ X ⟶ X
one_mul : (one ⊗ 𝟙 X) ≫ mul = (λ_ X).hom := by aesop_cat
mul_one : (𝟙 X ⊗ one) ≫ mul = (ρ_ X).hom := by aesop_cat
-- Obviously there is some flexibility stating this axiom.
-- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`,
-- and chooses to place the associator on the right-hand side.
-- The heuristic is that unitors and associators "don't have much weight".
mul_assoc : (mul ⊗ 𝟙 X) ≫ mul = (α_ X X X).hom ≫ (𝟙 X ⊗ mul) ≫ mul := by aesop_cat
#align Mon_ Mon_
attribute [reassoc] Mon_.one_mul Mon_.mul_one
-- We prove a more general `@[simp]` lemma below.
attribute [reassoc (attr := simp)] Mon_.mul_assoc
namespace Mon_
/-- The trivial monoid object. We later show this is initial in `Mon_ C`.
-/
@[simps]
def trivial : Mon_ C where
X := 𝟙_ C
one := 𝟙 _
mul := (λ_ _).hom
mul_assoc := by coherence
mul_one := by coherence
#align Mon_.trivial Mon_.trivial
instance : Inhabited (Mon_ C) :=
⟨trivial C⟩
variable {C}
variable {M : Mon_ C}
@[simp]
theorem one_mul_hom {Z : C} (f : Z ⟶ M.X) : (M.one ⊗ f) ≫ M.mul = (λ_ Z).hom ≫ f := by
rw [← id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality]
#align Mon_.one_mul_hom Mon_.one_mul_hom
@[simp]
theorem mul_one_hom {Z : C} (f : Z ⟶ M.X) : (f ⊗ M.one) ≫ M.mul = (ρ_ Z).hom ≫ f := by
rw [← tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality]
#align Mon_.mul_one_hom Mon_.mul_one_hom
theorem assoc_flip :
(𝟙 M.X ⊗ M.mul) ≫ M.mul = (α_ M.X M.X M.X).inv ≫ (M.mul ⊗ 𝟙 M.X) ≫ M.mul := by simp
#align Mon_.assoc_flip Mon_.assoc_flip
/-- A morphism of monoid objects. -/
@[ext]
structure Hom (M N : Mon_ C) where
hom : M.X ⟶ N.X
one_hom : M.one ≫ hom = N.one := by aesop_cat
mul_hom : M.mul ≫ hom = (hom ⊗ hom) ≫ N.mul := by aesop_cat
#align Mon_.hom Mon_.Hom
attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom
/-- The identity morphism on a monoid object. -/
@[simps]
def id (M : Mon_ C) : Hom M M where
hom := 𝟙 M.X
#align Mon_.id Mon_.id
instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) :=
⟨id M⟩
#align Mon_.hom_inhabited Mon_.homInhabited
/-- Composition of morphisms of monoid objects. -/
@[simps]
def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where
hom := f.hom ≫ g.hom
#align Mon_.comp Mon_.comp
instance : Category (Mon_ C) where
Hom M N := Hom M N
id := id
comp f g := comp f g
-- Porting note: added, as `Hom.ext` does not apply to a morphism.
@[ext]
lemma ext {X Y : Mon_ C} {f g : X ⟶ Y} (w : f.hom = g.hom) : f = g :=
Hom.ext _ _ w
@[simp]
theorem id_hom' (M : Mon_ C) : (𝟙 M : Hom M M).hom = 𝟙 M.X :=
rfl
#align Mon_.id_hom' Mon_.id_hom'
@[simp]
theorem comp_hom' {M N K : Mon_ C} (f : M ⟶ N) (g : N ⟶ K) :
(f ≫ g : Hom M K).hom = f.hom ≫ g.hom :=
rfl
#align Mon_.comp_hom' Mon_.comp_hom'
section
variable (C)
/-- The forgetful functor from monoid objects to the ambient category. -/
@[simps]
def forget : Mon_ C ⥤ C where
obj A := A.X
map f := f.hom
#align Mon_.forget Mon_.forget
end
instance forget_faithful : Faithful (@forget C _ _) where
#align Mon_.forget_faithful Mon_.forget_faithful
instance {A B : Mon_ C} (f : A ⟶ B) [e : IsIso ((forget C).map f)] : IsIso f.hom :=
e
/-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/
instance : ReflectsIsomorphisms (forget C) where
reflects f e :=
⟨⟨{ hom := inv f.hom
mul_hom := by
simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, ← tensor_comp_assoc,
IsIso.inv_hom_id, tensor_id, Category.id_comp] },
by aesop_cat⟩⟩
/-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X ≅ N.X) (one_f : M.one ≫ f.hom = N.one)
(mul_f : M.mul ≫ f.hom = (f.hom ⊗ f.hom) ≫ N.mul) : M ≅ N where
hom :=
{ hom := f.hom
one_hom := one_f
mul_hom := mul_f }
inv :=
{ hom := f.inv
one_hom := by rw [← one_f]; simp
mul_hom := by
rw [← cancel_mono f.hom]
slice_rhs 2 3 => rw [mul_f]
simp }
#align Mon_.iso_of_iso Mon_.isoOfIso
instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C ⟶ A) where
default :=
{ hom := A.one
one_hom := by dsimp; simp
mul_hom := by dsimp; simp [A.one_mul, unitors_equal] }
uniq f := by
ext; simp
rw [← Category.id_comp f.hom]
erw [f.one_hom]
#align Mon_.unique_hom_from_trivial Mon_.uniqueHomFromTrivial
open CategoryTheory.Limits
instance : HasInitial (Mon_ C) :=
hasInitial_of_unique (trivial C)
end Mon_
namespace CategoryTheory.LaxMonoidalFunctor
variable {C} {D : Type u₂} [Category.{v₂} D] [MonoidalCategory.{v₂} D]
-- TODO: mapMod F A : Mod A ⥤ Mod (F.mapMon A)
/-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one]
rw [F.toFunctor.map_id]
rw [F.right_unitality]
mul_assoc := by
conv_lhs => | rw [comp_tensor_id, ← F.toFunctor.map_id] | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one]
rw [F.toFunctor.map_id]
rw [F.right_unitality]
mul_assoc := by
conv_lhs => | Mathlib.CategoryTheory.Monoidal.Mon_.202_0.NTUMzhXPwXsmsYt | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A | Mathlib_CategoryTheory_Monoidal_Mon_ |
C : Type u₁
inst✝³ : Category.{v₁, u₁} C
inst✝² : MonoidalCategory C
D : Type u₂
inst✝¹ : Category.{v₂, u₂} D
inst✝ : MonoidalCategory D
F : LaxMonoidalFunctor C D
A : Mon_ C
| (μ F A.X A.X ≫ F.map A.mul ⊗ 𝟙 (F.obj A.X)) ≫ μ F A.X A.X ≫ F.map A.mul | /-
Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/
import Mathlib.CategoryTheory.Monoidal.Braided
import Mathlib.CategoryTheory.Monoidal.Discrete
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
import Mathlib.Algebra.PUnitInstances
#align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c"
/-!
# The category of monoids in a monoidal category.
We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to
the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if
`C` is braided, then the category of monoids is naturally monoidal.
-/
set_option linter.uppercaseLean3 false
universe v₁ v₂ u₁ u₂ u
open CategoryTheory MonoidalCategory
variable (C : Type u₁) [Category.{v₁} C] [MonoidalCategory.{v₁} C]
/-- A monoid object internal to a monoidal category.
When the monoidal category is preadditive, this is also sometimes called an "algebra object".
-/
structure Mon_ where
X : C
one : 𝟙_ C ⟶ X
mul : X ⊗ X ⟶ X
one_mul : (one ⊗ 𝟙 X) ≫ mul = (λ_ X).hom := by aesop_cat
mul_one : (𝟙 X ⊗ one) ≫ mul = (ρ_ X).hom := by aesop_cat
-- Obviously there is some flexibility stating this axiom.
-- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`,
-- and chooses to place the associator on the right-hand side.
-- The heuristic is that unitors and associators "don't have much weight".
mul_assoc : (mul ⊗ 𝟙 X) ≫ mul = (α_ X X X).hom ≫ (𝟙 X ⊗ mul) ≫ mul := by aesop_cat
#align Mon_ Mon_
attribute [reassoc] Mon_.one_mul Mon_.mul_one
-- We prove a more general `@[simp]` lemma below.
attribute [reassoc (attr := simp)] Mon_.mul_assoc
namespace Mon_
/-- The trivial monoid object. We later show this is initial in `Mon_ C`.
-/
@[simps]
def trivial : Mon_ C where
X := 𝟙_ C
one := 𝟙 _
mul := (λ_ _).hom
mul_assoc := by coherence
mul_one := by coherence
#align Mon_.trivial Mon_.trivial
instance : Inhabited (Mon_ C) :=
⟨trivial C⟩
variable {C}
variable {M : Mon_ C}
@[simp]
theorem one_mul_hom {Z : C} (f : Z ⟶ M.X) : (M.one ⊗ f) ≫ M.mul = (λ_ Z).hom ≫ f := by
rw [← id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality]
#align Mon_.one_mul_hom Mon_.one_mul_hom
@[simp]
theorem mul_one_hom {Z : C} (f : Z ⟶ M.X) : (f ⊗ M.one) ≫ M.mul = (ρ_ Z).hom ≫ f := by
rw [← tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality]
#align Mon_.mul_one_hom Mon_.mul_one_hom
theorem assoc_flip :
(𝟙 M.X ⊗ M.mul) ≫ M.mul = (α_ M.X M.X M.X).inv ≫ (M.mul ⊗ 𝟙 M.X) ≫ M.mul := by simp
#align Mon_.assoc_flip Mon_.assoc_flip
/-- A morphism of monoid objects. -/
@[ext]
structure Hom (M N : Mon_ C) where
hom : M.X ⟶ N.X
one_hom : M.one ≫ hom = N.one := by aesop_cat
mul_hom : M.mul ≫ hom = (hom ⊗ hom) ≫ N.mul := by aesop_cat
#align Mon_.hom Mon_.Hom
attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom
/-- The identity morphism on a monoid object. -/
@[simps]
def id (M : Mon_ C) : Hom M M where
hom := 𝟙 M.X
#align Mon_.id Mon_.id
instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) :=
⟨id M⟩
#align Mon_.hom_inhabited Mon_.homInhabited
/-- Composition of morphisms of monoid objects. -/
@[simps]
def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where
hom := f.hom ≫ g.hom
#align Mon_.comp Mon_.comp
instance : Category (Mon_ C) where
Hom M N := Hom M N
id := id
comp f g := comp f g
-- Porting note: added, as `Hom.ext` does not apply to a morphism.
@[ext]
lemma ext {X Y : Mon_ C} {f g : X ⟶ Y} (w : f.hom = g.hom) : f = g :=
Hom.ext _ _ w
@[simp]
theorem id_hom' (M : Mon_ C) : (𝟙 M : Hom M M).hom = 𝟙 M.X :=
rfl
#align Mon_.id_hom' Mon_.id_hom'
@[simp]
theorem comp_hom' {M N K : Mon_ C} (f : M ⟶ N) (g : N ⟶ K) :
(f ≫ g : Hom M K).hom = f.hom ≫ g.hom :=
rfl
#align Mon_.comp_hom' Mon_.comp_hom'
section
variable (C)
/-- The forgetful functor from monoid objects to the ambient category. -/
@[simps]
def forget : Mon_ C ⥤ C where
obj A := A.X
map f := f.hom
#align Mon_.forget Mon_.forget
end
instance forget_faithful : Faithful (@forget C _ _) where
#align Mon_.forget_faithful Mon_.forget_faithful
instance {A B : Mon_ C} (f : A ⟶ B) [e : IsIso ((forget C).map f)] : IsIso f.hom :=
e
/-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/
instance : ReflectsIsomorphisms (forget C) where
reflects f e :=
⟨⟨{ hom := inv f.hom
mul_hom := by
simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, ← tensor_comp_assoc,
IsIso.inv_hom_id, tensor_id, Category.id_comp] },
by aesop_cat⟩⟩
/-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X ≅ N.X) (one_f : M.one ≫ f.hom = N.one)
(mul_f : M.mul ≫ f.hom = (f.hom ⊗ f.hom) ≫ N.mul) : M ≅ N where
hom :=
{ hom := f.hom
one_hom := one_f
mul_hom := mul_f }
inv :=
{ hom := f.inv
one_hom := by rw [← one_f]; simp
mul_hom := by
rw [← cancel_mono f.hom]
slice_rhs 2 3 => rw [mul_f]
simp }
#align Mon_.iso_of_iso Mon_.isoOfIso
instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C ⟶ A) where
default :=
{ hom := A.one
one_hom := by dsimp; simp
mul_hom := by dsimp; simp [A.one_mul, unitors_equal] }
uniq f := by
ext; simp
rw [← Category.id_comp f.hom]
erw [f.one_hom]
#align Mon_.unique_hom_from_trivial Mon_.uniqueHomFromTrivial
open CategoryTheory.Limits
instance : HasInitial (Mon_ C) :=
hasInitial_of_unique (trivial C)
end Mon_
namespace CategoryTheory.LaxMonoidalFunctor
variable {C} {D : Type u₂} [Category.{v₂} D] [MonoidalCategory.{v₂} D]
-- TODO: mapMod F A : Mod A ⥤ Mod (F.mapMon A)
/-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one]
rw [F.toFunctor.map_id]
rw [F.right_unitality]
mul_assoc := by
conv_lhs => | rw [comp_tensor_id, ← F.toFunctor.map_id] | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one]
rw [F.toFunctor.map_id]
rw [F.right_unitality]
mul_assoc := by
conv_lhs => | Mathlib.CategoryTheory.Monoidal.Mon_.202_0.NTUMzhXPwXsmsYt | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A | Mathlib_CategoryTheory_Monoidal_Mon_ |
C : Type u₁
inst✝³ : Category.{v₁, u₁} C
inst✝² : MonoidalCategory C
D : Type u₂
inst✝¹ : Category.{v₂, u₂} D
inst✝ : MonoidalCategory D
F : LaxMonoidalFunctor C D
A : Mon_ C
⊢ ((μ F A.X A.X ⊗ F.map (𝟙 A.X)) ≫ (F.map A.mul ⊗ F.map (𝟙 A.X))) ≫ μ F A.X A.X ≫ F.map A.mul =
(α_ (F.obj A.X) (F.obj A.X) (F.obj A.X)).hom ≫
(𝟙 (F.obj A.X) ⊗ μ F A.X A.X ≫ F.map A.mul) ≫ μ F A.X A.X ≫ F.map A.mul | /-
Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/
import Mathlib.CategoryTheory.Monoidal.Braided
import Mathlib.CategoryTheory.Monoidal.Discrete
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
import Mathlib.Algebra.PUnitInstances
#align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c"
/-!
# The category of monoids in a monoidal category.
We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to
the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if
`C` is braided, then the category of monoids is naturally monoidal.
-/
set_option linter.uppercaseLean3 false
universe v₁ v₂ u₁ u₂ u
open CategoryTheory MonoidalCategory
variable (C : Type u₁) [Category.{v₁} C] [MonoidalCategory.{v₁} C]
/-- A monoid object internal to a monoidal category.
When the monoidal category is preadditive, this is also sometimes called an "algebra object".
-/
structure Mon_ where
X : C
one : 𝟙_ C ⟶ X
mul : X ⊗ X ⟶ X
one_mul : (one ⊗ 𝟙 X) ≫ mul = (λ_ X).hom := by aesop_cat
mul_one : (𝟙 X ⊗ one) ≫ mul = (ρ_ X).hom := by aesop_cat
-- Obviously there is some flexibility stating this axiom.
-- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`,
-- and chooses to place the associator on the right-hand side.
-- The heuristic is that unitors and associators "don't have much weight".
mul_assoc : (mul ⊗ 𝟙 X) ≫ mul = (α_ X X X).hom ≫ (𝟙 X ⊗ mul) ≫ mul := by aesop_cat
#align Mon_ Mon_
attribute [reassoc] Mon_.one_mul Mon_.mul_one
-- We prove a more general `@[simp]` lemma below.
attribute [reassoc (attr := simp)] Mon_.mul_assoc
namespace Mon_
/-- The trivial monoid object. We later show this is initial in `Mon_ C`.
-/
@[simps]
def trivial : Mon_ C where
X := 𝟙_ C
one := 𝟙 _
mul := (λ_ _).hom
mul_assoc := by coherence
mul_one := by coherence
#align Mon_.trivial Mon_.trivial
instance : Inhabited (Mon_ C) :=
⟨trivial C⟩
variable {C}
variable {M : Mon_ C}
@[simp]
theorem one_mul_hom {Z : C} (f : Z ⟶ M.X) : (M.one ⊗ f) ≫ M.mul = (λ_ Z).hom ≫ f := by
rw [← id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality]
#align Mon_.one_mul_hom Mon_.one_mul_hom
@[simp]
theorem mul_one_hom {Z : C} (f : Z ⟶ M.X) : (f ⊗ M.one) ≫ M.mul = (ρ_ Z).hom ≫ f := by
rw [← tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality]
#align Mon_.mul_one_hom Mon_.mul_one_hom
theorem assoc_flip :
(𝟙 M.X ⊗ M.mul) ≫ M.mul = (α_ M.X M.X M.X).inv ≫ (M.mul ⊗ 𝟙 M.X) ≫ M.mul := by simp
#align Mon_.assoc_flip Mon_.assoc_flip
/-- A morphism of monoid objects. -/
@[ext]
structure Hom (M N : Mon_ C) where
hom : M.X ⟶ N.X
one_hom : M.one ≫ hom = N.one := by aesop_cat
mul_hom : M.mul ≫ hom = (hom ⊗ hom) ≫ N.mul := by aesop_cat
#align Mon_.hom Mon_.Hom
attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom
/-- The identity morphism on a monoid object. -/
@[simps]
def id (M : Mon_ C) : Hom M M where
hom := 𝟙 M.X
#align Mon_.id Mon_.id
instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) :=
⟨id M⟩
#align Mon_.hom_inhabited Mon_.homInhabited
/-- Composition of morphisms of monoid objects. -/
@[simps]
def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where
hom := f.hom ≫ g.hom
#align Mon_.comp Mon_.comp
instance : Category (Mon_ C) where
Hom M N := Hom M N
id := id
comp f g := comp f g
-- Porting note: added, as `Hom.ext` does not apply to a morphism.
@[ext]
lemma ext {X Y : Mon_ C} {f g : X ⟶ Y} (w : f.hom = g.hom) : f = g :=
Hom.ext _ _ w
@[simp]
theorem id_hom' (M : Mon_ C) : (𝟙 M : Hom M M).hom = 𝟙 M.X :=
rfl
#align Mon_.id_hom' Mon_.id_hom'
@[simp]
theorem comp_hom' {M N K : Mon_ C} (f : M ⟶ N) (g : N ⟶ K) :
(f ≫ g : Hom M K).hom = f.hom ≫ g.hom :=
rfl
#align Mon_.comp_hom' Mon_.comp_hom'
section
variable (C)
/-- The forgetful functor from monoid objects to the ambient category. -/
@[simps]
def forget : Mon_ C ⥤ C where
obj A := A.X
map f := f.hom
#align Mon_.forget Mon_.forget
end
instance forget_faithful : Faithful (@forget C _ _) where
#align Mon_.forget_faithful Mon_.forget_faithful
instance {A B : Mon_ C} (f : A ⟶ B) [e : IsIso ((forget C).map f)] : IsIso f.hom :=
e
/-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/
instance : ReflectsIsomorphisms (forget C) where
reflects f e :=
⟨⟨{ hom := inv f.hom
mul_hom := by
simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, ← tensor_comp_assoc,
IsIso.inv_hom_id, tensor_id, Category.id_comp] },
by aesop_cat⟩⟩
/-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X ≅ N.X) (one_f : M.one ≫ f.hom = N.one)
(mul_f : M.mul ≫ f.hom = (f.hom ⊗ f.hom) ≫ N.mul) : M ≅ N where
hom :=
{ hom := f.hom
one_hom := one_f
mul_hom := mul_f }
inv :=
{ hom := f.inv
one_hom := by rw [← one_f]; simp
mul_hom := by
rw [← cancel_mono f.hom]
slice_rhs 2 3 => rw [mul_f]
simp }
#align Mon_.iso_of_iso Mon_.isoOfIso
instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C ⟶ A) where
default :=
{ hom := A.one
one_hom := by dsimp; simp
mul_hom := by dsimp; simp [A.one_mul, unitors_equal] }
uniq f := by
ext; simp
rw [← Category.id_comp f.hom]
erw [f.one_hom]
#align Mon_.unique_hom_from_trivial Mon_.uniqueHomFromTrivial
open CategoryTheory.Limits
instance : HasInitial (Mon_ C) :=
hasInitial_of_unique (trivial C)
end Mon_
namespace CategoryTheory.LaxMonoidalFunctor
variable {C} {D : Type u₂} [Category.{v₂} D] [MonoidalCategory.{v₂} D]
-- TODO: mapMod F A : Mod A ⥤ Mod (F.mapMon A)
/-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one]
rw [F.toFunctor.map_id]
rw [F.right_unitality]
mul_assoc := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
| slice_lhs 2 3 => rw [F.μ_natural] | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one]
rw [F.toFunctor.map_id]
rw [F.right_unitality]
mul_assoc := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
| Mathlib.CategoryTheory.Monoidal.Mon_.202_0.NTUMzhXPwXsmsYt | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A | Mathlib_CategoryTheory_Monoidal_Mon_ |
case a.a
C : Type u₁
inst✝³ : Category.{v₁, u₁} C
inst✝² : MonoidalCategory C
D : Type u₂
inst✝¹ : Category.{v₂, u₂} D
inst✝ : MonoidalCategory D
F : LaxMonoidalFunctor C D
A : Mon_ C
| (F.map A.mul ⊗ F.map (𝟙 A.X)) ≫ μ F A.X A.X
case a.a
C : Type u₁
inst✝³ : Category.{v₁, u₁} C
inst✝² : MonoidalCategory C
D : Type u₂
inst✝¹ : Category.{v₂, u₂} D
inst✝ : MonoidalCategory D
F : LaxMonoidalFunctor C D
A : Mon_ C
| F.map A.mul
case a
C : Type u₁
inst✝³ : Category.{v₁, u₁} C
inst✝² : MonoidalCategory C
D : Type u₂
inst✝¹ : Category.{v₂, u₂} D
inst✝ : MonoidalCategory D
F : LaxMonoidalFunctor C D
A : Mon_ C
| μ F A.X A.X ⊗ F.map (𝟙 A.X) | /-
Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/
import Mathlib.CategoryTheory.Monoidal.Braided
import Mathlib.CategoryTheory.Monoidal.Discrete
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
import Mathlib.Algebra.PUnitInstances
#align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c"
/-!
# The category of monoids in a monoidal category.
We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to
the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if
`C` is braided, then the category of monoids is naturally monoidal.
-/
set_option linter.uppercaseLean3 false
universe v₁ v₂ u₁ u₂ u
open CategoryTheory MonoidalCategory
variable (C : Type u₁) [Category.{v₁} C] [MonoidalCategory.{v₁} C]
/-- A monoid object internal to a monoidal category.
When the monoidal category is preadditive, this is also sometimes called an "algebra object".
-/
structure Mon_ where
X : C
one : 𝟙_ C ⟶ X
mul : X ⊗ X ⟶ X
one_mul : (one ⊗ 𝟙 X) ≫ mul = (λ_ X).hom := by aesop_cat
mul_one : (𝟙 X ⊗ one) ≫ mul = (ρ_ X).hom := by aesop_cat
-- Obviously there is some flexibility stating this axiom.
-- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`,
-- and chooses to place the associator on the right-hand side.
-- The heuristic is that unitors and associators "don't have much weight".
mul_assoc : (mul ⊗ 𝟙 X) ≫ mul = (α_ X X X).hom ≫ (𝟙 X ⊗ mul) ≫ mul := by aesop_cat
#align Mon_ Mon_
attribute [reassoc] Mon_.one_mul Mon_.mul_one
-- We prove a more general `@[simp]` lemma below.
attribute [reassoc (attr := simp)] Mon_.mul_assoc
namespace Mon_
/-- The trivial monoid object. We later show this is initial in `Mon_ C`.
-/
@[simps]
def trivial : Mon_ C where
X := 𝟙_ C
one := 𝟙 _
mul := (λ_ _).hom
mul_assoc := by coherence
mul_one := by coherence
#align Mon_.trivial Mon_.trivial
instance : Inhabited (Mon_ C) :=
⟨trivial C⟩
variable {C}
variable {M : Mon_ C}
@[simp]
theorem one_mul_hom {Z : C} (f : Z ⟶ M.X) : (M.one ⊗ f) ≫ M.mul = (λ_ Z).hom ≫ f := by
rw [← id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality]
#align Mon_.one_mul_hom Mon_.one_mul_hom
@[simp]
theorem mul_one_hom {Z : C} (f : Z ⟶ M.X) : (f ⊗ M.one) ≫ M.mul = (ρ_ Z).hom ≫ f := by
rw [← tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality]
#align Mon_.mul_one_hom Mon_.mul_one_hom
theorem assoc_flip :
(𝟙 M.X ⊗ M.mul) ≫ M.mul = (α_ M.X M.X M.X).inv ≫ (M.mul ⊗ 𝟙 M.X) ≫ M.mul := by simp
#align Mon_.assoc_flip Mon_.assoc_flip
/-- A morphism of monoid objects. -/
@[ext]
structure Hom (M N : Mon_ C) where
hom : M.X ⟶ N.X
one_hom : M.one ≫ hom = N.one := by aesop_cat
mul_hom : M.mul ≫ hom = (hom ⊗ hom) ≫ N.mul := by aesop_cat
#align Mon_.hom Mon_.Hom
attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom
/-- The identity morphism on a monoid object. -/
@[simps]
def id (M : Mon_ C) : Hom M M where
hom := 𝟙 M.X
#align Mon_.id Mon_.id
instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) :=
⟨id M⟩
#align Mon_.hom_inhabited Mon_.homInhabited
/-- Composition of morphisms of monoid objects. -/
@[simps]
def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where
hom := f.hom ≫ g.hom
#align Mon_.comp Mon_.comp
instance : Category (Mon_ C) where
Hom M N := Hom M N
id := id
comp f g := comp f g
-- Porting note: added, as `Hom.ext` does not apply to a morphism.
@[ext]
lemma ext {X Y : Mon_ C} {f g : X ⟶ Y} (w : f.hom = g.hom) : f = g :=
Hom.ext _ _ w
@[simp]
theorem id_hom' (M : Mon_ C) : (𝟙 M : Hom M M).hom = 𝟙 M.X :=
rfl
#align Mon_.id_hom' Mon_.id_hom'
@[simp]
theorem comp_hom' {M N K : Mon_ C} (f : M ⟶ N) (g : N ⟶ K) :
(f ≫ g : Hom M K).hom = f.hom ≫ g.hom :=
rfl
#align Mon_.comp_hom' Mon_.comp_hom'
section
variable (C)
/-- The forgetful functor from monoid objects to the ambient category. -/
@[simps]
def forget : Mon_ C ⥤ C where
obj A := A.X
map f := f.hom
#align Mon_.forget Mon_.forget
end
instance forget_faithful : Faithful (@forget C _ _) where
#align Mon_.forget_faithful Mon_.forget_faithful
instance {A B : Mon_ C} (f : A ⟶ B) [e : IsIso ((forget C).map f)] : IsIso f.hom :=
e
/-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/
instance : ReflectsIsomorphisms (forget C) where
reflects f e :=
⟨⟨{ hom := inv f.hom
mul_hom := by
simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, ← tensor_comp_assoc,
IsIso.inv_hom_id, tensor_id, Category.id_comp] },
by aesop_cat⟩⟩
/-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X ≅ N.X) (one_f : M.one ≫ f.hom = N.one)
(mul_f : M.mul ≫ f.hom = (f.hom ⊗ f.hom) ≫ N.mul) : M ≅ N where
hom :=
{ hom := f.hom
one_hom := one_f
mul_hom := mul_f }
inv :=
{ hom := f.inv
one_hom := by rw [← one_f]; simp
mul_hom := by
rw [← cancel_mono f.hom]
slice_rhs 2 3 => rw [mul_f]
simp }
#align Mon_.iso_of_iso Mon_.isoOfIso
instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C ⟶ A) where
default :=
{ hom := A.one
one_hom := by dsimp; simp
mul_hom := by dsimp; simp [A.one_mul, unitors_equal] }
uniq f := by
ext; simp
rw [← Category.id_comp f.hom]
erw [f.one_hom]
#align Mon_.unique_hom_from_trivial Mon_.uniqueHomFromTrivial
open CategoryTheory.Limits
instance : HasInitial (Mon_ C) :=
hasInitial_of_unique (trivial C)
end Mon_
namespace CategoryTheory.LaxMonoidalFunctor
variable {C} {D : Type u₂} [Category.{v₂} D] [MonoidalCategory.{v₂} D]
-- TODO: mapMod F A : Mod A ⥤ Mod (F.mapMon A)
/-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one]
rw [F.toFunctor.map_id]
rw [F.right_unitality]
mul_assoc := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => | rw [F.μ_natural] | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one]
rw [F.toFunctor.map_id]
rw [F.right_unitality]
mul_assoc := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => | Mathlib.CategoryTheory.Monoidal.Mon_.202_0.NTUMzhXPwXsmsYt | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A | Mathlib_CategoryTheory_Monoidal_Mon_ |
case a.a
C : Type u₁
inst✝³ : Category.{v₁, u₁} C
inst✝² : MonoidalCategory C
D : Type u₂
inst✝¹ : Category.{v₂, u₂} D
inst✝ : MonoidalCategory D
F : LaxMonoidalFunctor C D
A : Mon_ C
| (F.map A.mul ⊗ F.map (𝟙 A.X)) ≫ μ F A.X A.X
case a.a
C : Type u₁
inst✝³ : Category.{v₁, u₁} C
inst✝² : MonoidalCategory C
D : Type u₂
inst✝¹ : Category.{v₂, u₂} D
inst✝ : MonoidalCategory D
F : LaxMonoidalFunctor C D
A : Mon_ C
| F.map A.mul
case a
C : Type u₁
inst✝³ : Category.{v₁, u₁} C
inst✝² : MonoidalCategory C
D : Type u₂
inst✝¹ : Category.{v₂, u₂} D
inst✝ : MonoidalCategory D
F : LaxMonoidalFunctor C D
A : Mon_ C
| μ F A.X A.X ⊗ F.map (𝟙 A.X) | /-
Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/
import Mathlib.CategoryTheory.Monoidal.Braided
import Mathlib.CategoryTheory.Monoidal.Discrete
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
import Mathlib.Algebra.PUnitInstances
#align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c"
/-!
# The category of monoids in a monoidal category.
We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to
the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if
`C` is braided, then the category of monoids is naturally monoidal.
-/
set_option linter.uppercaseLean3 false
universe v₁ v₂ u₁ u₂ u
open CategoryTheory MonoidalCategory
variable (C : Type u₁) [Category.{v₁} C] [MonoidalCategory.{v₁} C]
/-- A monoid object internal to a monoidal category.
When the monoidal category is preadditive, this is also sometimes called an "algebra object".
-/
structure Mon_ where
X : C
one : 𝟙_ C ⟶ X
mul : X ⊗ X ⟶ X
one_mul : (one ⊗ 𝟙 X) ≫ mul = (λ_ X).hom := by aesop_cat
mul_one : (𝟙 X ⊗ one) ≫ mul = (ρ_ X).hom := by aesop_cat
-- Obviously there is some flexibility stating this axiom.
-- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`,
-- and chooses to place the associator on the right-hand side.
-- The heuristic is that unitors and associators "don't have much weight".
mul_assoc : (mul ⊗ 𝟙 X) ≫ mul = (α_ X X X).hom ≫ (𝟙 X ⊗ mul) ≫ mul := by aesop_cat
#align Mon_ Mon_
attribute [reassoc] Mon_.one_mul Mon_.mul_one
-- We prove a more general `@[simp]` lemma below.
attribute [reassoc (attr := simp)] Mon_.mul_assoc
namespace Mon_
/-- The trivial monoid object. We later show this is initial in `Mon_ C`.
-/
@[simps]
def trivial : Mon_ C where
X := 𝟙_ C
one := 𝟙 _
mul := (λ_ _).hom
mul_assoc := by coherence
mul_one := by coherence
#align Mon_.trivial Mon_.trivial
instance : Inhabited (Mon_ C) :=
⟨trivial C⟩
variable {C}
variable {M : Mon_ C}
@[simp]
theorem one_mul_hom {Z : C} (f : Z ⟶ M.X) : (M.one ⊗ f) ≫ M.mul = (λ_ Z).hom ≫ f := by
rw [← id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality]
#align Mon_.one_mul_hom Mon_.one_mul_hom
@[simp]
theorem mul_one_hom {Z : C} (f : Z ⟶ M.X) : (f ⊗ M.one) ≫ M.mul = (ρ_ Z).hom ≫ f := by
rw [← tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality]
#align Mon_.mul_one_hom Mon_.mul_one_hom
theorem assoc_flip :
(𝟙 M.X ⊗ M.mul) ≫ M.mul = (α_ M.X M.X M.X).inv ≫ (M.mul ⊗ 𝟙 M.X) ≫ M.mul := by simp
#align Mon_.assoc_flip Mon_.assoc_flip
/-- A morphism of monoid objects. -/
@[ext]
structure Hom (M N : Mon_ C) where
hom : M.X ⟶ N.X
one_hom : M.one ≫ hom = N.one := by aesop_cat
mul_hom : M.mul ≫ hom = (hom ⊗ hom) ≫ N.mul := by aesop_cat
#align Mon_.hom Mon_.Hom
attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom
/-- The identity morphism on a monoid object. -/
@[simps]
def id (M : Mon_ C) : Hom M M where
hom := 𝟙 M.X
#align Mon_.id Mon_.id
instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) :=
⟨id M⟩
#align Mon_.hom_inhabited Mon_.homInhabited
/-- Composition of morphisms of monoid objects. -/
@[simps]
def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where
hom := f.hom ≫ g.hom
#align Mon_.comp Mon_.comp
instance : Category (Mon_ C) where
Hom M N := Hom M N
id := id
comp f g := comp f g
-- Porting note: added, as `Hom.ext` does not apply to a morphism.
@[ext]
lemma ext {X Y : Mon_ C} {f g : X ⟶ Y} (w : f.hom = g.hom) : f = g :=
Hom.ext _ _ w
@[simp]
theorem id_hom' (M : Mon_ C) : (𝟙 M : Hom M M).hom = 𝟙 M.X :=
rfl
#align Mon_.id_hom' Mon_.id_hom'
@[simp]
theorem comp_hom' {M N K : Mon_ C} (f : M ⟶ N) (g : N ⟶ K) :
(f ≫ g : Hom M K).hom = f.hom ≫ g.hom :=
rfl
#align Mon_.comp_hom' Mon_.comp_hom'
section
variable (C)
/-- The forgetful functor from monoid objects to the ambient category. -/
@[simps]
def forget : Mon_ C ⥤ C where
obj A := A.X
map f := f.hom
#align Mon_.forget Mon_.forget
end
instance forget_faithful : Faithful (@forget C _ _) where
#align Mon_.forget_faithful Mon_.forget_faithful
instance {A B : Mon_ C} (f : A ⟶ B) [e : IsIso ((forget C).map f)] : IsIso f.hom :=
e
/-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/
instance : ReflectsIsomorphisms (forget C) where
reflects f e :=
⟨⟨{ hom := inv f.hom
mul_hom := by
simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, ← tensor_comp_assoc,
IsIso.inv_hom_id, tensor_id, Category.id_comp] },
by aesop_cat⟩⟩
/-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X ≅ N.X) (one_f : M.one ≫ f.hom = N.one)
(mul_f : M.mul ≫ f.hom = (f.hom ⊗ f.hom) ≫ N.mul) : M ≅ N where
hom :=
{ hom := f.hom
one_hom := one_f
mul_hom := mul_f }
inv :=
{ hom := f.inv
one_hom := by rw [← one_f]; simp
mul_hom := by
rw [← cancel_mono f.hom]
slice_rhs 2 3 => rw [mul_f]
simp }
#align Mon_.iso_of_iso Mon_.isoOfIso
instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C ⟶ A) where
default :=
{ hom := A.one
one_hom := by dsimp; simp
mul_hom := by dsimp; simp [A.one_mul, unitors_equal] }
uniq f := by
ext; simp
rw [← Category.id_comp f.hom]
erw [f.one_hom]
#align Mon_.unique_hom_from_trivial Mon_.uniqueHomFromTrivial
open CategoryTheory.Limits
instance : HasInitial (Mon_ C) :=
hasInitial_of_unique (trivial C)
end Mon_
namespace CategoryTheory.LaxMonoidalFunctor
variable {C} {D : Type u₂} [Category.{v₂} D] [MonoidalCategory.{v₂} D]
-- TODO: mapMod F A : Mod A ⥤ Mod (F.mapMon A)
/-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one]
rw [F.toFunctor.map_id]
rw [F.right_unitality]
mul_assoc := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => | rw [F.μ_natural] | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one]
rw [F.toFunctor.map_id]
rw [F.right_unitality]
mul_assoc := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => | Mathlib.CategoryTheory.Monoidal.Mon_.202_0.NTUMzhXPwXsmsYt | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A | Mathlib_CategoryTheory_Monoidal_Mon_ |
case a.a
C : Type u₁
inst✝³ : Category.{v₁, u₁} C
inst✝² : MonoidalCategory C
D : Type u₂
inst✝¹ : Category.{v₂, u₂} D
inst✝ : MonoidalCategory D
F : LaxMonoidalFunctor C D
A : Mon_ C
| (F.map A.mul ⊗ F.map (𝟙 A.X)) ≫ μ F A.X A.X
case a.a
C : Type u₁
inst✝³ : Category.{v₁, u₁} C
inst✝² : MonoidalCategory C
D : Type u₂
inst✝¹ : Category.{v₂, u₂} D
inst✝ : MonoidalCategory D
F : LaxMonoidalFunctor C D
A : Mon_ C
| F.map A.mul
case a
C : Type u₁
inst✝³ : Category.{v₁, u₁} C
inst✝² : MonoidalCategory C
D : Type u₂
inst✝¹ : Category.{v₂, u₂} D
inst✝ : MonoidalCategory D
F : LaxMonoidalFunctor C D
A : Mon_ C
| μ F A.X A.X ⊗ F.map (𝟙 A.X) | /-
Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/
import Mathlib.CategoryTheory.Monoidal.Braided
import Mathlib.CategoryTheory.Monoidal.Discrete
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
import Mathlib.Algebra.PUnitInstances
#align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c"
/-!
# The category of monoids in a monoidal category.
We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to
the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if
`C` is braided, then the category of monoids is naturally monoidal.
-/
set_option linter.uppercaseLean3 false
universe v₁ v₂ u₁ u₂ u
open CategoryTheory MonoidalCategory
variable (C : Type u₁) [Category.{v₁} C] [MonoidalCategory.{v₁} C]
/-- A monoid object internal to a monoidal category.
When the monoidal category is preadditive, this is also sometimes called an "algebra object".
-/
structure Mon_ where
X : C
one : 𝟙_ C ⟶ X
mul : X ⊗ X ⟶ X
one_mul : (one ⊗ 𝟙 X) ≫ mul = (λ_ X).hom := by aesop_cat
mul_one : (𝟙 X ⊗ one) ≫ mul = (ρ_ X).hom := by aesop_cat
-- Obviously there is some flexibility stating this axiom.
-- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`,
-- and chooses to place the associator on the right-hand side.
-- The heuristic is that unitors and associators "don't have much weight".
mul_assoc : (mul ⊗ 𝟙 X) ≫ mul = (α_ X X X).hom ≫ (𝟙 X ⊗ mul) ≫ mul := by aesop_cat
#align Mon_ Mon_
attribute [reassoc] Mon_.one_mul Mon_.mul_one
-- We prove a more general `@[simp]` lemma below.
attribute [reassoc (attr := simp)] Mon_.mul_assoc
namespace Mon_
/-- The trivial monoid object. We later show this is initial in `Mon_ C`.
-/
@[simps]
def trivial : Mon_ C where
X := 𝟙_ C
one := 𝟙 _
mul := (λ_ _).hom
mul_assoc := by coherence
mul_one := by coherence
#align Mon_.trivial Mon_.trivial
instance : Inhabited (Mon_ C) :=
⟨trivial C⟩
variable {C}
variable {M : Mon_ C}
@[simp]
theorem one_mul_hom {Z : C} (f : Z ⟶ M.X) : (M.one ⊗ f) ≫ M.mul = (λ_ Z).hom ≫ f := by
rw [← id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality]
#align Mon_.one_mul_hom Mon_.one_mul_hom
@[simp]
theorem mul_one_hom {Z : C} (f : Z ⟶ M.X) : (f ⊗ M.one) ≫ M.mul = (ρ_ Z).hom ≫ f := by
rw [← tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality]
#align Mon_.mul_one_hom Mon_.mul_one_hom
theorem assoc_flip :
(𝟙 M.X ⊗ M.mul) ≫ M.mul = (α_ M.X M.X M.X).inv ≫ (M.mul ⊗ 𝟙 M.X) ≫ M.mul := by simp
#align Mon_.assoc_flip Mon_.assoc_flip
/-- A morphism of monoid objects. -/
@[ext]
structure Hom (M N : Mon_ C) where
hom : M.X ⟶ N.X
one_hom : M.one ≫ hom = N.one := by aesop_cat
mul_hom : M.mul ≫ hom = (hom ⊗ hom) ≫ N.mul := by aesop_cat
#align Mon_.hom Mon_.Hom
attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom
/-- The identity morphism on a monoid object. -/
@[simps]
def id (M : Mon_ C) : Hom M M where
hom := 𝟙 M.X
#align Mon_.id Mon_.id
instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) :=
⟨id M⟩
#align Mon_.hom_inhabited Mon_.homInhabited
/-- Composition of morphisms of monoid objects. -/
@[simps]
def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where
hom := f.hom ≫ g.hom
#align Mon_.comp Mon_.comp
instance : Category (Mon_ C) where
Hom M N := Hom M N
id := id
comp f g := comp f g
-- Porting note: added, as `Hom.ext` does not apply to a morphism.
@[ext]
lemma ext {X Y : Mon_ C} {f g : X ⟶ Y} (w : f.hom = g.hom) : f = g :=
Hom.ext _ _ w
@[simp]
theorem id_hom' (M : Mon_ C) : (𝟙 M : Hom M M).hom = 𝟙 M.X :=
rfl
#align Mon_.id_hom' Mon_.id_hom'
@[simp]
theorem comp_hom' {M N K : Mon_ C} (f : M ⟶ N) (g : N ⟶ K) :
(f ≫ g : Hom M K).hom = f.hom ≫ g.hom :=
rfl
#align Mon_.comp_hom' Mon_.comp_hom'
section
variable (C)
/-- The forgetful functor from monoid objects to the ambient category. -/
@[simps]
def forget : Mon_ C ⥤ C where
obj A := A.X
map f := f.hom
#align Mon_.forget Mon_.forget
end
instance forget_faithful : Faithful (@forget C _ _) where
#align Mon_.forget_faithful Mon_.forget_faithful
instance {A B : Mon_ C} (f : A ⟶ B) [e : IsIso ((forget C).map f)] : IsIso f.hom :=
e
/-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/
instance : ReflectsIsomorphisms (forget C) where
reflects f e :=
⟨⟨{ hom := inv f.hom
mul_hom := by
simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, ← tensor_comp_assoc,
IsIso.inv_hom_id, tensor_id, Category.id_comp] },
by aesop_cat⟩⟩
/-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X ≅ N.X) (one_f : M.one ≫ f.hom = N.one)
(mul_f : M.mul ≫ f.hom = (f.hom ⊗ f.hom) ≫ N.mul) : M ≅ N where
hom :=
{ hom := f.hom
one_hom := one_f
mul_hom := mul_f }
inv :=
{ hom := f.inv
one_hom := by rw [← one_f]; simp
mul_hom := by
rw [← cancel_mono f.hom]
slice_rhs 2 3 => rw [mul_f]
simp }
#align Mon_.iso_of_iso Mon_.isoOfIso
instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C ⟶ A) where
default :=
{ hom := A.one
one_hom := by dsimp; simp
mul_hom := by dsimp; simp [A.one_mul, unitors_equal] }
uniq f := by
ext; simp
rw [← Category.id_comp f.hom]
erw [f.one_hom]
#align Mon_.unique_hom_from_trivial Mon_.uniqueHomFromTrivial
open CategoryTheory.Limits
instance : HasInitial (Mon_ C) :=
hasInitial_of_unique (trivial C)
end Mon_
namespace CategoryTheory.LaxMonoidalFunctor
variable {C} {D : Type u₂} [Category.{v₂} D] [MonoidalCategory.{v₂} D]
-- TODO: mapMod F A : Mod A ⥤ Mod (F.mapMon A)
/-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one]
rw [F.toFunctor.map_id]
rw [F.right_unitality]
mul_assoc := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => | rw [F.μ_natural] | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one]
rw [F.toFunctor.map_id]
rw [F.right_unitality]
mul_assoc := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => | Mathlib.CategoryTheory.Monoidal.Mon_.202_0.NTUMzhXPwXsmsYt | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A | Mathlib_CategoryTheory_Monoidal_Mon_ |
C : Type u₁
inst✝³ : Category.{v₁, u₁} C
inst✝² : MonoidalCategory C
D : Type u₂
inst✝¹ : Category.{v₂, u₂} D
inst✝ : MonoidalCategory D
F : LaxMonoidalFunctor C D
A : Mon_ C
⊢ (μ F A.X A.X ⊗ F.map (𝟙 A.X)) ≫ (μ F (A.X ⊗ A.X) A.X ≫ F.map (A.mul ⊗ 𝟙 A.X)) ≫ F.map A.mul =
(α_ (F.obj A.X) (F.obj A.X) (F.obj A.X)).hom ≫
(𝟙 (F.obj A.X) ⊗ μ F A.X A.X ≫ F.map A.mul) ≫ μ F A.X A.X ≫ F.map A.mul | /-
Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/
import Mathlib.CategoryTheory.Monoidal.Braided
import Mathlib.CategoryTheory.Monoidal.Discrete
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
import Mathlib.Algebra.PUnitInstances
#align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c"
/-!
# The category of monoids in a monoidal category.
We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to
the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if
`C` is braided, then the category of monoids is naturally monoidal.
-/
set_option linter.uppercaseLean3 false
universe v₁ v₂ u₁ u₂ u
open CategoryTheory MonoidalCategory
variable (C : Type u₁) [Category.{v₁} C] [MonoidalCategory.{v₁} C]
/-- A monoid object internal to a monoidal category.
When the monoidal category is preadditive, this is also sometimes called an "algebra object".
-/
structure Mon_ where
X : C
one : 𝟙_ C ⟶ X
mul : X ⊗ X ⟶ X
one_mul : (one ⊗ 𝟙 X) ≫ mul = (λ_ X).hom := by aesop_cat
mul_one : (𝟙 X ⊗ one) ≫ mul = (ρ_ X).hom := by aesop_cat
-- Obviously there is some flexibility stating this axiom.
-- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`,
-- and chooses to place the associator on the right-hand side.
-- The heuristic is that unitors and associators "don't have much weight".
mul_assoc : (mul ⊗ 𝟙 X) ≫ mul = (α_ X X X).hom ≫ (𝟙 X ⊗ mul) ≫ mul := by aesop_cat
#align Mon_ Mon_
attribute [reassoc] Mon_.one_mul Mon_.mul_one
-- We prove a more general `@[simp]` lemma below.
attribute [reassoc (attr := simp)] Mon_.mul_assoc
namespace Mon_
/-- The trivial monoid object. We later show this is initial in `Mon_ C`.
-/
@[simps]
def trivial : Mon_ C where
X := 𝟙_ C
one := 𝟙 _
mul := (λ_ _).hom
mul_assoc := by coherence
mul_one := by coherence
#align Mon_.trivial Mon_.trivial
instance : Inhabited (Mon_ C) :=
⟨trivial C⟩
variable {C}
variable {M : Mon_ C}
@[simp]
theorem one_mul_hom {Z : C} (f : Z ⟶ M.X) : (M.one ⊗ f) ≫ M.mul = (λ_ Z).hom ≫ f := by
rw [← id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality]
#align Mon_.one_mul_hom Mon_.one_mul_hom
@[simp]
theorem mul_one_hom {Z : C} (f : Z ⟶ M.X) : (f ⊗ M.one) ≫ M.mul = (ρ_ Z).hom ≫ f := by
rw [← tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality]
#align Mon_.mul_one_hom Mon_.mul_one_hom
theorem assoc_flip :
(𝟙 M.X ⊗ M.mul) ≫ M.mul = (α_ M.X M.X M.X).inv ≫ (M.mul ⊗ 𝟙 M.X) ≫ M.mul := by simp
#align Mon_.assoc_flip Mon_.assoc_flip
/-- A morphism of monoid objects. -/
@[ext]
structure Hom (M N : Mon_ C) where
hom : M.X ⟶ N.X
one_hom : M.one ≫ hom = N.one := by aesop_cat
mul_hom : M.mul ≫ hom = (hom ⊗ hom) ≫ N.mul := by aesop_cat
#align Mon_.hom Mon_.Hom
attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom
/-- The identity morphism on a monoid object. -/
@[simps]
def id (M : Mon_ C) : Hom M M where
hom := 𝟙 M.X
#align Mon_.id Mon_.id
instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) :=
⟨id M⟩
#align Mon_.hom_inhabited Mon_.homInhabited
/-- Composition of morphisms of monoid objects. -/
@[simps]
def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where
hom := f.hom ≫ g.hom
#align Mon_.comp Mon_.comp
instance : Category (Mon_ C) where
Hom M N := Hom M N
id := id
comp f g := comp f g
-- Porting note: added, as `Hom.ext` does not apply to a morphism.
@[ext]
lemma ext {X Y : Mon_ C} {f g : X ⟶ Y} (w : f.hom = g.hom) : f = g :=
Hom.ext _ _ w
@[simp]
theorem id_hom' (M : Mon_ C) : (𝟙 M : Hom M M).hom = 𝟙 M.X :=
rfl
#align Mon_.id_hom' Mon_.id_hom'
@[simp]
theorem comp_hom' {M N K : Mon_ C} (f : M ⟶ N) (g : N ⟶ K) :
(f ≫ g : Hom M K).hom = f.hom ≫ g.hom :=
rfl
#align Mon_.comp_hom' Mon_.comp_hom'
section
variable (C)
/-- The forgetful functor from monoid objects to the ambient category. -/
@[simps]
def forget : Mon_ C ⥤ C where
obj A := A.X
map f := f.hom
#align Mon_.forget Mon_.forget
end
instance forget_faithful : Faithful (@forget C _ _) where
#align Mon_.forget_faithful Mon_.forget_faithful
instance {A B : Mon_ C} (f : A ⟶ B) [e : IsIso ((forget C).map f)] : IsIso f.hom :=
e
/-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/
instance : ReflectsIsomorphisms (forget C) where
reflects f e :=
⟨⟨{ hom := inv f.hom
mul_hom := by
simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, ← tensor_comp_assoc,
IsIso.inv_hom_id, tensor_id, Category.id_comp] },
by aesop_cat⟩⟩
/-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X ≅ N.X) (one_f : M.one ≫ f.hom = N.one)
(mul_f : M.mul ≫ f.hom = (f.hom ⊗ f.hom) ≫ N.mul) : M ≅ N where
hom :=
{ hom := f.hom
one_hom := one_f
mul_hom := mul_f }
inv :=
{ hom := f.inv
one_hom := by rw [← one_f]; simp
mul_hom := by
rw [← cancel_mono f.hom]
slice_rhs 2 3 => rw [mul_f]
simp }
#align Mon_.iso_of_iso Mon_.isoOfIso
instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C ⟶ A) where
default :=
{ hom := A.one
one_hom := by dsimp; simp
mul_hom := by dsimp; simp [A.one_mul, unitors_equal] }
uniq f := by
ext; simp
rw [← Category.id_comp f.hom]
erw [f.one_hom]
#align Mon_.unique_hom_from_trivial Mon_.uniqueHomFromTrivial
open CategoryTheory.Limits
instance : HasInitial (Mon_ C) :=
hasInitial_of_unique (trivial C)
end Mon_
namespace CategoryTheory.LaxMonoidalFunctor
variable {C} {D : Type u₂} [Category.{v₂} D] [MonoidalCategory.{v₂} D]
-- TODO: mapMod F A : Mod A ⥤ Mod (F.mapMon A)
/-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one]
rw [F.toFunctor.map_id]
rw [F.right_unitality]
mul_assoc := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
| slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_assoc] | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one]
rw [F.toFunctor.map_id]
rw [F.right_unitality]
mul_assoc := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
| Mathlib.CategoryTheory.Monoidal.Mon_.202_0.NTUMzhXPwXsmsYt | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A | Mathlib_CategoryTheory_Monoidal_Mon_ |
case a.a
C : Type u₁
inst✝³ : Category.{v₁, u₁} C
inst✝² : MonoidalCategory C
D : Type u₂
inst✝¹ : Category.{v₂, u₂} D
inst✝ : MonoidalCategory D
F : LaxMonoidalFunctor C D
A : Mon_ C
| F.map (A.mul ⊗ 𝟙 A.X) ≫ F.map A.mul
case a
C : Type u₁
inst✝³ : Category.{v₁, u₁} C
inst✝² : MonoidalCategory C
D : Type u₂
inst✝¹ : Category.{v₂, u₂} D
inst✝ : MonoidalCategory D
F : LaxMonoidalFunctor C D
A : Mon_ C
| μ F A.X A.X ⊗ F.map (𝟙 A.X)
case a.a
C : Type u₁
inst✝³ : Category.{v₁, u₁} C
inst✝² : MonoidalCategory C
D : Type u₂
inst✝¹ : Category.{v₂, u₂} D
inst✝ : MonoidalCategory D
F : LaxMonoidalFunctor C D
A : Mon_ C
| μ F (A.X ⊗ A.X) A.X | /-
Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/
import Mathlib.CategoryTheory.Monoidal.Braided
import Mathlib.CategoryTheory.Monoidal.Discrete
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
import Mathlib.Algebra.PUnitInstances
#align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c"
/-!
# The category of monoids in a monoidal category.
We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to
the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if
`C` is braided, then the category of monoids is naturally monoidal.
-/
set_option linter.uppercaseLean3 false
universe v₁ v₂ u₁ u₂ u
open CategoryTheory MonoidalCategory
variable (C : Type u₁) [Category.{v₁} C] [MonoidalCategory.{v₁} C]
/-- A monoid object internal to a monoidal category.
When the monoidal category is preadditive, this is also sometimes called an "algebra object".
-/
structure Mon_ where
X : C
one : 𝟙_ C ⟶ X
mul : X ⊗ X ⟶ X
one_mul : (one ⊗ 𝟙 X) ≫ mul = (λ_ X).hom := by aesop_cat
mul_one : (𝟙 X ⊗ one) ≫ mul = (ρ_ X).hom := by aesop_cat
-- Obviously there is some flexibility stating this axiom.
-- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`,
-- and chooses to place the associator on the right-hand side.
-- The heuristic is that unitors and associators "don't have much weight".
mul_assoc : (mul ⊗ 𝟙 X) ≫ mul = (α_ X X X).hom ≫ (𝟙 X ⊗ mul) ≫ mul := by aesop_cat
#align Mon_ Mon_
attribute [reassoc] Mon_.one_mul Mon_.mul_one
-- We prove a more general `@[simp]` lemma below.
attribute [reassoc (attr := simp)] Mon_.mul_assoc
namespace Mon_
/-- The trivial monoid object. We later show this is initial in `Mon_ C`.
-/
@[simps]
def trivial : Mon_ C where
X := 𝟙_ C
one := 𝟙 _
mul := (λ_ _).hom
mul_assoc := by coherence
mul_one := by coherence
#align Mon_.trivial Mon_.trivial
instance : Inhabited (Mon_ C) :=
⟨trivial C⟩
variable {C}
variable {M : Mon_ C}
@[simp]
theorem one_mul_hom {Z : C} (f : Z ⟶ M.X) : (M.one ⊗ f) ≫ M.mul = (λ_ Z).hom ≫ f := by
rw [← id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality]
#align Mon_.one_mul_hom Mon_.one_mul_hom
@[simp]
theorem mul_one_hom {Z : C} (f : Z ⟶ M.X) : (f ⊗ M.one) ≫ M.mul = (ρ_ Z).hom ≫ f := by
rw [← tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality]
#align Mon_.mul_one_hom Mon_.mul_one_hom
theorem assoc_flip :
(𝟙 M.X ⊗ M.mul) ≫ M.mul = (α_ M.X M.X M.X).inv ≫ (M.mul ⊗ 𝟙 M.X) ≫ M.mul := by simp
#align Mon_.assoc_flip Mon_.assoc_flip
/-- A morphism of monoid objects. -/
@[ext]
structure Hom (M N : Mon_ C) where
hom : M.X ⟶ N.X
one_hom : M.one ≫ hom = N.one := by aesop_cat
mul_hom : M.mul ≫ hom = (hom ⊗ hom) ≫ N.mul := by aesop_cat
#align Mon_.hom Mon_.Hom
attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom
/-- The identity morphism on a monoid object. -/
@[simps]
def id (M : Mon_ C) : Hom M M where
hom := 𝟙 M.X
#align Mon_.id Mon_.id
instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) :=
⟨id M⟩
#align Mon_.hom_inhabited Mon_.homInhabited
/-- Composition of morphisms of monoid objects. -/
@[simps]
def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where
hom := f.hom ≫ g.hom
#align Mon_.comp Mon_.comp
instance : Category (Mon_ C) where
Hom M N := Hom M N
id := id
comp f g := comp f g
-- Porting note: added, as `Hom.ext` does not apply to a morphism.
@[ext]
lemma ext {X Y : Mon_ C} {f g : X ⟶ Y} (w : f.hom = g.hom) : f = g :=
Hom.ext _ _ w
@[simp]
theorem id_hom' (M : Mon_ C) : (𝟙 M : Hom M M).hom = 𝟙 M.X :=
rfl
#align Mon_.id_hom' Mon_.id_hom'
@[simp]
theorem comp_hom' {M N K : Mon_ C} (f : M ⟶ N) (g : N ⟶ K) :
(f ≫ g : Hom M K).hom = f.hom ≫ g.hom :=
rfl
#align Mon_.comp_hom' Mon_.comp_hom'
section
variable (C)
/-- The forgetful functor from monoid objects to the ambient category. -/
@[simps]
def forget : Mon_ C ⥤ C where
obj A := A.X
map f := f.hom
#align Mon_.forget Mon_.forget
end
instance forget_faithful : Faithful (@forget C _ _) where
#align Mon_.forget_faithful Mon_.forget_faithful
instance {A B : Mon_ C} (f : A ⟶ B) [e : IsIso ((forget C).map f)] : IsIso f.hom :=
e
/-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/
instance : ReflectsIsomorphisms (forget C) where
reflects f e :=
⟨⟨{ hom := inv f.hom
mul_hom := by
simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, ← tensor_comp_assoc,
IsIso.inv_hom_id, tensor_id, Category.id_comp] },
by aesop_cat⟩⟩
/-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X ≅ N.X) (one_f : M.one ≫ f.hom = N.one)
(mul_f : M.mul ≫ f.hom = (f.hom ⊗ f.hom) ≫ N.mul) : M ≅ N where
hom :=
{ hom := f.hom
one_hom := one_f
mul_hom := mul_f }
inv :=
{ hom := f.inv
one_hom := by rw [← one_f]; simp
mul_hom := by
rw [← cancel_mono f.hom]
slice_rhs 2 3 => rw [mul_f]
simp }
#align Mon_.iso_of_iso Mon_.isoOfIso
instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C ⟶ A) where
default :=
{ hom := A.one
one_hom := by dsimp; simp
mul_hom := by dsimp; simp [A.one_mul, unitors_equal] }
uniq f := by
ext; simp
rw [← Category.id_comp f.hom]
erw [f.one_hom]
#align Mon_.unique_hom_from_trivial Mon_.uniqueHomFromTrivial
open CategoryTheory.Limits
instance : HasInitial (Mon_ C) :=
hasInitial_of_unique (trivial C)
end Mon_
namespace CategoryTheory.LaxMonoidalFunctor
variable {C} {D : Type u₂} [Category.{v₂} D] [MonoidalCategory.{v₂} D]
-- TODO: mapMod F A : Mod A ⥤ Mod (F.mapMon A)
/-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one]
rw [F.toFunctor.map_id]
rw [F.right_unitality]
mul_assoc := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => | rw [← F.toFunctor.map_comp, A.mul_assoc] | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one]
rw [F.toFunctor.map_id]
rw [F.right_unitality]
mul_assoc := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => | Mathlib.CategoryTheory.Monoidal.Mon_.202_0.NTUMzhXPwXsmsYt | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A | Mathlib_CategoryTheory_Monoidal_Mon_ |
case a.a
C : Type u₁
inst✝³ : Category.{v₁, u₁} C
inst✝² : MonoidalCategory C
D : Type u₂
inst✝¹ : Category.{v₂, u₂} D
inst✝ : MonoidalCategory D
F : LaxMonoidalFunctor C D
A : Mon_ C
| F.map (A.mul ⊗ 𝟙 A.X) ≫ F.map A.mul
case a
C : Type u₁
inst✝³ : Category.{v₁, u₁} C
inst✝² : MonoidalCategory C
D : Type u₂
inst✝¹ : Category.{v₂, u₂} D
inst✝ : MonoidalCategory D
F : LaxMonoidalFunctor C D
A : Mon_ C
| μ F A.X A.X ⊗ F.map (𝟙 A.X)
case a.a
C : Type u₁
inst✝³ : Category.{v₁, u₁} C
inst✝² : MonoidalCategory C
D : Type u₂
inst✝¹ : Category.{v₂, u₂} D
inst✝ : MonoidalCategory D
F : LaxMonoidalFunctor C D
A : Mon_ C
| μ F (A.X ⊗ A.X) A.X | /-
Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/
import Mathlib.CategoryTheory.Monoidal.Braided
import Mathlib.CategoryTheory.Monoidal.Discrete
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
import Mathlib.Algebra.PUnitInstances
#align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c"
/-!
# The category of monoids in a monoidal category.
We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to
the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if
`C` is braided, then the category of monoids is naturally monoidal.
-/
set_option linter.uppercaseLean3 false
universe v₁ v₂ u₁ u₂ u
open CategoryTheory MonoidalCategory
variable (C : Type u₁) [Category.{v₁} C] [MonoidalCategory.{v₁} C]
/-- A monoid object internal to a monoidal category.
When the monoidal category is preadditive, this is also sometimes called an "algebra object".
-/
structure Mon_ where
X : C
one : 𝟙_ C ⟶ X
mul : X ⊗ X ⟶ X
one_mul : (one ⊗ 𝟙 X) ≫ mul = (λ_ X).hom := by aesop_cat
mul_one : (𝟙 X ⊗ one) ≫ mul = (ρ_ X).hom := by aesop_cat
-- Obviously there is some flexibility stating this axiom.
-- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`,
-- and chooses to place the associator on the right-hand side.
-- The heuristic is that unitors and associators "don't have much weight".
mul_assoc : (mul ⊗ 𝟙 X) ≫ mul = (α_ X X X).hom ≫ (𝟙 X ⊗ mul) ≫ mul := by aesop_cat
#align Mon_ Mon_
attribute [reassoc] Mon_.one_mul Mon_.mul_one
-- We prove a more general `@[simp]` lemma below.
attribute [reassoc (attr := simp)] Mon_.mul_assoc
namespace Mon_
/-- The trivial monoid object. We later show this is initial in `Mon_ C`.
-/
@[simps]
def trivial : Mon_ C where
X := 𝟙_ C
one := 𝟙 _
mul := (λ_ _).hom
mul_assoc := by coherence
mul_one := by coherence
#align Mon_.trivial Mon_.trivial
instance : Inhabited (Mon_ C) :=
⟨trivial C⟩
variable {C}
variable {M : Mon_ C}
@[simp]
theorem one_mul_hom {Z : C} (f : Z ⟶ M.X) : (M.one ⊗ f) ≫ M.mul = (λ_ Z).hom ≫ f := by
rw [← id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality]
#align Mon_.one_mul_hom Mon_.one_mul_hom
@[simp]
theorem mul_one_hom {Z : C} (f : Z ⟶ M.X) : (f ⊗ M.one) ≫ M.mul = (ρ_ Z).hom ≫ f := by
rw [← tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality]
#align Mon_.mul_one_hom Mon_.mul_one_hom
theorem assoc_flip :
(𝟙 M.X ⊗ M.mul) ≫ M.mul = (α_ M.X M.X M.X).inv ≫ (M.mul ⊗ 𝟙 M.X) ≫ M.mul := by simp
#align Mon_.assoc_flip Mon_.assoc_flip
/-- A morphism of monoid objects. -/
@[ext]
structure Hom (M N : Mon_ C) where
hom : M.X ⟶ N.X
one_hom : M.one ≫ hom = N.one := by aesop_cat
mul_hom : M.mul ≫ hom = (hom ⊗ hom) ≫ N.mul := by aesop_cat
#align Mon_.hom Mon_.Hom
attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom
/-- The identity morphism on a monoid object. -/
@[simps]
def id (M : Mon_ C) : Hom M M where
hom := 𝟙 M.X
#align Mon_.id Mon_.id
instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) :=
⟨id M⟩
#align Mon_.hom_inhabited Mon_.homInhabited
/-- Composition of morphisms of monoid objects. -/
@[simps]
def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where
hom := f.hom ≫ g.hom
#align Mon_.comp Mon_.comp
instance : Category (Mon_ C) where
Hom M N := Hom M N
id := id
comp f g := comp f g
-- Porting note: added, as `Hom.ext` does not apply to a morphism.
@[ext]
lemma ext {X Y : Mon_ C} {f g : X ⟶ Y} (w : f.hom = g.hom) : f = g :=
Hom.ext _ _ w
@[simp]
theorem id_hom' (M : Mon_ C) : (𝟙 M : Hom M M).hom = 𝟙 M.X :=
rfl
#align Mon_.id_hom' Mon_.id_hom'
@[simp]
theorem comp_hom' {M N K : Mon_ C} (f : M ⟶ N) (g : N ⟶ K) :
(f ≫ g : Hom M K).hom = f.hom ≫ g.hom :=
rfl
#align Mon_.comp_hom' Mon_.comp_hom'
section
variable (C)
/-- The forgetful functor from monoid objects to the ambient category. -/
@[simps]
def forget : Mon_ C ⥤ C where
obj A := A.X
map f := f.hom
#align Mon_.forget Mon_.forget
end
instance forget_faithful : Faithful (@forget C _ _) where
#align Mon_.forget_faithful Mon_.forget_faithful
instance {A B : Mon_ C} (f : A ⟶ B) [e : IsIso ((forget C).map f)] : IsIso f.hom :=
e
/-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/
instance : ReflectsIsomorphisms (forget C) where
reflects f e :=
⟨⟨{ hom := inv f.hom
mul_hom := by
simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, ← tensor_comp_assoc,
IsIso.inv_hom_id, tensor_id, Category.id_comp] },
by aesop_cat⟩⟩
/-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X ≅ N.X) (one_f : M.one ≫ f.hom = N.one)
(mul_f : M.mul ≫ f.hom = (f.hom ⊗ f.hom) ≫ N.mul) : M ≅ N where
hom :=
{ hom := f.hom
one_hom := one_f
mul_hom := mul_f }
inv :=
{ hom := f.inv
one_hom := by rw [← one_f]; simp
mul_hom := by
rw [← cancel_mono f.hom]
slice_rhs 2 3 => rw [mul_f]
simp }
#align Mon_.iso_of_iso Mon_.isoOfIso
instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C ⟶ A) where
default :=
{ hom := A.one
one_hom := by dsimp; simp
mul_hom := by dsimp; simp [A.one_mul, unitors_equal] }
uniq f := by
ext; simp
rw [← Category.id_comp f.hom]
erw [f.one_hom]
#align Mon_.unique_hom_from_trivial Mon_.uniqueHomFromTrivial
open CategoryTheory.Limits
instance : HasInitial (Mon_ C) :=
hasInitial_of_unique (trivial C)
end Mon_
namespace CategoryTheory.LaxMonoidalFunctor
variable {C} {D : Type u₂} [Category.{v₂} D] [MonoidalCategory.{v₂} D]
-- TODO: mapMod F A : Mod A ⥤ Mod (F.mapMon A)
/-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one]
rw [F.toFunctor.map_id]
rw [F.right_unitality]
mul_assoc := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => | rw [← F.toFunctor.map_comp, A.mul_assoc] | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one]
rw [F.toFunctor.map_id]
rw [F.right_unitality]
mul_assoc := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => | Mathlib.CategoryTheory.Monoidal.Mon_.202_0.NTUMzhXPwXsmsYt | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A | Mathlib_CategoryTheory_Monoidal_Mon_ |
case a.a
C : Type u₁
inst✝³ : Category.{v₁, u₁} C
inst✝² : MonoidalCategory C
D : Type u₂
inst✝¹ : Category.{v₂, u₂} D
inst✝ : MonoidalCategory D
F : LaxMonoidalFunctor C D
A : Mon_ C
| F.map (A.mul ⊗ 𝟙 A.X) ≫ F.map A.mul
case a
C : Type u₁
inst✝³ : Category.{v₁, u₁} C
inst✝² : MonoidalCategory C
D : Type u₂
inst✝¹ : Category.{v₂, u₂} D
inst✝ : MonoidalCategory D
F : LaxMonoidalFunctor C D
A : Mon_ C
| μ F A.X A.X ⊗ F.map (𝟙 A.X)
case a.a
C : Type u₁
inst✝³ : Category.{v₁, u₁} C
inst✝² : MonoidalCategory C
D : Type u₂
inst✝¹ : Category.{v₂, u₂} D
inst✝ : MonoidalCategory D
F : LaxMonoidalFunctor C D
A : Mon_ C
| μ F (A.X ⊗ A.X) A.X | /-
Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/
import Mathlib.CategoryTheory.Monoidal.Braided
import Mathlib.CategoryTheory.Monoidal.Discrete
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
import Mathlib.Algebra.PUnitInstances
#align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c"
/-!
# The category of monoids in a monoidal category.
We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to
the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if
`C` is braided, then the category of monoids is naturally monoidal.
-/
set_option linter.uppercaseLean3 false
universe v₁ v₂ u₁ u₂ u
open CategoryTheory MonoidalCategory
variable (C : Type u₁) [Category.{v₁} C] [MonoidalCategory.{v₁} C]
/-- A monoid object internal to a monoidal category.
When the monoidal category is preadditive, this is also sometimes called an "algebra object".
-/
structure Mon_ where
X : C
one : 𝟙_ C ⟶ X
mul : X ⊗ X ⟶ X
one_mul : (one ⊗ 𝟙 X) ≫ mul = (λ_ X).hom := by aesop_cat
mul_one : (𝟙 X ⊗ one) ≫ mul = (ρ_ X).hom := by aesop_cat
-- Obviously there is some flexibility stating this axiom.
-- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`,
-- and chooses to place the associator on the right-hand side.
-- The heuristic is that unitors and associators "don't have much weight".
mul_assoc : (mul ⊗ 𝟙 X) ≫ mul = (α_ X X X).hom ≫ (𝟙 X ⊗ mul) ≫ mul := by aesop_cat
#align Mon_ Mon_
attribute [reassoc] Mon_.one_mul Mon_.mul_one
-- We prove a more general `@[simp]` lemma below.
attribute [reassoc (attr := simp)] Mon_.mul_assoc
namespace Mon_
/-- The trivial monoid object. We later show this is initial in `Mon_ C`.
-/
@[simps]
def trivial : Mon_ C where
X := 𝟙_ C
one := 𝟙 _
mul := (λ_ _).hom
mul_assoc := by coherence
mul_one := by coherence
#align Mon_.trivial Mon_.trivial
instance : Inhabited (Mon_ C) :=
⟨trivial C⟩
variable {C}
variable {M : Mon_ C}
@[simp]
theorem one_mul_hom {Z : C} (f : Z ⟶ M.X) : (M.one ⊗ f) ≫ M.mul = (λ_ Z).hom ≫ f := by
rw [← id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality]
#align Mon_.one_mul_hom Mon_.one_mul_hom
@[simp]
theorem mul_one_hom {Z : C} (f : Z ⟶ M.X) : (f ⊗ M.one) ≫ M.mul = (ρ_ Z).hom ≫ f := by
rw [← tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality]
#align Mon_.mul_one_hom Mon_.mul_one_hom
theorem assoc_flip :
(𝟙 M.X ⊗ M.mul) ≫ M.mul = (α_ M.X M.X M.X).inv ≫ (M.mul ⊗ 𝟙 M.X) ≫ M.mul := by simp
#align Mon_.assoc_flip Mon_.assoc_flip
/-- A morphism of monoid objects. -/
@[ext]
structure Hom (M N : Mon_ C) where
hom : M.X ⟶ N.X
one_hom : M.one ≫ hom = N.one := by aesop_cat
mul_hom : M.mul ≫ hom = (hom ⊗ hom) ≫ N.mul := by aesop_cat
#align Mon_.hom Mon_.Hom
attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom
/-- The identity morphism on a monoid object. -/
@[simps]
def id (M : Mon_ C) : Hom M M where
hom := 𝟙 M.X
#align Mon_.id Mon_.id
instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) :=
⟨id M⟩
#align Mon_.hom_inhabited Mon_.homInhabited
/-- Composition of morphisms of monoid objects. -/
@[simps]
def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where
hom := f.hom ≫ g.hom
#align Mon_.comp Mon_.comp
instance : Category (Mon_ C) where
Hom M N := Hom M N
id := id
comp f g := comp f g
-- Porting note: added, as `Hom.ext` does not apply to a morphism.
@[ext]
lemma ext {X Y : Mon_ C} {f g : X ⟶ Y} (w : f.hom = g.hom) : f = g :=
Hom.ext _ _ w
@[simp]
theorem id_hom' (M : Mon_ C) : (𝟙 M : Hom M M).hom = 𝟙 M.X :=
rfl
#align Mon_.id_hom' Mon_.id_hom'
@[simp]
theorem comp_hom' {M N K : Mon_ C} (f : M ⟶ N) (g : N ⟶ K) :
(f ≫ g : Hom M K).hom = f.hom ≫ g.hom :=
rfl
#align Mon_.comp_hom' Mon_.comp_hom'
section
variable (C)
/-- The forgetful functor from monoid objects to the ambient category. -/
@[simps]
def forget : Mon_ C ⥤ C where
obj A := A.X
map f := f.hom
#align Mon_.forget Mon_.forget
end
instance forget_faithful : Faithful (@forget C _ _) where
#align Mon_.forget_faithful Mon_.forget_faithful
instance {A B : Mon_ C} (f : A ⟶ B) [e : IsIso ((forget C).map f)] : IsIso f.hom :=
e
/-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/
instance : ReflectsIsomorphisms (forget C) where
reflects f e :=
⟨⟨{ hom := inv f.hom
mul_hom := by
simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, ← tensor_comp_assoc,
IsIso.inv_hom_id, tensor_id, Category.id_comp] },
by aesop_cat⟩⟩
/-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X ≅ N.X) (one_f : M.one ≫ f.hom = N.one)
(mul_f : M.mul ≫ f.hom = (f.hom ⊗ f.hom) ≫ N.mul) : M ≅ N where
hom :=
{ hom := f.hom
one_hom := one_f
mul_hom := mul_f }
inv :=
{ hom := f.inv
one_hom := by rw [← one_f]; simp
mul_hom := by
rw [← cancel_mono f.hom]
slice_rhs 2 3 => rw [mul_f]
simp }
#align Mon_.iso_of_iso Mon_.isoOfIso
instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C ⟶ A) where
default :=
{ hom := A.one
one_hom := by dsimp; simp
mul_hom := by dsimp; simp [A.one_mul, unitors_equal] }
uniq f := by
ext; simp
rw [← Category.id_comp f.hom]
erw [f.one_hom]
#align Mon_.unique_hom_from_trivial Mon_.uniqueHomFromTrivial
open CategoryTheory.Limits
instance : HasInitial (Mon_ C) :=
hasInitial_of_unique (trivial C)
end Mon_
namespace CategoryTheory.LaxMonoidalFunctor
variable {C} {D : Type u₂} [Category.{v₂} D] [MonoidalCategory.{v₂} D]
-- TODO: mapMod F A : Mod A ⥤ Mod (F.mapMon A)
/-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one]
rw [F.toFunctor.map_id]
rw [F.right_unitality]
mul_assoc := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => | rw [← F.toFunctor.map_comp, A.mul_assoc] | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one]
rw [F.toFunctor.map_id]
rw [F.right_unitality]
mul_assoc := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => | Mathlib.CategoryTheory.Monoidal.Mon_.202_0.NTUMzhXPwXsmsYt | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A | Mathlib_CategoryTheory_Monoidal_Mon_ |
C : Type u₁
inst✝³ : Category.{v₁, u₁} C
inst✝² : MonoidalCategory C
D : Type u₂
inst✝¹ : Category.{v₂, u₂} D
inst✝ : MonoidalCategory D
F : LaxMonoidalFunctor C D
A : Mon_ C
⊢ (μ F A.X A.X ⊗ F.map (𝟙 A.X)) ≫ μ F (A.X ⊗ A.X) A.X ≫ F.map ((α_ A.X A.X A.X).hom ≫ (𝟙 A.X ⊗ A.mul) ≫ A.mul) =
(α_ (F.obj A.X) (F.obj A.X) (F.obj A.X)).hom ≫
(𝟙 (F.obj A.X) ⊗ μ F A.X A.X ≫ F.map A.mul) ≫ μ F A.X A.X ≫ F.map A.mul | /-
Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/
import Mathlib.CategoryTheory.Monoidal.Braided
import Mathlib.CategoryTheory.Monoidal.Discrete
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
import Mathlib.Algebra.PUnitInstances
#align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c"
/-!
# The category of monoids in a monoidal category.
We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to
the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if
`C` is braided, then the category of monoids is naturally monoidal.
-/
set_option linter.uppercaseLean3 false
universe v₁ v₂ u₁ u₂ u
open CategoryTheory MonoidalCategory
variable (C : Type u₁) [Category.{v₁} C] [MonoidalCategory.{v₁} C]
/-- A monoid object internal to a monoidal category.
When the monoidal category is preadditive, this is also sometimes called an "algebra object".
-/
structure Mon_ where
X : C
one : 𝟙_ C ⟶ X
mul : X ⊗ X ⟶ X
one_mul : (one ⊗ 𝟙 X) ≫ mul = (λ_ X).hom := by aesop_cat
mul_one : (𝟙 X ⊗ one) ≫ mul = (ρ_ X).hom := by aesop_cat
-- Obviously there is some flexibility stating this axiom.
-- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`,
-- and chooses to place the associator on the right-hand side.
-- The heuristic is that unitors and associators "don't have much weight".
mul_assoc : (mul ⊗ 𝟙 X) ≫ mul = (α_ X X X).hom ≫ (𝟙 X ⊗ mul) ≫ mul := by aesop_cat
#align Mon_ Mon_
attribute [reassoc] Mon_.one_mul Mon_.mul_one
-- We prove a more general `@[simp]` lemma below.
attribute [reassoc (attr := simp)] Mon_.mul_assoc
namespace Mon_
/-- The trivial monoid object. We later show this is initial in `Mon_ C`.
-/
@[simps]
def trivial : Mon_ C where
X := 𝟙_ C
one := 𝟙 _
mul := (λ_ _).hom
mul_assoc := by coherence
mul_one := by coherence
#align Mon_.trivial Mon_.trivial
instance : Inhabited (Mon_ C) :=
⟨trivial C⟩
variable {C}
variable {M : Mon_ C}
@[simp]
theorem one_mul_hom {Z : C} (f : Z ⟶ M.X) : (M.one ⊗ f) ≫ M.mul = (λ_ Z).hom ≫ f := by
rw [← id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality]
#align Mon_.one_mul_hom Mon_.one_mul_hom
@[simp]
theorem mul_one_hom {Z : C} (f : Z ⟶ M.X) : (f ⊗ M.one) ≫ M.mul = (ρ_ Z).hom ≫ f := by
rw [← tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality]
#align Mon_.mul_one_hom Mon_.mul_one_hom
theorem assoc_flip :
(𝟙 M.X ⊗ M.mul) ≫ M.mul = (α_ M.X M.X M.X).inv ≫ (M.mul ⊗ 𝟙 M.X) ≫ M.mul := by simp
#align Mon_.assoc_flip Mon_.assoc_flip
/-- A morphism of monoid objects. -/
@[ext]
structure Hom (M N : Mon_ C) where
hom : M.X ⟶ N.X
one_hom : M.one ≫ hom = N.one := by aesop_cat
mul_hom : M.mul ≫ hom = (hom ⊗ hom) ≫ N.mul := by aesop_cat
#align Mon_.hom Mon_.Hom
attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom
/-- The identity morphism on a monoid object. -/
@[simps]
def id (M : Mon_ C) : Hom M M where
hom := 𝟙 M.X
#align Mon_.id Mon_.id
instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) :=
⟨id M⟩
#align Mon_.hom_inhabited Mon_.homInhabited
/-- Composition of morphisms of monoid objects. -/
@[simps]
def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where
hom := f.hom ≫ g.hom
#align Mon_.comp Mon_.comp
instance : Category (Mon_ C) where
Hom M N := Hom M N
id := id
comp f g := comp f g
-- Porting note: added, as `Hom.ext` does not apply to a morphism.
@[ext]
lemma ext {X Y : Mon_ C} {f g : X ⟶ Y} (w : f.hom = g.hom) : f = g :=
Hom.ext _ _ w
@[simp]
theorem id_hom' (M : Mon_ C) : (𝟙 M : Hom M M).hom = 𝟙 M.X :=
rfl
#align Mon_.id_hom' Mon_.id_hom'
@[simp]
theorem comp_hom' {M N K : Mon_ C} (f : M ⟶ N) (g : N ⟶ K) :
(f ≫ g : Hom M K).hom = f.hom ≫ g.hom :=
rfl
#align Mon_.comp_hom' Mon_.comp_hom'
section
variable (C)
/-- The forgetful functor from monoid objects to the ambient category. -/
@[simps]
def forget : Mon_ C ⥤ C where
obj A := A.X
map f := f.hom
#align Mon_.forget Mon_.forget
end
instance forget_faithful : Faithful (@forget C _ _) where
#align Mon_.forget_faithful Mon_.forget_faithful
instance {A B : Mon_ C} (f : A ⟶ B) [e : IsIso ((forget C).map f)] : IsIso f.hom :=
e
/-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/
instance : ReflectsIsomorphisms (forget C) where
reflects f e :=
⟨⟨{ hom := inv f.hom
mul_hom := by
simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, ← tensor_comp_assoc,
IsIso.inv_hom_id, tensor_id, Category.id_comp] },
by aesop_cat⟩⟩
/-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X ≅ N.X) (one_f : M.one ≫ f.hom = N.one)
(mul_f : M.mul ≫ f.hom = (f.hom ⊗ f.hom) ≫ N.mul) : M ≅ N where
hom :=
{ hom := f.hom
one_hom := one_f
mul_hom := mul_f }
inv :=
{ hom := f.inv
one_hom := by rw [← one_f]; simp
mul_hom := by
rw [← cancel_mono f.hom]
slice_rhs 2 3 => rw [mul_f]
simp }
#align Mon_.iso_of_iso Mon_.isoOfIso
instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C ⟶ A) where
default :=
{ hom := A.one
one_hom := by dsimp; simp
mul_hom := by dsimp; simp [A.one_mul, unitors_equal] }
uniq f := by
ext; simp
rw [← Category.id_comp f.hom]
erw [f.one_hom]
#align Mon_.unique_hom_from_trivial Mon_.uniqueHomFromTrivial
open CategoryTheory.Limits
instance : HasInitial (Mon_ C) :=
hasInitial_of_unique (trivial C)
end Mon_
namespace CategoryTheory.LaxMonoidalFunctor
variable {C} {D : Type u₂} [Category.{v₂} D] [MonoidalCategory.{v₂} D]
-- TODO: mapMod F A : Mod A ⥤ Mod (F.mapMon A)
/-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one]
rw [F.toFunctor.map_id]
rw [F.right_unitality]
mul_assoc := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_assoc]
| conv_lhs => rw [F.toFunctor.map_id] | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one]
rw [F.toFunctor.map_id]
rw [F.right_unitality]
mul_assoc := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_assoc]
| Mathlib.CategoryTheory.Monoidal.Mon_.202_0.NTUMzhXPwXsmsYt | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A | Mathlib_CategoryTheory_Monoidal_Mon_ |
C : Type u₁
inst✝³ : Category.{v₁, u₁} C
inst✝² : MonoidalCategory C
D : Type u₂
inst✝¹ : Category.{v₂, u₂} D
inst✝ : MonoidalCategory D
F : LaxMonoidalFunctor C D
A : Mon_ C
| (μ F A.X A.X ⊗ F.map (𝟙 A.X)) ≫ μ F (A.X ⊗ A.X) A.X ≫ F.map ((α_ A.X A.X A.X).hom ≫ (𝟙 A.X ⊗ A.mul) ≫ A.mul) | /-
Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/
import Mathlib.CategoryTheory.Monoidal.Braided
import Mathlib.CategoryTheory.Monoidal.Discrete
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
import Mathlib.Algebra.PUnitInstances
#align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c"
/-!
# The category of monoids in a monoidal category.
We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to
the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if
`C` is braided, then the category of monoids is naturally monoidal.
-/
set_option linter.uppercaseLean3 false
universe v₁ v₂ u₁ u₂ u
open CategoryTheory MonoidalCategory
variable (C : Type u₁) [Category.{v₁} C] [MonoidalCategory.{v₁} C]
/-- A monoid object internal to a monoidal category.
When the monoidal category is preadditive, this is also sometimes called an "algebra object".
-/
structure Mon_ where
X : C
one : 𝟙_ C ⟶ X
mul : X ⊗ X ⟶ X
one_mul : (one ⊗ 𝟙 X) ≫ mul = (λ_ X).hom := by aesop_cat
mul_one : (𝟙 X ⊗ one) ≫ mul = (ρ_ X).hom := by aesop_cat
-- Obviously there is some flexibility stating this axiom.
-- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`,
-- and chooses to place the associator on the right-hand side.
-- The heuristic is that unitors and associators "don't have much weight".
mul_assoc : (mul ⊗ 𝟙 X) ≫ mul = (α_ X X X).hom ≫ (𝟙 X ⊗ mul) ≫ mul := by aesop_cat
#align Mon_ Mon_
attribute [reassoc] Mon_.one_mul Mon_.mul_one
-- We prove a more general `@[simp]` lemma below.
attribute [reassoc (attr := simp)] Mon_.mul_assoc
namespace Mon_
/-- The trivial monoid object. We later show this is initial in `Mon_ C`.
-/
@[simps]
def trivial : Mon_ C where
X := 𝟙_ C
one := 𝟙 _
mul := (λ_ _).hom
mul_assoc := by coherence
mul_one := by coherence
#align Mon_.trivial Mon_.trivial
instance : Inhabited (Mon_ C) :=
⟨trivial C⟩
variable {C}
variable {M : Mon_ C}
@[simp]
theorem one_mul_hom {Z : C} (f : Z ⟶ M.X) : (M.one ⊗ f) ≫ M.mul = (λ_ Z).hom ≫ f := by
rw [← id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality]
#align Mon_.one_mul_hom Mon_.one_mul_hom
@[simp]
theorem mul_one_hom {Z : C} (f : Z ⟶ M.X) : (f ⊗ M.one) ≫ M.mul = (ρ_ Z).hom ≫ f := by
rw [← tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality]
#align Mon_.mul_one_hom Mon_.mul_one_hom
theorem assoc_flip :
(𝟙 M.X ⊗ M.mul) ≫ M.mul = (α_ M.X M.X M.X).inv ≫ (M.mul ⊗ 𝟙 M.X) ≫ M.mul := by simp
#align Mon_.assoc_flip Mon_.assoc_flip
/-- A morphism of monoid objects. -/
@[ext]
structure Hom (M N : Mon_ C) where
hom : M.X ⟶ N.X
one_hom : M.one ≫ hom = N.one := by aesop_cat
mul_hom : M.mul ≫ hom = (hom ⊗ hom) ≫ N.mul := by aesop_cat
#align Mon_.hom Mon_.Hom
attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom
/-- The identity morphism on a monoid object. -/
@[simps]
def id (M : Mon_ C) : Hom M M where
hom := 𝟙 M.X
#align Mon_.id Mon_.id
instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) :=
⟨id M⟩
#align Mon_.hom_inhabited Mon_.homInhabited
/-- Composition of morphisms of monoid objects. -/
@[simps]
def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where
hom := f.hom ≫ g.hom
#align Mon_.comp Mon_.comp
instance : Category (Mon_ C) where
Hom M N := Hom M N
id := id
comp f g := comp f g
-- Porting note: added, as `Hom.ext` does not apply to a morphism.
@[ext]
lemma ext {X Y : Mon_ C} {f g : X ⟶ Y} (w : f.hom = g.hom) : f = g :=
Hom.ext _ _ w
@[simp]
theorem id_hom' (M : Mon_ C) : (𝟙 M : Hom M M).hom = 𝟙 M.X :=
rfl
#align Mon_.id_hom' Mon_.id_hom'
@[simp]
theorem comp_hom' {M N K : Mon_ C} (f : M ⟶ N) (g : N ⟶ K) :
(f ≫ g : Hom M K).hom = f.hom ≫ g.hom :=
rfl
#align Mon_.comp_hom' Mon_.comp_hom'
section
variable (C)
/-- The forgetful functor from monoid objects to the ambient category. -/
@[simps]
def forget : Mon_ C ⥤ C where
obj A := A.X
map f := f.hom
#align Mon_.forget Mon_.forget
end
instance forget_faithful : Faithful (@forget C _ _) where
#align Mon_.forget_faithful Mon_.forget_faithful
instance {A B : Mon_ C} (f : A ⟶ B) [e : IsIso ((forget C).map f)] : IsIso f.hom :=
e
/-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/
instance : ReflectsIsomorphisms (forget C) where
reflects f e :=
⟨⟨{ hom := inv f.hom
mul_hom := by
simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, ← tensor_comp_assoc,
IsIso.inv_hom_id, tensor_id, Category.id_comp] },
by aesop_cat⟩⟩
/-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X ≅ N.X) (one_f : M.one ≫ f.hom = N.one)
(mul_f : M.mul ≫ f.hom = (f.hom ⊗ f.hom) ≫ N.mul) : M ≅ N where
hom :=
{ hom := f.hom
one_hom := one_f
mul_hom := mul_f }
inv :=
{ hom := f.inv
one_hom := by rw [← one_f]; simp
mul_hom := by
rw [← cancel_mono f.hom]
slice_rhs 2 3 => rw [mul_f]
simp }
#align Mon_.iso_of_iso Mon_.isoOfIso
instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C ⟶ A) where
default :=
{ hom := A.one
one_hom := by dsimp; simp
mul_hom := by dsimp; simp [A.one_mul, unitors_equal] }
uniq f := by
ext; simp
rw [← Category.id_comp f.hom]
erw [f.one_hom]
#align Mon_.unique_hom_from_trivial Mon_.uniqueHomFromTrivial
open CategoryTheory.Limits
instance : HasInitial (Mon_ C) :=
hasInitial_of_unique (trivial C)
end Mon_
namespace CategoryTheory.LaxMonoidalFunctor
variable {C} {D : Type u₂} [Category.{v₂} D] [MonoidalCategory.{v₂} D]
-- TODO: mapMod F A : Mod A ⥤ Mod (F.mapMon A)
/-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one]
rw [F.toFunctor.map_id]
rw [F.right_unitality]
mul_assoc := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_assoc]
conv_lhs => | rw [F.toFunctor.map_id] | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one]
rw [F.toFunctor.map_id]
rw [F.right_unitality]
mul_assoc := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_assoc]
conv_lhs => | Mathlib.CategoryTheory.Monoidal.Mon_.202_0.NTUMzhXPwXsmsYt | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A | Mathlib_CategoryTheory_Monoidal_Mon_ |
C : Type u₁
inst✝³ : Category.{v₁, u₁} C
inst✝² : MonoidalCategory C
D : Type u₂
inst✝¹ : Category.{v₂, u₂} D
inst✝ : MonoidalCategory D
F : LaxMonoidalFunctor C D
A : Mon_ C
| (μ F A.X A.X ⊗ F.map (𝟙 A.X)) ≫ μ F (A.X ⊗ A.X) A.X ≫ F.map ((α_ A.X A.X A.X).hom ≫ (𝟙 A.X ⊗ A.mul) ≫ A.mul) | /-
Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/
import Mathlib.CategoryTheory.Monoidal.Braided
import Mathlib.CategoryTheory.Monoidal.Discrete
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
import Mathlib.Algebra.PUnitInstances
#align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c"
/-!
# The category of monoids in a monoidal category.
We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to
the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if
`C` is braided, then the category of monoids is naturally monoidal.
-/
set_option linter.uppercaseLean3 false
universe v₁ v₂ u₁ u₂ u
open CategoryTheory MonoidalCategory
variable (C : Type u₁) [Category.{v₁} C] [MonoidalCategory.{v₁} C]
/-- A monoid object internal to a monoidal category.
When the monoidal category is preadditive, this is also sometimes called an "algebra object".
-/
structure Mon_ where
X : C
one : 𝟙_ C ⟶ X
mul : X ⊗ X ⟶ X
one_mul : (one ⊗ 𝟙 X) ≫ mul = (λ_ X).hom := by aesop_cat
mul_one : (𝟙 X ⊗ one) ≫ mul = (ρ_ X).hom := by aesop_cat
-- Obviously there is some flexibility stating this axiom.
-- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`,
-- and chooses to place the associator on the right-hand side.
-- The heuristic is that unitors and associators "don't have much weight".
mul_assoc : (mul ⊗ 𝟙 X) ≫ mul = (α_ X X X).hom ≫ (𝟙 X ⊗ mul) ≫ mul := by aesop_cat
#align Mon_ Mon_
attribute [reassoc] Mon_.one_mul Mon_.mul_one
-- We prove a more general `@[simp]` lemma below.
attribute [reassoc (attr := simp)] Mon_.mul_assoc
namespace Mon_
/-- The trivial monoid object. We later show this is initial in `Mon_ C`.
-/
@[simps]
def trivial : Mon_ C where
X := 𝟙_ C
one := 𝟙 _
mul := (λ_ _).hom
mul_assoc := by coherence
mul_one := by coherence
#align Mon_.trivial Mon_.trivial
instance : Inhabited (Mon_ C) :=
⟨trivial C⟩
variable {C}
variable {M : Mon_ C}
@[simp]
theorem one_mul_hom {Z : C} (f : Z ⟶ M.X) : (M.one ⊗ f) ≫ M.mul = (λ_ Z).hom ≫ f := by
rw [← id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality]
#align Mon_.one_mul_hom Mon_.one_mul_hom
@[simp]
theorem mul_one_hom {Z : C} (f : Z ⟶ M.X) : (f ⊗ M.one) ≫ M.mul = (ρ_ Z).hom ≫ f := by
rw [← tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality]
#align Mon_.mul_one_hom Mon_.mul_one_hom
theorem assoc_flip :
(𝟙 M.X ⊗ M.mul) ≫ M.mul = (α_ M.X M.X M.X).inv ≫ (M.mul ⊗ 𝟙 M.X) ≫ M.mul := by simp
#align Mon_.assoc_flip Mon_.assoc_flip
/-- A morphism of monoid objects. -/
@[ext]
structure Hom (M N : Mon_ C) where
hom : M.X ⟶ N.X
one_hom : M.one ≫ hom = N.one := by aesop_cat
mul_hom : M.mul ≫ hom = (hom ⊗ hom) ≫ N.mul := by aesop_cat
#align Mon_.hom Mon_.Hom
attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom
/-- The identity morphism on a monoid object. -/
@[simps]
def id (M : Mon_ C) : Hom M M where
hom := 𝟙 M.X
#align Mon_.id Mon_.id
instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) :=
⟨id M⟩
#align Mon_.hom_inhabited Mon_.homInhabited
/-- Composition of morphisms of monoid objects. -/
@[simps]
def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where
hom := f.hom ≫ g.hom
#align Mon_.comp Mon_.comp
instance : Category (Mon_ C) where
Hom M N := Hom M N
id := id
comp f g := comp f g
-- Porting note: added, as `Hom.ext` does not apply to a morphism.
@[ext]
lemma ext {X Y : Mon_ C} {f g : X ⟶ Y} (w : f.hom = g.hom) : f = g :=
Hom.ext _ _ w
@[simp]
theorem id_hom' (M : Mon_ C) : (𝟙 M : Hom M M).hom = 𝟙 M.X :=
rfl
#align Mon_.id_hom' Mon_.id_hom'
@[simp]
theorem comp_hom' {M N K : Mon_ C} (f : M ⟶ N) (g : N ⟶ K) :
(f ≫ g : Hom M K).hom = f.hom ≫ g.hom :=
rfl
#align Mon_.comp_hom' Mon_.comp_hom'
section
variable (C)
/-- The forgetful functor from monoid objects to the ambient category. -/
@[simps]
def forget : Mon_ C ⥤ C where
obj A := A.X
map f := f.hom
#align Mon_.forget Mon_.forget
end
instance forget_faithful : Faithful (@forget C _ _) where
#align Mon_.forget_faithful Mon_.forget_faithful
instance {A B : Mon_ C} (f : A ⟶ B) [e : IsIso ((forget C).map f)] : IsIso f.hom :=
e
/-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/
instance : ReflectsIsomorphisms (forget C) where
reflects f e :=
⟨⟨{ hom := inv f.hom
mul_hom := by
simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, ← tensor_comp_assoc,
IsIso.inv_hom_id, tensor_id, Category.id_comp] },
by aesop_cat⟩⟩
/-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X ≅ N.X) (one_f : M.one ≫ f.hom = N.one)
(mul_f : M.mul ≫ f.hom = (f.hom ⊗ f.hom) ≫ N.mul) : M ≅ N where
hom :=
{ hom := f.hom
one_hom := one_f
mul_hom := mul_f }
inv :=
{ hom := f.inv
one_hom := by rw [← one_f]; simp
mul_hom := by
rw [← cancel_mono f.hom]
slice_rhs 2 3 => rw [mul_f]
simp }
#align Mon_.iso_of_iso Mon_.isoOfIso
instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C ⟶ A) where
default :=
{ hom := A.one
one_hom := by dsimp; simp
mul_hom := by dsimp; simp [A.one_mul, unitors_equal] }
uniq f := by
ext; simp
rw [← Category.id_comp f.hom]
erw [f.one_hom]
#align Mon_.unique_hom_from_trivial Mon_.uniqueHomFromTrivial
open CategoryTheory.Limits
instance : HasInitial (Mon_ C) :=
hasInitial_of_unique (trivial C)
end Mon_
namespace CategoryTheory.LaxMonoidalFunctor
variable {C} {D : Type u₂} [Category.{v₂} D] [MonoidalCategory.{v₂} D]
-- TODO: mapMod F A : Mod A ⥤ Mod (F.mapMon A)
/-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one]
rw [F.toFunctor.map_id]
rw [F.right_unitality]
mul_assoc := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_assoc]
conv_lhs => | rw [F.toFunctor.map_id] | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one]
rw [F.toFunctor.map_id]
rw [F.right_unitality]
mul_assoc := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_assoc]
conv_lhs => | Mathlib.CategoryTheory.Monoidal.Mon_.202_0.NTUMzhXPwXsmsYt | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A | Mathlib_CategoryTheory_Monoidal_Mon_ |
C : Type u₁
inst✝³ : Category.{v₁, u₁} C
inst✝² : MonoidalCategory C
D : Type u₂
inst✝¹ : Category.{v₂, u₂} D
inst✝ : MonoidalCategory D
F : LaxMonoidalFunctor C D
A : Mon_ C
| (μ F A.X A.X ⊗ F.map (𝟙 A.X)) ≫ μ F (A.X ⊗ A.X) A.X ≫ F.map ((α_ A.X A.X A.X).hom ≫ (𝟙 A.X ⊗ A.mul) ≫ A.mul) | /-
Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/
import Mathlib.CategoryTheory.Monoidal.Braided
import Mathlib.CategoryTheory.Monoidal.Discrete
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
import Mathlib.Algebra.PUnitInstances
#align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c"
/-!
# The category of monoids in a monoidal category.
We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to
the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if
`C` is braided, then the category of monoids is naturally monoidal.
-/
set_option linter.uppercaseLean3 false
universe v₁ v₂ u₁ u₂ u
open CategoryTheory MonoidalCategory
variable (C : Type u₁) [Category.{v₁} C] [MonoidalCategory.{v₁} C]
/-- A monoid object internal to a monoidal category.
When the monoidal category is preadditive, this is also sometimes called an "algebra object".
-/
structure Mon_ where
X : C
one : 𝟙_ C ⟶ X
mul : X ⊗ X ⟶ X
one_mul : (one ⊗ 𝟙 X) ≫ mul = (λ_ X).hom := by aesop_cat
mul_one : (𝟙 X ⊗ one) ≫ mul = (ρ_ X).hom := by aesop_cat
-- Obviously there is some flexibility stating this axiom.
-- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`,
-- and chooses to place the associator on the right-hand side.
-- The heuristic is that unitors and associators "don't have much weight".
mul_assoc : (mul ⊗ 𝟙 X) ≫ mul = (α_ X X X).hom ≫ (𝟙 X ⊗ mul) ≫ mul := by aesop_cat
#align Mon_ Mon_
attribute [reassoc] Mon_.one_mul Mon_.mul_one
-- We prove a more general `@[simp]` lemma below.
attribute [reassoc (attr := simp)] Mon_.mul_assoc
namespace Mon_
/-- The trivial monoid object. We later show this is initial in `Mon_ C`.
-/
@[simps]
def trivial : Mon_ C where
X := 𝟙_ C
one := 𝟙 _
mul := (λ_ _).hom
mul_assoc := by coherence
mul_one := by coherence
#align Mon_.trivial Mon_.trivial
instance : Inhabited (Mon_ C) :=
⟨trivial C⟩
variable {C}
variable {M : Mon_ C}
@[simp]
theorem one_mul_hom {Z : C} (f : Z ⟶ M.X) : (M.one ⊗ f) ≫ M.mul = (λ_ Z).hom ≫ f := by
rw [← id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality]
#align Mon_.one_mul_hom Mon_.one_mul_hom
@[simp]
theorem mul_one_hom {Z : C} (f : Z ⟶ M.X) : (f ⊗ M.one) ≫ M.mul = (ρ_ Z).hom ≫ f := by
rw [← tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality]
#align Mon_.mul_one_hom Mon_.mul_one_hom
theorem assoc_flip :
(𝟙 M.X ⊗ M.mul) ≫ M.mul = (α_ M.X M.X M.X).inv ≫ (M.mul ⊗ 𝟙 M.X) ≫ M.mul := by simp
#align Mon_.assoc_flip Mon_.assoc_flip
/-- A morphism of monoid objects. -/
@[ext]
structure Hom (M N : Mon_ C) where
hom : M.X ⟶ N.X
one_hom : M.one ≫ hom = N.one := by aesop_cat
mul_hom : M.mul ≫ hom = (hom ⊗ hom) ≫ N.mul := by aesop_cat
#align Mon_.hom Mon_.Hom
attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom
/-- The identity morphism on a monoid object. -/
@[simps]
def id (M : Mon_ C) : Hom M M where
hom := 𝟙 M.X
#align Mon_.id Mon_.id
instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) :=
⟨id M⟩
#align Mon_.hom_inhabited Mon_.homInhabited
/-- Composition of morphisms of monoid objects. -/
@[simps]
def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where
hom := f.hom ≫ g.hom
#align Mon_.comp Mon_.comp
instance : Category (Mon_ C) where
Hom M N := Hom M N
id := id
comp f g := comp f g
-- Porting note: added, as `Hom.ext` does not apply to a morphism.
@[ext]
lemma ext {X Y : Mon_ C} {f g : X ⟶ Y} (w : f.hom = g.hom) : f = g :=
Hom.ext _ _ w
@[simp]
theorem id_hom' (M : Mon_ C) : (𝟙 M : Hom M M).hom = 𝟙 M.X :=
rfl
#align Mon_.id_hom' Mon_.id_hom'
@[simp]
theorem comp_hom' {M N K : Mon_ C} (f : M ⟶ N) (g : N ⟶ K) :
(f ≫ g : Hom M K).hom = f.hom ≫ g.hom :=
rfl
#align Mon_.comp_hom' Mon_.comp_hom'
section
variable (C)
/-- The forgetful functor from monoid objects to the ambient category. -/
@[simps]
def forget : Mon_ C ⥤ C where
obj A := A.X
map f := f.hom
#align Mon_.forget Mon_.forget
end
instance forget_faithful : Faithful (@forget C _ _) where
#align Mon_.forget_faithful Mon_.forget_faithful
instance {A B : Mon_ C} (f : A ⟶ B) [e : IsIso ((forget C).map f)] : IsIso f.hom :=
e
/-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/
instance : ReflectsIsomorphisms (forget C) where
reflects f e :=
⟨⟨{ hom := inv f.hom
mul_hom := by
simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, ← tensor_comp_assoc,
IsIso.inv_hom_id, tensor_id, Category.id_comp] },
by aesop_cat⟩⟩
/-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X ≅ N.X) (one_f : M.one ≫ f.hom = N.one)
(mul_f : M.mul ≫ f.hom = (f.hom ⊗ f.hom) ≫ N.mul) : M ≅ N where
hom :=
{ hom := f.hom
one_hom := one_f
mul_hom := mul_f }
inv :=
{ hom := f.inv
one_hom := by rw [← one_f]; simp
mul_hom := by
rw [← cancel_mono f.hom]
slice_rhs 2 3 => rw [mul_f]
simp }
#align Mon_.iso_of_iso Mon_.isoOfIso
instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C ⟶ A) where
default :=
{ hom := A.one
one_hom := by dsimp; simp
mul_hom := by dsimp; simp [A.one_mul, unitors_equal] }
uniq f := by
ext; simp
rw [← Category.id_comp f.hom]
erw [f.one_hom]
#align Mon_.unique_hom_from_trivial Mon_.uniqueHomFromTrivial
open CategoryTheory.Limits
instance : HasInitial (Mon_ C) :=
hasInitial_of_unique (trivial C)
end Mon_
namespace CategoryTheory.LaxMonoidalFunctor
variable {C} {D : Type u₂} [Category.{v₂} D] [MonoidalCategory.{v₂} D]
-- TODO: mapMod F A : Mod A ⥤ Mod (F.mapMon A)
/-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one]
rw [F.toFunctor.map_id]
rw [F.right_unitality]
mul_assoc := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_assoc]
conv_lhs => | rw [F.toFunctor.map_id] | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one]
rw [F.toFunctor.map_id]
rw [F.right_unitality]
mul_assoc := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_assoc]
conv_lhs => | Mathlib.CategoryTheory.Monoidal.Mon_.202_0.NTUMzhXPwXsmsYt | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A | Mathlib_CategoryTheory_Monoidal_Mon_ |
C : Type u₁
inst✝³ : Category.{v₁, u₁} C
inst✝² : MonoidalCategory C
D : Type u₂
inst✝¹ : Category.{v₂, u₂} D
inst✝ : MonoidalCategory D
F : LaxMonoidalFunctor C D
A : Mon_ C
⊢ (μ F A.X A.X ⊗ 𝟙 (F.obj A.X)) ≫ μ F (A.X ⊗ A.X) A.X ≫ F.map ((α_ A.X A.X A.X).hom ≫ (𝟙 A.X ⊗ A.mul) ≫ A.mul) =
(α_ (F.obj A.X) (F.obj A.X) (F.obj A.X)).hom ≫
(𝟙 (F.obj A.X) ⊗ μ F A.X A.X ≫ F.map A.mul) ≫ μ F A.X A.X ≫ F.map A.mul | /-
Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/
import Mathlib.CategoryTheory.Monoidal.Braided
import Mathlib.CategoryTheory.Monoidal.Discrete
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
import Mathlib.Algebra.PUnitInstances
#align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c"
/-!
# The category of monoids in a monoidal category.
We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to
the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if
`C` is braided, then the category of monoids is naturally monoidal.
-/
set_option linter.uppercaseLean3 false
universe v₁ v₂ u₁ u₂ u
open CategoryTheory MonoidalCategory
variable (C : Type u₁) [Category.{v₁} C] [MonoidalCategory.{v₁} C]
/-- A monoid object internal to a monoidal category.
When the monoidal category is preadditive, this is also sometimes called an "algebra object".
-/
structure Mon_ where
X : C
one : 𝟙_ C ⟶ X
mul : X ⊗ X ⟶ X
one_mul : (one ⊗ 𝟙 X) ≫ mul = (λ_ X).hom := by aesop_cat
mul_one : (𝟙 X ⊗ one) ≫ mul = (ρ_ X).hom := by aesop_cat
-- Obviously there is some flexibility stating this axiom.
-- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`,
-- and chooses to place the associator on the right-hand side.
-- The heuristic is that unitors and associators "don't have much weight".
mul_assoc : (mul ⊗ 𝟙 X) ≫ mul = (α_ X X X).hom ≫ (𝟙 X ⊗ mul) ≫ mul := by aesop_cat
#align Mon_ Mon_
attribute [reassoc] Mon_.one_mul Mon_.mul_one
-- We prove a more general `@[simp]` lemma below.
attribute [reassoc (attr := simp)] Mon_.mul_assoc
namespace Mon_
/-- The trivial monoid object. We later show this is initial in `Mon_ C`.
-/
@[simps]
def trivial : Mon_ C where
X := 𝟙_ C
one := 𝟙 _
mul := (λ_ _).hom
mul_assoc := by coherence
mul_one := by coherence
#align Mon_.trivial Mon_.trivial
instance : Inhabited (Mon_ C) :=
⟨trivial C⟩
variable {C}
variable {M : Mon_ C}
@[simp]
theorem one_mul_hom {Z : C} (f : Z ⟶ M.X) : (M.one ⊗ f) ≫ M.mul = (λ_ Z).hom ≫ f := by
rw [← id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality]
#align Mon_.one_mul_hom Mon_.one_mul_hom
@[simp]
theorem mul_one_hom {Z : C} (f : Z ⟶ M.X) : (f ⊗ M.one) ≫ M.mul = (ρ_ Z).hom ≫ f := by
rw [← tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality]
#align Mon_.mul_one_hom Mon_.mul_one_hom
theorem assoc_flip :
(𝟙 M.X ⊗ M.mul) ≫ M.mul = (α_ M.X M.X M.X).inv ≫ (M.mul ⊗ 𝟙 M.X) ≫ M.mul := by simp
#align Mon_.assoc_flip Mon_.assoc_flip
/-- A morphism of monoid objects. -/
@[ext]
structure Hom (M N : Mon_ C) where
hom : M.X ⟶ N.X
one_hom : M.one ≫ hom = N.one := by aesop_cat
mul_hom : M.mul ≫ hom = (hom ⊗ hom) ≫ N.mul := by aesop_cat
#align Mon_.hom Mon_.Hom
attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom
/-- The identity morphism on a monoid object. -/
@[simps]
def id (M : Mon_ C) : Hom M M where
hom := 𝟙 M.X
#align Mon_.id Mon_.id
instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) :=
⟨id M⟩
#align Mon_.hom_inhabited Mon_.homInhabited
/-- Composition of morphisms of monoid objects. -/
@[simps]
def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where
hom := f.hom ≫ g.hom
#align Mon_.comp Mon_.comp
instance : Category (Mon_ C) where
Hom M N := Hom M N
id := id
comp f g := comp f g
-- Porting note: added, as `Hom.ext` does not apply to a morphism.
@[ext]
lemma ext {X Y : Mon_ C} {f g : X ⟶ Y} (w : f.hom = g.hom) : f = g :=
Hom.ext _ _ w
@[simp]
theorem id_hom' (M : Mon_ C) : (𝟙 M : Hom M M).hom = 𝟙 M.X :=
rfl
#align Mon_.id_hom' Mon_.id_hom'
@[simp]
theorem comp_hom' {M N K : Mon_ C} (f : M ⟶ N) (g : N ⟶ K) :
(f ≫ g : Hom M K).hom = f.hom ≫ g.hom :=
rfl
#align Mon_.comp_hom' Mon_.comp_hom'
section
variable (C)
/-- The forgetful functor from monoid objects to the ambient category. -/
@[simps]
def forget : Mon_ C ⥤ C where
obj A := A.X
map f := f.hom
#align Mon_.forget Mon_.forget
end
instance forget_faithful : Faithful (@forget C _ _) where
#align Mon_.forget_faithful Mon_.forget_faithful
instance {A B : Mon_ C} (f : A ⟶ B) [e : IsIso ((forget C).map f)] : IsIso f.hom :=
e
/-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/
instance : ReflectsIsomorphisms (forget C) where
reflects f e :=
⟨⟨{ hom := inv f.hom
mul_hom := by
simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, ← tensor_comp_assoc,
IsIso.inv_hom_id, tensor_id, Category.id_comp] },
by aesop_cat⟩⟩
/-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X ≅ N.X) (one_f : M.one ≫ f.hom = N.one)
(mul_f : M.mul ≫ f.hom = (f.hom ⊗ f.hom) ≫ N.mul) : M ≅ N where
hom :=
{ hom := f.hom
one_hom := one_f
mul_hom := mul_f }
inv :=
{ hom := f.inv
one_hom := by rw [← one_f]; simp
mul_hom := by
rw [← cancel_mono f.hom]
slice_rhs 2 3 => rw [mul_f]
simp }
#align Mon_.iso_of_iso Mon_.isoOfIso
instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C ⟶ A) where
default :=
{ hom := A.one
one_hom := by dsimp; simp
mul_hom := by dsimp; simp [A.one_mul, unitors_equal] }
uniq f := by
ext; simp
rw [← Category.id_comp f.hom]
erw [f.one_hom]
#align Mon_.unique_hom_from_trivial Mon_.uniqueHomFromTrivial
open CategoryTheory.Limits
instance : HasInitial (Mon_ C) :=
hasInitial_of_unique (trivial C)
end Mon_
namespace CategoryTheory.LaxMonoidalFunctor
variable {C} {D : Type u₂} [Category.{v₂} D] [MonoidalCategory.{v₂} D]
-- TODO: mapMod F A : Mod A ⥤ Mod (F.mapMon A)
/-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one]
rw [F.toFunctor.map_id]
rw [F.right_unitality]
mul_assoc := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_assoc]
conv_lhs => rw [F.toFunctor.map_id]
| conv_lhs => rw [F.toFunctor.map_comp, F.toFunctor.map_comp] | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one]
rw [F.toFunctor.map_id]
rw [F.right_unitality]
mul_assoc := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_assoc]
conv_lhs => rw [F.toFunctor.map_id]
| Mathlib.CategoryTheory.Monoidal.Mon_.202_0.NTUMzhXPwXsmsYt | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A | Mathlib_CategoryTheory_Monoidal_Mon_ |
C : Type u₁
inst✝³ : Category.{v₁, u₁} C
inst✝² : MonoidalCategory C
D : Type u₂
inst✝¹ : Category.{v₂, u₂} D
inst✝ : MonoidalCategory D
F : LaxMonoidalFunctor C D
A : Mon_ C
| (μ F A.X A.X ⊗ 𝟙 (F.obj A.X)) ≫ μ F (A.X ⊗ A.X) A.X ≫ F.map ((α_ A.X A.X A.X).hom ≫ (𝟙 A.X ⊗ A.mul) ≫ A.mul) | /-
Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/
import Mathlib.CategoryTheory.Monoidal.Braided
import Mathlib.CategoryTheory.Monoidal.Discrete
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
import Mathlib.Algebra.PUnitInstances
#align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c"
/-!
# The category of monoids in a monoidal category.
We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to
the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if
`C` is braided, then the category of monoids is naturally monoidal.
-/
set_option linter.uppercaseLean3 false
universe v₁ v₂ u₁ u₂ u
open CategoryTheory MonoidalCategory
variable (C : Type u₁) [Category.{v₁} C] [MonoidalCategory.{v₁} C]
/-- A monoid object internal to a monoidal category.
When the monoidal category is preadditive, this is also sometimes called an "algebra object".
-/
structure Mon_ where
X : C
one : 𝟙_ C ⟶ X
mul : X ⊗ X ⟶ X
one_mul : (one ⊗ 𝟙 X) ≫ mul = (λ_ X).hom := by aesop_cat
mul_one : (𝟙 X ⊗ one) ≫ mul = (ρ_ X).hom := by aesop_cat
-- Obviously there is some flexibility stating this axiom.
-- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`,
-- and chooses to place the associator on the right-hand side.
-- The heuristic is that unitors and associators "don't have much weight".
mul_assoc : (mul ⊗ 𝟙 X) ≫ mul = (α_ X X X).hom ≫ (𝟙 X ⊗ mul) ≫ mul := by aesop_cat
#align Mon_ Mon_
attribute [reassoc] Mon_.one_mul Mon_.mul_one
-- We prove a more general `@[simp]` lemma below.
attribute [reassoc (attr := simp)] Mon_.mul_assoc
namespace Mon_
/-- The trivial monoid object. We later show this is initial in `Mon_ C`.
-/
@[simps]
def trivial : Mon_ C where
X := 𝟙_ C
one := 𝟙 _
mul := (λ_ _).hom
mul_assoc := by coherence
mul_one := by coherence
#align Mon_.trivial Mon_.trivial
instance : Inhabited (Mon_ C) :=
⟨trivial C⟩
variable {C}
variable {M : Mon_ C}
@[simp]
theorem one_mul_hom {Z : C} (f : Z ⟶ M.X) : (M.one ⊗ f) ≫ M.mul = (λ_ Z).hom ≫ f := by
rw [← id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality]
#align Mon_.one_mul_hom Mon_.one_mul_hom
@[simp]
theorem mul_one_hom {Z : C} (f : Z ⟶ M.X) : (f ⊗ M.one) ≫ M.mul = (ρ_ Z).hom ≫ f := by
rw [← tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality]
#align Mon_.mul_one_hom Mon_.mul_one_hom
theorem assoc_flip :
(𝟙 M.X ⊗ M.mul) ≫ M.mul = (α_ M.X M.X M.X).inv ≫ (M.mul ⊗ 𝟙 M.X) ≫ M.mul := by simp
#align Mon_.assoc_flip Mon_.assoc_flip
/-- A morphism of monoid objects. -/
@[ext]
structure Hom (M N : Mon_ C) where
hom : M.X ⟶ N.X
one_hom : M.one ≫ hom = N.one := by aesop_cat
mul_hom : M.mul ≫ hom = (hom ⊗ hom) ≫ N.mul := by aesop_cat
#align Mon_.hom Mon_.Hom
attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom
/-- The identity morphism on a monoid object. -/
@[simps]
def id (M : Mon_ C) : Hom M M where
hom := 𝟙 M.X
#align Mon_.id Mon_.id
instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) :=
⟨id M⟩
#align Mon_.hom_inhabited Mon_.homInhabited
/-- Composition of morphisms of monoid objects. -/
@[simps]
def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where
hom := f.hom ≫ g.hom
#align Mon_.comp Mon_.comp
instance : Category (Mon_ C) where
Hom M N := Hom M N
id := id
comp f g := comp f g
-- Porting note: added, as `Hom.ext` does not apply to a morphism.
@[ext]
lemma ext {X Y : Mon_ C} {f g : X ⟶ Y} (w : f.hom = g.hom) : f = g :=
Hom.ext _ _ w
@[simp]
theorem id_hom' (M : Mon_ C) : (𝟙 M : Hom M M).hom = 𝟙 M.X :=
rfl
#align Mon_.id_hom' Mon_.id_hom'
@[simp]
theorem comp_hom' {M N K : Mon_ C} (f : M ⟶ N) (g : N ⟶ K) :
(f ≫ g : Hom M K).hom = f.hom ≫ g.hom :=
rfl
#align Mon_.comp_hom' Mon_.comp_hom'
section
variable (C)
/-- The forgetful functor from monoid objects to the ambient category. -/
@[simps]
def forget : Mon_ C ⥤ C where
obj A := A.X
map f := f.hom
#align Mon_.forget Mon_.forget
end
instance forget_faithful : Faithful (@forget C _ _) where
#align Mon_.forget_faithful Mon_.forget_faithful
instance {A B : Mon_ C} (f : A ⟶ B) [e : IsIso ((forget C).map f)] : IsIso f.hom :=
e
/-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/
instance : ReflectsIsomorphisms (forget C) where
reflects f e :=
⟨⟨{ hom := inv f.hom
mul_hom := by
simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, ← tensor_comp_assoc,
IsIso.inv_hom_id, tensor_id, Category.id_comp] },
by aesop_cat⟩⟩
/-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X ≅ N.X) (one_f : M.one ≫ f.hom = N.one)
(mul_f : M.mul ≫ f.hom = (f.hom ⊗ f.hom) ≫ N.mul) : M ≅ N where
hom :=
{ hom := f.hom
one_hom := one_f
mul_hom := mul_f }
inv :=
{ hom := f.inv
one_hom := by rw [← one_f]; simp
mul_hom := by
rw [← cancel_mono f.hom]
slice_rhs 2 3 => rw [mul_f]
simp }
#align Mon_.iso_of_iso Mon_.isoOfIso
instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C ⟶ A) where
default :=
{ hom := A.one
one_hom := by dsimp; simp
mul_hom := by dsimp; simp [A.one_mul, unitors_equal] }
uniq f := by
ext; simp
rw [← Category.id_comp f.hom]
erw [f.one_hom]
#align Mon_.unique_hom_from_trivial Mon_.uniqueHomFromTrivial
open CategoryTheory.Limits
instance : HasInitial (Mon_ C) :=
hasInitial_of_unique (trivial C)
end Mon_
namespace CategoryTheory.LaxMonoidalFunctor
variable {C} {D : Type u₂} [Category.{v₂} D] [MonoidalCategory.{v₂} D]
-- TODO: mapMod F A : Mod A ⥤ Mod (F.mapMon A)
/-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one]
rw [F.toFunctor.map_id]
rw [F.right_unitality]
mul_assoc := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_assoc]
conv_lhs => rw [F.toFunctor.map_id]
conv_lhs => | rw [F.toFunctor.map_comp, F.toFunctor.map_comp] | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one]
rw [F.toFunctor.map_id]
rw [F.right_unitality]
mul_assoc := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_assoc]
conv_lhs => rw [F.toFunctor.map_id]
conv_lhs => | Mathlib.CategoryTheory.Monoidal.Mon_.202_0.NTUMzhXPwXsmsYt | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A | Mathlib_CategoryTheory_Monoidal_Mon_ |
C : Type u₁
inst✝³ : Category.{v₁, u₁} C
inst✝² : MonoidalCategory C
D : Type u₂
inst✝¹ : Category.{v₂, u₂} D
inst✝ : MonoidalCategory D
F : LaxMonoidalFunctor C D
A : Mon_ C
| (μ F A.X A.X ⊗ 𝟙 (F.obj A.X)) ≫ μ F (A.X ⊗ A.X) A.X ≫ F.map ((α_ A.X A.X A.X).hom ≫ (𝟙 A.X ⊗ A.mul) ≫ A.mul) | /-
Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/
import Mathlib.CategoryTheory.Monoidal.Braided
import Mathlib.CategoryTheory.Monoidal.Discrete
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
import Mathlib.Algebra.PUnitInstances
#align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c"
/-!
# The category of monoids in a monoidal category.
We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to
the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if
`C` is braided, then the category of monoids is naturally monoidal.
-/
set_option linter.uppercaseLean3 false
universe v₁ v₂ u₁ u₂ u
open CategoryTheory MonoidalCategory
variable (C : Type u₁) [Category.{v₁} C] [MonoidalCategory.{v₁} C]
/-- A monoid object internal to a monoidal category.
When the monoidal category is preadditive, this is also sometimes called an "algebra object".
-/
structure Mon_ where
X : C
one : 𝟙_ C ⟶ X
mul : X ⊗ X ⟶ X
one_mul : (one ⊗ 𝟙 X) ≫ mul = (λ_ X).hom := by aesop_cat
mul_one : (𝟙 X ⊗ one) ≫ mul = (ρ_ X).hom := by aesop_cat
-- Obviously there is some flexibility stating this axiom.
-- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`,
-- and chooses to place the associator on the right-hand side.
-- The heuristic is that unitors and associators "don't have much weight".
mul_assoc : (mul ⊗ 𝟙 X) ≫ mul = (α_ X X X).hom ≫ (𝟙 X ⊗ mul) ≫ mul := by aesop_cat
#align Mon_ Mon_
attribute [reassoc] Mon_.one_mul Mon_.mul_one
-- We prove a more general `@[simp]` lemma below.
attribute [reassoc (attr := simp)] Mon_.mul_assoc
namespace Mon_
/-- The trivial monoid object. We later show this is initial in `Mon_ C`.
-/
@[simps]
def trivial : Mon_ C where
X := 𝟙_ C
one := 𝟙 _
mul := (λ_ _).hom
mul_assoc := by coherence
mul_one := by coherence
#align Mon_.trivial Mon_.trivial
instance : Inhabited (Mon_ C) :=
⟨trivial C⟩
variable {C}
variable {M : Mon_ C}
@[simp]
theorem one_mul_hom {Z : C} (f : Z ⟶ M.X) : (M.one ⊗ f) ≫ M.mul = (λ_ Z).hom ≫ f := by
rw [← id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality]
#align Mon_.one_mul_hom Mon_.one_mul_hom
@[simp]
theorem mul_one_hom {Z : C} (f : Z ⟶ M.X) : (f ⊗ M.one) ≫ M.mul = (ρ_ Z).hom ≫ f := by
rw [← tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality]
#align Mon_.mul_one_hom Mon_.mul_one_hom
theorem assoc_flip :
(𝟙 M.X ⊗ M.mul) ≫ M.mul = (α_ M.X M.X M.X).inv ≫ (M.mul ⊗ 𝟙 M.X) ≫ M.mul := by simp
#align Mon_.assoc_flip Mon_.assoc_flip
/-- A morphism of monoid objects. -/
@[ext]
structure Hom (M N : Mon_ C) where
hom : M.X ⟶ N.X
one_hom : M.one ≫ hom = N.one := by aesop_cat
mul_hom : M.mul ≫ hom = (hom ⊗ hom) ≫ N.mul := by aesop_cat
#align Mon_.hom Mon_.Hom
attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom
/-- The identity morphism on a monoid object. -/
@[simps]
def id (M : Mon_ C) : Hom M M where
hom := 𝟙 M.X
#align Mon_.id Mon_.id
instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) :=
⟨id M⟩
#align Mon_.hom_inhabited Mon_.homInhabited
/-- Composition of morphisms of monoid objects. -/
@[simps]
def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where
hom := f.hom ≫ g.hom
#align Mon_.comp Mon_.comp
instance : Category (Mon_ C) where
Hom M N := Hom M N
id := id
comp f g := comp f g
-- Porting note: added, as `Hom.ext` does not apply to a morphism.
@[ext]
lemma ext {X Y : Mon_ C} {f g : X ⟶ Y} (w : f.hom = g.hom) : f = g :=
Hom.ext _ _ w
@[simp]
theorem id_hom' (M : Mon_ C) : (𝟙 M : Hom M M).hom = 𝟙 M.X :=
rfl
#align Mon_.id_hom' Mon_.id_hom'
@[simp]
theorem comp_hom' {M N K : Mon_ C} (f : M ⟶ N) (g : N ⟶ K) :
(f ≫ g : Hom M K).hom = f.hom ≫ g.hom :=
rfl
#align Mon_.comp_hom' Mon_.comp_hom'
section
variable (C)
/-- The forgetful functor from monoid objects to the ambient category. -/
@[simps]
def forget : Mon_ C ⥤ C where
obj A := A.X
map f := f.hom
#align Mon_.forget Mon_.forget
end
instance forget_faithful : Faithful (@forget C _ _) where
#align Mon_.forget_faithful Mon_.forget_faithful
instance {A B : Mon_ C} (f : A ⟶ B) [e : IsIso ((forget C).map f)] : IsIso f.hom :=
e
/-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/
instance : ReflectsIsomorphisms (forget C) where
reflects f e :=
⟨⟨{ hom := inv f.hom
mul_hom := by
simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, ← tensor_comp_assoc,
IsIso.inv_hom_id, tensor_id, Category.id_comp] },
by aesop_cat⟩⟩
/-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X ≅ N.X) (one_f : M.one ≫ f.hom = N.one)
(mul_f : M.mul ≫ f.hom = (f.hom ⊗ f.hom) ≫ N.mul) : M ≅ N where
hom :=
{ hom := f.hom
one_hom := one_f
mul_hom := mul_f }
inv :=
{ hom := f.inv
one_hom := by rw [← one_f]; simp
mul_hom := by
rw [← cancel_mono f.hom]
slice_rhs 2 3 => rw [mul_f]
simp }
#align Mon_.iso_of_iso Mon_.isoOfIso
instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C ⟶ A) where
default :=
{ hom := A.one
one_hom := by dsimp; simp
mul_hom := by dsimp; simp [A.one_mul, unitors_equal] }
uniq f := by
ext; simp
rw [← Category.id_comp f.hom]
erw [f.one_hom]
#align Mon_.unique_hom_from_trivial Mon_.uniqueHomFromTrivial
open CategoryTheory.Limits
instance : HasInitial (Mon_ C) :=
hasInitial_of_unique (trivial C)
end Mon_
namespace CategoryTheory.LaxMonoidalFunctor
variable {C} {D : Type u₂} [Category.{v₂} D] [MonoidalCategory.{v₂} D]
-- TODO: mapMod F A : Mod A ⥤ Mod (F.mapMon A)
/-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one]
rw [F.toFunctor.map_id]
rw [F.right_unitality]
mul_assoc := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_assoc]
conv_lhs => rw [F.toFunctor.map_id]
conv_lhs => | rw [F.toFunctor.map_comp, F.toFunctor.map_comp] | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one]
rw [F.toFunctor.map_id]
rw [F.right_unitality]
mul_assoc := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_assoc]
conv_lhs => rw [F.toFunctor.map_id]
conv_lhs => | Mathlib.CategoryTheory.Monoidal.Mon_.202_0.NTUMzhXPwXsmsYt | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A | Mathlib_CategoryTheory_Monoidal_Mon_ |
C : Type u₁
inst✝³ : Category.{v₁, u₁} C
inst✝² : MonoidalCategory C
D : Type u₂
inst✝¹ : Category.{v₂, u₂} D
inst✝ : MonoidalCategory D
F : LaxMonoidalFunctor C D
A : Mon_ C
| (μ F A.X A.X ⊗ 𝟙 (F.obj A.X)) ≫ μ F (A.X ⊗ A.X) A.X ≫ F.map ((α_ A.X A.X A.X).hom ≫ (𝟙 A.X ⊗ A.mul) ≫ A.mul) | /-
Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/
import Mathlib.CategoryTheory.Monoidal.Braided
import Mathlib.CategoryTheory.Monoidal.Discrete
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
import Mathlib.Algebra.PUnitInstances
#align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c"
/-!
# The category of monoids in a monoidal category.
We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to
the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if
`C` is braided, then the category of monoids is naturally monoidal.
-/
set_option linter.uppercaseLean3 false
universe v₁ v₂ u₁ u₂ u
open CategoryTheory MonoidalCategory
variable (C : Type u₁) [Category.{v₁} C] [MonoidalCategory.{v₁} C]
/-- A monoid object internal to a monoidal category.
When the monoidal category is preadditive, this is also sometimes called an "algebra object".
-/
structure Mon_ where
X : C
one : 𝟙_ C ⟶ X
mul : X ⊗ X ⟶ X
one_mul : (one ⊗ 𝟙 X) ≫ mul = (λ_ X).hom := by aesop_cat
mul_one : (𝟙 X ⊗ one) ≫ mul = (ρ_ X).hom := by aesop_cat
-- Obviously there is some flexibility stating this axiom.
-- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`,
-- and chooses to place the associator on the right-hand side.
-- The heuristic is that unitors and associators "don't have much weight".
mul_assoc : (mul ⊗ 𝟙 X) ≫ mul = (α_ X X X).hom ≫ (𝟙 X ⊗ mul) ≫ mul := by aesop_cat
#align Mon_ Mon_
attribute [reassoc] Mon_.one_mul Mon_.mul_one
-- We prove a more general `@[simp]` lemma below.
attribute [reassoc (attr := simp)] Mon_.mul_assoc
namespace Mon_
/-- The trivial monoid object. We later show this is initial in `Mon_ C`.
-/
@[simps]
def trivial : Mon_ C where
X := 𝟙_ C
one := 𝟙 _
mul := (λ_ _).hom
mul_assoc := by coherence
mul_one := by coherence
#align Mon_.trivial Mon_.trivial
instance : Inhabited (Mon_ C) :=
⟨trivial C⟩
variable {C}
variable {M : Mon_ C}
@[simp]
theorem one_mul_hom {Z : C} (f : Z ⟶ M.X) : (M.one ⊗ f) ≫ M.mul = (λ_ Z).hom ≫ f := by
rw [← id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality]
#align Mon_.one_mul_hom Mon_.one_mul_hom
@[simp]
theorem mul_one_hom {Z : C} (f : Z ⟶ M.X) : (f ⊗ M.one) ≫ M.mul = (ρ_ Z).hom ≫ f := by
rw [← tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality]
#align Mon_.mul_one_hom Mon_.mul_one_hom
theorem assoc_flip :
(𝟙 M.X ⊗ M.mul) ≫ M.mul = (α_ M.X M.X M.X).inv ≫ (M.mul ⊗ 𝟙 M.X) ≫ M.mul := by simp
#align Mon_.assoc_flip Mon_.assoc_flip
/-- A morphism of monoid objects. -/
@[ext]
structure Hom (M N : Mon_ C) where
hom : M.X ⟶ N.X
one_hom : M.one ≫ hom = N.one := by aesop_cat
mul_hom : M.mul ≫ hom = (hom ⊗ hom) ≫ N.mul := by aesop_cat
#align Mon_.hom Mon_.Hom
attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom
/-- The identity morphism on a monoid object. -/
@[simps]
def id (M : Mon_ C) : Hom M M where
hom := 𝟙 M.X
#align Mon_.id Mon_.id
instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) :=
⟨id M⟩
#align Mon_.hom_inhabited Mon_.homInhabited
/-- Composition of morphisms of monoid objects. -/
@[simps]
def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where
hom := f.hom ≫ g.hom
#align Mon_.comp Mon_.comp
instance : Category (Mon_ C) where
Hom M N := Hom M N
id := id
comp f g := comp f g
-- Porting note: added, as `Hom.ext` does not apply to a morphism.
@[ext]
lemma ext {X Y : Mon_ C} {f g : X ⟶ Y} (w : f.hom = g.hom) : f = g :=
Hom.ext _ _ w
@[simp]
theorem id_hom' (M : Mon_ C) : (𝟙 M : Hom M M).hom = 𝟙 M.X :=
rfl
#align Mon_.id_hom' Mon_.id_hom'
@[simp]
theorem comp_hom' {M N K : Mon_ C} (f : M ⟶ N) (g : N ⟶ K) :
(f ≫ g : Hom M K).hom = f.hom ≫ g.hom :=
rfl
#align Mon_.comp_hom' Mon_.comp_hom'
section
variable (C)
/-- The forgetful functor from monoid objects to the ambient category. -/
@[simps]
def forget : Mon_ C ⥤ C where
obj A := A.X
map f := f.hom
#align Mon_.forget Mon_.forget
end
instance forget_faithful : Faithful (@forget C _ _) where
#align Mon_.forget_faithful Mon_.forget_faithful
instance {A B : Mon_ C} (f : A ⟶ B) [e : IsIso ((forget C).map f)] : IsIso f.hom :=
e
/-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/
instance : ReflectsIsomorphisms (forget C) where
reflects f e :=
⟨⟨{ hom := inv f.hom
mul_hom := by
simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, ← tensor_comp_assoc,
IsIso.inv_hom_id, tensor_id, Category.id_comp] },
by aesop_cat⟩⟩
/-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X ≅ N.X) (one_f : M.one ≫ f.hom = N.one)
(mul_f : M.mul ≫ f.hom = (f.hom ⊗ f.hom) ≫ N.mul) : M ≅ N where
hom :=
{ hom := f.hom
one_hom := one_f
mul_hom := mul_f }
inv :=
{ hom := f.inv
one_hom := by rw [← one_f]; simp
mul_hom := by
rw [← cancel_mono f.hom]
slice_rhs 2 3 => rw [mul_f]
simp }
#align Mon_.iso_of_iso Mon_.isoOfIso
instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C ⟶ A) where
default :=
{ hom := A.one
one_hom := by dsimp; simp
mul_hom := by dsimp; simp [A.one_mul, unitors_equal] }
uniq f := by
ext; simp
rw [← Category.id_comp f.hom]
erw [f.one_hom]
#align Mon_.unique_hom_from_trivial Mon_.uniqueHomFromTrivial
open CategoryTheory.Limits
instance : HasInitial (Mon_ C) :=
hasInitial_of_unique (trivial C)
end Mon_
namespace CategoryTheory.LaxMonoidalFunctor
variable {C} {D : Type u₂} [Category.{v₂} D] [MonoidalCategory.{v₂} D]
-- TODO: mapMod F A : Mod A ⥤ Mod (F.mapMon A)
/-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one]
rw [F.toFunctor.map_id]
rw [F.right_unitality]
mul_assoc := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_assoc]
conv_lhs => rw [F.toFunctor.map_id]
conv_lhs => | rw [F.toFunctor.map_comp, F.toFunctor.map_comp] | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one]
rw [F.toFunctor.map_id]
rw [F.right_unitality]
mul_assoc := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_assoc]
conv_lhs => rw [F.toFunctor.map_id]
conv_lhs => | Mathlib.CategoryTheory.Monoidal.Mon_.202_0.NTUMzhXPwXsmsYt | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A | Mathlib_CategoryTheory_Monoidal_Mon_ |
C : Type u₁
inst✝³ : Category.{v₁, u₁} C
inst✝² : MonoidalCategory C
D : Type u₂
inst✝¹ : Category.{v₂, u₂} D
inst✝ : MonoidalCategory D
F : LaxMonoidalFunctor C D
A : Mon_ C
⊢ (μ F A.X A.X ⊗ 𝟙 (F.obj A.X)) ≫
μ F (A.X ⊗ A.X) A.X ≫ F.map (α_ A.X A.X A.X).hom ≫ F.map (𝟙 A.X ⊗ A.mul) ≫ F.map A.mul =
(α_ (F.obj A.X) (F.obj A.X) (F.obj A.X)).hom ≫
(𝟙 (F.obj A.X) ⊗ μ F A.X A.X ≫ F.map A.mul) ≫ μ F A.X A.X ≫ F.map A.mul | /-
Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/
import Mathlib.CategoryTheory.Monoidal.Braided
import Mathlib.CategoryTheory.Monoidal.Discrete
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
import Mathlib.Algebra.PUnitInstances
#align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c"
/-!
# The category of monoids in a monoidal category.
We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to
the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if
`C` is braided, then the category of monoids is naturally monoidal.
-/
set_option linter.uppercaseLean3 false
universe v₁ v₂ u₁ u₂ u
open CategoryTheory MonoidalCategory
variable (C : Type u₁) [Category.{v₁} C] [MonoidalCategory.{v₁} C]
/-- A monoid object internal to a monoidal category.
When the monoidal category is preadditive, this is also sometimes called an "algebra object".
-/
structure Mon_ where
X : C
one : 𝟙_ C ⟶ X
mul : X ⊗ X ⟶ X
one_mul : (one ⊗ 𝟙 X) ≫ mul = (λ_ X).hom := by aesop_cat
mul_one : (𝟙 X ⊗ one) ≫ mul = (ρ_ X).hom := by aesop_cat
-- Obviously there is some flexibility stating this axiom.
-- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`,
-- and chooses to place the associator on the right-hand side.
-- The heuristic is that unitors and associators "don't have much weight".
mul_assoc : (mul ⊗ 𝟙 X) ≫ mul = (α_ X X X).hom ≫ (𝟙 X ⊗ mul) ≫ mul := by aesop_cat
#align Mon_ Mon_
attribute [reassoc] Mon_.one_mul Mon_.mul_one
-- We prove a more general `@[simp]` lemma below.
attribute [reassoc (attr := simp)] Mon_.mul_assoc
namespace Mon_
/-- The trivial monoid object. We later show this is initial in `Mon_ C`.
-/
@[simps]
def trivial : Mon_ C where
X := 𝟙_ C
one := 𝟙 _
mul := (λ_ _).hom
mul_assoc := by coherence
mul_one := by coherence
#align Mon_.trivial Mon_.trivial
instance : Inhabited (Mon_ C) :=
⟨trivial C⟩
variable {C}
variable {M : Mon_ C}
@[simp]
theorem one_mul_hom {Z : C} (f : Z ⟶ M.X) : (M.one ⊗ f) ≫ M.mul = (λ_ Z).hom ≫ f := by
rw [← id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality]
#align Mon_.one_mul_hom Mon_.one_mul_hom
@[simp]
theorem mul_one_hom {Z : C} (f : Z ⟶ M.X) : (f ⊗ M.one) ≫ M.mul = (ρ_ Z).hom ≫ f := by
rw [← tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality]
#align Mon_.mul_one_hom Mon_.mul_one_hom
theorem assoc_flip :
(𝟙 M.X ⊗ M.mul) ≫ M.mul = (α_ M.X M.X M.X).inv ≫ (M.mul ⊗ 𝟙 M.X) ≫ M.mul := by simp
#align Mon_.assoc_flip Mon_.assoc_flip
/-- A morphism of monoid objects. -/
@[ext]
structure Hom (M N : Mon_ C) where
hom : M.X ⟶ N.X
one_hom : M.one ≫ hom = N.one := by aesop_cat
mul_hom : M.mul ≫ hom = (hom ⊗ hom) ≫ N.mul := by aesop_cat
#align Mon_.hom Mon_.Hom
attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom
/-- The identity morphism on a monoid object. -/
@[simps]
def id (M : Mon_ C) : Hom M M where
hom := 𝟙 M.X
#align Mon_.id Mon_.id
instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) :=
⟨id M⟩
#align Mon_.hom_inhabited Mon_.homInhabited
/-- Composition of morphisms of monoid objects. -/
@[simps]
def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where
hom := f.hom ≫ g.hom
#align Mon_.comp Mon_.comp
instance : Category (Mon_ C) where
Hom M N := Hom M N
id := id
comp f g := comp f g
-- Porting note: added, as `Hom.ext` does not apply to a morphism.
@[ext]
lemma ext {X Y : Mon_ C} {f g : X ⟶ Y} (w : f.hom = g.hom) : f = g :=
Hom.ext _ _ w
@[simp]
theorem id_hom' (M : Mon_ C) : (𝟙 M : Hom M M).hom = 𝟙 M.X :=
rfl
#align Mon_.id_hom' Mon_.id_hom'
@[simp]
theorem comp_hom' {M N K : Mon_ C} (f : M ⟶ N) (g : N ⟶ K) :
(f ≫ g : Hom M K).hom = f.hom ≫ g.hom :=
rfl
#align Mon_.comp_hom' Mon_.comp_hom'
section
variable (C)
/-- The forgetful functor from monoid objects to the ambient category. -/
@[simps]
def forget : Mon_ C ⥤ C where
obj A := A.X
map f := f.hom
#align Mon_.forget Mon_.forget
end
instance forget_faithful : Faithful (@forget C _ _) where
#align Mon_.forget_faithful Mon_.forget_faithful
instance {A B : Mon_ C} (f : A ⟶ B) [e : IsIso ((forget C).map f)] : IsIso f.hom :=
e
/-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/
instance : ReflectsIsomorphisms (forget C) where
reflects f e :=
⟨⟨{ hom := inv f.hom
mul_hom := by
simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, ← tensor_comp_assoc,
IsIso.inv_hom_id, tensor_id, Category.id_comp] },
by aesop_cat⟩⟩
/-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X ≅ N.X) (one_f : M.one ≫ f.hom = N.one)
(mul_f : M.mul ≫ f.hom = (f.hom ⊗ f.hom) ≫ N.mul) : M ≅ N where
hom :=
{ hom := f.hom
one_hom := one_f
mul_hom := mul_f }
inv :=
{ hom := f.inv
one_hom := by rw [← one_f]; simp
mul_hom := by
rw [← cancel_mono f.hom]
slice_rhs 2 3 => rw [mul_f]
simp }
#align Mon_.iso_of_iso Mon_.isoOfIso
instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C ⟶ A) where
default :=
{ hom := A.one
one_hom := by dsimp; simp
mul_hom := by dsimp; simp [A.one_mul, unitors_equal] }
uniq f := by
ext; simp
rw [← Category.id_comp f.hom]
erw [f.one_hom]
#align Mon_.unique_hom_from_trivial Mon_.uniqueHomFromTrivial
open CategoryTheory.Limits
instance : HasInitial (Mon_ C) :=
hasInitial_of_unique (trivial C)
end Mon_
namespace CategoryTheory.LaxMonoidalFunctor
variable {C} {D : Type u₂} [Category.{v₂} D] [MonoidalCategory.{v₂} D]
-- TODO: mapMod F A : Mod A ⥤ Mod (F.mapMon A)
/-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one]
rw [F.toFunctor.map_id]
rw [F.right_unitality]
mul_assoc := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_assoc]
conv_lhs => rw [F.toFunctor.map_id]
conv_lhs => rw [F.toFunctor.map_comp, F.toFunctor.map_comp]
| conv_rhs => rw [id_tensor_comp, ← F.toFunctor.map_id] | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one]
rw [F.toFunctor.map_id]
rw [F.right_unitality]
mul_assoc := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_assoc]
conv_lhs => rw [F.toFunctor.map_id]
conv_lhs => rw [F.toFunctor.map_comp, F.toFunctor.map_comp]
| Mathlib.CategoryTheory.Monoidal.Mon_.202_0.NTUMzhXPwXsmsYt | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A | Mathlib_CategoryTheory_Monoidal_Mon_ |
C : Type u₁
inst✝³ : Category.{v₁, u₁} C
inst✝² : MonoidalCategory C
D : Type u₂
inst✝¹ : Category.{v₂, u₂} D
inst✝ : MonoidalCategory D
F : LaxMonoidalFunctor C D
A : Mon_ C
| (α_ (F.obj A.X) (F.obj A.X) (F.obj A.X)).hom ≫ (𝟙 (F.obj A.X) ⊗ μ F A.X A.X ≫ F.map A.mul) ≫ μ F A.X A.X ≫ F.map A.mul | /-
Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/
import Mathlib.CategoryTheory.Monoidal.Braided
import Mathlib.CategoryTheory.Monoidal.Discrete
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
import Mathlib.Algebra.PUnitInstances
#align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c"
/-!
# The category of monoids in a monoidal category.
We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to
the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if
`C` is braided, then the category of monoids is naturally monoidal.
-/
set_option linter.uppercaseLean3 false
universe v₁ v₂ u₁ u₂ u
open CategoryTheory MonoidalCategory
variable (C : Type u₁) [Category.{v₁} C] [MonoidalCategory.{v₁} C]
/-- A monoid object internal to a monoidal category.
When the monoidal category is preadditive, this is also sometimes called an "algebra object".
-/
structure Mon_ where
X : C
one : 𝟙_ C ⟶ X
mul : X ⊗ X ⟶ X
one_mul : (one ⊗ 𝟙 X) ≫ mul = (λ_ X).hom := by aesop_cat
mul_one : (𝟙 X ⊗ one) ≫ mul = (ρ_ X).hom := by aesop_cat
-- Obviously there is some flexibility stating this axiom.
-- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`,
-- and chooses to place the associator on the right-hand side.
-- The heuristic is that unitors and associators "don't have much weight".
mul_assoc : (mul ⊗ 𝟙 X) ≫ mul = (α_ X X X).hom ≫ (𝟙 X ⊗ mul) ≫ mul := by aesop_cat
#align Mon_ Mon_
attribute [reassoc] Mon_.one_mul Mon_.mul_one
-- We prove a more general `@[simp]` lemma below.
attribute [reassoc (attr := simp)] Mon_.mul_assoc
namespace Mon_
/-- The trivial monoid object. We later show this is initial in `Mon_ C`.
-/
@[simps]
def trivial : Mon_ C where
X := 𝟙_ C
one := 𝟙 _
mul := (λ_ _).hom
mul_assoc := by coherence
mul_one := by coherence
#align Mon_.trivial Mon_.trivial
instance : Inhabited (Mon_ C) :=
⟨trivial C⟩
variable {C}
variable {M : Mon_ C}
@[simp]
theorem one_mul_hom {Z : C} (f : Z ⟶ M.X) : (M.one ⊗ f) ≫ M.mul = (λ_ Z).hom ≫ f := by
rw [← id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality]
#align Mon_.one_mul_hom Mon_.one_mul_hom
@[simp]
theorem mul_one_hom {Z : C} (f : Z ⟶ M.X) : (f ⊗ M.one) ≫ M.mul = (ρ_ Z).hom ≫ f := by
rw [← tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality]
#align Mon_.mul_one_hom Mon_.mul_one_hom
theorem assoc_flip :
(𝟙 M.X ⊗ M.mul) ≫ M.mul = (α_ M.X M.X M.X).inv ≫ (M.mul ⊗ 𝟙 M.X) ≫ M.mul := by simp
#align Mon_.assoc_flip Mon_.assoc_flip
/-- A morphism of monoid objects. -/
@[ext]
structure Hom (M N : Mon_ C) where
hom : M.X ⟶ N.X
one_hom : M.one ≫ hom = N.one := by aesop_cat
mul_hom : M.mul ≫ hom = (hom ⊗ hom) ≫ N.mul := by aesop_cat
#align Mon_.hom Mon_.Hom
attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom
/-- The identity morphism on a monoid object. -/
@[simps]
def id (M : Mon_ C) : Hom M M where
hom := 𝟙 M.X
#align Mon_.id Mon_.id
instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) :=
⟨id M⟩
#align Mon_.hom_inhabited Mon_.homInhabited
/-- Composition of morphisms of monoid objects. -/
@[simps]
def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where
hom := f.hom ≫ g.hom
#align Mon_.comp Mon_.comp
instance : Category (Mon_ C) where
Hom M N := Hom M N
id := id
comp f g := comp f g
-- Porting note: added, as `Hom.ext` does not apply to a morphism.
@[ext]
lemma ext {X Y : Mon_ C} {f g : X ⟶ Y} (w : f.hom = g.hom) : f = g :=
Hom.ext _ _ w
@[simp]
theorem id_hom' (M : Mon_ C) : (𝟙 M : Hom M M).hom = 𝟙 M.X :=
rfl
#align Mon_.id_hom' Mon_.id_hom'
@[simp]
theorem comp_hom' {M N K : Mon_ C} (f : M ⟶ N) (g : N ⟶ K) :
(f ≫ g : Hom M K).hom = f.hom ≫ g.hom :=
rfl
#align Mon_.comp_hom' Mon_.comp_hom'
section
variable (C)
/-- The forgetful functor from monoid objects to the ambient category. -/
@[simps]
def forget : Mon_ C ⥤ C where
obj A := A.X
map f := f.hom
#align Mon_.forget Mon_.forget
end
instance forget_faithful : Faithful (@forget C _ _) where
#align Mon_.forget_faithful Mon_.forget_faithful
instance {A B : Mon_ C} (f : A ⟶ B) [e : IsIso ((forget C).map f)] : IsIso f.hom :=
e
/-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/
instance : ReflectsIsomorphisms (forget C) where
reflects f e :=
⟨⟨{ hom := inv f.hom
mul_hom := by
simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, ← tensor_comp_assoc,
IsIso.inv_hom_id, tensor_id, Category.id_comp] },
by aesop_cat⟩⟩
/-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X ≅ N.X) (one_f : M.one ≫ f.hom = N.one)
(mul_f : M.mul ≫ f.hom = (f.hom ⊗ f.hom) ≫ N.mul) : M ≅ N where
hom :=
{ hom := f.hom
one_hom := one_f
mul_hom := mul_f }
inv :=
{ hom := f.inv
one_hom := by rw [← one_f]; simp
mul_hom := by
rw [← cancel_mono f.hom]
slice_rhs 2 3 => rw [mul_f]
simp }
#align Mon_.iso_of_iso Mon_.isoOfIso
instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C ⟶ A) where
default :=
{ hom := A.one
one_hom := by dsimp; simp
mul_hom := by dsimp; simp [A.one_mul, unitors_equal] }
uniq f := by
ext; simp
rw [← Category.id_comp f.hom]
erw [f.one_hom]
#align Mon_.unique_hom_from_trivial Mon_.uniqueHomFromTrivial
open CategoryTheory.Limits
instance : HasInitial (Mon_ C) :=
hasInitial_of_unique (trivial C)
end Mon_
namespace CategoryTheory.LaxMonoidalFunctor
variable {C} {D : Type u₂} [Category.{v₂} D] [MonoidalCategory.{v₂} D]
-- TODO: mapMod F A : Mod A ⥤ Mod (F.mapMon A)
/-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one]
rw [F.toFunctor.map_id]
rw [F.right_unitality]
mul_assoc := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_assoc]
conv_lhs => rw [F.toFunctor.map_id]
conv_lhs => rw [F.toFunctor.map_comp, F.toFunctor.map_comp]
conv_rhs => | rw [id_tensor_comp, ← F.toFunctor.map_id] | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one]
rw [F.toFunctor.map_id]
rw [F.right_unitality]
mul_assoc := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_assoc]
conv_lhs => rw [F.toFunctor.map_id]
conv_lhs => rw [F.toFunctor.map_comp, F.toFunctor.map_comp]
conv_rhs => | Mathlib.CategoryTheory.Monoidal.Mon_.202_0.NTUMzhXPwXsmsYt | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A | Mathlib_CategoryTheory_Monoidal_Mon_ |
C : Type u₁
inst✝³ : Category.{v₁, u₁} C
inst✝² : MonoidalCategory C
D : Type u₂
inst✝¹ : Category.{v₂, u₂} D
inst✝ : MonoidalCategory D
F : LaxMonoidalFunctor C D
A : Mon_ C
| (α_ (F.obj A.X) (F.obj A.X) (F.obj A.X)).hom ≫ (𝟙 (F.obj A.X) ⊗ μ F A.X A.X ≫ F.map A.mul) ≫ μ F A.X A.X ≫ F.map A.mul | /-
Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/
import Mathlib.CategoryTheory.Monoidal.Braided
import Mathlib.CategoryTheory.Monoidal.Discrete
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
import Mathlib.Algebra.PUnitInstances
#align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c"
/-!
# The category of monoids in a monoidal category.
We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to
the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if
`C` is braided, then the category of monoids is naturally monoidal.
-/
set_option linter.uppercaseLean3 false
universe v₁ v₂ u₁ u₂ u
open CategoryTheory MonoidalCategory
variable (C : Type u₁) [Category.{v₁} C] [MonoidalCategory.{v₁} C]
/-- A monoid object internal to a monoidal category.
When the monoidal category is preadditive, this is also sometimes called an "algebra object".
-/
structure Mon_ where
X : C
one : 𝟙_ C ⟶ X
mul : X ⊗ X ⟶ X
one_mul : (one ⊗ 𝟙 X) ≫ mul = (λ_ X).hom := by aesop_cat
mul_one : (𝟙 X ⊗ one) ≫ mul = (ρ_ X).hom := by aesop_cat
-- Obviously there is some flexibility stating this axiom.
-- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`,
-- and chooses to place the associator on the right-hand side.
-- The heuristic is that unitors and associators "don't have much weight".
mul_assoc : (mul ⊗ 𝟙 X) ≫ mul = (α_ X X X).hom ≫ (𝟙 X ⊗ mul) ≫ mul := by aesop_cat
#align Mon_ Mon_
attribute [reassoc] Mon_.one_mul Mon_.mul_one
-- We prove a more general `@[simp]` lemma below.
attribute [reassoc (attr := simp)] Mon_.mul_assoc
namespace Mon_
/-- The trivial monoid object. We later show this is initial in `Mon_ C`.
-/
@[simps]
def trivial : Mon_ C where
X := 𝟙_ C
one := 𝟙 _
mul := (λ_ _).hom
mul_assoc := by coherence
mul_one := by coherence
#align Mon_.trivial Mon_.trivial
instance : Inhabited (Mon_ C) :=
⟨trivial C⟩
variable {C}
variable {M : Mon_ C}
@[simp]
theorem one_mul_hom {Z : C} (f : Z ⟶ M.X) : (M.one ⊗ f) ≫ M.mul = (λ_ Z).hom ≫ f := by
rw [← id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality]
#align Mon_.one_mul_hom Mon_.one_mul_hom
@[simp]
theorem mul_one_hom {Z : C} (f : Z ⟶ M.X) : (f ⊗ M.one) ≫ M.mul = (ρ_ Z).hom ≫ f := by
rw [← tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality]
#align Mon_.mul_one_hom Mon_.mul_one_hom
theorem assoc_flip :
(𝟙 M.X ⊗ M.mul) ≫ M.mul = (α_ M.X M.X M.X).inv ≫ (M.mul ⊗ 𝟙 M.X) ≫ M.mul := by simp
#align Mon_.assoc_flip Mon_.assoc_flip
/-- A morphism of monoid objects. -/
@[ext]
structure Hom (M N : Mon_ C) where
hom : M.X ⟶ N.X
one_hom : M.one ≫ hom = N.one := by aesop_cat
mul_hom : M.mul ≫ hom = (hom ⊗ hom) ≫ N.mul := by aesop_cat
#align Mon_.hom Mon_.Hom
attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom
/-- The identity morphism on a monoid object. -/
@[simps]
def id (M : Mon_ C) : Hom M M where
hom := 𝟙 M.X
#align Mon_.id Mon_.id
instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) :=
⟨id M⟩
#align Mon_.hom_inhabited Mon_.homInhabited
/-- Composition of morphisms of monoid objects. -/
@[simps]
def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where
hom := f.hom ≫ g.hom
#align Mon_.comp Mon_.comp
instance : Category (Mon_ C) where
Hom M N := Hom M N
id := id
comp f g := comp f g
-- Porting note: added, as `Hom.ext` does not apply to a morphism.
@[ext]
lemma ext {X Y : Mon_ C} {f g : X ⟶ Y} (w : f.hom = g.hom) : f = g :=
Hom.ext _ _ w
@[simp]
theorem id_hom' (M : Mon_ C) : (𝟙 M : Hom M M).hom = 𝟙 M.X :=
rfl
#align Mon_.id_hom' Mon_.id_hom'
@[simp]
theorem comp_hom' {M N K : Mon_ C} (f : M ⟶ N) (g : N ⟶ K) :
(f ≫ g : Hom M K).hom = f.hom ≫ g.hom :=
rfl
#align Mon_.comp_hom' Mon_.comp_hom'
section
variable (C)
/-- The forgetful functor from monoid objects to the ambient category. -/
@[simps]
def forget : Mon_ C ⥤ C where
obj A := A.X
map f := f.hom
#align Mon_.forget Mon_.forget
end
instance forget_faithful : Faithful (@forget C _ _) where
#align Mon_.forget_faithful Mon_.forget_faithful
instance {A B : Mon_ C} (f : A ⟶ B) [e : IsIso ((forget C).map f)] : IsIso f.hom :=
e
/-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/
instance : ReflectsIsomorphisms (forget C) where
reflects f e :=
⟨⟨{ hom := inv f.hom
mul_hom := by
simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, ← tensor_comp_assoc,
IsIso.inv_hom_id, tensor_id, Category.id_comp] },
by aesop_cat⟩⟩
/-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X ≅ N.X) (one_f : M.one ≫ f.hom = N.one)
(mul_f : M.mul ≫ f.hom = (f.hom ⊗ f.hom) ≫ N.mul) : M ≅ N where
hom :=
{ hom := f.hom
one_hom := one_f
mul_hom := mul_f }
inv :=
{ hom := f.inv
one_hom := by rw [← one_f]; simp
mul_hom := by
rw [← cancel_mono f.hom]
slice_rhs 2 3 => rw [mul_f]
simp }
#align Mon_.iso_of_iso Mon_.isoOfIso
instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C ⟶ A) where
default :=
{ hom := A.one
one_hom := by dsimp; simp
mul_hom := by dsimp; simp [A.one_mul, unitors_equal] }
uniq f := by
ext; simp
rw [← Category.id_comp f.hom]
erw [f.one_hom]
#align Mon_.unique_hom_from_trivial Mon_.uniqueHomFromTrivial
open CategoryTheory.Limits
instance : HasInitial (Mon_ C) :=
hasInitial_of_unique (trivial C)
end Mon_
namespace CategoryTheory.LaxMonoidalFunctor
variable {C} {D : Type u₂} [Category.{v₂} D] [MonoidalCategory.{v₂} D]
-- TODO: mapMod F A : Mod A ⥤ Mod (F.mapMon A)
/-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one]
rw [F.toFunctor.map_id]
rw [F.right_unitality]
mul_assoc := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_assoc]
conv_lhs => rw [F.toFunctor.map_id]
conv_lhs => rw [F.toFunctor.map_comp, F.toFunctor.map_comp]
conv_rhs => | rw [id_tensor_comp, ← F.toFunctor.map_id] | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one]
rw [F.toFunctor.map_id]
rw [F.right_unitality]
mul_assoc := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_assoc]
conv_lhs => rw [F.toFunctor.map_id]
conv_lhs => rw [F.toFunctor.map_comp, F.toFunctor.map_comp]
conv_rhs => | Mathlib.CategoryTheory.Monoidal.Mon_.202_0.NTUMzhXPwXsmsYt | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A | Mathlib_CategoryTheory_Monoidal_Mon_ |
C : Type u₁
inst✝³ : Category.{v₁, u₁} C
inst✝² : MonoidalCategory C
D : Type u₂
inst✝¹ : Category.{v₂, u₂} D
inst✝ : MonoidalCategory D
F : LaxMonoidalFunctor C D
A : Mon_ C
| (α_ (F.obj A.X) (F.obj A.X) (F.obj A.X)).hom ≫ (𝟙 (F.obj A.X) ⊗ μ F A.X A.X ≫ F.map A.mul) ≫ μ F A.X A.X ≫ F.map A.mul | /-
Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/
import Mathlib.CategoryTheory.Monoidal.Braided
import Mathlib.CategoryTheory.Monoidal.Discrete
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
import Mathlib.Algebra.PUnitInstances
#align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c"
/-!
# The category of monoids in a monoidal category.
We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to
the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if
`C` is braided, then the category of monoids is naturally monoidal.
-/
set_option linter.uppercaseLean3 false
universe v₁ v₂ u₁ u₂ u
open CategoryTheory MonoidalCategory
variable (C : Type u₁) [Category.{v₁} C] [MonoidalCategory.{v₁} C]
/-- A monoid object internal to a monoidal category.
When the monoidal category is preadditive, this is also sometimes called an "algebra object".
-/
structure Mon_ where
X : C
one : 𝟙_ C ⟶ X
mul : X ⊗ X ⟶ X
one_mul : (one ⊗ 𝟙 X) ≫ mul = (λ_ X).hom := by aesop_cat
mul_one : (𝟙 X ⊗ one) ≫ mul = (ρ_ X).hom := by aesop_cat
-- Obviously there is some flexibility stating this axiom.
-- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`,
-- and chooses to place the associator on the right-hand side.
-- The heuristic is that unitors and associators "don't have much weight".
mul_assoc : (mul ⊗ 𝟙 X) ≫ mul = (α_ X X X).hom ≫ (𝟙 X ⊗ mul) ≫ mul := by aesop_cat
#align Mon_ Mon_
attribute [reassoc] Mon_.one_mul Mon_.mul_one
-- We prove a more general `@[simp]` lemma below.
attribute [reassoc (attr := simp)] Mon_.mul_assoc
namespace Mon_
/-- The trivial monoid object. We later show this is initial in `Mon_ C`.
-/
@[simps]
def trivial : Mon_ C where
X := 𝟙_ C
one := 𝟙 _
mul := (λ_ _).hom
mul_assoc := by coherence
mul_one := by coherence
#align Mon_.trivial Mon_.trivial
instance : Inhabited (Mon_ C) :=
⟨trivial C⟩
variable {C}
variable {M : Mon_ C}
@[simp]
theorem one_mul_hom {Z : C} (f : Z ⟶ M.X) : (M.one ⊗ f) ≫ M.mul = (λ_ Z).hom ≫ f := by
rw [← id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality]
#align Mon_.one_mul_hom Mon_.one_mul_hom
@[simp]
theorem mul_one_hom {Z : C} (f : Z ⟶ M.X) : (f ⊗ M.one) ≫ M.mul = (ρ_ Z).hom ≫ f := by
rw [← tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality]
#align Mon_.mul_one_hom Mon_.mul_one_hom
theorem assoc_flip :
(𝟙 M.X ⊗ M.mul) ≫ M.mul = (α_ M.X M.X M.X).inv ≫ (M.mul ⊗ 𝟙 M.X) ≫ M.mul := by simp
#align Mon_.assoc_flip Mon_.assoc_flip
/-- A morphism of monoid objects. -/
@[ext]
structure Hom (M N : Mon_ C) where
hom : M.X ⟶ N.X
one_hom : M.one ≫ hom = N.one := by aesop_cat
mul_hom : M.mul ≫ hom = (hom ⊗ hom) ≫ N.mul := by aesop_cat
#align Mon_.hom Mon_.Hom
attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom
/-- The identity morphism on a monoid object. -/
@[simps]
def id (M : Mon_ C) : Hom M M where
hom := 𝟙 M.X
#align Mon_.id Mon_.id
instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) :=
⟨id M⟩
#align Mon_.hom_inhabited Mon_.homInhabited
/-- Composition of morphisms of monoid objects. -/
@[simps]
def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where
hom := f.hom ≫ g.hom
#align Mon_.comp Mon_.comp
instance : Category (Mon_ C) where
Hom M N := Hom M N
id := id
comp f g := comp f g
-- Porting note: added, as `Hom.ext` does not apply to a morphism.
@[ext]
lemma ext {X Y : Mon_ C} {f g : X ⟶ Y} (w : f.hom = g.hom) : f = g :=
Hom.ext _ _ w
@[simp]
theorem id_hom' (M : Mon_ C) : (𝟙 M : Hom M M).hom = 𝟙 M.X :=
rfl
#align Mon_.id_hom' Mon_.id_hom'
@[simp]
theorem comp_hom' {M N K : Mon_ C} (f : M ⟶ N) (g : N ⟶ K) :
(f ≫ g : Hom M K).hom = f.hom ≫ g.hom :=
rfl
#align Mon_.comp_hom' Mon_.comp_hom'
section
variable (C)
/-- The forgetful functor from monoid objects to the ambient category. -/
@[simps]
def forget : Mon_ C ⥤ C where
obj A := A.X
map f := f.hom
#align Mon_.forget Mon_.forget
end
instance forget_faithful : Faithful (@forget C _ _) where
#align Mon_.forget_faithful Mon_.forget_faithful
instance {A B : Mon_ C} (f : A ⟶ B) [e : IsIso ((forget C).map f)] : IsIso f.hom :=
e
/-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/
instance : ReflectsIsomorphisms (forget C) where
reflects f e :=
⟨⟨{ hom := inv f.hom
mul_hom := by
simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, ← tensor_comp_assoc,
IsIso.inv_hom_id, tensor_id, Category.id_comp] },
by aesop_cat⟩⟩
/-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X ≅ N.X) (one_f : M.one ≫ f.hom = N.one)
(mul_f : M.mul ≫ f.hom = (f.hom ⊗ f.hom) ≫ N.mul) : M ≅ N where
hom :=
{ hom := f.hom
one_hom := one_f
mul_hom := mul_f }
inv :=
{ hom := f.inv
one_hom := by rw [← one_f]; simp
mul_hom := by
rw [← cancel_mono f.hom]
slice_rhs 2 3 => rw [mul_f]
simp }
#align Mon_.iso_of_iso Mon_.isoOfIso
instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C ⟶ A) where
default :=
{ hom := A.one
one_hom := by dsimp; simp
mul_hom := by dsimp; simp [A.one_mul, unitors_equal] }
uniq f := by
ext; simp
rw [← Category.id_comp f.hom]
erw [f.one_hom]
#align Mon_.unique_hom_from_trivial Mon_.uniqueHomFromTrivial
open CategoryTheory.Limits
instance : HasInitial (Mon_ C) :=
hasInitial_of_unique (trivial C)
end Mon_
namespace CategoryTheory.LaxMonoidalFunctor
variable {C} {D : Type u₂} [Category.{v₂} D] [MonoidalCategory.{v₂} D]
-- TODO: mapMod F A : Mod A ⥤ Mod (F.mapMon A)
/-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one]
rw [F.toFunctor.map_id]
rw [F.right_unitality]
mul_assoc := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_assoc]
conv_lhs => rw [F.toFunctor.map_id]
conv_lhs => rw [F.toFunctor.map_comp, F.toFunctor.map_comp]
conv_rhs => | rw [id_tensor_comp, ← F.toFunctor.map_id] | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one]
rw [F.toFunctor.map_id]
rw [F.right_unitality]
mul_assoc := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_assoc]
conv_lhs => rw [F.toFunctor.map_id]
conv_lhs => rw [F.toFunctor.map_comp, F.toFunctor.map_comp]
conv_rhs => | Mathlib.CategoryTheory.Monoidal.Mon_.202_0.NTUMzhXPwXsmsYt | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A | Mathlib_CategoryTheory_Monoidal_Mon_ |
C : Type u₁
inst✝³ : Category.{v₁, u₁} C
inst✝² : MonoidalCategory C
D : Type u₂
inst✝¹ : Category.{v₂, u₂} D
inst✝ : MonoidalCategory D
F : LaxMonoidalFunctor C D
A : Mon_ C
⊢ (μ F A.X A.X ⊗ 𝟙 (F.obj A.X)) ≫
μ F (A.X ⊗ A.X) A.X ≫ F.map (α_ A.X A.X A.X).hom ≫ F.map (𝟙 A.X ⊗ A.mul) ≫ F.map A.mul =
(α_ (F.obj A.X) (F.obj A.X) (F.obj A.X)).hom ≫
((F.map (𝟙 A.X) ⊗ μ F A.X A.X) ≫ (F.map (𝟙 A.X) ⊗ F.map A.mul)) ≫ μ F A.X A.X ≫ F.map A.mul | /-
Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/
import Mathlib.CategoryTheory.Monoidal.Braided
import Mathlib.CategoryTheory.Monoidal.Discrete
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
import Mathlib.Algebra.PUnitInstances
#align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c"
/-!
# The category of monoids in a monoidal category.
We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to
the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if
`C` is braided, then the category of monoids is naturally monoidal.
-/
set_option linter.uppercaseLean3 false
universe v₁ v₂ u₁ u₂ u
open CategoryTheory MonoidalCategory
variable (C : Type u₁) [Category.{v₁} C] [MonoidalCategory.{v₁} C]
/-- A monoid object internal to a monoidal category.
When the monoidal category is preadditive, this is also sometimes called an "algebra object".
-/
structure Mon_ where
X : C
one : 𝟙_ C ⟶ X
mul : X ⊗ X ⟶ X
one_mul : (one ⊗ 𝟙 X) ≫ mul = (λ_ X).hom := by aesop_cat
mul_one : (𝟙 X ⊗ one) ≫ mul = (ρ_ X).hom := by aesop_cat
-- Obviously there is some flexibility stating this axiom.
-- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`,
-- and chooses to place the associator on the right-hand side.
-- The heuristic is that unitors and associators "don't have much weight".
mul_assoc : (mul ⊗ 𝟙 X) ≫ mul = (α_ X X X).hom ≫ (𝟙 X ⊗ mul) ≫ mul := by aesop_cat
#align Mon_ Mon_
attribute [reassoc] Mon_.one_mul Mon_.mul_one
-- We prove a more general `@[simp]` lemma below.
attribute [reassoc (attr := simp)] Mon_.mul_assoc
namespace Mon_
/-- The trivial monoid object. We later show this is initial in `Mon_ C`.
-/
@[simps]
def trivial : Mon_ C where
X := 𝟙_ C
one := 𝟙 _
mul := (λ_ _).hom
mul_assoc := by coherence
mul_one := by coherence
#align Mon_.trivial Mon_.trivial
instance : Inhabited (Mon_ C) :=
⟨trivial C⟩
variable {C}
variable {M : Mon_ C}
@[simp]
theorem one_mul_hom {Z : C} (f : Z ⟶ M.X) : (M.one ⊗ f) ≫ M.mul = (λ_ Z).hom ≫ f := by
rw [← id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality]
#align Mon_.one_mul_hom Mon_.one_mul_hom
@[simp]
theorem mul_one_hom {Z : C} (f : Z ⟶ M.X) : (f ⊗ M.one) ≫ M.mul = (ρ_ Z).hom ≫ f := by
rw [← tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality]
#align Mon_.mul_one_hom Mon_.mul_one_hom
theorem assoc_flip :
(𝟙 M.X ⊗ M.mul) ≫ M.mul = (α_ M.X M.X M.X).inv ≫ (M.mul ⊗ 𝟙 M.X) ≫ M.mul := by simp
#align Mon_.assoc_flip Mon_.assoc_flip
/-- A morphism of monoid objects. -/
@[ext]
structure Hom (M N : Mon_ C) where
hom : M.X ⟶ N.X
one_hom : M.one ≫ hom = N.one := by aesop_cat
mul_hom : M.mul ≫ hom = (hom ⊗ hom) ≫ N.mul := by aesop_cat
#align Mon_.hom Mon_.Hom
attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom
/-- The identity morphism on a monoid object. -/
@[simps]
def id (M : Mon_ C) : Hom M M where
hom := 𝟙 M.X
#align Mon_.id Mon_.id
instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) :=
⟨id M⟩
#align Mon_.hom_inhabited Mon_.homInhabited
/-- Composition of morphisms of monoid objects. -/
@[simps]
def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where
hom := f.hom ≫ g.hom
#align Mon_.comp Mon_.comp
instance : Category (Mon_ C) where
Hom M N := Hom M N
id := id
comp f g := comp f g
-- Porting note: added, as `Hom.ext` does not apply to a morphism.
@[ext]
lemma ext {X Y : Mon_ C} {f g : X ⟶ Y} (w : f.hom = g.hom) : f = g :=
Hom.ext _ _ w
@[simp]
theorem id_hom' (M : Mon_ C) : (𝟙 M : Hom M M).hom = 𝟙 M.X :=
rfl
#align Mon_.id_hom' Mon_.id_hom'
@[simp]
theorem comp_hom' {M N K : Mon_ C} (f : M ⟶ N) (g : N ⟶ K) :
(f ≫ g : Hom M K).hom = f.hom ≫ g.hom :=
rfl
#align Mon_.comp_hom' Mon_.comp_hom'
section
variable (C)
/-- The forgetful functor from monoid objects to the ambient category. -/
@[simps]
def forget : Mon_ C ⥤ C where
obj A := A.X
map f := f.hom
#align Mon_.forget Mon_.forget
end
instance forget_faithful : Faithful (@forget C _ _) where
#align Mon_.forget_faithful Mon_.forget_faithful
instance {A B : Mon_ C} (f : A ⟶ B) [e : IsIso ((forget C).map f)] : IsIso f.hom :=
e
/-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/
instance : ReflectsIsomorphisms (forget C) where
reflects f e :=
⟨⟨{ hom := inv f.hom
mul_hom := by
simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, ← tensor_comp_assoc,
IsIso.inv_hom_id, tensor_id, Category.id_comp] },
by aesop_cat⟩⟩
/-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X ≅ N.X) (one_f : M.one ≫ f.hom = N.one)
(mul_f : M.mul ≫ f.hom = (f.hom ⊗ f.hom) ≫ N.mul) : M ≅ N where
hom :=
{ hom := f.hom
one_hom := one_f
mul_hom := mul_f }
inv :=
{ hom := f.inv
one_hom := by rw [← one_f]; simp
mul_hom := by
rw [← cancel_mono f.hom]
slice_rhs 2 3 => rw [mul_f]
simp }
#align Mon_.iso_of_iso Mon_.isoOfIso
instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C ⟶ A) where
default :=
{ hom := A.one
one_hom := by dsimp; simp
mul_hom := by dsimp; simp [A.one_mul, unitors_equal] }
uniq f := by
ext; simp
rw [← Category.id_comp f.hom]
erw [f.one_hom]
#align Mon_.unique_hom_from_trivial Mon_.uniqueHomFromTrivial
open CategoryTheory.Limits
instance : HasInitial (Mon_ C) :=
hasInitial_of_unique (trivial C)
end Mon_
namespace CategoryTheory.LaxMonoidalFunctor
variable {C} {D : Type u₂} [Category.{v₂} D] [MonoidalCategory.{v₂} D]
-- TODO: mapMod F A : Mod A ⥤ Mod (F.mapMon A)
/-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one]
rw [F.toFunctor.map_id]
rw [F.right_unitality]
mul_assoc := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_assoc]
conv_lhs => rw [F.toFunctor.map_id]
conv_lhs => rw [F.toFunctor.map_comp, F.toFunctor.map_comp]
conv_rhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
| slice_rhs 3 4 => rw [F.μ_natural] | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one]
rw [F.toFunctor.map_id]
rw [F.right_unitality]
mul_assoc := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_assoc]
conv_lhs => rw [F.toFunctor.map_id]
conv_lhs => rw [F.toFunctor.map_comp, F.toFunctor.map_comp]
conv_rhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
| Mathlib.CategoryTheory.Monoidal.Mon_.202_0.NTUMzhXPwXsmsYt | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A | Mathlib_CategoryTheory_Monoidal_Mon_ |
case a.a.a
C : Type u₁
inst✝³ : Category.{v₁, u₁} C
inst✝² : MonoidalCategory C
D : Type u₂
inst✝¹ : Category.{v₂, u₂} D
inst✝ : MonoidalCategory D
F : LaxMonoidalFunctor C D
A : Mon_ C
| (F.map (𝟙 A.X) ⊗ F.map A.mul) ≫ μ F A.X A.X
case a.a.a
C : Type u₁
inst✝³ : Category.{v₁, u₁} C
inst✝² : MonoidalCategory C
D : Type u₂
inst✝¹ : Category.{v₂, u₂} D
inst✝ : MonoidalCategory D
F : LaxMonoidalFunctor C D
A : Mon_ C
| F.map A.mul
case a
C : Type u₁
inst✝³ : Category.{v₁, u₁} C
inst✝² : MonoidalCategory C
D : Type u₂
inst✝¹ : Category.{v₂, u₂} D
inst✝ : MonoidalCategory D
F : LaxMonoidalFunctor C D
A : Mon_ C
| (α_ (F.obj A.X) (F.obj A.X) (F.obj A.X)).hom
case a.a
C : Type u₁
inst✝³ : Category.{v₁, u₁} C
inst✝² : MonoidalCategory C
D : Type u₂
inst✝¹ : Category.{v₂, u₂} D
inst✝ : MonoidalCategory D
F : LaxMonoidalFunctor C D
A : Mon_ C
| F.map (𝟙 A.X) ⊗ μ F A.X A.X | /-
Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/
import Mathlib.CategoryTheory.Monoidal.Braided
import Mathlib.CategoryTheory.Monoidal.Discrete
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
import Mathlib.Algebra.PUnitInstances
#align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c"
/-!
# The category of monoids in a monoidal category.
We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to
the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if
`C` is braided, then the category of monoids is naturally monoidal.
-/
set_option linter.uppercaseLean3 false
universe v₁ v₂ u₁ u₂ u
open CategoryTheory MonoidalCategory
variable (C : Type u₁) [Category.{v₁} C] [MonoidalCategory.{v₁} C]
/-- A monoid object internal to a monoidal category.
When the monoidal category is preadditive, this is also sometimes called an "algebra object".
-/
structure Mon_ where
X : C
one : 𝟙_ C ⟶ X
mul : X ⊗ X ⟶ X
one_mul : (one ⊗ 𝟙 X) ≫ mul = (λ_ X).hom := by aesop_cat
mul_one : (𝟙 X ⊗ one) ≫ mul = (ρ_ X).hom := by aesop_cat
-- Obviously there is some flexibility stating this axiom.
-- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`,
-- and chooses to place the associator on the right-hand side.
-- The heuristic is that unitors and associators "don't have much weight".
mul_assoc : (mul ⊗ 𝟙 X) ≫ mul = (α_ X X X).hom ≫ (𝟙 X ⊗ mul) ≫ mul := by aesop_cat
#align Mon_ Mon_
attribute [reassoc] Mon_.one_mul Mon_.mul_one
-- We prove a more general `@[simp]` lemma below.
attribute [reassoc (attr := simp)] Mon_.mul_assoc
namespace Mon_
/-- The trivial monoid object. We later show this is initial in `Mon_ C`.
-/
@[simps]
def trivial : Mon_ C where
X := 𝟙_ C
one := 𝟙 _
mul := (λ_ _).hom
mul_assoc := by coherence
mul_one := by coherence
#align Mon_.trivial Mon_.trivial
instance : Inhabited (Mon_ C) :=
⟨trivial C⟩
variable {C}
variable {M : Mon_ C}
@[simp]
theorem one_mul_hom {Z : C} (f : Z ⟶ M.X) : (M.one ⊗ f) ≫ M.mul = (λ_ Z).hom ≫ f := by
rw [← id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality]
#align Mon_.one_mul_hom Mon_.one_mul_hom
@[simp]
theorem mul_one_hom {Z : C} (f : Z ⟶ M.X) : (f ⊗ M.one) ≫ M.mul = (ρ_ Z).hom ≫ f := by
rw [← tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality]
#align Mon_.mul_one_hom Mon_.mul_one_hom
theorem assoc_flip :
(𝟙 M.X ⊗ M.mul) ≫ M.mul = (α_ M.X M.X M.X).inv ≫ (M.mul ⊗ 𝟙 M.X) ≫ M.mul := by simp
#align Mon_.assoc_flip Mon_.assoc_flip
/-- A morphism of monoid objects. -/
@[ext]
structure Hom (M N : Mon_ C) where
hom : M.X ⟶ N.X
one_hom : M.one ≫ hom = N.one := by aesop_cat
mul_hom : M.mul ≫ hom = (hom ⊗ hom) ≫ N.mul := by aesop_cat
#align Mon_.hom Mon_.Hom
attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom
/-- The identity morphism on a monoid object. -/
@[simps]
def id (M : Mon_ C) : Hom M M where
hom := 𝟙 M.X
#align Mon_.id Mon_.id
instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) :=
⟨id M⟩
#align Mon_.hom_inhabited Mon_.homInhabited
/-- Composition of morphisms of monoid objects. -/
@[simps]
def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where
hom := f.hom ≫ g.hom
#align Mon_.comp Mon_.comp
instance : Category (Mon_ C) where
Hom M N := Hom M N
id := id
comp f g := comp f g
-- Porting note: added, as `Hom.ext` does not apply to a morphism.
@[ext]
lemma ext {X Y : Mon_ C} {f g : X ⟶ Y} (w : f.hom = g.hom) : f = g :=
Hom.ext _ _ w
@[simp]
theorem id_hom' (M : Mon_ C) : (𝟙 M : Hom M M).hom = 𝟙 M.X :=
rfl
#align Mon_.id_hom' Mon_.id_hom'
@[simp]
theorem comp_hom' {M N K : Mon_ C} (f : M ⟶ N) (g : N ⟶ K) :
(f ≫ g : Hom M K).hom = f.hom ≫ g.hom :=
rfl
#align Mon_.comp_hom' Mon_.comp_hom'
section
variable (C)
/-- The forgetful functor from monoid objects to the ambient category. -/
@[simps]
def forget : Mon_ C ⥤ C where
obj A := A.X
map f := f.hom
#align Mon_.forget Mon_.forget
end
instance forget_faithful : Faithful (@forget C _ _) where
#align Mon_.forget_faithful Mon_.forget_faithful
instance {A B : Mon_ C} (f : A ⟶ B) [e : IsIso ((forget C).map f)] : IsIso f.hom :=
e
/-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/
instance : ReflectsIsomorphisms (forget C) where
reflects f e :=
⟨⟨{ hom := inv f.hom
mul_hom := by
simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, ← tensor_comp_assoc,
IsIso.inv_hom_id, tensor_id, Category.id_comp] },
by aesop_cat⟩⟩
/-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X ≅ N.X) (one_f : M.one ≫ f.hom = N.one)
(mul_f : M.mul ≫ f.hom = (f.hom ⊗ f.hom) ≫ N.mul) : M ≅ N where
hom :=
{ hom := f.hom
one_hom := one_f
mul_hom := mul_f }
inv :=
{ hom := f.inv
one_hom := by rw [← one_f]; simp
mul_hom := by
rw [← cancel_mono f.hom]
slice_rhs 2 3 => rw [mul_f]
simp }
#align Mon_.iso_of_iso Mon_.isoOfIso
instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C ⟶ A) where
default :=
{ hom := A.one
one_hom := by dsimp; simp
mul_hom := by dsimp; simp [A.one_mul, unitors_equal] }
uniq f := by
ext; simp
rw [← Category.id_comp f.hom]
erw [f.one_hom]
#align Mon_.unique_hom_from_trivial Mon_.uniqueHomFromTrivial
open CategoryTheory.Limits
instance : HasInitial (Mon_ C) :=
hasInitial_of_unique (trivial C)
end Mon_
namespace CategoryTheory.LaxMonoidalFunctor
variable {C} {D : Type u₂} [Category.{v₂} D] [MonoidalCategory.{v₂} D]
-- TODO: mapMod F A : Mod A ⥤ Mod (F.mapMon A)
/-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one]
rw [F.toFunctor.map_id]
rw [F.right_unitality]
mul_assoc := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_assoc]
conv_lhs => rw [F.toFunctor.map_id]
conv_lhs => rw [F.toFunctor.map_comp, F.toFunctor.map_comp]
conv_rhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_rhs 3 4 => | rw [F.μ_natural] | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one]
rw [F.toFunctor.map_id]
rw [F.right_unitality]
mul_assoc := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_assoc]
conv_lhs => rw [F.toFunctor.map_id]
conv_lhs => rw [F.toFunctor.map_comp, F.toFunctor.map_comp]
conv_rhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_rhs 3 4 => | Mathlib.CategoryTheory.Monoidal.Mon_.202_0.NTUMzhXPwXsmsYt | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A | Mathlib_CategoryTheory_Monoidal_Mon_ |
case a.a.a
C : Type u₁
inst✝³ : Category.{v₁, u₁} C
inst✝² : MonoidalCategory C
D : Type u₂
inst✝¹ : Category.{v₂, u₂} D
inst✝ : MonoidalCategory D
F : LaxMonoidalFunctor C D
A : Mon_ C
| (F.map (𝟙 A.X) ⊗ F.map A.mul) ≫ μ F A.X A.X
case a.a.a
C : Type u₁
inst✝³ : Category.{v₁, u₁} C
inst✝² : MonoidalCategory C
D : Type u₂
inst✝¹ : Category.{v₂, u₂} D
inst✝ : MonoidalCategory D
F : LaxMonoidalFunctor C D
A : Mon_ C
| F.map A.mul
case a
C : Type u₁
inst✝³ : Category.{v₁, u₁} C
inst✝² : MonoidalCategory C
D : Type u₂
inst✝¹ : Category.{v₂, u₂} D
inst✝ : MonoidalCategory D
F : LaxMonoidalFunctor C D
A : Mon_ C
| (α_ (F.obj A.X) (F.obj A.X) (F.obj A.X)).hom
case a.a
C : Type u₁
inst✝³ : Category.{v₁, u₁} C
inst✝² : MonoidalCategory C
D : Type u₂
inst✝¹ : Category.{v₂, u₂} D
inst✝ : MonoidalCategory D
F : LaxMonoidalFunctor C D
A : Mon_ C
| F.map (𝟙 A.X) ⊗ μ F A.X A.X | /-
Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/
import Mathlib.CategoryTheory.Monoidal.Braided
import Mathlib.CategoryTheory.Monoidal.Discrete
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
import Mathlib.Algebra.PUnitInstances
#align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c"
/-!
# The category of monoids in a monoidal category.
We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to
the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if
`C` is braided, then the category of monoids is naturally monoidal.
-/
set_option linter.uppercaseLean3 false
universe v₁ v₂ u₁ u₂ u
open CategoryTheory MonoidalCategory
variable (C : Type u₁) [Category.{v₁} C] [MonoidalCategory.{v₁} C]
/-- A monoid object internal to a monoidal category.
When the monoidal category is preadditive, this is also sometimes called an "algebra object".
-/
structure Mon_ where
X : C
one : 𝟙_ C ⟶ X
mul : X ⊗ X ⟶ X
one_mul : (one ⊗ 𝟙 X) ≫ mul = (λ_ X).hom := by aesop_cat
mul_one : (𝟙 X ⊗ one) ≫ mul = (ρ_ X).hom := by aesop_cat
-- Obviously there is some flexibility stating this axiom.
-- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`,
-- and chooses to place the associator on the right-hand side.
-- The heuristic is that unitors and associators "don't have much weight".
mul_assoc : (mul ⊗ 𝟙 X) ≫ mul = (α_ X X X).hom ≫ (𝟙 X ⊗ mul) ≫ mul := by aesop_cat
#align Mon_ Mon_
attribute [reassoc] Mon_.one_mul Mon_.mul_one
-- We prove a more general `@[simp]` lemma below.
attribute [reassoc (attr := simp)] Mon_.mul_assoc
namespace Mon_
/-- The trivial monoid object. We later show this is initial in `Mon_ C`.
-/
@[simps]
def trivial : Mon_ C where
X := 𝟙_ C
one := 𝟙 _
mul := (λ_ _).hom
mul_assoc := by coherence
mul_one := by coherence
#align Mon_.trivial Mon_.trivial
instance : Inhabited (Mon_ C) :=
⟨trivial C⟩
variable {C}
variable {M : Mon_ C}
@[simp]
theorem one_mul_hom {Z : C} (f : Z ⟶ M.X) : (M.one ⊗ f) ≫ M.mul = (λ_ Z).hom ≫ f := by
rw [← id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality]
#align Mon_.one_mul_hom Mon_.one_mul_hom
@[simp]
theorem mul_one_hom {Z : C} (f : Z ⟶ M.X) : (f ⊗ M.one) ≫ M.mul = (ρ_ Z).hom ≫ f := by
rw [← tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality]
#align Mon_.mul_one_hom Mon_.mul_one_hom
theorem assoc_flip :
(𝟙 M.X ⊗ M.mul) ≫ M.mul = (α_ M.X M.X M.X).inv ≫ (M.mul ⊗ 𝟙 M.X) ≫ M.mul := by simp
#align Mon_.assoc_flip Mon_.assoc_flip
/-- A morphism of monoid objects. -/
@[ext]
structure Hom (M N : Mon_ C) where
hom : M.X ⟶ N.X
one_hom : M.one ≫ hom = N.one := by aesop_cat
mul_hom : M.mul ≫ hom = (hom ⊗ hom) ≫ N.mul := by aesop_cat
#align Mon_.hom Mon_.Hom
attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom
/-- The identity morphism on a monoid object. -/
@[simps]
def id (M : Mon_ C) : Hom M M where
hom := 𝟙 M.X
#align Mon_.id Mon_.id
instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) :=
⟨id M⟩
#align Mon_.hom_inhabited Mon_.homInhabited
/-- Composition of morphisms of monoid objects. -/
@[simps]
def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where
hom := f.hom ≫ g.hom
#align Mon_.comp Mon_.comp
instance : Category (Mon_ C) where
Hom M N := Hom M N
id := id
comp f g := comp f g
-- Porting note: added, as `Hom.ext` does not apply to a morphism.
@[ext]
lemma ext {X Y : Mon_ C} {f g : X ⟶ Y} (w : f.hom = g.hom) : f = g :=
Hom.ext _ _ w
@[simp]
theorem id_hom' (M : Mon_ C) : (𝟙 M : Hom M M).hom = 𝟙 M.X :=
rfl
#align Mon_.id_hom' Mon_.id_hom'
@[simp]
theorem comp_hom' {M N K : Mon_ C} (f : M ⟶ N) (g : N ⟶ K) :
(f ≫ g : Hom M K).hom = f.hom ≫ g.hom :=
rfl
#align Mon_.comp_hom' Mon_.comp_hom'
section
variable (C)
/-- The forgetful functor from monoid objects to the ambient category. -/
@[simps]
def forget : Mon_ C ⥤ C where
obj A := A.X
map f := f.hom
#align Mon_.forget Mon_.forget
end
instance forget_faithful : Faithful (@forget C _ _) where
#align Mon_.forget_faithful Mon_.forget_faithful
instance {A B : Mon_ C} (f : A ⟶ B) [e : IsIso ((forget C).map f)] : IsIso f.hom :=
e
/-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/
instance : ReflectsIsomorphisms (forget C) where
reflects f e :=
⟨⟨{ hom := inv f.hom
mul_hom := by
simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, ← tensor_comp_assoc,
IsIso.inv_hom_id, tensor_id, Category.id_comp] },
by aesop_cat⟩⟩
/-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X ≅ N.X) (one_f : M.one ≫ f.hom = N.one)
(mul_f : M.mul ≫ f.hom = (f.hom ⊗ f.hom) ≫ N.mul) : M ≅ N where
hom :=
{ hom := f.hom
one_hom := one_f
mul_hom := mul_f }
inv :=
{ hom := f.inv
one_hom := by rw [← one_f]; simp
mul_hom := by
rw [← cancel_mono f.hom]
slice_rhs 2 3 => rw [mul_f]
simp }
#align Mon_.iso_of_iso Mon_.isoOfIso
instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C ⟶ A) where
default :=
{ hom := A.one
one_hom := by dsimp; simp
mul_hom := by dsimp; simp [A.one_mul, unitors_equal] }
uniq f := by
ext; simp
rw [← Category.id_comp f.hom]
erw [f.one_hom]
#align Mon_.unique_hom_from_trivial Mon_.uniqueHomFromTrivial
open CategoryTheory.Limits
instance : HasInitial (Mon_ C) :=
hasInitial_of_unique (trivial C)
end Mon_
namespace CategoryTheory.LaxMonoidalFunctor
variable {C} {D : Type u₂} [Category.{v₂} D] [MonoidalCategory.{v₂} D]
-- TODO: mapMod F A : Mod A ⥤ Mod (F.mapMon A)
/-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one]
rw [F.toFunctor.map_id]
rw [F.right_unitality]
mul_assoc := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_assoc]
conv_lhs => rw [F.toFunctor.map_id]
conv_lhs => rw [F.toFunctor.map_comp, F.toFunctor.map_comp]
conv_rhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_rhs 3 4 => | rw [F.μ_natural] | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one]
rw [F.toFunctor.map_id]
rw [F.right_unitality]
mul_assoc := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_assoc]
conv_lhs => rw [F.toFunctor.map_id]
conv_lhs => rw [F.toFunctor.map_comp, F.toFunctor.map_comp]
conv_rhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_rhs 3 4 => | Mathlib.CategoryTheory.Monoidal.Mon_.202_0.NTUMzhXPwXsmsYt | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A | Mathlib_CategoryTheory_Monoidal_Mon_ |
case a.a.a
C : Type u₁
inst✝³ : Category.{v₁, u₁} C
inst✝² : MonoidalCategory C
D : Type u₂
inst✝¹ : Category.{v₂, u₂} D
inst✝ : MonoidalCategory D
F : LaxMonoidalFunctor C D
A : Mon_ C
| (F.map (𝟙 A.X) ⊗ F.map A.mul) ≫ μ F A.X A.X
case a.a.a
C : Type u₁
inst✝³ : Category.{v₁, u₁} C
inst✝² : MonoidalCategory C
D : Type u₂
inst✝¹ : Category.{v₂, u₂} D
inst✝ : MonoidalCategory D
F : LaxMonoidalFunctor C D
A : Mon_ C
| F.map A.mul
case a
C : Type u₁
inst✝³ : Category.{v₁, u₁} C
inst✝² : MonoidalCategory C
D : Type u₂
inst✝¹ : Category.{v₂, u₂} D
inst✝ : MonoidalCategory D
F : LaxMonoidalFunctor C D
A : Mon_ C
| (α_ (F.obj A.X) (F.obj A.X) (F.obj A.X)).hom
case a.a
C : Type u₁
inst✝³ : Category.{v₁, u₁} C
inst✝² : MonoidalCategory C
D : Type u₂
inst✝¹ : Category.{v₂, u₂} D
inst✝ : MonoidalCategory D
F : LaxMonoidalFunctor C D
A : Mon_ C
| F.map (𝟙 A.X) ⊗ μ F A.X A.X | /-
Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/
import Mathlib.CategoryTheory.Monoidal.Braided
import Mathlib.CategoryTheory.Monoidal.Discrete
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
import Mathlib.Algebra.PUnitInstances
#align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c"
/-!
# The category of monoids in a monoidal category.
We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to
the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if
`C` is braided, then the category of monoids is naturally monoidal.
-/
set_option linter.uppercaseLean3 false
universe v₁ v₂ u₁ u₂ u
open CategoryTheory MonoidalCategory
variable (C : Type u₁) [Category.{v₁} C] [MonoidalCategory.{v₁} C]
/-- A monoid object internal to a monoidal category.
When the monoidal category is preadditive, this is also sometimes called an "algebra object".
-/
structure Mon_ where
X : C
one : 𝟙_ C ⟶ X
mul : X ⊗ X ⟶ X
one_mul : (one ⊗ 𝟙 X) ≫ mul = (λ_ X).hom := by aesop_cat
mul_one : (𝟙 X ⊗ one) ≫ mul = (ρ_ X).hom := by aesop_cat
-- Obviously there is some flexibility stating this axiom.
-- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`,
-- and chooses to place the associator on the right-hand side.
-- The heuristic is that unitors and associators "don't have much weight".
mul_assoc : (mul ⊗ 𝟙 X) ≫ mul = (α_ X X X).hom ≫ (𝟙 X ⊗ mul) ≫ mul := by aesop_cat
#align Mon_ Mon_
attribute [reassoc] Mon_.one_mul Mon_.mul_one
-- We prove a more general `@[simp]` lemma below.
attribute [reassoc (attr := simp)] Mon_.mul_assoc
namespace Mon_
/-- The trivial monoid object. We later show this is initial in `Mon_ C`.
-/
@[simps]
def trivial : Mon_ C where
X := 𝟙_ C
one := 𝟙 _
mul := (λ_ _).hom
mul_assoc := by coherence
mul_one := by coherence
#align Mon_.trivial Mon_.trivial
instance : Inhabited (Mon_ C) :=
⟨trivial C⟩
variable {C}
variable {M : Mon_ C}
@[simp]
theorem one_mul_hom {Z : C} (f : Z ⟶ M.X) : (M.one ⊗ f) ≫ M.mul = (λ_ Z).hom ≫ f := by
rw [← id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality]
#align Mon_.one_mul_hom Mon_.one_mul_hom
@[simp]
theorem mul_one_hom {Z : C} (f : Z ⟶ M.X) : (f ⊗ M.one) ≫ M.mul = (ρ_ Z).hom ≫ f := by
rw [← tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality]
#align Mon_.mul_one_hom Mon_.mul_one_hom
theorem assoc_flip :
(𝟙 M.X ⊗ M.mul) ≫ M.mul = (α_ M.X M.X M.X).inv ≫ (M.mul ⊗ 𝟙 M.X) ≫ M.mul := by simp
#align Mon_.assoc_flip Mon_.assoc_flip
/-- A morphism of monoid objects. -/
@[ext]
structure Hom (M N : Mon_ C) where
hom : M.X ⟶ N.X
one_hom : M.one ≫ hom = N.one := by aesop_cat
mul_hom : M.mul ≫ hom = (hom ⊗ hom) ≫ N.mul := by aesop_cat
#align Mon_.hom Mon_.Hom
attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom
/-- The identity morphism on a monoid object. -/
@[simps]
def id (M : Mon_ C) : Hom M M where
hom := 𝟙 M.X
#align Mon_.id Mon_.id
instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) :=
⟨id M⟩
#align Mon_.hom_inhabited Mon_.homInhabited
/-- Composition of morphisms of monoid objects. -/
@[simps]
def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where
hom := f.hom ≫ g.hom
#align Mon_.comp Mon_.comp
instance : Category (Mon_ C) where
Hom M N := Hom M N
id := id
comp f g := comp f g
-- Porting note: added, as `Hom.ext` does not apply to a morphism.
@[ext]
lemma ext {X Y : Mon_ C} {f g : X ⟶ Y} (w : f.hom = g.hom) : f = g :=
Hom.ext _ _ w
@[simp]
theorem id_hom' (M : Mon_ C) : (𝟙 M : Hom M M).hom = 𝟙 M.X :=
rfl
#align Mon_.id_hom' Mon_.id_hom'
@[simp]
theorem comp_hom' {M N K : Mon_ C} (f : M ⟶ N) (g : N ⟶ K) :
(f ≫ g : Hom M K).hom = f.hom ≫ g.hom :=
rfl
#align Mon_.comp_hom' Mon_.comp_hom'
section
variable (C)
/-- The forgetful functor from monoid objects to the ambient category. -/
@[simps]
def forget : Mon_ C ⥤ C where
obj A := A.X
map f := f.hom
#align Mon_.forget Mon_.forget
end
instance forget_faithful : Faithful (@forget C _ _) where
#align Mon_.forget_faithful Mon_.forget_faithful
instance {A B : Mon_ C} (f : A ⟶ B) [e : IsIso ((forget C).map f)] : IsIso f.hom :=
e
/-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/
instance : ReflectsIsomorphisms (forget C) where
reflects f e :=
⟨⟨{ hom := inv f.hom
mul_hom := by
simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, ← tensor_comp_assoc,
IsIso.inv_hom_id, tensor_id, Category.id_comp] },
by aesop_cat⟩⟩
/-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X ≅ N.X) (one_f : M.one ≫ f.hom = N.one)
(mul_f : M.mul ≫ f.hom = (f.hom ⊗ f.hom) ≫ N.mul) : M ≅ N where
hom :=
{ hom := f.hom
one_hom := one_f
mul_hom := mul_f }
inv :=
{ hom := f.inv
one_hom := by rw [← one_f]; simp
mul_hom := by
rw [← cancel_mono f.hom]
slice_rhs 2 3 => rw [mul_f]
simp }
#align Mon_.iso_of_iso Mon_.isoOfIso
instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C ⟶ A) where
default :=
{ hom := A.one
one_hom := by dsimp; simp
mul_hom := by dsimp; simp [A.one_mul, unitors_equal] }
uniq f := by
ext; simp
rw [← Category.id_comp f.hom]
erw [f.one_hom]
#align Mon_.unique_hom_from_trivial Mon_.uniqueHomFromTrivial
open CategoryTheory.Limits
instance : HasInitial (Mon_ C) :=
hasInitial_of_unique (trivial C)
end Mon_
namespace CategoryTheory.LaxMonoidalFunctor
variable {C} {D : Type u₂} [Category.{v₂} D] [MonoidalCategory.{v₂} D]
-- TODO: mapMod F A : Mod A ⥤ Mod (F.mapMon A)
/-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one]
rw [F.toFunctor.map_id]
rw [F.right_unitality]
mul_assoc := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_assoc]
conv_lhs => rw [F.toFunctor.map_id]
conv_lhs => rw [F.toFunctor.map_comp, F.toFunctor.map_comp]
conv_rhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_rhs 3 4 => | rw [F.μ_natural] | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one]
rw [F.toFunctor.map_id]
rw [F.right_unitality]
mul_assoc := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_assoc]
conv_lhs => rw [F.toFunctor.map_id]
conv_lhs => rw [F.toFunctor.map_comp, F.toFunctor.map_comp]
conv_rhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_rhs 3 4 => | Mathlib.CategoryTheory.Monoidal.Mon_.202_0.NTUMzhXPwXsmsYt | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A | Mathlib_CategoryTheory_Monoidal_Mon_ |
C : Type u₁
inst✝³ : Category.{v₁, u₁} C
inst✝² : MonoidalCategory C
D : Type u₂
inst✝¹ : Category.{v₂, u₂} D
inst✝ : MonoidalCategory D
F : LaxMonoidalFunctor C D
A : Mon_ C
⊢ (μ F A.X A.X ⊗ 𝟙 (F.obj A.X)) ≫
μ F (A.X ⊗ A.X) A.X ≫ F.map (α_ A.X A.X A.X).hom ≫ F.map (𝟙 A.X ⊗ A.mul) ≫ F.map A.mul =
(α_ (F.obj A.X) (F.obj A.X) (F.obj A.X)).hom ≫
(F.map (𝟙 A.X) ⊗ μ F A.X A.X) ≫ (μ F A.X (A.X ⊗ A.X) ≫ F.map (𝟙 A.X ⊗ A.mul)) ≫ F.map A.mul | /-
Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/
import Mathlib.CategoryTheory.Monoidal.Braided
import Mathlib.CategoryTheory.Monoidal.Discrete
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
import Mathlib.Algebra.PUnitInstances
#align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c"
/-!
# The category of monoids in a monoidal category.
We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to
the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if
`C` is braided, then the category of monoids is naturally monoidal.
-/
set_option linter.uppercaseLean3 false
universe v₁ v₂ u₁ u₂ u
open CategoryTheory MonoidalCategory
variable (C : Type u₁) [Category.{v₁} C] [MonoidalCategory.{v₁} C]
/-- A monoid object internal to a monoidal category.
When the monoidal category is preadditive, this is also sometimes called an "algebra object".
-/
structure Mon_ where
X : C
one : 𝟙_ C ⟶ X
mul : X ⊗ X ⟶ X
one_mul : (one ⊗ 𝟙 X) ≫ mul = (λ_ X).hom := by aesop_cat
mul_one : (𝟙 X ⊗ one) ≫ mul = (ρ_ X).hom := by aesop_cat
-- Obviously there is some flexibility stating this axiom.
-- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`,
-- and chooses to place the associator on the right-hand side.
-- The heuristic is that unitors and associators "don't have much weight".
mul_assoc : (mul ⊗ 𝟙 X) ≫ mul = (α_ X X X).hom ≫ (𝟙 X ⊗ mul) ≫ mul := by aesop_cat
#align Mon_ Mon_
attribute [reassoc] Mon_.one_mul Mon_.mul_one
-- We prove a more general `@[simp]` lemma below.
attribute [reassoc (attr := simp)] Mon_.mul_assoc
namespace Mon_
/-- The trivial monoid object. We later show this is initial in `Mon_ C`.
-/
@[simps]
def trivial : Mon_ C where
X := 𝟙_ C
one := 𝟙 _
mul := (λ_ _).hom
mul_assoc := by coherence
mul_one := by coherence
#align Mon_.trivial Mon_.trivial
instance : Inhabited (Mon_ C) :=
⟨trivial C⟩
variable {C}
variable {M : Mon_ C}
@[simp]
theorem one_mul_hom {Z : C} (f : Z ⟶ M.X) : (M.one ⊗ f) ≫ M.mul = (λ_ Z).hom ≫ f := by
rw [← id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality]
#align Mon_.one_mul_hom Mon_.one_mul_hom
@[simp]
theorem mul_one_hom {Z : C} (f : Z ⟶ M.X) : (f ⊗ M.one) ≫ M.mul = (ρ_ Z).hom ≫ f := by
rw [← tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality]
#align Mon_.mul_one_hom Mon_.mul_one_hom
theorem assoc_flip :
(𝟙 M.X ⊗ M.mul) ≫ M.mul = (α_ M.X M.X M.X).inv ≫ (M.mul ⊗ 𝟙 M.X) ≫ M.mul := by simp
#align Mon_.assoc_flip Mon_.assoc_flip
/-- A morphism of monoid objects. -/
@[ext]
structure Hom (M N : Mon_ C) where
hom : M.X ⟶ N.X
one_hom : M.one ≫ hom = N.one := by aesop_cat
mul_hom : M.mul ≫ hom = (hom ⊗ hom) ≫ N.mul := by aesop_cat
#align Mon_.hom Mon_.Hom
attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom
/-- The identity morphism on a monoid object. -/
@[simps]
def id (M : Mon_ C) : Hom M M where
hom := 𝟙 M.X
#align Mon_.id Mon_.id
instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) :=
⟨id M⟩
#align Mon_.hom_inhabited Mon_.homInhabited
/-- Composition of morphisms of monoid objects. -/
@[simps]
def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where
hom := f.hom ≫ g.hom
#align Mon_.comp Mon_.comp
instance : Category (Mon_ C) where
Hom M N := Hom M N
id := id
comp f g := comp f g
-- Porting note: added, as `Hom.ext` does not apply to a morphism.
@[ext]
lemma ext {X Y : Mon_ C} {f g : X ⟶ Y} (w : f.hom = g.hom) : f = g :=
Hom.ext _ _ w
@[simp]
theorem id_hom' (M : Mon_ C) : (𝟙 M : Hom M M).hom = 𝟙 M.X :=
rfl
#align Mon_.id_hom' Mon_.id_hom'
@[simp]
theorem comp_hom' {M N K : Mon_ C} (f : M ⟶ N) (g : N ⟶ K) :
(f ≫ g : Hom M K).hom = f.hom ≫ g.hom :=
rfl
#align Mon_.comp_hom' Mon_.comp_hom'
section
variable (C)
/-- The forgetful functor from monoid objects to the ambient category. -/
@[simps]
def forget : Mon_ C ⥤ C where
obj A := A.X
map f := f.hom
#align Mon_.forget Mon_.forget
end
instance forget_faithful : Faithful (@forget C _ _) where
#align Mon_.forget_faithful Mon_.forget_faithful
instance {A B : Mon_ C} (f : A ⟶ B) [e : IsIso ((forget C).map f)] : IsIso f.hom :=
e
/-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/
instance : ReflectsIsomorphisms (forget C) where
reflects f e :=
⟨⟨{ hom := inv f.hom
mul_hom := by
simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, ← tensor_comp_assoc,
IsIso.inv_hom_id, tensor_id, Category.id_comp] },
by aesop_cat⟩⟩
/-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X ≅ N.X) (one_f : M.one ≫ f.hom = N.one)
(mul_f : M.mul ≫ f.hom = (f.hom ⊗ f.hom) ≫ N.mul) : M ≅ N where
hom :=
{ hom := f.hom
one_hom := one_f
mul_hom := mul_f }
inv :=
{ hom := f.inv
one_hom := by rw [← one_f]; simp
mul_hom := by
rw [← cancel_mono f.hom]
slice_rhs 2 3 => rw [mul_f]
simp }
#align Mon_.iso_of_iso Mon_.isoOfIso
instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C ⟶ A) where
default :=
{ hom := A.one
one_hom := by dsimp; simp
mul_hom := by dsimp; simp [A.one_mul, unitors_equal] }
uniq f := by
ext; simp
rw [← Category.id_comp f.hom]
erw [f.one_hom]
#align Mon_.unique_hom_from_trivial Mon_.uniqueHomFromTrivial
open CategoryTheory.Limits
instance : HasInitial (Mon_ C) :=
hasInitial_of_unique (trivial C)
end Mon_
namespace CategoryTheory.LaxMonoidalFunctor
variable {C} {D : Type u₂} [Category.{v₂} D] [MonoidalCategory.{v₂} D]
-- TODO: mapMod F A : Mod A ⥤ Mod (F.mapMon A)
/-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one]
rw [F.toFunctor.map_id]
rw [F.right_unitality]
mul_assoc := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_assoc]
conv_lhs => rw [F.toFunctor.map_id]
conv_lhs => rw [F.toFunctor.map_comp, F.toFunctor.map_comp]
conv_rhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_rhs 3 4 => rw [F.μ_natural]
| conv_rhs => rw [F.toFunctor.map_id] | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one]
rw [F.toFunctor.map_id]
rw [F.right_unitality]
mul_assoc := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_assoc]
conv_lhs => rw [F.toFunctor.map_id]
conv_lhs => rw [F.toFunctor.map_comp, F.toFunctor.map_comp]
conv_rhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_rhs 3 4 => rw [F.μ_natural]
| Mathlib.CategoryTheory.Monoidal.Mon_.202_0.NTUMzhXPwXsmsYt | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A | Mathlib_CategoryTheory_Monoidal_Mon_ |
C : Type u₁
inst✝³ : Category.{v₁, u₁} C
inst✝² : MonoidalCategory C
D : Type u₂
inst✝¹ : Category.{v₂, u₂} D
inst✝ : MonoidalCategory D
F : LaxMonoidalFunctor C D
A : Mon_ C
| (α_ (F.obj A.X) (F.obj A.X) (F.obj A.X)).hom ≫
(F.map (𝟙 A.X) ⊗ μ F A.X A.X) ≫ (μ F A.X (A.X ⊗ A.X) ≫ F.map (𝟙 A.X ⊗ A.mul)) ≫ F.map A.mul | /-
Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/
import Mathlib.CategoryTheory.Monoidal.Braided
import Mathlib.CategoryTheory.Monoidal.Discrete
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
import Mathlib.Algebra.PUnitInstances
#align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c"
/-!
# The category of monoids in a monoidal category.
We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to
the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if
`C` is braided, then the category of monoids is naturally monoidal.
-/
set_option linter.uppercaseLean3 false
universe v₁ v₂ u₁ u₂ u
open CategoryTheory MonoidalCategory
variable (C : Type u₁) [Category.{v₁} C] [MonoidalCategory.{v₁} C]
/-- A monoid object internal to a monoidal category.
When the monoidal category is preadditive, this is also sometimes called an "algebra object".
-/
structure Mon_ where
X : C
one : 𝟙_ C ⟶ X
mul : X ⊗ X ⟶ X
one_mul : (one ⊗ 𝟙 X) ≫ mul = (λ_ X).hom := by aesop_cat
mul_one : (𝟙 X ⊗ one) ≫ mul = (ρ_ X).hom := by aesop_cat
-- Obviously there is some flexibility stating this axiom.
-- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`,
-- and chooses to place the associator on the right-hand side.
-- The heuristic is that unitors and associators "don't have much weight".
mul_assoc : (mul ⊗ 𝟙 X) ≫ mul = (α_ X X X).hom ≫ (𝟙 X ⊗ mul) ≫ mul := by aesop_cat
#align Mon_ Mon_
attribute [reassoc] Mon_.one_mul Mon_.mul_one
-- We prove a more general `@[simp]` lemma below.
attribute [reassoc (attr := simp)] Mon_.mul_assoc
namespace Mon_
/-- The trivial monoid object. We later show this is initial in `Mon_ C`.
-/
@[simps]
def trivial : Mon_ C where
X := 𝟙_ C
one := 𝟙 _
mul := (λ_ _).hom
mul_assoc := by coherence
mul_one := by coherence
#align Mon_.trivial Mon_.trivial
instance : Inhabited (Mon_ C) :=
⟨trivial C⟩
variable {C}
variable {M : Mon_ C}
@[simp]
theorem one_mul_hom {Z : C} (f : Z ⟶ M.X) : (M.one ⊗ f) ≫ M.mul = (λ_ Z).hom ≫ f := by
rw [← id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality]
#align Mon_.one_mul_hom Mon_.one_mul_hom
@[simp]
theorem mul_one_hom {Z : C} (f : Z ⟶ M.X) : (f ⊗ M.one) ≫ M.mul = (ρ_ Z).hom ≫ f := by
rw [← tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality]
#align Mon_.mul_one_hom Mon_.mul_one_hom
theorem assoc_flip :
(𝟙 M.X ⊗ M.mul) ≫ M.mul = (α_ M.X M.X M.X).inv ≫ (M.mul ⊗ 𝟙 M.X) ≫ M.mul := by simp
#align Mon_.assoc_flip Mon_.assoc_flip
/-- A morphism of monoid objects. -/
@[ext]
structure Hom (M N : Mon_ C) where
hom : M.X ⟶ N.X
one_hom : M.one ≫ hom = N.one := by aesop_cat
mul_hom : M.mul ≫ hom = (hom ⊗ hom) ≫ N.mul := by aesop_cat
#align Mon_.hom Mon_.Hom
attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom
/-- The identity morphism on a monoid object. -/
@[simps]
def id (M : Mon_ C) : Hom M M where
hom := 𝟙 M.X
#align Mon_.id Mon_.id
instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) :=
⟨id M⟩
#align Mon_.hom_inhabited Mon_.homInhabited
/-- Composition of morphisms of monoid objects. -/
@[simps]
def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where
hom := f.hom ≫ g.hom
#align Mon_.comp Mon_.comp
instance : Category (Mon_ C) where
Hom M N := Hom M N
id := id
comp f g := comp f g
-- Porting note: added, as `Hom.ext` does not apply to a morphism.
@[ext]
lemma ext {X Y : Mon_ C} {f g : X ⟶ Y} (w : f.hom = g.hom) : f = g :=
Hom.ext _ _ w
@[simp]
theorem id_hom' (M : Mon_ C) : (𝟙 M : Hom M M).hom = 𝟙 M.X :=
rfl
#align Mon_.id_hom' Mon_.id_hom'
@[simp]
theorem comp_hom' {M N K : Mon_ C} (f : M ⟶ N) (g : N ⟶ K) :
(f ≫ g : Hom M K).hom = f.hom ≫ g.hom :=
rfl
#align Mon_.comp_hom' Mon_.comp_hom'
section
variable (C)
/-- The forgetful functor from monoid objects to the ambient category. -/
@[simps]
def forget : Mon_ C ⥤ C where
obj A := A.X
map f := f.hom
#align Mon_.forget Mon_.forget
end
instance forget_faithful : Faithful (@forget C _ _) where
#align Mon_.forget_faithful Mon_.forget_faithful
instance {A B : Mon_ C} (f : A ⟶ B) [e : IsIso ((forget C).map f)] : IsIso f.hom :=
e
/-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/
instance : ReflectsIsomorphisms (forget C) where
reflects f e :=
⟨⟨{ hom := inv f.hom
mul_hom := by
simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, ← tensor_comp_assoc,
IsIso.inv_hom_id, tensor_id, Category.id_comp] },
by aesop_cat⟩⟩
/-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X ≅ N.X) (one_f : M.one ≫ f.hom = N.one)
(mul_f : M.mul ≫ f.hom = (f.hom ⊗ f.hom) ≫ N.mul) : M ≅ N where
hom :=
{ hom := f.hom
one_hom := one_f
mul_hom := mul_f }
inv :=
{ hom := f.inv
one_hom := by rw [← one_f]; simp
mul_hom := by
rw [← cancel_mono f.hom]
slice_rhs 2 3 => rw [mul_f]
simp }
#align Mon_.iso_of_iso Mon_.isoOfIso
instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C ⟶ A) where
default :=
{ hom := A.one
one_hom := by dsimp; simp
mul_hom := by dsimp; simp [A.one_mul, unitors_equal] }
uniq f := by
ext; simp
rw [← Category.id_comp f.hom]
erw [f.one_hom]
#align Mon_.unique_hom_from_trivial Mon_.uniqueHomFromTrivial
open CategoryTheory.Limits
instance : HasInitial (Mon_ C) :=
hasInitial_of_unique (trivial C)
end Mon_
namespace CategoryTheory.LaxMonoidalFunctor
variable {C} {D : Type u₂} [Category.{v₂} D] [MonoidalCategory.{v₂} D]
-- TODO: mapMod F A : Mod A ⥤ Mod (F.mapMon A)
/-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one]
rw [F.toFunctor.map_id]
rw [F.right_unitality]
mul_assoc := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_assoc]
conv_lhs => rw [F.toFunctor.map_id]
conv_lhs => rw [F.toFunctor.map_comp, F.toFunctor.map_comp]
conv_rhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_rhs 3 4 => rw [F.μ_natural]
conv_rhs => | rw [F.toFunctor.map_id] | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one]
rw [F.toFunctor.map_id]
rw [F.right_unitality]
mul_assoc := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_assoc]
conv_lhs => rw [F.toFunctor.map_id]
conv_lhs => rw [F.toFunctor.map_comp, F.toFunctor.map_comp]
conv_rhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_rhs 3 4 => rw [F.μ_natural]
conv_rhs => | Mathlib.CategoryTheory.Monoidal.Mon_.202_0.NTUMzhXPwXsmsYt | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A | Mathlib_CategoryTheory_Monoidal_Mon_ |
C : Type u₁
inst✝³ : Category.{v₁, u₁} C
inst✝² : MonoidalCategory C
D : Type u₂
inst✝¹ : Category.{v₂, u₂} D
inst✝ : MonoidalCategory D
F : LaxMonoidalFunctor C D
A : Mon_ C
| (α_ (F.obj A.X) (F.obj A.X) (F.obj A.X)).hom ≫
(F.map (𝟙 A.X) ⊗ μ F A.X A.X) ≫ (μ F A.X (A.X ⊗ A.X) ≫ F.map (𝟙 A.X ⊗ A.mul)) ≫ F.map A.mul | /-
Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/
import Mathlib.CategoryTheory.Monoidal.Braided
import Mathlib.CategoryTheory.Monoidal.Discrete
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
import Mathlib.Algebra.PUnitInstances
#align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c"
/-!
# The category of monoids in a monoidal category.
We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to
the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if
`C` is braided, then the category of monoids is naturally monoidal.
-/
set_option linter.uppercaseLean3 false
universe v₁ v₂ u₁ u₂ u
open CategoryTheory MonoidalCategory
variable (C : Type u₁) [Category.{v₁} C] [MonoidalCategory.{v₁} C]
/-- A monoid object internal to a monoidal category.
When the monoidal category is preadditive, this is also sometimes called an "algebra object".
-/
structure Mon_ where
X : C
one : 𝟙_ C ⟶ X
mul : X ⊗ X ⟶ X
one_mul : (one ⊗ 𝟙 X) ≫ mul = (λ_ X).hom := by aesop_cat
mul_one : (𝟙 X ⊗ one) ≫ mul = (ρ_ X).hom := by aesop_cat
-- Obviously there is some flexibility stating this axiom.
-- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`,
-- and chooses to place the associator on the right-hand side.
-- The heuristic is that unitors and associators "don't have much weight".
mul_assoc : (mul ⊗ 𝟙 X) ≫ mul = (α_ X X X).hom ≫ (𝟙 X ⊗ mul) ≫ mul := by aesop_cat
#align Mon_ Mon_
attribute [reassoc] Mon_.one_mul Mon_.mul_one
-- We prove a more general `@[simp]` lemma below.
attribute [reassoc (attr := simp)] Mon_.mul_assoc
namespace Mon_
/-- The trivial monoid object. We later show this is initial in `Mon_ C`.
-/
@[simps]
def trivial : Mon_ C where
X := 𝟙_ C
one := 𝟙 _
mul := (λ_ _).hom
mul_assoc := by coherence
mul_one := by coherence
#align Mon_.trivial Mon_.trivial
instance : Inhabited (Mon_ C) :=
⟨trivial C⟩
variable {C}
variable {M : Mon_ C}
@[simp]
theorem one_mul_hom {Z : C} (f : Z ⟶ M.X) : (M.one ⊗ f) ≫ M.mul = (λ_ Z).hom ≫ f := by
rw [← id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality]
#align Mon_.one_mul_hom Mon_.one_mul_hom
@[simp]
theorem mul_one_hom {Z : C} (f : Z ⟶ M.X) : (f ⊗ M.one) ≫ M.mul = (ρ_ Z).hom ≫ f := by
rw [← tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality]
#align Mon_.mul_one_hom Mon_.mul_one_hom
theorem assoc_flip :
(𝟙 M.X ⊗ M.mul) ≫ M.mul = (α_ M.X M.X M.X).inv ≫ (M.mul ⊗ 𝟙 M.X) ≫ M.mul := by simp
#align Mon_.assoc_flip Mon_.assoc_flip
/-- A morphism of monoid objects. -/
@[ext]
structure Hom (M N : Mon_ C) where
hom : M.X ⟶ N.X
one_hom : M.one ≫ hom = N.one := by aesop_cat
mul_hom : M.mul ≫ hom = (hom ⊗ hom) ≫ N.mul := by aesop_cat
#align Mon_.hom Mon_.Hom
attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom
/-- The identity morphism on a monoid object. -/
@[simps]
def id (M : Mon_ C) : Hom M M where
hom := 𝟙 M.X
#align Mon_.id Mon_.id
instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) :=
⟨id M⟩
#align Mon_.hom_inhabited Mon_.homInhabited
/-- Composition of morphisms of monoid objects. -/
@[simps]
def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where
hom := f.hom ≫ g.hom
#align Mon_.comp Mon_.comp
instance : Category (Mon_ C) where
Hom M N := Hom M N
id := id
comp f g := comp f g
-- Porting note: added, as `Hom.ext` does not apply to a morphism.
@[ext]
lemma ext {X Y : Mon_ C} {f g : X ⟶ Y} (w : f.hom = g.hom) : f = g :=
Hom.ext _ _ w
@[simp]
theorem id_hom' (M : Mon_ C) : (𝟙 M : Hom M M).hom = 𝟙 M.X :=
rfl
#align Mon_.id_hom' Mon_.id_hom'
@[simp]
theorem comp_hom' {M N K : Mon_ C} (f : M ⟶ N) (g : N ⟶ K) :
(f ≫ g : Hom M K).hom = f.hom ≫ g.hom :=
rfl
#align Mon_.comp_hom' Mon_.comp_hom'
section
variable (C)
/-- The forgetful functor from monoid objects to the ambient category. -/
@[simps]
def forget : Mon_ C ⥤ C where
obj A := A.X
map f := f.hom
#align Mon_.forget Mon_.forget
end
instance forget_faithful : Faithful (@forget C _ _) where
#align Mon_.forget_faithful Mon_.forget_faithful
instance {A B : Mon_ C} (f : A ⟶ B) [e : IsIso ((forget C).map f)] : IsIso f.hom :=
e
/-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/
instance : ReflectsIsomorphisms (forget C) where
reflects f e :=
⟨⟨{ hom := inv f.hom
mul_hom := by
simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, ← tensor_comp_assoc,
IsIso.inv_hom_id, tensor_id, Category.id_comp] },
by aesop_cat⟩⟩
/-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X ≅ N.X) (one_f : M.one ≫ f.hom = N.one)
(mul_f : M.mul ≫ f.hom = (f.hom ⊗ f.hom) ≫ N.mul) : M ≅ N where
hom :=
{ hom := f.hom
one_hom := one_f
mul_hom := mul_f }
inv :=
{ hom := f.inv
one_hom := by rw [← one_f]; simp
mul_hom := by
rw [← cancel_mono f.hom]
slice_rhs 2 3 => rw [mul_f]
simp }
#align Mon_.iso_of_iso Mon_.isoOfIso
instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C ⟶ A) where
default :=
{ hom := A.one
one_hom := by dsimp; simp
mul_hom := by dsimp; simp [A.one_mul, unitors_equal] }
uniq f := by
ext; simp
rw [← Category.id_comp f.hom]
erw [f.one_hom]
#align Mon_.unique_hom_from_trivial Mon_.uniqueHomFromTrivial
open CategoryTheory.Limits
instance : HasInitial (Mon_ C) :=
hasInitial_of_unique (trivial C)
end Mon_
namespace CategoryTheory.LaxMonoidalFunctor
variable {C} {D : Type u₂} [Category.{v₂} D] [MonoidalCategory.{v₂} D]
-- TODO: mapMod F A : Mod A ⥤ Mod (F.mapMon A)
/-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one]
rw [F.toFunctor.map_id]
rw [F.right_unitality]
mul_assoc := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_assoc]
conv_lhs => rw [F.toFunctor.map_id]
conv_lhs => rw [F.toFunctor.map_comp, F.toFunctor.map_comp]
conv_rhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_rhs 3 4 => rw [F.μ_natural]
conv_rhs => | rw [F.toFunctor.map_id] | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one]
rw [F.toFunctor.map_id]
rw [F.right_unitality]
mul_assoc := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_assoc]
conv_lhs => rw [F.toFunctor.map_id]
conv_lhs => rw [F.toFunctor.map_comp, F.toFunctor.map_comp]
conv_rhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_rhs 3 4 => rw [F.μ_natural]
conv_rhs => | Mathlib.CategoryTheory.Monoidal.Mon_.202_0.NTUMzhXPwXsmsYt | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A | Mathlib_CategoryTheory_Monoidal_Mon_ |
C : Type u₁
inst✝³ : Category.{v₁, u₁} C
inst✝² : MonoidalCategory C
D : Type u₂
inst✝¹ : Category.{v₂, u₂} D
inst✝ : MonoidalCategory D
F : LaxMonoidalFunctor C D
A : Mon_ C
| (α_ (F.obj A.X) (F.obj A.X) (F.obj A.X)).hom ≫
(F.map (𝟙 A.X) ⊗ μ F A.X A.X) ≫ (μ F A.X (A.X ⊗ A.X) ≫ F.map (𝟙 A.X ⊗ A.mul)) ≫ F.map A.mul | /-
Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/
import Mathlib.CategoryTheory.Monoidal.Braided
import Mathlib.CategoryTheory.Monoidal.Discrete
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
import Mathlib.Algebra.PUnitInstances
#align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c"
/-!
# The category of monoids in a monoidal category.
We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to
the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if
`C` is braided, then the category of monoids is naturally monoidal.
-/
set_option linter.uppercaseLean3 false
universe v₁ v₂ u₁ u₂ u
open CategoryTheory MonoidalCategory
variable (C : Type u₁) [Category.{v₁} C] [MonoidalCategory.{v₁} C]
/-- A monoid object internal to a monoidal category.
When the monoidal category is preadditive, this is also sometimes called an "algebra object".
-/
structure Mon_ where
X : C
one : 𝟙_ C ⟶ X
mul : X ⊗ X ⟶ X
one_mul : (one ⊗ 𝟙 X) ≫ mul = (λ_ X).hom := by aesop_cat
mul_one : (𝟙 X ⊗ one) ≫ mul = (ρ_ X).hom := by aesop_cat
-- Obviously there is some flexibility stating this axiom.
-- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`,
-- and chooses to place the associator on the right-hand side.
-- The heuristic is that unitors and associators "don't have much weight".
mul_assoc : (mul ⊗ 𝟙 X) ≫ mul = (α_ X X X).hom ≫ (𝟙 X ⊗ mul) ≫ mul := by aesop_cat
#align Mon_ Mon_
attribute [reassoc] Mon_.one_mul Mon_.mul_one
-- We prove a more general `@[simp]` lemma below.
attribute [reassoc (attr := simp)] Mon_.mul_assoc
namespace Mon_
/-- The trivial monoid object. We later show this is initial in `Mon_ C`.
-/
@[simps]
def trivial : Mon_ C where
X := 𝟙_ C
one := 𝟙 _
mul := (λ_ _).hom
mul_assoc := by coherence
mul_one := by coherence
#align Mon_.trivial Mon_.trivial
instance : Inhabited (Mon_ C) :=
⟨trivial C⟩
variable {C}
variable {M : Mon_ C}
@[simp]
theorem one_mul_hom {Z : C} (f : Z ⟶ M.X) : (M.one ⊗ f) ≫ M.mul = (λ_ Z).hom ≫ f := by
rw [← id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality]
#align Mon_.one_mul_hom Mon_.one_mul_hom
@[simp]
theorem mul_one_hom {Z : C} (f : Z ⟶ M.X) : (f ⊗ M.one) ≫ M.mul = (ρ_ Z).hom ≫ f := by
rw [← tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality]
#align Mon_.mul_one_hom Mon_.mul_one_hom
theorem assoc_flip :
(𝟙 M.X ⊗ M.mul) ≫ M.mul = (α_ M.X M.X M.X).inv ≫ (M.mul ⊗ 𝟙 M.X) ≫ M.mul := by simp
#align Mon_.assoc_flip Mon_.assoc_flip
/-- A morphism of monoid objects. -/
@[ext]
structure Hom (M N : Mon_ C) where
hom : M.X ⟶ N.X
one_hom : M.one ≫ hom = N.one := by aesop_cat
mul_hom : M.mul ≫ hom = (hom ⊗ hom) ≫ N.mul := by aesop_cat
#align Mon_.hom Mon_.Hom
attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom
/-- The identity morphism on a monoid object. -/
@[simps]
def id (M : Mon_ C) : Hom M M where
hom := 𝟙 M.X
#align Mon_.id Mon_.id
instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) :=
⟨id M⟩
#align Mon_.hom_inhabited Mon_.homInhabited
/-- Composition of morphisms of monoid objects. -/
@[simps]
def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where
hom := f.hom ≫ g.hom
#align Mon_.comp Mon_.comp
instance : Category (Mon_ C) where
Hom M N := Hom M N
id := id
comp f g := comp f g
-- Porting note: added, as `Hom.ext` does not apply to a morphism.
@[ext]
lemma ext {X Y : Mon_ C} {f g : X ⟶ Y} (w : f.hom = g.hom) : f = g :=
Hom.ext _ _ w
@[simp]
theorem id_hom' (M : Mon_ C) : (𝟙 M : Hom M M).hom = 𝟙 M.X :=
rfl
#align Mon_.id_hom' Mon_.id_hom'
@[simp]
theorem comp_hom' {M N K : Mon_ C} (f : M ⟶ N) (g : N ⟶ K) :
(f ≫ g : Hom M K).hom = f.hom ≫ g.hom :=
rfl
#align Mon_.comp_hom' Mon_.comp_hom'
section
variable (C)
/-- The forgetful functor from monoid objects to the ambient category. -/
@[simps]
def forget : Mon_ C ⥤ C where
obj A := A.X
map f := f.hom
#align Mon_.forget Mon_.forget
end
instance forget_faithful : Faithful (@forget C _ _) where
#align Mon_.forget_faithful Mon_.forget_faithful
instance {A B : Mon_ C} (f : A ⟶ B) [e : IsIso ((forget C).map f)] : IsIso f.hom :=
e
/-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/
instance : ReflectsIsomorphisms (forget C) where
reflects f e :=
⟨⟨{ hom := inv f.hom
mul_hom := by
simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, ← tensor_comp_assoc,
IsIso.inv_hom_id, tensor_id, Category.id_comp] },
by aesop_cat⟩⟩
/-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X ≅ N.X) (one_f : M.one ≫ f.hom = N.one)
(mul_f : M.mul ≫ f.hom = (f.hom ⊗ f.hom) ≫ N.mul) : M ≅ N where
hom :=
{ hom := f.hom
one_hom := one_f
mul_hom := mul_f }
inv :=
{ hom := f.inv
one_hom := by rw [← one_f]; simp
mul_hom := by
rw [← cancel_mono f.hom]
slice_rhs 2 3 => rw [mul_f]
simp }
#align Mon_.iso_of_iso Mon_.isoOfIso
instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C ⟶ A) where
default :=
{ hom := A.one
one_hom := by dsimp; simp
mul_hom := by dsimp; simp [A.one_mul, unitors_equal] }
uniq f := by
ext; simp
rw [← Category.id_comp f.hom]
erw [f.one_hom]
#align Mon_.unique_hom_from_trivial Mon_.uniqueHomFromTrivial
open CategoryTheory.Limits
instance : HasInitial (Mon_ C) :=
hasInitial_of_unique (trivial C)
end Mon_
namespace CategoryTheory.LaxMonoidalFunctor
variable {C} {D : Type u₂} [Category.{v₂} D] [MonoidalCategory.{v₂} D]
-- TODO: mapMod F A : Mod A ⥤ Mod (F.mapMon A)
/-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one]
rw [F.toFunctor.map_id]
rw [F.right_unitality]
mul_assoc := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_assoc]
conv_lhs => rw [F.toFunctor.map_id]
conv_lhs => rw [F.toFunctor.map_comp, F.toFunctor.map_comp]
conv_rhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_rhs 3 4 => rw [F.μ_natural]
conv_rhs => | rw [F.toFunctor.map_id] | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one]
rw [F.toFunctor.map_id]
rw [F.right_unitality]
mul_assoc := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_assoc]
conv_lhs => rw [F.toFunctor.map_id]
conv_lhs => rw [F.toFunctor.map_comp, F.toFunctor.map_comp]
conv_rhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_rhs 3 4 => rw [F.μ_natural]
conv_rhs => | Mathlib.CategoryTheory.Monoidal.Mon_.202_0.NTUMzhXPwXsmsYt | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A | Mathlib_CategoryTheory_Monoidal_Mon_ |
C : Type u₁
inst✝³ : Category.{v₁, u₁} C
inst✝² : MonoidalCategory C
D : Type u₂
inst✝¹ : Category.{v₂, u₂} D
inst✝ : MonoidalCategory D
F : LaxMonoidalFunctor C D
A : Mon_ C
⊢ (μ F A.X A.X ⊗ 𝟙 (F.obj A.X)) ≫
μ F (A.X ⊗ A.X) A.X ≫ F.map (α_ A.X A.X A.X).hom ≫ F.map (𝟙 A.X ⊗ A.mul) ≫ F.map A.mul =
(α_ (F.obj A.X) (F.obj A.X) (F.obj A.X)).hom ≫
(𝟙 (F.obj A.X) ⊗ μ F A.X A.X) ≫ (μ F A.X (A.X ⊗ A.X) ≫ F.map (𝟙 A.X ⊗ A.mul)) ≫ F.map A.mul | /-
Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/
import Mathlib.CategoryTheory.Monoidal.Braided
import Mathlib.CategoryTheory.Monoidal.Discrete
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
import Mathlib.Algebra.PUnitInstances
#align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c"
/-!
# The category of monoids in a monoidal category.
We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to
the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if
`C` is braided, then the category of monoids is naturally monoidal.
-/
set_option linter.uppercaseLean3 false
universe v₁ v₂ u₁ u₂ u
open CategoryTheory MonoidalCategory
variable (C : Type u₁) [Category.{v₁} C] [MonoidalCategory.{v₁} C]
/-- A monoid object internal to a monoidal category.
When the monoidal category is preadditive, this is also sometimes called an "algebra object".
-/
structure Mon_ where
X : C
one : 𝟙_ C ⟶ X
mul : X ⊗ X ⟶ X
one_mul : (one ⊗ 𝟙 X) ≫ mul = (λ_ X).hom := by aesop_cat
mul_one : (𝟙 X ⊗ one) ≫ mul = (ρ_ X).hom := by aesop_cat
-- Obviously there is some flexibility stating this axiom.
-- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`,
-- and chooses to place the associator on the right-hand side.
-- The heuristic is that unitors and associators "don't have much weight".
mul_assoc : (mul ⊗ 𝟙 X) ≫ mul = (α_ X X X).hom ≫ (𝟙 X ⊗ mul) ≫ mul := by aesop_cat
#align Mon_ Mon_
attribute [reassoc] Mon_.one_mul Mon_.mul_one
-- We prove a more general `@[simp]` lemma below.
attribute [reassoc (attr := simp)] Mon_.mul_assoc
namespace Mon_
/-- The trivial monoid object. We later show this is initial in `Mon_ C`.
-/
@[simps]
def trivial : Mon_ C where
X := 𝟙_ C
one := 𝟙 _
mul := (λ_ _).hom
mul_assoc := by coherence
mul_one := by coherence
#align Mon_.trivial Mon_.trivial
instance : Inhabited (Mon_ C) :=
⟨trivial C⟩
variable {C}
variable {M : Mon_ C}
@[simp]
theorem one_mul_hom {Z : C} (f : Z ⟶ M.X) : (M.one ⊗ f) ≫ M.mul = (λ_ Z).hom ≫ f := by
rw [← id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality]
#align Mon_.one_mul_hom Mon_.one_mul_hom
@[simp]
theorem mul_one_hom {Z : C} (f : Z ⟶ M.X) : (f ⊗ M.one) ≫ M.mul = (ρ_ Z).hom ≫ f := by
rw [← tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality]
#align Mon_.mul_one_hom Mon_.mul_one_hom
theorem assoc_flip :
(𝟙 M.X ⊗ M.mul) ≫ M.mul = (α_ M.X M.X M.X).inv ≫ (M.mul ⊗ 𝟙 M.X) ≫ M.mul := by simp
#align Mon_.assoc_flip Mon_.assoc_flip
/-- A morphism of monoid objects. -/
@[ext]
structure Hom (M N : Mon_ C) where
hom : M.X ⟶ N.X
one_hom : M.one ≫ hom = N.one := by aesop_cat
mul_hom : M.mul ≫ hom = (hom ⊗ hom) ≫ N.mul := by aesop_cat
#align Mon_.hom Mon_.Hom
attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom
/-- The identity morphism on a monoid object. -/
@[simps]
def id (M : Mon_ C) : Hom M M where
hom := 𝟙 M.X
#align Mon_.id Mon_.id
instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) :=
⟨id M⟩
#align Mon_.hom_inhabited Mon_.homInhabited
/-- Composition of morphisms of monoid objects. -/
@[simps]
def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where
hom := f.hom ≫ g.hom
#align Mon_.comp Mon_.comp
instance : Category (Mon_ C) where
Hom M N := Hom M N
id := id
comp f g := comp f g
-- Porting note: added, as `Hom.ext` does not apply to a morphism.
@[ext]
lemma ext {X Y : Mon_ C} {f g : X ⟶ Y} (w : f.hom = g.hom) : f = g :=
Hom.ext _ _ w
@[simp]
theorem id_hom' (M : Mon_ C) : (𝟙 M : Hom M M).hom = 𝟙 M.X :=
rfl
#align Mon_.id_hom' Mon_.id_hom'
@[simp]
theorem comp_hom' {M N K : Mon_ C} (f : M ⟶ N) (g : N ⟶ K) :
(f ≫ g : Hom M K).hom = f.hom ≫ g.hom :=
rfl
#align Mon_.comp_hom' Mon_.comp_hom'
section
variable (C)
/-- The forgetful functor from monoid objects to the ambient category. -/
@[simps]
def forget : Mon_ C ⥤ C where
obj A := A.X
map f := f.hom
#align Mon_.forget Mon_.forget
end
instance forget_faithful : Faithful (@forget C _ _) where
#align Mon_.forget_faithful Mon_.forget_faithful
instance {A B : Mon_ C} (f : A ⟶ B) [e : IsIso ((forget C).map f)] : IsIso f.hom :=
e
/-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/
instance : ReflectsIsomorphisms (forget C) where
reflects f e :=
⟨⟨{ hom := inv f.hom
mul_hom := by
simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, ← tensor_comp_assoc,
IsIso.inv_hom_id, tensor_id, Category.id_comp] },
by aesop_cat⟩⟩
/-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X ≅ N.X) (one_f : M.one ≫ f.hom = N.one)
(mul_f : M.mul ≫ f.hom = (f.hom ⊗ f.hom) ≫ N.mul) : M ≅ N where
hom :=
{ hom := f.hom
one_hom := one_f
mul_hom := mul_f }
inv :=
{ hom := f.inv
one_hom := by rw [← one_f]; simp
mul_hom := by
rw [← cancel_mono f.hom]
slice_rhs 2 3 => rw [mul_f]
simp }
#align Mon_.iso_of_iso Mon_.isoOfIso
instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C ⟶ A) where
default :=
{ hom := A.one
one_hom := by dsimp; simp
mul_hom := by dsimp; simp [A.one_mul, unitors_equal] }
uniq f := by
ext; simp
rw [← Category.id_comp f.hom]
erw [f.one_hom]
#align Mon_.unique_hom_from_trivial Mon_.uniqueHomFromTrivial
open CategoryTheory.Limits
instance : HasInitial (Mon_ C) :=
hasInitial_of_unique (trivial C)
end Mon_
namespace CategoryTheory.LaxMonoidalFunctor
variable {C} {D : Type u₂} [Category.{v₂} D] [MonoidalCategory.{v₂} D]
-- TODO: mapMod F A : Mod A ⥤ Mod (F.mapMon A)
/-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one]
rw [F.toFunctor.map_id]
rw [F.right_unitality]
mul_assoc := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_assoc]
conv_lhs => rw [F.toFunctor.map_id]
conv_lhs => rw [F.toFunctor.map_comp, F.toFunctor.map_comp]
conv_rhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_rhs 3 4 => rw [F.μ_natural]
conv_rhs => rw [F.toFunctor.map_id]
| slice_rhs 1 3 => rw [← F.associativity] | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one]
rw [F.toFunctor.map_id]
rw [F.right_unitality]
mul_assoc := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_assoc]
conv_lhs => rw [F.toFunctor.map_id]
conv_lhs => rw [F.toFunctor.map_comp, F.toFunctor.map_comp]
conv_rhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_rhs 3 4 => rw [F.μ_natural]
conv_rhs => rw [F.toFunctor.map_id]
| Mathlib.CategoryTheory.Monoidal.Mon_.202_0.NTUMzhXPwXsmsYt | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A | Mathlib_CategoryTheory_Monoidal_Mon_ |
case a.a
C : Type u₁
inst✝³ : Category.{v₁, u₁} C
inst✝² : MonoidalCategory C
D : Type u₂
inst✝¹ : Category.{v₂, u₂} D
inst✝ : MonoidalCategory D
F : LaxMonoidalFunctor C D
A : Mon_ C
| (α_ (F.obj A.X) (F.obj A.X) (F.obj A.X)).hom ≫ (𝟙 (F.obj A.X) ⊗ μ F A.X A.X) ≫ μ F A.X (A.X ⊗ A.X)
case a.a
C : Type u₁
inst✝³ : Category.{v₁, u₁} C
inst✝² : MonoidalCategory C
D : Type u₂
inst✝¹ : Category.{v₂, u₂} D
inst✝ : MonoidalCategory D
F : LaxMonoidalFunctor C D
A : Mon_ C
| F.map (𝟙 A.X ⊗ A.mul)
case a
C : Type u₁
inst✝³ : Category.{v₁, u₁} C
inst✝² : MonoidalCategory C
D : Type u₂
inst✝¹ : Category.{v₂, u₂} D
inst✝ : MonoidalCategory D
F : LaxMonoidalFunctor C D
A : Mon_ C
| F.map A.mul | /-
Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/
import Mathlib.CategoryTheory.Monoidal.Braided
import Mathlib.CategoryTheory.Monoidal.Discrete
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
import Mathlib.Algebra.PUnitInstances
#align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c"
/-!
# The category of monoids in a monoidal category.
We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to
the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if
`C` is braided, then the category of monoids is naturally monoidal.
-/
set_option linter.uppercaseLean3 false
universe v₁ v₂ u₁ u₂ u
open CategoryTheory MonoidalCategory
variable (C : Type u₁) [Category.{v₁} C] [MonoidalCategory.{v₁} C]
/-- A monoid object internal to a monoidal category.
When the monoidal category is preadditive, this is also sometimes called an "algebra object".
-/
structure Mon_ where
X : C
one : 𝟙_ C ⟶ X
mul : X ⊗ X ⟶ X
one_mul : (one ⊗ 𝟙 X) ≫ mul = (λ_ X).hom := by aesop_cat
mul_one : (𝟙 X ⊗ one) ≫ mul = (ρ_ X).hom := by aesop_cat
-- Obviously there is some flexibility stating this axiom.
-- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`,
-- and chooses to place the associator on the right-hand side.
-- The heuristic is that unitors and associators "don't have much weight".
mul_assoc : (mul ⊗ 𝟙 X) ≫ mul = (α_ X X X).hom ≫ (𝟙 X ⊗ mul) ≫ mul := by aesop_cat
#align Mon_ Mon_
attribute [reassoc] Mon_.one_mul Mon_.mul_one
-- We prove a more general `@[simp]` lemma below.
attribute [reassoc (attr := simp)] Mon_.mul_assoc
namespace Mon_
/-- The trivial monoid object. We later show this is initial in `Mon_ C`.
-/
@[simps]
def trivial : Mon_ C where
X := 𝟙_ C
one := 𝟙 _
mul := (λ_ _).hom
mul_assoc := by coherence
mul_one := by coherence
#align Mon_.trivial Mon_.trivial
instance : Inhabited (Mon_ C) :=
⟨trivial C⟩
variable {C}
variable {M : Mon_ C}
@[simp]
theorem one_mul_hom {Z : C} (f : Z ⟶ M.X) : (M.one ⊗ f) ≫ M.mul = (λ_ Z).hom ≫ f := by
rw [← id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality]
#align Mon_.one_mul_hom Mon_.one_mul_hom
@[simp]
theorem mul_one_hom {Z : C} (f : Z ⟶ M.X) : (f ⊗ M.one) ≫ M.mul = (ρ_ Z).hom ≫ f := by
rw [← tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality]
#align Mon_.mul_one_hom Mon_.mul_one_hom
theorem assoc_flip :
(𝟙 M.X ⊗ M.mul) ≫ M.mul = (α_ M.X M.X M.X).inv ≫ (M.mul ⊗ 𝟙 M.X) ≫ M.mul := by simp
#align Mon_.assoc_flip Mon_.assoc_flip
/-- A morphism of monoid objects. -/
@[ext]
structure Hom (M N : Mon_ C) where
hom : M.X ⟶ N.X
one_hom : M.one ≫ hom = N.one := by aesop_cat
mul_hom : M.mul ≫ hom = (hom ⊗ hom) ≫ N.mul := by aesop_cat
#align Mon_.hom Mon_.Hom
attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom
/-- The identity morphism on a monoid object. -/
@[simps]
def id (M : Mon_ C) : Hom M M where
hom := 𝟙 M.X
#align Mon_.id Mon_.id
instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) :=
⟨id M⟩
#align Mon_.hom_inhabited Mon_.homInhabited
/-- Composition of morphisms of monoid objects. -/
@[simps]
def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where
hom := f.hom ≫ g.hom
#align Mon_.comp Mon_.comp
instance : Category (Mon_ C) where
Hom M N := Hom M N
id := id
comp f g := comp f g
-- Porting note: added, as `Hom.ext` does not apply to a morphism.
@[ext]
lemma ext {X Y : Mon_ C} {f g : X ⟶ Y} (w : f.hom = g.hom) : f = g :=
Hom.ext _ _ w
@[simp]
theorem id_hom' (M : Mon_ C) : (𝟙 M : Hom M M).hom = 𝟙 M.X :=
rfl
#align Mon_.id_hom' Mon_.id_hom'
@[simp]
theorem comp_hom' {M N K : Mon_ C} (f : M ⟶ N) (g : N ⟶ K) :
(f ≫ g : Hom M K).hom = f.hom ≫ g.hom :=
rfl
#align Mon_.comp_hom' Mon_.comp_hom'
section
variable (C)
/-- The forgetful functor from monoid objects to the ambient category. -/
@[simps]
def forget : Mon_ C ⥤ C where
obj A := A.X
map f := f.hom
#align Mon_.forget Mon_.forget
end
instance forget_faithful : Faithful (@forget C _ _) where
#align Mon_.forget_faithful Mon_.forget_faithful
instance {A B : Mon_ C} (f : A ⟶ B) [e : IsIso ((forget C).map f)] : IsIso f.hom :=
e
/-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/
instance : ReflectsIsomorphisms (forget C) where
reflects f e :=
⟨⟨{ hom := inv f.hom
mul_hom := by
simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, ← tensor_comp_assoc,
IsIso.inv_hom_id, tensor_id, Category.id_comp] },
by aesop_cat⟩⟩
/-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X ≅ N.X) (one_f : M.one ≫ f.hom = N.one)
(mul_f : M.mul ≫ f.hom = (f.hom ⊗ f.hom) ≫ N.mul) : M ≅ N where
hom :=
{ hom := f.hom
one_hom := one_f
mul_hom := mul_f }
inv :=
{ hom := f.inv
one_hom := by rw [← one_f]; simp
mul_hom := by
rw [← cancel_mono f.hom]
slice_rhs 2 3 => rw [mul_f]
simp }
#align Mon_.iso_of_iso Mon_.isoOfIso
instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C ⟶ A) where
default :=
{ hom := A.one
one_hom := by dsimp; simp
mul_hom := by dsimp; simp [A.one_mul, unitors_equal] }
uniq f := by
ext; simp
rw [← Category.id_comp f.hom]
erw [f.one_hom]
#align Mon_.unique_hom_from_trivial Mon_.uniqueHomFromTrivial
open CategoryTheory.Limits
instance : HasInitial (Mon_ C) :=
hasInitial_of_unique (trivial C)
end Mon_
namespace CategoryTheory.LaxMonoidalFunctor
variable {C} {D : Type u₂} [Category.{v₂} D] [MonoidalCategory.{v₂} D]
-- TODO: mapMod F A : Mod A ⥤ Mod (F.mapMon A)
/-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one]
rw [F.toFunctor.map_id]
rw [F.right_unitality]
mul_assoc := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_assoc]
conv_lhs => rw [F.toFunctor.map_id]
conv_lhs => rw [F.toFunctor.map_comp, F.toFunctor.map_comp]
conv_rhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_rhs 3 4 => rw [F.μ_natural]
conv_rhs => rw [F.toFunctor.map_id]
slice_rhs 1 3 => | rw [← F.associativity] | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one]
rw [F.toFunctor.map_id]
rw [F.right_unitality]
mul_assoc := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_assoc]
conv_lhs => rw [F.toFunctor.map_id]
conv_lhs => rw [F.toFunctor.map_comp, F.toFunctor.map_comp]
conv_rhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_rhs 3 4 => rw [F.μ_natural]
conv_rhs => rw [F.toFunctor.map_id]
slice_rhs 1 3 => | Mathlib.CategoryTheory.Monoidal.Mon_.202_0.NTUMzhXPwXsmsYt | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A | Mathlib_CategoryTheory_Monoidal_Mon_ |
case a.a
C : Type u₁
inst✝³ : Category.{v₁, u₁} C
inst✝² : MonoidalCategory C
D : Type u₂
inst✝¹ : Category.{v₂, u₂} D
inst✝ : MonoidalCategory D
F : LaxMonoidalFunctor C D
A : Mon_ C
| (α_ (F.obj A.X) (F.obj A.X) (F.obj A.X)).hom ≫ (𝟙 (F.obj A.X) ⊗ μ F A.X A.X) ≫ μ F A.X (A.X ⊗ A.X)
case a.a
C : Type u₁
inst✝³ : Category.{v₁, u₁} C
inst✝² : MonoidalCategory C
D : Type u₂
inst✝¹ : Category.{v₂, u₂} D
inst✝ : MonoidalCategory D
F : LaxMonoidalFunctor C D
A : Mon_ C
| F.map (𝟙 A.X ⊗ A.mul)
case a
C : Type u₁
inst✝³ : Category.{v₁, u₁} C
inst✝² : MonoidalCategory C
D : Type u₂
inst✝¹ : Category.{v₂, u₂} D
inst✝ : MonoidalCategory D
F : LaxMonoidalFunctor C D
A : Mon_ C
| F.map A.mul | /-
Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/
import Mathlib.CategoryTheory.Monoidal.Braided
import Mathlib.CategoryTheory.Monoidal.Discrete
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
import Mathlib.Algebra.PUnitInstances
#align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c"
/-!
# The category of monoids in a monoidal category.
We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to
the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if
`C` is braided, then the category of monoids is naturally monoidal.
-/
set_option linter.uppercaseLean3 false
universe v₁ v₂ u₁ u₂ u
open CategoryTheory MonoidalCategory
variable (C : Type u₁) [Category.{v₁} C] [MonoidalCategory.{v₁} C]
/-- A monoid object internal to a monoidal category.
When the monoidal category is preadditive, this is also sometimes called an "algebra object".
-/
structure Mon_ where
X : C
one : 𝟙_ C ⟶ X
mul : X ⊗ X ⟶ X
one_mul : (one ⊗ 𝟙 X) ≫ mul = (λ_ X).hom := by aesop_cat
mul_one : (𝟙 X ⊗ one) ≫ mul = (ρ_ X).hom := by aesop_cat
-- Obviously there is some flexibility stating this axiom.
-- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`,
-- and chooses to place the associator on the right-hand side.
-- The heuristic is that unitors and associators "don't have much weight".
mul_assoc : (mul ⊗ 𝟙 X) ≫ mul = (α_ X X X).hom ≫ (𝟙 X ⊗ mul) ≫ mul := by aesop_cat
#align Mon_ Mon_
attribute [reassoc] Mon_.one_mul Mon_.mul_one
-- We prove a more general `@[simp]` lemma below.
attribute [reassoc (attr := simp)] Mon_.mul_assoc
namespace Mon_
/-- The trivial monoid object. We later show this is initial in `Mon_ C`.
-/
@[simps]
def trivial : Mon_ C where
X := 𝟙_ C
one := 𝟙 _
mul := (λ_ _).hom
mul_assoc := by coherence
mul_one := by coherence
#align Mon_.trivial Mon_.trivial
instance : Inhabited (Mon_ C) :=
⟨trivial C⟩
variable {C}
variable {M : Mon_ C}
@[simp]
theorem one_mul_hom {Z : C} (f : Z ⟶ M.X) : (M.one ⊗ f) ≫ M.mul = (λ_ Z).hom ≫ f := by
rw [← id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality]
#align Mon_.one_mul_hom Mon_.one_mul_hom
@[simp]
theorem mul_one_hom {Z : C} (f : Z ⟶ M.X) : (f ⊗ M.one) ≫ M.mul = (ρ_ Z).hom ≫ f := by
rw [← tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality]
#align Mon_.mul_one_hom Mon_.mul_one_hom
theorem assoc_flip :
(𝟙 M.X ⊗ M.mul) ≫ M.mul = (α_ M.X M.X M.X).inv ≫ (M.mul ⊗ 𝟙 M.X) ≫ M.mul := by simp
#align Mon_.assoc_flip Mon_.assoc_flip
/-- A morphism of monoid objects. -/
@[ext]
structure Hom (M N : Mon_ C) where
hom : M.X ⟶ N.X
one_hom : M.one ≫ hom = N.one := by aesop_cat
mul_hom : M.mul ≫ hom = (hom ⊗ hom) ≫ N.mul := by aesop_cat
#align Mon_.hom Mon_.Hom
attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom
/-- The identity morphism on a monoid object. -/
@[simps]
def id (M : Mon_ C) : Hom M M where
hom := 𝟙 M.X
#align Mon_.id Mon_.id
instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) :=
⟨id M⟩
#align Mon_.hom_inhabited Mon_.homInhabited
/-- Composition of morphisms of monoid objects. -/
@[simps]
def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where
hom := f.hom ≫ g.hom
#align Mon_.comp Mon_.comp
instance : Category (Mon_ C) where
Hom M N := Hom M N
id := id
comp f g := comp f g
-- Porting note: added, as `Hom.ext` does not apply to a morphism.
@[ext]
lemma ext {X Y : Mon_ C} {f g : X ⟶ Y} (w : f.hom = g.hom) : f = g :=
Hom.ext _ _ w
@[simp]
theorem id_hom' (M : Mon_ C) : (𝟙 M : Hom M M).hom = 𝟙 M.X :=
rfl
#align Mon_.id_hom' Mon_.id_hom'
@[simp]
theorem comp_hom' {M N K : Mon_ C} (f : M ⟶ N) (g : N ⟶ K) :
(f ≫ g : Hom M K).hom = f.hom ≫ g.hom :=
rfl
#align Mon_.comp_hom' Mon_.comp_hom'
section
variable (C)
/-- The forgetful functor from monoid objects to the ambient category. -/
@[simps]
def forget : Mon_ C ⥤ C where
obj A := A.X
map f := f.hom
#align Mon_.forget Mon_.forget
end
instance forget_faithful : Faithful (@forget C _ _) where
#align Mon_.forget_faithful Mon_.forget_faithful
instance {A B : Mon_ C} (f : A ⟶ B) [e : IsIso ((forget C).map f)] : IsIso f.hom :=
e
/-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/
instance : ReflectsIsomorphisms (forget C) where
reflects f e :=
⟨⟨{ hom := inv f.hom
mul_hom := by
simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, ← tensor_comp_assoc,
IsIso.inv_hom_id, tensor_id, Category.id_comp] },
by aesop_cat⟩⟩
/-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X ≅ N.X) (one_f : M.one ≫ f.hom = N.one)
(mul_f : M.mul ≫ f.hom = (f.hom ⊗ f.hom) ≫ N.mul) : M ≅ N where
hom :=
{ hom := f.hom
one_hom := one_f
mul_hom := mul_f }
inv :=
{ hom := f.inv
one_hom := by rw [← one_f]; simp
mul_hom := by
rw [← cancel_mono f.hom]
slice_rhs 2 3 => rw [mul_f]
simp }
#align Mon_.iso_of_iso Mon_.isoOfIso
instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C ⟶ A) where
default :=
{ hom := A.one
one_hom := by dsimp; simp
mul_hom := by dsimp; simp [A.one_mul, unitors_equal] }
uniq f := by
ext; simp
rw [← Category.id_comp f.hom]
erw [f.one_hom]
#align Mon_.unique_hom_from_trivial Mon_.uniqueHomFromTrivial
open CategoryTheory.Limits
instance : HasInitial (Mon_ C) :=
hasInitial_of_unique (trivial C)
end Mon_
namespace CategoryTheory.LaxMonoidalFunctor
variable {C} {D : Type u₂} [Category.{v₂} D] [MonoidalCategory.{v₂} D]
-- TODO: mapMod F A : Mod A ⥤ Mod (F.mapMon A)
/-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one]
rw [F.toFunctor.map_id]
rw [F.right_unitality]
mul_assoc := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_assoc]
conv_lhs => rw [F.toFunctor.map_id]
conv_lhs => rw [F.toFunctor.map_comp, F.toFunctor.map_comp]
conv_rhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_rhs 3 4 => rw [F.μ_natural]
conv_rhs => rw [F.toFunctor.map_id]
slice_rhs 1 3 => | rw [← F.associativity] | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one]
rw [F.toFunctor.map_id]
rw [F.right_unitality]
mul_assoc := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_assoc]
conv_lhs => rw [F.toFunctor.map_id]
conv_lhs => rw [F.toFunctor.map_comp, F.toFunctor.map_comp]
conv_rhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_rhs 3 4 => rw [F.μ_natural]
conv_rhs => rw [F.toFunctor.map_id]
slice_rhs 1 3 => | Mathlib.CategoryTheory.Monoidal.Mon_.202_0.NTUMzhXPwXsmsYt | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A | Mathlib_CategoryTheory_Monoidal_Mon_ |
case a.a
C : Type u₁
inst✝³ : Category.{v₁, u₁} C
inst✝² : MonoidalCategory C
D : Type u₂
inst✝¹ : Category.{v₂, u₂} D
inst✝ : MonoidalCategory D
F : LaxMonoidalFunctor C D
A : Mon_ C
| (α_ (F.obj A.X) (F.obj A.X) (F.obj A.X)).hom ≫ (𝟙 (F.obj A.X) ⊗ μ F A.X A.X) ≫ μ F A.X (A.X ⊗ A.X)
case a.a
C : Type u₁
inst✝³ : Category.{v₁, u₁} C
inst✝² : MonoidalCategory C
D : Type u₂
inst✝¹ : Category.{v₂, u₂} D
inst✝ : MonoidalCategory D
F : LaxMonoidalFunctor C D
A : Mon_ C
| F.map (𝟙 A.X ⊗ A.mul)
case a
C : Type u₁
inst✝³ : Category.{v₁, u₁} C
inst✝² : MonoidalCategory C
D : Type u₂
inst✝¹ : Category.{v₂, u₂} D
inst✝ : MonoidalCategory D
F : LaxMonoidalFunctor C D
A : Mon_ C
| F.map A.mul | /-
Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/
import Mathlib.CategoryTheory.Monoidal.Braided
import Mathlib.CategoryTheory.Monoidal.Discrete
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
import Mathlib.Algebra.PUnitInstances
#align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c"
/-!
# The category of monoids in a monoidal category.
We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to
the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if
`C` is braided, then the category of monoids is naturally monoidal.
-/
set_option linter.uppercaseLean3 false
universe v₁ v₂ u₁ u₂ u
open CategoryTheory MonoidalCategory
variable (C : Type u₁) [Category.{v₁} C] [MonoidalCategory.{v₁} C]
/-- A monoid object internal to a monoidal category.
When the monoidal category is preadditive, this is also sometimes called an "algebra object".
-/
structure Mon_ where
X : C
one : 𝟙_ C ⟶ X
mul : X ⊗ X ⟶ X
one_mul : (one ⊗ 𝟙 X) ≫ mul = (λ_ X).hom := by aesop_cat
mul_one : (𝟙 X ⊗ one) ≫ mul = (ρ_ X).hom := by aesop_cat
-- Obviously there is some flexibility stating this axiom.
-- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`,
-- and chooses to place the associator on the right-hand side.
-- The heuristic is that unitors and associators "don't have much weight".
mul_assoc : (mul ⊗ 𝟙 X) ≫ mul = (α_ X X X).hom ≫ (𝟙 X ⊗ mul) ≫ mul := by aesop_cat
#align Mon_ Mon_
attribute [reassoc] Mon_.one_mul Mon_.mul_one
-- We prove a more general `@[simp]` lemma below.
attribute [reassoc (attr := simp)] Mon_.mul_assoc
namespace Mon_
/-- The trivial monoid object. We later show this is initial in `Mon_ C`.
-/
@[simps]
def trivial : Mon_ C where
X := 𝟙_ C
one := 𝟙 _
mul := (λ_ _).hom
mul_assoc := by coherence
mul_one := by coherence
#align Mon_.trivial Mon_.trivial
instance : Inhabited (Mon_ C) :=
⟨trivial C⟩
variable {C}
variable {M : Mon_ C}
@[simp]
theorem one_mul_hom {Z : C} (f : Z ⟶ M.X) : (M.one ⊗ f) ≫ M.mul = (λ_ Z).hom ≫ f := by
rw [← id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality]
#align Mon_.one_mul_hom Mon_.one_mul_hom
@[simp]
theorem mul_one_hom {Z : C} (f : Z ⟶ M.X) : (f ⊗ M.one) ≫ M.mul = (ρ_ Z).hom ≫ f := by
rw [← tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality]
#align Mon_.mul_one_hom Mon_.mul_one_hom
theorem assoc_flip :
(𝟙 M.X ⊗ M.mul) ≫ M.mul = (α_ M.X M.X M.X).inv ≫ (M.mul ⊗ 𝟙 M.X) ≫ M.mul := by simp
#align Mon_.assoc_flip Mon_.assoc_flip
/-- A morphism of monoid objects. -/
@[ext]
structure Hom (M N : Mon_ C) where
hom : M.X ⟶ N.X
one_hom : M.one ≫ hom = N.one := by aesop_cat
mul_hom : M.mul ≫ hom = (hom ⊗ hom) ≫ N.mul := by aesop_cat
#align Mon_.hom Mon_.Hom
attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom
/-- The identity morphism on a monoid object. -/
@[simps]
def id (M : Mon_ C) : Hom M M where
hom := 𝟙 M.X
#align Mon_.id Mon_.id
instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) :=
⟨id M⟩
#align Mon_.hom_inhabited Mon_.homInhabited
/-- Composition of morphisms of monoid objects. -/
@[simps]
def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where
hom := f.hom ≫ g.hom
#align Mon_.comp Mon_.comp
instance : Category (Mon_ C) where
Hom M N := Hom M N
id := id
comp f g := comp f g
-- Porting note: added, as `Hom.ext` does not apply to a morphism.
@[ext]
lemma ext {X Y : Mon_ C} {f g : X ⟶ Y} (w : f.hom = g.hom) : f = g :=
Hom.ext _ _ w
@[simp]
theorem id_hom' (M : Mon_ C) : (𝟙 M : Hom M M).hom = 𝟙 M.X :=
rfl
#align Mon_.id_hom' Mon_.id_hom'
@[simp]
theorem comp_hom' {M N K : Mon_ C} (f : M ⟶ N) (g : N ⟶ K) :
(f ≫ g : Hom M K).hom = f.hom ≫ g.hom :=
rfl
#align Mon_.comp_hom' Mon_.comp_hom'
section
variable (C)
/-- The forgetful functor from monoid objects to the ambient category. -/
@[simps]
def forget : Mon_ C ⥤ C where
obj A := A.X
map f := f.hom
#align Mon_.forget Mon_.forget
end
instance forget_faithful : Faithful (@forget C _ _) where
#align Mon_.forget_faithful Mon_.forget_faithful
instance {A B : Mon_ C} (f : A ⟶ B) [e : IsIso ((forget C).map f)] : IsIso f.hom :=
e
/-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/
instance : ReflectsIsomorphisms (forget C) where
reflects f e :=
⟨⟨{ hom := inv f.hom
mul_hom := by
simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, ← tensor_comp_assoc,
IsIso.inv_hom_id, tensor_id, Category.id_comp] },
by aesop_cat⟩⟩
/-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X ≅ N.X) (one_f : M.one ≫ f.hom = N.one)
(mul_f : M.mul ≫ f.hom = (f.hom ⊗ f.hom) ≫ N.mul) : M ≅ N where
hom :=
{ hom := f.hom
one_hom := one_f
mul_hom := mul_f }
inv :=
{ hom := f.inv
one_hom := by rw [← one_f]; simp
mul_hom := by
rw [← cancel_mono f.hom]
slice_rhs 2 3 => rw [mul_f]
simp }
#align Mon_.iso_of_iso Mon_.isoOfIso
instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C ⟶ A) where
default :=
{ hom := A.one
one_hom := by dsimp; simp
mul_hom := by dsimp; simp [A.one_mul, unitors_equal] }
uniq f := by
ext; simp
rw [← Category.id_comp f.hom]
erw [f.one_hom]
#align Mon_.unique_hom_from_trivial Mon_.uniqueHomFromTrivial
open CategoryTheory.Limits
instance : HasInitial (Mon_ C) :=
hasInitial_of_unique (trivial C)
end Mon_
namespace CategoryTheory.LaxMonoidalFunctor
variable {C} {D : Type u₂} [Category.{v₂} D] [MonoidalCategory.{v₂} D]
-- TODO: mapMod F A : Mod A ⥤ Mod (F.mapMon A)
/-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one]
rw [F.toFunctor.map_id]
rw [F.right_unitality]
mul_assoc := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_assoc]
conv_lhs => rw [F.toFunctor.map_id]
conv_lhs => rw [F.toFunctor.map_comp, F.toFunctor.map_comp]
conv_rhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_rhs 3 4 => rw [F.μ_natural]
conv_rhs => rw [F.toFunctor.map_id]
slice_rhs 1 3 => | rw [← F.associativity] | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one]
rw [F.toFunctor.map_id]
rw [F.right_unitality]
mul_assoc := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_assoc]
conv_lhs => rw [F.toFunctor.map_id]
conv_lhs => rw [F.toFunctor.map_comp, F.toFunctor.map_comp]
conv_rhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_rhs 3 4 => rw [F.μ_natural]
conv_rhs => rw [F.toFunctor.map_id]
slice_rhs 1 3 => | Mathlib.CategoryTheory.Monoidal.Mon_.202_0.NTUMzhXPwXsmsYt | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A | Mathlib_CategoryTheory_Monoidal_Mon_ |
C : Type u₁
inst✝³ : Category.{v₁, u₁} C
inst✝² : MonoidalCategory C
D : Type u₂
inst✝¹ : Category.{v₂, u₂} D
inst✝ : MonoidalCategory D
F : LaxMonoidalFunctor C D
A : Mon_ C
⊢ (μ F A.X A.X ⊗ 𝟙 (F.obj A.X)) ≫
μ F (A.X ⊗ A.X) A.X ≫ F.map (α_ A.X A.X A.X).hom ≫ F.map (𝟙 A.X ⊗ A.mul) ≫ F.map A.mul =
(((μ F A.X A.X ⊗ 𝟙 (F.obj A.X)) ≫ μ F (A.X ⊗ A.X) A.X ≫ F.map (α_ A.X A.X A.X).hom) ≫ F.map (𝟙 A.X ⊗ A.mul)) ≫
F.map A.mul | /-
Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/
import Mathlib.CategoryTheory.Monoidal.Braided
import Mathlib.CategoryTheory.Monoidal.Discrete
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
import Mathlib.Algebra.PUnitInstances
#align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c"
/-!
# The category of monoids in a monoidal category.
We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to
the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if
`C` is braided, then the category of monoids is naturally monoidal.
-/
set_option linter.uppercaseLean3 false
universe v₁ v₂ u₁ u₂ u
open CategoryTheory MonoidalCategory
variable (C : Type u₁) [Category.{v₁} C] [MonoidalCategory.{v₁} C]
/-- A monoid object internal to a monoidal category.
When the monoidal category is preadditive, this is also sometimes called an "algebra object".
-/
structure Mon_ where
X : C
one : 𝟙_ C ⟶ X
mul : X ⊗ X ⟶ X
one_mul : (one ⊗ 𝟙 X) ≫ mul = (λ_ X).hom := by aesop_cat
mul_one : (𝟙 X ⊗ one) ≫ mul = (ρ_ X).hom := by aesop_cat
-- Obviously there is some flexibility stating this axiom.
-- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`,
-- and chooses to place the associator on the right-hand side.
-- The heuristic is that unitors and associators "don't have much weight".
mul_assoc : (mul ⊗ 𝟙 X) ≫ mul = (α_ X X X).hom ≫ (𝟙 X ⊗ mul) ≫ mul := by aesop_cat
#align Mon_ Mon_
attribute [reassoc] Mon_.one_mul Mon_.mul_one
-- We prove a more general `@[simp]` lemma below.
attribute [reassoc (attr := simp)] Mon_.mul_assoc
namespace Mon_
/-- The trivial monoid object. We later show this is initial in `Mon_ C`.
-/
@[simps]
def trivial : Mon_ C where
X := 𝟙_ C
one := 𝟙 _
mul := (λ_ _).hom
mul_assoc := by coherence
mul_one := by coherence
#align Mon_.trivial Mon_.trivial
instance : Inhabited (Mon_ C) :=
⟨trivial C⟩
variable {C}
variable {M : Mon_ C}
@[simp]
theorem one_mul_hom {Z : C} (f : Z ⟶ M.X) : (M.one ⊗ f) ≫ M.mul = (λ_ Z).hom ≫ f := by
rw [← id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality]
#align Mon_.one_mul_hom Mon_.one_mul_hom
@[simp]
theorem mul_one_hom {Z : C} (f : Z ⟶ M.X) : (f ⊗ M.one) ≫ M.mul = (ρ_ Z).hom ≫ f := by
rw [← tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality]
#align Mon_.mul_one_hom Mon_.mul_one_hom
theorem assoc_flip :
(𝟙 M.X ⊗ M.mul) ≫ M.mul = (α_ M.X M.X M.X).inv ≫ (M.mul ⊗ 𝟙 M.X) ≫ M.mul := by simp
#align Mon_.assoc_flip Mon_.assoc_flip
/-- A morphism of monoid objects. -/
@[ext]
structure Hom (M N : Mon_ C) where
hom : M.X ⟶ N.X
one_hom : M.one ≫ hom = N.one := by aesop_cat
mul_hom : M.mul ≫ hom = (hom ⊗ hom) ≫ N.mul := by aesop_cat
#align Mon_.hom Mon_.Hom
attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom
/-- The identity morphism on a monoid object. -/
@[simps]
def id (M : Mon_ C) : Hom M M where
hom := 𝟙 M.X
#align Mon_.id Mon_.id
instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) :=
⟨id M⟩
#align Mon_.hom_inhabited Mon_.homInhabited
/-- Composition of morphisms of monoid objects. -/
@[simps]
def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where
hom := f.hom ≫ g.hom
#align Mon_.comp Mon_.comp
instance : Category (Mon_ C) where
Hom M N := Hom M N
id := id
comp f g := comp f g
-- Porting note: added, as `Hom.ext` does not apply to a morphism.
@[ext]
lemma ext {X Y : Mon_ C} {f g : X ⟶ Y} (w : f.hom = g.hom) : f = g :=
Hom.ext _ _ w
@[simp]
theorem id_hom' (M : Mon_ C) : (𝟙 M : Hom M M).hom = 𝟙 M.X :=
rfl
#align Mon_.id_hom' Mon_.id_hom'
@[simp]
theorem comp_hom' {M N K : Mon_ C} (f : M ⟶ N) (g : N ⟶ K) :
(f ≫ g : Hom M K).hom = f.hom ≫ g.hom :=
rfl
#align Mon_.comp_hom' Mon_.comp_hom'
section
variable (C)
/-- The forgetful functor from monoid objects to the ambient category. -/
@[simps]
def forget : Mon_ C ⥤ C where
obj A := A.X
map f := f.hom
#align Mon_.forget Mon_.forget
end
instance forget_faithful : Faithful (@forget C _ _) where
#align Mon_.forget_faithful Mon_.forget_faithful
instance {A B : Mon_ C} (f : A ⟶ B) [e : IsIso ((forget C).map f)] : IsIso f.hom :=
e
/-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/
instance : ReflectsIsomorphisms (forget C) where
reflects f e :=
⟨⟨{ hom := inv f.hom
mul_hom := by
simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, ← tensor_comp_assoc,
IsIso.inv_hom_id, tensor_id, Category.id_comp] },
by aesop_cat⟩⟩
/-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X ≅ N.X) (one_f : M.one ≫ f.hom = N.one)
(mul_f : M.mul ≫ f.hom = (f.hom ⊗ f.hom) ≫ N.mul) : M ≅ N where
hom :=
{ hom := f.hom
one_hom := one_f
mul_hom := mul_f }
inv :=
{ hom := f.inv
one_hom := by rw [← one_f]; simp
mul_hom := by
rw [← cancel_mono f.hom]
slice_rhs 2 3 => rw [mul_f]
simp }
#align Mon_.iso_of_iso Mon_.isoOfIso
instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C ⟶ A) where
default :=
{ hom := A.one
one_hom := by dsimp; simp
mul_hom := by dsimp; simp [A.one_mul, unitors_equal] }
uniq f := by
ext; simp
rw [← Category.id_comp f.hom]
erw [f.one_hom]
#align Mon_.unique_hom_from_trivial Mon_.uniqueHomFromTrivial
open CategoryTheory.Limits
instance : HasInitial (Mon_ C) :=
hasInitial_of_unique (trivial C)
end Mon_
namespace CategoryTheory.LaxMonoidalFunctor
variable {C} {D : Type u₂} [Category.{v₂} D] [MonoidalCategory.{v₂} D]
-- TODO: mapMod F A : Mod A ⥤ Mod (F.mapMon A)
/-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one]
rw [F.toFunctor.map_id]
rw [F.right_unitality]
mul_assoc := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_assoc]
conv_lhs => rw [F.toFunctor.map_id]
conv_lhs => rw [F.toFunctor.map_comp, F.toFunctor.map_comp]
conv_rhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_rhs 3 4 => rw [F.μ_natural]
conv_rhs => rw [F.toFunctor.map_id]
slice_rhs 1 3 => rw [← F.associativity]
| simp only [Category.assoc] | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one]
rw [F.toFunctor.map_id]
rw [F.right_unitality]
mul_assoc := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_assoc]
conv_lhs => rw [F.toFunctor.map_id]
conv_lhs => rw [F.toFunctor.map_comp, F.toFunctor.map_comp]
conv_rhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_rhs 3 4 => rw [F.μ_natural]
conv_rhs => rw [F.toFunctor.map_id]
slice_rhs 1 3 => rw [← F.associativity]
| Mathlib.CategoryTheory.Monoidal.Mon_.202_0.NTUMzhXPwXsmsYt | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A | Mathlib_CategoryTheory_Monoidal_Mon_ |
C : Type u₁
inst✝³ : Category.{v₁, u₁} C
inst✝² : MonoidalCategory C
D : Type u₂
inst✝¹ : Category.{v₂, u₂} D
inst✝ : MonoidalCategory D
F : LaxMonoidalFunctor C D
X✝ Y✝ : Mon_ C
f : X✝ ⟶ Y✝
⊢ ((fun A => Mon_.mk (F.obj A.X) (F.ε ≫ F.map A.one) (μ F A.X A.X ≫ F.map A.mul)) X✝).one ≫ F.map f.hom =
((fun A => Mon_.mk (F.obj A.X) (F.ε ≫ F.map A.one) (μ F A.X A.X ≫ F.map A.mul)) Y✝).one | /-
Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/
import Mathlib.CategoryTheory.Monoidal.Braided
import Mathlib.CategoryTheory.Monoidal.Discrete
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
import Mathlib.Algebra.PUnitInstances
#align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c"
/-!
# The category of monoids in a monoidal category.
We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to
the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if
`C` is braided, then the category of monoids is naturally monoidal.
-/
set_option linter.uppercaseLean3 false
universe v₁ v₂ u₁ u₂ u
open CategoryTheory MonoidalCategory
variable (C : Type u₁) [Category.{v₁} C] [MonoidalCategory.{v₁} C]
/-- A monoid object internal to a monoidal category.
When the monoidal category is preadditive, this is also sometimes called an "algebra object".
-/
structure Mon_ where
X : C
one : 𝟙_ C ⟶ X
mul : X ⊗ X ⟶ X
one_mul : (one ⊗ 𝟙 X) ≫ mul = (λ_ X).hom := by aesop_cat
mul_one : (𝟙 X ⊗ one) ≫ mul = (ρ_ X).hom := by aesop_cat
-- Obviously there is some flexibility stating this axiom.
-- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`,
-- and chooses to place the associator on the right-hand side.
-- The heuristic is that unitors and associators "don't have much weight".
mul_assoc : (mul ⊗ 𝟙 X) ≫ mul = (α_ X X X).hom ≫ (𝟙 X ⊗ mul) ≫ mul := by aesop_cat
#align Mon_ Mon_
attribute [reassoc] Mon_.one_mul Mon_.mul_one
-- We prove a more general `@[simp]` lemma below.
attribute [reassoc (attr := simp)] Mon_.mul_assoc
namespace Mon_
/-- The trivial monoid object. We later show this is initial in `Mon_ C`.
-/
@[simps]
def trivial : Mon_ C where
X := 𝟙_ C
one := 𝟙 _
mul := (λ_ _).hom
mul_assoc := by coherence
mul_one := by coherence
#align Mon_.trivial Mon_.trivial
instance : Inhabited (Mon_ C) :=
⟨trivial C⟩
variable {C}
variable {M : Mon_ C}
@[simp]
theorem one_mul_hom {Z : C} (f : Z ⟶ M.X) : (M.one ⊗ f) ≫ M.mul = (λ_ Z).hom ≫ f := by
rw [← id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality]
#align Mon_.one_mul_hom Mon_.one_mul_hom
@[simp]
theorem mul_one_hom {Z : C} (f : Z ⟶ M.X) : (f ⊗ M.one) ≫ M.mul = (ρ_ Z).hom ≫ f := by
rw [← tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality]
#align Mon_.mul_one_hom Mon_.mul_one_hom
theorem assoc_flip :
(𝟙 M.X ⊗ M.mul) ≫ M.mul = (α_ M.X M.X M.X).inv ≫ (M.mul ⊗ 𝟙 M.X) ≫ M.mul := by simp
#align Mon_.assoc_flip Mon_.assoc_flip
/-- A morphism of monoid objects. -/
@[ext]
structure Hom (M N : Mon_ C) where
hom : M.X ⟶ N.X
one_hom : M.one ≫ hom = N.one := by aesop_cat
mul_hom : M.mul ≫ hom = (hom ⊗ hom) ≫ N.mul := by aesop_cat
#align Mon_.hom Mon_.Hom
attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom
/-- The identity morphism on a monoid object. -/
@[simps]
def id (M : Mon_ C) : Hom M M where
hom := 𝟙 M.X
#align Mon_.id Mon_.id
instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) :=
⟨id M⟩
#align Mon_.hom_inhabited Mon_.homInhabited
/-- Composition of morphisms of monoid objects. -/
@[simps]
def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where
hom := f.hom ≫ g.hom
#align Mon_.comp Mon_.comp
instance : Category (Mon_ C) where
Hom M N := Hom M N
id := id
comp f g := comp f g
-- Porting note: added, as `Hom.ext` does not apply to a morphism.
@[ext]
lemma ext {X Y : Mon_ C} {f g : X ⟶ Y} (w : f.hom = g.hom) : f = g :=
Hom.ext _ _ w
@[simp]
theorem id_hom' (M : Mon_ C) : (𝟙 M : Hom M M).hom = 𝟙 M.X :=
rfl
#align Mon_.id_hom' Mon_.id_hom'
@[simp]
theorem comp_hom' {M N K : Mon_ C} (f : M ⟶ N) (g : N ⟶ K) :
(f ≫ g : Hom M K).hom = f.hom ≫ g.hom :=
rfl
#align Mon_.comp_hom' Mon_.comp_hom'
section
variable (C)
/-- The forgetful functor from monoid objects to the ambient category. -/
@[simps]
def forget : Mon_ C ⥤ C where
obj A := A.X
map f := f.hom
#align Mon_.forget Mon_.forget
end
instance forget_faithful : Faithful (@forget C _ _) where
#align Mon_.forget_faithful Mon_.forget_faithful
instance {A B : Mon_ C} (f : A ⟶ B) [e : IsIso ((forget C).map f)] : IsIso f.hom :=
e
/-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/
instance : ReflectsIsomorphisms (forget C) where
reflects f e :=
⟨⟨{ hom := inv f.hom
mul_hom := by
simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, ← tensor_comp_assoc,
IsIso.inv_hom_id, tensor_id, Category.id_comp] },
by aesop_cat⟩⟩
/-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X ≅ N.X) (one_f : M.one ≫ f.hom = N.one)
(mul_f : M.mul ≫ f.hom = (f.hom ⊗ f.hom) ≫ N.mul) : M ≅ N where
hom :=
{ hom := f.hom
one_hom := one_f
mul_hom := mul_f }
inv :=
{ hom := f.inv
one_hom := by rw [← one_f]; simp
mul_hom := by
rw [← cancel_mono f.hom]
slice_rhs 2 3 => rw [mul_f]
simp }
#align Mon_.iso_of_iso Mon_.isoOfIso
instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C ⟶ A) where
default :=
{ hom := A.one
one_hom := by dsimp; simp
mul_hom := by dsimp; simp [A.one_mul, unitors_equal] }
uniq f := by
ext; simp
rw [← Category.id_comp f.hom]
erw [f.one_hom]
#align Mon_.unique_hom_from_trivial Mon_.uniqueHomFromTrivial
open CategoryTheory.Limits
instance : HasInitial (Mon_ C) :=
hasInitial_of_unique (trivial C)
end Mon_
namespace CategoryTheory.LaxMonoidalFunctor
variable {C} {D : Type u₂} [Category.{v₂} D] [MonoidalCategory.{v₂} D]
-- TODO: mapMod F A : Mod A ⥤ Mod (F.mapMon A)
/-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one]
rw [F.toFunctor.map_id]
rw [F.right_unitality]
mul_assoc := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_assoc]
conv_lhs => rw [F.toFunctor.map_id]
conv_lhs => rw [F.toFunctor.map_comp, F.toFunctor.map_comp]
conv_rhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_rhs 3 4 => rw [F.μ_natural]
conv_rhs => rw [F.toFunctor.map_id]
slice_rhs 1 3 => rw [← F.associativity]
simp only [Category.assoc] }
map f :=
{ hom := F.map f.hom
one_hom := by | dsimp | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one]
rw [F.toFunctor.map_id]
rw [F.right_unitality]
mul_assoc := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_assoc]
conv_lhs => rw [F.toFunctor.map_id]
conv_lhs => rw [F.toFunctor.map_comp, F.toFunctor.map_comp]
conv_rhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_rhs 3 4 => rw [F.μ_natural]
conv_rhs => rw [F.toFunctor.map_id]
slice_rhs 1 3 => rw [← F.associativity]
simp only [Category.assoc] }
map f :=
{ hom := F.map f.hom
one_hom := by | Mathlib.CategoryTheory.Monoidal.Mon_.202_0.NTUMzhXPwXsmsYt | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A | Mathlib_CategoryTheory_Monoidal_Mon_ |
C : Type u₁
inst✝³ : Category.{v₁, u₁} C
inst✝² : MonoidalCategory C
D : Type u₂
inst✝¹ : Category.{v₂, u₂} D
inst✝ : MonoidalCategory D
F : LaxMonoidalFunctor C D
X✝ Y✝ : Mon_ C
f : X✝ ⟶ Y✝
⊢ (F.ε ≫ F.map X✝.one) ≫ F.map f.hom = F.ε ≫ F.map Y✝.one | /-
Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/
import Mathlib.CategoryTheory.Monoidal.Braided
import Mathlib.CategoryTheory.Monoidal.Discrete
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
import Mathlib.Algebra.PUnitInstances
#align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c"
/-!
# The category of monoids in a monoidal category.
We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to
the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if
`C` is braided, then the category of monoids is naturally monoidal.
-/
set_option linter.uppercaseLean3 false
universe v₁ v₂ u₁ u₂ u
open CategoryTheory MonoidalCategory
variable (C : Type u₁) [Category.{v₁} C] [MonoidalCategory.{v₁} C]
/-- A monoid object internal to a monoidal category.
When the monoidal category is preadditive, this is also sometimes called an "algebra object".
-/
structure Mon_ where
X : C
one : 𝟙_ C ⟶ X
mul : X ⊗ X ⟶ X
one_mul : (one ⊗ 𝟙 X) ≫ mul = (λ_ X).hom := by aesop_cat
mul_one : (𝟙 X ⊗ one) ≫ mul = (ρ_ X).hom := by aesop_cat
-- Obviously there is some flexibility stating this axiom.
-- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`,
-- and chooses to place the associator on the right-hand side.
-- The heuristic is that unitors and associators "don't have much weight".
mul_assoc : (mul ⊗ 𝟙 X) ≫ mul = (α_ X X X).hom ≫ (𝟙 X ⊗ mul) ≫ mul := by aesop_cat
#align Mon_ Mon_
attribute [reassoc] Mon_.one_mul Mon_.mul_one
-- We prove a more general `@[simp]` lemma below.
attribute [reassoc (attr := simp)] Mon_.mul_assoc
namespace Mon_
/-- The trivial monoid object. We later show this is initial in `Mon_ C`.
-/
@[simps]
def trivial : Mon_ C where
X := 𝟙_ C
one := 𝟙 _
mul := (λ_ _).hom
mul_assoc := by coherence
mul_one := by coherence
#align Mon_.trivial Mon_.trivial
instance : Inhabited (Mon_ C) :=
⟨trivial C⟩
variable {C}
variable {M : Mon_ C}
@[simp]
theorem one_mul_hom {Z : C} (f : Z ⟶ M.X) : (M.one ⊗ f) ≫ M.mul = (λ_ Z).hom ≫ f := by
rw [← id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality]
#align Mon_.one_mul_hom Mon_.one_mul_hom
@[simp]
theorem mul_one_hom {Z : C} (f : Z ⟶ M.X) : (f ⊗ M.one) ≫ M.mul = (ρ_ Z).hom ≫ f := by
rw [← tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality]
#align Mon_.mul_one_hom Mon_.mul_one_hom
theorem assoc_flip :
(𝟙 M.X ⊗ M.mul) ≫ M.mul = (α_ M.X M.X M.X).inv ≫ (M.mul ⊗ 𝟙 M.X) ≫ M.mul := by simp
#align Mon_.assoc_flip Mon_.assoc_flip
/-- A morphism of monoid objects. -/
@[ext]
structure Hom (M N : Mon_ C) where
hom : M.X ⟶ N.X
one_hom : M.one ≫ hom = N.one := by aesop_cat
mul_hom : M.mul ≫ hom = (hom ⊗ hom) ≫ N.mul := by aesop_cat
#align Mon_.hom Mon_.Hom
attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom
/-- The identity morphism on a monoid object. -/
@[simps]
def id (M : Mon_ C) : Hom M M where
hom := 𝟙 M.X
#align Mon_.id Mon_.id
instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) :=
⟨id M⟩
#align Mon_.hom_inhabited Mon_.homInhabited
/-- Composition of morphisms of monoid objects. -/
@[simps]
def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where
hom := f.hom ≫ g.hom
#align Mon_.comp Mon_.comp
instance : Category (Mon_ C) where
Hom M N := Hom M N
id := id
comp f g := comp f g
-- Porting note: added, as `Hom.ext` does not apply to a morphism.
@[ext]
lemma ext {X Y : Mon_ C} {f g : X ⟶ Y} (w : f.hom = g.hom) : f = g :=
Hom.ext _ _ w
@[simp]
theorem id_hom' (M : Mon_ C) : (𝟙 M : Hom M M).hom = 𝟙 M.X :=
rfl
#align Mon_.id_hom' Mon_.id_hom'
@[simp]
theorem comp_hom' {M N K : Mon_ C} (f : M ⟶ N) (g : N ⟶ K) :
(f ≫ g : Hom M K).hom = f.hom ≫ g.hom :=
rfl
#align Mon_.comp_hom' Mon_.comp_hom'
section
variable (C)
/-- The forgetful functor from monoid objects to the ambient category. -/
@[simps]
def forget : Mon_ C ⥤ C where
obj A := A.X
map f := f.hom
#align Mon_.forget Mon_.forget
end
instance forget_faithful : Faithful (@forget C _ _) where
#align Mon_.forget_faithful Mon_.forget_faithful
instance {A B : Mon_ C} (f : A ⟶ B) [e : IsIso ((forget C).map f)] : IsIso f.hom :=
e
/-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/
instance : ReflectsIsomorphisms (forget C) where
reflects f e :=
⟨⟨{ hom := inv f.hom
mul_hom := by
simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, ← tensor_comp_assoc,
IsIso.inv_hom_id, tensor_id, Category.id_comp] },
by aesop_cat⟩⟩
/-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X ≅ N.X) (one_f : M.one ≫ f.hom = N.one)
(mul_f : M.mul ≫ f.hom = (f.hom ⊗ f.hom) ≫ N.mul) : M ≅ N where
hom :=
{ hom := f.hom
one_hom := one_f
mul_hom := mul_f }
inv :=
{ hom := f.inv
one_hom := by rw [← one_f]; simp
mul_hom := by
rw [← cancel_mono f.hom]
slice_rhs 2 3 => rw [mul_f]
simp }
#align Mon_.iso_of_iso Mon_.isoOfIso
instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C ⟶ A) where
default :=
{ hom := A.one
one_hom := by dsimp; simp
mul_hom := by dsimp; simp [A.one_mul, unitors_equal] }
uniq f := by
ext; simp
rw [← Category.id_comp f.hom]
erw [f.one_hom]
#align Mon_.unique_hom_from_trivial Mon_.uniqueHomFromTrivial
open CategoryTheory.Limits
instance : HasInitial (Mon_ C) :=
hasInitial_of_unique (trivial C)
end Mon_
namespace CategoryTheory.LaxMonoidalFunctor
variable {C} {D : Type u₂} [Category.{v₂} D] [MonoidalCategory.{v₂} D]
-- TODO: mapMod F A : Mod A ⥤ Mod (F.mapMon A)
/-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one]
rw [F.toFunctor.map_id]
rw [F.right_unitality]
mul_assoc := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_assoc]
conv_lhs => rw [F.toFunctor.map_id]
conv_lhs => rw [F.toFunctor.map_comp, F.toFunctor.map_comp]
conv_rhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_rhs 3 4 => rw [F.μ_natural]
conv_rhs => rw [F.toFunctor.map_id]
slice_rhs 1 3 => rw [← F.associativity]
simp only [Category.assoc] }
map f :=
{ hom := F.map f.hom
one_hom := by dsimp; | rw [Category.assoc, ← F.toFunctor.map_comp, f.one_hom] | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one]
rw [F.toFunctor.map_id]
rw [F.right_unitality]
mul_assoc := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_assoc]
conv_lhs => rw [F.toFunctor.map_id]
conv_lhs => rw [F.toFunctor.map_comp, F.toFunctor.map_comp]
conv_rhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_rhs 3 4 => rw [F.μ_natural]
conv_rhs => rw [F.toFunctor.map_id]
slice_rhs 1 3 => rw [← F.associativity]
simp only [Category.assoc] }
map f :=
{ hom := F.map f.hom
one_hom := by dsimp; | Mathlib.CategoryTheory.Monoidal.Mon_.202_0.NTUMzhXPwXsmsYt | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A | Mathlib_CategoryTheory_Monoidal_Mon_ |
C : Type u₁
inst✝³ : Category.{v₁, u₁} C
inst✝² : MonoidalCategory C
D : Type u₂
inst✝¹ : Category.{v₂, u₂} D
inst✝ : MonoidalCategory D
F : LaxMonoidalFunctor C D
X✝ Y✝ : Mon_ C
f : X✝ ⟶ Y✝
⊢ ((fun A => Mon_.mk (F.obj A.X) (F.ε ≫ F.map A.one) (μ F A.X A.X ≫ F.map A.mul)) X✝).mul ≫ F.map f.hom =
(F.map f.hom ⊗ F.map f.hom) ≫
((fun A => Mon_.mk (F.obj A.X) (F.ε ≫ F.map A.one) (μ F A.X A.X ≫ F.map A.mul)) Y✝).mul | /-
Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/
import Mathlib.CategoryTheory.Monoidal.Braided
import Mathlib.CategoryTheory.Monoidal.Discrete
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
import Mathlib.Algebra.PUnitInstances
#align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c"
/-!
# The category of monoids in a monoidal category.
We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to
the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if
`C` is braided, then the category of monoids is naturally monoidal.
-/
set_option linter.uppercaseLean3 false
universe v₁ v₂ u₁ u₂ u
open CategoryTheory MonoidalCategory
variable (C : Type u₁) [Category.{v₁} C] [MonoidalCategory.{v₁} C]
/-- A monoid object internal to a monoidal category.
When the monoidal category is preadditive, this is also sometimes called an "algebra object".
-/
structure Mon_ where
X : C
one : 𝟙_ C ⟶ X
mul : X ⊗ X ⟶ X
one_mul : (one ⊗ 𝟙 X) ≫ mul = (λ_ X).hom := by aesop_cat
mul_one : (𝟙 X ⊗ one) ≫ mul = (ρ_ X).hom := by aesop_cat
-- Obviously there is some flexibility stating this axiom.
-- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`,
-- and chooses to place the associator on the right-hand side.
-- The heuristic is that unitors and associators "don't have much weight".
mul_assoc : (mul ⊗ 𝟙 X) ≫ mul = (α_ X X X).hom ≫ (𝟙 X ⊗ mul) ≫ mul := by aesop_cat
#align Mon_ Mon_
attribute [reassoc] Mon_.one_mul Mon_.mul_one
-- We prove a more general `@[simp]` lemma below.
attribute [reassoc (attr := simp)] Mon_.mul_assoc
namespace Mon_
/-- The trivial monoid object. We later show this is initial in `Mon_ C`.
-/
@[simps]
def trivial : Mon_ C where
X := 𝟙_ C
one := 𝟙 _
mul := (λ_ _).hom
mul_assoc := by coherence
mul_one := by coherence
#align Mon_.trivial Mon_.trivial
instance : Inhabited (Mon_ C) :=
⟨trivial C⟩
variable {C}
variable {M : Mon_ C}
@[simp]
theorem one_mul_hom {Z : C} (f : Z ⟶ M.X) : (M.one ⊗ f) ≫ M.mul = (λ_ Z).hom ≫ f := by
rw [← id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality]
#align Mon_.one_mul_hom Mon_.one_mul_hom
@[simp]
theorem mul_one_hom {Z : C} (f : Z ⟶ M.X) : (f ⊗ M.one) ≫ M.mul = (ρ_ Z).hom ≫ f := by
rw [← tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality]
#align Mon_.mul_one_hom Mon_.mul_one_hom
theorem assoc_flip :
(𝟙 M.X ⊗ M.mul) ≫ M.mul = (α_ M.X M.X M.X).inv ≫ (M.mul ⊗ 𝟙 M.X) ≫ M.mul := by simp
#align Mon_.assoc_flip Mon_.assoc_flip
/-- A morphism of monoid objects. -/
@[ext]
structure Hom (M N : Mon_ C) where
hom : M.X ⟶ N.X
one_hom : M.one ≫ hom = N.one := by aesop_cat
mul_hom : M.mul ≫ hom = (hom ⊗ hom) ≫ N.mul := by aesop_cat
#align Mon_.hom Mon_.Hom
attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom
/-- The identity morphism on a monoid object. -/
@[simps]
def id (M : Mon_ C) : Hom M M where
hom := 𝟙 M.X
#align Mon_.id Mon_.id
instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) :=
⟨id M⟩
#align Mon_.hom_inhabited Mon_.homInhabited
/-- Composition of morphisms of monoid objects. -/
@[simps]
def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where
hom := f.hom ≫ g.hom
#align Mon_.comp Mon_.comp
instance : Category (Mon_ C) where
Hom M N := Hom M N
id := id
comp f g := comp f g
-- Porting note: added, as `Hom.ext` does not apply to a morphism.
@[ext]
lemma ext {X Y : Mon_ C} {f g : X ⟶ Y} (w : f.hom = g.hom) : f = g :=
Hom.ext _ _ w
@[simp]
theorem id_hom' (M : Mon_ C) : (𝟙 M : Hom M M).hom = 𝟙 M.X :=
rfl
#align Mon_.id_hom' Mon_.id_hom'
@[simp]
theorem comp_hom' {M N K : Mon_ C} (f : M ⟶ N) (g : N ⟶ K) :
(f ≫ g : Hom M K).hom = f.hom ≫ g.hom :=
rfl
#align Mon_.comp_hom' Mon_.comp_hom'
section
variable (C)
/-- The forgetful functor from monoid objects to the ambient category. -/
@[simps]
def forget : Mon_ C ⥤ C where
obj A := A.X
map f := f.hom
#align Mon_.forget Mon_.forget
end
instance forget_faithful : Faithful (@forget C _ _) where
#align Mon_.forget_faithful Mon_.forget_faithful
instance {A B : Mon_ C} (f : A ⟶ B) [e : IsIso ((forget C).map f)] : IsIso f.hom :=
e
/-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/
instance : ReflectsIsomorphisms (forget C) where
reflects f e :=
⟨⟨{ hom := inv f.hom
mul_hom := by
simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, ← tensor_comp_assoc,
IsIso.inv_hom_id, tensor_id, Category.id_comp] },
by aesop_cat⟩⟩
/-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X ≅ N.X) (one_f : M.one ≫ f.hom = N.one)
(mul_f : M.mul ≫ f.hom = (f.hom ⊗ f.hom) ≫ N.mul) : M ≅ N where
hom :=
{ hom := f.hom
one_hom := one_f
mul_hom := mul_f }
inv :=
{ hom := f.inv
one_hom := by rw [← one_f]; simp
mul_hom := by
rw [← cancel_mono f.hom]
slice_rhs 2 3 => rw [mul_f]
simp }
#align Mon_.iso_of_iso Mon_.isoOfIso
instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C ⟶ A) where
default :=
{ hom := A.one
one_hom := by dsimp; simp
mul_hom := by dsimp; simp [A.one_mul, unitors_equal] }
uniq f := by
ext; simp
rw [← Category.id_comp f.hom]
erw [f.one_hom]
#align Mon_.unique_hom_from_trivial Mon_.uniqueHomFromTrivial
open CategoryTheory.Limits
instance : HasInitial (Mon_ C) :=
hasInitial_of_unique (trivial C)
end Mon_
namespace CategoryTheory.LaxMonoidalFunctor
variable {C} {D : Type u₂} [Category.{v₂} D] [MonoidalCategory.{v₂} D]
-- TODO: mapMod F A : Mod A ⥤ Mod (F.mapMon A)
/-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one]
rw [F.toFunctor.map_id]
rw [F.right_unitality]
mul_assoc := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_assoc]
conv_lhs => rw [F.toFunctor.map_id]
conv_lhs => rw [F.toFunctor.map_comp, F.toFunctor.map_comp]
conv_rhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_rhs 3 4 => rw [F.μ_natural]
conv_rhs => rw [F.toFunctor.map_id]
slice_rhs 1 3 => rw [← F.associativity]
simp only [Category.assoc] }
map f :=
{ hom := F.map f.hom
one_hom := by dsimp; rw [Category.assoc, ← F.toFunctor.map_comp, f.one_hom]
mul_hom := by
| dsimp | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one]
rw [F.toFunctor.map_id]
rw [F.right_unitality]
mul_assoc := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_assoc]
conv_lhs => rw [F.toFunctor.map_id]
conv_lhs => rw [F.toFunctor.map_comp, F.toFunctor.map_comp]
conv_rhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_rhs 3 4 => rw [F.μ_natural]
conv_rhs => rw [F.toFunctor.map_id]
slice_rhs 1 3 => rw [← F.associativity]
simp only [Category.assoc] }
map f :=
{ hom := F.map f.hom
one_hom := by dsimp; rw [Category.assoc, ← F.toFunctor.map_comp, f.one_hom]
mul_hom := by
| Mathlib.CategoryTheory.Monoidal.Mon_.202_0.NTUMzhXPwXsmsYt | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A | Mathlib_CategoryTheory_Monoidal_Mon_ |
C : Type u₁
inst✝³ : Category.{v₁, u₁} C
inst✝² : MonoidalCategory C
D : Type u₂
inst✝¹ : Category.{v₂, u₂} D
inst✝ : MonoidalCategory D
F : LaxMonoidalFunctor C D
X✝ Y✝ : Mon_ C
f : X✝ ⟶ Y✝
⊢ (μ F X✝.X X✝.X ≫ F.map X✝.mul) ≫ F.map f.hom = (F.map f.hom ⊗ F.map f.hom) ≫ μ F Y✝.X Y✝.X ≫ F.map Y✝.mul | /-
Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/
import Mathlib.CategoryTheory.Monoidal.Braided
import Mathlib.CategoryTheory.Monoidal.Discrete
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
import Mathlib.Algebra.PUnitInstances
#align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c"
/-!
# The category of monoids in a monoidal category.
We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to
the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if
`C` is braided, then the category of monoids is naturally monoidal.
-/
set_option linter.uppercaseLean3 false
universe v₁ v₂ u₁ u₂ u
open CategoryTheory MonoidalCategory
variable (C : Type u₁) [Category.{v₁} C] [MonoidalCategory.{v₁} C]
/-- A monoid object internal to a monoidal category.
When the monoidal category is preadditive, this is also sometimes called an "algebra object".
-/
structure Mon_ where
X : C
one : 𝟙_ C ⟶ X
mul : X ⊗ X ⟶ X
one_mul : (one ⊗ 𝟙 X) ≫ mul = (λ_ X).hom := by aesop_cat
mul_one : (𝟙 X ⊗ one) ≫ mul = (ρ_ X).hom := by aesop_cat
-- Obviously there is some flexibility stating this axiom.
-- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`,
-- and chooses to place the associator on the right-hand side.
-- The heuristic is that unitors and associators "don't have much weight".
mul_assoc : (mul ⊗ 𝟙 X) ≫ mul = (α_ X X X).hom ≫ (𝟙 X ⊗ mul) ≫ mul := by aesop_cat
#align Mon_ Mon_
attribute [reassoc] Mon_.one_mul Mon_.mul_one
-- We prove a more general `@[simp]` lemma below.
attribute [reassoc (attr := simp)] Mon_.mul_assoc
namespace Mon_
/-- The trivial monoid object. We later show this is initial in `Mon_ C`.
-/
@[simps]
def trivial : Mon_ C where
X := 𝟙_ C
one := 𝟙 _
mul := (λ_ _).hom
mul_assoc := by coherence
mul_one := by coherence
#align Mon_.trivial Mon_.trivial
instance : Inhabited (Mon_ C) :=
⟨trivial C⟩
variable {C}
variable {M : Mon_ C}
@[simp]
theorem one_mul_hom {Z : C} (f : Z ⟶ M.X) : (M.one ⊗ f) ≫ M.mul = (λ_ Z).hom ≫ f := by
rw [← id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality]
#align Mon_.one_mul_hom Mon_.one_mul_hom
@[simp]
theorem mul_one_hom {Z : C} (f : Z ⟶ M.X) : (f ⊗ M.one) ≫ M.mul = (ρ_ Z).hom ≫ f := by
rw [← tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality]
#align Mon_.mul_one_hom Mon_.mul_one_hom
theorem assoc_flip :
(𝟙 M.X ⊗ M.mul) ≫ M.mul = (α_ M.X M.X M.X).inv ≫ (M.mul ⊗ 𝟙 M.X) ≫ M.mul := by simp
#align Mon_.assoc_flip Mon_.assoc_flip
/-- A morphism of monoid objects. -/
@[ext]
structure Hom (M N : Mon_ C) where
hom : M.X ⟶ N.X
one_hom : M.one ≫ hom = N.one := by aesop_cat
mul_hom : M.mul ≫ hom = (hom ⊗ hom) ≫ N.mul := by aesop_cat
#align Mon_.hom Mon_.Hom
attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom
/-- The identity morphism on a monoid object. -/
@[simps]
def id (M : Mon_ C) : Hom M M where
hom := 𝟙 M.X
#align Mon_.id Mon_.id
instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) :=
⟨id M⟩
#align Mon_.hom_inhabited Mon_.homInhabited
/-- Composition of morphisms of monoid objects. -/
@[simps]
def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where
hom := f.hom ≫ g.hom
#align Mon_.comp Mon_.comp
instance : Category (Mon_ C) where
Hom M N := Hom M N
id := id
comp f g := comp f g
-- Porting note: added, as `Hom.ext` does not apply to a morphism.
@[ext]
lemma ext {X Y : Mon_ C} {f g : X ⟶ Y} (w : f.hom = g.hom) : f = g :=
Hom.ext _ _ w
@[simp]
theorem id_hom' (M : Mon_ C) : (𝟙 M : Hom M M).hom = 𝟙 M.X :=
rfl
#align Mon_.id_hom' Mon_.id_hom'
@[simp]
theorem comp_hom' {M N K : Mon_ C} (f : M ⟶ N) (g : N ⟶ K) :
(f ≫ g : Hom M K).hom = f.hom ≫ g.hom :=
rfl
#align Mon_.comp_hom' Mon_.comp_hom'
section
variable (C)
/-- The forgetful functor from monoid objects to the ambient category. -/
@[simps]
def forget : Mon_ C ⥤ C where
obj A := A.X
map f := f.hom
#align Mon_.forget Mon_.forget
end
instance forget_faithful : Faithful (@forget C _ _) where
#align Mon_.forget_faithful Mon_.forget_faithful
instance {A B : Mon_ C} (f : A ⟶ B) [e : IsIso ((forget C).map f)] : IsIso f.hom :=
e
/-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/
instance : ReflectsIsomorphisms (forget C) where
reflects f e :=
⟨⟨{ hom := inv f.hom
mul_hom := by
simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, ← tensor_comp_assoc,
IsIso.inv_hom_id, tensor_id, Category.id_comp] },
by aesop_cat⟩⟩
/-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X ≅ N.X) (one_f : M.one ≫ f.hom = N.one)
(mul_f : M.mul ≫ f.hom = (f.hom ⊗ f.hom) ≫ N.mul) : M ≅ N where
hom :=
{ hom := f.hom
one_hom := one_f
mul_hom := mul_f }
inv :=
{ hom := f.inv
one_hom := by rw [← one_f]; simp
mul_hom := by
rw [← cancel_mono f.hom]
slice_rhs 2 3 => rw [mul_f]
simp }
#align Mon_.iso_of_iso Mon_.isoOfIso
instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C ⟶ A) where
default :=
{ hom := A.one
one_hom := by dsimp; simp
mul_hom := by dsimp; simp [A.one_mul, unitors_equal] }
uniq f := by
ext; simp
rw [← Category.id_comp f.hom]
erw [f.one_hom]
#align Mon_.unique_hom_from_trivial Mon_.uniqueHomFromTrivial
open CategoryTheory.Limits
instance : HasInitial (Mon_ C) :=
hasInitial_of_unique (trivial C)
end Mon_
namespace CategoryTheory.LaxMonoidalFunctor
variable {C} {D : Type u₂} [Category.{v₂} D] [MonoidalCategory.{v₂} D]
-- TODO: mapMod F A : Mod A ⥤ Mod (F.mapMon A)
/-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one]
rw [F.toFunctor.map_id]
rw [F.right_unitality]
mul_assoc := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_assoc]
conv_lhs => rw [F.toFunctor.map_id]
conv_lhs => rw [F.toFunctor.map_comp, F.toFunctor.map_comp]
conv_rhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_rhs 3 4 => rw [F.μ_natural]
conv_rhs => rw [F.toFunctor.map_id]
slice_rhs 1 3 => rw [← F.associativity]
simp only [Category.assoc] }
map f :=
{ hom := F.map f.hom
one_hom := by dsimp; rw [Category.assoc, ← F.toFunctor.map_comp, f.one_hom]
mul_hom := by
dsimp
| rw [Category.assoc, F.μ_natural_assoc, ← F.toFunctor.map_comp, ← F.toFunctor.map_comp,
f.mul_hom] | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one]
rw [F.toFunctor.map_id]
rw [F.right_unitality]
mul_assoc := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_assoc]
conv_lhs => rw [F.toFunctor.map_id]
conv_lhs => rw [F.toFunctor.map_comp, F.toFunctor.map_comp]
conv_rhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_rhs 3 4 => rw [F.μ_natural]
conv_rhs => rw [F.toFunctor.map_id]
slice_rhs 1 3 => rw [← F.associativity]
simp only [Category.assoc] }
map f :=
{ hom := F.map f.hom
one_hom := by dsimp; rw [Category.assoc, ← F.toFunctor.map_comp, f.one_hom]
mul_hom := by
dsimp
| Mathlib.CategoryTheory.Monoidal.Mon_.202_0.NTUMzhXPwXsmsYt | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A | Mathlib_CategoryTheory_Monoidal_Mon_ |
C : Type u₁
inst✝³ : Category.{v₁, u₁} C
inst✝² : MonoidalCategory C
D : Type u₂
inst✝¹ : Category.{v₂, u₂} D
inst✝ : MonoidalCategory D
F : LaxMonoidalFunctor C D
A : Mon_ C
⊢ { obj := fun A => Mon_.mk (F.obj A.X) (F.ε ≫ F.map A.one) (μ F A.X A.X ≫ F.map A.mul),
map := fun {X Y} f => Mon_.Hom.mk (F.map f.hom) }.map
(𝟙 A) =
𝟙
({ obj := fun A => Mon_.mk (F.obj A.X) (F.ε ≫ F.map A.one) (μ F A.X A.X ≫ F.map A.mul),
map := fun {X Y} f => Mon_.Hom.mk (F.map f.hom) }.obj
A) | /-
Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/
import Mathlib.CategoryTheory.Monoidal.Braided
import Mathlib.CategoryTheory.Monoidal.Discrete
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
import Mathlib.Algebra.PUnitInstances
#align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c"
/-!
# The category of monoids in a monoidal category.
We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to
the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if
`C` is braided, then the category of monoids is naturally monoidal.
-/
set_option linter.uppercaseLean3 false
universe v₁ v₂ u₁ u₂ u
open CategoryTheory MonoidalCategory
variable (C : Type u₁) [Category.{v₁} C] [MonoidalCategory.{v₁} C]
/-- A monoid object internal to a monoidal category.
When the monoidal category is preadditive, this is also sometimes called an "algebra object".
-/
structure Mon_ where
X : C
one : 𝟙_ C ⟶ X
mul : X ⊗ X ⟶ X
one_mul : (one ⊗ 𝟙 X) ≫ mul = (λ_ X).hom := by aesop_cat
mul_one : (𝟙 X ⊗ one) ≫ mul = (ρ_ X).hom := by aesop_cat
-- Obviously there is some flexibility stating this axiom.
-- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`,
-- and chooses to place the associator on the right-hand side.
-- The heuristic is that unitors and associators "don't have much weight".
mul_assoc : (mul ⊗ 𝟙 X) ≫ mul = (α_ X X X).hom ≫ (𝟙 X ⊗ mul) ≫ mul := by aesop_cat
#align Mon_ Mon_
attribute [reassoc] Mon_.one_mul Mon_.mul_one
-- We prove a more general `@[simp]` lemma below.
attribute [reassoc (attr := simp)] Mon_.mul_assoc
namespace Mon_
/-- The trivial monoid object. We later show this is initial in `Mon_ C`.
-/
@[simps]
def trivial : Mon_ C where
X := 𝟙_ C
one := 𝟙 _
mul := (λ_ _).hom
mul_assoc := by coherence
mul_one := by coherence
#align Mon_.trivial Mon_.trivial
instance : Inhabited (Mon_ C) :=
⟨trivial C⟩
variable {C}
variable {M : Mon_ C}
@[simp]
theorem one_mul_hom {Z : C} (f : Z ⟶ M.X) : (M.one ⊗ f) ≫ M.mul = (λ_ Z).hom ≫ f := by
rw [← id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality]
#align Mon_.one_mul_hom Mon_.one_mul_hom
@[simp]
theorem mul_one_hom {Z : C} (f : Z ⟶ M.X) : (f ⊗ M.one) ≫ M.mul = (ρ_ Z).hom ≫ f := by
rw [← tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality]
#align Mon_.mul_one_hom Mon_.mul_one_hom
theorem assoc_flip :
(𝟙 M.X ⊗ M.mul) ≫ M.mul = (α_ M.X M.X M.X).inv ≫ (M.mul ⊗ 𝟙 M.X) ≫ M.mul := by simp
#align Mon_.assoc_flip Mon_.assoc_flip
/-- A morphism of monoid objects. -/
@[ext]
structure Hom (M N : Mon_ C) where
hom : M.X ⟶ N.X
one_hom : M.one ≫ hom = N.one := by aesop_cat
mul_hom : M.mul ≫ hom = (hom ⊗ hom) ≫ N.mul := by aesop_cat
#align Mon_.hom Mon_.Hom
attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom
/-- The identity morphism on a monoid object. -/
@[simps]
def id (M : Mon_ C) : Hom M M where
hom := 𝟙 M.X
#align Mon_.id Mon_.id
instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) :=
⟨id M⟩
#align Mon_.hom_inhabited Mon_.homInhabited
/-- Composition of morphisms of monoid objects. -/
@[simps]
def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where
hom := f.hom ≫ g.hom
#align Mon_.comp Mon_.comp
instance : Category (Mon_ C) where
Hom M N := Hom M N
id := id
comp f g := comp f g
-- Porting note: added, as `Hom.ext` does not apply to a morphism.
@[ext]
lemma ext {X Y : Mon_ C} {f g : X ⟶ Y} (w : f.hom = g.hom) : f = g :=
Hom.ext _ _ w
@[simp]
theorem id_hom' (M : Mon_ C) : (𝟙 M : Hom M M).hom = 𝟙 M.X :=
rfl
#align Mon_.id_hom' Mon_.id_hom'
@[simp]
theorem comp_hom' {M N K : Mon_ C} (f : M ⟶ N) (g : N ⟶ K) :
(f ≫ g : Hom M K).hom = f.hom ≫ g.hom :=
rfl
#align Mon_.comp_hom' Mon_.comp_hom'
section
variable (C)
/-- The forgetful functor from monoid objects to the ambient category. -/
@[simps]
def forget : Mon_ C ⥤ C where
obj A := A.X
map f := f.hom
#align Mon_.forget Mon_.forget
end
instance forget_faithful : Faithful (@forget C _ _) where
#align Mon_.forget_faithful Mon_.forget_faithful
instance {A B : Mon_ C} (f : A ⟶ B) [e : IsIso ((forget C).map f)] : IsIso f.hom :=
e
/-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/
instance : ReflectsIsomorphisms (forget C) where
reflects f e :=
⟨⟨{ hom := inv f.hom
mul_hom := by
simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, ← tensor_comp_assoc,
IsIso.inv_hom_id, tensor_id, Category.id_comp] },
by aesop_cat⟩⟩
/-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X ≅ N.X) (one_f : M.one ≫ f.hom = N.one)
(mul_f : M.mul ≫ f.hom = (f.hom ⊗ f.hom) ≫ N.mul) : M ≅ N where
hom :=
{ hom := f.hom
one_hom := one_f
mul_hom := mul_f }
inv :=
{ hom := f.inv
one_hom := by rw [← one_f]; simp
mul_hom := by
rw [← cancel_mono f.hom]
slice_rhs 2 3 => rw [mul_f]
simp }
#align Mon_.iso_of_iso Mon_.isoOfIso
instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C ⟶ A) where
default :=
{ hom := A.one
one_hom := by dsimp; simp
mul_hom := by dsimp; simp [A.one_mul, unitors_equal] }
uniq f := by
ext; simp
rw [← Category.id_comp f.hom]
erw [f.one_hom]
#align Mon_.unique_hom_from_trivial Mon_.uniqueHomFromTrivial
open CategoryTheory.Limits
instance : HasInitial (Mon_ C) :=
hasInitial_of_unique (trivial C)
end Mon_
namespace CategoryTheory.LaxMonoidalFunctor
variable {C} {D : Type u₂} [Category.{v₂} D] [MonoidalCategory.{v₂} D]
-- TODO: mapMod F A : Mod A ⥤ Mod (F.mapMon A)
/-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one]
rw [F.toFunctor.map_id]
rw [F.right_unitality]
mul_assoc := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_assoc]
conv_lhs => rw [F.toFunctor.map_id]
conv_lhs => rw [F.toFunctor.map_comp, F.toFunctor.map_comp]
conv_rhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_rhs 3 4 => rw [F.μ_natural]
conv_rhs => rw [F.toFunctor.map_id]
slice_rhs 1 3 => rw [← F.associativity]
simp only [Category.assoc] }
map f :=
{ hom := F.map f.hom
one_hom := by dsimp; rw [Category.assoc, ← F.toFunctor.map_comp, f.one_hom]
mul_hom := by
dsimp
rw [Category.assoc, F.μ_natural_assoc, ← F.toFunctor.map_comp, ← F.toFunctor.map_comp,
f.mul_hom] }
map_id A := by | ext | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one]
rw [F.toFunctor.map_id]
rw [F.right_unitality]
mul_assoc := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_assoc]
conv_lhs => rw [F.toFunctor.map_id]
conv_lhs => rw [F.toFunctor.map_comp, F.toFunctor.map_comp]
conv_rhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_rhs 3 4 => rw [F.μ_natural]
conv_rhs => rw [F.toFunctor.map_id]
slice_rhs 1 3 => rw [← F.associativity]
simp only [Category.assoc] }
map f :=
{ hom := F.map f.hom
one_hom := by dsimp; rw [Category.assoc, ← F.toFunctor.map_comp, f.one_hom]
mul_hom := by
dsimp
rw [Category.assoc, F.μ_natural_assoc, ← F.toFunctor.map_comp, ← F.toFunctor.map_comp,
f.mul_hom] }
map_id A := by | Mathlib.CategoryTheory.Monoidal.Mon_.202_0.NTUMzhXPwXsmsYt | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A | Mathlib_CategoryTheory_Monoidal_Mon_ |
case w
C : Type u₁
inst✝³ : Category.{v₁, u₁} C
inst✝² : MonoidalCategory C
D : Type u₂
inst✝¹ : Category.{v₂, u₂} D
inst✝ : MonoidalCategory D
F : LaxMonoidalFunctor C D
A : Mon_ C
⊢ ({ obj := fun A => Mon_.mk (F.obj A.X) (F.ε ≫ F.map A.one) (μ F A.X A.X ≫ F.map A.mul),
map := fun {X Y} f => Mon_.Hom.mk (F.map f.hom) }.map
(𝟙 A)).hom =
(𝟙
({ obj := fun A => Mon_.mk (F.obj A.X) (F.ε ≫ F.map A.one) (μ F A.X A.X ≫ F.map A.mul),
map := fun {X Y} f => Mon_.Hom.mk (F.map f.hom) }.obj
A)).hom | /-
Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/
import Mathlib.CategoryTheory.Monoidal.Braided
import Mathlib.CategoryTheory.Monoidal.Discrete
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
import Mathlib.Algebra.PUnitInstances
#align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c"
/-!
# The category of monoids in a monoidal category.
We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to
the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if
`C` is braided, then the category of monoids is naturally monoidal.
-/
set_option linter.uppercaseLean3 false
universe v₁ v₂ u₁ u₂ u
open CategoryTheory MonoidalCategory
variable (C : Type u₁) [Category.{v₁} C] [MonoidalCategory.{v₁} C]
/-- A monoid object internal to a monoidal category.
When the monoidal category is preadditive, this is also sometimes called an "algebra object".
-/
structure Mon_ where
X : C
one : 𝟙_ C ⟶ X
mul : X ⊗ X ⟶ X
one_mul : (one ⊗ 𝟙 X) ≫ mul = (λ_ X).hom := by aesop_cat
mul_one : (𝟙 X ⊗ one) ≫ mul = (ρ_ X).hom := by aesop_cat
-- Obviously there is some flexibility stating this axiom.
-- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`,
-- and chooses to place the associator on the right-hand side.
-- The heuristic is that unitors and associators "don't have much weight".
mul_assoc : (mul ⊗ 𝟙 X) ≫ mul = (α_ X X X).hom ≫ (𝟙 X ⊗ mul) ≫ mul := by aesop_cat
#align Mon_ Mon_
attribute [reassoc] Mon_.one_mul Mon_.mul_one
-- We prove a more general `@[simp]` lemma below.
attribute [reassoc (attr := simp)] Mon_.mul_assoc
namespace Mon_
/-- The trivial monoid object. We later show this is initial in `Mon_ C`.
-/
@[simps]
def trivial : Mon_ C where
X := 𝟙_ C
one := 𝟙 _
mul := (λ_ _).hom
mul_assoc := by coherence
mul_one := by coherence
#align Mon_.trivial Mon_.trivial
instance : Inhabited (Mon_ C) :=
⟨trivial C⟩
variable {C}
variable {M : Mon_ C}
@[simp]
theorem one_mul_hom {Z : C} (f : Z ⟶ M.X) : (M.one ⊗ f) ≫ M.mul = (λ_ Z).hom ≫ f := by
rw [← id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality]
#align Mon_.one_mul_hom Mon_.one_mul_hom
@[simp]
theorem mul_one_hom {Z : C} (f : Z ⟶ M.X) : (f ⊗ M.one) ≫ M.mul = (ρ_ Z).hom ≫ f := by
rw [← tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality]
#align Mon_.mul_one_hom Mon_.mul_one_hom
theorem assoc_flip :
(𝟙 M.X ⊗ M.mul) ≫ M.mul = (α_ M.X M.X M.X).inv ≫ (M.mul ⊗ 𝟙 M.X) ≫ M.mul := by simp
#align Mon_.assoc_flip Mon_.assoc_flip
/-- A morphism of monoid objects. -/
@[ext]
structure Hom (M N : Mon_ C) where
hom : M.X ⟶ N.X
one_hom : M.one ≫ hom = N.one := by aesop_cat
mul_hom : M.mul ≫ hom = (hom ⊗ hom) ≫ N.mul := by aesop_cat
#align Mon_.hom Mon_.Hom
attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom
/-- The identity morphism on a monoid object. -/
@[simps]
def id (M : Mon_ C) : Hom M M where
hom := 𝟙 M.X
#align Mon_.id Mon_.id
instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) :=
⟨id M⟩
#align Mon_.hom_inhabited Mon_.homInhabited
/-- Composition of morphisms of monoid objects. -/
@[simps]
def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where
hom := f.hom ≫ g.hom
#align Mon_.comp Mon_.comp
instance : Category (Mon_ C) where
Hom M N := Hom M N
id := id
comp f g := comp f g
-- Porting note: added, as `Hom.ext` does not apply to a morphism.
@[ext]
lemma ext {X Y : Mon_ C} {f g : X ⟶ Y} (w : f.hom = g.hom) : f = g :=
Hom.ext _ _ w
@[simp]
theorem id_hom' (M : Mon_ C) : (𝟙 M : Hom M M).hom = 𝟙 M.X :=
rfl
#align Mon_.id_hom' Mon_.id_hom'
@[simp]
theorem comp_hom' {M N K : Mon_ C} (f : M ⟶ N) (g : N ⟶ K) :
(f ≫ g : Hom M K).hom = f.hom ≫ g.hom :=
rfl
#align Mon_.comp_hom' Mon_.comp_hom'
section
variable (C)
/-- The forgetful functor from monoid objects to the ambient category. -/
@[simps]
def forget : Mon_ C ⥤ C where
obj A := A.X
map f := f.hom
#align Mon_.forget Mon_.forget
end
instance forget_faithful : Faithful (@forget C _ _) where
#align Mon_.forget_faithful Mon_.forget_faithful
instance {A B : Mon_ C} (f : A ⟶ B) [e : IsIso ((forget C).map f)] : IsIso f.hom :=
e
/-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/
instance : ReflectsIsomorphisms (forget C) where
reflects f e :=
⟨⟨{ hom := inv f.hom
mul_hom := by
simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, ← tensor_comp_assoc,
IsIso.inv_hom_id, tensor_id, Category.id_comp] },
by aesop_cat⟩⟩
/-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X ≅ N.X) (one_f : M.one ≫ f.hom = N.one)
(mul_f : M.mul ≫ f.hom = (f.hom ⊗ f.hom) ≫ N.mul) : M ≅ N where
hom :=
{ hom := f.hom
one_hom := one_f
mul_hom := mul_f }
inv :=
{ hom := f.inv
one_hom := by rw [← one_f]; simp
mul_hom := by
rw [← cancel_mono f.hom]
slice_rhs 2 3 => rw [mul_f]
simp }
#align Mon_.iso_of_iso Mon_.isoOfIso
instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C ⟶ A) where
default :=
{ hom := A.one
one_hom := by dsimp; simp
mul_hom := by dsimp; simp [A.one_mul, unitors_equal] }
uniq f := by
ext; simp
rw [← Category.id_comp f.hom]
erw [f.one_hom]
#align Mon_.unique_hom_from_trivial Mon_.uniqueHomFromTrivial
open CategoryTheory.Limits
instance : HasInitial (Mon_ C) :=
hasInitial_of_unique (trivial C)
end Mon_
namespace CategoryTheory.LaxMonoidalFunctor
variable {C} {D : Type u₂} [Category.{v₂} D] [MonoidalCategory.{v₂} D]
-- TODO: mapMod F A : Mod A ⥤ Mod (F.mapMon A)
/-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one]
rw [F.toFunctor.map_id]
rw [F.right_unitality]
mul_assoc := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_assoc]
conv_lhs => rw [F.toFunctor.map_id]
conv_lhs => rw [F.toFunctor.map_comp, F.toFunctor.map_comp]
conv_rhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_rhs 3 4 => rw [F.μ_natural]
conv_rhs => rw [F.toFunctor.map_id]
slice_rhs 1 3 => rw [← F.associativity]
simp only [Category.assoc] }
map f :=
{ hom := F.map f.hom
one_hom := by dsimp; rw [Category.assoc, ← F.toFunctor.map_comp, f.one_hom]
mul_hom := by
dsimp
rw [Category.assoc, F.μ_natural_assoc, ← F.toFunctor.map_comp, ← F.toFunctor.map_comp,
f.mul_hom] }
map_id A := by ext; | simp | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one]
rw [F.toFunctor.map_id]
rw [F.right_unitality]
mul_assoc := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_assoc]
conv_lhs => rw [F.toFunctor.map_id]
conv_lhs => rw [F.toFunctor.map_comp, F.toFunctor.map_comp]
conv_rhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_rhs 3 4 => rw [F.μ_natural]
conv_rhs => rw [F.toFunctor.map_id]
slice_rhs 1 3 => rw [← F.associativity]
simp only [Category.assoc] }
map f :=
{ hom := F.map f.hom
one_hom := by dsimp; rw [Category.assoc, ← F.toFunctor.map_comp, f.one_hom]
mul_hom := by
dsimp
rw [Category.assoc, F.μ_natural_assoc, ← F.toFunctor.map_comp, ← F.toFunctor.map_comp,
f.mul_hom] }
map_id A := by ext; | Mathlib.CategoryTheory.Monoidal.Mon_.202_0.NTUMzhXPwXsmsYt | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A | Mathlib_CategoryTheory_Monoidal_Mon_ |
C : Type u₁
inst✝³ : Category.{v₁, u₁} C
inst✝² : MonoidalCategory C
D : Type u₂
inst✝¹ : Category.{v₂, u₂} D
inst✝ : MonoidalCategory D
F : LaxMonoidalFunctor C D
X✝ Y✝ Z✝ : Mon_ C
f : X✝ ⟶ Y✝
g : Y✝ ⟶ Z✝
⊢ { obj := fun A => Mon_.mk (F.obj A.X) (F.ε ≫ F.map A.one) (μ F A.X A.X ≫ F.map A.mul),
map := fun {X Y} f => Mon_.Hom.mk (F.map f.hom) }.map
(f ≫ g) =
{ obj := fun A => Mon_.mk (F.obj A.X) (F.ε ≫ F.map A.one) (μ F A.X A.X ≫ F.map A.mul),
map := fun {X Y} f => Mon_.Hom.mk (F.map f.hom) }.map
f ≫
{ obj := fun A => Mon_.mk (F.obj A.X) (F.ε ≫ F.map A.one) (μ F A.X A.X ≫ F.map A.mul),
map := fun {X Y} f => Mon_.Hom.mk (F.map f.hom) }.map
g | /-
Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/
import Mathlib.CategoryTheory.Monoidal.Braided
import Mathlib.CategoryTheory.Monoidal.Discrete
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
import Mathlib.Algebra.PUnitInstances
#align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c"
/-!
# The category of monoids in a monoidal category.
We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to
the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if
`C` is braided, then the category of monoids is naturally monoidal.
-/
set_option linter.uppercaseLean3 false
universe v₁ v₂ u₁ u₂ u
open CategoryTheory MonoidalCategory
variable (C : Type u₁) [Category.{v₁} C] [MonoidalCategory.{v₁} C]
/-- A monoid object internal to a monoidal category.
When the monoidal category is preadditive, this is also sometimes called an "algebra object".
-/
structure Mon_ where
X : C
one : 𝟙_ C ⟶ X
mul : X ⊗ X ⟶ X
one_mul : (one ⊗ 𝟙 X) ≫ mul = (λ_ X).hom := by aesop_cat
mul_one : (𝟙 X ⊗ one) ≫ mul = (ρ_ X).hom := by aesop_cat
-- Obviously there is some flexibility stating this axiom.
-- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`,
-- and chooses to place the associator on the right-hand side.
-- The heuristic is that unitors and associators "don't have much weight".
mul_assoc : (mul ⊗ 𝟙 X) ≫ mul = (α_ X X X).hom ≫ (𝟙 X ⊗ mul) ≫ mul := by aesop_cat
#align Mon_ Mon_
attribute [reassoc] Mon_.one_mul Mon_.mul_one
-- We prove a more general `@[simp]` lemma below.
attribute [reassoc (attr := simp)] Mon_.mul_assoc
namespace Mon_
/-- The trivial monoid object. We later show this is initial in `Mon_ C`.
-/
@[simps]
def trivial : Mon_ C where
X := 𝟙_ C
one := 𝟙 _
mul := (λ_ _).hom
mul_assoc := by coherence
mul_one := by coherence
#align Mon_.trivial Mon_.trivial
instance : Inhabited (Mon_ C) :=
⟨trivial C⟩
variable {C}
variable {M : Mon_ C}
@[simp]
theorem one_mul_hom {Z : C} (f : Z ⟶ M.X) : (M.one ⊗ f) ≫ M.mul = (λ_ Z).hom ≫ f := by
rw [← id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality]
#align Mon_.one_mul_hom Mon_.one_mul_hom
@[simp]
theorem mul_one_hom {Z : C} (f : Z ⟶ M.X) : (f ⊗ M.one) ≫ M.mul = (ρ_ Z).hom ≫ f := by
rw [← tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality]
#align Mon_.mul_one_hom Mon_.mul_one_hom
theorem assoc_flip :
(𝟙 M.X ⊗ M.mul) ≫ M.mul = (α_ M.X M.X M.X).inv ≫ (M.mul ⊗ 𝟙 M.X) ≫ M.mul := by simp
#align Mon_.assoc_flip Mon_.assoc_flip
/-- A morphism of monoid objects. -/
@[ext]
structure Hom (M N : Mon_ C) where
hom : M.X ⟶ N.X
one_hom : M.one ≫ hom = N.one := by aesop_cat
mul_hom : M.mul ≫ hom = (hom ⊗ hom) ≫ N.mul := by aesop_cat
#align Mon_.hom Mon_.Hom
attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom
/-- The identity morphism on a monoid object. -/
@[simps]
def id (M : Mon_ C) : Hom M M where
hom := 𝟙 M.X
#align Mon_.id Mon_.id
instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) :=
⟨id M⟩
#align Mon_.hom_inhabited Mon_.homInhabited
/-- Composition of morphisms of monoid objects. -/
@[simps]
def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where
hom := f.hom ≫ g.hom
#align Mon_.comp Mon_.comp
instance : Category (Mon_ C) where
Hom M N := Hom M N
id := id
comp f g := comp f g
-- Porting note: added, as `Hom.ext` does not apply to a morphism.
@[ext]
lemma ext {X Y : Mon_ C} {f g : X ⟶ Y} (w : f.hom = g.hom) : f = g :=
Hom.ext _ _ w
@[simp]
theorem id_hom' (M : Mon_ C) : (𝟙 M : Hom M M).hom = 𝟙 M.X :=
rfl
#align Mon_.id_hom' Mon_.id_hom'
@[simp]
theorem comp_hom' {M N K : Mon_ C} (f : M ⟶ N) (g : N ⟶ K) :
(f ≫ g : Hom M K).hom = f.hom ≫ g.hom :=
rfl
#align Mon_.comp_hom' Mon_.comp_hom'
section
variable (C)
/-- The forgetful functor from monoid objects to the ambient category. -/
@[simps]
def forget : Mon_ C ⥤ C where
obj A := A.X
map f := f.hom
#align Mon_.forget Mon_.forget
end
instance forget_faithful : Faithful (@forget C _ _) where
#align Mon_.forget_faithful Mon_.forget_faithful
instance {A B : Mon_ C} (f : A ⟶ B) [e : IsIso ((forget C).map f)] : IsIso f.hom :=
e
/-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/
instance : ReflectsIsomorphisms (forget C) where
reflects f e :=
⟨⟨{ hom := inv f.hom
mul_hom := by
simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, ← tensor_comp_assoc,
IsIso.inv_hom_id, tensor_id, Category.id_comp] },
by aesop_cat⟩⟩
/-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X ≅ N.X) (one_f : M.one ≫ f.hom = N.one)
(mul_f : M.mul ≫ f.hom = (f.hom ⊗ f.hom) ≫ N.mul) : M ≅ N where
hom :=
{ hom := f.hom
one_hom := one_f
mul_hom := mul_f }
inv :=
{ hom := f.inv
one_hom := by rw [← one_f]; simp
mul_hom := by
rw [← cancel_mono f.hom]
slice_rhs 2 3 => rw [mul_f]
simp }
#align Mon_.iso_of_iso Mon_.isoOfIso
instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C ⟶ A) where
default :=
{ hom := A.one
one_hom := by dsimp; simp
mul_hom := by dsimp; simp [A.one_mul, unitors_equal] }
uniq f := by
ext; simp
rw [← Category.id_comp f.hom]
erw [f.one_hom]
#align Mon_.unique_hom_from_trivial Mon_.uniqueHomFromTrivial
open CategoryTheory.Limits
instance : HasInitial (Mon_ C) :=
hasInitial_of_unique (trivial C)
end Mon_
namespace CategoryTheory.LaxMonoidalFunctor
variable {C} {D : Type u₂} [Category.{v₂} D] [MonoidalCategory.{v₂} D]
-- TODO: mapMod F A : Mod A ⥤ Mod (F.mapMon A)
/-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one]
rw [F.toFunctor.map_id]
rw [F.right_unitality]
mul_assoc := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_assoc]
conv_lhs => rw [F.toFunctor.map_id]
conv_lhs => rw [F.toFunctor.map_comp, F.toFunctor.map_comp]
conv_rhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_rhs 3 4 => rw [F.μ_natural]
conv_rhs => rw [F.toFunctor.map_id]
slice_rhs 1 3 => rw [← F.associativity]
simp only [Category.assoc] }
map f :=
{ hom := F.map f.hom
one_hom := by dsimp; rw [Category.assoc, ← F.toFunctor.map_comp, f.one_hom]
mul_hom := by
dsimp
rw [Category.assoc, F.μ_natural_assoc, ← F.toFunctor.map_comp, ← F.toFunctor.map_comp,
f.mul_hom] }
map_id A := by ext; simp
map_comp f g := by | ext | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one]
rw [F.toFunctor.map_id]
rw [F.right_unitality]
mul_assoc := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_assoc]
conv_lhs => rw [F.toFunctor.map_id]
conv_lhs => rw [F.toFunctor.map_comp, F.toFunctor.map_comp]
conv_rhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_rhs 3 4 => rw [F.μ_natural]
conv_rhs => rw [F.toFunctor.map_id]
slice_rhs 1 3 => rw [← F.associativity]
simp only [Category.assoc] }
map f :=
{ hom := F.map f.hom
one_hom := by dsimp; rw [Category.assoc, ← F.toFunctor.map_comp, f.one_hom]
mul_hom := by
dsimp
rw [Category.assoc, F.μ_natural_assoc, ← F.toFunctor.map_comp, ← F.toFunctor.map_comp,
f.mul_hom] }
map_id A := by ext; simp
map_comp f g := by | Mathlib.CategoryTheory.Monoidal.Mon_.202_0.NTUMzhXPwXsmsYt | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A | Mathlib_CategoryTheory_Monoidal_Mon_ |
case w
C : Type u₁
inst✝³ : Category.{v₁, u₁} C
inst✝² : MonoidalCategory C
D : Type u₂
inst✝¹ : Category.{v₂, u₂} D
inst✝ : MonoidalCategory D
F : LaxMonoidalFunctor C D
X✝ Y✝ Z✝ : Mon_ C
f : X✝ ⟶ Y✝
g : Y✝ ⟶ Z✝
⊢ ({ obj := fun A => Mon_.mk (F.obj A.X) (F.ε ≫ F.map A.one) (μ F A.X A.X ≫ F.map A.mul),
map := fun {X Y} f => Mon_.Hom.mk (F.map f.hom) }.map
(f ≫ g)).hom =
({ obj := fun A => Mon_.mk (F.obj A.X) (F.ε ≫ F.map A.one) (μ F A.X A.X ≫ F.map A.mul),
map := fun {X Y} f => Mon_.Hom.mk (F.map f.hom) }.map
f ≫
{ obj := fun A => Mon_.mk (F.obj A.X) (F.ε ≫ F.map A.one) (μ F A.X A.X ≫ F.map A.mul),
map := fun {X Y} f => Mon_.Hom.mk (F.map f.hom) }.map
g).hom | /-
Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/
import Mathlib.CategoryTheory.Monoidal.Braided
import Mathlib.CategoryTheory.Monoidal.Discrete
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
import Mathlib.Algebra.PUnitInstances
#align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c"
/-!
# The category of monoids in a monoidal category.
We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to
the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if
`C` is braided, then the category of monoids is naturally monoidal.
-/
set_option linter.uppercaseLean3 false
universe v₁ v₂ u₁ u₂ u
open CategoryTheory MonoidalCategory
variable (C : Type u₁) [Category.{v₁} C] [MonoidalCategory.{v₁} C]
/-- A monoid object internal to a monoidal category.
When the monoidal category is preadditive, this is also sometimes called an "algebra object".
-/
structure Mon_ where
X : C
one : 𝟙_ C ⟶ X
mul : X ⊗ X ⟶ X
one_mul : (one ⊗ 𝟙 X) ≫ mul = (λ_ X).hom := by aesop_cat
mul_one : (𝟙 X ⊗ one) ≫ mul = (ρ_ X).hom := by aesop_cat
-- Obviously there is some flexibility stating this axiom.
-- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`,
-- and chooses to place the associator on the right-hand side.
-- The heuristic is that unitors and associators "don't have much weight".
mul_assoc : (mul ⊗ 𝟙 X) ≫ mul = (α_ X X X).hom ≫ (𝟙 X ⊗ mul) ≫ mul := by aesop_cat
#align Mon_ Mon_
attribute [reassoc] Mon_.one_mul Mon_.mul_one
-- We prove a more general `@[simp]` lemma below.
attribute [reassoc (attr := simp)] Mon_.mul_assoc
namespace Mon_
/-- The trivial monoid object. We later show this is initial in `Mon_ C`.
-/
@[simps]
def trivial : Mon_ C where
X := 𝟙_ C
one := 𝟙 _
mul := (λ_ _).hom
mul_assoc := by coherence
mul_one := by coherence
#align Mon_.trivial Mon_.trivial
instance : Inhabited (Mon_ C) :=
⟨trivial C⟩
variable {C}
variable {M : Mon_ C}
@[simp]
theorem one_mul_hom {Z : C} (f : Z ⟶ M.X) : (M.one ⊗ f) ≫ M.mul = (λ_ Z).hom ≫ f := by
rw [← id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality]
#align Mon_.one_mul_hom Mon_.one_mul_hom
@[simp]
theorem mul_one_hom {Z : C} (f : Z ⟶ M.X) : (f ⊗ M.one) ≫ M.mul = (ρ_ Z).hom ≫ f := by
rw [← tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality]
#align Mon_.mul_one_hom Mon_.mul_one_hom
theorem assoc_flip :
(𝟙 M.X ⊗ M.mul) ≫ M.mul = (α_ M.X M.X M.X).inv ≫ (M.mul ⊗ 𝟙 M.X) ≫ M.mul := by simp
#align Mon_.assoc_flip Mon_.assoc_flip
/-- A morphism of monoid objects. -/
@[ext]
structure Hom (M N : Mon_ C) where
hom : M.X ⟶ N.X
one_hom : M.one ≫ hom = N.one := by aesop_cat
mul_hom : M.mul ≫ hom = (hom ⊗ hom) ≫ N.mul := by aesop_cat
#align Mon_.hom Mon_.Hom
attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom
/-- The identity morphism on a monoid object. -/
@[simps]
def id (M : Mon_ C) : Hom M M where
hom := 𝟙 M.X
#align Mon_.id Mon_.id
instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) :=
⟨id M⟩
#align Mon_.hom_inhabited Mon_.homInhabited
/-- Composition of morphisms of monoid objects. -/
@[simps]
def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where
hom := f.hom ≫ g.hom
#align Mon_.comp Mon_.comp
instance : Category (Mon_ C) where
Hom M N := Hom M N
id := id
comp f g := comp f g
-- Porting note: added, as `Hom.ext` does not apply to a morphism.
@[ext]
lemma ext {X Y : Mon_ C} {f g : X ⟶ Y} (w : f.hom = g.hom) : f = g :=
Hom.ext _ _ w
@[simp]
theorem id_hom' (M : Mon_ C) : (𝟙 M : Hom M M).hom = 𝟙 M.X :=
rfl
#align Mon_.id_hom' Mon_.id_hom'
@[simp]
theorem comp_hom' {M N K : Mon_ C} (f : M ⟶ N) (g : N ⟶ K) :
(f ≫ g : Hom M K).hom = f.hom ≫ g.hom :=
rfl
#align Mon_.comp_hom' Mon_.comp_hom'
section
variable (C)
/-- The forgetful functor from monoid objects to the ambient category. -/
@[simps]
def forget : Mon_ C ⥤ C where
obj A := A.X
map f := f.hom
#align Mon_.forget Mon_.forget
end
instance forget_faithful : Faithful (@forget C _ _) where
#align Mon_.forget_faithful Mon_.forget_faithful
instance {A B : Mon_ C} (f : A ⟶ B) [e : IsIso ((forget C).map f)] : IsIso f.hom :=
e
/-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/
instance : ReflectsIsomorphisms (forget C) where
reflects f e :=
⟨⟨{ hom := inv f.hom
mul_hom := by
simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, ← tensor_comp_assoc,
IsIso.inv_hom_id, tensor_id, Category.id_comp] },
by aesop_cat⟩⟩
/-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X ≅ N.X) (one_f : M.one ≫ f.hom = N.one)
(mul_f : M.mul ≫ f.hom = (f.hom ⊗ f.hom) ≫ N.mul) : M ≅ N where
hom :=
{ hom := f.hom
one_hom := one_f
mul_hom := mul_f }
inv :=
{ hom := f.inv
one_hom := by rw [← one_f]; simp
mul_hom := by
rw [← cancel_mono f.hom]
slice_rhs 2 3 => rw [mul_f]
simp }
#align Mon_.iso_of_iso Mon_.isoOfIso
instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C ⟶ A) where
default :=
{ hom := A.one
one_hom := by dsimp; simp
mul_hom := by dsimp; simp [A.one_mul, unitors_equal] }
uniq f := by
ext; simp
rw [← Category.id_comp f.hom]
erw [f.one_hom]
#align Mon_.unique_hom_from_trivial Mon_.uniqueHomFromTrivial
open CategoryTheory.Limits
instance : HasInitial (Mon_ C) :=
hasInitial_of_unique (trivial C)
end Mon_
namespace CategoryTheory.LaxMonoidalFunctor
variable {C} {D : Type u₂} [Category.{v₂} D] [MonoidalCategory.{v₂} D]
-- TODO: mapMod F A : Mod A ⥤ Mod (F.mapMon A)
/-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one]
rw [F.toFunctor.map_id]
rw [F.right_unitality]
mul_assoc := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_assoc]
conv_lhs => rw [F.toFunctor.map_id]
conv_lhs => rw [F.toFunctor.map_comp, F.toFunctor.map_comp]
conv_rhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_rhs 3 4 => rw [F.μ_natural]
conv_rhs => rw [F.toFunctor.map_id]
slice_rhs 1 3 => rw [← F.associativity]
simp only [Category.assoc] }
map f :=
{ hom := F.map f.hom
one_hom := by dsimp; rw [Category.assoc, ← F.toFunctor.map_comp, f.one_hom]
mul_hom := by
dsimp
rw [Category.assoc, F.μ_natural_assoc, ← F.toFunctor.map_comp, ← F.toFunctor.map_comp,
f.mul_hom] }
map_id A := by ext; simp
map_comp f g := by ext; | simp | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one]
rw [F.toFunctor.map_id]
rw [F.right_unitality]
mul_assoc := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_assoc]
conv_lhs => rw [F.toFunctor.map_id]
conv_lhs => rw [F.toFunctor.map_comp, F.toFunctor.map_comp]
conv_rhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_rhs 3 4 => rw [F.μ_natural]
conv_rhs => rw [F.toFunctor.map_id]
slice_rhs 1 3 => rw [← F.associativity]
simp only [Category.assoc] }
map f :=
{ hom := F.map f.hom
one_hom := by dsimp; rw [Category.assoc, ← F.toFunctor.map_comp, f.one_hom]
mul_hom := by
dsimp
rw [Category.assoc, F.μ_natural_assoc, ← F.toFunctor.map_comp, ← F.toFunctor.map_comp,
f.mul_hom] }
map_id A := by ext; simp
map_comp f g := by ext; | Mathlib.CategoryTheory.Monoidal.Mon_.202_0.NTUMzhXPwXsmsYt | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A | Mathlib_CategoryTheory_Monoidal_Mon_ |
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : MonoidalCategory C
X✝ Y✝ : Mon_ C
f : X✝ ⟶ Y✝
x✝² x✝¹ : Discrete PUnit.{u + 1}
x✝ : x✝² ⟶ x✝¹
⊢ ((fun A =>
LaxMonoidalFunctor.mk
(CategoryTheory.Functor.mk { obj := fun x => A.X, map := fun {X Y} x => 𝟙 ((fun x => A.X) X) }) A.one
fun x x => A.mul)
X✝).map
x✝ ≫
(fun x => f.hom) x✝¹ =
(fun x => f.hom) x✝² ≫
((fun A =>
LaxMonoidalFunctor.mk
(CategoryTheory.Functor.mk { obj := fun x => A.X, map := fun {X Y} x => 𝟙 ((fun x => A.X) X) }) A.one
fun x x => A.mul)
Y✝).map
x✝ | /-
Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/
import Mathlib.CategoryTheory.Monoidal.Braided
import Mathlib.CategoryTheory.Monoidal.Discrete
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
import Mathlib.Algebra.PUnitInstances
#align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c"
/-!
# The category of monoids in a monoidal category.
We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to
the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if
`C` is braided, then the category of monoids is naturally monoidal.
-/
set_option linter.uppercaseLean3 false
universe v₁ v₂ u₁ u₂ u
open CategoryTheory MonoidalCategory
variable (C : Type u₁) [Category.{v₁} C] [MonoidalCategory.{v₁} C]
/-- A monoid object internal to a monoidal category.
When the monoidal category is preadditive, this is also sometimes called an "algebra object".
-/
structure Mon_ where
X : C
one : 𝟙_ C ⟶ X
mul : X ⊗ X ⟶ X
one_mul : (one ⊗ 𝟙 X) ≫ mul = (λ_ X).hom := by aesop_cat
mul_one : (𝟙 X ⊗ one) ≫ mul = (ρ_ X).hom := by aesop_cat
-- Obviously there is some flexibility stating this axiom.
-- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`,
-- and chooses to place the associator on the right-hand side.
-- The heuristic is that unitors and associators "don't have much weight".
mul_assoc : (mul ⊗ 𝟙 X) ≫ mul = (α_ X X X).hom ≫ (𝟙 X ⊗ mul) ≫ mul := by aesop_cat
#align Mon_ Mon_
attribute [reassoc] Mon_.one_mul Mon_.mul_one
-- We prove a more general `@[simp]` lemma below.
attribute [reassoc (attr := simp)] Mon_.mul_assoc
namespace Mon_
/-- The trivial monoid object. We later show this is initial in `Mon_ C`.
-/
@[simps]
def trivial : Mon_ C where
X := 𝟙_ C
one := 𝟙 _
mul := (λ_ _).hom
mul_assoc := by coherence
mul_one := by coherence
#align Mon_.trivial Mon_.trivial
instance : Inhabited (Mon_ C) :=
⟨trivial C⟩
variable {C}
variable {M : Mon_ C}
@[simp]
theorem one_mul_hom {Z : C} (f : Z ⟶ M.X) : (M.one ⊗ f) ≫ M.mul = (λ_ Z).hom ≫ f := by
rw [← id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality]
#align Mon_.one_mul_hom Mon_.one_mul_hom
@[simp]
theorem mul_one_hom {Z : C} (f : Z ⟶ M.X) : (f ⊗ M.one) ≫ M.mul = (ρ_ Z).hom ≫ f := by
rw [← tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality]
#align Mon_.mul_one_hom Mon_.mul_one_hom
theorem assoc_flip :
(𝟙 M.X ⊗ M.mul) ≫ M.mul = (α_ M.X M.X M.X).inv ≫ (M.mul ⊗ 𝟙 M.X) ≫ M.mul := by simp
#align Mon_.assoc_flip Mon_.assoc_flip
/-- A morphism of monoid objects. -/
@[ext]
structure Hom (M N : Mon_ C) where
hom : M.X ⟶ N.X
one_hom : M.one ≫ hom = N.one := by aesop_cat
mul_hom : M.mul ≫ hom = (hom ⊗ hom) ≫ N.mul := by aesop_cat
#align Mon_.hom Mon_.Hom
attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom
/-- The identity morphism on a monoid object. -/
@[simps]
def id (M : Mon_ C) : Hom M M where
hom := 𝟙 M.X
#align Mon_.id Mon_.id
instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) :=
⟨id M⟩
#align Mon_.hom_inhabited Mon_.homInhabited
/-- Composition of morphisms of monoid objects. -/
@[simps]
def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where
hom := f.hom ≫ g.hom
#align Mon_.comp Mon_.comp
instance : Category (Mon_ C) where
Hom M N := Hom M N
id := id
comp f g := comp f g
-- Porting note: added, as `Hom.ext` does not apply to a morphism.
@[ext]
lemma ext {X Y : Mon_ C} {f g : X ⟶ Y} (w : f.hom = g.hom) : f = g :=
Hom.ext _ _ w
@[simp]
theorem id_hom' (M : Mon_ C) : (𝟙 M : Hom M M).hom = 𝟙 M.X :=
rfl
#align Mon_.id_hom' Mon_.id_hom'
@[simp]
theorem comp_hom' {M N K : Mon_ C} (f : M ⟶ N) (g : N ⟶ K) :
(f ≫ g : Hom M K).hom = f.hom ≫ g.hom :=
rfl
#align Mon_.comp_hom' Mon_.comp_hom'
section
variable (C)
/-- The forgetful functor from monoid objects to the ambient category. -/
@[simps]
def forget : Mon_ C ⥤ C where
obj A := A.X
map f := f.hom
#align Mon_.forget Mon_.forget
end
instance forget_faithful : Faithful (@forget C _ _) where
#align Mon_.forget_faithful Mon_.forget_faithful
instance {A B : Mon_ C} (f : A ⟶ B) [e : IsIso ((forget C).map f)] : IsIso f.hom :=
e
/-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/
instance : ReflectsIsomorphisms (forget C) where
reflects f e :=
⟨⟨{ hom := inv f.hom
mul_hom := by
simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, ← tensor_comp_assoc,
IsIso.inv_hom_id, tensor_id, Category.id_comp] },
by aesop_cat⟩⟩
/-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X ≅ N.X) (one_f : M.one ≫ f.hom = N.one)
(mul_f : M.mul ≫ f.hom = (f.hom ⊗ f.hom) ≫ N.mul) : M ≅ N where
hom :=
{ hom := f.hom
one_hom := one_f
mul_hom := mul_f }
inv :=
{ hom := f.inv
one_hom := by rw [← one_f]; simp
mul_hom := by
rw [← cancel_mono f.hom]
slice_rhs 2 3 => rw [mul_f]
simp }
#align Mon_.iso_of_iso Mon_.isoOfIso
instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C ⟶ A) where
default :=
{ hom := A.one
one_hom := by dsimp; simp
mul_hom := by dsimp; simp [A.one_mul, unitors_equal] }
uniq f := by
ext; simp
rw [← Category.id_comp f.hom]
erw [f.one_hom]
#align Mon_.unique_hom_from_trivial Mon_.uniqueHomFromTrivial
open CategoryTheory.Limits
instance : HasInitial (Mon_ C) :=
hasInitial_of_unique (trivial C)
end Mon_
namespace CategoryTheory.LaxMonoidalFunctor
variable {C} {D : Type u₂} [Category.{v₂} D] [MonoidalCategory.{v₂} D]
-- TODO: mapMod F A : Mod A ⥤ Mod (F.mapMon A)
/-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one]
rw [F.toFunctor.map_id]
rw [F.right_unitality]
mul_assoc := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_assoc]
conv_lhs => rw [F.toFunctor.map_id]
conv_lhs => rw [F.toFunctor.map_comp, F.toFunctor.map_comp]
conv_rhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_rhs 3 4 => rw [F.μ_natural]
conv_rhs => rw [F.toFunctor.map_id]
slice_rhs 1 3 => rw [← F.associativity]
simp only [Category.assoc] }
map f :=
{ hom := F.map f.hom
one_hom := by dsimp; rw [Category.assoc, ← F.toFunctor.map_comp, f.one_hom]
mul_hom := by
dsimp
rw [Category.assoc, F.μ_natural_assoc, ← F.toFunctor.map_comp, ← F.toFunctor.map_comp,
f.mul_hom] }
map_id A := by ext; simp
map_comp f g := by ext; simp
#align category_theory.lax_monoidal_functor.map_Mon CategoryTheory.LaxMonoidalFunctor.mapMon
variable (C D)
/-- `mapMon` is functorial in the lax monoidal functor. -/
@[simps] -- Porting note: added this, not sure how it worked previously without.
def mapMonFunctor : LaxMonoidalFunctor C D ⥤ Mon_ C ⥤ Mon_ D where
obj := mapMon
map α := { app := fun A => { hom := α.app A.X } }
#align category_theory.lax_monoidal_functor.map_Mon_functor CategoryTheory.LaxMonoidalFunctor.mapMonFunctor
end CategoryTheory.LaxMonoidalFunctor
namespace Mon_
open CategoryTheory.LaxMonoidalFunctor
namespace EquivLaxMonoidalFunctorPUnit
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps]
def laxMonoidalToMon : LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C ⥤ Mon_ C where
obj F := (F.mapMon : Mon_ _ ⥤ Mon_ C).obj (trivial (Discrete PUnit))
map α := ((mapMonFunctor (Discrete PUnit) C).map α).app _
#align Mon_.equiv_lax_monoidal_functor_punit.lax_monoidal_to_Mon Mon_.EquivLaxMonoidalFunctorPUnit.laxMonoidalToMon
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps]
def monToLaxMonoidal : Mon_ C ⥤ LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C where
obj A :=
{ obj := fun _ => A.X
map := fun _ => 𝟙 _
ε := A.one
μ := fun _ _ => A.mul
map_id := fun _ => rfl
map_comp := fun _ _ => (Category.id_comp (𝟙 A.X)).symm }
map f :=
{ app := fun _ => f.hom
naturality := fun _ _ _ => by | dsimp | /-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps]
def monToLaxMonoidal : Mon_ C ⥤ LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C where
obj A :=
{ obj := fun _ => A.X
map := fun _ => 𝟙 _
ε := A.one
μ := fun _ _ => A.mul
map_id := fun _ => rfl
map_comp := fun _ _ => (Category.id_comp (𝟙 A.X)).symm }
map f :=
{ app := fun _ => f.hom
naturality := fun _ _ _ => by | Mathlib.CategoryTheory.Monoidal.Mon_.270_0.NTUMzhXPwXsmsYt | /-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps]
def monToLaxMonoidal : Mon_ C ⥤ LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C where
obj A | Mathlib_CategoryTheory_Monoidal_Mon_ |
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : MonoidalCategory C
X✝ Y✝ : Mon_ C
f : X✝ ⟶ Y✝
x✝² x✝¹ : Discrete PUnit.{u + 1}
x✝ : x✝² ⟶ x✝¹
⊢ 𝟙 X✝.X ≫ f.hom = f.hom ≫ 𝟙 Y✝.X | /-
Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/
import Mathlib.CategoryTheory.Monoidal.Braided
import Mathlib.CategoryTheory.Monoidal.Discrete
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
import Mathlib.Algebra.PUnitInstances
#align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c"
/-!
# The category of monoids in a monoidal category.
We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to
the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if
`C` is braided, then the category of monoids is naturally monoidal.
-/
set_option linter.uppercaseLean3 false
universe v₁ v₂ u₁ u₂ u
open CategoryTheory MonoidalCategory
variable (C : Type u₁) [Category.{v₁} C] [MonoidalCategory.{v₁} C]
/-- A monoid object internal to a monoidal category.
When the monoidal category is preadditive, this is also sometimes called an "algebra object".
-/
structure Mon_ where
X : C
one : 𝟙_ C ⟶ X
mul : X ⊗ X ⟶ X
one_mul : (one ⊗ 𝟙 X) ≫ mul = (λ_ X).hom := by aesop_cat
mul_one : (𝟙 X ⊗ one) ≫ mul = (ρ_ X).hom := by aesop_cat
-- Obviously there is some flexibility stating this axiom.
-- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`,
-- and chooses to place the associator on the right-hand side.
-- The heuristic is that unitors and associators "don't have much weight".
mul_assoc : (mul ⊗ 𝟙 X) ≫ mul = (α_ X X X).hom ≫ (𝟙 X ⊗ mul) ≫ mul := by aesop_cat
#align Mon_ Mon_
attribute [reassoc] Mon_.one_mul Mon_.mul_one
-- We prove a more general `@[simp]` lemma below.
attribute [reassoc (attr := simp)] Mon_.mul_assoc
namespace Mon_
/-- The trivial monoid object. We later show this is initial in `Mon_ C`.
-/
@[simps]
def trivial : Mon_ C where
X := 𝟙_ C
one := 𝟙 _
mul := (λ_ _).hom
mul_assoc := by coherence
mul_one := by coherence
#align Mon_.trivial Mon_.trivial
instance : Inhabited (Mon_ C) :=
⟨trivial C⟩
variable {C}
variable {M : Mon_ C}
@[simp]
theorem one_mul_hom {Z : C} (f : Z ⟶ M.X) : (M.one ⊗ f) ≫ M.mul = (λ_ Z).hom ≫ f := by
rw [← id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality]
#align Mon_.one_mul_hom Mon_.one_mul_hom
@[simp]
theorem mul_one_hom {Z : C} (f : Z ⟶ M.X) : (f ⊗ M.one) ≫ M.mul = (ρ_ Z).hom ≫ f := by
rw [← tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality]
#align Mon_.mul_one_hom Mon_.mul_one_hom
theorem assoc_flip :
(𝟙 M.X ⊗ M.mul) ≫ M.mul = (α_ M.X M.X M.X).inv ≫ (M.mul ⊗ 𝟙 M.X) ≫ M.mul := by simp
#align Mon_.assoc_flip Mon_.assoc_flip
/-- A morphism of monoid objects. -/
@[ext]
structure Hom (M N : Mon_ C) where
hom : M.X ⟶ N.X
one_hom : M.one ≫ hom = N.one := by aesop_cat
mul_hom : M.mul ≫ hom = (hom ⊗ hom) ≫ N.mul := by aesop_cat
#align Mon_.hom Mon_.Hom
attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom
/-- The identity morphism on a monoid object. -/
@[simps]
def id (M : Mon_ C) : Hom M M where
hom := 𝟙 M.X
#align Mon_.id Mon_.id
instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) :=
⟨id M⟩
#align Mon_.hom_inhabited Mon_.homInhabited
/-- Composition of morphisms of monoid objects. -/
@[simps]
def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where
hom := f.hom ≫ g.hom
#align Mon_.comp Mon_.comp
instance : Category (Mon_ C) where
Hom M N := Hom M N
id := id
comp f g := comp f g
-- Porting note: added, as `Hom.ext` does not apply to a morphism.
@[ext]
lemma ext {X Y : Mon_ C} {f g : X ⟶ Y} (w : f.hom = g.hom) : f = g :=
Hom.ext _ _ w
@[simp]
theorem id_hom' (M : Mon_ C) : (𝟙 M : Hom M M).hom = 𝟙 M.X :=
rfl
#align Mon_.id_hom' Mon_.id_hom'
@[simp]
theorem comp_hom' {M N K : Mon_ C} (f : M ⟶ N) (g : N ⟶ K) :
(f ≫ g : Hom M K).hom = f.hom ≫ g.hom :=
rfl
#align Mon_.comp_hom' Mon_.comp_hom'
section
variable (C)
/-- The forgetful functor from monoid objects to the ambient category. -/
@[simps]
def forget : Mon_ C ⥤ C where
obj A := A.X
map f := f.hom
#align Mon_.forget Mon_.forget
end
instance forget_faithful : Faithful (@forget C _ _) where
#align Mon_.forget_faithful Mon_.forget_faithful
instance {A B : Mon_ C} (f : A ⟶ B) [e : IsIso ((forget C).map f)] : IsIso f.hom :=
e
/-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/
instance : ReflectsIsomorphisms (forget C) where
reflects f e :=
⟨⟨{ hom := inv f.hom
mul_hom := by
simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, ← tensor_comp_assoc,
IsIso.inv_hom_id, tensor_id, Category.id_comp] },
by aesop_cat⟩⟩
/-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X ≅ N.X) (one_f : M.one ≫ f.hom = N.one)
(mul_f : M.mul ≫ f.hom = (f.hom ⊗ f.hom) ≫ N.mul) : M ≅ N where
hom :=
{ hom := f.hom
one_hom := one_f
mul_hom := mul_f }
inv :=
{ hom := f.inv
one_hom := by rw [← one_f]; simp
mul_hom := by
rw [← cancel_mono f.hom]
slice_rhs 2 3 => rw [mul_f]
simp }
#align Mon_.iso_of_iso Mon_.isoOfIso
instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C ⟶ A) where
default :=
{ hom := A.one
one_hom := by dsimp; simp
mul_hom := by dsimp; simp [A.one_mul, unitors_equal] }
uniq f := by
ext; simp
rw [← Category.id_comp f.hom]
erw [f.one_hom]
#align Mon_.unique_hom_from_trivial Mon_.uniqueHomFromTrivial
open CategoryTheory.Limits
instance : HasInitial (Mon_ C) :=
hasInitial_of_unique (trivial C)
end Mon_
namespace CategoryTheory.LaxMonoidalFunctor
variable {C} {D : Type u₂} [Category.{v₂} D] [MonoidalCategory.{v₂} D]
-- TODO: mapMod F A : Mod A ⥤ Mod (F.mapMon A)
/-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one]
rw [F.toFunctor.map_id]
rw [F.right_unitality]
mul_assoc := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_assoc]
conv_lhs => rw [F.toFunctor.map_id]
conv_lhs => rw [F.toFunctor.map_comp, F.toFunctor.map_comp]
conv_rhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_rhs 3 4 => rw [F.μ_natural]
conv_rhs => rw [F.toFunctor.map_id]
slice_rhs 1 3 => rw [← F.associativity]
simp only [Category.assoc] }
map f :=
{ hom := F.map f.hom
one_hom := by dsimp; rw [Category.assoc, ← F.toFunctor.map_comp, f.one_hom]
mul_hom := by
dsimp
rw [Category.assoc, F.μ_natural_assoc, ← F.toFunctor.map_comp, ← F.toFunctor.map_comp,
f.mul_hom] }
map_id A := by ext; simp
map_comp f g := by ext; simp
#align category_theory.lax_monoidal_functor.map_Mon CategoryTheory.LaxMonoidalFunctor.mapMon
variable (C D)
/-- `mapMon` is functorial in the lax monoidal functor. -/
@[simps] -- Porting note: added this, not sure how it worked previously without.
def mapMonFunctor : LaxMonoidalFunctor C D ⥤ Mon_ C ⥤ Mon_ D where
obj := mapMon
map α := { app := fun A => { hom := α.app A.X } }
#align category_theory.lax_monoidal_functor.map_Mon_functor CategoryTheory.LaxMonoidalFunctor.mapMonFunctor
end CategoryTheory.LaxMonoidalFunctor
namespace Mon_
open CategoryTheory.LaxMonoidalFunctor
namespace EquivLaxMonoidalFunctorPUnit
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps]
def laxMonoidalToMon : LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C ⥤ Mon_ C where
obj F := (F.mapMon : Mon_ _ ⥤ Mon_ C).obj (trivial (Discrete PUnit))
map α := ((mapMonFunctor (Discrete PUnit) C).map α).app _
#align Mon_.equiv_lax_monoidal_functor_punit.lax_monoidal_to_Mon Mon_.EquivLaxMonoidalFunctorPUnit.laxMonoidalToMon
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps]
def monToLaxMonoidal : Mon_ C ⥤ LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C where
obj A :=
{ obj := fun _ => A.X
map := fun _ => 𝟙 _
ε := A.one
μ := fun _ _ => A.mul
map_id := fun _ => rfl
map_comp := fun _ _ => (Category.id_comp (𝟙 A.X)).symm }
map f :=
{ app := fun _ => f.hom
naturality := fun _ _ _ => by dsimp; | rw [Category.id_comp, Category.comp_id] | /-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps]
def monToLaxMonoidal : Mon_ C ⥤ LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C where
obj A :=
{ obj := fun _ => A.X
map := fun _ => 𝟙 _
ε := A.one
μ := fun _ _ => A.mul
map_id := fun _ => rfl
map_comp := fun _ _ => (Category.id_comp (𝟙 A.X)).symm }
map f :=
{ app := fun _ => f.hom
naturality := fun _ _ _ => by dsimp; | Mathlib.CategoryTheory.Monoidal.Mon_.270_0.NTUMzhXPwXsmsYt | /-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps]
def monToLaxMonoidal : Mon_ C ⥤ LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C where
obj A | Mathlib_CategoryTheory_Monoidal_Mon_ |
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : MonoidalCategory C
F : LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C
x✝ : Discrete PUnit.{u + 1}
⊢ x✝ = (trivial (Discrete PUnit.{u + 1})).X | /-
Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/
import Mathlib.CategoryTheory.Monoidal.Braided
import Mathlib.CategoryTheory.Monoidal.Discrete
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
import Mathlib.Algebra.PUnitInstances
#align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c"
/-!
# The category of monoids in a monoidal category.
We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to
the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if
`C` is braided, then the category of monoids is naturally monoidal.
-/
set_option linter.uppercaseLean3 false
universe v₁ v₂ u₁ u₂ u
open CategoryTheory MonoidalCategory
variable (C : Type u₁) [Category.{v₁} C] [MonoidalCategory.{v₁} C]
/-- A monoid object internal to a monoidal category.
When the monoidal category is preadditive, this is also sometimes called an "algebra object".
-/
structure Mon_ where
X : C
one : 𝟙_ C ⟶ X
mul : X ⊗ X ⟶ X
one_mul : (one ⊗ 𝟙 X) ≫ mul = (λ_ X).hom := by aesop_cat
mul_one : (𝟙 X ⊗ one) ≫ mul = (ρ_ X).hom := by aesop_cat
-- Obviously there is some flexibility stating this axiom.
-- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`,
-- and chooses to place the associator on the right-hand side.
-- The heuristic is that unitors and associators "don't have much weight".
mul_assoc : (mul ⊗ 𝟙 X) ≫ mul = (α_ X X X).hom ≫ (𝟙 X ⊗ mul) ≫ mul := by aesop_cat
#align Mon_ Mon_
attribute [reassoc] Mon_.one_mul Mon_.mul_one
-- We prove a more general `@[simp]` lemma below.
attribute [reassoc (attr := simp)] Mon_.mul_assoc
namespace Mon_
/-- The trivial monoid object. We later show this is initial in `Mon_ C`.
-/
@[simps]
def trivial : Mon_ C where
X := 𝟙_ C
one := 𝟙 _
mul := (λ_ _).hom
mul_assoc := by coherence
mul_one := by coherence
#align Mon_.trivial Mon_.trivial
instance : Inhabited (Mon_ C) :=
⟨trivial C⟩
variable {C}
variable {M : Mon_ C}
@[simp]
theorem one_mul_hom {Z : C} (f : Z ⟶ M.X) : (M.one ⊗ f) ≫ M.mul = (λ_ Z).hom ≫ f := by
rw [← id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality]
#align Mon_.one_mul_hom Mon_.one_mul_hom
@[simp]
theorem mul_one_hom {Z : C} (f : Z ⟶ M.X) : (f ⊗ M.one) ≫ M.mul = (ρ_ Z).hom ≫ f := by
rw [← tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality]
#align Mon_.mul_one_hom Mon_.mul_one_hom
theorem assoc_flip :
(𝟙 M.X ⊗ M.mul) ≫ M.mul = (α_ M.X M.X M.X).inv ≫ (M.mul ⊗ 𝟙 M.X) ≫ M.mul := by simp
#align Mon_.assoc_flip Mon_.assoc_flip
/-- A morphism of monoid objects. -/
@[ext]
structure Hom (M N : Mon_ C) where
hom : M.X ⟶ N.X
one_hom : M.one ≫ hom = N.one := by aesop_cat
mul_hom : M.mul ≫ hom = (hom ⊗ hom) ≫ N.mul := by aesop_cat
#align Mon_.hom Mon_.Hom
attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom
/-- The identity morphism on a monoid object. -/
@[simps]
def id (M : Mon_ C) : Hom M M where
hom := 𝟙 M.X
#align Mon_.id Mon_.id
instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) :=
⟨id M⟩
#align Mon_.hom_inhabited Mon_.homInhabited
/-- Composition of morphisms of monoid objects. -/
@[simps]
def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where
hom := f.hom ≫ g.hom
#align Mon_.comp Mon_.comp
instance : Category (Mon_ C) where
Hom M N := Hom M N
id := id
comp f g := comp f g
-- Porting note: added, as `Hom.ext` does not apply to a morphism.
@[ext]
lemma ext {X Y : Mon_ C} {f g : X ⟶ Y} (w : f.hom = g.hom) : f = g :=
Hom.ext _ _ w
@[simp]
theorem id_hom' (M : Mon_ C) : (𝟙 M : Hom M M).hom = 𝟙 M.X :=
rfl
#align Mon_.id_hom' Mon_.id_hom'
@[simp]
theorem comp_hom' {M N K : Mon_ C} (f : M ⟶ N) (g : N ⟶ K) :
(f ≫ g : Hom M K).hom = f.hom ≫ g.hom :=
rfl
#align Mon_.comp_hom' Mon_.comp_hom'
section
variable (C)
/-- The forgetful functor from monoid objects to the ambient category. -/
@[simps]
def forget : Mon_ C ⥤ C where
obj A := A.X
map f := f.hom
#align Mon_.forget Mon_.forget
end
instance forget_faithful : Faithful (@forget C _ _) where
#align Mon_.forget_faithful Mon_.forget_faithful
instance {A B : Mon_ C} (f : A ⟶ B) [e : IsIso ((forget C).map f)] : IsIso f.hom :=
e
/-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/
instance : ReflectsIsomorphisms (forget C) where
reflects f e :=
⟨⟨{ hom := inv f.hom
mul_hom := by
simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, ← tensor_comp_assoc,
IsIso.inv_hom_id, tensor_id, Category.id_comp] },
by aesop_cat⟩⟩
/-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X ≅ N.X) (one_f : M.one ≫ f.hom = N.one)
(mul_f : M.mul ≫ f.hom = (f.hom ⊗ f.hom) ≫ N.mul) : M ≅ N where
hom :=
{ hom := f.hom
one_hom := one_f
mul_hom := mul_f }
inv :=
{ hom := f.inv
one_hom := by rw [← one_f]; simp
mul_hom := by
rw [← cancel_mono f.hom]
slice_rhs 2 3 => rw [mul_f]
simp }
#align Mon_.iso_of_iso Mon_.isoOfIso
instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C ⟶ A) where
default :=
{ hom := A.one
one_hom := by dsimp; simp
mul_hom := by dsimp; simp [A.one_mul, unitors_equal] }
uniq f := by
ext; simp
rw [← Category.id_comp f.hom]
erw [f.one_hom]
#align Mon_.unique_hom_from_trivial Mon_.uniqueHomFromTrivial
open CategoryTheory.Limits
instance : HasInitial (Mon_ C) :=
hasInitial_of_unique (trivial C)
end Mon_
namespace CategoryTheory.LaxMonoidalFunctor
variable {C} {D : Type u₂} [Category.{v₂} D] [MonoidalCategory.{v₂} D]
-- TODO: mapMod F A : Mod A ⥤ Mod (F.mapMon A)
/-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one]
rw [F.toFunctor.map_id]
rw [F.right_unitality]
mul_assoc := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_assoc]
conv_lhs => rw [F.toFunctor.map_id]
conv_lhs => rw [F.toFunctor.map_comp, F.toFunctor.map_comp]
conv_rhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_rhs 3 4 => rw [F.μ_natural]
conv_rhs => rw [F.toFunctor.map_id]
slice_rhs 1 3 => rw [← F.associativity]
simp only [Category.assoc] }
map f :=
{ hom := F.map f.hom
one_hom := by dsimp; rw [Category.assoc, ← F.toFunctor.map_comp, f.one_hom]
mul_hom := by
dsimp
rw [Category.assoc, F.μ_natural_assoc, ← F.toFunctor.map_comp, ← F.toFunctor.map_comp,
f.mul_hom] }
map_id A := by ext; simp
map_comp f g := by ext; simp
#align category_theory.lax_monoidal_functor.map_Mon CategoryTheory.LaxMonoidalFunctor.mapMon
variable (C D)
/-- `mapMon` is functorial in the lax monoidal functor. -/
@[simps] -- Porting note: added this, not sure how it worked previously without.
def mapMonFunctor : LaxMonoidalFunctor C D ⥤ Mon_ C ⥤ Mon_ D where
obj := mapMon
map α := { app := fun A => { hom := α.app A.X } }
#align category_theory.lax_monoidal_functor.map_Mon_functor CategoryTheory.LaxMonoidalFunctor.mapMonFunctor
end CategoryTheory.LaxMonoidalFunctor
namespace Mon_
open CategoryTheory.LaxMonoidalFunctor
namespace EquivLaxMonoidalFunctorPUnit
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps]
def laxMonoidalToMon : LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C ⥤ Mon_ C where
obj F := (F.mapMon : Mon_ _ ⥤ Mon_ C).obj (trivial (Discrete PUnit))
map α := ((mapMonFunctor (Discrete PUnit) C).map α).app _
#align Mon_.equiv_lax_monoidal_functor_punit.lax_monoidal_to_Mon Mon_.EquivLaxMonoidalFunctorPUnit.laxMonoidalToMon
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps]
def monToLaxMonoidal : Mon_ C ⥤ LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C where
obj A :=
{ obj := fun _ => A.X
map := fun _ => 𝟙 _
ε := A.one
μ := fun _ _ => A.mul
map_id := fun _ => rfl
map_comp := fun _ _ => (Category.id_comp (𝟙 A.X)).symm }
map f :=
{ app := fun _ => f.hom
naturality := fun _ _ _ => by dsimp; rw [Category.id_comp, Category.comp_id]
unit := f.one_hom
tensor := fun _ _ => f.mul_hom }
#align Mon_.equiv_lax_monoidal_functor_punit.Mon_to_lax_monoidal Mon_.EquivLaxMonoidalFunctorPUnit.monToLaxMonoidal
attribute [local aesop safe tactic (rule_sets [CategoryTheory])]
CategoryTheory.Discrete.discreteCases
attribute [local simp] eqToIso_map
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps!]
def unitIso :
𝟭 (LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C) ≅ laxMonoidalToMon C ⋙ monToLaxMonoidal C :=
NatIso.ofComponents
(fun F =>
MonoidalNatIso.ofComponents (fun _ => F.toFunctor.mapIso (eqToIso (by | ext | /-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps!]
def unitIso :
𝟭 (LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C) ≅ laxMonoidalToMon C ⋙ monToLaxMonoidal C :=
NatIso.ofComponents
(fun F =>
MonoidalNatIso.ofComponents (fun _ => F.toFunctor.mapIso (eqToIso (by | Mathlib.CategoryTheory.Monoidal.Mon_.292_0.NTUMzhXPwXsmsYt | /-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps!]
def unitIso :
𝟭 (LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C) ≅ laxMonoidalToMon C ⋙ monToLaxMonoidal C | Mathlib_CategoryTheory_Monoidal_Mon_ |
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : MonoidalCategory C
F : LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C
⊢ ∀ {X Y : Discrete PUnit.{u + 1}} (f : X ⟶ Y),
((𝟭 (LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C)).obj F).map f ≫
((fun x => F.mapIso (eqToIso (_ : x = (trivial (Discrete PUnit.{u + 1})).X))) Y).hom =
((fun x => F.mapIso (eqToIso (_ : x = (trivial (Discrete PUnit.{u + 1})).X))) X).hom ≫
((laxMonoidalToMon C ⋙ monToLaxMonoidal C).obj F).map f | /-
Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/
import Mathlib.CategoryTheory.Monoidal.Braided
import Mathlib.CategoryTheory.Monoidal.Discrete
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
import Mathlib.Algebra.PUnitInstances
#align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c"
/-!
# The category of monoids in a monoidal category.
We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to
the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if
`C` is braided, then the category of monoids is naturally monoidal.
-/
set_option linter.uppercaseLean3 false
universe v₁ v₂ u₁ u₂ u
open CategoryTheory MonoidalCategory
variable (C : Type u₁) [Category.{v₁} C] [MonoidalCategory.{v₁} C]
/-- A monoid object internal to a monoidal category.
When the monoidal category is preadditive, this is also sometimes called an "algebra object".
-/
structure Mon_ where
X : C
one : 𝟙_ C ⟶ X
mul : X ⊗ X ⟶ X
one_mul : (one ⊗ 𝟙 X) ≫ mul = (λ_ X).hom := by aesop_cat
mul_one : (𝟙 X ⊗ one) ≫ mul = (ρ_ X).hom := by aesop_cat
-- Obviously there is some flexibility stating this axiom.
-- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`,
-- and chooses to place the associator on the right-hand side.
-- The heuristic is that unitors and associators "don't have much weight".
mul_assoc : (mul ⊗ 𝟙 X) ≫ mul = (α_ X X X).hom ≫ (𝟙 X ⊗ mul) ≫ mul := by aesop_cat
#align Mon_ Mon_
attribute [reassoc] Mon_.one_mul Mon_.mul_one
-- We prove a more general `@[simp]` lemma below.
attribute [reassoc (attr := simp)] Mon_.mul_assoc
namespace Mon_
/-- The trivial monoid object. We later show this is initial in `Mon_ C`.
-/
@[simps]
def trivial : Mon_ C where
X := 𝟙_ C
one := 𝟙 _
mul := (λ_ _).hom
mul_assoc := by coherence
mul_one := by coherence
#align Mon_.trivial Mon_.trivial
instance : Inhabited (Mon_ C) :=
⟨trivial C⟩
variable {C}
variable {M : Mon_ C}
@[simp]
theorem one_mul_hom {Z : C} (f : Z ⟶ M.X) : (M.one ⊗ f) ≫ M.mul = (λ_ Z).hom ≫ f := by
rw [← id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality]
#align Mon_.one_mul_hom Mon_.one_mul_hom
@[simp]
theorem mul_one_hom {Z : C} (f : Z ⟶ M.X) : (f ⊗ M.one) ≫ M.mul = (ρ_ Z).hom ≫ f := by
rw [← tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality]
#align Mon_.mul_one_hom Mon_.mul_one_hom
theorem assoc_flip :
(𝟙 M.X ⊗ M.mul) ≫ M.mul = (α_ M.X M.X M.X).inv ≫ (M.mul ⊗ 𝟙 M.X) ≫ M.mul := by simp
#align Mon_.assoc_flip Mon_.assoc_flip
/-- A morphism of monoid objects. -/
@[ext]
structure Hom (M N : Mon_ C) where
hom : M.X ⟶ N.X
one_hom : M.one ≫ hom = N.one := by aesop_cat
mul_hom : M.mul ≫ hom = (hom ⊗ hom) ≫ N.mul := by aesop_cat
#align Mon_.hom Mon_.Hom
attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom
/-- The identity morphism on a monoid object. -/
@[simps]
def id (M : Mon_ C) : Hom M M where
hom := 𝟙 M.X
#align Mon_.id Mon_.id
instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) :=
⟨id M⟩
#align Mon_.hom_inhabited Mon_.homInhabited
/-- Composition of morphisms of monoid objects. -/
@[simps]
def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where
hom := f.hom ≫ g.hom
#align Mon_.comp Mon_.comp
instance : Category (Mon_ C) where
Hom M N := Hom M N
id := id
comp f g := comp f g
-- Porting note: added, as `Hom.ext` does not apply to a morphism.
@[ext]
lemma ext {X Y : Mon_ C} {f g : X ⟶ Y} (w : f.hom = g.hom) : f = g :=
Hom.ext _ _ w
@[simp]
theorem id_hom' (M : Mon_ C) : (𝟙 M : Hom M M).hom = 𝟙 M.X :=
rfl
#align Mon_.id_hom' Mon_.id_hom'
@[simp]
theorem comp_hom' {M N K : Mon_ C} (f : M ⟶ N) (g : N ⟶ K) :
(f ≫ g : Hom M K).hom = f.hom ≫ g.hom :=
rfl
#align Mon_.comp_hom' Mon_.comp_hom'
section
variable (C)
/-- The forgetful functor from monoid objects to the ambient category. -/
@[simps]
def forget : Mon_ C ⥤ C where
obj A := A.X
map f := f.hom
#align Mon_.forget Mon_.forget
end
instance forget_faithful : Faithful (@forget C _ _) where
#align Mon_.forget_faithful Mon_.forget_faithful
instance {A B : Mon_ C} (f : A ⟶ B) [e : IsIso ((forget C).map f)] : IsIso f.hom :=
e
/-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/
instance : ReflectsIsomorphisms (forget C) where
reflects f e :=
⟨⟨{ hom := inv f.hom
mul_hom := by
simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, ← tensor_comp_assoc,
IsIso.inv_hom_id, tensor_id, Category.id_comp] },
by aesop_cat⟩⟩
/-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X ≅ N.X) (one_f : M.one ≫ f.hom = N.one)
(mul_f : M.mul ≫ f.hom = (f.hom ⊗ f.hom) ≫ N.mul) : M ≅ N where
hom :=
{ hom := f.hom
one_hom := one_f
mul_hom := mul_f }
inv :=
{ hom := f.inv
one_hom := by rw [← one_f]; simp
mul_hom := by
rw [← cancel_mono f.hom]
slice_rhs 2 3 => rw [mul_f]
simp }
#align Mon_.iso_of_iso Mon_.isoOfIso
instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C ⟶ A) where
default :=
{ hom := A.one
one_hom := by dsimp; simp
mul_hom := by dsimp; simp [A.one_mul, unitors_equal] }
uniq f := by
ext; simp
rw [← Category.id_comp f.hom]
erw [f.one_hom]
#align Mon_.unique_hom_from_trivial Mon_.uniqueHomFromTrivial
open CategoryTheory.Limits
instance : HasInitial (Mon_ C) :=
hasInitial_of_unique (trivial C)
end Mon_
namespace CategoryTheory.LaxMonoidalFunctor
variable {C} {D : Type u₂} [Category.{v₂} D] [MonoidalCategory.{v₂} D]
-- TODO: mapMod F A : Mod A ⥤ Mod (F.mapMon A)
/-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one]
rw [F.toFunctor.map_id]
rw [F.right_unitality]
mul_assoc := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_assoc]
conv_lhs => rw [F.toFunctor.map_id]
conv_lhs => rw [F.toFunctor.map_comp, F.toFunctor.map_comp]
conv_rhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_rhs 3 4 => rw [F.μ_natural]
conv_rhs => rw [F.toFunctor.map_id]
slice_rhs 1 3 => rw [← F.associativity]
simp only [Category.assoc] }
map f :=
{ hom := F.map f.hom
one_hom := by dsimp; rw [Category.assoc, ← F.toFunctor.map_comp, f.one_hom]
mul_hom := by
dsimp
rw [Category.assoc, F.μ_natural_assoc, ← F.toFunctor.map_comp, ← F.toFunctor.map_comp,
f.mul_hom] }
map_id A := by ext; simp
map_comp f g := by ext; simp
#align category_theory.lax_monoidal_functor.map_Mon CategoryTheory.LaxMonoidalFunctor.mapMon
variable (C D)
/-- `mapMon` is functorial in the lax monoidal functor. -/
@[simps] -- Porting note: added this, not sure how it worked previously without.
def mapMonFunctor : LaxMonoidalFunctor C D ⥤ Mon_ C ⥤ Mon_ D where
obj := mapMon
map α := { app := fun A => { hom := α.app A.X } }
#align category_theory.lax_monoidal_functor.map_Mon_functor CategoryTheory.LaxMonoidalFunctor.mapMonFunctor
end CategoryTheory.LaxMonoidalFunctor
namespace Mon_
open CategoryTheory.LaxMonoidalFunctor
namespace EquivLaxMonoidalFunctorPUnit
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps]
def laxMonoidalToMon : LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C ⥤ Mon_ C where
obj F := (F.mapMon : Mon_ _ ⥤ Mon_ C).obj (trivial (Discrete PUnit))
map α := ((mapMonFunctor (Discrete PUnit) C).map α).app _
#align Mon_.equiv_lax_monoidal_functor_punit.lax_monoidal_to_Mon Mon_.EquivLaxMonoidalFunctorPUnit.laxMonoidalToMon
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps]
def monToLaxMonoidal : Mon_ C ⥤ LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C where
obj A :=
{ obj := fun _ => A.X
map := fun _ => 𝟙 _
ε := A.one
μ := fun _ _ => A.mul
map_id := fun _ => rfl
map_comp := fun _ _ => (Category.id_comp (𝟙 A.X)).symm }
map f :=
{ app := fun _ => f.hom
naturality := fun _ _ _ => by dsimp; rw [Category.id_comp, Category.comp_id]
unit := f.one_hom
tensor := fun _ _ => f.mul_hom }
#align Mon_.equiv_lax_monoidal_functor_punit.Mon_to_lax_monoidal Mon_.EquivLaxMonoidalFunctorPUnit.monToLaxMonoidal
attribute [local aesop safe tactic (rule_sets [CategoryTheory])]
CategoryTheory.Discrete.discreteCases
attribute [local simp] eqToIso_map
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps!]
def unitIso :
𝟭 (LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C) ≅ laxMonoidalToMon C ⋙ monToLaxMonoidal C :=
NatIso.ofComponents
(fun F =>
MonoidalNatIso.ofComponents (fun _ => F.toFunctor.mapIso (eqToIso (by ext))) (by | aesop_cat | /-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps!]
def unitIso :
𝟭 (LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C) ≅ laxMonoidalToMon C ⋙ monToLaxMonoidal C :=
NatIso.ofComponents
(fun F =>
MonoidalNatIso.ofComponents (fun _ => F.toFunctor.mapIso (eqToIso (by ext))) (by | Mathlib.CategoryTheory.Monoidal.Mon_.292_0.NTUMzhXPwXsmsYt | /-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps!]
def unitIso :
𝟭 (LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C) ≅ laxMonoidalToMon C ⋙ monToLaxMonoidal C | Mathlib_CategoryTheory_Monoidal_Mon_ |
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : MonoidalCategory C
F : LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C
⊢ ((𝟭 (LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C)).obj F).ε ≫
((fun x => F.mapIso (eqToIso (_ : x = (trivial (Discrete PUnit.{u + 1})).X))) (𝟙_ (Discrete PUnit.{u + 1}))).hom =
((laxMonoidalToMon C ⋙ monToLaxMonoidal C).obj F).ε | /-
Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/
import Mathlib.CategoryTheory.Monoidal.Braided
import Mathlib.CategoryTheory.Monoidal.Discrete
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
import Mathlib.Algebra.PUnitInstances
#align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c"
/-!
# The category of monoids in a monoidal category.
We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to
the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if
`C` is braided, then the category of monoids is naturally monoidal.
-/
set_option linter.uppercaseLean3 false
universe v₁ v₂ u₁ u₂ u
open CategoryTheory MonoidalCategory
variable (C : Type u₁) [Category.{v₁} C] [MonoidalCategory.{v₁} C]
/-- A monoid object internal to a monoidal category.
When the monoidal category is preadditive, this is also sometimes called an "algebra object".
-/
structure Mon_ where
X : C
one : 𝟙_ C ⟶ X
mul : X ⊗ X ⟶ X
one_mul : (one ⊗ 𝟙 X) ≫ mul = (λ_ X).hom := by aesop_cat
mul_one : (𝟙 X ⊗ one) ≫ mul = (ρ_ X).hom := by aesop_cat
-- Obviously there is some flexibility stating this axiom.
-- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`,
-- and chooses to place the associator on the right-hand side.
-- The heuristic is that unitors and associators "don't have much weight".
mul_assoc : (mul ⊗ 𝟙 X) ≫ mul = (α_ X X X).hom ≫ (𝟙 X ⊗ mul) ≫ mul := by aesop_cat
#align Mon_ Mon_
attribute [reassoc] Mon_.one_mul Mon_.mul_one
-- We prove a more general `@[simp]` lemma below.
attribute [reassoc (attr := simp)] Mon_.mul_assoc
namespace Mon_
/-- The trivial monoid object. We later show this is initial in `Mon_ C`.
-/
@[simps]
def trivial : Mon_ C where
X := 𝟙_ C
one := 𝟙 _
mul := (λ_ _).hom
mul_assoc := by coherence
mul_one := by coherence
#align Mon_.trivial Mon_.trivial
instance : Inhabited (Mon_ C) :=
⟨trivial C⟩
variable {C}
variable {M : Mon_ C}
@[simp]
theorem one_mul_hom {Z : C} (f : Z ⟶ M.X) : (M.one ⊗ f) ≫ M.mul = (λ_ Z).hom ≫ f := by
rw [← id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality]
#align Mon_.one_mul_hom Mon_.one_mul_hom
@[simp]
theorem mul_one_hom {Z : C} (f : Z ⟶ M.X) : (f ⊗ M.one) ≫ M.mul = (ρ_ Z).hom ≫ f := by
rw [← tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality]
#align Mon_.mul_one_hom Mon_.mul_one_hom
theorem assoc_flip :
(𝟙 M.X ⊗ M.mul) ≫ M.mul = (α_ M.X M.X M.X).inv ≫ (M.mul ⊗ 𝟙 M.X) ≫ M.mul := by simp
#align Mon_.assoc_flip Mon_.assoc_flip
/-- A morphism of monoid objects. -/
@[ext]
structure Hom (M N : Mon_ C) where
hom : M.X ⟶ N.X
one_hom : M.one ≫ hom = N.one := by aesop_cat
mul_hom : M.mul ≫ hom = (hom ⊗ hom) ≫ N.mul := by aesop_cat
#align Mon_.hom Mon_.Hom
attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom
/-- The identity morphism on a monoid object. -/
@[simps]
def id (M : Mon_ C) : Hom M M where
hom := 𝟙 M.X
#align Mon_.id Mon_.id
instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) :=
⟨id M⟩
#align Mon_.hom_inhabited Mon_.homInhabited
/-- Composition of morphisms of monoid objects. -/
@[simps]
def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where
hom := f.hom ≫ g.hom
#align Mon_.comp Mon_.comp
instance : Category (Mon_ C) where
Hom M N := Hom M N
id := id
comp f g := comp f g
-- Porting note: added, as `Hom.ext` does not apply to a morphism.
@[ext]
lemma ext {X Y : Mon_ C} {f g : X ⟶ Y} (w : f.hom = g.hom) : f = g :=
Hom.ext _ _ w
@[simp]
theorem id_hom' (M : Mon_ C) : (𝟙 M : Hom M M).hom = 𝟙 M.X :=
rfl
#align Mon_.id_hom' Mon_.id_hom'
@[simp]
theorem comp_hom' {M N K : Mon_ C} (f : M ⟶ N) (g : N ⟶ K) :
(f ≫ g : Hom M K).hom = f.hom ≫ g.hom :=
rfl
#align Mon_.comp_hom' Mon_.comp_hom'
section
variable (C)
/-- The forgetful functor from monoid objects to the ambient category. -/
@[simps]
def forget : Mon_ C ⥤ C where
obj A := A.X
map f := f.hom
#align Mon_.forget Mon_.forget
end
instance forget_faithful : Faithful (@forget C _ _) where
#align Mon_.forget_faithful Mon_.forget_faithful
instance {A B : Mon_ C} (f : A ⟶ B) [e : IsIso ((forget C).map f)] : IsIso f.hom :=
e
/-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/
instance : ReflectsIsomorphisms (forget C) where
reflects f e :=
⟨⟨{ hom := inv f.hom
mul_hom := by
simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, ← tensor_comp_assoc,
IsIso.inv_hom_id, tensor_id, Category.id_comp] },
by aesop_cat⟩⟩
/-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X ≅ N.X) (one_f : M.one ≫ f.hom = N.one)
(mul_f : M.mul ≫ f.hom = (f.hom ⊗ f.hom) ≫ N.mul) : M ≅ N where
hom :=
{ hom := f.hom
one_hom := one_f
mul_hom := mul_f }
inv :=
{ hom := f.inv
one_hom := by rw [← one_f]; simp
mul_hom := by
rw [← cancel_mono f.hom]
slice_rhs 2 3 => rw [mul_f]
simp }
#align Mon_.iso_of_iso Mon_.isoOfIso
instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C ⟶ A) where
default :=
{ hom := A.one
one_hom := by dsimp; simp
mul_hom := by dsimp; simp [A.one_mul, unitors_equal] }
uniq f := by
ext; simp
rw [← Category.id_comp f.hom]
erw [f.one_hom]
#align Mon_.unique_hom_from_trivial Mon_.uniqueHomFromTrivial
open CategoryTheory.Limits
instance : HasInitial (Mon_ C) :=
hasInitial_of_unique (trivial C)
end Mon_
namespace CategoryTheory.LaxMonoidalFunctor
variable {C} {D : Type u₂} [Category.{v₂} D] [MonoidalCategory.{v₂} D]
-- TODO: mapMod F A : Mod A ⥤ Mod (F.mapMon A)
/-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one]
rw [F.toFunctor.map_id]
rw [F.right_unitality]
mul_assoc := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_assoc]
conv_lhs => rw [F.toFunctor.map_id]
conv_lhs => rw [F.toFunctor.map_comp, F.toFunctor.map_comp]
conv_rhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_rhs 3 4 => rw [F.μ_natural]
conv_rhs => rw [F.toFunctor.map_id]
slice_rhs 1 3 => rw [← F.associativity]
simp only [Category.assoc] }
map f :=
{ hom := F.map f.hom
one_hom := by dsimp; rw [Category.assoc, ← F.toFunctor.map_comp, f.one_hom]
mul_hom := by
dsimp
rw [Category.assoc, F.μ_natural_assoc, ← F.toFunctor.map_comp, ← F.toFunctor.map_comp,
f.mul_hom] }
map_id A := by ext; simp
map_comp f g := by ext; simp
#align category_theory.lax_monoidal_functor.map_Mon CategoryTheory.LaxMonoidalFunctor.mapMon
variable (C D)
/-- `mapMon` is functorial in the lax monoidal functor. -/
@[simps] -- Porting note: added this, not sure how it worked previously without.
def mapMonFunctor : LaxMonoidalFunctor C D ⥤ Mon_ C ⥤ Mon_ D where
obj := mapMon
map α := { app := fun A => { hom := α.app A.X } }
#align category_theory.lax_monoidal_functor.map_Mon_functor CategoryTheory.LaxMonoidalFunctor.mapMonFunctor
end CategoryTheory.LaxMonoidalFunctor
namespace Mon_
open CategoryTheory.LaxMonoidalFunctor
namespace EquivLaxMonoidalFunctorPUnit
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps]
def laxMonoidalToMon : LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C ⥤ Mon_ C where
obj F := (F.mapMon : Mon_ _ ⥤ Mon_ C).obj (trivial (Discrete PUnit))
map α := ((mapMonFunctor (Discrete PUnit) C).map α).app _
#align Mon_.equiv_lax_monoidal_functor_punit.lax_monoidal_to_Mon Mon_.EquivLaxMonoidalFunctorPUnit.laxMonoidalToMon
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps]
def monToLaxMonoidal : Mon_ C ⥤ LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C where
obj A :=
{ obj := fun _ => A.X
map := fun _ => 𝟙 _
ε := A.one
μ := fun _ _ => A.mul
map_id := fun _ => rfl
map_comp := fun _ _ => (Category.id_comp (𝟙 A.X)).symm }
map f :=
{ app := fun _ => f.hom
naturality := fun _ _ _ => by dsimp; rw [Category.id_comp, Category.comp_id]
unit := f.one_hom
tensor := fun _ _ => f.mul_hom }
#align Mon_.equiv_lax_monoidal_functor_punit.Mon_to_lax_monoidal Mon_.EquivLaxMonoidalFunctorPUnit.monToLaxMonoidal
attribute [local aesop safe tactic (rule_sets [CategoryTheory])]
CategoryTheory.Discrete.discreteCases
attribute [local simp] eqToIso_map
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps!]
def unitIso :
𝟭 (LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C) ≅ laxMonoidalToMon C ⋙ monToLaxMonoidal C :=
NatIso.ofComponents
(fun F =>
MonoidalNatIso.ofComponents (fun _ => F.toFunctor.mapIso (eqToIso (by ext))) (by aesop_cat)
(by | aesop_cat | /-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps!]
def unitIso :
𝟭 (LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C) ≅ laxMonoidalToMon C ⋙ monToLaxMonoidal C :=
NatIso.ofComponents
(fun F =>
MonoidalNatIso.ofComponents (fun _ => F.toFunctor.mapIso (eqToIso (by ext))) (by aesop_cat)
(by | Mathlib.CategoryTheory.Monoidal.Mon_.292_0.NTUMzhXPwXsmsYt | /-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps!]
def unitIso :
𝟭 (LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C) ≅ laxMonoidalToMon C ⋙ monToLaxMonoidal C | Mathlib_CategoryTheory_Monoidal_Mon_ |
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : MonoidalCategory C
F : LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C
⊢ ∀ (X Y : Discrete PUnit.{u + 1}),
μ ((𝟭 (LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C)).obj F) X Y ≫
((fun x => F.mapIso (eqToIso (_ : x = (trivial (Discrete PUnit.{u + 1})).X))) (X ⊗ Y)).hom =
(((fun x => F.mapIso (eqToIso (_ : x = (trivial (Discrete PUnit.{u + 1})).X))) X).hom ⊗
((fun x => F.mapIso (eqToIso (_ : x = (trivial (Discrete PUnit.{u + 1})).X))) Y).hom) ≫
μ ((laxMonoidalToMon C ⋙ monToLaxMonoidal C).obj F) X Y | /-
Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/
import Mathlib.CategoryTheory.Monoidal.Braided
import Mathlib.CategoryTheory.Monoidal.Discrete
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
import Mathlib.Algebra.PUnitInstances
#align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c"
/-!
# The category of monoids in a monoidal category.
We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to
the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if
`C` is braided, then the category of monoids is naturally monoidal.
-/
set_option linter.uppercaseLean3 false
universe v₁ v₂ u₁ u₂ u
open CategoryTheory MonoidalCategory
variable (C : Type u₁) [Category.{v₁} C] [MonoidalCategory.{v₁} C]
/-- A monoid object internal to a monoidal category.
When the monoidal category is preadditive, this is also sometimes called an "algebra object".
-/
structure Mon_ where
X : C
one : 𝟙_ C ⟶ X
mul : X ⊗ X ⟶ X
one_mul : (one ⊗ 𝟙 X) ≫ mul = (λ_ X).hom := by aesop_cat
mul_one : (𝟙 X ⊗ one) ≫ mul = (ρ_ X).hom := by aesop_cat
-- Obviously there is some flexibility stating this axiom.
-- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`,
-- and chooses to place the associator on the right-hand side.
-- The heuristic is that unitors and associators "don't have much weight".
mul_assoc : (mul ⊗ 𝟙 X) ≫ mul = (α_ X X X).hom ≫ (𝟙 X ⊗ mul) ≫ mul := by aesop_cat
#align Mon_ Mon_
attribute [reassoc] Mon_.one_mul Mon_.mul_one
-- We prove a more general `@[simp]` lemma below.
attribute [reassoc (attr := simp)] Mon_.mul_assoc
namespace Mon_
/-- The trivial monoid object. We later show this is initial in `Mon_ C`.
-/
@[simps]
def trivial : Mon_ C where
X := 𝟙_ C
one := 𝟙 _
mul := (λ_ _).hom
mul_assoc := by coherence
mul_one := by coherence
#align Mon_.trivial Mon_.trivial
instance : Inhabited (Mon_ C) :=
⟨trivial C⟩
variable {C}
variable {M : Mon_ C}
@[simp]
theorem one_mul_hom {Z : C} (f : Z ⟶ M.X) : (M.one ⊗ f) ≫ M.mul = (λ_ Z).hom ≫ f := by
rw [← id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality]
#align Mon_.one_mul_hom Mon_.one_mul_hom
@[simp]
theorem mul_one_hom {Z : C} (f : Z ⟶ M.X) : (f ⊗ M.one) ≫ M.mul = (ρ_ Z).hom ≫ f := by
rw [← tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality]
#align Mon_.mul_one_hom Mon_.mul_one_hom
theorem assoc_flip :
(𝟙 M.X ⊗ M.mul) ≫ M.mul = (α_ M.X M.X M.X).inv ≫ (M.mul ⊗ 𝟙 M.X) ≫ M.mul := by simp
#align Mon_.assoc_flip Mon_.assoc_flip
/-- A morphism of monoid objects. -/
@[ext]
structure Hom (M N : Mon_ C) where
hom : M.X ⟶ N.X
one_hom : M.one ≫ hom = N.one := by aesop_cat
mul_hom : M.mul ≫ hom = (hom ⊗ hom) ≫ N.mul := by aesop_cat
#align Mon_.hom Mon_.Hom
attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom
/-- The identity morphism on a monoid object. -/
@[simps]
def id (M : Mon_ C) : Hom M M where
hom := 𝟙 M.X
#align Mon_.id Mon_.id
instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) :=
⟨id M⟩
#align Mon_.hom_inhabited Mon_.homInhabited
/-- Composition of morphisms of monoid objects. -/
@[simps]
def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where
hom := f.hom ≫ g.hom
#align Mon_.comp Mon_.comp
instance : Category (Mon_ C) where
Hom M N := Hom M N
id := id
comp f g := comp f g
-- Porting note: added, as `Hom.ext` does not apply to a morphism.
@[ext]
lemma ext {X Y : Mon_ C} {f g : X ⟶ Y} (w : f.hom = g.hom) : f = g :=
Hom.ext _ _ w
@[simp]
theorem id_hom' (M : Mon_ C) : (𝟙 M : Hom M M).hom = 𝟙 M.X :=
rfl
#align Mon_.id_hom' Mon_.id_hom'
@[simp]
theorem comp_hom' {M N K : Mon_ C} (f : M ⟶ N) (g : N ⟶ K) :
(f ≫ g : Hom M K).hom = f.hom ≫ g.hom :=
rfl
#align Mon_.comp_hom' Mon_.comp_hom'
section
variable (C)
/-- The forgetful functor from monoid objects to the ambient category. -/
@[simps]
def forget : Mon_ C ⥤ C where
obj A := A.X
map f := f.hom
#align Mon_.forget Mon_.forget
end
instance forget_faithful : Faithful (@forget C _ _) where
#align Mon_.forget_faithful Mon_.forget_faithful
instance {A B : Mon_ C} (f : A ⟶ B) [e : IsIso ((forget C).map f)] : IsIso f.hom :=
e
/-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/
instance : ReflectsIsomorphisms (forget C) where
reflects f e :=
⟨⟨{ hom := inv f.hom
mul_hom := by
simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, ← tensor_comp_assoc,
IsIso.inv_hom_id, tensor_id, Category.id_comp] },
by aesop_cat⟩⟩
/-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X ≅ N.X) (one_f : M.one ≫ f.hom = N.one)
(mul_f : M.mul ≫ f.hom = (f.hom ⊗ f.hom) ≫ N.mul) : M ≅ N where
hom :=
{ hom := f.hom
one_hom := one_f
mul_hom := mul_f }
inv :=
{ hom := f.inv
one_hom := by rw [← one_f]; simp
mul_hom := by
rw [← cancel_mono f.hom]
slice_rhs 2 3 => rw [mul_f]
simp }
#align Mon_.iso_of_iso Mon_.isoOfIso
instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C ⟶ A) where
default :=
{ hom := A.one
one_hom := by dsimp; simp
mul_hom := by dsimp; simp [A.one_mul, unitors_equal] }
uniq f := by
ext; simp
rw [← Category.id_comp f.hom]
erw [f.one_hom]
#align Mon_.unique_hom_from_trivial Mon_.uniqueHomFromTrivial
open CategoryTheory.Limits
instance : HasInitial (Mon_ C) :=
hasInitial_of_unique (trivial C)
end Mon_
namespace CategoryTheory.LaxMonoidalFunctor
variable {C} {D : Type u₂} [Category.{v₂} D] [MonoidalCategory.{v₂} D]
-- TODO: mapMod F A : Mod A ⥤ Mod (F.mapMon A)
/-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one]
rw [F.toFunctor.map_id]
rw [F.right_unitality]
mul_assoc := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_assoc]
conv_lhs => rw [F.toFunctor.map_id]
conv_lhs => rw [F.toFunctor.map_comp, F.toFunctor.map_comp]
conv_rhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_rhs 3 4 => rw [F.μ_natural]
conv_rhs => rw [F.toFunctor.map_id]
slice_rhs 1 3 => rw [← F.associativity]
simp only [Category.assoc] }
map f :=
{ hom := F.map f.hom
one_hom := by dsimp; rw [Category.assoc, ← F.toFunctor.map_comp, f.one_hom]
mul_hom := by
dsimp
rw [Category.assoc, F.μ_natural_assoc, ← F.toFunctor.map_comp, ← F.toFunctor.map_comp,
f.mul_hom] }
map_id A := by ext; simp
map_comp f g := by ext; simp
#align category_theory.lax_monoidal_functor.map_Mon CategoryTheory.LaxMonoidalFunctor.mapMon
variable (C D)
/-- `mapMon` is functorial in the lax monoidal functor. -/
@[simps] -- Porting note: added this, not sure how it worked previously without.
def mapMonFunctor : LaxMonoidalFunctor C D ⥤ Mon_ C ⥤ Mon_ D where
obj := mapMon
map α := { app := fun A => { hom := α.app A.X } }
#align category_theory.lax_monoidal_functor.map_Mon_functor CategoryTheory.LaxMonoidalFunctor.mapMonFunctor
end CategoryTheory.LaxMonoidalFunctor
namespace Mon_
open CategoryTheory.LaxMonoidalFunctor
namespace EquivLaxMonoidalFunctorPUnit
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps]
def laxMonoidalToMon : LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C ⥤ Mon_ C where
obj F := (F.mapMon : Mon_ _ ⥤ Mon_ C).obj (trivial (Discrete PUnit))
map α := ((mapMonFunctor (Discrete PUnit) C).map α).app _
#align Mon_.equiv_lax_monoidal_functor_punit.lax_monoidal_to_Mon Mon_.EquivLaxMonoidalFunctorPUnit.laxMonoidalToMon
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps]
def monToLaxMonoidal : Mon_ C ⥤ LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C where
obj A :=
{ obj := fun _ => A.X
map := fun _ => 𝟙 _
ε := A.one
μ := fun _ _ => A.mul
map_id := fun _ => rfl
map_comp := fun _ _ => (Category.id_comp (𝟙 A.X)).symm }
map f :=
{ app := fun _ => f.hom
naturality := fun _ _ _ => by dsimp; rw [Category.id_comp, Category.comp_id]
unit := f.one_hom
tensor := fun _ _ => f.mul_hom }
#align Mon_.equiv_lax_monoidal_functor_punit.Mon_to_lax_monoidal Mon_.EquivLaxMonoidalFunctorPUnit.monToLaxMonoidal
attribute [local aesop safe tactic (rule_sets [CategoryTheory])]
CategoryTheory.Discrete.discreteCases
attribute [local simp] eqToIso_map
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps!]
def unitIso :
𝟭 (LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C) ≅ laxMonoidalToMon C ⋙ monToLaxMonoidal C :=
NatIso.ofComponents
(fun F =>
MonoidalNatIso.ofComponents (fun _ => F.toFunctor.mapIso (eqToIso (by ext))) (by aesop_cat)
(by aesop_cat) (by | aesop_cat | /-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps!]
def unitIso :
𝟭 (LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C) ≅ laxMonoidalToMon C ⋙ monToLaxMonoidal C :=
NatIso.ofComponents
(fun F =>
MonoidalNatIso.ofComponents (fun _ => F.toFunctor.mapIso (eqToIso (by ext))) (by aesop_cat)
(by aesop_cat) (by | Mathlib.CategoryTheory.Monoidal.Mon_.292_0.NTUMzhXPwXsmsYt | /-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps!]
def unitIso :
𝟭 (LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C) ≅ laxMonoidalToMon C ⋙ monToLaxMonoidal C | Mathlib_CategoryTheory_Monoidal_Mon_ |
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : MonoidalCategory C
⊢ ∀ {X Y : LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C} (f : X ⟶ Y),
(𝟭 (LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C)).map f ≫
((fun F =>
MonoidalNatIso.ofComponents (fun x => F.mapIso (eqToIso (_ : x = (trivial (Discrete PUnit.{u + 1})).X)))
(_ :
∀ {X Y : Discrete PUnit.{u + 1}} (f : X ⟶ Y),
((𝟭 (LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C)).obj F).map f ≫
((fun x => F.mapIso (eqToIso (_ : x = (trivial (Discrete PUnit.{u + 1})).X))) Y).hom =
((fun x => F.mapIso (eqToIso (_ : x = (trivial (Discrete PUnit.{u + 1})).X))) X).hom ≫
((laxMonoidalToMon C ⋙ monToLaxMonoidal C).obj F).map f)
(_ :
F.ε ≫ (F.mapIso (Iso.refl (𝟙_ (Discrete PUnit.{u + 1})))).hom =
F.ε ≫ F.map (𝟙 (𝟙_ (Discrete PUnit.{u + 1}))))
(_ :
∀ (X Y : Discrete PUnit.{u + 1}),
μ ((𝟭 (LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C)).obj F) X Y ≫
((fun x => F.mapIso (eqToIso (_ : x = (trivial (Discrete PUnit.{u + 1})).X))) (X ⊗ Y)).hom =
(((fun x => F.mapIso (eqToIso (_ : x = (trivial (Discrete PUnit.{u + 1})).X))) X).hom ⊗
((fun x => F.mapIso (eqToIso (_ : x = (trivial (Discrete PUnit.{u + 1})).X))) Y).hom) ≫
μ ((laxMonoidalToMon C ⋙ monToLaxMonoidal C).obj F) X Y))
Y).hom =
((fun F =>
MonoidalNatIso.ofComponents (fun x => F.mapIso (eqToIso (_ : x = (trivial (Discrete PUnit.{u + 1})).X)))
(_ :
∀ {X Y : Discrete PUnit.{u + 1}} (f : X ⟶ Y),
((𝟭 (LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C)).obj F).map f ≫
((fun x => F.mapIso (eqToIso (_ : x = (trivial (Discrete PUnit.{u + 1})).X))) Y).hom =
((fun x => F.mapIso (eqToIso (_ : x = (trivial (Discrete PUnit.{u + 1})).X))) X).hom ≫
((laxMonoidalToMon C ⋙ monToLaxMonoidal C).obj F).map f)
(_ :
F.ε ≫ (F.mapIso (Iso.refl (𝟙_ (Discrete PUnit.{u + 1})))).hom =
F.ε ≫ F.map (𝟙 (𝟙_ (Discrete PUnit.{u + 1}))))
(_ :
∀ (X Y : Discrete PUnit.{u + 1}),
μ ((𝟭 (LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C)).obj F) X Y ≫
((fun x => F.mapIso (eqToIso (_ : x = (trivial (Discrete PUnit.{u + 1})).X))) (X ⊗ Y)).hom =
(((fun x => F.mapIso (eqToIso (_ : x = (trivial (Discrete PUnit.{u + 1})).X))) X).hom ⊗
((fun x => F.mapIso (eqToIso (_ : x = (trivial (Discrete PUnit.{u + 1})).X))) Y).hom) ≫
μ ((laxMonoidalToMon C ⋙ monToLaxMonoidal C).obj F) X Y))
X).hom ≫
(laxMonoidalToMon C ⋙ monToLaxMonoidal C).map f | /-
Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/
import Mathlib.CategoryTheory.Monoidal.Braided
import Mathlib.CategoryTheory.Monoidal.Discrete
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
import Mathlib.Algebra.PUnitInstances
#align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c"
/-!
# The category of monoids in a monoidal category.
We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to
the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if
`C` is braided, then the category of monoids is naturally monoidal.
-/
set_option linter.uppercaseLean3 false
universe v₁ v₂ u₁ u₂ u
open CategoryTheory MonoidalCategory
variable (C : Type u₁) [Category.{v₁} C] [MonoidalCategory.{v₁} C]
/-- A monoid object internal to a monoidal category.
When the monoidal category is preadditive, this is also sometimes called an "algebra object".
-/
structure Mon_ where
X : C
one : 𝟙_ C ⟶ X
mul : X ⊗ X ⟶ X
one_mul : (one ⊗ 𝟙 X) ≫ mul = (λ_ X).hom := by aesop_cat
mul_one : (𝟙 X ⊗ one) ≫ mul = (ρ_ X).hom := by aesop_cat
-- Obviously there is some flexibility stating this axiom.
-- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`,
-- and chooses to place the associator on the right-hand side.
-- The heuristic is that unitors and associators "don't have much weight".
mul_assoc : (mul ⊗ 𝟙 X) ≫ mul = (α_ X X X).hom ≫ (𝟙 X ⊗ mul) ≫ mul := by aesop_cat
#align Mon_ Mon_
attribute [reassoc] Mon_.one_mul Mon_.mul_one
-- We prove a more general `@[simp]` lemma below.
attribute [reassoc (attr := simp)] Mon_.mul_assoc
namespace Mon_
/-- The trivial monoid object. We later show this is initial in `Mon_ C`.
-/
@[simps]
def trivial : Mon_ C where
X := 𝟙_ C
one := 𝟙 _
mul := (λ_ _).hom
mul_assoc := by coherence
mul_one := by coherence
#align Mon_.trivial Mon_.trivial
instance : Inhabited (Mon_ C) :=
⟨trivial C⟩
variable {C}
variable {M : Mon_ C}
@[simp]
theorem one_mul_hom {Z : C} (f : Z ⟶ M.X) : (M.one ⊗ f) ≫ M.mul = (λ_ Z).hom ≫ f := by
rw [← id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality]
#align Mon_.one_mul_hom Mon_.one_mul_hom
@[simp]
theorem mul_one_hom {Z : C} (f : Z ⟶ M.X) : (f ⊗ M.one) ≫ M.mul = (ρ_ Z).hom ≫ f := by
rw [← tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality]
#align Mon_.mul_one_hom Mon_.mul_one_hom
theorem assoc_flip :
(𝟙 M.X ⊗ M.mul) ≫ M.mul = (α_ M.X M.X M.X).inv ≫ (M.mul ⊗ 𝟙 M.X) ≫ M.mul := by simp
#align Mon_.assoc_flip Mon_.assoc_flip
/-- A morphism of monoid objects. -/
@[ext]
structure Hom (M N : Mon_ C) where
hom : M.X ⟶ N.X
one_hom : M.one ≫ hom = N.one := by aesop_cat
mul_hom : M.mul ≫ hom = (hom ⊗ hom) ≫ N.mul := by aesop_cat
#align Mon_.hom Mon_.Hom
attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom
/-- The identity morphism on a monoid object. -/
@[simps]
def id (M : Mon_ C) : Hom M M where
hom := 𝟙 M.X
#align Mon_.id Mon_.id
instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) :=
⟨id M⟩
#align Mon_.hom_inhabited Mon_.homInhabited
/-- Composition of morphisms of monoid objects. -/
@[simps]
def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where
hom := f.hom ≫ g.hom
#align Mon_.comp Mon_.comp
instance : Category (Mon_ C) where
Hom M N := Hom M N
id := id
comp f g := comp f g
-- Porting note: added, as `Hom.ext` does not apply to a morphism.
@[ext]
lemma ext {X Y : Mon_ C} {f g : X ⟶ Y} (w : f.hom = g.hom) : f = g :=
Hom.ext _ _ w
@[simp]
theorem id_hom' (M : Mon_ C) : (𝟙 M : Hom M M).hom = 𝟙 M.X :=
rfl
#align Mon_.id_hom' Mon_.id_hom'
@[simp]
theorem comp_hom' {M N K : Mon_ C} (f : M ⟶ N) (g : N ⟶ K) :
(f ≫ g : Hom M K).hom = f.hom ≫ g.hom :=
rfl
#align Mon_.comp_hom' Mon_.comp_hom'
section
variable (C)
/-- The forgetful functor from monoid objects to the ambient category. -/
@[simps]
def forget : Mon_ C ⥤ C where
obj A := A.X
map f := f.hom
#align Mon_.forget Mon_.forget
end
instance forget_faithful : Faithful (@forget C _ _) where
#align Mon_.forget_faithful Mon_.forget_faithful
instance {A B : Mon_ C} (f : A ⟶ B) [e : IsIso ((forget C).map f)] : IsIso f.hom :=
e
/-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/
instance : ReflectsIsomorphisms (forget C) where
reflects f e :=
⟨⟨{ hom := inv f.hom
mul_hom := by
simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, ← tensor_comp_assoc,
IsIso.inv_hom_id, tensor_id, Category.id_comp] },
by aesop_cat⟩⟩
/-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X ≅ N.X) (one_f : M.one ≫ f.hom = N.one)
(mul_f : M.mul ≫ f.hom = (f.hom ⊗ f.hom) ≫ N.mul) : M ≅ N where
hom :=
{ hom := f.hom
one_hom := one_f
mul_hom := mul_f }
inv :=
{ hom := f.inv
one_hom := by rw [← one_f]; simp
mul_hom := by
rw [← cancel_mono f.hom]
slice_rhs 2 3 => rw [mul_f]
simp }
#align Mon_.iso_of_iso Mon_.isoOfIso
instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C ⟶ A) where
default :=
{ hom := A.one
one_hom := by dsimp; simp
mul_hom := by dsimp; simp [A.one_mul, unitors_equal] }
uniq f := by
ext; simp
rw [← Category.id_comp f.hom]
erw [f.one_hom]
#align Mon_.unique_hom_from_trivial Mon_.uniqueHomFromTrivial
open CategoryTheory.Limits
instance : HasInitial (Mon_ C) :=
hasInitial_of_unique (trivial C)
end Mon_
namespace CategoryTheory.LaxMonoidalFunctor
variable {C} {D : Type u₂} [Category.{v₂} D] [MonoidalCategory.{v₂} D]
-- TODO: mapMod F A : Mod A ⥤ Mod (F.mapMon A)
/-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one]
rw [F.toFunctor.map_id]
rw [F.right_unitality]
mul_assoc := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_assoc]
conv_lhs => rw [F.toFunctor.map_id]
conv_lhs => rw [F.toFunctor.map_comp, F.toFunctor.map_comp]
conv_rhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_rhs 3 4 => rw [F.μ_natural]
conv_rhs => rw [F.toFunctor.map_id]
slice_rhs 1 3 => rw [← F.associativity]
simp only [Category.assoc] }
map f :=
{ hom := F.map f.hom
one_hom := by dsimp; rw [Category.assoc, ← F.toFunctor.map_comp, f.one_hom]
mul_hom := by
dsimp
rw [Category.assoc, F.μ_natural_assoc, ← F.toFunctor.map_comp, ← F.toFunctor.map_comp,
f.mul_hom] }
map_id A := by ext; simp
map_comp f g := by ext; simp
#align category_theory.lax_monoidal_functor.map_Mon CategoryTheory.LaxMonoidalFunctor.mapMon
variable (C D)
/-- `mapMon` is functorial in the lax monoidal functor. -/
@[simps] -- Porting note: added this, not sure how it worked previously without.
def mapMonFunctor : LaxMonoidalFunctor C D ⥤ Mon_ C ⥤ Mon_ D where
obj := mapMon
map α := { app := fun A => { hom := α.app A.X } }
#align category_theory.lax_monoidal_functor.map_Mon_functor CategoryTheory.LaxMonoidalFunctor.mapMonFunctor
end CategoryTheory.LaxMonoidalFunctor
namespace Mon_
open CategoryTheory.LaxMonoidalFunctor
namespace EquivLaxMonoidalFunctorPUnit
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps]
def laxMonoidalToMon : LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C ⥤ Mon_ C where
obj F := (F.mapMon : Mon_ _ ⥤ Mon_ C).obj (trivial (Discrete PUnit))
map α := ((mapMonFunctor (Discrete PUnit) C).map α).app _
#align Mon_.equiv_lax_monoidal_functor_punit.lax_monoidal_to_Mon Mon_.EquivLaxMonoidalFunctorPUnit.laxMonoidalToMon
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps]
def monToLaxMonoidal : Mon_ C ⥤ LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C where
obj A :=
{ obj := fun _ => A.X
map := fun _ => 𝟙 _
ε := A.one
μ := fun _ _ => A.mul
map_id := fun _ => rfl
map_comp := fun _ _ => (Category.id_comp (𝟙 A.X)).symm }
map f :=
{ app := fun _ => f.hom
naturality := fun _ _ _ => by dsimp; rw [Category.id_comp, Category.comp_id]
unit := f.one_hom
tensor := fun _ _ => f.mul_hom }
#align Mon_.equiv_lax_monoidal_functor_punit.Mon_to_lax_monoidal Mon_.EquivLaxMonoidalFunctorPUnit.monToLaxMonoidal
attribute [local aesop safe tactic (rule_sets [CategoryTheory])]
CategoryTheory.Discrete.discreteCases
attribute [local simp] eqToIso_map
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps!]
def unitIso :
𝟭 (LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C) ≅ laxMonoidalToMon C ⋙ monToLaxMonoidal C :=
NatIso.ofComponents
(fun F =>
MonoidalNatIso.ofComponents (fun _ => F.toFunctor.mapIso (eqToIso (by ext))) (by aesop_cat)
(by aesop_cat) (by aesop_cat))
(by | aesop_cat | /-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps!]
def unitIso :
𝟭 (LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C) ≅ laxMonoidalToMon C ⋙ monToLaxMonoidal C :=
NatIso.ofComponents
(fun F =>
MonoidalNatIso.ofComponents (fun _ => F.toFunctor.mapIso (eqToIso (by ext))) (by aesop_cat)
(by aesop_cat) (by aesop_cat))
(by | Mathlib.CategoryTheory.Monoidal.Mon_.292_0.NTUMzhXPwXsmsYt | /-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps!]
def unitIso :
𝟭 (LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C) ≅ laxMonoidalToMon C ⋙ monToLaxMonoidal C | Mathlib_CategoryTheory_Monoidal_Mon_ |
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : MonoidalCategory C
⊢ ∀ {X Y : Mon_ C} (f : X ⟶ Y),
(monToLaxMonoidal C ⋙ laxMonoidalToMon C).map f ≫
((fun F =>
Iso.mk (Hom.mk (𝟙 ((monToLaxMonoidal C ⋙ laxMonoidalToMon C).obj F).X))
(Hom.mk (𝟙 ((𝟭 (Mon_ C)).obj F).X)))
Y).hom =
((fun F =>
Iso.mk (Hom.mk (𝟙 ((monToLaxMonoidal C ⋙ laxMonoidalToMon C).obj F).X))
(Hom.mk (𝟙 ((𝟭 (Mon_ C)).obj F).X)))
X).hom ≫
(𝟭 (Mon_ C)).map f | /-
Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/
import Mathlib.CategoryTheory.Monoidal.Braided
import Mathlib.CategoryTheory.Monoidal.Discrete
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
import Mathlib.Algebra.PUnitInstances
#align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c"
/-!
# The category of monoids in a monoidal category.
We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to
the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if
`C` is braided, then the category of monoids is naturally monoidal.
-/
set_option linter.uppercaseLean3 false
universe v₁ v₂ u₁ u₂ u
open CategoryTheory MonoidalCategory
variable (C : Type u₁) [Category.{v₁} C] [MonoidalCategory.{v₁} C]
/-- A monoid object internal to a monoidal category.
When the monoidal category is preadditive, this is also sometimes called an "algebra object".
-/
structure Mon_ where
X : C
one : 𝟙_ C ⟶ X
mul : X ⊗ X ⟶ X
one_mul : (one ⊗ 𝟙 X) ≫ mul = (λ_ X).hom := by aesop_cat
mul_one : (𝟙 X ⊗ one) ≫ mul = (ρ_ X).hom := by aesop_cat
-- Obviously there is some flexibility stating this axiom.
-- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`,
-- and chooses to place the associator on the right-hand side.
-- The heuristic is that unitors and associators "don't have much weight".
mul_assoc : (mul ⊗ 𝟙 X) ≫ mul = (α_ X X X).hom ≫ (𝟙 X ⊗ mul) ≫ mul := by aesop_cat
#align Mon_ Mon_
attribute [reassoc] Mon_.one_mul Mon_.mul_one
-- We prove a more general `@[simp]` lemma below.
attribute [reassoc (attr := simp)] Mon_.mul_assoc
namespace Mon_
/-- The trivial monoid object. We later show this is initial in `Mon_ C`.
-/
@[simps]
def trivial : Mon_ C where
X := 𝟙_ C
one := 𝟙 _
mul := (λ_ _).hom
mul_assoc := by coherence
mul_one := by coherence
#align Mon_.trivial Mon_.trivial
instance : Inhabited (Mon_ C) :=
⟨trivial C⟩
variable {C}
variable {M : Mon_ C}
@[simp]
theorem one_mul_hom {Z : C} (f : Z ⟶ M.X) : (M.one ⊗ f) ≫ M.mul = (λ_ Z).hom ≫ f := by
rw [← id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality]
#align Mon_.one_mul_hom Mon_.one_mul_hom
@[simp]
theorem mul_one_hom {Z : C} (f : Z ⟶ M.X) : (f ⊗ M.one) ≫ M.mul = (ρ_ Z).hom ≫ f := by
rw [← tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality]
#align Mon_.mul_one_hom Mon_.mul_one_hom
theorem assoc_flip :
(𝟙 M.X ⊗ M.mul) ≫ M.mul = (α_ M.X M.X M.X).inv ≫ (M.mul ⊗ 𝟙 M.X) ≫ M.mul := by simp
#align Mon_.assoc_flip Mon_.assoc_flip
/-- A morphism of monoid objects. -/
@[ext]
structure Hom (M N : Mon_ C) where
hom : M.X ⟶ N.X
one_hom : M.one ≫ hom = N.one := by aesop_cat
mul_hom : M.mul ≫ hom = (hom ⊗ hom) ≫ N.mul := by aesop_cat
#align Mon_.hom Mon_.Hom
attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom
/-- The identity morphism on a monoid object. -/
@[simps]
def id (M : Mon_ C) : Hom M M where
hom := 𝟙 M.X
#align Mon_.id Mon_.id
instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) :=
⟨id M⟩
#align Mon_.hom_inhabited Mon_.homInhabited
/-- Composition of morphisms of monoid objects. -/
@[simps]
def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where
hom := f.hom ≫ g.hom
#align Mon_.comp Mon_.comp
instance : Category (Mon_ C) where
Hom M N := Hom M N
id := id
comp f g := comp f g
-- Porting note: added, as `Hom.ext` does not apply to a morphism.
@[ext]
lemma ext {X Y : Mon_ C} {f g : X ⟶ Y} (w : f.hom = g.hom) : f = g :=
Hom.ext _ _ w
@[simp]
theorem id_hom' (M : Mon_ C) : (𝟙 M : Hom M M).hom = 𝟙 M.X :=
rfl
#align Mon_.id_hom' Mon_.id_hom'
@[simp]
theorem comp_hom' {M N K : Mon_ C} (f : M ⟶ N) (g : N ⟶ K) :
(f ≫ g : Hom M K).hom = f.hom ≫ g.hom :=
rfl
#align Mon_.comp_hom' Mon_.comp_hom'
section
variable (C)
/-- The forgetful functor from monoid objects to the ambient category. -/
@[simps]
def forget : Mon_ C ⥤ C where
obj A := A.X
map f := f.hom
#align Mon_.forget Mon_.forget
end
instance forget_faithful : Faithful (@forget C _ _) where
#align Mon_.forget_faithful Mon_.forget_faithful
instance {A B : Mon_ C} (f : A ⟶ B) [e : IsIso ((forget C).map f)] : IsIso f.hom :=
e
/-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/
instance : ReflectsIsomorphisms (forget C) where
reflects f e :=
⟨⟨{ hom := inv f.hom
mul_hom := by
simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, ← tensor_comp_assoc,
IsIso.inv_hom_id, tensor_id, Category.id_comp] },
by aesop_cat⟩⟩
/-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X ≅ N.X) (one_f : M.one ≫ f.hom = N.one)
(mul_f : M.mul ≫ f.hom = (f.hom ⊗ f.hom) ≫ N.mul) : M ≅ N where
hom :=
{ hom := f.hom
one_hom := one_f
mul_hom := mul_f }
inv :=
{ hom := f.inv
one_hom := by rw [← one_f]; simp
mul_hom := by
rw [← cancel_mono f.hom]
slice_rhs 2 3 => rw [mul_f]
simp }
#align Mon_.iso_of_iso Mon_.isoOfIso
instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C ⟶ A) where
default :=
{ hom := A.one
one_hom := by dsimp; simp
mul_hom := by dsimp; simp [A.one_mul, unitors_equal] }
uniq f := by
ext; simp
rw [← Category.id_comp f.hom]
erw [f.one_hom]
#align Mon_.unique_hom_from_trivial Mon_.uniqueHomFromTrivial
open CategoryTheory.Limits
instance : HasInitial (Mon_ C) :=
hasInitial_of_unique (trivial C)
end Mon_
namespace CategoryTheory.LaxMonoidalFunctor
variable {C} {D : Type u₂} [Category.{v₂} D] [MonoidalCategory.{v₂} D]
-- TODO: mapMod F A : Mod A ⥤ Mod (F.mapMon A)
/-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one]
rw [F.toFunctor.map_id]
rw [F.right_unitality]
mul_assoc := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_assoc]
conv_lhs => rw [F.toFunctor.map_id]
conv_lhs => rw [F.toFunctor.map_comp, F.toFunctor.map_comp]
conv_rhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_rhs 3 4 => rw [F.μ_natural]
conv_rhs => rw [F.toFunctor.map_id]
slice_rhs 1 3 => rw [← F.associativity]
simp only [Category.assoc] }
map f :=
{ hom := F.map f.hom
one_hom := by dsimp; rw [Category.assoc, ← F.toFunctor.map_comp, f.one_hom]
mul_hom := by
dsimp
rw [Category.assoc, F.μ_natural_assoc, ← F.toFunctor.map_comp, ← F.toFunctor.map_comp,
f.mul_hom] }
map_id A := by ext; simp
map_comp f g := by ext; simp
#align category_theory.lax_monoidal_functor.map_Mon CategoryTheory.LaxMonoidalFunctor.mapMon
variable (C D)
/-- `mapMon` is functorial in the lax monoidal functor. -/
@[simps] -- Porting note: added this, not sure how it worked previously without.
def mapMonFunctor : LaxMonoidalFunctor C D ⥤ Mon_ C ⥤ Mon_ D where
obj := mapMon
map α := { app := fun A => { hom := α.app A.X } }
#align category_theory.lax_monoidal_functor.map_Mon_functor CategoryTheory.LaxMonoidalFunctor.mapMonFunctor
end CategoryTheory.LaxMonoidalFunctor
namespace Mon_
open CategoryTheory.LaxMonoidalFunctor
namespace EquivLaxMonoidalFunctorPUnit
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps]
def laxMonoidalToMon : LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C ⥤ Mon_ C where
obj F := (F.mapMon : Mon_ _ ⥤ Mon_ C).obj (trivial (Discrete PUnit))
map α := ((mapMonFunctor (Discrete PUnit) C).map α).app _
#align Mon_.equiv_lax_monoidal_functor_punit.lax_monoidal_to_Mon Mon_.EquivLaxMonoidalFunctorPUnit.laxMonoidalToMon
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps]
def monToLaxMonoidal : Mon_ C ⥤ LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C where
obj A :=
{ obj := fun _ => A.X
map := fun _ => 𝟙 _
ε := A.one
μ := fun _ _ => A.mul
map_id := fun _ => rfl
map_comp := fun _ _ => (Category.id_comp (𝟙 A.X)).symm }
map f :=
{ app := fun _ => f.hom
naturality := fun _ _ _ => by dsimp; rw [Category.id_comp, Category.comp_id]
unit := f.one_hom
tensor := fun _ _ => f.mul_hom }
#align Mon_.equiv_lax_monoidal_functor_punit.Mon_to_lax_monoidal Mon_.EquivLaxMonoidalFunctorPUnit.monToLaxMonoidal
attribute [local aesop safe tactic (rule_sets [CategoryTheory])]
CategoryTheory.Discrete.discreteCases
attribute [local simp] eqToIso_map
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps!]
def unitIso :
𝟭 (LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C) ≅ laxMonoidalToMon C ⋙ monToLaxMonoidal C :=
NatIso.ofComponents
(fun F =>
MonoidalNatIso.ofComponents (fun _ => F.toFunctor.mapIso (eqToIso (by ext))) (by aesop_cat)
(by aesop_cat) (by aesop_cat))
(by aesop_cat)
#align Mon_.equiv_lax_monoidal_functor_punit.unit_iso Mon_.EquivLaxMonoidalFunctorPUnit.unitIso
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps!]
def counitIso : monToLaxMonoidal C ⋙ laxMonoidalToMon C ≅ 𝟭 (Mon_ C) :=
NatIso.ofComponents
(fun F =>
{ hom := { hom := 𝟙 _ }
inv := { hom := 𝟙 _ } })
(by | aesop_cat | /-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps!]
def counitIso : monToLaxMonoidal C ⋙ laxMonoidalToMon C ≅ 𝟭 (Mon_ C) :=
NatIso.ofComponents
(fun F =>
{ hom := { hom := 𝟙 _ }
inv := { hom := 𝟙 _ } })
(by | Mathlib.CategoryTheory.Monoidal.Mon_.303_0.NTUMzhXPwXsmsYt | /-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps!]
def counitIso : monToLaxMonoidal C ⋙ laxMonoidalToMon C ≅ 𝟭 (Mon_ C) | Mathlib_CategoryTheory_Monoidal_Mon_ |
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : MonoidalCategory C
M N P : Mon_ C
⊢ ((λ_ (𝟙_ C)).inv ≫ ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) ⊗ P.one)) ≫ (α_ M.X N.X P.X).hom =
(λ_ (𝟙_ C)).inv ≫ (M.one ⊗ (λ_ (𝟙_ C)).inv ≫ (N.one ⊗ P.one)) | /-
Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/
import Mathlib.CategoryTheory.Monoidal.Braided
import Mathlib.CategoryTheory.Monoidal.Discrete
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
import Mathlib.Algebra.PUnitInstances
#align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c"
/-!
# The category of monoids in a monoidal category.
We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to
the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if
`C` is braided, then the category of monoids is naturally monoidal.
-/
set_option linter.uppercaseLean3 false
universe v₁ v₂ u₁ u₂ u
open CategoryTheory MonoidalCategory
variable (C : Type u₁) [Category.{v₁} C] [MonoidalCategory.{v₁} C]
/-- A monoid object internal to a monoidal category.
When the monoidal category is preadditive, this is also sometimes called an "algebra object".
-/
structure Mon_ where
X : C
one : 𝟙_ C ⟶ X
mul : X ⊗ X ⟶ X
one_mul : (one ⊗ 𝟙 X) ≫ mul = (λ_ X).hom := by aesop_cat
mul_one : (𝟙 X ⊗ one) ≫ mul = (ρ_ X).hom := by aesop_cat
-- Obviously there is some flexibility stating this axiom.
-- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`,
-- and chooses to place the associator on the right-hand side.
-- The heuristic is that unitors and associators "don't have much weight".
mul_assoc : (mul ⊗ 𝟙 X) ≫ mul = (α_ X X X).hom ≫ (𝟙 X ⊗ mul) ≫ mul := by aesop_cat
#align Mon_ Mon_
attribute [reassoc] Mon_.one_mul Mon_.mul_one
-- We prove a more general `@[simp]` lemma below.
attribute [reassoc (attr := simp)] Mon_.mul_assoc
namespace Mon_
/-- The trivial monoid object. We later show this is initial in `Mon_ C`.
-/
@[simps]
def trivial : Mon_ C where
X := 𝟙_ C
one := 𝟙 _
mul := (λ_ _).hom
mul_assoc := by coherence
mul_one := by coherence
#align Mon_.trivial Mon_.trivial
instance : Inhabited (Mon_ C) :=
⟨trivial C⟩
variable {C}
variable {M : Mon_ C}
@[simp]
theorem one_mul_hom {Z : C} (f : Z ⟶ M.X) : (M.one ⊗ f) ≫ M.mul = (λ_ Z).hom ≫ f := by
rw [← id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality]
#align Mon_.one_mul_hom Mon_.one_mul_hom
@[simp]
theorem mul_one_hom {Z : C} (f : Z ⟶ M.X) : (f ⊗ M.one) ≫ M.mul = (ρ_ Z).hom ≫ f := by
rw [← tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality]
#align Mon_.mul_one_hom Mon_.mul_one_hom
theorem assoc_flip :
(𝟙 M.X ⊗ M.mul) ≫ M.mul = (α_ M.X M.X M.X).inv ≫ (M.mul ⊗ 𝟙 M.X) ≫ M.mul := by simp
#align Mon_.assoc_flip Mon_.assoc_flip
/-- A morphism of monoid objects. -/
@[ext]
structure Hom (M N : Mon_ C) where
hom : M.X ⟶ N.X
one_hom : M.one ≫ hom = N.one := by aesop_cat
mul_hom : M.mul ≫ hom = (hom ⊗ hom) ≫ N.mul := by aesop_cat
#align Mon_.hom Mon_.Hom
attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom
/-- The identity morphism on a monoid object. -/
@[simps]
def id (M : Mon_ C) : Hom M M where
hom := 𝟙 M.X
#align Mon_.id Mon_.id
instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) :=
⟨id M⟩
#align Mon_.hom_inhabited Mon_.homInhabited
/-- Composition of morphisms of monoid objects. -/
@[simps]
def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where
hom := f.hom ≫ g.hom
#align Mon_.comp Mon_.comp
instance : Category (Mon_ C) where
Hom M N := Hom M N
id := id
comp f g := comp f g
-- Porting note: added, as `Hom.ext` does not apply to a morphism.
@[ext]
lemma ext {X Y : Mon_ C} {f g : X ⟶ Y} (w : f.hom = g.hom) : f = g :=
Hom.ext _ _ w
@[simp]
theorem id_hom' (M : Mon_ C) : (𝟙 M : Hom M M).hom = 𝟙 M.X :=
rfl
#align Mon_.id_hom' Mon_.id_hom'
@[simp]
theorem comp_hom' {M N K : Mon_ C} (f : M ⟶ N) (g : N ⟶ K) :
(f ≫ g : Hom M K).hom = f.hom ≫ g.hom :=
rfl
#align Mon_.comp_hom' Mon_.comp_hom'
section
variable (C)
/-- The forgetful functor from monoid objects to the ambient category. -/
@[simps]
def forget : Mon_ C ⥤ C where
obj A := A.X
map f := f.hom
#align Mon_.forget Mon_.forget
end
instance forget_faithful : Faithful (@forget C _ _) where
#align Mon_.forget_faithful Mon_.forget_faithful
instance {A B : Mon_ C} (f : A ⟶ B) [e : IsIso ((forget C).map f)] : IsIso f.hom :=
e
/-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/
instance : ReflectsIsomorphisms (forget C) where
reflects f e :=
⟨⟨{ hom := inv f.hom
mul_hom := by
simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, ← tensor_comp_assoc,
IsIso.inv_hom_id, tensor_id, Category.id_comp] },
by aesop_cat⟩⟩
/-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X ≅ N.X) (one_f : M.one ≫ f.hom = N.one)
(mul_f : M.mul ≫ f.hom = (f.hom ⊗ f.hom) ≫ N.mul) : M ≅ N where
hom :=
{ hom := f.hom
one_hom := one_f
mul_hom := mul_f }
inv :=
{ hom := f.inv
one_hom := by rw [← one_f]; simp
mul_hom := by
rw [← cancel_mono f.hom]
slice_rhs 2 3 => rw [mul_f]
simp }
#align Mon_.iso_of_iso Mon_.isoOfIso
instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C ⟶ A) where
default :=
{ hom := A.one
one_hom := by dsimp; simp
mul_hom := by dsimp; simp [A.one_mul, unitors_equal] }
uniq f := by
ext; simp
rw [← Category.id_comp f.hom]
erw [f.one_hom]
#align Mon_.unique_hom_from_trivial Mon_.uniqueHomFromTrivial
open CategoryTheory.Limits
instance : HasInitial (Mon_ C) :=
hasInitial_of_unique (trivial C)
end Mon_
namespace CategoryTheory.LaxMonoidalFunctor
variable {C} {D : Type u₂} [Category.{v₂} D] [MonoidalCategory.{v₂} D]
-- TODO: mapMod F A : Mod A ⥤ Mod (F.mapMon A)
/-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one]
rw [F.toFunctor.map_id]
rw [F.right_unitality]
mul_assoc := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_assoc]
conv_lhs => rw [F.toFunctor.map_id]
conv_lhs => rw [F.toFunctor.map_comp, F.toFunctor.map_comp]
conv_rhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_rhs 3 4 => rw [F.μ_natural]
conv_rhs => rw [F.toFunctor.map_id]
slice_rhs 1 3 => rw [← F.associativity]
simp only [Category.assoc] }
map f :=
{ hom := F.map f.hom
one_hom := by dsimp; rw [Category.assoc, ← F.toFunctor.map_comp, f.one_hom]
mul_hom := by
dsimp
rw [Category.assoc, F.μ_natural_assoc, ← F.toFunctor.map_comp, ← F.toFunctor.map_comp,
f.mul_hom] }
map_id A := by ext; simp
map_comp f g := by ext; simp
#align category_theory.lax_monoidal_functor.map_Mon CategoryTheory.LaxMonoidalFunctor.mapMon
variable (C D)
/-- `mapMon` is functorial in the lax monoidal functor. -/
@[simps] -- Porting note: added this, not sure how it worked previously without.
def mapMonFunctor : LaxMonoidalFunctor C D ⥤ Mon_ C ⥤ Mon_ D where
obj := mapMon
map α := { app := fun A => { hom := α.app A.X } }
#align category_theory.lax_monoidal_functor.map_Mon_functor CategoryTheory.LaxMonoidalFunctor.mapMonFunctor
end CategoryTheory.LaxMonoidalFunctor
namespace Mon_
open CategoryTheory.LaxMonoidalFunctor
namespace EquivLaxMonoidalFunctorPUnit
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps]
def laxMonoidalToMon : LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C ⥤ Mon_ C where
obj F := (F.mapMon : Mon_ _ ⥤ Mon_ C).obj (trivial (Discrete PUnit))
map α := ((mapMonFunctor (Discrete PUnit) C).map α).app _
#align Mon_.equiv_lax_monoidal_functor_punit.lax_monoidal_to_Mon Mon_.EquivLaxMonoidalFunctorPUnit.laxMonoidalToMon
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps]
def monToLaxMonoidal : Mon_ C ⥤ LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C where
obj A :=
{ obj := fun _ => A.X
map := fun _ => 𝟙 _
ε := A.one
μ := fun _ _ => A.mul
map_id := fun _ => rfl
map_comp := fun _ _ => (Category.id_comp (𝟙 A.X)).symm }
map f :=
{ app := fun _ => f.hom
naturality := fun _ _ _ => by dsimp; rw [Category.id_comp, Category.comp_id]
unit := f.one_hom
tensor := fun _ _ => f.mul_hom }
#align Mon_.equiv_lax_monoidal_functor_punit.Mon_to_lax_monoidal Mon_.EquivLaxMonoidalFunctorPUnit.monToLaxMonoidal
attribute [local aesop safe tactic (rule_sets [CategoryTheory])]
CategoryTheory.Discrete.discreteCases
attribute [local simp] eqToIso_map
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps!]
def unitIso :
𝟭 (LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C) ≅ laxMonoidalToMon C ⋙ monToLaxMonoidal C :=
NatIso.ofComponents
(fun F =>
MonoidalNatIso.ofComponents (fun _ => F.toFunctor.mapIso (eqToIso (by ext))) (by aesop_cat)
(by aesop_cat) (by aesop_cat))
(by aesop_cat)
#align Mon_.equiv_lax_monoidal_functor_punit.unit_iso Mon_.EquivLaxMonoidalFunctorPUnit.unitIso
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps!]
def counitIso : monToLaxMonoidal C ⋙ laxMonoidalToMon C ≅ 𝟭 (Mon_ C) :=
NatIso.ofComponents
(fun F =>
{ hom := { hom := 𝟙 _ }
inv := { hom := 𝟙 _ } })
(by aesop_cat)
#align Mon_.equiv_lax_monoidal_functor_punit.counit_iso Mon_.EquivLaxMonoidalFunctorPUnit.counitIso
end EquivLaxMonoidalFunctorPUnit
open EquivLaxMonoidalFunctorPUnit
attribute [local simp] eqToIso_map
/--
Monoid objects in `C` are "just" lax monoidal functors from the trivial monoidal category to `C`.
-/
@[simps]
def equivLaxMonoidalFunctorPUnit : LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C ≌ Mon_ C where
functor := laxMonoidalToMon C
inverse := monToLaxMonoidal C
unitIso := unitIso C
counitIso := counitIso C
#align Mon_.equiv_lax_monoidal_functor_punit Mon_.equivLaxMonoidalFunctorPUnit
end Mon_
namespace Mon_
/-!
In this section, we prove that the category of monoids in a braided monoidal category is monoidal.
Given two monoids `M` and `N` in a braided monoidal category `C`,
the multiplication on the tensor product `M.X ⊗ N.X` is defined in the obvious way:
it is the tensor product of the multiplications on `M` and `N`,
except that the tensor factors in the source come in the wrong order,
which we fix by pre-composing with a permutation isomorphism constructed from the braiding.
(There is a subtlety here: in fact there are two ways to do these,
using either the positive or negative crossing.)
A more conceptual way of understanding this definition is the following:
The braiding on `C` gives rise to a monoidal structure on
the tensor product functor from `C × C` to `C`.
A pair of monoids in `C` gives rise to a monoid in `C × C`,
which the tensor product functor by being monoidal takes to a monoid in `C`.
The permutation isomorphism appearing in the definition of
the multiplication on the tensor product of two monoids is
an instance of a more general family of isomorphisms
which together form a strength that equips the tensor product functor with a monoidal structure,
and the monoid axioms for the tensor product follow from the monoid axioms for the tensor factors
plus the properties of the strength (i.e., monoidal functor axioms).
The strength `tensor_μ` of the tensor product functor has been defined in
`Mathlib.CategoryTheory.Monoidal.Braided`.
Its properties, stated as independent lemmas in that module,
are used extensively in the proofs below.
Notice that we could have followed the above plan not only conceptually
but also as a possible implementation and
could have constructed the tensor product of monoids via `mapMon`,
but we chose to give a more explicit definition directly in terms of `tensor_μ`.
To complete the definition of the monoidal category structure on the category of monoids,
we need to provide definitions of associator and unitors.
The obvious candidates are the associator and unitors from `C`,
but we need to prove that they are monoid morphisms, i.e., compatible with unit and multiplication.
These properties translate to the monoidality of the associator and unitors
(with respect to the monoidal structures on the functors they relate),
which have also been proved in `Mathlib.CategoryTheory.Monoidal.Braided`.
-/
variable {C}
-- The proofs that associators and unitors preserve monoid units don't require braiding.
theorem one_associator {M N P : Mon_ C} :
((λ_ (𝟙_ C)).inv ≫ ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) ⊗ P.one)) ≫ (α_ M.X N.X P.X).hom =
(λ_ (𝟙_ C)).inv ≫ (M.one ⊗ (λ_ (𝟙_ C)).inv ≫ (N.one ⊗ P.one)) := by
| simp only [Category.assoc, Iso.cancel_iso_inv_left] | theorem one_associator {M N P : Mon_ C} :
((λ_ (𝟙_ C)).inv ≫ ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) ⊗ P.one)) ≫ (α_ M.X N.X P.X).hom =
(λ_ (𝟙_ C)).inv ≫ (M.one ⊗ (λ_ (𝟙_ C)).inv ≫ (N.one ⊗ P.one)) := by
| Mathlib.CategoryTheory.Monoidal.Mon_.380_0.NTUMzhXPwXsmsYt | theorem one_associator {M N P : Mon_ C} :
((λ_ (𝟙_ C)).inv ≫ ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) ⊗ P.one)) ≫ (α_ M.X N.X P.X).hom =
(λ_ (𝟙_ C)).inv ≫ (M.one ⊗ (λ_ (𝟙_ C)).inv ≫ (N.one ⊗ P.one)) | Mathlib_CategoryTheory_Monoidal_Mon_ |
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : MonoidalCategory C
M N P : Mon_ C
⊢ ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) ⊗ P.one) ≫ (α_ M.X N.X P.X).hom = M.one ⊗ (λ_ (𝟙_ C)).inv ≫ (N.one ⊗ P.one) | /-
Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/
import Mathlib.CategoryTheory.Monoidal.Braided
import Mathlib.CategoryTheory.Monoidal.Discrete
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
import Mathlib.Algebra.PUnitInstances
#align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c"
/-!
# The category of monoids in a monoidal category.
We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to
the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if
`C` is braided, then the category of monoids is naturally monoidal.
-/
set_option linter.uppercaseLean3 false
universe v₁ v₂ u₁ u₂ u
open CategoryTheory MonoidalCategory
variable (C : Type u₁) [Category.{v₁} C] [MonoidalCategory.{v₁} C]
/-- A monoid object internal to a monoidal category.
When the monoidal category is preadditive, this is also sometimes called an "algebra object".
-/
structure Mon_ where
X : C
one : 𝟙_ C ⟶ X
mul : X ⊗ X ⟶ X
one_mul : (one ⊗ 𝟙 X) ≫ mul = (λ_ X).hom := by aesop_cat
mul_one : (𝟙 X ⊗ one) ≫ mul = (ρ_ X).hom := by aesop_cat
-- Obviously there is some flexibility stating this axiom.
-- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`,
-- and chooses to place the associator on the right-hand side.
-- The heuristic is that unitors and associators "don't have much weight".
mul_assoc : (mul ⊗ 𝟙 X) ≫ mul = (α_ X X X).hom ≫ (𝟙 X ⊗ mul) ≫ mul := by aesop_cat
#align Mon_ Mon_
attribute [reassoc] Mon_.one_mul Mon_.mul_one
-- We prove a more general `@[simp]` lemma below.
attribute [reassoc (attr := simp)] Mon_.mul_assoc
namespace Mon_
/-- The trivial monoid object. We later show this is initial in `Mon_ C`.
-/
@[simps]
def trivial : Mon_ C where
X := 𝟙_ C
one := 𝟙 _
mul := (λ_ _).hom
mul_assoc := by coherence
mul_one := by coherence
#align Mon_.trivial Mon_.trivial
instance : Inhabited (Mon_ C) :=
⟨trivial C⟩
variable {C}
variable {M : Mon_ C}
@[simp]
theorem one_mul_hom {Z : C} (f : Z ⟶ M.X) : (M.one ⊗ f) ≫ M.mul = (λ_ Z).hom ≫ f := by
rw [← id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality]
#align Mon_.one_mul_hom Mon_.one_mul_hom
@[simp]
theorem mul_one_hom {Z : C} (f : Z ⟶ M.X) : (f ⊗ M.one) ≫ M.mul = (ρ_ Z).hom ≫ f := by
rw [← tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality]
#align Mon_.mul_one_hom Mon_.mul_one_hom
theorem assoc_flip :
(𝟙 M.X ⊗ M.mul) ≫ M.mul = (α_ M.X M.X M.X).inv ≫ (M.mul ⊗ 𝟙 M.X) ≫ M.mul := by simp
#align Mon_.assoc_flip Mon_.assoc_flip
/-- A morphism of monoid objects. -/
@[ext]
structure Hom (M N : Mon_ C) where
hom : M.X ⟶ N.X
one_hom : M.one ≫ hom = N.one := by aesop_cat
mul_hom : M.mul ≫ hom = (hom ⊗ hom) ≫ N.mul := by aesop_cat
#align Mon_.hom Mon_.Hom
attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom
/-- The identity morphism on a monoid object. -/
@[simps]
def id (M : Mon_ C) : Hom M M where
hom := 𝟙 M.X
#align Mon_.id Mon_.id
instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) :=
⟨id M⟩
#align Mon_.hom_inhabited Mon_.homInhabited
/-- Composition of morphisms of monoid objects. -/
@[simps]
def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where
hom := f.hom ≫ g.hom
#align Mon_.comp Mon_.comp
instance : Category (Mon_ C) where
Hom M N := Hom M N
id := id
comp f g := comp f g
-- Porting note: added, as `Hom.ext` does not apply to a morphism.
@[ext]
lemma ext {X Y : Mon_ C} {f g : X ⟶ Y} (w : f.hom = g.hom) : f = g :=
Hom.ext _ _ w
@[simp]
theorem id_hom' (M : Mon_ C) : (𝟙 M : Hom M M).hom = 𝟙 M.X :=
rfl
#align Mon_.id_hom' Mon_.id_hom'
@[simp]
theorem comp_hom' {M N K : Mon_ C} (f : M ⟶ N) (g : N ⟶ K) :
(f ≫ g : Hom M K).hom = f.hom ≫ g.hom :=
rfl
#align Mon_.comp_hom' Mon_.comp_hom'
section
variable (C)
/-- The forgetful functor from monoid objects to the ambient category. -/
@[simps]
def forget : Mon_ C ⥤ C where
obj A := A.X
map f := f.hom
#align Mon_.forget Mon_.forget
end
instance forget_faithful : Faithful (@forget C _ _) where
#align Mon_.forget_faithful Mon_.forget_faithful
instance {A B : Mon_ C} (f : A ⟶ B) [e : IsIso ((forget C).map f)] : IsIso f.hom :=
e
/-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/
instance : ReflectsIsomorphisms (forget C) where
reflects f e :=
⟨⟨{ hom := inv f.hom
mul_hom := by
simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, ← tensor_comp_assoc,
IsIso.inv_hom_id, tensor_id, Category.id_comp] },
by aesop_cat⟩⟩
/-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X ≅ N.X) (one_f : M.one ≫ f.hom = N.one)
(mul_f : M.mul ≫ f.hom = (f.hom ⊗ f.hom) ≫ N.mul) : M ≅ N where
hom :=
{ hom := f.hom
one_hom := one_f
mul_hom := mul_f }
inv :=
{ hom := f.inv
one_hom := by rw [← one_f]; simp
mul_hom := by
rw [← cancel_mono f.hom]
slice_rhs 2 3 => rw [mul_f]
simp }
#align Mon_.iso_of_iso Mon_.isoOfIso
instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C ⟶ A) where
default :=
{ hom := A.one
one_hom := by dsimp; simp
mul_hom := by dsimp; simp [A.one_mul, unitors_equal] }
uniq f := by
ext; simp
rw [← Category.id_comp f.hom]
erw [f.one_hom]
#align Mon_.unique_hom_from_trivial Mon_.uniqueHomFromTrivial
open CategoryTheory.Limits
instance : HasInitial (Mon_ C) :=
hasInitial_of_unique (trivial C)
end Mon_
namespace CategoryTheory.LaxMonoidalFunctor
variable {C} {D : Type u₂} [Category.{v₂} D] [MonoidalCategory.{v₂} D]
-- TODO: mapMod F A : Mod A ⥤ Mod (F.mapMon A)
/-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one]
rw [F.toFunctor.map_id]
rw [F.right_unitality]
mul_assoc := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_assoc]
conv_lhs => rw [F.toFunctor.map_id]
conv_lhs => rw [F.toFunctor.map_comp, F.toFunctor.map_comp]
conv_rhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_rhs 3 4 => rw [F.μ_natural]
conv_rhs => rw [F.toFunctor.map_id]
slice_rhs 1 3 => rw [← F.associativity]
simp only [Category.assoc] }
map f :=
{ hom := F.map f.hom
one_hom := by dsimp; rw [Category.assoc, ← F.toFunctor.map_comp, f.one_hom]
mul_hom := by
dsimp
rw [Category.assoc, F.μ_natural_assoc, ← F.toFunctor.map_comp, ← F.toFunctor.map_comp,
f.mul_hom] }
map_id A := by ext; simp
map_comp f g := by ext; simp
#align category_theory.lax_monoidal_functor.map_Mon CategoryTheory.LaxMonoidalFunctor.mapMon
variable (C D)
/-- `mapMon` is functorial in the lax monoidal functor. -/
@[simps] -- Porting note: added this, not sure how it worked previously without.
def mapMonFunctor : LaxMonoidalFunctor C D ⥤ Mon_ C ⥤ Mon_ D where
obj := mapMon
map α := { app := fun A => { hom := α.app A.X } }
#align category_theory.lax_monoidal_functor.map_Mon_functor CategoryTheory.LaxMonoidalFunctor.mapMonFunctor
end CategoryTheory.LaxMonoidalFunctor
namespace Mon_
open CategoryTheory.LaxMonoidalFunctor
namespace EquivLaxMonoidalFunctorPUnit
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps]
def laxMonoidalToMon : LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C ⥤ Mon_ C where
obj F := (F.mapMon : Mon_ _ ⥤ Mon_ C).obj (trivial (Discrete PUnit))
map α := ((mapMonFunctor (Discrete PUnit) C).map α).app _
#align Mon_.equiv_lax_monoidal_functor_punit.lax_monoidal_to_Mon Mon_.EquivLaxMonoidalFunctorPUnit.laxMonoidalToMon
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps]
def monToLaxMonoidal : Mon_ C ⥤ LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C where
obj A :=
{ obj := fun _ => A.X
map := fun _ => 𝟙 _
ε := A.one
μ := fun _ _ => A.mul
map_id := fun _ => rfl
map_comp := fun _ _ => (Category.id_comp (𝟙 A.X)).symm }
map f :=
{ app := fun _ => f.hom
naturality := fun _ _ _ => by dsimp; rw [Category.id_comp, Category.comp_id]
unit := f.one_hom
tensor := fun _ _ => f.mul_hom }
#align Mon_.equiv_lax_monoidal_functor_punit.Mon_to_lax_monoidal Mon_.EquivLaxMonoidalFunctorPUnit.monToLaxMonoidal
attribute [local aesop safe tactic (rule_sets [CategoryTheory])]
CategoryTheory.Discrete.discreteCases
attribute [local simp] eqToIso_map
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps!]
def unitIso :
𝟭 (LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C) ≅ laxMonoidalToMon C ⋙ monToLaxMonoidal C :=
NatIso.ofComponents
(fun F =>
MonoidalNatIso.ofComponents (fun _ => F.toFunctor.mapIso (eqToIso (by ext))) (by aesop_cat)
(by aesop_cat) (by aesop_cat))
(by aesop_cat)
#align Mon_.equiv_lax_monoidal_functor_punit.unit_iso Mon_.EquivLaxMonoidalFunctorPUnit.unitIso
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps!]
def counitIso : monToLaxMonoidal C ⋙ laxMonoidalToMon C ≅ 𝟭 (Mon_ C) :=
NatIso.ofComponents
(fun F =>
{ hom := { hom := 𝟙 _ }
inv := { hom := 𝟙 _ } })
(by aesop_cat)
#align Mon_.equiv_lax_monoidal_functor_punit.counit_iso Mon_.EquivLaxMonoidalFunctorPUnit.counitIso
end EquivLaxMonoidalFunctorPUnit
open EquivLaxMonoidalFunctorPUnit
attribute [local simp] eqToIso_map
/--
Monoid objects in `C` are "just" lax monoidal functors from the trivial monoidal category to `C`.
-/
@[simps]
def equivLaxMonoidalFunctorPUnit : LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C ≌ Mon_ C where
functor := laxMonoidalToMon C
inverse := monToLaxMonoidal C
unitIso := unitIso C
counitIso := counitIso C
#align Mon_.equiv_lax_monoidal_functor_punit Mon_.equivLaxMonoidalFunctorPUnit
end Mon_
namespace Mon_
/-!
In this section, we prove that the category of monoids in a braided monoidal category is monoidal.
Given two monoids `M` and `N` in a braided monoidal category `C`,
the multiplication on the tensor product `M.X ⊗ N.X` is defined in the obvious way:
it is the tensor product of the multiplications on `M` and `N`,
except that the tensor factors in the source come in the wrong order,
which we fix by pre-composing with a permutation isomorphism constructed from the braiding.
(There is a subtlety here: in fact there are two ways to do these,
using either the positive or negative crossing.)
A more conceptual way of understanding this definition is the following:
The braiding on `C` gives rise to a monoidal structure on
the tensor product functor from `C × C` to `C`.
A pair of monoids in `C` gives rise to a monoid in `C × C`,
which the tensor product functor by being monoidal takes to a monoid in `C`.
The permutation isomorphism appearing in the definition of
the multiplication on the tensor product of two monoids is
an instance of a more general family of isomorphisms
which together form a strength that equips the tensor product functor with a monoidal structure,
and the monoid axioms for the tensor product follow from the monoid axioms for the tensor factors
plus the properties of the strength (i.e., monoidal functor axioms).
The strength `tensor_μ` of the tensor product functor has been defined in
`Mathlib.CategoryTheory.Monoidal.Braided`.
Its properties, stated as independent lemmas in that module,
are used extensively in the proofs below.
Notice that we could have followed the above plan not only conceptually
but also as a possible implementation and
could have constructed the tensor product of monoids via `mapMon`,
but we chose to give a more explicit definition directly in terms of `tensor_μ`.
To complete the definition of the monoidal category structure on the category of monoids,
we need to provide definitions of associator and unitors.
The obvious candidates are the associator and unitors from `C`,
but we need to prove that they are monoid morphisms, i.e., compatible with unit and multiplication.
These properties translate to the monoidality of the associator and unitors
(with respect to the monoidal structures on the functors they relate),
which have also been proved in `Mathlib.CategoryTheory.Monoidal.Braided`.
-/
variable {C}
-- The proofs that associators and unitors preserve monoid units don't require braiding.
theorem one_associator {M N P : Mon_ C} :
((λ_ (𝟙_ C)).inv ≫ ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) ⊗ P.one)) ≫ (α_ M.X N.X P.X).hom =
(λ_ (𝟙_ C)).inv ≫ (M.one ⊗ (λ_ (𝟙_ C)).inv ≫ (N.one ⊗ P.one)) := by
simp only [Category.assoc, Iso.cancel_iso_inv_left]
| slice_lhs 1 3 => rw [← Category.id_comp P.one, tensor_comp] | theorem one_associator {M N P : Mon_ C} :
((λ_ (𝟙_ C)).inv ≫ ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) ⊗ P.one)) ≫ (α_ M.X N.X P.X).hom =
(λ_ (𝟙_ C)).inv ≫ (M.one ⊗ (λ_ (𝟙_ C)).inv ≫ (N.one ⊗ P.one)) := by
simp only [Category.assoc, Iso.cancel_iso_inv_left]
| Mathlib.CategoryTheory.Monoidal.Mon_.380_0.NTUMzhXPwXsmsYt | theorem one_associator {M N P : Mon_ C} :
((λ_ (𝟙_ C)).inv ≫ ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) ⊗ P.one)) ≫ (α_ M.X N.X P.X).hom =
(λ_ (𝟙_ C)).inv ≫ (M.one ⊗ (λ_ (𝟙_ C)).inv ≫ (N.one ⊗ P.one)) | Mathlib_CategoryTheory_Monoidal_Mon_ |
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : MonoidalCategory C
M N P : Mon_ C
| ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) ⊗ P.one) ≫ (α_ M.X N.X P.X).hom | /-
Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/
import Mathlib.CategoryTheory.Monoidal.Braided
import Mathlib.CategoryTheory.Monoidal.Discrete
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
import Mathlib.Algebra.PUnitInstances
#align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c"
/-!
# The category of monoids in a monoidal category.
We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to
the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if
`C` is braided, then the category of monoids is naturally monoidal.
-/
set_option linter.uppercaseLean3 false
universe v₁ v₂ u₁ u₂ u
open CategoryTheory MonoidalCategory
variable (C : Type u₁) [Category.{v₁} C] [MonoidalCategory.{v₁} C]
/-- A monoid object internal to a monoidal category.
When the monoidal category is preadditive, this is also sometimes called an "algebra object".
-/
structure Mon_ where
X : C
one : 𝟙_ C ⟶ X
mul : X ⊗ X ⟶ X
one_mul : (one ⊗ 𝟙 X) ≫ mul = (λ_ X).hom := by aesop_cat
mul_one : (𝟙 X ⊗ one) ≫ mul = (ρ_ X).hom := by aesop_cat
-- Obviously there is some flexibility stating this axiom.
-- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`,
-- and chooses to place the associator on the right-hand side.
-- The heuristic is that unitors and associators "don't have much weight".
mul_assoc : (mul ⊗ 𝟙 X) ≫ mul = (α_ X X X).hom ≫ (𝟙 X ⊗ mul) ≫ mul := by aesop_cat
#align Mon_ Mon_
attribute [reassoc] Mon_.one_mul Mon_.mul_one
-- We prove a more general `@[simp]` lemma below.
attribute [reassoc (attr := simp)] Mon_.mul_assoc
namespace Mon_
/-- The trivial monoid object. We later show this is initial in `Mon_ C`.
-/
@[simps]
def trivial : Mon_ C where
X := 𝟙_ C
one := 𝟙 _
mul := (λ_ _).hom
mul_assoc := by coherence
mul_one := by coherence
#align Mon_.trivial Mon_.trivial
instance : Inhabited (Mon_ C) :=
⟨trivial C⟩
variable {C}
variable {M : Mon_ C}
@[simp]
theorem one_mul_hom {Z : C} (f : Z ⟶ M.X) : (M.one ⊗ f) ≫ M.mul = (λ_ Z).hom ≫ f := by
rw [← id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality]
#align Mon_.one_mul_hom Mon_.one_mul_hom
@[simp]
theorem mul_one_hom {Z : C} (f : Z ⟶ M.X) : (f ⊗ M.one) ≫ M.mul = (ρ_ Z).hom ≫ f := by
rw [← tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality]
#align Mon_.mul_one_hom Mon_.mul_one_hom
theorem assoc_flip :
(𝟙 M.X ⊗ M.mul) ≫ M.mul = (α_ M.X M.X M.X).inv ≫ (M.mul ⊗ 𝟙 M.X) ≫ M.mul := by simp
#align Mon_.assoc_flip Mon_.assoc_flip
/-- A morphism of monoid objects. -/
@[ext]
structure Hom (M N : Mon_ C) where
hom : M.X ⟶ N.X
one_hom : M.one ≫ hom = N.one := by aesop_cat
mul_hom : M.mul ≫ hom = (hom ⊗ hom) ≫ N.mul := by aesop_cat
#align Mon_.hom Mon_.Hom
attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom
/-- The identity morphism on a monoid object. -/
@[simps]
def id (M : Mon_ C) : Hom M M where
hom := 𝟙 M.X
#align Mon_.id Mon_.id
instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) :=
⟨id M⟩
#align Mon_.hom_inhabited Mon_.homInhabited
/-- Composition of morphisms of monoid objects. -/
@[simps]
def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where
hom := f.hom ≫ g.hom
#align Mon_.comp Mon_.comp
instance : Category (Mon_ C) where
Hom M N := Hom M N
id := id
comp f g := comp f g
-- Porting note: added, as `Hom.ext` does not apply to a morphism.
@[ext]
lemma ext {X Y : Mon_ C} {f g : X ⟶ Y} (w : f.hom = g.hom) : f = g :=
Hom.ext _ _ w
@[simp]
theorem id_hom' (M : Mon_ C) : (𝟙 M : Hom M M).hom = 𝟙 M.X :=
rfl
#align Mon_.id_hom' Mon_.id_hom'
@[simp]
theorem comp_hom' {M N K : Mon_ C} (f : M ⟶ N) (g : N ⟶ K) :
(f ≫ g : Hom M K).hom = f.hom ≫ g.hom :=
rfl
#align Mon_.comp_hom' Mon_.comp_hom'
section
variable (C)
/-- The forgetful functor from monoid objects to the ambient category. -/
@[simps]
def forget : Mon_ C ⥤ C where
obj A := A.X
map f := f.hom
#align Mon_.forget Mon_.forget
end
instance forget_faithful : Faithful (@forget C _ _) where
#align Mon_.forget_faithful Mon_.forget_faithful
instance {A B : Mon_ C} (f : A ⟶ B) [e : IsIso ((forget C).map f)] : IsIso f.hom :=
e
/-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/
instance : ReflectsIsomorphisms (forget C) where
reflects f e :=
⟨⟨{ hom := inv f.hom
mul_hom := by
simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, ← tensor_comp_assoc,
IsIso.inv_hom_id, tensor_id, Category.id_comp] },
by aesop_cat⟩⟩
/-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X ≅ N.X) (one_f : M.one ≫ f.hom = N.one)
(mul_f : M.mul ≫ f.hom = (f.hom ⊗ f.hom) ≫ N.mul) : M ≅ N where
hom :=
{ hom := f.hom
one_hom := one_f
mul_hom := mul_f }
inv :=
{ hom := f.inv
one_hom := by rw [← one_f]; simp
mul_hom := by
rw [← cancel_mono f.hom]
slice_rhs 2 3 => rw [mul_f]
simp }
#align Mon_.iso_of_iso Mon_.isoOfIso
instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C ⟶ A) where
default :=
{ hom := A.one
one_hom := by dsimp; simp
mul_hom := by dsimp; simp [A.one_mul, unitors_equal] }
uniq f := by
ext; simp
rw [← Category.id_comp f.hom]
erw [f.one_hom]
#align Mon_.unique_hom_from_trivial Mon_.uniqueHomFromTrivial
open CategoryTheory.Limits
instance : HasInitial (Mon_ C) :=
hasInitial_of_unique (trivial C)
end Mon_
namespace CategoryTheory.LaxMonoidalFunctor
variable {C} {D : Type u₂} [Category.{v₂} D] [MonoidalCategory.{v₂} D]
-- TODO: mapMod F A : Mod A ⥤ Mod (F.mapMon A)
/-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one]
rw [F.toFunctor.map_id]
rw [F.right_unitality]
mul_assoc := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_assoc]
conv_lhs => rw [F.toFunctor.map_id]
conv_lhs => rw [F.toFunctor.map_comp, F.toFunctor.map_comp]
conv_rhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_rhs 3 4 => rw [F.μ_natural]
conv_rhs => rw [F.toFunctor.map_id]
slice_rhs 1 3 => rw [← F.associativity]
simp only [Category.assoc] }
map f :=
{ hom := F.map f.hom
one_hom := by dsimp; rw [Category.assoc, ← F.toFunctor.map_comp, f.one_hom]
mul_hom := by
dsimp
rw [Category.assoc, F.μ_natural_assoc, ← F.toFunctor.map_comp, ← F.toFunctor.map_comp,
f.mul_hom] }
map_id A := by ext; simp
map_comp f g := by ext; simp
#align category_theory.lax_monoidal_functor.map_Mon CategoryTheory.LaxMonoidalFunctor.mapMon
variable (C D)
/-- `mapMon` is functorial in the lax monoidal functor. -/
@[simps] -- Porting note: added this, not sure how it worked previously without.
def mapMonFunctor : LaxMonoidalFunctor C D ⥤ Mon_ C ⥤ Mon_ D where
obj := mapMon
map α := { app := fun A => { hom := α.app A.X } }
#align category_theory.lax_monoidal_functor.map_Mon_functor CategoryTheory.LaxMonoidalFunctor.mapMonFunctor
end CategoryTheory.LaxMonoidalFunctor
namespace Mon_
open CategoryTheory.LaxMonoidalFunctor
namespace EquivLaxMonoidalFunctorPUnit
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps]
def laxMonoidalToMon : LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C ⥤ Mon_ C where
obj F := (F.mapMon : Mon_ _ ⥤ Mon_ C).obj (trivial (Discrete PUnit))
map α := ((mapMonFunctor (Discrete PUnit) C).map α).app _
#align Mon_.equiv_lax_monoidal_functor_punit.lax_monoidal_to_Mon Mon_.EquivLaxMonoidalFunctorPUnit.laxMonoidalToMon
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps]
def monToLaxMonoidal : Mon_ C ⥤ LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C where
obj A :=
{ obj := fun _ => A.X
map := fun _ => 𝟙 _
ε := A.one
μ := fun _ _ => A.mul
map_id := fun _ => rfl
map_comp := fun _ _ => (Category.id_comp (𝟙 A.X)).symm }
map f :=
{ app := fun _ => f.hom
naturality := fun _ _ _ => by dsimp; rw [Category.id_comp, Category.comp_id]
unit := f.one_hom
tensor := fun _ _ => f.mul_hom }
#align Mon_.equiv_lax_monoidal_functor_punit.Mon_to_lax_monoidal Mon_.EquivLaxMonoidalFunctorPUnit.monToLaxMonoidal
attribute [local aesop safe tactic (rule_sets [CategoryTheory])]
CategoryTheory.Discrete.discreteCases
attribute [local simp] eqToIso_map
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps!]
def unitIso :
𝟭 (LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C) ≅ laxMonoidalToMon C ⋙ monToLaxMonoidal C :=
NatIso.ofComponents
(fun F =>
MonoidalNatIso.ofComponents (fun _ => F.toFunctor.mapIso (eqToIso (by ext))) (by aesop_cat)
(by aesop_cat) (by aesop_cat))
(by aesop_cat)
#align Mon_.equiv_lax_monoidal_functor_punit.unit_iso Mon_.EquivLaxMonoidalFunctorPUnit.unitIso
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps!]
def counitIso : monToLaxMonoidal C ⋙ laxMonoidalToMon C ≅ 𝟭 (Mon_ C) :=
NatIso.ofComponents
(fun F =>
{ hom := { hom := 𝟙 _ }
inv := { hom := 𝟙 _ } })
(by aesop_cat)
#align Mon_.equiv_lax_monoidal_functor_punit.counit_iso Mon_.EquivLaxMonoidalFunctorPUnit.counitIso
end EquivLaxMonoidalFunctorPUnit
open EquivLaxMonoidalFunctorPUnit
attribute [local simp] eqToIso_map
/--
Monoid objects in `C` are "just" lax monoidal functors from the trivial monoidal category to `C`.
-/
@[simps]
def equivLaxMonoidalFunctorPUnit : LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C ≌ Mon_ C where
functor := laxMonoidalToMon C
inverse := monToLaxMonoidal C
unitIso := unitIso C
counitIso := counitIso C
#align Mon_.equiv_lax_monoidal_functor_punit Mon_.equivLaxMonoidalFunctorPUnit
end Mon_
namespace Mon_
/-!
In this section, we prove that the category of monoids in a braided monoidal category is monoidal.
Given two monoids `M` and `N` in a braided monoidal category `C`,
the multiplication on the tensor product `M.X ⊗ N.X` is defined in the obvious way:
it is the tensor product of the multiplications on `M` and `N`,
except that the tensor factors in the source come in the wrong order,
which we fix by pre-composing with a permutation isomorphism constructed from the braiding.
(There is a subtlety here: in fact there are two ways to do these,
using either the positive or negative crossing.)
A more conceptual way of understanding this definition is the following:
The braiding on `C` gives rise to a monoidal structure on
the tensor product functor from `C × C` to `C`.
A pair of monoids in `C` gives rise to a monoid in `C × C`,
which the tensor product functor by being monoidal takes to a monoid in `C`.
The permutation isomorphism appearing in the definition of
the multiplication on the tensor product of two monoids is
an instance of a more general family of isomorphisms
which together form a strength that equips the tensor product functor with a monoidal structure,
and the monoid axioms for the tensor product follow from the monoid axioms for the tensor factors
plus the properties of the strength (i.e., monoidal functor axioms).
The strength `tensor_μ` of the tensor product functor has been defined in
`Mathlib.CategoryTheory.Monoidal.Braided`.
Its properties, stated as independent lemmas in that module,
are used extensively in the proofs below.
Notice that we could have followed the above plan not only conceptually
but also as a possible implementation and
could have constructed the tensor product of monoids via `mapMon`,
but we chose to give a more explicit definition directly in terms of `tensor_μ`.
To complete the definition of the monoidal category structure on the category of monoids,
we need to provide definitions of associator and unitors.
The obvious candidates are the associator and unitors from `C`,
but we need to prove that they are monoid morphisms, i.e., compatible with unit and multiplication.
These properties translate to the monoidality of the associator and unitors
(with respect to the monoidal structures on the functors they relate),
which have also been proved in `Mathlib.CategoryTheory.Monoidal.Braided`.
-/
variable {C}
-- The proofs that associators and unitors preserve monoid units don't require braiding.
theorem one_associator {M N P : Mon_ C} :
((λ_ (𝟙_ C)).inv ≫ ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) ⊗ P.one)) ≫ (α_ M.X N.X P.X).hom =
(λ_ (𝟙_ C)).inv ≫ (M.one ⊗ (λ_ (𝟙_ C)).inv ≫ (N.one ⊗ P.one)) := by
simp only [Category.assoc, Iso.cancel_iso_inv_left]
slice_lhs 1 3 => | rw [← Category.id_comp P.one, tensor_comp] | theorem one_associator {M N P : Mon_ C} :
((λ_ (𝟙_ C)).inv ≫ ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) ⊗ P.one)) ≫ (α_ M.X N.X P.X).hom =
(λ_ (𝟙_ C)).inv ≫ (M.one ⊗ (λ_ (𝟙_ C)).inv ≫ (N.one ⊗ P.one)) := by
simp only [Category.assoc, Iso.cancel_iso_inv_left]
slice_lhs 1 3 => | Mathlib.CategoryTheory.Monoidal.Mon_.380_0.NTUMzhXPwXsmsYt | theorem one_associator {M N P : Mon_ C} :
((λ_ (𝟙_ C)).inv ≫ ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) ⊗ P.one)) ≫ (α_ M.X N.X P.X).hom =
(λ_ (𝟙_ C)).inv ≫ (M.one ⊗ (λ_ (𝟙_ C)).inv ≫ (N.one ⊗ P.one)) | Mathlib_CategoryTheory_Monoidal_Mon_ |
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : MonoidalCategory C
M N P : Mon_ C
| ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) ⊗ P.one) ≫ (α_ M.X N.X P.X).hom | /-
Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/
import Mathlib.CategoryTheory.Monoidal.Braided
import Mathlib.CategoryTheory.Monoidal.Discrete
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
import Mathlib.Algebra.PUnitInstances
#align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c"
/-!
# The category of monoids in a monoidal category.
We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to
the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if
`C` is braided, then the category of monoids is naturally monoidal.
-/
set_option linter.uppercaseLean3 false
universe v₁ v₂ u₁ u₂ u
open CategoryTheory MonoidalCategory
variable (C : Type u₁) [Category.{v₁} C] [MonoidalCategory.{v₁} C]
/-- A monoid object internal to a monoidal category.
When the monoidal category is preadditive, this is also sometimes called an "algebra object".
-/
structure Mon_ where
X : C
one : 𝟙_ C ⟶ X
mul : X ⊗ X ⟶ X
one_mul : (one ⊗ 𝟙 X) ≫ mul = (λ_ X).hom := by aesop_cat
mul_one : (𝟙 X ⊗ one) ≫ mul = (ρ_ X).hom := by aesop_cat
-- Obviously there is some flexibility stating this axiom.
-- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`,
-- and chooses to place the associator on the right-hand side.
-- The heuristic is that unitors and associators "don't have much weight".
mul_assoc : (mul ⊗ 𝟙 X) ≫ mul = (α_ X X X).hom ≫ (𝟙 X ⊗ mul) ≫ mul := by aesop_cat
#align Mon_ Mon_
attribute [reassoc] Mon_.one_mul Mon_.mul_one
-- We prove a more general `@[simp]` lemma below.
attribute [reassoc (attr := simp)] Mon_.mul_assoc
namespace Mon_
/-- The trivial monoid object. We later show this is initial in `Mon_ C`.
-/
@[simps]
def trivial : Mon_ C where
X := 𝟙_ C
one := 𝟙 _
mul := (λ_ _).hom
mul_assoc := by coherence
mul_one := by coherence
#align Mon_.trivial Mon_.trivial
instance : Inhabited (Mon_ C) :=
⟨trivial C⟩
variable {C}
variable {M : Mon_ C}
@[simp]
theorem one_mul_hom {Z : C} (f : Z ⟶ M.X) : (M.one ⊗ f) ≫ M.mul = (λ_ Z).hom ≫ f := by
rw [← id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality]
#align Mon_.one_mul_hom Mon_.one_mul_hom
@[simp]
theorem mul_one_hom {Z : C} (f : Z ⟶ M.X) : (f ⊗ M.one) ≫ M.mul = (ρ_ Z).hom ≫ f := by
rw [← tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality]
#align Mon_.mul_one_hom Mon_.mul_one_hom
theorem assoc_flip :
(𝟙 M.X ⊗ M.mul) ≫ M.mul = (α_ M.X M.X M.X).inv ≫ (M.mul ⊗ 𝟙 M.X) ≫ M.mul := by simp
#align Mon_.assoc_flip Mon_.assoc_flip
/-- A morphism of monoid objects. -/
@[ext]
structure Hom (M N : Mon_ C) where
hom : M.X ⟶ N.X
one_hom : M.one ≫ hom = N.one := by aesop_cat
mul_hom : M.mul ≫ hom = (hom ⊗ hom) ≫ N.mul := by aesop_cat
#align Mon_.hom Mon_.Hom
attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom
/-- The identity morphism on a monoid object. -/
@[simps]
def id (M : Mon_ C) : Hom M M where
hom := 𝟙 M.X
#align Mon_.id Mon_.id
instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) :=
⟨id M⟩
#align Mon_.hom_inhabited Mon_.homInhabited
/-- Composition of morphisms of monoid objects. -/
@[simps]
def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where
hom := f.hom ≫ g.hom
#align Mon_.comp Mon_.comp
instance : Category (Mon_ C) where
Hom M N := Hom M N
id := id
comp f g := comp f g
-- Porting note: added, as `Hom.ext` does not apply to a morphism.
@[ext]
lemma ext {X Y : Mon_ C} {f g : X ⟶ Y} (w : f.hom = g.hom) : f = g :=
Hom.ext _ _ w
@[simp]
theorem id_hom' (M : Mon_ C) : (𝟙 M : Hom M M).hom = 𝟙 M.X :=
rfl
#align Mon_.id_hom' Mon_.id_hom'
@[simp]
theorem comp_hom' {M N K : Mon_ C} (f : M ⟶ N) (g : N ⟶ K) :
(f ≫ g : Hom M K).hom = f.hom ≫ g.hom :=
rfl
#align Mon_.comp_hom' Mon_.comp_hom'
section
variable (C)
/-- The forgetful functor from monoid objects to the ambient category. -/
@[simps]
def forget : Mon_ C ⥤ C where
obj A := A.X
map f := f.hom
#align Mon_.forget Mon_.forget
end
instance forget_faithful : Faithful (@forget C _ _) where
#align Mon_.forget_faithful Mon_.forget_faithful
instance {A B : Mon_ C} (f : A ⟶ B) [e : IsIso ((forget C).map f)] : IsIso f.hom :=
e
/-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/
instance : ReflectsIsomorphisms (forget C) where
reflects f e :=
⟨⟨{ hom := inv f.hom
mul_hom := by
simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, ← tensor_comp_assoc,
IsIso.inv_hom_id, tensor_id, Category.id_comp] },
by aesop_cat⟩⟩
/-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X ≅ N.X) (one_f : M.one ≫ f.hom = N.one)
(mul_f : M.mul ≫ f.hom = (f.hom ⊗ f.hom) ≫ N.mul) : M ≅ N where
hom :=
{ hom := f.hom
one_hom := one_f
mul_hom := mul_f }
inv :=
{ hom := f.inv
one_hom := by rw [← one_f]; simp
mul_hom := by
rw [← cancel_mono f.hom]
slice_rhs 2 3 => rw [mul_f]
simp }
#align Mon_.iso_of_iso Mon_.isoOfIso
instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C ⟶ A) where
default :=
{ hom := A.one
one_hom := by dsimp; simp
mul_hom := by dsimp; simp [A.one_mul, unitors_equal] }
uniq f := by
ext; simp
rw [← Category.id_comp f.hom]
erw [f.one_hom]
#align Mon_.unique_hom_from_trivial Mon_.uniqueHomFromTrivial
open CategoryTheory.Limits
instance : HasInitial (Mon_ C) :=
hasInitial_of_unique (trivial C)
end Mon_
namespace CategoryTheory.LaxMonoidalFunctor
variable {C} {D : Type u₂} [Category.{v₂} D] [MonoidalCategory.{v₂} D]
-- TODO: mapMod F A : Mod A ⥤ Mod (F.mapMon A)
/-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one]
rw [F.toFunctor.map_id]
rw [F.right_unitality]
mul_assoc := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_assoc]
conv_lhs => rw [F.toFunctor.map_id]
conv_lhs => rw [F.toFunctor.map_comp, F.toFunctor.map_comp]
conv_rhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_rhs 3 4 => rw [F.μ_natural]
conv_rhs => rw [F.toFunctor.map_id]
slice_rhs 1 3 => rw [← F.associativity]
simp only [Category.assoc] }
map f :=
{ hom := F.map f.hom
one_hom := by dsimp; rw [Category.assoc, ← F.toFunctor.map_comp, f.one_hom]
mul_hom := by
dsimp
rw [Category.assoc, F.μ_natural_assoc, ← F.toFunctor.map_comp, ← F.toFunctor.map_comp,
f.mul_hom] }
map_id A := by ext; simp
map_comp f g := by ext; simp
#align category_theory.lax_monoidal_functor.map_Mon CategoryTheory.LaxMonoidalFunctor.mapMon
variable (C D)
/-- `mapMon` is functorial in the lax monoidal functor. -/
@[simps] -- Porting note: added this, not sure how it worked previously without.
def mapMonFunctor : LaxMonoidalFunctor C D ⥤ Mon_ C ⥤ Mon_ D where
obj := mapMon
map α := { app := fun A => { hom := α.app A.X } }
#align category_theory.lax_monoidal_functor.map_Mon_functor CategoryTheory.LaxMonoidalFunctor.mapMonFunctor
end CategoryTheory.LaxMonoidalFunctor
namespace Mon_
open CategoryTheory.LaxMonoidalFunctor
namespace EquivLaxMonoidalFunctorPUnit
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps]
def laxMonoidalToMon : LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C ⥤ Mon_ C where
obj F := (F.mapMon : Mon_ _ ⥤ Mon_ C).obj (trivial (Discrete PUnit))
map α := ((mapMonFunctor (Discrete PUnit) C).map α).app _
#align Mon_.equiv_lax_monoidal_functor_punit.lax_monoidal_to_Mon Mon_.EquivLaxMonoidalFunctorPUnit.laxMonoidalToMon
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps]
def monToLaxMonoidal : Mon_ C ⥤ LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C where
obj A :=
{ obj := fun _ => A.X
map := fun _ => 𝟙 _
ε := A.one
μ := fun _ _ => A.mul
map_id := fun _ => rfl
map_comp := fun _ _ => (Category.id_comp (𝟙 A.X)).symm }
map f :=
{ app := fun _ => f.hom
naturality := fun _ _ _ => by dsimp; rw [Category.id_comp, Category.comp_id]
unit := f.one_hom
tensor := fun _ _ => f.mul_hom }
#align Mon_.equiv_lax_monoidal_functor_punit.Mon_to_lax_monoidal Mon_.EquivLaxMonoidalFunctorPUnit.monToLaxMonoidal
attribute [local aesop safe tactic (rule_sets [CategoryTheory])]
CategoryTheory.Discrete.discreteCases
attribute [local simp] eqToIso_map
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps!]
def unitIso :
𝟭 (LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C) ≅ laxMonoidalToMon C ⋙ monToLaxMonoidal C :=
NatIso.ofComponents
(fun F =>
MonoidalNatIso.ofComponents (fun _ => F.toFunctor.mapIso (eqToIso (by ext))) (by aesop_cat)
(by aesop_cat) (by aesop_cat))
(by aesop_cat)
#align Mon_.equiv_lax_monoidal_functor_punit.unit_iso Mon_.EquivLaxMonoidalFunctorPUnit.unitIso
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps!]
def counitIso : monToLaxMonoidal C ⋙ laxMonoidalToMon C ≅ 𝟭 (Mon_ C) :=
NatIso.ofComponents
(fun F =>
{ hom := { hom := 𝟙 _ }
inv := { hom := 𝟙 _ } })
(by aesop_cat)
#align Mon_.equiv_lax_monoidal_functor_punit.counit_iso Mon_.EquivLaxMonoidalFunctorPUnit.counitIso
end EquivLaxMonoidalFunctorPUnit
open EquivLaxMonoidalFunctorPUnit
attribute [local simp] eqToIso_map
/--
Monoid objects in `C` are "just" lax monoidal functors from the trivial monoidal category to `C`.
-/
@[simps]
def equivLaxMonoidalFunctorPUnit : LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C ≌ Mon_ C where
functor := laxMonoidalToMon C
inverse := monToLaxMonoidal C
unitIso := unitIso C
counitIso := counitIso C
#align Mon_.equiv_lax_monoidal_functor_punit Mon_.equivLaxMonoidalFunctorPUnit
end Mon_
namespace Mon_
/-!
In this section, we prove that the category of monoids in a braided monoidal category is monoidal.
Given two monoids `M` and `N` in a braided monoidal category `C`,
the multiplication on the tensor product `M.X ⊗ N.X` is defined in the obvious way:
it is the tensor product of the multiplications on `M` and `N`,
except that the tensor factors in the source come in the wrong order,
which we fix by pre-composing with a permutation isomorphism constructed from the braiding.
(There is a subtlety here: in fact there are two ways to do these,
using either the positive or negative crossing.)
A more conceptual way of understanding this definition is the following:
The braiding on `C` gives rise to a monoidal structure on
the tensor product functor from `C × C` to `C`.
A pair of monoids in `C` gives rise to a monoid in `C × C`,
which the tensor product functor by being monoidal takes to a monoid in `C`.
The permutation isomorphism appearing in the definition of
the multiplication on the tensor product of two monoids is
an instance of a more general family of isomorphisms
which together form a strength that equips the tensor product functor with a monoidal structure,
and the monoid axioms for the tensor product follow from the monoid axioms for the tensor factors
plus the properties of the strength (i.e., monoidal functor axioms).
The strength `tensor_μ` of the tensor product functor has been defined in
`Mathlib.CategoryTheory.Monoidal.Braided`.
Its properties, stated as independent lemmas in that module,
are used extensively in the proofs below.
Notice that we could have followed the above plan not only conceptually
but also as a possible implementation and
could have constructed the tensor product of monoids via `mapMon`,
but we chose to give a more explicit definition directly in terms of `tensor_μ`.
To complete the definition of the monoidal category structure on the category of monoids,
we need to provide definitions of associator and unitors.
The obvious candidates are the associator and unitors from `C`,
but we need to prove that they are monoid morphisms, i.e., compatible with unit and multiplication.
These properties translate to the monoidality of the associator and unitors
(with respect to the monoidal structures on the functors they relate),
which have also been proved in `Mathlib.CategoryTheory.Monoidal.Braided`.
-/
variable {C}
-- The proofs that associators and unitors preserve monoid units don't require braiding.
theorem one_associator {M N P : Mon_ C} :
((λ_ (𝟙_ C)).inv ≫ ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) ⊗ P.one)) ≫ (α_ M.X N.X P.X).hom =
(λ_ (𝟙_ C)).inv ≫ (M.one ⊗ (λ_ (𝟙_ C)).inv ≫ (N.one ⊗ P.one)) := by
simp only [Category.assoc, Iso.cancel_iso_inv_left]
slice_lhs 1 3 => | rw [← Category.id_comp P.one, tensor_comp] | theorem one_associator {M N P : Mon_ C} :
((λ_ (𝟙_ C)).inv ≫ ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) ⊗ P.one)) ≫ (α_ M.X N.X P.X).hom =
(λ_ (𝟙_ C)).inv ≫ (M.one ⊗ (λ_ (𝟙_ C)).inv ≫ (N.one ⊗ P.one)) := by
simp only [Category.assoc, Iso.cancel_iso_inv_left]
slice_lhs 1 3 => | Mathlib.CategoryTheory.Monoidal.Mon_.380_0.NTUMzhXPwXsmsYt | theorem one_associator {M N P : Mon_ C} :
((λ_ (𝟙_ C)).inv ≫ ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) ⊗ P.one)) ≫ (α_ M.X N.X P.X).hom =
(λ_ (𝟙_ C)).inv ≫ (M.one ⊗ (λ_ (𝟙_ C)).inv ≫ (N.one ⊗ P.one)) | Mathlib_CategoryTheory_Monoidal_Mon_ |
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : MonoidalCategory C
M N P : Mon_ C
| ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) ⊗ P.one) ≫ (α_ M.X N.X P.X).hom | /-
Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/
import Mathlib.CategoryTheory.Monoidal.Braided
import Mathlib.CategoryTheory.Monoidal.Discrete
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
import Mathlib.Algebra.PUnitInstances
#align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c"
/-!
# The category of monoids in a monoidal category.
We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to
the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if
`C` is braided, then the category of monoids is naturally monoidal.
-/
set_option linter.uppercaseLean3 false
universe v₁ v₂ u₁ u₂ u
open CategoryTheory MonoidalCategory
variable (C : Type u₁) [Category.{v₁} C] [MonoidalCategory.{v₁} C]
/-- A monoid object internal to a monoidal category.
When the monoidal category is preadditive, this is also sometimes called an "algebra object".
-/
structure Mon_ where
X : C
one : 𝟙_ C ⟶ X
mul : X ⊗ X ⟶ X
one_mul : (one ⊗ 𝟙 X) ≫ mul = (λ_ X).hom := by aesop_cat
mul_one : (𝟙 X ⊗ one) ≫ mul = (ρ_ X).hom := by aesop_cat
-- Obviously there is some flexibility stating this axiom.
-- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`,
-- and chooses to place the associator on the right-hand side.
-- The heuristic is that unitors and associators "don't have much weight".
mul_assoc : (mul ⊗ 𝟙 X) ≫ mul = (α_ X X X).hom ≫ (𝟙 X ⊗ mul) ≫ mul := by aesop_cat
#align Mon_ Mon_
attribute [reassoc] Mon_.one_mul Mon_.mul_one
-- We prove a more general `@[simp]` lemma below.
attribute [reassoc (attr := simp)] Mon_.mul_assoc
namespace Mon_
/-- The trivial monoid object. We later show this is initial in `Mon_ C`.
-/
@[simps]
def trivial : Mon_ C where
X := 𝟙_ C
one := 𝟙 _
mul := (λ_ _).hom
mul_assoc := by coherence
mul_one := by coherence
#align Mon_.trivial Mon_.trivial
instance : Inhabited (Mon_ C) :=
⟨trivial C⟩
variable {C}
variable {M : Mon_ C}
@[simp]
theorem one_mul_hom {Z : C} (f : Z ⟶ M.X) : (M.one ⊗ f) ≫ M.mul = (λ_ Z).hom ≫ f := by
rw [← id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality]
#align Mon_.one_mul_hom Mon_.one_mul_hom
@[simp]
theorem mul_one_hom {Z : C} (f : Z ⟶ M.X) : (f ⊗ M.one) ≫ M.mul = (ρ_ Z).hom ≫ f := by
rw [← tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality]
#align Mon_.mul_one_hom Mon_.mul_one_hom
theorem assoc_flip :
(𝟙 M.X ⊗ M.mul) ≫ M.mul = (α_ M.X M.X M.X).inv ≫ (M.mul ⊗ 𝟙 M.X) ≫ M.mul := by simp
#align Mon_.assoc_flip Mon_.assoc_flip
/-- A morphism of monoid objects. -/
@[ext]
structure Hom (M N : Mon_ C) where
hom : M.X ⟶ N.X
one_hom : M.one ≫ hom = N.one := by aesop_cat
mul_hom : M.mul ≫ hom = (hom ⊗ hom) ≫ N.mul := by aesop_cat
#align Mon_.hom Mon_.Hom
attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom
/-- The identity morphism on a monoid object. -/
@[simps]
def id (M : Mon_ C) : Hom M M where
hom := 𝟙 M.X
#align Mon_.id Mon_.id
instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) :=
⟨id M⟩
#align Mon_.hom_inhabited Mon_.homInhabited
/-- Composition of morphisms of monoid objects. -/
@[simps]
def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where
hom := f.hom ≫ g.hom
#align Mon_.comp Mon_.comp
instance : Category (Mon_ C) where
Hom M N := Hom M N
id := id
comp f g := comp f g
-- Porting note: added, as `Hom.ext` does not apply to a morphism.
@[ext]
lemma ext {X Y : Mon_ C} {f g : X ⟶ Y} (w : f.hom = g.hom) : f = g :=
Hom.ext _ _ w
@[simp]
theorem id_hom' (M : Mon_ C) : (𝟙 M : Hom M M).hom = 𝟙 M.X :=
rfl
#align Mon_.id_hom' Mon_.id_hom'
@[simp]
theorem comp_hom' {M N K : Mon_ C} (f : M ⟶ N) (g : N ⟶ K) :
(f ≫ g : Hom M K).hom = f.hom ≫ g.hom :=
rfl
#align Mon_.comp_hom' Mon_.comp_hom'
section
variable (C)
/-- The forgetful functor from monoid objects to the ambient category. -/
@[simps]
def forget : Mon_ C ⥤ C where
obj A := A.X
map f := f.hom
#align Mon_.forget Mon_.forget
end
instance forget_faithful : Faithful (@forget C _ _) where
#align Mon_.forget_faithful Mon_.forget_faithful
instance {A B : Mon_ C} (f : A ⟶ B) [e : IsIso ((forget C).map f)] : IsIso f.hom :=
e
/-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/
instance : ReflectsIsomorphisms (forget C) where
reflects f e :=
⟨⟨{ hom := inv f.hom
mul_hom := by
simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, ← tensor_comp_assoc,
IsIso.inv_hom_id, tensor_id, Category.id_comp] },
by aesop_cat⟩⟩
/-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X ≅ N.X) (one_f : M.one ≫ f.hom = N.one)
(mul_f : M.mul ≫ f.hom = (f.hom ⊗ f.hom) ≫ N.mul) : M ≅ N where
hom :=
{ hom := f.hom
one_hom := one_f
mul_hom := mul_f }
inv :=
{ hom := f.inv
one_hom := by rw [← one_f]; simp
mul_hom := by
rw [← cancel_mono f.hom]
slice_rhs 2 3 => rw [mul_f]
simp }
#align Mon_.iso_of_iso Mon_.isoOfIso
instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C ⟶ A) where
default :=
{ hom := A.one
one_hom := by dsimp; simp
mul_hom := by dsimp; simp [A.one_mul, unitors_equal] }
uniq f := by
ext; simp
rw [← Category.id_comp f.hom]
erw [f.one_hom]
#align Mon_.unique_hom_from_trivial Mon_.uniqueHomFromTrivial
open CategoryTheory.Limits
instance : HasInitial (Mon_ C) :=
hasInitial_of_unique (trivial C)
end Mon_
namespace CategoryTheory.LaxMonoidalFunctor
variable {C} {D : Type u₂} [Category.{v₂} D] [MonoidalCategory.{v₂} D]
-- TODO: mapMod F A : Mod A ⥤ Mod (F.mapMon A)
/-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one]
rw [F.toFunctor.map_id]
rw [F.right_unitality]
mul_assoc := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_assoc]
conv_lhs => rw [F.toFunctor.map_id]
conv_lhs => rw [F.toFunctor.map_comp, F.toFunctor.map_comp]
conv_rhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_rhs 3 4 => rw [F.μ_natural]
conv_rhs => rw [F.toFunctor.map_id]
slice_rhs 1 3 => rw [← F.associativity]
simp only [Category.assoc] }
map f :=
{ hom := F.map f.hom
one_hom := by dsimp; rw [Category.assoc, ← F.toFunctor.map_comp, f.one_hom]
mul_hom := by
dsimp
rw [Category.assoc, F.μ_natural_assoc, ← F.toFunctor.map_comp, ← F.toFunctor.map_comp,
f.mul_hom] }
map_id A := by ext; simp
map_comp f g := by ext; simp
#align category_theory.lax_monoidal_functor.map_Mon CategoryTheory.LaxMonoidalFunctor.mapMon
variable (C D)
/-- `mapMon` is functorial in the lax monoidal functor. -/
@[simps] -- Porting note: added this, not sure how it worked previously without.
def mapMonFunctor : LaxMonoidalFunctor C D ⥤ Mon_ C ⥤ Mon_ D where
obj := mapMon
map α := { app := fun A => { hom := α.app A.X } }
#align category_theory.lax_monoidal_functor.map_Mon_functor CategoryTheory.LaxMonoidalFunctor.mapMonFunctor
end CategoryTheory.LaxMonoidalFunctor
namespace Mon_
open CategoryTheory.LaxMonoidalFunctor
namespace EquivLaxMonoidalFunctorPUnit
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps]
def laxMonoidalToMon : LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C ⥤ Mon_ C where
obj F := (F.mapMon : Mon_ _ ⥤ Mon_ C).obj (trivial (Discrete PUnit))
map α := ((mapMonFunctor (Discrete PUnit) C).map α).app _
#align Mon_.equiv_lax_monoidal_functor_punit.lax_monoidal_to_Mon Mon_.EquivLaxMonoidalFunctorPUnit.laxMonoidalToMon
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps]
def monToLaxMonoidal : Mon_ C ⥤ LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C where
obj A :=
{ obj := fun _ => A.X
map := fun _ => 𝟙 _
ε := A.one
μ := fun _ _ => A.mul
map_id := fun _ => rfl
map_comp := fun _ _ => (Category.id_comp (𝟙 A.X)).symm }
map f :=
{ app := fun _ => f.hom
naturality := fun _ _ _ => by dsimp; rw [Category.id_comp, Category.comp_id]
unit := f.one_hom
tensor := fun _ _ => f.mul_hom }
#align Mon_.equiv_lax_monoidal_functor_punit.Mon_to_lax_monoidal Mon_.EquivLaxMonoidalFunctorPUnit.monToLaxMonoidal
attribute [local aesop safe tactic (rule_sets [CategoryTheory])]
CategoryTheory.Discrete.discreteCases
attribute [local simp] eqToIso_map
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps!]
def unitIso :
𝟭 (LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C) ≅ laxMonoidalToMon C ⋙ monToLaxMonoidal C :=
NatIso.ofComponents
(fun F =>
MonoidalNatIso.ofComponents (fun _ => F.toFunctor.mapIso (eqToIso (by ext))) (by aesop_cat)
(by aesop_cat) (by aesop_cat))
(by aesop_cat)
#align Mon_.equiv_lax_monoidal_functor_punit.unit_iso Mon_.EquivLaxMonoidalFunctorPUnit.unitIso
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps!]
def counitIso : monToLaxMonoidal C ⋙ laxMonoidalToMon C ≅ 𝟭 (Mon_ C) :=
NatIso.ofComponents
(fun F =>
{ hom := { hom := 𝟙 _ }
inv := { hom := 𝟙 _ } })
(by aesop_cat)
#align Mon_.equiv_lax_monoidal_functor_punit.counit_iso Mon_.EquivLaxMonoidalFunctorPUnit.counitIso
end EquivLaxMonoidalFunctorPUnit
open EquivLaxMonoidalFunctorPUnit
attribute [local simp] eqToIso_map
/--
Monoid objects in `C` are "just" lax monoidal functors from the trivial monoidal category to `C`.
-/
@[simps]
def equivLaxMonoidalFunctorPUnit : LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C ≌ Mon_ C where
functor := laxMonoidalToMon C
inverse := monToLaxMonoidal C
unitIso := unitIso C
counitIso := counitIso C
#align Mon_.equiv_lax_monoidal_functor_punit Mon_.equivLaxMonoidalFunctorPUnit
end Mon_
namespace Mon_
/-!
In this section, we prove that the category of monoids in a braided monoidal category is monoidal.
Given two monoids `M` and `N` in a braided monoidal category `C`,
the multiplication on the tensor product `M.X ⊗ N.X` is defined in the obvious way:
it is the tensor product of the multiplications on `M` and `N`,
except that the tensor factors in the source come in the wrong order,
which we fix by pre-composing with a permutation isomorphism constructed from the braiding.
(There is a subtlety here: in fact there are two ways to do these,
using either the positive or negative crossing.)
A more conceptual way of understanding this definition is the following:
The braiding on `C` gives rise to a monoidal structure on
the tensor product functor from `C × C` to `C`.
A pair of monoids in `C` gives rise to a monoid in `C × C`,
which the tensor product functor by being monoidal takes to a monoid in `C`.
The permutation isomorphism appearing in the definition of
the multiplication on the tensor product of two monoids is
an instance of a more general family of isomorphisms
which together form a strength that equips the tensor product functor with a monoidal structure,
and the monoid axioms for the tensor product follow from the monoid axioms for the tensor factors
plus the properties of the strength (i.e., monoidal functor axioms).
The strength `tensor_μ` of the tensor product functor has been defined in
`Mathlib.CategoryTheory.Monoidal.Braided`.
Its properties, stated as independent lemmas in that module,
are used extensively in the proofs below.
Notice that we could have followed the above plan not only conceptually
but also as a possible implementation and
could have constructed the tensor product of monoids via `mapMon`,
but we chose to give a more explicit definition directly in terms of `tensor_μ`.
To complete the definition of the monoidal category structure on the category of monoids,
we need to provide definitions of associator and unitors.
The obvious candidates are the associator and unitors from `C`,
but we need to prove that they are monoid morphisms, i.e., compatible with unit and multiplication.
These properties translate to the monoidality of the associator and unitors
(with respect to the monoidal structures on the functors they relate),
which have also been proved in `Mathlib.CategoryTheory.Monoidal.Braided`.
-/
variable {C}
-- The proofs that associators and unitors preserve monoid units don't require braiding.
theorem one_associator {M N P : Mon_ C} :
((λ_ (𝟙_ C)).inv ≫ ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) ⊗ P.one)) ≫ (α_ M.X N.X P.X).hom =
(λ_ (𝟙_ C)).inv ≫ (M.one ⊗ (λ_ (𝟙_ C)).inv ≫ (N.one ⊗ P.one)) := by
simp only [Category.assoc, Iso.cancel_iso_inv_left]
slice_lhs 1 3 => | rw [← Category.id_comp P.one, tensor_comp] | theorem one_associator {M N P : Mon_ C} :
((λ_ (𝟙_ C)).inv ≫ ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) ⊗ P.one)) ≫ (α_ M.X N.X P.X).hom =
(λ_ (𝟙_ C)).inv ≫ (M.one ⊗ (λ_ (𝟙_ C)).inv ≫ (N.one ⊗ P.one)) := by
simp only [Category.assoc, Iso.cancel_iso_inv_left]
slice_lhs 1 3 => | Mathlib.CategoryTheory.Monoidal.Mon_.380_0.NTUMzhXPwXsmsYt | theorem one_associator {M N P : Mon_ C} :
((λ_ (𝟙_ C)).inv ≫ ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) ⊗ P.one)) ≫ (α_ M.X N.X P.X).hom =
(λ_ (𝟙_ C)).inv ≫ (M.one ⊗ (λ_ (𝟙_ C)).inv ≫ (N.one ⊗ P.one)) | Mathlib_CategoryTheory_Monoidal_Mon_ |
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : MonoidalCategory C
M N P : Mon_ C
⊢ (((λ_ (𝟙_ C)).inv ⊗ 𝟙 (𝟙_ C)) ≫ ((M.one ⊗ N.one) ⊗ P.one)) ≫ (α_ M.X N.X P.X).hom =
M.one ⊗ (λ_ (𝟙_ C)).inv ≫ (N.one ⊗ P.one) | /-
Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/
import Mathlib.CategoryTheory.Monoidal.Braided
import Mathlib.CategoryTheory.Monoidal.Discrete
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
import Mathlib.Algebra.PUnitInstances
#align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c"
/-!
# The category of monoids in a monoidal category.
We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to
the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if
`C` is braided, then the category of monoids is naturally monoidal.
-/
set_option linter.uppercaseLean3 false
universe v₁ v₂ u₁ u₂ u
open CategoryTheory MonoidalCategory
variable (C : Type u₁) [Category.{v₁} C] [MonoidalCategory.{v₁} C]
/-- A monoid object internal to a monoidal category.
When the monoidal category is preadditive, this is also sometimes called an "algebra object".
-/
structure Mon_ where
X : C
one : 𝟙_ C ⟶ X
mul : X ⊗ X ⟶ X
one_mul : (one ⊗ 𝟙 X) ≫ mul = (λ_ X).hom := by aesop_cat
mul_one : (𝟙 X ⊗ one) ≫ mul = (ρ_ X).hom := by aesop_cat
-- Obviously there is some flexibility stating this axiom.
-- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`,
-- and chooses to place the associator on the right-hand side.
-- The heuristic is that unitors and associators "don't have much weight".
mul_assoc : (mul ⊗ 𝟙 X) ≫ mul = (α_ X X X).hom ≫ (𝟙 X ⊗ mul) ≫ mul := by aesop_cat
#align Mon_ Mon_
attribute [reassoc] Mon_.one_mul Mon_.mul_one
-- We prove a more general `@[simp]` lemma below.
attribute [reassoc (attr := simp)] Mon_.mul_assoc
namespace Mon_
/-- The trivial monoid object. We later show this is initial in `Mon_ C`.
-/
@[simps]
def trivial : Mon_ C where
X := 𝟙_ C
one := 𝟙 _
mul := (λ_ _).hom
mul_assoc := by coherence
mul_one := by coherence
#align Mon_.trivial Mon_.trivial
instance : Inhabited (Mon_ C) :=
⟨trivial C⟩
variable {C}
variable {M : Mon_ C}
@[simp]
theorem one_mul_hom {Z : C} (f : Z ⟶ M.X) : (M.one ⊗ f) ≫ M.mul = (λ_ Z).hom ≫ f := by
rw [← id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality]
#align Mon_.one_mul_hom Mon_.one_mul_hom
@[simp]
theorem mul_one_hom {Z : C} (f : Z ⟶ M.X) : (f ⊗ M.one) ≫ M.mul = (ρ_ Z).hom ≫ f := by
rw [← tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality]
#align Mon_.mul_one_hom Mon_.mul_one_hom
theorem assoc_flip :
(𝟙 M.X ⊗ M.mul) ≫ M.mul = (α_ M.X M.X M.X).inv ≫ (M.mul ⊗ 𝟙 M.X) ≫ M.mul := by simp
#align Mon_.assoc_flip Mon_.assoc_flip
/-- A morphism of monoid objects. -/
@[ext]
structure Hom (M N : Mon_ C) where
hom : M.X ⟶ N.X
one_hom : M.one ≫ hom = N.one := by aesop_cat
mul_hom : M.mul ≫ hom = (hom ⊗ hom) ≫ N.mul := by aesop_cat
#align Mon_.hom Mon_.Hom
attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom
/-- The identity morphism on a monoid object. -/
@[simps]
def id (M : Mon_ C) : Hom M M where
hom := 𝟙 M.X
#align Mon_.id Mon_.id
instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) :=
⟨id M⟩
#align Mon_.hom_inhabited Mon_.homInhabited
/-- Composition of morphisms of monoid objects. -/
@[simps]
def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where
hom := f.hom ≫ g.hom
#align Mon_.comp Mon_.comp
instance : Category (Mon_ C) where
Hom M N := Hom M N
id := id
comp f g := comp f g
-- Porting note: added, as `Hom.ext` does not apply to a morphism.
@[ext]
lemma ext {X Y : Mon_ C} {f g : X ⟶ Y} (w : f.hom = g.hom) : f = g :=
Hom.ext _ _ w
@[simp]
theorem id_hom' (M : Mon_ C) : (𝟙 M : Hom M M).hom = 𝟙 M.X :=
rfl
#align Mon_.id_hom' Mon_.id_hom'
@[simp]
theorem comp_hom' {M N K : Mon_ C} (f : M ⟶ N) (g : N ⟶ K) :
(f ≫ g : Hom M K).hom = f.hom ≫ g.hom :=
rfl
#align Mon_.comp_hom' Mon_.comp_hom'
section
variable (C)
/-- The forgetful functor from monoid objects to the ambient category. -/
@[simps]
def forget : Mon_ C ⥤ C where
obj A := A.X
map f := f.hom
#align Mon_.forget Mon_.forget
end
instance forget_faithful : Faithful (@forget C _ _) where
#align Mon_.forget_faithful Mon_.forget_faithful
instance {A B : Mon_ C} (f : A ⟶ B) [e : IsIso ((forget C).map f)] : IsIso f.hom :=
e
/-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/
instance : ReflectsIsomorphisms (forget C) where
reflects f e :=
⟨⟨{ hom := inv f.hom
mul_hom := by
simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, ← tensor_comp_assoc,
IsIso.inv_hom_id, tensor_id, Category.id_comp] },
by aesop_cat⟩⟩
/-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X ≅ N.X) (one_f : M.one ≫ f.hom = N.one)
(mul_f : M.mul ≫ f.hom = (f.hom ⊗ f.hom) ≫ N.mul) : M ≅ N where
hom :=
{ hom := f.hom
one_hom := one_f
mul_hom := mul_f }
inv :=
{ hom := f.inv
one_hom := by rw [← one_f]; simp
mul_hom := by
rw [← cancel_mono f.hom]
slice_rhs 2 3 => rw [mul_f]
simp }
#align Mon_.iso_of_iso Mon_.isoOfIso
instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C ⟶ A) where
default :=
{ hom := A.one
one_hom := by dsimp; simp
mul_hom := by dsimp; simp [A.one_mul, unitors_equal] }
uniq f := by
ext; simp
rw [← Category.id_comp f.hom]
erw [f.one_hom]
#align Mon_.unique_hom_from_trivial Mon_.uniqueHomFromTrivial
open CategoryTheory.Limits
instance : HasInitial (Mon_ C) :=
hasInitial_of_unique (trivial C)
end Mon_
namespace CategoryTheory.LaxMonoidalFunctor
variable {C} {D : Type u₂} [Category.{v₂} D] [MonoidalCategory.{v₂} D]
-- TODO: mapMod F A : Mod A ⥤ Mod (F.mapMon A)
/-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one]
rw [F.toFunctor.map_id]
rw [F.right_unitality]
mul_assoc := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_assoc]
conv_lhs => rw [F.toFunctor.map_id]
conv_lhs => rw [F.toFunctor.map_comp, F.toFunctor.map_comp]
conv_rhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_rhs 3 4 => rw [F.μ_natural]
conv_rhs => rw [F.toFunctor.map_id]
slice_rhs 1 3 => rw [← F.associativity]
simp only [Category.assoc] }
map f :=
{ hom := F.map f.hom
one_hom := by dsimp; rw [Category.assoc, ← F.toFunctor.map_comp, f.one_hom]
mul_hom := by
dsimp
rw [Category.assoc, F.μ_natural_assoc, ← F.toFunctor.map_comp, ← F.toFunctor.map_comp,
f.mul_hom] }
map_id A := by ext; simp
map_comp f g := by ext; simp
#align category_theory.lax_monoidal_functor.map_Mon CategoryTheory.LaxMonoidalFunctor.mapMon
variable (C D)
/-- `mapMon` is functorial in the lax monoidal functor. -/
@[simps] -- Porting note: added this, not sure how it worked previously without.
def mapMonFunctor : LaxMonoidalFunctor C D ⥤ Mon_ C ⥤ Mon_ D where
obj := mapMon
map α := { app := fun A => { hom := α.app A.X } }
#align category_theory.lax_monoidal_functor.map_Mon_functor CategoryTheory.LaxMonoidalFunctor.mapMonFunctor
end CategoryTheory.LaxMonoidalFunctor
namespace Mon_
open CategoryTheory.LaxMonoidalFunctor
namespace EquivLaxMonoidalFunctorPUnit
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps]
def laxMonoidalToMon : LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C ⥤ Mon_ C where
obj F := (F.mapMon : Mon_ _ ⥤ Mon_ C).obj (trivial (Discrete PUnit))
map α := ((mapMonFunctor (Discrete PUnit) C).map α).app _
#align Mon_.equiv_lax_monoidal_functor_punit.lax_monoidal_to_Mon Mon_.EquivLaxMonoidalFunctorPUnit.laxMonoidalToMon
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps]
def monToLaxMonoidal : Mon_ C ⥤ LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C where
obj A :=
{ obj := fun _ => A.X
map := fun _ => 𝟙 _
ε := A.one
μ := fun _ _ => A.mul
map_id := fun _ => rfl
map_comp := fun _ _ => (Category.id_comp (𝟙 A.X)).symm }
map f :=
{ app := fun _ => f.hom
naturality := fun _ _ _ => by dsimp; rw [Category.id_comp, Category.comp_id]
unit := f.one_hom
tensor := fun _ _ => f.mul_hom }
#align Mon_.equiv_lax_monoidal_functor_punit.Mon_to_lax_monoidal Mon_.EquivLaxMonoidalFunctorPUnit.monToLaxMonoidal
attribute [local aesop safe tactic (rule_sets [CategoryTheory])]
CategoryTheory.Discrete.discreteCases
attribute [local simp] eqToIso_map
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps!]
def unitIso :
𝟭 (LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C) ≅ laxMonoidalToMon C ⋙ monToLaxMonoidal C :=
NatIso.ofComponents
(fun F =>
MonoidalNatIso.ofComponents (fun _ => F.toFunctor.mapIso (eqToIso (by ext))) (by aesop_cat)
(by aesop_cat) (by aesop_cat))
(by aesop_cat)
#align Mon_.equiv_lax_monoidal_functor_punit.unit_iso Mon_.EquivLaxMonoidalFunctorPUnit.unitIso
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps!]
def counitIso : monToLaxMonoidal C ⋙ laxMonoidalToMon C ≅ 𝟭 (Mon_ C) :=
NatIso.ofComponents
(fun F =>
{ hom := { hom := 𝟙 _ }
inv := { hom := 𝟙 _ } })
(by aesop_cat)
#align Mon_.equiv_lax_monoidal_functor_punit.counit_iso Mon_.EquivLaxMonoidalFunctorPUnit.counitIso
end EquivLaxMonoidalFunctorPUnit
open EquivLaxMonoidalFunctorPUnit
attribute [local simp] eqToIso_map
/--
Monoid objects in `C` are "just" lax monoidal functors from the trivial monoidal category to `C`.
-/
@[simps]
def equivLaxMonoidalFunctorPUnit : LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C ≌ Mon_ C where
functor := laxMonoidalToMon C
inverse := monToLaxMonoidal C
unitIso := unitIso C
counitIso := counitIso C
#align Mon_.equiv_lax_monoidal_functor_punit Mon_.equivLaxMonoidalFunctorPUnit
end Mon_
namespace Mon_
/-!
In this section, we prove that the category of monoids in a braided monoidal category is monoidal.
Given two monoids `M` and `N` in a braided monoidal category `C`,
the multiplication on the tensor product `M.X ⊗ N.X` is defined in the obvious way:
it is the tensor product of the multiplications on `M` and `N`,
except that the tensor factors in the source come in the wrong order,
which we fix by pre-composing with a permutation isomorphism constructed from the braiding.
(There is a subtlety here: in fact there are two ways to do these,
using either the positive or negative crossing.)
A more conceptual way of understanding this definition is the following:
The braiding on `C` gives rise to a monoidal structure on
the tensor product functor from `C × C` to `C`.
A pair of monoids in `C` gives rise to a monoid in `C × C`,
which the tensor product functor by being monoidal takes to a monoid in `C`.
The permutation isomorphism appearing in the definition of
the multiplication on the tensor product of two monoids is
an instance of a more general family of isomorphisms
which together form a strength that equips the tensor product functor with a monoidal structure,
and the monoid axioms for the tensor product follow from the monoid axioms for the tensor factors
plus the properties of the strength (i.e., monoidal functor axioms).
The strength `tensor_μ` of the tensor product functor has been defined in
`Mathlib.CategoryTheory.Monoidal.Braided`.
Its properties, stated as independent lemmas in that module,
are used extensively in the proofs below.
Notice that we could have followed the above plan not only conceptually
but also as a possible implementation and
could have constructed the tensor product of monoids via `mapMon`,
but we chose to give a more explicit definition directly in terms of `tensor_μ`.
To complete the definition of the monoidal category structure on the category of monoids,
we need to provide definitions of associator and unitors.
The obvious candidates are the associator and unitors from `C`,
but we need to prove that they are monoid morphisms, i.e., compatible with unit and multiplication.
These properties translate to the monoidality of the associator and unitors
(with respect to the monoidal structures on the functors they relate),
which have also been proved in `Mathlib.CategoryTheory.Monoidal.Braided`.
-/
variable {C}
-- The proofs that associators and unitors preserve monoid units don't require braiding.
theorem one_associator {M N P : Mon_ C} :
((λ_ (𝟙_ C)).inv ≫ ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) ⊗ P.one)) ≫ (α_ M.X N.X P.X).hom =
(λ_ (𝟙_ C)).inv ≫ (M.one ⊗ (λ_ (𝟙_ C)).inv ≫ (N.one ⊗ P.one)) := by
simp only [Category.assoc, Iso.cancel_iso_inv_left]
slice_lhs 1 3 => rw [← Category.id_comp P.one, tensor_comp]
| slice_lhs 2 3 => rw [associator_naturality] | theorem one_associator {M N P : Mon_ C} :
((λ_ (𝟙_ C)).inv ≫ ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) ⊗ P.one)) ≫ (α_ M.X N.X P.X).hom =
(λ_ (𝟙_ C)).inv ≫ (M.one ⊗ (λ_ (𝟙_ C)).inv ≫ (N.one ⊗ P.one)) := by
simp only [Category.assoc, Iso.cancel_iso_inv_left]
slice_lhs 1 3 => rw [← Category.id_comp P.one, tensor_comp]
| Mathlib.CategoryTheory.Monoidal.Mon_.380_0.NTUMzhXPwXsmsYt | theorem one_associator {M N P : Mon_ C} :
((λ_ (𝟙_ C)).inv ≫ ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) ⊗ P.one)) ≫ (α_ M.X N.X P.X).hom =
(λ_ (𝟙_ C)).inv ≫ (M.one ⊗ (λ_ (𝟙_ C)).inv ≫ (N.one ⊗ P.one)) | Mathlib_CategoryTheory_Monoidal_Mon_ |
case a
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : MonoidalCategory C
M N P : Mon_ C
| ((M.one ⊗ N.one) ⊗ P.one) ≫ (α_ M.X N.X P.X).hom
case a C : Type u₁ inst✝¹ : Category.{v₁, u₁} C inst✝ : MonoidalCategory C M N P : Mon_ C | (λ_ (𝟙_ C)).inv ⊗ 𝟙 (𝟙_ C) | /-
Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/
import Mathlib.CategoryTheory.Monoidal.Braided
import Mathlib.CategoryTheory.Monoidal.Discrete
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
import Mathlib.Algebra.PUnitInstances
#align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c"
/-!
# The category of monoids in a monoidal category.
We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to
the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if
`C` is braided, then the category of monoids is naturally monoidal.
-/
set_option linter.uppercaseLean3 false
universe v₁ v₂ u₁ u₂ u
open CategoryTheory MonoidalCategory
variable (C : Type u₁) [Category.{v₁} C] [MonoidalCategory.{v₁} C]
/-- A monoid object internal to a monoidal category.
When the monoidal category is preadditive, this is also sometimes called an "algebra object".
-/
structure Mon_ where
X : C
one : 𝟙_ C ⟶ X
mul : X ⊗ X ⟶ X
one_mul : (one ⊗ 𝟙 X) ≫ mul = (λ_ X).hom := by aesop_cat
mul_one : (𝟙 X ⊗ one) ≫ mul = (ρ_ X).hom := by aesop_cat
-- Obviously there is some flexibility stating this axiom.
-- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`,
-- and chooses to place the associator on the right-hand side.
-- The heuristic is that unitors and associators "don't have much weight".
mul_assoc : (mul ⊗ 𝟙 X) ≫ mul = (α_ X X X).hom ≫ (𝟙 X ⊗ mul) ≫ mul := by aesop_cat
#align Mon_ Mon_
attribute [reassoc] Mon_.one_mul Mon_.mul_one
-- We prove a more general `@[simp]` lemma below.
attribute [reassoc (attr := simp)] Mon_.mul_assoc
namespace Mon_
/-- The trivial monoid object. We later show this is initial in `Mon_ C`.
-/
@[simps]
def trivial : Mon_ C where
X := 𝟙_ C
one := 𝟙 _
mul := (λ_ _).hom
mul_assoc := by coherence
mul_one := by coherence
#align Mon_.trivial Mon_.trivial
instance : Inhabited (Mon_ C) :=
⟨trivial C⟩
variable {C}
variable {M : Mon_ C}
@[simp]
theorem one_mul_hom {Z : C} (f : Z ⟶ M.X) : (M.one ⊗ f) ≫ M.mul = (λ_ Z).hom ≫ f := by
rw [← id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality]
#align Mon_.one_mul_hom Mon_.one_mul_hom
@[simp]
theorem mul_one_hom {Z : C} (f : Z ⟶ M.X) : (f ⊗ M.one) ≫ M.mul = (ρ_ Z).hom ≫ f := by
rw [← tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality]
#align Mon_.mul_one_hom Mon_.mul_one_hom
theorem assoc_flip :
(𝟙 M.X ⊗ M.mul) ≫ M.mul = (α_ M.X M.X M.X).inv ≫ (M.mul ⊗ 𝟙 M.X) ≫ M.mul := by simp
#align Mon_.assoc_flip Mon_.assoc_flip
/-- A morphism of monoid objects. -/
@[ext]
structure Hom (M N : Mon_ C) where
hom : M.X ⟶ N.X
one_hom : M.one ≫ hom = N.one := by aesop_cat
mul_hom : M.mul ≫ hom = (hom ⊗ hom) ≫ N.mul := by aesop_cat
#align Mon_.hom Mon_.Hom
attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom
/-- The identity morphism on a monoid object. -/
@[simps]
def id (M : Mon_ C) : Hom M M where
hom := 𝟙 M.X
#align Mon_.id Mon_.id
instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) :=
⟨id M⟩
#align Mon_.hom_inhabited Mon_.homInhabited
/-- Composition of morphisms of monoid objects. -/
@[simps]
def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where
hom := f.hom ≫ g.hom
#align Mon_.comp Mon_.comp
instance : Category (Mon_ C) where
Hom M N := Hom M N
id := id
comp f g := comp f g
-- Porting note: added, as `Hom.ext` does not apply to a morphism.
@[ext]
lemma ext {X Y : Mon_ C} {f g : X ⟶ Y} (w : f.hom = g.hom) : f = g :=
Hom.ext _ _ w
@[simp]
theorem id_hom' (M : Mon_ C) : (𝟙 M : Hom M M).hom = 𝟙 M.X :=
rfl
#align Mon_.id_hom' Mon_.id_hom'
@[simp]
theorem comp_hom' {M N K : Mon_ C} (f : M ⟶ N) (g : N ⟶ K) :
(f ≫ g : Hom M K).hom = f.hom ≫ g.hom :=
rfl
#align Mon_.comp_hom' Mon_.comp_hom'
section
variable (C)
/-- The forgetful functor from monoid objects to the ambient category. -/
@[simps]
def forget : Mon_ C ⥤ C where
obj A := A.X
map f := f.hom
#align Mon_.forget Mon_.forget
end
instance forget_faithful : Faithful (@forget C _ _) where
#align Mon_.forget_faithful Mon_.forget_faithful
instance {A B : Mon_ C} (f : A ⟶ B) [e : IsIso ((forget C).map f)] : IsIso f.hom :=
e
/-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/
instance : ReflectsIsomorphisms (forget C) where
reflects f e :=
⟨⟨{ hom := inv f.hom
mul_hom := by
simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, ← tensor_comp_assoc,
IsIso.inv_hom_id, tensor_id, Category.id_comp] },
by aesop_cat⟩⟩
/-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X ≅ N.X) (one_f : M.one ≫ f.hom = N.one)
(mul_f : M.mul ≫ f.hom = (f.hom ⊗ f.hom) ≫ N.mul) : M ≅ N where
hom :=
{ hom := f.hom
one_hom := one_f
mul_hom := mul_f }
inv :=
{ hom := f.inv
one_hom := by rw [← one_f]; simp
mul_hom := by
rw [← cancel_mono f.hom]
slice_rhs 2 3 => rw [mul_f]
simp }
#align Mon_.iso_of_iso Mon_.isoOfIso
instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C ⟶ A) where
default :=
{ hom := A.one
one_hom := by dsimp; simp
mul_hom := by dsimp; simp [A.one_mul, unitors_equal] }
uniq f := by
ext; simp
rw [← Category.id_comp f.hom]
erw [f.one_hom]
#align Mon_.unique_hom_from_trivial Mon_.uniqueHomFromTrivial
open CategoryTheory.Limits
instance : HasInitial (Mon_ C) :=
hasInitial_of_unique (trivial C)
end Mon_
namespace CategoryTheory.LaxMonoidalFunctor
variable {C} {D : Type u₂} [Category.{v₂} D] [MonoidalCategory.{v₂} D]
-- TODO: mapMod F A : Mod A ⥤ Mod (F.mapMon A)
/-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one]
rw [F.toFunctor.map_id]
rw [F.right_unitality]
mul_assoc := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_assoc]
conv_lhs => rw [F.toFunctor.map_id]
conv_lhs => rw [F.toFunctor.map_comp, F.toFunctor.map_comp]
conv_rhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_rhs 3 4 => rw [F.μ_natural]
conv_rhs => rw [F.toFunctor.map_id]
slice_rhs 1 3 => rw [← F.associativity]
simp only [Category.assoc] }
map f :=
{ hom := F.map f.hom
one_hom := by dsimp; rw [Category.assoc, ← F.toFunctor.map_comp, f.one_hom]
mul_hom := by
dsimp
rw [Category.assoc, F.μ_natural_assoc, ← F.toFunctor.map_comp, ← F.toFunctor.map_comp,
f.mul_hom] }
map_id A := by ext; simp
map_comp f g := by ext; simp
#align category_theory.lax_monoidal_functor.map_Mon CategoryTheory.LaxMonoidalFunctor.mapMon
variable (C D)
/-- `mapMon` is functorial in the lax monoidal functor. -/
@[simps] -- Porting note: added this, not sure how it worked previously without.
def mapMonFunctor : LaxMonoidalFunctor C D ⥤ Mon_ C ⥤ Mon_ D where
obj := mapMon
map α := { app := fun A => { hom := α.app A.X } }
#align category_theory.lax_monoidal_functor.map_Mon_functor CategoryTheory.LaxMonoidalFunctor.mapMonFunctor
end CategoryTheory.LaxMonoidalFunctor
namespace Mon_
open CategoryTheory.LaxMonoidalFunctor
namespace EquivLaxMonoidalFunctorPUnit
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps]
def laxMonoidalToMon : LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C ⥤ Mon_ C where
obj F := (F.mapMon : Mon_ _ ⥤ Mon_ C).obj (trivial (Discrete PUnit))
map α := ((mapMonFunctor (Discrete PUnit) C).map α).app _
#align Mon_.equiv_lax_monoidal_functor_punit.lax_monoidal_to_Mon Mon_.EquivLaxMonoidalFunctorPUnit.laxMonoidalToMon
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps]
def monToLaxMonoidal : Mon_ C ⥤ LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C where
obj A :=
{ obj := fun _ => A.X
map := fun _ => 𝟙 _
ε := A.one
μ := fun _ _ => A.mul
map_id := fun _ => rfl
map_comp := fun _ _ => (Category.id_comp (𝟙 A.X)).symm }
map f :=
{ app := fun _ => f.hom
naturality := fun _ _ _ => by dsimp; rw [Category.id_comp, Category.comp_id]
unit := f.one_hom
tensor := fun _ _ => f.mul_hom }
#align Mon_.equiv_lax_monoidal_functor_punit.Mon_to_lax_monoidal Mon_.EquivLaxMonoidalFunctorPUnit.monToLaxMonoidal
attribute [local aesop safe tactic (rule_sets [CategoryTheory])]
CategoryTheory.Discrete.discreteCases
attribute [local simp] eqToIso_map
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps!]
def unitIso :
𝟭 (LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C) ≅ laxMonoidalToMon C ⋙ monToLaxMonoidal C :=
NatIso.ofComponents
(fun F =>
MonoidalNatIso.ofComponents (fun _ => F.toFunctor.mapIso (eqToIso (by ext))) (by aesop_cat)
(by aesop_cat) (by aesop_cat))
(by aesop_cat)
#align Mon_.equiv_lax_monoidal_functor_punit.unit_iso Mon_.EquivLaxMonoidalFunctorPUnit.unitIso
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps!]
def counitIso : monToLaxMonoidal C ⋙ laxMonoidalToMon C ≅ 𝟭 (Mon_ C) :=
NatIso.ofComponents
(fun F =>
{ hom := { hom := 𝟙 _ }
inv := { hom := 𝟙 _ } })
(by aesop_cat)
#align Mon_.equiv_lax_monoidal_functor_punit.counit_iso Mon_.EquivLaxMonoidalFunctorPUnit.counitIso
end EquivLaxMonoidalFunctorPUnit
open EquivLaxMonoidalFunctorPUnit
attribute [local simp] eqToIso_map
/--
Monoid objects in `C` are "just" lax monoidal functors from the trivial monoidal category to `C`.
-/
@[simps]
def equivLaxMonoidalFunctorPUnit : LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C ≌ Mon_ C where
functor := laxMonoidalToMon C
inverse := monToLaxMonoidal C
unitIso := unitIso C
counitIso := counitIso C
#align Mon_.equiv_lax_monoidal_functor_punit Mon_.equivLaxMonoidalFunctorPUnit
end Mon_
namespace Mon_
/-!
In this section, we prove that the category of monoids in a braided monoidal category is monoidal.
Given two monoids `M` and `N` in a braided monoidal category `C`,
the multiplication on the tensor product `M.X ⊗ N.X` is defined in the obvious way:
it is the tensor product of the multiplications on `M` and `N`,
except that the tensor factors in the source come in the wrong order,
which we fix by pre-composing with a permutation isomorphism constructed from the braiding.
(There is a subtlety here: in fact there are two ways to do these,
using either the positive or negative crossing.)
A more conceptual way of understanding this definition is the following:
The braiding on `C` gives rise to a monoidal structure on
the tensor product functor from `C × C` to `C`.
A pair of monoids in `C` gives rise to a monoid in `C × C`,
which the tensor product functor by being monoidal takes to a monoid in `C`.
The permutation isomorphism appearing in the definition of
the multiplication on the tensor product of two monoids is
an instance of a more general family of isomorphisms
which together form a strength that equips the tensor product functor with a monoidal structure,
and the monoid axioms for the tensor product follow from the monoid axioms for the tensor factors
plus the properties of the strength (i.e., monoidal functor axioms).
The strength `tensor_μ` of the tensor product functor has been defined in
`Mathlib.CategoryTheory.Monoidal.Braided`.
Its properties, stated as independent lemmas in that module,
are used extensively in the proofs below.
Notice that we could have followed the above plan not only conceptually
but also as a possible implementation and
could have constructed the tensor product of monoids via `mapMon`,
but we chose to give a more explicit definition directly in terms of `tensor_μ`.
To complete the definition of the monoidal category structure on the category of monoids,
we need to provide definitions of associator and unitors.
The obvious candidates are the associator and unitors from `C`,
but we need to prove that they are monoid morphisms, i.e., compatible with unit and multiplication.
These properties translate to the monoidality of the associator and unitors
(with respect to the monoidal structures on the functors they relate),
which have also been proved in `Mathlib.CategoryTheory.Monoidal.Braided`.
-/
variable {C}
-- The proofs that associators and unitors preserve monoid units don't require braiding.
theorem one_associator {M N P : Mon_ C} :
((λ_ (𝟙_ C)).inv ≫ ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) ⊗ P.one)) ≫ (α_ M.X N.X P.X).hom =
(λ_ (𝟙_ C)).inv ≫ (M.one ⊗ (λ_ (𝟙_ C)).inv ≫ (N.one ⊗ P.one)) := by
simp only [Category.assoc, Iso.cancel_iso_inv_left]
slice_lhs 1 3 => rw [← Category.id_comp P.one, tensor_comp]
slice_lhs 2 3 => | rw [associator_naturality] | theorem one_associator {M N P : Mon_ C} :
((λ_ (𝟙_ C)).inv ≫ ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) ⊗ P.one)) ≫ (α_ M.X N.X P.X).hom =
(λ_ (𝟙_ C)).inv ≫ (M.one ⊗ (λ_ (𝟙_ C)).inv ≫ (N.one ⊗ P.one)) := by
simp only [Category.assoc, Iso.cancel_iso_inv_left]
slice_lhs 1 3 => rw [← Category.id_comp P.one, tensor_comp]
slice_lhs 2 3 => | Mathlib.CategoryTheory.Monoidal.Mon_.380_0.NTUMzhXPwXsmsYt | theorem one_associator {M N P : Mon_ C} :
((λ_ (𝟙_ C)).inv ≫ ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) ⊗ P.one)) ≫ (α_ M.X N.X P.X).hom =
(λ_ (𝟙_ C)).inv ≫ (M.one ⊗ (λ_ (𝟙_ C)).inv ≫ (N.one ⊗ P.one)) | Mathlib_CategoryTheory_Monoidal_Mon_ |
case a
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : MonoidalCategory C
M N P : Mon_ C
| ((M.one ⊗ N.one) ⊗ P.one) ≫ (α_ M.X N.X P.X).hom
case a C : Type u₁ inst✝¹ : Category.{v₁, u₁} C inst✝ : MonoidalCategory C M N P : Mon_ C | (λ_ (𝟙_ C)).inv ⊗ 𝟙 (𝟙_ C) | /-
Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/
import Mathlib.CategoryTheory.Monoidal.Braided
import Mathlib.CategoryTheory.Monoidal.Discrete
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
import Mathlib.Algebra.PUnitInstances
#align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c"
/-!
# The category of monoids in a monoidal category.
We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to
the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if
`C` is braided, then the category of monoids is naturally monoidal.
-/
set_option linter.uppercaseLean3 false
universe v₁ v₂ u₁ u₂ u
open CategoryTheory MonoidalCategory
variable (C : Type u₁) [Category.{v₁} C] [MonoidalCategory.{v₁} C]
/-- A monoid object internal to a monoidal category.
When the monoidal category is preadditive, this is also sometimes called an "algebra object".
-/
structure Mon_ where
X : C
one : 𝟙_ C ⟶ X
mul : X ⊗ X ⟶ X
one_mul : (one ⊗ 𝟙 X) ≫ mul = (λ_ X).hom := by aesop_cat
mul_one : (𝟙 X ⊗ one) ≫ mul = (ρ_ X).hom := by aesop_cat
-- Obviously there is some flexibility stating this axiom.
-- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`,
-- and chooses to place the associator on the right-hand side.
-- The heuristic is that unitors and associators "don't have much weight".
mul_assoc : (mul ⊗ 𝟙 X) ≫ mul = (α_ X X X).hom ≫ (𝟙 X ⊗ mul) ≫ mul := by aesop_cat
#align Mon_ Mon_
attribute [reassoc] Mon_.one_mul Mon_.mul_one
-- We prove a more general `@[simp]` lemma below.
attribute [reassoc (attr := simp)] Mon_.mul_assoc
namespace Mon_
/-- The trivial monoid object. We later show this is initial in `Mon_ C`.
-/
@[simps]
def trivial : Mon_ C where
X := 𝟙_ C
one := 𝟙 _
mul := (λ_ _).hom
mul_assoc := by coherence
mul_one := by coherence
#align Mon_.trivial Mon_.trivial
instance : Inhabited (Mon_ C) :=
⟨trivial C⟩
variable {C}
variable {M : Mon_ C}
@[simp]
theorem one_mul_hom {Z : C} (f : Z ⟶ M.X) : (M.one ⊗ f) ≫ M.mul = (λ_ Z).hom ≫ f := by
rw [← id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality]
#align Mon_.one_mul_hom Mon_.one_mul_hom
@[simp]
theorem mul_one_hom {Z : C} (f : Z ⟶ M.X) : (f ⊗ M.one) ≫ M.mul = (ρ_ Z).hom ≫ f := by
rw [← tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality]
#align Mon_.mul_one_hom Mon_.mul_one_hom
theorem assoc_flip :
(𝟙 M.X ⊗ M.mul) ≫ M.mul = (α_ M.X M.X M.X).inv ≫ (M.mul ⊗ 𝟙 M.X) ≫ M.mul := by simp
#align Mon_.assoc_flip Mon_.assoc_flip
/-- A morphism of monoid objects. -/
@[ext]
structure Hom (M N : Mon_ C) where
hom : M.X ⟶ N.X
one_hom : M.one ≫ hom = N.one := by aesop_cat
mul_hom : M.mul ≫ hom = (hom ⊗ hom) ≫ N.mul := by aesop_cat
#align Mon_.hom Mon_.Hom
attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom
/-- The identity morphism on a monoid object. -/
@[simps]
def id (M : Mon_ C) : Hom M M where
hom := 𝟙 M.X
#align Mon_.id Mon_.id
instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) :=
⟨id M⟩
#align Mon_.hom_inhabited Mon_.homInhabited
/-- Composition of morphisms of monoid objects. -/
@[simps]
def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where
hom := f.hom ≫ g.hom
#align Mon_.comp Mon_.comp
instance : Category (Mon_ C) where
Hom M N := Hom M N
id := id
comp f g := comp f g
-- Porting note: added, as `Hom.ext` does not apply to a morphism.
@[ext]
lemma ext {X Y : Mon_ C} {f g : X ⟶ Y} (w : f.hom = g.hom) : f = g :=
Hom.ext _ _ w
@[simp]
theorem id_hom' (M : Mon_ C) : (𝟙 M : Hom M M).hom = 𝟙 M.X :=
rfl
#align Mon_.id_hom' Mon_.id_hom'
@[simp]
theorem comp_hom' {M N K : Mon_ C} (f : M ⟶ N) (g : N ⟶ K) :
(f ≫ g : Hom M K).hom = f.hom ≫ g.hom :=
rfl
#align Mon_.comp_hom' Mon_.comp_hom'
section
variable (C)
/-- The forgetful functor from monoid objects to the ambient category. -/
@[simps]
def forget : Mon_ C ⥤ C where
obj A := A.X
map f := f.hom
#align Mon_.forget Mon_.forget
end
instance forget_faithful : Faithful (@forget C _ _) where
#align Mon_.forget_faithful Mon_.forget_faithful
instance {A B : Mon_ C} (f : A ⟶ B) [e : IsIso ((forget C).map f)] : IsIso f.hom :=
e
/-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/
instance : ReflectsIsomorphisms (forget C) where
reflects f e :=
⟨⟨{ hom := inv f.hom
mul_hom := by
simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, ← tensor_comp_assoc,
IsIso.inv_hom_id, tensor_id, Category.id_comp] },
by aesop_cat⟩⟩
/-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X ≅ N.X) (one_f : M.one ≫ f.hom = N.one)
(mul_f : M.mul ≫ f.hom = (f.hom ⊗ f.hom) ≫ N.mul) : M ≅ N where
hom :=
{ hom := f.hom
one_hom := one_f
mul_hom := mul_f }
inv :=
{ hom := f.inv
one_hom := by rw [← one_f]; simp
mul_hom := by
rw [← cancel_mono f.hom]
slice_rhs 2 3 => rw [mul_f]
simp }
#align Mon_.iso_of_iso Mon_.isoOfIso
instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C ⟶ A) where
default :=
{ hom := A.one
one_hom := by dsimp; simp
mul_hom := by dsimp; simp [A.one_mul, unitors_equal] }
uniq f := by
ext; simp
rw [← Category.id_comp f.hom]
erw [f.one_hom]
#align Mon_.unique_hom_from_trivial Mon_.uniqueHomFromTrivial
open CategoryTheory.Limits
instance : HasInitial (Mon_ C) :=
hasInitial_of_unique (trivial C)
end Mon_
namespace CategoryTheory.LaxMonoidalFunctor
variable {C} {D : Type u₂} [Category.{v₂} D] [MonoidalCategory.{v₂} D]
-- TODO: mapMod F A : Mod A ⥤ Mod (F.mapMon A)
/-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one]
rw [F.toFunctor.map_id]
rw [F.right_unitality]
mul_assoc := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_assoc]
conv_lhs => rw [F.toFunctor.map_id]
conv_lhs => rw [F.toFunctor.map_comp, F.toFunctor.map_comp]
conv_rhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_rhs 3 4 => rw [F.μ_natural]
conv_rhs => rw [F.toFunctor.map_id]
slice_rhs 1 3 => rw [← F.associativity]
simp only [Category.assoc] }
map f :=
{ hom := F.map f.hom
one_hom := by dsimp; rw [Category.assoc, ← F.toFunctor.map_comp, f.one_hom]
mul_hom := by
dsimp
rw [Category.assoc, F.μ_natural_assoc, ← F.toFunctor.map_comp, ← F.toFunctor.map_comp,
f.mul_hom] }
map_id A := by ext; simp
map_comp f g := by ext; simp
#align category_theory.lax_monoidal_functor.map_Mon CategoryTheory.LaxMonoidalFunctor.mapMon
variable (C D)
/-- `mapMon` is functorial in the lax monoidal functor. -/
@[simps] -- Porting note: added this, not sure how it worked previously without.
def mapMonFunctor : LaxMonoidalFunctor C D ⥤ Mon_ C ⥤ Mon_ D where
obj := mapMon
map α := { app := fun A => { hom := α.app A.X } }
#align category_theory.lax_monoidal_functor.map_Mon_functor CategoryTheory.LaxMonoidalFunctor.mapMonFunctor
end CategoryTheory.LaxMonoidalFunctor
namespace Mon_
open CategoryTheory.LaxMonoidalFunctor
namespace EquivLaxMonoidalFunctorPUnit
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps]
def laxMonoidalToMon : LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C ⥤ Mon_ C where
obj F := (F.mapMon : Mon_ _ ⥤ Mon_ C).obj (trivial (Discrete PUnit))
map α := ((mapMonFunctor (Discrete PUnit) C).map α).app _
#align Mon_.equiv_lax_monoidal_functor_punit.lax_monoidal_to_Mon Mon_.EquivLaxMonoidalFunctorPUnit.laxMonoidalToMon
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps]
def monToLaxMonoidal : Mon_ C ⥤ LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C where
obj A :=
{ obj := fun _ => A.X
map := fun _ => 𝟙 _
ε := A.one
μ := fun _ _ => A.mul
map_id := fun _ => rfl
map_comp := fun _ _ => (Category.id_comp (𝟙 A.X)).symm }
map f :=
{ app := fun _ => f.hom
naturality := fun _ _ _ => by dsimp; rw [Category.id_comp, Category.comp_id]
unit := f.one_hom
tensor := fun _ _ => f.mul_hom }
#align Mon_.equiv_lax_monoidal_functor_punit.Mon_to_lax_monoidal Mon_.EquivLaxMonoidalFunctorPUnit.monToLaxMonoidal
attribute [local aesop safe tactic (rule_sets [CategoryTheory])]
CategoryTheory.Discrete.discreteCases
attribute [local simp] eqToIso_map
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps!]
def unitIso :
𝟭 (LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C) ≅ laxMonoidalToMon C ⋙ monToLaxMonoidal C :=
NatIso.ofComponents
(fun F =>
MonoidalNatIso.ofComponents (fun _ => F.toFunctor.mapIso (eqToIso (by ext))) (by aesop_cat)
(by aesop_cat) (by aesop_cat))
(by aesop_cat)
#align Mon_.equiv_lax_monoidal_functor_punit.unit_iso Mon_.EquivLaxMonoidalFunctorPUnit.unitIso
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps!]
def counitIso : monToLaxMonoidal C ⋙ laxMonoidalToMon C ≅ 𝟭 (Mon_ C) :=
NatIso.ofComponents
(fun F =>
{ hom := { hom := 𝟙 _ }
inv := { hom := 𝟙 _ } })
(by aesop_cat)
#align Mon_.equiv_lax_monoidal_functor_punit.counit_iso Mon_.EquivLaxMonoidalFunctorPUnit.counitIso
end EquivLaxMonoidalFunctorPUnit
open EquivLaxMonoidalFunctorPUnit
attribute [local simp] eqToIso_map
/--
Monoid objects in `C` are "just" lax monoidal functors from the trivial monoidal category to `C`.
-/
@[simps]
def equivLaxMonoidalFunctorPUnit : LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C ≌ Mon_ C where
functor := laxMonoidalToMon C
inverse := monToLaxMonoidal C
unitIso := unitIso C
counitIso := counitIso C
#align Mon_.equiv_lax_monoidal_functor_punit Mon_.equivLaxMonoidalFunctorPUnit
end Mon_
namespace Mon_
/-!
In this section, we prove that the category of monoids in a braided monoidal category is monoidal.
Given two monoids `M` and `N` in a braided monoidal category `C`,
the multiplication on the tensor product `M.X ⊗ N.X` is defined in the obvious way:
it is the tensor product of the multiplications on `M` and `N`,
except that the tensor factors in the source come in the wrong order,
which we fix by pre-composing with a permutation isomorphism constructed from the braiding.
(There is a subtlety here: in fact there are two ways to do these,
using either the positive or negative crossing.)
A more conceptual way of understanding this definition is the following:
The braiding on `C` gives rise to a monoidal structure on
the tensor product functor from `C × C` to `C`.
A pair of monoids in `C` gives rise to a monoid in `C × C`,
which the tensor product functor by being monoidal takes to a monoid in `C`.
The permutation isomorphism appearing in the definition of
the multiplication on the tensor product of two monoids is
an instance of a more general family of isomorphisms
which together form a strength that equips the tensor product functor with a monoidal structure,
and the monoid axioms for the tensor product follow from the monoid axioms for the tensor factors
plus the properties of the strength (i.e., monoidal functor axioms).
The strength `tensor_μ` of the tensor product functor has been defined in
`Mathlib.CategoryTheory.Monoidal.Braided`.
Its properties, stated as independent lemmas in that module,
are used extensively in the proofs below.
Notice that we could have followed the above plan not only conceptually
but also as a possible implementation and
could have constructed the tensor product of monoids via `mapMon`,
but we chose to give a more explicit definition directly in terms of `tensor_μ`.
To complete the definition of the monoidal category structure on the category of monoids,
we need to provide definitions of associator and unitors.
The obvious candidates are the associator and unitors from `C`,
but we need to prove that they are monoid morphisms, i.e., compatible with unit and multiplication.
These properties translate to the monoidality of the associator and unitors
(with respect to the monoidal structures on the functors they relate),
which have also been proved in `Mathlib.CategoryTheory.Monoidal.Braided`.
-/
variable {C}
-- The proofs that associators and unitors preserve monoid units don't require braiding.
theorem one_associator {M N P : Mon_ C} :
((λ_ (𝟙_ C)).inv ≫ ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) ⊗ P.one)) ≫ (α_ M.X N.X P.X).hom =
(λ_ (𝟙_ C)).inv ≫ (M.one ⊗ (λ_ (𝟙_ C)).inv ≫ (N.one ⊗ P.one)) := by
simp only [Category.assoc, Iso.cancel_iso_inv_left]
slice_lhs 1 3 => rw [← Category.id_comp P.one, tensor_comp]
slice_lhs 2 3 => | rw [associator_naturality] | theorem one_associator {M N P : Mon_ C} :
((λ_ (𝟙_ C)).inv ≫ ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) ⊗ P.one)) ≫ (α_ M.X N.X P.X).hom =
(λ_ (𝟙_ C)).inv ≫ (M.one ⊗ (λ_ (𝟙_ C)).inv ≫ (N.one ⊗ P.one)) := by
simp only [Category.assoc, Iso.cancel_iso_inv_left]
slice_lhs 1 3 => rw [← Category.id_comp P.one, tensor_comp]
slice_lhs 2 3 => | Mathlib.CategoryTheory.Monoidal.Mon_.380_0.NTUMzhXPwXsmsYt | theorem one_associator {M N P : Mon_ C} :
((λ_ (𝟙_ C)).inv ≫ ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) ⊗ P.one)) ≫ (α_ M.X N.X P.X).hom =
(λ_ (𝟙_ C)).inv ≫ (M.one ⊗ (λ_ (𝟙_ C)).inv ≫ (N.one ⊗ P.one)) | Mathlib_CategoryTheory_Monoidal_Mon_ |
case a
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : MonoidalCategory C
M N P : Mon_ C
| ((M.one ⊗ N.one) ⊗ P.one) ≫ (α_ M.X N.X P.X).hom
case a C : Type u₁ inst✝¹ : Category.{v₁, u₁} C inst✝ : MonoidalCategory C M N P : Mon_ C | (λ_ (𝟙_ C)).inv ⊗ 𝟙 (𝟙_ C) | /-
Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/
import Mathlib.CategoryTheory.Monoidal.Braided
import Mathlib.CategoryTheory.Monoidal.Discrete
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
import Mathlib.Algebra.PUnitInstances
#align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c"
/-!
# The category of monoids in a monoidal category.
We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to
the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if
`C` is braided, then the category of monoids is naturally monoidal.
-/
set_option linter.uppercaseLean3 false
universe v₁ v₂ u₁ u₂ u
open CategoryTheory MonoidalCategory
variable (C : Type u₁) [Category.{v₁} C] [MonoidalCategory.{v₁} C]
/-- A monoid object internal to a monoidal category.
When the monoidal category is preadditive, this is also sometimes called an "algebra object".
-/
structure Mon_ where
X : C
one : 𝟙_ C ⟶ X
mul : X ⊗ X ⟶ X
one_mul : (one ⊗ 𝟙 X) ≫ mul = (λ_ X).hom := by aesop_cat
mul_one : (𝟙 X ⊗ one) ≫ mul = (ρ_ X).hom := by aesop_cat
-- Obviously there is some flexibility stating this axiom.
-- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`,
-- and chooses to place the associator on the right-hand side.
-- The heuristic is that unitors and associators "don't have much weight".
mul_assoc : (mul ⊗ 𝟙 X) ≫ mul = (α_ X X X).hom ≫ (𝟙 X ⊗ mul) ≫ mul := by aesop_cat
#align Mon_ Mon_
attribute [reassoc] Mon_.one_mul Mon_.mul_one
-- We prove a more general `@[simp]` lemma below.
attribute [reassoc (attr := simp)] Mon_.mul_assoc
namespace Mon_
/-- The trivial monoid object. We later show this is initial in `Mon_ C`.
-/
@[simps]
def trivial : Mon_ C where
X := 𝟙_ C
one := 𝟙 _
mul := (λ_ _).hom
mul_assoc := by coherence
mul_one := by coherence
#align Mon_.trivial Mon_.trivial
instance : Inhabited (Mon_ C) :=
⟨trivial C⟩
variable {C}
variable {M : Mon_ C}
@[simp]
theorem one_mul_hom {Z : C} (f : Z ⟶ M.X) : (M.one ⊗ f) ≫ M.mul = (λ_ Z).hom ≫ f := by
rw [← id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality]
#align Mon_.one_mul_hom Mon_.one_mul_hom
@[simp]
theorem mul_one_hom {Z : C} (f : Z ⟶ M.X) : (f ⊗ M.one) ≫ M.mul = (ρ_ Z).hom ≫ f := by
rw [← tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality]
#align Mon_.mul_one_hom Mon_.mul_one_hom
theorem assoc_flip :
(𝟙 M.X ⊗ M.mul) ≫ M.mul = (α_ M.X M.X M.X).inv ≫ (M.mul ⊗ 𝟙 M.X) ≫ M.mul := by simp
#align Mon_.assoc_flip Mon_.assoc_flip
/-- A morphism of monoid objects. -/
@[ext]
structure Hom (M N : Mon_ C) where
hom : M.X ⟶ N.X
one_hom : M.one ≫ hom = N.one := by aesop_cat
mul_hom : M.mul ≫ hom = (hom ⊗ hom) ≫ N.mul := by aesop_cat
#align Mon_.hom Mon_.Hom
attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom
/-- The identity morphism on a monoid object. -/
@[simps]
def id (M : Mon_ C) : Hom M M where
hom := 𝟙 M.X
#align Mon_.id Mon_.id
instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) :=
⟨id M⟩
#align Mon_.hom_inhabited Mon_.homInhabited
/-- Composition of morphisms of monoid objects. -/
@[simps]
def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where
hom := f.hom ≫ g.hom
#align Mon_.comp Mon_.comp
instance : Category (Mon_ C) where
Hom M N := Hom M N
id := id
comp f g := comp f g
-- Porting note: added, as `Hom.ext` does not apply to a morphism.
@[ext]
lemma ext {X Y : Mon_ C} {f g : X ⟶ Y} (w : f.hom = g.hom) : f = g :=
Hom.ext _ _ w
@[simp]
theorem id_hom' (M : Mon_ C) : (𝟙 M : Hom M M).hom = 𝟙 M.X :=
rfl
#align Mon_.id_hom' Mon_.id_hom'
@[simp]
theorem comp_hom' {M N K : Mon_ C} (f : M ⟶ N) (g : N ⟶ K) :
(f ≫ g : Hom M K).hom = f.hom ≫ g.hom :=
rfl
#align Mon_.comp_hom' Mon_.comp_hom'
section
variable (C)
/-- The forgetful functor from monoid objects to the ambient category. -/
@[simps]
def forget : Mon_ C ⥤ C where
obj A := A.X
map f := f.hom
#align Mon_.forget Mon_.forget
end
instance forget_faithful : Faithful (@forget C _ _) where
#align Mon_.forget_faithful Mon_.forget_faithful
instance {A B : Mon_ C} (f : A ⟶ B) [e : IsIso ((forget C).map f)] : IsIso f.hom :=
e
/-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/
instance : ReflectsIsomorphisms (forget C) where
reflects f e :=
⟨⟨{ hom := inv f.hom
mul_hom := by
simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, ← tensor_comp_assoc,
IsIso.inv_hom_id, tensor_id, Category.id_comp] },
by aesop_cat⟩⟩
/-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X ≅ N.X) (one_f : M.one ≫ f.hom = N.one)
(mul_f : M.mul ≫ f.hom = (f.hom ⊗ f.hom) ≫ N.mul) : M ≅ N where
hom :=
{ hom := f.hom
one_hom := one_f
mul_hom := mul_f }
inv :=
{ hom := f.inv
one_hom := by rw [← one_f]; simp
mul_hom := by
rw [← cancel_mono f.hom]
slice_rhs 2 3 => rw [mul_f]
simp }
#align Mon_.iso_of_iso Mon_.isoOfIso
instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C ⟶ A) where
default :=
{ hom := A.one
one_hom := by dsimp; simp
mul_hom := by dsimp; simp [A.one_mul, unitors_equal] }
uniq f := by
ext; simp
rw [← Category.id_comp f.hom]
erw [f.one_hom]
#align Mon_.unique_hom_from_trivial Mon_.uniqueHomFromTrivial
open CategoryTheory.Limits
instance : HasInitial (Mon_ C) :=
hasInitial_of_unique (trivial C)
end Mon_
namespace CategoryTheory.LaxMonoidalFunctor
variable {C} {D : Type u₂} [Category.{v₂} D] [MonoidalCategory.{v₂} D]
-- TODO: mapMod F A : Mod A ⥤ Mod (F.mapMon A)
/-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one]
rw [F.toFunctor.map_id]
rw [F.right_unitality]
mul_assoc := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_assoc]
conv_lhs => rw [F.toFunctor.map_id]
conv_lhs => rw [F.toFunctor.map_comp, F.toFunctor.map_comp]
conv_rhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_rhs 3 4 => rw [F.μ_natural]
conv_rhs => rw [F.toFunctor.map_id]
slice_rhs 1 3 => rw [← F.associativity]
simp only [Category.assoc] }
map f :=
{ hom := F.map f.hom
one_hom := by dsimp; rw [Category.assoc, ← F.toFunctor.map_comp, f.one_hom]
mul_hom := by
dsimp
rw [Category.assoc, F.μ_natural_assoc, ← F.toFunctor.map_comp, ← F.toFunctor.map_comp,
f.mul_hom] }
map_id A := by ext; simp
map_comp f g := by ext; simp
#align category_theory.lax_monoidal_functor.map_Mon CategoryTheory.LaxMonoidalFunctor.mapMon
variable (C D)
/-- `mapMon` is functorial in the lax monoidal functor. -/
@[simps] -- Porting note: added this, not sure how it worked previously without.
def mapMonFunctor : LaxMonoidalFunctor C D ⥤ Mon_ C ⥤ Mon_ D where
obj := mapMon
map α := { app := fun A => { hom := α.app A.X } }
#align category_theory.lax_monoidal_functor.map_Mon_functor CategoryTheory.LaxMonoidalFunctor.mapMonFunctor
end CategoryTheory.LaxMonoidalFunctor
namespace Mon_
open CategoryTheory.LaxMonoidalFunctor
namespace EquivLaxMonoidalFunctorPUnit
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps]
def laxMonoidalToMon : LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C ⥤ Mon_ C where
obj F := (F.mapMon : Mon_ _ ⥤ Mon_ C).obj (trivial (Discrete PUnit))
map α := ((mapMonFunctor (Discrete PUnit) C).map α).app _
#align Mon_.equiv_lax_monoidal_functor_punit.lax_monoidal_to_Mon Mon_.EquivLaxMonoidalFunctorPUnit.laxMonoidalToMon
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps]
def monToLaxMonoidal : Mon_ C ⥤ LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C where
obj A :=
{ obj := fun _ => A.X
map := fun _ => 𝟙 _
ε := A.one
μ := fun _ _ => A.mul
map_id := fun _ => rfl
map_comp := fun _ _ => (Category.id_comp (𝟙 A.X)).symm }
map f :=
{ app := fun _ => f.hom
naturality := fun _ _ _ => by dsimp; rw [Category.id_comp, Category.comp_id]
unit := f.one_hom
tensor := fun _ _ => f.mul_hom }
#align Mon_.equiv_lax_monoidal_functor_punit.Mon_to_lax_monoidal Mon_.EquivLaxMonoidalFunctorPUnit.monToLaxMonoidal
attribute [local aesop safe tactic (rule_sets [CategoryTheory])]
CategoryTheory.Discrete.discreteCases
attribute [local simp] eqToIso_map
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps!]
def unitIso :
𝟭 (LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C) ≅ laxMonoidalToMon C ⋙ monToLaxMonoidal C :=
NatIso.ofComponents
(fun F =>
MonoidalNatIso.ofComponents (fun _ => F.toFunctor.mapIso (eqToIso (by ext))) (by aesop_cat)
(by aesop_cat) (by aesop_cat))
(by aesop_cat)
#align Mon_.equiv_lax_monoidal_functor_punit.unit_iso Mon_.EquivLaxMonoidalFunctorPUnit.unitIso
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps!]
def counitIso : monToLaxMonoidal C ⋙ laxMonoidalToMon C ≅ 𝟭 (Mon_ C) :=
NatIso.ofComponents
(fun F =>
{ hom := { hom := 𝟙 _ }
inv := { hom := 𝟙 _ } })
(by aesop_cat)
#align Mon_.equiv_lax_monoidal_functor_punit.counit_iso Mon_.EquivLaxMonoidalFunctorPUnit.counitIso
end EquivLaxMonoidalFunctorPUnit
open EquivLaxMonoidalFunctorPUnit
attribute [local simp] eqToIso_map
/--
Monoid objects in `C` are "just" lax monoidal functors from the trivial monoidal category to `C`.
-/
@[simps]
def equivLaxMonoidalFunctorPUnit : LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C ≌ Mon_ C where
functor := laxMonoidalToMon C
inverse := monToLaxMonoidal C
unitIso := unitIso C
counitIso := counitIso C
#align Mon_.equiv_lax_monoidal_functor_punit Mon_.equivLaxMonoidalFunctorPUnit
end Mon_
namespace Mon_
/-!
In this section, we prove that the category of monoids in a braided monoidal category is monoidal.
Given two monoids `M` and `N` in a braided monoidal category `C`,
the multiplication on the tensor product `M.X ⊗ N.X` is defined in the obvious way:
it is the tensor product of the multiplications on `M` and `N`,
except that the tensor factors in the source come in the wrong order,
which we fix by pre-composing with a permutation isomorphism constructed from the braiding.
(There is a subtlety here: in fact there are two ways to do these,
using either the positive or negative crossing.)
A more conceptual way of understanding this definition is the following:
The braiding on `C` gives rise to a monoidal structure on
the tensor product functor from `C × C` to `C`.
A pair of monoids in `C` gives rise to a monoid in `C × C`,
which the tensor product functor by being monoidal takes to a monoid in `C`.
The permutation isomorphism appearing in the definition of
the multiplication on the tensor product of two monoids is
an instance of a more general family of isomorphisms
which together form a strength that equips the tensor product functor with a monoidal structure,
and the monoid axioms for the tensor product follow from the monoid axioms for the tensor factors
plus the properties of the strength (i.e., monoidal functor axioms).
The strength `tensor_μ` of the tensor product functor has been defined in
`Mathlib.CategoryTheory.Monoidal.Braided`.
Its properties, stated as independent lemmas in that module,
are used extensively in the proofs below.
Notice that we could have followed the above plan not only conceptually
but also as a possible implementation and
could have constructed the tensor product of monoids via `mapMon`,
but we chose to give a more explicit definition directly in terms of `tensor_μ`.
To complete the definition of the monoidal category structure on the category of monoids,
we need to provide definitions of associator and unitors.
The obvious candidates are the associator and unitors from `C`,
but we need to prove that they are monoid morphisms, i.e., compatible with unit and multiplication.
These properties translate to the monoidality of the associator and unitors
(with respect to the monoidal structures on the functors they relate),
which have also been proved in `Mathlib.CategoryTheory.Monoidal.Braided`.
-/
variable {C}
-- The proofs that associators and unitors preserve monoid units don't require braiding.
theorem one_associator {M N P : Mon_ C} :
((λ_ (𝟙_ C)).inv ≫ ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) ⊗ P.one)) ≫ (α_ M.X N.X P.X).hom =
(λ_ (𝟙_ C)).inv ≫ (M.one ⊗ (λ_ (𝟙_ C)).inv ≫ (N.one ⊗ P.one)) := by
simp only [Category.assoc, Iso.cancel_iso_inv_left]
slice_lhs 1 3 => rw [← Category.id_comp P.one, tensor_comp]
slice_lhs 2 3 => | rw [associator_naturality] | theorem one_associator {M N P : Mon_ C} :
((λ_ (𝟙_ C)).inv ≫ ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) ⊗ P.one)) ≫ (α_ M.X N.X P.X).hom =
(λ_ (𝟙_ C)).inv ≫ (M.one ⊗ (λ_ (𝟙_ C)).inv ≫ (N.one ⊗ P.one)) := by
simp only [Category.assoc, Iso.cancel_iso_inv_left]
slice_lhs 1 3 => rw [← Category.id_comp P.one, tensor_comp]
slice_lhs 2 3 => | Mathlib.CategoryTheory.Monoidal.Mon_.380_0.NTUMzhXPwXsmsYt | theorem one_associator {M N P : Mon_ C} :
((λ_ (𝟙_ C)).inv ≫ ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) ⊗ P.one)) ≫ (α_ M.X N.X P.X).hom =
(λ_ (𝟙_ C)).inv ≫ (M.one ⊗ (λ_ (𝟙_ C)).inv ≫ (N.one ⊗ P.one)) | Mathlib_CategoryTheory_Monoidal_Mon_ |
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : MonoidalCategory C
M N P : Mon_ C
⊢ ((λ_ (𝟙_ C)).inv ⊗ 𝟙 (𝟙_ C)) ≫ (α_ (𝟙_ C) (𝟙_ C) (𝟙_ C)).hom ≫ (M.one ⊗ N.one ⊗ P.one) =
M.one ⊗ (λ_ (𝟙_ C)).inv ≫ (N.one ⊗ P.one) | /-
Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/
import Mathlib.CategoryTheory.Monoidal.Braided
import Mathlib.CategoryTheory.Monoidal.Discrete
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
import Mathlib.Algebra.PUnitInstances
#align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c"
/-!
# The category of monoids in a monoidal category.
We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to
the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if
`C` is braided, then the category of monoids is naturally monoidal.
-/
set_option linter.uppercaseLean3 false
universe v₁ v₂ u₁ u₂ u
open CategoryTheory MonoidalCategory
variable (C : Type u₁) [Category.{v₁} C] [MonoidalCategory.{v₁} C]
/-- A monoid object internal to a monoidal category.
When the monoidal category is preadditive, this is also sometimes called an "algebra object".
-/
structure Mon_ where
X : C
one : 𝟙_ C ⟶ X
mul : X ⊗ X ⟶ X
one_mul : (one ⊗ 𝟙 X) ≫ mul = (λ_ X).hom := by aesop_cat
mul_one : (𝟙 X ⊗ one) ≫ mul = (ρ_ X).hom := by aesop_cat
-- Obviously there is some flexibility stating this axiom.
-- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`,
-- and chooses to place the associator on the right-hand side.
-- The heuristic is that unitors and associators "don't have much weight".
mul_assoc : (mul ⊗ 𝟙 X) ≫ mul = (α_ X X X).hom ≫ (𝟙 X ⊗ mul) ≫ mul := by aesop_cat
#align Mon_ Mon_
attribute [reassoc] Mon_.one_mul Mon_.mul_one
-- We prove a more general `@[simp]` lemma below.
attribute [reassoc (attr := simp)] Mon_.mul_assoc
namespace Mon_
/-- The trivial monoid object. We later show this is initial in `Mon_ C`.
-/
@[simps]
def trivial : Mon_ C where
X := 𝟙_ C
one := 𝟙 _
mul := (λ_ _).hom
mul_assoc := by coherence
mul_one := by coherence
#align Mon_.trivial Mon_.trivial
instance : Inhabited (Mon_ C) :=
⟨trivial C⟩
variable {C}
variable {M : Mon_ C}
@[simp]
theorem one_mul_hom {Z : C} (f : Z ⟶ M.X) : (M.one ⊗ f) ≫ M.mul = (λ_ Z).hom ≫ f := by
rw [← id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality]
#align Mon_.one_mul_hom Mon_.one_mul_hom
@[simp]
theorem mul_one_hom {Z : C} (f : Z ⟶ M.X) : (f ⊗ M.one) ≫ M.mul = (ρ_ Z).hom ≫ f := by
rw [← tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality]
#align Mon_.mul_one_hom Mon_.mul_one_hom
theorem assoc_flip :
(𝟙 M.X ⊗ M.mul) ≫ M.mul = (α_ M.X M.X M.X).inv ≫ (M.mul ⊗ 𝟙 M.X) ≫ M.mul := by simp
#align Mon_.assoc_flip Mon_.assoc_flip
/-- A morphism of monoid objects. -/
@[ext]
structure Hom (M N : Mon_ C) where
hom : M.X ⟶ N.X
one_hom : M.one ≫ hom = N.one := by aesop_cat
mul_hom : M.mul ≫ hom = (hom ⊗ hom) ≫ N.mul := by aesop_cat
#align Mon_.hom Mon_.Hom
attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom
/-- The identity morphism on a monoid object. -/
@[simps]
def id (M : Mon_ C) : Hom M M where
hom := 𝟙 M.X
#align Mon_.id Mon_.id
instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) :=
⟨id M⟩
#align Mon_.hom_inhabited Mon_.homInhabited
/-- Composition of morphisms of monoid objects. -/
@[simps]
def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where
hom := f.hom ≫ g.hom
#align Mon_.comp Mon_.comp
instance : Category (Mon_ C) where
Hom M N := Hom M N
id := id
comp f g := comp f g
-- Porting note: added, as `Hom.ext` does not apply to a morphism.
@[ext]
lemma ext {X Y : Mon_ C} {f g : X ⟶ Y} (w : f.hom = g.hom) : f = g :=
Hom.ext _ _ w
@[simp]
theorem id_hom' (M : Mon_ C) : (𝟙 M : Hom M M).hom = 𝟙 M.X :=
rfl
#align Mon_.id_hom' Mon_.id_hom'
@[simp]
theorem comp_hom' {M N K : Mon_ C} (f : M ⟶ N) (g : N ⟶ K) :
(f ≫ g : Hom M K).hom = f.hom ≫ g.hom :=
rfl
#align Mon_.comp_hom' Mon_.comp_hom'
section
variable (C)
/-- The forgetful functor from monoid objects to the ambient category. -/
@[simps]
def forget : Mon_ C ⥤ C where
obj A := A.X
map f := f.hom
#align Mon_.forget Mon_.forget
end
instance forget_faithful : Faithful (@forget C _ _) where
#align Mon_.forget_faithful Mon_.forget_faithful
instance {A B : Mon_ C} (f : A ⟶ B) [e : IsIso ((forget C).map f)] : IsIso f.hom :=
e
/-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/
instance : ReflectsIsomorphisms (forget C) where
reflects f e :=
⟨⟨{ hom := inv f.hom
mul_hom := by
simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, ← tensor_comp_assoc,
IsIso.inv_hom_id, tensor_id, Category.id_comp] },
by aesop_cat⟩⟩
/-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X ≅ N.X) (one_f : M.one ≫ f.hom = N.one)
(mul_f : M.mul ≫ f.hom = (f.hom ⊗ f.hom) ≫ N.mul) : M ≅ N where
hom :=
{ hom := f.hom
one_hom := one_f
mul_hom := mul_f }
inv :=
{ hom := f.inv
one_hom := by rw [← one_f]; simp
mul_hom := by
rw [← cancel_mono f.hom]
slice_rhs 2 3 => rw [mul_f]
simp }
#align Mon_.iso_of_iso Mon_.isoOfIso
instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C ⟶ A) where
default :=
{ hom := A.one
one_hom := by dsimp; simp
mul_hom := by dsimp; simp [A.one_mul, unitors_equal] }
uniq f := by
ext; simp
rw [← Category.id_comp f.hom]
erw [f.one_hom]
#align Mon_.unique_hom_from_trivial Mon_.uniqueHomFromTrivial
open CategoryTheory.Limits
instance : HasInitial (Mon_ C) :=
hasInitial_of_unique (trivial C)
end Mon_
namespace CategoryTheory.LaxMonoidalFunctor
variable {C} {D : Type u₂} [Category.{v₂} D] [MonoidalCategory.{v₂} D]
-- TODO: mapMod F A : Mod A ⥤ Mod (F.mapMon A)
/-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one]
rw [F.toFunctor.map_id]
rw [F.right_unitality]
mul_assoc := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_assoc]
conv_lhs => rw [F.toFunctor.map_id]
conv_lhs => rw [F.toFunctor.map_comp, F.toFunctor.map_comp]
conv_rhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_rhs 3 4 => rw [F.μ_natural]
conv_rhs => rw [F.toFunctor.map_id]
slice_rhs 1 3 => rw [← F.associativity]
simp only [Category.assoc] }
map f :=
{ hom := F.map f.hom
one_hom := by dsimp; rw [Category.assoc, ← F.toFunctor.map_comp, f.one_hom]
mul_hom := by
dsimp
rw [Category.assoc, F.μ_natural_assoc, ← F.toFunctor.map_comp, ← F.toFunctor.map_comp,
f.mul_hom] }
map_id A := by ext; simp
map_comp f g := by ext; simp
#align category_theory.lax_monoidal_functor.map_Mon CategoryTheory.LaxMonoidalFunctor.mapMon
variable (C D)
/-- `mapMon` is functorial in the lax monoidal functor. -/
@[simps] -- Porting note: added this, not sure how it worked previously without.
def mapMonFunctor : LaxMonoidalFunctor C D ⥤ Mon_ C ⥤ Mon_ D where
obj := mapMon
map α := { app := fun A => { hom := α.app A.X } }
#align category_theory.lax_monoidal_functor.map_Mon_functor CategoryTheory.LaxMonoidalFunctor.mapMonFunctor
end CategoryTheory.LaxMonoidalFunctor
namespace Mon_
open CategoryTheory.LaxMonoidalFunctor
namespace EquivLaxMonoidalFunctorPUnit
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps]
def laxMonoidalToMon : LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C ⥤ Mon_ C where
obj F := (F.mapMon : Mon_ _ ⥤ Mon_ C).obj (trivial (Discrete PUnit))
map α := ((mapMonFunctor (Discrete PUnit) C).map α).app _
#align Mon_.equiv_lax_monoidal_functor_punit.lax_monoidal_to_Mon Mon_.EquivLaxMonoidalFunctorPUnit.laxMonoidalToMon
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps]
def monToLaxMonoidal : Mon_ C ⥤ LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C where
obj A :=
{ obj := fun _ => A.X
map := fun _ => 𝟙 _
ε := A.one
μ := fun _ _ => A.mul
map_id := fun _ => rfl
map_comp := fun _ _ => (Category.id_comp (𝟙 A.X)).symm }
map f :=
{ app := fun _ => f.hom
naturality := fun _ _ _ => by dsimp; rw [Category.id_comp, Category.comp_id]
unit := f.one_hom
tensor := fun _ _ => f.mul_hom }
#align Mon_.equiv_lax_monoidal_functor_punit.Mon_to_lax_monoidal Mon_.EquivLaxMonoidalFunctorPUnit.monToLaxMonoidal
attribute [local aesop safe tactic (rule_sets [CategoryTheory])]
CategoryTheory.Discrete.discreteCases
attribute [local simp] eqToIso_map
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps!]
def unitIso :
𝟭 (LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C) ≅ laxMonoidalToMon C ⋙ monToLaxMonoidal C :=
NatIso.ofComponents
(fun F =>
MonoidalNatIso.ofComponents (fun _ => F.toFunctor.mapIso (eqToIso (by ext))) (by aesop_cat)
(by aesop_cat) (by aesop_cat))
(by aesop_cat)
#align Mon_.equiv_lax_monoidal_functor_punit.unit_iso Mon_.EquivLaxMonoidalFunctorPUnit.unitIso
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps!]
def counitIso : monToLaxMonoidal C ⋙ laxMonoidalToMon C ≅ 𝟭 (Mon_ C) :=
NatIso.ofComponents
(fun F =>
{ hom := { hom := 𝟙 _ }
inv := { hom := 𝟙 _ } })
(by aesop_cat)
#align Mon_.equiv_lax_monoidal_functor_punit.counit_iso Mon_.EquivLaxMonoidalFunctorPUnit.counitIso
end EquivLaxMonoidalFunctorPUnit
open EquivLaxMonoidalFunctorPUnit
attribute [local simp] eqToIso_map
/--
Monoid objects in `C` are "just" lax monoidal functors from the trivial monoidal category to `C`.
-/
@[simps]
def equivLaxMonoidalFunctorPUnit : LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C ≌ Mon_ C where
functor := laxMonoidalToMon C
inverse := monToLaxMonoidal C
unitIso := unitIso C
counitIso := counitIso C
#align Mon_.equiv_lax_monoidal_functor_punit Mon_.equivLaxMonoidalFunctorPUnit
end Mon_
namespace Mon_
/-!
In this section, we prove that the category of monoids in a braided monoidal category is monoidal.
Given two monoids `M` and `N` in a braided monoidal category `C`,
the multiplication on the tensor product `M.X ⊗ N.X` is defined in the obvious way:
it is the tensor product of the multiplications on `M` and `N`,
except that the tensor factors in the source come in the wrong order,
which we fix by pre-composing with a permutation isomorphism constructed from the braiding.
(There is a subtlety here: in fact there are two ways to do these,
using either the positive or negative crossing.)
A more conceptual way of understanding this definition is the following:
The braiding on `C` gives rise to a monoidal structure on
the tensor product functor from `C × C` to `C`.
A pair of monoids in `C` gives rise to a monoid in `C × C`,
which the tensor product functor by being monoidal takes to a monoid in `C`.
The permutation isomorphism appearing in the definition of
the multiplication on the tensor product of two monoids is
an instance of a more general family of isomorphisms
which together form a strength that equips the tensor product functor with a monoidal structure,
and the monoid axioms for the tensor product follow from the monoid axioms for the tensor factors
plus the properties of the strength (i.e., monoidal functor axioms).
The strength `tensor_μ` of the tensor product functor has been defined in
`Mathlib.CategoryTheory.Monoidal.Braided`.
Its properties, stated as independent lemmas in that module,
are used extensively in the proofs below.
Notice that we could have followed the above plan not only conceptually
but also as a possible implementation and
could have constructed the tensor product of monoids via `mapMon`,
but we chose to give a more explicit definition directly in terms of `tensor_μ`.
To complete the definition of the monoidal category structure on the category of monoids,
we need to provide definitions of associator and unitors.
The obvious candidates are the associator and unitors from `C`,
but we need to prove that they are monoid morphisms, i.e., compatible with unit and multiplication.
These properties translate to the monoidality of the associator and unitors
(with respect to the monoidal structures on the functors they relate),
which have also been proved in `Mathlib.CategoryTheory.Monoidal.Braided`.
-/
variable {C}
-- The proofs that associators and unitors preserve monoid units don't require braiding.
theorem one_associator {M N P : Mon_ C} :
((λ_ (𝟙_ C)).inv ≫ ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) ⊗ P.one)) ≫ (α_ M.X N.X P.X).hom =
(λ_ (𝟙_ C)).inv ≫ (M.one ⊗ (λ_ (𝟙_ C)).inv ≫ (N.one ⊗ P.one)) := by
simp only [Category.assoc, Iso.cancel_iso_inv_left]
slice_lhs 1 3 => rw [← Category.id_comp P.one, tensor_comp]
slice_lhs 2 3 => rw [associator_naturality]
| slice_rhs 1 2 => rw [← Category.id_comp M.one, tensor_comp] | theorem one_associator {M N P : Mon_ C} :
((λ_ (𝟙_ C)).inv ≫ ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) ⊗ P.one)) ≫ (α_ M.X N.X P.X).hom =
(λ_ (𝟙_ C)).inv ≫ (M.one ⊗ (λ_ (𝟙_ C)).inv ≫ (N.one ⊗ P.one)) := by
simp only [Category.assoc, Iso.cancel_iso_inv_left]
slice_lhs 1 3 => rw [← Category.id_comp P.one, tensor_comp]
slice_lhs 2 3 => rw [associator_naturality]
| Mathlib.CategoryTheory.Monoidal.Mon_.380_0.NTUMzhXPwXsmsYt | theorem one_associator {M N P : Mon_ C} :
((λ_ (𝟙_ C)).inv ≫ ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) ⊗ P.one)) ≫ (α_ M.X N.X P.X).hom =
(λ_ (𝟙_ C)).inv ≫ (M.one ⊗ (λ_ (𝟙_ C)).inv ≫ (N.one ⊗ P.one)) | Mathlib_CategoryTheory_Monoidal_Mon_ |
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : MonoidalCategory C
M N P : Mon_ C
| M.one ⊗ (λ_ (𝟙_ C)).inv ≫ (N.one ⊗ P.one) | /-
Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/
import Mathlib.CategoryTheory.Monoidal.Braided
import Mathlib.CategoryTheory.Monoidal.Discrete
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
import Mathlib.Algebra.PUnitInstances
#align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c"
/-!
# The category of monoids in a monoidal category.
We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to
the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if
`C` is braided, then the category of monoids is naturally monoidal.
-/
set_option linter.uppercaseLean3 false
universe v₁ v₂ u₁ u₂ u
open CategoryTheory MonoidalCategory
variable (C : Type u₁) [Category.{v₁} C] [MonoidalCategory.{v₁} C]
/-- A monoid object internal to a monoidal category.
When the monoidal category is preadditive, this is also sometimes called an "algebra object".
-/
structure Mon_ where
X : C
one : 𝟙_ C ⟶ X
mul : X ⊗ X ⟶ X
one_mul : (one ⊗ 𝟙 X) ≫ mul = (λ_ X).hom := by aesop_cat
mul_one : (𝟙 X ⊗ one) ≫ mul = (ρ_ X).hom := by aesop_cat
-- Obviously there is some flexibility stating this axiom.
-- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`,
-- and chooses to place the associator on the right-hand side.
-- The heuristic is that unitors and associators "don't have much weight".
mul_assoc : (mul ⊗ 𝟙 X) ≫ mul = (α_ X X X).hom ≫ (𝟙 X ⊗ mul) ≫ mul := by aesop_cat
#align Mon_ Mon_
attribute [reassoc] Mon_.one_mul Mon_.mul_one
-- We prove a more general `@[simp]` lemma below.
attribute [reassoc (attr := simp)] Mon_.mul_assoc
namespace Mon_
/-- The trivial monoid object. We later show this is initial in `Mon_ C`.
-/
@[simps]
def trivial : Mon_ C where
X := 𝟙_ C
one := 𝟙 _
mul := (λ_ _).hom
mul_assoc := by coherence
mul_one := by coherence
#align Mon_.trivial Mon_.trivial
instance : Inhabited (Mon_ C) :=
⟨trivial C⟩
variable {C}
variable {M : Mon_ C}
@[simp]
theorem one_mul_hom {Z : C} (f : Z ⟶ M.X) : (M.one ⊗ f) ≫ M.mul = (λ_ Z).hom ≫ f := by
rw [← id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality]
#align Mon_.one_mul_hom Mon_.one_mul_hom
@[simp]
theorem mul_one_hom {Z : C} (f : Z ⟶ M.X) : (f ⊗ M.one) ≫ M.mul = (ρ_ Z).hom ≫ f := by
rw [← tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality]
#align Mon_.mul_one_hom Mon_.mul_one_hom
theorem assoc_flip :
(𝟙 M.X ⊗ M.mul) ≫ M.mul = (α_ M.X M.X M.X).inv ≫ (M.mul ⊗ 𝟙 M.X) ≫ M.mul := by simp
#align Mon_.assoc_flip Mon_.assoc_flip
/-- A morphism of monoid objects. -/
@[ext]
structure Hom (M N : Mon_ C) where
hom : M.X ⟶ N.X
one_hom : M.one ≫ hom = N.one := by aesop_cat
mul_hom : M.mul ≫ hom = (hom ⊗ hom) ≫ N.mul := by aesop_cat
#align Mon_.hom Mon_.Hom
attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom
/-- The identity morphism on a monoid object. -/
@[simps]
def id (M : Mon_ C) : Hom M M where
hom := 𝟙 M.X
#align Mon_.id Mon_.id
instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) :=
⟨id M⟩
#align Mon_.hom_inhabited Mon_.homInhabited
/-- Composition of morphisms of monoid objects. -/
@[simps]
def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where
hom := f.hom ≫ g.hom
#align Mon_.comp Mon_.comp
instance : Category (Mon_ C) where
Hom M N := Hom M N
id := id
comp f g := comp f g
-- Porting note: added, as `Hom.ext` does not apply to a morphism.
@[ext]
lemma ext {X Y : Mon_ C} {f g : X ⟶ Y} (w : f.hom = g.hom) : f = g :=
Hom.ext _ _ w
@[simp]
theorem id_hom' (M : Mon_ C) : (𝟙 M : Hom M M).hom = 𝟙 M.X :=
rfl
#align Mon_.id_hom' Mon_.id_hom'
@[simp]
theorem comp_hom' {M N K : Mon_ C} (f : M ⟶ N) (g : N ⟶ K) :
(f ≫ g : Hom M K).hom = f.hom ≫ g.hom :=
rfl
#align Mon_.comp_hom' Mon_.comp_hom'
section
variable (C)
/-- The forgetful functor from monoid objects to the ambient category. -/
@[simps]
def forget : Mon_ C ⥤ C where
obj A := A.X
map f := f.hom
#align Mon_.forget Mon_.forget
end
instance forget_faithful : Faithful (@forget C _ _) where
#align Mon_.forget_faithful Mon_.forget_faithful
instance {A B : Mon_ C} (f : A ⟶ B) [e : IsIso ((forget C).map f)] : IsIso f.hom :=
e
/-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/
instance : ReflectsIsomorphisms (forget C) where
reflects f e :=
⟨⟨{ hom := inv f.hom
mul_hom := by
simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, ← tensor_comp_assoc,
IsIso.inv_hom_id, tensor_id, Category.id_comp] },
by aesop_cat⟩⟩
/-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X ≅ N.X) (one_f : M.one ≫ f.hom = N.one)
(mul_f : M.mul ≫ f.hom = (f.hom ⊗ f.hom) ≫ N.mul) : M ≅ N where
hom :=
{ hom := f.hom
one_hom := one_f
mul_hom := mul_f }
inv :=
{ hom := f.inv
one_hom := by rw [← one_f]; simp
mul_hom := by
rw [← cancel_mono f.hom]
slice_rhs 2 3 => rw [mul_f]
simp }
#align Mon_.iso_of_iso Mon_.isoOfIso
instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C ⟶ A) where
default :=
{ hom := A.one
one_hom := by dsimp; simp
mul_hom := by dsimp; simp [A.one_mul, unitors_equal] }
uniq f := by
ext; simp
rw [← Category.id_comp f.hom]
erw [f.one_hom]
#align Mon_.unique_hom_from_trivial Mon_.uniqueHomFromTrivial
open CategoryTheory.Limits
instance : HasInitial (Mon_ C) :=
hasInitial_of_unique (trivial C)
end Mon_
namespace CategoryTheory.LaxMonoidalFunctor
variable {C} {D : Type u₂} [Category.{v₂} D] [MonoidalCategory.{v₂} D]
-- TODO: mapMod F A : Mod A ⥤ Mod (F.mapMon A)
/-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one]
rw [F.toFunctor.map_id]
rw [F.right_unitality]
mul_assoc := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_assoc]
conv_lhs => rw [F.toFunctor.map_id]
conv_lhs => rw [F.toFunctor.map_comp, F.toFunctor.map_comp]
conv_rhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_rhs 3 4 => rw [F.μ_natural]
conv_rhs => rw [F.toFunctor.map_id]
slice_rhs 1 3 => rw [← F.associativity]
simp only [Category.assoc] }
map f :=
{ hom := F.map f.hom
one_hom := by dsimp; rw [Category.assoc, ← F.toFunctor.map_comp, f.one_hom]
mul_hom := by
dsimp
rw [Category.assoc, F.μ_natural_assoc, ← F.toFunctor.map_comp, ← F.toFunctor.map_comp,
f.mul_hom] }
map_id A := by ext; simp
map_comp f g := by ext; simp
#align category_theory.lax_monoidal_functor.map_Mon CategoryTheory.LaxMonoidalFunctor.mapMon
variable (C D)
/-- `mapMon` is functorial in the lax monoidal functor. -/
@[simps] -- Porting note: added this, not sure how it worked previously without.
def mapMonFunctor : LaxMonoidalFunctor C D ⥤ Mon_ C ⥤ Mon_ D where
obj := mapMon
map α := { app := fun A => { hom := α.app A.X } }
#align category_theory.lax_monoidal_functor.map_Mon_functor CategoryTheory.LaxMonoidalFunctor.mapMonFunctor
end CategoryTheory.LaxMonoidalFunctor
namespace Mon_
open CategoryTheory.LaxMonoidalFunctor
namespace EquivLaxMonoidalFunctorPUnit
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps]
def laxMonoidalToMon : LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C ⥤ Mon_ C where
obj F := (F.mapMon : Mon_ _ ⥤ Mon_ C).obj (trivial (Discrete PUnit))
map α := ((mapMonFunctor (Discrete PUnit) C).map α).app _
#align Mon_.equiv_lax_monoidal_functor_punit.lax_monoidal_to_Mon Mon_.EquivLaxMonoidalFunctorPUnit.laxMonoidalToMon
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps]
def monToLaxMonoidal : Mon_ C ⥤ LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C where
obj A :=
{ obj := fun _ => A.X
map := fun _ => 𝟙 _
ε := A.one
μ := fun _ _ => A.mul
map_id := fun _ => rfl
map_comp := fun _ _ => (Category.id_comp (𝟙 A.X)).symm }
map f :=
{ app := fun _ => f.hom
naturality := fun _ _ _ => by dsimp; rw [Category.id_comp, Category.comp_id]
unit := f.one_hom
tensor := fun _ _ => f.mul_hom }
#align Mon_.equiv_lax_monoidal_functor_punit.Mon_to_lax_monoidal Mon_.EquivLaxMonoidalFunctorPUnit.monToLaxMonoidal
attribute [local aesop safe tactic (rule_sets [CategoryTheory])]
CategoryTheory.Discrete.discreteCases
attribute [local simp] eqToIso_map
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps!]
def unitIso :
𝟭 (LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C) ≅ laxMonoidalToMon C ⋙ monToLaxMonoidal C :=
NatIso.ofComponents
(fun F =>
MonoidalNatIso.ofComponents (fun _ => F.toFunctor.mapIso (eqToIso (by ext))) (by aesop_cat)
(by aesop_cat) (by aesop_cat))
(by aesop_cat)
#align Mon_.equiv_lax_monoidal_functor_punit.unit_iso Mon_.EquivLaxMonoidalFunctorPUnit.unitIso
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps!]
def counitIso : monToLaxMonoidal C ⋙ laxMonoidalToMon C ≅ 𝟭 (Mon_ C) :=
NatIso.ofComponents
(fun F =>
{ hom := { hom := 𝟙 _ }
inv := { hom := 𝟙 _ } })
(by aesop_cat)
#align Mon_.equiv_lax_monoidal_functor_punit.counit_iso Mon_.EquivLaxMonoidalFunctorPUnit.counitIso
end EquivLaxMonoidalFunctorPUnit
open EquivLaxMonoidalFunctorPUnit
attribute [local simp] eqToIso_map
/--
Monoid objects in `C` are "just" lax monoidal functors from the trivial monoidal category to `C`.
-/
@[simps]
def equivLaxMonoidalFunctorPUnit : LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C ≌ Mon_ C where
functor := laxMonoidalToMon C
inverse := monToLaxMonoidal C
unitIso := unitIso C
counitIso := counitIso C
#align Mon_.equiv_lax_monoidal_functor_punit Mon_.equivLaxMonoidalFunctorPUnit
end Mon_
namespace Mon_
/-!
In this section, we prove that the category of monoids in a braided monoidal category is monoidal.
Given two monoids `M` and `N` in a braided monoidal category `C`,
the multiplication on the tensor product `M.X ⊗ N.X` is defined in the obvious way:
it is the tensor product of the multiplications on `M` and `N`,
except that the tensor factors in the source come in the wrong order,
which we fix by pre-composing with a permutation isomorphism constructed from the braiding.
(There is a subtlety here: in fact there are two ways to do these,
using either the positive or negative crossing.)
A more conceptual way of understanding this definition is the following:
The braiding on `C` gives rise to a monoidal structure on
the tensor product functor from `C × C` to `C`.
A pair of monoids in `C` gives rise to a monoid in `C × C`,
which the tensor product functor by being monoidal takes to a monoid in `C`.
The permutation isomorphism appearing in the definition of
the multiplication on the tensor product of two monoids is
an instance of a more general family of isomorphisms
which together form a strength that equips the tensor product functor with a monoidal structure,
and the monoid axioms for the tensor product follow from the monoid axioms for the tensor factors
plus the properties of the strength (i.e., monoidal functor axioms).
The strength `tensor_μ` of the tensor product functor has been defined in
`Mathlib.CategoryTheory.Monoidal.Braided`.
Its properties, stated as independent lemmas in that module,
are used extensively in the proofs below.
Notice that we could have followed the above plan not only conceptually
but also as a possible implementation and
could have constructed the tensor product of monoids via `mapMon`,
but we chose to give a more explicit definition directly in terms of `tensor_μ`.
To complete the definition of the monoidal category structure on the category of monoids,
we need to provide definitions of associator and unitors.
The obvious candidates are the associator and unitors from `C`,
but we need to prove that they are monoid morphisms, i.e., compatible with unit and multiplication.
These properties translate to the monoidality of the associator and unitors
(with respect to the monoidal structures on the functors they relate),
which have also been proved in `Mathlib.CategoryTheory.Monoidal.Braided`.
-/
variable {C}
-- The proofs that associators and unitors preserve monoid units don't require braiding.
theorem one_associator {M N P : Mon_ C} :
((λ_ (𝟙_ C)).inv ≫ ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) ⊗ P.one)) ≫ (α_ M.X N.X P.X).hom =
(λ_ (𝟙_ C)).inv ≫ (M.one ⊗ (λ_ (𝟙_ C)).inv ≫ (N.one ⊗ P.one)) := by
simp only [Category.assoc, Iso.cancel_iso_inv_left]
slice_lhs 1 3 => rw [← Category.id_comp P.one, tensor_comp]
slice_lhs 2 3 => rw [associator_naturality]
slice_rhs 1 2 => | rw [← Category.id_comp M.one, tensor_comp] | theorem one_associator {M N P : Mon_ C} :
((λ_ (𝟙_ C)).inv ≫ ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) ⊗ P.one)) ≫ (α_ M.X N.X P.X).hom =
(λ_ (𝟙_ C)).inv ≫ (M.one ⊗ (λ_ (𝟙_ C)).inv ≫ (N.one ⊗ P.one)) := by
simp only [Category.assoc, Iso.cancel_iso_inv_left]
slice_lhs 1 3 => rw [← Category.id_comp P.one, tensor_comp]
slice_lhs 2 3 => rw [associator_naturality]
slice_rhs 1 2 => | Mathlib.CategoryTheory.Monoidal.Mon_.380_0.NTUMzhXPwXsmsYt | theorem one_associator {M N P : Mon_ C} :
((λ_ (𝟙_ C)).inv ≫ ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) ⊗ P.one)) ≫ (α_ M.X N.X P.X).hom =
(λ_ (𝟙_ C)).inv ≫ (M.one ⊗ (λ_ (𝟙_ C)).inv ≫ (N.one ⊗ P.one)) | Mathlib_CategoryTheory_Monoidal_Mon_ |
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : MonoidalCategory C
M N P : Mon_ C
| M.one ⊗ (λ_ (𝟙_ C)).inv ≫ (N.one ⊗ P.one) | /-
Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/
import Mathlib.CategoryTheory.Monoidal.Braided
import Mathlib.CategoryTheory.Monoidal.Discrete
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
import Mathlib.Algebra.PUnitInstances
#align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c"
/-!
# The category of monoids in a monoidal category.
We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to
the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if
`C` is braided, then the category of monoids is naturally monoidal.
-/
set_option linter.uppercaseLean3 false
universe v₁ v₂ u₁ u₂ u
open CategoryTheory MonoidalCategory
variable (C : Type u₁) [Category.{v₁} C] [MonoidalCategory.{v₁} C]
/-- A monoid object internal to a monoidal category.
When the monoidal category is preadditive, this is also sometimes called an "algebra object".
-/
structure Mon_ where
X : C
one : 𝟙_ C ⟶ X
mul : X ⊗ X ⟶ X
one_mul : (one ⊗ 𝟙 X) ≫ mul = (λ_ X).hom := by aesop_cat
mul_one : (𝟙 X ⊗ one) ≫ mul = (ρ_ X).hom := by aesop_cat
-- Obviously there is some flexibility stating this axiom.
-- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`,
-- and chooses to place the associator on the right-hand side.
-- The heuristic is that unitors and associators "don't have much weight".
mul_assoc : (mul ⊗ 𝟙 X) ≫ mul = (α_ X X X).hom ≫ (𝟙 X ⊗ mul) ≫ mul := by aesop_cat
#align Mon_ Mon_
attribute [reassoc] Mon_.one_mul Mon_.mul_one
-- We prove a more general `@[simp]` lemma below.
attribute [reassoc (attr := simp)] Mon_.mul_assoc
namespace Mon_
/-- The trivial monoid object. We later show this is initial in `Mon_ C`.
-/
@[simps]
def trivial : Mon_ C where
X := 𝟙_ C
one := 𝟙 _
mul := (λ_ _).hom
mul_assoc := by coherence
mul_one := by coherence
#align Mon_.trivial Mon_.trivial
instance : Inhabited (Mon_ C) :=
⟨trivial C⟩
variable {C}
variable {M : Mon_ C}
@[simp]
theorem one_mul_hom {Z : C} (f : Z ⟶ M.X) : (M.one ⊗ f) ≫ M.mul = (λ_ Z).hom ≫ f := by
rw [← id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality]
#align Mon_.one_mul_hom Mon_.one_mul_hom
@[simp]
theorem mul_one_hom {Z : C} (f : Z ⟶ M.X) : (f ⊗ M.one) ≫ M.mul = (ρ_ Z).hom ≫ f := by
rw [← tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality]
#align Mon_.mul_one_hom Mon_.mul_one_hom
theorem assoc_flip :
(𝟙 M.X ⊗ M.mul) ≫ M.mul = (α_ M.X M.X M.X).inv ≫ (M.mul ⊗ 𝟙 M.X) ≫ M.mul := by simp
#align Mon_.assoc_flip Mon_.assoc_flip
/-- A morphism of monoid objects. -/
@[ext]
structure Hom (M N : Mon_ C) where
hom : M.X ⟶ N.X
one_hom : M.one ≫ hom = N.one := by aesop_cat
mul_hom : M.mul ≫ hom = (hom ⊗ hom) ≫ N.mul := by aesop_cat
#align Mon_.hom Mon_.Hom
attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom
/-- The identity morphism on a monoid object. -/
@[simps]
def id (M : Mon_ C) : Hom M M where
hom := 𝟙 M.X
#align Mon_.id Mon_.id
instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) :=
⟨id M⟩
#align Mon_.hom_inhabited Mon_.homInhabited
/-- Composition of morphisms of monoid objects. -/
@[simps]
def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where
hom := f.hom ≫ g.hom
#align Mon_.comp Mon_.comp
instance : Category (Mon_ C) where
Hom M N := Hom M N
id := id
comp f g := comp f g
-- Porting note: added, as `Hom.ext` does not apply to a morphism.
@[ext]
lemma ext {X Y : Mon_ C} {f g : X ⟶ Y} (w : f.hom = g.hom) : f = g :=
Hom.ext _ _ w
@[simp]
theorem id_hom' (M : Mon_ C) : (𝟙 M : Hom M M).hom = 𝟙 M.X :=
rfl
#align Mon_.id_hom' Mon_.id_hom'
@[simp]
theorem comp_hom' {M N K : Mon_ C} (f : M ⟶ N) (g : N ⟶ K) :
(f ≫ g : Hom M K).hom = f.hom ≫ g.hom :=
rfl
#align Mon_.comp_hom' Mon_.comp_hom'
section
variable (C)
/-- The forgetful functor from monoid objects to the ambient category. -/
@[simps]
def forget : Mon_ C ⥤ C where
obj A := A.X
map f := f.hom
#align Mon_.forget Mon_.forget
end
instance forget_faithful : Faithful (@forget C _ _) where
#align Mon_.forget_faithful Mon_.forget_faithful
instance {A B : Mon_ C} (f : A ⟶ B) [e : IsIso ((forget C).map f)] : IsIso f.hom :=
e
/-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/
instance : ReflectsIsomorphisms (forget C) where
reflects f e :=
⟨⟨{ hom := inv f.hom
mul_hom := by
simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, ← tensor_comp_assoc,
IsIso.inv_hom_id, tensor_id, Category.id_comp] },
by aesop_cat⟩⟩
/-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X ≅ N.X) (one_f : M.one ≫ f.hom = N.one)
(mul_f : M.mul ≫ f.hom = (f.hom ⊗ f.hom) ≫ N.mul) : M ≅ N where
hom :=
{ hom := f.hom
one_hom := one_f
mul_hom := mul_f }
inv :=
{ hom := f.inv
one_hom := by rw [← one_f]; simp
mul_hom := by
rw [← cancel_mono f.hom]
slice_rhs 2 3 => rw [mul_f]
simp }
#align Mon_.iso_of_iso Mon_.isoOfIso
instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C ⟶ A) where
default :=
{ hom := A.one
one_hom := by dsimp; simp
mul_hom := by dsimp; simp [A.one_mul, unitors_equal] }
uniq f := by
ext; simp
rw [← Category.id_comp f.hom]
erw [f.one_hom]
#align Mon_.unique_hom_from_trivial Mon_.uniqueHomFromTrivial
open CategoryTheory.Limits
instance : HasInitial (Mon_ C) :=
hasInitial_of_unique (trivial C)
end Mon_
namespace CategoryTheory.LaxMonoidalFunctor
variable {C} {D : Type u₂} [Category.{v₂} D] [MonoidalCategory.{v₂} D]
-- TODO: mapMod F A : Mod A ⥤ Mod (F.mapMon A)
/-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one]
rw [F.toFunctor.map_id]
rw [F.right_unitality]
mul_assoc := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_assoc]
conv_lhs => rw [F.toFunctor.map_id]
conv_lhs => rw [F.toFunctor.map_comp, F.toFunctor.map_comp]
conv_rhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_rhs 3 4 => rw [F.μ_natural]
conv_rhs => rw [F.toFunctor.map_id]
slice_rhs 1 3 => rw [← F.associativity]
simp only [Category.assoc] }
map f :=
{ hom := F.map f.hom
one_hom := by dsimp; rw [Category.assoc, ← F.toFunctor.map_comp, f.one_hom]
mul_hom := by
dsimp
rw [Category.assoc, F.μ_natural_assoc, ← F.toFunctor.map_comp, ← F.toFunctor.map_comp,
f.mul_hom] }
map_id A := by ext; simp
map_comp f g := by ext; simp
#align category_theory.lax_monoidal_functor.map_Mon CategoryTheory.LaxMonoidalFunctor.mapMon
variable (C D)
/-- `mapMon` is functorial in the lax monoidal functor. -/
@[simps] -- Porting note: added this, not sure how it worked previously without.
def mapMonFunctor : LaxMonoidalFunctor C D ⥤ Mon_ C ⥤ Mon_ D where
obj := mapMon
map α := { app := fun A => { hom := α.app A.X } }
#align category_theory.lax_monoidal_functor.map_Mon_functor CategoryTheory.LaxMonoidalFunctor.mapMonFunctor
end CategoryTheory.LaxMonoidalFunctor
namespace Mon_
open CategoryTheory.LaxMonoidalFunctor
namespace EquivLaxMonoidalFunctorPUnit
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps]
def laxMonoidalToMon : LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C ⥤ Mon_ C where
obj F := (F.mapMon : Mon_ _ ⥤ Mon_ C).obj (trivial (Discrete PUnit))
map α := ((mapMonFunctor (Discrete PUnit) C).map α).app _
#align Mon_.equiv_lax_monoidal_functor_punit.lax_monoidal_to_Mon Mon_.EquivLaxMonoidalFunctorPUnit.laxMonoidalToMon
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps]
def monToLaxMonoidal : Mon_ C ⥤ LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C where
obj A :=
{ obj := fun _ => A.X
map := fun _ => 𝟙 _
ε := A.one
μ := fun _ _ => A.mul
map_id := fun _ => rfl
map_comp := fun _ _ => (Category.id_comp (𝟙 A.X)).symm }
map f :=
{ app := fun _ => f.hom
naturality := fun _ _ _ => by dsimp; rw [Category.id_comp, Category.comp_id]
unit := f.one_hom
tensor := fun _ _ => f.mul_hom }
#align Mon_.equiv_lax_monoidal_functor_punit.Mon_to_lax_monoidal Mon_.EquivLaxMonoidalFunctorPUnit.monToLaxMonoidal
attribute [local aesop safe tactic (rule_sets [CategoryTheory])]
CategoryTheory.Discrete.discreteCases
attribute [local simp] eqToIso_map
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps!]
def unitIso :
𝟭 (LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C) ≅ laxMonoidalToMon C ⋙ monToLaxMonoidal C :=
NatIso.ofComponents
(fun F =>
MonoidalNatIso.ofComponents (fun _ => F.toFunctor.mapIso (eqToIso (by ext))) (by aesop_cat)
(by aesop_cat) (by aesop_cat))
(by aesop_cat)
#align Mon_.equiv_lax_monoidal_functor_punit.unit_iso Mon_.EquivLaxMonoidalFunctorPUnit.unitIso
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps!]
def counitIso : monToLaxMonoidal C ⋙ laxMonoidalToMon C ≅ 𝟭 (Mon_ C) :=
NatIso.ofComponents
(fun F =>
{ hom := { hom := 𝟙 _ }
inv := { hom := 𝟙 _ } })
(by aesop_cat)
#align Mon_.equiv_lax_monoidal_functor_punit.counit_iso Mon_.EquivLaxMonoidalFunctorPUnit.counitIso
end EquivLaxMonoidalFunctorPUnit
open EquivLaxMonoidalFunctorPUnit
attribute [local simp] eqToIso_map
/--
Monoid objects in `C` are "just" lax monoidal functors from the trivial monoidal category to `C`.
-/
@[simps]
def equivLaxMonoidalFunctorPUnit : LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C ≌ Mon_ C where
functor := laxMonoidalToMon C
inverse := monToLaxMonoidal C
unitIso := unitIso C
counitIso := counitIso C
#align Mon_.equiv_lax_monoidal_functor_punit Mon_.equivLaxMonoidalFunctorPUnit
end Mon_
namespace Mon_
/-!
In this section, we prove that the category of monoids in a braided monoidal category is monoidal.
Given two monoids `M` and `N` in a braided monoidal category `C`,
the multiplication on the tensor product `M.X ⊗ N.X` is defined in the obvious way:
it is the tensor product of the multiplications on `M` and `N`,
except that the tensor factors in the source come in the wrong order,
which we fix by pre-composing with a permutation isomorphism constructed from the braiding.
(There is a subtlety here: in fact there are two ways to do these,
using either the positive or negative crossing.)
A more conceptual way of understanding this definition is the following:
The braiding on `C` gives rise to a monoidal structure on
the tensor product functor from `C × C` to `C`.
A pair of monoids in `C` gives rise to a monoid in `C × C`,
which the tensor product functor by being monoidal takes to a monoid in `C`.
The permutation isomorphism appearing in the definition of
the multiplication on the tensor product of two monoids is
an instance of a more general family of isomorphisms
which together form a strength that equips the tensor product functor with a monoidal structure,
and the monoid axioms for the tensor product follow from the monoid axioms for the tensor factors
plus the properties of the strength (i.e., monoidal functor axioms).
The strength `tensor_μ` of the tensor product functor has been defined in
`Mathlib.CategoryTheory.Monoidal.Braided`.
Its properties, stated as independent lemmas in that module,
are used extensively in the proofs below.
Notice that we could have followed the above plan not only conceptually
but also as a possible implementation and
could have constructed the tensor product of monoids via `mapMon`,
but we chose to give a more explicit definition directly in terms of `tensor_μ`.
To complete the definition of the monoidal category structure on the category of monoids,
we need to provide definitions of associator and unitors.
The obvious candidates are the associator and unitors from `C`,
but we need to prove that they are monoid morphisms, i.e., compatible with unit and multiplication.
These properties translate to the monoidality of the associator and unitors
(with respect to the monoidal structures on the functors they relate),
which have also been proved in `Mathlib.CategoryTheory.Monoidal.Braided`.
-/
variable {C}
-- The proofs that associators and unitors preserve monoid units don't require braiding.
theorem one_associator {M N P : Mon_ C} :
((λ_ (𝟙_ C)).inv ≫ ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) ⊗ P.one)) ≫ (α_ M.X N.X P.X).hom =
(λ_ (𝟙_ C)).inv ≫ (M.one ⊗ (λ_ (𝟙_ C)).inv ≫ (N.one ⊗ P.one)) := by
simp only [Category.assoc, Iso.cancel_iso_inv_left]
slice_lhs 1 3 => rw [← Category.id_comp P.one, tensor_comp]
slice_lhs 2 3 => rw [associator_naturality]
slice_rhs 1 2 => | rw [← Category.id_comp M.one, tensor_comp] | theorem one_associator {M N P : Mon_ C} :
((λ_ (𝟙_ C)).inv ≫ ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) ⊗ P.one)) ≫ (α_ M.X N.X P.X).hom =
(λ_ (𝟙_ C)).inv ≫ (M.one ⊗ (λ_ (𝟙_ C)).inv ≫ (N.one ⊗ P.one)) := by
simp only [Category.assoc, Iso.cancel_iso_inv_left]
slice_lhs 1 3 => rw [← Category.id_comp P.one, tensor_comp]
slice_lhs 2 3 => rw [associator_naturality]
slice_rhs 1 2 => | Mathlib.CategoryTheory.Monoidal.Mon_.380_0.NTUMzhXPwXsmsYt | theorem one_associator {M N P : Mon_ C} :
((λ_ (𝟙_ C)).inv ≫ ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) ⊗ P.one)) ≫ (α_ M.X N.X P.X).hom =
(λ_ (𝟙_ C)).inv ≫ (M.one ⊗ (λ_ (𝟙_ C)).inv ≫ (N.one ⊗ P.one)) | Mathlib_CategoryTheory_Monoidal_Mon_ |
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : MonoidalCategory C
M N P : Mon_ C
| M.one ⊗ (λ_ (𝟙_ C)).inv ≫ (N.one ⊗ P.one) | /-
Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/
import Mathlib.CategoryTheory.Monoidal.Braided
import Mathlib.CategoryTheory.Monoidal.Discrete
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
import Mathlib.Algebra.PUnitInstances
#align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c"
/-!
# The category of monoids in a monoidal category.
We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to
the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if
`C` is braided, then the category of monoids is naturally monoidal.
-/
set_option linter.uppercaseLean3 false
universe v₁ v₂ u₁ u₂ u
open CategoryTheory MonoidalCategory
variable (C : Type u₁) [Category.{v₁} C] [MonoidalCategory.{v₁} C]
/-- A monoid object internal to a monoidal category.
When the monoidal category is preadditive, this is also sometimes called an "algebra object".
-/
structure Mon_ where
X : C
one : 𝟙_ C ⟶ X
mul : X ⊗ X ⟶ X
one_mul : (one ⊗ 𝟙 X) ≫ mul = (λ_ X).hom := by aesop_cat
mul_one : (𝟙 X ⊗ one) ≫ mul = (ρ_ X).hom := by aesop_cat
-- Obviously there is some flexibility stating this axiom.
-- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`,
-- and chooses to place the associator on the right-hand side.
-- The heuristic is that unitors and associators "don't have much weight".
mul_assoc : (mul ⊗ 𝟙 X) ≫ mul = (α_ X X X).hom ≫ (𝟙 X ⊗ mul) ≫ mul := by aesop_cat
#align Mon_ Mon_
attribute [reassoc] Mon_.one_mul Mon_.mul_one
-- We prove a more general `@[simp]` lemma below.
attribute [reassoc (attr := simp)] Mon_.mul_assoc
namespace Mon_
/-- The trivial monoid object. We later show this is initial in `Mon_ C`.
-/
@[simps]
def trivial : Mon_ C where
X := 𝟙_ C
one := 𝟙 _
mul := (λ_ _).hom
mul_assoc := by coherence
mul_one := by coherence
#align Mon_.trivial Mon_.trivial
instance : Inhabited (Mon_ C) :=
⟨trivial C⟩
variable {C}
variable {M : Mon_ C}
@[simp]
theorem one_mul_hom {Z : C} (f : Z ⟶ M.X) : (M.one ⊗ f) ≫ M.mul = (λ_ Z).hom ≫ f := by
rw [← id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality]
#align Mon_.one_mul_hom Mon_.one_mul_hom
@[simp]
theorem mul_one_hom {Z : C} (f : Z ⟶ M.X) : (f ⊗ M.one) ≫ M.mul = (ρ_ Z).hom ≫ f := by
rw [← tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality]
#align Mon_.mul_one_hom Mon_.mul_one_hom
theorem assoc_flip :
(𝟙 M.X ⊗ M.mul) ≫ M.mul = (α_ M.X M.X M.X).inv ≫ (M.mul ⊗ 𝟙 M.X) ≫ M.mul := by simp
#align Mon_.assoc_flip Mon_.assoc_flip
/-- A morphism of monoid objects. -/
@[ext]
structure Hom (M N : Mon_ C) where
hom : M.X ⟶ N.X
one_hom : M.one ≫ hom = N.one := by aesop_cat
mul_hom : M.mul ≫ hom = (hom ⊗ hom) ≫ N.mul := by aesop_cat
#align Mon_.hom Mon_.Hom
attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom
/-- The identity morphism on a monoid object. -/
@[simps]
def id (M : Mon_ C) : Hom M M where
hom := 𝟙 M.X
#align Mon_.id Mon_.id
instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) :=
⟨id M⟩
#align Mon_.hom_inhabited Mon_.homInhabited
/-- Composition of morphisms of monoid objects. -/
@[simps]
def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where
hom := f.hom ≫ g.hom
#align Mon_.comp Mon_.comp
instance : Category (Mon_ C) where
Hom M N := Hom M N
id := id
comp f g := comp f g
-- Porting note: added, as `Hom.ext` does not apply to a morphism.
@[ext]
lemma ext {X Y : Mon_ C} {f g : X ⟶ Y} (w : f.hom = g.hom) : f = g :=
Hom.ext _ _ w
@[simp]
theorem id_hom' (M : Mon_ C) : (𝟙 M : Hom M M).hom = 𝟙 M.X :=
rfl
#align Mon_.id_hom' Mon_.id_hom'
@[simp]
theorem comp_hom' {M N K : Mon_ C} (f : M ⟶ N) (g : N ⟶ K) :
(f ≫ g : Hom M K).hom = f.hom ≫ g.hom :=
rfl
#align Mon_.comp_hom' Mon_.comp_hom'
section
variable (C)
/-- The forgetful functor from monoid objects to the ambient category. -/
@[simps]
def forget : Mon_ C ⥤ C where
obj A := A.X
map f := f.hom
#align Mon_.forget Mon_.forget
end
instance forget_faithful : Faithful (@forget C _ _) where
#align Mon_.forget_faithful Mon_.forget_faithful
instance {A B : Mon_ C} (f : A ⟶ B) [e : IsIso ((forget C).map f)] : IsIso f.hom :=
e
/-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/
instance : ReflectsIsomorphisms (forget C) where
reflects f e :=
⟨⟨{ hom := inv f.hom
mul_hom := by
simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, ← tensor_comp_assoc,
IsIso.inv_hom_id, tensor_id, Category.id_comp] },
by aesop_cat⟩⟩
/-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X ≅ N.X) (one_f : M.one ≫ f.hom = N.one)
(mul_f : M.mul ≫ f.hom = (f.hom ⊗ f.hom) ≫ N.mul) : M ≅ N where
hom :=
{ hom := f.hom
one_hom := one_f
mul_hom := mul_f }
inv :=
{ hom := f.inv
one_hom := by rw [← one_f]; simp
mul_hom := by
rw [← cancel_mono f.hom]
slice_rhs 2 3 => rw [mul_f]
simp }
#align Mon_.iso_of_iso Mon_.isoOfIso
instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C ⟶ A) where
default :=
{ hom := A.one
one_hom := by dsimp; simp
mul_hom := by dsimp; simp [A.one_mul, unitors_equal] }
uniq f := by
ext; simp
rw [← Category.id_comp f.hom]
erw [f.one_hom]
#align Mon_.unique_hom_from_trivial Mon_.uniqueHomFromTrivial
open CategoryTheory.Limits
instance : HasInitial (Mon_ C) :=
hasInitial_of_unique (trivial C)
end Mon_
namespace CategoryTheory.LaxMonoidalFunctor
variable {C} {D : Type u₂} [Category.{v₂} D] [MonoidalCategory.{v₂} D]
-- TODO: mapMod F A : Mod A ⥤ Mod (F.mapMon A)
/-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one]
rw [F.toFunctor.map_id]
rw [F.right_unitality]
mul_assoc := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_assoc]
conv_lhs => rw [F.toFunctor.map_id]
conv_lhs => rw [F.toFunctor.map_comp, F.toFunctor.map_comp]
conv_rhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_rhs 3 4 => rw [F.μ_natural]
conv_rhs => rw [F.toFunctor.map_id]
slice_rhs 1 3 => rw [← F.associativity]
simp only [Category.assoc] }
map f :=
{ hom := F.map f.hom
one_hom := by dsimp; rw [Category.assoc, ← F.toFunctor.map_comp, f.one_hom]
mul_hom := by
dsimp
rw [Category.assoc, F.μ_natural_assoc, ← F.toFunctor.map_comp, ← F.toFunctor.map_comp,
f.mul_hom] }
map_id A := by ext; simp
map_comp f g := by ext; simp
#align category_theory.lax_monoidal_functor.map_Mon CategoryTheory.LaxMonoidalFunctor.mapMon
variable (C D)
/-- `mapMon` is functorial in the lax monoidal functor. -/
@[simps] -- Porting note: added this, not sure how it worked previously without.
def mapMonFunctor : LaxMonoidalFunctor C D ⥤ Mon_ C ⥤ Mon_ D where
obj := mapMon
map α := { app := fun A => { hom := α.app A.X } }
#align category_theory.lax_monoidal_functor.map_Mon_functor CategoryTheory.LaxMonoidalFunctor.mapMonFunctor
end CategoryTheory.LaxMonoidalFunctor
namespace Mon_
open CategoryTheory.LaxMonoidalFunctor
namespace EquivLaxMonoidalFunctorPUnit
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps]
def laxMonoidalToMon : LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C ⥤ Mon_ C where
obj F := (F.mapMon : Mon_ _ ⥤ Mon_ C).obj (trivial (Discrete PUnit))
map α := ((mapMonFunctor (Discrete PUnit) C).map α).app _
#align Mon_.equiv_lax_monoidal_functor_punit.lax_monoidal_to_Mon Mon_.EquivLaxMonoidalFunctorPUnit.laxMonoidalToMon
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps]
def monToLaxMonoidal : Mon_ C ⥤ LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C where
obj A :=
{ obj := fun _ => A.X
map := fun _ => 𝟙 _
ε := A.one
μ := fun _ _ => A.mul
map_id := fun _ => rfl
map_comp := fun _ _ => (Category.id_comp (𝟙 A.X)).symm }
map f :=
{ app := fun _ => f.hom
naturality := fun _ _ _ => by dsimp; rw [Category.id_comp, Category.comp_id]
unit := f.one_hom
tensor := fun _ _ => f.mul_hom }
#align Mon_.equiv_lax_monoidal_functor_punit.Mon_to_lax_monoidal Mon_.EquivLaxMonoidalFunctorPUnit.monToLaxMonoidal
attribute [local aesop safe tactic (rule_sets [CategoryTheory])]
CategoryTheory.Discrete.discreteCases
attribute [local simp] eqToIso_map
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps!]
def unitIso :
𝟭 (LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C) ≅ laxMonoidalToMon C ⋙ monToLaxMonoidal C :=
NatIso.ofComponents
(fun F =>
MonoidalNatIso.ofComponents (fun _ => F.toFunctor.mapIso (eqToIso (by ext))) (by aesop_cat)
(by aesop_cat) (by aesop_cat))
(by aesop_cat)
#align Mon_.equiv_lax_monoidal_functor_punit.unit_iso Mon_.EquivLaxMonoidalFunctorPUnit.unitIso
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps!]
def counitIso : monToLaxMonoidal C ⋙ laxMonoidalToMon C ≅ 𝟭 (Mon_ C) :=
NatIso.ofComponents
(fun F =>
{ hom := { hom := 𝟙 _ }
inv := { hom := 𝟙 _ } })
(by aesop_cat)
#align Mon_.equiv_lax_monoidal_functor_punit.counit_iso Mon_.EquivLaxMonoidalFunctorPUnit.counitIso
end EquivLaxMonoidalFunctorPUnit
open EquivLaxMonoidalFunctorPUnit
attribute [local simp] eqToIso_map
/--
Monoid objects in `C` are "just" lax monoidal functors from the trivial monoidal category to `C`.
-/
@[simps]
def equivLaxMonoidalFunctorPUnit : LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C ≌ Mon_ C where
functor := laxMonoidalToMon C
inverse := monToLaxMonoidal C
unitIso := unitIso C
counitIso := counitIso C
#align Mon_.equiv_lax_monoidal_functor_punit Mon_.equivLaxMonoidalFunctorPUnit
end Mon_
namespace Mon_
/-!
In this section, we prove that the category of monoids in a braided monoidal category is monoidal.
Given two monoids `M` and `N` in a braided monoidal category `C`,
the multiplication on the tensor product `M.X ⊗ N.X` is defined in the obvious way:
it is the tensor product of the multiplications on `M` and `N`,
except that the tensor factors in the source come in the wrong order,
which we fix by pre-composing with a permutation isomorphism constructed from the braiding.
(There is a subtlety here: in fact there are two ways to do these,
using either the positive or negative crossing.)
A more conceptual way of understanding this definition is the following:
The braiding on `C` gives rise to a monoidal structure on
the tensor product functor from `C × C` to `C`.
A pair of monoids in `C` gives rise to a monoid in `C × C`,
which the tensor product functor by being monoidal takes to a monoid in `C`.
The permutation isomorphism appearing in the definition of
the multiplication on the tensor product of two monoids is
an instance of a more general family of isomorphisms
which together form a strength that equips the tensor product functor with a monoidal structure,
and the monoid axioms for the tensor product follow from the monoid axioms for the tensor factors
plus the properties of the strength (i.e., monoidal functor axioms).
The strength `tensor_μ` of the tensor product functor has been defined in
`Mathlib.CategoryTheory.Monoidal.Braided`.
Its properties, stated as independent lemmas in that module,
are used extensively in the proofs below.
Notice that we could have followed the above plan not only conceptually
but also as a possible implementation and
could have constructed the tensor product of monoids via `mapMon`,
but we chose to give a more explicit definition directly in terms of `tensor_μ`.
To complete the definition of the monoidal category structure on the category of monoids,
we need to provide definitions of associator and unitors.
The obvious candidates are the associator and unitors from `C`,
but we need to prove that they are monoid morphisms, i.e., compatible with unit and multiplication.
These properties translate to the monoidality of the associator and unitors
(with respect to the monoidal structures on the functors they relate),
which have also been proved in `Mathlib.CategoryTheory.Monoidal.Braided`.
-/
variable {C}
-- The proofs that associators and unitors preserve monoid units don't require braiding.
theorem one_associator {M N P : Mon_ C} :
((λ_ (𝟙_ C)).inv ≫ ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) ⊗ P.one)) ≫ (α_ M.X N.X P.X).hom =
(λ_ (𝟙_ C)).inv ≫ (M.one ⊗ (λ_ (𝟙_ C)).inv ≫ (N.one ⊗ P.one)) := by
simp only [Category.assoc, Iso.cancel_iso_inv_left]
slice_lhs 1 3 => rw [← Category.id_comp P.one, tensor_comp]
slice_lhs 2 3 => rw [associator_naturality]
slice_rhs 1 2 => | rw [← Category.id_comp M.one, tensor_comp] | theorem one_associator {M N P : Mon_ C} :
((λ_ (𝟙_ C)).inv ≫ ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) ⊗ P.one)) ≫ (α_ M.X N.X P.X).hom =
(λ_ (𝟙_ C)).inv ≫ (M.one ⊗ (λ_ (𝟙_ C)).inv ≫ (N.one ⊗ P.one)) := by
simp only [Category.assoc, Iso.cancel_iso_inv_left]
slice_lhs 1 3 => rw [← Category.id_comp P.one, tensor_comp]
slice_lhs 2 3 => rw [associator_naturality]
slice_rhs 1 2 => | Mathlib.CategoryTheory.Monoidal.Mon_.380_0.NTUMzhXPwXsmsYt | theorem one_associator {M N P : Mon_ C} :
((λ_ (𝟙_ C)).inv ≫ ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) ⊗ P.one)) ≫ (α_ M.X N.X P.X).hom =
(λ_ (𝟙_ C)).inv ≫ (M.one ⊗ (λ_ (𝟙_ C)).inv ≫ (N.one ⊗ P.one)) | Mathlib_CategoryTheory_Monoidal_Mon_ |
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : MonoidalCategory C
M N P : Mon_ C
⊢ ((λ_ (𝟙_ C)).inv ⊗ 𝟙 (𝟙_ C)) ≫ (α_ (𝟙_ C) (𝟙_ C) (𝟙_ C)).hom ≫ (M.one ⊗ N.one ⊗ P.one) =
(𝟙 (𝟙_ C) ⊗ (λ_ (𝟙_ C)).inv) ≫ (M.one ⊗ N.one ⊗ P.one) | /-
Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/
import Mathlib.CategoryTheory.Monoidal.Braided
import Mathlib.CategoryTheory.Monoidal.Discrete
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
import Mathlib.Algebra.PUnitInstances
#align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c"
/-!
# The category of monoids in a monoidal category.
We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to
the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if
`C` is braided, then the category of monoids is naturally monoidal.
-/
set_option linter.uppercaseLean3 false
universe v₁ v₂ u₁ u₂ u
open CategoryTheory MonoidalCategory
variable (C : Type u₁) [Category.{v₁} C] [MonoidalCategory.{v₁} C]
/-- A monoid object internal to a monoidal category.
When the monoidal category is preadditive, this is also sometimes called an "algebra object".
-/
structure Mon_ where
X : C
one : 𝟙_ C ⟶ X
mul : X ⊗ X ⟶ X
one_mul : (one ⊗ 𝟙 X) ≫ mul = (λ_ X).hom := by aesop_cat
mul_one : (𝟙 X ⊗ one) ≫ mul = (ρ_ X).hom := by aesop_cat
-- Obviously there is some flexibility stating this axiom.
-- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`,
-- and chooses to place the associator on the right-hand side.
-- The heuristic is that unitors and associators "don't have much weight".
mul_assoc : (mul ⊗ 𝟙 X) ≫ mul = (α_ X X X).hom ≫ (𝟙 X ⊗ mul) ≫ mul := by aesop_cat
#align Mon_ Mon_
attribute [reassoc] Mon_.one_mul Mon_.mul_one
-- We prove a more general `@[simp]` lemma below.
attribute [reassoc (attr := simp)] Mon_.mul_assoc
namespace Mon_
/-- The trivial monoid object. We later show this is initial in `Mon_ C`.
-/
@[simps]
def trivial : Mon_ C where
X := 𝟙_ C
one := 𝟙 _
mul := (λ_ _).hom
mul_assoc := by coherence
mul_one := by coherence
#align Mon_.trivial Mon_.trivial
instance : Inhabited (Mon_ C) :=
⟨trivial C⟩
variable {C}
variable {M : Mon_ C}
@[simp]
theorem one_mul_hom {Z : C} (f : Z ⟶ M.X) : (M.one ⊗ f) ≫ M.mul = (λ_ Z).hom ≫ f := by
rw [← id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality]
#align Mon_.one_mul_hom Mon_.one_mul_hom
@[simp]
theorem mul_one_hom {Z : C} (f : Z ⟶ M.X) : (f ⊗ M.one) ≫ M.mul = (ρ_ Z).hom ≫ f := by
rw [← tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality]
#align Mon_.mul_one_hom Mon_.mul_one_hom
theorem assoc_flip :
(𝟙 M.X ⊗ M.mul) ≫ M.mul = (α_ M.X M.X M.X).inv ≫ (M.mul ⊗ 𝟙 M.X) ≫ M.mul := by simp
#align Mon_.assoc_flip Mon_.assoc_flip
/-- A morphism of monoid objects. -/
@[ext]
structure Hom (M N : Mon_ C) where
hom : M.X ⟶ N.X
one_hom : M.one ≫ hom = N.one := by aesop_cat
mul_hom : M.mul ≫ hom = (hom ⊗ hom) ≫ N.mul := by aesop_cat
#align Mon_.hom Mon_.Hom
attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom
/-- The identity morphism on a monoid object. -/
@[simps]
def id (M : Mon_ C) : Hom M M where
hom := 𝟙 M.X
#align Mon_.id Mon_.id
instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) :=
⟨id M⟩
#align Mon_.hom_inhabited Mon_.homInhabited
/-- Composition of morphisms of monoid objects. -/
@[simps]
def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where
hom := f.hom ≫ g.hom
#align Mon_.comp Mon_.comp
instance : Category (Mon_ C) where
Hom M N := Hom M N
id := id
comp f g := comp f g
-- Porting note: added, as `Hom.ext` does not apply to a morphism.
@[ext]
lemma ext {X Y : Mon_ C} {f g : X ⟶ Y} (w : f.hom = g.hom) : f = g :=
Hom.ext _ _ w
@[simp]
theorem id_hom' (M : Mon_ C) : (𝟙 M : Hom M M).hom = 𝟙 M.X :=
rfl
#align Mon_.id_hom' Mon_.id_hom'
@[simp]
theorem comp_hom' {M N K : Mon_ C} (f : M ⟶ N) (g : N ⟶ K) :
(f ≫ g : Hom M K).hom = f.hom ≫ g.hom :=
rfl
#align Mon_.comp_hom' Mon_.comp_hom'
section
variable (C)
/-- The forgetful functor from monoid objects to the ambient category. -/
@[simps]
def forget : Mon_ C ⥤ C where
obj A := A.X
map f := f.hom
#align Mon_.forget Mon_.forget
end
instance forget_faithful : Faithful (@forget C _ _) where
#align Mon_.forget_faithful Mon_.forget_faithful
instance {A B : Mon_ C} (f : A ⟶ B) [e : IsIso ((forget C).map f)] : IsIso f.hom :=
e
/-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/
instance : ReflectsIsomorphisms (forget C) where
reflects f e :=
⟨⟨{ hom := inv f.hom
mul_hom := by
simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, ← tensor_comp_assoc,
IsIso.inv_hom_id, tensor_id, Category.id_comp] },
by aesop_cat⟩⟩
/-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X ≅ N.X) (one_f : M.one ≫ f.hom = N.one)
(mul_f : M.mul ≫ f.hom = (f.hom ⊗ f.hom) ≫ N.mul) : M ≅ N where
hom :=
{ hom := f.hom
one_hom := one_f
mul_hom := mul_f }
inv :=
{ hom := f.inv
one_hom := by rw [← one_f]; simp
mul_hom := by
rw [← cancel_mono f.hom]
slice_rhs 2 3 => rw [mul_f]
simp }
#align Mon_.iso_of_iso Mon_.isoOfIso
instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C ⟶ A) where
default :=
{ hom := A.one
one_hom := by dsimp; simp
mul_hom := by dsimp; simp [A.one_mul, unitors_equal] }
uniq f := by
ext; simp
rw [← Category.id_comp f.hom]
erw [f.one_hom]
#align Mon_.unique_hom_from_trivial Mon_.uniqueHomFromTrivial
open CategoryTheory.Limits
instance : HasInitial (Mon_ C) :=
hasInitial_of_unique (trivial C)
end Mon_
namespace CategoryTheory.LaxMonoidalFunctor
variable {C} {D : Type u₂} [Category.{v₂} D] [MonoidalCategory.{v₂} D]
-- TODO: mapMod F A : Mod A ⥤ Mod (F.mapMon A)
/-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one]
rw [F.toFunctor.map_id]
rw [F.right_unitality]
mul_assoc := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_assoc]
conv_lhs => rw [F.toFunctor.map_id]
conv_lhs => rw [F.toFunctor.map_comp, F.toFunctor.map_comp]
conv_rhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_rhs 3 4 => rw [F.μ_natural]
conv_rhs => rw [F.toFunctor.map_id]
slice_rhs 1 3 => rw [← F.associativity]
simp only [Category.assoc] }
map f :=
{ hom := F.map f.hom
one_hom := by dsimp; rw [Category.assoc, ← F.toFunctor.map_comp, f.one_hom]
mul_hom := by
dsimp
rw [Category.assoc, F.μ_natural_assoc, ← F.toFunctor.map_comp, ← F.toFunctor.map_comp,
f.mul_hom] }
map_id A := by ext; simp
map_comp f g := by ext; simp
#align category_theory.lax_monoidal_functor.map_Mon CategoryTheory.LaxMonoidalFunctor.mapMon
variable (C D)
/-- `mapMon` is functorial in the lax monoidal functor. -/
@[simps] -- Porting note: added this, not sure how it worked previously without.
def mapMonFunctor : LaxMonoidalFunctor C D ⥤ Mon_ C ⥤ Mon_ D where
obj := mapMon
map α := { app := fun A => { hom := α.app A.X } }
#align category_theory.lax_monoidal_functor.map_Mon_functor CategoryTheory.LaxMonoidalFunctor.mapMonFunctor
end CategoryTheory.LaxMonoidalFunctor
namespace Mon_
open CategoryTheory.LaxMonoidalFunctor
namespace EquivLaxMonoidalFunctorPUnit
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps]
def laxMonoidalToMon : LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C ⥤ Mon_ C where
obj F := (F.mapMon : Mon_ _ ⥤ Mon_ C).obj (trivial (Discrete PUnit))
map α := ((mapMonFunctor (Discrete PUnit) C).map α).app _
#align Mon_.equiv_lax_monoidal_functor_punit.lax_monoidal_to_Mon Mon_.EquivLaxMonoidalFunctorPUnit.laxMonoidalToMon
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps]
def monToLaxMonoidal : Mon_ C ⥤ LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C where
obj A :=
{ obj := fun _ => A.X
map := fun _ => 𝟙 _
ε := A.one
μ := fun _ _ => A.mul
map_id := fun _ => rfl
map_comp := fun _ _ => (Category.id_comp (𝟙 A.X)).symm }
map f :=
{ app := fun _ => f.hom
naturality := fun _ _ _ => by dsimp; rw [Category.id_comp, Category.comp_id]
unit := f.one_hom
tensor := fun _ _ => f.mul_hom }
#align Mon_.equiv_lax_monoidal_functor_punit.Mon_to_lax_monoidal Mon_.EquivLaxMonoidalFunctorPUnit.monToLaxMonoidal
attribute [local aesop safe tactic (rule_sets [CategoryTheory])]
CategoryTheory.Discrete.discreteCases
attribute [local simp] eqToIso_map
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps!]
def unitIso :
𝟭 (LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C) ≅ laxMonoidalToMon C ⋙ monToLaxMonoidal C :=
NatIso.ofComponents
(fun F =>
MonoidalNatIso.ofComponents (fun _ => F.toFunctor.mapIso (eqToIso (by ext))) (by aesop_cat)
(by aesop_cat) (by aesop_cat))
(by aesop_cat)
#align Mon_.equiv_lax_monoidal_functor_punit.unit_iso Mon_.EquivLaxMonoidalFunctorPUnit.unitIso
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps!]
def counitIso : monToLaxMonoidal C ⋙ laxMonoidalToMon C ≅ 𝟭 (Mon_ C) :=
NatIso.ofComponents
(fun F =>
{ hom := { hom := 𝟙 _ }
inv := { hom := 𝟙 _ } })
(by aesop_cat)
#align Mon_.equiv_lax_monoidal_functor_punit.counit_iso Mon_.EquivLaxMonoidalFunctorPUnit.counitIso
end EquivLaxMonoidalFunctorPUnit
open EquivLaxMonoidalFunctorPUnit
attribute [local simp] eqToIso_map
/--
Monoid objects in `C` are "just" lax monoidal functors from the trivial monoidal category to `C`.
-/
@[simps]
def equivLaxMonoidalFunctorPUnit : LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C ≌ Mon_ C where
functor := laxMonoidalToMon C
inverse := monToLaxMonoidal C
unitIso := unitIso C
counitIso := counitIso C
#align Mon_.equiv_lax_monoidal_functor_punit Mon_.equivLaxMonoidalFunctorPUnit
end Mon_
namespace Mon_
/-!
In this section, we prove that the category of monoids in a braided monoidal category is monoidal.
Given two monoids `M` and `N` in a braided monoidal category `C`,
the multiplication on the tensor product `M.X ⊗ N.X` is defined in the obvious way:
it is the tensor product of the multiplications on `M` and `N`,
except that the tensor factors in the source come in the wrong order,
which we fix by pre-composing with a permutation isomorphism constructed from the braiding.
(There is a subtlety here: in fact there are two ways to do these,
using either the positive or negative crossing.)
A more conceptual way of understanding this definition is the following:
The braiding on `C` gives rise to a monoidal structure on
the tensor product functor from `C × C` to `C`.
A pair of monoids in `C` gives rise to a monoid in `C × C`,
which the tensor product functor by being monoidal takes to a monoid in `C`.
The permutation isomorphism appearing in the definition of
the multiplication on the tensor product of two monoids is
an instance of a more general family of isomorphisms
which together form a strength that equips the tensor product functor with a monoidal structure,
and the monoid axioms for the tensor product follow from the monoid axioms for the tensor factors
plus the properties of the strength (i.e., monoidal functor axioms).
The strength `tensor_μ` of the tensor product functor has been defined in
`Mathlib.CategoryTheory.Monoidal.Braided`.
Its properties, stated as independent lemmas in that module,
are used extensively in the proofs below.
Notice that we could have followed the above plan not only conceptually
but also as a possible implementation and
could have constructed the tensor product of monoids via `mapMon`,
but we chose to give a more explicit definition directly in terms of `tensor_μ`.
To complete the definition of the monoidal category structure on the category of monoids,
we need to provide definitions of associator and unitors.
The obvious candidates are the associator and unitors from `C`,
but we need to prove that they are monoid morphisms, i.e., compatible with unit and multiplication.
These properties translate to the monoidality of the associator and unitors
(with respect to the monoidal structures on the functors they relate),
which have also been proved in `Mathlib.CategoryTheory.Monoidal.Braided`.
-/
variable {C}
-- The proofs that associators and unitors preserve monoid units don't require braiding.
theorem one_associator {M N P : Mon_ C} :
((λ_ (𝟙_ C)).inv ≫ ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) ⊗ P.one)) ≫ (α_ M.X N.X P.X).hom =
(λ_ (𝟙_ C)).inv ≫ (M.one ⊗ (λ_ (𝟙_ C)).inv ≫ (N.one ⊗ P.one)) := by
simp only [Category.assoc, Iso.cancel_iso_inv_left]
slice_lhs 1 3 => rw [← Category.id_comp P.one, tensor_comp]
slice_lhs 2 3 => rw [associator_naturality]
slice_rhs 1 2 => rw [← Category.id_comp M.one, tensor_comp]
| slice_lhs 1 2 => rw [← leftUnitor_tensor_inv] | theorem one_associator {M N P : Mon_ C} :
((λ_ (𝟙_ C)).inv ≫ ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) ⊗ P.one)) ≫ (α_ M.X N.X P.X).hom =
(λ_ (𝟙_ C)).inv ≫ (M.one ⊗ (λ_ (𝟙_ C)).inv ≫ (N.one ⊗ P.one)) := by
simp only [Category.assoc, Iso.cancel_iso_inv_left]
slice_lhs 1 3 => rw [← Category.id_comp P.one, tensor_comp]
slice_lhs 2 3 => rw [associator_naturality]
slice_rhs 1 2 => rw [← Category.id_comp M.one, tensor_comp]
| Mathlib.CategoryTheory.Monoidal.Mon_.380_0.NTUMzhXPwXsmsYt | theorem one_associator {M N P : Mon_ C} :
((λ_ (𝟙_ C)).inv ≫ ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) ⊗ P.one)) ≫ (α_ M.X N.X P.X).hom =
(λ_ (𝟙_ C)).inv ≫ (M.one ⊗ (λ_ (𝟙_ C)).inv ≫ (N.one ⊗ P.one)) | Mathlib_CategoryTheory_Monoidal_Mon_ |
case a
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : MonoidalCategory C
M N P : Mon_ C
| ((λ_ (𝟙_ C)).inv ⊗ 𝟙 (𝟙_ C)) ≫ (α_ (𝟙_ C) (𝟙_ C) (𝟙_ C)).hom
case a C : Type u₁ inst✝¹ : Category.{v₁, u₁} C inst✝ : MonoidalCategory C M N P : Mon_ C | M.one ⊗ N.one ⊗ P.one | /-
Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/
import Mathlib.CategoryTheory.Monoidal.Braided
import Mathlib.CategoryTheory.Monoidal.Discrete
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
import Mathlib.Algebra.PUnitInstances
#align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c"
/-!
# The category of monoids in a monoidal category.
We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to
the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if
`C` is braided, then the category of monoids is naturally monoidal.
-/
set_option linter.uppercaseLean3 false
universe v₁ v₂ u₁ u₂ u
open CategoryTheory MonoidalCategory
variable (C : Type u₁) [Category.{v₁} C] [MonoidalCategory.{v₁} C]
/-- A monoid object internal to a monoidal category.
When the monoidal category is preadditive, this is also sometimes called an "algebra object".
-/
structure Mon_ where
X : C
one : 𝟙_ C ⟶ X
mul : X ⊗ X ⟶ X
one_mul : (one ⊗ 𝟙 X) ≫ mul = (λ_ X).hom := by aesop_cat
mul_one : (𝟙 X ⊗ one) ≫ mul = (ρ_ X).hom := by aesop_cat
-- Obviously there is some flexibility stating this axiom.
-- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`,
-- and chooses to place the associator on the right-hand side.
-- The heuristic is that unitors and associators "don't have much weight".
mul_assoc : (mul ⊗ 𝟙 X) ≫ mul = (α_ X X X).hom ≫ (𝟙 X ⊗ mul) ≫ mul := by aesop_cat
#align Mon_ Mon_
attribute [reassoc] Mon_.one_mul Mon_.mul_one
-- We prove a more general `@[simp]` lemma below.
attribute [reassoc (attr := simp)] Mon_.mul_assoc
namespace Mon_
/-- The trivial monoid object. We later show this is initial in `Mon_ C`.
-/
@[simps]
def trivial : Mon_ C where
X := 𝟙_ C
one := 𝟙 _
mul := (λ_ _).hom
mul_assoc := by coherence
mul_one := by coherence
#align Mon_.trivial Mon_.trivial
instance : Inhabited (Mon_ C) :=
⟨trivial C⟩
variable {C}
variable {M : Mon_ C}
@[simp]
theorem one_mul_hom {Z : C} (f : Z ⟶ M.X) : (M.one ⊗ f) ≫ M.mul = (λ_ Z).hom ≫ f := by
rw [← id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality]
#align Mon_.one_mul_hom Mon_.one_mul_hom
@[simp]
theorem mul_one_hom {Z : C} (f : Z ⟶ M.X) : (f ⊗ M.one) ≫ M.mul = (ρ_ Z).hom ≫ f := by
rw [← tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality]
#align Mon_.mul_one_hom Mon_.mul_one_hom
theorem assoc_flip :
(𝟙 M.X ⊗ M.mul) ≫ M.mul = (α_ M.X M.X M.X).inv ≫ (M.mul ⊗ 𝟙 M.X) ≫ M.mul := by simp
#align Mon_.assoc_flip Mon_.assoc_flip
/-- A morphism of monoid objects. -/
@[ext]
structure Hom (M N : Mon_ C) where
hom : M.X ⟶ N.X
one_hom : M.one ≫ hom = N.one := by aesop_cat
mul_hom : M.mul ≫ hom = (hom ⊗ hom) ≫ N.mul := by aesop_cat
#align Mon_.hom Mon_.Hom
attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom
/-- The identity morphism on a monoid object. -/
@[simps]
def id (M : Mon_ C) : Hom M M where
hom := 𝟙 M.X
#align Mon_.id Mon_.id
instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) :=
⟨id M⟩
#align Mon_.hom_inhabited Mon_.homInhabited
/-- Composition of morphisms of monoid objects. -/
@[simps]
def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where
hom := f.hom ≫ g.hom
#align Mon_.comp Mon_.comp
instance : Category (Mon_ C) where
Hom M N := Hom M N
id := id
comp f g := comp f g
-- Porting note: added, as `Hom.ext` does not apply to a morphism.
@[ext]
lemma ext {X Y : Mon_ C} {f g : X ⟶ Y} (w : f.hom = g.hom) : f = g :=
Hom.ext _ _ w
@[simp]
theorem id_hom' (M : Mon_ C) : (𝟙 M : Hom M M).hom = 𝟙 M.X :=
rfl
#align Mon_.id_hom' Mon_.id_hom'
@[simp]
theorem comp_hom' {M N K : Mon_ C} (f : M ⟶ N) (g : N ⟶ K) :
(f ≫ g : Hom M K).hom = f.hom ≫ g.hom :=
rfl
#align Mon_.comp_hom' Mon_.comp_hom'
section
variable (C)
/-- The forgetful functor from monoid objects to the ambient category. -/
@[simps]
def forget : Mon_ C ⥤ C where
obj A := A.X
map f := f.hom
#align Mon_.forget Mon_.forget
end
instance forget_faithful : Faithful (@forget C _ _) where
#align Mon_.forget_faithful Mon_.forget_faithful
instance {A B : Mon_ C} (f : A ⟶ B) [e : IsIso ((forget C).map f)] : IsIso f.hom :=
e
/-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/
instance : ReflectsIsomorphisms (forget C) where
reflects f e :=
⟨⟨{ hom := inv f.hom
mul_hom := by
simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, ← tensor_comp_assoc,
IsIso.inv_hom_id, tensor_id, Category.id_comp] },
by aesop_cat⟩⟩
/-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X ≅ N.X) (one_f : M.one ≫ f.hom = N.one)
(mul_f : M.mul ≫ f.hom = (f.hom ⊗ f.hom) ≫ N.mul) : M ≅ N where
hom :=
{ hom := f.hom
one_hom := one_f
mul_hom := mul_f }
inv :=
{ hom := f.inv
one_hom := by rw [← one_f]; simp
mul_hom := by
rw [← cancel_mono f.hom]
slice_rhs 2 3 => rw [mul_f]
simp }
#align Mon_.iso_of_iso Mon_.isoOfIso
instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C ⟶ A) where
default :=
{ hom := A.one
one_hom := by dsimp; simp
mul_hom := by dsimp; simp [A.one_mul, unitors_equal] }
uniq f := by
ext; simp
rw [← Category.id_comp f.hom]
erw [f.one_hom]
#align Mon_.unique_hom_from_trivial Mon_.uniqueHomFromTrivial
open CategoryTheory.Limits
instance : HasInitial (Mon_ C) :=
hasInitial_of_unique (trivial C)
end Mon_
namespace CategoryTheory.LaxMonoidalFunctor
variable {C} {D : Type u₂} [Category.{v₂} D] [MonoidalCategory.{v₂} D]
-- TODO: mapMod F A : Mod A ⥤ Mod (F.mapMon A)
/-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one]
rw [F.toFunctor.map_id]
rw [F.right_unitality]
mul_assoc := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_assoc]
conv_lhs => rw [F.toFunctor.map_id]
conv_lhs => rw [F.toFunctor.map_comp, F.toFunctor.map_comp]
conv_rhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_rhs 3 4 => rw [F.μ_natural]
conv_rhs => rw [F.toFunctor.map_id]
slice_rhs 1 3 => rw [← F.associativity]
simp only [Category.assoc] }
map f :=
{ hom := F.map f.hom
one_hom := by dsimp; rw [Category.assoc, ← F.toFunctor.map_comp, f.one_hom]
mul_hom := by
dsimp
rw [Category.assoc, F.μ_natural_assoc, ← F.toFunctor.map_comp, ← F.toFunctor.map_comp,
f.mul_hom] }
map_id A := by ext; simp
map_comp f g := by ext; simp
#align category_theory.lax_monoidal_functor.map_Mon CategoryTheory.LaxMonoidalFunctor.mapMon
variable (C D)
/-- `mapMon` is functorial in the lax monoidal functor. -/
@[simps] -- Porting note: added this, not sure how it worked previously without.
def mapMonFunctor : LaxMonoidalFunctor C D ⥤ Mon_ C ⥤ Mon_ D where
obj := mapMon
map α := { app := fun A => { hom := α.app A.X } }
#align category_theory.lax_monoidal_functor.map_Mon_functor CategoryTheory.LaxMonoidalFunctor.mapMonFunctor
end CategoryTheory.LaxMonoidalFunctor
namespace Mon_
open CategoryTheory.LaxMonoidalFunctor
namespace EquivLaxMonoidalFunctorPUnit
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps]
def laxMonoidalToMon : LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C ⥤ Mon_ C where
obj F := (F.mapMon : Mon_ _ ⥤ Mon_ C).obj (trivial (Discrete PUnit))
map α := ((mapMonFunctor (Discrete PUnit) C).map α).app _
#align Mon_.equiv_lax_monoidal_functor_punit.lax_monoidal_to_Mon Mon_.EquivLaxMonoidalFunctorPUnit.laxMonoidalToMon
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps]
def monToLaxMonoidal : Mon_ C ⥤ LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C where
obj A :=
{ obj := fun _ => A.X
map := fun _ => 𝟙 _
ε := A.one
μ := fun _ _ => A.mul
map_id := fun _ => rfl
map_comp := fun _ _ => (Category.id_comp (𝟙 A.X)).symm }
map f :=
{ app := fun _ => f.hom
naturality := fun _ _ _ => by dsimp; rw [Category.id_comp, Category.comp_id]
unit := f.one_hom
tensor := fun _ _ => f.mul_hom }
#align Mon_.equiv_lax_monoidal_functor_punit.Mon_to_lax_monoidal Mon_.EquivLaxMonoidalFunctorPUnit.monToLaxMonoidal
attribute [local aesop safe tactic (rule_sets [CategoryTheory])]
CategoryTheory.Discrete.discreteCases
attribute [local simp] eqToIso_map
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps!]
def unitIso :
𝟭 (LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C) ≅ laxMonoidalToMon C ⋙ monToLaxMonoidal C :=
NatIso.ofComponents
(fun F =>
MonoidalNatIso.ofComponents (fun _ => F.toFunctor.mapIso (eqToIso (by ext))) (by aesop_cat)
(by aesop_cat) (by aesop_cat))
(by aesop_cat)
#align Mon_.equiv_lax_monoidal_functor_punit.unit_iso Mon_.EquivLaxMonoidalFunctorPUnit.unitIso
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps!]
def counitIso : monToLaxMonoidal C ⋙ laxMonoidalToMon C ≅ 𝟭 (Mon_ C) :=
NatIso.ofComponents
(fun F =>
{ hom := { hom := 𝟙 _ }
inv := { hom := 𝟙 _ } })
(by aesop_cat)
#align Mon_.equiv_lax_monoidal_functor_punit.counit_iso Mon_.EquivLaxMonoidalFunctorPUnit.counitIso
end EquivLaxMonoidalFunctorPUnit
open EquivLaxMonoidalFunctorPUnit
attribute [local simp] eqToIso_map
/--
Monoid objects in `C` are "just" lax monoidal functors from the trivial monoidal category to `C`.
-/
@[simps]
def equivLaxMonoidalFunctorPUnit : LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C ≌ Mon_ C where
functor := laxMonoidalToMon C
inverse := monToLaxMonoidal C
unitIso := unitIso C
counitIso := counitIso C
#align Mon_.equiv_lax_monoidal_functor_punit Mon_.equivLaxMonoidalFunctorPUnit
end Mon_
namespace Mon_
/-!
In this section, we prove that the category of monoids in a braided monoidal category is monoidal.
Given two monoids `M` and `N` in a braided monoidal category `C`,
the multiplication on the tensor product `M.X ⊗ N.X` is defined in the obvious way:
it is the tensor product of the multiplications on `M` and `N`,
except that the tensor factors in the source come in the wrong order,
which we fix by pre-composing with a permutation isomorphism constructed from the braiding.
(There is a subtlety here: in fact there are two ways to do these,
using either the positive or negative crossing.)
A more conceptual way of understanding this definition is the following:
The braiding on `C` gives rise to a monoidal structure on
the tensor product functor from `C × C` to `C`.
A pair of monoids in `C` gives rise to a monoid in `C × C`,
which the tensor product functor by being monoidal takes to a monoid in `C`.
The permutation isomorphism appearing in the definition of
the multiplication on the tensor product of two monoids is
an instance of a more general family of isomorphisms
which together form a strength that equips the tensor product functor with a monoidal structure,
and the monoid axioms for the tensor product follow from the monoid axioms for the tensor factors
plus the properties of the strength (i.e., monoidal functor axioms).
The strength `tensor_μ` of the tensor product functor has been defined in
`Mathlib.CategoryTheory.Monoidal.Braided`.
Its properties, stated as independent lemmas in that module,
are used extensively in the proofs below.
Notice that we could have followed the above plan not only conceptually
but also as a possible implementation and
could have constructed the tensor product of monoids via `mapMon`,
but we chose to give a more explicit definition directly in terms of `tensor_μ`.
To complete the definition of the monoidal category structure on the category of monoids,
we need to provide definitions of associator and unitors.
The obvious candidates are the associator and unitors from `C`,
but we need to prove that they are monoid morphisms, i.e., compatible with unit and multiplication.
These properties translate to the monoidality of the associator and unitors
(with respect to the monoidal structures on the functors they relate),
which have also been proved in `Mathlib.CategoryTheory.Monoidal.Braided`.
-/
variable {C}
-- The proofs that associators and unitors preserve monoid units don't require braiding.
theorem one_associator {M N P : Mon_ C} :
((λ_ (𝟙_ C)).inv ≫ ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) ⊗ P.one)) ≫ (α_ M.X N.X P.X).hom =
(λ_ (𝟙_ C)).inv ≫ (M.one ⊗ (λ_ (𝟙_ C)).inv ≫ (N.one ⊗ P.one)) := by
simp only [Category.assoc, Iso.cancel_iso_inv_left]
slice_lhs 1 3 => rw [← Category.id_comp P.one, tensor_comp]
slice_lhs 2 3 => rw [associator_naturality]
slice_rhs 1 2 => rw [← Category.id_comp M.one, tensor_comp]
slice_lhs 1 2 => | rw [← leftUnitor_tensor_inv] | theorem one_associator {M N P : Mon_ C} :
((λ_ (𝟙_ C)).inv ≫ ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) ⊗ P.one)) ≫ (α_ M.X N.X P.X).hom =
(λ_ (𝟙_ C)).inv ≫ (M.one ⊗ (λ_ (𝟙_ C)).inv ≫ (N.one ⊗ P.one)) := by
simp only [Category.assoc, Iso.cancel_iso_inv_left]
slice_lhs 1 3 => rw [← Category.id_comp P.one, tensor_comp]
slice_lhs 2 3 => rw [associator_naturality]
slice_rhs 1 2 => rw [← Category.id_comp M.one, tensor_comp]
slice_lhs 1 2 => | Mathlib.CategoryTheory.Monoidal.Mon_.380_0.NTUMzhXPwXsmsYt | theorem one_associator {M N P : Mon_ C} :
((λ_ (𝟙_ C)).inv ≫ ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) ⊗ P.one)) ≫ (α_ M.X N.X P.X).hom =
(λ_ (𝟙_ C)).inv ≫ (M.one ⊗ (λ_ (𝟙_ C)).inv ≫ (N.one ⊗ P.one)) | Mathlib_CategoryTheory_Monoidal_Mon_ |
case a
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : MonoidalCategory C
M N P : Mon_ C
| ((λ_ (𝟙_ C)).inv ⊗ 𝟙 (𝟙_ C)) ≫ (α_ (𝟙_ C) (𝟙_ C) (𝟙_ C)).hom
case a C : Type u₁ inst✝¹ : Category.{v₁, u₁} C inst✝ : MonoidalCategory C M N P : Mon_ C | M.one ⊗ N.one ⊗ P.one | /-
Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/
import Mathlib.CategoryTheory.Monoidal.Braided
import Mathlib.CategoryTheory.Monoidal.Discrete
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
import Mathlib.Algebra.PUnitInstances
#align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c"
/-!
# The category of monoids in a monoidal category.
We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to
the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if
`C` is braided, then the category of monoids is naturally monoidal.
-/
set_option linter.uppercaseLean3 false
universe v₁ v₂ u₁ u₂ u
open CategoryTheory MonoidalCategory
variable (C : Type u₁) [Category.{v₁} C] [MonoidalCategory.{v₁} C]
/-- A monoid object internal to a monoidal category.
When the monoidal category is preadditive, this is also sometimes called an "algebra object".
-/
structure Mon_ where
X : C
one : 𝟙_ C ⟶ X
mul : X ⊗ X ⟶ X
one_mul : (one ⊗ 𝟙 X) ≫ mul = (λ_ X).hom := by aesop_cat
mul_one : (𝟙 X ⊗ one) ≫ mul = (ρ_ X).hom := by aesop_cat
-- Obviously there is some flexibility stating this axiom.
-- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`,
-- and chooses to place the associator on the right-hand side.
-- The heuristic is that unitors and associators "don't have much weight".
mul_assoc : (mul ⊗ 𝟙 X) ≫ mul = (α_ X X X).hom ≫ (𝟙 X ⊗ mul) ≫ mul := by aesop_cat
#align Mon_ Mon_
attribute [reassoc] Mon_.one_mul Mon_.mul_one
-- We prove a more general `@[simp]` lemma below.
attribute [reassoc (attr := simp)] Mon_.mul_assoc
namespace Mon_
/-- The trivial monoid object. We later show this is initial in `Mon_ C`.
-/
@[simps]
def trivial : Mon_ C where
X := 𝟙_ C
one := 𝟙 _
mul := (λ_ _).hom
mul_assoc := by coherence
mul_one := by coherence
#align Mon_.trivial Mon_.trivial
instance : Inhabited (Mon_ C) :=
⟨trivial C⟩
variable {C}
variable {M : Mon_ C}
@[simp]
theorem one_mul_hom {Z : C} (f : Z ⟶ M.X) : (M.one ⊗ f) ≫ M.mul = (λ_ Z).hom ≫ f := by
rw [← id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality]
#align Mon_.one_mul_hom Mon_.one_mul_hom
@[simp]
theorem mul_one_hom {Z : C} (f : Z ⟶ M.X) : (f ⊗ M.one) ≫ M.mul = (ρ_ Z).hom ≫ f := by
rw [← tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality]
#align Mon_.mul_one_hom Mon_.mul_one_hom
theorem assoc_flip :
(𝟙 M.X ⊗ M.mul) ≫ M.mul = (α_ M.X M.X M.X).inv ≫ (M.mul ⊗ 𝟙 M.X) ≫ M.mul := by simp
#align Mon_.assoc_flip Mon_.assoc_flip
/-- A morphism of monoid objects. -/
@[ext]
structure Hom (M N : Mon_ C) where
hom : M.X ⟶ N.X
one_hom : M.one ≫ hom = N.one := by aesop_cat
mul_hom : M.mul ≫ hom = (hom ⊗ hom) ≫ N.mul := by aesop_cat
#align Mon_.hom Mon_.Hom
attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom
/-- The identity morphism on a monoid object. -/
@[simps]
def id (M : Mon_ C) : Hom M M where
hom := 𝟙 M.X
#align Mon_.id Mon_.id
instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) :=
⟨id M⟩
#align Mon_.hom_inhabited Mon_.homInhabited
/-- Composition of morphisms of monoid objects. -/
@[simps]
def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where
hom := f.hom ≫ g.hom
#align Mon_.comp Mon_.comp
instance : Category (Mon_ C) where
Hom M N := Hom M N
id := id
comp f g := comp f g
-- Porting note: added, as `Hom.ext` does not apply to a morphism.
@[ext]
lemma ext {X Y : Mon_ C} {f g : X ⟶ Y} (w : f.hom = g.hom) : f = g :=
Hom.ext _ _ w
@[simp]
theorem id_hom' (M : Mon_ C) : (𝟙 M : Hom M M).hom = 𝟙 M.X :=
rfl
#align Mon_.id_hom' Mon_.id_hom'
@[simp]
theorem comp_hom' {M N K : Mon_ C} (f : M ⟶ N) (g : N ⟶ K) :
(f ≫ g : Hom M K).hom = f.hom ≫ g.hom :=
rfl
#align Mon_.comp_hom' Mon_.comp_hom'
section
variable (C)
/-- The forgetful functor from monoid objects to the ambient category. -/
@[simps]
def forget : Mon_ C ⥤ C where
obj A := A.X
map f := f.hom
#align Mon_.forget Mon_.forget
end
instance forget_faithful : Faithful (@forget C _ _) where
#align Mon_.forget_faithful Mon_.forget_faithful
instance {A B : Mon_ C} (f : A ⟶ B) [e : IsIso ((forget C).map f)] : IsIso f.hom :=
e
/-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/
instance : ReflectsIsomorphisms (forget C) where
reflects f e :=
⟨⟨{ hom := inv f.hom
mul_hom := by
simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, ← tensor_comp_assoc,
IsIso.inv_hom_id, tensor_id, Category.id_comp] },
by aesop_cat⟩⟩
/-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X ≅ N.X) (one_f : M.one ≫ f.hom = N.one)
(mul_f : M.mul ≫ f.hom = (f.hom ⊗ f.hom) ≫ N.mul) : M ≅ N where
hom :=
{ hom := f.hom
one_hom := one_f
mul_hom := mul_f }
inv :=
{ hom := f.inv
one_hom := by rw [← one_f]; simp
mul_hom := by
rw [← cancel_mono f.hom]
slice_rhs 2 3 => rw [mul_f]
simp }
#align Mon_.iso_of_iso Mon_.isoOfIso
instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C ⟶ A) where
default :=
{ hom := A.one
one_hom := by dsimp; simp
mul_hom := by dsimp; simp [A.one_mul, unitors_equal] }
uniq f := by
ext; simp
rw [← Category.id_comp f.hom]
erw [f.one_hom]
#align Mon_.unique_hom_from_trivial Mon_.uniqueHomFromTrivial
open CategoryTheory.Limits
instance : HasInitial (Mon_ C) :=
hasInitial_of_unique (trivial C)
end Mon_
namespace CategoryTheory.LaxMonoidalFunctor
variable {C} {D : Type u₂} [Category.{v₂} D] [MonoidalCategory.{v₂} D]
-- TODO: mapMod F A : Mod A ⥤ Mod (F.mapMon A)
/-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one]
rw [F.toFunctor.map_id]
rw [F.right_unitality]
mul_assoc := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_assoc]
conv_lhs => rw [F.toFunctor.map_id]
conv_lhs => rw [F.toFunctor.map_comp, F.toFunctor.map_comp]
conv_rhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_rhs 3 4 => rw [F.μ_natural]
conv_rhs => rw [F.toFunctor.map_id]
slice_rhs 1 3 => rw [← F.associativity]
simp only [Category.assoc] }
map f :=
{ hom := F.map f.hom
one_hom := by dsimp; rw [Category.assoc, ← F.toFunctor.map_comp, f.one_hom]
mul_hom := by
dsimp
rw [Category.assoc, F.μ_natural_assoc, ← F.toFunctor.map_comp, ← F.toFunctor.map_comp,
f.mul_hom] }
map_id A := by ext; simp
map_comp f g := by ext; simp
#align category_theory.lax_monoidal_functor.map_Mon CategoryTheory.LaxMonoidalFunctor.mapMon
variable (C D)
/-- `mapMon` is functorial in the lax monoidal functor. -/
@[simps] -- Porting note: added this, not sure how it worked previously without.
def mapMonFunctor : LaxMonoidalFunctor C D ⥤ Mon_ C ⥤ Mon_ D where
obj := mapMon
map α := { app := fun A => { hom := α.app A.X } }
#align category_theory.lax_monoidal_functor.map_Mon_functor CategoryTheory.LaxMonoidalFunctor.mapMonFunctor
end CategoryTheory.LaxMonoidalFunctor
namespace Mon_
open CategoryTheory.LaxMonoidalFunctor
namespace EquivLaxMonoidalFunctorPUnit
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps]
def laxMonoidalToMon : LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C ⥤ Mon_ C where
obj F := (F.mapMon : Mon_ _ ⥤ Mon_ C).obj (trivial (Discrete PUnit))
map α := ((mapMonFunctor (Discrete PUnit) C).map α).app _
#align Mon_.equiv_lax_monoidal_functor_punit.lax_monoidal_to_Mon Mon_.EquivLaxMonoidalFunctorPUnit.laxMonoidalToMon
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps]
def monToLaxMonoidal : Mon_ C ⥤ LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C where
obj A :=
{ obj := fun _ => A.X
map := fun _ => 𝟙 _
ε := A.one
μ := fun _ _ => A.mul
map_id := fun _ => rfl
map_comp := fun _ _ => (Category.id_comp (𝟙 A.X)).symm }
map f :=
{ app := fun _ => f.hom
naturality := fun _ _ _ => by dsimp; rw [Category.id_comp, Category.comp_id]
unit := f.one_hom
tensor := fun _ _ => f.mul_hom }
#align Mon_.equiv_lax_monoidal_functor_punit.Mon_to_lax_monoidal Mon_.EquivLaxMonoidalFunctorPUnit.monToLaxMonoidal
attribute [local aesop safe tactic (rule_sets [CategoryTheory])]
CategoryTheory.Discrete.discreteCases
attribute [local simp] eqToIso_map
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps!]
def unitIso :
𝟭 (LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C) ≅ laxMonoidalToMon C ⋙ monToLaxMonoidal C :=
NatIso.ofComponents
(fun F =>
MonoidalNatIso.ofComponents (fun _ => F.toFunctor.mapIso (eqToIso (by ext))) (by aesop_cat)
(by aesop_cat) (by aesop_cat))
(by aesop_cat)
#align Mon_.equiv_lax_monoidal_functor_punit.unit_iso Mon_.EquivLaxMonoidalFunctorPUnit.unitIso
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps!]
def counitIso : monToLaxMonoidal C ⋙ laxMonoidalToMon C ≅ 𝟭 (Mon_ C) :=
NatIso.ofComponents
(fun F =>
{ hom := { hom := 𝟙 _ }
inv := { hom := 𝟙 _ } })
(by aesop_cat)
#align Mon_.equiv_lax_monoidal_functor_punit.counit_iso Mon_.EquivLaxMonoidalFunctorPUnit.counitIso
end EquivLaxMonoidalFunctorPUnit
open EquivLaxMonoidalFunctorPUnit
attribute [local simp] eqToIso_map
/--
Monoid objects in `C` are "just" lax monoidal functors from the trivial monoidal category to `C`.
-/
@[simps]
def equivLaxMonoidalFunctorPUnit : LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C ≌ Mon_ C where
functor := laxMonoidalToMon C
inverse := monToLaxMonoidal C
unitIso := unitIso C
counitIso := counitIso C
#align Mon_.equiv_lax_monoidal_functor_punit Mon_.equivLaxMonoidalFunctorPUnit
end Mon_
namespace Mon_
/-!
In this section, we prove that the category of monoids in a braided monoidal category is monoidal.
Given two monoids `M` and `N` in a braided monoidal category `C`,
the multiplication on the tensor product `M.X ⊗ N.X` is defined in the obvious way:
it is the tensor product of the multiplications on `M` and `N`,
except that the tensor factors in the source come in the wrong order,
which we fix by pre-composing with a permutation isomorphism constructed from the braiding.
(There is a subtlety here: in fact there are two ways to do these,
using either the positive or negative crossing.)
A more conceptual way of understanding this definition is the following:
The braiding on `C` gives rise to a monoidal structure on
the tensor product functor from `C × C` to `C`.
A pair of monoids in `C` gives rise to a monoid in `C × C`,
which the tensor product functor by being monoidal takes to a monoid in `C`.
The permutation isomorphism appearing in the definition of
the multiplication on the tensor product of two monoids is
an instance of a more general family of isomorphisms
which together form a strength that equips the tensor product functor with a monoidal structure,
and the monoid axioms for the tensor product follow from the monoid axioms for the tensor factors
plus the properties of the strength (i.e., monoidal functor axioms).
The strength `tensor_μ` of the tensor product functor has been defined in
`Mathlib.CategoryTheory.Monoidal.Braided`.
Its properties, stated as independent lemmas in that module,
are used extensively in the proofs below.
Notice that we could have followed the above plan not only conceptually
but also as a possible implementation and
could have constructed the tensor product of monoids via `mapMon`,
but we chose to give a more explicit definition directly in terms of `tensor_μ`.
To complete the definition of the monoidal category structure on the category of monoids,
we need to provide definitions of associator and unitors.
The obvious candidates are the associator and unitors from `C`,
but we need to prove that they are monoid morphisms, i.e., compatible with unit and multiplication.
These properties translate to the monoidality of the associator and unitors
(with respect to the monoidal structures on the functors they relate),
which have also been proved in `Mathlib.CategoryTheory.Monoidal.Braided`.
-/
variable {C}
-- The proofs that associators and unitors preserve monoid units don't require braiding.
theorem one_associator {M N P : Mon_ C} :
((λ_ (𝟙_ C)).inv ≫ ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) ⊗ P.one)) ≫ (α_ M.X N.X P.X).hom =
(λ_ (𝟙_ C)).inv ≫ (M.one ⊗ (λ_ (𝟙_ C)).inv ≫ (N.one ⊗ P.one)) := by
simp only [Category.assoc, Iso.cancel_iso_inv_left]
slice_lhs 1 3 => rw [← Category.id_comp P.one, tensor_comp]
slice_lhs 2 3 => rw [associator_naturality]
slice_rhs 1 2 => rw [← Category.id_comp M.one, tensor_comp]
slice_lhs 1 2 => | rw [← leftUnitor_tensor_inv] | theorem one_associator {M N P : Mon_ C} :
((λ_ (𝟙_ C)).inv ≫ ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) ⊗ P.one)) ≫ (α_ M.X N.X P.X).hom =
(λ_ (𝟙_ C)).inv ≫ (M.one ⊗ (λ_ (𝟙_ C)).inv ≫ (N.one ⊗ P.one)) := by
simp only [Category.assoc, Iso.cancel_iso_inv_left]
slice_lhs 1 3 => rw [← Category.id_comp P.one, tensor_comp]
slice_lhs 2 3 => rw [associator_naturality]
slice_rhs 1 2 => rw [← Category.id_comp M.one, tensor_comp]
slice_lhs 1 2 => | Mathlib.CategoryTheory.Monoidal.Mon_.380_0.NTUMzhXPwXsmsYt | theorem one_associator {M N P : Mon_ C} :
((λ_ (𝟙_ C)).inv ≫ ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) ⊗ P.one)) ≫ (α_ M.X N.X P.X).hom =
(λ_ (𝟙_ C)).inv ≫ (M.one ⊗ (λ_ (𝟙_ C)).inv ≫ (N.one ⊗ P.one)) | Mathlib_CategoryTheory_Monoidal_Mon_ |
case a
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : MonoidalCategory C
M N P : Mon_ C
| ((λ_ (𝟙_ C)).inv ⊗ 𝟙 (𝟙_ C)) ≫ (α_ (𝟙_ C) (𝟙_ C) (𝟙_ C)).hom
case a C : Type u₁ inst✝¹ : Category.{v₁, u₁} C inst✝ : MonoidalCategory C M N P : Mon_ C | M.one ⊗ N.one ⊗ P.one | /-
Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/
import Mathlib.CategoryTheory.Monoidal.Braided
import Mathlib.CategoryTheory.Monoidal.Discrete
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
import Mathlib.Algebra.PUnitInstances
#align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c"
/-!
# The category of monoids in a monoidal category.
We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to
the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if
`C` is braided, then the category of monoids is naturally monoidal.
-/
set_option linter.uppercaseLean3 false
universe v₁ v₂ u₁ u₂ u
open CategoryTheory MonoidalCategory
variable (C : Type u₁) [Category.{v₁} C] [MonoidalCategory.{v₁} C]
/-- A monoid object internal to a monoidal category.
When the monoidal category is preadditive, this is also sometimes called an "algebra object".
-/
structure Mon_ where
X : C
one : 𝟙_ C ⟶ X
mul : X ⊗ X ⟶ X
one_mul : (one ⊗ 𝟙 X) ≫ mul = (λ_ X).hom := by aesop_cat
mul_one : (𝟙 X ⊗ one) ≫ mul = (ρ_ X).hom := by aesop_cat
-- Obviously there is some flexibility stating this axiom.
-- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`,
-- and chooses to place the associator on the right-hand side.
-- The heuristic is that unitors and associators "don't have much weight".
mul_assoc : (mul ⊗ 𝟙 X) ≫ mul = (α_ X X X).hom ≫ (𝟙 X ⊗ mul) ≫ mul := by aesop_cat
#align Mon_ Mon_
attribute [reassoc] Mon_.one_mul Mon_.mul_one
-- We prove a more general `@[simp]` lemma below.
attribute [reassoc (attr := simp)] Mon_.mul_assoc
namespace Mon_
/-- The trivial monoid object. We later show this is initial in `Mon_ C`.
-/
@[simps]
def trivial : Mon_ C where
X := 𝟙_ C
one := 𝟙 _
mul := (λ_ _).hom
mul_assoc := by coherence
mul_one := by coherence
#align Mon_.trivial Mon_.trivial
instance : Inhabited (Mon_ C) :=
⟨trivial C⟩
variable {C}
variable {M : Mon_ C}
@[simp]
theorem one_mul_hom {Z : C} (f : Z ⟶ M.X) : (M.one ⊗ f) ≫ M.mul = (λ_ Z).hom ≫ f := by
rw [← id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality]
#align Mon_.one_mul_hom Mon_.one_mul_hom
@[simp]
theorem mul_one_hom {Z : C} (f : Z ⟶ M.X) : (f ⊗ M.one) ≫ M.mul = (ρ_ Z).hom ≫ f := by
rw [← tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality]
#align Mon_.mul_one_hom Mon_.mul_one_hom
theorem assoc_flip :
(𝟙 M.X ⊗ M.mul) ≫ M.mul = (α_ M.X M.X M.X).inv ≫ (M.mul ⊗ 𝟙 M.X) ≫ M.mul := by simp
#align Mon_.assoc_flip Mon_.assoc_flip
/-- A morphism of monoid objects. -/
@[ext]
structure Hom (M N : Mon_ C) where
hom : M.X ⟶ N.X
one_hom : M.one ≫ hom = N.one := by aesop_cat
mul_hom : M.mul ≫ hom = (hom ⊗ hom) ≫ N.mul := by aesop_cat
#align Mon_.hom Mon_.Hom
attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom
/-- The identity morphism on a monoid object. -/
@[simps]
def id (M : Mon_ C) : Hom M M where
hom := 𝟙 M.X
#align Mon_.id Mon_.id
instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) :=
⟨id M⟩
#align Mon_.hom_inhabited Mon_.homInhabited
/-- Composition of morphisms of monoid objects. -/
@[simps]
def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where
hom := f.hom ≫ g.hom
#align Mon_.comp Mon_.comp
instance : Category (Mon_ C) where
Hom M N := Hom M N
id := id
comp f g := comp f g
-- Porting note: added, as `Hom.ext` does not apply to a morphism.
@[ext]
lemma ext {X Y : Mon_ C} {f g : X ⟶ Y} (w : f.hom = g.hom) : f = g :=
Hom.ext _ _ w
@[simp]
theorem id_hom' (M : Mon_ C) : (𝟙 M : Hom M M).hom = 𝟙 M.X :=
rfl
#align Mon_.id_hom' Mon_.id_hom'
@[simp]
theorem comp_hom' {M N K : Mon_ C} (f : M ⟶ N) (g : N ⟶ K) :
(f ≫ g : Hom M K).hom = f.hom ≫ g.hom :=
rfl
#align Mon_.comp_hom' Mon_.comp_hom'
section
variable (C)
/-- The forgetful functor from monoid objects to the ambient category. -/
@[simps]
def forget : Mon_ C ⥤ C where
obj A := A.X
map f := f.hom
#align Mon_.forget Mon_.forget
end
instance forget_faithful : Faithful (@forget C _ _) where
#align Mon_.forget_faithful Mon_.forget_faithful
instance {A B : Mon_ C} (f : A ⟶ B) [e : IsIso ((forget C).map f)] : IsIso f.hom :=
e
/-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/
instance : ReflectsIsomorphisms (forget C) where
reflects f e :=
⟨⟨{ hom := inv f.hom
mul_hom := by
simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, ← tensor_comp_assoc,
IsIso.inv_hom_id, tensor_id, Category.id_comp] },
by aesop_cat⟩⟩
/-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X ≅ N.X) (one_f : M.one ≫ f.hom = N.one)
(mul_f : M.mul ≫ f.hom = (f.hom ⊗ f.hom) ≫ N.mul) : M ≅ N where
hom :=
{ hom := f.hom
one_hom := one_f
mul_hom := mul_f }
inv :=
{ hom := f.inv
one_hom := by rw [← one_f]; simp
mul_hom := by
rw [← cancel_mono f.hom]
slice_rhs 2 3 => rw [mul_f]
simp }
#align Mon_.iso_of_iso Mon_.isoOfIso
instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C ⟶ A) where
default :=
{ hom := A.one
one_hom := by dsimp; simp
mul_hom := by dsimp; simp [A.one_mul, unitors_equal] }
uniq f := by
ext; simp
rw [← Category.id_comp f.hom]
erw [f.one_hom]
#align Mon_.unique_hom_from_trivial Mon_.uniqueHomFromTrivial
open CategoryTheory.Limits
instance : HasInitial (Mon_ C) :=
hasInitial_of_unique (trivial C)
end Mon_
namespace CategoryTheory.LaxMonoidalFunctor
variable {C} {D : Type u₂} [Category.{v₂} D] [MonoidalCategory.{v₂} D]
-- TODO: mapMod F A : Mod A ⥤ Mod (F.mapMon A)
/-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one]
rw [F.toFunctor.map_id]
rw [F.right_unitality]
mul_assoc := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_assoc]
conv_lhs => rw [F.toFunctor.map_id]
conv_lhs => rw [F.toFunctor.map_comp, F.toFunctor.map_comp]
conv_rhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_rhs 3 4 => rw [F.μ_natural]
conv_rhs => rw [F.toFunctor.map_id]
slice_rhs 1 3 => rw [← F.associativity]
simp only [Category.assoc] }
map f :=
{ hom := F.map f.hom
one_hom := by dsimp; rw [Category.assoc, ← F.toFunctor.map_comp, f.one_hom]
mul_hom := by
dsimp
rw [Category.assoc, F.μ_natural_assoc, ← F.toFunctor.map_comp, ← F.toFunctor.map_comp,
f.mul_hom] }
map_id A := by ext; simp
map_comp f g := by ext; simp
#align category_theory.lax_monoidal_functor.map_Mon CategoryTheory.LaxMonoidalFunctor.mapMon
variable (C D)
/-- `mapMon` is functorial in the lax monoidal functor. -/
@[simps] -- Porting note: added this, not sure how it worked previously without.
def mapMonFunctor : LaxMonoidalFunctor C D ⥤ Mon_ C ⥤ Mon_ D where
obj := mapMon
map α := { app := fun A => { hom := α.app A.X } }
#align category_theory.lax_monoidal_functor.map_Mon_functor CategoryTheory.LaxMonoidalFunctor.mapMonFunctor
end CategoryTheory.LaxMonoidalFunctor
namespace Mon_
open CategoryTheory.LaxMonoidalFunctor
namespace EquivLaxMonoidalFunctorPUnit
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps]
def laxMonoidalToMon : LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C ⥤ Mon_ C where
obj F := (F.mapMon : Mon_ _ ⥤ Mon_ C).obj (trivial (Discrete PUnit))
map α := ((mapMonFunctor (Discrete PUnit) C).map α).app _
#align Mon_.equiv_lax_monoidal_functor_punit.lax_monoidal_to_Mon Mon_.EquivLaxMonoidalFunctorPUnit.laxMonoidalToMon
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps]
def monToLaxMonoidal : Mon_ C ⥤ LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C where
obj A :=
{ obj := fun _ => A.X
map := fun _ => 𝟙 _
ε := A.one
μ := fun _ _ => A.mul
map_id := fun _ => rfl
map_comp := fun _ _ => (Category.id_comp (𝟙 A.X)).symm }
map f :=
{ app := fun _ => f.hom
naturality := fun _ _ _ => by dsimp; rw [Category.id_comp, Category.comp_id]
unit := f.one_hom
tensor := fun _ _ => f.mul_hom }
#align Mon_.equiv_lax_monoidal_functor_punit.Mon_to_lax_monoidal Mon_.EquivLaxMonoidalFunctorPUnit.monToLaxMonoidal
attribute [local aesop safe tactic (rule_sets [CategoryTheory])]
CategoryTheory.Discrete.discreteCases
attribute [local simp] eqToIso_map
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps!]
def unitIso :
𝟭 (LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C) ≅ laxMonoidalToMon C ⋙ monToLaxMonoidal C :=
NatIso.ofComponents
(fun F =>
MonoidalNatIso.ofComponents (fun _ => F.toFunctor.mapIso (eqToIso (by ext))) (by aesop_cat)
(by aesop_cat) (by aesop_cat))
(by aesop_cat)
#align Mon_.equiv_lax_monoidal_functor_punit.unit_iso Mon_.EquivLaxMonoidalFunctorPUnit.unitIso
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps!]
def counitIso : monToLaxMonoidal C ⋙ laxMonoidalToMon C ≅ 𝟭 (Mon_ C) :=
NatIso.ofComponents
(fun F =>
{ hom := { hom := 𝟙 _ }
inv := { hom := 𝟙 _ } })
(by aesop_cat)
#align Mon_.equiv_lax_monoidal_functor_punit.counit_iso Mon_.EquivLaxMonoidalFunctorPUnit.counitIso
end EquivLaxMonoidalFunctorPUnit
open EquivLaxMonoidalFunctorPUnit
attribute [local simp] eqToIso_map
/--
Monoid objects in `C` are "just" lax monoidal functors from the trivial monoidal category to `C`.
-/
@[simps]
def equivLaxMonoidalFunctorPUnit : LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C ≌ Mon_ C where
functor := laxMonoidalToMon C
inverse := monToLaxMonoidal C
unitIso := unitIso C
counitIso := counitIso C
#align Mon_.equiv_lax_monoidal_functor_punit Mon_.equivLaxMonoidalFunctorPUnit
end Mon_
namespace Mon_
/-!
In this section, we prove that the category of monoids in a braided monoidal category is monoidal.
Given two monoids `M` and `N` in a braided monoidal category `C`,
the multiplication on the tensor product `M.X ⊗ N.X` is defined in the obvious way:
it is the tensor product of the multiplications on `M` and `N`,
except that the tensor factors in the source come in the wrong order,
which we fix by pre-composing with a permutation isomorphism constructed from the braiding.
(There is a subtlety here: in fact there are two ways to do these,
using either the positive or negative crossing.)
A more conceptual way of understanding this definition is the following:
The braiding on `C` gives rise to a monoidal structure on
the tensor product functor from `C × C` to `C`.
A pair of monoids in `C` gives rise to a monoid in `C × C`,
which the tensor product functor by being monoidal takes to a monoid in `C`.
The permutation isomorphism appearing in the definition of
the multiplication on the tensor product of two monoids is
an instance of a more general family of isomorphisms
which together form a strength that equips the tensor product functor with a monoidal structure,
and the monoid axioms for the tensor product follow from the monoid axioms for the tensor factors
plus the properties of the strength (i.e., monoidal functor axioms).
The strength `tensor_μ` of the tensor product functor has been defined in
`Mathlib.CategoryTheory.Monoidal.Braided`.
Its properties, stated as independent lemmas in that module,
are used extensively in the proofs below.
Notice that we could have followed the above plan not only conceptually
but also as a possible implementation and
could have constructed the tensor product of monoids via `mapMon`,
but we chose to give a more explicit definition directly in terms of `tensor_μ`.
To complete the definition of the monoidal category structure on the category of monoids,
we need to provide definitions of associator and unitors.
The obvious candidates are the associator and unitors from `C`,
but we need to prove that they are monoid morphisms, i.e., compatible with unit and multiplication.
These properties translate to the monoidality of the associator and unitors
(with respect to the monoidal structures on the functors they relate),
which have also been proved in `Mathlib.CategoryTheory.Monoidal.Braided`.
-/
variable {C}
-- The proofs that associators and unitors preserve monoid units don't require braiding.
theorem one_associator {M N P : Mon_ C} :
((λ_ (𝟙_ C)).inv ≫ ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) ⊗ P.one)) ≫ (α_ M.X N.X P.X).hom =
(λ_ (𝟙_ C)).inv ≫ (M.one ⊗ (λ_ (𝟙_ C)).inv ≫ (N.one ⊗ P.one)) := by
simp only [Category.assoc, Iso.cancel_iso_inv_left]
slice_lhs 1 3 => rw [← Category.id_comp P.one, tensor_comp]
slice_lhs 2 3 => rw [associator_naturality]
slice_rhs 1 2 => rw [← Category.id_comp M.one, tensor_comp]
slice_lhs 1 2 => | rw [← leftUnitor_tensor_inv] | theorem one_associator {M N P : Mon_ C} :
((λ_ (𝟙_ C)).inv ≫ ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) ⊗ P.one)) ≫ (α_ M.X N.X P.X).hom =
(λ_ (𝟙_ C)).inv ≫ (M.one ⊗ (λ_ (𝟙_ C)).inv ≫ (N.one ⊗ P.one)) := by
simp only [Category.assoc, Iso.cancel_iso_inv_left]
slice_lhs 1 3 => rw [← Category.id_comp P.one, tensor_comp]
slice_lhs 2 3 => rw [associator_naturality]
slice_rhs 1 2 => rw [← Category.id_comp M.one, tensor_comp]
slice_lhs 1 2 => | Mathlib.CategoryTheory.Monoidal.Mon_.380_0.NTUMzhXPwXsmsYt | theorem one_associator {M N P : Mon_ C} :
((λ_ (𝟙_ C)).inv ≫ ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) ⊗ P.one)) ≫ (α_ M.X N.X P.X).hom =
(λ_ (𝟙_ C)).inv ≫ (M.one ⊗ (λ_ (𝟙_ C)).inv ≫ (N.one ⊗ P.one)) | Mathlib_CategoryTheory_Monoidal_Mon_ |
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : MonoidalCategory C
M N P : Mon_ C
⊢ (λ_ (𝟙_ C ⊗ 𝟙_ C)).inv ≫ (M.one ⊗ N.one ⊗ P.one) = (𝟙 (𝟙_ C) ⊗ (λ_ (𝟙_ C)).inv) ≫ (M.one ⊗ N.one ⊗ P.one) | /-
Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/
import Mathlib.CategoryTheory.Monoidal.Braided
import Mathlib.CategoryTheory.Monoidal.Discrete
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
import Mathlib.Algebra.PUnitInstances
#align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c"
/-!
# The category of monoids in a monoidal category.
We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to
the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if
`C` is braided, then the category of monoids is naturally monoidal.
-/
set_option linter.uppercaseLean3 false
universe v₁ v₂ u₁ u₂ u
open CategoryTheory MonoidalCategory
variable (C : Type u₁) [Category.{v₁} C] [MonoidalCategory.{v₁} C]
/-- A monoid object internal to a monoidal category.
When the monoidal category is preadditive, this is also sometimes called an "algebra object".
-/
structure Mon_ where
X : C
one : 𝟙_ C ⟶ X
mul : X ⊗ X ⟶ X
one_mul : (one ⊗ 𝟙 X) ≫ mul = (λ_ X).hom := by aesop_cat
mul_one : (𝟙 X ⊗ one) ≫ mul = (ρ_ X).hom := by aesop_cat
-- Obviously there is some flexibility stating this axiom.
-- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`,
-- and chooses to place the associator on the right-hand side.
-- The heuristic is that unitors and associators "don't have much weight".
mul_assoc : (mul ⊗ 𝟙 X) ≫ mul = (α_ X X X).hom ≫ (𝟙 X ⊗ mul) ≫ mul := by aesop_cat
#align Mon_ Mon_
attribute [reassoc] Mon_.one_mul Mon_.mul_one
-- We prove a more general `@[simp]` lemma below.
attribute [reassoc (attr := simp)] Mon_.mul_assoc
namespace Mon_
/-- The trivial monoid object. We later show this is initial in `Mon_ C`.
-/
@[simps]
def trivial : Mon_ C where
X := 𝟙_ C
one := 𝟙 _
mul := (λ_ _).hom
mul_assoc := by coherence
mul_one := by coherence
#align Mon_.trivial Mon_.trivial
instance : Inhabited (Mon_ C) :=
⟨trivial C⟩
variable {C}
variable {M : Mon_ C}
@[simp]
theorem one_mul_hom {Z : C} (f : Z ⟶ M.X) : (M.one ⊗ f) ≫ M.mul = (λ_ Z).hom ≫ f := by
rw [← id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality]
#align Mon_.one_mul_hom Mon_.one_mul_hom
@[simp]
theorem mul_one_hom {Z : C} (f : Z ⟶ M.X) : (f ⊗ M.one) ≫ M.mul = (ρ_ Z).hom ≫ f := by
rw [← tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality]
#align Mon_.mul_one_hom Mon_.mul_one_hom
theorem assoc_flip :
(𝟙 M.X ⊗ M.mul) ≫ M.mul = (α_ M.X M.X M.X).inv ≫ (M.mul ⊗ 𝟙 M.X) ≫ M.mul := by simp
#align Mon_.assoc_flip Mon_.assoc_flip
/-- A morphism of monoid objects. -/
@[ext]
structure Hom (M N : Mon_ C) where
hom : M.X ⟶ N.X
one_hom : M.one ≫ hom = N.one := by aesop_cat
mul_hom : M.mul ≫ hom = (hom ⊗ hom) ≫ N.mul := by aesop_cat
#align Mon_.hom Mon_.Hom
attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom
/-- The identity morphism on a monoid object. -/
@[simps]
def id (M : Mon_ C) : Hom M M where
hom := 𝟙 M.X
#align Mon_.id Mon_.id
instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) :=
⟨id M⟩
#align Mon_.hom_inhabited Mon_.homInhabited
/-- Composition of morphisms of monoid objects. -/
@[simps]
def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where
hom := f.hom ≫ g.hom
#align Mon_.comp Mon_.comp
instance : Category (Mon_ C) where
Hom M N := Hom M N
id := id
comp f g := comp f g
-- Porting note: added, as `Hom.ext` does not apply to a morphism.
@[ext]
lemma ext {X Y : Mon_ C} {f g : X ⟶ Y} (w : f.hom = g.hom) : f = g :=
Hom.ext _ _ w
@[simp]
theorem id_hom' (M : Mon_ C) : (𝟙 M : Hom M M).hom = 𝟙 M.X :=
rfl
#align Mon_.id_hom' Mon_.id_hom'
@[simp]
theorem comp_hom' {M N K : Mon_ C} (f : M ⟶ N) (g : N ⟶ K) :
(f ≫ g : Hom M K).hom = f.hom ≫ g.hom :=
rfl
#align Mon_.comp_hom' Mon_.comp_hom'
section
variable (C)
/-- The forgetful functor from monoid objects to the ambient category. -/
@[simps]
def forget : Mon_ C ⥤ C where
obj A := A.X
map f := f.hom
#align Mon_.forget Mon_.forget
end
instance forget_faithful : Faithful (@forget C _ _) where
#align Mon_.forget_faithful Mon_.forget_faithful
instance {A B : Mon_ C} (f : A ⟶ B) [e : IsIso ((forget C).map f)] : IsIso f.hom :=
e
/-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/
instance : ReflectsIsomorphisms (forget C) where
reflects f e :=
⟨⟨{ hom := inv f.hom
mul_hom := by
simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, ← tensor_comp_assoc,
IsIso.inv_hom_id, tensor_id, Category.id_comp] },
by aesop_cat⟩⟩
/-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X ≅ N.X) (one_f : M.one ≫ f.hom = N.one)
(mul_f : M.mul ≫ f.hom = (f.hom ⊗ f.hom) ≫ N.mul) : M ≅ N where
hom :=
{ hom := f.hom
one_hom := one_f
mul_hom := mul_f }
inv :=
{ hom := f.inv
one_hom := by rw [← one_f]; simp
mul_hom := by
rw [← cancel_mono f.hom]
slice_rhs 2 3 => rw [mul_f]
simp }
#align Mon_.iso_of_iso Mon_.isoOfIso
instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C ⟶ A) where
default :=
{ hom := A.one
one_hom := by dsimp; simp
mul_hom := by dsimp; simp [A.one_mul, unitors_equal] }
uniq f := by
ext; simp
rw [← Category.id_comp f.hom]
erw [f.one_hom]
#align Mon_.unique_hom_from_trivial Mon_.uniqueHomFromTrivial
open CategoryTheory.Limits
instance : HasInitial (Mon_ C) :=
hasInitial_of_unique (trivial C)
end Mon_
namespace CategoryTheory.LaxMonoidalFunctor
variable {C} {D : Type u₂} [Category.{v₂} D] [MonoidalCategory.{v₂} D]
-- TODO: mapMod F A : Mod A ⥤ Mod (F.mapMon A)
/-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one]
rw [F.toFunctor.map_id]
rw [F.right_unitality]
mul_assoc := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_assoc]
conv_lhs => rw [F.toFunctor.map_id]
conv_lhs => rw [F.toFunctor.map_comp, F.toFunctor.map_comp]
conv_rhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_rhs 3 4 => rw [F.μ_natural]
conv_rhs => rw [F.toFunctor.map_id]
slice_rhs 1 3 => rw [← F.associativity]
simp only [Category.assoc] }
map f :=
{ hom := F.map f.hom
one_hom := by dsimp; rw [Category.assoc, ← F.toFunctor.map_comp, f.one_hom]
mul_hom := by
dsimp
rw [Category.assoc, F.μ_natural_assoc, ← F.toFunctor.map_comp, ← F.toFunctor.map_comp,
f.mul_hom] }
map_id A := by ext; simp
map_comp f g := by ext; simp
#align category_theory.lax_monoidal_functor.map_Mon CategoryTheory.LaxMonoidalFunctor.mapMon
variable (C D)
/-- `mapMon` is functorial in the lax monoidal functor. -/
@[simps] -- Porting note: added this, not sure how it worked previously without.
def mapMonFunctor : LaxMonoidalFunctor C D ⥤ Mon_ C ⥤ Mon_ D where
obj := mapMon
map α := { app := fun A => { hom := α.app A.X } }
#align category_theory.lax_monoidal_functor.map_Mon_functor CategoryTheory.LaxMonoidalFunctor.mapMonFunctor
end CategoryTheory.LaxMonoidalFunctor
namespace Mon_
open CategoryTheory.LaxMonoidalFunctor
namespace EquivLaxMonoidalFunctorPUnit
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps]
def laxMonoidalToMon : LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C ⥤ Mon_ C where
obj F := (F.mapMon : Mon_ _ ⥤ Mon_ C).obj (trivial (Discrete PUnit))
map α := ((mapMonFunctor (Discrete PUnit) C).map α).app _
#align Mon_.equiv_lax_monoidal_functor_punit.lax_monoidal_to_Mon Mon_.EquivLaxMonoidalFunctorPUnit.laxMonoidalToMon
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps]
def monToLaxMonoidal : Mon_ C ⥤ LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C where
obj A :=
{ obj := fun _ => A.X
map := fun _ => 𝟙 _
ε := A.one
μ := fun _ _ => A.mul
map_id := fun _ => rfl
map_comp := fun _ _ => (Category.id_comp (𝟙 A.X)).symm }
map f :=
{ app := fun _ => f.hom
naturality := fun _ _ _ => by dsimp; rw [Category.id_comp, Category.comp_id]
unit := f.one_hom
tensor := fun _ _ => f.mul_hom }
#align Mon_.equiv_lax_monoidal_functor_punit.Mon_to_lax_monoidal Mon_.EquivLaxMonoidalFunctorPUnit.monToLaxMonoidal
attribute [local aesop safe tactic (rule_sets [CategoryTheory])]
CategoryTheory.Discrete.discreteCases
attribute [local simp] eqToIso_map
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps!]
def unitIso :
𝟭 (LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C) ≅ laxMonoidalToMon C ⋙ monToLaxMonoidal C :=
NatIso.ofComponents
(fun F =>
MonoidalNatIso.ofComponents (fun _ => F.toFunctor.mapIso (eqToIso (by ext))) (by aesop_cat)
(by aesop_cat) (by aesop_cat))
(by aesop_cat)
#align Mon_.equiv_lax_monoidal_functor_punit.unit_iso Mon_.EquivLaxMonoidalFunctorPUnit.unitIso
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps!]
def counitIso : monToLaxMonoidal C ⋙ laxMonoidalToMon C ≅ 𝟭 (Mon_ C) :=
NatIso.ofComponents
(fun F =>
{ hom := { hom := 𝟙 _ }
inv := { hom := 𝟙 _ } })
(by aesop_cat)
#align Mon_.equiv_lax_monoidal_functor_punit.counit_iso Mon_.EquivLaxMonoidalFunctorPUnit.counitIso
end EquivLaxMonoidalFunctorPUnit
open EquivLaxMonoidalFunctorPUnit
attribute [local simp] eqToIso_map
/--
Monoid objects in `C` are "just" lax monoidal functors from the trivial monoidal category to `C`.
-/
@[simps]
def equivLaxMonoidalFunctorPUnit : LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C ≌ Mon_ C where
functor := laxMonoidalToMon C
inverse := monToLaxMonoidal C
unitIso := unitIso C
counitIso := counitIso C
#align Mon_.equiv_lax_monoidal_functor_punit Mon_.equivLaxMonoidalFunctorPUnit
end Mon_
namespace Mon_
/-!
In this section, we prove that the category of monoids in a braided monoidal category is monoidal.
Given two monoids `M` and `N` in a braided monoidal category `C`,
the multiplication on the tensor product `M.X ⊗ N.X` is defined in the obvious way:
it is the tensor product of the multiplications on `M` and `N`,
except that the tensor factors in the source come in the wrong order,
which we fix by pre-composing with a permutation isomorphism constructed from the braiding.
(There is a subtlety here: in fact there are two ways to do these,
using either the positive or negative crossing.)
A more conceptual way of understanding this definition is the following:
The braiding on `C` gives rise to a monoidal structure on
the tensor product functor from `C × C` to `C`.
A pair of monoids in `C` gives rise to a monoid in `C × C`,
which the tensor product functor by being monoidal takes to a monoid in `C`.
The permutation isomorphism appearing in the definition of
the multiplication on the tensor product of two monoids is
an instance of a more general family of isomorphisms
which together form a strength that equips the tensor product functor with a monoidal structure,
and the monoid axioms for the tensor product follow from the monoid axioms for the tensor factors
plus the properties of the strength (i.e., monoidal functor axioms).
The strength `tensor_μ` of the tensor product functor has been defined in
`Mathlib.CategoryTheory.Monoidal.Braided`.
Its properties, stated as independent lemmas in that module,
are used extensively in the proofs below.
Notice that we could have followed the above plan not only conceptually
but also as a possible implementation and
could have constructed the tensor product of monoids via `mapMon`,
but we chose to give a more explicit definition directly in terms of `tensor_μ`.
To complete the definition of the monoidal category structure on the category of monoids,
we need to provide definitions of associator and unitors.
The obvious candidates are the associator and unitors from `C`,
but we need to prove that they are monoid morphisms, i.e., compatible with unit and multiplication.
These properties translate to the monoidality of the associator and unitors
(with respect to the monoidal structures on the functors they relate),
which have also been proved in `Mathlib.CategoryTheory.Monoidal.Braided`.
-/
variable {C}
-- The proofs that associators and unitors preserve monoid units don't require braiding.
theorem one_associator {M N P : Mon_ C} :
((λ_ (𝟙_ C)).inv ≫ ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) ⊗ P.one)) ≫ (α_ M.X N.X P.X).hom =
(λ_ (𝟙_ C)).inv ≫ (M.one ⊗ (λ_ (𝟙_ C)).inv ≫ (N.one ⊗ P.one)) := by
simp only [Category.assoc, Iso.cancel_iso_inv_left]
slice_lhs 1 3 => rw [← Category.id_comp P.one, tensor_comp]
slice_lhs 2 3 => rw [associator_naturality]
slice_rhs 1 2 => rw [← Category.id_comp M.one, tensor_comp]
slice_lhs 1 2 => rw [← leftUnitor_tensor_inv]
| rw [← cancel_epi (λ_ (𝟙_ C)).inv] | theorem one_associator {M N P : Mon_ C} :
((λ_ (𝟙_ C)).inv ≫ ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) ⊗ P.one)) ≫ (α_ M.X N.X P.X).hom =
(λ_ (𝟙_ C)).inv ≫ (M.one ⊗ (λ_ (𝟙_ C)).inv ≫ (N.one ⊗ P.one)) := by
simp only [Category.assoc, Iso.cancel_iso_inv_left]
slice_lhs 1 3 => rw [← Category.id_comp P.one, tensor_comp]
slice_lhs 2 3 => rw [associator_naturality]
slice_rhs 1 2 => rw [← Category.id_comp M.one, tensor_comp]
slice_lhs 1 2 => rw [← leftUnitor_tensor_inv]
| Mathlib.CategoryTheory.Monoidal.Mon_.380_0.NTUMzhXPwXsmsYt | theorem one_associator {M N P : Mon_ C} :
((λ_ (𝟙_ C)).inv ≫ ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) ⊗ P.one)) ≫ (α_ M.X N.X P.X).hom =
(λ_ (𝟙_ C)).inv ≫ (M.one ⊗ (λ_ (𝟙_ C)).inv ≫ (N.one ⊗ P.one)) | Mathlib_CategoryTheory_Monoidal_Mon_ |
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : MonoidalCategory C
M N P : Mon_ C
⊢ (λ_ (𝟙_ C)).inv ≫ (λ_ (𝟙_ C ⊗ 𝟙_ C)).inv ≫ (M.one ⊗ N.one ⊗ P.one) =
(λ_ (𝟙_ C)).inv ≫ (𝟙 (𝟙_ C) ⊗ (λ_ (𝟙_ C)).inv) ≫ (M.one ⊗ N.one ⊗ P.one) | /-
Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/
import Mathlib.CategoryTheory.Monoidal.Braided
import Mathlib.CategoryTheory.Monoidal.Discrete
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
import Mathlib.Algebra.PUnitInstances
#align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c"
/-!
# The category of monoids in a monoidal category.
We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to
the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if
`C` is braided, then the category of monoids is naturally monoidal.
-/
set_option linter.uppercaseLean3 false
universe v₁ v₂ u₁ u₂ u
open CategoryTheory MonoidalCategory
variable (C : Type u₁) [Category.{v₁} C] [MonoidalCategory.{v₁} C]
/-- A monoid object internal to a monoidal category.
When the monoidal category is preadditive, this is also sometimes called an "algebra object".
-/
structure Mon_ where
X : C
one : 𝟙_ C ⟶ X
mul : X ⊗ X ⟶ X
one_mul : (one ⊗ 𝟙 X) ≫ mul = (λ_ X).hom := by aesop_cat
mul_one : (𝟙 X ⊗ one) ≫ mul = (ρ_ X).hom := by aesop_cat
-- Obviously there is some flexibility stating this axiom.
-- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`,
-- and chooses to place the associator on the right-hand side.
-- The heuristic is that unitors and associators "don't have much weight".
mul_assoc : (mul ⊗ 𝟙 X) ≫ mul = (α_ X X X).hom ≫ (𝟙 X ⊗ mul) ≫ mul := by aesop_cat
#align Mon_ Mon_
attribute [reassoc] Mon_.one_mul Mon_.mul_one
-- We prove a more general `@[simp]` lemma below.
attribute [reassoc (attr := simp)] Mon_.mul_assoc
namespace Mon_
/-- The trivial monoid object. We later show this is initial in `Mon_ C`.
-/
@[simps]
def trivial : Mon_ C where
X := 𝟙_ C
one := 𝟙 _
mul := (λ_ _).hom
mul_assoc := by coherence
mul_one := by coherence
#align Mon_.trivial Mon_.trivial
instance : Inhabited (Mon_ C) :=
⟨trivial C⟩
variable {C}
variable {M : Mon_ C}
@[simp]
theorem one_mul_hom {Z : C} (f : Z ⟶ M.X) : (M.one ⊗ f) ≫ M.mul = (λ_ Z).hom ≫ f := by
rw [← id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality]
#align Mon_.one_mul_hom Mon_.one_mul_hom
@[simp]
theorem mul_one_hom {Z : C} (f : Z ⟶ M.X) : (f ⊗ M.one) ≫ M.mul = (ρ_ Z).hom ≫ f := by
rw [← tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality]
#align Mon_.mul_one_hom Mon_.mul_one_hom
theorem assoc_flip :
(𝟙 M.X ⊗ M.mul) ≫ M.mul = (α_ M.X M.X M.X).inv ≫ (M.mul ⊗ 𝟙 M.X) ≫ M.mul := by simp
#align Mon_.assoc_flip Mon_.assoc_flip
/-- A morphism of monoid objects. -/
@[ext]
structure Hom (M N : Mon_ C) where
hom : M.X ⟶ N.X
one_hom : M.one ≫ hom = N.one := by aesop_cat
mul_hom : M.mul ≫ hom = (hom ⊗ hom) ≫ N.mul := by aesop_cat
#align Mon_.hom Mon_.Hom
attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom
/-- The identity morphism on a monoid object. -/
@[simps]
def id (M : Mon_ C) : Hom M M where
hom := 𝟙 M.X
#align Mon_.id Mon_.id
instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) :=
⟨id M⟩
#align Mon_.hom_inhabited Mon_.homInhabited
/-- Composition of morphisms of monoid objects. -/
@[simps]
def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where
hom := f.hom ≫ g.hom
#align Mon_.comp Mon_.comp
instance : Category (Mon_ C) where
Hom M N := Hom M N
id := id
comp f g := comp f g
-- Porting note: added, as `Hom.ext` does not apply to a morphism.
@[ext]
lemma ext {X Y : Mon_ C} {f g : X ⟶ Y} (w : f.hom = g.hom) : f = g :=
Hom.ext _ _ w
@[simp]
theorem id_hom' (M : Mon_ C) : (𝟙 M : Hom M M).hom = 𝟙 M.X :=
rfl
#align Mon_.id_hom' Mon_.id_hom'
@[simp]
theorem comp_hom' {M N K : Mon_ C} (f : M ⟶ N) (g : N ⟶ K) :
(f ≫ g : Hom M K).hom = f.hom ≫ g.hom :=
rfl
#align Mon_.comp_hom' Mon_.comp_hom'
section
variable (C)
/-- The forgetful functor from monoid objects to the ambient category. -/
@[simps]
def forget : Mon_ C ⥤ C where
obj A := A.X
map f := f.hom
#align Mon_.forget Mon_.forget
end
instance forget_faithful : Faithful (@forget C _ _) where
#align Mon_.forget_faithful Mon_.forget_faithful
instance {A B : Mon_ C} (f : A ⟶ B) [e : IsIso ((forget C).map f)] : IsIso f.hom :=
e
/-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/
instance : ReflectsIsomorphisms (forget C) where
reflects f e :=
⟨⟨{ hom := inv f.hom
mul_hom := by
simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, ← tensor_comp_assoc,
IsIso.inv_hom_id, tensor_id, Category.id_comp] },
by aesop_cat⟩⟩
/-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X ≅ N.X) (one_f : M.one ≫ f.hom = N.one)
(mul_f : M.mul ≫ f.hom = (f.hom ⊗ f.hom) ≫ N.mul) : M ≅ N where
hom :=
{ hom := f.hom
one_hom := one_f
mul_hom := mul_f }
inv :=
{ hom := f.inv
one_hom := by rw [← one_f]; simp
mul_hom := by
rw [← cancel_mono f.hom]
slice_rhs 2 3 => rw [mul_f]
simp }
#align Mon_.iso_of_iso Mon_.isoOfIso
instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C ⟶ A) where
default :=
{ hom := A.one
one_hom := by dsimp; simp
mul_hom := by dsimp; simp [A.one_mul, unitors_equal] }
uniq f := by
ext; simp
rw [← Category.id_comp f.hom]
erw [f.one_hom]
#align Mon_.unique_hom_from_trivial Mon_.uniqueHomFromTrivial
open CategoryTheory.Limits
instance : HasInitial (Mon_ C) :=
hasInitial_of_unique (trivial C)
end Mon_
namespace CategoryTheory.LaxMonoidalFunctor
variable {C} {D : Type u₂} [Category.{v₂} D] [MonoidalCategory.{v₂} D]
-- TODO: mapMod F A : Mod A ⥤ Mod (F.mapMon A)
/-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one]
rw [F.toFunctor.map_id]
rw [F.right_unitality]
mul_assoc := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_assoc]
conv_lhs => rw [F.toFunctor.map_id]
conv_lhs => rw [F.toFunctor.map_comp, F.toFunctor.map_comp]
conv_rhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_rhs 3 4 => rw [F.μ_natural]
conv_rhs => rw [F.toFunctor.map_id]
slice_rhs 1 3 => rw [← F.associativity]
simp only [Category.assoc] }
map f :=
{ hom := F.map f.hom
one_hom := by dsimp; rw [Category.assoc, ← F.toFunctor.map_comp, f.one_hom]
mul_hom := by
dsimp
rw [Category.assoc, F.μ_natural_assoc, ← F.toFunctor.map_comp, ← F.toFunctor.map_comp,
f.mul_hom] }
map_id A := by ext; simp
map_comp f g := by ext; simp
#align category_theory.lax_monoidal_functor.map_Mon CategoryTheory.LaxMonoidalFunctor.mapMon
variable (C D)
/-- `mapMon` is functorial in the lax monoidal functor. -/
@[simps] -- Porting note: added this, not sure how it worked previously without.
def mapMonFunctor : LaxMonoidalFunctor C D ⥤ Mon_ C ⥤ Mon_ D where
obj := mapMon
map α := { app := fun A => { hom := α.app A.X } }
#align category_theory.lax_monoidal_functor.map_Mon_functor CategoryTheory.LaxMonoidalFunctor.mapMonFunctor
end CategoryTheory.LaxMonoidalFunctor
namespace Mon_
open CategoryTheory.LaxMonoidalFunctor
namespace EquivLaxMonoidalFunctorPUnit
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps]
def laxMonoidalToMon : LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C ⥤ Mon_ C where
obj F := (F.mapMon : Mon_ _ ⥤ Mon_ C).obj (trivial (Discrete PUnit))
map α := ((mapMonFunctor (Discrete PUnit) C).map α).app _
#align Mon_.equiv_lax_monoidal_functor_punit.lax_monoidal_to_Mon Mon_.EquivLaxMonoidalFunctorPUnit.laxMonoidalToMon
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps]
def monToLaxMonoidal : Mon_ C ⥤ LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C where
obj A :=
{ obj := fun _ => A.X
map := fun _ => 𝟙 _
ε := A.one
μ := fun _ _ => A.mul
map_id := fun _ => rfl
map_comp := fun _ _ => (Category.id_comp (𝟙 A.X)).symm }
map f :=
{ app := fun _ => f.hom
naturality := fun _ _ _ => by dsimp; rw [Category.id_comp, Category.comp_id]
unit := f.one_hom
tensor := fun _ _ => f.mul_hom }
#align Mon_.equiv_lax_monoidal_functor_punit.Mon_to_lax_monoidal Mon_.EquivLaxMonoidalFunctorPUnit.monToLaxMonoidal
attribute [local aesop safe tactic (rule_sets [CategoryTheory])]
CategoryTheory.Discrete.discreteCases
attribute [local simp] eqToIso_map
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps!]
def unitIso :
𝟭 (LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C) ≅ laxMonoidalToMon C ⋙ monToLaxMonoidal C :=
NatIso.ofComponents
(fun F =>
MonoidalNatIso.ofComponents (fun _ => F.toFunctor.mapIso (eqToIso (by ext))) (by aesop_cat)
(by aesop_cat) (by aesop_cat))
(by aesop_cat)
#align Mon_.equiv_lax_monoidal_functor_punit.unit_iso Mon_.EquivLaxMonoidalFunctorPUnit.unitIso
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps!]
def counitIso : monToLaxMonoidal C ⋙ laxMonoidalToMon C ≅ 𝟭 (Mon_ C) :=
NatIso.ofComponents
(fun F =>
{ hom := { hom := 𝟙 _ }
inv := { hom := 𝟙 _ } })
(by aesop_cat)
#align Mon_.equiv_lax_monoidal_functor_punit.counit_iso Mon_.EquivLaxMonoidalFunctorPUnit.counitIso
end EquivLaxMonoidalFunctorPUnit
open EquivLaxMonoidalFunctorPUnit
attribute [local simp] eqToIso_map
/--
Monoid objects in `C` are "just" lax monoidal functors from the trivial monoidal category to `C`.
-/
@[simps]
def equivLaxMonoidalFunctorPUnit : LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C ≌ Mon_ C where
functor := laxMonoidalToMon C
inverse := monToLaxMonoidal C
unitIso := unitIso C
counitIso := counitIso C
#align Mon_.equiv_lax_monoidal_functor_punit Mon_.equivLaxMonoidalFunctorPUnit
end Mon_
namespace Mon_
/-!
In this section, we prove that the category of monoids in a braided monoidal category is monoidal.
Given two monoids `M` and `N` in a braided monoidal category `C`,
the multiplication on the tensor product `M.X ⊗ N.X` is defined in the obvious way:
it is the tensor product of the multiplications on `M` and `N`,
except that the tensor factors in the source come in the wrong order,
which we fix by pre-composing with a permutation isomorphism constructed from the braiding.
(There is a subtlety here: in fact there are two ways to do these,
using either the positive or negative crossing.)
A more conceptual way of understanding this definition is the following:
The braiding on `C` gives rise to a monoidal structure on
the tensor product functor from `C × C` to `C`.
A pair of monoids in `C` gives rise to a monoid in `C × C`,
which the tensor product functor by being monoidal takes to a monoid in `C`.
The permutation isomorphism appearing in the definition of
the multiplication on the tensor product of two monoids is
an instance of a more general family of isomorphisms
which together form a strength that equips the tensor product functor with a monoidal structure,
and the monoid axioms for the tensor product follow from the monoid axioms for the tensor factors
plus the properties of the strength (i.e., monoidal functor axioms).
The strength `tensor_μ` of the tensor product functor has been defined in
`Mathlib.CategoryTheory.Monoidal.Braided`.
Its properties, stated as independent lemmas in that module,
are used extensively in the proofs below.
Notice that we could have followed the above plan not only conceptually
but also as a possible implementation and
could have constructed the tensor product of monoids via `mapMon`,
but we chose to give a more explicit definition directly in terms of `tensor_μ`.
To complete the definition of the monoidal category structure on the category of monoids,
we need to provide definitions of associator and unitors.
The obvious candidates are the associator and unitors from `C`,
but we need to prove that they are monoid morphisms, i.e., compatible with unit and multiplication.
These properties translate to the monoidality of the associator and unitors
(with respect to the monoidal structures on the functors they relate),
which have also been proved in `Mathlib.CategoryTheory.Monoidal.Braided`.
-/
variable {C}
-- The proofs that associators and unitors preserve monoid units don't require braiding.
theorem one_associator {M N P : Mon_ C} :
((λ_ (𝟙_ C)).inv ≫ ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) ⊗ P.one)) ≫ (α_ M.X N.X P.X).hom =
(λ_ (𝟙_ C)).inv ≫ (M.one ⊗ (λ_ (𝟙_ C)).inv ≫ (N.one ⊗ P.one)) := by
simp only [Category.assoc, Iso.cancel_iso_inv_left]
slice_lhs 1 3 => rw [← Category.id_comp P.one, tensor_comp]
slice_lhs 2 3 => rw [associator_naturality]
slice_rhs 1 2 => rw [← Category.id_comp M.one, tensor_comp]
slice_lhs 1 2 => rw [← leftUnitor_tensor_inv]
rw [← cancel_epi (λ_ (𝟙_ C)).inv]
| slice_lhs 1 2 => rw [leftUnitor_inv_naturality] | theorem one_associator {M N P : Mon_ C} :
((λ_ (𝟙_ C)).inv ≫ ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) ⊗ P.one)) ≫ (α_ M.X N.X P.X).hom =
(λ_ (𝟙_ C)).inv ≫ (M.one ⊗ (λ_ (𝟙_ C)).inv ≫ (N.one ⊗ P.one)) := by
simp only [Category.assoc, Iso.cancel_iso_inv_left]
slice_lhs 1 3 => rw [← Category.id_comp P.one, tensor_comp]
slice_lhs 2 3 => rw [associator_naturality]
slice_rhs 1 2 => rw [← Category.id_comp M.one, tensor_comp]
slice_lhs 1 2 => rw [← leftUnitor_tensor_inv]
rw [← cancel_epi (λ_ (𝟙_ C)).inv]
| Mathlib.CategoryTheory.Monoidal.Mon_.380_0.NTUMzhXPwXsmsYt | theorem one_associator {M N P : Mon_ C} :
((λ_ (𝟙_ C)).inv ≫ ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) ⊗ P.one)) ≫ (α_ M.X N.X P.X).hom =
(λ_ (𝟙_ C)).inv ≫ (M.one ⊗ (λ_ (𝟙_ C)).inv ≫ (N.one ⊗ P.one)) | Mathlib_CategoryTheory_Monoidal_Mon_ |
case a
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : MonoidalCategory C
M N P : Mon_ C
| (λ_ (𝟙_ C)).inv ≫ (λ_ (𝟙_ C ⊗ 𝟙_ C)).inv
case a C : Type u₁ inst✝¹ : Category.{v₁, u₁} C inst✝ : MonoidalCategory C M N P : Mon_ C | M.one ⊗ N.one ⊗ P.one | /-
Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/
import Mathlib.CategoryTheory.Monoidal.Braided
import Mathlib.CategoryTheory.Monoidal.Discrete
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
import Mathlib.Algebra.PUnitInstances
#align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c"
/-!
# The category of monoids in a monoidal category.
We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to
the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if
`C` is braided, then the category of monoids is naturally monoidal.
-/
set_option linter.uppercaseLean3 false
universe v₁ v₂ u₁ u₂ u
open CategoryTheory MonoidalCategory
variable (C : Type u₁) [Category.{v₁} C] [MonoidalCategory.{v₁} C]
/-- A monoid object internal to a monoidal category.
When the monoidal category is preadditive, this is also sometimes called an "algebra object".
-/
structure Mon_ where
X : C
one : 𝟙_ C ⟶ X
mul : X ⊗ X ⟶ X
one_mul : (one ⊗ 𝟙 X) ≫ mul = (λ_ X).hom := by aesop_cat
mul_one : (𝟙 X ⊗ one) ≫ mul = (ρ_ X).hom := by aesop_cat
-- Obviously there is some flexibility stating this axiom.
-- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`,
-- and chooses to place the associator on the right-hand side.
-- The heuristic is that unitors and associators "don't have much weight".
mul_assoc : (mul ⊗ 𝟙 X) ≫ mul = (α_ X X X).hom ≫ (𝟙 X ⊗ mul) ≫ mul := by aesop_cat
#align Mon_ Mon_
attribute [reassoc] Mon_.one_mul Mon_.mul_one
-- We prove a more general `@[simp]` lemma below.
attribute [reassoc (attr := simp)] Mon_.mul_assoc
namespace Mon_
/-- The trivial monoid object. We later show this is initial in `Mon_ C`.
-/
@[simps]
def trivial : Mon_ C where
X := 𝟙_ C
one := 𝟙 _
mul := (λ_ _).hom
mul_assoc := by coherence
mul_one := by coherence
#align Mon_.trivial Mon_.trivial
instance : Inhabited (Mon_ C) :=
⟨trivial C⟩
variable {C}
variable {M : Mon_ C}
@[simp]
theorem one_mul_hom {Z : C} (f : Z ⟶ M.X) : (M.one ⊗ f) ≫ M.mul = (λ_ Z).hom ≫ f := by
rw [← id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality]
#align Mon_.one_mul_hom Mon_.one_mul_hom
@[simp]
theorem mul_one_hom {Z : C} (f : Z ⟶ M.X) : (f ⊗ M.one) ≫ M.mul = (ρ_ Z).hom ≫ f := by
rw [← tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality]
#align Mon_.mul_one_hom Mon_.mul_one_hom
theorem assoc_flip :
(𝟙 M.X ⊗ M.mul) ≫ M.mul = (α_ M.X M.X M.X).inv ≫ (M.mul ⊗ 𝟙 M.X) ≫ M.mul := by simp
#align Mon_.assoc_flip Mon_.assoc_flip
/-- A morphism of monoid objects. -/
@[ext]
structure Hom (M N : Mon_ C) where
hom : M.X ⟶ N.X
one_hom : M.one ≫ hom = N.one := by aesop_cat
mul_hom : M.mul ≫ hom = (hom ⊗ hom) ≫ N.mul := by aesop_cat
#align Mon_.hom Mon_.Hom
attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom
/-- The identity morphism on a monoid object. -/
@[simps]
def id (M : Mon_ C) : Hom M M where
hom := 𝟙 M.X
#align Mon_.id Mon_.id
instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) :=
⟨id M⟩
#align Mon_.hom_inhabited Mon_.homInhabited
/-- Composition of morphisms of monoid objects. -/
@[simps]
def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where
hom := f.hom ≫ g.hom
#align Mon_.comp Mon_.comp
instance : Category (Mon_ C) where
Hom M N := Hom M N
id := id
comp f g := comp f g
-- Porting note: added, as `Hom.ext` does not apply to a morphism.
@[ext]
lemma ext {X Y : Mon_ C} {f g : X ⟶ Y} (w : f.hom = g.hom) : f = g :=
Hom.ext _ _ w
@[simp]
theorem id_hom' (M : Mon_ C) : (𝟙 M : Hom M M).hom = 𝟙 M.X :=
rfl
#align Mon_.id_hom' Mon_.id_hom'
@[simp]
theorem comp_hom' {M N K : Mon_ C} (f : M ⟶ N) (g : N ⟶ K) :
(f ≫ g : Hom M K).hom = f.hom ≫ g.hom :=
rfl
#align Mon_.comp_hom' Mon_.comp_hom'
section
variable (C)
/-- The forgetful functor from monoid objects to the ambient category. -/
@[simps]
def forget : Mon_ C ⥤ C where
obj A := A.X
map f := f.hom
#align Mon_.forget Mon_.forget
end
instance forget_faithful : Faithful (@forget C _ _) where
#align Mon_.forget_faithful Mon_.forget_faithful
instance {A B : Mon_ C} (f : A ⟶ B) [e : IsIso ((forget C).map f)] : IsIso f.hom :=
e
/-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/
instance : ReflectsIsomorphisms (forget C) where
reflects f e :=
⟨⟨{ hom := inv f.hom
mul_hom := by
simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, ← tensor_comp_assoc,
IsIso.inv_hom_id, tensor_id, Category.id_comp] },
by aesop_cat⟩⟩
/-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X ≅ N.X) (one_f : M.one ≫ f.hom = N.one)
(mul_f : M.mul ≫ f.hom = (f.hom ⊗ f.hom) ≫ N.mul) : M ≅ N where
hom :=
{ hom := f.hom
one_hom := one_f
mul_hom := mul_f }
inv :=
{ hom := f.inv
one_hom := by rw [← one_f]; simp
mul_hom := by
rw [← cancel_mono f.hom]
slice_rhs 2 3 => rw [mul_f]
simp }
#align Mon_.iso_of_iso Mon_.isoOfIso
instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C ⟶ A) where
default :=
{ hom := A.one
one_hom := by dsimp; simp
mul_hom := by dsimp; simp [A.one_mul, unitors_equal] }
uniq f := by
ext; simp
rw [← Category.id_comp f.hom]
erw [f.one_hom]
#align Mon_.unique_hom_from_trivial Mon_.uniqueHomFromTrivial
open CategoryTheory.Limits
instance : HasInitial (Mon_ C) :=
hasInitial_of_unique (trivial C)
end Mon_
namespace CategoryTheory.LaxMonoidalFunctor
variable {C} {D : Type u₂} [Category.{v₂} D] [MonoidalCategory.{v₂} D]
-- TODO: mapMod F A : Mod A ⥤ Mod (F.mapMon A)
/-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one]
rw [F.toFunctor.map_id]
rw [F.right_unitality]
mul_assoc := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_assoc]
conv_lhs => rw [F.toFunctor.map_id]
conv_lhs => rw [F.toFunctor.map_comp, F.toFunctor.map_comp]
conv_rhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_rhs 3 4 => rw [F.μ_natural]
conv_rhs => rw [F.toFunctor.map_id]
slice_rhs 1 3 => rw [← F.associativity]
simp only [Category.assoc] }
map f :=
{ hom := F.map f.hom
one_hom := by dsimp; rw [Category.assoc, ← F.toFunctor.map_comp, f.one_hom]
mul_hom := by
dsimp
rw [Category.assoc, F.μ_natural_assoc, ← F.toFunctor.map_comp, ← F.toFunctor.map_comp,
f.mul_hom] }
map_id A := by ext; simp
map_comp f g := by ext; simp
#align category_theory.lax_monoidal_functor.map_Mon CategoryTheory.LaxMonoidalFunctor.mapMon
variable (C D)
/-- `mapMon` is functorial in the lax monoidal functor. -/
@[simps] -- Porting note: added this, not sure how it worked previously without.
def mapMonFunctor : LaxMonoidalFunctor C D ⥤ Mon_ C ⥤ Mon_ D where
obj := mapMon
map α := { app := fun A => { hom := α.app A.X } }
#align category_theory.lax_monoidal_functor.map_Mon_functor CategoryTheory.LaxMonoidalFunctor.mapMonFunctor
end CategoryTheory.LaxMonoidalFunctor
namespace Mon_
open CategoryTheory.LaxMonoidalFunctor
namespace EquivLaxMonoidalFunctorPUnit
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps]
def laxMonoidalToMon : LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C ⥤ Mon_ C where
obj F := (F.mapMon : Mon_ _ ⥤ Mon_ C).obj (trivial (Discrete PUnit))
map α := ((mapMonFunctor (Discrete PUnit) C).map α).app _
#align Mon_.equiv_lax_monoidal_functor_punit.lax_monoidal_to_Mon Mon_.EquivLaxMonoidalFunctorPUnit.laxMonoidalToMon
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps]
def monToLaxMonoidal : Mon_ C ⥤ LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C where
obj A :=
{ obj := fun _ => A.X
map := fun _ => 𝟙 _
ε := A.one
μ := fun _ _ => A.mul
map_id := fun _ => rfl
map_comp := fun _ _ => (Category.id_comp (𝟙 A.X)).symm }
map f :=
{ app := fun _ => f.hom
naturality := fun _ _ _ => by dsimp; rw [Category.id_comp, Category.comp_id]
unit := f.one_hom
tensor := fun _ _ => f.mul_hom }
#align Mon_.equiv_lax_monoidal_functor_punit.Mon_to_lax_monoidal Mon_.EquivLaxMonoidalFunctorPUnit.monToLaxMonoidal
attribute [local aesop safe tactic (rule_sets [CategoryTheory])]
CategoryTheory.Discrete.discreteCases
attribute [local simp] eqToIso_map
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps!]
def unitIso :
𝟭 (LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C) ≅ laxMonoidalToMon C ⋙ monToLaxMonoidal C :=
NatIso.ofComponents
(fun F =>
MonoidalNatIso.ofComponents (fun _ => F.toFunctor.mapIso (eqToIso (by ext))) (by aesop_cat)
(by aesop_cat) (by aesop_cat))
(by aesop_cat)
#align Mon_.equiv_lax_monoidal_functor_punit.unit_iso Mon_.EquivLaxMonoidalFunctorPUnit.unitIso
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps!]
def counitIso : monToLaxMonoidal C ⋙ laxMonoidalToMon C ≅ 𝟭 (Mon_ C) :=
NatIso.ofComponents
(fun F =>
{ hom := { hom := 𝟙 _ }
inv := { hom := 𝟙 _ } })
(by aesop_cat)
#align Mon_.equiv_lax_monoidal_functor_punit.counit_iso Mon_.EquivLaxMonoidalFunctorPUnit.counitIso
end EquivLaxMonoidalFunctorPUnit
open EquivLaxMonoidalFunctorPUnit
attribute [local simp] eqToIso_map
/--
Monoid objects in `C` are "just" lax monoidal functors from the trivial monoidal category to `C`.
-/
@[simps]
def equivLaxMonoidalFunctorPUnit : LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C ≌ Mon_ C where
functor := laxMonoidalToMon C
inverse := monToLaxMonoidal C
unitIso := unitIso C
counitIso := counitIso C
#align Mon_.equiv_lax_monoidal_functor_punit Mon_.equivLaxMonoidalFunctorPUnit
end Mon_
namespace Mon_
/-!
In this section, we prove that the category of monoids in a braided monoidal category is monoidal.
Given two monoids `M` and `N` in a braided monoidal category `C`,
the multiplication on the tensor product `M.X ⊗ N.X` is defined in the obvious way:
it is the tensor product of the multiplications on `M` and `N`,
except that the tensor factors in the source come in the wrong order,
which we fix by pre-composing with a permutation isomorphism constructed from the braiding.
(There is a subtlety here: in fact there are two ways to do these,
using either the positive or negative crossing.)
A more conceptual way of understanding this definition is the following:
The braiding on `C` gives rise to a monoidal structure on
the tensor product functor from `C × C` to `C`.
A pair of monoids in `C` gives rise to a monoid in `C × C`,
which the tensor product functor by being monoidal takes to a monoid in `C`.
The permutation isomorphism appearing in the definition of
the multiplication on the tensor product of two monoids is
an instance of a more general family of isomorphisms
which together form a strength that equips the tensor product functor with a monoidal structure,
and the monoid axioms for the tensor product follow from the monoid axioms for the tensor factors
plus the properties of the strength (i.e., monoidal functor axioms).
The strength `tensor_μ` of the tensor product functor has been defined in
`Mathlib.CategoryTheory.Monoidal.Braided`.
Its properties, stated as independent lemmas in that module,
are used extensively in the proofs below.
Notice that we could have followed the above plan not only conceptually
but also as a possible implementation and
could have constructed the tensor product of monoids via `mapMon`,
but we chose to give a more explicit definition directly in terms of `tensor_μ`.
To complete the definition of the monoidal category structure on the category of monoids,
we need to provide definitions of associator and unitors.
The obvious candidates are the associator and unitors from `C`,
but we need to prove that they are monoid morphisms, i.e., compatible with unit and multiplication.
These properties translate to the monoidality of the associator and unitors
(with respect to the monoidal structures on the functors they relate),
which have also been proved in `Mathlib.CategoryTheory.Monoidal.Braided`.
-/
variable {C}
-- The proofs that associators and unitors preserve monoid units don't require braiding.
theorem one_associator {M N P : Mon_ C} :
((λ_ (𝟙_ C)).inv ≫ ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) ⊗ P.one)) ≫ (α_ M.X N.X P.X).hom =
(λ_ (𝟙_ C)).inv ≫ (M.one ⊗ (λ_ (𝟙_ C)).inv ≫ (N.one ⊗ P.one)) := by
simp only [Category.assoc, Iso.cancel_iso_inv_left]
slice_lhs 1 3 => rw [← Category.id_comp P.one, tensor_comp]
slice_lhs 2 3 => rw [associator_naturality]
slice_rhs 1 2 => rw [← Category.id_comp M.one, tensor_comp]
slice_lhs 1 2 => rw [← leftUnitor_tensor_inv]
rw [← cancel_epi (λ_ (𝟙_ C)).inv]
slice_lhs 1 2 => | rw [leftUnitor_inv_naturality] | theorem one_associator {M N P : Mon_ C} :
((λ_ (𝟙_ C)).inv ≫ ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) ⊗ P.one)) ≫ (α_ M.X N.X P.X).hom =
(λ_ (𝟙_ C)).inv ≫ (M.one ⊗ (λ_ (𝟙_ C)).inv ≫ (N.one ⊗ P.one)) := by
simp only [Category.assoc, Iso.cancel_iso_inv_left]
slice_lhs 1 3 => rw [← Category.id_comp P.one, tensor_comp]
slice_lhs 2 3 => rw [associator_naturality]
slice_rhs 1 2 => rw [← Category.id_comp M.one, tensor_comp]
slice_lhs 1 2 => rw [← leftUnitor_tensor_inv]
rw [← cancel_epi (λ_ (𝟙_ C)).inv]
slice_lhs 1 2 => | Mathlib.CategoryTheory.Monoidal.Mon_.380_0.NTUMzhXPwXsmsYt | theorem one_associator {M N P : Mon_ C} :
((λ_ (𝟙_ C)).inv ≫ ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) ⊗ P.one)) ≫ (α_ M.X N.X P.X).hom =
(λ_ (𝟙_ C)).inv ≫ (M.one ⊗ (λ_ (𝟙_ C)).inv ≫ (N.one ⊗ P.one)) | Mathlib_CategoryTheory_Monoidal_Mon_ |
case a
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : MonoidalCategory C
M N P : Mon_ C
| (λ_ (𝟙_ C)).inv ≫ (λ_ (𝟙_ C ⊗ 𝟙_ C)).inv
case a C : Type u₁ inst✝¹ : Category.{v₁, u₁} C inst✝ : MonoidalCategory C M N P : Mon_ C | M.one ⊗ N.one ⊗ P.one | /-
Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/
import Mathlib.CategoryTheory.Monoidal.Braided
import Mathlib.CategoryTheory.Monoidal.Discrete
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
import Mathlib.Algebra.PUnitInstances
#align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c"
/-!
# The category of monoids in a monoidal category.
We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to
the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if
`C` is braided, then the category of monoids is naturally monoidal.
-/
set_option linter.uppercaseLean3 false
universe v₁ v₂ u₁ u₂ u
open CategoryTheory MonoidalCategory
variable (C : Type u₁) [Category.{v₁} C] [MonoidalCategory.{v₁} C]
/-- A monoid object internal to a monoidal category.
When the monoidal category is preadditive, this is also sometimes called an "algebra object".
-/
structure Mon_ where
X : C
one : 𝟙_ C ⟶ X
mul : X ⊗ X ⟶ X
one_mul : (one ⊗ 𝟙 X) ≫ mul = (λ_ X).hom := by aesop_cat
mul_one : (𝟙 X ⊗ one) ≫ mul = (ρ_ X).hom := by aesop_cat
-- Obviously there is some flexibility stating this axiom.
-- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`,
-- and chooses to place the associator on the right-hand side.
-- The heuristic is that unitors and associators "don't have much weight".
mul_assoc : (mul ⊗ 𝟙 X) ≫ mul = (α_ X X X).hom ≫ (𝟙 X ⊗ mul) ≫ mul := by aesop_cat
#align Mon_ Mon_
attribute [reassoc] Mon_.one_mul Mon_.mul_one
-- We prove a more general `@[simp]` lemma below.
attribute [reassoc (attr := simp)] Mon_.mul_assoc
namespace Mon_
/-- The trivial monoid object. We later show this is initial in `Mon_ C`.
-/
@[simps]
def trivial : Mon_ C where
X := 𝟙_ C
one := 𝟙 _
mul := (λ_ _).hom
mul_assoc := by coherence
mul_one := by coherence
#align Mon_.trivial Mon_.trivial
instance : Inhabited (Mon_ C) :=
⟨trivial C⟩
variable {C}
variable {M : Mon_ C}
@[simp]
theorem one_mul_hom {Z : C} (f : Z ⟶ M.X) : (M.one ⊗ f) ≫ M.mul = (λ_ Z).hom ≫ f := by
rw [← id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality]
#align Mon_.one_mul_hom Mon_.one_mul_hom
@[simp]
theorem mul_one_hom {Z : C} (f : Z ⟶ M.X) : (f ⊗ M.one) ≫ M.mul = (ρ_ Z).hom ≫ f := by
rw [← tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality]
#align Mon_.mul_one_hom Mon_.mul_one_hom
theorem assoc_flip :
(𝟙 M.X ⊗ M.mul) ≫ M.mul = (α_ M.X M.X M.X).inv ≫ (M.mul ⊗ 𝟙 M.X) ≫ M.mul := by simp
#align Mon_.assoc_flip Mon_.assoc_flip
/-- A morphism of monoid objects. -/
@[ext]
structure Hom (M N : Mon_ C) where
hom : M.X ⟶ N.X
one_hom : M.one ≫ hom = N.one := by aesop_cat
mul_hom : M.mul ≫ hom = (hom ⊗ hom) ≫ N.mul := by aesop_cat
#align Mon_.hom Mon_.Hom
attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom
/-- The identity morphism on a monoid object. -/
@[simps]
def id (M : Mon_ C) : Hom M M where
hom := 𝟙 M.X
#align Mon_.id Mon_.id
instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) :=
⟨id M⟩
#align Mon_.hom_inhabited Mon_.homInhabited
/-- Composition of morphisms of monoid objects. -/
@[simps]
def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where
hom := f.hom ≫ g.hom
#align Mon_.comp Mon_.comp
instance : Category (Mon_ C) where
Hom M N := Hom M N
id := id
comp f g := comp f g
-- Porting note: added, as `Hom.ext` does not apply to a morphism.
@[ext]
lemma ext {X Y : Mon_ C} {f g : X ⟶ Y} (w : f.hom = g.hom) : f = g :=
Hom.ext _ _ w
@[simp]
theorem id_hom' (M : Mon_ C) : (𝟙 M : Hom M M).hom = 𝟙 M.X :=
rfl
#align Mon_.id_hom' Mon_.id_hom'
@[simp]
theorem comp_hom' {M N K : Mon_ C} (f : M ⟶ N) (g : N ⟶ K) :
(f ≫ g : Hom M K).hom = f.hom ≫ g.hom :=
rfl
#align Mon_.comp_hom' Mon_.comp_hom'
section
variable (C)
/-- The forgetful functor from monoid objects to the ambient category. -/
@[simps]
def forget : Mon_ C ⥤ C where
obj A := A.X
map f := f.hom
#align Mon_.forget Mon_.forget
end
instance forget_faithful : Faithful (@forget C _ _) where
#align Mon_.forget_faithful Mon_.forget_faithful
instance {A B : Mon_ C} (f : A ⟶ B) [e : IsIso ((forget C).map f)] : IsIso f.hom :=
e
/-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/
instance : ReflectsIsomorphisms (forget C) where
reflects f e :=
⟨⟨{ hom := inv f.hom
mul_hom := by
simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, ← tensor_comp_assoc,
IsIso.inv_hom_id, tensor_id, Category.id_comp] },
by aesop_cat⟩⟩
/-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X ≅ N.X) (one_f : M.one ≫ f.hom = N.one)
(mul_f : M.mul ≫ f.hom = (f.hom ⊗ f.hom) ≫ N.mul) : M ≅ N where
hom :=
{ hom := f.hom
one_hom := one_f
mul_hom := mul_f }
inv :=
{ hom := f.inv
one_hom := by rw [← one_f]; simp
mul_hom := by
rw [← cancel_mono f.hom]
slice_rhs 2 3 => rw [mul_f]
simp }
#align Mon_.iso_of_iso Mon_.isoOfIso
instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C ⟶ A) where
default :=
{ hom := A.one
one_hom := by dsimp; simp
mul_hom := by dsimp; simp [A.one_mul, unitors_equal] }
uniq f := by
ext; simp
rw [← Category.id_comp f.hom]
erw [f.one_hom]
#align Mon_.unique_hom_from_trivial Mon_.uniqueHomFromTrivial
open CategoryTheory.Limits
instance : HasInitial (Mon_ C) :=
hasInitial_of_unique (trivial C)
end Mon_
namespace CategoryTheory.LaxMonoidalFunctor
variable {C} {D : Type u₂} [Category.{v₂} D] [MonoidalCategory.{v₂} D]
-- TODO: mapMod F A : Mod A ⥤ Mod (F.mapMon A)
/-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one]
rw [F.toFunctor.map_id]
rw [F.right_unitality]
mul_assoc := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_assoc]
conv_lhs => rw [F.toFunctor.map_id]
conv_lhs => rw [F.toFunctor.map_comp, F.toFunctor.map_comp]
conv_rhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_rhs 3 4 => rw [F.μ_natural]
conv_rhs => rw [F.toFunctor.map_id]
slice_rhs 1 3 => rw [← F.associativity]
simp only [Category.assoc] }
map f :=
{ hom := F.map f.hom
one_hom := by dsimp; rw [Category.assoc, ← F.toFunctor.map_comp, f.one_hom]
mul_hom := by
dsimp
rw [Category.assoc, F.μ_natural_assoc, ← F.toFunctor.map_comp, ← F.toFunctor.map_comp,
f.mul_hom] }
map_id A := by ext; simp
map_comp f g := by ext; simp
#align category_theory.lax_monoidal_functor.map_Mon CategoryTheory.LaxMonoidalFunctor.mapMon
variable (C D)
/-- `mapMon` is functorial in the lax monoidal functor. -/
@[simps] -- Porting note: added this, not sure how it worked previously without.
def mapMonFunctor : LaxMonoidalFunctor C D ⥤ Mon_ C ⥤ Mon_ D where
obj := mapMon
map α := { app := fun A => { hom := α.app A.X } }
#align category_theory.lax_monoidal_functor.map_Mon_functor CategoryTheory.LaxMonoidalFunctor.mapMonFunctor
end CategoryTheory.LaxMonoidalFunctor
namespace Mon_
open CategoryTheory.LaxMonoidalFunctor
namespace EquivLaxMonoidalFunctorPUnit
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps]
def laxMonoidalToMon : LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C ⥤ Mon_ C where
obj F := (F.mapMon : Mon_ _ ⥤ Mon_ C).obj (trivial (Discrete PUnit))
map α := ((mapMonFunctor (Discrete PUnit) C).map α).app _
#align Mon_.equiv_lax_monoidal_functor_punit.lax_monoidal_to_Mon Mon_.EquivLaxMonoidalFunctorPUnit.laxMonoidalToMon
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps]
def monToLaxMonoidal : Mon_ C ⥤ LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C where
obj A :=
{ obj := fun _ => A.X
map := fun _ => 𝟙 _
ε := A.one
μ := fun _ _ => A.mul
map_id := fun _ => rfl
map_comp := fun _ _ => (Category.id_comp (𝟙 A.X)).symm }
map f :=
{ app := fun _ => f.hom
naturality := fun _ _ _ => by dsimp; rw [Category.id_comp, Category.comp_id]
unit := f.one_hom
tensor := fun _ _ => f.mul_hom }
#align Mon_.equiv_lax_monoidal_functor_punit.Mon_to_lax_monoidal Mon_.EquivLaxMonoidalFunctorPUnit.monToLaxMonoidal
attribute [local aesop safe tactic (rule_sets [CategoryTheory])]
CategoryTheory.Discrete.discreteCases
attribute [local simp] eqToIso_map
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps!]
def unitIso :
𝟭 (LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C) ≅ laxMonoidalToMon C ⋙ monToLaxMonoidal C :=
NatIso.ofComponents
(fun F =>
MonoidalNatIso.ofComponents (fun _ => F.toFunctor.mapIso (eqToIso (by ext))) (by aesop_cat)
(by aesop_cat) (by aesop_cat))
(by aesop_cat)
#align Mon_.equiv_lax_monoidal_functor_punit.unit_iso Mon_.EquivLaxMonoidalFunctorPUnit.unitIso
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps!]
def counitIso : monToLaxMonoidal C ⋙ laxMonoidalToMon C ≅ 𝟭 (Mon_ C) :=
NatIso.ofComponents
(fun F =>
{ hom := { hom := 𝟙 _ }
inv := { hom := 𝟙 _ } })
(by aesop_cat)
#align Mon_.equiv_lax_monoidal_functor_punit.counit_iso Mon_.EquivLaxMonoidalFunctorPUnit.counitIso
end EquivLaxMonoidalFunctorPUnit
open EquivLaxMonoidalFunctorPUnit
attribute [local simp] eqToIso_map
/--
Monoid objects in `C` are "just" lax monoidal functors from the trivial monoidal category to `C`.
-/
@[simps]
def equivLaxMonoidalFunctorPUnit : LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C ≌ Mon_ C where
functor := laxMonoidalToMon C
inverse := monToLaxMonoidal C
unitIso := unitIso C
counitIso := counitIso C
#align Mon_.equiv_lax_monoidal_functor_punit Mon_.equivLaxMonoidalFunctorPUnit
end Mon_
namespace Mon_
/-!
In this section, we prove that the category of monoids in a braided monoidal category is monoidal.
Given two monoids `M` and `N` in a braided monoidal category `C`,
the multiplication on the tensor product `M.X ⊗ N.X` is defined in the obvious way:
it is the tensor product of the multiplications on `M` and `N`,
except that the tensor factors in the source come in the wrong order,
which we fix by pre-composing with a permutation isomorphism constructed from the braiding.
(There is a subtlety here: in fact there are two ways to do these,
using either the positive or negative crossing.)
A more conceptual way of understanding this definition is the following:
The braiding on `C` gives rise to a monoidal structure on
the tensor product functor from `C × C` to `C`.
A pair of monoids in `C` gives rise to a monoid in `C × C`,
which the tensor product functor by being monoidal takes to a monoid in `C`.
The permutation isomorphism appearing in the definition of
the multiplication on the tensor product of two monoids is
an instance of a more general family of isomorphisms
which together form a strength that equips the tensor product functor with a monoidal structure,
and the monoid axioms for the tensor product follow from the monoid axioms for the tensor factors
plus the properties of the strength (i.e., monoidal functor axioms).
The strength `tensor_μ` of the tensor product functor has been defined in
`Mathlib.CategoryTheory.Monoidal.Braided`.
Its properties, stated as independent lemmas in that module,
are used extensively in the proofs below.
Notice that we could have followed the above plan not only conceptually
but also as a possible implementation and
could have constructed the tensor product of monoids via `mapMon`,
but we chose to give a more explicit definition directly in terms of `tensor_μ`.
To complete the definition of the monoidal category structure on the category of monoids,
we need to provide definitions of associator and unitors.
The obvious candidates are the associator and unitors from `C`,
but we need to prove that they are monoid morphisms, i.e., compatible with unit and multiplication.
These properties translate to the monoidality of the associator and unitors
(with respect to the monoidal structures on the functors they relate),
which have also been proved in `Mathlib.CategoryTheory.Monoidal.Braided`.
-/
variable {C}
-- The proofs that associators and unitors preserve monoid units don't require braiding.
theorem one_associator {M N P : Mon_ C} :
((λ_ (𝟙_ C)).inv ≫ ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) ⊗ P.one)) ≫ (α_ M.X N.X P.X).hom =
(λ_ (𝟙_ C)).inv ≫ (M.one ⊗ (λ_ (𝟙_ C)).inv ≫ (N.one ⊗ P.one)) := by
simp only [Category.assoc, Iso.cancel_iso_inv_left]
slice_lhs 1 3 => rw [← Category.id_comp P.one, tensor_comp]
slice_lhs 2 3 => rw [associator_naturality]
slice_rhs 1 2 => rw [← Category.id_comp M.one, tensor_comp]
slice_lhs 1 2 => rw [← leftUnitor_tensor_inv]
rw [← cancel_epi (λ_ (𝟙_ C)).inv]
slice_lhs 1 2 => | rw [leftUnitor_inv_naturality] | theorem one_associator {M N P : Mon_ C} :
((λ_ (𝟙_ C)).inv ≫ ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) ⊗ P.one)) ≫ (α_ M.X N.X P.X).hom =
(λ_ (𝟙_ C)).inv ≫ (M.one ⊗ (λ_ (𝟙_ C)).inv ≫ (N.one ⊗ P.one)) := by
simp only [Category.assoc, Iso.cancel_iso_inv_left]
slice_lhs 1 3 => rw [← Category.id_comp P.one, tensor_comp]
slice_lhs 2 3 => rw [associator_naturality]
slice_rhs 1 2 => rw [← Category.id_comp M.one, tensor_comp]
slice_lhs 1 2 => rw [← leftUnitor_tensor_inv]
rw [← cancel_epi (λ_ (𝟙_ C)).inv]
slice_lhs 1 2 => | Mathlib.CategoryTheory.Monoidal.Mon_.380_0.NTUMzhXPwXsmsYt | theorem one_associator {M N P : Mon_ C} :
((λ_ (𝟙_ C)).inv ≫ ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) ⊗ P.one)) ≫ (α_ M.X N.X P.X).hom =
(λ_ (𝟙_ C)).inv ≫ (M.one ⊗ (λ_ (𝟙_ C)).inv ≫ (N.one ⊗ P.one)) | Mathlib_CategoryTheory_Monoidal_Mon_ |
case a
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : MonoidalCategory C
M N P : Mon_ C
| (λ_ (𝟙_ C)).inv ≫ (λ_ (𝟙_ C ⊗ 𝟙_ C)).inv
case a C : Type u₁ inst✝¹ : Category.{v₁, u₁} C inst✝ : MonoidalCategory C M N P : Mon_ C | M.one ⊗ N.one ⊗ P.one | /-
Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/
import Mathlib.CategoryTheory.Monoidal.Braided
import Mathlib.CategoryTheory.Monoidal.Discrete
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
import Mathlib.Algebra.PUnitInstances
#align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c"
/-!
# The category of monoids in a monoidal category.
We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to
the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if
`C` is braided, then the category of monoids is naturally monoidal.
-/
set_option linter.uppercaseLean3 false
universe v₁ v₂ u₁ u₂ u
open CategoryTheory MonoidalCategory
variable (C : Type u₁) [Category.{v₁} C] [MonoidalCategory.{v₁} C]
/-- A monoid object internal to a monoidal category.
When the monoidal category is preadditive, this is also sometimes called an "algebra object".
-/
structure Mon_ where
X : C
one : 𝟙_ C ⟶ X
mul : X ⊗ X ⟶ X
one_mul : (one ⊗ 𝟙 X) ≫ mul = (λ_ X).hom := by aesop_cat
mul_one : (𝟙 X ⊗ one) ≫ mul = (ρ_ X).hom := by aesop_cat
-- Obviously there is some flexibility stating this axiom.
-- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`,
-- and chooses to place the associator on the right-hand side.
-- The heuristic is that unitors and associators "don't have much weight".
mul_assoc : (mul ⊗ 𝟙 X) ≫ mul = (α_ X X X).hom ≫ (𝟙 X ⊗ mul) ≫ mul := by aesop_cat
#align Mon_ Mon_
attribute [reassoc] Mon_.one_mul Mon_.mul_one
-- We prove a more general `@[simp]` lemma below.
attribute [reassoc (attr := simp)] Mon_.mul_assoc
namespace Mon_
/-- The trivial monoid object. We later show this is initial in `Mon_ C`.
-/
@[simps]
def trivial : Mon_ C where
X := 𝟙_ C
one := 𝟙 _
mul := (λ_ _).hom
mul_assoc := by coherence
mul_one := by coherence
#align Mon_.trivial Mon_.trivial
instance : Inhabited (Mon_ C) :=
⟨trivial C⟩
variable {C}
variable {M : Mon_ C}
@[simp]
theorem one_mul_hom {Z : C} (f : Z ⟶ M.X) : (M.one ⊗ f) ≫ M.mul = (λ_ Z).hom ≫ f := by
rw [← id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality]
#align Mon_.one_mul_hom Mon_.one_mul_hom
@[simp]
theorem mul_one_hom {Z : C} (f : Z ⟶ M.X) : (f ⊗ M.one) ≫ M.mul = (ρ_ Z).hom ≫ f := by
rw [← tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality]
#align Mon_.mul_one_hom Mon_.mul_one_hom
theorem assoc_flip :
(𝟙 M.X ⊗ M.mul) ≫ M.mul = (α_ M.X M.X M.X).inv ≫ (M.mul ⊗ 𝟙 M.X) ≫ M.mul := by simp
#align Mon_.assoc_flip Mon_.assoc_flip
/-- A morphism of monoid objects. -/
@[ext]
structure Hom (M N : Mon_ C) where
hom : M.X ⟶ N.X
one_hom : M.one ≫ hom = N.one := by aesop_cat
mul_hom : M.mul ≫ hom = (hom ⊗ hom) ≫ N.mul := by aesop_cat
#align Mon_.hom Mon_.Hom
attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom
/-- The identity morphism on a monoid object. -/
@[simps]
def id (M : Mon_ C) : Hom M M where
hom := 𝟙 M.X
#align Mon_.id Mon_.id
instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) :=
⟨id M⟩
#align Mon_.hom_inhabited Mon_.homInhabited
/-- Composition of morphisms of monoid objects. -/
@[simps]
def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where
hom := f.hom ≫ g.hom
#align Mon_.comp Mon_.comp
instance : Category (Mon_ C) where
Hom M N := Hom M N
id := id
comp f g := comp f g
-- Porting note: added, as `Hom.ext` does not apply to a morphism.
@[ext]
lemma ext {X Y : Mon_ C} {f g : X ⟶ Y} (w : f.hom = g.hom) : f = g :=
Hom.ext _ _ w
@[simp]
theorem id_hom' (M : Mon_ C) : (𝟙 M : Hom M M).hom = 𝟙 M.X :=
rfl
#align Mon_.id_hom' Mon_.id_hom'
@[simp]
theorem comp_hom' {M N K : Mon_ C} (f : M ⟶ N) (g : N ⟶ K) :
(f ≫ g : Hom M K).hom = f.hom ≫ g.hom :=
rfl
#align Mon_.comp_hom' Mon_.comp_hom'
section
variable (C)
/-- The forgetful functor from monoid objects to the ambient category. -/
@[simps]
def forget : Mon_ C ⥤ C where
obj A := A.X
map f := f.hom
#align Mon_.forget Mon_.forget
end
instance forget_faithful : Faithful (@forget C _ _) where
#align Mon_.forget_faithful Mon_.forget_faithful
instance {A B : Mon_ C} (f : A ⟶ B) [e : IsIso ((forget C).map f)] : IsIso f.hom :=
e
/-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/
instance : ReflectsIsomorphisms (forget C) where
reflects f e :=
⟨⟨{ hom := inv f.hom
mul_hom := by
simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, ← tensor_comp_assoc,
IsIso.inv_hom_id, tensor_id, Category.id_comp] },
by aesop_cat⟩⟩
/-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X ≅ N.X) (one_f : M.one ≫ f.hom = N.one)
(mul_f : M.mul ≫ f.hom = (f.hom ⊗ f.hom) ≫ N.mul) : M ≅ N where
hom :=
{ hom := f.hom
one_hom := one_f
mul_hom := mul_f }
inv :=
{ hom := f.inv
one_hom := by rw [← one_f]; simp
mul_hom := by
rw [← cancel_mono f.hom]
slice_rhs 2 3 => rw [mul_f]
simp }
#align Mon_.iso_of_iso Mon_.isoOfIso
instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C ⟶ A) where
default :=
{ hom := A.one
one_hom := by dsimp; simp
mul_hom := by dsimp; simp [A.one_mul, unitors_equal] }
uniq f := by
ext; simp
rw [← Category.id_comp f.hom]
erw [f.one_hom]
#align Mon_.unique_hom_from_trivial Mon_.uniqueHomFromTrivial
open CategoryTheory.Limits
instance : HasInitial (Mon_ C) :=
hasInitial_of_unique (trivial C)
end Mon_
namespace CategoryTheory.LaxMonoidalFunctor
variable {C} {D : Type u₂} [Category.{v₂} D] [MonoidalCategory.{v₂} D]
-- TODO: mapMod F A : Mod A ⥤ Mod (F.mapMon A)
/-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one]
rw [F.toFunctor.map_id]
rw [F.right_unitality]
mul_assoc := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_assoc]
conv_lhs => rw [F.toFunctor.map_id]
conv_lhs => rw [F.toFunctor.map_comp, F.toFunctor.map_comp]
conv_rhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_rhs 3 4 => rw [F.μ_natural]
conv_rhs => rw [F.toFunctor.map_id]
slice_rhs 1 3 => rw [← F.associativity]
simp only [Category.assoc] }
map f :=
{ hom := F.map f.hom
one_hom := by dsimp; rw [Category.assoc, ← F.toFunctor.map_comp, f.one_hom]
mul_hom := by
dsimp
rw [Category.assoc, F.μ_natural_assoc, ← F.toFunctor.map_comp, ← F.toFunctor.map_comp,
f.mul_hom] }
map_id A := by ext; simp
map_comp f g := by ext; simp
#align category_theory.lax_monoidal_functor.map_Mon CategoryTheory.LaxMonoidalFunctor.mapMon
variable (C D)
/-- `mapMon` is functorial in the lax monoidal functor. -/
@[simps] -- Porting note: added this, not sure how it worked previously without.
def mapMonFunctor : LaxMonoidalFunctor C D ⥤ Mon_ C ⥤ Mon_ D where
obj := mapMon
map α := { app := fun A => { hom := α.app A.X } }
#align category_theory.lax_monoidal_functor.map_Mon_functor CategoryTheory.LaxMonoidalFunctor.mapMonFunctor
end CategoryTheory.LaxMonoidalFunctor
namespace Mon_
open CategoryTheory.LaxMonoidalFunctor
namespace EquivLaxMonoidalFunctorPUnit
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps]
def laxMonoidalToMon : LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C ⥤ Mon_ C where
obj F := (F.mapMon : Mon_ _ ⥤ Mon_ C).obj (trivial (Discrete PUnit))
map α := ((mapMonFunctor (Discrete PUnit) C).map α).app _
#align Mon_.equiv_lax_monoidal_functor_punit.lax_monoidal_to_Mon Mon_.EquivLaxMonoidalFunctorPUnit.laxMonoidalToMon
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps]
def monToLaxMonoidal : Mon_ C ⥤ LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C where
obj A :=
{ obj := fun _ => A.X
map := fun _ => 𝟙 _
ε := A.one
μ := fun _ _ => A.mul
map_id := fun _ => rfl
map_comp := fun _ _ => (Category.id_comp (𝟙 A.X)).symm }
map f :=
{ app := fun _ => f.hom
naturality := fun _ _ _ => by dsimp; rw [Category.id_comp, Category.comp_id]
unit := f.one_hom
tensor := fun _ _ => f.mul_hom }
#align Mon_.equiv_lax_monoidal_functor_punit.Mon_to_lax_monoidal Mon_.EquivLaxMonoidalFunctorPUnit.monToLaxMonoidal
attribute [local aesop safe tactic (rule_sets [CategoryTheory])]
CategoryTheory.Discrete.discreteCases
attribute [local simp] eqToIso_map
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps!]
def unitIso :
𝟭 (LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C) ≅ laxMonoidalToMon C ⋙ monToLaxMonoidal C :=
NatIso.ofComponents
(fun F =>
MonoidalNatIso.ofComponents (fun _ => F.toFunctor.mapIso (eqToIso (by ext))) (by aesop_cat)
(by aesop_cat) (by aesop_cat))
(by aesop_cat)
#align Mon_.equiv_lax_monoidal_functor_punit.unit_iso Mon_.EquivLaxMonoidalFunctorPUnit.unitIso
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps!]
def counitIso : monToLaxMonoidal C ⋙ laxMonoidalToMon C ≅ 𝟭 (Mon_ C) :=
NatIso.ofComponents
(fun F =>
{ hom := { hom := 𝟙 _ }
inv := { hom := 𝟙 _ } })
(by aesop_cat)
#align Mon_.equiv_lax_monoidal_functor_punit.counit_iso Mon_.EquivLaxMonoidalFunctorPUnit.counitIso
end EquivLaxMonoidalFunctorPUnit
open EquivLaxMonoidalFunctorPUnit
attribute [local simp] eqToIso_map
/--
Monoid objects in `C` are "just" lax monoidal functors from the trivial monoidal category to `C`.
-/
@[simps]
def equivLaxMonoidalFunctorPUnit : LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C ≌ Mon_ C where
functor := laxMonoidalToMon C
inverse := monToLaxMonoidal C
unitIso := unitIso C
counitIso := counitIso C
#align Mon_.equiv_lax_monoidal_functor_punit Mon_.equivLaxMonoidalFunctorPUnit
end Mon_
namespace Mon_
/-!
In this section, we prove that the category of monoids in a braided monoidal category is monoidal.
Given two monoids `M` and `N` in a braided monoidal category `C`,
the multiplication on the tensor product `M.X ⊗ N.X` is defined in the obvious way:
it is the tensor product of the multiplications on `M` and `N`,
except that the tensor factors in the source come in the wrong order,
which we fix by pre-composing with a permutation isomorphism constructed from the braiding.
(There is a subtlety here: in fact there are two ways to do these,
using either the positive or negative crossing.)
A more conceptual way of understanding this definition is the following:
The braiding on `C` gives rise to a monoidal structure on
the tensor product functor from `C × C` to `C`.
A pair of monoids in `C` gives rise to a monoid in `C × C`,
which the tensor product functor by being monoidal takes to a monoid in `C`.
The permutation isomorphism appearing in the definition of
the multiplication on the tensor product of two monoids is
an instance of a more general family of isomorphisms
which together form a strength that equips the tensor product functor with a monoidal structure,
and the monoid axioms for the tensor product follow from the monoid axioms for the tensor factors
plus the properties of the strength (i.e., monoidal functor axioms).
The strength `tensor_μ` of the tensor product functor has been defined in
`Mathlib.CategoryTheory.Monoidal.Braided`.
Its properties, stated as independent lemmas in that module,
are used extensively in the proofs below.
Notice that we could have followed the above plan not only conceptually
but also as a possible implementation and
could have constructed the tensor product of monoids via `mapMon`,
but we chose to give a more explicit definition directly in terms of `tensor_μ`.
To complete the definition of the monoidal category structure on the category of monoids,
we need to provide definitions of associator and unitors.
The obvious candidates are the associator and unitors from `C`,
but we need to prove that they are monoid morphisms, i.e., compatible with unit and multiplication.
These properties translate to the monoidality of the associator and unitors
(with respect to the monoidal structures on the functors they relate),
which have also been proved in `Mathlib.CategoryTheory.Monoidal.Braided`.
-/
variable {C}
-- The proofs that associators and unitors preserve monoid units don't require braiding.
theorem one_associator {M N P : Mon_ C} :
((λ_ (𝟙_ C)).inv ≫ ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) ⊗ P.one)) ≫ (α_ M.X N.X P.X).hom =
(λ_ (𝟙_ C)).inv ≫ (M.one ⊗ (λ_ (𝟙_ C)).inv ≫ (N.one ⊗ P.one)) := by
simp only [Category.assoc, Iso.cancel_iso_inv_left]
slice_lhs 1 3 => rw [← Category.id_comp P.one, tensor_comp]
slice_lhs 2 3 => rw [associator_naturality]
slice_rhs 1 2 => rw [← Category.id_comp M.one, tensor_comp]
slice_lhs 1 2 => rw [← leftUnitor_tensor_inv]
rw [← cancel_epi (λ_ (𝟙_ C)).inv]
slice_lhs 1 2 => | rw [leftUnitor_inv_naturality] | theorem one_associator {M N P : Mon_ C} :
((λ_ (𝟙_ C)).inv ≫ ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) ⊗ P.one)) ≫ (α_ M.X N.X P.X).hom =
(λ_ (𝟙_ C)).inv ≫ (M.one ⊗ (λ_ (𝟙_ C)).inv ≫ (N.one ⊗ P.one)) := by
simp only [Category.assoc, Iso.cancel_iso_inv_left]
slice_lhs 1 3 => rw [← Category.id_comp P.one, tensor_comp]
slice_lhs 2 3 => rw [associator_naturality]
slice_rhs 1 2 => rw [← Category.id_comp M.one, tensor_comp]
slice_lhs 1 2 => rw [← leftUnitor_tensor_inv]
rw [← cancel_epi (λ_ (𝟙_ C)).inv]
slice_lhs 1 2 => | Mathlib.CategoryTheory.Monoidal.Mon_.380_0.NTUMzhXPwXsmsYt | theorem one_associator {M N P : Mon_ C} :
((λ_ (𝟙_ C)).inv ≫ ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) ⊗ P.one)) ≫ (α_ M.X N.X P.X).hom =
(λ_ (𝟙_ C)).inv ≫ (M.one ⊗ (λ_ (𝟙_ C)).inv ≫ (N.one ⊗ P.one)) | Mathlib_CategoryTheory_Monoidal_Mon_ |
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : MonoidalCategory C
M N P : Mon_ C
⊢ ((λ_ (𝟙_ C)).inv ≫ (𝟙 (𝟙_ C) ⊗ (λ_ (𝟙_ C)).inv)) ≫ (M.one ⊗ N.one ⊗ P.one) =
(λ_ (𝟙_ C)).inv ≫ (𝟙 (𝟙_ C) ⊗ (λ_ (𝟙_ C)).inv) ≫ (M.one ⊗ N.one ⊗ P.one) | /-
Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/
import Mathlib.CategoryTheory.Monoidal.Braided
import Mathlib.CategoryTheory.Monoidal.Discrete
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
import Mathlib.Algebra.PUnitInstances
#align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c"
/-!
# The category of monoids in a monoidal category.
We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to
the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if
`C` is braided, then the category of monoids is naturally monoidal.
-/
set_option linter.uppercaseLean3 false
universe v₁ v₂ u₁ u₂ u
open CategoryTheory MonoidalCategory
variable (C : Type u₁) [Category.{v₁} C] [MonoidalCategory.{v₁} C]
/-- A monoid object internal to a monoidal category.
When the monoidal category is preadditive, this is also sometimes called an "algebra object".
-/
structure Mon_ where
X : C
one : 𝟙_ C ⟶ X
mul : X ⊗ X ⟶ X
one_mul : (one ⊗ 𝟙 X) ≫ mul = (λ_ X).hom := by aesop_cat
mul_one : (𝟙 X ⊗ one) ≫ mul = (ρ_ X).hom := by aesop_cat
-- Obviously there is some flexibility stating this axiom.
-- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`,
-- and chooses to place the associator on the right-hand side.
-- The heuristic is that unitors and associators "don't have much weight".
mul_assoc : (mul ⊗ 𝟙 X) ≫ mul = (α_ X X X).hom ≫ (𝟙 X ⊗ mul) ≫ mul := by aesop_cat
#align Mon_ Mon_
attribute [reassoc] Mon_.one_mul Mon_.mul_one
-- We prove a more general `@[simp]` lemma below.
attribute [reassoc (attr := simp)] Mon_.mul_assoc
namespace Mon_
/-- The trivial monoid object. We later show this is initial in `Mon_ C`.
-/
@[simps]
def trivial : Mon_ C where
X := 𝟙_ C
one := 𝟙 _
mul := (λ_ _).hom
mul_assoc := by coherence
mul_one := by coherence
#align Mon_.trivial Mon_.trivial
instance : Inhabited (Mon_ C) :=
⟨trivial C⟩
variable {C}
variable {M : Mon_ C}
@[simp]
theorem one_mul_hom {Z : C} (f : Z ⟶ M.X) : (M.one ⊗ f) ≫ M.mul = (λ_ Z).hom ≫ f := by
rw [← id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality]
#align Mon_.one_mul_hom Mon_.one_mul_hom
@[simp]
theorem mul_one_hom {Z : C} (f : Z ⟶ M.X) : (f ⊗ M.one) ≫ M.mul = (ρ_ Z).hom ≫ f := by
rw [← tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality]
#align Mon_.mul_one_hom Mon_.mul_one_hom
theorem assoc_flip :
(𝟙 M.X ⊗ M.mul) ≫ M.mul = (α_ M.X M.X M.X).inv ≫ (M.mul ⊗ 𝟙 M.X) ≫ M.mul := by simp
#align Mon_.assoc_flip Mon_.assoc_flip
/-- A morphism of monoid objects. -/
@[ext]
structure Hom (M N : Mon_ C) where
hom : M.X ⟶ N.X
one_hom : M.one ≫ hom = N.one := by aesop_cat
mul_hom : M.mul ≫ hom = (hom ⊗ hom) ≫ N.mul := by aesop_cat
#align Mon_.hom Mon_.Hom
attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom
/-- The identity morphism on a monoid object. -/
@[simps]
def id (M : Mon_ C) : Hom M M where
hom := 𝟙 M.X
#align Mon_.id Mon_.id
instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) :=
⟨id M⟩
#align Mon_.hom_inhabited Mon_.homInhabited
/-- Composition of morphisms of monoid objects. -/
@[simps]
def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where
hom := f.hom ≫ g.hom
#align Mon_.comp Mon_.comp
instance : Category (Mon_ C) where
Hom M N := Hom M N
id := id
comp f g := comp f g
-- Porting note: added, as `Hom.ext` does not apply to a morphism.
@[ext]
lemma ext {X Y : Mon_ C} {f g : X ⟶ Y} (w : f.hom = g.hom) : f = g :=
Hom.ext _ _ w
@[simp]
theorem id_hom' (M : Mon_ C) : (𝟙 M : Hom M M).hom = 𝟙 M.X :=
rfl
#align Mon_.id_hom' Mon_.id_hom'
@[simp]
theorem comp_hom' {M N K : Mon_ C} (f : M ⟶ N) (g : N ⟶ K) :
(f ≫ g : Hom M K).hom = f.hom ≫ g.hom :=
rfl
#align Mon_.comp_hom' Mon_.comp_hom'
section
variable (C)
/-- The forgetful functor from monoid objects to the ambient category. -/
@[simps]
def forget : Mon_ C ⥤ C where
obj A := A.X
map f := f.hom
#align Mon_.forget Mon_.forget
end
instance forget_faithful : Faithful (@forget C _ _) where
#align Mon_.forget_faithful Mon_.forget_faithful
instance {A B : Mon_ C} (f : A ⟶ B) [e : IsIso ((forget C).map f)] : IsIso f.hom :=
e
/-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/
instance : ReflectsIsomorphisms (forget C) where
reflects f e :=
⟨⟨{ hom := inv f.hom
mul_hom := by
simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, ← tensor_comp_assoc,
IsIso.inv_hom_id, tensor_id, Category.id_comp] },
by aesop_cat⟩⟩
/-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X ≅ N.X) (one_f : M.one ≫ f.hom = N.one)
(mul_f : M.mul ≫ f.hom = (f.hom ⊗ f.hom) ≫ N.mul) : M ≅ N where
hom :=
{ hom := f.hom
one_hom := one_f
mul_hom := mul_f }
inv :=
{ hom := f.inv
one_hom := by rw [← one_f]; simp
mul_hom := by
rw [← cancel_mono f.hom]
slice_rhs 2 3 => rw [mul_f]
simp }
#align Mon_.iso_of_iso Mon_.isoOfIso
instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C ⟶ A) where
default :=
{ hom := A.one
one_hom := by dsimp; simp
mul_hom := by dsimp; simp [A.one_mul, unitors_equal] }
uniq f := by
ext; simp
rw [← Category.id_comp f.hom]
erw [f.one_hom]
#align Mon_.unique_hom_from_trivial Mon_.uniqueHomFromTrivial
open CategoryTheory.Limits
instance : HasInitial (Mon_ C) :=
hasInitial_of_unique (trivial C)
end Mon_
namespace CategoryTheory.LaxMonoidalFunctor
variable {C} {D : Type u₂} [Category.{v₂} D] [MonoidalCategory.{v₂} D]
-- TODO: mapMod F A : Mod A ⥤ Mod (F.mapMon A)
/-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one]
rw [F.toFunctor.map_id]
rw [F.right_unitality]
mul_assoc := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_assoc]
conv_lhs => rw [F.toFunctor.map_id]
conv_lhs => rw [F.toFunctor.map_comp, F.toFunctor.map_comp]
conv_rhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_rhs 3 4 => rw [F.μ_natural]
conv_rhs => rw [F.toFunctor.map_id]
slice_rhs 1 3 => rw [← F.associativity]
simp only [Category.assoc] }
map f :=
{ hom := F.map f.hom
one_hom := by dsimp; rw [Category.assoc, ← F.toFunctor.map_comp, f.one_hom]
mul_hom := by
dsimp
rw [Category.assoc, F.μ_natural_assoc, ← F.toFunctor.map_comp, ← F.toFunctor.map_comp,
f.mul_hom] }
map_id A := by ext; simp
map_comp f g := by ext; simp
#align category_theory.lax_monoidal_functor.map_Mon CategoryTheory.LaxMonoidalFunctor.mapMon
variable (C D)
/-- `mapMon` is functorial in the lax monoidal functor. -/
@[simps] -- Porting note: added this, not sure how it worked previously without.
def mapMonFunctor : LaxMonoidalFunctor C D ⥤ Mon_ C ⥤ Mon_ D where
obj := mapMon
map α := { app := fun A => { hom := α.app A.X } }
#align category_theory.lax_monoidal_functor.map_Mon_functor CategoryTheory.LaxMonoidalFunctor.mapMonFunctor
end CategoryTheory.LaxMonoidalFunctor
namespace Mon_
open CategoryTheory.LaxMonoidalFunctor
namespace EquivLaxMonoidalFunctorPUnit
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps]
def laxMonoidalToMon : LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C ⥤ Mon_ C where
obj F := (F.mapMon : Mon_ _ ⥤ Mon_ C).obj (trivial (Discrete PUnit))
map α := ((mapMonFunctor (Discrete PUnit) C).map α).app _
#align Mon_.equiv_lax_monoidal_functor_punit.lax_monoidal_to_Mon Mon_.EquivLaxMonoidalFunctorPUnit.laxMonoidalToMon
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps]
def monToLaxMonoidal : Mon_ C ⥤ LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C where
obj A :=
{ obj := fun _ => A.X
map := fun _ => 𝟙 _
ε := A.one
μ := fun _ _ => A.mul
map_id := fun _ => rfl
map_comp := fun _ _ => (Category.id_comp (𝟙 A.X)).symm }
map f :=
{ app := fun _ => f.hom
naturality := fun _ _ _ => by dsimp; rw [Category.id_comp, Category.comp_id]
unit := f.one_hom
tensor := fun _ _ => f.mul_hom }
#align Mon_.equiv_lax_monoidal_functor_punit.Mon_to_lax_monoidal Mon_.EquivLaxMonoidalFunctorPUnit.monToLaxMonoidal
attribute [local aesop safe tactic (rule_sets [CategoryTheory])]
CategoryTheory.Discrete.discreteCases
attribute [local simp] eqToIso_map
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps!]
def unitIso :
𝟭 (LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C) ≅ laxMonoidalToMon C ⋙ monToLaxMonoidal C :=
NatIso.ofComponents
(fun F =>
MonoidalNatIso.ofComponents (fun _ => F.toFunctor.mapIso (eqToIso (by ext))) (by aesop_cat)
(by aesop_cat) (by aesop_cat))
(by aesop_cat)
#align Mon_.equiv_lax_monoidal_functor_punit.unit_iso Mon_.EquivLaxMonoidalFunctorPUnit.unitIso
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps!]
def counitIso : monToLaxMonoidal C ⋙ laxMonoidalToMon C ≅ 𝟭 (Mon_ C) :=
NatIso.ofComponents
(fun F =>
{ hom := { hom := 𝟙 _ }
inv := { hom := 𝟙 _ } })
(by aesop_cat)
#align Mon_.equiv_lax_monoidal_functor_punit.counit_iso Mon_.EquivLaxMonoidalFunctorPUnit.counitIso
end EquivLaxMonoidalFunctorPUnit
open EquivLaxMonoidalFunctorPUnit
attribute [local simp] eqToIso_map
/--
Monoid objects in `C` are "just" lax monoidal functors from the trivial monoidal category to `C`.
-/
@[simps]
def equivLaxMonoidalFunctorPUnit : LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C ≌ Mon_ C where
functor := laxMonoidalToMon C
inverse := monToLaxMonoidal C
unitIso := unitIso C
counitIso := counitIso C
#align Mon_.equiv_lax_monoidal_functor_punit Mon_.equivLaxMonoidalFunctorPUnit
end Mon_
namespace Mon_
/-!
In this section, we prove that the category of monoids in a braided monoidal category is monoidal.
Given two monoids `M` and `N` in a braided monoidal category `C`,
the multiplication on the tensor product `M.X ⊗ N.X` is defined in the obvious way:
it is the tensor product of the multiplications on `M` and `N`,
except that the tensor factors in the source come in the wrong order,
which we fix by pre-composing with a permutation isomorphism constructed from the braiding.
(There is a subtlety here: in fact there are two ways to do these,
using either the positive or negative crossing.)
A more conceptual way of understanding this definition is the following:
The braiding on `C` gives rise to a monoidal structure on
the tensor product functor from `C × C` to `C`.
A pair of monoids in `C` gives rise to a monoid in `C × C`,
which the tensor product functor by being monoidal takes to a monoid in `C`.
The permutation isomorphism appearing in the definition of
the multiplication on the tensor product of two monoids is
an instance of a more general family of isomorphisms
which together form a strength that equips the tensor product functor with a monoidal structure,
and the monoid axioms for the tensor product follow from the monoid axioms for the tensor factors
plus the properties of the strength (i.e., monoidal functor axioms).
The strength `tensor_μ` of the tensor product functor has been defined in
`Mathlib.CategoryTheory.Monoidal.Braided`.
Its properties, stated as independent lemmas in that module,
are used extensively in the proofs below.
Notice that we could have followed the above plan not only conceptually
but also as a possible implementation and
could have constructed the tensor product of monoids via `mapMon`,
but we chose to give a more explicit definition directly in terms of `tensor_μ`.
To complete the definition of the monoidal category structure on the category of monoids,
we need to provide definitions of associator and unitors.
The obvious candidates are the associator and unitors from `C`,
but we need to prove that they are monoid morphisms, i.e., compatible with unit and multiplication.
These properties translate to the monoidality of the associator and unitors
(with respect to the monoidal structures on the functors they relate),
which have also been proved in `Mathlib.CategoryTheory.Monoidal.Braided`.
-/
variable {C}
-- The proofs that associators and unitors preserve monoid units don't require braiding.
theorem one_associator {M N P : Mon_ C} :
((λ_ (𝟙_ C)).inv ≫ ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) ⊗ P.one)) ≫ (α_ M.X N.X P.X).hom =
(λ_ (𝟙_ C)).inv ≫ (M.one ⊗ (λ_ (𝟙_ C)).inv ≫ (N.one ⊗ P.one)) := by
simp only [Category.assoc, Iso.cancel_iso_inv_left]
slice_lhs 1 3 => rw [← Category.id_comp P.one, tensor_comp]
slice_lhs 2 3 => rw [associator_naturality]
slice_rhs 1 2 => rw [← Category.id_comp M.one, tensor_comp]
slice_lhs 1 2 => rw [← leftUnitor_tensor_inv]
rw [← cancel_epi (λ_ (𝟙_ C)).inv]
slice_lhs 1 2 => rw [leftUnitor_inv_naturality]
| simp only [Category.assoc] | theorem one_associator {M N P : Mon_ C} :
((λ_ (𝟙_ C)).inv ≫ ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) ⊗ P.one)) ≫ (α_ M.X N.X P.X).hom =
(λ_ (𝟙_ C)).inv ≫ (M.one ⊗ (λ_ (𝟙_ C)).inv ≫ (N.one ⊗ P.one)) := by
simp only [Category.assoc, Iso.cancel_iso_inv_left]
slice_lhs 1 3 => rw [← Category.id_comp P.one, tensor_comp]
slice_lhs 2 3 => rw [associator_naturality]
slice_rhs 1 2 => rw [← Category.id_comp M.one, tensor_comp]
slice_lhs 1 2 => rw [← leftUnitor_tensor_inv]
rw [← cancel_epi (λ_ (𝟙_ C)).inv]
slice_lhs 1 2 => rw [leftUnitor_inv_naturality]
| Mathlib.CategoryTheory.Monoidal.Mon_.380_0.NTUMzhXPwXsmsYt | theorem one_associator {M N P : Mon_ C} :
((λ_ (𝟙_ C)).inv ≫ ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) ⊗ P.one)) ≫ (α_ M.X N.X P.X).hom =
(λ_ (𝟙_ C)).inv ≫ (M.one ⊗ (λ_ (𝟙_ C)).inv ≫ (N.one ⊗ P.one)) | Mathlib_CategoryTheory_Monoidal_Mon_ |
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : MonoidalCategory C
M : Mon_ C
⊢ ((λ_ (𝟙_ C)).inv ≫ (𝟙 (𝟙_ C) ⊗ M.one)) ≫ (λ_ M.X).hom = M.one | /-
Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/
import Mathlib.CategoryTheory.Monoidal.Braided
import Mathlib.CategoryTheory.Monoidal.Discrete
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
import Mathlib.Algebra.PUnitInstances
#align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c"
/-!
# The category of monoids in a monoidal category.
We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to
the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if
`C` is braided, then the category of monoids is naturally monoidal.
-/
set_option linter.uppercaseLean3 false
universe v₁ v₂ u₁ u₂ u
open CategoryTheory MonoidalCategory
variable (C : Type u₁) [Category.{v₁} C] [MonoidalCategory.{v₁} C]
/-- A monoid object internal to a monoidal category.
When the monoidal category is preadditive, this is also sometimes called an "algebra object".
-/
structure Mon_ where
X : C
one : 𝟙_ C ⟶ X
mul : X ⊗ X ⟶ X
one_mul : (one ⊗ 𝟙 X) ≫ mul = (λ_ X).hom := by aesop_cat
mul_one : (𝟙 X ⊗ one) ≫ mul = (ρ_ X).hom := by aesop_cat
-- Obviously there is some flexibility stating this axiom.
-- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`,
-- and chooses to place the associator on the right-hand side.
-- The heuristic is that unitors and associators "don't have much weight".
mul_assoc : (mul ⊗ 𝟙 X) ≫ mul = (α_ X X X).hom ≫ (𝟙 X ⊗ mul) ≫ mul := by aesop_cat
#align Mon_ Mon_
attribute [reassoc] Mon_.one_mul Mon_.mul_one
-- We prove a more general `@[simp]` lemma below.
attribute [reassoc (attr := simp)] Mon_.mul_assoc
namespace Mon_
/-- The trivial monoid object. We later show this is initial in `Mon_ C`.
-/
@[simps]
def trivial : Mon_ C where
X := 𝟙_ C
one := 𝟙 _
mul := (λ_ _).hom
mul_assoc := by coherence
mul_one := by coherence
#align Mon_.trivial Mon_.trivial
instance : Inhabited (Mon_ C) :=
⟨trivial C⟩
variable {C}
variable {M : Mon_ C}
@[simp]
theorem one_mul_hom {Z : C} (f : Z ⟶ M.X) : (M.one ⊗ f) ≫ M.mul = (λ_ Z).hom ≫ f := by
rw [← id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality]
#align Mon_.one_mul_hom Mon_.one_mul_hom
@[simp]
theorem mul_one_hom {Z : C} (f : Z ⟶ M.X) : (f ⊗ M.one) ≫ M.mul = (ρ_ Z).hom ≫ f := by
rw [← tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality]
#align Mon_.mul_one_hom Mon_.mul_one_hom
theorem assoc_flip :
(𝟙 M.X ⊗ M.mul) ≫ M.mul = (α_ M.X M.X M.X).inv ≫ (M.mul ⊗ 𝟙 M.X) ≫ M.mul := by simp
#align Mon_.assoc_flip Mon_.assoc_flip
/-- A morphism of monoid objects. -/
@[ext]
structure Hom (M N : Mon_ C) where
hom : M.X ⟶ N.X
one_hom : M.one ≫ hom = N.one := by aesop_cat
mul_hom : M.mul ≫ hom = (hom ⊗ hom) ≫ N.mul := by aesop_cat
#align Mon_.hom Mon_.Hom
attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom
/-- The identity morphism on a monoid object. -/
@[simps]
def id (M : Mon_ C) : Hom M M where
hom := 𝟙 M.X
#align Mon_.id Mon_.id
instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) :=
⟨id M⟩
#align Mon_.hom_inhabited Mon_.homInhabited
/-- Composition of morphisms of monoid objects. -/
@[simps]
def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where
hom := f.hom ≫ g.hom
#align Mon_.comp Mon_.comp
instance : Category (Mon_ C) where
Hom M N := Hom M N
id := id
comp f g := comp f g
-- Porting note: added, as `Hom.ext` does not apply to a morphism.
@[ext]
lemma ext {X Y : Mon_ C} {f g : X ⟶ Y} (w : f.hom = g.hom) : f = g :=
Hom.ext _ _ w
@[simp]
theorem id_hom' (M : Mon_ C) : (𝟙 M : Hom M M).hom = 𝟙 M.X :=
rfl
#align Mon_.id_hom' Mon_.id_hom'
@[simp]
theorem comp_hom' {M N K : Mon_ C} (f : M ⟶ N) (g : N ⟶ K) :
(f ≫ g : Hom M K).hom = f.hom ≫ g.hom :=
rfl
#align Mon_.comp_hom' Mon_.comp_hom'
section
variable (C)
/-- The forgetful functor from monoid objects to the ambient category. -/
@[simps]
def forget : Mon_ C ⥤ C where
obj A := A.X
map f := f.hom
#align Mon_.forget Mon_.forget
end
instance forget_faithful : Faithful (@forget C _ _) where
#align Mon_.forget_faithful Mon_.forget_faithful
instance {A B : Mon_ C} (f : A ⟶ B) [e : IsIso ((forget C).map f)] : IsIso f.hom :=
e
/-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/
instance : ReflectsIsomorphisms (forget C) where
reflects f e :=
⟨⟨{ hom := inv f.hom
mul_hom := by
simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, ← tensor_comp_assoc,
IsIso.inv_hom_id, tensor_id, Category.id_comp] },
by aesop_cat⟩⟩
/-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X ≅ N.X) (one_f : M.one ≫ f.hom = N.one)
(mul_f : M.mul ≫ f.hom = (f.hom ⊗ f.hom) ≫ N.mul) : M ≅ N where
hom :=
{ hom := f.hom
one_hom := one_f
mul_hom := mul_f }
inv :=
{ hom := f.inv
one_hom := by rw [← one_f]; simp
mul_hom := by
rw [← cancel_mono f.hom]
slice_rhs 2 3 => rw [mul_f]
simp }
#align Mon_.iso_of_iso Mon_.isoOfIso
instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C ⟶ A) where
default :=
{ hom := A.one
one_hom := by dsimp; simp
mul_hom := by dsimp; simp [A.one_mul, unitors_equal] }
uniq f := by
ext; simp
rw [← Category.id_comp f.hom]
erw [f.one_hom]
#align Mon_.unique_hom_from_trivial Mon_.uniqueHomFromTrivial
open CategoryTheory.Limits
instance : HasInitial (Mon_ C) :=
hasInitial_of_unique (trivial C)
end Mon_
namespace CategoryTheory.LaxMonoidalFunctor
variable {C} {D : Type u₂} [Category.{v₂} D] [MonoidalCategory.{v₂} D]
-- TODO: mapMod F A : Mod A ⥤ Mod (F.mapMon A)
/-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one]
rw [F.toFunctor.map_id]
rw [F.right_unitality]
mul_assoc := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_assoc]
conv_lhs => rw [F.toFunctor.map_id]
conv_lhs => rw [F.toFunctor.map_comp, F.toFunctor.map_comp]
conv_rhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_rhs 3 4 => rw [F.μ_natural]
conv_rhs => rw [F.toFunctor.map_id]
slice_rhs 1 3 => rw [← F.associativity]
simp only [Category.assoc] }
map f :=
{ hom := F.map f.hom
one_hom := by dsimp; rw [Category.assoc, ← F.toFunctor.map_comp, f.one_hom]
mul_hom := by
dsimp
rw [Category.assoc, F.μ_natural_assoc, ← F.toFunctor.map_comp, ← F.toFunctor.map_comp,
f.mul_hom] }
map_id A := by ext; simp
map_comp f g := by ext; simp
#align category_theory.lax_monoidal_functor.map_Mon CategoryTheory.LaxMonoidalFunctor.mapMon
variable (C D)
/-- `mapMon` is functorial in the lax monoidal functor. -/
@[simps] -- Porting note: added this, not sure how it worked previously without.
def mapMonFunctor : LaxMonoidalFunctor C D ⥤ Mon_ C ⥤ Mon_ D where
obj := mapMon
map α := { app := fun A => { hom := α.app A.X } }
#align category_theory.lax_monoidal_functor.map_Mon_functor CategoryTheory.LaxMonoidalFunctor.mapMonFunctor
end CategoryTheory.LaxMonoidalFunctor
namespace Mon_
open CategoryTheory.LaxMonoidalFunctor
namespace EquivLaxMonoidalFunctorPUnit
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps]
def laxMonoidalToMon : LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C ⥤ Mon_ C where
obj F := (F.mapMon : Mon_ _ ⥤ Mon_ C).obj (trivial (Discrete PUnit))
map α := ((mapMonFunctor (Discrete PUnit) C).map α).app _
#align Mon_.equiv_lax_monoidal_functor_punit.lax_monoidal_to_Mon Mon_.EquivLaxMonoidalFunctorPUnit.laxMonoidalToMon
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps]
def monToLaxMonoidal : Mon_ C ⥤ LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C where
obj A :=
{ obj := fun _ => A.X
map := fun _ => 𝟙 _
ε := A.one
μ := fun _ _ => A.mul
map_id := fun _ => rfl
map_comp := fun _ _ => (Category.id_comp (𝟙 A.X)).symm }
map f :=
{ app := fun _ => f.hom
naturality := fun _ _ _ => by dsimp; rw [Category.id_comp, Category.comp_id]
unit := f.one_hom
tensor := fun _ _ => f.mul_hom }
#align Mon_.equiv_lax_monoidal_functor_punit.Mon_to_lax_monoidal Mon_.EquivLaxMonoidalFunctorPUnit.monToLaxMonoidal
attribute [local aesop safe tactic (rule_sets [CategoryTheory])]
CategoryTheory.Discrete.discreteCases
attribute [local simp] eqToIso_map
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps!]
def unitIso :
𝟭 (LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C) ≅ laxMonoidalToMon C ⋙ monToLaxMonoidal C :=
NatIso.ofComponents
(fun F =>
MonoidalNatIso.ofComponents (fun _ => F.toFunctor.mapIso (eqToIso (by ext))) (by aesop_cat)
(by aesop_cat) (by aesop_cat))
(by aesop_cat)
#align Mon_.equiv_lax_monoidal_functor_punit.unit_iso Mon_.EquivLaxMonoidalFunctorPUnit.unitIso
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps!]
def counitIso : monToLaxMonoidal C ⋙ laxMonoidalToMon C ≅ 𝟭 (Mon_ C) :=
NatIso.ofComponents
(fun F =>
{ hom := { hom := 𝟙 _ }
inv := { hom := 𝟙 _ } })
(by aesop_cat)
#align Mon_.equiv_lax_monoidal_functor_punit.counit_iso Mon_.EquivLaxMonoidalFunctorPUnit.counitIso
end EquivLaxMonoidalFunctorPUnit
open EquivLaxMonoidalFunctorPUnit
attribute [local simp] eqToIso_map
/--
Monoid objects in `C` are "just" lax monoidal functors from the trivial monoidal category to `C`.
-/
@[simps]
def equivLaxMonoidalFunctorPUnit : LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C ≌ Mon_ C where
functor := laxMonoidalToMon C
inverse := monToLaxMonoidal C
unitIso := unitIso C
counitIso := counitIso C
#align Mon_.equiv_lax_monoidal_functor_punit Mon_.equivLaxMonoidalFunctorPUnit
end Mon_
namespace Mon_
/-!
In this section, we prove that the category of monoids in a braided monoidal category is monoidal.
Given two monoids `M` and `N` in a braided monoidal category `C`,
the multiplication on the tensor product `M.X ⊗ N.X` is defined in the obvious way:
it is the tensor product of the multiplications on `M` and `N`,
except that the tensor factors in the source come in the wrong order,
which we fix by pre-composing with a permutation isomorphism constructed from the braiding.
(There is a subtlety here: in fact there are two ways to do these,
using either the positive or negative crossing.)
A more conceptual way of understanding this definition is the following:
The braiding on `C` gives rise to a monoidal structure on
the tensor product functor from `C × C` to `C`.
A pair of monoids in `C` gives rise to a monoid in `C × C`,
which the tensor product functor by being monoidal takes to a monoid in `C`.
The permutation isomorphism appearing in the definition of
the multiplication on the tensor product of two monoids is
an instance of a more general family of isomorphisms
which together form a strength that equips the tensor product functor with a monoidal structure,
and the monoid axioms for the tensor product follow from the monoid axioms for the tensor factors
plus the properties of the strength (i.e., monoidal functor axioms).
The strength `tensor_μ` of the tensor product functor has been defined in
`Mathlib.CategoryTheory.Monoidal.Braided`.
Its properties, stated as independent lemmas in that module,
are used extensively in the proofs below.
Notice that we could have followed the above plan not only conceptually
but also as a possible implementation and
could have constructed the tensor product of monoids via `mapMon`,
but we chose to give a more explicit definition directly in terms of `tensor_μ`.
To complete the definition of the monoidal category structure on the category of monoids,
we need to provide definitions of associator and unitors.
The obvious candidates are the associator and unitors from `C`,
but we need to prove that they are monoid morphisms, i.e., compatible with unit and multiplication.
These properties translate to the monoidality of the associator and unitors
(with respect to the monoidal structures on the functors they relate),
which have also been proved in `Mathlib.CategoryTheory.Monoidal.Braided`.
-/
variable {C}
-- The proofs that associators and unitors preserve monoid units don't require braiding.
theorem one_associator {M N P : Mon_ C} :
((λ_ (𝟙_ C)).inv ≫ ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) ⊗ P.one)) ≫ (α_ M.X N.X P.X).hom =
(λ_ (𝟙_ C)).inv ≫ (M.one ⊗ (λ_ (𝟙_ C)).inv ≫ (N.one ⊗ P.one)) := by
simp only [Category.assoc, Iso.cancel_iso_inv_left]
slice_lhs 1 3 => rw [← Category.id_comp P.one, tensor_comp]
slice_lhs 2 3 => rw [associator_naturality]
slice_rhs 1 2 => rw [← Category.id_comp M.one, tensor_comp]
slice_lhs 1 2 => rw [← leftUnitor_tensor_inv]
rw [← cancel_epi (λ_ (𝟙_ C)).inv]
slice_lhs 1 2 => rw [leftUnitor_inv_naturality]
simp only [Category.assoc]
#align Mon_.one_associator Mon_.one_associator
theorem one_leftUnitor {M : Mon_ C} :
((λ_ (𝟙_ C)).inv ≫ (𝟙 (𝟙_ C) ⊗ M.one)) ≫ (λ_ M.X).hom = M.one := by
| slice_lhs 2 3 => rw [leftUnitor_naturality] | theorem one_leftUnitor {M : Mon_ C} :
((λ_ (𝟙_ C)).inv ≫ (𝟙 (𝟙_ C) ⊗ M.one)) ≫ (λ_ M.X).hom = M.one := by
| Mathlib.CategoryTheory.Monoidal.Mon_.393_0.NTUMzhXPwXsmsYt | theorem one_leftUnitor {M : Mon_ C} :
((λ_ (𝟙_ C)).inv ≫ (𝟙 (𝟙_ C) ⊗ M.one)) ≫ (λ_ M.X).hom = M.one | Mathlib_CategoryTheory_Monoidal_Mon_ |
case a
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : MonoidalCategory C
M : Mon_ C
| (𝟙 (𝟙_ C) ⊗ M.one) ≫ (λ_ M.X).hom
case a C : Type u₁ inst✝¹ : Category.{v₁, u₁} C inst✝ : MonoidalCategory C M : Mon_ C | (λ_ (𝟙_ C)).inv | /-
Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/
import Mathlib.CategoryTheory.Monoidal.Braided
import Mathlib.CategoryTheory.Monoidal.Discrete
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
import Mathlib.Algebra.PUnitInstances
#align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c"
/-!
# The category of monoids in a monoidal category.
We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to
the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if
`C` is braided, then the category of monoids is naturally monoidal.
-/
set_option linter.uppercaseLean3 false
universe v₁ v₂ u₁ u₂ u
open CategoryTheory MonoidalCategory
variable (C : Type u₁) [Category.{v₁} C] [MonoidalCategory.{v₁} C]
/-- A monoid object internal to a monoidal category.
When the monoidal category is preadditive, this is also sometimes called an "algebra object".
-/
structure Mon_ where
X : C
one : 𝟙_ C ⟶ X
mul : X ⊗ X ⟶ X
one_mul : (one ⊗ 𝟙 X) ≫ mul = (λ_ X).hom := by aesop_cat
mul_one : (𝟙 X ⊗ one) ≫ mul = (ρ_ X).hom := by aesop_cat
-- Obviously there is some flexibility stating this axiom.
-- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`,
-- and chooses to place the associator on the right-hand side.
-- The heuristic is that unitors and associators "don't have much weight".
mul_assoc : (mul ⊗ 𝟙 X) ≫ mul = (α_ X X X).hom ≫ (𝟙 X ⊗ mul) ≫ mul := by aesop_cat
#align Mon_ Mon_
attribute [reassoc] Mon_.one_mul Mon_.mul_one
-- We prove a more general `@[simp]` lemma below.
attribute [reassoc (attr := simp)] Mon_.mul_assoc
namespace Mon_
/-- The trivial monoid object. We later show this is initial in `Mon_ C`.
-/
@[simps]
def trivial : Mon_ C where
X := 𝟙_ C
one := 𝟙 _
mul := (λ_ _).hom
mul_assoc := by coherence
mul_one := by coherence
#align Mon_.trivial Mon_.trivial
instance : Inhabited (Mon_ C) :=
⟨trivial C⟩
variable {C}
variable {M : Mon_ C}
@[simp]
theorem one_mul_hom {Z : C} (f : Z ⟶ M.X) : (M.one ⊗ f) ≫ M.mul = (λ_ Z).hom ≫ f := by
rw [← id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality]
#align Mon_.one_mul_hom Mon_.one_mul_hom
@[simp]
theorem mul_one_hom {Z : C} (f : Z ⟶ M.X) : (f ⊗ M.one) ≫ M.mul = (ρ_ Z).hom ≫ f := by
rw [← tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality]
#align Mon_.mul_one_hom Mon_.mul_one_hom
theorem assoc_flip :
(𝟙 M.X ⊗ M.mul) ≫ M.mul = (α_ M.X M.X M.X).inv ≫ (M.mul ⊗ 𝟙 M.X) ≫ M.mul := by simp
#align Mon_.assoc_flip Mon_.assoc_flip
/-- A morphism of monoid objects. -/
@[ext]
structure Hom (M N : Mon_ C) where
hom : M.X ⟶ N.X
one_hom : M.one ≫ hom = N.one := by aesop_cat
mul_hom : M.mul ≫ hom = (hom ⊗ hom) ≫ N.mul := by aesop_cat
#align Mon_.hom Mon_.Hom
attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom
/-- The identity morphism on a monoid object. -/
@[simps]
def id (M : Mon_ C) : Hom M M where
hom := 𝟙 M.X
#align Mon_.id Mon_.id
instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) :=
⟨id M⟩
#align Mon_.hom_inhabited Mon_.homInhabited
/-- Composition of morphisms of monoid objects. -/
@[simps]
def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where
hom := f.hom ≫ g.hom
#align Mon_.comp Mon_.comp
instance : Category (Mon_ C) where
Hom M N := Hom M N
id := id
comp f g := comp f g
-- Porting note: added, as `Hom.ext` does not apply to a morphism.
@[ext]
lemma ext {X Y : Mon_ C} {f g : X ⟶ Y} (w : f.hom = g.hom) : f = g :=
Hom.ext _ _ w
@[simp]
theorem id_hom' (M : Mon_ C) : (𝟙 M : Hom M M).hom = 𝟙 M.X :=
rfl
#align Mon_.id_hom' Mon_.id_hom'
@[simp]
theorem comp_hom' {M N K : Mon_ C} (f : M ⟶ N) (g : N ⟶ K) :
(f ≫ g : Hom M K).hom = f.hom ≫ g.hom :=
rfl
#align Mon_.comp_hom' Mon_.comp_hom'
section
variable (C)
/-- The forgetful functor from monoid objects to the ambient category. -/
@[simps]
def forget : Mon_ C ⥤ C where
obj A := A.X
map f := f.hom
#align Mon_.forget Mon_.forget
end
instance forget_faithful : Faithful (@forget C _ _) where
#align Mon_.forget_faithful Mon_.forget_faithful
instance {A B : Mon_ C} (f : A ⟶ B) [e : IsIso ((forget C).map f)] : IsIso f.hom :=
e
/-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/
instance : ReflectsIsomorphisms (forget C) where
reflects f e :=
⟨⟨{ hom := inv f.hom
mul_hom := by
simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, ← tensor_comp_assoc,
IsIso.inv_hom_id, tensor_id, Category.id_comp] },
by aesop_cat⟩⟩
/-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X ≅ N.X) (one_f : M.one ≫ f.hom = N.one)
(mul_f : M.mul ≫ f.hom = (f.hom ⊗ f.hom) ≫ N.mul) : M ≅ N where
hom :=
{ hom := f.hom
one_hom := one_f
mul_hom := mul_f }
inv :=
{ hom := f.inv
one_hom := by rw [← one_f]; simp
mul_hom := by
rw [← cancel_mono f.hom]
slice_rhs 2 3 => rw [mul_f]
simp }
#align Mon_.iso_of_iso Mon_.isoOfIso
instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C ⟶ A) where
default :=
{ hom := A.one
one_hom := by dsimp; simp
mul_hom := by dsimp; simp [A.one_mul, unitors_equal] }
uniq f := by
ext; simp
rw [← Category.id_comp f.hom]
erw [f.one_hom]
#align Mon_.unique_hom_from_trivial Mon_.uniqueHomFromTrivial
open CategoryTheory.Limits
instance : HasInitial (Mon_ C) :=
hasInitial_of_unique (trivial C)
end Mon_
namespace CategoryTheory.LaxMonoidalFunctor
variable {C} {D : Type u₂} [Category.{v₂} D] [MonoidalCategory.{v₂} D]
-- TODO: mapMod F A : Mod A ⥤ Mod (F.mapMon A)
/-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one]
rw [F.toFunctor.map_id]
rw [F.right_unitality]
mul_assoc := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_assoc]
conv_lhs => rw [F.toFunctor.map_id]
conv_lhs => rw [F.toFunctor.map_comp, F.toFunctor.map_comp]
conv_rhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_rhs 3 4 => rw [F.μ_natural]
conv_rhs => rw [F.toFunctor.map_id]
slice_rhs 1 3 => rw [← F.associativity]
simp only [Category.assoc] }
map f :=
{ hom := F.map f.hom
one_hom := by dsimp; rw [Category.assoc, ← F.toFunctor.map_comp, f.one_hom]
mul_hom := by
dsimp
rw [Category.assoc, F.μ_natural_assoc, ← F.toFunctor.map_comp, ← F.toFunctor.map_comp,
f.mul_hom] }
map_id A := by ext; simp
map_comp f g := by ext; simp
#align category_theory.lax_monoidal_functor.map_Mon CategoryTheory.LaxMonoidalFunctor.mapMon
variable (C D)
/-- `mapMon` is functorial in the lax monoidal functor. -/
@[simps] -- Porting note: added this, not sure how it worked previously without.
def mapMonFunctor : LaxMonoidalFunctor C D ⥤ Mon_ C ⥤ Mon_ D where
obj := mapMon
map α := { app := fun A => { hom := α.app A.X } }
#align category_theory.lax_monoidal_functor.map_Mon_functor CategoryTheory.LaxMonoidalFunctor.mapMonFunctor
end CategoryTheory.LaxMonoidalFunctor
namespace Mon_
open CategoryTheory.LaxMonoidalFunctor
namespace EquivLaxMonoidalFunctorPUnit
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps]
def laxMonoidalToMon : LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C ⥤ Mon_ C where
obj F := (F.mapMon : Mon_ _ ⥤ Mon_ C).obj (trivial (Discrete PUnit))
map α := ((mapMonFunctor (Discrete PUnit) C).map α).app _
#align Mon_.equiv_lax_monoidal_functor_punit.lax_monoidal_to_Mon Mon_.EquivLaxMonoidalFunctorPUnit.laxMonoidalToMon
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps]
def monToLaxMonoidal : Mon_ C ⥤ LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C where
obj A :=
{ obj := fun _ => A.X
map := fun _ => 𝟙 _
ε := A.one
μ := fun _ _ => A.mul
map_id := fun _ => rfl
map_comp := fun _ _ => (Category.id_comp (𝟙 A.X)).symm }
map f :=
{ app := fun _ => f.hom
naturality := fun _ _ _ => by dsimp; rw [Category.id_comp, Category.comp_id]
unit := f.one_hom
tensor := fun _ _ => f.mul_hom }
#align Mon_.equiv_lax_monoidal_functor_punit.Mon_to_lax_monoidal Mon_.EquivLaxMonoidalFunctorPUnit.monToLaxMonoidal
attribute [local aesop safe tactic (rule_sets [CategoryTheory])]
CategoryTheory.Discrete.discreteCases
attribute [local simp] eqToIso_map
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps!]
def unitIso :
𝟭 (LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C) ≅ laxMonoidalToMon C ⋙ monToLaxMonoidal C :=
NatIso.ofComponents
(fun F =>
MonoidalNatIso.ofComponents (fun _ => F.toFunctor.mapIso (eqToIso (by ext))) (by aesop_cat)
(by aesop_cat) (by aesop_cat))
(by aesop_cat)
#align Mon_.equiv_lax_monoidal_functor_punit.unit_iso Mon_.EquivLaxMonoidalFunctorPUnit.unitIso
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps!]
def counitIso : monToLaxMonoidal C ⋙ laxMonoidalToMon C ≅ 𝟭 (Mon_ C) :=
NatIso.ofComponents
(fun F =>
{ hom := { hom := 𝟙 _ }
inv := { hom := 𝟙 _ } })
(by aesop_cat)
#align Mon_.equiv_lax_monoidal_functor_punit.counit_iso Mon_.EquivLaxMonoidalFunctorPUnit.counitIso
end EquivLaxMonoidalFunctorPUnit
open EquivLaxMonoidalFunctorPUnit
attribute [local simp] eqToIso_map
/--
Monoid objects in `C` are "just" lax monoidal functors from the trivial monoidal category to `C`.
-/
@[simps]
def equivLaxMonoidalFunctorPUnit : LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C ≌ Mon_ C where
functor := laxMonoidalToMon C
inverse := monToLaxMonoidal C
unitIso := unitIso C
counitIso := counitIso C
#align Mon_.equiv_lax_monoidal_functor_punit Mon_.equivLaxMonoidalFunctorPUnit
end Mon_
namespace Mon_
/-!
In this section, we prove that the category of monoids in a braided monoidal category is monoidal.
Given two monoids `M` and `N` in a braided monoidal category `C`,
the multiplication on the tensor product `M.X ⊗ N.X` is defined in the obvious way:
it is the tensor product of the multiplications on `M` and `N`,
except that the tensor factors in the source come in the wrong order,
which we fix by pre-composing with a permutation isomorphism constructed from the braiding.
(There is a subtlety here: in fact there are two ways to do these,
using either the positive or negative crossing.)
A more conceptual way of understanding this definition is the following:
The braiding on `C` gives rise to a monoidal structure on
the tensor product functor from `C × C` to `C`.
A pair of monoids in `C` gives rise to a monoid in `C × C`,
which the tensor product functor by being monoidal takes to a monoid in `C`.
The permutation isomorphism appearing in the definition of
the multiplication on the tensor product of two monoids is
an instance of a more general family of isomorphisms
which together form a strength that equips the tensor product functor with a monoidal structure,
and the monoid axioms for the tensor product follow from the monoid axioms for the tensor factors
plus the properties of the strength (i.e., monoidal functor axioms).
The strength `tensor_μ` of the tensor product functor has been defined in
`Mathlib.CategoryTheory.Monoidal.Braided`.
Its properties, stated as independent lemmas in that module,
are used extensively in the proofs below.
Notice that we could have followed the above plan not only conceptually
but also as a possible implementation and
could have constructed the tensor product of monoids via `mapMon`,
but we chose to give a more explicit definition directly in terms of `tensor_μ`.
To complete the definition of the monoidal category structure on the category of monoids,
we need to provide definitions of associator and unitors.
The obvious candidates are the associator and unitors from `C`,
but we need to prove that they are monoid morphisms, i.e., compatible with unit and multiplication.
These properties translate to the monoidality of the associator and unitors
(with respect to the monoidal structures on the functors they relate),
which have also been proved in `Mathlib.CategoryTheory.Monoidal.Braided`.
-/
variable {C}
-- The proofs that associators and unitors preserve monoid units don't require braiding.
theorem one_associator {M N P : Mon_ C} :
((λ_ (𝟙_ C)).inv ≫ ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) ⊗ P.one)) ≫ (α_ M.X N.X P.X).hom =
(λ_ (𝟙_ C)).inv ≫ (M.one ⊗ (λ_ (𝟙_ C)).inv ≫ (N.one ⊗ P.one)) := by
simp only [Category.assoc, Iso.cancel_iso_inv_left]
slice_lhs 1 3 => rw [← Category.id_comp P.one, tensor_comp]
slice_lhs 2 3 => rw [associator_naturality]
slice_rhs 1 2 => rw [← Category.id_comp M.one, tensor_comp]
slice_lhs 1 2 => rw [← leftUnitor_tensor_inv]
rw [← cancel_epi (λ_ (𝟙_ C)).inv]
slice_lhs 1 2 => rw [leftUnitor_inv_naturality]
simp only [Category.assoc]
#align Mon_.one_associator Mon_.one_associator
theorem one_leftUnitor {M : Mon_ C} :
((λ_ (𝟙_ C)).inv ≫ (𝟙 (𝟙_ C) ⊗ M.one)) ≫ (λ_ M.X).hom = M.one := by
slice_lhs 2 3 => | rw [leftUnitor_naturality] | theorem one_leftUnitor {M : Mon_ C} :
((λ_ (𝟙_ C)).inv ≫ (𝟙 (𝟙_ C) ⊗ M.one)) ≫ (λ_ M.X).hom = M.one := by
slice_lhs 2 3 => | Mathlib.CategoryTheory.Monoidal.Mon_.393_0.NTUMzhXPwXsmsYt | theorem one_leftUnitor {M : Mon_ C} :
((λ_ (𝟙_ C)).inv ≫ (𝟙 (𝟙_ C) ⊗ M.one)) ≫ (λ_ M.X).hom = M.one | Mathlib_CategoryTheory_Monoidal_Mon_ |
case a
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : MonoidalCategory C
M : Mon_ C
| (𝟙 (𝟙_ C) ⊗ M.one) ≫ (λ_ M.X).hom
case a C : Type u₁ inst✝¹ : Category.{v₁, u₁} C inst✝ : MonoidalCategory C M : Mon_ C | (λ_ (𝟙_ C)).inv | /-
Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/
import Mathlib.CategoryTheory.Monoidal.Braided
import Mathlib.CategoryTheory.Monoidal.Discrete
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
import Mathlib.Algebra.PUnitInstances
#align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c"
/-!
# The category of monoids in a monoidal category.
We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to
the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if
`C` is braided, then the category of monoids is naturally monoidal.
-/
set_option linter.uppercaseLean3 false
universe v₁ v₂ u₁ u₂ u
open CategoryTheory MonoidalCategory
variable (C : Type u₁) [Category.{v₁} C] [MonoidalCategory.{v₁} C]
/-- A monoid object internal to a monoidal category.
When the monoidal category is preadditive, this is also sometimes called an "algebra object".
-/
structure Mon_ where
X : C
one : 𝟙_ C ⟶ X
mul : X ⊗ X ⟶ X
one_mul : (one ⊗ 𝟙 X) ≫ mul = (λ_ X).hom := by aesop_cat
mul_one : (𝟙 X ⊗ one) ≫ mul = (ρ_ X).hom := by aesop_cat
-- Obviously there is some flexibility stating this axiom.
-- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`,
-- and chooses to place the associator on the right-hand side.
-- The heuristic is that unitors and associators "don't have much weight".
mul_assoc : (mul ⊗ 𝟙 X) ≫ mul = (α_ X X X).hom ≫ (𝟙 X ⊗ mul) ≫ mul := by aesop_cat
#align Mon_ Mon_
attribute [reassoc] Mon_.one_mul Mon_.mul_one
-- We prove a more general `@[simp]` lemma below.
attribute [reassoc (attr := simp)] Mon_.mul_assoc
namespace Mon_
/-- The trivial monoid object. We later show this is initial in `Mon_ C`.
-/
@[simps]
def trivial : Mon_ C where
X := 𝟙_ C
one := 𝟙 _
mul := (λ_ _).hom
mul_assoc := by coherence
mul_one := by coherence
#align Mon_.trivial Mon_.trivial
instance : Inhabited (Mon_ C) :=
⟨trivial C⟩
variable {C}
variable {M : Mon_ C}
@[simp]
theorem one_mul_hom {Z : C} (f : Z ⟶ M.X) : (M.one ⊗ f) ≫ M.mul = (λ_ Z).hom ≫ f := by
rw [← id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality]
#align Mon_.one_mul_hom Mon_.one_mul_hom
@[simp]
theorem mul_one_hom {Z : C} (f : Z ⟶ M.X) : (f ⊗ M.one) ≫ M.mul = (ρ_ Z).hom ≫ f := by
rw [← tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality]
#align Mon_.mul_one_hom Mon_.mul_one_hom
theorem assoc_flip :
(𝟙 M.X ⊗ M.mul) ≫ M.mul = (α_ M.X M.X M.X).inv ≫ (M.mul ⊗ 𝟙 M.X) ≫ M.mul := by simp
#align Mon_.assoc_flip Mon_.assoc_flip
/-- A morphism of monoid objects. -/
@[ext]
structure Hom (M N : Mon_ C) where
hom : M.X ⟶ N.X
one_hom : M.one ≫ hom = N.one := by aesop_cat
mul_hom : M.mul ≫ hom = (hom ⊗ hom) ≫ N.mul := by aesop_cat
#align Mon_.hom Mon_.Hom
attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom
/-- The identity morphism on a monoid object. -/
@[simps]
def id (M : Mon_ C) : Hom M M where
hom := 𝟙 M.X
#align Mon_.id Mon_.id
instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) :=
⟨id M⟩
#align Mon_.hom_inhabited Mon_.homInhabited
/-- Composition of morphisms of monoid objects. -/
@[simps]
def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where
hom := f.hom ≫ g.hom
#align Mon_.comp Mon_.comp
instance : Category (Mon_ C) where
Hom M N := Hom M N
id := id
comp f g := comp f g
-- Porting note: added, as `Hom.ext` does not apply to a morphism.
@[ext]
lemma ext {X Y : Mon_ C} {f g : X ⟶ Y} (w : f.hom = g.hom) : f = g :=
Hom.ext _ _ w
@[simp]
theorem id_hom' (M : Mon_ C) : (𝟙 M : Hom M M).hom = 𝟙 M.X :=
rfl
#align Mon_.id_hom' Mon_.id_hom'
@[simp]
theorem comp_hom' {M N K : Mon_ C} (f : M ⟶ N) (g : N ⟶ K) :
(f ≫ g : Hom M K).hom = f.hom ≫ g.hom :=
rfl
#align Mon_.comp_hom' Mon_.comp_hom'
section
variable (C)
/-- The forgetful functor from monoid objects to the ambient category. -/
@[simps]
def forget : Mon_ C ⥤ C where
obj A := A.X
map f := f.hom
#align Mon_.forget Mon_.forget
end
instance forget_faithful : Faithful (@forget C _ _) where
#align Mon_.forget_faithful Mon_.forget_faithful
instance {A B : Mon_ C} (f : A ⟶ B) [e : IsIso ((forget C).map f)] : IsIso f.hom :=
e
/-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/
instance : ReflectsIsomorphisms (forget C) where
reflects f e :=
⟨⟨{ hom := inv f.hom
mul_hom := by
simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, ← tensor_comp_assoc,
IsIso.inv_hom_id, tensor_id, Category.id_comp] },
by aesop_cat⟩⟩
/-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X ≅ N.X) (one_f : M.one ≫ f.hom = N.one)
(mul_f : M.mul ≫ f.hom = (f.hom ⊗ f.hom) ≫ N.mul) : M ≅ N where
hom :=
{ hom := f.hom
one_hom := one_f
mul_hom := mul_f }
inv :=
{ hom := f.inv
one_hom := by rw [← one_f]; simp
mul_hom := by
rw [← cancel_mono f.hom]
slice_rhs 2 3 => rw [mul_f]
simp }
#align Mon_.iso_of_iso Mon_.isoOfIso
instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C ⟶ A) where
default :=
{ hom := A.one
one_hom := by dsimp; simp
mul_hom := by dsimp; simp [A.one_mul, unitors_equal] }
uniq f := by
ext; simp
rw [← Category.id_comp f.hom]
erw [f.one_hom]
#align Mon_.unique_hom_from_trivial Mon_.uniqueHomFromTrivial
open CategoryTheory.Limits
instance : HasInitial (Mon_ C) :=
hasInitial_of_unique (trivial C)
end Mon_
namespace CategoryTheory.LaxMonoidalFunctor
variable {C} {D : Type u₂} [Category.{v₂} D] [MonoidalCategory.{v₂} D]
-- TODO: mapMod F A : Mod A ⥤ Mod (F.mapMon A)
/-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one]
rw [F.toFunctor.map_id]
rw [F.right_unitality]
mul_assoc := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_assoc]
conv_lhs => rw [F.toFunctor.map_id]
conv_lhs => rw [F.toFunctor.map_comp, F.toFunctor.map_comp]
conv_rhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_rhs 3 4 => rw [F.μ_natural]
conv_rhs => rw [F.toFunctor.map_id]
slice_rhs 1 3 => rw [← F.associativity]
simp only [Category.assoc] }
map f :=
{ hom := F.map f.hom
one_hom := by dsimp; rw [Category.assoc, ← F.toFunctor.map_comp, f.one_hom]
mul_hom := by
dsimp
rw [Category.assoc, F.μ_natural_assoc, ← F.toFunctor.map_comp, ← F.toFunctor.map_comp,
f.mul_hom] }
map_id A := by ext; simp
map_comp f g := by ext; simp
#align category_theory.lax_monoidal_functor.map_Mon CategoryTheory.LaxMonoidalFunctor.mapMon
variable (C D)
/-- `mapMon` is functorial in the lax monoidal functor. -/
@[simps] -- Porting note: added this, not sure how it worked previously without.
def mapMonFunctor : LaxMonoidalFunctor C D ⥤ Mon_ C ⥤ Mon_ D where
obj := mapMon
map α := { app := fun A => { hom := α.app A.X } }
#align category_theory.lax_monoidal_functor.map_Mon_functor CategoryTheory.LaxMonoidalFunctor.mapMonFunctor
end CategoryTheory.LaxMonoidalFunctor
namespace Mon_
open CategoryTheory.LaxMonoidalFunctor
namespace EquivLaxMonoidalFunctorPUnit
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps]
def laxMonoidalToMon : LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C ⥤ Mon_ C where
obj F := (F.mapMon : Mon_ _ ⥤ Mon_ C).obj (trivial (Discrete PUnit))
map α := ((mapMonFunctor (Discrete PUnit) C).map α).app _
#align Mon_.equiv_lax_monoidal_functor_punit.lax_monoidal_to_Mon Mon_.EquivLaxMonoidalFunctorPUnit.laxMonoidalToMon
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps]
def monToLaxMonoidal : Mon_ C ⥤ LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C where
obj A :=
{ obj := fun _ => A.X
map := fun _ => 𝟙 _
ε := A.one
μ := fun _ _ => A.mul
map_id := fun _ => rfl
map_comp := fun _ _ => (Category.id_comp (𝟙 A.X)).symm }
map f :=
{ app := fun _ => f.hom
naturality := fun _ _ _ => by dsimp; rw [Category.id_comp, Category.comp_id]
unit := f.one_hom
tensor := fun _ _ => f.mul_hom }
#align Mon_.equiv_lax_monoidal_functor_punit.Mon_to_lax_monoidal Mon_.EquivLaxMonoidalFunctorPUnit.monToLaxMonoidal
attribute [local aesop safe tactic (rule_sets [CategoryTheory])]
CategoryTheory.Discrete.discreteCases
attribute [local simp] eqToIso_map
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps!]
def unitIso :
𝟭 (LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C) ≅ laxMonoidalToMon C ⋙ monToLaxMonoidal C :=
NatIso.ofComponents
(fun F =>
MonoidalNatIso.ofComponents (fun _ => F.toFunctor.mapIso (eqToIso (by ext))) (by aesop_cat)
(by aesop_cat) (by aesop_cat))
(by aesop_cat)
#align Mon_.equiv_lax_monoidal_functor_punit.unit_iso Mon_.EquivLaxMonoidalFunctorPUnit.unitIso
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps!]
def counitIso : monToLaxMonoidal C ⋙ laxMonoidalToMon C ≅ 𝟭 (Mon_ C) :=
NatIso.ofComponents
(fun F =>
{ hom := { hom := 𝟙 _ }
inv := { hom := 𝟙 _ } })
(by aesop_cat)
#align Mon_.equiv_lax_monoidal_functor_punit.counit_iso Mon_.EquivLaxMonoidalFunctorPUnit.counitIso
end EquivLaxMonoidalFunctorPUnit
open EquivLaxMonoidalFunctorPUnit
attribute [local simp] eqToIso_map
/--
Monoid objects in `C` are "just" lax monoidal functors from the trivial monoidal category to `C`.
-/
@[simps]
def equivLaxMonoidalFunctorPUnit : LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C ≌ Mon_ C where
functor := laxMonoidalToMon C
inverse := monToLaxMonoidal C
unitIso := unitIso C
counitIso := counitIso C
#align Mon_.equiv_lax_monoidal_functor_punit Mon_.equivLaxMonoidalFunctorPUnit
end Mon_
namespace Mon_
/-!
In this section, we prove that the category of monoids in a braided monoidal category is monoidal.
Given two monoids `M` and `N` in a braided monoidal category `C`,
the multiplication on the tensor product `M.X ⊗ N.X` is defined in the obvious way:
it is the tensor product of the multiplications on `M` and `N`,
except that the tensor factors in the source come in the wrong order,
which we fix by pre-composing with a permutation isomorphism constructed from the braiding.
(There is a subtlety here: in fact there are two ways to do these,
using either the positive or negative crossing.)
A more conceptual way of understanding this definition is the following:
The braiding on `C` gives rise to a monoidal structure on
the tensor product functor from `C × C` to `C`.
A pair of monoids in `C` gives rise to a monoid in `C × C`,
which the tensor product functor by being monoidal takes to a monoid in `C`.
The permutation isomorphism appearing in the definition of
the multiplication on the tensor product of two monoids is
an instance of a more general family of isomorphisms
which together form a strength that equips the tensor product functor with a monoidal structure,
and the monoid axioms for the tensor product follow from the monoid axioms for the tensor factors
plus the properties of the strength (i.e., monoidal functor axioms).
The strength `tensor_μ` of the tensor product functor has been defined in
`Mathlib.CategoryTheory.Monoidal.Braided`.
Its properties, stated as independent lemmas in that module,
are used extensively in the proofs below.
Notice that we could have followed the above plan not only conceptually
but also as a possible implementation and
could have constructed the tensor product of monoids via `mapMon`,
but we chose to give a more explicit definition directly in terms of `tensor_μ`.
To complete the definition of the monoidal category structure on the category of monoids,
we need to provide definitions of associator and unitors.
The obvious candidates are the associator and unitors from `C`,
but we need to prove that they are monoid morphisms, i.e., compatible with unit and multiplication.
These properties translate to the monoidality of the associator and unitors
(with respect to the monoidal structures on the functors they relate),
which have also been proved in `Mathlib.CategoryTheory.Monoidal.Braided`.
-/
variable {C}
-- The proofs that associators and unitors preserve monoid units don't require braiding.
theorem one_associator {M N P : Mon_ C} :
((λ_ (𝟙_ C)).inv ≫ ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) ⊗ P.one)) ≫ (α_ M.X N.X P.X).hom =
(λ_ (𝟙_ C)).inv ≫ (M.one ⊗ (λ_ (𝟙_ C)).inv ≫ (N.one ⊗ P.one)) := by
simp only [Category.assoc, Iso.cancel_iso_inv_left]
slice_lhs 1 3 => rw [← Category.id_comp P.one, tensor_comp]
slice_lhs 2 3 => rw [associator_naturality]
slice_rhs 1 2 => rw [← Category.id_comp M.one, tensor_comp]
slice_lhs 1 2 => rw [← leftUnitor_tensor_inv]
rw [← cancel_epi (λ_ (𝟙_ C)).inv]
slice_lhs 1 2 => rw [leftUnitor_inv_naturality]
simp only [Category.assoc]
#align Mon_.one_associator Mon_.one_associator
theorem one_leftUnitor {M : Mon_ C} :
((λ_ (𝟙_ C)).inv ≫ (𝟙 (𝟙_ C) ⊗ M.one)) ≫ (λ_ M.X).hom = M.one := by
slice_lhs 2 3 => | rw [leftUnitor_naturality] | theorem one_leftUnitor {M : Mon_ C} :
((λ_ (𝟙_ C)).inv ≫ (𝟙 (𝟙_ C) ⊗ M.one)) ≫ (λ_ M.X).hom = M.one := by
slice_lhs 2 3 => | Mathlib.CategoryTheory.Monoidal.Mon_.393_0.NTUMzhXPwXsmsYt | theorem one_leftUnitor {M : Mon_ C} :
((λ_ (𝟙_ C)).inv ≫ (𝟙 (𝟙_ C) ⊗ M.one)) ≫ (λ_ M.X).hom = M.one | Mathlib_CategoryTheory_Monoidal_Mon_ |
case a
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : MonoidalCategory C
M : Mon_ C
| (𝟙 (𝟙_ C) ⊗ M.one) ≫ (λ_ M.X).hom
case a C : Type u₁ inst✝¹ : Category.{v₁, u₁} C inst✝ : MonoidalCategory C M : Mon_ C | (λ_ (𝟙_ C)).inv | /-
Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/
import Mathlib.CategoryTheory.Monoidal.Braided
import Mathlib.CategoryTheory.Monoidal.Discrete
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
import Mathlib.Algebra.PUnitInstances
#align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c"
/-!
# The category of monoids in a monoidal category.
We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to
the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if
`C` is braided, then the category of monoids is naturally monoidal.
-/
set_option linter.uppercaseLean3 false
universe v₁ v₂ u₁ u₂ u
open CategoryTheory MonoidalCategory
variable (C : Type u₁) [Category.{v₁} C] [MonoidalCategory.{v₁} C]
/-- A monoid object internal to a monoidal category.
When the monoidal category is preadditive, this is also sometimes called an "algebra object".
-/
structure Mon_ where
X : C
one : 𝟙_ C ⟶ X
mul : X ⊗ X ⟶ X
one_mul : (one ⊗ 𝟙 X) ≫ mul = (λ_ X).hom := by aesop_cat
mul_one : (𝟙 X ⊗ one) ≫ mul = (ρ_ X).hom := by aesop_cat
-- Obviously there is some flexibility stating this axiom.
-- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`,
-- and chooses to place the associator on the right-hand side.
-- The heuristic is that unitors and associators "don't have much weight".
mul_assoc : (mul ⊗ 𝟙 X) ≫ mul = (α_ X X X).hom ≫ (𝟙 X ⊗ mul) ≫ mul := by aesop_cat
#align Mon_ Mon_
attribute [reassoc] Mon_.one_mul Mon_.mul_one
-- We prove a more general `@[simp]` lemma below.
attribute [reassoc (attr := simp)] Mon_.mul_assoc
namespace Mon_
/-- The trivial monoid object. We later show this is initial in `Mon_ C`.
-/
@[simps]
def trivial : Mon_ C where
X := 𝟙_ C
one := 𝟙 _
mul := (λ_ _).hom
mul_assoc := by coherence
mul_one := by coherence
#align Mon_.trivial Mon_.trivial
instance : Inhabited (Mon_ C) :=
⟨trivial C⟩
variable {C}
variable {M : Mon_ C}
@[simp]
theorem one_mul_hom {Z : C} (f : Z ⟶ M.X) : (M.one ⊗ f) ≫ M.mul = (λ_ Z).hom ≫ f := by
rw [← id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality]
#align Mon_.one_mul_hom Mon_.one_mul_hom
@[simp]
theorem mul_one_hom {Z : C} (f : Z ⟶ M.X) : (f ⊗ M.one) ≫ M.mul = (ρ_ Z).hom ≫ f := by
rw [← tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality]
#align Mon_.mul_one_hom Mon_.mul_one_hom
theorem assoc_flip :
(𝟙 M.X ⊗ M.mul) ≫ M.mul = (α_ M.X M.X M.X).inv ≫ (M.mul ⊗ 𝟙 M.X) ≫ M.mul := by simp
#align Mon_.assoc_flip Mon_.assoc_flip
/-- A morphism of monoid objects. -/
@[ext]
structure Hom (M N : Mon_ C) where
hom : M.X ⟶ N.X
one_hom : M.one ≫ hom = N.one := by aesop_cat
mul_hom : M.mul ≫ hom = (hom ⊗ hom) ≫ N.mul := by aesop_cat
#align Mon_.hom Mon_.Hom
attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom
/-- The identity morphism on a monoid object. -/
@[simps]
def id (M : Mon_ C) : Hom M M where
hom := 𝟙 M.X
#align Mon_.id Mon_.id
instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) :=
⟨id M⟩
#align Mon_.hom_inhabited Mon_.homInhabited
/-- Composition of morphisms of monoid objects. -/
@[simps]
def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where
hom := f.hom ≫ g.hom
#align Mon_.comp Mon_.comp
instance : Category (Mon_ C) where
Hom M N := Hom M N
id := id
comp f g := comp f g
-- Porting note: added, as `Hom.ext` does not apply to a morphism.
@[ext]
lemma ext {X Y : Mon_ C} {f g : X ⟶ Y} (w : f.hom = g.hom) : f = g :=
Hom.ext _ _ w
@[simp]
theorem id_hom' (M : Mon_ C) : (𝟙 M : Hom M M).hom = 𝟙 M.X :=
rfl
#align Mon_.id_hom' Mon_.id_hom'
@[simp]
theorem comp_hom' {M N K : Mon_ C} (f : M ⟶ N) (g : N ⟶ K) :
(f ≫ g : Hom M K).hom = f.hom ≫ g.hom :=
rfl
#align Mon_.comp_hom' Mon_.comp_hom'
section
variable (C)
/-- The forgetful functor from monoid objects to the ambient category. -/
@[simps]
def forget : Mon_ C ⥤ C where
obj A := A.X
map f := f.hom
#align Mon_.forget Mon_.forget
end
instance forget_faithful : Faithful (@forget C _ _) where
#align Mon_.forget_faithful Mon_.forget_faithful
instance {A B : Mon_ C} (f : A ⟶ B) [e : IsIso ((forget C).map f)] : IsIso f.hom :=
e
/-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/
instance : ReflectsIsomorphisms (forget C) where
reflects f e :=
⟨⟨{ hom := inv f.hom
mul_hom := by
simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, ← tensor_comp_assoc,
IsIso.inv_hom_id, tensor_id, Category.id_comp] },
by aesop_cat⟩⟩
/-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X ≅ N.X) (one_f : M.one ≫ f.hom = N.one)
(mul_f : M.mul ≫ f.hom = (f.hom ⊗ f.hom) ≫ N.mul) : M ≅ N where
hom :=
{ hom := f.hom
one_hom := one_f
mul_hom := mul_f }
inv :=
{ hom := f.inv
one_hom := by rw [← one_f]; simp
mul_hom := by
rw [← cancel_mono f.hom]
slice_rhs 2 3 => rw [mul_f]
simp }
#align Mon_.iso_of_iso Mon_.isoOfIso
instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C ⟶ A) where
default :=
{ hom := A.one
one_hom := by dsimp; simp
mul_hom := by dsimp; simp [A.one_mul, unitors_equal] }
uniq f := by
ext; simp
rw [← Category.id_comp f.hom]
erw [f.one_hom]
#align Mon_.unique_hom_from_trivial Mon_.uniqueHomFromTrivial
open CategoryTheory.Limits
instance : HasInitial (Mon_ C) :=
hasInitial_of_unique (trivial C)
end Mon_
namespace CategoryTheory.LaxMonoidalFunctor
variable {C} {D : Type u₂} [Category.{v₂} D] [MonoidalCategory.{v₂} D]
-- TODO: mapMod F A : Mod A ⥤ Mod (F.mapMon A)
/-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one]
rw [F.toFunctor.map_id]
rw [F.right_unitality]
mul_assoc := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_assoc]
conv_lhs => rw [F.toFunctor.map_id]
conv_lhs => rw [F.toFunctor.map_comp, F.toFunctor.map_comp]
conv_rhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_rhs 3 4 => rw [F.μ_natural]
conv_rhs => rw [F.toFunctor.map_id]
slice_rhs 1 3 => rw [← F.associativity]
simp only [Category.assoc] }
map f :=
{ hom := F.map f.hom
one_hom := by dsimp; rw [Category.assoc, ← F.toFunctor.map_comp, f.one_hom]
mul_hom := by
dsimp
rw [Category.assoc, F.μ_natural_assoc, ← F.toFunctor.map_comp, ← F.toFunctor.map_comp,
f.mul_hom] }
map_id A := by ext; simp
map_comp f g := by ext; simp
#align category_theory.lax_monoidal_functor.map_Mon CategoryTheory.LaxMonoidalFunctor.mapMon
variable (C D)
/-- `mapMon` is functorial in the lax monoidal functor. -/
@[simps] -- Porting note: added this, not sure how it worked previously without.
def mapMonFunctor : LaxMonoidalFunctor C D ⥤ Mon_ C ⥤ Mon_ D where
obj := mapMon
map α := { app := fun A => { hom := α.app A.X } }
#align category_theory.lax_monoidal_functor.map_Mon_functor CategoryTheory.LaxMonoidalFunctor.mapMonFunctor
end CategoryTheory.LaxMonoidalFunctor
namespace Mon_
open CategoryTheory.LaxMonoidalFunctor
namespace EquivLaxMonoidalFunctorPUnit
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps]
def laxMonoidalToMon : LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C ⥤ Mon_ C where
obj F := (F.mapMon : Mon_ _ ⥤ Mon_ C).obj (trivial (Discrete PUnit))
map α := ((mapMonFunctor (Discrete PUnit) C).map α).app _
#align Mon_.equiv_lax_monoidal_functor_punit.lax_monoidal_to_Mon Mon_.EquivLaxMonoidalFunctorPUnit.laxMonoidalToMon
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps]
def monToLaxMonoidal : Mon_ C ⥤ LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C where
obj A :=
{ obj := fun _ => A.X
map := fun _ => 𝟙 _
ε := A.one
μ := fun _ _ => A.mul
map_id := fun _ => rfl
map_comp := fun _ _ => (Category.id_comp (𝟙 A.X)).symm }
map f :=
{ app := fun _ => f.hom
naturality := fun _ _ _ => by dsimp; rw [Category.id_comp, Category.comp_id]
unit := f.one_hom
tensor := fun _ _ => f.mul_hom }
#align Mon_.equiv_lax_monoidal_functor_punit.Mon_to_lax_monoidal Mon_.EquivLaxMonoidalFunctorPUnit.monToLaxMonoidal
attribute [local aesop safe tactic (rule_sets [CategoryTheory])]
CategoryTheory.Discrete.discreteCases
attribute [local simp] eqToIso_map
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps!]
def unitIso :
𝟭 (LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C) ≅ laxMonoidalToMon C ⋙ monToLaxMonoidal C :=
NatIso.ofComponents
(fun F =>
MonoidalNatIso.ofComponents (fun _ => F.toFunctor.mapIso (eqToIso (by ext))) (by aesop_cat)
(by aesop_cat) (by aesop_cat))
(by aesop_cat)
#align Mon_.equiv_lax_monoidal_functor_punit.unit_iso Mon_.EquivLaxMonoidalFunctorPUnit.unitIso
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps!]
def counitIso : monToLaxMonoidal C ⋙ laxMonoidalToMon C ≅ 𝟭 (Mon_ C) :=
NatIso.ofComponents
(fun F =>
{ hom := { hom := 𝟙 _ }
inv := { hom := 𝟙 _ } })
(by aesop_cat)
#align Mon_.equiv_lax_monoidal_functor_punit.counit_iso Mon_.EquivLaxMonoidalFunctorPUnit.counitIso
end EquivLaxMonoidalFunctorPUnit
open EquivLaxMonoidalFunctorPUnit
attribute [local simp] eqToIso_map
/--
Monoid objects in `C` are "just" lax monoidal functors from the trivial monoidal category to `C`.
-/
@[simps]
def equivLaxMonoidalFunctorPUnit : LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C ≌ Mon_ C where
functor := laxMonoidalToMon C
inverse := monToLaxMonoidal C
unitIso := unitIso C
counitIso := counitIso C
#align Mon_.equiv_lax_monoidal_functor_punit Mon_.equivLaxMonoidalFunctorPUnit
end Mon_
namespace Mon_
/-!
In this section, we prove that the category of monoids in a braided monoidal category is monoidal.
Given two monoids `M` and `N` in a braided monoidal category `C`,
the multiplication on the tensor product `M.X ⊗ N.X` is defined in the obvious way:
it is the tensor product of the multiplications on `M` and `N`,
except that the tensor factors in the source come in the wrong order,
which we fix by pre-composing with a permutation isomorphism constructed from the braiding.
(There is a subtlety here: in fact there are two ways to do these,
using either the positive or negative crossing.)
A more conceptual way of understanding this definition is the following:
The braiding on `C` gives rise to a monoidal structure on
the tensor product functor from `C × C` to `C`.
A pair of monoids in `C` gives rise to a monoid in `C × C`,
which the tensor product functor by being monoidal takes to a monoid in `C`.
The permutation isomorphism appearing in the definition of
the multiplication on the tensor product of two monoids is
an instance of a more general family of isomorphisms
which together form a strength that equips the tensor product functor with a monoidal structure,
and the monoid axioms for the tensor product follow from the monoid axioms for the tensor factors
plus the properties of the strength (i.e., monoidal functor axioms).
The strength `tensor_μ` of the tensor product functor has been defined in
`Mathlib.CategoryTheory.Monoidal.Braided`.
Its properties, stated as independent lemmas in that module,
are used extensively in the proofs below.
Notice that we could have followed the above plan not only conceptually
but also as a possible implementation and
could have constructed the tensor product of monoids via `mapMon`,
but we chose to give a more explicit definition directly in terms of `tensor_μ`.
To complete the definition of the monoidal category structure on the category of monoids,
we need to provide definitions of associator and unitors.
The obvious candidates are the associator and unitors from `C`,
but we need to prove that they are monoid morphisms, i.e., compatible with unit and multiplication.
These properties translate to the monoidality of the associator and unitors
(with respect to the monoidal structures on the functors they relate),
which have also been proved in `Mathlib.CategoryTheory.Monoidal.Braided`.
-/
variable {C}
-- The proofs that associators and unitors preserve monoid units don't require braiding.
theorem one_associator {M N P : Mon_ C} :
((λ_ (𝟙_ C)).inv ≫ ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) ⊗ P.one)) ≫ (α_ M.X N.X P.X).hom =
(λ_ (𝟙_ C)).inv ≫ (M.one ⊗ (λ_ (𝟙_ C)).inv ≫ (N.one ⊗ P.one)) := by
simp only [Category.assoc, Iso.cancel_iso_inv_left]
slice_lhs 1 3 => rw [← Category.id_comp P.one, tensor_comp]
slice_lhs 2 3 => rw [associator_naturality]
slice_rhs 1 2 => rw [← Category.id_comp M.one, tensor_comp]
slice_lhs 1 2 => rw [← leftUnitor_tensor_inv]
rw [← cancel_epi (λ_ (𝟙_ C)).inv]
slice_lhs 1 2 => rw [leftUnitor_inv_naturality]
simp only [Category.assoc]
#align Mon_.one_associator Mon_.one_associator
theorem one_leftUnitor {M : Mon_ C} :
((λ_ (𝟙_ C)).inv ≫ (𝟙 (𝟙_ C) ⊗ M.one)) ≫ (λ_ M.X).hom = M.one := by
slice_lhs 2 3 => | rw [leftUnitor_naturality] | theorem one_leftUnitor {M : Mon_ C} :
((λ_ (𝟙_ C)).inv ≫ (𝟙 (𝟙_ C) ⊗ M.one)) ≫ (λ_ M.X).hom = M.one := by
slice_lhs 2 3 => | Mathlib.CategoryTheory.Monoidal.Mon_.393_0.NTUMzhXPwXsmsYt | theorem one_leftUnitor {M : Mon_ C} :
((λ_ (𝟙_ C)).inv ≫ (𝟙 (𝟙_ C) ⊗ M.one)) ≫ (λ_ M.X).hom = M.one | Mathlib_CategoryTheory_Monoidal_Mon_ |
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : MonoidalCategory C
M : Mon_ C
⊢ (λ_ (𝟙_ C)).inv ≫ (λ_ (𝟙_ C)).hom ≫ M.one = M.one | /-
Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/
import Mathlib.CategoryTheory.Monoidal.Braided
import Mathlib.CategoryTheory.Monoidal.Discrete
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
import Mathlib.Algebra.PUnitInstances
#align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c"
/-!
# The category of monoids in a monoidal category.
We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to
the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if
`C` is braided, then the category of monoids is naturally monoidal.
-/
set_option linter.uppercaseLean3 false
universe v₁ v₂ u₁ u₂ u
open CategoryTheory MonoidalCategory
variable (C : Type u₁) [Category.{v₁} C] [MonoidalCategory.{v₁} C]
/-- A monoid object internal to a monoidal category.
When the monoidal category is preadditive, this is also sometimes called an "algebra object".
-/
structure Mon_ where
X : C
one : 𝟙_ C ⟶ X
mul : X ⊗ X ⟶ X
one_mul : (one ⊗ 𝟙 X) ≫ mul = (λ_ X).hom := by aesop_cat
mul_one : (𝟙 X ⊗ one) ≫ mul = (ρ_ X).hom := by aesop_cat
-- Obviously there is some flexibility stating this axiom.
-- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`,
-- and chooses to place the associator on the right-hand side.
-- The heuristic is that unitors and associators "don't have much weight".
mul_assoc : (mul ⊗ 𝟙 X) ≫ mul = (α_ X X X).hom ≫ (𝟙 X ⊗ mul) ≫ mul := by aesop_cat
#align Mon_ Mon_
attribute [reassoc] Mon_.one_mul Mon_.mul_one
-- We prove a more general `@[simp]` lemma below.
attribute [reassoc (attr := simp)] Mon_.mul_assoc
namespace Mon_
/-- The trivial monoid object. We later show this is initial in `Mon_ C`.
-/
@[simps]
def trivial : Mon_ C where
X := 𝟙_ C
one := 𝟙 _
mul := (λ_ _).hom
mul_assoc := by coherence
mul_one := by coherence
#align Mon_.trivial Mon_.trivial
instance : Inhabited (Mon_ C) :=
⟨trivial C⟩
variable {C}
variable {M : Mon_ C}
@[simp]
theorem one_mul_hom {Z : C} (f : Z ⟶ M.X) : (M.one ⊗ f) ≫ M.mul = (λ_ Z).hom ≫ f := by
rw [← id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality]
#align Mon_.one_mul_hom Mon_.one_mul_hom
@[simp]
theorem mul_one_hom {Z : C} (f : Z ⟶ M.X) : (f ⊗ M.one) ≫ M.mul = (ρ_ Z).hom ≫ f := by
rw [← tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality]
#align Mon_.mul_one_hom Mon_.mul_one_hom
theorem assoc_flip :
(𝟙 M.X ⊗ M.mul) ≫ M.mul = (α_ M.X M.X M.X).inv ≫ (M.mul ⊗ 𝟙 M.X) ≫ M.mul := by simp
#align Mon_.assoc_flip Mon_.assoc_flip
/-- A morphism of monoid objects. -/
@[ext]
structure Hom (M N : Mon_ C) where
hom : M.X ⟶ N.X
one_hom : M.one ≫ hom = N.one := by aesop_cat
mul_hom : M.mul ≫ hom = (hom ⊗ hom) ≫ N.mul := by aesop_cat
#align Mon_.hom Mon_.Hom
attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom
/-- The identity morphism on a monoid object. -/
@[simps]
def id (M : Mon_ C) : Hom M M where
hom := 𝟙 M.X
#align Mon_.id Mon_.id
instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) :=
⟨id M⟩
#align Mon_.hom_inhabited Mon_.homInhabited
/-- Composition of morphisms of monoid objects. -/
@[simps]
def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where
hom := f.hom ≫ g.hom
#align Mon_.comp Mon_.comp
instance : Category (Mon_ C) where
Hom M N := Hom M N
id := id
comp f g := comp f g
-- Porting note: added, as `Hom.ext` does not apply to a morphism.
@[ext]
lemma ext {X Y : Mon_ C} {f g : X ⟶ Y} (w : f.hom = g.hom) : f = g :=
Hom.ext _ _ w
@[simp]
theorem id_hom' (M : Mon_ C) : (𝟙 M : Hom M M).hom = 𝟙 M.X :=
rfl
#align Mon_.id_hom' Mon_.id_hom'
@[simp]
theorem comp_hom' {M N K : Mon_ C} (f : M ⟶ N) (g : N ⟶ K) :
(f ≫ g : Hom M K).hom = f.hom ≫ g.hom :=
rfl
#align Mon_.comp_hom' Mon_.comp_hom'
section
variable (C)
/-- The forgetful functor from monoid objects to the ambient category. -/
@[simps]
def forget : Mon_ C ⥤ C where
obj A := A.X
map f := f.hom
#align Mon_.forget Mon_.forget
end
instance forget_faithful : Faithful (@forget C _ _) where
#align Mon_.forget_faithful Mon_.forget_faithful
instance {A B : Mon_ C} (f : A ⟶ B) [e : IsIso ((forget C).map f)] : IsIso f.hom :=
e
/-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/
instance : ReflectsIsomorphisms (forget C) where
reflects f e :=
⟨⟨{ hom := inv f.hom
mul_hom := by
simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, ← tensor_comp_assoc,
IsIso.inv_hom_id, tensor_id, Category.id_comp] },
by aesop_cat⟩⟩
/-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X ≅ N.X) (one_f : M.one ≫ f.hom = N.one)
(mul_f : M.mul ≫ f.hom = (f.hom ⊗ f.hom) ≫ N.mul) : M ≅ N where
hom :=
{ hom := f.hom
one_hom := one_f
mul_hom := mul_f }
inv :=
{ hom := f.inv
one_hom := by rw [← one_f]; simp
mul_hom := by
rw [← cancel_mono f.hom]
slice_rhs 2 3 => rw [mul_f]
simp }
#align Mon_.iso_of_iso Mon_.isoOfIso
instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C ⟶ A) where
default :=
{ hom := A.one
one_hom := by dsimp; simp
mul_hom := by dsimp; simp [A.one_mul, unitors_equal] }
uniq f := by
ext; simp
rw [← Category.id_comp f.hom]
erw [f.one_hom]
#align Mon_.unique_hom_from_trivial Mon_.uniqueHomFromTrivial
open CategoryTheory.Limits
instance : HasInitial (Mon_ C) :=
hasInitial_of_unique (trivial C)
end Mon_
namespace CategoryTheory.LaxMonoidalFunctor
variable {C} {D : Type u₂} [Category.{v₂} D] [MonoidalCategory.{v₂} D]
-- TODO: mapMod F A : Mod A ⥤ Mod (F.mapMon A)
/-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one]
rw [F.toFunctor.map_id]
rw [F.right_unitality]
mul_assoc := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_assoc]
conv_lhs => rw [F.toFunctor.map_id]
conv_lhs => rw [F.toFunctor.map_comp, F.toFunctor.map_comp]
conv_rhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_rhs 3 4 => rw [F.μ_natural]
conv_rhs => rw [F.toFunctor.map_id]
slice_rhs 1 3 => rw [← F.associativity]
simp only [Category.assoc] }
map f :=
{ hom := F.map f.hom
one_hom := by dsimp; rw [Category.assoc, ← F.toFunctor.map_comp, f.one_hom]
mul_hom := by
dsimp
rw [Category.assoc, F.μ_natural_assoc, ← F.toFunctor.map_comp, ← F.toFunctor.map_comp,
f.mul_hom] }
map_id A := by ext; simp
map_comp f g := by ext; simp
#align category_theory.lax_monoidal_functor.map_Mon CategoryTheory.LaxMonoidalFunctor.mapMon
variable (C D)
/-- `mapMon` is functorial in the lax monoidal functor. -/
@[simps] -- Porting note: added this, not sure how it worked previously without.
def mapMonFunctor : LaxMonoidalFunctor C D ⥤ Mon_ C ⥤ Mon_ D where
obj := mapMon
map α := { app := fun A => { hom := α.app A.X } }
#align category_theory.lax_monoidal_functor.map_Mon_functor CategoryTheory.LaxMonoidalFunctor.mapMonFunctor
end CategoryTheory.LaxMonoidalFunctor
namespace Mon_
open CategoryTheory.LaxMonoidalFunctor
namespace EquivLaxMonoidalFunctorPUnit
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps]
def laxMonoidalToMon : LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C ⥤ Mon_ C where
obj F := (F.mapMon : Mon_ _ ⥤ Mon_ C).obj (trivial (Discrete PUnit))
map α := ((mapMonFunctor (Discrete PUnit) C).map α).app _
#align Mon_.equiv_lax_monoidal_functor_punit.lax_monoidal_to_Mon Mon_.EquivLaxMonoidalFunctorPUnit.laxMonoidalToMon
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps]
def monToLaxMonoidal : Mon_ C ⥤ LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C where
obj A :=
{ obj := fun _ => A.X
map := fun _ => 𝟙 _
ε := A.one
μ := fun _ _ => A.mul
map_id := fun _ => rfl
map_comp := fun _ _ => (Category.id_comp (𝟙 A.X)).symm }
map f :=
{ app := fun _ => f.hom
naturality := fun _ _ _ => by dsimp; rw [Category.id_comp, Category.comp_id]
unit := f.one_hom
tensor := fun _ _ => f.mul_hom }
#align Mon_.equiv_lax_monoidal_functor_punit.Mon_to_lax_monoidal Mon_.EquivLaxMonoidalFunctorPUnit.monToLaxMonoidal
attribute [local aesop safe tactic (rule_sets [CategoryTheory])]
CategoryTheory.Discrete.discreteCases
attribute [local simp] eqToIso_map
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps!]
def unitIso :
𝟭 (LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C) ≅ laxMonoidalToMon C ⋙ monToLaxMonoidal C :=
NatIso.ofComponents
(fun F =>
MonoidalNatIso.ofComponents (fun _ => F.toFunctor.mapIso (eqToIso (by ext))) (by aesop_cat)
(by aesop_cat) (by aesop_cat))
(by aesop_cat)
#align Mon_.equiv_lax_monoidal_functor_punit.unit_iso Mon_.EquivLaxMonoidalFunctorPUnit.unitIso
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps!]
def counitIso : monToLaxMonoidal C ⋙ laxMonoidalToMon C ≅ 𝟭 (Mon_ C) :=
NatIso.ofComponents
(fun F =>
{ hom := { hom := 𝟙 _ }
inv := { hom := 𝟙 _ } })
(by aesop_cat)
#align Mon_.equiv_lax_monoidal_functor_punit.counit_iso Mon_.EquivLaxMonoidalFunctorPUnit.counitIso
end EquivLaxMonoidalFunctorPUnit
open EquivLaxMonoidalFunctorPUnit
attribute [local simp] eqToIso_map
/--
Monoid objects in `C` are "just" lax monoidal functors from the trivial monoidal category to `C`.
-/
@[simps]
def equivLaxMonoidalFunctorPUnit : LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C ≌ Mon_ C where
functor := laxMonoidalToMon C
inverse := monToLaxMonoidal C
unitIso := unitIso C
counitIso := counitIso C
#align Mon_.equiv_lax_monoidal_functor_punit Mon_.equivLaxMonoidalFunctorPUnit
end Mon_
namespace Mon_
/-!
In this section, we prove that the category of monoids in a braided monoidal category is monoidal.
Given two monoids `M` and `N` in a braided monoidal category `C`,
the multiplication on the tensor product `M.X ⊗ N.X` is defined in the obvious way:
it is the tensor product of the multiplications on `M` and `N`,
except that the tensor factors in the source come in the wrong order,
which we fix by pre-composing with a permutation isomorphism constructed from the braiding.
(There is a subtlety here: in fact there are two ways to do these,
using either the positive or negative crossing.)
A more conceptual way of understanding this definition is the following:
The braiding on `C` gives rise to a monoidal structure on
the tensor product functor from `C × C` to `C`.
A pair of monoids in `C` gives rise to a monoid in `C × C`,
which the tensor product functor by being monoidal takes to a monoid in `C`.
The permutation isomorphism appearing in the definition of
the multiplication on the tensor product of two monoids is
an instance of a more general family of isomorphisms
which together form a strength that equips the tensor product functor with a monoidal structure,
and the monoid axioms for the tensor product follow from the monoid axioms for the tensor factors
plus the properties of the strength (i.e., monoidal functor axioms).
The strength `tensor_μ` of the tensor product functor has been defined in
`Mathlib.CategoryTheory.Monoidal.Braided`.
Its properties, stated as independent lemmas in that module,
are used extensively in the proofs below.
Notice that we could have followed the above plan not only conceptually
but also as a possible implementation and
could have constructed the tensor product of monoids via `mapMon`,
but we chose to give a more explicit definition directly in terms of `tensor_μ`.
To complete the definition of the monoidal category structure on the category of monoids,
we need to provide definitions of associator and unitors.
The obvious candidates are the associator and unitors from `C`,
but we need to prove that they are monoid morphisms, i.e., compatible with unit and multiplication.
These properties translate to the monoidality of the associator and unitors
(with respect to the monoidal structures on the functors they relate),
which have also been proved in `Mathlib.CategoryTheory.Monoidal.Braided`.
-/
variable {C}
-- The proofs that associators and unitors preserve monoid units don't require braiding.
theorem one_associator {M N P : Mon_ C} :
((λ_ (𝟙_ C)).inv ≫ ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) ⊗ P.one)) ≫ (α_ M.X N.X P.X).hom =
(λ_ (𝟙_ C)).inv ≫ (M.one ⊗ (λ_ (𝟙_ C)).inv ≫ (N.one ⊗ P.one)) := by
simp only [Category.assoc, Iso.cancel_iso_inv_left]
slice_lhs 1 3 => rw [← Category.id_comp P.one, tensor_comp]
slice_lhs 2 3 => rw [associator_naturality]
slice_rhs 1 2 => rw [← Category.id_comp M.one, tensor_comp]
slice_lhs 1 2 => rw [← leftUnitor_tensor_inv]
rw [← cancel_epi (λ_ (𝟙_ C)).inv]
slice_lhs 1 2 => rw [leftUnitor_inv_naturality]
simp only [Category.assoc]
#align Mon_.one_associator Mon_.one_associator
theorem one_leftUnitor {M : Mon_ C} :
((λ_ (𝟙_ C)).inv ≫ (𝟙 (𝟙_ C) ⊗ M.one)) ≫ (λ_ M.X).hom = M.one := by
slice_lhs 2 3 => rw [leftUnitor_naturality]
| simp | theorem one_leftUnitor {M : Mon_ C} :
((λ_ (𝟙_ C)).inv ≫ (𝟙 (𝟙_ C) ⊗ M.one)) ≫ (λ_ M.X).hom = M.one := by
slice_lhs 2 3 => rw [leftUnitor_naturality]
| Mathlib.CategoryTheory.Monoidal.Mon_.393_0.NTUMzhXPwXsmsYt | theorem one_leftUnitor {M : Mon_ C} :
((λ_ (𝟙_ C)).inv ≫ (𝟙 (𝟙_ C) ⊗ M.one)) ≫ (λ_ M.X).hom = M.one | Mathlib_CategoryTheory_Monoidal_Mon_ |
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : MonoidalCategory C
M : Mon_ C
⊢ ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ 𝟙 (𝟙_ C))) ≫ (ρ_ M.X).hom = M.one | /-
Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/
import Mathlib.CategoryTheory.Monoidal.Braided
import Mathlib.CategoryTheory.Monoidal.Discrete
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
import Mathlib.Algebra.PUnitInstances
#align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c"
/-!
# The category of monoids in a monoidal category.
We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to
the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if
`C` is braided, then the category of monoids is naturally monoidal.
-/
set_option linter.uppercaseLean3 false
universe v₁ v₂ u₁ u₂ u
open CategoryTheory MonoidalCategory
variable (C : Type u₁) [Category.{v₁} C] [MonoidalCategory.{v₁} C]
/-- A monoid object internal to a monoidal category.
When the monoidal category is preadditive, this is also sometimes called an "algebra object".
-/
structure Mon_ where
X : C
one : 𝟙_ C ⟶ X
mul : X ⊗ X ⟶ X
one_mul : (one ⊗ 𝟙 X) ≫ mul = (λ_ X).hom := by aesop_cat
mul_one : (𝟙 X ⊗ one) ≫ mul = (ρ_ X).hom := by aesop_cat
-- Obviously there is some flexibility stating this axiom.
-- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`,
-- and chooses to place the associator on the right-hand side.
-- The heuristic is that unitors and associators "don't have much weight".
mul_assoc : (mul ⊗ 𝟙 X) ≫ mul = (α_ X X X).hom ≫ (𝟙 X ⊗ mul) ≫ mul := by aesop_cat
#align Mon_ Mon_
attribute [reassoc] Mon_.one_mul Mon_.mul_one
-- We prove a more general `@[simp]` lemma below.
attribute [reassoc (attr := simp)] Mon_.mul_assoc
namespace Mon_
/-- The trivial monoid object. We later show this is initial in `Mon_ C`.
-/
@[simps]
def trivial : Mon_ C where
X := 𝟙_ C
one := 𝟙 _
mul := (λ_ _).hom
mul_assoc := by coherence
mul_one := by coherence
#align Mon_.trivial Mon_.trivial
instance : Inhabited (Mon_ C) :=
⟨trivial C⟩
variable {C}
variable {M : Mon_ C}
@[simp]
theorem one_mul_hom {Z : C} (f : Z ⟶ M.X) : (M.one ⊗ f) ≫ M.mul = (λ_ Z).hom ≫ f := by
rw [← id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality]
#align Mon_.one_mul_hom Mon_.one_mul_hom
@[simp]
theorem mul_one_hom {Z : C} (f : Z ⟶ M.X) : (f ⊗ M.one) ≫ M.mul = (ρ_ Z).hom ≫ f := by
rw [← tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality]
#align Mon_.mul_one_hom Mon_.mul_one_hom
theorem assoc_flip :
(𝟙 M.X ⊗ M.mul) ≫ M.mul = (α_ M.X M.X M.X).inv ≫ (M.mul ⊗ 𝟙 M.X) ≫ M.mul := by simp
#align Mon_.assoc_flip Mon_.assoc_flip
/-- A morphism of monoid objects. -/
@[ext]
structure Hom (M N : Mon_ C) where
hom : M.X ⟶ N.X
one_hom : M.one ≫ hom = N.one := by aesop_cat
mul_hom : M.mul ≫ hom = (hom ⊗ hom) ≫ N.mul := by aesop_cat
#align Mon_.hom Mon_.Hom
attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom
/-- The identity morphism on a monoid object. -/
@[simps]
def id (M : Mon_ C) : Hom M M where
hom := 𝟙 M.X
#align Mon_.id Mon_.id
instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) :=
⟨id M⟩
#align Mon_.hom_inhabited Mon_.homInhabited
/-- Composition of morphisms of monoid objects. -/
@[simps]
def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where
hom := f.hom ≫ g.hom
#align Mon_.comp Mon_.comp
instance : Category (Mon_ C) where
Hom M N := Hom M N
id := id
comp f g := comp f g
-- Porting note: added, as `Hom.ext` does not apply to a morphism.
@[ext]
lemma ext {X Y : Mon_ C} {f g : X ⟶ Y} (w : f.hom = g.hom) : f = g :=
Hom.ext _ _ w
@[simp]
theorem id_hom' (M : Mon_ C) : (𝟙 M : Hom M M).hom = 𝟙 M.X :=
rfl
#align Mon_.id_hom' Mon_.id_hom'
@[simp]
theorem comp_hom' {M N K : Mon_ C} (f : M ⟶ N) (g : N ⟶ K) :
(f ≫ g : Hom M K).hom = f.hom ≫ g.hom :=
rfl
#align Mon_.comp_hom' Mon_.comp_hom'
section
variable (C)
/-- The forgetful functor from monoid objects to the ambient category. -/
@[simps]
def forget : Mon_ C ⥤ C where
obj A := A.X
map f := f.hom
#align Mon_.forget Mon_.forget
end
instance forget_faithful : Faithful (@forget C _ _) where
#align Mon_.forget_faithful Mon_.forget_faithful
instance {A B : Mon_ C} (f : A ⟶ B) [e : IsIso ((forget C).map f)] : IsIso f.hom :=
e
/-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/
instance : ReflectsIsomorphisms (forget C) where
reflects f e :=
⟨⟨{ hom := inv f.hom
mul_hom := by
simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, ← tensor_comp_assoc,
IsIso.inv_hom_id, tensor_id, Category.id_comp] },
by aesop_cat⟩⟩
/-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X ≅ N.X) (one_f : M.one ≫ f.hom = N.one)
(mul_f : M.mul ≫ f.hom = (f.hom ⊗ f.hom) ≫ N.mul) : M ≅ N where
hom :=
{ hom := f.hom
one_hom := one_f
mul_hom := mul_f }
inv :=
{ hom := f.inv
one_hom := by rw [← one_f]; simp
mul_hom := by
rw [← cancel_mono f.hom]
slice_rhs 2 3 => rw [mul_f]
simp }
#align Mon_.iso_of_iso Mon_.isoOfIso
instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C ⟶ A) where
default :=
{ hom := A.one
one_hom := by dsimp; simp
mul_hom := by dsimp; simp [A.one_mul, unitors_equal] }
uniq f := by
ext; simp
rw [← Category.id_comp f.hom]
erw [f.one_hom]
#align Mon_.unique_hom_from_trivial Mon_.uniqueHomFromTrivial
open CategoryTheory.Limits
instance : HasInitial (Mon_ C) :=
hasInitial_of_unique (trivial C)
end Mon_
namespace CategoryTheory.LaxMonoidalFunctor
variable {C} {D : Type u₂} [Category.{v₂} D] [MonoidalCategory.{v₂} D]
-- TODO: mapMod F A : Mod A ⥤ Mod (F.mapMon A)
/-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one]
rw [F.toFunctor.map_id]
rw [F.right_unitality]
mul_assoc := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_assoc]
conv_lhs => rw [F.toFunctor.map_id]
conv_lhs => rw [F.toFunctor.map_comp, F.toFunctor.map_comp]
conv_rhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_rhs 3 4 => rw [F.μ_natural]
conv_rhs => rw [F.toFunctor.map_id]
slice_rhs 1 3 => rw [← F.associativity]
simp only [Category.assoc] }
map f :=
{ hom := F.map f.hom
one_hom := by dsimp; rw [Category.assoc, ← F.toFunctor.map_comp, f.one_hom]
mul_hom := by
dsimp
rw [Category.assoc, F.μ_natural_assoc, ← F.toFunctor.map_comp, ← F.toFunctor.map_comp,
f.mul_hom] }
map_id A := by ext; simp
map_comp f g := by ext; simp
#align category_theory.lax_monoidal_functor.map_Mon CategoryTheory.LaxMonoidalFunctor.mapMon
variable (C D)
/-- `mapMon` is functorial in the lax monoidal functor. -/
@[simps] -- Porting note: added this, not sure how it worked previously without.
def mapMonFunctor : LaxMonoidalFunctor C D ⥤ Mon_ C ⥤ Mon_ D where
obj := mapMon
map α := { app := fun A => { hom := α.app A.X } }
#align category_theory.lax_monoidal_functor.map_Mon_functor CategoryTheory.LaxMonoidalFunctor.mapMonFunctor
end CategoryTheory.LaxMonoidalFunctor
namespace Mon_
open CategoryTheory.LaxMonoidalFunctor
namespace EquivLaxMonoidalFunctorPUnit
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps]
def laxMonoidalToMon : LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C ⥤ Mon_ C where
obj F := (F.mapMon : Mon_ _ ⥤ Mon_ C).obj (trivial (Discrete PUnit))
map α := ((mapMonFunctor (Discrete PUnit) C).map α).app _
#align Mon_.equiv_lax_monoidal_functor_punit.lax_monoidal_to_Mon Mon_.EquivLaxMonoidalFunctorPUnit.laxMonoidalToMon
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps]
def monToLaxMonoidal : Mon_ C ⥤ LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C where
obj A :=
{ obj := fun _ => A.X
map := fun _ => 𝟙 _
ε := A.one
μ := fun _ _ => A.mul
map_id := fun _ => rfl
map_comp := fun _ _ => (Category.id_comp (𝟙 A.X)).symm }
map f :=
{ app := fun _ => f.hom
naturality := fun _ _ _ => by dsimp; rw [Category.id_comp, Category.comp_id]
unit := f.one_hom
tensor := fun _ _ => f.mul_hom }
#align Mon_.equiv_lax_monoidal_functor_punit.Mon_to_lax_monoidal Mon_.EquivLaxMonoidalFunctorPUnit.monToLaxMonoidal
attribute [local aesop safe tactic (rule_sets [CategoryTheory])]
CategoryTheory.Discrete.discreteCases
attribute [local simp] eqToIso_map
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps!]
def unitIso :
𝟭 (LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C) ≅ laxMonoidalToMon C ⋙ monToLaxMonoidal C :=
NatIso.ofComponents
(fun F =>
MonoidalNatIso.ofComponents (fun _ => F.toFunctor.mapIso (eqToIso (by ext))) (by aesop_cat)
(by aesop_cat) (by aesop_cat))
(by aesop_cat)
#align Mon_.equiv_lax_monoidal_functor_punit.unit_iso Mon_.EquivLaxMonoidalFunctorPUnit.unitIso
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps!]
def counitIso : monToLaxMonoidal C ⋙ laxMonoidalToMon C ≅ 𝟭 (Mon_ C) :=
NatIso.ofComponents
(fun F =>
{ hom := { hom := 𝟙 _ }
inv := { hom := 𝟙 _ } })
(by aesop_cat)
#align Mon_.equiv_lax_monoidal_functor_punit.counit_iso Mon_.EquivLaxMonoidalFunctorPUnit.counitIso
end EquivLaxMonoidalFunctorPUnit
open EquivLaxMonoidalFunctorPUnit
attribute [local simp] eqToIso_map
/--
Monoid objects in `C` are "just" lax monoidal functors from the trivial monoidal category to `C`.
-/
@[simps]
def equivLaxMonoidalFunctorPUnit : LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C ≌ Mon_ C where
functor := laxMonoidalToMon C
inverse := monToLaxMonoidal C
unitIso := unitIso C
counitIso := counitIso C
#align Mon_.equiv_lax_monoidal_functor_punit Mon_.equivLaxMonoidalFunctorPUnit
end Mon_
namespace Mon_
/-!
In this section, we prove that the category of monoids in a braided monoidal category is monoidal.
Given two monoids `M` and `N` in a braided monoidal category `C`,
the multiplication on the tensor product `M.X ⊗ N.X` is defined in the obvious way:
it is the tensor product of the multiplications on `M` and `N`,
except that the tensor factors in the source come in the wrong order,
which we fix by pre-composing with a permutation isomorphism constructed from the braiding.
(There is a subtlety here: in fact there are two ways to do these,
using either the positive or negative crossing.)
A more conceptual way of understanding this definition is the following:
The braiding on `C` gives rise to a monoidal structure on
the tensor product functor from `C × C` to `C`.
A pair of monoids in `C` gives rise to a monoid in `C × C`,
which the tensor product functor by being monoidal takes to a monoid in `C`.
The permutation isomorphism appearing in the definition of
the multiplication on the tensor product of two monoids is
an instance of a more general family of isomorphisms
which together form a strength that equips the tensor product functor with a monoidal structure,
and the monoid axioms for the tensor product follow from the monoid axioms for the tensor factors
plus the properties of the strength (i.e., monoidal functor axioms).
The strength `tensor_μ` of the tensor product functor has been defined in
`Mathlib.CategoryTheory.Monoidal.Braided`.
Its properties, stated as independent lemmas in that module,
are used extensively in the proofs below.
Notice that we could have followed the above plan not only conceptually
but also as a possible implementation and
could have constructed the tensor product of monoids via `mapMon`,
but we chose to give a more explicit definition directly in terms of `tensor_μ`.
To complete the definition of the monoidal category structure on the category of monoids,
we need to provide definitions of associator and unitors.
The obvious candidates are the associator and unitors from `C`,
but we need to prove that they are monoid morphisms, i.e., compatible with unit and multiplication.
These properties translate to the monoidality of the associator and unitors
(with respect to the monoidal structures on the functors they relate),
which have also been proved in `Mathlib.CategoryTheory.Monoidal.Braided`.
-/
variable {C}
-- The proofs that associators and unitors preserve monoid units don't require braiding.
theorem one_associator {M N P : Mon_ C} :
((λ_ (𝟙_ C)).inv ≫ ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) ⊗ P.one)) ≫ (α_ M.X N.X P.X).hom =
(λ_ (𝟙_ C)).inv ≫ (M.one ⊗ (λ_ (𝟙_ C)).inv ≫ (N.one ⊗ P.one)) := by
simp only [Category.assoc, Iso.cancel_iso_inv_left]
slice_lhs 1 3 => rw [← Category.id_comp P.one, tensor_comp]
slice_lhs 2 3 => rw [associator_naturality]
slice_rhs 1 2 => rw [← Category.id_comp M.one, tensor_comp]
slice_lhs 1 2 => rw [← leftUnitor_tensor_inv]
rw [← cancel_epi (λ_ (𝟙_ C)).inv]
slice_lhs 1 2 => rw [leftUnitor_inv_naturality]
simp only [Category.assoc]
#align Mon_.one_associator Mon_.one_associator
theorem one_leftUnitor {M : Mon_ C} :
((λ_ (𝟙_ C)).inv ≫ (𝟙 (𝟙_ C) ⊗ M.one)) ≫ (λ_ M.X).hom = M.one := by
slice_lhs 2 3 => rw [leftUnitor_naturality]
simp
#align Mon_.one_left_unitor Mon_.one_leftUnitor
theorem one_rightUnitor {M : Mon_ C} :
((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ 𝟙 (𝟙_ C))) ≫ (ρ_ M.X).hom = M.one := by
| slice_lhs 2 3 => rw [rightUnitor_naturality, ← unitors_equal] | theorem one_rightUnitor {M : Mon_ C} :
((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ 𝟙 (𝟙_ C))) ≫ (ρ_ M.X).hom = M.one := by
| Mathlib.CategoryTheory.Monoidal.Mon_.399_0.NTUMzhXPwXsmsYt | theorem one_rightUnitor {M : Mon_ C} :
((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ 𝟙 (𝟙_ C))) ≫ (ρ_ M.X).hom = M.one | Mathlib_CategoryTheory_Monoidal_Mon_ |
case a
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : MonoidalCategory C
M : Mon_ C
| (M.one ⊗ 𝟙 (𝟙_ C)) ≫ (ρ_ M.X).hom
case a C : Type u₁ inst✝¹ : Category.{v₁, u₁} C inst✝ : MonoidalCategory C M : Mon_ C | (λ_ (𝟙_ C)).inv | /-
Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/
import Mathlib.CategoryTheory.Monoidal.Braided
import Mathlib.CategoryTheory.Monoidal.Discrete
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
import Mathlib.Algebra.PUnitInstances
#align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c"
/-!
# The category of monoids in a monoidal category.
We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to
the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if
`C` is braided, then the category of monoids is naturally monoidal.
-/
set_option linter.uppercaseLean3 false
universe v₁ v₂ u₁ u₂ u
open CategoryTheory MonoidalCategory
variable (C : Type u₁) [Category.{v₁} C] [MonoidalCategory.{v₁} C]
/-- A monoid object internal to a monoidal category.
When the monoidal category is preadditive, this is also sometimes called an "algebra object".
-/
structure Mon_ where
X : C
one : 𝟙_ C ⟶ X
mul : X ⊗ X ⟶ X
one_mul : (one ⊗ 𝟙 X) ≫ mul = (λ_ X).hom := by aesop_cat
mul_one : (𝟙 X ⊗ one) ≫ mul = (ρ_ X).hom := by aesop_cat
-- Obviously there is some flexibility stating this axiom.
-- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`,
-- and chooses to place the associator on the right-hand side.
-- The heuristic is that unitors and associators "don't have much weight".
mul_assoc : (mul ⊗ 𝟙 X) ≫ mul = (α_ X X X).hom ≫ (𝟙 X ⊗ mul) ≫ mul := by aesop_cat
#align Mon_ Mon_
attribute [reassoc] Mon_.one_mul Mon_.mul_one
-- We prove a more general `@[simp]` lemma below.
attribute [reassoc (attr := simp)] Mon_.mul_assoc
namespace Mon_
/-- The trivial monoid object. We later show this is initial in `Mon_ C`.
-/
@[simps]
def trivial : Mon_ C where
X := 𝟙_ C
one := 𝟙 _
mul := (λ_ _).hom
mul_assoc := by coherence
mul_one := by coherence
#align Mon_.trivial Mon_.trivial
instance : Inhabited (Mon_ C) :=
⟨trivial C⟩
variable {C}
variable {M : Mon_ C}
@[simp]
theorem one_mul_hom {Z : C} (f : Z ⟶ M.X) : (M.one ⊗ f) ≫ M.mul = (λ_ Z).hom ≫ f := by
rw [← id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality]
#align Mon_.one_mul_hom Mon_.one_mul_hom
@[simp]
theorem mul_one_hom {Z : C} (f : Z ⟶ M.X) : (f ⊗ M.one) ≫ M.mul = (ρ_ Z).hom ≫ f := by
rw [← tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality]
#align Mon_.mul_one_hom Mon_.mul_one_hom
theorem assoc_flip :
(𝟙 M.X ⊗ M.mul) ≫ M.mul = (α_ M.X M.X M.X).inv ≫ (M.mul ⊗ 𝟙 M.X) ≫ M.mul := by simp
#align Mon_.assoc_flip Mon_.assoc_flip
/-- A morphism of monoid objects. -/
@[ext]
structure Hom (M N : Mon_ C) where
hom : M.X ⟶ N.X
one_hom : M.one ≫ hom = N.one := by aesop_cat
mul_hom : M.mul ≫ hom = (hom ⊗ hom) ≫ N.mul := by aesop_cat
#align Mon_.hom Mon_.Hom
attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom
/-- The identity morphism on a monoid object. -/
@[simps]
def id (M : Mon_ C) : Hom M M where
hom := 𝟙 M.X
#align Mon_.id Mon_.id
instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) :=
⟨id M⟩
#align Mon_.hom_inhabited Mon_.homInhabited
/-- Composition of morphisms of monoid objects. -/
@[simps]
def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where
hom := f.hom ≫ g.hom
#align Mon_.comp Mon_.comp
instance : Category (Mon_ C) where
Hom M N := Hom M N
id := id
comp f g := comp f g
-- Porting note: added, as `Hom.ext` does not apply to a morphism.
@[ext]
lemma ext {X Y : Mon_ C} {f g : X ⟶ Y} (w : f.hom = g.hom) : f = g :=
Hom.ext _ _ w
@[simp]
theorem id_hom' (M : Mon_ C) : (𝟙 M : Hom M M).hom = 𝟙 M.X :=
rfl
#align Mon_.id_hom' Mon_.id_hom'
@[simp]
theorem comp_hom' {M N K : Mon_ C} (f : M ⟶ N) (g : N ⟶ K) :
(f ≫ g : Hom M K).hom = f.hom ≫ g.hom :=
rfl
#align Mon_.comp_hom' Mon_.comp_hom'
section
variable (C)
/-- The forgetful functor from monoid objects to the ambient category. -/
@[simps]
def forget : Mon_ C ⥤ C where
obj A := A.X
map f := f.hom
#align Mon_.forget Mon_.forget
end
instance forget_faithful : Faithful (@forget C _ _) where
#align Mon_.forget_faithful Mon_.forget_faithful
instance {A B : Mon_ C} (f : A ⟶ B) [e : IsIso ((forget C).map f)] : IsIso f.hom :=
e
/-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/
instance : ReflectsIsomorphisms (forget C) where
reflects f e :=
⟨⟨{ hom := inv f.hom
mul_hom := by
simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, ← tensor_comp_assoc,
IsIso.inv_hom_id, tensor_id, Category.id_comp] },
by aesop_cat⟩⟩
/-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X ≅ N.X) (one_f : M.one ≫ f.hom = N.one)
(mul_f : M.mul ≫ f.hom = (f.hom ⊗ f.hom) ≫ N.mul) : M ≅ N where
hom :=
{ hom := f.hom
one_hom := one_f
mul_hom := mul_f }
inv :=
{ hom := f.inv
one_hom := by rw [← one_f]; simp
mul_hom := by
rw [← cancel_mono f.hom]
slice_rhs 2 3 => rw [mul_f]
simp }
#align Mon_.iso_of_iso Mon_.isoOfIso
instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C ⟶ A) where
default :=
{ hom := A.one
one_hom := by dsimp; simp
mul_hom := by dsimp; simp [A.one_mul, unitors_equal] }
uniq f := by
ext; simp
rw [← Category.id_comp f.hom]
erw [f.one_hom]
#align Mon_.unique_hom_from_trivial Mon_.uniqueHomFromTrivial
open CategoryTheory.Limits
instance : HasInitial (Mon_ C) :=
hasInitial_of_unique (trivial C)
end Mon_
namespace CategoryTheory.LaxMonoidalFunctor
variable {C} {D : Type u₂} [Category.{v₂} D] [MonoidalCategory.{v₂} D]
-- TODO: mapMod F A : Mod A ⥤ Mod (F.mapMon A)
/-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one]
rw [F.toFunctor.map_id]
rw [F.right_unitality]
mul_assoc := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_assoc]
conv_lhs => rw [F.toFunctor.map_id]
conv_lhs => rw [F.toFunctor.map_comp, F.toFunctor.map_comp]
conv_rhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_rhs 3 4 => rw [F.μ_natural]
conv_rhs => rw [F.toFunctor.map_id]
slice_rhs 1 3 => rw [← F.associativity]
simp only [Category.assoc] }
map f :=
{ hom := F.map f.hom
one_hom := by dsimp; rw [Category.assoc, ← F.toFunctor.map_comp, f.one_hom]
mul_hom := by
dsimp
rw [Category.assoc, F.μ_natural_assoc, ← F.toFunctor.map_comp, ← F.toFunctor.map_comp,
f.mul_hom] }
map_id A := by ext; simp
map_comp f g := by ext; simp
#align category_theory.lax_monoidal_functor.map_Mon CategoryTheory.LaxMonoidalFunctor.mapMon
variable (C D)
/-- `mapMon` is functorial in the lax monoidal functor. -/
@[simps] -- Porting note: added this, not sure how it worked previously without.
def mapMonFunctor : LaxMonoidalFunctor C D ⥤ Mon_ C ⥤ Mon_ D where
obj := mapMon
map α := { app := fun A => { hom := α.app A.X } }
#align category_theory.lax_monoidal_functor.map_Mon_functor CategoryTheory.LaxMonoidalFunctor.mapMonFunctor
end CategoryTheory.LaxMonoidalFunctor
namespace Mon_
open CategoryTheory.LaxMonoidalFunctor
namespace EquivLaxMonoidalFunctorPUnit
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps]
def laxMonoidalToMon : LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C ⥤ Mon_ C where
obj F := (F.mapMon : Mon_ _ ⥤ Mon_ C).obj (trivial (Discrete PUnit))
map α := ((mapMonFunctor (Discrete PUnit) C).map α).app _
#align Mon_.equiv_lax_monoidal_functor_punit.lax_monoidal_to_Mon Mon_.EquivLaxMonoidalFunctorPUnit.laxMonoidalToMon
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps]
def monToLaxMonoidal : Mon_ C ⥤ LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C where
obj A :=
{ obj := fun _ => A.X
map := fun _ => 𝟙 _
ε := A.one
μ := fun _ _ => A.mul
map_id := fun _ => rfl
map_comp := fun _ _ => (Category.id_comp (𝟙 A.X)).symm }
map f :=
{ app := fun _ => f.hom
naturality := fun _ _ _ => by dsimp; rw [Category.id_comp, Category.comp_id]
unit := f.one_hom
tensor := fun _ _ => f.mul_hom }
#align Mon_.equiv_lax_monoidal_functor_punit.Mon_to_lax_monoidal Mon_.EquivLaxMonoidalFunctorPUnit.monToLaxMonoidal
attribute [local aesop safe tactic (rule_sets [CategoryTheory])]
CategoryTheory.Discrete.discreteCases
attribute [local simp] eqToIso_map
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps!]
def unitIso :
𝟭 (LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C) ≅ laxMonoidalToMon C ⋙ monToLaxMonoidal C :=
NatIso.ofComponents
(fun F =>
MonoidalNatIso.ofComponents (fun _ => F.toFunctor.mapIso (eqToIso (by ext))) (by aesop_cat)
(by aesop_cat) (by aesop_cat))
(by aesop_cat)
#align Mon_.equiv_lax_monoidal_functor_punit.unit_iso Mon_.EquivLaxMonoidalFunctorPUnit.unitIso
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps!]
def counitIso : monToLaxMonoidal C ⋙ laxMonoidalToMon C ≅ 𝟭 (Mon_ C) :=
NatIso.ofComponents
(fun F =>
{ hom := { hom := 𝟙 _ }
inv := { hom := 𝟙 _ } })
(by aesop_cat)
#align Mon_.equiv_lax_monoidal_functor_punit.counit_iso Mon_.EquivLaxMonoidalFunctorPUnit.counitIso
end EquivLaxMonoidalFunctorPUnit
open EquivLaxMonoidalFunctorPUnit
attribute [local simp] eqToIso_map
/--
Monoid objects in `C` are "just" lax monoidal functors from the trivial monoidal category to `C`.
-/
@[simps]
def equivLaxMonoidalFunctorPUnit : LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C ≌ Mon_ C where
functor := laxMonoidalToMon C
inverse := monToLaxMonoidal C
unitIso := unitIso C
counitIso := counitIso C
#align Mon_.equiv_lax_monoidal_functor_punit Mon_.equivLaxMonoidalFunctorPUnit
end Mon_
namespace Mon_
/-!
In this section, we prove that the category of monoids in a braided monoidal category is monoidal.
Given two monoids `M` and `N` in a braided monoidal category `C`,
the multiplication on the tensor product `M.X ⊗ N.X` is defined in the obvious way:
it is the tensor product of the multiplications on `M` and `N`,
except that the tensor factors in the source come in the wrong order,
which we fix by pre-composing with a permutation isomorphism constructed from the braiding.
(There is a subtlety here: in fact there are two ways to do these,
using either the positive or negative crossing.)
A more conceptual way of understanding this definition is the following:
The braiding on `C` gives rise to a monoidal structure on
the tensor product functor from `C × C` to `C`.
A pair of monoids in `C` gives rise to a monoid in `C × C`,
which the tensor product functor by being monoidal takes to a monoid in `C`.
The permutation isomorphism appearing in the definition of
the multiplication on the tensor product of two monoids is
an instance of a more general family of isomorphisms
which together form a strength that equips the tensor product functor with a monoidal structure,
and the monoid axioms for the tensor product follow from the monoid axioms for the tensor factors
plus the properties of the strength (i.e., monoidal functor axioms).
The strength `tensor_μ` of the tensor product functor has been defined in
`Mathlib.CategoryTheory.Monoidal.Braided`.
Its properties, stated as independent lemmas in that module,
are used extensively in the proofs below.
Notice that we could have followed the above plan not only conceptually
but also as a possible implementation and
could have constructed the tensor product of monoids via `mapMon`,
but we chose to give a more explicit definition directly in terms of `tensor_μ`.
To complete the definition of the monoidal category structure on the category of monoids,
we need to provide definitions of associator and unitors.
The obvious candidates are the associator and unitors from `C`,
but we need to prove that they are monoid morphisms, i.e., compatible with unit and multiplication.
These properties translate to the monoidality of the associator and unitors
(with respect to the monoidal structures on the functors they relate),
which have also been proved in `Mathlib.CategoryTheory.Monoidal.Braided`.
-/
variable {C}
-- The proofs that associators and unitors preserve monoid units don't require braiding.
theorem one_associator {M N P : Mon_ C} :
((λ_ (𝟙_ C)).inv ≫ ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) ⊗ P.one)) ≫ (α_ M.X N.X P.X).hom =
(λ_ (𝟙_ C)).inv ≫ (M.one ⊗ (λ_ (𝟙_ C)).inv ≫ (N.one ⊗ P.one)) := by
simp only [Category.assoc, Iso.cancel_iso_inv_left]
slice_lhs 1 3 => rw [← Category.id_comp P.one, tensor_comp]
slice_lhs 2 3 => rw [associator_naturality]
slice_rhs 1 2 => rw [← Category.id_comp M.one, tensor_comp]
slice_lhs 1 2 => rw [← leftUnitor_tensor_inv]
rw [← cancel_epi (λ_ (𝟙_ C)).inv]
slice_lhs 1 2 => rw [leftUnitor_inv_naturality]
simp only [Category.assoc]
#align Mon_.one_associator Mon_.one_associator
theorem one_leftUnitor {M : Mon_ C} :
((λ_ (𝟙_ C)).inv ≫ (𝟙 (𝟙_ C) ⊗ M.one)) ≫ (λ_ M.X).hom = M.one := by
slice_lhs 2 3 => rw [leftUnitor_naturality]
simp
#align Mon_.one_left_unitor Mon_.one_leftUnitor
theorem one_rightUnitor {M : Mon_ C} :
((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ 𝟙 (𝟙_ C))) ≫ (ρ_ M.X).hom = M.one := by
slice_lhs 2 3 => | rw [rightUnitor_naturality, ← unitors_equal] | theorem one_rightUnitor {M : Mon_ C} :
((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ 𝟙 (𝟙_ C))) ≫ (ρ_ M.X).hom = M.one := by
slice_lhs 2 3 => | Mathlib.CategoryTheory.Monoidal.Mon_.399_0.NTUMzhXPwXsmsYt | theorem one_rightUnitor {M : Mon_ C} :
((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ 𝟙 (𝟙_ C))) ≫ (ρ_ M.X).hom = M.one | Mathlib_CategoryTheory_Monoidal_Mon_ |
case a
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : MonoidalCategory C
M : Mon_ C
| (M.one ⊗ 𝟙 (𝟙_ C)) ≫ (ρ_ M.X).hom
case a C : Type u₁ inst✝¹ : Category.{v₁, u₁} C inst✝ : MonoidalCategory C M : Mon_ C | (λ_ (𝟙_ C)).inv | /-
Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/
import Mathlib.CategoryTheory.Monoidal.Braided
import Mathlib.CategoryTheory.Monoidal.Discrete
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
import Mathlib.Algebra.PUnitInstances
#align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c"
/-!
# The category of monoids in a monoidal category.
We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to
the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if
`C` is braided, then the category of monoids is naturally monoidal.
-/
set_option linter.uppercaseLean3 false
universe v₁ v₂ u₁ u₂ u
open CategoryTheory MonoidalCategory
variable (C : Type u₁) [Category.{v₁} C] [MonoidalCategory.{v₁} C]
/-- A monoid object internal to a monoidal category.
When the monoidal category is preadditive, this is also sometimes called an "algebra object".
-/
structure Mon_ where
X : C
one : 𝟙_ C ⟶ X
mul : X ⊗ X ⟶ X
one_mul : (one ⊗ 𝟙 X) ≫ mul = (λ_ X).hom := by aesop_cat
mul_one : (𝟙 X ⊗ one) ≫ mul = (ρ_ X).hom := by aesop_cat
-- Obviously there is some flexibility stating this axiom.
-- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`,
-- and chooses to place the associator on the right-hand side.
-- The heuristic is that unitors and associators "don't have much weight".
mul_assoc : (mul ⊗ 𝟙 X) ≫ mul = (α_ X X X).hom ≫ (𝟙 X ⊗ mul) ≫ mul := by aesop_cat
#align Mon_ Mon_
attribute [reassoc] Mon_.one_mul Mon_.mul_one
-- We prove a more general `@[simp]` lemma below.
attribute [reassoc (attr := simp)] Mon_.mul_assoc
namespace Mon_
/-- The trivial monoid object. We later show this is initial in `Mon_ C`.
-/
@[simps]
def trivial : Mon_ C where
X := 𝟙_ C
one := 𝟙 _
mul := (λ_ _).hom
mul_assoc := by coherence
mul_one := by coherence
#align Mon_.trivial Mon_.trivial
instance : Inhabited (Mon_ C) :=
⟨trivial C⟩
variable {C}
variable {M : Mon_ C}
@[simp]
theorem one_mul_hom {Z : C} (f : Z ⟶ M.X) : (M.one ⊗ f) ≫ M.mul = (λ_ Z).hom ≫ f := by
rw [← id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality]
#align Mon_.one_mul_hom Mon_.one_mul_hom
@[simp]
theorem mul_one_hom {Z : C} (f : Z ⟶ M.X) : (f ⊗ M.one) ≫ M.mul = (ρ_ Z).hom ≫ f := by
rw [← tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality]
#align Mon_.mul_one_hom Mon_.mul_one_hom
theorem assoc_flip :
(𝟙 M.X ⊗ M.mul) ≫ M.mul = (α_ M.X M.X M.X).inv ≫ (M.mul ⊗ 𝟙 M.X) ≫ M.mul := by simp
#align Mon_.assoc_flip Mon_.assoc_flip
/-- A morphism of monoid objects. -/
@[ext]
structure Hom (M N : Mon_ C) where
hom : M.X ⟶ N.X
one_hom : M.one ≫ hom = N.one := by aesop_cat
mul_hom : M.mul ≫ hom = (hom ⊗ hom) ≫ N.mul := by aesop_cat
#align Mon_.hom Mon_.Hom
attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom
/-- The identity morphism on a monoid object. -/
@[simps]
def id (M : Mon_ C) : Hom M M where
hom := 𝟙 M.X
#align Mon_.id Mon_.id
instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) :=
⟨id M⟩
#align Mon_.hom_inhabited Mon_.homInhabited
/-- Composition of morphisms of monoid objects. -/
@[simps]
def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where
hom := f.hom ≫ g.hom
#align Mon_.comp Mon_.comp
instance : Category (Mon_ C) where
Hom M N := Hom M N
id := id
comp f g := comp f g
-- Porting note: added, as `Hom.ext` does not apply to a morphism.
@[ext]
lemma ext {X Y : Mon_ C} {f g : X ⟶ Y} (w : f.hom = g.hom) : f = g :=
Hom.ext _ _ w
@[simp]
theorem id_hom' (M : Mon_ C) : (𝟙 M : Hom M M).hom = 𝟙 M.X :=
rfl
#align Mon_.id_hom' Mon_.id_hom'
@[simp]
theorem comp_hom' {M N K : Mon_ C} (f : M ⟶ N) (g : N ⟶ K) :
(f ≫ g : Hom M K).hom = f.hom ≫ g.hom :=
rfl
#align Mon_.comp_hom' Mon_.comp_hom'
section
variable (C)
/-- The forgetful functor from monoid objects to the ambient category. -/
@[simps]
def forget : Mon_ C ⥤ C where
obj A := A.X
map f := f.hom
#align Mon_.forget Mon_.forget
end
instance forget_faithful : Faithful (@forget C _ _) where
#align Mon_.forget_faithful Mon_.forget_faithful
instance {A B : Mon_ C} (f : A ⟶ B) [e : IsIso ((forget C).map f)] : IsIso f.hom :=
e
/-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/
instance : ReflectsIsomorphisms (forget C) where
reflects f e :=
⟨⟨{ hom := inv f.hom
mul_hom := by
simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, ← tensor_comp_assoc,
IsIso.inv_hom_id, tensor_id, Category.id_comp] },
by aesop_cat⟩⟩
/-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X ≅ N.X) (one_f : M.one ≫ f.hom = N.one)
(mul_f : M.mul ≫ f.hom = (f.hom ⊗ f.hom) ≫ N.mul) : M ≅ N where
hom :=
{ hom := f.hom
one_hom := one_f
mul_hom := mul_f }
inv :=
{ hom := f.inv
one_hom := by rw [← one_f]; simp
mul_hom := by
rw [← cancel_mono f.hom]
slice_rhs 2 3 => rw [mul_f]
simp }
#align Mon_.iso_of_iso Mon_.isoOfIso
instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C ⟶ A) where
default :=
{ hom := A.one
one_hom := by dsimp; simp
mul_hom := by dsimp; simp [A.one_mul, unitors_equal] }
uniq f := by
ext; simp
rw [← Category.id_comp f.hom]
erw [f.one_hom]
#align Mon_.unique_hom_from_trivial Mon_.uniqueHomFromTrivial
open CategoryTheory.Limits
instance : HasInitial (Mon_ C) :=
hasInitial_of_unique (trivial C)
end Mon_
namespace CategoryTheory.LaxMonoidalFunctor
variable {C} {D : Type u₂} [Category.{v₂} D] [MonoidalCategory.{v₂} D]
-- TODO: mapMod F A : Mod A ⥤ Mod (F.mapMon A)
/-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one]
rw [F.toFunctor.map_id]
rw [F.right_unitality]
mul_assoc := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_assoc]
conv_lhs => rw [F.toFunctor.map_id]
conv_lhs => rw [F.toFunctor.map_comp, F.toFunctor.map_comp]
conv_rhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_rhs 3 4 => rw [F.μ_natural]
conv_rhs => rw [F.toFunctor.map_id]
slice_rhs 1 3 => rw [← F.associativity]
simp only [Category.assoc] }
map f :=
{ hom := F.map f.hom
one_hom := by dsimp; rw [Category.assoc, ← F.toFunctor.map_comp, f.one_hom]
mul_hom := by
dsimp
rw [Category.assoc, F.μ_natural_assoc, ← F.toFunctor.map_comp, ← F.toFunctor.map_comp,
f.mul_hom] }
map_id A := by ext; simp
map_comp f g := by ext; simp
#align category_theory.lax_monoidal_functor.map_Mon CategoryTheory.LaxMonoidalFunctor.mapMon
variable (C D)
/-- `mapMon` is functorial in the lax monoidal functor. -/
@[simps] -- Porting note: added this, not sure how it worked previously without.
def mapMonFunctor : LaxMonoidalFunctor C D ⥤ Mon_ C ⥤ Mon_ D where
obj := mapMon
map α := { app := fun A => { hom := α.app A.X } }
#align category_theory.lax_monoidal_functor.map_Mon_functor CategoryTheory.LaxMonoidalFunctor.mapMonFunctor
end CategoryTheory.LaxMonoidalFunctor
namespace Mon_
open CategoryTheory.LaxMonoidalFunctor
namespace EquivLaxMonoidalFunctorPUnit
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps]
def laxMonoidalToMon : LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C ⥤ Mon_ C where
obj F := (F.mapMon : Mon_ _ ⥤ Mon_ C).obj (trivial (Discrete PUnit))
map α := ((mapMonFunctor (Discrete PUnit) C).map α).app _
#align Mon_.equiv_lax_monoidal_functor_punit.lax_monoidal_to_Mon Mon_.EquivLaxMonoidalFunctorPUnit.laxMonoidalToMon
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps]
def monToLaxMonoidal : Mon_ C ⥤ LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C where
obj A :=
{ obj := fun _ => A.X
map := fun _ => 𝟙 _
ε := A.one
μ := fun _ _ => A.mul
map_id := fun _ => rfl
map_comp := fun _ _ => (Category.id_comp (𝟙 A.X)).symm }
map f :=
{ app := fun _ => f.hom
naturality := fun _ _ _ => by dsimp; rw [Category.id_comp, Category.comp_id]
unit := f.one_hom
tensor := fun _ _ => f.mul_hom }
#align Mon_.equiv_lax_monoidal_functor_punit.Mon_to_lax_monoidal Mon_.EquivLaxMonoidalFunctorPUnit.monToLaxMonoidal
attribute [local aesop safe tactic (rule_sets [CategoryTheory])]
CategoryTheory.Discrete.discreteCases
attribute [local simp] eqToIso_map
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps!]
def unitIso :
𝟭 (LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C) ≅ laxMonoidalToMon C ⋙ monToLaxMonoidal C :=
NatIso.ofComponents
(fun F =>
MonoidalNatIso.ofComponents (fun _ => F.toFunctor.mapIso (eqToIso (by ext))) (by aesop_cat)
(by aesop_cat) (by aesop_cat))
(by aesop_cat)
#align Mon_.equiv_lax_monoidal_functor_punit.unit_iso Mon_.EquivLaxMonoidalFunctorPUnit.unitIso
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps!]
def counitIso : monToLaxMonoidal C ⋙ laxMonoidalToMon C ≅ 𝟭 (Mon_ C) :=
NatIso.ofComponents
(fun F =>
{ hom := { hom := 𝟙 _ }
inv := { hom := 𝟙 _ } })
(by aesop_cat)
#align Mon_.equiv_lax_monoidal_functor_punit.counit_iso Mon_.EquivLaxMonoidalFunctorPUnit.counitIso
end EquivLaxMonoidalFunctorPUnit
open EquivLaxMonoidalFunctorPUnit
attribute [local simp] eqToIso_map
/--
Monoid objects in `C` are "just" lax monoidal functors from the trivial monoidal category to `C`.
-/
@[simps]
def equivLaxMonoidalFunctorPUnit : LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C ≌ Mon_ C where
functor := laxMonoidalToMon C
inverse := monToLaxMonoidal C
unitIso := unitIso C
counitIso := counitIso C
#align Mon_.equiv_lax_monoidal_functor_punit Mon_.equivLaxMonoidalFunctorPUnit
end Mon_
namespace Mon_
/-!
In this section, we prove that the category of monoids in a braided monoidal category is monoidal.
Given two monoids `M` and `N` in a braided monoidal category `C`,
the multiplication on the tensor product `M.X ⊗ N.X` is defined in the obvious way:
it is the tensor product of the multiplications on `M` and `N`,
except that the tensor factors in the source come in the wrong order,
which we fix by pre-composing with a permutation isomorphism constructed from the braiding.
(There is a subtlety here: in fact there are two ways to do these,
using either the positive or negative crossing.)
A more conceptual way of understanding this definition is the following:
The braiding on `C` gives rise to a monoidal structure on
the tensor product functor from `C × C` to `C`.
A pair of monoids in `C` gives rise to a monoid in `C × C`,
which the tensor product functor by being monoidal takes to a monoid in `C`.
The permutation isomorphism appearing in the definition of
the multiplication on the tensor product of two monoids is
an instance of a more general family of isomorphisms
which together form a strength that equips the tensor product functor with a monoidal structure,
and the monoid axioms for the tensor product follow from the monoid axioms for the tensor factors
plus the properties of the strength (i.e., monoidal functor axioms).
The strength `tensor_μ` of the tensor product functor has been defined in
`Mathlib.CategoryTheory.Monoidal.Braided`.
Its properties, stated as independent lemmas in that module,
are used extensively in the proofs below.
Notice that we could have followed the above plan not only conceptually
but also as a possible implementation and
could have constructed the tensor product of monoids via `mapMon`,
but we chose to give a more explicit definition directly in terms of `tensor_μ`.
To complete the definition of the monoidal category structure on the category of monoids,
we need to provide definitions of associator and unitors.
The obvious candidates are the associator and unitors from `C`,
but we need to prove that they are monoid morphisms, i.e., compatible with unit and multiplication.
These properties translate to the monoidality of the associator and unitors
(with respect to the monoidal structures on the functors they relate),
which have also been proved in `Mathlib.CategoryTheory.Monoidal.Braided`.
-/
variable {C}
-- The proofs that associators and unitors preserve monoid units don't require braiding.
theorem one_associator {M N P : Mon_ C} :
((λ_ (𝟙_ C)).inv ≫ ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) ⊗ P.one)) ≫ (α_ M.X N.X P.X).hom =
(λ_ (𝟙_ C)).inv ≫ (M.one ⊗ (λ_ (𝟙_ C)).inv ≫ (N.one ⊗ P.one)) := by
simp only [Category.assoc, Iso.cancel_iso_inv_left]
slice_lhs 1 3 => rw [← Category.id_comp P.one, tensor_comp]
slice_lhs 2 3 => rw [associator_naturality]
slice_rhs 1 2 => rw [← Category.id_comp M.one, tensor_comp]
slice_lhs 1 2 => rw [← leftUnitor_tensor_inv]
rw [← cancel_epi (λ_ (𝟙_ C)).inv]
slice_lhs 1 2 => rw [leftUnitor_inv_naturality]
simp only [Category.assoc]
#align Mon_.one_associator Mon_.one_associator
theorem one_leftUnitor {M : Mon_ C} :
((λ_ (𝟙_ C)).inv ≫ (𝟙 (𝟙_ C) ⊗ M.one)) ≫ (λ_ M.X).hom = M.one := by
slice_lhs 2 3 => rw [leftUnitor_naturality]
simp
#align Mon_.one_left_unitor Mon_.one_leftUnitor
theorem one_rightUnitor {M : Mon_ C} :
((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ 𝟙 (𝟙_ C))) ≫ (ρ_ M.X).hom = M.one := by
slice_lhs 2 3 => | rw [rightUnitor_naturality, ← unitors_equal] | theorem one_rightUnitor {M : Mon_ C} :
((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ 𝟙 (𝟙_ C))) ≫ (ρ_ M.X).hom = M.one := by
slice_lhs 2 3 => | Mathlib.CategoryTheory.Monoidal.Mon_.399_0.NTUMzhXPwXsmsYt | theorem one_rightUnitor {M : Mon_ C} :
((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ 𝟙 (𝟙_ C))) ≫ (ρ_ M.X).hom = M.one | Mathlib_CategoryTheory_Monoidal_Mon_ |
case a
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : MonoidalCategory C
M : Mon_ C
| (M.one ⊗ 𝟙 (𝟙_ C)) ≫ (ρ_ M.X).hom
case a C : Type u₁ inst✝¹ : Category.{v₁, u₁} C inst✝ : MonoidalCategory C M : Mon_ C | (λ_ (𝟙_ C)).inv | /-
Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/
import Mathlib.CategoryTheory.Monoidal.Braided
import Mathlib.CategoryTheory.Monoidal.Discrete
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
import Mathlib.Algebra.PUnitInstances
#align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c"
/-!
# The category of monoids in a monoidal category.
We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to
the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if
`C` is braided, then the category of monoids is naturally monoidal.
-/
set_option linter.uppercaseLean3 false
universe v₁ v₂ u₁ u₂ u
open CategoryTheory MonoidalCategory
variable (C : Type u₁) [Category.{v₁} C] [MonoidalCategory.{v₁} C]
/-- A monoid object internal to a monoidal category.
When the monoidal category is preadditive, this is also sometimes called an "algebra object".
-/
structure Mon_ where
X : C
one : 𝟙_ C ⟶ X
mul : X ⊗ X ⟶ X
one_mul : (one ⊗ 𝟙 X) ≫ mul = (λ_ X).hom := by aesop_cat
mul_one : (𝟙 X ⊗ one) ≫ mul = (ρ_ X).hom := by aesop_cat
-- Obviously there is some flexibility stating this axiom.
-- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`,
-- and chooses to place the associator on the right-hand side.
-- The heuristic is that unitors and associators "don't have much weight".
mul_assoc : (mul ⊗ 𝟙 X) ≫ mul = (α_ X X X).hom ≫ (𝟙 X ⊗ mul) ≫ mul := by aesop_cat
#align Mon_ Mon_
attribute [reassoc] Mon_.one_mul Mon_.mul_one
-- We prove a more general `@[simp]` lemma below.
attribute [reassoc (attr := simp)] Mon_.mul_assoc
namespace Mon_
/-- The trivial monoid object. We later show this is initial in `Mon_ C`.
-/
@[simps]
def trivial : Mon_ C where
X := 𝟙_ C
one := 𝟙 _
mul := (λ_ _).hom
mul_assoc := by coherence
mul_one := by coherence
#align Mon_.trivial Mon_.trivial
instance : Inhabited (Mon_ C) :=
⟨trivial C⟩
variable {C}
variable {M : Mon_ C}
@[simp]
theorem one_mul_hom {Z : C} (f : Z ⟶ M.X) : (M.one ⊗ f) ≫ M.mul = (λ_ Z).hom ≫ f := by
rw [← id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality]
#align Mon_.one_mul_hom Mon_.one_mul_hom
@[simp]
theorem mul_one_hom {Z : C} (f : Z ⟶ M.X) : (f ⊗ M.one) ≫ M.mul = (ρ_ Z).hom ≫ f := by
rw [← tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality]
#align Mon_.mul_one_hom Mon_.mul_one_hom
theorem assoc_flip :
(𝟙 M.X ⊗ M.mul) ≫ M.mul = (α_ M.X M.X M.X).inv ≫ (M.mul ⊗ 𝟙 M.X) ≫ M.mul := by simp
#align Mon_.assoc_flip Mon_.assoc_flip
/-- A morphism of monoid objects. -/
@[ext]
structure Hom (M N : Mon_ C) where
hom : M.X ⟶ N.X
one_hom : M.one ≫ hom = N.one := by aesop_cat
mul_hom : M.mul ≫ hom = (hom ⊗ hom) ≫ N.mul := by aesop_cat
#align Mon_.hom Mon_.Hom
attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom
/-- The identity morphism on a monoid object. -/
@[simps]
def id (M : Mon_ C) : Hom M M where
hom := 𝟙 M.X
#align Mon_.id Mon_.id
instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) :=
⟨id M⟩
#align Mon_.hom_inhabited Mon_.homInhabited
/-- Composition of morphisms of monoid objects. -/
@[simps]
def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where
hom := f.hom ≫ g.hom
#align Mon_.comp Mon_.comp
instance : Category (Mon_ C) where
Hom M N := Hom M N
id := id
comp f g := comp f g
-- Porting note: added, as `Hom.ext` does not apply to a morphism.
@[ext]
lemma ext {X Y : Mon_ C} {f g : X ⟶ Y} (w : f.hom = g.hom) : f = g :=
Hom.ext _ _ w
@[simp]
theorem id_hom' (M : Mon_ C) : (𝟙 M : Hom M M).hom = 𝟙 M.X :=
rfl
#align Mon_.id_hom' Mon_.id_hom'
@[simp]
theorem comp_hom' {M N K : Mon_ C} (f : M ⟶ N) (g : N ⟶ K) :
(f ≫ g : Hom M K).hom = f.hom ≫ g.hom :=
rfl
#align Mon_.comp_hom' Mon_.comp_hom'
section
variable (C)
/-- The forgetful functor from monoid objects to the ambient category. -/
@[simps]
def forget : Mon_ C ⥤ C where
obj A := A.X
map f := f.hom
#align Mon_.forget Mon_.forget
end
instance forget_faithful : Faithful (@forget C _ _) where
#align Mon_.forget_faithful Mon_.forget_faithful
instance {A B : Mon_ C} (f : A ⟶ B) [e : IsIso ((forget C).map f)] : IsIso f.hom :=
e
/-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/
instance : ReflectsIsomorphisms (forget C) where
reflects f e :=
⟨⟨{ hom := inv f.hom
mul_hom := by
simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, ← tensor_comp_assoc,
IsIso.inv_hom_id, tensor_id, Category.id_comp] },
by aesop_cat⟩⟩
/-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X ≅ N.X) (one_f : M.one ≫ f.hom = N.one)
(mul_f : M.mul ≫ f.hom = (f.hom ⊗ f.hom) ≫ N.mul) : M ≅ N where
hom :=
{ hom := f.hom
one_hom := one_f
mul_hom := mul_f }
inv :=
{ hom := f.inv
one_hom := by rw [← one_f]; simp
mul_hom := by
rw [← cancel_mono f.hom]
slice_rhs 2 3 => rw [mul_f]
simp }
#align Mon_.iso_of_iso Mon_.isoOfIso
instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C ⟶ A) where
default :=
{ hom := A.one
one_hom := by dsimp; simp
mul_hom := by dsimp; simp [A.one_mul, unitors_equal] }
uniq f := by
ext; simp
rw [← Category.id_comp f.hom]
erw [f.one_hom]
#align Mon_.unique_hom_from_trivial Mon_.uniqueHomFromTrivial
open CategoryTheory.Limits
instance : HasInitial (Mon_ C) :=
hasInitial_of_unique (trivial C)
end Mon_
namespace CategoryTheory.LaxMonoidalFunctor
variable {C} {D : Type u₂} [Category.{v₂} D] [MonoidalCategory.{v₂} D]
-- TODO: mapMod F A : Mod A ⥤ Mod (F.mapMon A)
/-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one]
rw [F.toFunctor.map_id]
rw [F.right_unitality]
mul_assoc := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_assoc]
conv_lhs => rw [F.toFunctor.map_id]
conv_lhs => rw [F.toFunctor.map_comp, F.toFunctor.map_comp]
conv_rhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_rhs 3 4 => rw [F.μ_natural]
conv_rhs => rw [F.toFunctor.map_id]
slice_rhs 1 3 => rw [← F.associativity]
simp only [Category.assoc] }
map f :=
{ hom := F.map f.hom
one_hom := by dsimp; rw [Category.assoc, ← F.toFunctor.map_comp, f.one_hom]
mul_hom := by
dsimp
rw [Category.assoc, F.μ_natural_assoc, ← F.toFunctor.map_comp, ← F.toFunctor.map_comp,
f.mul_hom] }
map_id A := by ext; simp
map_comp f g := by ext; simp
#align category_theory.lax_monoidal_functor.map_Mon CategoryTheory.LaxMonoidalFunctor.mapMon
variable (C D)
/-- `mapMon` is functorial in the lax monoidal functor. -/
@[simps] -- Porting note: added this, not sure how it worked previously without.
def mapMonFunctor : LaxMonoidalFunctor C D ⥤ Mon_ C ⥤ Mon_ D where
obj := mapMon
map α := { app := fun A => { hom := α.app A.X } }
#align category_theory.lax_monoidal_functor.map_Mon_functor CategoryTheory.LaxMonoidalFunctor.mapMonFunctor
end CategoryTheory.LaxMonoidalFunctor
namespace Mon_
open CategoryTheory.LaxMonoidalFunctor
namespace EquivLaxMonoidalFunctorPUnit
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps]
def laxMonoidalToMon : LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C ⥤ Mon_ C where
obj F := (F.mapMon : Mon_ _ ⥤ Mon_ C).obj (trivial (Discrete PUnit))
map α := ((mapMonFunctor (Discrete PUnit) C).map α).app _
#align Mon_.equiv_lax_monoidal_functor_punit.lax_monoidal_to_Mon Mon_.EquivLaxMonoidalFunctorPUnit.laxMonoidalToMon
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps]
def monToLaxMonoidal : Mon_ C ⥤ LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C where
obj A :=
{ obj := fun _ => A.X
map := fun _ => 𝟙 _
ε := A.one
μ := fun _ _ => A.mul
map_id := fun _ => rfl
map_comp := fun _ _ => (Category.id_comp (𝟙 A.X)).symm }
map f :=
{ app := fun _ => f.hom
naturality := fun _ _ _ => by dsimp; rw [Category.id_comp, Category.comp_id]
unit := f.one_hom
tensor := fun _ _ => f.mul_hom }
#align Mon_.equiv_lax_monoidal_functor_punit.Mon_to_lax_monoidal Mon_.EquivLaxMonoidalFunctorPUnit.monToLaxMonoidal
attribute [local aesop safe tactic (rule_sets [CategoryTheory])]
CategoryTheory.Discrete.discreteCases
attribute [local simp] eqToIso_map
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps!]
def unitIso :
𝟭 (LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C) ≅ laxMonoidalToMon C ⋙ monToLaxMonoidal C :=
NatIso.ofComponents
(fun F =>
MonoidalNatIso.ofComponents (fun _ => F.toFunctor.mapIso (eqToIso (by ext))) (by aesop_cat)
(by aesop_cat) (by aesop_cat))
(by aesop_cat)
#align Mon_.equiv_lax_monoidal_functor_punit.unit_iso Mon_.EquivLaxMonoidalFunctorPUnit.unitIso
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps!]
def counitIso : monToLaxMonoidal C ⋙ laxMonoidalToMon C ≅ 𝟭 (Mon_ C) :=
NatIso.ofComponents
(fun F =>
{ hom := { hom := 𝟙 _ }
inv := { hom := 𝟙 _ } })
(by aesop_cat)
#align Mon_.equiv_lax_monoidal_functor_punit.counit_iso Mon_.EquivLaxMonoidalFunctorPUnit.counitIso
end EquivLaxMonoidalFunctorPUnit
open EquivLaxMonoidalFunctorPUnit
attribute [local simp] eqToIso_map
/--
Monoid objects in `C` are "just" lax monoidal functors from the trivial monoidal category to `C`.
-/
@[simps]
def equivLaxMonoidalFunctorPUnit : LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C ≌ Mon_ C where
functor := laxMonoidalToMon C
inverse := monToLaxMonoidal C
unitIso := unitIso C
counitIso := counitIso C
#align Mon_.equiv_lax_monoidal_functor_punit Mon_.equivLaxMonoidalFunctorPUnit
end Mon_
namespace Mon_
/-!
In this section, we prove that the category of monoids in a braided monoidal category is monoidal.
Given two monoids `M` and `N` in a braided monoidal category `C`,
the multiplication on the tensor product `M.X ⊗ N.X` is defined in the obvious way:
it is the tensor product of the multiplications on `M` and `N`,
except that the tensor factors in the source come in the wrong order,
which we fix by pre-composing with a permutation isomorphism constructed from the braiding.
(There is a subtlety here: in fact there are two ways to do these,
using either the positive or negative crossing.)
A more conceptual way of understanding this definition is the following:
The braiding on `C` gives rise to a monoidal structure on
the tensor product functor from `C × C` to `C`.
A pair of monoids in `C` gives rise to a monoid in `C × C`,
which the tensor product functor by being monoidal takes to a monoid in `C`.
The permutation isomorphism appearing in the definition of
the multiplication on the tensor product of two monoids is
an instance of a more general family of isomorphisms
which together form a strength that equips the tensor product functor with a monoidal structure,
and the monoid axioms for the tensor product follow from the monoid axioms for the tensor factors
plus the properties of the strength (i.e., monoidal functor axioms).
The strength `tensor_μ` of the tensor product functor has been defined in
`Mathlib.CategoryTheory.Monoidal.Braided`.
Its properties, stated as independent lemmas in that module,
are used extensively in the proofs below.
Notice that we could have followed the above plan not only conceptually
but also as a possible implementation and
could have constructed the tensor product of monoids via `mapMon`,
but we chose to give a more explicit definition directly in terms of `tensor_μ`.
To complete the definition of the monoidal category structure on the category of monoids,
we need to provide definitions of associator and unitors.
The obvious candidates are the associator and unitors from `C`,
but we need to prove that they are monoid morphisms, i.e., compatible with unit and multiplication.
These properties translate to the monoidality of the associator and unitors
(with respect to the monoidal structures on the functors they relate),
which have also been proved in `Mathlib.CategoryTheory.Monoidal.Braided`.
-/
variable {C}
-- The proofs that associators and unitors preserve monoid units don't require braiding.
theorem one_associator {M N P : Mon_ C} :
((λ_ (𝟙_ C)).inv ≫ ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) ⊗ P.one)) ≫ (α_ M.X N.X P.X).hom =
(λ_ (𝟙_ C)).inv ≫ (M.one ⊗ (λ_ (𝟙_ C)).inv ≫ (N.one ⊗ P.one)) := by
simp only [Category.assoc, Iso.cancel_iso_inv_left]
slice_lhs 1 3 => rw [← Category.id_comp P.one, tensor_comp]
slice_lhs 2 3 => rw [associator_naturality]
slice_rhs 1 2 => rw [← Category.id_comp M.one, tensor_comp]
slice_lhs 1 2 => rw [← leftUnitor_tensor_inv]
rw [← cancel_epi (λ_ (𝟙_ C)).inv]
slice_lhs 1 2 => rw [leftUnitor_inv_naturality]
simp only [Category.assoc]
#align Mon_.one_associator Mon_.one_associator
theorem one_leftUnitor {M : Mon_ C} :
((λ_ (𝟙_ C)).inv ≫ (𝟙 (𝟙_ C) ⊗ M.one)) ≫ (λ_ M.X).hom = M.one := by
slice_lhs 2 3 => rw [leftUnitor_naturality]
simp
#align Mon_.one_left_unitor Mon_.one_leftUnitor
theorem one_rightUnitor {M : Mon_ C} :
((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ 𝟙 (𝟙_ C))) ≫ (ρ_ M.X).hom = M.one := by
slice_lhs 2 3 => | rw [rightUnitor_naturality, ← unitors_equal] | theorem one_rightUnitor {M : Mon_ C} :
((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ 𝟙 (𝟙_ C))) ≫ (ρ_ M.X).hom = M.one := by
slice_lhs 2 3 => | Mathlib.CategoryTheory.Monoidal.Mon_.399_0.NTUMzhXPwXsmsYt | theorem one_rightUnitor {M : Mon_ C} :
((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ 𝟙 (𝟙_ C))) ≫ (ρ_ M.X).hom = M.one | Mathlib_CategoryTheory_Monoidal_Mon_ |
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
inst✝ : MonoidalCategory C
M : Mon_ C
⊢ (λ_ (𝟙_ C)).inv ≫ (λ_ (𝟙_ C)).hom ≫ M.one = M.one | /-
Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/
import Mathlib.CategoryTheory.Monoidal.Braided
import Mathlib.CategoryTheory.Monoidal.Discrete
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
import Mathlib.Algebra.PUnitInstances
#align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c"
/-!
# The category of monoids in a monoidal category.
We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to
the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if
`C` is braided, then the category of monoids is naturally monoidal.
-/
set_option linter.uppercaseLean3 false
universe v₁ v₂ u₁ u₂ u
open CategoryTheory MonoidalCategory
variable (C : Type u₁) [Category.{v₁} C] [MonoidalCategory.{v₁} C]
/-- A monoid object internal to a monoidal category.
When the monoidal category is preadditive, this is also sometimes called an "algebra object".
-/
structure Mon_ where
X : C
one : 𝟙_ C ⟶ X
mul : X ⊗ X ⟶ X
one_mul : (one ⊗ 𝟙 X) ≫ mul = (λ_ X).hom := by aesop_cat
mul_one : (𝟙 X ⊗ one) ≫ mul = (ρ_ X).hom := by aesop_cat
-- Obviously there is some flexibility stating this axiom.
-- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`,
-- and chooses to place the associator on the right-hand side.
-- The heuristic is that unitors and associators "don't have much weight".
mul_assoc : (mul ⊗ 𝟙 X) ≫ mul = (α_ X X X).hom ≫ (𝟙 X ⊗ mul) ≫ mul := by aesop_cat
#align Mon_ Mon_
attribute [reassoc] Mon_.one_mul Mon_.mul_one
-- We prove a more general `@[simp]` lemma below.
attribute [reassoc (attr := simp)] Mon_.mul_assoc
namespace Mon_
/-- The trivial monoid object. We later show this is initial in `Mon_ C`.
-/
@[simps]
def trivial : Mon_ C where
X := 𝟙_ C
one := 𝟙 _
mul := (λ_ _).hom
mul_assoc := by coherence
mul_one := by coherence
#align Mon_.trivial Mon_.trivial
instance : Inhabited (Mon_ C) :=
⟨trivial C⟩
variable {C}
variable {M : Mon_ C}
@[simp]
theorem one_mul_hom {Z : C} (f : Z ⟶ M.X) : (M.one ⊗ f) ≫ M.mul = (λ_ Z).hom ≫ f := by
rw [← id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality]
#align Mon_.one_mul_hom Mon_.one_mul_hom
@[simp]
theorem mul_one_hom {Z : C} (f : Z ⟶ M.X) : (f ⊗ M.one) ≫ M.mul = (ρ_ Z).hom ≫ f := by
rw [← tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality]
#align Mon_.mul_one_hom Mon_.mul_one_hom
theorem assoc_flip :
(𝟙 M.X ⊗ M.mul) ≫ M.mul = (α_ M.X M.X M.X).inv ≫ (M.mul ⊗ 𝟙 M.X) ≫ M.mul := by simp
#align Mon_.assoc_flip Mon_.assoc_flip
/-- A morphism of monoid objects. -/
@[ext]
structure Hom (M N : Mon_ C) where
hom : M.X ⟶ N.X
one_hom : M.one ≫ hom = N.one := by aesop_cat
mul_hom : M.mul ≫ hom = (hom ⊗ hom) ≫ N.mul := by aesop_cat
#align Mon_.hom Mon_.Hom
attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom
/-- The identity morphism on a monoid object. -/
@[simps]
def id (M : Mon_ C) : Hom M M where
hom := 𝟙 M.X
#align Mon_.id Mon_.id
instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) :=
⟨id M⟩
#align Mon_.hom_inhabited Mon_.homInhabited
/-- Composition of morphisms of monoid objects. -/
@[simps]
def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where
hom := f.hom ≫ g.hom
#align Mon_.comp Mon_.comp
instance : Category (Mon_ C) where
Hom M N := Hom M N
id := id
comp f g := comp f g
-- Porting note: added, as `Hom.ext` does not apply to a morphism.
@[ext]
lemma ext {X Y : Mon_ C} {f g : X ⟶ Y} (w : f.hom = g.hom) : f = g :=
Hom.ext _ _ w
@[simp]
theorem id_hom' (M : Mon_ C) : (𝟙 M : Hom M M).hom = 𝟙 M.X :=
rfl
#align Mon_.id_hom' Mon_.id_hom'
@[simp]
theorem comp_hom' {M N K : Mon_ C} (f : M ⟶ N) (g : N ⟶ K) :
(f ≫ g : Hom M K).hom = f.hom ≫ g.hom :=
rfl
#align Mon_.comp_hom' Mon_.comp_hom'
section
variable (C)
/-- The forgetful functor from monoid objects to the ambient category. -/
@[simps]
def forget : Mon_ C ⥤ C where
obj A := A.X
map f := f.hom
#align Mon_.forget Mon_.forget
end
instance forget_faithful : Faithful (@forget C _ _) where
#align Mon_.forget_faithful Mon_.forget_faithful
instance {A B : Mon_ C} (f : A ⟶ B) [e : IsIso ((forget C).map f)] : IsIso f.hom :=
e
/-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/
instance : ReflectsIsomorphisms (forget C) where
reflects f e :=
⟨⟨{ hom := inv f.hom
mul_hom := by
simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, ← tensor_comp_assoc,
IsIso.inv_hom_id, tensor_id, Category.id_comp] },
by aesop_cat⟩⟩
/-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X ≅ N.X) (one_f : M.one ≫ f.hom = N.one)
(mul_f : M.mul ≫ f.hom = (f.hom ⊗ f.hom) ≫ N.mul) : M ≅ N where
hom :=
{ hom := f.hom
one_hom := one_f
mul_hom := mul_f }
inv :=
{ hom := f.inv
one_hom := by rw [← one_f]; simp
mul_hom := by
rw [← cancel_mono f.hom]
slice_rhs 2 3 => rw [mul_f]
simp }
#align Mon_.iso_of_iso Mon_.isoOfIso
instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C ⟶ A) where
default :=
{ hom := A.one
one_hom := by dsimp; simp
mul_hom := by dsimp; simp [A.one_mul, unitors_equal] }
uniq f := by
ext; simp
rw [← Category.id_comp f.hom]
erw [f.one_hom]
#align Mon_.unique_hom_from_trivial Mon_.uniqueHomFromTrivial
open CategoryTheory.Limits
instance : HasInitial (Mon_ C) :=
hasInitial_of_unique (trivial C)
end Mon_
namespace CategoryTheory.LaxMonoidalFunctor
variable {C} {D : Type u₂} [Category.{v₂} D] [MonoidalCategory.{v₂} D]
-- TODO: mapMod F A : Mod A ⥤ Mod (F.mapMon A)
/-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.ε ≫ F.map A.one
mul := F.μ _ _ ≫ F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
rw [F.left_unitality]
mul_one := by
conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one]
rw [F.toFunctor.map_id]
rw [F.right_unitality]
mul_assoc := by
conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.μ_natural]
slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_assoc]
conv_lhs => rw [F.toFunctor.map_id]
conv_lhs => rw [F.toFunctor.map_comp, F.toFunctor.map_comp]
conv_rhs => rw [id_tensor_comp, ← F.toFunctor.map_id]
slice_rhs 3 4 => rw [F.μ_natural]
conv_rhs => rw [F.toFunctor.map_id]
slice_rhs 1 3 => rw [← F.associativity]
simp only [Category.assoc] }
map f :=
{ hom := F.map f.hom
one_hom := by dsimp; rw [Category.assoc, ← F.toFunctor.map_comp, f.one_hom]
mul_hom := by
dsimp
rw [Category.assoc, F.μ_natural_assoc, ← F.toFunctor.map_comp, ← F.toFunctor.map_comp,
f.mul_hom] }
map_id A := by ext; simp
map_comp f g := by ext; simp
#align category_theory.lax_monoidal_functor.map_Mon CategoryTheory.LaxMonoidalFunctor.mapMon
variable (C D)
/-- `mapMon` is functorial in the lax monoidal functor. -/
@[simps] -- Porting note: added this, not sure how it worked previously without.
def mapMonFunctor : LaxMonoidalFunctor C D ⥤ Mon_ C ⥤ Mon_ D where
obj := mapMon
map α := { app := fun A => { hom := α.app A.X } }
#align category_theory.lax_monoidal_functor.map_Mon_functor CategoryTheory.LaxMonoidalFunctor.mapMonFunctor
end CategoryTheory.LaxMonoidalFunctor
namespace Mon_
open CategoryTheory.LaxMonoidalFunctor
namespace EquivLaxMonoidalFunctorPUnit
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps]
def laxMonoidalToMon : LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C ⥤ Mon_ C where
obj F := (F.mapMon : Mon_ _ ⥤ Mon_ C).obj (trivial (Discrete PUnit))
map α := ((mapMonFunctor (Discrete PUnit) C).map α).app _
#align Mon_.equiv_lax_monoidal_functor_punit.lax_monoidal_to_Mon Mon_.EquivLaxMonoidalFunctorPUnit.laxMonoidalToMon
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps]
def monToLaxMonoidal : Mon_ C ⥤ LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C where
obj A :=
{ obj := fun _ => A.X
map := fun _ => 𝟙 _
ε := A.one
μ := fun _ _ => A.mul
map_id := fun _ => rfl
map_comp := fun _ _ => (Category.id_comp (𝟙 A.X)).symm }
map f :=
{ app := fun _ => f.hom
naturality := fun _ _ _ => by dsimp; rw [Category.id_comp, Category.comp_id]
unit := f.one_hom
tensor := fun _ _ => f.mul_hom }
#align Mon_.equiv_lax_monoidal_functor_punit.Mon_to_lax_monoidal Mon_.EquivLaxMonoidalFunctorPUnit.monToLaxMonoidal
attribute [local aesop safe tactic (rule_sets [CategoryTheory])]
CategoryTheory.Discrete.discreteCases
attribute [local simp] eqToIso_map
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps!]
def unitIso :
𝟭 (LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C) ≅ laxMonoidalToMon C ⋙ monToLaxMonoidal C :=
NatIso.ofComponents
(fun F =>
MonoidalNatIso.ofComponents (fun _ => F.toFunctor.mapIso (eqToIso (by ext))) (by aesop_cat)
(by aesop_cat) (by aesop_cat))
(by aesop_cat)
#align Mon_.equiv_lax_monoidal_functor_punit.unit_iso Mon_.EquivLaxMonoidalFunctorPUnit.unitIso
/-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/
@[simps!]
def counitIso : monToLaxMonoidal C ⋙ laxMonoidalToMon C ≅ 𝟭 (Mon_ C) :=
NatIso.ofComponents
(fun F =>
{ hom := { hom := 𝟙 _ }
inv := { hom := 𝟙 _ } })
(by aesop_cat)
#align Mon_.equiv_lax_monoidal_functor_punit.counit_iso Mon_.EquivLaxMonoidalFunctorPUnit.counitIso
end EquivLaxMonoidalFunctorPUnit
open EquivLaxMonoidalFunctorPUnit
attribute [local simp] eqToIso_map
/--
Monoid objects in `C` are "just" lax monoidal functors from the trivial monoidal category to `C`.
-/
@[simps]
def equivLaxMonoidalFunctorPUnit : LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C ≌ Mon_ C where
functor := laxMonoidalToMon C
inverse := monToLaxMonoidal C
unitIso := unitIso C
counitIso := counitIso C
#align Mon_.equiv_lax_monoidal_functor_punit Mon_.equivLaxMonoidalFunctorPUnit
end Mon_
namespace Mon_
/-!
In this section, we prove that the category of monoids in a braided monoidal category is monoidal.
Given two monoids `M` and `N` in a braided monoidal category `C`,
the multiplication on the tensor product `M.X ⊗ N.X` is defined in the obvious way:
it is the tensor product of the multiplications on `M` and `N`,
except that the tensor factors in the source come in the wrong order,
which we fix by pre-composing with a permutation isomorphism constructed from the braiding.
(There is a subtlety here: in fact there are two ways to do these,
using either the positive or negative crossing.)
A more conceptual way of understanding this definition is the following:
The braiding on `C` gives rise to a monoidal structure on
the tensor product functor from `C × C` to `C`.
A pair of monoids in `C` gives rise to a monoid in `C × C`,
which the tensor product functor by being monoidal takes to a monoid in `C`.
The permutation isomorphism appearing in the definition of
the multiplication on the tensor product of two monoids is
an instance of a more general family of isomorphisms
which together form a strength that equips the tensor product functor with a monoidal structure,
and the monoid axioms for the tensor product follow from the monoid axioms for the tensor factors
plus the properties of the strength (i.e., monoidal functor axioms).
The strength `tensor_μ` of the tensor product functor has been defined in
`Mathlib.CategoryTheory.Monoidal.Braided`.
Its properties, stated as independent lemmas in that module,
are used extensively in the proofs below.
Notice that we could have followed the above plan not only conceptually
but also as a possible implementation and
could have constructed the tensor product of monoids via `mapMon`,
but we chose to give a more explicit definition directly in terms of `tensor_μ`.
To complete the definition of the monoidal category structure on the category of monoids,
we need to provide definitions of associator and unitors.
The obvious candidates are the associator and unitors from `C`,
but we need to prove that they are monoid morphisms, i.e., compatible with unit and multiplication.
These properties translate to the monoidality of the associator and unitors
(with respect to the monoidal structures on the functors they relate),
which have also been proved in `Mathlib.CategoryTheory.Monoidal.Braided`.
-/
variable {C}
-- The proofs that associators and unitors preserve monoid units don't require braiding.
theorem one_associator {M N P : Mon_ C} :
((λ_ (𝟙_ C)).inv ≫ ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) ⊗ P.one)) ≫ (α_ M.X N.X P.X).hom =
(λ_ (𝟙_ C)).inv ≫ (M.one ⊗ (λ_ (𝟙_ C)).inv ≫ (N.one ⊗ P.one)) := by
simp only [Category.assoc, Iso.cancel_iso_inv_left]
slice_lhs 1 3 => rw [← Category.id_comp P.one, tensor_comp]
slice_lhs 2 3 => rw [associator_naturality]
slice_rhs 1 2 => rw [← Category.id_comp M.one, tensor_comp]
slice_lhs 1 2 => rw [← leftUnitor_tensor_inv]
rw [← cancel_epi (λ_ (𝟙_ C)).inv]
slice_lhs 1 2 => rw [leftUnitor_inv_naturality]
simp only [Category.assoc]
#align Mon_.one_associator Mon_.one_associator
theorem one_leftUnitor {M : Mon_ C} :
((λ_ (𝟙_ C)).inv ≫ (𝟙 (𝟙_ C) ⊗ M.one)) ≫ (λ_ M.X).hom = M.one := by
slice_lhs 2 3 => rw [leftUnitor_naturality]
simp
#align Mon_.one_left_unitor Mon_.one_leftUnitor
theorem one_rightUnitor {M : Mon_ C} :
((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ 𝟙 (𝟙_ C))) ≫ (ρ_ M.X).hom = M.one := by
slice_lhs 2 3 => rw [rightUnitor_naturality, ← unitors_equal]
| simp | theorem one_rightUnitor {M : Mon_ C} :
((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ 𝟙 (𝟙_ C))) ≫ (ρ_ M.X).hom = M.one := by
slice_lhs 2 3 => rw [rightUnitor_naturality, ← unitors_equal]
| Mathlib.CategoryTheory.Monoidal.Mon_.399_0.NTUMzhXPwXsmsYt | theorem one_rightUnitor {M : Mon_ C} :
((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ 𝟙 (𝟙_ C))) ≫ (ρ_ M.X).hom = M.one | Mathlib_CategoryTheory_Monoidal_Mon_ |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.