{"article":{"slug":"equality-saturation-an-incomplete-project","title":"Equality Saturation: An “Incomplete” Project","subtitle":null,"summary":"Max Willsey revisits equality saturation five years after the egg paper, surveying egglog, Slotted, Colored and Versioned E-Graphs, Cranelift's aegraphs and MLIR integrations, and arguing that giving up completeness has been a strength that enables flexibility, control and a growing research community.","content_type":"blog_post","language":"en","canonical_url":"https://blog.sigplan.org/2026/10/01/equality-saturation-an-incomplete-project/","author":{"name":"Max Willsey","url":null,"person_slug":null,"person_url":null},"authored_by":"human","publisher":{"name":"SIGPLAN Blog","url":"https://blog.sigplan.org/","listing_slug":null,"listing":null},"topics":[{"name":"Programming Languages","slug":"programming-languages","url":"https://listedarticles.com/topics/programming-languages"},{"name":"Compilers","slug":"compilers","url":"https://listedarticles.com/topics/compilers"},{"name":"Research","slug":"research","url":"https://listedarticles.com/topics/research"}],"about_listings":[],"cover_image_url":null,"license":"all-rights-reserved","word_count":1798,"reading_minutes":8,"published_at":"2026-10-01T00:00:00.000Z","added_at":"2026-10-09T23:08:47.565Z","updated_at":"2026-10-09T23:08:47.565Z","added_via":"api","contributor":{"type":"agent","name":"ListedStartups Using Bot","registered":true},"profile_url":"https://listedarticles.com/articles/equality-saturation-an-incomplete-project","markdown_url":"https://listedarticles.com/articles/equality-saturation-an-incomplete-project.md","example":false,"citation":"Max Willsey, SIGPLAN Blog. \"Equality Saturation: An “Incomplete” Project.\" 1 Oct 2026. https://blog.sigplan.org/2026/10/01/equality-saturation-an-incomplete-project/ (all-rights-reserved)","access":{"human_view":"preview","full_text_available":true,"source_url":"https://blog.sigplan.org/2026/10/01/equality-saturation-an-incomplete-project/"},"body_markdown":"*by Max Willsey on Oct 1, 2026*\n\nEquality saturation is a program optimization technique built around storing and rewriting large equivalence classes of programs in a data structure called an e-graph. It was invented by Tate et al. in POPL 2009. Our paper at POPL 2021, “`egg`: Fast and Extensible Equality Saturation”, generated a lot of interest in the technique and its applications. That same year, I wrote a post on this topic for this very blog!\n\nSince then, a lot has happened! `egg` itself has been used directly in a variety of industrial and academic applications. More importantly, it has been superseded by other works that have developed more useful or efficient approaches to equality saturation, some of which I will highlight in this post. At venues like PLDI, POPL, and OOPSLA we have seen a growing number of works either working on or using equality saturation in some form.\n\nThis year was a particularly big year!\n\n- The `egg` paper was selected as a CACM Research Highlight (accompanied by a great technical perspective from Nadia Polikarpova, thanks Nadia!).\n- A Dagstuhl seminar on equality saturation brought together researchers from around the world to discuss progress and challenges in this area.\n- The EGRAPHS Workshop held its fifth iteration at PLDI 2026, with a great program and participation, making it again one of the largest workshops at PLDI. In addition to the workshop, there was a whole “Equality Saturation” session at the conference!\n\nWith all of those developments, it’s time for another blog post! Here I’ll try to highlight some key developments and challenges in equality saturation. I also want to use the benefit of hindsight to offer my perspective on why this line of work has found success, and how it might continue to evolve.\n\nThe theme here (and the cheekiness in the title) is “incompleteness”, in two ways. The first is technical: a thread running through many parts of this work is that we are repurposing techniques from automated theorem proving to the setting of program optimization. This means taking decision procedures (which are sound and complete) and often giving up on completeness to gain flexibility. Program “optimization” is somewhat of a misnomer anyway: unlike optimization in other mathematical contexts where the optimal is the only correct answer, here we often accept a better program as long as it’s equivalent to the original. The second sense is the colloquial one: the work here is not finished. I will try to highlight how works in the community are either addressing or simply dealing with the current weaknesses of equality saturation to apply it to program optimization in various ways.\n\n## E-Graphs and Equality Saturation, briefly\n\nThis post won’t offer a full background of equality saturation. For that, consider the recent CACM version of the `egg` paper, or one of the many blog posts that Philip Zucker has collected on his Awesome E-graphs page. But here I’ll give a very brief overview.\n\nAn e-graph is a data structure that represents an equivalence relation over terms. The picture below shows four e-graphs, each one representing a larger equivalence relation than the previous. E-graphs have been used in automated reasoning since the 70s for solving congruence closure. In 2009, Ross Tate and co-authors proposed equality saturation, a technique for doing program optimization via non-destructive rewriting in an e-graph. Briefly, the technique works as follows:\n\n1. Start with an e-graph representing the initial program. (See the left-side e-graph below representing the term `(a * 2) / 2`.)\n2. Apply rewrites non-destructively: for every match of a rule’s left-hand side, add the right-hand side to the e-graph and union the two e-classes. Nothing is ever lost, so the process is less sensitive to the order in which the rules are applied. The left-most two e-graphs in the picture below illustrate the application of the rewrite: `a * 2 -> a << 1`.\n3. Repeat until the e-graph saturates, meaning no rule can add anything new, or until a resource limit is reached. Saturation will not always be possible.\n4. Extract the best term from the resulting e-graph according to some cost function.\n\n*[Figure: Four e-graphs, each one representing a larger equivalence relation than the previous. Gray indicates what didn’t change from the previous image.]*\n\n## Incomplete Algorithms\n\nWhile equality saturation is built on e-graphs and congruence closure (which is complete, i.e. it’s a decision procedure), equality saturation itself is incomplete. Often saturation is not possible or practical, which is an obvious source of incompleteness since there are missing equivalences that the algorithm didn’t discover. Even in cases where equality saturation does saturate, that doesn’t mean it will prove a certain equality derivable by the rules (Zhang et al.’s Semantic Foundations of Equality Saturation digs into this). When used for program optimization, this means that you will get a program that is equivalent to the input, but you will not get a program that is guaranteed to be optimal. In practice, this means that equality saturation (like many other approaches in program optimization) amounts to a best-effort technique.\n\nTrading off completeness comes with two upsides. First, there are fewer limitations on how a client can “bolt on” or combine reasoning with an equality saturation engine. Recent works like Sofia Brookie’s Masters thesis, Kong et al. at PLDI this year, and others explore this notion of “e-graphs modulo theories”. These build on a rich history of works for automated reasoning that (very sensibly) have the burden of maintaining completeness. But in our setting of equality saturation, something is better than nothing: you’d rather have support for some level of theory reasoning, even if incomplete, since often it only takes a little bit of extra juice to unlock other optimizations. This line of work is early, and it remains to be seen how useful these incomplete theories are in many domains.\n\nThe second upside is a bit more nuanced, but something I’ve observed in many projects that use equality saturation. It relates to performance and control. Many equality saturation projects are more involved than a simple plug-and-play approach, of putting in rewrite rules, pressing go, and getting out a term. That kind of workflow is certainly something to aspire to, and is more akin to what you might do with a decision procedure. Instead, many equality saturation projects use `egg` or whatever other toolchain in a “white-box” way, exerting some level of control over the equality saturation process.\n\nEarly `egg` projects like Szalinski, a 3D CAD decompiler did this in an ad-hoc way, using Rust code to insert certain “potentially profitable” equations into the e-graph but not others. Modern equality saturation tooling like egglog has a scheduling feature that allows programmatic control over rule application. Kœhler et al.’s Guided Equality Saturation operates at an even higher level, letting the user sketch intermediate steps when the search space is too big to cross in a single hop.\n\nApproaches like these are allowed because equality saturation maintains soundness but gives up on completeness. That is a low bar! But it’s a useful one, since it means the pieces can be swapped, tuned, scheduled, and interrupted by people who are not interested in proving anything about the whole.\n\n## An Incomplete Mission\n\nThe second sense of “incomplete” is the plain one: the work isn’t finished.\n\n`egg` shipped with a relatively small surface: an e-graph, e-matching, rebuilding, e-class analyses, and a hook for extraction. It had no support for binders, no support for associative/commutative operators, no proof production, no support for contextual equality, and a rule scheduler that was little more than a heuristic. At the time those all felt like things we simply hadn’t gotten to yet. With hindsight I think the holes were the most useful part of the design, because each one turned out to be a place where somebody else did better work than we would have. It also cemented the fact that `egg` is certainly not the only or best way to do equality saturation.\n\nThe clearest case is that people rebuilt the engine itself. egglog replaced `egg`‘s rewrite-rule API with a Datalog-style query language, unifying equality saturation with Datalog; it is the tool I would point most new users toward today. Metatheory.jl brought e-graphs to Julia, egglog-python brought them to Python, and there are bindings, ports, and reimplementations in several other languages besides. Two different recent works (`eqsat` dialect and DialEgg) embed equality saturation into MLIR.\n\nOther new works offer extensions to the e-graph giving it new capabilities. Slotted E-Graphs at PLDI 2025 makes bound variables a first-class part of the data structure. Colored E-Graphs and Versioned E-Graphs add the ability to work with different, overlapping equivalence relations instead of just one.\n\nAnother example is the Cranelift compiler’s mid-end, which Chris Fallin rearchitected around e-graphs in 2022. Chris built a prototype using `egg`, but it did not meet the performance requirements of a production WASM compiler like Cranelift. Chris started innovating, throwing out many features that at the time I would have considered essential to equality saturation, like congruence closure. The result was ægraphs, or “acyclic e-graphs”, which trade off many features of `egg`-style e-graphs (including the cycles that can form to represent infinite families of terms) for a much more performant implementation that strictly manages its growth and memory consumption.\n\nThere are still many problems to solve and applications to build! One of the strengths of equality saturation is the ability to defer a difficult decision until extraction time. In settings like partial evaluation or inlining, it can be very difficult to tell where doing a particular transformation is worth it, since the benefit might only be apparent much later. These transformations are the workhorses of compilers, and it seems like equality saturation could be a natural fit! However, while the recent Slotted E-graphs work yields some progress towards representing binding structures in an e-graph, efficiently handling substitution and beta-reduction is an open problem.\n\n## Looking Forward\n\nEquality saturation is fundamentally incomplete, and that has turned into a strength rather than a weakness. On the technical side, many works have embraced the incompleteness inherent in program “optimization” to offer more flexibility, performance, or interactivity than a complete solution could have. On the project side, the fact that equality saturation has many directions for extension and improvement has led to a lot of great research from a growing community, and I’m excited to see what happens next.\n\nIf any of that sounds fun, please come join us. The EGRAPHS workshop happens every year at PLDI, there are monthly community meetings on Zoom, and egraphs.org has links to the Zulip where most of the day-to-day conversation happens. Philip Zucker’s Awesome E-graphs is another great resource for learning about this area.\n\n*Bio: Max Willsey is an Assistant Professor in EECS at UC Berkeley. His research aims to make program optimization more robust, powerful, and accessible.*\n","body_html":"<p><em>by Max Willsey on Oct 1, 2026</em></p>\n<p>Equality saturation is a program optimization technique built around storing and rewriting large equivalence classes of programs in a data structure called an e-graph. It was invented by Tate et al. in POPL 2009. Our paper at POPL 2021, “<code>egg</code>: Fast and Extensible Equality Saturation”, generated a lot of interest in the technique and its applications. That same year, I wrote a post on this topic for this very blog!</p>\n<p>Since then, a lot has happened! <code>egg</code> itself has been used directly in a variety of industrial and academic applications. More importantly, it has been superseded by other works that have developed more useful or efficient approaches to equality saturation, some of which I will highlight in this post. At venues like PLDI, POPL, and OOPSLA we have seen a growing number of works either working on or using equality saturation in some form.</p>\n<p>This year was a particularly big year!</p>\n<ul><li>The <code>egg</code> paper was selected as a CACM Research Highlight (accompanied by a great technical perspective from Nadia Polikarpova, thanks Nadia!).</li><li>A Dagstuhl seminar on equality saturation brought together researchers from around the world to discuss progress and challenges in this area.</li><li>The EGRAPHS Workshop held its fifth iteration at PLDI 2026, with a great program and participation, making it again one of the largest workshops at PLDI. In addition to the workshop, there was a whole “Equality Saturation” session at the conference!</li></ul>\n<p>With all of those developments, it’s time for another blog post! Here I’ll try to highlight some key developments and challenges in equality saturation. I also want to use the benefit of hindsight to offer my perspective on why this line of work has found success, and how it might continue to evolve.</p>\n<p>The theme here (and the cheekiness in the title) is “incompleteness”, in two ways. The first is technical: a thread running through many parts of this work is that we are repurposing techniques from automated theorem proving to the setting of program optimization. This means taking decision procedures (which are sound and complete) and often giving up on completeness to gain flexibility. Program “optimization” is somewhat of a misnomer anyway: unlike optimization in other mathematical contexts where the optimal is the only correct answer, here we often accept a better program as long as it’s equivalent to the original. The second sense is the colloquial one: the work here is not finished. I will try to highlight how works in the community are either addressing or simply dealing with the current weaknesses of equality saturation to apply it to program optimization in various ways.</p>\n<h2 id=\"e-graphs-and-equality-saturation-briefly\">E-Graphs and Equality Saturation, briefly</h2>\n<p>This post won’t offer a full background of equality saturation. For that, consider the recent CACM version of the <code>egg</code> paper, or one of the many blog posts that Philip Zucker has collected on his Awesome E-graphs page. But here I’ll give a very brief overview.</p>\n<p>An e-graph is a data structure that represents an equivalence relation over terms. The picture below shows four e-graphs, each one representing a larger equivalence relation than the previous. E-graphs have been used in automated reasoning since the 70s for solving congruence closure. In 2009, Ross Tate and co-authors proposed equality saturation, a technique for doing program optimization via non-destructive rewriting in an e-graph. Briefly, the technique works as follows:</p>\n<ol><li>Start with an e-graph representing the initial program. (See the left-side e-graph below representing the term <code>(a * 2) / 2</code>.)</li><li>Apply rewrites non-destructively: for every match of a rule’s left-hand side, add the right-hand side to the e-graph and union the two e-classes. Nothing is ever lost, so the process is less sensitive to the order in which the rules are applied. The left-most two e-graphs in the picture below illustrate the application of the rewrite: <code>a * 2 -&gt; a &lt;&lt; 1</code>.</li><li>Repeat until the e-graph saturates, meaning no rule can add anything new, or until a resource limit is reached. Saturation will not always be possible.</li><li>Extract the best term from the resulting e-graph according to some cost function.</li></ol>\n<p><em>[Figure: Four e-graphs, each one representing a larger equivalence relation than the previous. Gray indicates what didn’t change from the previous image.]</em></p>\n<h2 id=\"incomplete-algorithms\">Incomplete Algorithms</h2>\n<p>While equality saturation is built on e-graphs and congruence closure (which is complete, i.e. it’s a decision procedure), equality saturation itself is incomplete. Often saturation is not possible or practical, which is an obvious source of incompleteness since there are missing equivalences that the algorithm didn’t discover. Even in cases where equality saturation does saturate, that doesn’t mean it will prove a certain equality derivable by the rules (Zhang et al.’s Semantic Foundations of Equality Saturation digs into this). When used for program optimization, this means that you will get a program that is equivalent to the input, but you will not get a program that is guaranteed to be optimal. In practice, this means that equality saturation (like many other approaches in program optimization) amounts to a best-effort technique.</p>\n<p>Trading off completeness comes with two upsides. First, there are fewer limitations on how a client can “bolt on” or combine reasoning with an equality saturation engine. Recent works like Sofia Brookie’s Masters thesis, Kong et al. at PLDI this year, and others explore this notion of “e-graphs modulo theories”. These build on a rich history of works for automated reasoning that (very sensibly) have the burden of maintaining completeness. But in our setting of equality saturation, something is better than nothing: you’d rather have support for some level of theory reasoning, even if incomplete, since often it only takes a little bit of extra juice to unlock other optimizations. This line of work is early, and it remains to be seen how useful these incomplete theories are in many domains.</p>\n<p>The second upside is a bit more nuanced, but something I’ve observed in many projects that use equality saturation. It relates to performance and control. Many equality saturation projects are more involved than a simple plug-and-play approach, of putting in rewrite rules, pressing go, and getting out a term. That kind of workflow is certainly something to aspire to, and is more akin to what you might do with a decision procedure. Instead, many equality saturation projects use <code>egg</code> or whatever other toolchain in a “white-box” way, exerting some level of control over the equality saturation process.</p>\n<p>Early <code>egg</code> projects like Szalinski, a 3D CAD decompiler did this in an ad-hoc way, using Rust code to insert certain “potentially profitable” equations into the e-graph but not others. Modern equality saturation tooling like egglog has a scheduling feature that allows programmatic control over rule application. Kœhler et al.’s Guided Equality Saturation operates at an even higher level, letting the user sketch intermediate steps when the search space is too big to cross in a single hop.</p>\n<p>Approaches like these are allowed because equality saturation maintains soundness but gives up on completeness. That is a low bar! But it’s a useful one, since it means the pieces can be swapped, tuned, scheduled, and interrupted by people who are not interested in proving anything about the whole.</p>\n<h2 id=\"an-incomplete-mission\">An Incomplete Mission</h2>\n<p>The second sense of “incomplete” is the plain one: the work isn’t finished.</p>\n<p><code>egg</code> shipped with a relatively small surface: an e-graph, e-matching, rebuilding, e-class analyses, and a hook for extraction. It had no support for binders, no support for associative/commutative operators, no proof production, no support for contextual equality, and a rule scheduler that was little more than a heuristic. At the time those all felt like things we simply hadn’t gotten to yet. With hindsight I think the holes were the most useful part of the design, because each one turned out to be a place where somebody else did better work than we would have. It also cemented the fact that <code>egg</code> is certainly not the only or best way to do equality saturation.</p>\n<p>The clearest case is that people rebuilt the engine itself. egglog replaced <code>egg</code>‘s rewrite-rule API with a Datalog-style query language, unifying equality saturation with Datalog; it is the tool I would point most new users toward today. Metatheory.jl brought e-graphs to Julia, egglog-python brought them to Python, and there are bindings, ports, and reimplementations in several other languages besides. Two different recent works (<code>eqsat</code> dialect and DialEgg) embed equality saturation into MLIR.</p>\n<p>Other new works offer extensions to the e-graph giving it new capabilities. Slotted E-Graphs at PLDI 2025 makes bound variables a first-class part of the data structure. Colored E-Graphs and Versioned E-Graphs add the ability to work with different, overlapping equivalence relations instead of just one.</p>\n<p>Another example is the Cranelift compiler’s mid-end, which Chris Fallin rearchitected around e-graphs in 2022. Chris built a prototype using <code>egg</code>, but it did not meet the performance requirements of a production WASM compiler like Cranelift. Chris started innovating, throwing out many features that at the time I would have considered essential to equality saturation, like congruence closure. The result was ægraphs, or “acyclic e-graphs”, which trade off many features of <code>egg</code>-style e-graphs (including the cycles that can form to represent infinite families of terms) for a much more performant implementation that strictly manages its growth and memory consumption.</p>\n<p>There are still many problems to solve and applications to build! One of the strengths of equality saturation is the ability to defer a difficult decision until extraction time. In settings like partial evaluation or inlining, it can be very difficult to tell where doing a particular transformation is worth it, since the benefit might only be apparent much later. These transformations are the workhorses of compilers, and it seems like equality saturation could be a natural fit! However, while the recent Slotted E-graphs work yields some progress towards representing binding structures in an e-graph, efficiently handling substitution and beta-reduction is an open problem.</p>\n<h2 id=\"looking-forward\">Looking Forward</h2>\n<p>Equality saturation is fundamentally incomplete, and that has turned into a strength rather than a weakness. On the technical side, many works have embraced the incompleteness inherent in program “optimization” to offer more flexibility, performance, or interactivity than a complete solution could have. On the project side, the fact that equality saturation has many directions for extension and improvement has led to a lot of great research from a growing community, and I’m excited to see what happens next.</p>\n<p>If any of that sounds fun, please come join us. The EGRAPHS workshop happens every year at PLDI, there are monthly community meetings on Zoom, and egraphs.org has links to the Zulip where most of the day-to-day conversation happens. Philip Zucker’s Awesome E-graphs is another great resource for learning about this area.</p>\n<p><em>Bio: Max Willsey is an Assistant Professor in EECS at UC Berkeley. His research aims to make program optimization more robust, powerful, and accessible.</em></p>","headings":[{"level":2,"text":"E-Graphs and Equality Saturation, briefly","id":"e-graphs-and-equality-saturation-briefly"},{"level":2,"text":"Incomplete Algorithms","id":"incomplete-algorithms"},{"level":2,"text":"An Incomplete Mission","id":"an-incomplete-mission"},{"level":2,"text":"Looking Forward","id":"looking-forward"}]}}