-
Notifications
You must be signed in to change notification settings - Fork 56
Back translation for Princess rewrites #527
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
Open
daniel-raffler
wants to merge
24
commits into
master
Choose a base branch
from
princessVisitorImprovements
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
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
Princess will rewrite multiplication/division by introducing epsilon terms, which are not supported by JavaSmt. We use pattern matching to undo the transformation and restore the original formula
# Conflicts: # src/org/sosy_lab/java_smt/solvers/princess/PrincessFormulaCreator.java
This seems to have gotten lost during the last merge
…getFormulaType() Both operations seem to be "abstract" in Princess and we need to manually calculate the bitsize of the resulting vector
We need to add 1 to the bitvector size for bv_extract. The lower bit is included
# Conflicts: # src/org/sosy_lab/java_smt/solvers/princess/PrincessEnvironment.java # src/org/sosy_lab/java_smt/solvers/princess/PrincessModel.java
…or the formula visitor
… in the formula visitor
Princess will occasionally return terms like (= term 0), even thought this isn't the canonical representation. This causes problems later as "(= term 0)" != "(=0 term)", even though the two formulas represent the same term
…te again Princess sometimes does not have a proof, even though the solver stack should not have changed. Repeating the sat-check generates a new proof, and interpolation may then succeed
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.
Hello everyone,
this PR aims to address some of the issues that came up while working on the tracing delegate. Specifically, Princess will often rewrite formulas for operations like multiplication, divison or floor using quantifiers and epsilon terms. As an example let's take the formula
RationalFormulaManager.floor(RationalFormulamanager.makeNumber(0.5)). Here Princess will produce the following expression:While the expression is logically equivalent, and solvers are allowed to make some rewrites, such a fundamental transformation makes is quite hard to understand the meaning of the term. More importantly, it will cause crashes in our visitor as epsilon terms are not supported by JavaSMT. Because of this many formulas in Princess currently can't be visited.
In this PR we try to fix the problem by translating Princess formulas back to their original operations. This is done by using pattern matching in the visitor: We first create a set of patterns by evaluating operations like
flooror division on some generic arguments, f.exRationalFormulaManager.floor(a)orRationalFormlaManager.divide(a, b)wherea,bare variables. Then we match those patterns against the current formula in the visitor. If they can be unified the substitution is then used to recover the original arguments for the operation. We then visit the operation with the recovered arguments and skip any quantifiers or epsilon terms that Princess has createdThe number of patterns that are needed is relatively small and currently looks like this:
Note that for some operations we need several patterns to cover all cases. We should make sure that these patterns are indeed always enough to match the terms that Princess returns. However, from my experience the transformation that Princess applies is relatively static and the solver doesn't try to optimize these terms any further.
We could alternatively still ask the Princess developers to handle the back translation for us. However, I haven't opened an issue about this yet.