### Bimodules Versus Spans

#### Posted by John Baez

Bimodules and spans show up a lot in applications of category theory to physics, perhaps because they get along with the ‘reversibility’ we have come to expect. Given an $(R,S)$-bimodule, we can think of it as a morphism from the ring $R$ to the ring $S$, and we can ‘compose’ these morphisms by tensoring them… but we can also turn them around: any $(R,S)$-bimodule can be thought of as an $(S^{op},R^{op})$-bimodule, and when our rings are commutative we don’t even need to bother with that ‘op’. Similarly, we can compose spans of sets but also turn them around.

I always thought bimodules and spans should be related, but only recently did I learn exactly how, thanks to Paul-André Melliès. The relation so nice I’ll present it as a series of puzzles. If these puzzles are too easy for you, please let others take a try first.

Let’s work in the category $Set^{op}$, where a morphism $f:S \to T$ is a function from $T$ to $S$. This is a monoidal category with $\times$ as its tensor product. So, we can talk about monoid objects in $Set^{op}$.

**Puzzle 1:** What’s a monoid object in $Set^{op}$? It’s something very familiar.

Whenever we have a monoid object $R$ we can talk about an ‘action’ of this object on some other object $M$: just a morphism

$a : R \otimes M \to M$

satisfying the usual equations. An action is sometimes called a ‘module’, since a monoid object in $AbGrp$ is just a ring $R$, and an action of this is just what people usually call an $R$-module.

**Puzzle 2:** What’s a module of a monoid object in $Set^{op}$? It’s something very familiar.

We can also talk about bimodules.

**Puzzle 3:** What’s a bimodule of a pair of monoid objects in $Set^{op}$? It’s something very familiar.

And, if we’re lucky — and in $Set^{op}$ we are — we can tensor an an $(R,S)$-bimodule and a $(S,T)$-bimodule and get an an $(R,T)$-bimodule!

**Puzzle 4:** What does tensoring bimodules amount to in $Set^{op}$? It’s something very familiar to some of you.

## Re: Bimodules Versus Spans

Okay, here are the answers:

Answer 1:a set.Answer 2:a function.Answer 3:a span of sets.Answer 4:the usual way composing spans of sets.