Skip to content
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

Merged
merged 2 commits into from
Dec 19, 2023
Merged

Conversation

kroening
Copy link
Member

@kroening kroening commented Oct 27, 2023

  • 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.

@kroening kroening force-pushed the decision-procedure-API branch 2 times, most recently from 1ad4119 to 11f6e8d Compare October 27, 2023 12:48
@kroening kroening force-pushed the decision-procedure-API branch from 11f6e8d to 752b318 Compare October 27, 2023 13:45
@codecov
Copy link

codecov bot commented Oct 27, 2023

Codecov Report

Attention: 3 lines in your changes are missing coverage. Please review.

Comparison is base (5341b44) 79.08% compared to head (bbedeea) 79.08%.

Files Patch % Lines
src/solvers/smt2/smt2_conv.cpp 50.00% 3 Missing ⚠️
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.
📢 Have feedback on the report? Share it here.

@kroening kroening force-pushed the decision-procedure-API branch 2 times, most recently from fa810f5 to 7ff8ea9 Compare October 27, 2023 20:54
@kroening kroening marked this pull request as ready for review October 27, 2023 21:06
Copy link
Collaborator

@martin-cs martin-cs left a 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.
@kroening kroening force-pushed the decision-procedure-API branch from 7ff8ea9 to bbedeea Compare December 18, 2023 16:17
decision_proceduret::~decision_proceduret()
{
}

decision_proceduret::resultt decision_proceduret::operator()()
{
return dec_solve();
return dec_solve(nil_exprt());
}
Copy link
Collaborator

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.

Copy link
Member Author

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.

Copy link
Collaborator

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?

Copy link
Member Author

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.

Copy link
Member Author

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.

@tautschnig tautschnig merged commit 3a1272a into develop Dec 19, 2023
38 checks passed
@tautschnig tautschnig deleted the decision-procedure-API branch December 19, 2023 08:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants