[Middlend] Non-linear and definite iteration pattern simplification#224
Open
DCupello1 wants to merge 4 commits into
Open
[Middlend] Non-linear and definite iteration pattern simplification#224DCupello1 wants to merge 4 commits into
DCupello1 wants to merge 4 commits into
Conversation
… expansion in order to remove some non-linear bindings.
Draft
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.
This pass simplifies definite iteration and non-linear patterns
by utilizing premises. This is done to make functions be able to
match the pattern matching of proof assistants.
It achieves this through the following steps:
of all variables in expressions. If a variable appears more
than once, we generate a fresh version of the variable and
keep it for later.
the variables tracked to generate new quantifiers and equality
premises.
all variables used for definite iteration (i.e. the e in ListN e _ )
and the respective lists being iterated.
the equality premises.
For example (for non-linear pattern), take the function:
Would be transformed as such:
For definite iteration:
to
Modified test.spectec with some cases (like the ones above).
For the definite iteration pass, it would actually make more sense to use a let premise. However, since it is not properly defined, an equality premise will have to do for now.