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
instβ : BraidedCategory C
M N : Mon_ C
β’ ((Ξ»_ (π_ C)).inv β« (M.one β N.one) β π (M.X β N.X)) β« tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ»_ (M.X β N.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]
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
#align Mon_.one_right_unitor Mon_.one_rightUnitor
variable [BraidedCategory C]
theorem Mon_tensor_one_mul (M N : Mon_ C) :
((Ξ»_ (π_ C)).inv β« (M.one β N.one) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ»_ (M.X β N.X)).hom := by
|
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
|
theorem Mon_tensor_one_mul (M N : Mon_ C) :
((Ξ»_ (π_ C)).inv β« (M.one β N.one) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ»_ (M.X β N.X)).hom := by
|
Mathlib.CategoryTheory.Monoidal.Mon_.407_0.NTUMzhXPwXsmsYt
|
theorem Mon_tensor_one_mul (M N : Mon_ C) :
((Ξ»_ (π_ C)).inv β« (M.one β N.one) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ»_ (M.X β N.X)).hom
|
Mathlib_CategoryTheory_Monoidal_Mon_
|
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M N : Mon_ C
β’ (((Ξ»_ (π_ C)).inv β π (M.X β N.X)) β« ((M.one β N.one) β π (M.X β N.X))) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ»_ (M.X β N.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]
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
#align Mon_.one_right_unitor Mon_.one_rightUnitor
variable [BraidedCategory C]
theorem Mon_tensor_one_mul (M N : Mon_ C) :
((Ξ»_ (π_ C)).inv β« (M.one β N.one) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ»_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
|
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
|
theorem Mon_tensor_one_mul (M N : Mon_ C) :
((Ξ»_ (π_ C)).inv β« (M.one β N.one) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ»_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
|
Mathlib.CategoryTheory.Monoidal.Mon_.407_0.NTUMzhXPwXsmsYt
|
theorem Mon_tensor_one_mul (M N : Mon_ C) :
((Ξ»_ (π_ C)).inv β« (M.one β N.one) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ»_ (M.X β N.X)).hom
|
Mathlib_CategoryTheory_Monoidal_Mon_
|
case a.a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M N : Mon_ C
| ((M.one β N.one) β π (M.X β N.X)) β« tensor_ΞΌ C (M.X, N.X) (M.X, N.X)
case a.a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M N : Mon_ C
| M.mul β N.mul
case a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M N : Mon_ C
| (Ξ»_ (π_ C)).inv β π (M.X β N.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))) (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
#align Mon_.one_right_unitor Mon_.one_rightUnitor
variable [BraidedCategory C]
theorem Mon_tensor_one_mul (M N : Mon_ C) :
((Ξ»_ (π_ C)).inv β« (M.one β N.one) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ»_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 =>
|
rw [β tensor_id, tensor_ΞΌ_natural]
|
theorem Mon_tensor_one_mul (M N : Mon_ C) :
((Ξ»_ (π_ C)).inv β« (M.one β N.one) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ»_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 =>
|
Mathlib.CategoryTheory.Monoidal.Mon_.407_0.NTUMzhXPwXsmsYt
|
theorem Mon_tensor_one_mul (M N : Mon_ C) :
((Ξ»_ (π_ C)).inv β« (M.one β N.one) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ»_ (M.X β N.X)).hom
|
Mathlib_CategoryTheory_Monoidal_Mon_
|
case a.a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M N : Mon_ C
| ((M.one β N.one) β π (M.X β N.X)) β« tensor_ΞΌ C (M.X, N.X) (M.X, N.X)
case a.a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M N : Mon_ C
| M.mul β N.mul
case a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M N : Mon_ C
| (Ξ»_ (π_ C)).inv β π (M.X β N.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))) (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
#align Mon_.one_right_unitor Mon_.one_rightUnitor
variable [BraidedCategory C]
theorem Mon_tensor_one_mul (M N : Mon_ C) :
((Ξ»_ (π_ C)).inv β« (M.one β N.one) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ»_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 =>
|
rw [β tensor_id, tensor_ΞΌ_natural]
|
theorem Mon_tensor_one_mul (M N : Mon_ C) :
((Ξ»_ (π_ C)).inv β« (M.one β N.one) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ»_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 =>
|
Mathlib.CategoryTheory.Monoidal.Mon_.407_0.NTUMzhXPwXsmsYt
|
theorem Mon_tensor_one_mul (M N : Mon_ C) :
((Ξ»_ (π_ C)).inv β« (M.one β N.one) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ»_ (M.X β N.X)).hom
|
Mathlib_CategoryTheory_Monoidal_Mon_
|
case a.a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M N : Mon_ C
| ((M.one β N.one) β π (M.X β N.X)) β« tensor_ΞΌ C (M.X, N.X) (M.X, N.X)
case a.a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M N : Mon_ C
| M.mul β N.mul
case a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M N : Mon_ C
| (Ξ»_ (π_ C)).inv β π (M.X β N.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))) (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
#align Mon_.one_right_unitor Mon_.one_rightUnitor
variable [BraidedCategory C]
theorem Mon_tensor_one_mul (M N : Mon_ C) :
((Ξ»_ (π_ C)).inv β« (M.one β N.one) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ»_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 =>
|
rw [β tensor_id, tensor_ΞΌ_natural]
|
theorem Mon_tensor_one_mul (M N : Mon_ C) :
((Ξ»_ (π_ C)).inv β« (M.one β N.one) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ»_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 =>
|
Mathlib.CategoryTheory.Monoidal.Mon_.407_0.NTUMzhXPwXsmsYt
|
theorem Mon_tensor_one_mul (M N : Mon_ C) :
((Ξ»_ (π_ C)).inv β« (M.one β N.one) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ»_ (M.X β N.X)).hom
|
Mathlib_CategoryTheory_Monoidal_Mon_
|
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M N : Mon_ C
β’ ((Ξ»_ (π_ C)).inv β π (M.X β N.X)) β«
(tensor_ΞΌ C (π_ C, π_ C) (M.X, N.X) β« ((M.one β π M.X) β N.one β π N.X)) β« (M.mul β N.mul) =
(Ξ»_ (M.X β N.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]
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
#align Mon_.one_right_unitor Mon_.one_rightUnitor
variable [BraidedCategory C]
theorem Mon_tensor_one_mul (M N : Mon_ C) :
((Ξ»_ (π_ C)).inv β« (M.one β N.one) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ»_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
|
slice_lhs 3 4 => rw [β tensor_comp, one_mul M, one_mul N]
|
theorem Mon_tensor_one_mul (M N : Mon_ C) :
((Ξ»_ (π_ C)).inv β« (M.one β N.one) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ»_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
|
Mathlib.CategoryTheory.Monoidal.Mon_.407_0.NTUMzhXPwXsmsYt
|
theorem Mon_tensor_one_mul (M N : Mon_ C) :
((Ξ»_ (π_ C)).inv β« (M.one β N.one) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ»_ (M.X β N.X)).hom
|
Mathlib_CategoryTheory_Monoidal_Mon_
|
case a.a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M N : Mon_ C
| ((M.one β π M.X) β N.one β π N.X) β« (M.mul β N.mul)
case a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M N : Mon_ C
| (Ξ»_ (π_ C)).inv β π (M.X β N.X)
case a.a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M N : Mon_ C
| tensor_ΞΌ C (π_ C, π_ C) (M.X, N.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))) (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
#align Mon_.one_right_unitor Mon_.one_rightUnitor
variable [BraidedCategory C]
theorem Mon_tensor_one_mul (M N : Mon_ C) :
((Ξ»_ (π_ C)).inv β« (M.one β N.one) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ»_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 =>
|
rw [β tensor_comp, one_mul M, one_mul N]
|
theorem Mon_tensor_one_mul (M N : Mon_ C) :
((Ξ»_ (π_ C)).inv β« (M.one β N.one) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ»_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 =>
|
Mathlib.CategoryTheory.Monoidal.Mon_.407_0.NTUMzhXPwXsmsYt
|
theorem Mon_tensor_one_mul (M N : Mon_ C) :
((Ξ»_ (π_ C)).inv β« (M.one β N.one) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ»_ (M.X β N.X)).hom
|
Mathlib_CategoryTheory_Monoidal_Mon_
|
case a.a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M N : Mon_ C
| ((M.one β π M.X) β N.one β π N.X) β« (M.mul β N.mul)
case a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M N : Mon_ C
| (Ξ»_ (π_ C)).inv β π (M.X β N.X)
case a.a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M N : Mon_ C
| tensor_ΞΌ C (π_ C, π_ C) (M.X, N.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))) (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
#align Mon_.one_right_unitor Mon_.one_rightUnitor
variable [BraidedCategory C]
theorem Mon_tensor_one_mul (M N : Mon_ C) :
((Ξ»_ (π_ C)).inv β« (M.one β N.one) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ»_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 =>
|
rw [β tensor_comp, one_mul M, one_mul N]
|
theorem Mon_tensor_one_mul (M N : Mon_ C) :
((Ξ»_ (π_ C)).inv β« (M.one β N.one) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ»_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 =>
|
Mathlib.CategoryTheory.Monoidal.Mon_.407_0.NTUMzhXPwXsmsYt
|
theorem Mon_tensor_one_mul (M N : Mon_ C) :
((Ξ»_ (π_ C)).inv β« (M.one β N.one) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ»_ (M.X β N.X)).hom
|
Mathlib_CategoryTheory_Monoidal_Mon_
|
case a.a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M N : Mon_ C
| ((M.one β π M.X) β N.one β π N.X) β« (M.mul β N.mul)
case a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M N : Mon_ C
| (Ξ»_ (π_ C)).inv β π (M.X β N.X)
case a.a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M N : Mon_ C
| tensor_ΞΌ C (π_ C, π_ C) (M.X, N.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))) (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
#align Mon_.one_right_unitor Mon_.one_rightUnitor
variable [BraidedCategory C]
theorem Mon_tensor_one_mul (M N : Mon_ C) :
((Ξ»_ (π_ C)).inv β« (M.one β N.one) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ»_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 =>
|
rw [β tensor_comp, one_mul M, one_mul N]
|
theorem Mon_tensor_one_mul (M N : Mon_ C) :
((Ξ»_ (π_ C)).inv β« (M.one β N.one) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ»_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 =>
|
Mathlib.CategoryTheory.Monoidal.Mon_.407_0.NTUMzhXPwXsmsYt
|
theorem Mon_tensor_one_mul (M N : Mon_ C) :
((Ξ»_ (π_ C)).inv β« (M.one β N.one) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ»_ (M.X β N.X)).hom
|
Mathlib_CategoryTheory_Monoidal_Mon_
|
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M N : Mon_ C
β’ ((Ξ»_ (π_ C)).inv β π (M.X β N.X)) β« tensor_ΞΌ C (π_ C, π_ C) (M.X, N.X) β« ((Ξ»_ M.X).hom β (Ξ»_ N.X).hom) =
(Ξ»_ (M.X β N.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]
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
#align Mon_.one_right_unitor Mon_.one_rightUnitor
variable [BraidedCategory C]
theorem Mon_tensor_one_mul (M N : Mon_ C) :
((Ξ»_ (π_ C)).inv β« (M.one β N.one) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ»_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, one_mul M, one_mul N]
|
symm
|
theorem Mon_tensor_one_mul (M N : Mon_ C) :
((Ξ»_ (π_ C)).inv β« (M.one β N.one) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ»_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, one_mul M, one_mul N]
|
Mathlib.CategoryTheory.Monoidal.Mon_.407_0.NTUMzhXPwXsmsYt
|
theorem Mon_tensor_one_mul (M N : Mon_ C) :
((Ξ»_ (π_ C)).inv β« (M.one β N.one) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ»_ (M.X β N.X)).hom
|
Mathlib_CategoryTheory_Monoidal_Mon_
|
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M N : Mon_ C
β’ (Ξ»_ (M.X β N.X)).hom =
((Ξ»_ (π_ C)).inv β π (M.X β N.X)) β« tensor_ΞΌ C (π_ C, π_ C) (M.X, N.X) β« ((Ξ»_ M.X).hom β (Ξ»_ N.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]
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
#align Mon_.one_right_unitor Mon_.one_rightUnitor
variable [BraidedCategory C]
theorem Mon_tensor_one_mul (M N : Mon_ C) :
((Ξ»_ (π_ C)).inv β« (M.one β N.one) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ»_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, one_mul M, one_mul N]
symm
|
exact tensor_left_unitality C M.X N.X
|
theorem Mon_tensor_one_mul (M N : Mon_ C) :
((Ξ»_ (π_ C)).inv β« (M.one β N.one) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ»_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, one_mul M, one_mul N]
symm
|
Mathlib.CategoryTheory.Monoidal.Mon_.407_0.NTUMzhXPwXsmsYt
|
theorem Mon_tensor_one_mul (M N : Mon_ C) :
((Ξ»_ (π_ C)).inv β« (M.one β N.one) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ»_ (M.X β N.X)).hom
|
Mathlib_CategoryTheory_Monoidal_Mon_
|
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M N : Mon_ C
β’ (π (M.X β N.X) β (Ξ»_ (π_ C)).inv β« (M.one β N.one)) β« tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ο_ (M.X β N.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]
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
#align Mon_.one_right_unitor Mon_.one_rightUnitor
variable [BraidedCategory C]
theorem Mon_tensor_one_mul (M N : Mon_ C) :
((Ξ»_ (π_ C)).inv β« (M.one β N.one) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ»_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, one_mul M, one_mul N]
symm
exact tensor_left_unitality C M.X N.X
#align Mon_.Mon_tensor_one_mul Mon_.Mon_tensor_one_mul
theorem Mon_tensor_mul_one (M N : Mon_ C) :
(π (M.X β N.X) β (Ξ»_ (π_ C)).inv β« (M.one β N.one)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ο_ (M.X β N.X)).hom := by
|
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
|
theorem Mon_tensor_mul_one (M N : Mon_ C) :
(π (M.X β N.X) β (Ξ»_ (π_ C)).inv β« (M.one β N.one)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ο_ (M.X β N.X)).hom := by
|
Mathlib.CategoryTheory.Monoidal.Mon_.418_0.NTUMzhXPwXsmsYt
|
theorem Mon_tensor_mul_one (M N : Mon_ C) :
(π (M.X β N.X) β (Ξ»_ (π_ C)).inv β« (M.one β N.one)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ο_ (M.X β N.X)).hom
|
Mathlib_CategoryTheory_Monoidal_Mon_
|
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M N : Mon_ C
β’ ((π (M.X β N.X) β (Ξ»_ (π_ C)).inv) β« (π (M.X β N.X) β M.one β N.one)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ο_ (M.X β N.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]
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
#align Mon_.one_right_unitor Mon_.one_rightUnitor
variable [BraidedCategory C]
theorem Mon_tensor_one_mul (M N : Mon_ C) :
((Ξ»_ (π_ C)).inv β« (M.one β N.one) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ»_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, one_mul M, one_mul N]
symm
exact tensor_left_unitality C M.X N.X
#align Mon_.Mon_tensor_one_mul Mon_.Mon_tensor_one_mul
theorem Mon_tensor_mul_one (M N : Mon_ C) :
(π (M.X β N.X) β (Ξ»_ (π_ C)).inv β« (M.one β N.one)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ο_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
|
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
|
theorem Mon_tensor_mul_one (M N : Mon_ C) :
(π (M.X β N.X) β (Ξ»_ (π_ C)).inv β« (M.one β N.one)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ο_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
|
Mathlib.CategoryTheory.Monoidal.Mon_.418_0.NTUMzhXPwXsmsYt
|
theorem Mon_tensor_mul_one (M N : Mon_ C) :
(π (M.X β N.X) β (Ξ»_ (π_ C)).inv β« (M.one β N.one)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ο_ (M.X β N.X)).hom
|
Mathlib_CategoryTheory_Monoidal_Mon_
|
case a.a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M N : Mon_ C
| (π (M.X β N.X) β M.one β N.one) β« tensor_ΞΌ C (M.X, N.X) (M.X, N.X)
case a.a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M N : Mon_ C
| M.mul β N.mul
case a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M N : Mon_ C
| π (M.X β N.X) β (Ξ»_ (π_ 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]
simp
#align Mon_.one_right_unitor Mon_.one_rightUnitor
variable [BraidedCategory C]
theorem Mon_tensor_one_mul (M N : Mon_ C) :
((Ξ»_ (π_ C)).inv β« (M.one β N.one) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ»_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, one_mul M, one_mul N]
symm
exact tensor_left_unitality C M.X N.X
#align Mon_.Mon_tensor_one_mul Mon_.Mon_tensor_one_mul
theorem Mon_tensor_mul_one (M N : Mon_ C) :
(π (M.X β N.X) β (Ξ»_ (π_ C)).inv β« (M.one β N.one)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ο_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 =>
|
rw [β tensor_id, tensor_ΞΌ_natural]
|
theorem Mon_tensor_mul_one (M N : Mon_ C) :
(π (M.X β N.X) β (Ξ»_ (π_ C)).inv β« (M.one β N.one)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ο_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 =>
|
Mathlib.CategoryTheory.Monoidal.Mon_.418_0.NTUMzhXPwXsmsYt
|
theorem Mon_tensor_mul_one (M N : Mon_ C) :
(π (M.X β N.X) β (Ξ»_ (π_ C)).inv β« (M.one β N.one)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ο_ (M.X β N.X)).hom
|
Mathlib_CategoryTheory_Monoidal_Mon_
|
case a.a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M N : Mon_ C
| (π (M.X β N.X) β M.one β N.one) β« tensor_ΞΌ C (M.X, N.X) (M.X, N.X)
case a.a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M N : Mon_ C
| M.mul β N.mul
case a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M N : Mon_ C
| π (M.X β N.X) β (Ξ»_ (π_ 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]
simp
#align Mon_.one_right_unitor Mon_.one_rightUnitor
variable [BraidedCategory C]
theorem Mon_tensor_one_mul (M N : Mon_ C) :
((Ξ»_ (π_ C)).inv β« (M.one β N.one) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ»_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, one_mul M, one_mul N]
symm
exact tensor_left_unitality C M.X N.X
#align Mon_.Mon_tensor_one_mul Mon_.Mon_tensor_one_mul
theorem Mon_tensor_mul_one (M N : Mon_ C) :
(π (M.X β N.X) β (Ξ»_ (π_ C)).inv β« (M.one β N.one)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ο_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 =>
|
rw [β tensor_id, tensor_ΞΌ_natural]
|
theorem Mon_tensor_mul_one (M N : Mon_ C) :
(π (M.X β N.X) β (Ξ»_ (π_ C)).inv β« (M.one β N.one)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ο_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 =>
|
Mathlib.CategoryTheory.Monoidal.Mon_.418_0.NTUMzhXPwXsmsYt
|
theorem Mon_tensor_mul_one (M N : Mon_ C) :
(π (M.X β N.X) β (Ξ»_ (π_ C)).inv β« (M.one β N.one)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ο_ (M.X β N.X)).hom
|
Mathlib_CategoryTheory_Monoidal_Mon_
|
case a.a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M N : Mon_ C
| (π (M.X β N.X) β M.one β N.one) β« tensor_ΞΌ C (M.X, N.X) (M.X, N.X)
case a.a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M N : Mon_ C
| M.mul β N.mul
case a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M N : Mon_ C
| π (M.X β N.X) β (Ξ»_ (π_ 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]
simp
#align Mon_.one_right_unitor Mon_.one_rightUnitor
variable [BraidedCategory C]
theorem Mon_tensor_one_mul (M N : Mon_ C) :
((Ξ»_ (π_ C)).inv β« (M.one β N.one) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ»_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, one_mul M, one_mul N]
symm
exact tensor_left_unitality C M.X N.X
#align Mon_.Mon_tensor_one_mul Mon_.Mon_tensor_one_mul
theorem Mon_tensor_mul_one (M N : Mon_ C) :
(π (M.X β N.X) β (Ξ»_ (π_ C)).inv β« (M.one β N.one)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ο_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 =>
|
rw [β tensor_id, tensor_ΞΌ_natural]
|
theorem Mon_tensor_mul_one (M N : Mon_ C) :
(π (M.X β N.X) β (Ξ»_ (π_ C)).inv β« (M.one β N.one)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ο_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 =>
|
Mathlib.CategoryTheory.Monoidal.Mon_.418_0.NTUMzhXPwXsmsYt
|
theorem Mon_tensor_mul_one (M N : Mon_ C) :
(π (M.X β N.X) β (Ξ»_ (π_ C)).inv β« (M.one β N.one)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ο_ (M.X β N.X)).hom
|
Mathlib_CategoryTheory_Monoidal_Mon_
|
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M N : Mon_ C
β’ (π (M.X β N.X) β (Ξ»_ (π_ C)).inv) β«
(tensor_ΞΌ C (M.X, N.X) (π_ C, π_ C) β« ((π M.X β M.one) β π N.X β N.one)) β« (M.mul β N.mul) =
(Ο_ (M.X β N.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]
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
#align Mon_.one_right_unitor Mon_.one_rightUnitor
variable [BraidedCategory C]
theorem Mon_tensor_one_mul (M N : Mon_ C) :
((Ξ»_ (π_ C)).inv β« (M.one β N.one) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ»_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, one_mul M, one_mul N]
symm
exact tensor_left_unitality C M.X N.X
#align Mon_.Mon_tensor_one_mul Mon_.Mon_tensor_one_mul
theorem Mon_tensor_mul_one (M N : Mon_ C) :
(π (M.X β N.X) β (Ξ»_ (π_ C)).inv β« (M.one β N.one)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ο_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
|
slice_lhs 3 4 => rw [β tensor_comp, mul_one M, mul_one N]
|
theorem Mon_tensor_mul_one (M N : Mon_ C) :
(π (M.X β N.X) β (Ξ»_ (π_ C)).inv β« (M.one β N.one)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ο_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
|
Mathlib.CategoryTheory.Monoidal.Mon_.418_0.NTUMzhXPwXsmsYt
|
theorem Mon_tensor_mul_one (M N : Mon_ C) :
(π (M.X β N.X) β (Ξ»_ (π_ C)).inv β« (M.one β N.one)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ο_ (M.X β N.X)).hom
|
Mathlib_CategoryTheory_Monoidal_Mon_
|
case a.a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M N : Mon_ C
| ((π M.X β M.one) β π N.X β N.one) β« (M.mul β N.mul)
case a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M N : Mon_ C
| π (M.X β N.X) β (Ξ»_ (π_ C)).inv
case a.a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M N : Mon_ C
| tensor_ΞΌ C (M.X, N.X) (π_ C, π_ 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]
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
#align Mon_.one_right_unitor Mon_.one_rightUnitor
variable [BraidedCategory C]
theorem Mon_tensor_one_mul (M N : Mon_ C) :
((Ξ»_ (π_ C)).inv β« (M.one β N.one) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ»_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, one_mul M, one_mul N]
symm
exact tensor_left_unitality C M.X N.X
#align Mon_.Mon_tensor_one_mul Mon_.Mon_tensor_one_mul
theorem Mon_tensor_mul_one (M N : Mon_ C) :
(π (M.X β N.X) β (Ξ»_ (π_ C)).inv β« (M.one β N.one)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ο_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 =>
|
rw [β tensor_comp, mul_one M, mul_one N]
|
theorem Mon_tensor_mul_one (M N : Mon_ C) :
(π (M.X β N.X) β (Ξ»_ (π_ C)).inv β« (M.one β N.one)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ο_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 =>
|
Mathlib.CategoryTheory.Monoidal.Mon_.418_0.NTUMzhXPwXsmsYt
|
theorem Mon_tensor_mul_one (M N : Mon_ C) :
(π (M.X β N.X) β (Ξ»_ (π_ C)).inv β« (M.one β N.one)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ο_ (M.X β N.X)).hom
|
Mathlib_CategoryTheory_Monoidal_Mon_
|
case a.a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M N : Mon_ C
| ((π M.X β M.one) β π N.X β N.one) β« (M.mul β N.mul)
case a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M N : Mon_ C
| π (M.X β N.X) β (Ξ»_ (π_ C)).inv
case a.a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M N : Mon_ C
| tensor_ΞΌ C (M.X, N.X) (π_ C, π_ 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]
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
#align Mon_.one_right_unitor Mon_.one_rightUnitor
variable [BraidedCategory C]
theorem Mon_tensor_one_mul (M N : Mon_ C) :
((Ξ»_ (π_ C)).inv β« (M.one β N.one) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ»_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, one_mul M, one_mul N]
symm
exact tensor_left_unitality C M.X N.X
#align Mon_.Mon_tensor_one_mul Mon_.Mon_tensor_one_mul
theorem Mon_tensor_mul_one (M N : Mon_ C) :
(π (M.X β N.X) β (Ξ»_ (π_ C)).inv β« (M.one β N.one)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ο_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 =>
|
rw [β tensor_comp, mul_one M, mul_one N]
|
theorem Mon_tensor_mul_one (M N : Mon_ C) :
(π (M.X β N.X) β (Ξ»_ (π_ C)).inv β« (M.one β N.one)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ο_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 =>
|
Mathlib.CategoryTheory.Monoidal.Mon_.418_0.NTUMzhXPwXsmsYt
|
theorem Mon_tensor_mul_one (M N : Mon_ C) :
(π (M.X β N.X) β (Ξ»_ (π_ C)).inv β« (M.one β N.one)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ο_ (M.X β N.X)).hom
|
Mathlib_CategoryTheory_Monoidal_Mon_
|
case a.a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M N : Mon_ C
| ((π M.X β M.one) β π N.X β N.one) β« (M.mul β N.mul)
case a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M N : Mon_ C
| π (M.X β N.X) β (Ξ»_ (π_ C)).inv
case a.a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M N : Mon_ C
| tensor_ΞΌ C (M.X, N.X) (π_ C, π_ 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]
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
#align Mon_.one_right_unitor Mon_.one_rightUnitor
variable [BraidedCategory C]
theorem Mon_tensor_one_mul (M N : Mon_ C) :
((Ξ»_ (π_ C)).inv β« (M.one β N.one) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ»_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, one_mul M, one_mul N]
symm
exact tensor_left_unitality C M.X N.X
#align Mon_.Mon_tensor_one_mul Mon_.Mon_tensor_one_mul
theorem Mon_tensor_mul_one (M N : Mon_ C) :
(π (M.X β N.X) β (Ξ»_ (π_ C)).inv β« (M.one β N.one)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ο_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 =>
|
rw [β tensor_comp, mul_one M, mul_one N]
|
theorem Mon_tensor_mul_one (M N : Mon_ C) :
(π (M.X β N.X) β (Ξ»_ (π_ C)).inv β« (M.one β N.one)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ο_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 =>
|
Mathlib.CategoryTheory.Monoidal.Mon_.418_0.NTUMzhXPwXsmsYt
|
theorem Mon_tensor_mul_one (M N : Mon_ C) :
(π (M.X β N.X) β (Ξ»_ (π_ C)).inv β« (M.one β N.one)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ο_ (M.X β N.X)).hom
|
Mathlib_CategoryTheory_Monoidal_Mon_
|
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M N : Mon_ C
β’ (π (M.X β N.X) β (Ξ»_ (π_ C)).inv) β« tensor_ΞΌ C (M.X, N.X) (π_ C, π_ C) β« ((Ο_ M.X).hom β (Ο_ N.X).hom) =
(Ο_ (M.X β N.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]
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
#align Mon_.one_right_unitor Mon_.one_rightUnitor
variable [BraidedCategory C]
theorem Mon_tensor_one_mul (M N : Mon_ C) :
((Ξ»_ (π_ C)).inv β« (M.one β N.one) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ»_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, one_mul M, one_mul N]
symm
exact tensor_left_unitality C M.X N.X
#align Mon_.Mon_tensor_one_mul Mon_.Mon_tensor_one_mul
theorem Mon_tensor_mul_one (M N : Mon_ C) :
(π (M.X β N.X) β (Ξ»_ (π_ C)).inv β« (M.one β N.one)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ο_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_one M, mul_one N]
|
symm
|
theorem Mon_tensor_mul_one (M N : Mon_ C) :
(π (M.X β N.X) β (Ξ»_ (π_ C)).inv β« (M.one β N.one)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ο_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_one M, mul_one N]
|
Mathlib.CategoryTheory.Monoidal.Mon_.418_0.NTUMzhXPwXsmsYt
|
theorem Mon_tensor_mul_one (M N : Mon_ C) :
(π (M.X β N.X) β (Ξ»_ (π_ C)).inv β« (M.one β N.one)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ο_ (M.X β N.X)).hom
|
Mathlib_CategoryTheory_Monoidal_Mon_
|
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M N : Mon_ C
β’ (Ο_ (M.X β N.X)).hom =
(π (M.X β N.X) β (Ξ»_ (π_ C)).inv) β« tensor_ΞΌ C (M.X, N.X) (π_ C, π_ C) β« ((Ο_ M.X).hom β (Ο_ N.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]
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
#align Mon_.one_right_unitor Mon_.one_rightUnitor
variable [BraidedCategory C]
theorem Mon_tensor_one_mul (M N : Mon_ C) :
((Ξ»_ (π_ C)).inv β« (M.one β N.one) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ»_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, one_mul M, one_mul N]
symm
exact tensor_left_unitality C M.X N.X
#align Mon_.Mon_tensor_one_mul Mon_.Mon_tensor_one_mul
theorem Mon_tensor_mul_one (M N : Mon_ C) :
(π (M.X β N.X) β (Ξ»_ (π_ C)).inv β« (M.one β N.one)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ο_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_one M, mul_one N]
symm
|
exact tensor_right_unitality C M.X N.X
|
theorem Mon_tensor_mul_one (M N : Mon_ C) :
(π (M.X β N.X) β (Ξ»_ (π_ C)).inv β« (M.one β N.one)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ο_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_one M, mul_one N]
symm
|
Mathlib.CategoryTheory.Monoidal.Mon_.418_0.NTUMzhXPwXsmsYt
|
theorem Mon_tensor_mul_one (M N : Mon_ C) :
(π (M.X β N.X) β (Ξ»_ (π_ C)).inv β« (M.one β N.one)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ο_ (M.X β N.X)).hom
|
Mathlib_CategoryTheory_Monoidal_Mon_
|
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M N : Mon_ C
β’ (tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ±_ (M.X β N.X) (M.X β N.X) (M.X β N.X)).hom β«
(π (M.X β N.X) β tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.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] }
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
#align Mon_.one_right_unitor Mon_.one_rightUnitor
variable [BraidedCategory C]
theorem Mon_tensor_one_mul (M N : Mon_ C) :
((Ξ»_ (π_ C)).inv β« (M.one β N.one) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ»_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, one_mul M, one_mul N]
symm
exact tensor_left_unitality C M.X N.X
#align Mon_.Mon_tensor_one_mul Mon_.Mon_tensor_one_mul
theorem Mon_tensor_mul_one (M N : Mon_ C) :
(π (M.X β N.X) β (Ξ»_ (π_ C)).inv β« (M.one β N.one)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ο_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_one M, mul_one N]
symm
exact tensor_right_unitality C M.X N.X
#align Mon_.Mon_tensor_mul_one Mon_.Mon_tensor_mul_one
theorem Mon_tensor_mul_assoc (M N : Mon_ C) :
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ±_ (M.X β N.X) (M.X β N.X) (M.X β N.X)).hom β«
(π (M.X β N.X) β tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) := by
|
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
|
theorem Mon_tensor_mul_assoc (M N : Mon_ C) :
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ±_ (M.X β N.X) (M.X β N.X) (M.X β N.X)).hom β«
(π (M.X β N.X) β tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) := by
|
Mathlib.CategoryTheory.Monoidal.Mon_.429_0.NTUMzhXPwXsmsYt
|
theorem Mon_tensor_mul_assoc (M N : Mon_ C) :
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ±_ (M.X β N.X) (M.X β N.X) (M.X β N.X)).hom β«
(π (M.X β N.X) β tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)
|
Mathlib_CategoryTheory_Monoidal_Mon_
|
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M N : Mon_ C
β’ ((tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β π (M.X β N.X)) β« ((M.mul β N.mul) β π (M.X β N.X))) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ±_ (M.X β N.X) (M.X β N.X) (M.X β N.X)).hom β«
(π (M.X β N.X) β« π (M.X β N.X) β tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.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] }
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
#align Mon_.one_right_unitor Mon_.one_rightUnitor
variable [BraidedCategory C]
theorem Mon_tensor_one_mul (M N : Mon_ C) :
((Ξ»_ (π_ C)).inv β« (M.one β N.one) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ»_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, one_mul M, one_mul N]
symm
exact tensor_left_unitality C M.X N.X
#align Mon_.Mon_tensor_one_mul Mon_.Mon_tensor_one_mul
theorem Mon_tensor_mul_one (M N : Mon_ C) :
(π (M.X β N.X) β (Ξ»_ (π_ C)).inv β« (M.one β N.one)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ο_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_one M, mul_one N]
symm
exact tensor_right_unitality C M.X N.X
#align Mon_.Mon_tensor_mul_one Mon_.Mon_tensor_mul_one
theorem Mon_tensor_mul_assoc (M N : Mon_ C) :
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ±_ (M.X β N.X) (M.X β N.X) (M.X β N.X)).hom β«
(π (M.X β N.X) β tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
|
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
|
theorem Mon_tensor_mul_assoc (M N : Mon_ C) :
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ±_ (M.X β N.X) (M.X β N.X) (M.X β N.X)).hom β«
(π (M.X β N.X) β tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
|
Mathlib.CategoryTheory.Monoidal.Mon_.429_0.NTUMzhXPwXsmsYt
|
theorem Mon_tensor_mul_assoc (M N : Mon_ C) :
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ±_ (M.X β N.X) (M.X β N.X) (M.X β N.X)).hom β«
(π (M.X β N.X) β tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)
|
Mathlib_CategoryTheory_Monoidal_Mon_
|
case a.a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M N : Mon_ C
| ((M.mul β N.mul) β π (M.X β N.X)) β« tensor_ΞΌ C (M.X, N.X) (M.X, N.X)
case a.a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M N : Mon_ C
| M.mul β N.mul
case a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M N : Mon_ C
| tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β π (M.X β N.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))) (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
#align Mon_.one_right_unitor Mon_.one_rightUnitor
variable [BraidedCategory C]
theorem Mon_tensor_one_mul (M N : Mon_ C) :
((Ξ»_ (π_ C)).inv β« (M.one β N.one) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ»_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, one_mul M, one_mul N]
symm
exact tensor_left_unitality C M.X N.X
#align Mon_.Mon_tensor_one_mul Mon_.Mon_tensor_one_mul
theorem Mon_tensor_mul_one (M N : Mon_ C) :
(π (M.X β N.X) β (Ξ»_ (π_ C)).inv β« (M.one β N.one)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ο_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_one M, mul_one N]
symm
exact tensor_right_unitality C M.X N.X
#align Mon_.Mon_tensor_mul_one Mon_.Mon_tensor_mul_one
theorem Mon_tensor_mul_assoc (M N : Mon_ C) :
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ±_ (M.X β N.X) (M.X β N.X) (M.X β N.X)).hom β«
(π (M.X β N.X) β tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 =>
|
rw [β tensor_id, tensor_ΞΌ_natural]
|
theorem Mon_tensor_mul_assoc (M N : Mon_ C) :
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ±_ (M.X β N.X) (M.X β N.X) (M.X β N.X)).hom β«
(π (M.X β N.X) β tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 =>
|
Mathlib.CategoryTheory.Monoidal.Mon_.429_0.NTUMzhXPwXsmsYt
|
theorem Mon_tensor_mul_assoc (M N : Mon_ C) :
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ±_ (M.X β N.X) (M.X β N.X) (M.X β N.X)).hom β«
(π (M.X β N.X) β tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)
|
Mathlib_CategoryTheory_Monoidal_Mon_
|
case a.a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M N : Mon_ C
| ((M.mul β N.mul) β π (M.X β N.X)) β« tensor_ΞΌ C (M.X, N.X) (M.X, N.X)
case a.a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M N : Mon_ C
| M.mul β N.mul
case a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M N : Mon_ C
| tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β π (M.X β N.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))) (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
#align Mon_.one_right_unitor Mon_.one_rightUnitor
variable [BraidedCategory C]
theorem Mon_tensor_one_mul (M N : Mon_ C) :
((Ξ»_ (π_ C)).inv β« (M.one β N.one) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ»_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, one_mul M, one_mul N]
symm
exact tensor_left_unitality C M.X N.X
#align Mon_.Mon_tensor_one_mul Mon_.Mon_tensor_one_mul
theorem Mon_tensor_mul_one (M N : Mon_ C) :
(π (M.X β N.X) β (Ξ»_ (π_ C)).inv β« (M.one β N.one)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ο_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_one M, mul_one N]
symm
exact tensor_right_unitality C M.X N.X
#align Mon_.Mon_tensor_mul_one Mon_.Mon_tensor_mul_one
theorem Mon_tensor_mul_assoc (M N : Mon_ C) :
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ±_ (M.X β N.X) (M.X β N.X) (M.X β N.X)).hom β«
(π (M.X β N.X) β tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 =>
|
rw [β tensor_id, tensor_ΞΌ_natural]
|
theorem Mon_tensor_mul_assoc (M N : Mon_ C) :
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ±_ (M.X β N.X) (M.X β N.X) (M.X β N.X)).hom β«
(π (M.X β N.X) β tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 =>
|
Mathlib.CategoryTheory.Monoidal.Mon_.429_0.NTUMzhXPwXsmsYt
|
theorem Mon_tensor_mul_assoc (M N : Mon_ C) :
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ±_ (M.X β N.X) (M.X β N.X) (M.X β N.X)).hom β«
(π (M.X β N.X) β tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)
|
Mathlib_CategoryTheory_Monoidal_Mon_
|
case a.a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M N : Mon_ C
| ((M.mul β N.mul) β π (M.X β N.X)) β« tensor_ΞΌ C (M.X, N.X) (M.X, N.X)
case a.a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M N : Mon_ C
| M.mul β N.mul
case a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M N : Mon_ C
| tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β π (M.X β N.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))) (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
#align Mon_.one_right_unitor Mon_.one_rightUnitor
variable [BraidedCategory C]
theorem Mon_tensor_one_mul (M N : Mon_ C) :
((Ξ»_ (π_ C)).inv β« (M.one β N.one) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ»_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, one_mul M, one_mul N]
symm
exact tensor_left_unitality C M.X N.X
#align Mon_.Mon_tensor_one_mul Mon_.Mon_tensor_one_mul
theorem Mon_tensor_mul_one (M N : Mon_ C) :
(π (M.X β N.X) β (Ξ»_ (π_ C)).inv β« (M.one β N.one)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ο_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_one M, mul_one N]
symm
exact tensor_right_unitality C M.X N.X
#align Mon_.Mon_tensor_mul_one Mon_.Mon_tensor_mul_one
theorem Mon_tensor_mul_assoc (M N : Mon_ C) :
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ±_ (M.X β N.X) (M.X β N.X) (M.X β N.X)).hom β«
(π (M.X β N.X) β tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 =>
|
rw [β tensor_id, tensor_ΞΌ_natural]
|
theorem Mon_tensor_mul_assoc (M N : Mon_ C) :
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ±_ (M.X β N.X) (M.X β N.X) (M.X β N.X)).hom β«
(π (M.X β N.X) β tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 =>
|
Mathlib.CategoryTheory.Monoidal.Mon_.429_0.NTUMzhXPwXsmsYt
|
theorem Mon_tensor_mul_assoc (M N : Mon_ C) :
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ±_ (M.X β N.X) (M.X β N.X) (M.X β N.X)).hom β«
(π (M.X β N.X) β tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)
|
Mathlib_CategoryTheory_Monoidal_Mon_
|
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M N : Mon_ C
β’ (tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β π (M.X β N.X)) β«
(tensor_ΞΌ C (((M.X, N.X) β (M.X, N.X)).1, ((M.X, N.X) β (M.X, N.X)).2) (M.X, N.X) β«
((M.mul β π M.X) β N.mul β π N.X)) β«
(M.mul β N.mul) =
(Ξ±_ (M.X β N.X) (M.X β N.X) (M.X β N.X)).hom β«
(π (M.X β N.X) β« π (M.X β N.X) β tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.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] }
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
#align Mon_.one_right_unitor Mon_.one_rightUnitor
variable [BraidedCategory C]
theorem Mon_tensor_one_mul (M N : Mon_ C) :
((Ξ»_ (π_ C)).inv β« (M.one β N.one) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ»_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, one_mul M, one_mul N]
symm
exact tensor_left_unitality C M.X N.X
#align Mon_.Mon_tensor_one_mul Mon_.Mon_tensor_one_mul
theorem Mon_tensor_mul_one (M N : Mon_ C) :
(π (M.X β N.X) β (Ξ»_ (π_ C)).inv β« (M.one β N.one)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ο_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_one M, mul_one N]
symm
exact tensor_right_unitality C M.X N.X
#align Mon_.Mon_tensor_mul_one Mon_.Mon_tensor_mul_one
theorem Mon_tensor_mul_assoc (M N : Mon_ C) :
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ±_ (M.X β N.X) (M.X β N.X) (M.X β N.X)).hom β«
(π (M.X β N.X) β tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
|
slice_lhs 3 4 => rw [β tensor_comp, mul_assoc M, mul_assoc N, tensor_comp, tensor_comp]
|
theorem Mon_tensor_mul_assoc (M N : Mon_ C) :
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ±_ (M.X β N.X) (M.X β N.X) (M.X β N.X)).hom β«
(π (M.X β N.X) β tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
|
Mathlib.CategoryTheory.Monoidal.Mon_.429_0.NTUMzhXPwXsmsYt
|
theorem Mon_tensor_mul_assoc (M N : Mon_ C) :
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ±_ (M.X β N.X) (M.X β N.X) (M.X β N.X)).hom β«
(π (M.X β N.X) β tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)
|
Mathlib_CategoryTheory_Monoidal_Mon_
|
case a.a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M N : Mon_ C
| ((M.mul β π M.X) β N.mul β π N.X) β« (M.mul β N.mul)
case a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M N : Mon_ C
| tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β π (M.X β N.X)
case a.a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M N : Mon_ C
| tensor_ΞΌ C (((M.X, N.X) β (M.X, N.X)).1, ((M.X, N.X) β (M.X, N.X)).2) (M.X, N.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))) (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
#align Mon_.one_right_unitor Mon_.one_rightUnitor
variable [BraidedCategory C]
theorem Mon_tensor_one_mul (M N : Mon_ C) :
((Ξ»_ (π_ C)).inv β« (M.one β N.one) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ»_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, one_mul M, one_mul N]
symm
exact tensor_left_unitality C M.X N.X
#align Mon_.Mon_tensor_one_mul Mon_.Mon_tensor_one_mul
theorem Mon_tensor_mul_one (M N : Mon_ C) :
(π (M.X β N.X) β (Ξ»_ (π_ C)).inv β« (M.one β N.one)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ο_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_one M, mul_one N]
symm
exact tensor_right_unitality C M.X N.X
#align Mon_.Mon_tensor_mul_one Mon_.Mon_tensor_mul_one
theorem Mon_tensor_mul_assoc (M N : Mon_ C) :
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ±_ (M.X β N.X) (M.X β N.X) (M.X β N.X)).hom β«
(π (M.X β N.X) β tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 =>
|
rw [β tensor_comp, mul_assoc M, mul_assoc N, tensor_comp, tensor_comp]
|
theorem Mon_tensor_mul_assoc (M N : Mon_ C) :
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ±_ (M.X β N.X) (M.X β N.X) (M.X β N.X)).hom β«
(π (M.X β N.X) β tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 =>
|
Mathlib.CategoryTheory.Monoidal.Mon_.429_0.NTUMzhXPwXsmsYt
|
theorem Mon_tensor_mul_assoc (M N : Mon_ C) :
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ±_ (M.X β N.X) (M.X β N.X) (M.X β N.X)).hom β«
(π (M.X β N.X) β tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)
|
Mathlib_CategoryTheory_Monoidal_Mon_
|
case a.a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M N : Mon_ C
| ((M.mul β π M.X) β N.mul β π N.X) β« (M.mul β N.mul)
case a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M N : Mon_ C
| tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β π (M.X β N.X)
case a.a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M N : Mon_ C
| tensor_ΞΌ C (((M.X, N.X) β (M.X, N.X)).1, ((M.X, N.X) β (M.X, N.X)).2) (M.X, N.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))) (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
#align Mon_.one_right_unitor Mon_.one_rightUnitor
variable [BraidedCategory C]
theorem Mon_tensor_one_mul (M N : Mon_ C) :
((Ξ»_ (π_ C)).inv β« (M.one β N.one) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ»_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, one_mul M, one_mul N]
symm
exact tensor_left_unitality C M.X N.X
#align Mon_.Mon_tensor_one_mul Mon_.Mon_tensor_one_mul
theorem Mon_tensor_mul_one (M N : Mon_ C) :
(π (M.X β N.X) β (Ξ»_ (π_ C)).inv β« (M.one β N.one)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ο_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_one M, mul_one N]
symm
exact tensor_right_unitality C M.X N.X
#align Mon_.Mon_tensor_mul_one Mon_.Mon_tensor_mul_one
theorem Mon_tensor_mul_assoc (M N : Mon_ C) :
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ±_ (M.X β N.X) (M.X β N.X) (M.X β N.X)).hom β«
(π (M.X β N.X) β tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 =>
|
rw [β tensor_comp, mul_assoc M, mul_assoc N, tensor_comp, tensor_comp]
|
theorem Mon_tensor_mul_assoc (M N : Mon_ C) :
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ±_ (M.X β N.X) (M.X β N.X) (M.X β N.X)).hom β«
(π (M.X β N.X) β tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 =>
|
Mathlib.CategoryTheory.Monoidal.Mon_.429_0.NTUMzhXPwXsmsYt
|
theorem Mon_tensor_mul_assoc (M N : Mon_ C) :
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ±_ (M.X β N.X) (M.X β N.X) (M.X β N.X)).hom β«
(π (M.X β N.X) β tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)
|
Mathlib_CategoryTheory_Monoidal_Mon_
|
case a.a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M N : Mon_ C
| ((M.mul β π M.X) β N.mul β π N.X) β« (M.mul β N.mul)
case a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M N : Mon_ C
| tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β π (M.X β N.X)
case a.a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M N : Mon_ C
| tensor_ΞΌ C (((M.X, N.X) β (M.X, N.X)).1, ((M.X, N.X) β (M.X, N.X)).2) (M.X, N.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))) (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
#align Mon_.one_right_unitor Mon_.one_rightUnitor
variable [BraidedCategory C]
theorem Mon_tensor_one_mul (M N : Mon_ C) :
((Ξ»_ (π_ C)).inv β« (M.one β N.one) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ»_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, one_mul M, one_mul N]
symm
exact tensor_left_unitality C M.X N.X
#align Mon_.Mon_tensor_one_mul Mon_.Mon_tensor_one_mul
theorem Mon_tensor_mul_one (M N : Mon_ C) :
(π (M.X β N.X) β (Ξ»_ (π_ C)).inv β« (M.one β N.one)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ο_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_one M, mul_one N]
symm
exact tensor_right_unitality C M.X N.X
#align Mon_.Mon_tensor_mul_one Mon_.Mon_tensor_mul_one
theorem Mon_tensor_mul_assoc (M N : Mon_ C) :
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ±_ (M.X β N.X) (M.X β N.X) (M.X β N.X)).hom β«
(π (M.X β N.X) β tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 =>
|
rw [β tensor_comp, mul_assoc M, mul_assoc N, tensor_comp, tensor_comp]
|
theorem Mon_tensor_mul_assoc (M N : Mon_ C) :
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ±_ (M.X β N.X) (M.X β N.X) (M.X β N.X)).hom β«
(π (M.X β N.X) β tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 =>
|
Mathlib.CategoryTheory.Monoidal.Mon_.429_0.NTUMzhXPwXsmsYt
|
theorem Mon_tensor_mul_assoc (M N : Mon_ C) :
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ±_ (M.X β N.X) (M.X β N.X) (M.X β N.X)).hom β«
(π (M.X β N.X) β tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)
|
Mathlib_CategoryTheory_Monoidal_Mon_
|
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M N : Mon_ C
β’ (tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β π (M.X β N.X)) β«
tensor_ΞΌ C (((M.X, N.X) β (M.X, N.X)).1, ((M.X, N.X) β (M.X, N.X)).2) (M.X, N.X) β«
((Ξ±_ M.X M.X M.X).hom β (Ξ±_ N.X N.X N.X).hom) β« ((π M.X β M.mul) β π N.X β N.mul) β« (M.mul β N.mul) =
(Ξ±_ (M.X β N.X) (M.X β N.X) (M.X β N.X)).hom β«
(π (M.X β N.X) β« π (M.X β N.X) β tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.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] }
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
#align Mon_.one_right_unitor Mon_.one_rightUnitor
variable [BraidedCategory C]
theorem Mon_tensor_one_mul (M N : Mon_ C) :
((Ξ»_ (π_ C)).inv β« (M.one β N.one) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ»_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, one_mul M, one_mul N]
symm
exact tensor_left_unitality C M.X N.X
#align Mon_.Mon_tensor_one_mul Mon_.Mon_tensor_one_mul
theorem Mon_tensor_mul_one (M N : Mon_ C) :
(π (M.X β N.X) β (Ξ»_ (π_ C)).inv β« (M.one β N.one)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ο_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_one M, mul_one N]
symm
exact tensor_right_unitality C M.X N.X
#align Mon_.Mon_tensor_mul_one Mon_.Mon_tensor_mul_one
theorem Mon_tensor_mul_assoc (M N : Mon_ C) :
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ±_ (M.X β N.X) (M.X β N.X) (M.X β N.X)).hom β«
(π (M.X β N.X) β tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_assoc M, mul_assoc N, tensor_comp, tensor_comp]
-- Porting note: needed to add `dsimp` here.
|
slice_lhs 1 3 => dsimp; rw [tensor_associativity]
|
theorem Mon_tensor_mul_assoc (M N : Mon_ C) :
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ±_ (M.X β N.X) (M.X β N.X) (M.X β N.X)).hom β«
(π (M.X β N.X) β tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_assoc M, mul_assoc N, tensor_comp, tensor_comp]
-- Porting note: needed to add `dsimp` here.
|
Mathlib.CategoryTheory.Monoidal.Mon_.429_0.NTUMzhXPwXsmsYt
|
theorem Mon_tensor_mul_assoc (M N : Mon_ C) :
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ±_ (M.X β N.X) (M.X β N.X) (M.X β N.X)).hom β«
(π (M.X β N.X) β tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)
|
Mathlib_CategoryTheory_Monoidal_Mon_
|
case a.a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M N : Mon_ C
| (tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β π (M.X β N.X)) β«
tensor_ΞΌ C (((M.X, N.X) β (M.X, N.X)).1, ((M.X, N.X) β (M.X, N.X)).2) (M.X, N.X) β«
((Ξ±_ M.X M.X M.X).hom β (Ξ±_ N.X N.X N.X).hom)
case a.a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M N : Mon_ C
| (π M.X β M.mul) β π N.X β N.mul
case a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M N : Mon_ C
| M.mul β N.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] }
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
#align Mon_.one_right_unitor Mon_.one_rightUnitor
variable [BraidedCategory C]
theorem Mon_tensor_one_mul (M N : Mon_ C) :
((Ξ»_ (π_ C)).inv β« (M.one β N.one) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ»_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, one_mul M, one_mul N]
symm
exact tensor_left_unitality C M.X N.X
#align Mon_.Mon_tensor_one_mul Mon_.Mon_tensor_one_mul
theorem Mon_tensor_mul_one (M N : Mon_ C) :
(π (M.X β N.X) β (Ξ»_ (π_ C)).inv β« (M.one β N.one)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ο_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_one M, mul_one N]
symm
exact tensor_right_unitality C M.X N.X
#align Mon_.Mon_tensor_mul_one Mon_.Mon_tensor_mul_one
theorem Mon_tensor_mul_assoc (M N : Mon_ C) :
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ±_ (M.X β N.X) (M.X β N.X) (M.X β N.X)).hom β«
(π (M.X β N.X) β tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_assoc M, mul_assoc N, tensor_comp, tensor_comp]
-- Porting note: needed to add `dsimp` here.
slice_lhs 1 3 =>
|
dsimp; rw [tensor_associativity]
|
theorem Mon_tensor_mul_assoc (M N : Mon_ C) :
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ±_ (M.X β N.X) (M.X β N.X) (M.X β N.X)).hom β«
(π (M.X β N.X) β tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_assoc M, mul_assoc N, tensor_comp, tensor_comp]
-- Porting note: needed to add `dsimp` here.
slice_lhs 1 3 =>
|
Mathlib.CategoryTheory.Monoidal.Mon_.429_0.NTUMzhXPwXsmsYt
|
theorem Mon_tensor_mul_assoc (M N : Mon_ C) :
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ±_ (M.X β N.X) (M.X β N.X) (M.X β N.X)).hom β«
(π (M.X β N.X) β tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)
|
Mathlib_CategoryTheory_Monoidal_Mon_
|
case a.a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M N : Mon_ C
| (tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β π (M.X β N.X)) β«
tensor_ΞΌ C (((M.X, N.X) β (M.X, N.X)).1, ((M.X, N.X) β (M.X, N.X)).2) (M.X, N.X) β«
((Ξ±_ M.X M.X M.X).hom β (Ξ±_ N.X N.X N.X).hom)
case a.a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M N : Mon_ C
| (π M.X β M.mul) β π N.X β N.mul
case a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M N : Mon_ C
| M.mul β N.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] }
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
#align Mon_.one_right_unitor Mon_.one_rightUnitor
variable [BraidedCategory C]
theorem Mon_tensor_one_mul (M N : Mon_ C) :
((Ξ»_ (π_ C)).inv β« (M.one β N.one) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ»_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, one_mul M, one_mul N]
symm
exact tensor_left_unitality C M.X N.X
#align Mon_.Mon_tensor_one_mul Mon_.Mon_tensor_one_mul
theorem Mon_tensor_mul_one (M N : Mon_ C) :
(π (M.X β N.X) β (Ξ»_ (π_ C)).inv β« (M.one β N.one)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ο_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_one M, mul_one N]
symm
exact tensor_right_unitality C M.X N.X
#align Mon_.Mon_tensor_mul_one Mon_.Mon_tensor_mul_one
theorem Mon_tensor_mul_assoc (M N : Mon_ C) :
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ±_ (M.X β N.X) (M.X β N.X) (M.X β N.X)).hom β«
(π (M.X β N.X) β tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_assoc M, mul_assoc N, tensor_comp, tensor_comp]
-- Porting note: needed to add `dsimp` here.
slice_lhs 1 3 =>
|
dsimp; rw [tensor_associativity]
|
theorem Mon_tensor_mul_assoc (M N : Mon_ C) :
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ±_ (M.X β N.X) (M.X β N.X) (M.X β N.X)).hom β«
(π (M.X β N.X) β tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_assoc M, mul_assoc N, tensor_comp, tensor_comp]
-- Porting note: needed to add `dsimp` here.
slice_lhs 1 3 =>
|
Mathlib.CategoryTheory.Monoidal.Mon_.429_0.NTUMzhXPwXsmsYt
|
theorem Mon_tensor_mul_assoc (M N : Mon_ C) :
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ±_ (M.X β N.X) (M.X β N.X) (M.X β N.X)).hom β«
(π (M.X β N.X) β tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)
|
Mathlib_CategoryTheory_Monoidal_Mon_
|
case a.a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M N : Mon_ C
| (tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β π (M.X β N.X)) β«
tensor_ΞΌ C (((M.X, N.X) β (M.X, N.X)).1, ((M.X, N.X) β (M.X, N.X)).2) (M.X, N.X) β«
((Ξ±_ M.X M.X M.X).hom β (Ξ±_ N.X N.X N.X).hom)
case a.a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M N : Mon_ C
| (π M.X β M.mul) β π N.X β N.mul
case a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M N : Mon_ C
| M.mul β N.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] }
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
#align Mon_.one_right_unitor Mon_.one_rightUnitor
variable [BraidedCategory C]
theorem Mon_tensor_one_mul (M N : Mon_ C) :
((Ξ»_ (π_ C)).inv β« (M.one β N.one) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ»_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, one_mul M, one_mul N]
symm
exact tensor_left_unitality C M.X N.X
#align Mon_.Mon_tensor_one_mul Mon_.Mon_tensor_one_mul
theorem Mon_tensor_mul_one (M N : Mon_ C) :
(π (M.X β N.X) β (Ξ»_ (π_ C)).inv β« (M.one β N.one)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ο_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_one M, mul_one N]
symm
exact tensor_right_unitality C M.X N.X
#align Mon_.Mon_tensor_mul_one Mon_.Mon_tensor_mul_one
theorem Mon_tensor_mul_assoc (M N : Mon_ C) :
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ±_ (M.X β N.X) (M.X β N.X) (M.X β N.X)).hom β«
(π (M.X β N.X) β tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_assoc M, mul_assoc N, tensor_comp, tensor_comp]
-- Porting note: needed to add `dsimp` here.
slice_lhs 1 3 =>
|
dsimp
|
theorem Mon_tensor_mul_assoc (M N : Mon_ C) :
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ±_ (M.X β N.X) (M.X β N.X) (M.X β N.X)).hom β«
(π (M.X β N.X) β tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_assoc M, mul_assoc N, tensor_comp, tensor_comp]
-- Porting note: needed to add `dsimp` here.
slice_lhs 1 3 =>
|
Mathlib.CategoryTheory.Monoidal.Mon_.429_0.NTUMzhXPwXsmsYt
|
theorem Mon_tensor_mul_assoc (M N : Mon_ C) :
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ±_ (M.X β N.X) (M.X β N.X) (M.X β N.X)).hom β«
(π (M.X β N.X) β tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)
|
Mathlib_CategoryTheory_Monoidal_Mon_
|
case a.a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M N : Mon_ C
| (tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X β M.X, N.X β N.X) (M.X, N.X) β« ((Ξ±_ M.X M.X M.X).hom β (Ξ±_ N.X N.X N.X).hom)
case a.a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M N : Mon_ C
| (π M.X β M.mul) β π N.X β N.mul
case a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M N : Mon_ C
| M.mul β N.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] }
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
#align Mon_.one_right_unitor Mon_.one_rightUnitor
variable [BraidedCategory C]
theorem Mon_tensor_one_mul (M N : Mon_ C) :
((Ξ»_ (π_ C)).inv β« (M.one β N.one) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ»_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, one_mul M, one_mul N]
symm
exact tensor_left_unitality C M.X N.X
#align Mon_.Mon_tensor_one_mul Mon_.Mon_tensor_one_mul
theorem Mon_tensor_mul_one (M N : Mon_ C) :
(π (M.X β N.X) β (Ξ»_ (π_ C)).inv β« (M.one β N.one)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ο_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_one M, mul_one N]
symm
exact tensor_right_unitality C M.X N.X
#align Mon_.Mon_tensor_mul_one Mon_.Mon_tensor_mul_one
theorem Mon_tensor_mul_assoc (M N : Mon_ C) :
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ±_ (M.X β N.X) (M.X β N.X) (M.X β N.X)).hom β«
(π (M.X β N.X) β tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_assoc M, mul_assoc N, tensor_comp, tensor_comp]
-- Porting note: needed to add `dsimp` here.
slice_lhs 1 3 => dsimp;
|
rw [tensor_associativity]
|
theorem Mon_tensor_mul_assoc (M N : Mon_ C) :
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ±_ (M.X β N.X) (M.X β N.X) (M.X β N.X)).hom β«
(π (M.X β N.X) β tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_assoc M, mul_assoc N, tensor_comp, tensor_comp]
-- Porting note: needed to add `dsimp` here.
slice_lhs 1 3 => dsimp;
|
Mathlib.CategoryTheory.Monoidal.Mon_.429_0.NTUMzhXPwXsmsYt
|
theorem Mon_tensor_mul_assoc (M N : Mon_ C) :
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ±_ (M.X β N.X) (M.X β N.X) (M.X β N.X)).hom β«
(π (M.X β N.X) β tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)
|
Mathlib_CategoryTheory_Monoidal_Mon_
|
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M N : Mon_ C
β’ (((Ξ±_ (M.X β N.X) (M.X β N.X) (M.X β N.X)).hom β«
(π (M.X β N.X) β tensor_ΞΌ C (M.X, N.X) (M.X, N.X)) β« tensor_ΞΌ C (M.X, N.X) (M.X β M.X, N.X β N.X)) β«
((π M.X β M.mul) β π N.X β N.mul)) β«
(M.mul β N.mul) =
(Ξ±_ (M.X β N.X) (M.X β N.X) (M.X β N.X)).hom β«
(π (M.X β N.X) β« π (M.X β N.X) β tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.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] }
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
#align Mon_.one_right_unitor Mon_.one_rightUnitor
variable [BraidedCategory C]
theorem Mon_tensor_one_mul (M N : Mon_ C) :
((Ξ»_ (π_ C)).inv β« (M.one β N.one) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ»_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, one_mul M, one_mul N]
symm
exact tensor_left_unitality C M.X N.X
#align Mon_.Mon_tensor_one_mul Mon_.Mon_tensor_one_mul
theorem Mon_tensor_mul_one (M N : Mon_ C) :
(π (M.X β N.X) β (Ξ»_ (π_ C)).inv β« (M.one β N.one)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ο_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_one M, mul_one N]
symm
exact tensor_right_unitality C M.X N.X
#align Mon_.Mon_tensor_mul_one Mon_.Mon_tensor_mul_one
theorem Mon_tensor_mul_assoc (M N : Mon_ C) :
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ±_ (M.X β N.X) (M.X β N.X) (M.X β N.X)).hom β«
(π (M.X β N.X) β tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_assoc M, mul_assoc N, tensor_comp, tensor_comp]
-- Porting note: needed to add `dsimp` here.
slice_lhs 1 3 => dsimp; rw [tensor_associativity]
|
slice_lhs 3 4 => rw [β tensor_ΞΌ_natural]
|
theorem Mon_tensor_mul_assoc (M N : Mon_ C) :
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ±_ (M.X β N.X) (M.X β N.X) (M.X β N.X)).hom β«
(π (M.X β N.X) β tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_assoc M, mul_assoc N, tensor_comp, tensor_comp]
-- Porting note: needed to add `dsimp` here.
slice_lhs 1 3 => dsimp; rw [tensor_associativity]
|
Mathlib.CategoryTheory.Monoidal.Mon_.429_0.NTUMzhXPwXsmsYt
|
theorem Mon_tensor_mul_assoc (M N : Mon_ C) :
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ±_ (M.X β N.X) (M.X β N.X) (M.X β N.X)).hom β«
(π (M.X β N.X) β tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)
|
Mathlib_CategoryTheory_Monoidal_Mon_
|
case a.a.a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M N : Mon_ C
| tensor_ΞΌ C (M.X, N.X) (M.X β M.X, N.X β N.X) β« ((π M.X β M.mul) β π N.X β N.mul)
case a.a.a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M N : Mon_ C
| M.mul β N.mul
case a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M N : Mon_ C
| (Ξ±_ (M.X β N.X) (M.X β N.X) (M.X β N.X)).hom
case a.a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M N : Mon_ C
| π (M.X β N.X) β tensor_ΞΌ C (M.X, N.X) (M.X, N.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))) (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
#align Mon_.one_right_unitor Mon_.one_rightUnitor
variable [BraidedCategory C]
theorem Mon_tensor_one_mul (M N : Mon_ C) :
((Ξ»_ (π_ C)).inv β« (M.one β N.one) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ»_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, one_mul M, one_mul N]
symm
exact tensor_left_unitality C M.X N.X
#align Mon_.Mon_tensor_one_mul Mon_.Mon_tensor_one_mul
theorem Mon_tensor_mul_one (M N : Mon_ C) :
(π (M.X β N.X) β (Ξ»_ (π_ C)).inv β« (M.one β N.one)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ο_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_one M, mul_one N]
symm
exact tensor_right_unitality C M.X N.X
#align Mon_.Mon_tensor_mul_one Mon_.Mon_tensor_mul_one
theorem Mon_tensor_mul_assoc (M N : Mon_ C) :
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ±_ (M.X β N.X) (M.X β N.X) (M.X β N.X)).hom β«
(π (M.X β N.X) β tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_assoc M, mul_assoc N, tensor_comp, tensor_comp]
-- Porting note: needed to add `dsimp` here.
slice_lhs 1 3 => dsimp; rw [tensor_associativity]
slice_lhs 3 4 =>
|
rw [β tensor_ΞΌ_natural]
|
theorem Mon_tensor_mul_assoc (M N : Mon_ C) :
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ±_ (M.X β N.X) (M.X β N.X) (M.X β N.X)).hom β«
(π (M.X β N.X) β tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_assoc M, mul_assoc N, tensor_comp, tensor_comp]
-- Porting note: needed to add `dsimp` here.
slice_lhs 1 3 => dsimp; rw [tensor_associativity]
slice_lhs 3 4 =>
|
Mathlib.CategoryTheory.Monoidal.Mon_.429_0.NTUMzhXPwXsmsYt
|
theorem Mon_tensor_mul_assoc (M N : Mon_ C) :
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ±_ (M.X β N.X) (M.X β N.X) (M.X β N.X)).hom β«
(π (M.X β N.X) β tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)
|
Mathlib_CategoryTheory_Monoidal_Mon_
|
case a.a.a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M N : Mon_ C
| tensor_ΞΌ C (M.X, N.X) (M.X β M.X, N.X β N.X) β« ((π M.X β M.mul) β π N.X β N.mul)
case a.a.a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M N : Mon_ C
| M.mul β N.mul
case a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M N : Mon_ C
| (Ξ±_ (M.X β N.X) (M.X β N.X) (M.X β N.X)).hom
case a.a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M N : Mon_ C
| π (M.X β N.X) β tensor_ΞΌ C (M.X, N.X) (M.X, N.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))) (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
#align Mon_.one_right_unitor Mon_.one_rightUnitor
variable [BraidedCategory C]
theorem Mon_tensor_one_mul (M N : Mon_ C) :
((Ξ»_ (π_ C)).inv β« (M.one β N.one) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ»_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, one_mul M, one_mul N]
symm
exact tensor_left_unitality C M.X N.X
#align Mon_.Mon_tensor_one_mul Mon_.Mon_tensor_one_mul
theorem Mon_tensor_mul_one (M N : Mon_ C) :
(π (M.X β N.X) β (Ξ»_ (π_ C)).inv β« (M.one β N.one)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ο_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_one M, mul_one N]
symm
exact tensor_right_unitality C M.X N.X
#align Mon_.Mon_tensor_mul_one Mon_.Mon_tensor_mul_one
theorem Mon_tensor_mul_assoc (M N : Mon_ C) :
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ±_ (M.X β N.X) (M.X β N.X) (M.X β N.X)).hom β«
(π (M.X β N.X) β tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_assoc M, mul_assoc N, tensor_comp, tensor_comp]
-- Porting note: needed to add `dsimp` here.
slice_lhs 1 3 => dsimp; rw [tensor_associativity]
slice_lhs 3 4 =>
|
rw [β tensor_ΞΌ_natural]
|
theorem Mon_tensor_mul_assoc (M N : Mon_ C) :
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ±_ (M.X β N.X) (M.X β N.X) (M.X β N.X)).hom β«
(π (M.X β N.X) β tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_assoc M, mul_assoc N, tensor_comp, tensor_comp]
-- Porting note: needed to add `dsimp` here.
slice_lhs 1 3 => dsimp; rw [tensor_associativity]
slice_lhs 3 4 =>
|
Mathlib.CategoryTheory.Monoidal.Mon_.429_0.NTUMzhXPwXsmsYt
|
theorem Mon_tensor_mul_assoc (M N : Mon_ C) :
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ±_ (M.X β N.X) (M.X β N.X) (M.X β N.X)).hom β«
(π (M.X β N.X) β tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)
|
Mathlib_CategoryTheory_Monoidal_Mon_
|
case a.a.a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M N : Mon_ C
| tensor_ΞΌ C (M.X, N.X) (M.X β M.X, N.X β N.X) β« ((π M.X β M.mul) β π N.X β N.mul)
case a.a.a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M N : Mon_ C
| M.mul β N.mul
case a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M N : Mon_ C
| (Ξ±_ (M.X β N.X) (M.X β N.X) (M.X β N.X)).hom
case a.a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M N : Mon_ C
| π (M.X β N.X) β tensor_ΞΌ C (M.X, N.X) (M.X, N.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))) (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
#align Mon_.one_right_unitor Mon_.one_rightUnitor
variable [BraidedCategory C]
theorem Mon_tensor_one_mul (M N : Mon_ C) :
((Ξ»_ (π_ C)).inv β« (M.one β N.one) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ»_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, one_mul M, one_mul N]
symm
exact tensor_left_unitality C M.X N.X
#align Mon_.Mon_tensor_one_mul Mon_.Mon_tensor_one_mul
theorem Mon_tensor_mul_one (M N : Mon_ C) :
(π (M.X β N.X) β (Ξ»_ (π_ C)).inv β« (M.one β N.one)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ο_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_one M, mul_one N]
symm
exact tensor_right_unitality C M.X N.X
#align Mon_.Mon_tensor_mul_one Mon_.Mon_tensor_mul_one
theorem Mon_tensor_mul_assoc (M N : Mon_ C) :
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ±_ (M.X β N.X) (M.X β N.X) (M.X β N.X)).hom β«
(π (M.X β N.X) β tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_assoc M, mul_assoc N, tensor_comp, tensor_comp]
-- Porting note: needed to add `dsimp` here.
slice_lhs 1 3 => dsimp; rw [tensor_associativity]
slice_lhs 3 4 =>
|
rw [β tensor_ΞΌ_natural]
|
theorem Mon_tensor_mul_assoc (M N : Mon_ C) :
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ±_ (M.X β N.X) (M.X β N.X) (M.X β N.X)).hom β«
(π (M.X β N.X) β tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_assoc M, mul_assoc N, tensor_comp, tensor_comp]
-- Porting note: needed to add `dsimp` here.
slice_lhs 1 3 => dsimp; rw [tensor_associativity]
slice_lhs 3 4 =>
|
Mathlib.CategoryTheory.Monoidal.Mon_.429_0.NTUMzhXPwXsmsYt
|
theorem Mon_tensor_mul_assoc (M N : Mon_ C) :
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ±_ (M.X β N.X) (M.X β N.X) (M.X β N.X)).hom β«
(π (M.X β N.X) β tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)
|
Mathlib_CategoryTheory_Monoidal_Mon_
|
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M N : Mon_ C
β’ (Ξ±_ (M.X β N.X) (M.X β N.X) (M.X β N.X)).hom β«
(π (M.X β N.X) β tensor_ΞΌ C (M.X, N.X) (M.X, N.X)) β«
(((π M.X β π N.X) β M.mul β N.mul) β« tensor_ΞΌ C (M.X, N.X) (M.X, N.X)) β« (M.mul β N.mul) =
(Ξ±_ (M.X β N.X) (M.X β N.X) (M.X β N.X)).hom β«
(π (M.X β N.X) β« π (M.X β N.X) β tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.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] }
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
#align Mon_.one_right_unitor Mon_.one_rightUnitor
variable [BraidedCategory C]
theorem Mon_tensor_one_mul (M N : Mon_ C) :
((Ξ»_ (π_ C)).inv β« (M.one β N.one) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ»_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, one_mul M, one_mul N]
symm
exact tensor_left_unitality C M.X N.X
#align Mon_.Mon_tensor_one_mul Mon_.Mon_tensor_one_mul
theorem Mon_tensor_mul_one (M N : Mon_ C) :
(π (M.X β N.X) β (Ξ»_ (π_ C)).inv β« (M.one β N.one)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ο_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_one M, mul_one N]
symm
exact tensor_right_unitality C M.X N.X
#align Mon_.Mon_tensor_mul_one Mon_.Mon_tensor_mul_one
theorem Mon_tensor_mul_assoc (M N : Mon_ C) :
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ±_ (M.X β N.X) (M.X β N.X) (M.X β N.X)).hom β«
(π (M.X β N.X) β tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_assoc M, mul_assoc N, tensor_comp, tensor_comp]
-- Porting note: needed to add `dsimp` here.
slice_lhs 1 3 => dsimp; rw [tensor_associativity]
slice_lhs 3 4 => rw [β tensor_ΞΌ_natural]
|
slice_lhs 2 3 => rw [β tensor_comp, tensor_id]
|
theorem Mon_tensor_mul_assoc (M N : Mon_ C) :
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ±_ (M.X β N.X) (M.X β N.X) (M.X β N.X)).hom β«
(π (M.X β N.X) β tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_assoc M, mul_assoc N, tensor_comp, tensor_comp]
-- Porting note: needed to add `dsimp` here.
slice_lhs 1 3 => dsimp; rw [tensor_associativity]
slice_lhs 3 4 => rw [β tensor_ΞΌ_natural]
|
Mathlib.CategoryTheory.Monoidal.Mon_.429_0.NTUMzhXPwXsmsYt
|
theorem Mon_tensor_mul_assoc (M N : Mon_ C) :
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ±_ (M.X β N.X) (M.X β N.X) (M.X β N.X)).hom β«
(π (M.X β N.X) β tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)
|
Mathlib_CategoryTheory_Monoidal_Mon_
|
case a.a.a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M N : Mon_ C
| (π (M.X β N.X) β tensor_ΞΌ C (M.X, N.X) (M.X, N.X)) β« ((π M.X β π N.X) β M.mul β N.mul)
case a.a.a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M N : Mon_ C
| tensor_ΞΌ C (M.X, N.X) (M.X, N.X)
case a.a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M N : Mon_ C
| M.mul β N.mul
case a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M N : Mon_ C
| (Ξ±_ (M.X β N.X) (M.X β N.X) (M.X β N.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]
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
#align Mon_.one_right_unitor Mon_.one_rightUnitor
variable [BraidedCategory C]
theorem Mon_tensor_one_mul (M N : Mon_ C) :
((Ξ»_ (π_ C)).inv β« (M.one β N.one) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ»_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, one_mul M, one_mul N]
symm
exact tensor_left_unitality C M.X N.X
#align Mon_.Mon_tensor_one_mul Mon_.Mon_tensor_one_mul
theorem Mon_tensor_mul_one (M N : Mon_ C) :
(π (M.X β N.X) β (Ξ»_ (π_ C)).inv β« (M.one β N.one)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ο_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_one M, mul_one N]
symm
exact tensor_right_unitality C M.X N.X
#align Mon_.Mon_tensor_mul_one Mon_.Mon_tensor_mul_one
theorem Mon_tensor_mul_assoc (M N : Mon_ C) :
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ±_ (M.X β N.X) (M.X β N.X) (M.X β N.X)).hom β«
(π (M.X β N.X) β tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_assoc M, mul_assoc N, tensor_comp, tensor_comp]
-- Porting note: needed to add `dsimp` here.
slice_lhs 1 3 => dsimp; rw [tensor_associativity]
slice_lhs 3 4 => rw [β tensor_ΞΌ_natural]
slice_lhs 2 3 =>
|
rw [β tensor_comp, tensor_id]
|
theorem Mon_tensor_mul_assoc (M N : Mon_ C) :
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ±_ (M.X β N.X) (M.X β N.X) (M.X β N.X)).hom β«
(π (M.X β N.X) β tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_assoc M, mul_assoc N, tensor_comp, tensor_comp]
-- Porting note: needed to add `dsimp` here.
slice_lhs 1 3 => dsimp; rw [tensor_associativity]
slice_lhs 3 4 => rw [β tensor_ΞΌ_natural]
slice_lhs 2 3 =>
|
Mathlib.CategoryTheory.Monoidal.Mon_.429_0.NTUMzhXPwXsmsYt
|
theorem Mon_tensor_mul_assoc (M N : Mon_ C) :
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ±_ (M.X β N.X) (M.X β N.X) (M.X β N.X)).hom β«
(π (M.X β N.X) β tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)
|
Mathlib_CategoryTheory_Monoidal_Mon_
|
case a.a.a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M N : Mon_ C
| (π (M.X β N.X) β tensor_ΞΌ C (M.X, N.X) (M.X, N.X)) β« ((π M.X β π N.X) β M.mul β N.mul)
case a.a.a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M N : Mon_ C
| tensor_ΞΌ C (M.X, N.X) (M.X, N.X)
case a.a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M N : Mon_ C
| M.mul β N.mul
case a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M N : Mon_ C
| (Ξ±_ (M.X β N.X) (M.X β N.X) (M.X β N.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]
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
#align Mon_.one_right_unitor Mon_.one_rightUnitor
variable [BraidedCategory C]
theorem Mon_tensor_one_mul (M N : Mon_ C) :
((Ξ»_ (π_ C)).inv β« (M.one β N.one) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ»_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, one_mul M, one_mul N]
symm
exact tensor_left_unitality C M.X N.X
#align Mon_.Mon_tensor_one_mul Mon_.Mon_tensor_one_mul
theorem Mon_tensor_mul_one (M N : Mon_ C) :
(π (M.X β N.X) β (Ξ»_ (π_ C)).inv β« (M.one β N.one)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ο_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_one M, mul_one N]
symm
exact tensor_right_unitality C M.X N.X
#align Mon_.Mon_tensor_mul_one Mon_.Mon_tensor_mul_one
theorem Mon_tensor_mul_assoc (M N : Mon_ C) :
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ±_ (M.X β N.X) (M.X β N.X) (M.X β N.X)).hom β«
(π (M.X β N.X) β tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_assoc M, mul_assoc N, tensor_comp, tensor_comp]
-- Porting note: needed to add `dsimp` here.
slice_lhs 1 3 => dsimp; rw [tensor_associativity]
slice_lhs 3 4 => rw [β tensor_ΞΌ_natural]
slice_lhs 2 3 =>
|
rw [β tensor_comp, tensor_id]
|
theorem Mon_tensor_mul_assoc (M N : Mon_ C) :
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ±_ (M.X β N.X) (M.X β N.X) (M.X β N.X)).hom β«
(π (M.X β N.X) β tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_assoc M, mul_assoc N, tensor_comp, tensor_comp]
-- Porting note: needed to add `dsimp` here.
slice_lhs 1 3 => dsimp; rw [tensor_associativity]
slice_lhs 3 4 => rw [β tensor_ΞΌ_natural]
slice_lhs 2 3 =>
|
Mathlib.CategoryTheory.Monoidal.Mon_.429_0.NTUMzhXPwXsmsYt
|
theorem Mon_tensor_mul_assoc (M N : Mon_ C) :
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ±_ (M.X β N.X) (M.X β N.X) (M.X β N.X)).hom β«
(π (M.X β N.X) β tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)
|
Mathlib_CategoryTheory_Monoidal_Mon_
|
case a.a.a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M N : Mon_ C
| (π (M.X β N.X) β tensor_ΞΌ C (M.X, N.X) (M.X, N.X)) β« ((π M.X β π N.X) β M.mul β N.mul)
case a.a.a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M N : Mon_ C
| tensor_ΞΌ C (M.X, N.X) (M.X, N.X)
case a.a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M N : Mon_ C
| M.mul β N.mul
case a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M N : Mon_ C
| (Ξ±_ (M.X β N.X) (M.X β N.X) (M.X β N.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]
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
#align Mon_.one_right_unitor Mon_.one_rightUnitor
variable [BraidedCategory C]
theorem Mon_tensor_one_mul (M N : Mon_ C) :
((Ξ»_ (π_ C)).inv β« (M.one β N.one) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ»_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, one_mul M, one_mul N]
symm
exact tensor_left_unitality C M.X N.X
#align Mon_.Mon_tensor_one_mul Mon_.Mon_tensor_one_mul
theorem Mon_tensor_mul_one (M N : Mon_ C) :
(π (M.X β N.X) β (Ξ»_ (π_ C)).inv β« (M.one β N.one)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ο_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_one M, mul_one N]
symm
exact tensor_right_unitality C M.X N.X
#align Mon_.Mon_tensor_mul_one Mon_.Mon_tensor_mul_one
theorem Mon_tensor_mul_assoc (M N : Mon_ C) :
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ±_ (M.X β N.X) (M.X β N.X) (M.X β N.X)).hom β«
(π (M.X β N.X) β tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_assoc M, mul_assoc N, tensor_comp, tensor_comp]
-- Porting note: needed to add `dsimp` here.
slice_lhs 1 3 => dsimp; rw [tensor_associativity]
slice_lhs 3 4 => rw [β tensor_ΞΌ_natural]
slice_lhs 2 3 =>
|
rw [β tensor_comp, tensor_id]
|
theorem Mon_tensor_mul_assoc (M N : Mon_ C) :
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ±_ (M.X β N.X) (M.X β N.X) (M.X β N.X)).hom β«
(π (M.X β N.X) β tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_assoc M, mul_assoc N, tensor_comp, tensor_comp]
-- Porting note: needed to add `dsimp` here.
slice_lhs 1 3 => dsimp; rw [tensor_associativity]
slice_lhs 3 4 => rw [β tensor_ΞΌ_natural]
slice_lhs 2 3 =>
|
Mathlib.CategoryTheory.Monoidal.Mon_.429_0.NTUMzhXPwXsmsYt
|
theorem Mon_tensor_mul_assoc (M N : Mon_ C) :
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ±_ (M.X β N.X) (M.X β N.X) (M.X β N.X)).hom β«
(π (M.X β N.X) β tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)
|
Mathlib_CategoryTheory_Monoidal_Mon_
|
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M N : Mon_ C
β’ (Ξ±_ (M.X β N.X) (M.X β N.X) (M.X β N.X)).hom β«
((π (M.X β N.X) β« π (M.X β N.X) β tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X)) β«
(M.mul β N.mul) =
(Ξ±_ (M.X β N.X) (M.X β N.X) (M.X β N.X)).hom β«
(π (M.X β N.X) β« π (M.X β N.X) β tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.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] }
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
#align Mon_.one_right_unitor Mon_.one_rightUnitor
variable [BraidedCategory C]
theorem Mon_tensor_one_mul (M N : Mon_ C) :
((Ξ»_ (π_ C)).inv β« (M.one β N.one) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ»_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, one_mul M, one_mul N]
symm
exact tensor_left_unitality C M.X N.X
#align Mon_.Mon_tensor_one_mul Mon_.Mon_tensor_one_mul
theorem Mon_tensor_mul_one (M N : Mon_ C) :
(π (M.X β N.X) β (Ξ»_ (π_ C)).inv β« (M.one β N.one)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ο_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_one M, mul_one N]
symm
exact tensor_right_unitality C M.X N.X
#align Mon_.Mon_tensor_mul_one Mon_.Mon_tensor_mul_one
theorem Mon_tensor_mul_assoc (M N : Mon_ C) :
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ±_ (M.X β N.X) (M.X β N.X) (M.X β N.X)).hom β«
(π (M.X β N.X) β tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_assoc M, mul_assoc N, tensor_comp, tensor_comp]
-- Porting note: needed to add `dsimp` here.
slice_lhs 1 3 => dsimp; rw [tensor_associativity]
slice_lhs 3 4 => rw [β tensor_ΞΌ_natural]
slice_lhs 2 3 => rw [β tensor_comp, tensor_id]
|
simp only [Category.assoc]
|
theorem Mon_tensor_mul_assoc (M N : Mon_ C) :
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ±_ (M.X β N.X) (M.X β N.X) (M.X β N.X)).hom β«
(π (M.X β N.X) β tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_assoc M, mul_assoc N, tensor_comp, tensor_comp]
-- Porting note: needed to add `dsimp` here.
slice_lhs 1 3 => dsimp; rw [tensor_associativity]
slice_lhs 3 4 => rw [β tensor_ΞΌ_natural]
slice_lhs 2 3 => rw [β tensor_comp, tensor_id]
|
Mathlib.CategoryTheory.Monoidal.Mon_.429_0.NTUMzhXPwXsmsYt
|
theorem Mon_tensor_mul_assoc (M N : Mon_ C) :
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ±_ (M.X β N.X) (M.X β N.X) (M.X β N.X)).hom β«
(π (M.X β N.X) β tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)
|
Mathlib_CategoryTheory_Monoidal_Mon_
|
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M N P : Mon_ C
β’ (tensor_ΞΌ C (M.X β N.X, P.X) (M.X β N.X, P.X) β« (tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β P.mul)) β«
(Ξ±_ M.X N.X P.X).hom =
((Ξ±_ M.X N.X P.X).hom β (Ξ±_ M.X N.X P.X).hom) β«
tensor_ΞΌ C (M.X, N.X β P.X) (M.X, N.X β P.X) β« (M.mul β tensor_ΞΌ C (N.X, P.X) (N.X, P.X) β« (N.mul β P.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] }
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
#align Mon_.one_right_unitor Mon_.one_rightUnitor
variable [BraidedCategory C]
theorem Mon_tensor_one_mul (M N : Mon_ C) :
((Ξ»_ (π_ C)).inv β« (M.one β N.one) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ»_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, one_mul M, one_mul N]
symm
exact tensor_left_unitality C M.X N.X
#align Mon_.Mon_tensor_one_mul Mon_.Mon_tensor_one_mul
theorem Mon_tensor_mul_one (M N : Mon_ C) :
(π (M.X β N.X) β (Ξ»_ (π_ C)).inv β« (M.one β N.one)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ο_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_one M, mul_one N]
symm
exact tensor_right_unitality C M.X N.X
#align Mon_.Mon_tensor_mul_one Mon_.Mon_tensor_mul_one
theorem Mon_tensor_mul_assoc (M N : Mon_ C) :
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ±_ (M.X β N.X) (M.X β N.X) (M.X β N.X)).hom β«
(π (M.X β N.X) β tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_assoc M, mul_assoc N, tensor_comp, tensor_comp]
-- Porting note: needed to add `dsimp` here.
slice_lhs 1 3 => dsimp; rw [tensor_associativity]
slice_lhs 3 4 => rw [β tensor_ΞΌ_natural]
slice_lhs 2 3 => rw [β tensor_comp, tensor_id]
simp only [Category.assoc]
#align Mon_.Mon_tensor_mul_assoc Mon_.Mon_tensor_mul_assoc
theorem mul_associator {M N P : Mon_ C} :
(tensor_ΞΌ C (M.X β N.X, P.X) (M.X β N.X, P.X) β«
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β P.mul)) β«
(Ξ±_ M.X N.X P.X).hom =
((Ξ±_ M.X N.X P.X).hom β (Ξ±_ M.X N.X P.X).hom) β«
tensor_ΞΌ C (M.X, N.X β P.X) (M.X, N.X β P.X) β«
(M.mul β tensor_ΞΌ C (N.X, P.X) (N.X, P.X) β« (N.mul β P.mul)) := by
|
simp only [tensor_obj, prodMonoidal_tensorObj, Category.assoc]
|
theorem mul_associator {M N P : Mon_ C} :
(tensor_ΞΌ C (M.X β N.X, P.X) (M.X β N.X, P.X) β«
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β P.mul)) β«
(Ξ±_ M.X N.X P.X).hom =
((Ξ±_ M.X N.X P.X).hom β (Ξ±_ M.X N.X P.X).hom) β«
tensor_ΞΌ C (M.X, N.X β P.X) (M.X, N.X β P.X) β«
(M.mul β tensor_ΞΌ C (N.X, P.X) (N.X, P.X) β« (N.mul β P.mul)) := by
|
Mathlib.CategoryTheory.Monoidal.Mon_.445_0.NTUMzhXPwXsmsYt
|
theorem mul_associator {M N P : Mon_ C} :
(tensor_ΞΌ C (M.X β N.X, P.X) (M.X β N.X, P.X) β«
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β P.mul)) β«
(Ξ±_ M.X N.X P.X).hom =
((Ξ±_ M.X N.X P.X).hom β (Ξ±_ M.X N.X P.X).hom) β«
tensor_ΞΌ C (M.X, N.X β P.X) (M.X, N.X β P.X) β«
(M.mul β tensor_ΞΌ C (N.X, P.X) (N.X, P.X) β« (N.mul β P.mul))
|
Mathlib_CategoryTheory_Monoidal_Mon_
|
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M N P : Mon_ C
β’ tensor_ΞΌ C (M.X β N.X, P.X) (M.X β N.X, P.X) β«
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β P.mul) β« (Ξ±_ M.X N.X P.X).hom =
((Ξ±_ M.X N.X P.X).hom β (Ξ±_ M.X N.X P.X).hom) β«
tensor_ΞΌ C (M.X, N.X β P.X) (M.X, N.X β P.X) β« (M.mul β tensor_ΞΌ C (N.X, P.X) (N.X, P.X) β« (N.mul β P.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] }
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
#align Mon_.one_right_unitor Mon_.one_rightUnitor
variable [BraidedCategory C]
theorem Mon_tensor_one_mul (M N : Mon_ C) :
((Ξ»_ (π_ C)).inv β« (M.one β N.one) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ»_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, one_mul M, one_mul N]
symm
exact tensor_left_unitality C M.X N.X
#align Mon_.Mon_tensor_one_mul Mon_.Mon_tensor_one_mul
theorem Mon_tensor_mul_one (M N : Mon_ C) :
(π (M.X β N.X) β (Ξ»_ (π_ C)).inv β« (M.one β N.one)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ο_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_one M, mul_one N]
symm
exact tensor_right_unitality C M.X N.X
#align Mon_.Mon_tensor_mul_one Mon_.Mon_tensor_mul_one
theorem Mon_tensor_mul_assoc (M N : Mon_ C) :
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ±_ (M.X β N.X) (M.X β N.X) (M.X β N.X)).hom β«
(π (M.X β N.X) β tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_assoc M, mul_assoc N, tensor_comp, tensor_comp]
-- Porting note: needed to add `dsimp` here.
slice_lhs 1 3 => dsimp; rw [tensor_associativity]
slice_lhs 3 4 => rw [β tensor_ΞΌ_natural]
slice_lhs 2 3 => rw [β tensor_comp, tensor_id]
simp only [Category.assoc]
#align Mon_.Mon_tensor_mul_assoc Mon_.Mon_tensor_mul_assoc
theorem mul_associator {M N P : Mon_ C} :
(tensor_ΞΌ C (M.X β N.X, P.X) (M.X β N.X, P.X) β«
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β P.mul)) β«
(Ξ±_ M.X N.X P.X).hom =
((Ξ±_ M.X N.X P.X).hom β (Ξ±_ M.X N.X P.X).hom) β«
tensor_ΞΌ C (M.X, N.X β P.X) (M.X, N.X β P.X) β«
(M.mul β tensor_ΞΌ C (N.X, P.X) (N.X, P.X) β« (N.mul β P.mul)) := by
simp only [tensor_obj, prodMonoidal_tensorObj, Category.assoc]
|
slice_lhs 2 3 => rw [β Category.id_comp P.mul, tensor_comp]
|
theorem mul_associator {M N P : Mon_ C} :
(tensor_ΞΌ C (M.X β N.X, P.X) (M.X β N.X, P.X) β«
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β P.mul)) β«
(Ξ±_ M.X N.X P.X).hom =
((Ξ±_ M.X N.X P.X).hom β (Ξ±_ M.X N.X P.X).hom) β«
tensor_ΞΌ C (M.X, N.X β P.X) (M.X, N.X β P.X) β«
(M.mul β tensor_ΞΌ C (N.X, P.X) (N.X, P.X) β« (N.mul β P.mul)) := by
simp only [tensor_obj, prodMonoidal_tensorObj, Category.assoc]
|
Mathlib.CategoryTheory.Monoidal.Mon_.445_0.NTUMzhXPwXsmsYt
|
theorem mul_associator {M N P : Mon_ C} :
(tensor_ΞΌ C (M.X β N.X, P.X) (M.X β N.X, P.X) β«
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β P.mul)) β«
(Ξ±_ M.X N.X P.X).hom =
((Ξ±_ M.X N.X P.X).hom β (Ξ±_ M.X N.X P.X).hom) β«
tensor_ΞΌ C (M.X, N.X β P.X) (M.X, N.X β P.X) β«
(M.mul β tensor_ΞΌ C (N.X, P.X) (N.X, P.X) β« (N.mul β P.mul))
|
Mathlib_CategoryTheory_Monoidal_Mon_
|
case a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M N P : Mon_ C
| (tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β P.mul) β« (Ξ±_ M.X N.X P.X).hom
case a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M N P : Mon_ C
| tensor_ΞΌ C (M.X β N.X, P.X) (M.X β N.X, P.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))) (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
#align Mon_.one_right_unitor Mon_.one_rightUnitor
variable [BraidedCategory C]
theorem Mon_tensor_one_mul (M N : Mon_ C) :
((Ξ»_ (π_ C)).inv β« (M.one β N.one) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ»_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, one_mul M, one_mul N]
symm
exact tensor_left_unitality C M.X N.X
#align Mon_.Mon_tensor_one_mul Mon_.Mon_tensor_one_mul
theorem Mon_tensor_mul_one (M N : Mon_ C) :
(π (M.X β N.X) β (Ξ»_ (π_ C)).inv β« (M.one β N.one)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ο_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_one M, mul_one N]
symm
exact tensor_right_unitality C M.X N.X
#align Mon_.Mon_tensor_mul_one Mon_.Mon_tensor_mul_one
theorem Mon_tensor_mul_assoc (M N : Mon_ C) :
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ±_ (M.X β N.X) (M.X β N.X) (M.X β N.X)).hom β«
(π (M.X β N.X) β tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_assoc M, mul_assoc N, tensor_comp, tensor_comp]
-- Porting note: needed to add `dsimp` here.
slice_lhs 1 3 => dsimp; rw [tensor_associativity]
slice_lhs 3 4 => rw [β tensor_ΞΌ_natural]
slice_lhs 2 3 => rw [β tensor_comp, tensor_id]
simp only [Category.assoc]
#align Mon_.Mon_tensor_mul_assoc Mon_.Mon_tensor_mul_assoc
theorem mul_associator {M N P : Mon_ C} :
(tensor_ΞΌ C (M.X β N.X, P.X) (M.X β N.X, P.X) β«
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β P.mul)) β«
(Ξ±_ M.X N.X P.X).hom =
((Ξ±_ M.X N.X P.X).hom β (Ξ±_ M.X N.X P.X).hom) β«
tensor_ΞΌ C (M.X, N.X β P.X) (M.X, N.X β P.X) β«
(M.mul β tensor_ΞΌ C (N.X, P.X) (N.X, P.X) β« (N.mul β P.mul)) := by
simp only [tensor_obj, prodMonoidal_tensorObj, Category.assoc]
slice_lhs 2 3 =>
|
rw [β Category.id_comp P.mul, tensor_comp]
|
theorem mul_associator {M N P : Mon_ C} :
(tensor_ΞΌ C (M.X β N.X, P.X) (M.X β N.X, P.X) β«
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β P.mul)) β«
(Ξ±_ M.X N.X P.X).hom =
((Ξ±_ M.X N.X P.X).hom β (Ξ±_ M.X N.X P.X).hom) β«
tensor_ΞΌ C (M.X, N.X β P.X) (M.X, N.X β P.X) β«
(M.mul β tensor_ΞΌ C (N.X, P.X) (N.X, P.X) β« (N.mul β P.mul)) := by
simp only [tensor_obj, prodMonoidal_tensorObj, Category.assoc]
slice_lhs 2 3 =>
|
Mathlib.CategoryTheory.Monoidal.Mon_.445_0.NTUMzhXPwXsmsYt
|
theorem mul_associator {M N P : Mon_ C} :
(tensor_ΞΌ C (M.X β N.X, P.X) (M.X β N.X, P.X) β«
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β P.mul)) β«
(Ξ±_ M.X N.X P.X).hom =
((Ξ±_ M.X N.X P.X).hom β (Ξ±_ M.X N.X P.X).hom) β«
tensor_ΞΌ C (M.X, N.X β P.X) (M.X, N.X β P.X) β«
(M.mul β tensor_ΞΌ C (N.X, P.X) (N.X, P.X) β« (N.mul β P.mul))
|
Mathlib_CategoryTheory_Monoidal_Mon_
|
case a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M N P : Mon_ C
| (tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β P.mul) β« (Ξ±_ M.X N.X P.X).hom
case a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M N P : Mon_ C
| tensor_ΞΌ C (M.X β N.X, P.X) (M.X β N.X, P.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))) (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
#align Mon_.one_right_unitor Mon_.one_rightUnitor
variable [BraidedCategory C]
theorem Mon_tensor_one_mul (M N : Mon_ C) :
((Ξ»_ (π_ C)).inv β« (M.one β N.one) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ»_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, one_mul M, one_mul N]
symm
exact tensor_left_unitality C M.X N.X
#align Mon_.Mon_tensor_one_mul Mon_.Mon_tensor_one_mul
theorem Mon_tensor_mul_one (M N : Mon_ C) :
(π (M.X β N.X) β (Ξ»_ (π_ C)).inv β« (M.one β N.one)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ο_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_one M, mul_one N]
symm
exact tensor_right_unitality C M.X N.X
#align Mon_.Mon_tensor_mul_one Mon_.Mon_tensor_mul_one
theorem Mon_tensor_mul_assoc (M N : Mon_ C) :
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ±_ (M.X β N.X) (M.X β N.X) (M.X β N.X)).hom β«
(π (M.X β N.X) β tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_assoc M, mul_assoc N, tensor_comp, tensor_comp]
-- Porting note: needed to add `dsimp` here.
slice_lhs 1 3 => dsimp; rw [tensor_associativity]
slice_lhs 3 4 => rw [β tensor_ΞΌ_natural]
slice_lhs 2 3 => rw [β tensor_comp, tensor_id]
simp only [Category.assoc]
#align Mon_.Mon_tensor_mul_assoc Mon_.Mon_tensor_mul_assoc
theorem mul_associator {M N P : Mon_ C} :
(tensor_ΞΌ C (M.X β N.X, P.X) (M.X β N.X, P.X) β«
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β P.mul)) β«
(Ξ±_ M.X N.X P.X).hom =
((Ξ±_ M.X N.X P.X).hom β (Ξ±_ M.X N.X P.X).hom) β«
tensor_ΞΌ C (M.X, N.X β P.X) (M.X, N.X β P.X) β«
(M.mul β tensor_ΞΌ C (N.X, P.X) (N.X, P.X) β« (N.mul β P.mul)) := by
simp only [tensor_obj, prodMonoidal_tensorObj, Category.assoc]
slice_lhs 2 3 =>
|
rw [β Category.id_comp P.mul, tensor_comp]
|
theorem mul_associator {M N P : Mon_ C} :
(tensor_ΞΌ C (M.X β N.X, P.X) (M.X β N.X, P.X) β«
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β P.mul)) β«
(Ξ±_ M.X N.X P.X).hom =
((Ξ±_ M.X N.X P.X).hom β (Ξ±_ M.X N.X P.X).hom) β«
tensor_ΞΌ C (M.X, N.X β P.X) (M.X, N.X β P.X) β«
(M.mul β tensor_ΞΌ C (N.X, P.X) (N.X, P.X) β« (N.mul β P.mul)) := by
simp only [tensor_obj, prodMonoidal_tensorObj, Category.assoc]
slice_lhs 2 3 =>
|
Mathlib.CategoryTheory.Monoidal.Mon_.445_0.NTUMzhXPwXsmsYt
|
theorem mul_associator {M N P : Mon_ C} :
(tensor_ΞΌ C (M.X β N.X, P.X) (M.X β N.X, P.X) β«
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β P.mul)) β«
(Ξ±_ M.X N.X P.X).hom =
((Ξ±_ M.X N.X P.X).hom β (Ξ±_ M.X N.X P.X).hom) β«
tensor_ΞΌ C (M.X, N.X β P.X) (M.X, N.X β P.X) β«
(M.mul β tensor_ΞΌ C (N.X, P.X) (N.X, P.X) β« (N.mul β P.mul))
|
Mathlib_CategoryTheory_Monoidal_Mon_
|
case a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M N P : Mon_ C
| (tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β P.mul) β« (Ξ±_ M.X N.X P.X).hom
case a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M N P : Mon_ C
| tensor_ΞΌ C (M.X β N.X, P.X) (M.X β N.X, P.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))) (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
#align Mon_.one_right_unitor Mon_.one_rightUnitor
variable [BraidedCategory C]
theorem Mon_tensor_one_mul (M N : Mon_ C) :
((Ξ»_ (π_ C)).inv β« (M.one β N.one) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ»_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, one_mul M, one_mul N]
symm
exact tensor_left_unitality C M.X N.X
#align Mon_.Mon_tensor_one_mul Mon_.Mon_tensor_one_mul
theorem Mon_tensor_mul_one (M N : Mon_ C) :
(π (M.X β N.X) β (Ξ»_ (π_ C)).inv β« (M.one β N.one)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ο_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_one M, mul_one N]
symm
exact tensor_right_unitality C M.X N.X
#align Mon_.Mon_tensor_mul_one Mon_.Mon_tensor_mul_one
theorem Mon_tensor_mul_assoc (M N : Mon_ C) :
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ±_ (M.X β N.X) (M.X β N.X) (M.X β N.X)).hom β«
(π (M.X β N.X) β tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_assoc M, mul_assoc N, tensor_comp, tensor_comp]
-- Porting note: needed to add `dsimp` here.
slice_lhs 1 3 => dsimp; rw [tensor_associativity]
slice_lhs 3 4 => rw [β tensor_ΞΌ_natural]
slice_lhs 2 3 => rw [β tensor_comp, tensor_id]
simp only [Category.assoc]
#align Mon_.Mon_tensor_mul_assoc Mon_.Mon_tensor_mul_assoc
theorem mul_associator {M N P : Mon_ C} :
(tensor_ΞΌ C (M.X β N.X, P.X) (M.X β N.X, P.X) β«
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β P.mul)) β«
(Ξ±_ M.X N.X P.X).hom =
((Ξ±_ M.X N.X P.X).hom β (Ξ±_ M.X N.X P.X).hom) β«
tensor_ΞΌ C (M.X, N.X β P.X) (M.X, N.X β P.X) β«
(M.mul β tensor_ΞΌ C (N.X, P.X) (N.X, P.X) β« (N.mul β P.mul)) := by
simp only [tensor_obj, prodMonoidal_tensorObj, Category.assoc]
slice_lhs 2 3 =>
|
rw [β Category.id_comp P.mul, tensor_comp]
|
theorem mul_associator {M N P : Mon_ C} :
(tensor_ΞΌ C (M.X β N.X, P.X) (M.X β N.X, P.X) β«
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β P.mul)) β«
(Ξ±_ M.X N.X P.X).hom =
((Ξ±_ M.X N.X P.X).hom β (Ξ±_ M.X N.X P.X).hom) β«
tensor_ΞΌ C (M.X, N.X β P.X) (M.X, N.X β P.X) β«
(M.mul β tensor_ΞΌ C (N.X, P.X) (N.X, P.X) β« (N.mul β P.mul)) := by
simp only [tensor_obj, prodMonoidal_tensorObj, Category.assoc]
slice_lhs 2 3 =>
|
Mathlib.CategoryTheory.Monoidal.Mon_.445_0.NTUMzhXPwXsmsYt
|
theorem mul_associator {M N P : Mon_ C} :
(tensor_ΞΌ C (M.X β N.X, P.X) (M.X β N.X, P.X) β«
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β P.mul)) β«
(Ξ±_ M.X N.X P.X).hom =
((Ξ±_ M.X N.X P.X).hom β (Ξ±_ M.X N.X P.X).hom) β«
tensor_ΞΌ C (M.X, N.X β P.X) (M.X, N.X β P.X) β«
(M.mul β tensor_ΞΌ C (N.X, P.X) (N.X, P.X) β« (N.mul β P.mul))
|
Mathlib_CategoryTheory_Monoidal_Mon_
|
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M N P : Mon_ C
β’ tensor_ΞΌ C (M.X β N.X, P.X) (M.X β N.X, P.X) β«
((tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β π (P.X β P.X)) β« ((M.mul β N.mul) β P.mul)) β« (Ξ±_ M.X N.X P.X).hom =
((Ξ±_ M.X N.X P.X).hom β (Ξ±_ M.X N.X P.X).hom) β«
tensor_ΞΌ C (M.X, N.X β P.X) (M.X, N.X β P.X) β« (M.mul β tensor_ΞΌ C (N.X, P.X) (N.X, P.X) β« (N.mul β P.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] }
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
#align Mon_.one_right_unitor Mon_.one_rightUnitor
variable [BraidedCategory C]
theorem Mon_tensor_one_mul (M N : Mon_ C) :
((Ξ»_ (π_ C)).inv β« (M.one β N.one) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ»_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, one_mul M, one_mul N]
symm
exact tensor_left_unitality C M.X N.X
#align Mon_.Mon_tensor_one_mul Mon_.Mon_tensor_one_mul
theorem Mon_tensor_mul_one (M N : Mon_ C) :
(π (M.X β N.X) β (Ξ»_ (π_ C)).inv β« (M.one β N.one)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ο_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_one M, mul_one N]
symm
exact tensor_right_unitality C M.X N.X
#align Mon_.Mon_tensor_mul_one Mon_.Mon_tensor_mul_one
theorem Mon_tensor_mul_assoc (M N : Mon_ C) :
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ±_ (M.X β N.X) (M.X β N.X) (M.X β N.X)).hom β«
(π (M.X β N.X) β tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_assoc M, mul_assoc N, tensor_comp, tensor_comp]
-- Porting note: needed to add `dsimp` here.
slice_lhs 1 3 => dsimp; rw [tensor_associativity]
slice_lhs 3 4 => rw [β tensor_ΞΌ_natural]
slice_lhs 2 3 => rw [β tensor_comp, tensor_id]
simp only [Category.assoc]
#align Mon_.Mon_tensor_mul_assoc Mon_.Mon_tensor_mul_assoc
theorem mul_associator {M N P : Mon_ C} :
(tensor_ΞΌ C (M.X β N.X, P.X) (M.X β N.X, P.X) β«
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β P.mul)) β«
(Ξ±_ M.X N.X P.X).hom =
((Ξ±_ M.X N.X P.X).hom β (Ξ±_ M.X N.X P.X).hom) β«
tensor_ΞΌ C (M.X, N.X β P.X) (M.X, N.X β P.X) β«
(M.mul β tensor_ΞΌ C (N.X, P.X) (N.X, P.X) β« (N.mul β P.mul)) := by
simp only [tensor_obj, prodMonoidal_tensorObj, Category.assoc]
slice_lhs 2 3 => rw [β Category.id_comp P.mul, tensor_comp]
|
slice_lhs 3 4 => rw [associator_naturality]
|
theorem mul_associator {M N P : Mon_ C} :
(tensor_ΞΌ C (M.X β N.X, P.X) (M.X β N.X, P.X) β«
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β P.mul)) β«
(Ξ±_ M.X N.X P.X).hom =
((Ξ±_ M.X N.X P.X).hom β (Ξ±_ M.X N.X P.X).hom) β«
tensor_ΞΌ C (M.X, N.X β P.X) (M.X, N.X β P.X) β«
(M.mul β tensor_ΞΌ C (N.X, P.X) (N.X, P.X) β« (N.mul β P.mul)) := by
simp only [tensor_obj, prodMonoidal_tensorObj, Category.assoc]
slice_lhs 2 3 => rw [β Category.id_comp P.mul, tensor_comp]
|
Mathlib.CategoryTheory.Monoidal.Mon_.445_0.NTUMzhXPwXsmsYt
|
theorem mul_associator {M N P : Mon_ C} :
(tensor_ΞΌ C (M.X β N.X, P.X) (M.X β N.X, P.X) β«
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β P.mul)) β«
(Ξ±_ M.X N.X P.X).hom =
((Ξ±_ M.X N.X P.X).hom β (Ξ±_ M.X N.X P.X).hom) β«
tensor_ΞΌ C (M.X, N.X β P.X) (M.X, N.X β P.X) β«
(M.mul β tensor_ΞΌ C (N.X, P.X) (N.X, P.X) β« (N.mul β P.mul))
|
Mathlib_CategoryTheory_Monoidal_Mon_
|
case a.a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M N P : Mon_ C
| ((M.mul β N.mul) β P.mul) β« (Ξ±_ M.X N.X P.X).hom
case a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M N P : Mon_ C
| tensor_ΞΌ C (M.X β N.X, P.X) (M.X β N.X, P.X)
case a.a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M N P : Mon_ C
| tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β π (P.X β P.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))) (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
#align Mon_.one_right_unitor Mon_.one_rightUnitor
variable [BraidedCategory C]
theorem Mon_tensor_one_mul (M N : Mon_ C) :
((Ξ»_ (π_ C)).inv β« (M.one β N.one) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ»_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, one_mul M, one_mul N]
symm
exact tensor_left_unitality C M.X N.X
#align Mon_.Mon_tensor_one_mul Mon_.Mon_tensor_one_mul
theorem Mon_tensor_mul_one (M N : Mon_ C) :
(π (M.X β N.X) β (Ξ»_ (π_ C)).inv β« (M.one β N.one)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ο_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_one M, mul_one N]
symm
exact tensor_right_unitality C M.X N.X
#align Mon_.Mon_tensor_mul_one Mon_.Mon_tensor_mul_one
theorem Mon_tensor_mul_assoc (M N : Mon_ C) :
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ±_ (M.X β N.X) (M.X β N.X) (M.X β N.X)).hom β«
(π (M.X β N.X) β tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_assoc M, mul_assoc N, tensor_comp, tensor_comp]
-- Porting note: needed to add `dsimp` here.
slice_lhs 1 3 => dsimp; rw [tensor_associativity]
slice_lhs 3 4 => rw [β tensor_ΞΌ_natural]
slice_lhs 2 3 => rw [β tensor_comp, tensor_id]
simp only [Category.assoc]
#align Mon_.Mon_tensor_mul_assoc Mon_.Mon_tensor_mul_assoc
theorem mul_associator {M N P : Mon_ C} :
(tensor_ΞΌ C (M.X β N.X, P.X) (M.X β N.X, P.X) β«
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β P.mul)) β«
(Ξ±_ M.X N.X P.X).hom =
((Ξ±_ M.X N.X P.X).hom β (Ξ±_ M.X N.X P.X).hom) β«
tensor_ΞΌ C (M.X, N.X β P.X) (M.X, N.X β P.X) β«
(M.mul β tensor_ΞΌ C (N.X, P.X) (N.X, P.X) β« (N.mul β P.mul)) := by
simp only [tensor_obj, prodMonoidal_tensorObj, Category.assoc]
slice_lhs 2 3 => rw [β Category.id_comp P.mul, tensor_comp]
slice_lhs 3 4 =>
|
rw [associator_naturality]
|
theorem mul_associator {M N P : Mon_ C} :
(tensor_ΞΌ C (M.X β N.X, P.X) (M.X β N.X, P.X) β«
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β P.mul)) β«
(Ξ±_ M.X N.X P.X).hom =
((Ξ±_ M.X N.X P.X).hom β (Ξ±_ M.X N.X P.X).hom) β«
tensor_ΞΌ C (M.X, N.X β P.X) (M.X, N.X β P.X) β«
(M.mul β tensor_ΞΌ C (N.X, P.X) (N.X, P.X) β« (N.mul β P.mul)) := by
simp only [tensor_obj, prodMonoidal_tensorObj, Category.assoc]
slice_lhs 2 3 => rw [β Category.id_comp P.mul, tensor_comp]
slice_lhs 3 4 =>
|
Mathlib.CategoryTheory.Monoidal.Mon_.445_0.NTUMzhXPwXsmsYt
|
theorem mul_associator {M N P : Mon_ C} :
(tensor_ΞΌ C (M.X β N.X, P.X) (M.X β N.X, P.X) β«
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β P.mul)) β«
(Ξ±_ M.X N.X P.X).hom =
((Ξ±_ M.X N.X P.X).hom β (Ξ±_ M.X N.X P.X).hom) β«
tensor_ΞΌ C (M.X, N.X β P.X) (M.X, N.X β P.X) β«
(M.mul β tensor_ΞΌ C (N.X, P.X) (N.X, P.X) β« (N.mul β P.mul))
|
Mathlib_CategoryTheory_Monoidal_Mon_
|
case a.a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M N P : Mon_ C
| ((M.mul β N.mul) β P.mul) β« (Ξ±_ M.X N.X P.X).hom
case a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M N P : Mon_ C
| tensor_ΞΌ C (M.X β N.X, P.X) (M.X β N.X, P.X)
case a.a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M N P : Mon_ C
| tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β π (P.X β P.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))) (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
#align Mon_.one_right_unitor Mon_.one_rightUnitor
variable [BraidedCategory C]
theorem Mon_tensor_one_mul (M N : Mon_ C) :
((Ξ»_ (π_ C)).inv β« (M.one β N.one) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ»_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, one_mul M, one_mul N]
symm
exact tensor_left_unitality C M.X N.X
#align Mon_.Mon_tensor_one_mul Mon_.Mon_tensor_one_mul
theorem Mon_tensor_mul_one (M N : Mon_ C) :
(π (M.X β N.X) β (Ξ»_ (π_ C)).inv β« (M.one β N.one)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ο_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_one M, mul_one N]
symm
exact tensor_right_unitality C M.X N.X
#align Mon_.Mon_tensor_mul_one Mon_.Mon_tensor_mul_one
theorem Mon_tensor_mul_assoc (M N : Mon_ C) :
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ±_ (M.X β N.X) (M.X β N.X) (M.X β N.X)).hom β«
(π (M.X β N.X) β tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_assoc M, mul_assoc N, tensor_comp, tensor_comp]
-- Porting note: needed to add `dsimp` here.
slice_lhs 1 3 => dsimp; rw [tensor_associativity]
slice_lhs 3 4 => rw [β tensor_ΞΌ_natural]
slice_lhs 2 3 => rw [β tensor_comp, tensor_id]
simp only [Category.assoc]
#align Mon_.Mon_tensor_mul_assoc Mon_.Mon_tensor_mul_assoc
theorem mul_associator {M N P : Mon_ C} :
(tensor_ΞΌ C (M.X β N.X, P.X) (M.X β N.X, P.X) β«
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β P.mul)) β«
(Ξ±_ M.X N.X P.X).hom =
((Ξ±_ M.X N.X P.X).hom β (Ξ±_ M.X N.X P.X).hom) β«
tensor_ΞΌ C (M.X, N.X β P.X) (M.X, N.X β P.X) β«
(M.mul β tensor_ΞΌ C (N.X, P.X) (N.X, P.X) β« (N.mul β P.mul)) := by
simp only [tensor_obj, prodMonoidal_tensorObj, Category.assoc]
slice_lhs 2 3 => rw [β Category.id_comp P.mul, tensor_comp]
slice_lhs 3 4 =>
|
rw [associator_naturality]
|
theorem mul_associator {M N P : Mon_ C} :
(tensor_ΞΌ C (M.X β N.X, P.X) (M.X β N.X, P.X) β«
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β P.mul)) β«
(Ξ±_ M.X N.X P.X).hom =
((Ξ±_ M.X N.X P.X).hom β (Ξ±_ M.X N.X P.X).hom) β«
tensor_ΞΌ C (M.X, N.X β P.X) (M.X, N.X β P.X) β«
(M.mul β tensor_ΞΌ C (N.X, P.X) (N.X, P.X) β« (N.mul β P.mul)) := by
simp only [tensor_obj, prodMonoidal_tensorObj, Category.assoc]
slice_lhs 2 3 => rw [β Category.id_comp P.mul, tensor_comp]
slice_lhs 3 4 =>
|
Mathlib.CategoryTheory.Monoidal.Mon_.445_0.NTUMzhXPwXsmsYt
|
theorem mul_associator {M N P : Mon_ C} :
(tensor_ΞΌ C (M.X β N.X, P.X) (M.X β N.X, P.X) β«
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β P.mul)) β«
(Ξ±_ M.X N.X P.X).hom =
((Ξ±_ M.X N.X P.X).hom β (Ξ±_ M.X N.X P.X).hom) β«
tensor_ΞΌ C (M.X, N.X β P.X) (M.X, N.X β P.X) β«
(M.mul β tensor_ΞΌ C (N.X, P.X) (N.X, P.X) β« (N.mul β P.mul))
|
Mathlib_CategoryTheory_Monoidal_Mon_
|
case a.a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M N P : Mon_ C
| ((M.mul β N.mul) β P.mul) β« (Ξ±_ M.X N.X P.X).hom
case a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M N P : Mon_ C
| tensor_ΞΌ C (M.X β N.X, P.X) (M.X β N.X, P.X)
case a.a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M N P : Mon_ C
| tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β π (P.X β P.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))) (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
#align Mon_.one_right_unitor Mon_.one_rightUnitor
variable [BraidedCategory C]
theorem Mon_tensor_one_mul (M N : Mon_ C) :
((Ξ»_ (π_ C)).inv β« (M.one β N.one) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ»_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, one_mul M, one_mul N]
symm
exact tensor_left_unitality C M.X N.X
#align Mon_.Mon_tensor_one_mul Mon_.Mon_tensor_one_mul
theorem Mon_tensor_mul_one (M N : Mon_ C) :
(π (M.X β N.X) β (Ξ»_ (π_ C)).inv β« (M.one β N.one)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ο_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_one M, mul_one N]
symm
exact tensor_right_unitality C M.X N.X
#align Mon_.Mon_tensor_mul_one Mon_.Mon_tensor_mul_one
theorem Mon_tensor_mul_assoc (M N : Mon_ C) :
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ±_ (M.X β N.X) (M.X β N.X) (M.X β N.X)).hom β«
(π (M.X β N.X) β tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_assoc M, mul_assoc N, tensor_comp, tensor_comp]
-- Porting note: needed to add `dsimp` here.
slice_lhs 1 3 => dsimp; rw [tensor_associativity]
slice_lhs 3 4 => rw [β tensor_ΞΌ_natural]
slice_lhs 2 3 => rw [β tensor_comp, tensor_id]
simp only [Category.assoc]
#align Mon_.Mon_tensor_mul_assoc Mon_.Mon_tensor_mul_assoc
theorem mul_associator {M N P : Mon_ C} :
(tensor_ΞΌ C (M.X β N.X, P.X) (M.X β N.X, P.X) β«
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β P.mul)) β«
(Ξ±_ M.X N.X P.X).hom =
((Ξ±_ M.X N.X P.X).hom β (Ξ±_ M.X N.X P.X).hom) β«
tensor_ΞΌ C (M.X, N.X β P.X) (M.X, N.X β P.X) β«
(M.mul β tensor_ΞΌ C (N.X, P.X) (N.X, P.X) β« (N.mul β P.mul)) := by
simp only [tensor_obj, prodMonoidal_tensorObj, Category.assoc]
slice_lhs 2 3 => rw [β Category.id_comp P.mul, tensor_comp]
slice_lhs 3 4 =>
|
rw [associator_naturality]
|
theorem mul_associator {M N P : Mon_ C} :
(tensor_ΞΌ C (M.X β N.X, P.X) (M.X β N.X, P.X) β«
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β P.mul)) β«
(Ξ±_ M.X N.X P.X).hom =
((Ξ±_ M.X N.X P.X).hom β (Ξ±_ M.X N.X P.X).hom) β«
tensor_ΞΌ C (M.X, N.X β P.X) (M.X, N.X β P.X) β«
(M.mul β tensor_ΞΌ C (N.X, P.X) (N.X, P.X) β« (N.mul β P.mul)) := by
simp only [tensor_obj, prodMonoidal_tensorObj, Category.assoc]
slice_lhs 2 3 => rw [β Category.id_comp P.mul, tensor_comp]
slice_lhs 3 4 =>
|
Mathlib.CategoryTheory.Monoidal.Mon_.445_0.NTUMzhXPwXsmsYt
|
theorem mul_associator {M N P : Mon_ C} :
(tensor_ΞΌ C (M.X β N.X, P.X) (M.X β N.X, P.X) β«
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β P.mul)) β«
(Ξ±_ M.X N.X P.X).hom =
((Ξ±_ M.X N.X P.X).hom β (Ξ±_ M.X N.X P.X).hom) β«
tensor_ΞΌ C (M.X, N.X β P.X) (M.X, N.X β P.X) β«
(M.mul β tensor_ΞΌ C (N.X, P.X) (N.X, P.X) β« (N.mul β P.mul))
|
Mathlib_CategoryTheory_Monoidal_Mon_
|
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M N P : Mon_ C
β’ tensor_ΞΌ C (M.X β N.X, P.X) (M.X β N.X, P.X) β«
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β π (P.X β P.X)) β«
(Ξ±_ (M.X β M.X) (N.X β N.X) (P.X β P.X)).hom β« (M.mul β N.mul β P.mul) =
((Ξ±_ M.X N.X P.X).hom β (Ξ±_ M.X N.X P.X).hom) β«
tensor_ΞΌ C (M.X, N.X β P.X) (M.X, N.X β P.X) β« (M.mul β tensor_ΞΌ C (N.X, P.X) (N.X, P.X) β« (N.mul β P.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] }
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
#align Mon_.one_right_unitor Mon_.one_rightUnitor
variable [BraidedCategory C]
theorem Mon_tensor_one_mul (M N : Mon_ C) :
((Ξ»_ (π_ C)).inv β« (M.one β N.one) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ»_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, one_mul M, one_mul N]
symm
exact tensor_left_unitality C M.X N.X
#align Mon_.Mon_tensor_one_mul Mon_.Mon_tensor_one_mul
theorem Mon_tensor_mul_one (M N : Mon_ C) :
(π (M.X β N.X) β (Ξ»_ (π_ C)).inv β« (M.one β N.one)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ο_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_one M, mul_one N]
symm
exact tensor_right_unitality C M.X N.X
#align Mon_.Mon_tensor_mul_one Mon_.Mon_tensor_mul_one
theorem Mon_tensor_mul_assoc (M N : Mon_ C) :
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ±_ (M.X β N.X) (M.X β N.X) (M.X β N.X)).hom β«
(π (M.X β N.X) β tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_assoc M, mul_assoc N, tensor_comp, tensor_comp]
-- Porting note: needed to add `dsimp` here.
slice_lhs 1 3 => dsimp; rw [tensor_associativity]
slice_lhs 3 4 => rw [β tensor_ΞΌ_natural]
slice_lhs 2 3 => rw [β tensor_comp, tensor_id]
simp only [Category.assoc]
#align Mon_.Mon_tensor_mul_assoc Mon_.Mon_tensor_mul_assoc
theorem mul_associator {M N P : Mon_ C} :
(tensor_ΞΌ C (M.X β N.X, P.X) (M.X β N.X, P.X) β«
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β P.mul)) β«
(Ξ±_ M.X N.X P.X).hom =
((Ξ±_ M.X N.X P.X).hom β (Ξ±_ M.X N.X P.X).hom) β«
tensor_ΞΌ C (M.X, N.X β P.X) (M.X, N.X β P.X) β«
(M.mul β tensor_ΞΌ C (N.X, P.X) (N.X, P.X) β« (N.mul β P.mul)) := by
simp only [tensor_obj, prodMonoidal_tensorObj, Category.assoc]
slice_lhs 2 3 => rw [β Category.id_comp P.mul, tensor_comp]
slice_lhs 3 4 => rw [associator_naturality]
|
slice_rhs 3 4 => rw [β Category.id_comp M.mul, tensor_comp]
|
theorem mul_associator {M N P : Mon_ C} :
(tensor_ΞΌ C (M.X β N.X, P.X) (M.X β N.X, P.X) β«
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β P.mul)) β«
(Ξ±_ M.X N.X P.X).hom =
((Ξ±_ M.X N.X P.X).hom β (Ξ±_ M.X N.X P.X).hom) β«
tensor_ΞΌ C (M.X, N.X β P.X) (M.X, N.X β P.X) β«
(M.mul β tensor_ΞΌ C (N.X, P.X) (N.X, P.X) β« (N.mul β P.mul)) := by
simp only [tensor_obj, prodMonoidal_tensorObj, Category.assoc]
slice_lhs 2 3 => rw [β Category.id_comp P.mul, tensor_comp]
slice_lhs 3 4 => rw [associator_naturality]
|
Mathlib.CategoryTheory.Monoidal.Mon_.445_0.NTUMzhXPwXsmsYt
|
theorem mul_associator {M N P : Mon_ C} :
(tensor_ΞΌ C (M.X β N.X, P.X) (M.X β N.X, P.X) β«
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β P.mul)) β«
(Ξ±_ M.X N.X P.X).hom =
((Ξ±_ M.X N.X P.X).hom β (Ξ±_ M.X N.X P.X).hom) β«
tensor_ΞΌ C (M.X, N.X β P.X) (M.X, N.X β P.X) β«
(M.mul β tensor_ΞΌ C (N.X, P.X) (N.X, P.X) β« (N.mul β P.mul))
|
Mathlib_CategoryTheory_Monoidal_Mon_
|
case a.a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M N P : Mon_ C
| M.mul β tensor_ΞΌ C (N.X, P.X) (N.X, P.X) β« (N.mul β P.mul)
case a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M N P : Mon_ C
| (Ξ±_ M.X N.X P.X).hom β (Ξ±_ M.X N.X P.X).hom
case a.a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M N P : Mon_ C
| tensor_ΞΌ C (M.X, N.X β P.X) (M.X, N.X β P.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))) (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
#align Mon_.one_right_unitor Mon_.one_rightUnitor
variable [BraidedCategory C]
theorem Mon_tensor_one_mul (M N : Mon_ C) :
((Ξ»_ (π_ C)).inv β« (M.one β N.one) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ»_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, one_mul M, one_mul N]
symm
exact tensor_left_unitality C M.X N.X
#align Mon_.Mon_tensor_one_mul Mon_.Mon_tensor_one_mul
theorem Mon_tensor_mul_one (M N : Mon_ C) :
(π (M.X β N.X) β (Ξ»_ (π_ C)).inv β« (M.one β N.one)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ο_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_one M, mul_one N]
symm
exact tensor_right_unitality C M.X N.X
#align Mon_.Mon_tensor_mul_one Mon_.Mon_tensor_mul_one
theorem Mon_tensor_mul_assoc (M N : Mon_ C) :
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ±_ (M.X β N.X) (M.X β N.X) (M.X β N.X)).hom β«
(π (M.X β N.X) β tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_assoc M, mul_assoc N, tensor_comp, tensor_comp]
-- Porting note: needed to add `dsimp` here.
slice_lhs 1 3 => dsimp; rw [tensor_associativity]
slice_lhs 3 4 => rw [β tensor_ΞΌ_natural]
slice_lhs 2 3 => rw [β tensor_comp, tensor_id]
simp only [Category.assoc]
#align Mon_.Mon_tensor_mul_assoc Mon_.Mon_tensor_mul_assoc
theorem mul_associator {M N P : Mon_ C} :
(tensor_ΞΌ C (M.X β N.X, P.X) (M.X β N.X, P.X) β«
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β P.mul)) β«
(Ξ±_ M.X N.X P.X).hom =
((Ξ±_ M.X N.X P.X).hom β (Ξ±_ M.X N.X P.X).hom) β«
tensor_ΞΌ C (M.X, N.X β P.X) (M.X, N.X β P.X) β«
(M.mul β tensor_ΞΌ C (N.X, P.X) (N.X, P.X) β« (N.mul β P.mul)) := by
simp only [tensor_obj, prodMonoidal_tensorObj, Category.assoc]
slice_lhs 2 3 => rw [β Category.id_comp P.mul, tensor_comp]
slice_lhs 3 4 => rw [associator_naturality]
slice_rhs 3 4 =>
|
rw [β Category.id_comp M.mul, tensor_comp]
|
theorem mul_associator {M N P : Mon_ C} :
(tensor_ΞΌ C (M.X β N.X, P.X) (M.X β N.X, P.X) β«
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β P.mul)) β«
(Ξ±_ M.X N.X P.X).hom =
((Ξ±_ M.X N.X P.X).hom β (Ξ±_ M.X N.X P.X).hom) β«
tensor_ΞΌ C (M.X, N.X β P.X) (M.X, N.X β P.X) β«
(M.mul β tensor_ΞΌ C (N.X, P.X) (N.X, P.X) β« (N.mul β P.mul)) := by
simp only [tensor_obj, prodMonoidal_tensorObj, Category.assoc]
slice_lhs 2 3 => rw [β Category.id_comp P.mul, tensor_comp]
slice_lhs 3 4 => rw [associator_naturality]
slice_rhs 3 4 =>
|
Mathlib.CategoryTheory.Monoidal.Mon_.445_0.NTUMzhXPwXsmsYt
|
theorem mul_associator {M N P : Mon_ C} :
(tensor_ΞΌ C (M.X β N.X, P.X) (M.X β N.X, P.X) β«
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β P.mul)) β«
(Ξ±_ M.X N.X P.X).hom =
((Ξ±_ M.X N.X P.X).hom β (Ξ±_ M.X N.X P.X).hom) β«
tensor_ΞΌ C (M.X, N.X β P.X) (M.X, N.X β P.X) β«
(M.mul β tensor_ΞΌ C (N.X, P.X) (N.X, P.X) β« (N.mul β P.mul))
|
Mathlib_CategoryTheory_Monoidal_Mon_
|
case a.a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M N P : Mon_ C
| M.mul β tensor_ΞΌ C (N.X, P.X) (N.X, P.X) β« (N.mul β P.mul)
case a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M N P : Mon_ C
| (Ξ±_ M.X N.X P.X).hom β (Ξ±_ M.X N.X P.X).hom
case a.a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M N P : Mon_ C
| tensor_ΞΌ C (M.X, N.X β P.X) (M.X, N.X β P.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))) (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
#align Mon_.one_right_unitor Mon_.one_rightUnitor
variable [BraidedCategory C]
theorem Mon_tensor_one_mul (M N : Mon_ C) :
((Ξ»_ (π_ C)).inv β« (M.one β N.one) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ»_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, one_mul M, one_mul N]
symm
exact tensor_left_unitality C M.X N.X
#align Mon_.Mon_tensor_one_mul Mon_.Mon_tensor_one_mul
theorem Mon_tensor_mul_one (M N : Mon_ C) :
(π (M.X β N.X) β (Ξ»_ (π_ C)).inv β« (M.one β N.one)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ο_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_one M, mul_one N]
symm
exact tensor_right_unitality C M.X N.X
#align Mon_.Mon_tensor_mul_one Mon_.Mon_tensor_mul_one
theorem Mon_tensor_mul_assoc (M N : Mon_ C) :
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ±_ (M.X β N.X) (M.X β N.X) (M.X β N.X)).hom β«
(π (M.X β N.X) β tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_assoc M, mul_assoc N, tensor_comp, tensor_comp]
-- Porting note: needed to add `dsimp` here.
slice_lhs 1 3 => dsimp; rw [tensor_associativity]
slice_lhs 3 4 => rw [β tensor_ΞΌ_natural]
slice_lhs 2 3 => rw [β tensor_comp, tensor_id]
simp only [Category.assoc]
#align Mon_.Mon_tensor_mul_assoc Mon_.Mon_tensor_mul_assoc
theorem mul_associator {M N P : Mon_ C} :
(tensor_ΞΌ C (M.X β N.X, P.X) (M.X β N.X, P.X) β«
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β P.mul)) β«
(Ξ±_ M.X N.X P.X).hom =
((Ξ±_ M.X N.X P.X).hom β (Ξ±_ M.X N.X P.X).hom) β«
tensor_ΞΌ C (M.X, N.X β P.X) (M.X, N.X β P.X) β«
(M.mul β tensor_ΞΌ C (N.X, P.X) (N.X, P.X) β« (N.mul β P.mul)) := by
simp only [tensor_obj, prodMonoidal_tensorObj, Category.assoc]
slice_lhs 2 3 => rw [β Category.id_comp P.mul, tensor_comp]
slice_lhs 3 4 => rw [associator_naturality]
slice_rhs 3 4 =>
|
rw [β Category.id_comp M.mul, tensor_comp]
|
theorem mul_associator {M N P : Mon_ C} :
(tensor_ΞΌ C (M.X β N.X, P.X) (M.X β N.X, P.X) β«
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β P.mul)) β«
(Ξ±_ M.X N.X P.X).hom =
((Ξ±_ M.X N.X P.X).hom β (Ξ±_ M.X N.X P.X).hom) β«
tensor_ΞΌ C (M.X, N.X β P.X) (M.X, N.X β P.X) β«
(M.mul β tensor_ΞΌ C (N.X, P.X) (N.X, P.X) β« (N.mul β P.mul)) := by
simp only [tensor_obj, prodMonoidal_tensorObj, Category.assoc]
slice_lhs 2 3 => rw [β Category.id_comp P.mul, tensor_comp]
slice_lhs 3 4 => rw [associator_naturality]
slice_rhs 3 4 =>
|
Mathlib.CategoryTheory.Monoidal.Mon_.445_0.NTUMzhXPwXsmsYt
|
theorem mul_associator {M N P : Mon_ C} :
(tensor_ΞΌ C (M.X β N.X, P.X) (M.X β N.X, P.X) β«
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β P.mul)) β«
(Ξ±_ M.X N.X P.X).hom =
((Ξ±_ M.X N.X P.X).hom β (Ξ±_ M.X N.X P.X).hom) β«
tensor_ΞΌ C (M.X, N.X β P.X) (M.X, N.X β P.X) β«
(M.mul β tensor_ΞΌ C (N.X, P.X) (N.X, P.X) β« (N.mul β P.mul))
|
Mathlib_CategoryTheory_Monoidal_Mon_
|
case a.a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M N P : Mon_ C
| M.mul β tensor_ΞΌ C (N.X, P.X) (N.X, P.X) β« (N.mul β P.mul)
case a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M N P : Mon_ C
| (Ξ±_ M.X N.X P.X).hom β (Ξ±_ M.X N.X P.X).hom
case a.a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M N P : Mon_ C
| tensor_ΞΌ C (M.X, N.X β P.X) (M.X, N.X β P.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))) (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
#align Mon_.one_right_unitor Mon_.one_rightUnitor
variable [BraidedCategory C]
theorem Mon_tensor_one_mul (M N : Mon_ C) :
((Ξ»_ (π_ C)).inv β« (M.one β N.one) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ»_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, one_mul M, one_mul N]
symm
exact tensor_left_unitality C M.X N.X
#align Mon_.Mon_tensor_one_mul Mon_.Mon_tensor_one_mul
theorem Mon_tensor_mul_one (M N : Mon_ C) :
(π (M.X β N.X) β (Ξ»_ (π_ C)).inv β« (M.one β N.one)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ο_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_one M, mul_one N]
symm
exact tensor_right_unitality C M.X N.X
#align Mon_.Mon_tensor_mul_one Mon_.Mon_tensor_mul_one
theorem Mon_tensor_mul_assoc (M N : Mon_ C) :
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ±_ (M.X β N.X) (M.X β N.X) (M.X β N.X)).hom β«
(π (M.X β N.X) β tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_assoc M, mul_assoc N, tensor_comp, tensor_comp]
-- Porting note: needed to add `dsimp` here.
slice_lhs 1 3 => dsimp; rw [tensor_associativity]
slice_lhs 3 4 => rw [β tensor_ΞΌ_natural]
slice_lhs 2 3 => rw [β tensor_comp, tensor_id]
simp only [Category.assoc]
#align Mon_.Mon_tensor_mul_assoc Mon_.Mon_tensor_mul_assoc
theorem mul_associator {M N P : Mon_ C} :
(tensor_ΞΌ C (M.X β N.X, P.X) (M.X β N.X, P.X) β«
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β P.mul)) β«
(Ξ±_ M.X N.X P.X).hom =
((Ξ±_ M.X N.X P.X).hom β (Ξ±_ M.X N.X P.X).hom) β«
tensor_ΞΌ C (M.X, N.X β P.X) (M.X, N.X β P.X) β«
(M.mul β tensor_ΞΌ C (N.X, P.X) (N.X, P.X) β« (N.mul β P.mul)) := by
simp only [tensor_obj, prodMonoidal_tensorObj, Category.assoc]
slice_lhs 2 3 => rw [β Category.id_comp P.mul, tensor_comp]
slice_lhs 3 4 => rw [associator_naturality]
slice_rhs 3 4 =>
|
rw [β Category.id_comp M.mul, tensor_comp]
|
theorem mul_associator {M N P : Mon_ C} :
(tensor_ΞΌ C (M.X β N.X, P.X) (M.X β N.X, P.X) β«
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β P.mul)) β«
(Ξ±_ M.X N.X P.X).hom =
((Ξ±_ M.X N.X P.X).hom β (Ξ±_ M.X N.X P.X).hom) β«
tensor_ΞΌ C (M.X, N.X β P.X) (M.X, N.X β P.X) β«
(M.mul β tensor_ΞΌ C (N.X, P.X) (N.X, P.X) β« (N.mul β P.mul)) := by
simp only [tensor_obj, prodMonoidal_tensorObj, Category.assoc]
slice_lhs 2 3 => rw [β Category.id_comp P.mul, tensor_comp]
slice_lhs 3 4 => rw [associator_naturality]
slice_rhs 3 4 =>
|
Mathlib.CategoryTheory.Monoidal.Mon_.445_0.NTUMzhXPwXsmsYt
|
theorem mul_associator {M N P : Mon_ C} :
(tensor_ΞΌ C (M.X β N.X, P.X) (M.X β N.X, P.X) β«
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β P.mul)) β«
(Ξ±_ M.X N.X P.X).hom =
((Ξ±_ M.X N.X P.X).hom β (Ξ±_ M.X N.X P.X).hom) β«
tensor_ΞΌ C (M.X, N.X β P.X) (M.X, N.X β P.X) β«
(M.mul β tensor_ΞΌ C (N.X, P.X) (N.X, P.X) β« (N.mul β P.mul))
|
Mathlib_CategoryTheory_Monoidal_Mon_
|
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M N P : Mon_ C
β’ tensor_ΞΌ C (M.X β N.X, P.X) (M.X β N.X, P.X) β«
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β π (P.X β P.X)) β«
(Ξ±_ (M.X β M.X) (N.X β N.X) (P.X β P.X)).hom β« (M.mul β N.mul β P.mul) =
((Ξ±_ M.X N.X P.X).hom β (Ξ±_ M.X N.X P.X).hom) β«
tensor_ΞΌ C (M.X, N.X β P.X) (M.X, N.X β P.X) β«
(π (M.X β M.X) β tensor_ΞΌ C (N.X, P.X) (N.X, P.X)) β« (M.mul β N.mul β P.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] }
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
#align Mon_.one_right_unitor Mon_.one_rightUnitor
variable [BraidedCategory C]
theorem Mon_tensor_one_mul (M N : Mon_ C) :
((Ξ»_ (π_ C)).inv β« (M.one β N.one) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ»_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, one_mul M, one_mul N]
symm
exact tensor_left_unitality C M.X N.X
#align Mon_.Mon_tensor_one_mul Mon_.Mon_tensor_one_mul
theorem Mon_tensor_mul_one (M N : Mon_ C) :
(π (M.X β N.X) β (Ξ»_ (π_ C)).inv β« (M.one β N.one)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ο_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_one M, mul_one N]
symm
exact tensor_right_unitality C M.X N.X
#align Mon_.Mon_tensor_mul_one Mon_.Mon_tensor_mul_one
theorem Mon_tensor_mul_assoc (M N : Mon_ C) :
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ±_ (M.X β N.X) (M.X β N.X) (M.X β N.X)).hom β«
(π (M.X β N.X) β tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_assoc M, mul_assoc N, tensor_comp, tensor_comp]
-- Porting note: needed to add `dsimp` here.
slice_lhs 1 3 => dsimp; rw [tensor_associativity]
slice_lhs 3 4 => rw [β tensor_ΞΌ_natural]
slice_lhs 2 3 => rw [β tensor_comp, tensor_id]
simp only [Category.assoc]
#align Mon_.Mon_tensor_mul_assoc Mon_.Mon_tensor_mul_assoc
theorem mul_associator {M N P : Mon_ C} :
(tensor_ΞΌ C (M.X β N.X, P.X) (M.X β N.X, P.X) β«
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β P.mul)) β«
(Ξ±_ M.X N.X P.X).hom =
((Ξ±_ M.X N.X P.X).hom β (Ξ±_ M.X N.X P.X).hom) β«
tensor_ΞΌ C (M.X, N.X β P.X) (M.X, N.X β P.X) β«
(M.mul β tensor_ΞΌ C (N.X, P.X) (N.X, P.X) β« (N.mul β P.mul)) := by
simp only [tensor_obj, prodMonoidal_tensorObj, Category.assoc]
slice_lhs 2 3 => rw [β Category.id_comp P.mul, tensor_comp]
slice_lhs 3 4 => rw [associator_naturality]
slice_rhs 3 4 => rw [β Category.id_comp M.mul, tensor_comp]
|
slice_lhs 1 3 => rw [associator_monoidal]
|
theorem mul_associator {M N P : Mon_ C} :
(tensor_ΞΌ C (M.X β N.X, P.X) (M.X β N.X, P.X) β«
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β P.mul)) β«
(Ξ±_ M.X N.X P.X).hom =
((Ξ±_ M.X N.X P.X).hom β (Ξ±_ M.X N.X P.X).hom) β«
tensor_ΞΌ C (M.X, N.X β P.X) (M.X, N.X β P.X) β«
(M.mul β tensor_ΞΌ C (N.X, P.X) (N.X, P.X) β« (N.mul β P.mul)) := by
simp only [tensor_obj, prodMonoidal_tensorObj, Category.assoc]
slice_lhs 2 3 => rw [β Category.id_comp P.mul, tensor_comp]
slice_lhs 3 4 => rw [associator_naturality]
slice_rhs 3 4 => rw [β Category.id_comp M.mul, tensor_comp]
|
Mathlib.CategoryTheory.Monoidal.Mon_.445_0.NTUMzhXPwXsmsYt
|
theorem mul_associator {M N P : Mon_ C} :
(tensor_ΞΌ C (M.X β N.X, P.X) (M.X β N.X, P.X) β«
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β P.mul)) β«
(Ξ±_ M.X N.X P.X).hom =
((Ξ±_ M.X N.X P.X).hom β (Ξ±_ M.X N.X P.X).hom) β«
tensor_ΞΌ C (M.X, N.X β P.X) (M.X, N.X β P.X) β«
(M.mul β tensor_ΞΌ C (N.X, P.X) (N.X, P.X) β« (N.mul β P.mul))
|
Mathlib_CategoryTheory_Monoidal_Mon_
|
case a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M N P : Mon_ C
| tensor_ΞΌ C (M.X β N.X, P.X) (M.X β N.X, P.X) β«
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β π (P.X β P.X)) β« (Ξ±_ (M.X β M.X) (N.X β N.X) (P.X β P.X)).hom
case a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M N P : Mon_ C
| M.mul β N.mul β P.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] }
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
#align Mon_.one_right_unitor Mon_.one_rightUnitor
variable [BraidedCategory C]
theorem Mon_tensor_one_mul (M N : Mon_ C) :
((Ξ»_ (π_ C)).inv β« (M.one β N.one) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ»_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, one_mul M, one_mul N]
symm
exact tensor_left_unitality C M.X N.X
#align Mon_.Mon_tensor_one_mul Mon_.Mon_tensor_one_mul
theorem Mon_tensor_mul_one (M N : Mon_ C) :
(π (M.X β N.X) β (Ξ»_ (π_ C)).inv β« (M.one β N.one)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ο_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_one M, mul_one N]
symm
exact tensor_right_unitality C M.X N.X
#align Mon_.Mon_tensor_mul_one Mon_.Mon_tensor_mul_one
theorem Mon_tensor_mul_assoc (M N : Mon_ C) :
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ±_ (M.X β N.X) (M.X β N.X) (M.X β N.X)).hom β«
(π (M.X β N.X) β tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_assoc M, mul_assoc N, tensor_comp, tensor_comp]
-- Porting note: needed to add `dsimp` here.
slice_lhs 1 3 => dsimp; rw [tensor_associativity]
slice_lhs 3 4 => rw [β tensor_ΞΌ_natural]
slice_lhs 2 3 => rw [β tensor_comp, tensor_id]
simp only [Category.assoc]
#align Mon_.Mon_tensor_mul_assoc Mon_.Mon_tensor_mul_assoc
theorem mul_associator {M N P : Mon_ C} :
(tensor_ΞΌ C (M.X β N.X, P.X) (M.X β N.X, P.X) β«
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β P.mul)) β«
(Ξ±_ M.X N.X P.X).hom =
((Ξ±_ M.X N.X P.X).hom β (Ξ±_ M.X N.X P.X).hom) β«
tensor_ΞΌ C (M.X, N.X β P.X) (M.X, N.X β P.X) β«
(M.mul β tensor_ΞΌ C (N.X, P.X) (N.X, P.X) β« (N.mul β P.mul)) := by
simp only [tensor_obj, prodMonoidal_tensorObj, Category.assoc]
slice_lhs 2 3 => rw [β Category.id_comp P.mul, tensor_comp]
slice_lhs 3 4 => rw [associator_naturality]
slice_rhs 3 4 => rw [β Category.id_comp M.mul, tensor_comp]
slice_lhs 1 3 =>
|
rw [associator_monoidal]
|
theorem mul_associator {M N P : Mon_ C} :
(tensor_ΞΌ C (M.X β N.X, P.X) (M.X β N.X, P.X) β«
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β P.mul)) β«
(Ξ±_ M.X N.X P.X).hom =
((Ξ±_ M.X N.X P.X).hom β (Ξ±_ M.X N.X P.X).hom) β«
tensor_ΞΌ C (M.X, N.X β P.X) (M.X, N.X β P.X) β«
(M.mul β tensor_ΞΌ C (N.X, P.X) (N.X, P.X) β« (N.mul β P.mul)) := by
simp only [tensor_obj, prodMonoidal_tensorObj, Category.assoc]
slice_lhs 2 3 => rw [β Category.id_comp P.mul, tensor_comp]
slice_lhs 3 4 => rw [associator_naturality]
slice_rhs 3 4 => rw [β Category.id_comp M.mul, tensor_comp]
slice_lhs 1 3 =>
|
Mathlib.CategoryTheory.Monoidal.Mon_.445_0.NTUMzhXPwXsmsYt
|
theorem mul_associator {M N P : Mon_ C} :
(tensor_ΞΌ C (M.X β N.X, P.X) (M.X β N.X, P.X) β«
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β P.mul)) β«
(Ξ±_ M.X N.X P.X).hom =
((Ξ±_ M.X N.X P.X).hom β (Ξ±_ M.X N.X P.X).hom) β«
tensor_ΞΌ C (M.X, N.X β P.X) (M.X, N.X β P.X) β«
(M.mul β tensor_ΞΌ C (N.X, P.X) (N.X, P.X) β« (N.mul β P.mul))
|
Mathlib_CategoryTheory_Monoidal_Mon_
|
case a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M N P : Mon_ C
| tensor_ΞΌ C (M.X β N.X, P.X) (M.X β N.X, P.X) β«
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β π (P.X β P.X)) β« (Ξ±_ (M.X β M.X) (N.X β N.X) (P.X β P.X)).hom
case a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M N P : Mon_ C
| M.mul β N.mul β P.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] }
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
#align Mon_.one_right_unitor Mon_.one_rightUnitor
variable [BraidedCategory C]
theorem Mon_tensor_one_mul (M N : Mon_ C) :
((Ξ»_ (π_ C)).inv β« (M.one β N.one) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ»_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, one_mul M, one_mul N]
symm
exact tensor_left_unitality C M.X N.X
#align Mon_.Mon_tensor_one_mul Mon_.Mon_tensor_one_mul
theorem Mon_tensor_mul_one (M N : Mon_ C) :
(π (M.X β N.X) β (Ξ»_ (π_ C)).inv β« (M.one β N.one)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ο_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_one M, mul_one N]
symm
exact tensor_right_unitality C M.X N.X
#align Mon_.Mon_tensor_mul_one Mon_.Mon_tensor_mul_one
theorem Mon_tensor_mul_assoc (M N : Mon_ C) :
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ±_ (M.X β N.X) (M.X β N.X) (M.X β N.X)).hom β«
(π (M.X β N.X) β tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_assoc M, mul_assoc N, tensor_comp, tensor_comp]
-- Porting note: needed to add `dsimp` here.
slice_lhs 1 3 => dsimp; rw [tensor_associativity]
slice_lhs 3 4 => rw [β tensor_ΞΌ_natural]
slice_lhs 2 3 => rw [β tensor_comp, tensor_id]
simp only [Category.assoc]
#align Mon_.Mon_tensor_mul_assoc Mon_.Mon_tensor_mul_assoc
theorem mul_associator {M N P : Mon_ C} :
(tensor_ΞΌ C (M.X β N.X, P.X) (M.X β N.X, P.X) β«
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β P.mul)) β«
(Ξ±_ M.X N.X P.X).hom =
((Ξ±_ M.X N.X P.X).hom β (Ξ±_ M.X N.X P.X).hom) β«
tensor_ΞΌ C (M.X, N.X β P.X) (M.X, N.X β P.X) β«
(M.mul β tensor_ΞΌ C (N.X, P.X) (N.X, P.X) β« (N.mul β P.mul)) := by
simp only [tensor_obj, prodMonoidal_tensorObj, Category.assoc]
slice_lhs 2 3 => rw [β Category.id_comp P.mul, tensor_comp]
slice_lhs 3 4 => rw [associator_naturality]
slice_rhs 3 4 => rw [β Category.id_comp M.mul, tensor_comp]
slice_lhs 1 3 =>
|
rw [associator_monoidal]
|
theorem mul_associator {M N P : Mon_ C} :
(tensor_ΞΌ C (M.X β N.X, P.X) (M.X β N.X, P.X) β«
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β P.mul)) β«
(Ξ±_ M.X N.X P.X).hom =
((Ξ±_ M.X N.X P.X).hom β (Ξ±_ M.X N.X P.X).hom) β«
tensor_ΞΌ C (M.X, N.X β P.X) (M.X, N.X β P.X) β«
(M.mul β tensor_ΞΌ C (N.X, P.X) (N.X, P.X) β« (N.mul β P.mul)) := by
simp only [tensor_obj, prodMonoidal_tensorObj, Category.assoc]
slice_lhs 2 3 => rw [β Category.id_comp P.mul, tensor_comp]
slice_lhs 3 4 => rw [associator_naturality]
slice_rhs 3 4 => rw [β Category.id_comp M.mul, tensor_comp]
slice_lhs 1 3 =>
|
Mathlib.CategoryTheory.Monoidal.Mon_.445_0.NTUMzhXPwXsmsYt
|
theorem mul_associator {M N P : Mon_ C} :
(tensor_ΞΌ C (M.X β N.X, P.X) (M.X β N.X, P.X) β«
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β P.mul)) β«
(Ξ±_ M.X N.X P.X).hom =
((Ξ±_ M.X N.X P.X).hom β (Ξ±_ M.X N.X P.X).hom) β«
tensor_ΞΌ C (M.X, N.X β P.X) (M.X, N.X β P.X) β«
(M.mul β tensor_ΞΌ C (N.X, P.X) (N.X, P.X) β« (N.mul β P.mul))
|
Mathlib_CategoryTheory_Monoidal_Mon_
|
case a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M N P : Mon_ C
| tensor_ΞΌ C (M.X β N.X, P.X) (M.X β N.X, P.X) β«
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β π (P.X β P.X)) β« (Ξ±_ (M.X β M.X) (N.X β N.X) (P.X β P.X)).hom
case a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M N P : Mon_ C
| M.mul β N.mul β P.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] }
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
#align Mon_.one_right_unitor Mon_.one_rightUnitor
variable [BraidedCategory C]
theorem Mon_tensor_one_mul (M N : Mon_ C) :
((Ξ»_ (π_ C)).inv β« (M.one β N.one) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ»_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, one_mul M, one_mul N]
symm
exact tensor_left_unitality C M.X N.X
#align Mon_.Mon_tensor_one_mul Mon_.Mon_tensor_one_mul
theorem Mon_tensor_mul_one (M N : Mon_ C) :
(π (M.X β N.X) β (Ξ»_ (π_ C)).inv β« (M.one β N.one)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ο_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_one M, mul_one N]
symm
exact tensor_right_unitality C M.X N.X
#align Mon_.Mon_tensor_mul_one Mon_.Mon_tensor_mul_one
theorem Mon_tensor_mul_assoc (M N : Mon_ C) :
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ±_ (M.X β N.X) (M.X β N.X) (M.X β N.X)).hom β«
(π (M.X β N.X) β tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_assoc M, mul_assoc N, tensor_comp, tensor_comp]
-- Porting note: needed to add `dsimp` here.
slice_lhs 1 3 => dsimp; rw [tensor_associativity]
slice_lhs 3 4 => rw [β tensor_ΞΌ_natural]
slice_lhs 2 3 => rw [β tensor_comp, tensor_id]
simp only [Category.assoc]
#align Mon_.Mon_tensor_mul_assoc Mon_.Mon_tensor_mul_assoc
theorem mul_associator {M N P : Mon_ C} :
(tensor_ΞΌ C (M.X β N.X, P.X) (M.X β N.X, P.X) β«
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β P.mul)) β«
(Ξ±_ M.X N.X P.X).hom =
((Ξ±_ M.X N.X P.X).hom β (Ξ±_ M.X N.X P.X).hom) β«
tensor_ΞΌ C (M.X, N.X β P.X) (M.X, N.X β P.X) β«
(M.mul β tensor_ΞΌ C (N.X, P.X) (N.X, P.X) β« (N.mul β P.mul)) := by
simp only [tensor_obj, prodMonoidal_tensorObj, Category.assoc]
slice_lhs 2 3 => rw [β Category.id_comp P.mul, tensor_comp]
slice_lhs 3 4 => rw [associator_naturality]
slice_rhs 3 4 => rw [β Category.id_comp M.mul, tensor_comp]
slice_lhs 1 3 =>
|
rw [associator_monoidal]
|
theorem mul_associator {M N P : Mon_ C} :
(tensor_ΞΌ C (M.X β N.X, P.X) (M.X β N.X, P.X) β«
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β P.mul)) β«
(Ξ±_ M.X N.X P.X).hom =
((Ξ±_ M.X N.X P.X).hom β (Ξ±_ M.X N.X P.X).hom) β«
tensor_ΞΌ C (M.X, N.X β P.X) (M.X, N.X β P.X) β«
(M.mul β tensor_ΞΌ C (N.X, P.X) (N.X, P.X) β« (N.mul β P.mul)) := by
simp only [tensor_obj, prodMonoidal_tensorObj, Category.assoc]
slice_lhs 2 3 => rw [β Category.id_comp P.mul, tensor_comp]
slice_lhs 3 4 => rw [associator_naturality]
slice_rhs 3 4 => rw [β Category.id_comp M.mul, tensor_comp]
slice_lhs 1 3 =>
|
Mathlib.CategoryTheory.Monoidal.Mon_.445_0.NTUMzhXPwXsmsYt
|
theorem mul_associator {M N P : Mon_ C} :
(tensor_ΞΌ C (M.X β N.X, P.X) (M.X β N.X, P.X) β«
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β P.mul)) β«
(Ξ±_ M.X N.X P.X).hom =
((Ξ±_ M.X N.X P.X).hom β (Ξ±_ M.X N.X P.X).hom) β«
tensor_ΞΌ C (M.X, N.X β P.X) (M.X, N.X β P.X) β«
(M.mul β tensor_ΞΌ C (N.X, P.X) (N.X, P.X) β« (N.mul β P.mul))
|
Mathlib_CategoryTheory_Monoidal_Mon_
|
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M N P : Mon_ C
β’ (((Ξ±_ M.X N.X P.X).hom β (Ξ±_ M.X N.X P.X).hom) β«
tensor_ΞΌ C (M.X, N.X β P.X) (M.X, N.X β P.X) β« (π (M.X β M.X) β tensor_ΞΌ C (N.X, P.X) (N.X, P.X))) β«
(M.mul β N.mul β P.mul) =
((Ξ±_ M.X N.X P.X).hom β (Ξ±_ M.X N.X P.X).hom) β«
tensor_ΞΌ C (M.X, N.X β P.X) (M.X, N.X β P.X) β«
(π (M.X β M.X) β tensor_ΞΌ C (N.X, P.X) (N.X, P.X)) β« (M.mul β N.mul β P.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] }
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
#align Mon_.one_right_unitor Mon_.one_rightUnitor
variable [BraidedCategory C]
theorem Mon_tensor_one_mul (M N : Mon_ C) :
((Ξ»_ (π_ C)).inv β« (M.one β N.one) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ»_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, one_mul M, one_mul N]
symm
exact tensor_left_unitality C M.X N.X
#align Mon_.Mon_tensor_one_mul Mon_.Mon_tensor_one_mul
theorem Mon_tensor_mul_one (M N : Mon_ C) :
(π (M.X β N.X) β (Ξ»_ (π_ C)).inv β« (M.one β N.one)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ο_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_one M, mul_one N]
symm
exact tensor_right_unitality C M.X N.X
#align Mon_.Mon_tensor_mul_one Mon_.Mon_tensor_mul_one
theorem Mon_tensor_mul_assoc (M N : Mon_ C) :
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ±_ (M.X β N.X) (M.X β N.X) (M.X β N.X)).hom β«
(π (M.X β N.X) β tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_assoc M, mul_assoc N, tensor_comp, tensor_comp]
-- Porting note: needed to add `dsimp` here.
slice_lhs 1 3 => dsimp; rw [tensor_associativity]
slice_lhs 3 4 => rw [β tensor_ΞΌ_natural]
slice_lhs 2 3 => rw [β tensor_comp, tensor_id]
simp only [Category.assoc]
#align Mon_.Mon_tensor_mul_assoc Mon_.Mon_tensor_mul_assoc
theorem mul_associator {M N P : Mon_ C} :
(tensor_ΞΌ C (M.X β N.X, P.X) (M.X β N.X, P.X) β«
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β P.mul)) β«
(Ξ±_ M.X N.X P.X).hom =
((Ξ±_ M.X N.X P.X).hom β (Ξ±_ M.X N.X P.X).hom) β«
tensor_ΞΌ C (M.X, N.X β P.X) (M.X, N.X β P.X) β«
(M.mul β tensor_ΞΌ C (N.X, P.X) (N.X, P.X) β« (N.mul β P.mul)) := by
simp only [tensor_obj, prodMonoidal_tensorObj, Category.assoc]
slice_lhs 2 3 => rw [β Category.id_comp P.mul, tensor_comp]
slice_lhs 3 4 => rw [associator_naturality]
slice_rhs 3 4 => rw [β Category.id_comp M.mul, tensor_comp]
slice_lhs 1 3 => rw [associator_monoidal]
|
simp only [Category.assoc]
|
theorem mul_associator {M N P : Mon_ C} :
(tensor_ΞΌ C (M.X β N.X, P.X) (M.X β N.X, P.X) β«
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β P.mul)) β«
(Ξ±_ M.X N.X P.X).hom =
((Ξ±_ M.X N.X P.X).hom β (Ξ±_ M.X N.X P.X).hom) β«
tensor_ΞΌ C (M.X, N.X β P.X) (M.X, N.X β P.X) β«
(M.mul β tensor_ΞΌ C (N.X, P.X) (N.X, P.X) β« (N.mul β P.mul)) := by
simp only [tensor_obj, prodMonoidal_tensorObj, Category.assoc]
slice_lhs 2 3 => rw [β Category.id_comp P.mul, tensor_comp]
slice_lhs 3 4 => rw [associator_naturality]
slice_rhs 3 4 => rw [β Category.id_comp M.mul, tensor_comp]
slice_lhs 1 3 => rw [associator_monoidal]
|
Mathlib.CategoryTheory.Monoidal.Mon_.445_0.NTUMzhXPwXsmsYt
|
theorem mul_associator {M N P : Mon_ C} :
(tensor_ΞΌ C (M.X β N.X, P.X) (M.X β N.X, P.X) β«
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β P.mul)) β«
(Ξ±_ M.X N.X P.X).hom =
((Ξ±_ M.X N.X P.X).hom β (Ξ±_ M.X N.X P.X).hom) β«
tensor_ΞΌ C (M.X, N.X β P.X) (M.X, N.X β P.X) β«
(M.mul β tensor_ΞΌ C (N.X, P.X) (N.X, P.X) β« (N.mul β P.mul))
|
Mathlib_CategoryTheory_Monoidal_Mon_
|
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M : Mon_ C
β’ (tensor_ΞΌ C (π_ C, M.X) (π_ C, M.X) β« ((Ξ»_ (π_ C)).hom β M.mul)) β« (Ξ»_ M.X).hom =
((Ξ»_ M.X).hom β (Ξ»_ M.X).hom) β« M.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] }
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
#align Mon_.one_right_unitor Mon_.one_rightUnitor
variable [BraidedCategory C]
theorem Mon_tensor_one_mul (M N : Mon_ C) :
((Ξ»_ (π_ C)).inv β« (M.one β N.one) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ»_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, one_mul M, one_mul N]
symm
exact tensor_left_unitality C M.X N.X
#align Mon_.Mon_tensor_one_mul Mon_.Mon_tensor_one_mul
theorem Mon_tensor_mul_one (M N : Mon_ C) :
(π (M.X β N.X) β (Ξ»_ (π_ C)).inv β« (M.one β N.one)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ο_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_one M, mul_one N]
symm
exact tensor_right_unitality C M.X N.X
#align Mon_.Mon_tensor_mul_one Mon_.Mon_tensor_mul_one
theorem Mon_tensor_mul_assoc (M N : Mon_ C) :
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ±_ (M.X β N.X) (M.X β N.X) (M.X β N.X)).hom β«
(π (M.X β N.X) β tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_assoc M, mul_assoc N, tensor_comp, tensor_comp]
-- Porting note: needed to add `dsimp` here.
slice_lhs 1 3 => dsimp; rw [tensor_associativity]
slice_lhs 3 4 => rw [β tensor_ΞΌ_natural]
slice_lhs 2 3 => rw [β tensor_comp, tensor_id]
simp only [Category.assoc]
#align Mon_.Mon_tensor_mul_assoc Mon_.Mon_tensor_mul_assoc
theorem mul_associator {M N P : Mon_ C} :
(tensor_ΞΌ C (M.X β N.X, P.X) (M.X β N.X, P.X) β«
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β P.mul)) β«
(Ξ±_ M.X N.X P.X).hom =
((Ξ±_ M.X N.X P.X).hom β (Ξ±_ M.X N.X P.X).hom) β«
tensor_ΞΌ C (M.X, N.X β P.X) (M.X, N.X β P.X) β«
(M.mul β tensor_ΞΌ C (N.X, P.X) (N.X, P.X) β« (N.mul β P.mul)) := by
simp only [tensor_obj, prodMonoidal_tensorObj, Category.assoc]
slice_lhs 2 3 => rw [β Category.id_comp P.mul, tensor_comp]
slice_lhs 3 4 => rw [associator_naturality]
slice_rhs 3 4 => rw [β Category.id_comp M.mul, tensor_comp]
slice_lhs 1 3 => rw [associator_monoidal]
simp only [Category.assoc]
#align Mon_.mul_associator Mon_.mul_associator
theorem mul_leftUnitor {M : Mon_ C} :
(tensor_ΞΌ C (π_ C, M.X) (π_ C, M.X) β« ((Ξ»_ (π_ C)).hom β M.mul)) β« (Ξ»_ M.X).hom =
((Ξ»_ M.X).hom β (Ξ»_ M.X).hom) β« M.mul := by
|
rw [β Category.comp_id (Ξ»_ (π_ C)).hom, β Category.id_comp M.mul, tensor_comp]
|
theorem mul_leftUnitor {M : Mon_ C} :
(tensor_ΞΌ C (π_ C, M.X) (π_ C, M.X) β« ((Ξ»_ (π_ C)).hom β M.mul)) β« (Ξ»_ M.X).hom =
((Ξ»_ M.X).hom β (Ξ»_ M.X).hom) β« M.mul := by
|
Mathlib.CategoryTheory.Monoidal.Mon_.460_0.NTUMzhXPwXsmsYt
|
theorem mul_leftUnitor {M : Mon_ C} :
(tensor_ΞΌ C (π_ C, M.X) (π_ C, M.X) β« ((Ξ»_ (π_ C)).hom β M.mul)) β« (Ξ»_ M.X).hom =
((Ξ»_ M.X).hom β (Ξ»_ M.X).hom) β« M.mul
|
Mathlib_CategoryTheory_Monoidal_Mon_
|
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M : Mon_ C
β’ (tensor_ΞΌ C (π_ C, M.X) (π_ C, M.X) β« ((Ξ»_ (π_ C)).hom β π (M.X β M.X)) β« (π (π_ C) β M.mul)) β« (Ξ»_ M.X).hom =
((Ξ»_ M.X).hom β (Ξ»_ M.X).hom) β« π (M.X β M.X) β« M.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] }
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
#align Mon_.one_right_unitor Mon_.one_rightUnitor
variable [BraidedCategory C]
theorem Mon_tensor_one_mul (M N : Mon_ C) :
((Ξ»_ (π_ C)).inv β« (M.one β N.one) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ»_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, one_mul M, one_mul N]
symm
exact tensor_left_unitality C M.X N.X
#align Mon_.Mon_tensor_one_mul Mon_.Mon_tensor_one_mul
theorem Mon_tensor_mul_one (M N : Mon_ C) :
(π (M.X β N.X) β (Ξ»_ (π_ C)).inv β« (M.one β N.one)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ο_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_one M, mul_one N]
symm
exact tensor_right_unitality C M.X N.X
#align Mon_.Mon_tensor_mul_one Mon_.Mon_tensor_mul_one
theorem Mon_tensor_mul_assoc (M N : Mon_ C) :
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ±_ (M.X β N.X) (M.X β N.X) (M.X β N.X)).hom β«
(π (M.X β N.X) β tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_assoc M, mul_assoc N, tensor_comp, tensor_comp]
-- Porting note: needed to add `dsimp` here.
slice_lhs 1 3 => dsimp; rw [tensor_associativity]
slice_lhs 3 4 => rw [β tensor_ΞΌ_natural]
slice_lhs 2 3 => rw [β tensor_comp, tensor_id]
simp only [Category.assoc]
#align Mon_.Mon_tensor_mul_assoc Mon_.Mon_tensor_mul_assoc
theorem mul_associator {M N P : Mon_ C} :
(tensor_ΞΌ C (M.X β N.X, P.X) (M.X β N.X, P.X) β«
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β P.mul)) β«
(Ξ±_ M.X N.X P.X).hom =
((Ξ±_ M.X N.X P.X).hom β (Ξ±_ M.X N.X P.X).hom) β«
tensor_ΞΌ C (M.X, N.X β P.X) (M.X, N.X β P.X) β«
(M.mul β tensor_ΞΌ C (N.X, P.X) (N.X, P.X) β« (N.mul β P.mul)) := by
simp only [tensor_obj, prodMonoidal_tensorObj, Category.assoc]
slice_lhs 2 3 => rw [β Category.id_comp P.mul, tensor_comp]
slice_lhs 3 4 => rw [associator_naturality]
slice_rhs 3 4 => rw [β Category.id_comp M.mul, tensor_comp]
slice_lhs 1 3 => rw [associator_monoidal]
simp only [Category.assoc]
#align Mon_.mul_associator Mon_.mul_associator
theorem mul_leftUnitor {M : Mon_ C} :
(tensor_ΞΌ C (π_ C, M.X) (π_ C, M.X) β« ((Ξ»_ (π_ C)).hom β M.mul)) β« (Ξ»_ M.X).hom =
((Ξ»_ M.X).hom β (Ξ»_ M.X).hom) β« M.mul := by
rw [β Category.comp_id (Ξ»_ (π_ C)).hom, β Category.id_comp M.mul, tensor_comp]
|
slice_lhs 3 4 => rw [leftUnitor_naturality]
|
theorem mul_leftUnitor {M : Mon_ C} :
(tensor_ΞΌ C (π_ C, M.X) (π_ C, M.X) β« ((Ξ»_ (π_ C)).hom β M.mul)) β« (Ξ»_ M.X).hom =
((Ξ»_ M.X).hom β (Ξ»_ M.X).hom) β« M.mul := by
rw [β Category.comp_id (Ξ»_ (π_ C)).hom, β Category.id_comp M.mul, tensor_comp]
|
Mathlib.CategoryTheory.Monoidal.Mon_.460_0.NTUMzhXPwXsmsYt
|
theorem mul_leftUnitor {M : Mon_ C} :
(tensor_ΞΌ C (π_ C, M.X) (π_ C, M.X) β« ((Ξ»_ (π_ C)).hom β M.mul)) β« (Ξ»_ M.X).hom =
((Ξ»_ M.X).hom β (Ξ»_ M.X).hom) β« M.mul
|
Mathlib_CategoryTheory_Monoidal_Mon_
|
case a.a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M : Mon_ C
| (π (π_ C) β M.mul) β« (Ξ»_ M.X).hom
case a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M : Mon_ C
| tensor_ΞΌ C (π_ C, M.X) (π_ C, M.X)
case a.a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M : Mon_ C
| (Ξ»_ (π_ C)).hom β π (M.X β M.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))) (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
#align Mon_.one_right_unitor Mon_.one_rightUnitor
variable [BraidedCategory C]
theorem Mon_tensor_one_mul (M N : Mon_ C) :
((Ξ»_ (π_ C)).inv β« (M.one β N.one) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ»_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, one_mul M, one_mul N]
symm
exact tensor_left_unitality C M.X N.X
#align Mon_.Mon_tensor_one_mul Mon_.Mon_tensor_one_mul
theorem Mon_tensor_mul_one (M N : Mon_ C) :
(π (M.X β N.X) β (Ξ»_ (π_ C)).inv β« (M.one β N.one)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ο_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_one M, mul_one N]
symm
exact tensor_right_unitality C M.X N.X
#align Mon_.Mon_tensor_mul_one Mon_.Mon_tensor_mul_one
theorem Mon_tensor_mul_assoc (M N : Mon_ C) :
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ±_ (M.X β N.X) (M.X β N.X) (M.X β N.X)).hom β«
(π (M.X β N.X) β tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_assoc M, mul_assoc N, tensor_comp, tensor_comp]
-- Porting note: needed to add `dsimp` here.
slice_lhs 1 3 => dsimp; rw [tensor_associativity]
slice_lhs 3 4 => rw [β tensor_ΞΌ_natural]
slice_lhs 2 3 => rw [β tensor_comp, tensor_id]
simp only [Category.assoc]
#align Mon_.Mon_tensor_mul_assoc Mon_.Mon_tensor_mul_assoc
theorem mul_associator {M N P : Mon_ C} :
(tensor_ΞΌ C (M.X β N.X, P.X) (M.X β N.X, P.X) β«
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β P.mul)) β«
(Ξ±_ M.X N.X P.X).hom =
((Ξ±_ M.X N.X P.X).hom β (Ξ±_ M.X N.X P.X).hom) β«
tensor_ΞΌ C (M.X, N.X β P.X) (M.X, N.X β P.X) β«
(M.mul β tensor_ΞΌ C (N.X, P.X) (N.X, P.X) β« (N.mul β P.mul)) := by
simp only [tensor_obj, prodMonoidal_tensorObj, Category.assoc]
slice_lhs 2 3 => rw [β Category.id_comp P.mul, tensor_comp]
slice_lhs 3 4 => rw [associator_naturality]
slice_rhs 3 4 => rw [β Category.id_comp M.mul, tensor_comp]
slice_lhs 1 3 => rw [associator_monoidal]
simp only [Category.assoc]
#align Mon_.mul_associator Mon_.mul_associator
theorem mul_leftUnitor {M : Mon_ C} :
(tensor_ΞΌ C (π_ C, M.X) (π_ C, M.X) β« ((Ξ»_ (π_ C)).hom β M.mul)) β« (Ξ»_ M.X).hom =
((Ξ»_ M.X).hom β (Ξ»_ M.X).hom) β« M.mul := by
rw [β Category.comp_id (Ξ»_ (π_ C)).hom, β Category.id_comp M.mul, tensor_comp]
slice_lhs 3 4 =>
|
rw [leftUnitor_naturality]
|
theorem mul_leftUnitor {M : Mon_ C} :
(tensor_ΞΌ C (π_ C, M.X) (π_ C, M.X) β« ((Ξ»_ (π_ C)).hom β M.mul)) β« (Ξ»_ M.X).hom =
((Ξ»_ M.X).hom β (Ξ»_ M.X).hom) β« M.mul := by
rw [β Category.comp_id (Ξ»_ (π_ C)).hom, β Category.id_comp M.mul, tensor_comp]
slice_lhs 3 4 =>
|
Mathlib.CategoryTheory.Monoidal.Mon_.460_0.NTUMzhXPwXsmsYt
|
theorem mul_leftUnitor {M : Mon_ C} :
(tensor_ΞΌ C (π_ C, M.X) (π_ C, M.X) β« ((Ξ»_ (π_ C)).hom β M.mul)) β« (Ξ»_ M.X).hom =
((Ξ»_ M.X).hom β (Ξ»_ M.X).hom) β« M.mul
|
Mathlib_CategoryTheory_Monoidal_Mon_
|
case a.a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M : Mon_ C
| (π (π_ C) β M.mul) β« (Ξ»_ M.X).hom
case a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M : Mon_ C
| tensor_ΞΌ C (π_ C, M.X) (π_ C, M.X)
case a.a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M : Mon_ C
| (Ξ»_ (π_ C)).hom β π (M.X β M.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))) (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
#align Mon_.one_right_unitor Mon_.one_rightUnitor
variable [BraidedCategory C]
theorem Mon_tensor_one_mul (M N : Mon_ C) :
((Ξ»_ (π_ C)).inv β« (M.one β N.one) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ»_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, one_mul M, one_mul N]
symm
exact tensor_left_unitality C M.X N.X
#align Mon_.Mon_tensor_one_mul Mon_.Mon_tensor_one_mul
theorem Mon_tensor_mul_one (M N : Mon_ C) :
(π (M.X β N.X) β (Ξ»_ (π_ C)).inv β« (M.one β N.one)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ο_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_one M, mul_one N]
symm
exact tensor_right_unitality C M.X N.X
#align Mon_.Mon_tensor_mul_one Mon_.Mon_tensor_mul_one
theorem Mon_tensor_mul_assoc (M N : Mon_ C) :
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ±_ (M.X β N.X) (M.X β N.X) (M.X β N.X)).hom β«
(π (M.X β N.X) β tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_assoc M, mul_assoc N, tensor_comp, tensor_comp]
-- Porting note: needed to add `dsimp` here.
slice_lhs 1 3 => dsimp; rw [tensor_associativity]
slice_lhs 3 4 => rw [β tensor_ΞΌ_natural]
slice_lhs 2 3 => rw [β tensor_comp, tensor_id]
simp only [Category.assoc]
#align Mon_.Mon_tensor_mul_assoc Mon_.Mon_tensor_mul_assoc
theorem mul_associator {M N P : Mon_ C} :
(tensor_ΞΌ C (M.X β N.X, P.X) (M.X β N.X, P.X) β«
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β P.mul)) β«
(Ξ±_ M.X N.X P.X).hom =
((Ξ±_ M.X N.X P.X).hom β (Ξ±_ M.X N.X P.X).hom) β«
tensor_ΞΌ C (M.X, N.X β P.X) (M.X, N.X β P.X) β«
(M.mul β tensor_ΞΌ C (N.X, P.X) (N.X, P.X) β« (N.mul β P.mul)) := by
simp only [tensor_obj, prodMonoidal_tensorObj, Category.assoc]
slice_lhs 2 3 => rw [β Category.id_comp P.mul, tensor_comp]
slice_lhs 3 4 => rw [associator_naturality]
slice_rhs 3 4 => rw [β Category.id_comp M.mul, tensor_comp]
slice_lhs 1 3 => rw [associator_monoidal]
simp only [Category.assoc]
#align Mon_.mul_associator Mon_.mul_associator
theorem mul_leftUnitor {M : Mon_ C} :
(tensor_ΞΌ C (π_ C, M.X) (π_ C, M.X) β« ((Ξ»_ (π_ C)).hom β M.mul)) β« (Ξ»_ M.X).hom =
((Ξ»_ M.X).hom β (Ξ»_ M.X).hom) β« M.mul := by
rw [β Category.comp_id (Ξ»_ (π_ C)).hom, β Category.id_comp M.mul, tensor_comp]
slice_lhs 3 4 =>
|
rw [leftUnitor_naturality]
|
theorem mul_leftUnitor {M : Mon_ C} :
(tensor_ΞΌ C (π_ C, M.X) (π_ C, M.X) β« ((Ξ»_ (π_ C)).hom β M.mul)) β« (Ξ»_ M.X).hom =
((Ξ»_ M.X).hom β (Ξ»_ M.X).hom) β« M.mul := by
rw [β Category.comp_id (Ξ»_ (π_ C)).hom, β Category.id_comp M.mul, tensor_comp]
slice_lhs 3 4 =>
|
Mathlib.CategoryTheory.Monoidal.Mon_.460_0.NTUMzhXPwXsmsYt
|
theorem mul_leftUnitor {M : Mon_ C} :
(tensor_ΞΌ C (π_ C, M.X) (π_ C, M.X) β« ((Ξ»_ (π_ C)).hom β M.mul)) β« (Ξ»_ M.X).hom =
((Ξ»_ M.X).hom β (Ξ»_ M.X).hom) β« M.mul
|
Mathlib_CategoryTheory_Monoidal_Mon_
|
case a.a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M : Mon_ C
| (π (π_ C) β M.mul) β« (Ξ»_ M.X).hom
case a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M : Mon_ C
| tensor_ΞΌ C (π_ C, M.X) (π_ C, M.X)
case a.a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M : Mon_ C
| (Ξ»_ (π_ C)).hom β π (M.X β M.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))) (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
#align Mon_.one_right_unitor Mon_.one_rightUnitor
variable [BraidedCategory C]
theorem Mon_tensor_one_mul (M N : Mon_ C) :
((Ξ»_ (π_ C)).inv β« (M.one β N.one) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ»_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, one_mul M, one_mul N]
symm
exact tensor_left_unitality C M.X N.X
#align Mon_.Mon_tensor_one_mul Mon_.Mon_tensor_one_mul
theorem Mon_tensor_mul_one (M N : Mon_ C) :
(π (M.X β N.X) β (Ξ»_ (π_ C)).inv β« (M.one β N.one)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ο_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_one M, mul_one N]
symm
exact tensor_right_unitality C M.X N.X
#align Mon_.Mon_tensor_mul_one Mon_.Mon_tensor_mul_one
theorem Mon_tensor_mul_assoc (M N : Mon_ C) :
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ±_ (M.X β N.X) (M.X β N.X) (M.X β N.X)).hom β«
(π (M.X β N.X) β tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_assoc M, mul_assoc N, tensor_comp, tensor_comp]
-- Porting note: needed to add `dsimp` here.
slice_lhs 1 3 => dsimp; rw [tensor_associativity]
slice_lhs 3 4 => rw [β tensor_ΞΌ_natural]
slice_lhs 2 3 => rw [β tensor_comp, tensor_id]
simp only [Category.assoc]
#align Mon_.Mon_tensor_mul_assoc Mon_.Mon_tensor_mul_assoc
theorem mul_associator {M N P : Mon_ C} :
(tensor_ΞΌ C (M.X β N.X, P.X) (M.X β N.X, P.X) β«
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β P.mul)) β«
(Ξ±_ M.X N.X P.X).hom =
((Ξ±_ M.X N.X P.X).hom β (Ξ±_ M.X N.X P.X).hom) β«
tensor_ΞΌ C (M.X, N.X β P.X) (M.X, N.X β P.X) β«
(M.mul β tensor_ΞΌ C (N.X, P.X) (N.X, P.X) β« (N.mul β P.mul)) := by
simp only [tensor_obj, prodMonoidal_tensorObj, Category.assoc]
slice_lhs 2 3 => rw [β Category.id_comp P.mul, tensor_comp]
slice_lhs 3 4 => rw [associator_naturality]
slice_rhs 3 4 => rw [β Category.id_comp M.mul, tensor_comp]
slice_lhs 1 3 => rw [associator_monoidal]
simp only [Category.assoc]
#align Mon_.mul_associator Mon_.mul_associator
theorem mul_leftUnitor {M : Mon_ C} :
(tensor_ΞΌ C (π_ C, M.X) (π_ C, M.X) β« ((Ξ»_ (π_ C)).hom β M.mul)) β« (Ξ»_ M.X).hom =
((Ξ»_ M.X).hom β (Ξ»_ M.X).hom) β« M.mul := by
rw [β Category.comp_id (Ξ»_ (π_ C)).hom, β Category.id_comp M.mul, tensor_comp]
slice_lhs 3 4 =>
|
rw [leftUnitor_naturality]
|
theorem mul_leftUnitor {M : Mon_ C} :
(tensor_ΞΌ C (π_ C, M.X) (π_ C, M.X) β« ((Ξ»_ (π_ C)).hom β M.mul)) β« (Ξ»_ M.X).hom =
((Ξ»_ M.X).hom β (Ξ»_ M.X).hom) β« M.mul := by
rw [β Category.comp_id (Ξ»_ (π_ C)).hom, β Category.id_comp M.mul, tensor_comp]
slice_lhs 3 4 =>
|
Mathlib.CategoryTheory.Monoidal.Mon_.460_0.NTUMzhXPwXsmsYt
|
theorem mul_leftUnitor {M : Mon_ C} :
(tensor_ΞΌ C (π_ C, M.X) (π_ C, M.X) β« ((Ξ»_ (π_ C)).hom β M.mul)) β« (Ξ»_ M.X).hom =
((Ξ»_ M.X).hom β (Ξ»_ M.X).hom) β« M.mul
|
Mathlib_CategoryTheory_Monoidal_Mon_
|
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M : Mon_ C
β’ tensor_ΞΌ C (π_ C, M.X) (π_ C, M.X) β« ((Ξ»_ (π_ C)).hom β π (M.X β M.X)) β« (Ξ»_ (M.X β M.X)).hom β« M.mul =
((Ξ»_ M.X).hom β (Ξ»_ M.X).hom) β« π (M.X β M.X) β« M.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] }
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
#align Mon_.one_right_unitor Mon_.one_rightUnitor
variable [BraidedCategory C]
theorem Mon_tensor_one_mul (M N : Mon_ C) :
((Ξ»_ (π_ C)).inv β« (M.one β N.one) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ»_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, one_mul M, one_mul N]
symm
exact tensor_left_unitality C M.X N.X
#align Mon_.Mon_tensor_one_mul Mon_.Mon_tensor_one_mul
theorem Mon_tensor_mul_one (M N : Mon_ C) :
(π (M.X β N.X) β (Ξ»_ (π_ C)).inv β« (M.one β N.one)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ο_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_one M, mul_one N]
symm
exact tensor_right_unitality C M.X N.X
#align Mon_.Mon_tensor_mul_one Mon_.Mon_tensor_mul_one
theorem Mon_tensor_mul_assoc (M N : Mon_ C) :
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ±_ (M.X β N.X) (M.X β N.X) (M.X β N.X)).hom β«
(π (M.X β N.X) β tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_assoc M, mul_assoc N, tensor_comp, tensor_comp]
-- Porting note: needed to add `dsimp` here.
slice_lhs 1 3 => dsimp; rw [tensor_associativity]
slice_lhs 3 4 => rw [β tensor_ΞΌ_natural]
slice_lhs 2 3 => rw [β tensor_comp, tensor_id]
simp only [Category.assoc]
#align Mon_.Mon_tensor_mul_assoc Mon_.Mon_tensor_mul_assoc
theorem mul_associator {M N P : Mon_ C} :
(tensor_ΞΌ C (M.X β N.X, P.X) (M.X β N.X, P.X) β«
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β P.mul)) β«
(Ξ±_ M.X N.X P.X).hom =
((Ξ±_ M.X N.X P.X).hom β (Ξ±_ M.X N.X P.X).hom) β«
tensor_ΞΌ C (M.X, N.X β P.X) (M.X, N.X β P.X) β«
(M.mul β tensor_ΞΌ C (N.X, P.X) (N.X, P.X) β« (N.mul β P.mul)) := by
simp only [tensor_obj, prodMonoidal_tensorObj, Category.assoc]
slice_lhs 2 3 => rw [β Category.id_comp P.mul, tensor_comp]
slice_lhs 3 4 => rw [associator_naturality]
slice_rhs 3 4 => rw [β Category.id_comp M.mul, tensor_comp]
slice_lhs 1 3 => rw [associator_monoidal]
simp only [Category.assoc]
#align Mon_.mul_associator Mon_.mul_associator
theorem mul_leftUnitor {M : Mon_ C} :
(tensor_ΞΌ C (π_ C, M.X) (π_ C, M.X) β« ((Ξ»_ (π_ C)).hom β M.mul)) β« (Ξ»_ M.X).hom =
((Ξ»_ M.X).hom β (Ξ»_ M.X).hom) β« M.mul := by
rw [β Category.comp_id (Ξ»_ (π_ C)).hom, β Category.id_comp M.mul, tensor_comp]
slice_lhs 3 4 => rw [leftUnitor_naturality]
|
slice_lhs 1 3 => rw [β leftUnitor_monoidal]
|
theorem mul_leftUnitor {M : Mon_ C} :
(tensor_ΞΌ C (π_ C, M.X) (π_ C, M.X) β« ((Ξ»_ (π_ C)).hom β M.mul)) β« (Ξ»_ M.X).hom =
((Ξ»_ M.X).hom β (Ξ»_ M.X).hom) β« M.mul := by
rw [β Category.comp_id (Ξ»_ (π_ C)).hom, β Category.id_comp M.mul, tensor_comp]
slice_lhs 3 4 => rw [leftUnitor_naturality]
|
Mathlib.CategoryTheory.Monoidal.Mon_.460_0.NTUMzhXPwXsmsYt
|
theorem mul_leftUnitor {M : Mon_ C} :
(tensor_ΞΌ C (π_ C, M.X) (π_ C, M.X) β« ((Ξ»_ (π_ C)).hom β M.mul)) β« (Ξ»_ M.X).hom =
((Ξ»_ M.X).hom β (Ξ»_ M.X).hom) β« M.mul
|
Mathlib_CategoryTheory_Monoidal_Mon_
|
case a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M : Mon_ C
| tensor_ΞΌ C (π_ C, M.X) (π_ C, M.X) β« ((Ξ»_ (π_ C)).hom β π (M.X β M.X)) β« (Ξ»_ (M.X β M.X)).hom
case a C : Type uβ instβΒ² : Category.{vβ, uβ} C instβΒΉ : MonoidalCategory C instβ : BraidedCategory C M : Mon_ C | M.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] }
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
#align Mon_.one_right_unitor Mon_.one_rightUnitor
variable [BraidedCategory C]
theorem Mon_tensor_one_mul (M N : Mon_ C) :
((Ξ»_ (π_ C)).inv β« (M.one β N.one) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ»_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, one_mul M, one_mul N]
symm
exact tensor_left_unitality C M.X N.X
#align Mon_.Mon_tensor_one_mul Mon_.Mon_tensor_one_mul
theorem Mon_tensor_mul_one (M N : Mon_ C) :
(π (M.X β N.X) β (Ξ»_ (π_ C)).inv β« (M.one β N.one)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ο_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_one M, mul_one N]
symm
exact tensor_right_unitality C M.X N.X
#align Mon_.Mon_tensor_mul_one Mon_.Mon_tensor_mul_one
theorem Mon_tensor_mul_assoc (M N : Mon_ C) :
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ±_ (M.X β N.X) (M.X β N.X) (M.X β N.X)).hom β«
(π (M.X β N.X) β tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_assoc M, mul_assoc N, tensor_comp, tensor_comp]
-- Porting note: needed to add `dsimp` here.
slice_lhs 1 3 => dsimp; rw [tensor_associativity]
slice_lhs 3 4 => rw [β tensor_ΞΌ_natural]
slice_lhs 2 3 => rw [β tensor_comp, tensor_id]
simp only [Category.assoc]
#align Mon_.Mon_tensor_mul_assoc Mon_.Mon_tensor_mul_assoc
theorem mul_associator {M N P : Mon_ C} :
(tensor_ΞΌ C (M.X β N.X, P.X) (M.X β N.X, P.X) β«
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β P.mul)) β«
(Ξ±_ M.X N.X P.X).hom =
((Ξ±_ M.X N.X P.X).hom β (Ξ±_ M.X N.X P.X).hom) β«
tensor_ΞΌ C (M.X, N.X β P.X) (M.X, N.X β P.X) β«
(M.mul β tensor_ΞΌ C (N.X, P.X) (N.X, P.X) β« (N.mul β P.mul)) := by
simp only [tensor_obj, prodMonoidal_tensorObj, Category.assoc]
slice_lhs 2 3 => rw [β Category.id_comp P.mul, tensor_comp]
slice_lhs 3 4 => rw [associator_naturality]
slice_rhs 3 4 => rw [β Category.id_comp M.mul, tensor_comp]
slice_lhs 1 3 => rw [associator_monoidal]
simp only [Category.assoc]
#align Mon_.mul_associator Mon_.mul_associator
theorem mul_leftUnitor {M : Mon_ C} :
(tensor_ΞΌ C (π_ C, M.X) (π_ C, M.X) β« ((Ξ»_ (π_ C)).hom β M.mul)) β« (Ξ»_ M.X).hom =
((Ξ»_ M.X).hom β (Ξ»_ M.X).hom) β« M.mul := by
rw [β Category.comp_id (Ξ»_ (π_ C)).hom, β Category.id_comp M.mul, tensor_comp]
slice_lhs 3 4 => rw [leftUnitor_naturality]
slice_lhs 1 3 =>
|
rw [β leftUnitor_monoidal]
|
theorem mul_leftUnitor {M : Mon_ C} :
(tensor_ΞΌ C (π_ C, M.X) (π_ C, M.X) β« ((Ξ»_ (π_ C)).hom β M.mul)) β« (Ξ»_ M.X).hom =
((Ξ»_ M.X).hom β (Ξ»_ M.X).hom) β« M.mul := by
rw [β Category.comp_id (Ξ»_ (π_ C)).hom, β Category.id_comp M.mul, tensor_comp]
slice_lhs 3 4 => rw [leftUnitor_naturality]
slice_lhs 1 3 =>
|
Mathlib.CategoryTheory.Monoidal.Mon_.460_0.NTUMzhXPwXsmsYt
|
theorem mul_leftUnitor {M : Mon_ C} :
(tensor_ΞΌ C (π_ C, M.X) (π_ C, M.X) β« ((Ξ»_ (π_ C)).hom β M.mul)) β« (Ξ»_ M.X).hom =
((Ξ»_ M.X).hom β (Ξ»_ M.X).hom) β« M.mul
|
Mathlib_CategoryTheory_Monoidal_Mon_
|
case a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M : Mon_ C
| tensor_ΞΌ C (π_ C, M.X) (π_ C, M.X) β« ((Ξ»_ (π_ C)).hom β π (M.X β M.X)) β« (Ξ»_ (M.X β M.X)).hom
case a C : Type uβ instβΒ² : Category.{vβ, uβ} C instβΒΉ : MonoidalCategory C instβ : BraidedCategory C M : Mon_ C | M.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] }
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
#align Mon_.one_right_unitor Mon_.one_rightUnitor
variable [BraidedCategory C]
theorem Mon_tensor_one_mul (M N : Mon_ C) :
((Ξ»_ (π_ C)).inv β« (M.one β N.one) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ»_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, one_mul M, one_mul N]
symm
exact tensor_left_unitality C M.X N.X
#align Mon_.Mon_tensor_one_mul Mon_.Mon_tensor_one_mul
theorem Mon_tensor_mul_one (M N : Mon_ C) :
(π (M.X β N.X) β (Ξ»_ (π_ C)).inv β« (M.one β N.one)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ο_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_one M, mul_one N]
symm
exact tensor_right_unitality C M.X N.X
#align Mon_.Mon_tensor_mul_one Mon_.Mon_tensor_mul_one
theorem Mon_tensor_mul_assoc (M N : Mon_ C) :
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ±_ (M.X β N.X) (M.X β N.X) (M.X β N.X)).hom β«
(π (M.X β N.X) β tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_assoc M, mul_assoc N, tensor_comp, tensor_comp]
-- Porting note: needed to add `dsimp` here.
slice_lhs 1 3 => dsimp; rw [tensor_associativity]
slice_lhs 3 4 => rw [β tensor_ΞΌ_natural]
slice_lhs 2 3 => rw [β tensor_comp, tensor_id]
simp only [Category.assoc]
#align Mon_.Mon_tensor_mul_assoc Mon_.Mon_tensor_mul_assoc
theorem mul_associator {M N P : Mon_ C} :
(tensor_ΞΌ C (M.X β N.X, P.X) (M.X β N.X, P.X) β«
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β P.mul)) β«
(Ξ±_ M.X N.X P.X).hom =
((Ξ±_ M.X N.X P.X).hom β (Ξ±_ M.X N.X P.X).hom) β«
tensor_ΞΌ C (M.X, N.X β P.X) (M.X, N.X β P.X) β«
(M.mul β tensor_ΞΌ C (N.X, P.X) (N.X, P.X) β« (N.mul β P.mul)) := by
simp only [tensor_obj, prodMonoidal_tensorObj, Category.assoc]
slice_lhs 2 3 => rw [β Category.id_comp P.mul, tensor_comp]
slice_lhs 3 4 => rw [associator_naturality]
slice_rhs 3 4 => rw [β Category.id_comp M.mul, tensor_comp]
slice_lhs 1 3 => rw [associator_monoidal]
simp only [Category.assoc]
#align Mon_.mul_associator Mon_.mul_associator
theorem mul_leftUnitor {M : Mon_ C} :
(tensor_ΞΌ C (π_ C, M.X) (π_ C, M.X) β« ((Ξ»_ (π_ C)).hom β M.mul)) β« (Ξ»_ M.X).hom =
((Ξ»_ M.X).hom β (Ξ»_ M.X).hom) β« M.mul := by
rw [β Category.comp_id (Ξ»_ (π_ C)).hom, β Category.id_comp M.mul, tensor_comp]
slice_lhs 3 4 => rw [leftUnitor_naturality]
slice_lhs 1 3 =>
|
rw [β leftUnitor_monoidal]
|
theorem mul_leftUnitor {M : Mon_ C} :
(tensor_ΞΌ C (π_ C, M.X) (π_ C, M.X) β« ((Ξ»_ (π_ C)).hom β M.mul)) β« (Ξ»_ M.X).hom =
((Ξ»_ M.X).hom β (Ξ»_ M.X).hom) β« M.mul := by
rw [β Category.comp_id (Ξ»_ (π_ C)).hom, β Category.id_comp M.mul, tensor_comp]
slice_lhs 3 4 => rw [leftUnitor_naturality]
slice_lhs 1 3 =>
|
Mathlib.CategoryTheory.Monoidal.Mon_.460_0.NTUMzhXPwXsmsYt
|
theorem mul_leftUnitor {M : Mon_ C} :
(tensor_ΞΌ C (π_ C, M.X) (π_ C, M.X) β« ((Ξ»_ (π_ C)).hom β M.mul)) β« (Ξ»_ M.X).hom =
((Ξ»_ M.X).hom β (Ξ»_ M.X).hom) β« M.mul
|
Mathlib_CategoryTheory_Monoidal_Mon_
|
case a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M : Mon_ C
| tensor_ΞΌ C (π_ C, M.X) (π_ C, M.X) β« ((Ξ»_ (π_ C)).hom β π (M.X β M.X)) β« (Ξ»_ (M.X β M.X)).hom
case a C : Type uβ instβΒ² : Category.{vβ, uβ} C instβΒΉ : MonoidalCategory C instβ : BraidedCategory C M : Mon_ C | M.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] }
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
#align Mon_.one_right_unitor Mon_.one_rightUnitor
variable [BraidedCategory C]
theorem Mon_tensor_one_mul (M N : Mon_ C) :
((Ξ»_ (π_ C)).inv β« (M.one β N.one) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ»_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, one_mul M, one_mul N]
symm
exact tensor_left_unitality C M.X N.X
#align Mon_.Mon_tensor_one_mul Mon_.Mon_tensor_one_mul
theorem Mon_tensor_mul_one (M N : Mon_ C) :
(π (M.X β N.X) β (Ξ»_ (π_ C)).inv β« (M.one β N.one)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ο_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_one M, mul_one N]
symm
exact tensor_right_unitality C M.X N.X
#align Mon_.Mon_tensor_mul_one Mon_.Mon_tensor_mul_one
theorem Mon_tensor_mul_assoc (M N : Mon_ C) :
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ±_ (M.X β N.X) (M.X β N.X) (M.X β N.X)).hom β«
(π (M.X β N.X) β tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_assoc M, mul_assoc N, tensor_comp, tensor_comp]
-- Porting note: needed to add `dsimp` here.
slice_lhs 1 3 => dsimp; rw [tensor_associativity]
slice_lhs 3 4 => rw [β tensor_ΞΌ_natural]
slice_lhs 2 3 => rw [β tensor_comp, tensor_id]
simp only [Category.assoc]
#align Mon_.Mon_tensor_mul_assoc Mon_.Mon_tensor_mul_assoc
theorem mul_associator {M N P : Mon_ C} :
(tensor_ΞΌ C (M.X β N.X, P.X) (M.X β N.X, P.X) β«
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β P.mul)) β«
(Ξ±_ M.X N.X P.X).hom =
((Ξ±_ M.X N.X P.X).hom β (Ξ±_ M.X N.X P.X).hom) β«
tensor_ΞΌ C (M.X, N.X β P.X) (M.X, N.X β P.X) β«
(M.mul β tensor_ΞΌ C (N.X, P.X) (N.X, P.X) β« (N.mul β P.mul)) := by
simp only [tensor_obj, prodMonoidal_tensorObj, Category.assoc]
slice_lhs 2 3 => rw [β Category.id_comp P.mul, tensor_comp]
slice_lhs 3 4 => rw [associator_naturality]
slice_rhs 3 4 => rw [β Category.id_comp M.mul, tensor_comp]
slice_lhs 1 3 => rw [associator_monoidal]
simp only [Category.assoc]
#align Mon_.mul_associator Mon_.mul_associator
theorem mul_leftUnitor {M : Mon_ C} :
(tensor_ΞΌ C (π_ C, M.X) (π_ C, M.X) β« ((Ξ»_ (π_ C)).hom β M.mul)) β« (Ξ»_ M.X).hom =
((Ξ»_ M.X).hom β (Ξ»_ M.X).hom) β« M.mul := by
rw [β Category.comp_id (Ξ»_ (π_ C)).hom, β Category.id_comp M.mul, tensor_comp]
slice_lhs 3 4 => rw [leftUnitor_naturality]
slice_lhs 1 3 =>
|
rw [β leftUnitor_monoidal]
|
theorem mul_leftUnitor {M : Mon_ C} :
(tensor_ΞΌ C (π_ C, M.X) (π_ C, M.X) β« ((Ξ»_ (π_ C)).hom β M.mul)) β« (Ξ»_ M.X).hom =
((Ξ»_ M.X).hom β (Ξ»_ M.X).hom) β« M.mul := by
rw [β Category.comp_id (Ξ»_ (π_ C)).hom, β Category.id_comp M.mul, tensor_comp]
slice_lhs 3 4 => rw [leftUnitor_naturality]
slice_lhs 1 3 =>
|
Mathlib.CategoryTheory.Monoidal.Mon_.460_0.NTUMzhXPwXsmsYt
|
theorem mul_leftUnitor {M : Mon_ C} :
(tensor_ΞΌ C (π_ C, M.X) (π_ C, M.X) β« ((Ξ»_ (π_ C)).hom β M.mul)) β« (Ξ»_ M.X).hom =
((Ξ»_ M.X).hom β (Ξ»_ M.X).hom) β« M.mul
|
Mathlib_CategoryTheory_Monoidal_Mon_
|
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M : Mon_ C
β’ ((Ξ»_ M.X).hom β (Ξ»_ M.X).hom) β« M.mul = ((Ξ»_ M.X).hom β (Ξ»_ M.X).hom) β« π (M.X β M.X) β« M.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] }
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
#align Mon_.one_right_unitor Mon_.one_rightUnitor
variable [BraidedCategory C]
theorem Mon_tensor_one_mul (M N : Mon_ C) :
((Ξ»_ (π_ C)).inv β« (M.one β N.one) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ»_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, one_mul M, one_mul N]
symm
exact tensor_left_unitality C M.X N.X
#align Mon_.Mon_tensor_one_mul Mon_.Mon_tensor_one_mul
theorem Mon_tensor_mul_one (M N : Mon_ C) :
(π (M.X β N.X) β (Ξ»_ (π_ C)).inv β« (M.one β N.one)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ο_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_one M, mul_one N]
symm
exact tensor_right_unitality C M.X N.X
#align Mon_.Mon_tensor_mul_one Mon_.Mon_tensor_mul_one
theorem Mon_tensor_mul_assoc (M N : Mon_ C) :
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ±_ (M.X β N.X) (M.X β N.X) (M.X β N.X)).hom β«
(π (M.X β N.X) β tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_assoc M, mul_assoc N, tensor_comp, tensor_comp]
-- Porting note: needed to add `dsimp` here.
slice_lhs 1 3 => dsimp; rw [tensor_associativity]
slice_lhs 3 4 => rw [β tensor_ΞΌ_natural]
slice_lhs 2 3 => rw [β tensor_comp, tensor_id]
simp only [Category.assoc]
#align Mon_.Mon_tensor_mul_assoc Mon_.Mon_tensor_mul_assoc
theorem mul_associator {M N P : Mon_ C} :
(tensor_ΞΌ C (M.X β N.X, P.X) (M.X β N.X, P.X) β«
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β P.mul)) β«
(Ξ±_ M.X N.X P.X).hom =
((Ξ±_ M.X N.X P.X).hom β (Ξ±_ M.X N.X P.X).hom) β«
tensor_ΞΌ C (M.X, N.X β P.X) (M.X, N.X β P.X) β«
(M.mul β tensor_ΞΌ C (N.X, P.X) (N.X, P.X) β« (N.mul β P.mul)) := by
simp only [tensor_obj, prodMonoidal_tensorObj, Category.assoc]
slice_lhs 2 3 => rw [β Category.id_comp P.mul, tensor_comp]
slice_lhs 3 4 => rw [associator_naturality]
slice_rhs 3 4 => rw [β Category.id_comp M.mul, tensor_comp]
slice_lhs 1 3 => rw [associator_monoidal]
simp only [Category.assoc]
#align Mon_.mul_associator Mon_.mul_associator
theorem mul_leftUnitor {M : Mon_ C} :
(tensor_ΞΌ C (π_ C, M.X) (π_ C, M.X) β« ((Ξ»_ (π_ C)).hom β M.mul)) β« (Ξ»_ M.X).hom =
((Ξ»_ M.X).hom β (Ξ»_ M.X).hom) β« M.mul := by
rw [β Category.comp_id (Ξ»_ (π_ C)).hom, β Category.id_comp M.mul, tensor_comp]
slice_lhs 3 4 => rw [leftUnitor_naturality]
slice_lhs 1 3 => rw [β leftUnitor_monoidal]
|
simp only [Category.assoc, Category.id_comp]
|
theorem mul_leftUnitor {M : Mon_ C} :
(tensor_ΞΌ C (π_ C, M.X) (π_ C, M.X) β« ((Ξ»_ (π_ C)).hom β M.mul)) β« (Ξ»_ M.X).hom =
((Ξ»_ M.X).hom β (Ξ»_ M.X).hom) β« M.mul := by
rw [β Category.comp_id (Ξ»_ (π_ C)).hom, β Category.id_comp M.mul, tensor_comp]
slice_lhs 3 4 => rw [leftUnitor_naturality]
slice_lhs 1 3 => rw [β leftUnitor_monoidal]
|
Mathlib.CategoryTheory.Monoidal.Mon_.460_0.NTUMzhXPwXsmsYt
|
theorem mul_leftUnitor {M : Mon_ C} :
(tensor_ΞΌ C (π_ C, M.X) (π_ C, M.X) β« ((Ξ»_ (π_ C)).hom β M.mul)) β« (Ξ»_ M.X).hom =
((Ξ»_ M.X).hom β (Ξ»_ M.X).hom) β« M.mul
|
Mathlib_CategoryTheory_Monoidal_Mon_
|
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M : Mon_ C
β’ (tensor_ΞΌ C (M.X, π_ C) (M.X, π_ C) β« (M.mul β (Ξ»_ (π_ C)).hom)) β« (Ο_ M.X).hom =
((Ο_ M.X).hom β (Ο_ M.X).hom) β« M.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] }
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
#align Mon_.one_right_unitor Mon_.one_rightUnitor
variable [BraidedCategory C]
theorem Mon_tensor_one_mul (M N : Mon_ C) :
((Ξ»_ (π_ C)).inv β« (M.one β N.one) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ»_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, one_mul M, one_mul N]
symm
exact tensor_left_unitality C M.X N.X
#align Mon_.Mon_tensor_one_mul Mon_.Mon_tensor_one_mul
theorem Mon_tensor_mul_one (M N : Mon_ C) :
(π (M.X β N.X) β (Ξ»_ (π_ C)).inv β« (M.one β N.one)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ο_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_one M, mul_one N]
symm
exact tensor_right_unitality C M.X N.X
#align Mon_.Mon_tensor_mul_one Mon_.Mon_tensor_mul_one
theorem Mon_tensor_mul_assoc (M N : Mon_ C) :
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ±_ (M.X β N.X) (M.X β N.X) (M.X β N.X)).hom β«
(π (M.X β N.X) β tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_assoc M, mul_assoc N, tensor_comp, tensor_comp]
-- Porting note: needed to add `dsimp` here.
slice_lhs 1 3 => dsimp; rw [tensor_associativity]
slice_lhs 3 4 => rw [β tensor_ΞΌ_natural]
slice_lhs 2 3 => rw [β tensor_comp, tensor_id]
simp only [Category.assoc]
#align Mon_.Mon_tensor_mul_assoc Mon_.Mon_tensor_mul_assoc
theorem mul_associator {M N P : Mon_ C} :
(tensor_ΞΌ C (M.X β N.X, P.X) (M.X β N.X, P.X) β«
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β P.mul)) β«
(Ξ±_ M.X N.X P.X).hom =
((Ξ±_ M.X N.X P.X).hom β (Ξ±_ M.X N.X P.X).hom) β«
tensor_ΞΌ C (M.X, N.X β P.X) (M.X, N.X β P.X) β«
(M.mul β tensor_ΞΌ C (N.X, P.X) (N.X, P.X) β« (N.mul β P.mul)) := by
simp only [tensor_obj, prodMonoidal_tensorObj, Category.assoc]
slice_lhs 2 3 => rw [β Category.id_comp P.mul, tensor_comp]
slice_lhs 3 4 => rw [associator_naturality]
slice_rhs 3 4 => rw [β Category.id_comp M.mul, tensor_comp]
slice_lhs 1 3 => rw [associator_monoidal]
simp only [Category.assoc]
#align Mon_.mul_associator Mon_.mul_associator
theorem mul_leftUnitor {M : Mon_ C} :
(tensor_ΞΌ C (π_ C, M.X) (π_ C, M.X) β« ((Ξ»_ (π_ C)).hom β M.mul)) β« (Ξ»_ M.X).hom =
((Ξ»_ M.X).hom β (Ξ»_ M.X).hom) β« M.mul := by
rw [β Category.comp_id (Ξ»_ (π_ C)).hom, β Category.id_comp M.mul, tensor_comp]
slice_lhs 3 4 => rw [leftUnitor_naturality]
slice_lhs 1 3 => rw [β leftUnitor_monoidal]
simp only [Category.assoc, Category.id_comp]
#align Mon_.mul_left_unitor Mon_.mul_leftUnitor
theorem mul_rightUnitor {M : Mon_ C} :
(tensor_ΞΌ C (M.X, π_ C) (M.X, π_ C) β« (M.mul β (Ξ»_ (π_ C)).hom)) β« (Ο_ M.X).hom =
((Ο_ M.X).hom β (Ο_ M.X).hom) β« M.mul := by
|
rw [β Category.id_comp M.mul, β Category.comp_id (Ξ»_ (π_ C)).hom, tensor_comp]
|
theorem mul_rightUnitor {M : Mon_ C} :
(tensor_ΞΌ C (M.X, π_ C) (M.X, π_ C) β« (M.mul β (Ξ»_ (π_ C)).hom)) β« (Ο_ M.X).hom =
((Ο_ M.X).hom β (Ο_ M.X).hom) β« M.mul := by
|
Mathlib.CategoryTheory.Monoidal.Mon_.469_0.NTUMzhXPwXsmsYt
|
theorem mul_rightUnitor {M : Mon_ C} :
(tensor_ΞΌ C (M.X, π_ C) (M.X, π_ C) β« (M.mul β (Ξ»_ (π_ C)).hom)) β« (Ο_ M.X).hom =
((Ο_ M.X).hom β (Ο_ M.X).hom) β« M.mul
|
Mathlib_CategoryTheory_Monoidal_Mon_
|
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M : Mon_ C
β’ (tensor_ΞΌ C (M.X, π_ C) (M.X, π_ C) β« (π (M.X β M.X) β (Ξ»_ (π_ C)).hom) β« (M.mul β π (π_ C))) β« (Ο_ M.X).hom =
((Ο_ M.X).hom β (Ο_ M.X).hom) β« π (M.X β M.X) β« M.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] }
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
#align Mon_.one_right_unitor Mon_.one_rightUnitor
variable [BraidedCategory C]
theorem Mon_tensor_one_mul (M N : Mon_ C) :
((Ξ»_ (π_ C)).inv β« (M.one β N.one) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ»_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, one_mul M, one_mul N]
symm
exact tensor_left_unitality C M.X N.X
#align Mon_.Mon_tensor_one_mul Mon_.Mon_tensor_one_mul
theorem Mon_tensor_mul_one (M N : Mon_ C) :
(π (M.X β N.X) β (Ξ»_ (π_ C)).inv β« (M.one β N.one)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ο_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_one M, mul_one N]
symm
exact tensor_right_unitality C M.X N.X
#align Mon_.Mon_tensor_mul_one Mon_.Mon_tensor_mul_one
theorem Mon_tensor_mul_assoc (M N : Mon_ C) :
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ±_ (M.X β N.X) (M.X β N.X) (M.X β N.X)).hom β«
(π (M.X β N.X) β tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_assoc M, mul_assoc N, tensor_comp, tensor_comp]
-- Porting note: needed to add `dsimp` here.
slice_lhs 1 3 => dsimp; rw [tensor_associativity]
slice_lhs 3 4 => rw [β tensor_ΞΌ_natural]
slice_lhs 2 3 => rw [β tensor_comp, tensor_id]
simp only [Category.assoc]
#align Mon_.Mon_tensor_mul_assoc Mon_.Mon_tensor_mul_assoc
theorem mul_associator {M N P : Mon_ C} :
(tensor_ΞΌ C (M.X β N.X, P.X) (M.X β N.X, P.X) β«
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β P.mul)) β«
(Ξ±_ M.X N.X P.X).hom =
((Ξ±_ M.X N.X P.X).hom β (Ξ±_ M.X N.X P.X).hom) β«
tensor_ΞΌ C (M.X, N.X β P.X) (M.X, N.X β P.X) β«
(M.mul β tensor_ΞΌ C (N.X, P.X) (N.X, P.X) β« (N.mul β P.mul)) := by
simp only [tensor_obj, prodMonoidal_tensorObj, Category.assoc]
slice_lhs 2 3 => rw [β Category.id_comp P.mul, tensor_comp]
slice_lhs 3 4 => rw [associator_naturality]
slice_rhs 3 4 => rw [β Category.id_comp M.mul, tensor_comp]
slice_lhs 1 3 => rw [associator_monoidal]
simp only [Category.assoc]
#align Mon_.mul_associator Mon_.mul_associator
theorem mul_leftUnitor {M : Mon_ C} :
(tensor_ΞΌ C (π_ C, M.X) (π_ C, M.X) β« ((Ξ»_ (π_ C)).hom β M.mul)) β« (Ξ»_ M.X).hom =
((Ξ»_ M.X).hom β (Ξ»_ M.X).hom) β« M.mul := by
rw [β Category.comp_id (Ξ»_ (π_ C)).hom, β Category.id_comp M.mul, tensor_comp]
slice_lhs 3 4 => rw [leftUnitor_naturality]
slice_lhs 1 3 => rw [β leftUnitor_monoidal]
simp only [Category.assoc, Category.id_comp]
#align Mon_.mul_left_unitor Mon_.mul_leftUnitor
theorem mul_rightUnitor {M : Mon_ C} :
(tensor_ΞΌ C (M.X, π_ C) (M.X, π_ C) β« (M.mul β (Ξ»_ (π_ C)).hom)) β« (Ο_ M.X).hom =
((Ο_ M.X).hom β (Ο_ M.X).hom) β« M.mul := by
rw [β Category.id_comp M.mul, β Category.comp_id (Ξ»_ (π_ C)).hom, tensor_comp]
|
slice_lhs 3 4 => rw [rightUnitor_naturality]
|
theorem mul_rightUnitor {M : Mon_ C} :
(tensor_ΞΌ C (M.X, π_ C) (M.X, π_ C) β« (M.mul β (Ξ»_ (π_ C)).hom)) β« (Ο_ M.X).hom =
((Ο_ M.X).hom β (Ο_ M.X).hom) β« M.mul := by
rw [β Category.id_comp M.mul, β Category.comp_id (Ξ»_ (π_ C)).hom, tensor_comp]
|
Mathlib.CategoryTheory.Monoidal.Mon_.469_0.NTUMzhXPwXsmsYt
|
theorem mul_rightUnitor {M : Mon_ C} :
(tensor_ΞΌ C (M.X, π_ C) (M.X, π_ C) β« (M.mul β (Ξ»_ (π_ C)).hom)) β« (Ο_ M.X).hom =
((Ο_ M.X).hom β (Ο_ M.X).hom) β« M.mul
|
Mathlib_CategoryTheory_Monoidal_Mon_
|
case a.a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M : Mon_ C
| (M.mul β π (π_ C)) β« (Ο_ M.X).hom
case a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M : Mon_ C
| tensor_ΞΌ C (M.X, π_ C) (M.X, π_ C)
case a.a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M : Mon_ C
| π (M.X β M.X) β (Ξ»_ (π_ C)).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]
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
#align Mon_.one_right_unitor Mon_.one_rightUnitor
variable [BraidedCategory C]
theorem Mon_tensor_one_mul (M N : Mon_ C) :
((Ξ»_ (π_ C)).inv β« (M.one β N.one) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ»_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, one_mul M, one_mul N]
symm
exact tensor_left_unitality C M.X N.X
#align Mon_.Mon_tensor_one_mul Mon_.Mon_tensor_one_mul
theorem Mon_tensor_mul_one (M N : Mon_ C) :
(π (M.X β N.X) β (Ξ»_ (π_ C)).inv β« (M.one β N.one)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ο_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_one M, mul_one N]
symm
exact tensor_right_unitality C M.X N.X
#align Mon_.Mon_tensor_mul_one Mon_.Mon_tensor_mul_one
theorem Mon_tensor_mul_assoc (M N : Mon_ C) :
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ±_ (M.X β N.X) (M.X β N.X) (M.X β N.X)).hom β«
(π (M.X β N.X) β tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_assoc M, mul_assoc N, tensor_comp, tensor_comp]
-- Porting note: needed to add `dsimp` here.
slice_lhs 1 3 => dsimp; rw [tensor_associativity]
slice_lhs 3 4 => rw [β tensor_ΞΌ_natural]
slice_lhs 2 3 => rw [β tensor_comp, tensor_id]
simp only [Category.assoc]
#align Mon_.Mon_tensor_mul_assoc Mon_.Mon_tensor_mul_assoc
theorem mul_associator {M N P : Mon_ C} :
(tensor_ΞΌ C (M.X β N.X, P.X) (M.X β N.X, P.X) β«
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β P.mul)) β«
(Ξ±_ M.X N.X P.X).hom =
((Ξ±_ M.X N.X P.X).hom β (Ξ±_ M.X N.X P.X).hom) β«
tensor_ΞΌ C (M.X, N.X β P.X) (M.X, N.X β P.X) β«
(M.mul β tensor_ΞΌ C (N.X, P.X) (N.X, P.X) β« (N.mul β P.mul)) := by
simp only [tensor_obj, prodMonoidal_tensorObj, Category.assoc]
slice_lhs 2 3 => rw [β Category.id_comp P.mul, tensor_comp]
slice_lhs 3 4 => rw [associator_naturality]
slice_rhs 3 4 => rw [β Category.id_comp M.mul, tensor_comp]
slice_lhs 1 3 => rw [associator_monoidal]
simp only [Category.assoc]
#align Mon_.mul_associator Mon_.mul_associator
theorem mul_leftUnitor {M : Mon_ C} :
(tensor_ΞΌ C (π_ C, M.X) (π_ C, M.X) β« ((Ξ»_ (π_ C)).hom β M.mul)) β« (Ξ»_ M.X).hom =
((Ξ»_ M.X).hom β (Ξ»_ M.X).hom) β« M.mul := by
rw [β Category.comp_id (Ξ»_ (π_ C)).hom, β Category.id_comp M.mul, tensor_comp]
slice_lhs 3 4 => rw [leftUnitor_naturality]
slice_lhs 1 3 => rw [β leftUnitor_monoidal]
simp only [Category.assoc, Category.id_comp]
#align Mon_.mul_left_unitor Mon_.mul_leftUnitor
theorem mul_rightUnitor {M : Mon_ C} :
(tensor_ΞΌ C (M.X, π_ C) (M.X, π_ C) β« (M.mul β (Ξ»_ (π_ C)).hom)) β« (Ο_ M.X).hom =
((Ο_ M.X).hom β (Ο_ M.X).hom) β« M.mul := by
rw [β Category.id_comp M.mul, β Category.comp_id (Ξ»_ (π_ C)).hom, tensor_comp]
slice_lhs 3 4 =>
|
rw [rightUnitor_naturality]
|
theorem mul_rightUnitor {M : Mon_ C} :
(tensor_ΞΌ C (M.X, π_ C) (M.X, π_ C) β« (M.mul β (Ξ»_ (π_ C)).hom)) β« (Ο_ M.X).hom =
((Ο_ M.X).hom β (Ο_ M.X).hom) β« M.mul := by
rw [β Category.id_comp M.mul, β Category.comp_id (Ξ»_ (π_ C)).hom, tensor_comp]
slice_lhs 3 4 =>
|
Mathlib.CategoryTheory.Monoidal.Mon_.469_0.NTUMzhXPwXsmsYt
|
theorem mul_rightUnitor {M : Mon_ C} :
(tensor_ΞΌ C (M.X, π_ C) (M.X, π_ C) β« (M.mul β (Ξ»_ (π_ C)).hom)) β« (Ο_ M.X).hom =
((Ο_ M.X).hom β (Ο_ M.X).hom) β« M.mul
|
Mathlib_CategoryTheory_Monoidal_Mon_
|
case a.a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M : Mon_ C
| (M.mul β π (π_ C)) β« (Ο_ M.X).hom
case a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M : Mon_ C
| tensor_ΞΌ C (M.X, π_ C) (M.X, π_ C)
case a.a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M : Mon_ C
| π (M.X β M.X) β (Ξ»_ (π_ C)).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]
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
#align Mon_.one_right_unitor Mon_.one_rightUnitor
variable [BraidedCategory C]
theorem Mon_tensor_one_mul (M N : Mon_ C) :
((Ξ»_ (π_ C)).inv β« (M.one β N.one) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ»_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, one_mul M, one_mul N]
symm
exact tensor_left_unitality C M.X N.X
#align Mon_.Mon_tensor_one_mul Mon_.Mon_tensor_one_mul
theorem Mon_tensor_mul_one (M N : Mon_ C) :
(π (M.X β N.X) β (Ξ»_ (π_ C)).inv β« (M.one β N.one)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ο_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_one M, mul_one N]
symm
exact tensor_right_unitality C M.X N.X
#align Mon_.Mon_tensor_mul_one Mon_.Mon_tensor_mul_one
theorem Mon_tensor_mul_assoc (M N : Mon_ C) :
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ±_ (M.X β N.X) (M.X β N.X) (M.X β N.X)).hom β«
(π (M.X β N.X) β tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_assoc M, mul_assoc N, tensor_comp, tensor_comp]
-- Porting note: needed to add `dsimp` here.
slice_lhs 1 3 => dsimp; rw [tensor_associativity]
slice_lhs 3 4 => rw [β tensor_ΞΌ_natural]
slice_lhs 2 3 => rw [β tensor_comp, tensor_id]
simp only [Category.assoc]
#align Mon_.Mon_tensor_mul_assoc Mon_.Mon_tensor_mul_assoc
theorem mul_associator {M N P : Mon_ C} :
(tensor_ΞΌ C (M.X β N.X, P.X) (M.X β N.X, P.X) β«
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β P.mul)) β«
(Ξ±_ M.X N.X P.X).hom =
((Ξ±_ M.X N.X P.X).hom β (Ξ±_ M.X N.X P.X).hom) β«
tensor_ΞΌ C (M.X, N.X β P.X) (M.X, N.X β P.X) β«
(M.mul β tensor_ΞΌ C (N.X, P.X) (N.X, P.X) β« (N.mul β P.mul)) := by
simp only [tensor_obj, prodMonoidal_tensorObj, Category.assoc]
slice_lhs 2 3 => rw [β Category.id_comp P.mul, tensor_comp]
slice_lhs 3 4 => rw [associator_naturality]
slice_rhs 3 4 => rw [β Category.id_comp M.mul, tensor_comp]
slice_lhs 1 3 => rw [associator_monoidal]
simp only [Category.assoc]
#align Mon_.mul_associator Mon_.mul_associator
theorem mul_leftUnitor {M : Mon_ C} :
(tensor_ΞΌ C (π_ C, M.X) (π_ C, M.X) β« ((Ξ»_ (π_ C)).hom β M.mul)) β« (Ξ»_ M.X).hom =
((Ξ»_ M.X).hom β (Ξ»_ M.X).hom) β« M.mul := by
rw [β Category.comp_id (Ξ»_ (π_ C)).hom, β Category.id_comp M.mul, tensor_comp]
slice_lhs 3 4 => rw [leftUnitor_naturality]
slice_lhs 1 3 => rw [β leftUnitor_monoidal]
simp only [Category.assoc, Category.id_comp]
#align Mon_.mul_left_unitor Mon_.mul_leftUnitor
theorem mul_rightUnitor {M : Mon_ C} :
(tensor_ΞΌ C (M.X, π_ C) (M.X, π_ C) β« (M.mul β (Ξ»_ (π_ C)).hom)) β« (Ο_ M.X).hom =
((Ο_ M.X).hom β (Ο_ M.X).hom) β« M.mul := by
rw [β Category.id_comp M.mul, β Category.comp_id (Ξ»_ (π_ C)).hom, tensor_comp]
slice_lhs 3 4 =>
|
rw [rightUnitor_naturality]
|
theorem mul_rightUnitor {M : Mon_ C} :
(tensor_ΞΌ C (M.X, π_ C) (M.X, π_ C) β« (M.mul β (Ξ»_ (π_ C)).hom)) β« (Ο_ M.X).hom =
((Ο_ M.X).hom β (Ο_ M.X).hom) β« M.mul := by
rw [β Category.id_comp M.mul, β Category.comp_id (Ξ»_ (π_ C)).hom, tensor_comp]
slice_lhs 3 4 =>
|
Mathlib.CategoryTheory.Monoidal.Mon_.469_0.NTUMzhXPwXsmsYt
|
theorem mul_rightUnitor {M : Mon_ C} :
(tensor_ΞΌ C (M.X, π_ C) (M.X, π_ C) β« (M.mul β (Ξ»_ (π_ C)).hom)) β« (Ο_ M.X).hom =
((Ο_ M.X).hom β (Ο_ M.X).hom) β« M.mul
|
Mathlib_CategoryTheory_Monoidal_Mon_
|
case a.a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M : Mon_ C
| (M.mul β π (π_ C)) β« (Ο_ M.X).hom
case a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M : Mon_ C
| tensor_ΞΌ C (M.X, π_ C) (M.X, π_ C)
case a.a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M : Mon_ C
| π (M.X β M.X) β (Ξ»_ (π_ C)).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]
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
#align Mon_.one_right_unitor Mon_.one_rightUnitor
variable [BraidedCategory C]
theorem Mon_tensor_one_mul (M N : Mon_ C) :
((Ξ»_ (π_ C)).inv β« (M.one β N.one) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ»_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, one_mul M, one_mul N]
symm
exact tensor_left_unitality C M.X N.X
#align Mon_.Mon_tensor_one_mul Mon_.Mon_tensor_one_mul
theorem Mon_tensor_mul_one (M N : Mon_ C) :
(π (M.X β N.X) β (Ξ»_ (π_ C)).inv β« (M.one β N.one)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ο_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_one M, mul_one N]
symm
exact tensor_right_unitality C M.X N.X
#align Mon_.Mon_tensor_mul_one Mon_.Mon_tensor_mul_one
theorem Mon_tensor_mul_assoc (M N : Mon_ C) :
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ±_ (M.X β N.X) (M.X β N.X) (M.X β N.X)).hom β«
(π (M.X β N.X) β tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_assoc M, mul_assoc N, tensor_comp, tensor_comp]
-- Porting note: needed to add `dsimp` here.
slice_lhs 1 3 => dsimp; rw [tensor_associativity]
slice_lhs 3 4 => rw [β tensor_ΞΌ_natural]
slice_lhs 2 3 => rw [β tensor_comp, tensor_id]
simp only [Category.assoc]
#align Mon_.Mon_tensor_mul_assoc Mon_.Mon_tensor_mul_assoc
theorem mul_associator {M N P : Mon_ C} :
(tensor_ΞΌ C (M.X β N.X, P.X) (M.X β N.X, P.X) β«
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β P.mul)) β«
(Ξ±_ M.X N.X P.X).hom =
((Ξ±_ M.X N.X P.X).hom β (Ξ±_ M.X N.X P.X).hom) β«
tensor_ΞΌ C (M.X, N.X β P.X) (M.X, N.X β P.X) β«
(M.mul β tensor_ΞΌ C (N.X, P.X) (N.X, P.X) β« (N.mul β P.mul)) := by
simp only [tensor_obj, prodMonoidal_tensorObj, Category.assoc]
slice_lhs 2 3 => rw [β Category.id_comp P.mul, tensor_comp]
slice_lhs 3 4 => rw [associator_naturality]
slice_rhs 3 4 => rw [β Category.id_comp M.mul, tensor_comp]
slice_lhs 1 3 => rw [associator_monoidal]
simp only [Category.assoc]
#align Mon_.mul_associator Mon_.mul_associator
theorem mul_leftUnitor {M : Mon_ C} :
(tensor_ΞΌ C (π_ C, M.X) (π_ C, M.X) β« ((Ξ»_ (π_ C)).hom β M.mul)) β« (Ξ»_ M.X).hom =
((Ξ»_ M.X).hom β (Ξ»_ M.X).hom) β« M.mul := by
rw [β Category.comp_id (Ξ»_ (π_ C)).hom, β Category.id_comp M.mul, tensor_comp]
slice_lhs 3 4 => rw [leftUnitor_naturality]
slice_lhs 1 3 => rw [β leftUnitor_monoidal]
simp only [Category.assoc, Category.id_comp]
#align Mon_.mul_left_unitor Mon_.mul_leftUnitor
theorem mul_rightUnitor {M : Mon_ C} :
(tensor_ΞΌ C (M.X, π_ C) (M.X, π_ C) β« (M.mul β (Ξ»_ (π_ C)).hom)) β« (Ο_ M.X).hom =
((Ο_ M.X).hom β (Ο_ M.X).hom) β« M.mul := by
rw [β Category.id_comp M.mul, β Category.comp_id (Ξ»_ (π_ C)).hom, tensor_comp]
slice_lhs 3 4 =>
|
rw [rightUnitor_naturality]
|
theorem mul_rightUnitor {M : Mon_ C} :
(tensor_ΞΌ C (M.X, π_ C) (M.X, π_ C) β« (M.mul β (Ξ»_ (π_ C)).hom)) β« (Ο_ M.X).hom =
((Ο_ M.X).hom β (Ο_ M.X).hom) β« M.mul := by
rw [β Category.id_comp M.mul, β Category.comp_id (Ξ»_ (π_ C)).hom, tensor_comp]
slice_lhs 3 4 =>
|
Mathlib.CategoryTheory.Monoidal.Mon_.469_0.NTUMzhXPwXsmsYt
|
theorem mul_rightUnitor {M : Mon_ C} :
(tensor_ΞΌ C (M.X, π_ C) (M.X, π_ C) β« (M.mul β (Ξ»_ (π_ C)).hom)) β« (Ο_ M.X).hom =
((Ο_ M.X).hom β (Ο_ M.X).hom) β« M.mul
|
Mathlib_CategoryTheory_Monoidal_Mon_
|
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M : Mon_ C
β’ tensor_ΞΌ C (M.X, π_ C) (M.X, π_ C) β« (π (M.X β M.X) β (Ξ»_ (π_ C)).hom) β« (Ο_ (M.X β M.X)).hom β« M.mul =
((Ο_ M.X).hom β (Ο_ M.X).hom) β« π (M.X β M.X) β« M.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] }
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
#align Mon_.one_right_unitor Mon_.one_rightUnitor
variable [BraidedCategory C]
theorem Mon_tensor_one_mul (M N : Mon_ C) :
((Ξ»_ (π_ C)).inv β« (M.one β N.one) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ»_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, one_mul M, one_mul N]
symm
exact tensor_left_unitality C M.X N.X
#align Mon_.Mon_tensor_one_mul Mon_.Mon_tensor_one_mul
theorem Mon_tensor_mul_one (M N : Mon_ C) :
(π (M.X β N.X) β (Ξ»_ (π_ C)).inv β« (M.one β N.one)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ο_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_one M, mul_one N]
symm
exact tensor_right_unitality C M.X N.X
#align Mon_.Mon_tensor_mul_one Mon_.Mon_tensor_mul_one
theorem Mon_tensor_mul_assoc (M N : Mon_ C) :
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ±_ (M.X β N.X) (M.X β N.X) (M.X β N.X)).hom β«
(π (M.X β N.X) β tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_assoc M, mul_assoc N, tensor_comp, tensor_comp]
-- Porting note: needed to add `dsimp` here.
slice_lhs 1 3 => dsimp; rw [tensor_associativity]
slice_lhs 3 4 => rw [β tensor_ΞΌ_natural]
slice_lhs 2 3 => rw [β tensor_comp, tensor_id]
simp only [Category.assoc]
#align Mon_.Mon_tensor_mul_assoc Mon_.Mon_tensor_mul_assoc
theorem mul_associator {M N P : Mon_ C} :
(tensor_ΞΌ C (M.X β N.X, P.X) (M.X β N.X, P.X) β«
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β P.mul)) β«
(Ξ±_ M.X N.X P.X).hom =
((Ξ±_ M.X N.X P.X).hom β (Ξ±_ M.X N.X P.X).hom) β«
tensor_ΞΌ C (M.X, N.X β P.X) (M.X, N.X β P.X) β«
(M.mul β tensor_ΞΌ C (N.X, P.X) (N.X, P.X) β« (N.mul β P.mul)) := by
simp only [tensor_obj, prodMonoidal_tensorObj, Category.assoc]
slice_lhs 2 3 => rw [β Category.id_comp P.mul, tensor_comp]
slice_lhs 3 4 => rw [associator_naturality]
slice_rhs 3 4 => rw [β Category.id_comp M.mul, tensor_comp]
slice_lhs 1 3 => rw [associator_monoidal]
simp only [Category.assoc]
#align Mon_.mul_associator Mon_.mul_associator
theorem mul_leftUnitor {M : Mon_ C} :
(tensor_ΞΌ C (π_ C, M.X) (π_ C, M.X) β« ((Ξ»_ (π_ C)).hom β M.mul)) β« (Ξ»_ M.X).hom =
((Ξ»_ M.X).hom β (Ξ»_ M.X).hom) β« M.mul := by
rw [β Category.comp_id (Ξ»_ (π_ C)).hom, β Category.id_comp M.mul, tensor_comp]
slice_lhs 3 4 => rw [leftUnitor_naturality]
slice_lhs 1 3 => rw [β leftUnitor_monoidal]
simp only [Category.assoc, Category.id_comp]
#align Mon_.mul_left_unitor Mon_.mul_leftUnitor
theorem mul_rightUnitor {M : Mon_ C} :
(tensor_ΞΌ C (M.X, π_ C) (M.X, π_ C) β« (M.mul β (Ξ»_ (π_ C)).hom)) β« (Ο_ M.X).hom =
((Ο_ M.X).hom β (Ο_ M.X).hom) β« M.mul := by
rw [β Category.id_comp M.mul, β Category.comp_id (Ξ»_ (π_ C)).hom, tensor_comp]
slice_lhs 3 4 => rw [rightUnitor_naturality]
|
slice_lhs 1 3 => rw [β rightUnitor_monoidal]
|
theorem mul_rightUnitor {M : Mon_ C} :
(tensor_ΞΌ C (M.X, π_ C) (M.X, π_ C) β« (M.mul β (Ξ»_ (π_ C)).hom)) β« (Ο_ M.X).hom =
((Ο_ M.X).hom β (Ο_ M.X).hom) β« M.mul := by
rw [β Category.id_comp M.mul, β Category.comp_id (Ξ»_ (π_ C)).hom, tensor_comp]
slice_lhs 3 4 => rw [rightUnitor_naturality]
|
Mathlib.CategoryTheory.Monoidal.Mon_.469_0.NTUMzhXPwXsmsYt
|
theorem mul_rightUnitor {M : Mon_ C} :
(tensor_ΞΌ C (M.X, π_ C) (M.X, π_ C) β« (M.mul β (Ξ»_ (π_ C)).hom)) β« (Ο_ M.X).hom =
((Ο_ M.X).hom β (Ο_ M.X).hom) β« M.mul
|
Mathlib_CategoryTheory_Monoidal_Mon_
|
case a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M : Mon_ C
| tensor_ΞΌ C (M.X, π_ C) (M.X, π_ C) β« (π (M.X β M.X) β (Ξ»_ (π_ C)).hom) β« (Ο_ (M.X β M.X)).hom
case a C : Type uβ instβΒ² : Category.{vβ, uβ} C instβΒΉ : MonoidalCategory C instβ : BraidedCategory C M : Mon_ C | M.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] }
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
#align Mon_.one_right_unitor Mon_.one_rightUnitor
variable [BraidedCategory C]
theorem Mon_tensor_one_mul (M N : Mon_ C) :
((Ξ»_ (π_ C)).inv β« (M.one β N.one) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ»_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, one_mul M, one_mul N]
symm
exact tensor_left_unitality C M.X N.X
#align Mon_.Mon_tensor_one_mul Mon_.Mon_tensor_one_mul
theorem Mon_tensor_mul_one (M N : Mon_ C) :
(π (M.X β N.X) β (Ξ»_ (π_ C)).inv β« (M.one β N.one)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ο_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_one M, mul_one N]
symm
exact tensor_right_unitality C M.X N.X
#align Mon_.Mon_tensor_mul_one Mon_.Mon_tensor_mul_one
theorem Mon_tensor_mul_assoc (M N : Mon_ C) :
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ±_ (M.X β N.X) (M.X β N.X) (M.X β N.X)).hom β«
(π (M.X β N.X) β tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_assoc M, mul_assoc N, tensor_comp, tensor_comp]
-- Porting note: needed to add `dsimp` here.
slice_lhs 1 3 => dsimp; rw [tensor_associativity]
slice_lhs 3 4 => rw [β tensor_ΞΌ_natural]
slice_lhs 2 3 => rw [β tensor_comp, tensor_id]
simp only [Category.assoc]
#align Mon_.Mon_tensor_mul_assoc Mon_.Mon_tensor_mul_assoc
theorem mul_associator {M N P : Mon_ C} :
(tensor_ΞΌ C (M.X β N.X, P.X) (M.X β N.X, P.X) β«
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β P.mul)) β«
(Ξ±_ M.X N.X P.X).hom =
((Ξ±_ M.X N.X P.X).hom β (Ξ±_ M.X N.X P.X).hom) β«
tensor_ΞΌ C (M.X, N.X β P.X) (M.X, N.X β P.X) β«
(M.mul β tensor_ΞΌ C (N.X, P.X) (N.X, P.X) β« (N.mul β P.mul)) := by
simp only [tensor_obj, prodMonoidal_tensorObj, Category.assoc]
slice_lhs 2 3 => rw [β Category.id_comp P.mul, tensor_comp]
slice_lhs 3 4 => rw [associator_naturality]
slice_rhs 3 4 => rw [β Category.id_comp M.mul, tensor_comp]
slice_lhs 1 3 => rw [associator_monoidal]
simp only [Category.assoc]
#align Mon_.mul_associator Mon_.mul_associator
theorem mul_leftUnitor {M : Mon_ C} :
(tensor_ΞΌ C (π_ C, M.X) (π_ C, M.X) β« ((Ξ»_ (π_ C)).hom β M.mul)) β« (Ξ»_ M.X).hom =
((Ξ»_ M.X).hom β (Ξ»_ M.X).hom) β« M.mul := by
rw [β Category.comp_id (Ξ»_ (π_ C)).hom, β Category.id_comp M.mul, tensor_comp]
slice_lhs 3 4 => rw [leftUnitor_naturality]
slice_lhs 1 3 => rw [β leftUnitor_monoidal]
simp only [Category.assoc, Category.id_comp]
#align Mon_.mul_left_unitor Mon_.mul_leftUnitor
theorem mul_rightUnitor {M : Mon_ C} :
(tensor_ΞΌ C (M.X, π_ C) (M.X, π_ C) β« (M.mul β (Ξ»_ (π_ C)).hom)) β« (Ο_ M.X).hom =
((Ο_ M.X).hom β (Ο_ M.X).hom) β« M.mul := by
rw [β Category.id_comp M.mul, β Category.comp_id (Ξ»_ (π_ C)).hom, tensor_comp]
slice_lhs 3 4 => rw [rightUnitor_naturality]
slice_lhs 1 3 =>
|
rw [β rightUnitor_monoidal]
|
theorem mul_rightUnitor {M : Mon_ C} :
(tensor_ΞΌ C (M.X, π_ C) (M.X, π_ C) β« (M.mul β (Ξ»_ (π_ C)).hom)) β« (Ο_ M.X).hom =
((Ο_ M.X).hom β (Ο_ M.X).hom) β« M.mul := by
rw [β Category.id_comp M.mul, β Category.comp_id (Ξ»_ (π_ C)).hom, tensor_comp]
slice_lhs 3 4 => rw [rightUnitor_naturality]
slice_lhs 1 3 =>
|
Mathlib.CategoryTheory.Monoidal.Mon_.469_0.NTUMzhXPwXsmsYt
|
theorem mul_rightUnitor {M : Mon_ C} :
(tensor_ΞΌ C (M.X, π_ C) (M.X, π_ C) β« (M.mul β (Ξ»_ (π_ C)).hom)) β« (Ο_ M.X).hom =
((Ο_ M.X).hom β (Ο_ M.X).hom) β« M.mul
|
Mathlib_CategoryTheory_Monoidal_Mon_
|
case a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M : Mon_ C
| tensor_ΞΌ C (M.X, π_ C) (M.X, π_ C) β« (π (M.X β M.X) β (Ξ»_ (π_ C)).hom) β« (Ο_ (M.X β M.X)).hom
case a C : Type uβ instβΒ² : Category.{vβ, uβ} C instβΒΉ : MonoidalCategory C instβ : BraidedCategory C M : Mon_ C | M.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] }
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
#align Mon_.one_right_unitor Mon_.one_rightUnitor
variable [BraidedCategory C]
theorem Mon_tensor_one_mul (M N : Mon_ C) :
((Ξ»_ (π_ C)).inv β« (M.one β N.one) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ»_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, one_mul M, one_mul N]
symm
exact tensor_left_unitality C M.X N.X
#align Mon_.Mon_tensor_one_mul Mon_.Mon_tensor_one_mul
theorem Mon_tensor_mul_one (M N : Mon_ C) :
(π (M.X β N.X) β (Ξ»_ (π_ C)).inv β« (M.one β N.one)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ο_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_one M, mul_one N]
symm
exact tensor_right_unitality C M.X N.X
#align Mon_.Mon_tensor_mul_one Mon_.Mon_tensor_mul_one
theorem Mon_tensor_mul_assoc (M N : Mon_ C) :
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ±_ (M.X β N.X) (M.X β N.X) (M.X β N.X)).hom β«
(π (M.X β N.X) β tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_assoc M, mul_assoc N, tensor_comp, tensor_comp]
-- Porting note: needed to add `dsimp` here.
slice_lhs 1 3 => dsimp; rw [tensor_associativity]
slice_lhs 3 4 => rw [β tensor_ΞΌ_natural]
slice_lhs 2 3 => rw [β tensor_comp, tensor_id]
simp only [Category.assoc]
#align Mon_.Mon_tensor_mul_assoc Mon_.Mon_tensor_mul_assoc
theorem mul_associator {M N P : Mon_ C} :
(tensor_ΞΌ C (M.X β N.X, P.X) (M.X β N.X, P.X) β«
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β P.mul)) β«
(Ξ±_ M.X N.X P.X).hom =
((Ξ±_ M.X N.X P.X).hom β (Ξ±_ M.X N.X P.X).hom) β«
tensor_ΞΌ C (M.X, N.X β P.X) (M.X, N.X β P.X) β«
(M.mul β tensor_ΞΌ C (N.X, P.X) (N.X, P.X) β« (N.mul β P.mul)) := by
simp only [tensor_obj, prodMonoidal_tensorObj, Category.assoc]
slice_lhs 2 3 => rw [β Category.id_comp P.mul, tensor_comp]
slice_lhs 3 4 => rw [associator_naturality]
slice_rhs 3 4 => rw [β Category.id_comp M.mul, tensor_comp]
slice_lhs 1 3 => rw [associator_monoidal]
simp only [Category.assoc]
#align Mon_.mul_associator Mon_.mul_associator
theorem mul_leftUnitor {M : Mon_ C} :
(tensor_ΞΌ C (π_ C, M.X) (π_ C, M.X) β« ((Ξ»_ (π_ C)).hom β M.mul)) β« (Ξ»_ M.X).hom =
((Ξ»_ M.X).hom β (Ξ»_ M.X).hom) β« M.mul := by
rw [β Category.comp_id (Ξ»_ (π_ C)).hom, β Category.id_comp M.mul, tensor_comp]
slice_lhs 3 4 => rw [leftUnitor_naturality]
slice_lhs 1 3 => rw [β leftUnitor_monoidal]
simp only [Category.assoc, Category.id_comp]
#align Mon_.mul_left_unitor Mon_.mul_leftUnitor
theorem mul_rightUnitor {M : Mon_ C} :
(tensor_ΞΌ C (M.X, π_ C) (M.X, π_ C) β« (M.mul β (Ξ»_ (π_ C)).hom)) β« (Ο_ M.X).hom =
((Ο_ M.X).hom β (Ο_ M.X).hom) β« M.mul := by
rw [β Category.id_comp M.mul, β Category.comp_id (Ξ»_ (π_ C)).hom, tensor_comp]
slice_lhs 3 4 => rw [rightUnitor_naturality]
slice_lhs 1 3 =>
|
rw [β rightUnitor_monoidal]
|
theorem mul_rightUnitor {M : Mon_ C} :
(tensor_ΞΌ C (M.X, π_ C) (M.X, π_ C) β« (M.mul β (Ξ»_ (π_ C)).hom)) β« (Ο_ M.X).hom =
((Ο_ M.X).hom β (Ο_ M.X).hom) β« M.mul := by
rw [β Category.id_comp M.mul, β Category.comp_id (Ξ»_ (π_ C)).hom, tensor_comp]
slice_lhs 3 4 => rw [rightUnitor_naturality]
slice_lhs 1 3 =>
|
Mathlib.CategoryTheory.Monoidal.Mon_.469_0.NTUMzhXPwXsmsYt
|
theorem mul_rightUnitor {M : Mon_ C} :
(tensor_ΞΌ C (M.X, π_ C) (M.X, π_ C) β« (M.mul β (Ξ»_ (π_ C)).hom)) β« (Ο_ M.X).hom =
((Ο_ M.X).hom β (Ο_ M.X).hom) β« M.mul
|
Mathlib_CategoryTheory_Monoidal_Mon_
|
case a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M : Mon_ C
| tensor_ΞΌ C (M.X, π_ C) (M.X, π_ C) β« (π (M.X β M.X) β (Ξ»_ (π_ C)).hom) β« (Ο_ (M.X β M.X)).hom
case a C : Type uβ instβΒ² : Category.{vβ, uβ} C instβΒΉ : MonoidalCategory C instβ : BraidedCategory C M : Mon_ C | M.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] }
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
#align Mon_.one_right_unitor Mon_.one_rightUnitor
variable [BraidedCategory C]
theorem Mon_tensor_one_mul (M N : Mon_ C) :
((Ξ»_ (π_ C)).inv β« (M.one β N.one) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ»_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, one_mul M, one_mul N]
symm
exact tensor_left_unitality C M.X N.X
#align Mon_.Mon_tensor_one_mul Mon_.Mon_tensor_one_mul
theorem Mon_tensor_mul_one (M N : Mon_ C) :
(π (M.X β N.X) β (Ξ»_ (π_ C)).inv β« (M.one β N.one)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ο_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_one M, mul_one N]
symm
exact tensor_right_unitality C M.X N.X
#align Mon_.Mon_tensor_mul_one Mon_.Mon_tensor_mul_one
theorem Mon_tensor_mul_assoc (M N : Mon_ C) :
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ±_ (M.X β N.X) (M.X β N.X) (M.X β N.X)).hom β«
(π (M.X β N.X) β tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_assoc M, mul_assoc N, tensor_comp, tensor_comp]
-- Porting note: needed to add `dsimp` here.
slice_lhs 1 3 => dsimp; rw [tensor_associativity]
slice_lhs 3 4 => rw [β tensor_ΞΌ_natural]
slice_lhs 2 3 => rw [β tensor_comp, tensor_id]
simp only [Category.assoc]
#align Mon_.Mon_tensor_mul_assoc Mon_.Mon_tensor_mul_assoc
theorem mul_associator {M N P : Mon_ C} :
(tensor_ΞΌ C (M.X β N.X, P.X) (M.X β N.X, P.X) β«
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β P.mul)) β«
(Ξ±_ M.X N.X P.X).hom =
((Ξ±_ M.X N.X P.X).hom β (Ξ±_ M.X N.X P.X).hom) β«
tensor_ΞΌ C (M.X, N.X β P.X) (M.X, N.X β P.X) β«
(M.mul β tensor_ΞΌ C (N.X, P.X) (N.X, P.X) β« (N.mul β P.mul)) := by
simp only [tensor_obj, prodMonoidal_tensorObj, Category.assoc]
slice_lhs 2 3 => rw [β Category.id_comp P.mul, tensor_comp]
slice_lhs 3 4 => rw [associator_naturality]
slice_rhs 3 4 => rw [β Category.id_comp M.mul, tensor_comp]
slice_lhs 1 3 => rw [associator_monoidal]
simp only [Category.assoc]
#align Mon_.mul_associator Mon_.mul_associator
theorem mul_leftUnitor {M : Mon_ C} :
(tensor_ΞΌ C (π_ C, M.X) (π_ C, M.X) β« ((Ξ»_ (π_ C)).hom β M.mul)) β« (Ξ»_ M.X).hom =
((Ξ»_ M.X).hom β (Ξ»_ M.X).hom) β« M.mul := by
rw [β Category.comp_id (Ξ»_ (π_ C)).hom, β Category.id_comp M.mul, tensor_comp]
slice_lhs 3 4 => rw [leftUnitor_naturality]
slice_lhs 1 3 => rw [β leftUnitor_monoidal]
simp only [Category.assoc, Category.id_comp]
#align Mon_.mul_left_unitor Mon_.mul_leftUnitor
theorem mul_rightUnitor {M : Mon_ C} :
(tensor_ΞΌ C (M.X, π_ C) (M.X, π_ C) β« (M.mul β (Ξ»_ (π_ C)).hom)) β« (Ο_ M.X).hom =
((Ο_ M.X).hom β (Ο_ M.X).hom) β« M.mul := by
rw [β Category.id_comp M.mul, β Category.comp_id (Ξ»_ (π_ C)).hom, tensor_comp]
slice_lhs 3 4 => rw [rightUnitor_naturality]
slice_lhs 1 3 =>
|
rw [β rightUnitor_monoidal]
|
theorem mul_rightUnitor {M : Mon_ C} :
(tensor_ΞΌ C (M.X, π_ C) (M.X, π_ C) β« (M.mul β (Ξ»_ (π_ C)).hom)) β« (Ο_ M.X).hom =
((Ο_ M.X).hom β (Ο_ M.X).hom) β« M.mul := by
rw [β Category.id_comp M.mul, β Category.comp_id (Ξ»_ (π_ C)).hom, tensor_comp]
slice_lhs 3 4 => rw [rightUnitor_naturality]
slice_lhs 1 3 =>
|
Mathlib.CategoryTheory.Monoidal.Mon_.469_0.NTUMzhXPwXsmsYt
|
theorem mul_rightUnitor {M : Mon_ C} :
(tensor_ΞΌ C (M.X, π_ C) (M.X, π_ C) β« (M.mul β (Ξ»_ (π_ C)).hom)) β« (Ο_ M.X).hom =
((Ο_ M.X).hom β (Ο_ M.X).hom) β« M.mul
|
Mathlib_CategoryTheory_Monoidal_Mon_
|
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
M : Mon_ C
β’ ((Ο_ M.X).hom β (Ο_ M.X).hom) β« M.mul = ((Ο_ M.X).hom β (Ο_ M.X).hom) β« π (M.X β M.X) β« M.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] }
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
#align Mon_.one_right_unitor Mon_.one_rightUnitor
variable [BraidedCategory C]
theorem Mon_tensor_one_mul (M N : Mon_ C) :
((Ξ»_ (π_ C)).inv β« (M.one β N.one) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ»_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, one_mul M, one_mul N]
symm
exact tensor_left_unitality C M.X N.X
#align Mon_.Mon_tensor_one_mul Mon_.Mon_tensor_one_mul
theorem Mon_tensor_mul_one (M N : Mon_ C) :
(π (M.X β N.X) β (Ξ»_ (π_ C)).inv β« (M.one β N.one)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ο_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_one M, mul_one N]
symm
exact tensor_right_unitality C M.X N.X
#align Mon_.Mon_tensor_mul_one Mon_.Mon_tensor_mul_one
theorem Mon_tensor_mul_assoc (M N : Mon_ C) :
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ±_ (M.X β N.X) (M.X β N.X) (M.X β N.X)).hom β«
(π (M.X β N.X) β tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_assoc M, mul_assoc N, tensor_comp, tensor_comp]
-- Porting note: needed to add `dsimp` here.
slice_lhs 1 3 => dsimp; rw [tensor_associativity]
slice_lhs 3 4 => rw [β tensor_ΞΌ_natural]
slice_lhs 2 3 => rw [β tensor_comp, tensor_id]
simp only [Category.assoc]
#align Mon_.Mon_tensor_mul_assoc Mon_.Mon_tensor_mul_assoc
theorem mul_associator {M N P : Mon_ C} :
(tensor_ΞΌ C (M.X β N.X, P.X) (M.X β N.X, P.X) β«
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β P.mul)) β«
(Ξ±_ M.X N.X P.X).hom =
((Ξ±_ M.X N.X P.X).hom β (Ξ±_ M.X N.X P.X).hom) β«
tensor_ΞΌ C (M.X, N.X β P.X) (M.X, N.X β P.X) β«
(M.mul β tensor_ΞΌ C (N.X, P.X) (N.X, P.X) β« (N.mul β P.mul)) := by
simp only [tensor_obj, prodMonoidal_tensorObj, Category.assoc]
slice_lhs 2 3 => rw [β Category.id_comp P.mul, tensor_comp]
slice_lhs 3 4 => rw [associator_naturality]
slice_rhs 3 4 => rw [β Category.id_comp M.mul, tensor_comp]
slice_lhs 1 3 => rw [associator_monoidal]
simp only [Category.assoc]
#align Mon_.mul_associator Mon_.mul_associator
theorem mul_leftUnitor {M : Mon_ C} :
(tensor_ΞΌ C (π_ C, M.X) (π_ C, M.X) β« ((Ξ»_ (π_ C)).hom β M.mul)) β« (Ξ»_ M.X).hom =
((Ξ»_ M.X).hom β (Ξ»_ M.X).hom) β« M.mul := by
rw [β Category.comp_id (Ξ»_ (π_ C)).hom, β Category.id_comp M.mul, tensor_comp]
slice_lhs 3 4 => rw [leftUnitor_naturality]
slice_lhs 1 3 => rw [β leftUnitor_monoidal]
simp only [Category.assoc, Category.id_comp]
#align Mon_.mul_left_unitor Mon_.mul_leftUnitor
theorem mul_rightUnitor {M : Mon_ C} :
(tensor_ΞΌ C (M.X, π_ C) (M.X, π_ C) β« (M.mul β (Ξ»_ (π_ C)).hom)) β« (Ο_ M.X).hom =
((Ο_ M.X).hom β (Ο_ M.X).hom) β« M.mul := by
rw [β Category.id_comp M.mul, β Category.comp_id (Ξ»_ (π_ C)).hom, tensor_comp]
slice_lhs 3 4 => rw [rightUnitor_naturality]
slice_lhs 1 3 => rw [β rightUnitor_monoidal]
|
simp only [Category.assoc, Category.id_comp]
|
theorem mul_rightUnitor {M : Mon_ C} :
(tensor_ΞΌ C (M.X, π_ C) (M.X, π_ C) β« (M.mul β (Ξ»_ (π_ C)).hom)) β« (Ο_ M.X).hom =
((Ο_ M.X).hom β (Ο_ M.X).hom) β« M.mul := by
rw [β Category.id_comp M.mul, β Category.comp_id (Ξ»_ (π_ C)).hom, tensor_comp]
slice_lhs 3 4 => rw [rightUnitor_naturality]
slice_lhs 1 3 => rw [β rightUnitor_monoidal]
|
Mathlib.CategoryTheory.Monoidal.Mon_.469_0.NTUMzhXPwXsmsYt
|
theorem mul_rightUnitor {M : Mon_ C} :
(tensor_ΞΌ C (M.X, π_ C) (M.X, π_ C) β« (M.mul β (Ξ»_ (π_ C)).hom)) β« (Ο_ M.X).hom =
((Ο_ M.X).hom β (Ο_ M.X).hom) β« M.mul
|
Mathlib_CategoryTheory_Monoidal_Mon_
|
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
tensorObj : Mon_ C β Mon_ C β Mon_ C :=
fun M N => mk (M.X β N.X) ((Ξ»_ (π_ C)).inv β« (M.one β N.one)) (tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul))
Xβ Yβ Xβ Yβ : Mon_ C
f : Xβ βΆ Yβ
g : Xβ βΆ Yβ
β’ (tensorObj Xβ Xβ).one β« (f.hom β g.hom) = (tensorObj Yβ 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]
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
#align Mon_.one_right_unitor Mon_.one_rightUnitor
variable [BraidedCategory C]
theorem Mon_tensor_one_mul (M N : Mon_ C) :
((Ξ»_ (π_ C)).inv β« (M.one β N.one) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ»_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, one_mul M, one_mul N]
symm
exact tensor_left_unitality C M.X N.X
#align Mon_.Mon_tensor_one_mul Mon_.Mon_tensor_one_mul
theorem Mon_tensor_mul_one (M N : Mon_ C) :
(π (M.X β N.X) β (Ξ»_ (π_ C)).inv β« (M.one β N.one)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ο_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_one M, mul_one N]
symm
exact tensor_right_unitality C M.X N.X
#align Mon_.Mon_tensor_mul_one Mon_.Mon_tensor_mul_one
theorem Mon_tensor_mul_assoc (M N : Mon_ C) :
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ±_ (M.X β N.X) (M.X β N.X) (M.X β N.X)).hom β«
(π (M.X β N.X) β tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_assoc M, mul_assoc N, tensor_comp, tensor_comp]
-- Porting note: needed to add `dsimp` here.
slice_lhs 1 3 => dsimp; rw [tensor_associativity]
slice_lhs 3 4 => rw [β tensor_ΞΌ_natural]
slice_lhs 2 3 => rw [β tensor_comp, tensor_id]
simp only [Category.assoc]
#align Mon_.Mon_tensor_mul_assoc Mon_.Mon_tensor_mul_assoc
theorem mul_associator {M N P : Mon_ C} :
(tensor_ΞΌ C (M.X β N.X, P.X) (M.X β N.X, P.X) β«
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β P.mul)) β«
(Ξ±_ M.X N.X P.X).hom =
((Ξ±_ M.X N.X P.X).hom β (Ξ±_ M.X N.X P.X).hom) β«
tensor_ΞΌ C (M.X, N.X β P.X) (M.X, N.X β P.X) β«
(M.mul β tensor_ΞΌ C (N.X, P.X) (N.X, P.X) β« (N.mul β P.mul)) := by
simp only [tensor_obj, prodMonoidal_tensorObj, Category.assoc]
slice_lhs 2 3 => rw [β Category.id_comp P.mul, tensor_comp]
slice_lhs 3 4 => rw [associator_naturality]
slice_rhs 3 4 => rw [β Category.id_comp M.mul, tensor_comp]
slice_lhs 1 3 => rw [associator_monoidal]
simp only [Category.assoc]
#align Mon_.mul_associator Mon_.mul_associator
theorem mul_leftUnitor {M : Mon_ C} :
(tensor_ΞΌ C (π_ C, M.X) (π_ C, M.X) β« ((Ξ»_ (π_ C)).hom β M.mul)) β« (Ξ»_ M.X).hom =
((Ξ»_ M.X).hom β (Ξ»_ M.X).hom) β« M.mul := by
rw [β Category.comp_id (Ξ»_ (π_ C)).hom, β Category.id_comp M.mul, tensor_comp]
slice_lhs 3 4 => rw [leftUnitor_naturality]
slice_lhs 1 3 => rw [β leftUnitor_monoidal]
simp only [Category.assoc, Category.id_comp]
#align Mon_.mul_left_unitor Mon_.mul_leftUnitor
theorem mul_rightUnitor {M : Mon_ C} :
(tensor_ΞΌ C (M.X, π_ C) (M.X, π_ C) β« (M.mul β (Ξ»_ (π_ C)).hom)) β« (Ο_ M.X).hom =
((Ο_ M.X).hom β (Ο_ M.X).hom) β« M.mul := by
rw [β Category.id_comp M.mul, β Category.comp_id (Ξ»_ (π_ C)).hom, tensor_comp]
slice_lhs 3 4 => rw [rightUnitor_naturality]
slice_lhs 1 3 => rw [β rightUnitor_monoidal]
simp only [Category.assoc, Category.id_comp]
#align Mon_.mul_right_unitor Mon_.mul_rightUnitor
instance monMonoidalStruct : MonoidalCategoryStruct (Mon_ C) :=
let tensorObj (M N : Mon_ C) : Mon_ C :=
{ X := M.X β N.X
one := (Ξ»_ (π_ C)).inv β« (M.one β N.one)
mul := tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)
one_mul := Mon_tensor_one_mul M N
mul_one := Mon_tensor_mul_one M N
mul_assoc := Mon_tensor_mul_assoc M N }
let tensorHom {Xβ Yβ Xβ Yβ : Mon_ C} (f : Xβ βΆ Yβ) (g : Xβ βΆ Yβ) :
tensorObj _ _ βΆ tensorObj _ _ :=
{ hom := f.hom β g.hom
one_hom := by
|
dsimp
|
instance monMonoidalStruct : MonoidalCategoryStruct (Mon_ C) :=
let tensorObj (M N : Mon_ C) : Mon_ C :=
{ X := M.X β N.X
one := (Ξ»_ (π_ C)).inv β« (M.one β N.one)
mul := tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)
one_mul := Mon_tensor_one_mul M N
mul_one := Mon_tensor_mul_one M N
mul_assoc := Mon_tensor_mul_assoc M N }
let tensorHom {Xβ Yβ Xβ Yβ : Mon_ C} (f : Xβ βΆ Yβ) (g : Xβ βΆ Yβ) :
tensorObj _ _ βΆ tensorObj _ _ :=
{ hom := f.hom β g.hom
one_hom := by
|
Mathlib.CategoryTheory.Monoidal.Mon_.478_0.NTUMzhXPwXsmsYt
|
instance monMonoidalStruct : MonoidalCategoryStruct (Mon_ C)
|
Mathlib_CategoryTheory_Monoidal_Mon_
|
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
tensorObj : Mon_ C β Mon_ C β Mon_ C :=
fun M N => mk (M.X β N.X) ((Ξ»_ (π_ C)).inv β« (M.one β N.one)) (tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul))
Xβ Yβ Xβ Yβ : Mon_ C
f : Xβ βΆ Yβ
g : Xβ βΆ Yβ
β’ ((Ξ»_ (π_ C)).inv β« (Xβ.one β Xβ.one)) β« (f.hom β g.hom) = (Ξ»_ (π_ C)).inv β« (Yβ.one β 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]
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
#align Mon_.one_right_unitor Mon_.one_rightUnitor
variable [BraidedCategory C]
theorem Mon_tensor_one_mul (M N : Mon_ C) :
((Ξ»_ (π_ C)).inv β« (M.one β N.one) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ»_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, one_mul M, one_mul N]
symm
exact tensor_left_unitality C M.X N.X
#align Mon_.Mon_tensor_one_mul Mon_.Mon_tensor_one_mul
theorem Mon_tensor_mul_one (M N : Mon_ C) :
(π (M.X β N.X) β (Ξ»_ (π_ C)).inv β« (M.one β N.one)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ο_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_one M, mul_one N]
symm
exact tensor_right_unitality C M.X N.X
#align Mon_.Mon_tensor_mul_one Mon_.Mon_tensor_mul_one
theorem Mon_tensor_mul_assoc (M N : Mon_ C) :
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ±_ (M.X β N.X) (M.X β N.X) (M.X β N.X)).hom β«
(π (M.X β N.X) β tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_assoc M, mul_assoc N, tensor_comp, tensor_comp]
-- Porting note: needed to add `dsimp` here.
slice_lhs 1 3 => dsimp; rw [tensor_associativity]
slice_lhs 3 4 => rw [β tensor_ΞΌ_natural]
slice_lhs 2 3 => rw [β tensor_comp, tensor_id]
simp only [Category.assoc]
#align Mon_.Mon_tensor_mul_assoc Mon_.Mon_tensor_mul_assoc
theorem mul_associator {M N P : Mon_ C} :
(tensor_ΞΌ C (M.X β N.X, P.X) (M.X β N.X, P.X) β«
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β P.mul)) β«
(Ξ±_ M.X N.X P.X).hom =
((Ξ±_ M.X N.X P.X).hom β (Ξ±_ M.X N.X P.X).hom) β«
tensor_ΞΌ C (M.X, N.X β P.X) (M.X, N.X β P.X) β«
(M.mul β tensor_ΞΌ C (N.X, P.X) (N.X, P.X) β« (N.mul β P.mul)) := by
simp only [tensor_obj, prodMonoidal_tensorObj, Category.assoc]
slice_lhs 2 3 => rw [β Category.id_comp P.mul, tensor_comp]
slice_lhs 3 4 => rw [associator_naturality]
slice_rhs 3 4 => rw [β Category.id_comp M.mul, tensor_comp]
slice_lhs 1 3 => rw [associator_monoidal]
simp only [Category.assoc]
#align Mon_.mul_associator Mon_.mul_associator
theorem mul_leftUnitor {M : Mon_ C} :
(tensor_ΞΌ C (π_ C, M.X) (π_ C, M.X) β« ((Ξ»_ (π_ C)).hom β M.mul)) β« (Ξ»_ M.X).hom =
((Ξ»_ M.X).hom β (Ξ»_ M.X).hom) β« M.mul := by
rw [β Category.comp_id (Ξ»_ (π_ C)).hom, β Category.id_comp M.mul, tensor_comp]
slice_lhs 3 4 => rw [leftUnitor_naturality]
slice_lhs 1 3 => rw [β leftUnitor_monoidal]
simp only [Category.assoc, Category.id_comp]
#align Mon_.mul_left_unitor Mon_.mul_leftUnitor
theorem mul_rightUnitor {M : Mon_ C} :
(tensor_ΞΌ C (M.X, π_ C) (M.X, π_ C) β« (M.mul β (Ξ»_ (π_ C)).hom)) β« (Ο_ M.X).hom =
((Ο_ M.X).hom β (Ο_ M.X).hom) β« M.mul := by
rw [β Category.id_comp M.mul, β Category.comp_id (Ξ»_ (π_ C)).hom, tensor_comp]
slice_lhs 3 4 => rw [rightUnitor_naturality]
slice_lhs 1 3 => rw [β rightUnitor_monoidal]
simp only [Category.assoc, Category.id_comp]
#align Mon_.mul_right_unitor Mon_.mul_rightUnitor
instance monMonoidalStruct : MonoidalCategoryStruct (Mon_ C) :=
let tensorObj (M N : Mon_ C) : Mon_ C :=
{ X := M.X β N.X
one := (Ξ»_ (π_ C)).inv β« (M.one β N.one)
mul := tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)
one_mul := Mon_tensor_one_mul M N
mul_one := Mon_tensor_mul_one M N
mul_assoc := Mon_tensor_mul_assoc M N }
let tensorHom {Xβ Yβ Xβ Yβ : Mon_ C} (f : Xβ βΆ Yβ) (g : Xβ βΆ Yβ) :
tensorObj _ _ βΆ tensorObj _ _ :=
{ hom := f.hom β g.hom
one_hom := by
dsimp
|
slice_lhs 2 3 => rw [β tensor_comp, Hom.one_hom f, Hom.one_hom g]
|
instance monMonoidalStruct : MonoidalCategoryStruct (Mon_ C) :=
let tensorObj (M N : Mon_ C) : Mon_ C :=
{ X := M.X β N.X
one := (Ξ»_ (π_ C)).inv β« (M.one β N.one)
mul := tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)
one_mul := Mon_tensor_one_mul M N
mul_one := Mon_tensor_mul_one M N
mul_assoc := Mon_tensor_mul_assoc M N }
let tensorHom {Xβ Yβ Xβ Yβ : Mon_ C} (f : Xβ βΆ Yβ) (g : Xβ βΆ Yβ) :
tensorObj _ _ βΆ tensorObj _ _ :=
{ hom := f.hom β g.hom
one_hom := by
dsimp
|
Mathlib.CategoryTheory.Monoidal.Mon_.478_0.NTUMzhXPwXsmsYt
|
instance monMonoidalStruct : MonoidalCategoryStruct (Mon_ C)
|
Mathlib_CategoryTheory_Monoidal_Mon_
|
case a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
tensorObj : Mon_ C β Mon_ C β Mon_ C :=
fun M N => mk (M.X β N.X) ((Ξ»_ (π_ C)).inv β« (M.one β N.one)) (tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul))
Xβ Yβ Xβ Yβ : Mon_ C
f : Xβ βΆ Yβ
g : Xβ βΆ Yβ
| (Xβ.one β Xβ.one) β« (f.hom β g.hom)
case a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
tensorObj : Mon_ C β Mon_ C β Mon_ C :=
fun M N => mk (M.X β N.X) ((Ξ»_ (π_ C)).inv β« (M.one β N.one)) (tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul))
Xβ Yβ Xβ Yβ : Mon_ C
f : Xβ βΆ Yβ
g : Xβ βΆ Yβ
| (Ξ»_ (π_ 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]
simp
#align Mon_.one_right_unitor Mon_.one_rightUnitor
variable [BraidedCategory C]
theorem Mon_tensor_one_mul (M N : Mon_ C) :
((Ξ»_ (π_ C)).inv β« (M.one β N.one) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ»_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, one_mul M, one_mul N]
symm
exact tensor_left_unitality C M.X N.X
#align Mon_.Mon_tensor_one_mul Mon_.Mon_tensor_one_mul
theorem Mon_tensor_mul_one (M N : Mon_ C) :
(π (M.X β N.X) β (Ξ»_ (π_ C)).inv β« (M.one β N.one)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ο_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_one M, mul_one N]
symm
exact tensor_right_unitality C M.X N.X
#align Mon_.Mon_tensor_mul_one Mon_.Mon_tensor_mul_one
theorem Mon_tensor_mul_assoc (M N : Mon_ C) :
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ±_ (M.X β N.X) (M.X β N.X) (M.X β N.X)).hom β«
(π (M.X β N.X) β tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_assoc M, mul_assoc N, tensor_comp, tensor_comp]
-- Porting note: needed to add `dsimp` here.
slice_lhs 1 3 => dsimp; rw [tensor_associativity]
slice_lhs 3 4 => rw [β tensor_ΞΌ_natural]
slice_lhs 2 3 => rw [β tensor_comp, tensor_id]
simp only [Category.assoc]
#align Mon_.Mon_tensor_mul_assoc Mon_.Mon_tensor_mul_assoc
theorem mul_associator {M N P : Mon_ C} :
(tensor_ΞΌ C (M.X β N.X, P.X) (M.X β N.X, P.X) β«
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β P.mul)) β«
(Ξ±_ M.X N.X P.X).hom =
((Ξ±_ M.X N.X P.X).hom β (Ξ±_ M.X N.X P.X).hom) β«
tensor_ΞΌ C (M.X, N.X β P.X) (M.X, N.X β P.X) β«
(M.mul β tensor_ΞΌ C (N.X, P.X) (N.X, P.X) β« (N.mul β P.mul)) := by
simp only [tensor_obj, prodMonoidal_tensorObj, Category.assoc]
slice_lhs 2 3 => rw [β Category.id_comp P.mul, tensor_comp]
slice_lhs 3 4 => rw [associator_naturality]
slice_rhs 3 4 => rw [β Category.id_comp M.mul, tensor_comp]
slice_lhs 1 3 => rw [associator_monoidal]
simp only [Category.assoc]
#align Mon_.mul_associator Mon_.mul_associator
theorem mul_leftUnitor {M : Mon_ C} :
(tensor_ΞΌ C (π_ C, M.X) (π_ C, M.X) β« ((Ξ»_ (π_ C)).hom β M.mul)) β« (Ξ»_ M.X).hom =
((Ξ»_ M.X).hom β (Ξ»_ M.X).hom) β« M.mul := by
rw [β Category.comp_id (Ξ»_ (π_ C)).hom, β Category.id_comp M.mul, tensor_comp]
slice_lhs 3 4 => rw [leftUnitor_naturality]
slice_lhs 1 3 => rw [β leftUnitor_monoidal]
simp only [Category.assoc, Category.id_comp]
#align Mon_.mul_left_unitor Mon_.mul_leftUnitor
theorem mul_rightUnitor {M : Mon_ C} :
(tensor_ΞΌ C (M.X, π_ C) (M.X, π_ C) β« (M.mul β (Ξ»_ (π_ C)).hom)) β« (Ο_ M.X).hom =
((Ο_ M.X).hom β (Ο_ M.X).hom) β« M.mul := by
rw [β Category.id_comp M.mul, β Category.comp_id (Ξ»_ (π_ C)).hom, tensor_comp]
slice_lhs 3 4 => rw [rightUnitor_naturality]
slice_lhs 1 3 => rw [β rightUnitor_monoidal]
simp only [Category.assoc, Category.id_comp]
#align Mon_.mul_right_unitor Mon_.mul_rightUnitor
instance monMonoidalStruct : MonoidalCategoryStruct (Mon_ C) :=
let tensorObj (M N : Mon_ C) : Mon_ C :=
{ X := M.X β N.X
one := (Ξ»_ (π_ C)).inv β« (M.one β N.one)
mul := tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)
one_mul := Mon_tensor_one_mul M N
mul_one := Mon_tensor_mul_one M N
mul_assoc := Mon_tensor_mul_assoc M N }
let tensorHom {Xβ Yβ Xβ Yβ : Mon_ C} (f : Xβ βΆ Yβ) (g : Xβ βΆ Yβ) :
tensorObj _ _ βΆ tensorObj _ _ :=
{ hom := f.hom β g.hom
one_hom := by
dsimp
slice_lhs 2 3 =>
|
rw [β tensor_comp, Hom.one_hom f, Hom.one_hom g]
|
instance monMonoidalStruct : MonoidalCategoryStruct (Mon_ C) :=
let tensorObj (M N : Mon_ C) : Mon_ C :=
{ X := M.X β N.X
one := (Ξ»_ (π_ C)).inv β« (M.one β N.one)
mul := tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)
one_mul := Mon_tensor_one_mul M N
mul_one := Mon_tensor_mul_one M N
mul_assoc := Mon_tensor_mul_assoc M N }
let tensorHom {Xβ Yβ Xβ Yβ : Mon_ C} (f : Xβ βΆ Yβ) (g : Xβ βΆ Yβ) :
tensorObj _ _ βΆ tensorObj _ _ :=
{ hom := f.hom β g.hom
one_hom := by
dsimp
slice_lhs 2 3 =>
|
Mathlib.CategoryTheory.Monoidal.Mon_.478_0.NTUMzhXPwXsmsYt
|
instance monMonoidalStruct : MonoidalCategoryStruct (Mon_ C)
|
Mathlib_CategoryTheory_Monoidal_Mon_
|
case a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
tensorObj : Mon_ C β Mon_ C β Mon_ C :=
fun M N => mk (M.X β N.X) ((Ξ»_ (π_ C)).inv β« (M.one β N.one)) (tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul))
Xβ Yβ Xβ Yβ : Mon_ C
f : Xβ βΆ Yβ
g : Xβ βΆ Yβ
| (Xβ.one β Xβ.one) β« (f.hom β g.hom)
case a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
tensorObj : Mon_ C β Mon_ C β Mon_ C :=
fun M N => mk (M.X β N.X) ((Ξ»_ (π_ C)).inv β« (M.one β N.one)) (tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul))
Xβ Yβ Xβ Yβ : Mon_ C
f : Xβ βΆ Yβ
g : Xβ βΆ Yβ
| (Ξ»_ (π_ 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]
simp
#align Mon_.one_right_unitor Mon_.one_rightUnitor
variable [BraidedCategory C]
theorem Mon_tensor_one_mul (M N : Mon_ C) :
((Ξ»_ (π_ C)).inv β« (M.one β N.one) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ»_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, one_mul M, one_mul N]
symm
exact tensor_left_unitality C M.X N.X
#align Mon_.Mon_tensor_one_mul Mon_.Mon_tensor_one_mul
theorem Mon_tensor_mul_one (M N : Mon_ C) :
(π (M.X β N.X) β (Ξ»_ (π_ C)).inv β« (M.one β N.one)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ο_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_one M, mul_one N]
symm
exact tensor_right_unitality C M.X N.X
#align Mon_.Mon_tensor_mul_one Mon_.Mon_tensor_mul_one
theorem Mon_tensor_mul_assoc (M N : Mon_ C) :
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ±_ (M.X β N.X) (M.X β N.X) (M.X β N.X)).hom β«
(π (M.X β N.X) β tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_assoc M, mul_assoc N, tensor_comp, tensor_comp]
-- Porting note: needed to add `dsimp` here.
slice_lhs 1 3 => dsimp; rw [tensor_associativity]
slice_lhs 3 4 => rw [β tensor_ΞΌ_natural]
slice_lhs 2 3 => rw [β tensor_comp, tensor_id]
simp only [Category.assoc]
#align Mon_.Mon_tensor_mul_assoc Mon_.Mon_tensor_mul_assoc
theorem mul_associator {M N P : Mon_ C} :
(tensor_ΞΌ C (M.X β N.X, P.X) (M.X β N.X, P.X) β«
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β P.mul)) β«
(Ξ±_ M.X N.X P.X).hom =
((Ξ±_ M.X N.X P.X).hom β (Ξ±_ M.X N.X P.X).hom) β«
tensor_ΞΌ C (M.X, N.X β P.X) (M.X, N.X β P.X) β«
(M.mul β tensor_ΞΌ C (N.X, P.X) (N.X, P.X) β« (N.mul β P.mul)) := by
simp only [tensor_obj, prodMonoidal_tensorObj, Category.assoc]
slice_lhs 2 3 => rw [β Category.id_comp P.mul, tensor_comp]
slice_lhs 3 4 => rw [associator_naturality]
slice_rhs 3 4 => rw [β Category.id_comp M.mul, tensor_comp]
slice_lhs 1 3 => rw [associator_monoidal]
simp only [Category.assoc]
#align Mon_.mul_associator Mon_.mul_associator
theorem mul_leftUnitor {M : Mon_ C} :
(tensor_ΞΌ C (π_ C, M.X) (π_ C, M.X) β« ((Ξ»_ (π_ C)).hom β M.mul)) β« (Ξ»_ M.X).hom =
((Ξ»_ M.X).hom β (Ξ»_ M.X).hom) β« M.mul := by
rw [β Category.comp_id (Ξ»_ (π_ C)).hom, β Category.id_comp M.mul, tensor_comp]
slice_lhs 3 4 => rw [leftUnitor_naturality]
slice_lhs 1 3 => rw [β leftUnitor_monoidal]
simp only [Category.assoc, Category.id_comp]
#align Mon_.mul_left_unitor Mon_.mul_leftUnitor
theorem mul_rightUnitor {M : Mon_ C} :
(tensor_ΞΌ C (M.X, π_ C) (M.X, π_ C) β« (M.mul β (Ξ»_ (π_ C)).hom)) β« (Ο_ M.X).hom =
((Ο_ M.X).hom β (Ο_ M.X).hom) β« M.mul := by
rw [β Category.id_comp M.mul, β Category.comp_id (Ξ»_ (π_ C)).hom, tensor_comp]
slice_lhs 3 4 => rw [rightUnitor_naturality]
slice_lhs 1 3 => rw [β rightUnitor_monoidal]
simp only [Category.assoc, Category.id_comp]
#align Mon_.mul_right_unitor Mon_.mul_rightUnitor
instance monMonoidalStruct : MonoidalCategoryStruct (Mon_ C) :=
let tensorObj (M N : Mon_ C) : Mon_ C :=
{ X := M.X β N.X
one := (Ξ»_ (π_ C)).inv β« (M.one β N.one)
mul := tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)
one_mul := Mon_tensor_one_mul M N
mul_one := Mon_tensor_mul_one M N
mul_assoc := Mon_tensor_mul_assoc M N }
let tensorHom {Xβ Yβ Xβ Yβ : Mon_ C} (f : Xβ βΆ Yβ) (g : Xβ βΆ Yβ) :
tensorObj _ _ βΆ tensorObj _ _ :=
{ hom := f.hom β g.hom
one_hom := by
dsimp
slice_lhs 2 3 =>
|
rw [β tensor_comp, Hom.one_hom f, Hom.one_hom g]
|
instance monMonoidalStruct : MonoidalCategoryStruct (Mon_ C) :=
let tensorObj (M N : Mon_ C) : Mon_ C :=
{ X := M.X β N.X
one := (Ξ»_ (π_ C)).inv β« (M.one β N.one)
mul := tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)
one_mul := Mon_tensor_one_mul M N
mul_one := Mon_tensor_mul_one M N
mul_assoc := Mon_tensor_mul_assoc M N }
let tensorHom {Xβ Yβ Xβ Yβ : Mon_ C} (f : Xβ βΆ Yβ) (g : Xβ βΆ Yβ) :
tensorObj _ _ βΆ tensorObj _ _ :=
{ hom := f.hom β g.hom
one_hom := by
dsimp
slice_lhs 2 3 =>
|
Mathlib.CategoryTheory.Monoidal.Mon_.478_0.NTUMzhXPwXsmsYt
|
instance monMonoidalStruct : MonoidalCategoryStruct (Mon_ C)
|
Mathlib_CategoryTheory_Monoidal_Mon_
|
case a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
tensorObj : Mon_ C β Mon_ C β Mon_ C :=
fun M N => mk (M.X β N.X) ((Ξ»_ (π_ C)).inv β« (M.one β N.one)) (tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul))
Xβ Yβ Xβ Yβ : Mon_ C
f : Xβ βΆ Yβ
g : Xβ βΆ Yβ
| (Xβ.one β Xβ.one) β« (f.hom β g.hom)
case a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
tensorObj : Mon_ C β Mon_ C β Mon_ C :=
fun M N => mk (M.X β N.X) ((Ξ»_ (π_ C)).inv β« (M.one β N.one)) (tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul))
Xβ Yβ Xβ Yβ : Mon_ C
f : Xβ βΆ Yβ
g : Xβ βΆ Yβ
| (Ξ»_ (π_ 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]
simp
#align Mon_.one_right_unitor Mon_.one_rightUnitor
variable [BraidedCategory C]
theorem Mon_tensor_one_mul (M N : Mon_ C) :
((Ξ»_ (π_ C)).inv β« (M.one β N.one) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ»_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, one_mul M, one_mul N]
symm
exact tensor_left_unitality C M.X N.X
#align Mon_.Mon_tensor_one_mul Mon_.Mon_tensor_one_mul
theorem Mon_tensor_mul_one (M N : Mon_ C) :
(π (M.X β N.X) β (Ξ»_ (π_ C)).inv β« (M.one β N.one)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ο_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_one M, mul_one N]
symm
exact tensor_right_unitality C M.X N.X
#align Mon_.Mon_tensor_mul_one Mon_.Mon_tensor_mul_one
theorem Mon_tensor_mul_assoc (M N : Mon_ C) :
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ±_ (M.X β N.X) (M.X β N.X) (M.X β N.X)).hom β«
(π (M.X β N.X) β tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_assoc M, mul_assoc N, tensor_comp, tensor_comp]
-- Porting note: needed to add `dsimp` here.
slice_lhs 1 3 => dsimp; rw [tensor_associativity]
slice_lhs 3 4 => rw [β tensor_ΞΌ_natural]
slice_lhs 2 3 => rw [β tensor_comp, tensor_id]
simp only [Category.assoc]
#align Mon_.Mon_tensor_mul_assoc Mon_.Mon_tensor_mul_assoc
theorem mul_associator {M N P : Mon_ C} :
(tensor_ΞΌ C (M.X β N.X, P.X) (M.X β N.X, P.X) β«
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β P.mul)) β«
(Ξ±_ M.X N.X P.X).hom =
((Ξ±_ M.X N.X P.X).hom β (Ξ±_ M.X N.X P.X).hom) β«
tensor_ΞΌ C (M.X, N.X β P.X) (M.X, N.X β P.X) β«
(M.mul β tensor_ΞΌ C (N.X, P.X) (N.X, P.X) β« (N.mul β P.mul)) := by
simp only [tensor_obj, prodMonoidal_tensorObj, Category.assoc]
slice_lhs 2 3 => rw [β Category.id_comp P.mul, tensor_comp]
slice_lhs 3 4 => rw [associator_naturality]
slice_rhs 3 4 => rw [β Category.id_comp M.mul, tensor_comp]
slice_lhs 1 3 => rw [associator_monoidal]
simp only [Category.assoc]
#align Mon_.mul_associator Mon_.mul_associator
theorem mul_leftUnitor {M : Mon_ C} :
(tensor_ΞΌ C (π_ C, M.X) (π_ C, M.X) β« ((Ξ»_ (π_ C)).hom β M.mul)) β« (Ξ»_ M.X).hom =
((Ξ»_ M.X).hom β (Ξ»_ M.X).hom) β« M.mul := by
rw [β Category.comp_id (Ξ»_ (π_ C)).hom, β Category.id_comp M.mul, tensor_comp]
slice_lhs 3 4 => rw [leftUnitor_naturality]
slice_lhs 1 3 => rw [β leftUnitor_monoidal]
simp only [Category.assoc, Category.id_comp]
#align Mon_.mul_left_unitor Mon_.mul_leftUnitor
theorem mul_rightUnitor {M : Mon_ C} :
(tensor_ΞΌ C (M.X, π_ C) (M.X, π_ C) β« (M.mul β (Ξ»_ (π_ C)).hom)) β« (Ο_ M.X).hom =
((Ο_ M.X).hom β (Ο_ M.X).hom) β« M.mul := by
rw [β Category.id_comp M.mul, β Category.comp_id (Ξ»_ (π_ C)).hom, tensor_comp]
slice_lhs 3 4 => rw [rightUnitor_naturality]
slice_lhs 1 3 => rw [β rightUnitor_monoidal]
simp only [Category.assoc, Category.id_comp]
#align Mon_.mul_right_unitor Mon_.mul_rightUnitor
instance monMonoidalStruct : MonoidalCategoryStruct (Mon_ C) :=
let tensorObj (M N : Mon_ C) : Mon_ C :=
{ X := M.X β N.X
one := (Ξ»_ (π_ C)).inv β« (M.one β N.one)
mul := tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)
one_mul := Mon_tensor_one_mul M N
mul_one := Mon_tensor_mul_one M N
mul_assoc := Mon_tensor_mul_assoc M N }
let tensorHom {Xβ Yβ Xβ Yβ : Mon_ C} (f : Xβ βΆ Yβ) (g : Xβ βΆ Yβ) :
tensorObj _ _ βΆ tensorObj _ _ :=
{ hom := f.hom β g.hom
one_hom := by
dsimp
slice_lhs 2 3 =>
|
rw [β tensor_comp, Hom.one_hom f, Hom.one_hom g]
|
instance monMonoidalStruct : MonoidalCategoryStruct (Mon_ C) :=
let tensorObj (M N : Mon_ C) : Mon_ C :=
{ X := M.X β N.X
one := (Ξ»_ (π_ C)).inv β« (M.one β N.one)
mul := tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)
one_mul := Mon_tensor_one_mul M N
mul_one := Mon_tensor_mul_one M N
mul_assoc := Mon_tensor_mul_assoc M N }
let tensorHom {Xβ Yβ Xβ Yβ : Mon_ C} (f : Xβ βΆ Yβ) (g : Xβ βΆ Yβ) :
tensorObj _ _ βΆ tensorObj _ _ :=
{ hom := f.hom β g.hom
one_hom := by
dsimp
slice_lhs 2 3 =>
|
Mathlib.CategoryTheory.Monoidal.Mon_.478_0.NTUMzhXPwXsmsYt
|
instance monMonoidalStruct : MonoidalCategoryStruct (Mon_ C)
|
Mathlib_CategoryTheory_Monoidal_Mon_
|
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
tensorObj : Mon_ C β Mon_ C β Mon_ C :=
fun M N => mk (M.X β N.X) ((Ξ»_ (π_ C)).inv β« (M.one β N.one)) (tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul))
Xβ Yβ Xβ Yβ : Mon_ C
f : Xβ βΆ Yβ
g : Xβ βΆ Yβ
β’ (tensorObj Xβ Xβ).mul β« (f.hom β g.hom) = ((f.hom β g.hom) β f.hom β g.hom) β« (tensorObj Yβ 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] }
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
#align Mon_.one_right_unitor Mon_.one_rightUnitor
variable [BraidedCategory C]
theorem Mon_tensor_one_mul (M N : Mon_ C) :
((Ξ»_ (π_ C)).inv β« (M.one β N.one) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ»_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, one_mul M, one_mul N]
symm
exact tensor_left_unitality C M.X N.X
#align Mon_.Mon_tensor_one_mul Mon_.Mon_tensor_one_mul
theorem Mon_tensor_mul_one (M N : Mon_ C) :
(π (M.X β N.X) β (Ξ»_ (π_ C)).inv β« (M.one β N.one)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ο_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_one M, mul_one N]
symm
exact tensor_right_unitality C M.X N.X
#align Mon_.Mon_tensor_mul_one Mon_.Mon_tensor_mul_one
theorem Mon_tensor_mul_assoc (M N : Mon_ C) :
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ±_ (M.X β N.X) (M.X β N.X) (M.X β N.X)).hom β«
(π (M.X β N.X) β tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_assoc M, mul_assoc N, tensor_comp, tensor_comp]
-- Porting note: needed to add `dsimp` here.
slice_lhs 1 3 => dsimp; rw [tensor_associativity]
slice_lhs 3 4 => rw [β tensor_ΞΌ_natural]
slice_lhs 2 3 => rw [β tensor_comp, tensor_id]
simp only [Category.assoc]
#align Mon_.Mon_tensor_mul_assoc Mon_.Mon_tensor_mul_assoc
theorem mul_associator {M N P : Mon_ C} :
(tensor_ΞΌ C (M.X β N.X, P.X) (M.X β N.X, P.X) β«
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β P.mul)) β«
(Ξ±_ M.X N.X P.X).hom =
((Ξ±_ M.X N.X P.X).hom β (Ξ±_ M.X N.X P.X).hom) β«
tensor_ΞΌ C (M.X, N.X β P.X) (M.X, N.X β P.X) β«
(M.mul β tensor_ΞΌ C (N.X, P.X) (N.X, P.X) β« (N.mul β P.mul)) := by
simp only [tensor_obj, prodMonoidal_tensorObj, Category.assoc]
slice_lhs 2 3 => rw [β Category.id_comp P.mul, tensor_comp]
slice_lhs 3 4 => rw [associator_naturality]
slice_rhs 3 4 => rw [β Category.id_comp M.mul, tensor_comp]
slice_lhs 1 3 => rw [associator_monoidal]
simp only [Category.assoc]
#align Mon_.mul_associator Mon_.mul_associator
theorem mul_leftUnitor {M : Mon_ C} :
(tensor_ΞΌ C (π_ C, M.X) (π_ C, M.X) β« ((Ξ»_ (π_ C)).hom β M.mul)) β« (Ξ»_ M.X).hom =
((Ξ»_ M.X).hom β (Ξ»_ M.X).hom) β« M.mul := by
rw [β Category.comp_id (Ξ»_ (π_ C)).hom, β Category.id_comp M.mul, tensor_comp]
slice_lhs 3 4 => rw [leftUnitor_naturality]
slice_lhs 1 3 => rw [β leftUnitor_monoidal]
simp only [Category.assoc, Category.id_comp]
#align Mon_.mul_left_unitor Mon_.mul_leftUnitor
theorem mul_rightUnitor {M : Mon_ C} :
(tensor_ΞΌ C (M.X, π_ C) (M.X, π_ C) β« (M.mul β (Ξ»_ (π_ C)).hom)) β« (Ο_ M.X).hom =
((Ο_ M.X).hom β (Ο_ M.X).hom) β« M.mul := by
rw [β Category.id_comp M.mul, β Category.comp_id (Ξ»_ (π_ C)).hom, tensor_comp]
slice_lhs 3 4 => rw [rightUnitor_naturality]
slice_lhs 1 3 => rw [β rightUnitor_monoidal]
simp only [Category.assoc, Category.id_comp]
#align Mon_.mul_right_unitor Mon_.mul_rightUnitor
instance monMonoidalStruct : MonoidalCategoryStruct (Mon_ C) :=
let tensorObj (M N : Mon_ C) : Mon_ C :=
{ X := M.X β N.X
one := (Ξ»_ (π_ C)).inv β« (M.one β N.one)
mul := tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)
one_mul := Mon_tensor_one_mul M N
mul_one := Mon_tensor_mul_one M N
mul_assoc := Mon_tensor_mul_assoc M N }
let tensorHom {Xβ Yβ Xβ Yβ : Mon_ C} (f : Xβ βΆ Yβ) (g : Xβ βΆ Yβ) :
tensorObj _ _ βΆ tensorObj _ _ :=
{ hom := f.hom β g.hom
one_hom := by
dsimp
slice_lhs 2 3 => rw [β tensor_comp, Hom.one_hom f, Hom.one_hom g]
mul_hom := by
|
dsimp
|
instance monMonoidalStruct : MonoidalCategoryStruct (Mon_ C) :=
let tensorObj (M N : Mon_ C) : Mon_ C :=
{ X := M.X β N.X
one := (Ξ»_ (π_ C)).inv β« (M.one β N.one)
mul := tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)
one_mul := Mon_tensor_one_mul M N
mul_one := Mon_tensor_mul_one M N
mul_assoc := Mon_tensor_mul_assoc M N }
let tensorHom {Xβ Yβ Xβ Yβ : Mon_ C} (f : Xβ βΆ Yβ) (g : Xβ βΆ Yβ) :
tensorObj _ _ βΆ tensorObj _ _ :=
{ hom := f.hom β g.hom
one_hom := by
dsimp
slice_lhs 2 3 => rw [β tensor_comp, Hom.one_hom f, Hom.one_hom g]
mul_hom := by
|
Mathlib.CategoryTheory.Monoidal.Mon_.478_0.NTUMzhXPwXsmsYt
|
instance monMonoidalStruct : MonoidalCategoryStruct (Mon_ C)
|
Mathlib_CategoryTheory_Monoidal_Mon_
|
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
tensorObj : Mon_ C β Mon_ C β Mon_ C :=
fun M N => mk (M.X β N.X) ((Ξ»_ (π_ C)).inv β« (M.one β N.one)) (tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul))
Xβ Yβ Xβ Yβ : Mon_ C
f : Xβ βΆ Yβ
g : Xβ βΆ Yβ
β’ (tensor_ΞΌ C (Xβ.X, Xβ.X) (Xβ.X, Xβ.X) β« (Xβ.mul β Xβ.mul)) β« (f.hom β g.hom) =
((f.hom β g.hom) β f.hom β g.hom) β« tensor_ΞΌ C (Yβ.X, Yβ.X) (Yβ.X, Yβ.X) β« (Yβ.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
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
#align Mon_.one_right_unitor Mon_.one_rightUnitor
variable [BraidedCategory C]
theorem Mon_tensor_one_mul (M N : Mon_ C) :
((Ξ»_ (π_ C)).inv β« (M.one β N.one) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ»_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, one_mul M, one_mul N]
symm
exact tensor_left_unitality C M.X N.X
#align Mon_.Mon_tensor_one_mul Mon_.Mon_tensor_one_mul
theorem Mon_tensor_mul_one (M N : Mon_ C) :
(π (M.X β N.X) β (Ξ»_ (π_ C)).inv β« (M.one β N.one)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ο_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_one M, mul_one N]
symm
exact tensor_right_unitality C M.X N.X
#align Mon_.Mon_tensor_mul_one Mon_.Mon_tensor_mul_one
theorem Mon_tensor_mul_assoc (M N : Mon_ C) :
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ±_ (M.X β N.X) (M.X β N.X) (M.X β N.X)).hom β«
(π (M.X β N.X) β tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_assoc M, mul_assoc N, tensor_comp, tensor_comp]
-- Porting note: needed to add `dsimp` here.
slice_lhs 1 3 => dsimp; rw [tensor_associativity]
slice_lhs 3 4 => rw [β tensor_ΞΌ_natural]
slice_lhs 2 3 => rw [β tensor_comp, tensor_id]
simp only [Category.assoc]
#align Mon_.Mon_tensor_mul_assoc Mon_.Mon_tensor_mul_assoc
theorem mul_associator {M N P : Mon_ C} :
(tensor_ΞΌ C (M.X β N.X, P.X) (M.X β N.X, P.X) β«
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β P.mul)) β«
(Ξ±_ M.X N.X P.X).hom =
((Ξ±_ M.X N.X P.X).hom β (Ξ±_ M.X N.X P.X).hom) β«
tensor_ΞΌ C (M.X, N.X β P.X) (M.X, N.X β P.X) β«
(M.mul β tensor_ΞΌ C (N.X, P.X) (N.X, P.X) β« (N.mul β P.mul)) := by
simp only [tensor_obj, prodMonoidal_tensorObj, Category.assoc]
slice_lhs 2 3 => rw [β Category.id_comp P.mul, tensor_comp]
slice_lhs 3 4 => rw [associator_naturality]
slice_rhs 3 4 => rw [β Category.id_comp M.mul, tensor_comp]
slice_lhs 1 3 => rw [associator_monoidal]
simp only [Category.assoc]
#align Mon_.mul_associator Mon_.mul_associator
theorem mul_leftUnitor {M : Mon_ C} :
(tensor_ΞΌ C (π_ C, M.X) (π_ C, M.X) β« ((Ξ»_ (π_ C)).hom β M.mul)) β« (Ξ»_ M.X).hom =
((Ξ»_ M.X).hom β (Ξ»_ M.X).hom) β« M.mul := by
rw [β Category.comp_id (Ξ»_ (π_ C)).hom, β Category.id_comp M.mul, tensor_comp]
slice_lhs 3 4 => rw [leftUnitor_naturality]
slice_lhs 1 3 => rw [β leftUnitor_monoidal]
simp only [Category.assoc, Category.id_comp]
#align Mon_.mul_left_unitor Mon_.mul_leftUnitor
theorem mul_rightUnitor {M : Mon_ C} :
(tensor_ΞΌ C (M.X, π_ C) (M.X, π_ C) β« (M.mul β (Ξ»_ (π_ C)).hom)) β« (Ο_ M.X).hom =
((Ο_ M.X).hom β (Ο_ M.X).hom) β« M.mul := by
rw [β Category.id_comp M.mul, β Category.comp_id (Ξ»_ (π_ C)).hom, tensor_comp]
slice_lhs 3 4 => rw [rightUnitor_naturality]
slice_lhs 1 3 => rw [β rightUnitor_monoidal]
simp only [Category.assoc, Category.id_comp]
#align Mon_.mul_right_unitor Mon_.mul_rightUnitor
instance monMonoidalStruct : MonoidalCategoryStruct (Mon_ C) :=
let tensorObj (M N : Mon_ C) : Mon_ C :=
{ X := M.X β N.X
one := (Ξ»_ (π_ C)).inv β« (M.one β N.one)
mul := tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)
one_mul := Mon_tensor_one_mul M N
mul_one := Mon_tensor_mul_one M N
mul_assoc := Mon_tensor_mul_assoc M N }
let tensorHom {Xβ Yβ Xβ Yβ : Mon_ C} (f : Xβ βΆ Yβ) (g : Xβ βΆ Yβ) :
tensorObj _ _ βΆ tensorObj _ _ :=
{ hom := f.hom β g.hom
one_hom := by
dsimp
slice_lhs 2 3 => rw [β tensor_comp, Hom.one_hom f, Hom.one_hom g]
mul_hom := by
dsimp
|
slice_rhs 1 2 => rw [tensor_ΞΌ_natural]
|
instance monMonoidalStruct : MonoidalCategoryStruct (Mon_ C) :=
let tensorObj (M N : Mon_ C) : Mon_ C :=
{ X := M.X β N.X
one := (Ξ»_ (π_ C)).inv β« (M.one β N.one)
mul := tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)
one_mul := Mon_tensor_one_mul M N
mul_one := Mon_tensor_mul_one M N
mul_assoc := Mon_tensor_mul_assoc M N }
let tensorHom {Xβ Yβ Xβ Yβ : Mon_ C} (f : Xβ βΆ Yβ) (g : Xβ βΆ Yβ) :
tensorObj _ _ βΆ tensorObj _ _ :=
{ hom := f.hom β g.hom
one_hom := by
dsimp
slice_lhs 2 3 => rw [β tensor_comp, Hom.one_hom f, Hom.one_hom g]
mul_hom := by
dsimp
|
Mathlib.CategoryTheory.Monoidal.Mon_.478_0.NTUMzhXPwXsmsYt
|
instance monMonoidalStruct : MonoidalCategoryStruct (Mon_ C)
|
Mathlib_CategoryTheory_Monoidal_Mon_
|
case a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
tensorObj : Mon_ C β Mon_ C β Mon_ C :=
fun M N => mk (M.X β N.X) ((Ξ»_ (π_ C)).inv β« (M.one β N.one)) (tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul))
Xβ Yβ Xβ Yβ : Mon_ C
f : Xβ βΆ Yβ
g : Xβ βΆ Yβ
| ((f.hom β g.hom) β f.hom β g.hom) β« tensor_ΞΌ C (Yβ.X, Yβ.X) (Yβ.X, Yβ.X)
case a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
tensorObj : Mon_ C β Mon_ C β Mon_ C :=
fun M N => mk (M.X β N.X) ((Ξ»_ (π_ C)).inv β« (M.one β N.one)) (tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul))
Xβ Yβ Xβ Yβ : Mon_ C
f : Xβ βΆ Yβ
g : Xβ βΆ Yβ
| Yβ.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
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
#align Mon_.one_right_unitor Mon_.one_rightUnitor
variable [BraidedCategory C]
theorem Mon_tensor_one_mul (M N : Mon_ C) :
((Ξ»_ (π_ C)).inv β« (M.one β N.one) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ»_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, one_mul M, one_mul N]
symm
exact tensor_left_unitality C M.X N.X
#align Mon_.Mon_tensor_one_mul Mon_.Mon_tensor_one_mul
theorem Mon_tensor_mul_one (M N : Mon_ C) :
(π (M.X β N.X) β (Ξ»_ (π_ C)).inv β« (M.one β N.one)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ο_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_one M, mul_one N]
symm
exact tensor_right_unitality C M.X N.X
#align Mon_.Mon_tensor_mul_one Mon_.Mon_tensor_mul_one
theorem Mon_tensor_mul_assoc (M N : Mon_ C) :
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ±_ (M.X β N.X) (M.X β N.X) (M.X β N.X)).hom β«
(π (M.X β N.X) β tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_assoc M, mul_assoc N, tensor_comp, tensor_comp]
-- Porting note: needed to add `dsimp` here.
slice_lhs 1 3 => dsimp; rw [tensor_associativity]
slice_lhs 3 4 => rw [β tensor_ΞΌ_natural]
slice_lhs 2 3 => rw [β tensor_comp, tensor_id]
simp only [Category.assoc]
#align Mon_.Mon_tensor_mul_assoc Mon_.Mon_tensor_mul_assoc
theorem mul_associator {M N P : Mon_ C} :
(tensor_ΞΌ C (M.X β N.X, P.X) (M.X β N.X, P.X) β«
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β P.mul)) β«
(Ξ±_ M.X N.X P.X).hom =
((Ξ±_ M.X N.X P.X).hom β (Ξ±_ M.X N.X P.X).hom) β«
tensor_ΞΌ C (M.X, N.X β P.X) (M.X, N.X β P.X) β«
(M.mul β tensor_ΞΌ C (N.X, P.X) (N.X, P.X) β« (N.mul β P.mul)) := by
simp only [tensor_obj, prodMonoidal_tensorObj, Category.assoc]
slice_lhs 2 3 => rw [β Category.id_comp P.mul, tensor_comp]
slice_lhs 3 4 => rw [associator_naturality]
slice_rhs 3 4 => rw [β Category.id_comp M.mul, tensor_comp]
slice_lhs 1 3 => rw [associator_monoidal]
simp only [Category.assoc]
#align Mon_.mul_associator Mon_.mul_associator
theorem mul_leftUnitor {M : Mon_ C} :
(tensor_ΞΌ C (π_ C, M.X) (π_ C, M.X) β« ((Ξ»_ (π_ C)).hom β M.mul)) β« (Ξ»_ M.X).hom =
((Ξ»_ M.X).hom β (Ξ»_ M.X).hom) β« M.mul := by
rw [β Category.comp_id (Ξ»_ (π_ C)).hom, β Category.id_comp M.mul, tensor_comp]
slice_lhs 3 4 => rw [leftUnitor_naturality]
slice_lhs 1 3 => rw [β leftUnitor_monoidal]
simp only [Category.assoc, Category.id_comp]
#align Mon_.mul_left_unitor Mon_.mul_leftUnitor
theorem mul_rightUnitor {M : Mon_ C} :
(tensor_ΞΌ C (M.X, π_ C) (M.X, π_ C) β« (M.mul β (Ξ»_ (π_ C)).hom)) β« (Ο_ M.X).hom =
((Ο_ M.X).hom β (Ο_ M.X).hom) β« M.mul := by
rw [β Category.id_comp M.mul, β Category.comp_id (Ξ»_ (π_ C)).hom, tensor_comp]
slice_lhs 3 4 => rw [rightUnitor_naturality]
slice_lhs 1 3 => rw [β rightUnitor_monoidal]
simp only [Category.assoc, Category.id_comp]
#align Mon_.mul_right_unitor Mon_.mul_rightUnitor
instance monMonoidalStruct : MonoidalCategoryStruct (Mon_ C) :=
let tensorObj (M N : Mon_ C) : Mon_ C :=
{ X := M.X β N.X
one := (Ξ»_ (π_ C)).inv β« (M.one β N.one)
mul := tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)
one_mul := Mon_tensor_one_mul M N
mul_one := Mon_tensor_mul_one M N
mul_assoc := Mon_tensor_mul_assoc M N }
let tensorHom {Xβ Yβ Xβ Yβ : Mon_ C} (f : Xβ βΆ Yβ) (g : Xβ βΆ Yβ) :
tensorObj _ _ βΆ tensorObj _ _ :=
{ hom := f.hom β g.hom
one_hom := by
dsimp
slice_lhs 2 3 => rw [β tensor_comp, Hom.one_hom f, Hom.one_hom g]
mul_hom := by
dsimp
slice_rhs 1 2 =>
|
rw [tensor_ΞΌ_natural]
|
instance monMonoidalStruct : MonoidalCategoryStruct (Mon_ C) :=
let tensorObj (M N : Mon_ C) : Mon_ C :=
{ X := M.X β N.X
one := (Ξ»_ (π_ C)).inv β« (M.one β N.one)
mul := tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)
one_mul := Mon_tensor_one_mul M N
mul_one := Mon_tensor_mul_one M N
mul_assoc := Mon_tensor_mul_assoc M N }
let tensorHom {Xβ Yβ Xβ Yβ : Mon_ C} (f : Xβ βΆ Yβ) (g : Xβ βΆ Yβ) :
tensorObj _ _ βΆ tensorObj _ _ :=
{ hom := f.hom β g.hom
one_hom := by
dsimp
slice_lhs 2 3 => rw [β tensor_comp, Hom.one_hom f, Hom.one_hom g]
mul_hom := by
dsimp
slice_rhs 1 2 =>
|
Mathlib.CategoryTheory.Monoidal.Mon_.478_0.NTUMzhXPwXsmsYt
|
instance monMonoidalStruct : MonoidalCategoryStruct (Mon_ C)
|
Mathlib_CategoryTheory_Monoidal_Mon_
|
case a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
tensorObj : Mon_ C β Mon_ C β Mon_ C :=
fun M N => mk (M.X β N.X) ((Ξ»_ (π_ C)).inv β« (M.one β N.one)) (tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul))
Xβ Yβ Xβ Yβ : Mon_ C
f : Xβ βΆ Yβ
g : Xβ βΆ Yβ
| ((f.hom β g.hom) β f.hom β g.hom) β« tensor_ΞΌ C (Yβ.X, Yβ.X) (Yβ.X, Yβ.X)
case a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
tensorObj : Mon_ C β Mon_ C β Mon_ C :=
fun M N => mk (M.X β N.X) ((Ξ»_ (π_ C)).inv β« (M.one β N.one)) (tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul))
Xβ Yβ Xβ Yβ : Mon_ C
f : Xβ βΆ Yβ
g : Xβ βΆ Yβ
| Yβ.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
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
#align Mon_.one_right_unitor Mon_.one_rightUnitor
variable [BraidedCategory C]
theorem Mon_tensor_one_mul (M N : Mon_ C) :
((Ξ»_ (π_ C)).inv β« (M.one β N.one) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ»_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, one_mul M, one_mul N]
symm
exact tensor_left_unitality C M.X N.X
#align Mon_.Mon_tensor_one_mul Mon_.Mon_tensor_one_mul
theorem Mon_tensor_mul_one (M N : Mon_ C) :
(π (M.X β N.X) β (Ξ»_ (π_ C)).inv β« (M.one β N.one)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ο_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_one M, mul_one N]
symm
exact tensor_right_unitality C M.X N.X
#align Mon_.Mon_tensor_mul_one Mon_.Mon_tensor_mul_one
theorem Mon_tensor_mul_assoc (M N : Mon_ C) :
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ±_ (M.X β N.X) (M.X β N.X) (M.X β N.X)).hom β«
(π (M.X β N.X) β tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_assoc M, mul_assoc N, tensor_comp, tensor_comp]
-- Porting note: needed to add `dsimp` here.
slice_lhs 1 3 => dsimp; rw [tensor_associativity]
slice_lhs 3 4 => rw [β tensor_ΞΌ_natural]
slice_lhs 2 3 => rw [β tensor_comp, tensor_id]
simp only [Category.assoc]
#align Mon_.Mon_tensor_mul_assoc Mon_.Mon_tensor_mul_assoc
theorem mul_associator {M N P : Mon_ C} :
(tensor_ΞΌ C (M.X β N.X, P.X) (M.X β N.X, P.X) β«
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β P.mul)) β«
(Ξ±_ M.X N.X P.X).hom =
((Ξ±_ M.X N.X P.X).hom β (Ξ±_ M.X N.X P.X).hom) β«
tensor_ΞΌ C (M.X, N.X β P.X) (M.X, N.X β P.X) β«
(M.mul β tensor_ΞΌ C (N.X, P.X) (N.X, P.X) β« (N.mul β P.mul)) := by
simp only [tensor_obj, prodMonoidal_tensorObj, Category.assoc]
slice_lhs 2 3 => rw [β Category.id_comp P.mul, tensor_comp]
slice_lhs 3 4 => rw [associator_naturality]
slice_rhs 3 4 => rw [β Category.id_comp M.mul, tensor_comp]
slice_lhs 1 3 => rw [associator_monoidal]
simp only [Category.assoc]
#align Mon_.mul_associator Mon_.mul_associator
theorem mul_leftUnitor {M : Mon_ C} :
(tensor_ΞΌ C (π_ C, M.X) (π_ C, M.X) β« ((Ξ»_ (π_ C)).hom β M.mul)) β« (Ξ»_ M.X).hom =
((Ξ»_ M.X).hom β (Ξ»_ M.X).hom) β« M.mul := by
rw [β Category.comp_id (Ξ»_ (π_ C)).hom, β Category.id_comp M.mul, tensor_comp]
slice_lhs 3 4 => rw [leftUnitor_naturality]
slice_lhs 1 3 => rw [β leftUnitor_monoidal]
simp only [Category.assoc, Category.id_comp]
#align Mon_.mul_left_unitor Mon_.mul_leftUnitor
theorem mul_rightUnitor {M : Mon_ C} :
(tensor_ΞΌ C (M.X, π_ C) (M.X, π_ C) β« (M.mul β (Ξ»_ (π_ C)).hom)) β« (Ο_ M.X).hom =
((Ο_ M.X).hom β (Ο_ M.X).hom) β« M.mul := by
rw [β Category.id_comp M.mul, β Category.comp_id (Ξ»_ (π_ C)).hom, tensor_comp]
slice_lhs 3 4 => rw [rightUnitor_naturality]
slice_lhs 1 3 => rw [β rightUnitor_monoidal]
simp only [Category.assoc, Category.id_comp]
#align Mon_.mul_right_unitor Mon_.mul_rightUnitor
instance monMonoidalStruct : MonoidalCategoryStruct (Mon_ C) :=
let tensorObj (M N : Mon_ C) : Mon_ C :=
{ X := M.X β N.X
one := (Ξ»_ (π_ C)).inv β« (M.one β N.one)
mul := tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)
one_mul := Mon_tensor_one_mul M N
mul_one := Mon_tensor_mul_one M N
mul_assoc := Mon_tensor_mul_assoc M N }
let tensorHom {Xβ Yβ Xβ Yβ : Mon_ C} (f : Xβ βΆ Yβ) (g : Xβ βΆ Yβ) :
tensorObj _ _ βΆ tensorObj _ _ :=
{ hom := f.hom β g.hom
one_hom := by
dsimp
slice_lhs 2 3 => rw [β tensor_comp, Hom.one_hom f, Hom.one_hom g]
mul_hom := by
dsimp
slice_rhs 1 2 =>
|
rw [tensor_ΞΌ_natural]
|
instance monMonoidalStruct : MonoidalCategoryStruct (Mon_ C) :=
let tensorObj (M N : Mon_ C) : Mon_ C :=
{ X := M.X β N.X
one := (Ξ»_ (π_ C)).inv β« (M.one β N.one)
mul := tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)
one_mul := Mon_tensor_one_mul M N
mul_one := Mon_tensor_mul_one M N
mul_assoc := Mon_tensor_mul_assoc M N }
let tensorHom {Xβ Yβ Xβ Yβ : Mon_ C} (f : Xβ βΆ Yβ) (g : Xβ βΆ Yβ) :
tensorObj _ _ βΆ tensorObj _ _ :=
{ hom := f.hom β g.hom
one_hom := by
dsimp
slice_lhs 2 3 => rw [β tensor_comp, Hom.one_hom f, Hom.one_hom g]
mul_hom := by
dsimp
slice_rhs 1 2 =>
|
Mathlib.CategoryTheory.Monoidal.Mon_.478_0.NTUMzhXPwXsmsYt
|
instance monMonoidalStruct : MonoidalCategoryStruct (Mon_ C)
|
Mathlib_CategoryTheory_Monoidal_Mon_
|
case a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
tensorObj : Mon_ C β Mon_ C β Mon_ C :=
fun M N => mk (M.X β N.X) ((Ξ»_ (π_ C)).inv β« (M.one β N.one)) (tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul))
Xβ Yβ Xβ Yβ : Mon_ C
f : Xβ βΆ Yβ
g : Xβ βΆ Yβ
| ((f.hom β g.hom) β f.hom β g.hom) β« tensor_ΞΌ C (Yβ.X, Yβ.X) (Yβ.X, Yβ.X)
case a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
tensorObj : Mon_ C β Mon_ C β Mon_ C :=
fun M N => mk (M.X β N.X) ((Ξ»_ (π_ C)).inv β« (M.one β N.one)) (tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul))
Xβ Yβ Xβ Yβ : Mon_ C
f : Xβ βΆ Yβ
g : Xβ βΆ Yβ
| Yβ.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
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
#align Mon_.one_right_unitor Mon_.one_rightUnitor
variable [BraidedCategory C]
theorem Mon_tensor_one_mul (M N : Mon_ C) :
((Ξ»_ (π_ C)).inv β« (M.one β N.one) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ»_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, one_mul M, one_mul N]
symm
exact tensor_left_unitality C M.X N.X
#align Mon_.Mon_tensor_one_mul Mon_.Mon_tensor_one_mul
theorem Mon_tensor_mul_one (M N : Mon_ C) :
(π (M.X β N.X) β (Ξ»_ (π_ C)).inv β« (M.one β N.one)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ο_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_one M, mul_one N]
symm
exact tensor_right_unitality C M.X N.X
#align Mon_.Mon_tensor_mul_one Mon_.Mon_tensor_mul_one
theorem Mon_tensor_mul_assoc (M N : Mon_ C) :
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ±_ (M.X β N.X) (M.X β N.X) (M.X β N.X)).hom β«
(π (M.X β N.X) β tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_assoc M, mul_assoc N, tensor_comp, tensor_comp]
-- Porting note: needed to add `dsimp` here.
slice_lhs 1 3 => dsimp; rw [tensor_associativity]
slice_lhs 3 4 => rw [β tensor_ΞΌ_natural]
slice_lhs 2 3 => rw [β tensor_comp, tensor_id]
simp only [Category.assoc]
#align Mon_.Mon_tensor_mul_assoc Mon_.Mon_tensor_mul_assoc
theorem mul_associator {M N P : Mon_ C} :
(tensor_ΞΌ C (M.X β N.X, P.X) (M.X β N.X, P.X) β«
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β P.mul)) β«
(Ξ±_ M.X N.X P.X).hom =
((Ξ±_ M.X N.X P.X).hom β (Ξ±_ M.X N.X P.X).hom) β«
tensor_ΞΌ C (M.X, N.X β P.X) (M.X, N.X β P.X) β«
(M.mul β tensor_ΞΌ C (N.X, P.X) (N.X, P.X) β« (N.mul β P.mul)) := by
simp only [tensor_obj, prodMonoidal_tensorObj, Category.assoc]
slice_lhs 2 3 => rw [β Category.id_comp P.mul, tensor_comp]
slice_lhs 3 4 => rw [associator_naturality]
slice_rhs 3 4 => rw [β Category.id_comp M.mul, tensor_comp]
slice_lhs 1 3 => rw [associator_monoidal]
simp only [Category.assoc]
#align Mon_.mul_associator Mon_.mul_associator
theorem mul_leftUnitor {M : Mon_ C} :
(tensor_ΞΌ C (π_ C, M.X) (π_ C, M.X) β« ((Ξ»_ (π_ C)).hom β M.mul)) β« (Ξ»_ M.X).hom =
((Ξ»_ M.X).hom β (Ξ»_ M.X).hom) β« M.mul := by
rw [β Category.comp_id (Ξ»_ (π_ C)).hom, β Category.id_comp M.mul, tensor_comp]
slice_lhs 3 4 => rw [leftUnitor_naturality]
slice_lhs 1 3 => rw [β leftUnitor_monoidal]
simp only [Category.assoc, Category.id_comp]
#align Mon_.mul_left_unitor Mon_.mul_leftUnitor
theorem mul_rightUnitor {M : Mon_ C} :
(tensor_ΞΌ C (M.X, π_ C) (M.X, π_ C) β« (M.mul β (Ξ»_ (π_ C)).hom)) β« (Ο_ M.X).hom =
((Ο_ M.X).hom β (Ο_ M.X).hom) β« M.mul := by
rw [β Category.id_comp M.mul, β Category.comp_id (Ξ»_ (π_ C)).hom, tensor_comp]
slice_lhs 3 4 => rw [rightUnitor_naturality]
slice_lhs 1 3 => rw [β rightUnitor_monoidal]
simp only [Category.assoc, Category.id_comp]
#align Mon_.mul_right_unitor Mon_.mul_rightUnitor
instance monMonoidalStruct : MonoidalCategoryStruct (Mon_ C) :=
let tensorObj (M N : Mon_ C) : Mon_ C :=
{ X := M.X β N.X
one := (Ξ»_ (π_ C)).inv β« (M.one β N.one)
mul := tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)
one_mul := Mon_tensor_one_mul M N
mul_one := Mon_tensor_mul_one M N
mul_assoc := Mon_tensor_mul_assoc M N }
let tensorHom {Xβ Yβ Xβ Yβ : Mon_ C} (f : Xβ βΆ Yβ) (g : Xβ βΆ Yβ) :
tensorObj _ _ βΆ tensorObj _ _ :=
{ hom := f.hom β g.hom
one_hom := by
dsimp
slice_lhs 2 3 => rw [β tensor_comp, Hom.one_hom f, Hom.one_hom g]
mul_hom := by
dsimp
slice_rhs 1 2 =>
|
rw [tensor_ΞΌ_natural]
|
instance monMonoidalStruct : MonoidalCategoryStruct (Mon_ C) :=
let tensorObj (M N : Mon_ C) : Mon_ C :=
{ X := M.X β N.X
one := (Ξ»_ (π_ C)).inv β« (M.one β N.one)
mul := tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)
one_mul := Mon_tensor_one_mul M N
mul_one := Mon_tensor_mul_one M N
mul_assoc := Mon_tensor_mul_assoc M N }
let tensorHom {Xβ Yβ Xβ Yβ : Mon_ C} (f : Xβ βΆ Yβ) (g : Xβ βΆ Yβ) :
tensorObj _ _ βΆ tensorObj _ _ :=
{ hom := f.hom β g.hom
one_hom := by
dsimp
slice_lhs 2 3 => rw [β tensor_comp, Hom.one_hom f, Hom.one_hom g]
mul_hom := by
dsimp
slice_rhs 1 2 =>
|
Mathlib.CategoryTheory.Monoidal.Mon_.478_0.NTUMzhXPwXsmsYt
|
instance monMonoidalStruct : MonoidalCategoryStruct (Mon_ C)
|
Mathlib_CategoryTheory_Monoidal_Mon_
|
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
tensorObj : Mon_ C β Mon_ C β Mon_ C :=
fun M N => mk (M.X β N.X) ((Ξ»_ (π_ C)).inv β« (M.one β N.one)) (tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul))
Xβ Yβ Xβ Yβ : Mon_ C
f : Xβ βΆ Yβ
g : Xβ βΆ Yβ
β’ (tensor_ΞΌ C (Xβ.X, Xβ.X) (Xβ.X, Xβ.X) β« (Xβ.mul β Xβ.mul)) β« (f.hom β g.hom) =
(tensor_ΞΌ C (Xβ.X, Xβ.X) (Xβ.X, Xβ.X) β« ((f.hom β f.hom) β g.hom β g.hom)) β« (Yβ.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
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
#align Mon_.one_right_unitor Mon_.one_rightUnitor
variable [BraidedCategory C]
theorem Mon_tensor_one_mul (M N : Mon_ C) :
((Ξ»_ (π_ C)).inv β« (M.one β N.one) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ»_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, one_mul M, one_mul N]
symm
exact tensor_left_unitality C M.X N.X
#align Mon_.Mon_tensor_one_mul Mon_.Mon_tensor_one_mul
theorem Mon_tensor_mul_one (M N : Mon_ C) :
(π (M.X β N.X) β (Ξ»_ (π_ C)).inv β« (M.one β N.one)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ο_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_one M, mul_one N]
symm
exact tensor_right_unitality C M.X N.X
#align Mon_.Mon_tensor_mul_one Mon_.Mon_tensor_mul_one
theorem Mon_tensor_mul_assoc (M N : Mon_ C) :
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ±_ (M.X β N.X) (M.X β N.X) (M.X β N.X)).hom β«
(π (M.X β N.X) β tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_assoc M, mul_assoc N, tensor_comp, tensor_comp]
-- Porting note: needed to add `dsimp` here.
slice_lhs 1 3 => dsimp; rw [tensor_associativity]
slice_lhs 3 4 => rw [β tensor_ΞΌ_natural]
slice_lhs 2 3 => rw [β tensor_comp, tensor_id]
simp only [Category.assoc]
#align Mon_.Mon_tensor_mul_assoc Mon_.Mon_tensor_mul_assoc
theorem mul_associator {M N P : Mon_ C} :
(tensor_ΞΌ C (M.X β N.X, P.X) (M.X β N.X, P.X) β«
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β P.mul)) β«
(Ξ±_ M.X N.X P.X).hom =
((Ξ±_ M.X N.X P.X).hom β (Ξ±_ M.X N.X P.X).hom) β«
tensor_ΞΌ C (M.X, N.X β P.X) (M.X, N.X β P.X) β«
(M.mul β tensor_ΞΌ C (N.X, P.X) (N.X, P.X) β« (N.mul β P.mul)) := by
simp only [tensor_obj, prodMonoidal_tensorObj, Category.assoc]
slice_lhs 2 3 => rw [β Category.id_comp P.mul, tensor_comp]
slice_lhs 3 4 => rw [associator_naturality]
slice_rhs 3 4 => rw [β Category.id_comp M.mul, tensor_comp]
slice_lhs 1 3 => rw [associator_monoidal]
simp only [Category.assoc]
#align Mon_.mul_associator Mon_.mul_associator
theorem mul_leftUnitor {M : Mon_ C} :
(tensor_ΞΌ C (π_ C, M.X) (π_ C, M.X) β« ((Ξ»_ (π_ C)).hom β M.mul)) β« (Ξ»_ M.X).hom =
((Ξ»_ M.X).hom β (Ξ»_ M.X).hom) β« M.mul := by
rw [β Category.comp_id (Ξ»_ (π_ C)).hom, β Category.id_comp M.mul, tensor_comp]
slice_lhs 3 4 => rw [leftUnitor_naturality]
slice_lhs 1 3 => rw [β leftUnitor_monoidal]
simp only [Category.assoc, Category.id_comp]
#align Mon_.mul_left_unitor Mon_.mul_leftUnitor
theorem mul_rightUnitor {M : Mon_ C} :
(tensor_ΞΌ C (M.X, π_ C) (M.X, π_ C) β« (M.mul β (Ξ»_ (π_ C)).hom)) β« (Ο_ M.X).hom =
((Ο_ M.X).hom β (Ο_ M.X).hom) β« M.mul := by
rw [β Category.id_comp M.mul, β Category.comp_id (Ξ»_ (π_ C)).hom, tensor_comp]
slice_lhs 3 4 => rw [rightUnitor_naturality]
slice_lhs 1 3 => rw [β rightUnitor_monoidal]
simp only [Category.assoc, Category.id_comp]
#align Mon_.mul_right_unitor Mon_.mul_rightUnitor
instance monMonoidalStruct : MonoidalCategoryStruct (Mon_ C) :=
let tensorObj (M N : Mon_ C) : Mon_ C :=
{ X := M.X β N.X
one := (Ξ»_ (π_ C)).inv β« (M.one β N.one)
mul := tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)
one_mul := Mon_tensor_one_mul M N
mul_one := Mon_tensor_mul_one M N
mul_assoc := Mon_tensor_mul_assoc M N }
let tensorHom {Xβ Yβ Xβ Yβ : Mon_ C} (f : Xβ βΆ Yβ) (g : Xβ βΆ Yβ) :
tensorObj _ _ βΆ tensorObj _ _ :=
{ hom := f.hom β g.hom
one_hom := by
dsimp
slice_lhs 2 3 => rw [β tensor_comp, Hom.one_hom f, Hom.one_hom g]
mul_hom := by
dsimp
slice_rhs 1 2 => rw [tensor_ΞΌ_natural]
|
slice_lhs 2 3 => rw [β tensor_comp, Hom.mul_hom f, Hom.mul_hom g, tensor_comp]
|
instance monMonoidalStruct : MonoidalCategoryStruct (Mon_ C) :=
let tensorObj (M N : Mon_ C) : Mon_ C :=
{ X := M.X β N.X
one := (Ξ»_ (π_ C)).inv β« (M.one β N.one)
mul := tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)
one_mul := Mon_tensor_one_mul M N
mul_one := Mon_tensor_mul_one M N
mul_assoc := Mon_tensor_mul_assoc M N }
let tensorHom {Xβ Yβ Xβ Yβ : Mon_ C} (f : Xβ βΆ Yβ) (g : Xβ βΆ Yβ) :
tensorObj _ _ βΆ tensorObj _ _ :=
{ hom := f.hom β g.hom
one_hom := by
dsimp
slice_lhs 2 3 => rw [β tensor_comp, Hom.one_hom f, Hom.one_hom g]
mul_hom := by
dsimp
slice_rhs 1 2 => rw [tensor_ΞΌ_natural]
|
Mathlib.CategoryTheory.Monoidal.Mon_.478_0.NTUMzhXPwXsmsYt
|
instance monMonoidalStruct : MonoidalCategoryStruct (Mon_ C)
|
Mathlib_CategoryTheory_Monoidal_Mon_
|
case a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
tensorObj : Mon_ C β Mon_ C β Mon_ C :=
fun M N => mk (M.X β N.X) ((Ξ»_ (π_ C)).inv β« (M.one β N.one)) (tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul))
Xβ Yβ Xβ Yβ : Mon_ C
f : Xβ βΆ Yβ
g : Xβ βΆ Yβ
| (Xβ.mul β Xβ.mul) β« (f.hom β g.hom)
case a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
tensorObj : Mon_ C β Mon_ C β Mon_ C :=
fun M N => mk (M.X β N.X) ((Ξ»_ (π_ C)).inv β« (M.one β N.one)) (tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul))
Xβ Yβ Xβ Yβ : Mon_ C
f : Xβ βΆ Yβ
g : Xβ βΆ Yβ
| tensor_ΞΌ C (Xβ.X, Xβ.X) (Xβ.X, Xβ.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))) (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
#align Mon_.one_right_unitor Mon_.one_rightUnitor
variable [BraidedCategory C]
theorem Mon_tensor_one_mul (M N : Mon_ C) :
((Ξ»_ (π_ C)).inv β« (M.one β N.one) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ»_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, one_mul M, one_mul N]
symm
exact tensor_left_unitality C M.X N.X
#align Mon_.Mon_tensor_one_mul Mon_.Mon_tensor_one_mul
theorem Mon_tensor_mul_one (M N : Mon_ C) :
(π (M.X β N.X) β (Ξ»_ (π_ C)).inv β« (M.one β N.one)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ο_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_one M, mul_one N]
symm
exact tensor_right_unitality C M.X N.X
#align Mon_.Mon_tensor_mul_one Mon_.Mon_tensor_mul_one
theorem Mon_tensor_mul_assoc (M N : Mon_ C) :
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ±_ (M.X β N.X) (M.X β N.X) (M.X β N.X)).hom β«
(π (M.X β N.X) β tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_assoc M, mul_assoc N, tensor_comp, tensor_comp]
-- Porting note: needed to add `dsimp` here.
slice_lhs 1 3 => dsimp; rw [tensor_associativity]
slice_lhs 3 4 => rw [β tensor_ΞΌ_natural]
slice_lhs 2 3 => rw [β tensor_comp, tensor_id]
simp only [Category.assoc]
#align Mon_.Mon_tensor_mul_assoc Mon_.Mon_tensor_mul_assoc
theorem mul_associator {M N P : Mon_ C} :
(tensor_ΞΌ C (M.X β N.X, P.X) (M.X β N.X, P.X) β«
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β P.mul)) β«
(Ξ±_ M.X N.X P.X).hom =
((Ξ±_ M.X N.X P.X).hom β (Ξ±_ M.X N.X P.X).hom) β«
tensor_ΞΌ C (M.X, N.X β P.X) (M.X, N.X β P.X) β«
(M.mul β tensor_ΞΌ C (N.X, P.X) (N.X, P.X) β« (N.mul β P.mul)) := by
simp only [tensor_obj, prodMonoidal_tensorObj, Category.assoc]
slice_lhs 2 3 => rw [β Category.id_comp P.mul, tensor_comp]
slice_lhs 3 4 => rw [associator_naturality]
slice_rhs 3 4 => rw [β Category.id_comp M.mul, tensor_comp]
slice_lhs 1 3 => rw [associator_monoidal]
simp only [Category.assoc]
#align Mon_.mul_associator Mon_.mul_associator
theorem mul_leftUnitor {M : Mon_ C} :
(tensor_ΞΌ C (π_ C, M.X) (π_ C, M.X) β« ((Ξ»_ (π_ C)).hom β M.mul)) β« (Ξ»_ M.X).hom =
((Ξ»_ M.X).hom β (Ξ»_ M.X).hom) β« M.mul := by
rw [β Category.comp_id (Ξ»_ (π_ C)).hom, β Category.id_comp M.mul, tensor_comp]
slice_lhs 3 4 => rw [leftUnitor_naturality]
slice_lhs 1 3 => rw [β leftUnitor_monoidal]
simp only [Category.assoc, Category.id_comp]
#align Mon_.mul_left_unitor Mon_.mul_leftUnitor
theorem mul_rightUnitor {M : Mon_ C} :
(tensor_ΞΌ C (M.X, π_ C) (M.X, π_ C) β« (M.mul β (Ξ»_ (π_ C)).hom)) β« (Ο_ M.X).hom =
((Ο_ M.X).hom β (Ο_ M.X).hom) β« M.mul := by
rw [β Category.id_comp M.mul, β Category.comp_id (Ξ»_ (π_ C)).hom, tensor_comp]
slice_lhs 3 4 => rw [rightUnitor_naturality]
slice_lhs 1 3 => rw [β rightUnitor_monoidal]
simp only [Category.assoc, Category.id_comp]
#align Mon_.mul_right_unitor Mon_.mul_rightUnitor
instance monMonoidalStruct : MonoidalCategoryStruct (Mon_ C) :=
let tensorObj (M N : Mon_ C) : Mon_ C :=
{ X := M.X β N.X
one := (Ξ»_ (π_ C)).inv β« (M.one β N.one)
mul := tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)
one_mul := Mon_tensor_one_mul M N
mul_one := Mon_tensor_mul_one M N
mul_assoc := Mon_tensor_mul_assoc M N }
let tensorHom {Xβ Yβ Xβ Yβ : Mon_ C} (f : Xβ βΆ Yβ) (g : Xβ βΆ Yβ) :
tensorObj _ _ βΆ tensorObj _ _ :=
{ hom := f.hom β g.hom
one_hom := by
dsimp
slice_lhs 2 3 => rw [β tensor_comp, Hom.one_hom f, Hom.one_hom g]
mul_hom := by
dsimp
slice_rhs 1 2 => rw [tensor_ΞΌ_natural]
slice_lhs 2 3 =>
|
rw [β tensor_comp, Hom.mul_hom f, Hom.mul_hom g, tensor_comp]
|
instance monMonoidalStruct : MonoidalCategoryStruct (Mon_ C) :=
let tensorObj (M N : Mon_ C) : Mon_ C :=
{ X := M.X β N.X
one := (Ξ»_ (π_ C)).inv β« (M.one β N.one)
mul := tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)
one_mul := Mon_tensor_one_mul M N
mul_one := Mon_tensor_mul_one M N
mul_assoc := Mon_tensor_mul_assoc M N }
let tensorHom {Xβ Yβ Xβ Yβ : Mon_ C} (f : Xβ βΆ Yβ) (g : Xβ βΆ Yβ) :
tensorObj _ _ βΆ tensorObj _ _ :=
{ hom := f.hom β g.hom
one_hom := by
dsimp
slice_lhs 2 3 => rw [β tensor_comp, Hom.one_hom f, Hom.one_hom g]
mul_hom := by
dsimp
slice_rhs 1 2 => rw [tensor_ΞΌ_natural]
slice_lhs 2 3 =>
|
Mathlib.CategoryTheory.Monoidal.Mon_.478_0.NTUMzhXPwXsmsYt
|
instance monMonoidalStruct : MonoidalCategoryStruct (Mon_ C)
|
Mathlib_CategoryTheory_Monoidal_Mon_
|
case a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
tensorObj : Mon_ C β Mon_ C β Mon_ C :=
fun M N => mk (M.X β N.X) ((Ξ»_ (π_ C)).inv β« (M.one β N.one)) (tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul))
Xβ Yβ Xβ Yβ : Mon_ C
f : Xβ βΆ Yβ
g : Xβ βΆ Yβ
| (Xβ.mul β Xβ.mul) β« (f.hom β g.hom)
case a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
tensorObj : Mon_ C β Mon_ C β Mon_ C :=
fun M N => mk (M.X β N.X) ((Ξ»_ (π_ C)).inv β« (M.one β N.one)) (tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul))
Xβ Yβ Xβ Yβ : Mon_ C
f : Xβ βΆ Yβ
g : Xβ βΆ Yβ
| tensor_ΞΌ C (Xβ.X, Xβ.X) (Xβ.X, Xβ.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))) (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
#align Mon_.one_right_unitor Mon_.one_rightUnitor
variable [BraidedCategory C]
theorem Mon_tensor_one_mul (M N : Mon_ C) :
((Ξ»_ (π_ C)).inv β« (M.one β N.one) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ»_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, one_mul M, one_mul N]
symm
exact tensor_left_unitality C M.X N.X
#align Mon_.Mon_tensor_one_mul Mon_.Mon_tensor_one_mul
theorem Mon_tensor_mul_one (M N : Mon_ C) :
(π (M.X β N.X) β (Ξ»_ (π_ C)).inv β« (M.one β N.one)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ο_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_one M, mul_one N]
symm
exact tensor_right_unitality C M.X N.X
#align Mon_.Mon_tensor_mul_one Mon_.Mon_tensor_mul_one
theorem Mon_tensor_mul_assoc (M N : Mon_ C) :
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ±_ (M.X β N.X) (M.X β N.X) (M.X β N.X)).hom β«
(π (M.X β N.X) β tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_assoc M, mul_assoc N, tensor_comp, tensor_comp]
-- Porting note: needed to add `dsimp` here.
slice_lhs 1 3 => dsimp; rw [tensor_associativity]
slice_lhs 3 4 => rw [β tensor_ΞΌ_natural]
slice_lhs 2 3 => rw [β tensor_comp, tensor_id]
simp only [Category.assoc]
#align Mon_.Mon_tensor_mul_assoc Mon_.Mon_tensor_mul_assoc
theorem mul_associator {M N P : Mon_ C} :
(tensor_ΞΌ C (M.X β N.X, P.X) (M.X β N.X, P.X) β«
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β P.mul)) β«
(Ξ±_ M.X N.X P.X).hom =
((Ξ±_ M.X N.X P.X).hom β (Ξ±_ M.X N.X P.X).hom) β«
tensor_ΞΌ C (M.X, N.X β P.X) (M.X, N.X β P.X) β«
(M.mul β tensor_ΞΌ C (N.X, P.X) (N.X, P.X) β« (N.mul β P.mul)) := by
simp only [tensor_obj, prodMonoidal_tensorObj, Category.assoc]
slice_lhs 2 3 => rw [β Category.id_comp P.mul, tensor_comp]
slice_lhs 3 4 => rw [associator_naturality]
slice_rhs 3 4 => rw [β Category.id_comp M.mul, tensor_comp]
slice_lhs 1 3 => rw [associator_monoidal]
simp only [Category.assoc]
#align Mon_.mul_associator Mon_.mul_associator
theorem mul_leftUnitor {M : Mon_ C} :
(tensor_ΞΌ C (π_ C, M.X) (π_ C, M.X) β« ((Ξ»_ (π_ C)).hom β M.mul)) β« (Ξ»_ M.X).hom =
((Ξ»_ M.X).hom β (Ξ»_ M.X).hom) β« M.mul := by
rw [β Category.comp_id (Ξ»_ (π_ C)).hom, β Category.id_comp M.mul, tensor_comp]
slice_lhs 3 4 => rw [leftUnitor_naturality]
slice_lhs 1 3 => rw [β leftUnitor_monoidal]
simp only [Category.assoc, Category.id_comp]
#align Mon_.mul_left_unitor Mon_.mul_leftUnitor
theorem mul_rightUnitor {M : Mon_ C} :
(tensor_ΞΌ C (M.X, π_ C) (M.X, π_ C) β« (M.mul β (Ξ»_ (π_ C)).hom)) β« (Ο_ M.X).hom =
((Ο_ M.X).hom β (Ο_ M.X).hom) β« M.mul := by
rw [β Category.id_comp M.mul, β Category.comp_id (Ξ»_ (π_ C)).hom, tensor_comp]
slice_lhs 3 4 => rw [rightUnitor_naturality]
slice_lhs 1 3 => rw [β rightUnitor_monoidal]
simp only [Category.assoc, Category.id_comp]
#align Mon_.mul_right_unitor Mon_.mul_rightUnitor
instance monMonoidalStruct : MonoidalCategoryStruct (Mon_ C) :=
let tensorObj (M N : Mon_ C) : Mon_ C :=
{ X := M.X β N.X
one := (Ξ»_ (π_ C)).inv β« (M.one β N.one)
mul := tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)
one_mul := Mon_tensor_one_mul M N
mul_one := Mon_tensor_mul_one M N
mul_assoc := Mon_tensor_mul_assoc M N }
let tensorHom {Xβ Yβ Xβ Yβ : Mon_ C} (f : Xβ βΆ Yβ) (g : Xβ βΆ Yβ) :
tensorObj _ _ βΆ tensorObj _ _ :=
{ hom := f.hom β g.hom
one_hom := by
dsimp
slice_lhs 2 3 => rw [β tensor_comp, Hom.one_hom f, Hom.one_hom g]
mul_hom := by
dsimp
slice_rhs 1 2 => rw [tensor_ΞΌ_natural]
slice_lhs 2 3 =>
|
rw [β tensor_comp, Hom.mul_hom f, Hom.mul_hom g, tensor_comp]
|
instance monMonoidalStruct : MonoidalCategoryStruct (Mon_ C) :=
let tensorObj (M N : Mon_ C) : Mon_ C :=
{ X := M.X β N.X
one := (Ξ»_ (π_ C)).inv β« (M.one β N.one)
mul := tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)
one_mul := Mon_tensor_one_mul M N
mul_one := Mon_tensor_mul_one M N
mul_assoc := Mon_tensor_mul_assoc M N }
let tensorHom {Xβ Yβ Xβ Yβ : Mon_ C} (f : Xβ βΆ Yβ) (g : Xβ βΆ Yβ) :
tensorObj _ _ βΆ tensorObj _ _ :=
{ hom := f.hom β g.hom
one_hom := by
dsimp
slice_lhs 2 3 => rw [β tensor_comp, Hom.one_hom f, Hom.one_hom g]
mul_hom := by
dsimp
slice_rhs 1 2 => rw [tensor_ΞΌ_natural]
slice_lhs 2 3 =>
|
Mathlib.CategoryTheory.Monoidal.Mon_.478_0.NTUMzhXPwXsmsYt
|
instance monMonoidalStruct : MonoidalCategoryStruct (Mon_ C)
|
Mathlib_CategoryTheory_Monoidal_Mon_
|
case a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
tensorObj : Mon_ C β Mon_ C β Mon_ C :=
fun M N => mk (M.X β N.X) ((Ξ»_ (π_ C)).inv β« (M.one β N.one)) (tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul))
Xβ Yβ Xβ Yβ : Mon_ C
f : Xβ βΆ Yβ
g : Xβ βΆ Yβ
| (Xβ.mul β Xβ.mul) β« (f.hom β g.hom)
case a
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
tensorObj : Mon_ C β Mon_ C β Mon_ C :=
fun M N => mk (M.X β N.X) ((Ξ»_ (π_ C)).inv β« (M.one β N.one)) (tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul))
Xβ Yβ Xβ Yβ : Mon_ C
f : Xβ βΆ Yβ
g : Xβ βΆ Yβ
| tensor_ΞΌ C (Xβ.X, Xβ.X) (Xβ.X, Xβ.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))) (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
#align Mon_.one_right_unitor Mon_.one_rightUnitor
variable [BraidedCategory C]
theorem Mon_tensor_one_mul (M N : Mon_ C) :
((Ξ»_ (π_ C)).inv β« (M.one β N.one) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ»_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, one_mul M, one_mul N]
symm
exact tensor_left_unitality C M.X N.X
#align Mon_.Mon_tensor_one_mul Mon_.Mon_tensor_one_mul
theorem Mon_tensor_mul_one (M N : Mon_ C) :
(π (M.X β N.X) β (Ξ»_ (π_ C)).inv β« (M.one β N.one)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ο_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_one M, mul_one N]
symm
exact tensor_right_unitality C M.X N.X
#align Mon_.Mon_tensor_mul_one Mon_.Mon_tensor_mul_one
theorem Mon_tensor_mul_assoc (M N : Mon_ C) :
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ±_ (M.X β N.X) (M.X β N.X) (M.X β N.X)).hom β«
(π (M.X β N.X) β tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_assoc M, mul_assoc N, tensor_comp, tensor_comp]
-- Porting note: needed to add `dsimp` here.
slice_lhs 1 3 => dsimp; rw [tensor_associativity]
slice_lhs 3 4 => rw [β tensor_ΞΌ_natural]
slice_lhs 2 3 => rw [β tensor_comp, tensor_id]
simp only [Category.assoc]
#align Mon_.Mon_tensor_mul_assoc Mon_.Mon_tensor_mul_assoc
theorem mul_associator {M N P : Mon_ C} :
(tensor_ΞΌ C (M.X β N.X, P.X) (M.X β N.X, P.X) β«
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β P.mul)) β«
(Ξ±_ M.X N.X P.X).hom =
((Ξ±_ M.X N.X P.X).hom β (Ξ±_ M.X N.X P.X).hom) β«
tensor_ΞΌ C (M.X, N.X β P.X) (M.X, N.X β P.X) β«
(M.mul β tensor_ΞΌ C (N.X, P.X) (N.X, P.X) β« (N.mul β P.mul)) := by
simp only [tensor_obj, prodMonoidal_tensorObj, Category.assoc]
slice_lhs 2 3 => rw [β Category.id_comp P.mul, tensor_comp]
slice_lhs 3 4 => rw [associator_naturality]
slice_rhs 3 4 => rw [β Category.id_comp M.mul, tensor_comp]
slice_lhs 1 3 => rw [associator_monoidal]
simp only [Category.assoc]
#align Mon_.mul_associator Mon_.mul_associator
theorem mul_leftUnitor {M : Mon_ C} :
(tensor_ΞΌ C (π_ C, M.X) (π_ C, M.X) β« ((Ξ»_ (π_ C)).hom β M.mul)) β« (Ξ»_ M.X).hom =
((Ξ»_ M.X).hom β (Ξ»_ M.X).hom) β« M.mul := by
rw [β Category.comp_id (Ξ»_ (π_ C)).hom, β Category.id_comp M.mul, tensor_comp]
slice_lhs 3 4 => rw [leftUnitor_naturality]
slice_lhs 1 3 => rw [β leftUnitor_monoidal]
simp only [Category.assoc, Category.id_comp]
#align Mon_.mul_left_unitor Mon_.mul_leftUnitor
theorem mul_rightUnitor {M : Mon_ C} :
(tensor_ΞΌ C (M.X, π_ C) (M.X, π_ C) β« (M.mul β (Ξ»_ (π_ C)).hom)) β« (Ο_ M.X).hom =
((Ο_ M.X).hom β (Ο_ M.X).hom) β« M.mul := by
rw [β Category.id_comp M.mul, β Category.comp_id (Ξ»_ (π_ C)).hom, tensor_comp]
slice_lhs 3 4 => rw [rightUnitor_naturality]
slice_lhs 1 3 => rw [β rightUnitor_monoidal]
simp only [Category.assoc, Category.id_comp]
#align Mon_.mul_right_unitor Mon_.mul_rightUnitor
instance monMonoidalStruct : MonoidalCategoryStruct (Mon_ C) :=
let tensorObj (M N : Mon_ C) : Mon_ C :=
{ X := M.X β N.X
one := (Ξ»_ (π_ C)).inv β« (M.one β N.one)
mul := tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)
one_mul := Mon_tensor_one_mul M N
mul_one := Mon_tensor_mul_one M N
mul_assoc := Mon_tensor_mul_assoc M N }
let tensorHom {Xβ Yβ Xβ Yβ : Mon_ C} (f : Xβ βΆ Yβ) (g : Xβ βΆ Yβ) :
tensorObj _ _ βΆ tensorObj _ _ :=
{ hom := f.hom β g.hom
one_hom := by
dsimp
slice_lhs 2 3 => rw [β tensor_comp, Hom.one_hom f, Hom.one_hom g]
mul_hom := by
dsimp
slice_rhs 1 2 => rw [tensor_ΞΌ_natural]
slice_lhs 2 3 =>
|
rw [β tensor_comp, Hom.mul_hom f, Hom.mul_hom g, tensor_comp]
|
instance monMonoidalStruct : MonoidalCategoryStruct (Mon_ C) :=
let tensorObj (M N : Mon_ C) : Mon_ C :=
{ X := M.X β N.X
one := (Ξ»_ (π_ C)).inv β« (M.one β N.one)
mul := tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)
one_mul := Mon_tensor_one_mul M N
mul_one := Mon_tensor_mul_one M N
mul_assoc := Mon_tensor_mul_assoc M N }
let tensorHom {Xβ Yβ Xβ Yβ : Mon_ C} (f : Xβ βΆ Yβ) (g : Xβ βΆ Yβ) :
tensorObj _ _ βΆ tensorObj _ _ :=
{ hom := f.hom β g.hom
one_hom := by
dsimp
slice_lhs 2 3 => rw [β tensor_comp, Hom.one_hom f, Hom.one_hom g]
mul_hom := by
dsimp
slice_rhs 1 2 => rw [tensor_ΞΌ_natural]
slice_lhs 2 3 =>
|
Mathlib.CategoryTheory.Monoidal.Mon_.478_0.NTUMzhXPwXsmsYt
|
instance monMonoidalStruct : MonoidalCategoryStruct (Mon_ C)
|
Mathlib_CategoryTheory_Monoidal_Mon_
|
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
tensorObj : Mon_ C β Mon_ C β Mon_ C :=
fun M N => mk (M.X β N.X) ((Ξ»_ (π_ C)).inv β« (M.one β N.one)) (tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul))
Xβ Yβ Xβ Yβ : Mon_ C
f : Xβ βΆ Yβ
g : Xβ βΆ Yβ
β’ tensor_ΞΌ C (Xβ.X, Xβ.X) (Xβ.X, Xβ.X) β« ((f.hom β f.hom) β g.hom β g.hom) β« (Yβ.mul β Yβ.mul) =
(tensor_ΞΌ C (Xβ.X, Xβ.X) (Xβ.X, Xβ.X) β« ((f.hom β f.hom) β g.hom β g.hom)) β« (Yβ.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
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
#align Mon_.one_right_unitor Mon_.one_rightUnitor
variable [BraidedCategory C]
theorem Mon_tensor_one_mul (M N : Mon_ C) :
((Ξ»_ (π_ C)).inv β« (M.one β N.one) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ»_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, one_mul M, one_mul N]
symm
exact tensor_left_unitality C M.X N.X
#align Mon_.Mon_tensor_one_mul Mon_.Mon_tensor_one_mul
theorem Mon_tensor_mul_one (M N : Mon_ C) :
(π (M.X β N.X) β (Ξ»_ (π_ C)).inv β« (M.one β N.one)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ο_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_one M, mul_one N]
symm
exact tensor_right_unitality C M.X N.X
#align Mon_.Mon_tensor_mul_one Mon_.Mon_tensor_mul_one
theorem Mon_tensor_mul_assoc (M N : Mon_ C) :
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ±_ (M.X β N.X) (M.X β N.X) (M.X β N.X)).hom β«
(π (M.X β N.X) β tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_assoc M, mul_assoc N, tensor_comp, tensor_comp]
-- Porting note: needed to add `dsimp` here.
slice_lhs 1 3 => dsimp; rw [tensor_associativity]
slice_lhs 3 4 => rw [β tensor_ΞΌ_natural]
slice_lhs 2 3 => rw [β tensor_comp, tensor_id]
simp only [Category.assoc]
#align Mon_.Mon_tensor_mul_assoc Mon_.Mon_tensor_mul_assoc
theorem mul_associator {M N P : Mon_ C} :
(tensor_ΞΌ C (M.X β N.X, P.X) (M.X β N.X, P.X) β«
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β P.mul)) β«
(Ξ±_ M.X N.X P.X).hom =
((Ξ±_ M.X N.X P.X).hom β (Ξ±_ M.X N.X P.X).hom) β«
tensor_ΞΌ C (M.X, N.X β P.X) (M.X, N.X β P.X) β«
(M.mul β tensor_ΞΌ C (N.X, P.X) (N.X, P.X) β« (N.mul β P.mul)) := by
simp only [tensor_obj, prodMonoidal_tensorObj, Category.assoc]
slice_lhs 2 3 => rw [β Category.id_comp P.mul, tensor_comp]
slice_lhs 3 4 => rw [associator_naturality]
slice_rhs 3 4 => rw [β Category.id_comp M.mul, tensor_comp]
slice_lhs 1 3 => rw [associator_monoidal]
simp only [Category.assoc]
#align Mon_.mul_associator Mon_.mul_associator
theorem mul_leftUnitor {M : Mon_ C} :
(tensor_ΞΌ C (π_ C, M.X) (π_ C, M.X) β« ((Ξ»_ (π_ C)).hom β M.mul)) β« (Ξ»_ M.X).hom =
((Ξ»_ M.X).hom β (Ξ»_ M.X).hom) β« M.mul := by
rw [β Category.comp_id (Ξ»_ (π_ C)).hom, β Category.id_comp M.mul, tensor_comp]
slice_lhs 3 4 => rw [leftUnitor_naturality]
slice_lhs 1 3 => rw [β leftUnitor_monoidal]
simp only [Category.assoc, Category.id_comp]
#align Mon_.mul_left_unitor Mon_.mul_leftUnitor
theorem mul_rightUnitor {M : Mon_ C} :
(tensor_ΞΌ C (M.X, π_ C) (M.X, π_ C) β« (M.mul β (Ξ»_ (π_ C)).hom)) β« (Ο_ M.X).hom =
((Ο_ M.X).hom β (Ο_ M.X).hom) β« M.mul := by
rw [β Category.id_comp M.mul, β Category.comp_id (Ξ»_ (π_ C)).hom, tensor_comp]
slice_lhs 3 4 => rw [rightUnitor_naturality]
slice_lhs 1 3 => rw [β rightUnitor_monoidal]
simp only [Category.assoc, Category.id_comp]
#align Mon_.mul_right_unitor Mon_.mul_rightUnitor
instance monMonoidalStruct : MonoidalCategoryStruct (Mon_ C) :=
let tensorObj (M N : Mon_ C) : Mon_ C :=
{ X := M.X β N.X
one := (Ξ»_ (π_ C)).inv β« (M.one β N.one)
mul := tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)
one_mul := Mon_tensor_one_mul M N
mul_one := Mon_tensor_mul_one M N
mul_assoc := Mon_tensor_mul_assoc M N }
let tensorHom {Xβ Yβ Xβ Yβ : Mon_ C} (f : Xβ βΆ Yβ) (g : Xβ βΆ Yβ) :
tensorObj _ _ βΆ tensorObj _ _ :=
{ hom := f.hom β g.hom
one_hom := by
dsimp
slice_lhs 2 3 => rw [β tensor_comp, Hom.one_hom f, Hom.one_hom g]
mul_hom := by
dsimp
slice_rhs 1 2 => rw [tensor_ΞΌ_natural]
slice_lhs 2 3 => rw [β tensor_comp, Hom.mul_hom f, Hom.mul_hom g, tensor_comp]
|
simp only [Category.assoc]
|
instance monMonoidalStruct : MonoidalCategoryStruct (Mon_ C) :=
let tensorObj (M N : Mon_ C) : Mon_ C :=
{ X := M.X β N.X
one := (Ξ»_ (π_ C)).inv β« (M.one β N.one)
mul := tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)
one_mul := Mon_tensor_one_mul M N
mul_one := Mon_tensor_mul_one M N
mul_assoc := Mon_tensor_mul_assoc M N }
let tensorHom {Xβ Yβ Xβ Yβ : Mon_ C} (f : Xβ βΆ Yβ) (g : Xβ βΆ Yβ) :
tensorObj _ _ βΆ tensorObj _ _ :=
{ hom := f.hom β g.hom
one_hom := by
dsimp
slice_lhs 2 3 => rw [β tensor_comp, Hom.one_hom f, Hom.one_hom g]
mul_hom := by
dsimp
slice_rhs 1 2 => rw [tensor_ΞΌ_natural]
slice_lhs 2 3 => rw [β tensor_comp, Hom.mul_hom f, Hom.mul_hom g, tensor_comp]
|
Mathlib.CategoryTheory.Monoidal.Mon_.478_0.NTUMzhXPwXsmsYt
|
instance monMonoidalStruct : MonoidalCategoryStruct (Mon_ C)
|
Mathlib_CategoryTheory_Monoidal_Mon_
|
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
β’ β (Xβ Xβ : Mon_ C), π Xβ β π Xβ = π (Xβ β 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))) (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
#align Mon_.one_right_unitor Mon_.one_rightUnitor
variable [BraidedCategory C]
theorem Mon_tensor_one_mul (M N : Mon_ C) :
((Ξ»_ (π_ C)).inv β« (M.one β N.one) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ»_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, one_mul M, one_mul N]
symm
exact tensor_left_unitality C M.X N.X
#align Mon_.Mon_tensor_one_mul Mon_.Mon_tensor_one_mul
theorem Mon_tensor_mul_one (M N : Mon_ C) :
(π (M.X β N.X) β (Ξ»_ (π_ C)).inv β« (M.one β N.one)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ο_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_one M, mul_one N]
symm
exact tensor_right_unitality C M.X N.X
#align Mon_.Mon_tensor_mul_one Mon_.Mon_tensor_mul_one
theorem Mon_tensor_mul_assoc (M N : Mon_ C) :
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ±_ (M.X β N.X) (M.X β N.X) (M.X β N.X)).hom β«
(π (M.X β N.X) β tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_assoc M, mul_assoc N, tensor_comp, tensor_comp]
-- Porting note: needed to add `dsimp` here.
slice_lhs 1 3 => dsimp; rw [tensor_associativity]
slice_lhs 3 4 => rw [β tensor_ΞΌ_natural]
slice_lhs 2 3 => rw [β tensor_comp, tensor_id]
simp only [Category.assoc]
#align Mon_.Mon_tensor_mul_assoc Mon_.Mon_tensor_mul_assoc
theorem mul_associator {M N P : Mon_ C} :
(tensor_ΞΌ C (M.X β N.X, P.X) (M.X β N.X, P.X) β«
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β P.mul)) β«
(Ξ±_ M.X N.X P.X).hom =
((Ξ±_ M.X N.X P.X).hom β (Ξ±_ M.X N.X P.X).hom) β«
tensor_ΞΌ C (M.X, N.X β P.X) (M.X, N.X β P.X) β«
(M.mul β tensor_ΞΌ C (N.X, P.X) (N.X, P.X) β« (N.mul β P.mul)) := by
simp only [tensor_obj, prodMonoidal_tensorObj, Category.assoc]
slice_lhs 2 3 => rw [β Category.id_comp P.mul, tensor_comp]
slice_lhs 3 4 => rw [associator_naturality]
slice_rhs 3 4 => rw [β Category.id_comp M.mul, tensor_comp]
slice_lhs 1 3 => rw [associator_monoidal]
simp only [Category.assoc]
#align Mon_.mul_associator Mon_.mul_associator
theorem mul_leftUnitor {M : Mon_ C} :
(tensor_ΞΌ C (π_ C, M.X) (π_ C, M.X) β« ((Ξ»_ (π_ C)).hom β M.mul)) β« (Ξ»_ M.X).hom =
((Ξ»_ M.X).hom β (Ξ»_ M.X).hom) β« M.mul := by
rw [β Category.comp_id (Ξ»_ (π_ C)).hom, β Category.id_comp M.mul, tensor_comp]
slice_lhs 3 4 => rw [leftUnitor_naturality]
slice_lhs 1 3 => rw [β leftUnitor_monoidal]
simp only [Category.assoc, Category.id_comp]
#align Mon_.mul_left_unitor Mon_.mul_leftUnitor
theorem mul_rightUnitor {M : Mon_ C} :
(tensor_ΞΌ C (M.X, π_ C) (M.X, π_ C) β« (M.mul β (Ξ»_ (π_ C)).hom)) β« (Ο_ M.X).hom =
((Ο_ M.X).hom β (Ο_ M.X).hom) β« M.mul := by
rw [β Category.id_comp M.mul, β Category.comp_id (Ξ»_ (π_ C)).hom, tensor_comp]
slice_lhs 3 4 => rw [rightUnitor_naturality]
slice_lhs 1 3 => rw [β rightUnitor_monoidal]
simp only [Category.assoc, Category.id_comp]
#align Mon_.mul_right_unitor Mon_.mul_rightUnitor
instance monMonoidalStruct : MonoidalCategoryStruct (Mon_ C) :=
let tensorObj (M N : Mon_ C) : Mon_ C :=
{ X := M.X β N.X
one := (Ξ»_ (π_ C)).inv β« (M.one β N.one)
mul := tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)
one_mul := Mon_tensor_one_mul M N
mul_one := Mon_tensor_mul_one M N
mul_assoc := Mon_tensor_mul_assoc M N }
let tensorHom {Xβ Yβ Xβ Yβ : Mon_ C} (f : Xβ βΆ Yβ) (g : Xβ βΆ Yβ) :
tensorObj _ _ βΆ tensorObj _ _ :=
{ hom := f.hom β g.hom
one_hom := by
dsimp
slice_lhs 2 3 => rw [β tensor_comp, Hom.one_hom f, Hom.one_hom g]
mul_hom := by
dsimp
slice_rhs 1 2 => rw [tensor_ΞΌ_natural]
slice_lhs 2 3 => rw [β tensor_comp, Hom.mul_hom f, Hom.mul_hom g, tensor_comp]
simp only [Category.assoc] }
{ tensorObj := tensorObj
tensorHom := tensorHom
whiskerRight := fun f Y => tensorHom f (π Y)
whiskerLeft := fun X _ _ g => tensorHom (π X) g
tensorUnit := trivial C
associator := fun M N P β¦ isoOfIso (Ξ±_ M.X N.X P.X) one_associator mul_associator
leftUnitor := fun M β¦ isoOfIso (Ξ»_ M.X) one_leftUnitor mul_leftUnitor
rightUnitor := fun M β¦ isoOfIso (Ο_ M.X) one_rightUnitor mul_rightUnitor }
instance monMonoidal : MonoidalCategory (Mon_ C) := .ofTensorHom
(tensor_id := by
|
intros
|
instance monMonoidal : MonoidalCategory (Mon_ C) := .ofTensorHom
(tensor_id := by
|
Mathlib.CategoryTheory.Monoidal.Mon_.506_0.NTUMzhXPwXsmsYt
|
instance monMonoidal : MonoidalCategory (Mon_ C)
|
Mathlib_CategoryTheory_Monoidal_Mon_
|
C : Type uβ
instβΒ² : Category.{vβ, uβ} C
instβΒΉ : MonoidalCategory C
instβ : BraidedCategory C
Xββ Xββ : Mon_ C
β’ π Xββ β π Xββ = π (Xββ β 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))) (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
#align Mon_.one_right_unitor Mon_.one_rightUnitor
variable [BraidedCategory C]
theorem Mon_tensor_one_mul (M N : Mon_ C) :
((Ξ»_ (π_ C)).inv β« (M.one β N.one) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ»_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, one_mul M, one_mul N]
symm
exact tensor_left_unitality C M.X N.X
#align Mon_.Mon_tensor_one_mul Mon_.Mon_tensor_one_mul
theorem Mon_tensor_mul_one (M N : Mon_ C) :
(π (M.X β N.X) β (Ξ»_ (π_ C)).inv β« (M.one β N.one)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ο_ (M.X β N.X)).hom := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_one M, mul_one N]
symm
exact tensor_right_unitality C M.X N.X
#align Mon_.Mon_tensor_mul_one Mon_.Mon_tensor_mul_one
theorem Mon_tensor_mul_assoc (M N : Mon_ C) :
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β π (M.X β N.X)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) =
(Ξ±_ (M.X β N.X) (M.X β N.X) (M.X β N.X)).hom β«
(π (M.X β N.X) β tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)) β«
tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) := by
rw [β Category.id_comp (π (M.X β N.X)), tensor_comp]
slice_lhs 2 3 => rw [β tensor_id, tensor_ΞΌ_natural]
slice_lhs 3 4 => rw [β tensor_comp, mul_assoc M, mul_assoc N, tensor_comp, tensor_comp]
-- Porting note: needed to add `dsimp` here.
slice_lhs 1 3 => dsimp; rw [tensor_associativity]
slice_lhs 3 4 => rw [β tensor_ΞΌ_natural]
slice_lhs 2 3 => rw [β tensor_comp, tensor_id]
simp only [Category.assoc]
#align Mon_.Mon_tensor_mul_assoc Mon_.Mon_tensor_mul_assoc
theorem mul_associator {M N P : Mon_ C} :
(tensor_ΞΌ C (M.X β N.X, P.X) (M.X β N.X, P.X) β«
(tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul) β P.mul)) β«
(Ξ±_ M.X N.X P.X).hom =
((Ξ±_ M.X N.X P.X).hom β (Ξ±_ M.X N.X P.X).hom) β«
tensor_ΞΌ C (M.X, N.X β P.X) (M.X, N.X β P.X) β«
(M.mul β tensor_ΞΌ C (N.X, P.X) (N.X, P.X) β« (N.mul β P.mul)) := by
simp only [tensor_obj, prodMonoidal_tensorObj, Category.assoc]
slice_lhs 2 3 => rw [β Category.id_comp P.mul, tensor_comp]
slice_lhs 3 4 => rw [associator_naturality]
slice_rhs 3 4 => rw [β Category.id_comp M.mul, tensor_comp]
slice_lhs 1 3 => rw [associator_monoidal]
simp only [Category.assoc]
#align Mon_.mul_associator Mon_.mul_associator
theorem mul_leftUnitor {M : Mon_ C} :
(tensor_ΞΌ C (π_ C, M.X) (π_ C, M.X) β« ((Ξ»_ (π_ C)).hom β M.mul)) β« (Ξ»_ M.X).hom =
((Ξ»_ M.X).hom β (Ξ»_ M.X).hom) β« M.mul := by
rw [β Category.comp_id (Ξ»_ (π_ C)).hom, β Category.id_comp M.mul, tensor_comp]
slice_lhs 3 4 => rw [leftUnitor_naturality]
slice_lhs 1 3 => rw [β leftUnitor_monoidal]
simp only [Category.assoc, Category.id_comp]
#align Mon_.mul_left_unitor Mon_.mul_leftUnitor
theorem mul_rightUnitor {M : Mon_ C} :
(tensor_ΞΌ C (M.X, π_ C) (M.X, π_ C) β« (M.mul β (Ξ»_ (π_ C)).hom)) β« (Ο_ M.X).hom =
((Ο_ M.X).hom β (Ο_ M.X).hom) β« M.mul := by
rw [β Category.id_comp M.mul, β Category.comp_id (Ξ»_ (π_ C)).hom, tensor_comp]
slice_lhs 3 4 => rw [rightUnitor_naturality]
slice_lhs 1 3 => rw [β rightUnitor_monoidal]
simp only [Category.assoc, Category.id_comp]
#align Mon_.mul_right_unitor Mon_.mul_rightUnitor
instance monMonoidalStruct : MonoidalCategoryStruct (Mon_ C) :=
let tensorObj (M N : Mon_ C) : Mon_ C :=
{ X := M.X β N.X
one := (Ξ»_ (π_ C)).inv β« (M.one β N.one)
mul := tensor_ΞΌ C (M.X, N.X) (M.X, N.X) β« (M.mul β N.mul)
one_mul := Mon_tensor_one_mul M N
mul_one := Mon_tensor_mul_one M N
mul_assoc := Mon_tensor_mul_assoc M N }
let tensorHom {Xβ Yβ Xβ Yβ : Mon_ C} (f : Xβ βΆ Yβ) (g : Xβ βΆ Yβ) :
tensorObj _ _ βΆ tensorObj _ _ :=
{ hom := f.hom β g.hom
one_hom := by
dsimp
slice_lhs 2 3 => rw [β tensor_comp, Hom.one_hom f, Hom.one_hom g]
mul_hom := by
dsimp
slice_rhs 1 2 => rw [tensor_ΞΌ_natural]
slice_lhs 2 3 => rw [β tensor_comp, Hom.mul_hom f, Hom.mul_hom g, tensor_comp]
simp only [Category.assoc] }
{ tensorObj := tensorObj
tensorHom := tensorHom
whiskerRight := fun f Y => tensorHom f (π Y)
whiskerLeft := fun X _ _ g => tensorHom (π X) g
tensorUnit := trivial C
associator := fun M N P β¦ isoOfIso (Ξ±_ M.X N.X P.X) one_associator mul_associator
leftUnitor := fun M β¦ isoOfIso (Ξ»_ M.X) one_leftUnitor mul_leftUnitor
rightUnitor := fun M β¦ isoOfIso (Ο_ M.X) one_rightUnitor mul_rightUnitor }
instance monMonoidal : MonoidalCategory (Mon_ C) := .ofTensorHom
(tensor_id := by intros;
|
ext
|
instance monMonoidal : MonoidalCategory (Mon_ C) := .ofTensorHom
(tensor_id := by intros;
|
Mathlib.CategoryTheory.Monoidal.Mon_.506_0.NTUMzhXPwXsmsYt
|
instance monMonoidal : MonoidalCategory (Mon_ C)
|
Mathlib_CategoryTheory_Monoidal_Mon_
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.