# Kleisli category

In category theory, a Kleisli category is a category naturally associated to any monad T. It is equivalent to the category of free T-algebras. The Kleisli category is one of two extremal solutions to the question Does every monad arise from an adjunction? The other extremal solution is the Eilenberg–Moore category. Kleisli categories are named for the mathematician Heinrich Kleisli.

## Formal definition

Let 〈T, η, μ〉 be a monad over a category C. The Kleisli category of C is the category CT whose objects and morphisms are given by

{\displaystyle {\begin{aligned}\mathrm {Obj} ({{\mathcal {C}}_{T}})&=\mathrm {Obj} ({\mathcal {C}}),\\\mathrm {Hom} _{{\mathcal {C}}_{T}}(X,Y)&=\mathrm {Hom} _{\mathcal {C}}(X,TY).\end{aligned}}}

That is, every morphism f: X → T Y in C (with codomain TY) can also be regarded as a morphism in CT (but with codomain Y). Composition of morphisms in CT is given by

${\displaystyle g\circ _{T}f=\mu _{Z}\circ Tg\circ f:X\to TY\to T^{2}Z\to TZ}$

where f: X → T Y and g: Y → T Z. The identity morphism is given by the monad unit η:

${\displaystyle \mathrm {id} _{X}=\eta _{X}}$ .

An alternative way of writing this, which clarifies the category in which each object lives, is used by Mac Lane.[1] We use very slightly different notation for this presentation. Given the same monad and category ${\displaystyle C}$  as above, we associate with each object ${\displaystyle X}$  in ${\displaystyle C}$  a new object ${\displaystyle X_{T}}$ , and for each morphism ${\displaystyle f\colon X\to TY}$  in ${\displaystyle C}$  a morphism ${\displaystyle f^{*}\colon X_{T}\to Y_{T}}$ . Together, these objects and morphisms form our category ${\displaystyle C_{T}}$ , where we define

${\displaystyle g^{*}\circ _{T}f^{*}=(\mu _{Z}\circ Tg\circ f)^{*}.}$

Then the identity morphism in ${\displaystyle C_{T}}$  is

${\displaystyle \mathrm {id} _{X_{T}}=(\eta _{X})^{*}.}$

## Extension operators and Kleisli triples

Composition of Kleisli arrows can be expressed succinctly by means of the extension operator (-)* : Hom(X, TY) → Hom(TX, TY). Given a monad 〈T, η, μ〉 over a category C and a morphism f : XTY let

${\displaystyle f^{*}=\mu _{Y}\circ Tf.}$

Composition in the Kleisli category CT can then be written

${\displaystyle g\circ _{T}f=g^{*}\circ f.}$

The extension operator satisfies the identities:

{\displaystyle {\begin{aligned}\eta _{X}^{*}&=\mathrm {id} _{TX}\\f^{*}\circ \eta _{X}&=f\\(g^{*}\circ f)^{*}&=g^{*}\circ f^{*}\end{aligned}}}

where f : XTY and g : YTZ. It follows trivially from these properties that Kleisli composition is associative and that ηX is the identity.

In fact, to give a monad is to give a Kleisli triple, i.e.

• A function ${\displaystyle T\colon \mathrm {ob} (C)\to \mathrm {ob} (C)}$ ;
• For each object ${\displaystyle A}$  in ${\displaystyle C}$ , a morphism ${\displaystyle \eta _{A}\colon A\to T(A)}$ ;
• For each morphism ${\displaystyle f\colon A\to T(B)}$  in ${\displaystyle C}$ , a morphism ${\displaystyle f^{*}\colon T(A)\to T(B)}$

such that the above three equations for extension operators are satisfied.

Kleisli categories were originally defined in order to show that every monad arises from an adjunction. That construction is as follows.

Let 〈T, η, μ〉 be a monad over a category C and let CT be the associated Kleisli category. Define a functor F: CCT by

${\displaystyle FX=X\;}$
${\displaystyle F(f\colon X\to Y)=\eta _{Y}\circ f}$

and a functor G : CTC by

${\displaystyle GY=TY\;}$
${\displaystyle G(f\colon X\to TY)=\mu _{Y}\circ Tf\;}$

One can show that F and G are indeed functors and that F is left adjoint to G. The counit of the adjunction is given by

${\displaystyle \varepsilon _{Y}=\mathrm {id} _{TY}:(TY)_{T}\to Y_{T}.}$

Finally, one can show that T = GF and μ = GεF so that 〈T, η, μ〉 is the monad associated to the adjunction 〈F, G, η, ε〉.

## References

1. ^ Mac Lane(1998) p.147
• Mac Lane, Saunders (1998). Categories for the Working Mathematician. Graduate Texts in Mathematics. 5 (2nd ed.). New York, NY: Springer-Verlag. ISBN 0-387-98403-8. Zbl 0906.18001.
• Pedicchio, Maria Cristina; Tholen, Walter, eds. (2004). Categorical foundations. Special topics in order, topology, algebra, and sheaf theory. Encyclopedia of Mathematics and Its Applications. 97. Cambridge: Cambridge University Press. ISBN 0-521-83414-7. Zbl 1034.18001.
• Jacques Riguet & Rene Guitart (1992) Enveloppe Karoubienne et categorie de Kleisli, Cahiers de Topologie et Géométrie Différentielle Catégoriques 33(3) : 261–6, via Numdam.org