We have now seen both relative monads and relative adjunctions, and how every relative adjunction induces a relative monad. As in conventional monad theory, it is natural to ask ourselves if every relative monad arises in this way. The mathematics parallels the situation for ordinary monads. In todays post will look at one extremal construction, generalising the ordinary Kleisli category and its corresponding adjunction.
From a computational perspective, the traditional Kleisli captured the basic aspects of effectful computation. The Kleisli category for a relative monad might be seen as modelling effectful computation on constrained or structured inputs.
Kleisli Categories of Relative Monads
For assume we have a
-relative monad
. The Kleisli category
has:
- Objects: The objects of
.
- Morphisms: The morphisms of type
in
are morphisms of type
. The identity at
is
. The composite
in the Kleisli category is given by
in
.
The structure of this category, and verifying the category axioms, follow pretty directly from the properties of the Kleisli triple. As with the notion of -relative monad, the structure of the Kleisli category is a pretty routine generalisation of the ordinary notion, with
inserted in a few places to make things type check.
Remark: We make a different notational choice for the Kleisli category of a relative monad than the one we used in the ordinary situation. This is because the traditional notation seems a bit less natural once the monad is not an endofunctor.
We will now look at a few examples, all arising as the relative monad induced by an ordinary monad, for a suitable choice of .
Example: Let be the inclusion of the subcategory of finite sets into the category of sets. The Kleisli category of the
-relative monad induced by the powerset monad
is the category with:
- Objects: Finite sets
- Morphisms: A morphism
is a binary relation
. Composition and identities are the usual thing for binary relations.
Notice this is neither the Kleisli category of the powerset monad, or the finite powerset monad. In this case, it is equivalent to the powerset monad on the category of finite sets.
In the previous example, everything ended up being finite due to properties specific to the powerset construction. Before we start developing bad intuitions, lets look at a different example that behaves differently.
Example: For as in the previous example, consider the relative monad induced by the list monad
. The Kleisli category has:
- Objects: Finite sets.
- Morphisms: Functions
with composition and identities as for the ordinary list monad.
Notice here, this is not the same as the Kleisli category of the list monad itself. There is no obvious analogue of the finite powerset to consider in this case either. Nor can we simply restrict the list monad to an endofunctor on finite sets, as the collection of lists of elements taken from a finite set is infinite. So here we see some genuine interplay between the finite and infinite aspects of the construction.
Another natural, if a bit pathological, source of examples will help to test our intuitions even further.
Example: For any , we can consider the relative monad induced by the identity monad. This will have:
- Objects: Objects in the category
.
- Morphisms: Morphisms of type
are
-morphisms of type
. Composition and identities are exactly as in
.
For different choices of :
gives the category of non-empty sets and functions between them.
gives the category of sets with at least
elements, and functions between them.
has Kleisli category equivalent to the Kleisli category of the state monad with state set
.
has Kleisli category equivalent to the Kleisli category of the continuation monad on set
.
We also note the following obvious example, establishing the connection with ordinary monads.
Example: As we have previously seen, an -relative monad is the same thing as an ordinary monad. The associated Kleisli construction is also the same as in the case of ordinary monads.
The Kleisli Adjunction
For , and
-relative monad
, we have the following functors:
, with
, and
.
, with
and
.
It is a routine exercise to show that is a
-relative left adjoint of
, and that this adjunction induces the relative monad
.
We can form a category with objects resolutions of a fixed -relative monad. A morphism of resolutions via categories
and
is a functor
commuting with the left and right adjoints in the obvious way. The Kleisli adjunction is initial in this category. For another resolution with left adjoint
, the unique Kleisli comparison functor is given on objects by
and on morphisms
is the transpose of
under the codomain adjunction. As taking transposes is a bijection, this functor is full and faithful.
Generalising the situation for ordinary monads:
- The comparison functor is an isomorphism iff
is bijective on objects.
- The comparison functor is an equivalence iff
is essentially surjective.
Conclusion
We have seen that every relative monad is induced by an adjunction, via a generalisation of the Kleisli construction for ordinary monads. The resulting Kleisli categories were surprisingly varied, given the extra flexibility that relative monads provide.
Given what we have learned about ordinary monad theory, we should ask ourselves whether there is an analogue of the Eilenberg-Moore construction as well. That is the topic we will address next time.
Futher reading: The Kleisli construction for relative monads appears in “Monads need not be endofunctors”. That the characterisation of adjunctions of Kleisli type generalises to the relative setting appears in Nathanael Arkor’s thesis, where they serve an important role in connection to algebra.
One thought on “The Relative Monad Kleisli Construction”