Lune

POPL2021Top-tier venue

egg: Fast and extensible equality saturation

Max Willsey, Chandrakana Nandi, Yisu Remy Wang, Oliver Flatt, Zachary Tatlock, Pavel Panchekha

Abstract

An e-graph efficiently represents a congruence relation over many expressions. Although they were originally developed in the late 1970s for use in automated theorem provers, a more recent technique known as equality saturation repurposes e-graphs to implement state-of-the-art, rewrite-driven compiler optimizations and program synthesizers. However, e-graphs remain unspecialized for this newer use case. Equality saturation workloads exhibit distinct characteristics and often require ad hoc e-graph extensions to incorporate transformations beyond purely syntactic rewrites. This work contributes two techniques that make e-graphs fast and extensible, specializing them to equality saturation. A new amortized invariant restoration technique called rebuilding takes advantage of equality saturation's distinct workload, providing asymptotic speedups over current techniques in practice. A general mechanism called e-class analyses integrates domain-specific analyses into the e-graph, reducing the need for ad hoc manipulation.

We implemented these techniques in a new open-source library called egg. Our case studies on three previously published applications of equality saturation highlight how egg's performance and flexibility enable state-of-the-art results across diverse domains.

Ask Lune

Know this paper in minutes, not an afternoon.

Lune can read every page of it and the top-tier papers that cite it, and gives you its claims, its evidence and its limits, each one cited to the paper it comes from. No skimming, no AI slop.

74 top-tier papers have cited it since. Know what they found before your reviewers do.

Questions to start from

Lune can draw on

the full paper · the top-tier papers that cite it · related work

Get the answer

Free to start. No credit card required.

Lineage

  • babble: Learning Better Abstractions with E-Graphs and Anti-unification cites Synthesizing structured CAD models with equality saturation and inverse transformations
  • babble: Learning Better Abstractions with E-Graphs and Anti-unification cites SPORES: Sum-Product Optimization via Relational Equality Saturation for Large Scale Linear Algebra
  • Synthesizing Quantum-Circuit Optimizers cites Alive2: bounded translation validation for LLVM
  • Better Together: Unifying Datalog and Equality Saturation cites Synthesizing structured CAD models with equality saturation and inverse transformations
  • Better Together: Unifying Datalog and Equality Saturation cites SPORES: Sum-Product Optimization via Relational Equality Saturation for Large Scale Linear Algebra
Builds onCited byLeft to right by year; the more cited, the higher.

Cited by top-tier papers74

  1. Alive2: bounded translation validation for LLVMNuno P. Lopes, Juneyoung Lee, Chung-Kil Hur, Zhengyang Liu et al.PLDI 2021 · 109 citations
  2. vChain+: Optimizing Verifiable Blockchain Boolean Range QueriesHaixin Wang, Cheng Xu, Ce Zhang, Jianliang Xu et al.ICDE 2022 · 95 citations
  3. Synthesizing Quantum-Circuit OptimizersAmanda Xu, Abtin Molavi, Lauren Pick, Swamit Tannu et al.PLDI 2023 · 41 citations
  4. babble: Learning Better Abstractions with E-Graphs and Anti-unificationDavid Cao, Rose Kunkel, Chandrakana Nandi, Max Willsey et al.POPL 2023 · 38 citations
  5. Better Together: Unifying Datalog and Equality SaturationYihong Zhang, Yisu Remy Wang, Oliver Flatt, David Cao et al.PLDI 2023 · 38 citations

Builds on3

  1. Synthesizing structured CAD models with equality saturation and inverse transformationsChandrakana Nandi, Max Willsey, Adam Anderson, James R. Wilcox et al.PLDI 2020 · 65 citations
  2. Semantic code search via equational reasoningVarot Premtoon, James Koppel, Armando Solar-LezamaPLDI 2020 · 49 citations
  3. SPORES: Sum-Product Optimization via Relational Equality Saturation for Large Scale Linear AlgebraYisu Remy Wang, Shana Hutchison, Dan Suciu, Bill Howe et al.VLDB 2020

Related papers

  1. Dis/Equality GraphsGeorge Zakhour, Pascal Weisenburger, Jahrim Gabriele Cesario, Guido SalvaneschiPOPL 2025 · 3 citations
  2. Fast and Optimal Extraction for Sparse Equality GraphsAmir Kafshdar Goharshady, Chun Kit Lam, Lionel ParreauxOOPSLA 2024 · 11 citations
  3. Improving Equality Saturation for EDA via Semantic E-GraphsSijie Kong, Jingtao Xia, Daniel Ruelas-Petrisko, Zachary D. Sisco et al.PLDI 2026
  4. Slotted E-Graphs: First-Class Support for (Bound) Variables in E-GraphsRudi Schneider, Marcus Rossel, Amir Shaikhha, Andrés Goens et al.PLDI 2025 · 1 citation
  5. Rewrite rule inference using equality saturationChandrakana Nandi, Max Willsey, Amy Zhu, Yisu Remy Wang et al.OOPSLA 2021 · 35 citations
Dusk over the sea between two cliffs drawn in fine vertical lines