Feeds:
Posts

## A monad is just a monoid in the category of endofunctors, what’s the problem?

Okay, but what’s the point of looking at monoids in the category of endofunctors?

Recall that if $m$ is a monoid in a monoidal category $(M, \otimes)$, then we can talk about a module over $m$: it’s an object $c$ equipped with an action map

$\displaystyle m \otimes c \to c$

satisfying some axioms. But this is clearly not the most general notion of action of a monoid we can think of. For example, we know what it means for an ordinary monoid $m$, in $\text{Set}$, to act on the objects of any category $C$ whatsoever (we just want a monoid homomorphism $m \to \text{End}(C)$), and that notion of monoid action isn’t subsumed by this definition.

Here’s something more general that comes closer. It’s not necessary that $m$ and $c$ live in the same category. Instead, $m$ can live in a monoidal category $(M, \otimes)$ while $c$ lives in a category $C$ equipped with the structure of a module category over $M$. In particular this means that there is an action functor

$\displaystyle \otimes : M \times C \to C$

with some extra structure satisfying some axioms. This allows us to make sense of $m \otimes c$ as an object in $C$ and hence to make sense of an action map $m \otimes c \to c$ as before, and even to state the usual axioms. (Another instance of the microcosm principle.)

Now, fix $C$. What is the most general monoidal category over which $C$ is a module category? Of course, it’s the monoidal category $\text{End}(C)$ of endofunctors of $C$. Hence the most general kind of monoid that can act on an object in $C$ is a monoid in $\text{End}(C)$, or equivalently a monad.

In fact, since an action of a monoidal category $M$ on $C$ can be described as a monoidal functor $M \to \text{End}(C)$, any action of a monoid $m \in M$ on an object $c \in C$ in the sense described above naturally factors through an action of a monad.

Example. Any cocomplete category $C$ is naturally a module category over $(\text{Set}, \times)$ with the action given by

$\displaystyle \text{Set} \times C \ni (X, c) \mapsto X \otimes c \cong \coprod_X c \in C$.

More precisely, in this situation we say that $C$ is tensored over $\text{Set}$ (which is in some sense dual to being enriched over $\text{Set}$). This lets us describe what it means for a monoid in $\text{Set}$ to act on an object $c \in C$.

Example. Any symmetric monoidal cocomplete category $C$ (this includes the hypothesis that the monoidal operation distributes over colimits) is naturally a module category over the monoidal category $\widehat{S}$ (see this blog post) of species (equipped with the composition product $\circ$) with the action given by

$\displaystyle \widehat{S} \times C \ni (F, c) \mapsto \coprod_{n \ge 0} F(n) \otimes_{S_n} c^{\otimes n}$

where $F(n) \otimes c^{\otimes n}$ denotes, as above, $\coprod_{F(n)} c^{\otimes n}$, and $\otimes_{S_n}$ denotes the quotient of this by the diagonal action of $S_n$.

This lets us describe what it means for a monoid in $(\widehat{S}, \circ)$ to act on an object $c \in C$. And a monoid in $(\widehat{S}, \circ)$ is precisely an operad.

## String diagrams, duality, and trace

Previously we introduced string diagrams and saw that they were a convenient way to talk about tensor products, partial compositions of multilinear maps, and symmetries. But string diagrams really prove their use when augmented to talk about duality, which will be described topologically by bending input and output wires. In particular, we will be able to see topologically the sense in which the following four pieces of information are equivalent:

• A linear map $U \to V$,
• A linear map $U \otimes V^{\ast} \to 1$,
• A linear map $V^{\ast} \to U^{\ast}$,
• A linear map $1 \to U^{\ast} \otimes V^{\ast}$.

Using string diagrams we will also give a diagrammatic definition of the trace $\text{tr}(f)$ of an endomorphism $f : V \to V$ of a finite-dimensional vector space, as well as a diagrammatic proof of some of its basic properties.

Below all vector spaces are finite-dimensional and the composition convention from the previous post is still in effect.

## Introduction to string diagrams

Today I would like to introduce a diagrammatic notation for dealing with tensor products and multilinear maps. The basic idea for this notation appears to be due to Penrose. It has the advantage of both being widely applicable and easier and more intuitive to work with; roughly speaking, computations are performed by topological manipulations on diagrams, revealing the natural notation to use here is 2-dimensional (living in a plane) rather than 1-dimensional (living on a line).

For the sake of accessibility we will restrict our attention to vector spaces. There are category-theoretic things happening in this post but we will not point them out explicitly. We assume familiarity with the notion of tensor product of vector spaces but not much else.

Below the composition of a map $f : a \to b$ with a map $g : b \to c$ will be denoted $f \circ g : a \to c$ (rather than the more typical $g \circ f$). This will make it easier to translate between diagrams and non-diagrams. All diagrams were drawn in Paper.

One annoying feature of the abstract theory of vector spaces, and one that often trips up beginners, is that it is not possible to make sense of an infinite sum of vectors in general. If we want to make sense of infinite sums, we should probably define them as limits of finite sums, so rather than work with bare vector spaces we need to work with topological vector spaces over a topological field, usually $\mathbb{R}$ or $\mathbb{C}$ (but sometimes fields like $\mathbb{Q}_p$ are also considered, e.g. in number theory). Common and important examples include spaces of continuous or differentiable functions.