# A Monoidal Category Example

I have never felt entirely comfortable with Haskell’s arrows and skimming the literature for their categorical basis didn’t reveal anything as straightforward as monads or applicatives. It did however lead me to start thinking about monoidal categories and since I always want an example, I thought I would write up Hilbert spaces.

Let $H_1$ and $H_2$ be Hilbert spaces then as vector spaces we can form the tensor product $H_1 \otimes H_2$. The tensor product can be defined as the free vector space on $H_1$ and $H_2$ as sets (that is purely formal sums of $(u,v)$) modulo a relation $\sim$ defined by

\displaystyle \begin{aligned} (u_1,v) + (u_2,v) \sim (u_1 + u_2,v) \\ (u,v_1) + (u,v_2) \sim (u,v_1 + v_2) \\ c(u,v) \sim (cu,v) \\ c(u,v) \sim (u,cv) \end{aligned}

Slightly overloading notation, we can define an inner product on the tensored space by

$\displaystyle \langle u_1 \otimes v_1, u_2 \otimes v_2\rangle = \langle u_1, v_1 \rangle \langle u_2, v_2\rangle$

Of course this might not be complete so we define the tensor product on Hilbert spaces to be the completion of this inner product.

For Hilbert spaces to form a monoidal category, we take the arrows (in the categorical sense) to be linear continuous maps and the bifunctor to be the tensor product. We also need an identity object $I$ which we take to be $\mathbb{R}$ considered as a Hilbert space. We should check the coherence conditions but the associativity of the tensor product and the fact that our Hilbert spaces are over the $\mathbb{R}$ make this straightforward.

Now for some slightly interesting properties of this category.

• The tensor product is not the product in the categorical sense. If $\{u_i\}$ and $\{v_i\}$ are (orthonormal) bases for $H_1$ and $H_2$ then $\{u_i \otimes v_j\}$ is a (orthonormal) basis for $H_1 \otimes H_2$. Thus a linear combination of basis vectors in the tensor product cannot be expressed as the tensor of basis vectors in the component spaces.

• There is no diagonal arrow $\Delta : X \rightarrow X \otimes X$. Suppose there were such a diagonal then for arbitrary $\lambda$ we would have $\Delta(\lambda u) = (\lambda u) \otimes (\lambda u) = \lambda^2 (u \otimes u)$ and since $\Delta$ must be linear this is not possible.

Presumably the latter is equivalent to the statement in quantum mechanics of “no cloning”.