egg 0.9.1

An implementation of egraphs
Documentation

egg: egraphs good

Crates.io Released Docs.rs Main branch docs Zulip

Are you using egg? Please cite using the BibTeX below and add your project to the egg website!

Check out the web demo for some quick e-graph action!

Using egg

Add egg to your Cargo.toml like this:

[dependencies]
egg = "0.9.1"

Make sure to compile with --release if you are measuring performance!

Developing

It's written in Rust. Typically, you install Rust using rustup.

Run cargo doc --open to build and open the documentation in a browser.

Before committing/pushing, make sure to run make, which runs all the tests and lints that CI will (including those under feature flags). This requires the cbc solver due to the lp feature.

Tests

Running cargo test will run the tests. Some tests may time out; try cargo test --release if that happens.

There are a couple interesting tests in the tests directory:

  • prop.rs implements propositional logic and proves some simple theorems.
  • math.rs implements real arithmetic, with a little bit of symbolic differentiation.
  • lambda.rs implements a small lambda calculus, using egg as a partial evaluator.

Benchmarking

To get a simple csv of the runtime of each test, you set the environment variable EGG_BENCH_CSV to something to append a row per test to a csv.

Example:

EGG_BENCH_CSV=math.csv cargo test --test math --release -- --nocapture --test --test-threads=1