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_