TwoVect
Posted by Urs Schreiber
guest post by Jamie Vicary
There are lots of computations in higher linear algebra that can be difficult to carry out; not because any of the individual steps are difficult, but because the calculation as a whole is long and introduces many opportunities to make mistakes. A student of mine, Dan Roberts, wrote an impressive computer package called TwoVect as an add-on to Mathematica to help with these calculations, and I’d like to tell you about it!
It’s already being used in earnest by Chris Douglas to find some new modular tensor categories, and by me and Dan for some projects in topological quantum field theory and quantum information. So we’re hopeful that the early bugs have been worked out, and we’re happy to show it to the world.
If you like semisimple monoidal categories, and ever spend time checking pentagon or hexagon equations, or computing the value of a string diagram, or verifying the axioms for a Frobenius algebra or a Hopf algebra, or checking properties like modularity or rigidity, or showing that your extended topological quantum field theory satisfies the right axioms, or checking the equations for a bimodule between two tensor categories — or you like the idea of using Mathematica’s built-in solvers to help with these tasks — or you just want to know what this stuff is all about! — read on.
Higher linear algebra
What is higher linear algebra, anyway? It’s the algebra of 2-vector spaces, linear functors and natural transformations. This is a beautiful and important extension of ordinary linear algebra. In my opinion, it’s category theory at its best: it is shocking, and wonderful, to learn that something as straightfoward and familiar as linear algebra, which you thought had no secrets left to hide, is in fact just a tiny corner of a vast new mathematical landscape. These 2-vector spaces are used in all sorts of areas, including topological quantum field theory, quantum algebra, representation theory, and even quantum information. And of course, they are also studied for their own sake.
The 2-vector spaces we’re interested in are -enriched categories. We assume that they’re semisimple, meaning that there is a zero object, and a family of nonisomorphic simple objects whose endomorphism spaces are , and which produce every other object by taking finite biproducts. We also assume finite-dimensionality, meaning we can make do with a finite number of these simple objects. With a few notable exceptions, almost everyone who works with 2-vector spaces also makes these assumptions, so they’re not overly restrictive.
Matrix calculations
To do a calculation in ordinary finite-dimensional linear algebra, it can be useful to write your linear maps as matrices of complex numbers. Composites and tensor products can then be directly calculated, and existing computer algebra packages such as Mathematica provide all the tools necessary to do this automatically.
When it comes to higher linear algebra, we can also use a matrix calculus, but it’s more complicated: our natural transformations are matrices of matrices of complex numbers. Here’s an example:
The entries ‘’ represent the zero map from the zero-dimensional vector space to itself, and is a complex parameter. In fact, this isn’t any old example: it’s the associator for the modular tensor category Fib of ‘Fibonacci anyons’, for which is the golden ratio. As such, it should satisfy the pentagon equation for a monoidal category.
But how to check this? There are three different ways to combine these matrices of matrices: tensor product, vertical composition and horizontal composition. We need to use all of them together to check that above satisfies the pentagon equation. While this can definitely be done by hand, it’s a delicate calculation to say the least.
But this is just the start of it. What if you had a bigger associator? What if you wanted to check something more complicated? Things get unmanageable very, very fast.
The package
Dan’s package implements a completely skeletal version 2Vect, the symmetric monoidal 2-category of finite-dimensional complex 2-vector spaces. This is exactly what you want for a computer implementation, as it gives you the best control possible over the entities which the system has to represent:
- 0-cells are natural numbers;
- 1-cells are matrices of natural numbers;
- 2-cells are matrices of matrices of complex numbers.
These sorts of things are easy to represent in Mathematica. The package implements the three ways in which these entities can be composed, which are all binary operations:
- Tensor product for which the arguments can be 0-cells, 1-cells or 2-cells;
- Horizontal composition for which the arguments can be 1-cells or 2-cells;
- Vertical composition for which the arguments must be 2-cells.
These are pretty combinatorially tricky, so it’s nice for the package to be able to do these calculations. But the real power of the package lies in its ability to calculate the nontrivial structural 2-cells that account for weakness of horizontal composition and tensor product:
- The interchanger: ;
- The compositor: ;
- The symmetrizer: .
Using these structures, an equation such as the pentagon equation for a monoidal category can be coded once-and-for-all. Then if you come up with an associator for a new monoidal category, all you have to do is type it in, and let the package check whether the pentagon equation is solved. Or maybe you know some of the entries to the associator, but not others — then you can leave them as variables, tell the package to generate the pentagon equation, and then get Mathematica to try to find solutions to the resulting equations.
The future
There’s still loads more we’d like this package to be able to do! There’s plenty of scope to add more higher algebraic equations, so they’re there hard-coded if people want to make use of them. The core algorithms at the heart of the package have hardly been optimized at all, so there’s significant scope to improve their speed. It would also be great to leverage Nick Gurski’s and Angelica Osorno’s new coherence result to have the structural 2-cells , and inserted automatically where appropriate. And this is just the beginning.
If you want to help out, or you want some help using or understanding the package, get in touch! There is also a user guide available on the webpage, which is over at the Lab.
Re: TwoVect
Thanks Dan and Jamie for all this work and this contribution.