module Cat.Monoidal.Diagram.Monoid where
module _ {o β} {C : Precategory o β} (M : Monoidal-category C) where private module C where open Cat.Reasoning C public open Monoidal-category M public
Monoids in a monoidal categoryπ
Let be a monoidal category you want to study. It can be, for instance, one of the endomorphism categories in a bicategory that you like. A monoid object in , generally just called a βmonoid in β, is really a collection of diagrams in centered around an object the monoid itself.
In addition to the object, we also require a βunitβ map and βmultiplicationβ map Moreover, these maps should be compatible with the unitors and associator of the underlying monoidal category:
record Monoid-on (M : C.Ob) : Type β where no-eta-equality field Ξ· : C.Hom C.Unit M ΞΌ : C.Hom (M C.β M) M ΞΌ-unitl : ΞΌ C.β (Ξ· C.ββ C.id) β‘ C.Ξ»β ΞΌ-unitr : ΞΌ C.β (C.id C.ββ Ξ·) β‘ C.Οβ ΞΌ-assoc : ΞΌ C.β (C.id C.ββ ΞΌ) β‘ ΞΌ C.β (ΞΌ C.ββ C.id) C.β C.Ξ±β _ _ _
If we think of as a bicategory with a single object β that is, we deloop it β, then a monoid in is given by precisely the same data as a monad in on the object
private BC = Deloop M module BC = Prebicategory BC open Monoid-on Monoid-pathp : β {P : I β C.Ob} {x : Monoid-on (P i0)} {y : Monoid-on (P i1)} β PathP (Ξ» i β C.Hom C.Unit (P i)) (x .Ξ·) (y .Ξ·) β PathP (Ξ» i β C.Hom (P i C.β P i) (P i)) (x .ΞΌ) (y .ΞΌ) β PathP (Ξ» i β Monoid-on (P i)) x y Monoid-pathp {x = x} {y} p q i .Ξ· = p i Monoid-pathp {x = x} {y} p q i .ΞΌ = q i Monoid-pathp {P = P} {x} {y} p q i .ΞΌ-unitl = is-propβpathp (Ξ» i β C.Hom-set _ (P i) (q i C.β (p i C.ββ C.id)) C.Ξ»β) (x .ΞΌ-unitl) (y .ΞΌ-unitl) i Monoid-pathp {P = P} {x} {y} p q i .ΞΌ-unitr = is-propβpathp (Ξ» i β C.Hom-set _ (P i) (q i C.β (C.id C.ββ p i)) C.Οβ) (x .ΞΌ-unitr) (y .ΞΌ-unitr) i Monoid-pathp {P = P} {x} {y} p q i .ΞΌ-assoc = is-propβpathp (Ξ» i β C.Hom-set _ (P i) (q i C.β (C.id C.ββ q i)) (q i C.β (q i C.ββ C.id) C.β C.Ξ±β _ _ _)) (x .ΞΌ-assoc) (y .ΞΌ-assoc) i
monadβmonoid : (M : Monad BC tt) β Monoid-on (M .Monad.M) monadβmonoid M = go where module M = Monad M go : Monoid-on M.M go .Ξ· = M.Ξ· go .ΞΌ = M.ΞΌ go .ΞΌ-unitl = M.ΞΌ-unitl go .ΞΌ-unitr = M.ΞΌ-unitr go .ΞΌ-assoc = M.ΞΌ-assoc monoidβmonad : β {M} β Monoid-on M β Monad BC tt monoidβmonad M = go where module M = Monoid-on M go : Monad BC tt go .Monad.M = _ go .Monad.ΞΌ = M.ΞΌ go .Monad.Ξ· = M.Ξ· go .Monad.ΞΌ-assoc = M.ΞΌ-assoc go .Monad.ΞΌ-unitr = M.ΞΌ-unitr go .Monad.ΞΌ-unitl = M.ΞΌ-unitl
Put another way, a monad is just a monoid in the category of
endofunctors endo-1-cells, whatβs the problem?
The category Mon(C)π
The monoid objects in
can be made into a category, much like the monoids in the category of sets. In fact,
we shall see later that when
is equipped with its Cartesian monoidal
structure,
Rather than defining
directly as a category, we instead define it as a category
displayed
over
which fits naturally with the way we have defined Monoid-object-on
.
module _ {o β} {C : Precategory o β} (M : Monoidal-category C) where private module C where open Cat.Reasoning C public open Monoidal-category M public
Therefore, rather than defining a type of monoid homomorphisms, we define a predicate on maps expressing the condition of being a monoid homomorphism. This is the familiar condition from algebra, but expressed in a point-free way:
record is-monoid-hom {m n} (f : C.Hom m n) (mo : Monoid-on M m) (no : Monoid-on M n) : Type β where private module m = Monoid-on mo module n = Monoid-on no field pres-Ξ· : f C.β m.Ξ· β‘ n.Ξ· pres-ΞΌ : f C.β m.ΞΌ β‘ n.ΞΌ C.β (f C.ββ f)
Since being a monoid homomorphism is a pair of propositions, the overall condition is a proposition as well. This means that we will not need to concern ourselves with proving displayed identity and associativity laws, a great simplification.
private unquoteDecl eqv = declare-record-iso eqv (quote is-monoid-hom) instance H-Level-is-monoid-hom : β {m n} {f : C .Precategory.Hom m n} {mo no} {k} β H-Level (is-monoid-hom f mo no) (suc k) H-Level-is-monoid-hom = prop-instance $ Isoβis-hlevel! 1 eqv open Displayed open Functor open is-monoid-hom
Mon[_] : Displayed C β β Mon[_] .Ob[_] = Monoid-on M Mon[_] .Hom[_] = is-monoid-hom Mon[_] .Hom[_]-set f x y = hlevel 2
The most complicated step of putting together the displayed category of monoid objects is proving that monoid homomorphisms are closed under composition. However, even in the point-free setting of an arbitrary category the reasoning isnβt that painful:
Mon[_] .id' .pres-Ξ· = C.idl _ Mon[_] .id' .pres-ΞΌ = C.idl _ β C.intror (C.-β- .F-id) Mon[_] ._β'_ fh gh .pres-Ξ· = C.pullr (gh .pres-Ξ·) β fh .pres-Ξ· Mon[_] ._β'_ {x = x} {y} {z} {f} {g} fh gh .pres-ΞΌ = (f C.β g) C.β x .Monoid-on.ΞΌ β‘β¨ C.pullr (gh .pres-ΞΌ) β©β‘ f C.β y .Monoid-on.ΞΌ C.β (g C.ββ g) β‘β¨ C.extendl (fh .pres-ΞΌ) β©β‘ Monoid-on.ΞΌ z C.β (f C.ββ f) C.β (g C.ββ g) β‘Λβ¨ C.reflβ©ββ¨ C.-β- .F-β _ _ β©β‘Λ Monoid-on.ΞΌ z C.β (f C.β g C.ββ f C.β g) β Mon[_] .idr' f = prop! Mon[_] .idl' f = prop! Mon[_] .assoc' f g h = prop!
unquoteDecl H-Level-is-monoid-hom = declare-record-hlevel 1 H-Level-is-monoid-hom (quote is-monoid-hom) private Mon : β {β} β Displayed (Sets β) _ _ Mon = Thin-structure-over (Mon.Monoid-structure _)
Constructing this displayed category for the Cartesian monoidal structure on the category of sets, we find that it is but a few renamings away from the ordinary category of monoids-on-sets. The only thing out of the ordinary about the proof below is that we can establish the displayed categories themselves are identical, so it is a trivial step to show they induce identical1 total categories.
Mon[Sets]β‘Mon : β {β} β Mon[ Setsβ ] β‘ Mon {β} Mon[Sets]β‘Mon {β} = Displayed-path F (Ξ» a β is-isoβis-equiv (fiso a)) ff where open Displayed-functor open Monoid-on open is-monoid-hom open Mon.Monoid-hom open Mon.Monoid-on
The construction proceeds in three steps: First, put together a functor (displayed over the identity) Then, prove that its action on objects (βstep 2β) and action on morphisms (βstep 3β) are independently equivalences of types. The characterisation of paths of displayed categories will take care of turning this data into an identification.
F : Displayed-functor Mon[ Setsβ ] Mon Id F .Fβ' o .identity = o .Ξ· (lift tt) F .Fβ' o ._β_ x y = o .ΞΌ (x , y) F .Fβ' o .has-is-monoid .has-is-semigroup = record { has-is-magma = record { has-is-set = hlevel 2 } ; associative = o .ΞΌ-assoc $β _ } F .Fβ' o .has-is-monoid .idl = o .ΞΌ-unitl $β _ F .Fβ' o .has-is-monoid .idr = o .ΞΌ-unitr $β _ F .Fβ' wit .pres-id = wit .pres-Ξ· $β _ F .Fβ' wit .pres-β x y = wit .pres-ΞΌ $β _ F .F-id' = prop! F .F-β' = prop! open is-iso fiso : β a β is-iso (F .Fβ' {a}) fiso T .inv m .Ξ· _ = m .identity fiso T .inv m .ΞΌ (a , b) = m ._β_ a b fiso T .inv m .ΞΌ-unitl = funext Ξ» _ β m .idl fiso T .inv m .ΞΌ-unitr = funext Ξ» _ β m .idr fiso T .inv m .ΞΌ-assoc = funext Ξ» _ β m .associative fiso T .rinv x = Mon.Monoid-structure _ .id-hom-unique (record { pres-id = refl ; pres-β = Ξ» _ _ β refl }) (record { pres-id = refl ; pres-β = Ξ» _ _ β refl }) fiso T .linv m = Monoid-pathp Setsβ refl refl ff : β {a b : Set _} {f : β£ a β£ β β£ b β£} {a' b'} β is-equiv (Fβ' F {a} {b} {f} {a'} {b'}) ff {a} {b} {f} {a'} {b'} = biimp-is-equiv! (Ξ» z β Fβ' F z) invs where invs : Mon.Monoid-hom (F .Fβ' a') (F .Fβ' b') f β is-monoid-hom Setsβ f a' b' invs m .pres-Ξ· = funext Ξ» _ β m .pres-id invs m .pres-ΞΌ = funext Ξ» _ β m .pres-β _ _
Monoidal functors preserve monoidsπ
module _ {oc βc od βd} {C : Precategory oc βc} {D : Precategory od βd} {MC : Monoidal-category C} {MD : Monoidal-category D} ((F , MF) : Lax-monoidal-functor MC MD) where private module C where open Cat.Reasoning C public open Monoidal-category MC public open Cat.Reasoning D open Monoidal-category MD open Functor F private module F = Cat.Functor.Reasoning F open Lax-monoidal-functor-on MF open Displayed-functor open Monoid-on open is-monoid-hom
If is a lax monoidal functor between monoidal categories and and is a monoid in then can be equipped with the structure of a monoid in
We can phrase this nicely as a displayed functor over
Monβ[_] : Displayed-functor Mon[ MC ] Mon[ MD ] F Monβ[_] .Fβ' m .Ξ· = Fβ (m .Ξ·) β Ξ΅ Monβ[_] .Fβ' m .ΞΌ = Fβ (m .ΞΌ) β Ο
The unit laws are witnessed by the commutativity of this diagram:
Monβ[_] .Fβ' m .ΞΌ-unitl = (Fβ (m .ΞΌ) β Ο) β ((Fβ (m .Ξ·) β Ξ΅) ββ id) β‘β¨ pullr (reflβ©ββ¨ β.expand (refl ,β F.introl refl)) β©β‘ Fβ (m .ΞΌ) β Ο β (Fβ (m .Ξ·) ββ Fβ C.id) β (Ξ΅ ββ id) β‘β¨ reflβ©ββ¨ extendl (Ο.is-natural _ _ _) β©β‘ Fβ (m .ΞΌ) β Fβ (m .Ξ· C.ββ C.id) β Ο β (Ξ΅ ββ id) β‘β¨ F.pulll (m .ΞΌ-unitl) β©β‘ Fβ C.Ξ»β β Ο β (Ξ΅ ββ id) β‘β¨ F-Ξ»β β©β‘ Ξ»β β Monβ[_] .Fβ' m .ΞΌ-unitr = (Fβ (m .ΞΌ) β Ο) β (id ββ (Fβ (m .Ξ·) β Ξ΅)) β‘β¨ pullr (reflβ©ββ¨ β.expand (F.introl refl ,β refl)) β©β‘ Fβ (m .ΞΌ) β Ο β (Fβ C.id ββ Fβ (m .Ξ·)) β (id ββ Ξ΅) β‘β¨ reflβ©ββ¨ extendl (Ο.is-natural _ _ _) β©β‘ Fβ (m .ΞΌ) β Fβ (C.id C.ββ m .Ξ·) β Ο β (id ββ Ξ΅) β‘β¨ F.pulll (m .ΞΌ-unitr) β©β‘ Fβ C.Οβ β Ο β (id ββ Ξ΅) β‘β¨ F-Οβ β©β‘ Οβ β
β¦ and the associativity by this one.
Monβ[_] .Fβ' m .ΞΌ-assoc = (Fβ (m .ΞΌ) β Ο) β (id ββ (Fβ (m .ΞΌ) β Ο)) β‘β¨ pullr (reflβ©ββ¨ β.expand (F.introl refl ,β refl)) β©β‘ Fβ (m .ΞΌ) β Ο β (Fβ C.id ββ Fβ (m .ΞΌ)) β (id ββ Ο) β‘β¨ (reflβ©ββ¨ extendl (Ο.is-natural _ _ _)) β©β‘ Fβ (m .ΞΌ) β Fβ (C.id C.ββ m .ΞΌ) β Ο β (id ββ Ο) β‘β¨ F.pulll (m .ΞΌ-assoc) β©β‘ Fβ (m .ΞΌ C.β (m .ΞΌ C.ββ C.id) C.β C.Ξ±β _ _ _) β Ο β (id ββ Ο) β‘β¨ F.popr (F.popr F-Ξ±β) β©β‘ Fβ (m .ΞΌ) β Fβ (m .ΞΌ C.ββ C.id) β Ο β (Ο ββ id) β Ξ±β _ _ _ β‘Λβ¨ pullr (extendl (Ο.is-natural _ _ _)) β©β‘Λ (Fβ (m .ΞΌ) β Ο) β (Fβ (m .ΞΌ) ββ Fβ C.id) β (Ο ββ id) β Ξ±β _ _ _ β‘β¨ reflβ©ββ¨ β.pulll (refl ,β F.eliml refl) β©β‘ (Fβ (m .ΞΌ) β Ο) β ((Fβ (m .ΞΌ) β Ο) ββ id) β Ξ±β _ _ _ β
Functoriality for means that, given a monoid homomorphism the map is a monoid homomorphism between the induced monoids on and
Monβ[_] .Fβ' h .pres-Ξ· = F.pulll (h .pres-Ξ·) Monβ[_] .Fβ' h .pres-ΞΌ = F.extendl (h .pres-ΞΌ) β pushr (sym (Ο.is-natural _ _ _)) Monβ[_] .F-id' = prop! Monβ[_] .F-β' = prop!
thus isomorphic, thus equivalentβ©οΈ