Monad (category theory)

Monad (category theory)

In category theory, a branch of mathematics, a monad, Kleisli triple, or triple is an (endo-)functor, 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.

The notion of "algebras for a monad" generalizes classical notions from universal algebra, and in this sense, monads can be thought of as "theories".

Contents

Introduction

If F and G are a pair of adjoint functors, with F left adjoint to G, then the composition G \circ F is a monad. Therefore, a monad is an endofunctor. If F and G 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 F \circ G, 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 of groups to the category Set of sets. Then as F we can take the free group functor.

This means that the monad

T = G \circ F

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

X \rightarrow T(X)

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

T(T(X)) \rightarrow T(X)

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

I \rightarrow T

and

T \circ T \rightarrow T

They will satisfy some axioms about identity and associativity 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 sets (P, \le) (with a single morphism from x to y iff x \le y), 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 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. 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, 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 notion of monad was invented by Godement in 1958 under the name standard construction. In the 1960s and 1970s, many people used the name triple. The term "monad", which is now standard, is due to Mac Lane.

Formal definition

If C is a category, a monad on C consists of a functor T \colon C \to C together with two natural transformations: \eta \colon 1_{C} \to T (where 1C denotes the identity functor on C) and \mu \colon T^{2} \to T (where T2 is the functor T \circ T from C to C). These are required to fulfill the following conditions (sometimes called coherence conditions):

  • \mu \circ T\mu = \mu \circ \mu T (as natural transformations T^{3} \to T);
  • \mu \circ T \eta = \mu \circ \eta T = 1_{T} (as natural transformations T \to T; here 1T denotes the identity transformation from T to T).

We can rewrite these conditions using following commutative diagrams:

Monad mult.png
            
Monad unit1.png

See the article on natural transformations for the explanation of the notations Tμ and μT, 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, the second axiom to the existence of an identity element. Indeed, a monad on C can alternatively be defined as a monoid in the category \mathbf{End}_{C} whose objects are the endofunctors of C and whose morphisms are the natural transformations between them, with the monoidal structure induced by the composition of endofunctors.

Comonads and their importance

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 C is a monad for the opposite category 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, 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) 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 imposition of the equivalence relation 'in the same fiber', for geometric morphisms what you should do is pass to such a coalgebra subcategory.

Examples

The rich set of examples is given by adjunctions (see "Monads_and_adjunctions"), and the free group example mentioned above belongs to that set. Another example, on the category \mathbf{Set}: for a set A let T(A) be the power set of A and for a function f \colon A \to 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 \eta_{A} \colon A \to T(A), which assigns to every a\in A the singleton {a}. The function

\mu_{A} \colon T(T(A)) \to T(A)

in fact is union (arbitrary union, not finitary union). These data describe a monad.

Closure operators are monads on preorder categories.

Algebras for a monad

Suppose that (T,η,μ) is a given monad on a category C.

A T-algebra (x,h) is an object x of C together with an arrow h\colon Tx\to x of C called the structure map of the algebra such that the diagrams

Monad alg mult.png and Monad alg unit.png

commute.

A morphism f\colon (x,h)\to(x',h') of T-algebras is an arrow f\colon x\to x' of C such that the diagram

Monad alg morph.png

commutes.

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

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

Monads and adjunctions

An adjunction (F,G,η,ε) between two categories C and D (where F\colon C\to D is left adjoint to G\colon D\to C and η and ε are respectively the unit and the counit) always defines a monad (GF,η,GεF).

Conversely, it is interesting to consider the adjunctions which define a given monad (T,η,μ) this way. Let \mathbf{Adj}(C,T) be the category whose objects are the adjunctions (F,G,e,ε) such that (GF,e,GεF) = (T,η,μ) and whose arrows are the morphisms of adjunctions which are the identity on C. Then this category has

  • an initial object (F_T, G_T, \eta, \mu_T):C\to C_T, where CT is the Kleisli category,
  • a terminal object (F^T, G^T, \eta, \mu^T):C\to C^T, where CT is the Eilenberg-Moore category.

An adjunction (F,G,η,ε) between two categories C and D is a monadic adjunction when the category D is equivalent to the Eilenberg-Moore category CT for the monad T = GF. By extension, a functor G\colon D\to C is said to be monadic if it has a left adjoint F forming a monadic adjunction. Beck's monadicity theorem gives a characterization of monadic functors.

Uses

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.

Generalization

It is possible to define monads in a 2-category C. Monads described above are monads for C = \mathbf{Cat}.

See also

References

  • Daniele Turi: Category Theory Lecture Notes (1996-2001), based on MacLane's book "Categories for the Working Mathematician"
  • Michael Barr and Charles Wells: Category Theory Lecture Notes (1999), based on their book "Category Theory for Computing Science"
  • Roger Godement: Topologie Algébrique et Théorie des Faisceaux. Actualités Sci. Ind. No. 1252. Publ. Math. Univ. Strasbourg. No. 13 Hermann, Paris 1958 viii+283 pp.

External links


Wikimedia Foundation. 2010.

Игры ⚽ Поможем написать реферат

Look at other dictionaries:

  • Outline of category theory — The following outline is provided as an overview of and guide to category theory: Category theory – area of study in mathematics that examines in an abstract way the properties of particular mathematical concepts, by formalising them as… …   Wikipedia

  • List of category theory topics — This is a list of category theory topics, by Wikipedia page. Specific categories *Category of sets **Concrete category *Category of vector spaces **Category of graded vector spaces *Category of finite dimensional Hilbert spaces *Category of sets… …   Wikipedia

  • Monoid (category theory) — In category theory, a monoid (or monoid object) (M,μ,η) in a monoidal category is an object M together with two morphisms called multiplication, and called unit, such that the diagrams and …   Wikipedia

  • Monad — may refer to: Contents 1 Philosophy 2 Mathematics and computer science 3 Music 4 Biology 5 …   Wikipedia

  • Monad — Cette page d’homonymie répertorie les différents sujets et articles partageant un même nom. Pour le mot anglais Monad, voir Monade Monad est aussi le nom de code de Windows PowerShell Articles connexes (en) Monad (Gn …   Wikipédia en Français

  • Monad (functional programming) — In functional programming, a monad is a programming structure that represents computations. Monads are a kind of abstract data type constructor that encapsulate program logic instead of data in the domain model. A defined monad allows the… …   Wikipedia

  • Monad transformer — In functional programming, a monad transformer is a type constructor which takes a monad as an argument and returns a monad as a result. Monad transformers can be used to compose features encapsulated by monads such as state, exception handling,… …   Wikipedia

  • Category of relations — In mathematics, the category Rel has the class of sets as objects and binary relations as morphisms.A morphism (or arrow) R : A → B in this category is a relation between the sets A and B , so nowrap| R ⊆ A × B .The composition of two relations R …   Wikipedia

  • Strong monad — In category theory, a strong monad over a monoidal category is a monad (T,η,μ) together with a natural transformation , called (tensorial) strength, such that the diagrams …   Wikipedia

  • Monoidal monad — In category theory, a monoidal monad (T,η,μ,m) is a monad (T,η,μ) on a monoidal category such that the functor is a lax monoidal functor with and as coherence maps, and the natu …   Wikipedia

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”