-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
introduce notion of beta redex to deal with lambdas in non-extensiona…
…l positions Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
- Loading branch information
1 parent
b9b5377
commit 8efa3c8
Showing
10 changed files
with
65 additions
and
51 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
8efa3c8
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This commit introduces a check for whether a sub-term (array, lambda expression) occurs as a beta redex.
When lambdas occur exclusively as beta redexes, we don't have to enforce extensionality nor require the solver to bail with unknown.
It assumes that beta redex expressions are rewritten to equal term that eliminate the redex for satisfiable instances.
For example, for a satisfiable state the term (seq.map fn S) will be equalized to a sequence term T where S and T have the same length such that each element in T at position i is equal to fn applied to the same element in S at position i.
Equality reasoning for extensional arrays is then avoided for beta redexes, and the solver can produce conclusive answers for a class of uses of lambdas.
Handling of beta redexes is not complete in this commit: for example, a lambda that occurs as an argument to a recursively defined function could also be marked as a beta redex. Future updates can address these (and other) missing filters by overriding is_beta_redex in the theory interface.
8efa3c8
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This patch has a great impact for Alive2. I'm seeing up to 40% reduction in SMT errors in some benchmarks. The number of UNSATs also goes up.
8efa3c8
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Must be bad: you want Alive to produce SAT (to identify bugs) ;>
8efa3c8
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sometimes I sleep better when LLVM is shown to be correct.
8efa3c8
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, if you sleep you don't program. If ou don't program, you don't improve Alive2. If you don't improve Alive2, it will not find bugs.
Can you profile for where it instantiates extensionality axioms? The change adds a filter on unneeded axioms. A question is whether we are missing additional filters. You could validate whether extensionality is instantiated in essential scenarios.
8efa3c8
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, I can do that! But after the semester ends. Z3 won't write a software engineering exam for me (yet).
8efa3c8
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Zzzzz3
8efa3c8
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It turns out that
context::has_lambda()
never returns true in my benchmarks. Our lambdas seem to be all too easy for Z3 it seems.Though we don't use lambdas in a few cases where we could because in the past the performance wasn't great. Maybe I can give it another try at using lambdas in more places.
8efa3c8
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
beta redex applies to more than lambdas. The occurrence of A in select(A,i) is a beta redex.
8efa3c8
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about these? Simple and easy:
I don't know exactly what your bypass can handle, but here's another one that scream to be optimized:
8efa3c8
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
has-lambda returns false for these occurrences because they are in the scope of beta redexes.
The beta-redexes should be expanded by quantifier reasoning.
I am not sure where your "Scream to be optimized" example relates. It is created during search? Then internalized as a lambda instead of beta reduced?
The rewriter can beta reduce.