The longest list of analogies between vector spaces and categories ever made

I suspect this question exists in different forms, elsewhere.

I would like to know what's going on with this table, how to fill the missing items and how to continue the list, and what is the analogy that underlies it.

╔═══════════════════════╦══════════════════════╗
║ vector spaces         ║ categories           ║
╠═══════════════════════╬══════════════════════╣
║ tensor product        ║ product              ║
╠═══════════════════════╬══════════════════════╣
║ linear map            ║ functor              ║
╠═══════════════════════╬══════════════════════╣
║ dual space            ║ opposite category    ║
╠═══════════════════════╬══════════════════════╣
║ canonical pairing     ║ hom functor          ║
╠═══════════════════════╬══════════════════════╣
║ ground field          ║ category of sets     ║
╠═══════════════════════╬══════════════════════╣
║ bidual injection      ║ Yoneda embedding     ║
╠═══════════════════════╬══════════════════════╣
║ ev(v) -> f = f(v)     ║ Yoneda lemma         ║
╠═══════════════════════╬══════════════════════╣
║ V~V** in finite dim   ║  ???                 ║
╠═══════════════════════╬══════════════════════╣
║ bilinear map          ║ profunctor           ║
╠═══════════════════════╬══════════════════════╣
║ ???                   ║ co/complete category ║
╠═══════════════════════╬══════════════════════╣
║ linear representation ║ ???                  ║
╠═══════════════════════╬══════════════════════╣
║ ???                   ║ adjoint functors     ║
╠═══════════════════════╬══════════════════════╣
║ ???                   ║ Kan extensions       ║
╠═══════════════════════╬══════════════════════╣
║ ???                   ║        coend         ║
╚═══════════════════════╩══════════════════════╝

Solution 1:

There is a 2-category whose

  • objects are categories $C$,
  • morphisms $C \to D$ are profunctors $D^{op} \times C \to \text{Set}$,
  • 2-morphisms are natural transformations

and working in this 2-category is a bit like doing "linear algebra over $\text{Set}$." The categories $C$ themselves are not the "vector spaces," though; the idea is to think of their presheaf categories $[C^{op}, \text{Set}]$ as the vector spaces (the "free vector spaces" on $C$) and the profunctors as "matrices" defining "linear transformations" between these. This analogy is much clearer in the special case when the categories involved are discrete; then you can check that a profunctor is literally a matrix of sets and profunctor composition is literally matrix multiplication but with disjoint union, cartesian product, etc.

The story works out a lot better if we restrict our attention to essentially small categories or else there are size issues in considering presheaf categories. With this restriction, an equivalent way of presenting this 2-category is that it is the 2-category whose

  • objects are presheaf categories $\widehat{C} = [C^{op}, \text{Set}]$,
  • morphisms are cocontinuous functors,
  • 2-morphisms are natural transformations

(this follows from the Yoneda embedding being the free cocompletion: we get that cocontinuous functors $\widehat{C} \to \widehat{D}$ can be identified with functors $C \to \widehat{D}$, or equivalently with functors $C \times D^{op} \to \text{Set}$, and moreover we can check that composition of such functors matches up with profunctor composition).

Now let's go through the entries in the table and check how everything matches up.

  1. As stated above, vector spaces are analogous to categories, or more precisely free vector spaces are analogous to presheaf categories. If you like you can generalize to considering cocomplete categories which aren't necessarily presheaf categories but then you lose the ability to describe morphisms in terms of profunctors.

  2. The sense in which tensor product is analogous to product is the following: you can write down what it means for a functor $\widehat{C} \times \widehat{D} \to \widehat{E}$ to be cocontinuous in each variable, and then you can check that you can identify such functors with cocontinuous functors $\widehat{C \times D} \to \widehat{E}$, or equivalently with "triple profunctors" $C \times D \times E^{op} \to \text{Set}$. So the product of categories really does have the expected universal property with respect to "bilinear maps"!

  3. Linear maps are analogous to profunctors if we are thinking in terms of the first presentation above or analogous to cocontinuous functors in terms of the second presentation above ("cocontinuous" being analogous to "linear" because colimits are analogous to sums).

  4. There are two compatible senses in which the dual space is analogous to the opposite category $C^{op}$: first, the category of morphisms $C \to 1$ is profunctors $C \to \text{Set}$, which in terms of the second presentation above corresponds to presheaves on $C^{op}$. Second, we have monoidal duality where the dual pairing between $C$ and $C^{op}$ is given by a profunctor $C \times C^{op} \to 1$ which is exactly the hom functor.

  5. As in 4.

  6. This is, as I mentioned above, "linear algebra over $\text{Set}$." It's important to keep in mind that $\text{Set}$ is the presheaf category $\widehat{1}$ on the terminal category, which is the monoidal unit with respect to cartesian product. So $\text{Set}$ itself naturally appears as an object in the second presentation but in the first it's disguised as the terminal category $1$.

  7. The bidual injection $V \to (V^{\ast})^{\ast}$ is the isomorphism $C \cong (C^{op})^{op}$ in this setting.

  8. As in 4, the dual pairing is the hom functor, so evaluation just sends an object $c \in C$ to the presheaf it represents.

  9. As in 7.

  10. As in 2, bilinear maps are "triple profunctors."

  11. In the second presentation, every category involved is cocomplete. In the first presentation, almost none of them are (a cocomplete essentially small category is a preorder).

  12. Linear representations are analogous to actions of, say, a group (but we could also consider a 2-group) on an object in this 2-category. One needs to be a little careful defining what a group action is in this setting; see e.g. this blog post. Keep in mind that it's pretty hard for a matrix of natural numbers to be invertible unless it's a permutation matrix; I think group actions in this 2-category end up being pretty similar if not identical to just group actions on categories in the usual sense (by functors, not profunctors), although these are still quite interesting.

  13. Since we're in a 2-category we can talk about adjoint morphisms, which make sense in any 2-category. We can also ask what adjoint functors between the ordinary categories in the first presentation look like in terms of profunctors. One way to say it is the following. Among all the profunctors $M : C \to D$ we can distinguish the ones which are represented by ordinary functors $F : C \to D$ in the sense that $M(d, c) = \text{Hom}_D(d, F(c))$. Every profunctor has a dual or transpose or opposite profunctor $M^{op} : D^{op} \to C^{op}$ given by switching the role of the two input variables, and $F$ has a left adjoint in the ordinary sense iff $M^{op}$ is also represented by a functor $D^{op} \to C^{op}$.

  14. Kan extensions are a general 2-categorical construction; I don't know that there's anything special to say about them in terms of this analogy.

  15. Coends are analogous to traces. This comes from thinking about functors $C^{op} \times C \to \text{Set}$ as endomorphisms of $C$ in this 2-category.

You can also see me write down a bunch of this story but for "linear algebra over $\text{Vect}$" instead of $\text{Set}$ in this blog post.

Solution 2:

It works better if the vector space comes equipped with an inner product. The inner product satisfies

$$ \begin{matrix} \langle x, 0\rangle = 0 = \langle 0, x\rangle\\ \\ \langle x + y, z\rangle = \langle x, z\rangle + \langle y, z\rangle\\ \langle x, y + z\rangle = \langle x, y\rangle + \langle x, z\rangle\\ \\ \langle cx, y\rangle = \bar{c} \langle x, y\rangle \\ \langle x, cy\rangle = c \langle x, y\rangle\\ \\ \langle x, y\rangle = \overline{\langle y, x\rangle }\\ \\ \sum_i \langle x, e_i\rangle \langle e_i, y\rangle = \langle x, y\rangle\\ \\ \langle T^{\dagger}x, y\rangle = \langle x, Ty\rangle \end{matrix} $$

where bar is conjugation, $\dagger$ is conjugate transpose and $e_i$ is some orthonormal basis.

In every category, the hom satisfies properties analogous to the last couple of these: $$ \begin{matrix} \int_i {\rm hom}(x, i)\, {\rm hom}(i, y) = {\rm hom}(x, y)\\ \\ {\rm hom}(Lx, y) ~= {\rm hom}(x, Ry) \mbox{ if $L, R$ are adjoint functors.} \end{matrix} $$

In a compact closed category, where ${\rm hom}(x, y)$ is isomorphic to $x^* \otimes y,$ it also satisfies

$$ {\rm hom}(x, y) \cong {\rm hom}(y, x)^*.$$

In a compact closed category with a monoidal operation + with unit 0 over which tensor distributes (e.g. the category of finite dimensional vector spaces), the rest of the laws hold up to equivalence.