JuliaSymbolics / Metatheory.jl

Makes Julia reason with equations. General purpose metaprogramming, symbolic computation and algebraic equational reasoning library for the Julia programming language: E-Graphs & equality saturation, term rewriting and more.
https://juliasymbolics.github.io/Metatheory.jl/dev/
MIT License
357 stars 47 forks source link

Unable to saturate #124

Closed vitrun closed 2 years ago

vitrun commented 2 years ago

Cases as simple as :(0+0+0) are unlikely to saturate. Let's go through the process:

  1. 0 + 0 matches a + a --> 2a, resulted in 2 * 0
  2. 0 + 2 * 0 matches a + b * a --> (b + 1) * a, resulted in 3 * 0
  3. ..., resulted in 4 * 0

and it goes on forever.

Let's ignore a + b * a --> (b + 1) * a, and consider the commutative and associative rules only. They explode the egraph too. Adding three digits:

How can we deal with this kind of situations?

vitrun commented 2 years ago

Maybe we can prune those noisy 2 * 0, 3 * 0

0x0f0f0f commented 2 years ago

Check this out! https://github.com/egraphs-good/egg/discussions/60

vitrun commented 2 years ago

@0x0f0f0f Thanks. I read it through and it clears things up.

vitrun commented 2 years ago

@0x0f0f0f Thanks. I read it through and it clears things up.

0x0f0f0f commented 2 years ago

Can close? @vitrun