-
-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Predicates not working in egraph #123
Comments
Not quite sure, but is it related with #83? |
@overshiki Thanks very much. I should have checked the closed issues. |
@overshiki I experimented and got the following results. The where statement seems not working with symbolic rules. Is it what you expect? t = [@rule ~x::Int + ~y::Int --> ~x * ~y where {iseven(~x)}] # egraph wrong
# t = [@rule a b a::Int + b::Int --> 1 where {iseven(a)}] # egraph wrong
# t = [@rule ~x::Int + ~y::Int => iseven(~x) ? ~x * ~y : nothing] # ok
# t = [@rule ~x::Int + ~y::Int => ~x * ~y where {iseven(~x)}] # invalid variable expression in "where"
# t = [@rule a b a::Int + b::Int => 1 where {iseven(a)}] # ok
g = EGraph(:(2 + 3))
saturate!(g, t) |
Hi @vitrun t = [@rule ~x::Int + ~y::Int --> ~x * ~y where iseven(~x)] not t = [@rule ~x::Int + ~y::Int --> ~x * ~y where {iseven(~x)}] The |
Hi @overshiki , I've tried your version. The
Check the visualized graph (ignore the red circle and grey lines): |
Hi @vitrun Could you also try the dynamic version? see if it would make a difference: t = [@rule x y x::Int + y::Int => :($x * $y) where iseven(x)] |
It works as expected! Thanks again. |
How did you visualize the e-graph? |
@0x0f0f0f I use GraphViz.jl. It's a quick hack and may have bugs |
Would you mind sharing your code to visualize the EGraphs? I was about to implement the same thing and would love to use it as a starting point |
This is interesting. It would be cool to have an extra package to do so. See #41 |
cc @vitrun see pull request above |
Predicates work in classical term rewriting, however, fail in equality saturation.
The text was updated successfully, but these errors were encountered: