The definition of a $T$-algebra on a monad seems random to me. Can anyone shed some light on it? This is the inuition I have behind monads.
Intuition behind $T$-algebras
642 Views Asked by Bumbble Comm https://math.techqa.club/user/bumbble-comm/detail AtThere are 2 best solutions below
On
I'll try to offer the intuitions I use to understand Eilenberg-Moore algebras; hopefully it is not too idiosyncratic to be helpful. There are two, in my mind, archetypal examples of algebras on monads, both coming from monoids (for the Cartesian monoidal structure on $\mathsf{Set}$).
The first example is monoid actions $f:M\times X\to X$. If we take $\eta_X:X\to M\times X$ as $x\mapsto\langle e,x\rangle$ and $\mu_X:M\times M\times X\to M\times X$ to be $\langle m,n,x\rangle\mapsto\langle mn,x\rangle$, then the usual way of saying that $f:M\times X\to X$ is an $M$-action is precisely the same as saying that it's an algebra for $\langle M\times-,\eta,\mu\rangle$. So we can think of $T$-algebras as some kind of "generalized monoid action," where the "monoid" may be something more abstract than an ordinary monoid.
The other is the algebras of the monad $\langle (-)^*,\eta,\mu\rangle$ on $\mathsf{Set}$, where $X^*$ is the set of finite sequences of elements of $X$, $f^*:X^*\to Y^*$ takes a sequence $\langle x_1,\ldots,x_n\rangle$ to the sequence $\langle f(x_1),\ldots,f(x_n)\rangle$, $\eta_X$ is the inclusion of $X$ as the subset of length 1 sequences, and $\mu_X$ is concatenation of sequences. Here, the algebras are essentially a different presentation of monoids. An algebra $f:X^*\to X$ is the monoid operation extended to finite sequences instead of just ordered pairs; $f\circ\mu_X=f\circ (f)^*$ says that the operation is associative (in a way that extends to the arbitrary arity of $f$); and $f\circ\eta_X=id_X$ says that $f(\langle x\rangle)=x$, implying, in the context of the other condition, that there's a unit element.
Generalizing from this second example, we can think of $f:TX\to X$ as giving us an operation of "abstract arbitrary arity" on $X$, that has to obey certain niceness conditions (the operation on a "unary" input just gives you back that input, and it's "associative" in a generalized sense). The monad is the thing that tells us just what being "unital and associative" means for this "abstract arity".
These are, of course, imperfect ways of conceptualizing $T$-algebras, since there are a lot of monads whose algebras do not, concretely, look much like monoids or monoid actions; but they are motivating examples where the $T$-algebra structure is a reasonably natural way to describe fairly ordinary mathematical objects, and where "associative" and "unital" can be taken fairly literally.
Let $(T,\mu,\eta)$ be a monad on the category of sets and let $(X, f: T(X) \to X)$ be a pair where $X$ is a set and $f$ is a map of sets. I think of $T(X)$ as the set of free/formal expressions of "type $T$" that we can build using elements of $X$. Stated otherwise, $T(X)$ is the synax we can build using elements of $X$ as variables. The map $f$ then is a procedure that builds an element of $X$ from a free expression of "type $T$". Stated otherwise, $f$ interprets syntactic expressions as elements of $X$.
We can think of it as an evaluation of the expressions, e.g. $2 + 3$ is an expression built from natural numbers and $f(2+3) = 5$ is the element it evaluates to, 5 is what $2 + 3$ means inside of natural numbers.
Saying that $(X, f: T(X) \to X)$ is a $T$-algebra is asking for $f$ to be compatible with $\mu$ and $\eta$ :
My favourite example, and the one that made me understand it is using the monad of vector spaces :
Suppose $(T,\mu,\eta)$ is the monad of $K$-vector spaces on sets. If $X$ is a set, then $T(X)$ is the set of formal finite linear combinations of elements of $X$, say $a_1 \cdot x_1 + \cdots + a_n \cdot x_n$ where the $a_i$'s are in $K$ and $n \in \mathbb{N}$. If I have a map $f : T(X) \to X$, I have a way to interpret $a_1 \cdot x_1 + \cdots + a_n \cdot x_n$ as an element of $X$, so $f$ gives a way to interpret "$+$" and "$\cdot$" inside of $X$ !
If further more $f$ verifies the axioms of a $T$-algebra I have the following :
So to sum things up, $f:T(X) \to X$ is a way to interpret pure syntactic objects (the elements of $T(X)$) inside of $X$. And then a $K$-vector space (or $T$-algebra) is a set $X$ where finite $K$-linear combinations have an internal meaning that is compatible with the syntactic rules of linear combinations (given by $\mu$ and $\eta$).