Monads in mathematics 3 : monads from adjunctions

2 March 2009 at 12:13 am 1 comment

The adjunction property between two functors, T: C_1 \to C_2 and U: C_2 \to C_1, says that there is a natural bijection between morphisms \mathrm{Hom}_1(A, UB) (in the first category) and \mathrm{Hom}_2(TA, B) (in the second category). Here natural means that these bijection is compatible with composition with morphisms B \to B', UB \to UB' or A' \to A and TA' \to TA.

Adjunctions are naturally created by the use of monads or operads. For example, the functor V_k: \mathrm{Set} \to \mathrm{Vect}_k mapping a set X to the free vector space V_k(X) = k^{(X)} with basis X, has a adjoint, U: \mathrm{Vect}_k \to \mathrm{Set}, mapping a vector space to the set of its elements. The meaning of the adjunction is that a morphism V_k(X) \to W is equivalent to the choice X \to W of images of basis vectors where W is considered as as set. Similar adjunctions exist for other free objects (free algebras, free groups, free modules).

Another fundamental adjunction relates products and exponentials in the following sense. If X, Y and Z are sets, the bijection \mathrm{Hom}(X \times Y, Z) = \mathrm{Hom}(X, Z^Y) adjoins the functors \bullet \times Y and \bullet^Y. A similar adjunction works for modules or vector spaces, and states \mathrm{Hom}(X \otimes Y, Z) \simeq \mathrm{Hom}(X, \mathrm{Hom}(Y,Z)).

An informal way of describing adjoint functors is that one of the functors describes how to obtain morphisms to/from objects created by the other functor (these morphisms are said to be representable). For example, morphisms from a free vector space are described by picking elements in the target, so the “free vector space” functor is adjoint to the “set of elements” functor.

Monads from adjunction

Arbitrary pairs of adjoint functors define monads in the following way: if T and U are adjoint functors as before (T being the left adjoint and U the right adjoint). Recall that the adjunction between T and U says that U describes morphisms coming from objects of the form TX. Then the identity TX \to TX should be represented by a morphism X \to UTX.

Is is then a simple but head-aching exercise to show that UT is a monad and understand what it means. When U is the “set of elements” functor and T the “free thing” functor, UT is the “free thing” monad in the sense of my first post. Beware that TU does not define a monad, but a comonad (whose definition has arrows going the other way): the natural morphism is TUX \to X.

The product/exponential adjunction defines a comonad Y \times \mathrm{Map}(Y, X) to X which is the evaluation map (y,f) \to f(y). There is also a monad X \to \mathrm{Map}(Y, X \times Y) (mapping x to y \mapsto (x,y)): applying it twice yields \mathrm{Map}(Y, \mathrm{Map}(Y, X \times Y) \times Y) which has a natural morphism towards \mathrm{Map}(Y, X \times Y) using the evaluation map. This monad can model computations with side effects (the State monad of Haskell) : these computations would usually be described as maps S \times X_1 \to S \times X_2 where S is the set of states, but these are exactly the same as maps X_1 \to \mathrm{Map}(S, S \times X_2) (using the adjunction), which syntaxically allows going from stateless objects to state-dependent objects. This is an example of why the formalism of monads can be relevant in modeling real-world phenomena.

About these ads

Entry filed under: algebra, categories, english, monads in mathematics. Tags: , , , , .

LaTeXing monads Monads in mathematics 4 : the bar and cobar constructions

1 Comment Add your own

  • 1. Edward Kmett  |  4 March 2009 at 6:52 pm

    As an aside, category-extras provides Haskell with the Context comonad induced by composing the project/exponential adjunction the other way around.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Trackback this post  |  Subscribe to the comments via RSS Feed




Get every new post delivered to your Inbox.

%d bloggers like this: