## Monads in mathematics 1 : examples

*25 February 2009 at 12:06 pm* *
1 comment *

Category theory studies in an abstract way how structures and constructions of mathematics are related. A *category* is a collection of (mathematical) objects. Usually, interesting categories contain objects sharing the same properties (there is a category of sets, a category of groups, a category of rings, and so on). A category need also have a definition of arrows, which often correspond to the usual definition of functions, maps or morphisms. But it is possible to define categories having more complicated arrows. A (not so) stupid non-trivial category is the opposite category *C ^{op}* of a given category

*C*, which has arrows going the other way.

A monad *M* on a category *C* is a *functor*: it associates to any object *X* in *C* another object *MX* of *C* in a so-called functorial way, which means that any arrow should give rise to an arrow . But in order to call *M * a monad, we require several other properties: there should be natural transformations (so that and are the same, which can be expressed by a *commutative square*), and such that is the identity (notice that there are two ways to obtain an arrow ). MacLane in *Categories for the Working Mathematician* gives a good account of the theory along with a bit of history and references.

Most examples of monads arising in mathematics are derived from two concepts: operads, which combine monads with much richer structure (but correspond to really tangible examples), and adjunctions (a framework in which monads can actually fit). I should write about these later, and concentrate on examples. Monads are also used in computer science, because they model a construction scheme which is widely spread. The programming language *Haskell* formulates many concepts in the language of monads. Marco Maggesi wrote a small introduction to monads (in Italian), which covers monads appearing in Haskell.

A basic undergraduate example is the monad of vector spaces. If *k* is a field, and *X* is a set, define to be the vector space with basis *X*: this is the set of abstract linear combinations of elements of *X* with coefficients in *k*. Then is a monad is the category of sets: it maps each set to another set (which is in fact a vector space over *k*), in a functorial way (any function defines a map of vector spaces ). We recognize the structure of a monad by considering the injection which maps an element of *X* to the corresponding basis vector. We also have a natural map which sends an abstract linear combination of elements of to their *actual linear combination*, which is a well-defined element of . Checking the other properties of monads is a simple exercise.

In a similar way, it is possible to define a monad of associative monoids (which is also the `List`

monad of Haskell), a monad of commutative monoids, a monad of rings, etc. These can all be expressed using the formalism of operads or of adjoint functors.

A more pictorial example of monad is the monad of trees, which is closely related to operads.

This monad associates to a set

*X*the set

*TX*of trees (to be defined) with a root (the bottom part of the tree in the picture) and leaves (the upper part) which are labelled by elements of the set (here

*a*,

*b*,

*c*). The set

*X*maps to

*TX*: an element

*x*is represented by the tree having no lines at all, just a point, labelled by

*x*. The set

*TTX*represents trees where leaves

*v*carry a tree

*T(v)*: such a tree-labelled tree has a natural associated tree, constructed by drawing really

*T(v)*at

*v*, which makes a bigger tree (this operation is called

*grafting trees*).

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

1.Monads in mathematics 3 : monads from adjunctions « Embûches tissues | 2 March 2009 at 12:13 am[...] 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 [...]