module Cat.Bi.Diagram.Monad where
open _=>_ module _ {o β β'} (B : Prebicategory o β β') where private module B = Prebicategory B
Monads in a bicategoryπ
Recall that a monad on a category consists of a functor and natural transformations While the words βfunctorβ and βnatural transformationβ are specific to the setup where is a category, if we replace those with β1-cellβ and β2-cellβ, then the definition works in any bicategory!
record Monad (a : B.Ob) : Type (β β β') where field M : a B.β¦ a ΞΌ : (M B.β M) B.β M Ξ· : B.id B.β M
The setup is, in a sense, a lot more organic when phrased in an arbitrary bicategory: Rather than dealing with the specificities of natural transformations and the category we abstract all of that away into the setup of the bicategory All we need is that the multiplication be compatible with the associator and the unit must be appropriately compatible with the left and right unitors
ΞΌ-assoc : ΞΌ B.β (M B.βΆ ΞΌ) β‘ ΞΌ B.β (ΞΌ B.β M) B.β B.Ξ±β M M M ΞΌ-unitr : ΞΌ B.β (M B.βΆ Ξ·) β‘ B.Οβ M ΞΌ-unitl : ΞΌ B.β (Ξ· B.β M) β‘ B.Ξ»β M
We can draw these compatibility conditions as pretty commutative diagrams. The commutative altar (on top) indicates associativity of multiplication, or more abstractly, compatibility of the multiplication with the associator. The commutative upside-down triangle indicates mutual compatibility of the multiplication and unit with the unitors.
In Catπ
To prove that this is an actual generalisation of the 1-categorical notion, we push some symbols around and prove that a monad in the bicategory is the same thing as a monad on some category. Things are set up so that this is almost definitional, but the compatibility paths have to be adjusted slightly. Check it out below:
module _ {o β} {C : Precategory o β} where open Cat.Monad open Monad private module C = Cr C Bicat-monadβmonad : Monad (Cat _ _) C β Cat.Monad C Bicat-monadβmonad monad = monad' where private module M = Monad monad monad' : Cat.Monad C monad' .M = M.M monad' .unit = M.Ξ· monad' .mult = M.ΞΌ monad' .left-ident {x} = ap (M.ΞΌ .Ξ· x C.β_) (C.intror refl) β M.ΞΌ-unitr Ξ·β x monad' .right-ident {x} = ap (M.ΞΌ .Ξ· x C.β_) (C.introl (M.M .Functor.F-id)) β M.ΞΌ-unitl Ξ·β x monad' .mult-assoc {x} = ap (M.ΞΌ .Ξ· x C.β_) (C.intror refl) Β·Β· M.ΞΌ-assoc Ξ·β x Β·Β· ap (M.ΞΌ .Ξ· x C.β_) (C.elimr refl β C.eliml (M.M .Functor.F-id)) Monadβbicat-monad : Cat.Monad C β Monad (Cat _ _) C Monadβbicat-monad monad = monad' where private module M = Cat.Monad monad monad' : Monad (Cat _ _) C monad' .M = M.M monad' .ΞΌ = M.mult monad' .Ξ· = M.unit monad' .ΞΌ-assoc = ext Ξ» _ β ap (M.ΞΌ _ C.β_) (C.elimr refl) Β·Β· M.mult-assoc Β·Β· ap (M.ΞΌ _ C.β_) (C.introl (M.M-id) β C.intror refl) monad' .ΞΌ-unitr = ext Ξ» _ β ap (M.ΞΌ _ C.β_) (C.elimr refl) β M.left-ident monad' .ΞΌ-unitl = ext Ξ» _ β ap (M.ΞΌ _ C.β_) (C.eliml M.M-id) β M.right-ident