This is the second of two talks about monads, based on the very good notes by Andrea Schalk and continuing the one I gave on the 30th of May. Recall that we are trying to solve the following problem:

*given a monad , find an adjunction such that and *

If the adjunction solves the problem above, we say that it *generates* the monad .

The first solution to this problem was given by the Swiss mathematician Heinrich Kleisli, and is based on an alternative way of defining monads, as it is the case with adjunctions. Let us suppose with . If , then , so that : and we know from the definition of monad that . We can thus define an operator that takes into so that whatever is. The simplest example is itself, which yields , so that by uniqueness in the definition of adjunction quadruple, and . Moreover, if and , then , which implies by uniqueness.

**Definition 4.** A *Kleisli triple* on a category is a triple where:

- is a function,
- for every , and
- for every

such that the following equations are satisfied:

- for every ;
- for every ;
- for every , .

If is an adjunction quadruple then is a Kleisli triple.

**Theorem 1.** Let be a category.

- If is a monad on , and if for every , then is a Kleisli triple on .
- If is a Kleisli triple on , and if for every and for every , then is a monad on .
- The two operations from the previous points are each other’s converse.

*Proof:* Point 1 follows from naturality of and and the three monad laws:

For point 2, functoriality of , naturality of and , and monad laws follow from Kleisli laws:

Point 3 is straightforward.

Considering again the free monoid example, the corresponding Kleisli triple has

Theorem 1 says that we can restate our problem as follows:

*given a Kleisli triple ,** find an adjunction quadruple such that and *

If with , then for every there is an isomorphism : this observation is at the base of Kleisli’s construction.

**Definition 5.** Let be a Kleisli triple on a category . The *Kleisli category *of is the category defined as follows:

- ;
- ;
- , that is, the identity of in is ;
- , that is, the composition of and in is the composition of and in .

**Theorem 2.** is a category.

*Proof:* If , then and by the Kleisli laws. If , , and , then

Our plan is to construct an adjunction quadruple , with and , such that and for every . We do this as follows:

- for every ;
- for every ;
- for every ;
- for every .

Let us quickly check that is indeed a functor. If then . If and , then . We are only left to determine, for every , a unique such that : but the entire construction leads to the choice ! Indeed, , and by the Kleisli laws. Observe that the functor is the one that does all the work, while the function is little more than a placeholder.

By our identification of adjunctions with adjunction quadruples (see the previous talk) we also get for every , and for every .

Kleisli’s solution is not the only one, but just one among many: and, in a sense that will be clear later, the “simplest” one. Another solution was constructed by Eilenberg and Moore, and is based on a completely different approach: instead of keeping the objects and specializing the morphisms, one expands the objects and redefines the morphisms.

**Definition 6.** Let be a category and let be a monad on .

- A
*-algebra*on is a pair where is an object in and is such that and . - A morphism of -algebras from a -algebra to a -algebra is an arrow such that .
- The
*Eilenberg-Moore category*of -algebras on is the category which has -algebras as objects, morphisms of -algebras as morphisms, and where identities and composition are defined as in .

If is the free monoid construction, then an -algebra is a function such that

- for every , and
- for every .

As is a monad, for every object of there is a *free -algebra* , and every arrow induces a morphism of free -algebras . Moreover, *any* is, by definition, also a morphism from to in .

This time, our plan is to construct an adjunction such that , , , and for every . We do this as follows:

- ;
- ;
- if ;
- ;
- for every .

Then clearly , while naturality of follows from the properties of free -algebras with respect to -algebra morphisms. In addition, if then , and if then . We thus have a full-featured adjunction: this time, is doing all the work, and is just a forgetful functor.

**Theorem 3.** Let be a monad on a . Identify the monad with the corresponding Kleisli triple . The Kleisli category is equivalent to the full subcategory of generated by the free -algebras.

*Proof:* Define a functor by setting for every , and for every . Then is a faithful functor, because if , then and similarly , so that if . But is also full, because if is a morphism of free -algebras, then from the laws of monads follows that .

But things get even more interesting than this! Let be a monad: let us consider *all* the adjunctions that generate . What can be a *morphism* of such adjunctions? First, if is a solution with , and is a solution with , we may consider a functor as a morphism from to . Next, we want that the equalities are not affected by mid-way application of : this translates into the two conditions and . Finally, as the previous point yields , we want that does not interfere with the counits: that is, .

**Definition 7.** Let be a monad on a category and let , be two adjunctions that generate , with and , respectively. A *-preserving functor* from to is a functor such that , , and .

It is straightforward to see that -generating adjunctions together with -preserving functors form a category : composition is provided by the usual composition of functors, while the identity of in is the identity functor of if .

To confirm that our intuition is correct, let us verify that satisfies the three given equations:

- ;
- ;
- ;
- ;
- .

**Theorem 4.** Let be a monad. Then the Kleisli adjunction is the initial object of , the Eilenberg-Moore adjunction is the final object. In particular, is the only arrow in from the former to the latter.

*Proof:* If is the Kleisli adjunction, then the only choice for is and . If is the Eilenberg-Moore adjunction, then the only choice for is and .