Skip to main content

A toolkit for higher-dimensional diagram rewriting.

Project description

rewalt

  1. (archaic) to overturn, throw down
  2. a library for rewriting, algebra, and topology, developed in Tallinn (aka Reval)

CoolDiagram

About

rewalt is a toolkit for higher-dimensional diagram rewriting, with applications in

  • higher and monoidal category theory,
  • homotopical algebra,
  • combinatorial topology,

and more. Thanks to its visualisation features, it can also be used as a structure-aware string diagram editor, supporting TikZ output so the string diagrams can be directly embedded in your LaTeX files.

BlackWhiteDiagram

It implements diagrammatic sets, which, by the "higher-dimensional rewriting" paradigm, double as a model of

  • higher-dimensional rewrite systems, and of
  • directed cell complexes.

This model is "topologically sound": a diagrammatic set built in rewalt presents a finite CW complex, and a diagram constructed in the diagrammatic set presents a valid homotopy in this CW complex.

A diagrammatic set can be seen as a generalisation of a simplicial set or of a cubical set with many more "cell shapes". As a result, rewalt also contains a full implementation of finitely presented simplicial sets and cubical sets with connections.

Getting started

rewalt is available for Python 3.7 and higher. You can install it with the command

pip install rewalt

Then you should take a look at the documentation, which includes several worked examples from category theory, algebra, and homotopy theory.

Usage

The docs/notebooks/ folder contains several worked examples in the form of Jupyter notebooks.

For example, this is how you create a single-sorted algebraic signature with one binary operation $m$ and one constant $u$, then represent the term $m(u, -)$ as a string diagram oriented bottom-to-top.

from rewalt import DiagSet

X = DiagSet()
pt = X.add('pt', draw_label=False)
a = X.add('a', pt, pt, draw_label=False)  # the sort

m = X.add('m', a.paste(a), a)  # binary operation
u = X.add('u', pt.unit(), a)  # constant

m.to_inputs(0, u).draw()

ExampleAlgebra

This is how you construct a 3-dimensional diagram shape as an "oriented cylinder" whose bases are 2-simplices, then output its oriented face poset in the form of a Hasse diagram with magenta edges for input faces, and blue edges for output faces.

from rewalt import Shape

twosimplex = Shape.simplex(2)
arrow = Shape.arrow()

cylinder = arrow * twosimplex  # Gray product of arrow and 2-simplex
cylinder.hasse(labels=False)

ExampleTopology

Testing

You can run all tests with the command

pytest

Documentation

The latest documentation is hosted on Read the Docs.

If you want to build a local copy of the documentation, first install the required dependencies:

pip install -r docs/requirements.txt

Then run

cd docs/
make clean
make html

You will then find the documentation under docs/_build/.

Further reading

For a first introduction to the ideas of higher-dimensional rewriting, diagrammatic sets, and "topological soundness", you may want to watch these presentations at the CIRM meeting on Higher Structures and at the GETCO 2022 conference.

A nice overview of the general landscape of higher-dimensional rewriting is Yves Guiraud's mémoire d'habilitation.

So far there are two papers on the theory of diagrammatic sets: the first one containing the foundations, the second one containing some developments applied to categorical universal algebra.

A description and complexity analysis of some of the data structures and algorithms behind rewalt will be published in the proceedings of ACT 2022.

License

rewalt is distributed under the BSD 3-clause license; see LICENSE.

Contributing

Currently, the only active developer of rewalt is Amar Hadzihasanovic.

Contributions are welcome. Please reach out either by sending me an email, or by opening an issue.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rewalt-0.1.0.tar.gz (66.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

rewalt-0.1.0-py3-none-any.whl (68.2 kB view details)

Uploaded Python 3

File details

Details for the file rewalt-0.1.0.tar.gz.

File metadata

  • Download URL: rewalt-0.1.0.tar.gz
  • Upload date:
  • Size: 66.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.2

File hashes

Hashes for rewalt-0.1.0.tar.gz
Algorithm Hash digest
SHA256 1e632d8bf04791bb061ca823f7efe1b143aea9efd2218f1e682cadecfae1f77d
MD5 ec616c464030d66aa89756fb1ed413a6
BLAKE2b-256 449880fb9480d073cc26536ffa78e0cdf2f324ac4f8aa904d4c2ff58c387535d

See more details on using hashes here.

File details

Details for the file rewalt-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: rewalt-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 68.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.2

File hashes

Hashes for rewalt-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2ed984eaec1b253ce7e152cf37c8107e3d2d003bc1a2cb5ff989d27d69232fda
MD5 91a9897df9b91ed9c4dd0427a8c7ca58
BLAKE2b-256 7c911a4400e56deeb97dfee03f60ea2e0de098759a1639bd01287fae74d5bb0e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page