Kleisli category

From HandWiki

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

[math]\displaystyle{ \begin{align}\mathrm{Obj}({\mathcal{C}_T}) &= \mathrm{Obj}({\mathcal{C}}), \\ \mathrm{Hom}_{\mathcal{C}_T}(X,Y) &= \mathrm{Hom}_{\mathcal{C}}(X,TY).\end{align} }[/math]

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

[math]\displaystyle{ g\circ_T f = \mu_Z \circ Tg \circ f : X \to T Y \to T^2 Z \to T Z }[/math]

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

[math]\displaystyle{ \mathrm{id}_X = \eta_X }[/math].

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 [math]\displaystyle{ C }[/math] as above, we associate with each object [math]\displaystyle{ X }[/math] in [math]\displaystyle{ C }[/math] a new object [math]\displaystyle{ X_T }[/math], and for each morphism [math]\displaystyle{ f\colon X\to TY }[/math] in [math]\displaystyle{ C }[/math] a morphism [math]\displaystyle{ f^*\colon X_T\to Y_T }[/math]. Together, these objects and morphisms form our category [math]\displaystyle{ C_T }[/math], where we define

[math]\displaystyle{ g^*\circ_T f^* = (\mu_Z \circ Tg \circ f)^*. }[/math]

Then the identity morphism in [math]\displaystyle{ C_T }[/math] is

[math]\displaystyle{ \mathrm{id}_{X_T} = (\eta_X)^*. }[/math]

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

[math]\displaystyle{ f^\sharp = \mu_Y\circ Tf. }[/math]

Composition in the Kleisli category CT can then be written

[math]\displaystyle{ g\circ_T f = g^\sharp \circ f. }[/math]

The extension operator satisfies the identities:

[math]\displaystyle{ \begin{align}\eta_X^\sharp &= \mathrm{id}_{TX}\\ f^\sharp\circ\eta_X &= f\\ (g^\sharp\circ f)^\sharp &= g^\sharp \circ f^\sharp\end{align} }[/math]

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.

  • A function [math]\displaystyle{ T\colon \mathrm{ob}(C)\to \mathrm{ob}(C) }[/math];
  • For each object [math]\displaystyle{ A }[/math] in [math]\displaystyle{ C }[/math], a morphism [math]\displaystyle{ \eta_A\colon A\to T(A) }[/math];
  • For each morphism [math]\displaystyle{ f\colon A\to T(B) }[/math] in [math]\displaystyle{ C }[/math], a morphism [math]\displaystyle{ f^\sharp\colon T(A)\to T(B) }[/math]

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

[math]\displaystyle{ FX = X_T\; }[/math]
[math]\displaystyle{ F(f\colon X \to Y) = (\eta_Y \circ f)^* }[/math]

and a functor G : CTC by

[math]\displaystyle{ GY_T = TY\; }[/math]
[math]\displaystyle{ G(f^*\colon X_T \to Y_T) = \mu_Y \circ Tf\; }[/math]

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

[math]\displaystyle{ \varepsilon_{Y_T} = (\mathrm{id}_{TY})^* : (TY)_T \to Y_T. }[/math]

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:

[math]\displaystyle{ \begin{align} (G \circ F)(X) &= G(F(X)) \\ &= G(X_T) \\ &= TX. \end{align} }[/math]

For any [math]\displaystyle{ f : X \to Y }[/math] in category C:

[math]\displaystyle{ \begin{align} (G \circ F)(f) &= G(F(f)) \\ &= G((\eta_Y \circ f)^*) \\ &= \mu_Y \circ T(\eta_Y \circ f) \\ &= \mu_Y \circ T\eta_Y \circ Tf \\ &= \text{id}_{TY} \circ Tf \\ &= Tf. \end{align} }[/math]

Since [math]\displaystyle{ (G \circ F)(X) = TX }[/math] is true for any object X in C and [math]\displaystyle{ (G \circ F)(f) = Tf }[/math] is true for any morphism f in C, then [math]\displaystyle{ G \circ F = T }[/math]. Q.E.D.

References

  1. Mac Lane (1998). Categories for the Working Mathematician. p. 147. 

External links