After a few rejections elsewhere (ICFP'23, POPL'24), the much improved paper on Domain-Specific Tensor Languages has now been submitted to JFP for review and uploaded to arXiv for reference. Comments welcome!

Domain-Specific Tensor Languages

Jean-Philippe Bernardy, Patrik Jansson

arXiv.org/abs/2312.02664 arXiv.org/pdf/2312.02664

The paper explains tensor algebra and tensor calculus with two DSLs embedded in Haskell: one called Albert (after Einstein) for the Einstein tensor notation (made famous 100 years ago by the papers on general relativity and curved space-time) and one called Roger (after Penrose) for the underlying category theory morphisms. One unusual feature is that the DSL expressions can be rendered as diagrams by the Haskell library. The first image below shows the main tensor algebra diagrams and the second show the main tensor calculus diagrams.

As a motivating example the paper also defines the main equation of Einstein's general relativity: the tensor equation describing the curvature of space-time by mass and energy, and presents the simplest (non-trivial) solution: the Schwartzschild metric. The Haskell library can express the equation and the S. metric, and computes the 4x4 space-time tensor field with symbolic expressions which, when simplified, shows that the S. metric is a solution to the equation.

As a motivating example the paper also defines the main equation of Einstein's general relativity: the tensor equation describing the curvature of space-time by mass and energy, and presents the simplest (non-trivial) solution: the Schwartzschild metric. The Haskell library can express the equation and the S. metric, and computes the 4x4 space-time tensor field with symbolic expressions which, when simplified, shows that the S. metric is a solution to the equation.