-
Notifications
You must be signed in to change notification settings - Fork 63
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
Rewriter loop? #746
Comments
Yeah, that looks like a rewriter loop. Rewriting for commutativity manually doesn't tend to work well. The rule |
There is some loop detection in Cryptol. We get a |
Of course, even with these extra checks on permutative rewrite rules, it's still possible to make a rewriter loop using combinations of two or more rules. It might be possible (but might be expensive) to detect when the rewriter is creating the same exact term repeatedly. But other rewrite rules can yield infinite loops of ever-larger terms that are never the same, so in general I don't think it's possible to prevent all forms of looping rewrites. One easy thing we could do is add some configurable resource limits to the saw-core rewriter, so that the rewriter could quit with an error message instead of just running forever in situations like this. |
Does @msaaltink's recent work (GaloisInc/saw-core#173) apply here? |
It should apply to these specific rules. It is certainly not going to prevent or even detect all loops,though; there are rules like I think ACL2 has some interesting loop detection capability but I forget the details. |
The termination of rewriting systems is, in general, a very difficult and deep topic. Are there other low-hanging fruit here we can pick, or should we close this ticket? |
I recently learned about E-graphs, which are data structures for efficiently storing many equivalent/rewritten versions of the same term and performaing pattern-matching style rewrites on them. These are nice because they make the order of rewrites less important, and they "saturate", making issues with rewrites like commutativity and associativity less serious. This definitely isn't "low-hanging fruit", but might be worth considering if the rewriter is ever overhauled. |
I agree that it probably makes sense to close this ticket, because it's kind of vague and open-ended. We already have a more specific issue #1266 about choosing the right term ordering for permutative rewrite rules. If we want to implement some other specific fix, e.g. adding some kind of resource bounds to the rewriter, we should open a separate ticket for that. |
Is the rewriter going in a loop here? If so, I'm not sure why...
The text was updated successfully, but these errors were encountered: