-
Notifications
You must be signed in to change notification settings - Fork 270
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
decision_proceduret API with assumptions #7979
Conversation
kroening
commented
Oct 27, 2023
•
edited
Loading
edited
- Each commit message has a non-empty body, explaining why the change was made.
- Methods or procedures I have added are documented, following the guidelines provided in CODING_STANDARD.md.
- n/a The feature or user visible behaviour I have added or modified has been documented in the User Guide in doc/cprover-manual/
- Regression or unit tests are included, or existing tests cover the modified code (in this case I have detailed which ones those are in the commit message).
- n/a My commit message includes data points confirming performance improvements (if claimed).
- My PR is restricted to a single feature or bugfix.
- n/a White-space or formatting changes outside the feature-related changed lines are in commits of their own.
1ad4119
to
11f6e8d
Compare
11f6e8d
to
752b318
Compare
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## develop #7979 +/- ##
========================================
Coverage 79.08% 79.08%
========================================
Files 1696 1697 +1
Lines 196429 196463 +34
========================================
+ Hits 155346 155382 +36
+ Misses 41083 41081 -2 ☔ View full report in Codecov by Sentry. |
fa810f5
to
7ff8ea9
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.
Seems like the sensible thing to do.
The cbmc/hex_trace test pattern relies on a particular value (0) for an uninitialized local variable. This removes the pattern. See https://github.com/diffblue/cbmc/actions/runs/6672135313/job/18269948126?pr=7979 as an exemplar where this was triggered.
This changes the API offered by decision_proceduret to solving under assumptions. Solving under assumptions has been popularised by MiniSat, and is a state-less alternative to context stacks. This change mimics the transition from check-sat to check-sat-assuming that SMT-LIB is undergoing.
7ff8ea9
to
bbedeea
Compare
decision_proceduret::~decision_proceduret() | ||
{ | ||
} | ||
|
||
decision_proceduret::resultt decision_proceduret::operator()() | ||
{ | ||
return dec_solve(); | ||
return dec_solve(nil_exprt()); | ||
} |
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.
My preference would be to use std::optional at the interface rather than nil.
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 was reluctant to do so since that can't avoid copying the expression.
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.
Wouldn't const std::optional<exprt> &
do the trick?
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.
No, you'd still need to copy the expression into the optional when creating the optional.
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.
std::optional< std::reference_wrapper<exprt> >
would work, but then it's getting more verbose.