Monad (category theory)

from Wikipedia, the free encyclopedia

In the mathematical branch of category theory, a monad is a structure that has a certain formal similarity to the monoids of algebra .

definition

A monad is a triple of

  • a functor T of category K in itself, d. H.
  • a natural transformation (where stands for the identity function )
  • a natural transformation (where stands for ),

so that the following conditions are met:

  • , d. H. the following diagram commutates :
Monad multiplication.svg
  • , d. H. the following diagram commutates:
Monad unit.svg

Explicitly means the commutativity of the diagrams that for each object in the two diagrams

Monad multiplication explicit.svg and Monad unit explicit.svg

commute. The first condition is analogous to the associative law for monoids, the second to the existence of a neutral element.

Algebras

If a monad, then a pair is an (Eilenberg-Moore) algebra for this monad, if

  • and

be valid. A homomorphism from to is an arrow in with .

For any objects from z. B. an algebra, and is a homomorphism from to .

Examples

Dcpos

The endofunctor on the category of the partially ordered sets and monotonous mappings assign to each the partially ordered set of the order ideals in . Its effect on monotone pictures is . For a partially ordered set and a subset , here is .

The illustration families and complete the functor to a monad.

The structure mapping of an algebra is now straight . Every ideal in (and thus every directed subset ) has a supremum in . That is, an algebra is the same as a Dcpo . A homomorphism of algebras is a Scott continuous map.

Adjoint functors

Is a functor left adjoint to a functor , and are

or.

Unity or co-unity of the adjunction, so is with

  • so for objects

a monad.

This is already the only example, as each monad arises in a certain sense in this way, at least up to isomorphism: The triples with , , and are objects of a category . In this category, a morphism from to is a functor for which and hold.

Beginning object is , where the Kleisli category to be. , for is . , for is .

End object in is where the Eilenberg-Moore algebras category is closed. , for is . , .

Lists

An example of a monad are lists. If the list is labeled with the elements to , then the following triple represents a monad above the category of sets :

  1. List functor:
    • At the object level, results in the set of all lists, the elements of which come from , for any set .
    • For a mapping between two sets, the corresponding mapping between the list sets results in
  2. Constructor for single-element lists :
  3. Concatenation of lists :so- this is in a way the (single-stage) flat knock a list of lists.

The statements of the axioms can be transferred accordingly to the list example:

  1. If the axiom applied to the example, the result for a lot at first . Transferred to the list of example arises for also , d. This means that in the case of lists that are nested several times, it does not matter whether they are knocked flat from the inside or the outside, which is obviously the case with lists.
  2. The second axiom says in this example that when adding a list level, it does not matter whether it happens inside or outside, as long as it is tapped flat afterwards - it is .

This monad belongs to an adjoint functor pair (as above) between the categories of sets or semigroups . assigns the free semigroup above this set to a set, and the underlying set to a semigroup.

application

Monads are used in computer science, especially in functional programming languages and the like. a. used for abstraction of side effects. It is Haskell highlight where monads to integrate input and output are used in the otherwise completely of side effects-free language. See also Monad (computer science) .

literature

  • Saunders Mac Lane, Categories for the Working Mathematician . Springer-Verlag, Berlin 1971. ISBN 3-540-90035-7

Web links