Rewrite rule inference using equality saturation
Chandrakana Nandi, Max Willsey, Amy Zhu, Yisu Remy Wang, Brett Saiki, Adam Anderson, Adriana Schulz, Dan Grossman, Zachary Tatlock
Abstract
Many compilers, synthesizers, and theorem provers rely on rewrite rules to simplify expressions or prove equivalences. Developing rewrite rules can be difficult: rules may be subtly incorrect, profitable rules are easy to miss, and rulesets must be rechecked or extended whenever semantics are tweaked. Large rulesets can also be challenging to apply: redundant rules slow down rule-based search and frustrate debugging.
This paper explores how equality saturation, a promising technique that uses e-graphs to apply rewrite rules, can also be used to infer rewrite rules. E-graphs can compactly represent the exponentially large sets of enumerated terms and potential rewrite rules. We show that equality saturation efficiently shrinks both sets, leading to faster synthesis of smaller, more general rulesets.
We prototyped these strategies in a tool dubbed Ruler. Compared to a similar tool built on CVC4, Ruler synthesizes 5.8× smaller rulesets 25× faster without compromising on proving power. In an end-to-end case study, we show Ruler-synthesized rules which perform as well as those crafted by domain experts, and addressed a longstanding issue in a popular open source tool.
Ask about this paper
Your agent reads all of it.
Lune indexed this paper to the last equation, along with the top-tier papers that cite it. Ask a question and the answer quotes them.
Your agent calls
Luneget_paper_fulltext
Free to start. No credit card required.
Terminal
Install the CLIlune papers fulltext af7b9fc5-cc0d-4687-a373-8cc824c33c21Cited by top-tier papers18
- babble: Learning Better Abstractions with E-Graphs and Anti-unificationDavid Cao, Rose Kunkel, Chandrakana Nandi, Max Willsey et al.POPL 2023 · 38 citations
- Better Together: Unifying Datalog and Equality SaturationYihong Zhang, Yisu Remy Wang, Oliver Flatt, David Cao et al.PLDI 2023 · 38 citations
- WeTune: Automatic Discovery and Verification of Query Rewrite RulesZhaoguo Wang, Zhou Zhou, Yicun Yang, Haoran Ding et al.SIGMOD 2022 · 35 citations
- NeuRI: Diversifying DNN Generation via Inductive Rule InferenceJiawei Liu, Jinjun Peng, Yuyao Wang, Lingming ZhangFSE 2023 · 24 citations
- SEER: Super-Optimization Explorer for High-Level Synthesis using E-graph RewritingJianyi Cheng, Samuel Coward, Lorenzo Chelini, Rafael Barbalho et al.ASPLOS 2024 · 18 citations
Builds on6
- Alive2: bounded translation validation for LLVMNuno P. Lopes, Juneyoung Lee, Chung-Kil Hur, Zhengyang Liu et al.PLDI 2021 · 109 citations
- Synthesizing structured CAD models with equality saturation and inverse transformationsChandrakana Nandi, Max Willsey, Adam Anderson, James R. Wilcox et al.PLDI 2020 · 65 citations
- Vectorization for digital signal processors via equality saturationAlexa VanHattum, Rachit Nigam, Vincent T. Lee, James Bornholt et al.ASPLOS 2021 · 57 citations
- Semantic code search via equational reasoningVarot Premtoon, James Koppel, Armando Solar-LezamaPLDI 2020 · 49 citations
- Theory Exploration Powered by Deductive SynthesisEytan Singher, Shachar ItzhakyCAV 2021 · 19 citations
Related papers
- Equality Saturation Theory Exploration à la CarteAnjali Pal, Brett Saiki, Ryan Tjoa, Cynthia Richey et al.OOPSLA 2023 · 11 citations
- Fast and Optimal Extraction for Sparse Equality GraphsAmir Kafshdar Goharshady, Chun Kit Lam, Lionel ParreauxOOPSLA 2024 · 11 citations
- egg: Fast and extensible equality saturationMax Willsey, Chandrakana Nandi, Yisu Remy Wang, Oliver Flatt et al.POPL 2021 · 170 citations
- Guided Equality SaturationThomas Koehler, Andrés Goens, Siddharth Bhat, Tobias Grosser et al.POPL 2024 · 9 citations
- Improving Equality Saturation for EDA via Semantic E-GraphsSijie Kong, Jingtao Xia, Daniel Ruelas-Petrisko, Zachary D. Sisco et al.PLDI 2026
