nLab
Kleisli category

Context

2-Category theory

Higher algebra

Kleisli category

Idea

Given a monad TT on some category 𝒞\mathcal{C}, then its Kleisli category is the full subcategory of the Eilenberg–Moore category of TT, hence the category of T-algebras, on those that are free T-algebras (free TT-modules).

Explicitly one may describe the Kleisli category of TT to have as objects the objects of 𝒞\mathcal{C}, and a morphism XYX \to Y in the Kleisli category is a morphism in 𝒞\mathcal{C} of the form XT(Y)X \to T(Y) in 𝒞\mathcal{C}. The monad structure induces a natural composition of such “TT-shifted” morphisms.

The Kleisli category is also characterized by the following universal property:

Since every adjunction gives rise to a monad on the domain of its left adjoint, we might ask if every monad may be construed as arising from an adjunction. This is in fact true, and the initial such adjunction in the category of adjunctions for the given monad has the Kleisli category as the codomain of its left adjoint.

Definition

Let T=(T,μ,η)\mathbf{T}=(T,\mu,\eta) be a monad in Cat, where T:CCT:C\to C is an endofunctor with multiplication μ:TTT\mu:T T\to T and unit η:Id CT\eta:Id_C\to T.

In terms of free algebras

Definition

A free T\mathbf{T}-algebra over a monad (or free T\mathbf{T}-module) is a T\mathbf{T}-algebra (module) of the form (T(M),μ M)(T(M),\mu_M), where the action is the component of multiplication transformation μ M:T(T(M))T(M)\mu_M : T(T(M))\to T(M).

Definition

The Kleisli category C TC_{\mathbf{T}} of the monad T\mathbf{T} the subcategory of the Eilenberg–Moore category C TC^{\mathbf{T}} on the free T\mathbf{T}-algebras.

Remark

If U:C TCU:C^{\mathbf{T}}\to C is the forgetful functor and F:CC TF: C\to C^{\mathbf{T}} is the free algebra functor F:M(TM,μ M)F: M\mapsto (T M,\mu_M), then the Kleisli category is simply the full subcategory of C TC^{\mathbf{T}} containing those objects in the image of FF.

In terms of Kleisli morphisms

As another way of looking at this, we can keep the same objects as in CC but redefine the morphisms. This was the original Kleisli construction:

Definition

The Kleisli category C TC_{\mathbf{T}} has as objects the objects of CC, and as morphisms MNM\to N the elements of the hom-set C(M,T(N))C(M,T(N)), in other words morphisms of the form MT(N)M \to T(N) in CC, called Kleisli morphisms.

Composition is given by the Kleisli composition rule g Kleislif=μ PT(g)fg\circ_{Kleisli} f = \mu_P\circ T(g)\circ f (as in the Grothendieck construction (here MfNgPM\stackrel{f}\to N\stackrel{g}\to P).

Remark

More explicitly, this means that the Kleisli-composite of f:xTyf : x \to T y with g:yTzg : y \to T z is the morphism

xfTyTgTTzμzTz. x \stackrel{f}{\to} T y \stackrel{T g}{\to} T T z \stackrel{\mu z}{\to} T z \,.
Proof of equivalence

The equivalence between both presentations amounts to the functor C TC TC_{T} \to C^{T} being full and faithful. This functor maps any object XX to T(X)T(X), and any morphism f:XT(Y)f \colon X \to T(Y) to T(X)T(f)T 2(Y)μ YT(Y)T(X) \stackrel{T(f)}{\to} T^2(Y) \stackrel{\mu_Y}{\to} T(Y).

Fullness holds because any morphism g:T(X)T(Y)g \colon T(X) \to T(Y) of algebras has as antecedent the composite Xη XT(X)gT(Y)X \stackrel{\eta_X}{\to} T(X) \stackrel{g}{\to} T(Y). Indeed, the latter is mapped by the functor into μ YT(g)T(η X)\mu_Y \circ T(g) \circ T(\eta_X), which because gg is a morphism of algebras is equal to gμ XT(η X)g \circ \mu_X \circ T(\eta_X), i.e., gg.

Faithfulness holds as follows: if μ YT(f)=μ YT(g)\mu_Y \circ T(f) = \mu_Y \circ T(g), then precomposing by η X\eta_X yields μ YT(f)η X=μ Yη T(Y)f=f\mu_Y \circ T(f) \circ \eta_X = \mu_Y \circ \eta_{T(Y)} \circ f = f and similarly for gg, hence f=gf = g.

Remark

This Kleisli composition plays an important role in computer science; for this, see the article at monad (in computer science).

Properties

Universal properties

In more general 2-categories the universal properties of Kleisli objects are dual to the universal properties of Eilenberg–Moore objects.

In particular, C TC_{\mathbf{T}} is initial in the category of adjunctions for T\mathbf{T} (whereas C TC^{\mathbf{T}} is terminal). For a proof, see Category Theory in Context Proposition 5.2.12.

In functional programming

In typed functional programming, the Kleisli category is used to model call-by-value? functions with side-effects and computation. See at monad (in computer science) for more on this.

References

The original source is

  • H. Kleisli, Every standard construction is induced by a pair of adjoint functors , Proc. Amer. Math. Soc. 16 (1965) pp.544–546. (AMS)

  • Jenö Szigeti, On limits and colimits in the Kleisli category, Cahiers de Topologie et Géométrie Différentielle Catégoriques, 24 no. 4 (1983), p. 381-391 (NUMDAM)

Discussion of cases where the inclusion of the Kleisli category into the Eilenberg-Moore category is a reflective subcategory is in

  • Marcelo Fiore, Matias Menni, Reflective Kleisli subcategories of the category of Eilenberg-Moore algebras for factorization monads, Theory and Applications of Categories, Vol. 15, CT2004, No. 2, pp 40-65. (TAC)

Discussion in internal category theory is in

  • Tomasz Brzeziński, Adrian Vazquez-Marquez, Internal Kleisli categories, Journal of Pure and Applied Algebra Volume 215, Issue 9, September 2011, Pages 2135–2147 (arXiv:0911.4048)

Discussion of Kleisli categories in type theory is in

  • Alex Simpson, Recursive types in Kleisli Categories (pdf)

Revised on September 22, 2017 16:06:24 by Max S. New? (129.10.110.48)