The Computer Algebra System of the Future

Owen Lynch

Introduction

  • What is a computer algebra system?
  • Why do we care about computer algebra systems?

Properties

Morphism-first

  • In a traditional CAS, the basic primitive is an untyped term with free variables, i.e. Plus[Times[a, 2], b]

    Problems:

    • What types are these variables?
    • What algebraic theory are we working in?
    • Variable name clashes for substitution?
  • In a morphism-first CAS, the basic primitive is (roughly) a morphism in the Kleisli category of a “syntax monad”.

    Solutions:

    • Types are given by the domain of the morphism
    • Algebraic theory is given by the monad we are using
    • Substitution is morphism composition

Functorial semantics

  • Traditionally, interfacing CAS and numerical computing is difficult
    • CAS are written in high-level, dynamic languages
    • Numerical computing is in low-level, compiled languages
  • Computer algebra really should be a means of deriving higher-performance numerical code than one would write by hand
  • Should use high-level user-specified equalities to optimize computation
  • Given symbolic morphisms in a theory, we compile them to high-performance functions acting on any model of the theory

Nonlinear syntax

  • In a traditional CAS, terms of a theory are represented using syntax trees.
  • In category theory, we have graphical/nonlinear syntax for categorical constructs, including:
    • combinatorial operads, i.e. directed/undirected wiring diagrams
    • graphical languages: i.e. Petri nets, regnets, etc.
  • An advanced CAS should allow the user to graphically manipulate these

Progress

Design of Gatlab

Gatlab is the next-generation rewrite of the core of Catlab.

Gatlab is a category-theoretic computer algebra system in two senses.

  1. Gatlab manipulates finite presentations of category-theoretic objects (categories, categories with structure on them, functors, etc.)
  2. Category-theoretic concepts are used to organize the computer algebra itself, via a focus on morphisms between theories and between contexts.

Example

Other features

Currently implemented, not demo’d

  • Morphisms between theories themselves
  • Multiple inheritance of theories via pushout
  • e-graph backed rewriting and type inference/checking
  • Parametric models (i.e. GL(n) as a group for each n)

To implement in the future

  • Tactics system for rewriting
  • Optimization/compilation of extracted programs
  • Generic constructions for Slice, Para, Lens, etc.
  • 2-categories of models via double Lawvere theories
  • Integration with Semagrams (see next slide)

Semagrams