Monads in mathematics 3 : monads from adjunctions

2 March 2009 at 12:13 am

The adjunction property between two functors, and , says that there is a natural bijection between morphisms (in the first category) and (in the second category). Here natural means that these bijection is compatible with composition with morphisms , or and .

Adjunctions are naturally created by the use of monads or operads. For example, the functor mapping a set X to the free vector space with basis X, has a adjoint, , mapping a vector space to the set of its elements. The meaning of the adjunction is that a morphism is equivalent to the choice 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 adjoins the functors and . A similar adjunction works for modules or vector spaces, and states .

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 should be represented by a morphism .

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 .

The product/exponential adjunction defines a comonad which is the evaluation map . There is also a monad (mapping to ): applying it twice yields which has a natural morphism towards 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 where S is the set of states, but these are exactly the same as maps (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.

Advertisements

Like this: Like Loading... Related

Entry filed under: algebra, categories, english, monads in mathematics. Tags: adjunction, category, Haskell, monad, monads in mathematics.