egg: Fast and Extensible Equality Saturation

E-graphs, originally developed for use in automated theorem provers, are data structures that compactly represent a large number of expressions and the equalities between them. Recently, a technique called equality saturation adapted e-graphs for program optimization. Equality saturation can ameliorate issues with traditional, destructive term rewriting since e-graph rewriting only adds information to the e-graph. After rewriting, the e-graph represents a large space of equivalent terms (including the original term), and a final extraction procedure selects the best term according to a user-provided cost function. The egg library is a fast and flexible open-source implementation of e-graphs and equality saturation. Unlike solvers, egg is a white-box library for programmatic use. Users can easily define their own languages, rewrites, and analyses, and they can inspect and manipulate the e-graph directly. It incorporates novel techniques such as e-class analysis , a mechanism for integrating program analyses modulo equality; and rebuilding , a deferred invariant restoration algorithm. egg has been used in hundreds of academic and industrial projects for program optimization, synthesis, and verification in many domains; some are briefly highlighted in this article.

Authors

Institutions

Publication Details

Journal
Communications of the ACM
Published
2026-07-29
DOI
https://doi.org/10.1145/3815481
Citations
133
Primary Topic
Software Testing and Debugging Techniques
Type
article
Field-Weighted Citation Impact
0.00

Funders

Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
article

egg: Fast and Extensible Equality Saturation

Pavel Panchekha, Zachary Tatlock, Yisu Remy Wang, Max Willsey et al.
133 citations
Communications of the ACM
Software Testing and Debugging Techniques
article

egg: Fast and Extensible Equality Saturation

Pavel Panchekha, Zachary Tatlock, Yisu Remy Wang, Max Willsey, Oliver Flatt, Chandrakana Nandi
article en
133 citations

Abstract

E-graphs, originally developed for use in automated theorem provers, are data structures that compactly represent a large number of expressions and the equalities between them. Recently, a technique called equality saturation adapted e-graphs for program optimization. Equality saturation can ameliorate issues with traditional, destructive term rewriting since e-graph rewriting only adds information to the e-graph. After rewriting, the e-graph represents a large space of equivalent terms (including the original term), and a final extraction procedure selects the best term according to a user-provided cost function. The egg library is a fast and flexible open-source implementation of e-graphs and equality saturation. Unlike solvers, egg is a white-box library for programmatic use. Users can easily define their own languages, rewrites, and analyses, and they can inspect and manipulate the e-graph directly. It incorporates novel techniques such as e-class analysis , a mechanism for integrating program analyses modulo equality; and rebuilding , a deferred invariant restoration algorithm. egg has been used in hundreds of academic and industrial projects for program optimization, synthesis, and verification in many domains; some are briefly highlighted in this article.

Communications of the ACMVol. 69(8)
University of California, Los Angeles (US), University of Washington (US), University of Utah (US), University of Washington Applied Physics Laboratory (US), University of California, Berkeley (US)
National Science Foundation
Sustainable cities and communities, Peace, Justice and strong institutions
Software Testing and Debugging Techniques
AI Navigator

Ask Laika to Summarize, Analyze, and Connect papers live on the map.

Summarize Papers & Methodologies

Extract key findings, datasets, and comparative methods across publications.

Benchmark Rankings & Visual Analytics

Rank top research institutions, authors, funders, topics, and journals by Field-Weighted Citation Impact (FWCI) and paper volume with instant charts.

Connect Distant Disciplines

Bridge topological clusters on the map to find hidden collaborative intersections.