open import Cat.Bi.Base
open import Cat.Prelude

import Cat.Reasoning as Cr

module Cat.Bi.Diagram.Monad  where

open _=>_

module _ {o β β'} (B : Prebicategory o β β') where
private module B = Prebicategory B


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
private module C = Cr C

ap (M.ΞΌ .Ξ· x C.β_) (C.intror refl)
β M.ΞΌ-unitr Ξ·β x
ap (M.ΞΌ .Ξ· x C.β_) (C.introl (M.M .Functor.F-id))
β M.ΞΌ-unitl Ξ·β 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))