Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inverse equality saturation #1

Open
wants to merge 27 commits into
base: main
Choose a base branch
from
Open

Inverse equality saturation #1

wants to merge 27 commits into from

Conversation

paulzzy
Copy link
Owner

@paulzzy paulzzy commented Jul 2, 2024

Entry point is egraph.undo_rewrites().

For testing, undo_rewrites is hardcoded to run every iteration of equality saturation. This is too aggressive for real usage, since it strips away useful e-nodes before they can be extracted. As a result most test cases fail (errors are usually of the form goal is not reached). However, inverse equality saturation should never "break" the egraph — right now it skips removing enodes from the original egraph (before rewrites were applied).

Currently, undo_rewrites cannot handle multipatterns (only Patterns) and does not work with explanations enabled.

paulzzy added 24 commits July 20, 2024 13:40
Also, remove `dbg!` statements and don't mark egraph as dirty after
removing enodes
Matches type signature of `Runner::run`
Breaks explanations, specifically `diff_power_harder` in tests/math.rs
fails
Oddly this appears to result in more failures in `cargo test --test math`.
Turns out the math.rs tests were modifying the egraph (see
https://github.com/egraphs-good/egg/blob/ae2db378d25dbe55046d96a7eef25ee9f2916058/tests/math.rs#L98-L99),
so the `None` path being taken is actually a bug if enodes aren't being
removed by my code (`remove_enodes` specifically).
Compare by value instead of ID, since an enode may have multiple IDs (at
least in `egraph.nodes`).
Also, hardcode running inverse equality saturation every iteration for
now.
paulzzy added 2 commits July 25, 2024 21:15
Also improve checking egraph validity when `cfg(debug_assertions)`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant