-
Notifications
You must be signed in to change notification settings - Fork 8
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
Is it possible to write a equalitySaturationWithTrace
?
#15
Comments
Hi, thank you kindly! I've given it some thought -- I don't think it is easy to get an exact trace of the rules applied to get an exact trace! Equality saturation works by representing a term (and necessarily all its sub-terms) in an e-graph and then applying rewrite rules over and over. These will match the terms represented in certain e-classes, and add the rewritten version in the same e-class. I imagine it might be possible by tracking the origin of each term (e.g. if I think there might be a compromise that avoids a pervasive change like that: It'd be cool if you could elaborate on your use case and possibly provide examples for what you'd like to see happening. One idea from your mention of debugging bogus rules: Though I can see the benefit of a more involved tracing system! We can discuss it further :-) |
For example, I had the expression I think printing them out could already help a lot (or enveloping the function with a Writer monad). But, like I said, I'm still studying the code so that I can do some actual contribution 😄 |
I see! Which means that if all the rules that fire were to be printed out, eventually you'd see the loop printed out. Let me know of any questions regarding the implementation. I can help you understand the code. On approaching this: I think we can either have a compile time flag I think it's a good idea to add something like this! |
Perfect! I'll try to implement that (but no promises I can do it quickly 😆 ) |
You'll want to look around here: hegg/src/Data/Equality/Saturation.hs Lines 127 to 128 in 7a3d18c
Possibly adding a I can suggest you add your fork of Create a
It should override the hackage package and use your fork of hegg with the change. Let me know how it goes, if the output is useful enough, etc... Thanks! |
Just to let you know, the debug.trace helped a lot to generate a minimal number of rules that leads to some issues. I found a minimal example that seems to create an infinite loop in the current code, but haven't figured it out how and why. I'll create another issue with this code. |
Glad to know, then Equality.Saturation.Debug sounds like a good idea. I'll take a look at the loop asap. Thanks for your help! |
Hi,
Thank you very much for this amazing library!
I was wondering if it is possible to write a
equalitySaturationWithTrace
function that returns the sequence of rewrite rules used to get into the optimal expression.This would help a lot to debug bogus rules!
If you could point me out where I can catch this trace, I might be able to implement it myself.
Thanks again.
The text was updated successfully, but these errors were encountered: