All Topics  
Monad (category theory)

 

   Email Print
   Bookmark   Link






 

Monad (category theory)



 
 
In category theory
Category theory

In mathematics, category theory deals in an abstract way with mathematical structures and relationships between them: it abstracts from set s and function s to objects linked in diagrams by morphisms or arrows....
, a monad or triple is an (endo-)functor
Functor

In category theory, a branch of mathematics, a functor is a special type of mapping between categories. Functors can be thought of as morphisms in the category of small categories....
, together with two associated natural transformation
Natural transformation

In category theory, a branch of mathematics, a natural transformation provides a way of transforming one functor into another while respecting the internal structure of the categories involved....
s. They are important in the theory of pairs of adjoint functors
Adjoint functors

In mathematics, adjoint functors are pairs of functors which stand in a particular relationship with one another, called an adjunction. The relationship of adjunction is ubiquitous in mathematics, as it rigorously reflects the intuitive notions of optimization and efficiency....
, and they generalize closure operator
Closure operator

A closure operator on a set S is a function cl: P ? P from the power set of S to itself which satisfies the following conditions for all sets X,Y ? S....
s on posets to arbitrary categories.

The notion of "algebras for a monad" generalizes classical notions from universal algebra
Universal algebra

Universal algebra is the field of mathematics that studies algebraic structures themselves, not examples of algebraic structures.For instance, rather than take particular groups as the object of study, in universal algebra one takes "the theory of groups" as an object of study....
, and in this sense, monads can be thought of as "theories".

Introduction
If F and G are a pair of adjoint functors
Adjoint functors

In mathematics, adjoint functors are pairs of functors which stand in a particular relationship with one another, called an adjunction. The relationship of adjunction is ubiquitous in mathematics, as it rigorously reflects the intuitive notions of optimization and efficiency....
, with F left adjoint to G, then the composition is a monad.






Discussion
Ask a question about 'Monad (category theory)'
Start a new discussion about 'Monad (category theory)'
Answer questions from other users
Full Discussion Forum



Encyclopedia


In category theory
Category theory

In mathematics, category theory deals in an abstract way with mathematical structures and relationships between them: it abstracts from set s and function s to objects linked in diagrams by morphisms or arrows....
, a monad or triple is an (endo-)functor
Functor

In category theory, a branch of mathematics, a functor is a special type of mapping between categories. Functors can be thought of as morphisms in the category of small categories....
, together with two associated natural transformation
Natural transformation

In category theory, a branch of mathematics, a natural transformation provides a way of transforming one functor into another while respecting the internal structure of the categories involved....
s. They are important in the theory of pairs of adjoint functors
Adjoint functors

In mathematics, adjoint functors are pairs of functors which stand in a particular relationship with one another, called an adjunction. The relationship of adjunction is ubiquitous in mathematics, as it rigorously reflects the intuitive notions of optimization and efficiency....
, and they generalize closure operator
Closure operator

A closure operator on a set S is a function cl: P ? P from the power set of S to itself which satisfies the following conditions for all sets X,Y ? S....
s on posets to arbitrary categories.

The notion of "algebras for a monad" generalizes classical notions from universal algebra
Universal algebra

Universal algebra is the field of mathematics that studies algebraic structures themselves, not examples of algebraic structures.For instance, rather than take particular groups as the object of study, in universal algebra one takes "the theory of groups" as an object of study....
, and in this sense, monads can be thought of as "theories".

Introduction


If F and G are a pair of adjoint functors
Adjoint functors

In mathematics, adjoint functors are pairs of functors which stand in a particular relationship with one another, called an adjunction. The relationship of adjunction is ubiquitous in mathematics, as it rigorously reflects the intuitive notions of optimization and efficiency....
, with F left adjoint to G, then the composition is a monad. Therefore, a monad is a functor from a category to itself. If F and G are inverse functors the corresponding monad is the identity functor. In general adjunctions are not equivalences
Equivalence of categories

In category theory, an abstract branch of mathematics, an equivalence of categories is a relation between two categories that establishes that these categories are "essentially the same"....
 — 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 a simple example: let G be the forgetful functor from the category Grp
Category of groups

In mathematics, the category theory Grp has the class of all Group for objects and group homomorphisms for morphisms. As such, it is a concrete category....
 of groups
Group (mathematics)

In mathematics, a group is an algebraic structure consisting of a set together with an Binary operation that combines any two of its element to form a third element....
 to the category Set
Category of sets

In mathematics, the category of sets, denoted as Set, is the Category theory whose Category theory are all Set and whose morphisms are all function s....
 of sets. Then as F we can take the free group
Free group

In mathematics, a group G is called free if there is a subset S of G such that any element of G can be written in one and only one way as a product of finitely many elements of S and their inverses ....
 functor.

This means that the monad

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

by including any set X in Free(X) in the natural way, as strings of length 1. Further,

can be made out of a natural concatenation
Concatenation

In computer programming, string concatenation is the operation of joining two character string end to end. For example, the strings "snow" and "ball" may be concatenated to give "snowball"....
 of 'strings of strings'. This amounts to two natural transformation
Natural transformation

In category theory, a branch of mathematics, a natural transformation provides a way of transforming one functor into another while respecting the internal structure of the categories involved....
s

and

They will satisfy some axioms about identity and associativity
Associativity

In mathematics, associativity is a property that a binary operation can have. It means that, within an expression containing two or more of the same associative operators in a row, the order that the operations are performed does not matter as long as the sequence of the operands is not changed....
 that result from the adjunction properties.

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 set
Partially ordered set

In mathematics, especially order theory, a partially ordered set formalizes the intuitive concept of an ordering, sequencing, or arrangement of the elements of a Set ....
s (P, =) (with a single morphism from x to y iff
IFF

IFF, Iff or iff can stand for:* Identification Friend or Foe, an electronic radio-based identification system utilizing transponders...
 x = y), then the formalism becomes much simpler: adjoint pairs are Galois connection
Galois connection

In mathematics, especially in order theory, a Galois connection is a particular correspondence between two partially ordered sets . Galois connections generalize the correspondence between subgroups and field investigated in Galois theory....
s and monads are closure operator
Closure operator

A closure operator on a set S is a function cl: P ? P from the power set of S to itself which satisfies the following conditions for all sets X,Y ? S....
s.

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 of 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
Universal algebra

Universal algebra is the field of mathematics that studies algebraic structures themselves, not examples of algebraic structures.For instance, rather than take particular groups as the object of study, in universal algebra one takes "the theory of groups" as an object of study....
. 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 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
Beck's monadicity theorem

In category theory, a branch of mathematics, Beck's monadicity theorem asserts that a functoris monadic functor if and only if# U has a left adjoint functors;...
, which gives a criterion for monadicity, can be used to show that an arbitrary adjunction can be treated as a category of algebras in this way.

The language of monads belongs to the school of Mac Lane, and members of the school of Grothendieck often only work with adjoint functors, not mentioning monads directly.

Formal definition


If C is a category
Category theory

In mathematics, category theory deals in an abstract way with mathematical structures and relationships between them: it abstracts from set s and function s to objects linked in diagrams by morphisms or arrows....
, a monad on C consists of a functor T : C ? C together with two natural transformation
Natural transformation

In category theory, a branch of mathematics, a natural transformation provides a way of transforming one functor into another while respecting the internal structure of the categories involved....
s: ? : 1C ? T (where 1C denotes the identity functor on C) and µ : T2 ? T (where T2 is the functor T o T from C to C). These are required to fulfill the following conditions (sometimes called coherence condition
Coherence condition

In mathematics, a coherence condition or coherence theorem expresses the statement that two or more morphisms between two given objects, the existence of which is given or follows from general properties, are equal....
s):
  • µ o Tµ = µ o µT (as natural transformations T3 ? T);
  • µ o T? = µ o ?T = 1T (as natural transformations T ? T; here 1T denotes the identity transformation from T to T).


With commutative diagrams:
Monad Mult
            


See the article on natural transformation
Natural transformation

In category theory, a branch of mathematics, a natural transformation provides a way of transforming one functor into another while respecting the internal structure of the categories involved....
s for the explanation of the notations Tµ and µT, or see below the commutative diagrams not using these notions:

            


The first axiom is akin to the associativity
Associativity

In mathematics, associativity is a property that a binary operation can have. It means that, within an expression containing two or more of the same associative operators in a row, the order that the operations are performed does not matter as long as the sequence of the operands is not changed....
 in monoids
Monoid (category theory)

In category theory, a monoid in a monoidal category C is an object M together with two morphism* called multiplication,* and called unit,...
, the second axiom to the existence of an identity element
Identity element

In mathematics, an identity element is a special type of element of a Set with respect to a binary operation on that set. It leaves other elements unchanged when combined with them....
. Indeed, a monad on C can alternatively be defined as a monoid
Monoid (category theory)

In category theory, a monoid in a monoidal category C is an object M together with two morphism* called multiplication,* and called unit,...
 in the category EndC whose objects are the endofunctors of C and whose morphisms are the natural transformation
Natural transformation

In category theory, a branch of mathematics, a natural transformation provides a way of transforming one functor into another while respecting the internal structure of the categories involved....
s between them, with the monoidal structure
Monoidal category

In mathematics, a monoidal category is a category C equipped with a bifunctorwhich is associative , and an object I which is both a left identity and right identity for ?, ....
 induced by the composition of endofunctors.

Comonads and their importance


The categorical dual
Dual (category theory)

In category theory, a branch of mathematics, duality is a correspondence between properties of a category C and so-called dual properties of the opposite category Cop....
 definition is a formal definition of a comonad (or cotriple); this can be said quickly in the terms that a comonad for a category C is a monad for the opposite category
Opposite category

In category theory, a branch of mathematics, the opposite category or dual category Cop of a given category C is formed by reversing the morphisms, i.e....
 Cop. It is therefore a functor U from C to itself, with a set of axioms for counit and comultiplication that come from reversing the arrows everywhere in the definition just given.

Since a comonoid is not a basic structure in abstract algebra
Abstract algebra

Abstract algebra is the subject area of mathematics that studies algebraic structures, such as group , ring , field , module , vector spaces, and algebra over a field....
, this is less familiar at an immediate level.

The importance of the definition comes in a class of theorems from the categorical (and algebraic geometry
Algebraic geometry

Algebraic geometry is a branch of mathematics which, as the name suggests, combines techniques of abstract algebra, especially commutative algebra, with the language and the problems of geometry....
) theory of descent
Descent (category theory)

In mathematics, the idea of descent has come to stand for a very general idea, extending the intuitive idea of 'gluing' in topology. Since the topologists' glue is actually the use of equivalence relations on topological spaces, the theory starts with some ideas on identification....
. 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 imposition of the equivalence relation
Equivalence relation

In mathematics, an equivalence relation is, loosely, a binary relation on a Set that specifies how to split up the set into subsets such that every element of the larger set is in exactly one of the subsets....
 'in the same fiber
Fiber

Fiber or fibre is a class of materials that are continuous filaments or are in discrete elongated pieces, similar to lengths of yarn. They are very important in the biology of both plants and animals, for holding tissue s together....
', for geometric morphisms what you should do is pass to such a coalgebra subcategory.

Examples


The most important examples to think about when hearing the term "monad" are the free group example mentioned above, and closure operator
Closure operator

A closure operator on a set S is a function cl: P ? P from the power set of S to itself which satisfies the following conditions for all sets X,Y ? S....
s. Another example, on the category Set: for a set A let T(A) be the power set
Power set

In mathematics, given a Set S, the power set of S, written , P, ℘ or Power set#Representing subsets as functions, is the set of all subsets of S....
 of A and for a function f : A ? B let T(f) be the function between the power sets induced by taking direct images under f. For every set A, we have a map ?A : A ? T(A), which assigns to every element a of A the singleton
Singleton (mathematics)

In mathematics, a singleton is a Set with unique element. For example, the set is a singleton....
 . A function

μA : T(T(A)) → T(A)


can be given as follows: if L is a set whose elements are subsets of A, then taking the union
Union (set theory)

In set theory, the term Union refers to a set operation used in the convergence of set elements to form a resultant set containing the elements of both sets....
 of these subsets gives a subset ?A(L) of A. These data describe a monad.

Algebras for a monad

Suppose that is a given monad on a category C.

A T-algebra is an object x of C together with an arrow of C called the structure map of the algebra such that the diagrams
Monad Alg Mult
 and 
Monad Alg Unit
commute.

A morphism of
T-algebras is an arrow of C such that the diagram
Monad Alg Morph
commutes.

The category of
T-algebras and their morphisms is called the
Eilenberg-Moore category or category of (Eilenberg-Moore) algebras of the monad T.

Given the monad
T, there exists another "canonical" category called the
Kleisli category of the monad T. Its objects are the objects of C and its arrows from x to y are the arrows in C. The identity on an object x is the unit , and the composite of two arrows and is given by . This category is equivalent to the category of free algebras for the monad T, i. e. the full subcategory of whose objects are of the form , for x an object of C. The Kleisli category is named for mathematician Heinrich Kleisli
Heinrich Kleisli

Heinrich Kleisli was a mathematician. He is the namesake of several constructions in category theory, including the Kleisli category and Kleisli triples....
.

Monads and adjunctions


An adjunction between two categories
C and D (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
C. 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
C and D is a
monadic adjunction when the category D is equivalent
Equivalence of categories

In category theory, an abstract branch of mathematics, an equivalence of categories is a relation between two categories that establishes that these categories are "essentially the same"....
 to the Eilenberg-Moore category for the monad . By extension, a functor is said to be
monadic if it has a left adjoint F forming a monadic adjunction. Beck's monadicity theorem
Beck's monadicity theorem

In category theory, a branch of mathematics, Beck's monadicity theorem asserts that a functoris monadic functor if and only if# U has a left adjoint functors;...
 gives a characterization of monadic functors.

Uses


Monads are used in functional programming
Functional programming

In computer science, functional programming is a programming paradigm that treats computation as the evaluation of function s and avoids program state and immutable object data....
 to express types of sequential computation (sometimes with side-effects). See monads in functional programming
Monads in functional programming

In functional programming, a monad is a kind of abstract data type used to represent computations . Programs written in functional style can make use of monads to structure procedures that include sequenced operations, or to define arbitrary control flows ....
, 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
Modal logic

A modal logic is any system of mathematical logic#Formal logic that attempts to deal with notions of possibility and necessity. Traditionally, there are three "modes" or "moods" or "modalities" of the Copula to be, namely, Logical possibility, probability, and Necessary_and_sufficient_conditions#Necessary_conditions....
.

Generalization

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

See also


  • Distributive law between monads
    Distributive law between monads

    In category theory, an abstract branch of mathematics, distributive laws between monads are a way to express abstractly that two algebraic structures distribute one over the other one....
  • Strong monad
    Strong monad

    In category theory, a strong monad over a monoidal category is a monad together with a natural transformation , called strength, such that the diagramsandcommute for every object , and ....
  • Monad
    Monad

    Monad may refer to:In philosophy:*Monad a term used by ancient philosophers Pythagoras, Parmenides, Xenophanes, Plato, Aristotle, and Plotinus as a term for God or the first being, or the totality of all being....
     for other meanings of the term.


External links

  • Five short lectures (with one appendix).
  • John Baez's covers monads in 2-categories.