---
tag: F426Q5R0RY
kind: definition
name: Monad
msc: [18C15]
defines: FF6XXA6D1A
uses: [28NQ0KRHD3, KYCPCC57FT]
sources:
  - url: https://en.wikipedia.org/wiki/Monad_(category_theory)
---

## Definition

Let $\mathcal{C}$ be a category.
A *monad* on $\mathcal{C}$ is a triple $(T, \eta, \mu)$ made of these data.

1. $T \colon \mathcal{C} \to \mathcal{C}$ is a [[functor|28NQ0KRHD3]].
2. $\eta \colon \mathrm{Id}_{\mathcal{C}} \Rightarrow T$ is a [[natural transformation|KYCPCC57FT]], the unit.
3. $\mu \colon T \circ T \Rightarrow T$ is a natural transformation, the multiplication.

The data must satisfy two laws.
The associativity law is $\mu \circ T\mu = \mu \circ \mu T$ as natural transformations $T T T \Rightarrow T$.
The unit laws are $\mu \circ T\eta = \id_T$ and $\mu \circ \eta T = \id_T$.
Here $(T\mu)_X = T(\mu_X)$ and $(\mu T)_X = \mu_{T(X)}$, and similarly for $\eta$.

## Remarks

Example: the power set monad on the category of sets.
Here $T(X)$ is the power set of $X$, and $T(f)$ sends a subset $A$ to its image $f(A)$.
The unit is $\eta_X(x) = \set{x}$ and the multiplication is $\mu_X(\mathcal{S}) = \bigcup \mathcal{S}$.
Both sides of the associativity law send a set of sets of subsets to the union of all the subsets that occur in it.
The unit laws hold because $\bigcup \set{A} = A$ and $\bigcup \set{\set{a} : a \in A} = A$.

Non-example: on the category of sets let $T(X) = X \times X$, $\eta_X(x) = (x, x)$ and $\mu_X((a, b), (c, d)) = (a, c)$.
Then $(\mu \circ \eta T)_X$ sends $(x, y)$ to $\mu_X((x, y), (x, y)) = (x, x)$.
This differs from $(x, y)$ when $x \ne y$, so a unit law fails.
With $\mu_X((a, b), (c, d)) = (a, d)$ instead, one gets a monad.

A monad on $\mathcal{C}$ is the same as a monoid object in the monoidal category of endofunctors of $\mathcal{C}$, with composition as the product.
The dual notion is a comonad.
