4118 better indexing for rewrite rules#4120
Merged
Merged
Conversation
… not fail rewrite)
…-sort-difference-with-functions
…g-for-rewrite-rules
`TopFun` index components are set to `Anything` before computing rule indexes to try. The effect is that all rules (for this index component) will be tried, leading to `Aborts` rather than getting `Stuck` (as the test with the unevaluated function shows).
Collaborator
Author
|
KEVM tests with insignificant slowdown
Likewise for kontrol tests:
|
tothtamas28
approved these changes
Jul 17, 2025
|
|
||
| syntax KItem ::= "Done" [symbol(Done)] | ||
|
|
||
| syntax Abcd ::= "A" | "B" |
Contributor
There was a problem hiding this comment.
Consider adding a new sort
syntax Ab ::= "A" [token]
| "B" [token]
Collaborator
Author
There was a problem hiding this comment.
I tried that, but it actually breaks the demonstration of the unsound behaviour (because the tokens get index Anything and the Vrule gets tried first). So I just corrected the indexes in the comments and left the test as-is.
Member
|
I love the lattice formulation, that reflects unification properties very nicely! As long as we respect the properties of unification, we can be sure our rule indexing will be sound! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Indexing is extended to
Cell indexes form a (flat) lattice which is now explicit in a less-or-equal definition.
Rule selection now uses a function that selects all rule indexes which are (as a product lattice) greater than the inverted term index (i.e., top element becomes bottom element), with all function indexes turned into
Anything(top element) before the inversion. The new integration test shows why this is important for soundness.This addresses cases of unevaluated functions in indexed cells where previously booster would (likely) report
Stuckor (unlikely) a wrong result, while the result should beAborted(rules were excluded but they could apply depending on what kind of term the unevaluated function would return when evaluated).Fixes #4118