-
Notifications
You must be signed in to change notification settings - Fork 278
fix distinct operator #5827
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
fix distinct operator #5827
Conversation
39653c5
to
522b3a1
Compare
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.
Sorry but I don't think this is the correct semantics. I think that distinct
is pair-wise inequality.
src/solvers/smt2/smt2_parser.cpp
Outdated
else | ||
{ | ||
std::vector<exprt> pairwise_constraints; | ||
for(std::size_t i = 0; i < op.size();) |
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.
I don't think this is the semantics of SMT-LIB distinct
. It is described here ( http://smtlib.cs.uiowa.edu/theories-Core.shtml ) as:
(par (A) (distinct A A Bool :pairwise))
And :pairwise
is described on Page 34 of http://smtlib.cs.uiowa.edu/papers/smt-lib-reference-v2.6-r2017-07-18.pdf as:
[pairwise annotation] (f t1···tn) is syntactic sugar (recursively) for (and (f t1 t2) ··· (f t1 tn) (f t2···tn)).
This adds support for the distinct operator in SMTlib, by directly translating it into "not equal" Prior to this change, the distinct operator was ignored, giving incorrect results
522b3a1
to
9778868
Compare
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.
Much better -- thank you!
{ | ||
for(std::size_t j = i; j < op.size(); j++) | ||
{ | ||
if(i != j) |
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.
You could start at j = i + 1
and skip this check if you wanted.
Codecov Report
@@ Coverage Diff @@
## develop #5827 +/- ##
===========================================
+ Coverage 69.08% 72.85% +3.76%
===========================================
Files 1242 1423 +181
Lines 100842 154072 +53230
===========================================
+ Hits 69667 112244 +42577
- Misses 31175 41828 +10653
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
Adds support for distinct operator in smt2 parser (which is syntactic sugar for a pairwise "not equal" predicate). Previously operator was parsed but later ignored