[ANN] TensorAlgebra.jl: Taking covariance seriously

Thanks for your great response @anon67531922

As you say in TensorAlgebras.jl, a vector is V^\ast \to K, or I would prefer to write this as K \to V. In categorical terms, the objects are vector spaces, but there is no such thing as elements of objects, objects are abstract things, not necessarily sets with elements. There are however morphisms between vector spaces, and so a vector v \in V is rather thought of as a morphism from the ground field K (one-dimensional vector space) to the space V, namely, this morphism would be the map that sends a scalar \lambda to \lambda v. As soon as you have several vector spaces involved, they could appear at different places in the domain or codomain, but I have chosen the convention to call a tensor that thing that you get from taking tensor products of vectors, i.e. the tensor product of morphisms K \to V, which is a morphism K \to V_1 \otimes V_2 \otimes \cdots \otimes V_N.

That’s indeed opposite to the picture where you think of a tensor as a multilinear map which receives some vector inputs and produces a scalar. That’s not how I need to think of tensors in my daily life, though it’s an equally valid perspective.

They are only naturally isomorphic for your typical vector spaces. Mostly, the problem is with reordering spaces rather than with applying the unit or counit, but you need this, for example, to go from K \to U \otimes V \otimes W to V^\ast \to U \otimes W: you cannot just use the (co)unit for this, as this only works on the first or last tensor factor.

Now, to permute two of the spaces, i.e. tensor indices, in the case of anyonic systems (or thus, general fusion categories), there might not be a swap operation that is symmetric (i.e. that becomes the identity if you do it twice), but rather you have to use some general braid. This actually changes the tensor. And doing it a second time does not bring you back to the same tensor.

But more down to earth, in my example of SU2 symmetry, I am not talking about being Lie-algebra valued or anything, just normal tensors which have some kind of constraint. Say I have a tensor in \mathbb{C}^2 \otimes \mathbb{C}^2 \otimes \mathbb{C}^2 \otimes \mathbb{C}^2, where on every \mathbb{C}^2 there is the fundamental representation of \mathsf{SU}(2) acting. I now want to describe a tensor in this space that is invariant under this joint action of the \mathsf{SU}(2) symmetry. This comes up typically in quantum mechanics, i.e. its a singlet of four spin-1/2 states.

The way such invariant tensors are described in TensorKit is using fusion trees, that is, we write the coefficients of this tensor with respect to a basis consisting of all possibilities of the following:

fuse the first two spin-1/2 representations, into a j1=0 or j1=1 representation
fuse the result of this with the third spin-1/2, which can be j2 = 1/2 if j1 = 0, or j2 = 1/2 or 3/2 if j1 = 1
and so forth …

If you now want to reorder the tensor factors, i.e. the spins, this changes the basis and has non-trivial effect on the corresponding coefficients. So even though in that case the actual tensors are maybe trivially related (naturally isomorphic), it is useful to be explicit about this, as it is not a zero-cost operation.