Kleisli category explained

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

\begin{align}Obj({l{C}T})&=Obj({l{C}}),\\ Homl{CT}(X,Y)&=Homl{C

}(X,TY).\endThat 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

g\circTf=\muZ\circTg\circf:X\toTY\toT2Z\toTZ

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

idX=η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

C

as above, we associate with each object

X

in 

C

a new object

XT

, and for each morphism

f\colonX\toTY

in 

C

a morphism

f*\colonXT\toYT

. Together, these objects and morphisms form our category

CT

, where we define
*\circ
g
T

f*=(\muZ\circTg\circf)*.

Then the identity morphism in

CT

is
id
XT

=

*.
(η
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

f\sharp=\muY\circTf.

Composition in the Kleisli category CT can then be written

g\circTf=g\sharp\circf.

The extension operator satisfies the identities:
\sharp
\begin{align}η
X

&=idTX

\sharp\circη
\\ f
X

&=f\\ (g\sharp\circf)\sharp&=g\sharp\circf\sharp\end{align}

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 tripleT, η, (–)#⟩, i.e.

T\colonob(C)\toob(C)

;

A

in

C

, a morphism

ηA\colonA\toT(A)

;

f\colonA\toT(B)

in

C

, a morphism

f\sharp\colonT(A)\toT(B)

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

Kleisli adjunction

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. Using Mac Lane's notation mentioned in the “Formal definition” section above, define a functor FC → CT by

FX=XT

F(f\colonX\toY)=(ηY\circf)*

and a functor G : CTC by

GYT=TY

G(f*\colonXT\toYT)=\muY\circTf

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
\varepsilon
YT

=(idTY)*:(TY)T\toYT.

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

Showing that GF = T

For any object X in category C:

\begin{align} (G\circF)(X)&=G(F(X))\\ &=G(XT)\\ &=TX. \end{align}

For any

f:X\toY

in category C:

\begin{align} (G\circF)(f)&=G(F(f))\\ &=G((ηY\circf)*)\\ &=\muY\circT(ηY\circf)\\ &=\muY\circTηY\circTf\\ &=idTY\circTf\\ &=Tf. \end{align}

Since

(G\circF)(X)=TX

is true for any object X in C and

(G\circF)(f)=Tf

is true for any morphism f in C, then

G\circF=T

. Q.E.D.

References

. Saunders Mac Lane . . 2nd . . 5 . Springer . 1998 . 0-387-98403-8 . 0906.18001 .

. Category Theory in Context. Emily Riehl. Dover Publications. 2016. 978-0-486-80903-8. 1006743127.

Notes and References

  1. Book: Mac Lane . 1998. Categories for the Working Mathematician. 147.