Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Monad (category theory)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
{{Short description|Operation in algebra and mathematics}} {{distinguish|Monad (homological algebra)}} {{for|the uses of monads in computer software|monads in functional programming}} In [[category theory]], a branch of [[mathematics]], a '''monad''' is a triple <math>(T, \eta, \mu)</math> consisting of a [[functor]] ''T'' from a category to itself and two [[natural transformation]]s <math>\eta, \mu</math> that satisfy the conditions like associativity. For example, if <math>F, G</math> are functors [[adjoint functor|adjoint]] to each other, then <math>T = G \circ F</math> together with <math>\eta, \mu</math> determined by the adjoint relation is a monad. In concise terms, a monad is a [[Monoid (category theory)|monoid]] in the [[Category (mathematics)|category]] of [[endofunctor]]s of some fixed category (an endofunctor is a [[functor]] mapping a category to itself). According to [[John C. Baez|John Baez]], a monad can be considered at least in two ways: <ref name="Baez"> https://golem.ph.utexas.edu/category/2009/07/the_monads_hurt_my_head_but_no.html</ref> # A monad as a generalized monoid; this is clear since a monad is a monoid in a certain category, # A monad as a tool for studying [[Algebraic gadget|algebraic gadgets]]; for example, a [[group (mathematics)|group]] can be described by a certain monad. Monads are used in the theory of pairs of [[adjoint functors]], and they generalize [[closure operator]]s on [[partially ordered set]]s to arbitrary categories. Monads are also useful in the [[Type theory|theory of datatypes]], the [[denotational semantics]] of [[Imperative programming language|imperative programming languages]], and in [[functional programming language]]s, allowing languages without mutable state to do things such as simulate [[for-loop]]s; see [[Monad (functional programming)]]. A monad is also called, especially in old literature, a '''triple''', '''triad''', '''standard construction''' and '''fundamental construction'''.<ref>{{citation|url=http://www.tac.mta.ca/tac/reprints/articles/12/tr12.pdf | title=Toposes, Triples and Theories | year=1985 | first1=Michael | last1=Barr | first2=Charles | last2= Wells | publisher=Springer-Verlag | isbn=0-387-96115-1 | volume=278 | work= Grundlehren der mathematischen Wissenschaften |pages=82 and 120 |postscript=.}}</ref> == Introduction and definition == {{quote box |align =right |width =33% |quote = We had some time to talk, and during the course of it I realized I’d become less scared of certain topics involving monads. Monads seem to bother a lot of people. There’s even a YouTube video called The Monads Hurt My Head! ... Shortly thereafter, the woman speaking exclaims: What the heck?! How do you even explain what a monad is? |author = John Baez |source = <ref name="Baez" /> }} A monad is a certain type of [[endofunctor]]. For example, if <math>F</math> and <math>G</math> are a pair of [[adjoint functors]], with <math>F</math> left adjoint to <math>G</math>, then the composition <math>G \circ F</math> is a monad. If <math>F</math> and <math>G</math> are inverse to each other, the corresponding monad is the [[identity functor]]. In general, adjunctions are not [[equivalence of categories|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 <math>F \circ G</math>, is discussed under the dual theory of ''comonads''. ===Formal definition=== Throughout this article, <math>C</math> denotes a [[category (mathematics)|category]]. A ''monad'' on <math>C</math> consists of an endofunctor <math>T \colon C \to C</math> together with two [[natural transformation]]s: <math>\eta \colon 1_{C} \to T</math> (where <math>1_{C}</math> denotes the identity functor on <math>C</math>) and <math>\mu \colon T^{2} \to T</math> (where <math>T^{2}</math> is the functor <math>T \circ T</math> from <math>C</math> to <math>C</math>). These are required to fulfill the following conditions (sometimes called [[coherence condition]]s): * <math>\mu \circ T\mu = \mu \circ \mu T</math> (as natural transformations <math>T^{3} \to T</math>); here <math>T\mu</math> and <math>\mu T</math> are formed by "[[Natural transformation#Operations with natural transformations|horizontal composition]]". * <math>\mu \circ T \eta = \mu \circ \eta T = 1_{T}</math> (as natural transformations <math>T \to T</math>; here <math>1_{T}</math> denotes the identity transformation from <math>T</math> to <math>T</math>). We can rewrite these conditions using the following [[commutative diagrams]]: {|style="margin:1em auto;" | [[Image:Coherence law for the multiplication of a monad.svg|center|150px|class=skin-invert]] | {{spaces|12}} | [[Image:Coherence law for the unit of a monad.svg|center|150px|class=skin-invert]] |} See the article on [[natural transformation#Operations with natural transformations|natural transformations]] for the explanation of the notations <math>T\mu</math> and <math>\mu T</math>, or see below the commutative diagrams not using these notions: {|style="margin:1em auto;" | [[Image:Monad multiplication explicit.svg|class=skin-invert]] | {{spaces|12}} | [[Image:Monad unit explicit.svg|class=skin-invert]] |} The first axiom is akin to the [[associativity]] in [[monoid (category theory)|monoids]] if we think of <math>\mu</math> 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 <math>\eta</math>). Indeed, a monad on <math>C</math> can alternatively be defined as a [[monoid (category theory)|monoid]] in the category <math>\mathbf{End}_{C}</math> whose objects are the endofunctors of <math>C</math> and whose morphisms are the natural transformations between them, with the [[monoidal category|monoidal structure]] induced by the composition of endofunctors. ===The power set monad=== The ''power set monad'' is a monad <math>\mathcal{P}</math> on the category <math>\mathbf{Set}</math>: For a set <math>A</math> let <math>T(A)</math> be the [[power set]] of <math>A</math> and for a function <math>f \colon A \to B</math> let <math>T(f)</math> be the function between the power sets induced by taking [[Image (mathematics)|direct images]] under <math>f</math>. For every set <math>A</math>, we have a map <math>\eta_{A} \colon A \to T(A)</math>, which assigns to every <math>a\in A</math> the [[singleton (mathematics)|singleton]] <math>\{a\}</math>. The function :<math>\mu_{A} \colon T(T(A)) \to T(A)</math> takes a set of sets to its [[Union (set theory)|union]]. These data describe a monad. ===Remarks=== The axioms of a monad are formally similar to the [[monoid]] axioms. In fact, monads are special cases of monoids, namely they are precisely the monoids among [[endofunctor]]s <math>\operatorname{End}(C)</math>, which is equipped with the multiplication given by composition of endofunctors. Composition of monads is not, in general, a monad. For example, the double power set functor <math>\mathcal{P} \circ \mathcal{P}</math> does not admit any monad structure.<ref>{{Citation|doi= 10.1016/j.entcs.2018.11.013| last1=Klin| last2=Salamanca| title= Iterated Covariant Powerset is not a Monad| journal=[[Electronic Notes in Theoretical Computer Science]]| year=2018| volume=341| pages=261–276| doi-access=free}}</ref> === Comonads === The [[Dual (category theory)|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 <math>C</math> is a monad for the [[opposite category]] <math>C^{\mathrm{op}}</math>. It is therefore a functor <math>U</math> from <math>C</math> 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 ''[[comonoid]]s''. 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 [[coalgebra]]s. ===Terminological history=== The notion of monad was invented by [[Roger Godement]] in 1958 under the name "standard construction". Monad has been called "dual standard construction", "triple", "monoid" and "triad".{{Sfn|MacLane|1978|p=138}} The term "monad" is used at latest 1967, by [[Jean Bénabou]].<ref>{{Cite book |last=Bénabou |first=Jean |title=Reports of the Midwest Category Seminar |chapter=Introduction to bicategories |date=1967 |editor-last=Bénabou |editor-first=J. |editor2-last=Davis |editor2-first=R. |editor3-last=Dold |editor3-first=A. |editor4-last=Isbell |editor4-first=J. |editor5-last=MacLane |editor5-first=S. |editor6-last=Oberst |editor6-first=U. |editor7-last=Roos |editor7-first=J. -E. |chapter-url=https://link.springer.com/chapter/10.1007/BFb0074299 |series=Lecture Notes in Mathematics |volume=47 |language=en |location=Berlin, Heidelberg |publisher=Springer |pages=1–77 |doi=10.1007/BFb0074299 |isbn=978-3-540-35545-8}}</ref><ref>{{Cite web |date=2009-04-04 |title=RE: Monads |url=http://article.gmane.org/gmane.science.mathematics.categories/225/ |url-status=dead |archive-url=https://web.archive.org/web/20150326175332/http://article.gmane.org/gmane.science.mathematics.categories/225/match= |archive-date=2015-03-26 |website=[[Gmane]]}}</ref> ==Examples== ===Identity=== The [[identity functor]] on a category <math>C</math> is a monad. Its multiplication and unit are the [[identity function]] on the objects of <math>C</math>. ===Monads arising from adjunctions=== Any [[adjunction (category theory)|adjunction]] :<math>F: C \rightleftarrows D : G</math> gives rise to a monad on ''C''. This very widespread construction works as follows: the endofunctor is the composite :<math>T = G \circ F.</math> This endofunctor is quickly seen to be a monad, where the unit map stems from the unit map <math>\operatorname{id}_C \to G \circ F</math> of the adjunction, and the multiplication map is constructed using the counit map of the adjunction: :<math>T^2 = G \circ F \circ G \circ F \xrightarrow{G \circ \text{counit} \circ F} G \circ F = T.</math> In fact, '''any monad can be found as an explicit adjunction of functors''' using the [[Eilenberg–Moore category]] <math>C^T</math> (the category of <math>T</math>-algebras).<ref>{{Cite web|last=Riehl|first=Emily|author-link=Emily Riehl|title=Category Theory in Context |url=https://math.jhu.edu/%7Eeriehl/context.pdf|url-status=live|archive-url=https://web.archive.org/web/20210405153806/https://math.jhu.edu/%7Eeriehl/context.pdf|archive-date=5 Apr 2021|page=162}}</ref> ====Double dualization==== The ''double dualization monad'', for a fixed [[field (mathematics)|field]] ''k'' arises from the adjunction :<math>(-)^* : \mathbf{Vect}_k \rightleftarrows \mathbf{Vect}_k^{op} : (-)^*</math> where both functors are given by sending a [[vector space]] ''V'' to its [[dual vector space]] <math>V^* := \operatorname{Hom}(V, k)</math>. The associated monad sends a vector space ''V'' to its [[double dual]] <math>V^{**}</math>. This monad is discussed, in much greater generality, by {{harvtxt|Kock|1970}}. ====Closure operators on partially ordered sets==== For categories arising from [[partially ordered set]]s <math>(P, \le)</math> (with a single morphism from <math>x</math> to <math>y</math> [[if and only if]] <math>x \le y</math>), then the formalism becomes much simpler: adjoint pairs are [[Galois connection]]s and monads are [[closure operator#Closure operators on partially ordered sets|closure operators]]. ====Free-forgetful adjunctions==== For example, let <math>G</math> be the [[forgetful functor]] from [[category of groups|the category '''Grp''']] of [[group (mathematics)|groups]] to the [[category of sets|category '''Set''']] of sets, and let <math>F</math> be the [[free group]] functor from the category of sets to the category of groups. Then <math>F</math> is left adjoint of <math>G</math>. In this case, the associated monad <math>T = G \circ F</math> takes a set <math>X</math> and returns the underlying set of the free group <math>\mathrm{Free}(X)</math>. The unit map of this monad is given by the maps :<math>X \to T(X) </math> including any set <math>X</math> into the set <math>\mathrm{Free}(X)</math> in the natural way, as strings of length 1. Further, the multiplication of this monad is the map :<math>T(T(X)) \to T(X) </math> made out of a natural [[concatenation]] or 'flattening' of 'strings of strings'. This amounts to two [[natural transformation]]s. The preceding example about free groups 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. Another monad arising from an adjunction is when <math>T</math> is the endofunctor on the category of vector spaces which maps a vector space <math>V</math> to its [[tensor algebra]] <math>T(V)</math>, and which maps linear maps to their tensor product. We then have a natural transformation corresponding to the embedding of <math>V</math> into its [[tensor algebra]], and a natural transformation corresponding to the map from <math>T(T(V))</math> to <math>T(V)</math> obtained by simply expanding all tensor products. ===Codensity monads=== Under mild conditions, functors not admitting a left adjoint also give rise to a monad, the so-called [[codensity monad]]. For example, the inclusion :<math>\mathbf{FinSet} \subset \mathbf{Set}</math> does not admit a left adjoint. Its codensity monad is the monad on sets sending any set ''X'' to the set of [[ultrafilter]]s on ''X''. This and similar examples are discussed in {{harvtxt|Leinster|2013}}. ===Monads used in denotational semantics=== {{See also|Monad (functional programming)}} The following monads over the category of sets are used in [[denotational semantics]] of [[Imperative programming language|imperative programming languages]], and analogous constructions are used in functional programming. ====The maybe monad==== The endofunctor of the '''maybe''' or '''partiality''' monad adds a disjoint point:{{sfn|Riehl|2017|p=155}} :<math>(-)_{*}: \mathbf{Set}\to\mathbf{Set}</math> :<math>X\mapsto X\cup\{*\}</math> The unit is given by the inclusion of a set <math>X</math> into <math>X_*</math>: :<math>\eta_X: X\to X_{*}</math> :<math>x\mapsto x</math> The multiplication maps elements of <math>X</math> to themselves, and the two disjoint points in <math>(X_{*})_{*}</math> to the one in <math>X_{*}</math>. In both functional programming and denotational semantics, the maybe monad models [[Partial function|partial computations]], that is, computations that may fail. ====The state monad==== {{Expand section|date=February 2023|with=describe multiplication}} Given a set <math>S</math>, the endofunctor of the '''state monad''' maps each set <math>X</math> to the set of functions <math>S\to S \times X</math>. The component of the unit at <math>X</math> maps each element <math>x\in X</math> to the function :<math>\eta_X(x): S\to S\times X</math> :<math>s\mapsto (s, x)</math> The multiplication maps the function <math>f: S\to S\times (S\to S\times X), s\mapsto (s',f')</math> to the function :<math>\mu_X(f): S\to S\times X</math> :<math>s\mapsto f'(s')</math> In functional programming and denotational semantics, the state monad models [[State (computer science)|stateful computations]]. ====The environment monad==== {{Expand section|date=February 2023|with=describe multiplication}} Given a set <math>E</math>, the endofunctor of the '''reader''' or '''environment monad''' maps each set <math>X</math> to the set of functions <math>E\to X</math>. Thus, the endofunctor of this monad is exactly the [[hom functor]] <math>\mathrm{Hom}(E, -)</math>. The component of the unit at <math>X</math> maps each element <math>x\in X</math> to the [[constant function]] <math>e\mapsto x</math>. In functional programming and denotational semantics, the environment monad models computations with access to some read-only data. ====The list and set monads==== {{Expand section|date=February 2023|with=describe multiplication}} The '''list''' or '''nondeterminism monad''' maps a set ''X'' to the set of finite [[Sequence|sequences]] (i.e., [[List (abstract data type)|lists]]) with elements from ''X''. The unit maps an element ''x'' in ''X'' to the singleton list [x]. The multiplication concatenates a list of lists into a single list. In functional programming, the list monad is used to model [[Nondeterministic model of computation|nondeterministic computations]]. The covariant powerset monad is also known as the '''set monad''', and is also used to model nondeterministic computation. == Algebras for a monad == {{see also|F-algebra|pseudoalgebra}} Given a monad <math>(T,\eta,\mu)</math> on a category <math>C</math>, it is natural to consider ''<math>T</math>-algebras'', i.e., objects of <math>C</math> acted upon by <math>T</math> in a way which is compatible with the unit and multiplication of the monad. More formally, a <math>T</math>-algebra <math>(x,h)</math> is an object <math>x</math> of <math>C</math> together with an arrow <math>h\colon Tx\to x</math> of <math>C</math> called the ''structure map'' of the algebra such that the diagrams {| align="center" |- |[[Image:Monad_multi_algebra.svg|class=skin-invert]] | width="20" | |and | width="20" | |[[Image:Monad_unit_algebra.svg|class=skin-invert]] |} commute. A morphism <math>f\colon (x,h)\to(x',h')</math> of <math>T</math>-algebras is an arrow <math>f\colon x\to x'</math> of <math>C</math> such that the diagram [[Image:Monad_morphism_algebra.svg|center]] commutes. <math>T</math>-algebras form a category called the ''Eilenberg–Moore category'' and denoted by <math>C^T</math>. === Examples === ==== Algebras over the free group monad ==== For example, for the free group monad discussed above, a <math>T</math>-algebra is a set <math>X</math> together with a map from the free group generated by <math>X</math> towards <math>X</math> subject to associativity and unitality conditions. Such a structure is equivalent to saying that <math>X</math> is a group itself. ==== Algebras over the distribution monad ==== Another example is the '''''distribution monad''''' <math>\mathcal{D}</math> on the category of sets. It is defined by sending a set <math>X</math> to the set of functions <math>f : X \to [0,1]</math> with finite support and such that their sum is equal to <math>1</math>. In set-builder notation, this is the set<math display="block">\mathcal{D}(X) = \left\{ f: X \to [0,1] : \begin{matrix} \#\text{supp}(f) < +\infty \\ \sum_{x \in X} f(x) = 1 \end{matrix} \right\}</math>By inspection of the definitions, it can be shown that algebras over the distribution monad are equivalent to [[convex set]]s, i.e., sets equipped with operations <math>x +_r y</math> for <math>r \in [0,1]</math> subject to axioms resembling the behavior of convex linear combinations <math>rx + (1-r)y</math> in Euclidean space.<ref>{{Citation |last=Świrszcz |first=T. |title=Monadic functors and convexity|journal=Bull. Acad. Polon. Sci. Sér. Sci. Math. Astron. Phys.|volume=22 |year=1974 |pages=39–42|mr=0390019}}, {{Citation|doi=10.1007/978-3-642-15240-5_1|chapter=Convexity, Duality and Effects|title=Theoretical Computer Science|volume=323 |pages=1–19|series=IFIP Advances in Information and Communication Technology|year=2010|last1=Jacobs|first1=Bart |isbn=978-3-642-15239-9 |doi-access=free}}</ref> ==== Algebras over the symmetric monad ==== Another useful example of a monad is the symmetric algebra functor on the category of <math>R</math>-modules for a commutative ring <math>R</math>.<math display="block">\text{Sym}^\bullet(-): \text{Mod}(R) \to \text{Mod}(R)</math>sending an <math>R</math>-module <math>M</math> to the direct sum of [[symmetric tensor]] powers<math display="block">\text{Sym}^\bullet(M) = \bigoplus_{k=0}^\infty \text{Sym}^k(M)</math>where <math>\text{Sym}^0(M) = R</math>. For example, <math>\text{Sym}^\bullet(R^{\oplus n}) \cong R[x_1,\ldots, x_n]</math> where the <math>R</math>-algebra on the right is considered as a module. Then, an algebra over this monad are commutative <math>R</math>-algebras. There are also algebras over the monads for the alternating tensors <math>\text{Alt}^\bullet(-)</math> and total tensor functors <math>T^\bullet(-)</math> giving anti-symmetric <math>R</math>-algebras, and free <math>R</math>-algebras, so<math display="block">\begin{align} \text{Alt}^\bullet(R^{\oplus n}) &= R(x_1,\ldots, x_n)\\ \text{T}^\bullet(R^{\oplus n}) &= R\langle x_1,\ldots, x_n \rangle \end{align}</math>where the first ring is the free anti-symmetric algebra over <math>R</math> in <math>n</math>-generators and the second ring is the free algebra over <math>R</math> in <math>n</math>-generators. ==== Commutative algebras in E-infinity ring spectra ==== There is an analogous construction for [[S-module|commutative <math>\mathbb{S}</math>-algebras]]<ref>{{Cite journal|date=1999-12-15|title=André–Quillen cohomology of commutative S-algebras|journal=[[Journal of Pure and Applied Algebra]]|language=en|volume=144| issue=2|pages=111–143| doi=10.1016/S0022-4049(98)00051-6|issn=0022-4049|doi-access=free|last1=Basterra |first1=M. }}</ref><sup>pg 113</sup> which gives commutative <math>A</math>-algebras for a commutative <math>\mathbb{S}</math>-algebra <math>A</math>. If <math>\mathcal{M}_A</math> is the category of <math>A</math>-modules, then the functor <math>\mathbb{P}: \mathcal{M}_A \to \mathcal{M}_A</math> is the monad given by<math display="block">\mathbb{P}(M) = \bigvee_{j \geq 0} M^j/\Sigma_j</math>where<math display="block">M^j = M\wedge_A \cdots \wedge_A M</math> <math>j</math>-times. Then there is an associated category <math>\mathcal{C}_A</math> of commutative <math>A</math>-algebras from the category of algebras over this monad. == Monads and adjunctions == As was mentioned above, any adjunction gives rise to a monad. Conversely, every monad arises from some adjunction, namely the free–forgetful adjunction :<math>T(-) : C \rightleftarrows C^T : \text{forget}</math> whose left adjoint sends an object ''X'' to the free ''T''-algebra ''T''(''X''). However, there are usually several distinct adjunctions giving rise to a monad: let <math>\mathbf{Adj}(C,T)</math> be the category whose objects are the adjunctions <math>(F,G,e,\varepsilon)</math> such that <math>(GF, e, G\varepsilon F)=(T,\eta,\mu)</math> and whose arrows are the morphisms of adjunctions that are the identity on <math>C</math>. Then the above free–forgetful adjunction involving the Eilenberg–Moore category <math>C^T</math> is a terminal object in <math>\mathbf{Adj}(C,T)</math>. An initial object is the [[Kleisli category]], which is by definition the full subcategory of <math>C^T</math> consisting only of free ''T''-algebras, i.e., ''T''-algebras of the form <math>T(x)</math> for some object ''x'' of ''C''. ===Monadic adjunctions=== Given any adjunction <math>(F : C \to D,G : D \to C,\eta,\varepsilon)</math> with associated monad ''T'', the functor ''G'' can be factored as :<math>D \overset{\widetilde{G}}\longrightarrow C^T \xrightarrow{\text{forget}} C,</math> i.e., ''G''(''Y'') can be naturally endowed with a ''T''-algebra structure for any ''Y'' in ''D''. The adjunction is called a '''monadic adjunction''' if the first functor <math>\tilde G</math> yields an [[equivalence of categories]] between ''D'' and the Eilenberg–Moore category <math>C^T</math>.<ref>{{harvtxt|MacLane|1978}} uses a stronger definition, where the two categories are isomorphic rather than equivalent.</ref> By extension, a functor <math>G\colon D\to C</math> is said to be '''monadic''' if it has a left adjoint {{mvar|F}} forming a monadic adjunction. For example, the free–forgetful adjunction between groups and sets is monadic, since algebras over the associated monad are groups, as was mentioned above. In general, knowing that an adjunction is monadic allows one to reconstruct objects in ''D'' out of objects in ''C'' and the ''T''-action. ===Beck's monadicity theorem=== ''[[Beck's monadicity theorem]]'' gives a necessary and sufficient condition for an adjunction to be monadic. A simplified version of this theorem states that ''G'' is monadic if it is [[conservative functor|conservative]] (or ''G'' reflects isomorphisms, i.e., a morphism in ''D'' is an isomorphism if and only if its image under ''G'' is an isomorphism in ''C'') and ''C'' has and ''G'' preserves [[coequalizer]]s. For example, the forgetful functor from the category of [[compact topological space|compact]] [[Hausdorff space]]s to sets is monadic. However the forgetful functor from all topological spaces to sets is not conservative since there are continuous bijective maps (between non-compact or non-Hausdorff spaces) that fail to be [[homeomorphisms]]. Thus, this forgetful functor is not monadic.<ref>{{harvtxt|MacLane|loc=§§VI.3, VI.9|1978}}</ref> The dual version of Beck's theorem, characterizing comonadic adjunctions, is relevant in different fields such as [[topos theory]] and topics in [[algebraic geometry]] related to [[descent (category theory)|descent]]. A first example of a comonadic adjunction is the adjunction :<math>- \otimes_A B : \mathbf{Mod}_A \rightleftarrows \mathbf{Mod}_B : \operatorname{forget}</math> for a ring homomorphism <math>A \to B</math> between commutative rings. This adjunction is comonadic, by Beck's theorem, if and only if ''B'' is [[Faithfully flat module|faithfully flat]] as an ''A''-module. It thus allows to descend ''B''-modules, equipped with a descent datum (i.e., an action of the comonad given by the adjunction) to ''A''-modules. The resulting theory of [[faithfully flat descent]] is widely applied in algebraic geometry. == 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]]. Monads are used in the [[denotational semantics]] of impure functional and [[Imperative programming|imperative programming languages]].<ref>{{Cite book |last=Wadler |first=Philip |title=Program Design Calculi |chapter=Monads for functional programming |date=1993 |editor-last=Broy |editor-first=Manfred |chapter-url=https://link.springer.com/chapter/10.1007/978-3-662-02880-3_8 |series=NATO ASI Series |volume=118 |language=en |location=Berlin, Heidelberg |publisher=Springer |pages=233–264 |doi=10.1007/978-3-662-02880-3_8 |isbn=978-3-662-02880-3}} "The concept of a monad, which arises from category theory, has been applied by Moggi to structure the denotational semantics of programming languages."</ref><ref>{{Cite journal |last=Mulry |first=Philip S. |date=1998-01-01 |title=Monads in Semantics |journal=Electronic Notes in Theoretical Computer Science |series=US-Brazil Joint Workshops on the Formal Foundations of Software Systems |language=en |volume=14 |pages=275–286 |doi=10.1016/S1571-0661(05)80241-5 |issn=1571-0661|doi-access=free }}</ref> In categorical logic, an analogy has been drawn between the monad-comonad theory, and [[modal logic]] via [[closure operator]]s, [[interior algebra]]s, and their relation to [[Mathematical model|models]] of [[S4 algebra|S4]] and [[intuitionistic logic]]s. ==Generalization== It is possible to define monads in a [[2-category]] <math>C</math>. Monads described above are monads for <math>C = \mathbf{Cat}</math>. == See also == * [[Distributive law between monads]] * [[Lawvere theory]] * [[Monad (functional programming)]] * [[Polyad]] * [[Strong monad]] * [[Giry monad]] * [[Monoidal monad]] == References == {{reflist}} == Further reading == * {{Citation|author1-link=Michael Barr (mathematician)|first1=Michael|last1=Barr|author2-link=Charles Wells (mathematician)|first2=Charles|last2=Wells|url=http://www.tac.mta.ca/tac/reprints/articles/22/tr22.pdf|title=Category Theory for Computing Science|year=1999}} * {{Citation|first=Roger|last=Godement|author-link=Roger Godement|title=Topologie Algébrique et Théorie des Faisceaux.|series=Actualités Sci. Ind., Publ. Math. Univ. Strasbourg|volume=1252|issue=13|publisher=Hermann|location=Paris|year=1958|pages=viii+283 pp}} * {{Citation|doi=10.7146/math.scand.a-10995|title=On Double Dualization Monads|journal=Mathematica Scandinavica|volume=27|pages=151|year=1970|last1=Kock|first1=Anders|doi-access=free}} * {{Citation|arxiv=1209.3606|last1=Leinster|first1=Tom|title=Codensity and the ultrafilter monad|journal=Theory and Applications of Categories|volume=28|pages=332–370|year=2013|bibcode=2012arXiv1209.3606L|url=http://www.tac.mta.ca/tac/volumes/28/13/28-13.pdf}} * {{Citation|doi= 10.1007/978-1-4757-4721-8|title= Categories for the Working Mathematician|volume= 5|series= Graduate Texts in Mathematics|year= 1978|isbn= 978-1-4419-3123-8|last1=MacLane|first1= Saunders|doi-access= free}} * {{cite book | editor1-last=Pedicchio | editor1-first=Maria Cristina | editor2-last=Tholen | editor2-first=Walter | title=Categorical Foundations. Special Topics in Order, Topology, Algebra, and Sheaf Theory | series=Encyclopedia of Mathematics and Its Applications | volume=97 | location=Cambridge | publisher=[[Cambridge University Press]] | year=2004 | isbn=0-521-83414-7 | zbl=1034.18001 }} * {{Citation|last = Perrone |first = Paolo |title = Starting Category Theory|chapter = Chapter 5. Monads and Comonads|date = 2024 |publisher = World Scientific|doi = 10.1142/9789811286018_0005 |isbn = 978-981-12-8600-1|chapter-url = https://www.worldscientific.com/doi/10.1142/9789811286018_0005}} * {{Citation|isbn=9780486820804|title=Category Theory in Context|last1=Riehl|first1=Emily|date=2017|publisher=Courier Dover Publications }} * {{Citation|first=Daniele|last=Turi|url=http://www.dcs.ed.ac.uk/home/dt/CT/categories.pdf|title=Category Theory Lecture Notes|year=1996–2001}} * https://mathoverflow.net/questions/55182/what-is-known-about-the-category-of-monads-on-set * Ross Street, The formal theory of monads [https://www.sciencedirect.com/science/article/pii/0022404972900199?ref=pdf_download&fr=RR-2&rr=8ecd045cf8c8263b] == External links == *[https://www.youtube.com/view_play_list?p=0E91279846EC843E Monads], a YouTube video of five short lectures (with one appendix). *John Baez's [http://math.ucr.edu/home/baez/week89.html This Week's Finds in Mathematical Physics (Week 89)] covers monads in 2-categories. *[https://www.youtube.com/watch?v=ryMkvAOJk20 Monads and comonads], video tutorial. * https://medium.com/@felix.kuehl/a-monad-is-just-a-monoid-in-the-category-of-endofunctors-lets-actually-unravel-this-f5d4b7dbe5d6 [[Category:Adjoint functors]] [[Category:Category theory]]
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)
Pages transcluded onto the current version of this page
(
help
)
:
Template:Citation
(
edit
)
Template:Cite book
(
edit
)
Template:Cite journal
(
edit
)
Template:Cite web
(
edit
)
Template:Distinguish
(
edit
)
Template:Expand section
(
edit
)
Template:For
(
edit
)
Template:Harvtxt
(
edit
)
Template:Mvar
(
edit
)
Template:Quote box
(
edit
)
Template:Reflist
(
edit
)
Template:See also
(
edit
)
Template:Sfn
(
edit
)
Template:Short description
(
edit
)
Template:Spaces
(
edit
)