-
Notifications
You must be signed in to change notification settings - Fork 88
Simplify relational witness invariants #1630
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
Conversation
By moving terms and constant to other side.
Other Apron domans output equalities.
|
Are transformation such as avoid negation on both sides actually sound in the presence of overflows? |
If anything, I think it should avoid overflows. The constraint from Apron is on mathematical integers, so Above I described a bunch of small simplifications based on invariants I've seen and how they would look nicer. I started out trying to implement such simplifications, but eventually realized that the following algorithm pretty much does it all: put all terms with positive coefficients on one side and all of the ones with negative coefficients to the other (while removing the negation). So it's just a comparison between two sums. We're still casting everything to |
|
I think @DrMichaelPetter ran into some such issues when trying to assert constraints from his 2-variable domain, where doing some of these innocuous transformations lead to unsoundnesses. Maybe he can elaborate himself in the Gobcon today. |
|
|
Could either of you review this? This simplification is good for both human-readability and avoiding some obvious overflows. |
DrMichaelPetter
left a comment
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.
Ok, it took me some time to understand this idea of partitioning into pterms and nterms, but now I get it. LGTM
|
Thanks! I added some comments to explain the partitioning and also the negation booleans that were there already before. |
Simplifications
0 - x >= 0→-x >= 0.-10 + x >= 0→x >= 10.TODO
-x >= -5→5 >= x.-x + y >= 0→y - x >= 0.x >= 0 && -x >= 0→x == 0.x + 5 = 0→x = -5(only happens if one side is default 0)? Needs ad-hoc logic and extra care to ensure unary minus does not overflow.