Feeds:
Posts

It’s common to think of monads as generalized algebraic theories; the most familiar examples, such as the monads on $\text{Set}$ encoding groups, rings, and so forth, have this flavor. However, this intuition is really only appropriate for certain monads (e.g. finitary monads on $\text{Set}$, which are the same thing as Lawvere theories).

It’s also common to think of monads as generalized monoids; previously we discussed why this was a reasonable thing to do.

Today we’ll discuss a different intuition: monads are (loosely) categorifications of idempotents.

Conventions

As previously, in this post compositions will be done in diagrammatic order, so if $f : c \to d$ and $g : d \to e$ are two morphisms, their composite will be denoted $fg : c \to e$, or sometimes $c \xrightarrow{f} d \xrightarrow{g} e$ (which is independent of, but strongly suggests, the diagrammatic order).

This will end up switching the role of “left” and “right” in a few statements relative to the usual order of composition. For example, it will switch which adjoint goes first when constructing a monad out of an adjunction, so be careful when matching up statements in this post to statements elsewhere. But as we’ll see this convention has nice properties.

It will also force us to use the following curious-looking notation: if $F : C \to D$ is a functor and $c \in C$ is an object, we’ll denote the value of $F$ on $c$ by $cF$ (thinking of $c$ as a morphism $c : 1 \to C$). Read this in your head the same way you would read “c squared.”

Several different kinds of composition throughout this post will be denoted by concatenation, and it should hopefully be clear from the types of the objects involved what kind of composition is meant. For example, if $\alpha : f \to g$ is a 2-morphism and $h$ is a 1-morphism such that the compositions $fh, gh$ are defined, then $\alpha h : fh \to gh$ denotes the vertical composition of $\alpha$ with the identity $\text{id}_h : h \to h$.

Like the definition of adjoints, the definition of monads is purely 2-categorically equational, so makes sense in any 2-category and is preserved by any 2-functor, and we’ll introduce it at this level of generality.

In short, a monad on an object $c$ in a 2-category $C$ is a monoid in the monoidal category $\text{End}(c)$ of endomorphisms of $c$. More explicitly, a monad is a 1-morphism $m : c \to c$ from an object $c$ to itself together with a unit 2-morphism $\eta : \text{id}_c \to m$ and a multiplication 2-morphism $\mu : m^2 \to m$ satisfying the following compatibilities. The first compatibility (associativity) says that the two ways of using $\mu$ to write down a 2-morphism $m^3 \to m$ agree; explicitly,

$\left( m^3 \xrightarrow{m \mu} m^2 \xrightarrow{\mu} m \right) = \left( m^3 \xrightarrow{\mu m} m^2 \xrightarrow{\mu} m \right)$.

The second compatibility (unit) says that

$\left( m \xrightarrow{m \eta} m^2 \xrightarrow{\mu} m \right) = \left( m \xrightarrow{\eta m} m^2 \xrightarrow{\mu} m \right) = \left( m \xrightarrow{\text{id}_m} m \right)$.

Dually, a comonad is a monad in the 1-opposite 2-category (reversing the order of composition of 1-morphisms): it still starts out as a 1-morphism $m : c \to c$ but has a counit $\varepsilon : m \to \text{id}_c$ and a comultiplication $\Delta : m \to m^2$.

Our favorite way of producing monads and comonads will be via adjunctions, as follows. Let $f \vdash g : c \to d$ be an adjunction, so $f : c \to d$ is the left adjoint and $g : d \to c$ is the right. Let

$\eta : \text{id}_c \to fg$

denote the unit of the adjunction, and let

$\varepsilon : gf \to \text{id}_d$

denote the counit. (This is a place where diagrammatic order matters.)

Proposition: $m = fg : c \to c$ is a monad on $c$, with unit the unit of the adjunction and multiplication the map

$\displaystyle m^2 = fgfg \xrightarrow{f \varepsilon g} fg = m.$

Dually, $n = gf : d \to d$ is a comonad on $d$, with counit the counit of the adjunction and comultiplication derived from the unit.

This can be thought of as a categorification of the usual method of producing an idempotent $m : c \to c$ from a section-retraction pair, namely a pair of morphisms $f : c \to d$ and $g : d \to c$ such that $gf = \text{id}_d$. (This is another place where diagrammatic order matters. $f$ is the retraction and $g$ is the section.) This condition means that $m = fg$ satisfies $m^2 = fgfg = f(gf)g = fg$, which categorifies to the above.

Example. Let $C = BV$ be the one-object 2-category corresponding to a monoidal category $(V, \otimes)$. Then a monad in $C$ is just a monoid in $V$, and a comonad in $C$ is a comonoid in $V$. (Working backwards, if monads and comonads in a 2-category categorify idempotent morphisms in a category, then monoids and comonoids in a monoidal category categorify idempotent elements of a monoid.)

An adjoint pair in $C$ is a dual pair $v, v^{\ast}$ of objects of $M$ (here $v^{\ast}$ indicates the right dual of $v$). So the construction above specializes to the observation that the tensor product $v \otimes v^{\ast}$ has a natural monoid structure, which should be familiar from the case of vector spaces, where it is a matrix algebra. (What might be less familiar is the dual statement that $v^{\ast} \otimes v$ has a natural comonoid structure.)

More generally, if $V$ is a closed symmetric monoidal category with internal hom $[-, -]$, then

$\displaystyle \text{Hom}(-, [v, v]) \cong \text{Hom}(v \otimes (-), v) \cong \text{Hom}(-, v \otimes v^{\ast})$

so by the Yoneda lemma we conclude that for a dualizable object $v$, the tensor product $v \otimes v^{\ast}$ is canonically isomorphic to the internal endomorphism object $[v, v]$ (and a little more work shows that this is even an isomorphism of monoid objects).

In general, we get that $v \otimes v^{\ast}$ is a monoid in $V$ which naturally acts on $v$ from the left, and on $v^{\ast}$ from the right. Furthermore,

$\text{Hom}(v, v) \cong \text{Hom}(1, v \otimes v^{\ast})$

where $1$ denotes the monoidal unit, so the “points” of $v \otimes v^{\ast}$ (the result of applying $\text{Hom}(1, -)$) are endomorphisms of $v$.

Example. Let $C$ be the 2-category of posets. Then a monad in $C$ is a closure operator $m : P \to P$ on a poset $P$.

Explicitly, $m$ must first of all be a morphism of posets, so $p \le q$ implies $pm \le qm$. Next, the unit becomes the condition $p \le pm$, and finally, multiplication becomes the condition $p m^2 \le p m$. Since $p \le pm$ implies $pm \le p m^2$, we have $p m^2 = p m$. (So all monads on posets are genuinely idempotents.)

The construction of monads from adjunctions specializes here to the construction of closure operators from adjunctions between posets, also known as Galois connections. This reproduces various familiar closure operators in mathematics, such as Zariski closure.

Example. Let $C = \text{Mor}(k)$ be the Morita 2-category of algebras, bimodules, and bimodule homomorphisms over a commutative ring $k$. Then a monad in $C$ is an algebra object in $(A, A)$-bimodules over $k$, where $A$ is some $k$-algebra; we’ll call this an $A$-algebra for short, although note that even if $A$ is commutative it doesn’t reduce to the usual notion of algebra over a commutative ring.

An adjoint pair in $C$ is, as we saw previously, a pair consisting of an $(A, B)$-bimodule $V$ which is f.g. projective as a right $B$-module (the left adjoint) and its $B$-linear dual $V^{\ast} = \text{Hom}_B(V, B)$ regarded as a $(B, A)$-bimodule (the right adjoint). The notation is meant to again evoke the special case of vector spaces, which we recover when $A = B = k$ is a field. The corresponding monad is the $A$-algebra $V \otimes_B V^{\ast}$, which can be thought of as the algebra of $B$-linear endomorphisms of $V$ (acting on the left) or of $V^{\ast}$ (acting on the right).

Left and right modules

Just like monoids, monads have modules over them. A right module over a monad $m : c \to c$ is an object $d$, a 1-morphism $g : d \to c$, and an action 2-morphism

$\alpha : gm \to g$

satisfying the associativity condition

$\left( gm^2 \xrightarrow{\alpha m} gm \xrightarrow{\alpha} g \right) = \left( gm^2 \xrightarrow{g \mu} gm \xrightarrow{\alpha} g \right)$

and the unit condition

$\left( g \xrightarrow{\eta g} mg \xrightarrow{\alpha} g \right) = \left( g \xrightarrow{\text{id}_g} g \right)$.

Dually, a left module is an object $d$, a 1-morphism $f : c \to d$, and an action 2-morphism $\beta : mf \to f$ satisfying the obvious duals of the above conditions.

Our favorite way of producing modules is again via adjunctions. If $f \vdash g : c \to d$ is an adjunction giving rise to $m \cong fg$, then the left adjoint $f$ is naturally a left module over $m$, and dually the right adjoint $g$ is naturally a right module over $m$. (If we had stuck to compositions in the usual rather than diagrammatic order this would be reversed.) In fact the two together form a kind of bimodule over $m$.

Classically, in $\text{Cat}$, what is usually called a module or algebra for a monad $M : C \to C$ is an object $c \in C$ together with an action map $\alpha : cM \to c$ satisfying the same axioms as above. This is a special kind of right module where $d = 1$ is the terminal category. More generally, in $\text{Cat}$ a right module $g : d \to c$ can be interpreted as a family of $M$-algebras parameterized by $d$. It’s less clear what a left module is.

Thinking of monads as idempotents $m : c \to c$, right modules categorify morphisms $g : d \to c$ such that $gm = g$, or equivalently that equalize $m$ and $\text{id}_c : c \to c$, and dually left modules categorify morphisms $f : c \to d$ such that $mf = f$, or equivalently that coequalize $m$ and $\text{id}_c$. These are used to state the universal property of the equalizer and coequalizer of $m$ and $\text{id}_c$ respectively, which can be thought of as the object $c^m$ of invariants (fixed points) or the object $c_m$ of coinvariants (orbits), respectively, under the action of $m$, and (because $m$ is an idempotent) which are canonically isomorphic.

This categorifies as follows. The categorification of invariants is the Eilenberg-Moore object $c^m$ of a monad $m : c \to c$. This is, if it exists, the universal right module over $m$: that is, it is equipped with a 1-morphism $g : c^m \to c$ and an action 2-morphism $gm \to g$ making it a right module, and any other right module uniquely factors through it. Said another way, right module structures on an object $d$ are equivalent to 1-morphisms $d \to c^m$.

Dually, the categorification of coinvariants is the Kleisli object $c_m$. This is, if it exists, the universal left module over $m$: that is, it is equipped with a 1-morphism $f : c \to c_m$ and an action 2-map $mf \to f$ making it a left module, and any other left module uniquely factors through it. Said another way, left module structures on an object $d$ are equivalent to 1-morphisms $c_m \to d$.

Example. In $\text{Cat}$, the Eilenberg-Moore category $C^M$ of a monad $M : C \to C$ on a category turns out to be the category of $M$-algebras (categorifying how the invariants of an idempotent endomorphism of a set is the set of its fixed points). The right module structure on $C^M$ has 1-morphism the forgetful functor $G : C^M \to C$ given by forgetting the $M$-algebra structure and action 2-morphism the natural transformation $GM \to G$ whose components are given by the action maps

$\alpha : cM \to c$

of the $M$-algebras $c \in C^M$.

The universal property of $C^M$ says that a right module structure on a category $D$ is a functor $D \to C^M$, or in other words a family of $M$-algebras parameterized by $D$, which at least makes sense at the level of objects.

The Kleisli category $C_M$ turns out to have the same objects as $C$, but where a morphism from $c$ to $d$ is a Kleisli morphism, namely a morphism $f : c \to dM$. Composition is as follows: if $f : c \to dM$ and $g : d \to eM$ are two Kleisli morphisms, then their composite is

$c \xrightarrow{f} dM \xrightarrow{gM} dM \to eM^2 \xrightarrow{e \mu} eM$.

The left module structure on $C_M$ has 1-morphism the functor $F : C \to C_M$ which is the identity on objects and which sends an ordinary morphism $f : c \to d$ to the Kleisli morphism

$c \xrightarrow{f} d \xrightarrow{d \eta} dM$.

Its action 2-morphism is the natural transformation $MF \to F$ whose components are the identity $\text{id}_{cM} : cM \to cM$, regarded as a Kleisli morphism from $cM$ to $c$.

The universal property of $C_M$ says that a left module structure on a category $D$ is a functor $C_M \to D$. It’s less clear to me what this means.

splitting of an idempotent $m : c \to c$ is a pair of morphisms $f : c \to d, g : d \to c$ (a section-retraction pair) such that $fg = m$ and $gf = \text{id}_d$; we say that $m$ splits (or, in the terminology we used earlier, is a split idempotent) if it admits a splitting. Under very mild hypotheses (e.g. the existence of either equalizers or coequalizers), every idempotent $m$ admits a unique (up to unique isomorphism) splitting, where $d$ is simultaneously both the object of invariants $c^m = \text{eq}(m, \text{id}_c)$ and the object of coinvariants $c_m = \text{coeq}(m, \text{id}_c)$ of $m$. To exhibit this isomorphism we start by writing down a map $c_m \to c^m$ from coinvariants to invariants (when they both exist), and this map exists because an idempotent $m$ both equalizes and coequalizes itself.

This categorifies as follows. (All of the terminology I’m about to introduce is nonstandard.) A splitting of a monad $m : c \to c$ is a pair of adjoint 1-morphisms $f : c \to d, g : d \to c$ together with an isomorphism $fg \cong m$ of monads; we say that $m$ splits (or is a split monad) if it admits a splitting.

Example. As above, let $C = BV$ be the one-object 2-category corresponding to a monoidal category $(V, \otimes)$. A monad in $C$ is a monoid in $V$, and a monoid $m$ splits iff there is a right dualizable object $v \in V$ such that $m \cong v \otimes v^{\ast}$ as monoids.

Specializing to the case that $V = \text{Mod}(k)$ is the symmetric monoidal category of modules over a commutative ring $k$, a monad in $C$ is a $k$-algebra $A$, and an algebra splits iff there is a f.g. projective $k$-module $P$ such that $A \cong P \otimes_k P^{\ast}$ as $k$-algebras, or equivalently iff

$\displaystyle A \cong \text{End}_k(P)$.

Such a $P$ need not either exist or be unique. Lack of existence is clear; for example, when $k$ is a field the above condition says that $A$ is a matrix algebra, and there are plenty of non-matrix algebras. To see lack of uniqueness we can observe that if $A = k$ then we can take $P$ to be any invertible $k$-module, so $P$ need not be unique if the Picard group $\text{Pic}(k)$ is nontrivial.

(There’s something interesting to say here even when $k$ is a field. It’s possible for a $k$-algebra $A$ not to split over $k$ but to split over a finite extension of $k$; such algebras correspond to nontrivial classes in the Brauer group $\text{Br}(k)$. Incidentally, in this area there’s an existing definition of “split,” and it’s a happy accident as far as I can tell that the two uses coincide in this special case.)

We’ve learned that in general, splittings of monads neither exist nor are unique. However, it’s true that the Eilenberg-Moore object $c^m$ and Kleisli object $c_m$ (when they exist) both give rise to splittings, as follows. In particular, all monads in $\text{Cat}$ split (so arise from adjunctions).

A monad $m$ is naturally both a left and a right module over itself. Because $m$ is a right module over itself, $m : c \to c$ admits a factorization

$\displaystyle c \xrightarrow{\ell} c^m \xrightarrow{g} c$

through the universal right module $c^m$. The pair of 1-morphisms $\ell, g$ are in fact adjoint: the unit of the adjunction comes from the unit $\eta : \text{id}_c \to m$ of $m$, while the counit comes from the action 2-morphism $\alpha : gm \to m$, as follows. Part of the definition of a right module implies that the action 2-morphism is in fact a morphism of right $m$-modules, and so by the universal property of the Eilenberg-Moore object $c^m$ it factors through $c^m \xrightarrow{g} c$, giving a 2-morphism $g \ell \to \text{id}_{c^m}$ which is our counit.

The verification of the zigzag identities isn’t hard but is annoying without good notation, so we’ll omit it. One of them follows from the unit condition for the right $m$-module structure on $g$, and the other one follows from the unit condition for the monad structure on $m$, together with the same factoring-through-$g$ argument as above.

Hence whenever the Eilenberg-Moore object $c^m$ exists, it exhibits a splitting of $m$. Dually (by reversing 1-morphisms), whenever the Kleisli object $c_m$ exists, it also exhibits a splitting of $m$. (Hence Eilenberg-Moore and Kleisli objects can’t always exist in 2-categories with monads that aren’t split.)

But we can say more than this. The left adjoint $c \xrightarrow{\ell} c^m$ now admits a natural left $m$-module structure (since it’s the left adjoint of an adjunction that splits $m$), so by the universal property of the Kleisli object $c_m$ (if it exists), we get a further factorization

$\displaystyle c \xrightarrow{f} c_m \xrightarrow{i} c^m \xrightarrow{g} c$

of $m$. If our situation were exactly analogous to the case of idempotents, the middle morphism $i : c_m \to c^m$ would be an equivalence. This isn’t true, but it’s very close, and it’s true if in addition $m$ is an idempotent monad (meaning that the multiplication 2-morphism $\mu : m^2 \to m$ is an isomorphism).  In $\text{Cat}$ these arise from reflective subcategories, for example the adjunction between $\text{Ab}$ and $\text{Grp}$.

Example. In the case of $\text{Cat}$, let $M : C \to C$ be a monad on a category $C$. Then, as we saw above, the Eilenberg-Moore category $C^M$ is the category of $M$-algebras, so objects $c \in C$ equipped with action maps $\alpha : cM \to c$ satisfying unit and associativity conditions. There’s an obvious forgetful functor $G : C^M \to C$ given by forgetting the action map, and its left adjoint acts on objects as

$\displaystyle L : C \ni c \mapsto cM \in C^M$.

This exhibits $cM$ as the free $M$-algebra on $c$ (categorifying how, if $m : X \to X$ is an idempotent endomorphism of a set, then for every $x \in X$, the element $xm$ is a fixed point of $m$). The $M$-algebra structure on $cM$ comes from the right $M$-module structure on $M$ itself; explicitly, the action map is

$\displaystyle cM^2 \xrightarrow{c \mu} cM$

and unit and associativity for it reduce to unit and associativity for $\mu$. The claim that $cM$ is the free $M$-algebra says concretely that if $d$ is an $M$-algebra (with action map $\alpha : dM \to d$), then we have a natural bijection

$\displaystyle \text{Hom}_{C^M}(cM, d) \cong \text{Hom}_C(c, d)$.

This bijection is, explicitly, the following. The natural map from the LHS to the RHS sends an $M$-algebra morphism $f : cM \to d$ to the composite

$\displaystyle c \xrightarrow{c \eta} cM \xrightarrow{f} d.$

The natural map from the RHS to the LHS sends a morphism $h : c \to d$ to the composite

$\displaystyle cM \xrightarrow{hM} dM \xrightarrow{\alpha} d$.

The verification that these two maps are inverses to each other is purely equational. In one direction (starting from an $M$-algebra morphism $f : cM \to d$), we need the identity

$\displaystyle \left( cM \xrightarrow{c \eta M} cM^2 \xrightarrow{fM} dM \xrightarrow{\alpha} d \right) = \left( cM \xrightarrow{f} d \right)$

which we can prove as follows. $f$ being an $M$-algebra morphism means, by definition, that

$\displaystyle \left( cM^2 \xrightarrow{c \mu} cM \xrightarrow{f} d \right) = \left( cM^2 \xrightarrow{f M} dM \xrightarrow{\alpha} d \right)$.

The identity we need then becomes

$\displaystyle \left( cM \xrightarrow{c \eta M} cM^2 \xrightarrow{c \mu} cM \xrightarrow{f} d \right) = \left( cM \xrightarrow{f} d \right)$

which follows from the unit condition on $M$.

In the other direction (starting from a morphism $h : c \to d$), we need the identity

$\displaystyle \left( c \xrightarrow{c \eta} cM \xrightarrow{hM} dM \xrightarrow{\alpha} d \right) = \left( c \xrightarrow{h} d \right).$

The naturality of $\eta$ means precisely that

$\left( c \xrightarrow{c \eta} cM \xrightarrow{hM} dM \right) = \left( c \xrightarrow{h} d \xrightarrow{d \eta} dM \right)$

so the identity we need becomes

$\displaystyle \left( c \xrightarrow{h} d \xrightarrow{d \eta} dM \xrightarrow{\alpha} d \right) = \left( c \xrightarrow{h} d \right)$

which follows from the unit condition on the $M$-algebra structure on $d$.

According to our abstract argument above, the left adjoint $L : C \to C^M$ of the forgetful functor from the Eilenberg-Moore category should naturally factor through the Kleisli category $C_M$. This factorization can be described as follows. There is a natural functor

$\displaystyle I : C_M \ni c \mapsto cM \in C^M$

sending an object $c \in C_M$ to the free $M$-algebra $cM \in C^M$, and sending a Kleisli morphism $f : c \to dM$ to the composite

$\displaystyle cM \xrightarrow{fM} dM^2 \xrightarrow{d \mu} dM$.

The free $M$-algebra functor $L : C \to C^M$ factors through this functor in the obvious way. In fact more is true: because we know that $cM$ is the free $M$-algebra on $c$, we have

$\displaystyle \text{Hom}_{C^M}(cM, dM) \cong \text{Hom}_C(c, dM)$

from which it follows that in fact the functor $I$ from the Kleisli category to the Eilenberg-Moore category is fully faithful: it exhibits the Kleisli category as the full subcategory of free $M$-algebras among all $M$-algebras.

Subexample. If $C = P$ is a poset, so that $M : P \to P$ is a closure operator, then both the Eilenberg-Moore and Kleisli posets $P^M, P_M$ can be identified with the poset of $M$-closed elements of $P$ (those elements $p \in P$ such that $pM = p$), and the natural map $P_M \to P^M$ is an equivalence. This reflects the fact that closure operators are idempotent, so every closed element $p$ is a “free” closed element $pM$.