Monad (category theory)

From Wikipedia, the free encyclopedia
Jump to navigation Jump to search

In category theory, a branch of mathematics, a monad (also triple, triad, standard construction and fundamental construction)[1] is an endofunctor (a functor mapping a category to itself), together with two natural transformations. Monads are used in the theory of pairs of adjoint functors, and they generalize closure operators on partially ordered sets to arbitrary categories.


A monad is a certain type of endofunctor. For example, if and are a pair of adjoint functors, with left adjoint to , then the composition is a monad. If and are inverse functors, the corresponding monad is the identity functor. In general, adjunctions are not equivalences—they relate categories of different natures. The monad theory matters as part of the effort to capture what it is that adjunctions 'preserve'. The other half of the theory, of what can be learned likewise from consideration of , is discussed under the dual theory of comonads.

The monad axioms can be seen at work in this example: let be the forgetful functor from the category Grp of groups to the category Set of sets, and let be the free group functor from the category of sets to the category of groups. Then is left adjoint of .

The monad

takes a set and returns the underlying set of the free group . In this situation, we are given two natural morphisms:

by including any set into the set in the natural way, as strings of length 1. Further,

can be made out of a natural concatenation or 'flattening' of 'strings of strings'. This amounts to two natural transformations


They will satisfy some axioms about identity and associativity that result from the adjunction properties. These are the monad axioms.

Another example is when is the endofunctor on the category of vector spaces which maps a vector space to its tensor algebra , and which maps linear maps to their tensor product. We then have a natural transformation corresponding to the embedding of into its tensor algebra, and a natural transformation corresponding to the map from to obtained by simply expanding all tensor products. These satisfy the monad axioms.

Those axioms are formally similar to the monoid axioms. They are taken as the definition of a general monad (not assumed a priori to be connected to an adjunction) on a category.

If we specialize to categories arising from partially ordered sets (with a single morphism from to iff ), then the formalism becomes much simpler: adjoint pairs are Galois connections and monads are closure operators.

Every monad arises from some adjunction, in fact typically from many adjunctions. Two constructions introduced below, the Kleisli category and the category of Eilenberg–Moore algebras, are extremal solutions to the problem of constructing an adjunction that gives rise to a given monad.

The example about free groups given above can be generalized to any type of algebra in the sense of a variety of algebras in universal algebra. Thus, every such type of algebra gives rise to a monad on the category of sets. Importantly, the algebra type can be recovered from the monad (as the category of Eilenberg–Moore algebras), so monads can also be seen as generalizing varieties of universal algebras. Even more generally, any adjunction is said to be monadic (or tripleable) if it shares this property of being (equivalent to) the Eilenberg–Moore category of its associated monad. Consequently, Beck's monadicity theorem, which gives a criterion for monadicity, can be used to show that a particular adjunction can be treated as a category of algebras in this way.

The notion of monad was invented by Roger Godement in 1958 under the name "standard construction." In the 1960s and 1970s, many people used the name "triple." The now standard term "monad" is due to Saunders Mac Lane.

Formal definition[edit]

If is a category, a monad on consists of an endofunctor together with two natural transformations: (where denotes the identity functor on ) and (where is the functor from to ). These are required to fulfill the following conditions (sometimes called coherence conditions):

  • (as natural transformations );
  • (as natural transformations ; here denotes the identity transformation from to ).

We can rewrite these conditions using the following commutative diagrams:

Coherence law for the multiplication of a monad.svg
Coherence law for the unit of a monad.svg

See the article on natural transformations for the explanation of the notations and , or see below the commutative diagrams not using these notions:

Monad multiplication explicit.svg              Monad unit explicit.svg

The first axiom is akin to the associativity in monoids if we think of as the monoid's binary operation, and the second axiom is akin to the existence of an identity element (which we think of as given by ). Indeed, a monad on can alternatively be defined as a monoid in the category whose objects are the endofunctors of and whose morphisms are the natural transformations between them, with the monoidal structure induced by the composition of endofunctors.


A rich set of examples is given by adjunctions (see Monads and adjunctions, below), and the free group example mentioned above belongs to that set.

Here is another example, on the category : For a set let be the power set of and for a function let be the function between the power sets induced by taking direct images under . For every set , we have a map , which assigns to every the singleton . The function

takes a set of sets to its union. These data describe a monad.

Closure operators are monads on preorder categories.

Algebras for a monad[edit]

Suppose that is a given monad on a category .

A -algebra is an object of together with an arrow of called the structure map of the algebra such that the diagrams

Monad multi algebra.svg and Monad unit algebra.svg


A morphism of -algebras is an arrow of such that the diagram

Monad morphism algebra.svg


The category of -algebras and their morphisms is called the Eilenberg–Moore category or category of (Eilenberg–Moore) algebras of the monad . The forgetful functor has a left adjoint taking to the free algebra .

Given the monad , there exists another "canonical" category called the Kleisli category of the monad . This category is equivalent to the category of free algebras for the monad , i. e. the full subcategory of whose objects are of the form , for an object of .

Monads and adjunctions[edit]

An adjunction between two categories and (where is left adjoint to and and are respectively the unit and the counit) always defines a monad .

Conversely, it is interesting to consider the adjunctions which define a given monad this way. Let be the category whose objects are the adjunctions such that and whose arrows are the morphisms of adjunctions which are the identity on . Then this category has

  • an initial object , where is the Kleisli category,
  • a terminal object , where is the Eilenberg–Moore category.

An adjunction between two categories and is a monadic adjunction when the category is equivalent to the Eilenberg–Moore category for the monad . (Mac Lane uses a stronger definition, where the two categories are isomorphic rather than equivalent.) By extension, a functor is said to be monadic if it has a left adjoint forming a monadic adjunction. Beck's monadicity theorem gives a characterization of monadic functors.

Comonads and their importance[edit]

The categorical dual definition is a formal definition of a comonad (or cotriple); this can be said quickly in the terms that a comonad for a category is a monad for the opposite category . It is therefore a functor from to itself, with a set of axioms for counit and comultiplication that come from reversing the arrows everywhere in the definition just given.

Monads are to monoids as comonads are to comonoids. Every set is a comonoid in a unique way, so comonoids are less familiar in abstract algebra than monoids; however, comonoids in the category of vector spaces with its usual tensor product are important and widely studied under the name of coalgebras.

The importance of comonads becomes visible in a class of theorems from the categorical (and algebraic geometry) theory of descent. What was realised in the period 1960 to 1970 is that recognising the categories of coalgebras for a comonad was an important tool of category theory (particularly topos theory). The results involved are based on Beck's theorem. Roughly what goes on is this: while it is simple set theory that a surjective mapping of sets is as good as the equivalence relation "x is in the same fiber as y" on the domain of the mapping, for geometric morphisms what you should do is pass to such a coalgebra subcategory.


Monads are used in functional programming to express types of sequential computation (sometimes with side-effects). See monads in functional programming, and the more mathematically oriented Wikibook module b:Haskell/Category theory.

In categorical logic, an analogy has been drawn between the monad-comonad theory, and modal logic via closure operators, interior algebras, and their relation to models of S4 and intuitionistic logics.


It is possible to define monads in a 2-category . Monads described above are monads for .

See also[edit]


  1. ^ Barr, Michael; Wells, Charles (1985), "Toposes, Triples and Theories" (PDF), Grundlehren der mathematischen Wissenschaften, Springer-Verlag, 278, pp. 82 and 120, ISBN 0-387-96115-1.

Further reading[edit]

External links[edit]