Monads and Adjunctions

21 April 2024

Welcome to another episode of categories by diagrams! Today we will investigate the connection between adjunctions and monads. The results I present here are quite elementary. However, it is a nice exercise for learning how to utilize string diagrams. Of course, to the trained category theorist this approach will be less efficient than directly applying Yoneda-type arguments. Still, I think the string diagrams let us easily understand the underlying structure (compared to the usual commutative diagrams.)

Note: All diagrams use the notation from my post about Kan extensions.

Monads #

Let C\mathcal{C} be category. The functor category ([C,C],,Id)([\mathcal{C}, \mathcal{C}], \circ, \mathrm{Id}) is (strict) monoidal, and so we may define monoid objects in it. A monad is a monoid object in this category. More explicitly, a monad is a functor T ⁣:CCT\colon \mathcal{C} \to \mathcal{C} together with a multiplication and unit

μ ⁣:TTT,η ⁣:IdT\mu\colon T \circ T \Longrightarrow T, \quad \eta\colon \mathrm{Id} \Longrightarrow T

such that the monoid axioms are satisfied. The associativity and unit axioms are readily expressed in string diagram notation.

Monoid laws

Notice that by horizontally flipping the string diagrams we obtain the definition of a comonad which has to satisfy the coassociativity and counit axioms.

Monads from Adjunctions #

It turns out that every adjunction gives rise to both a monad and a comonad in a natural way. In fact, this is obvious from the string diagrams!

Suppose we have an adjunction LRL \dashv R with unit η ⁣:IdRL\eta\colon \text{Id} \Rightarrow R \circ L and counit ε ⁣:LRId\eps\colon L \circ R \Rightarrow \text{Id}. Then η\eta is already the unit of the corresponding monad where T=RLT = R \circ L. The multiplication is given by whiskering the counit in the obvious way. The associativity and unit laws are a direct consequence of the zig-zag identities and naturality.

Monad from adjunction

By flipping the diagrams horizontally and exchanging the roles of η\eta and ε\eps we obtain a comonad with underlying functor C=LRC = L \circ R.

Adjunctions from monads? #

We understand that every adjunction yields a monad. But does every monad come from an adjunction? More precisely: Given a monad (T,μ,η)(T, \mu, \eta), can we construct an adjunction LRL \dashv R whose monad is (T,μ,η)(T, \mu, \eta)? The answer to that question is “yes” and we can do it in more than one way. One such construction is the Eilenberg-Moore adjunction which effectively reconstructs the monad from its category of modules.

Modules over a monad #

Traditionally a module over a monoid is an object on which the monoid acts. We generalize this notion to monads: A module over a monad T ⁣:CCT\colon \mathcal{C} \to \mathcal{C} is an object xCx \in \mathcal{C} with a TT-action a ⁣:Txxa\colon Tx \to x in C\mathcal{C} that satisfies the usual axioms we would require of a module action. To express the laws in string diagram notation, we identify objects xCx \in \mathcal{C} with the functor x ⁣:1Cx\colon \mathbf{1} \to \mathcal{C} that selects the object. A morphism xyx \to y in C\mathcal{C} corresponds to a natural transformation xyx \Rightarrow y between those functors. Here is the resulting string diagram for the action, along with the two module axioms (1) and (2).

Monad module laws

Let x,yx,y be two TT-modules with actions a ⁣:Txxa\colon Tx \to x and b ⁣:Tyyb\colon Ty \to y. We say that f ⁣:xyf\colon x \to y is a morphism of TT-modules, if it is compatible with the actions, i.e. the following diagram equation must hold.

Module morphism

It’s obvious from the diagrams that TT-modules form a category. This category is called the Eilenberg-Moore category and usually denoted by CT\mathcal{C}^T.

Free Modules #

To reconstruct TT we need to define a functor F ⁣:CCTF\colon \mathcal{C} \to \mathcal{C}^T which assigns each object in C\mathcal{C} a “free” TT-module. Since we have no information apart from μ\mu and η\eta, the only reasonable thing to do is to use μx ⁣:T(Tx)Tx\mu_x\colon T(Tx) \to Tx as an action on TxTx which doesn’t really depend on any information about xx. Indeed, it is completely obvious from the diagrams that μx\mu_x is an action on TxTx for any xCx \in \mathcal{C} because it doesn’t interact with xx at all.

Regular T-module

Similarly, we can now observe that any morphism f ⁣:xyf\colon x \to y in C\mathcal{C} is lifted by TT to a morphism of TT-modules. This is simply due to naturality of μ\mu.

Regular T-module

Hence, we can define the functor FF via

F ⁣:CCT,x(Tx,μx),(f ⁣:xy)(Tf ⁣:TxTy).F\colon \mathcal{C} \to \mathcal{C}^T, \quad x \mapsto (Tx, \mu_x), \quad (f\colon x \to y) \mapsto (Tf\colon Tx \to Ty).

The Reconstruction #

It is left to show that FUF \dashv U where U ⁣:CTCU\colon \mathcal{C}^T \to \mathcal{C} simply forgets the action. We want the unit η\eta of TT to be the unit of the adjunction. The components of the counit ε ⁣:FUId\eps\colon F \circ U \Rightarrow \mathrm{Id} have the form TyyTy \to y so we define them to be the TT-action of each yCTy \in \mathcal{C}^T. The naturality condition of ε\eps is merely stating that all morphisms in CT\mathcal{C}^T are TT-equivariant which holds by definition. The zig-zag identities are easy to work out using string diagrams.

EM-adjunction

Outlook #

We have seen one particular way to build an adjunction for a given monad. Another way to build an adjunction from a monad is by using the associated Kleisli category. By turning the adjunctions that produce a fixed monad into a category, one can show that the Eilenberg-Moore construction is terminal and the Kleisli construction is initial in this setting. In fact, one can show that those two constructions are equivalent when all modules over the monad are free.


Scroll to Top