## Monads in mathematics 1 : examples

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 Cop 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 $X to Y$ should give rise to an arrow $MX to MY$. But in order to call M a monad, we require several other properties: there should be natural transformations $X to MX$ (so that $X to MX to MY$ and $X to Y to MY$ are the same, which can be expressed by a commutative square), and $MMX to MX$ such that $MX to MMX to MX$ is the identity (notice that there are two ways to obtain an arrow $MX to MMX$). MacLane in Categories for the Working Mathematician gives a good account of the theory along with a bit of history and references.

A basic undergraduate example is the monad of vector spaces. If k is a field, and X is a set, define $V_k(X)$ 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 $V_k$ 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 $X to Y$ defines a map of vector spaces $V_k(X) to V_k(Y)$). We recognize the structure of a monad by considering the injection $X to V_k(X)$ which maps an element of X to the corresponding basis vector. We also have a natural map $V_k(V_k(X)) to V_k(X)$ which sends an abstract linear combination of elements of $V_k(X)$ to their actual linear combination, which is a well-defined element of $V_k(X)$. 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.

Labelled tree

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: , , , , , .