For a monad: what is the $\mu: T^2 \rightarrow T$ natural transformation?

102 Views Asked by At

Wikipedia says that a Monad has a natural transformation:

$$\mu: T^2 \rightarrow T$$

Where:

$C$ is a category, and $T$ is an endofunctor: $T: C \rightarrow C$

$T^2$ is a functor $T \circ T$ from $C$ to $C$.

I'm trying to understand $\mu$ and $T^2$. What do these definitions mean?

(I'm a programmer trying to understand just enough category theory for a particular problem.)

1

There are 1 best solutions below

0
On

Every monad is defined as the following data $\def\C{\mathcal C}(\C, T,\mu,\eta)$ where
- $\C$ is a category
- $T$ is an endofunctor $T:\C\to\C$
- $\mu$ is a natural transformation $T\circ T\to T$,
$\quad\quad$ i.e. it is a collection of arrows $\mu_c:T(Tc)\to Tc$ for $c\in Ob\,\C$, satisfying a commutativity condition
- $\eta$ is a natural transformation $1_\C\to T$,
$\quad\quad$ i.e. a collection of arrows $c\to Tc$.

(And these data has to satisfy some monoid-like axioms: 'associativity' of $\mu$ - yielding a unique extension of the 'operation' $\mu$ to $T^3\to T$, and left and right 'identity' axioms for $\eta$.)


Best is to understand with specific examples.

In the case of (a variant of) the list monad, we have
- $\C=\mathcal Set$
- $T:A\mapsto A^*$ where $A^*$ is the set of finite lists (or 'words') of elements of $A$, $\ T(A)=A^*=\bigsqcup_{n\in\Bbb N}A^n$
- $T^2(A)=\{\langle w_1,w_2,\dots,w_n\rangle\,:\,n\in\Bbb N, w_i\in A^*\}$, i.e. its elements are 'sentences' of words, when letters taken from $A$
- $\mu_A:T^2(A)\to T(A)$ is the concatenation of words: $\langle w_1,\dots,w_n\rangle\mapsto w_1\cdots w_n$
- $\eta_A:A\to T(A)$ picks the one-element words for the letters

Note that $A^*$ is the 'free semigroup' (or 'free monoid' if the empty word is included in the above) generated by $A$, and so that the list monad is also called the 'free semigroup monad'.


The free commutative ring monad consists of:
- $\C=\mathcal Set$
- $T(A):=\Bbb Z[A]$ the set of all polynomials with integer coefficients and variables taken from $A\ $
$\quad\quad$ [e.g. the expression $2ab-73c^2\,\in T(\{a,b,c,d\})$].
- Elements of $T^2(A)$ can be thought of as parenthesized expressions
- $\mu$ opens up the brackets
- $\eta$ assigns the single variable polynomial to a single variable.