Open Hypergraphs are a general, differentiable and data-parallel datastructure for syntax. Here’s a few examples of suitable uses:
- Differentiable array programs for deep learning (in catgrad).
- Proofs and terms in first order logic
- Programs in the λ-calculus
- Circuits with feedback
This code is an implementation of the paper Data-Parallel Algorithms for String Diagrams.
Features
- An imperative interface for constructing open hypergraphs in Rust the lax module)
- Data-parallel algorithms for algebraic operations (the strict module)
- Data-parallel diagram layering and decomposition
- Functors, including optic transformation for ahead-of-time differentiation of syntax
Examples
An example for defining a simple expression language (polynomial circuits) and evaluating its terms is given here.
A complete example showing term construction, rendering as SVG using open-hypergraphs-dot, and serialization to JSON can be found here. This example produces the following open hypergraph:
which serializes to JSON as below: