Skip to content

Separate interface for solving under assumptions [depends: 4450, blocks: 4054] #4451

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

peterschrammel
Copy link
Member

Based on #4450, only review last commit.

  • 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.
  • 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).
  • My commit message includes data points confirming performance improvements (if claimed).
  • My PR is restricted to a single feature or bugfix.
  • White-space or formatting changes outside the feature-related changed lines are in commits of their own.

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.

Am unsure but I guess it makes sense to resolve the discussion around #4450 first.


void decision_procedure_assumptionst::set_assumptions(const bvt &)
{
UNREACHABLE;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this be pure virtual or something else? Base implementations of methods that are just "nope!" make me kinda nervous.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True, I've actually thought I had patched that. Will change.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

{
public:
/// Set assumptions for the next call to operator() to solve the problem
virtual void set_assumptions(const bvt &);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this / should this be a separate call? If the solver is deterministic then it's not like you are going to call solve multiple times? One reason it might be separate is that you want to be able to call this multiple times, but, if that is the case, do you need interfaces to manage and remove these?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no particular reason except legacy. You can remove assumptions by passing an empty bvt.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we are going to refactor then really the assumptions should be an argument to the solve call and not stateful.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better yet; it can be an argument and a result of the solve call so we can get back a reduced set of assumptions that are sufficient to give UNSAT.

@peterschrammel peterschrammel force-pushed the inremental-dp-assumptions branch from 6b7e292 to 1de02f5 Compare March 28, 2019 14:19
@peterschrammel
Copy link
Member Author

@martin-cs, another question is whether is_in_conflict should be placed on top of assumptions. This would be justified as smt2_convt can emulate assumptions, but cannot do is_in_conflict.

@peterschrammel peterschrammel force-pushed the inremental-dp-assumptions branch 3 times, most recently from 03739c1 to de0f768 Compare March 28, 2019 17:29
decision_procedure_incrementalt will then be further split
into support for assumptions and contexts.
@peterschrammel peterschrammel changed the title Separate interface for solving under assumptions [depends: 4450] Separate interface for solving under assumptions [depends: 4450, blocks: 4054] Mar 28, 2019
Makes it explicit which algorithms actually require this feature.
This is only provided by the prop_conv_solvert-based hierarchy
at the moment and is quite specific to MiniSAT-based solvers.
The functionality itself is used out-of-tree only (2LS).
@peterschrammel peterschrammel force-pushed the inremental-dp-assumptions branch from de0f768 to a17fb36 Compare March 28, 2019 20:34
Copy link
Contributor

@allredj allredj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️
This PR failed Diffblue compatibility checks (cbmc commit: a17fb36).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/106239885
Status will be re-evaluated on next push.
Common spurious failures include: the cbmc commit has disappeared in the mean time (e.g. in a force-push); the author is not in the list of contributors (e.g. first-time contributors); compatibility was already broken by an earlier merge.

@martin-cs
Copy link
Collaborator

To my mind is_in_conflict is something for an incremental solver interface (i.e. the main interface) rather than solve under assumption. If you are monotonically adding to a set of constraints then tracking (maybe triggering solve?) when a call to solve has returned UNSAT is a meaningful thing to do. If you are working with assumptions then it is just making the interface more stateful than it needs to be.

@peterschrammel
Copy link
Member Author

@martin-cs, no. Minisat Solver.cc:401: ...express the final conflict in terms of assumptions. Calculates the (possibly empty) set of assumptions that led to the assignment of 'p', and stores the result in 'out_conflict'.

@martin-cs
Copy link
Collaborator

@peterschrammel : my point is that this could be wrapped by this API and made into a single call to solve : set of assumptions -> SAT | set of contradictory assumptions. The actual solver is going to be very stateful but our interface to it can be a lot less stateful.

@peterschrammel
Copy link
Member Author

obsolete

@peterschrammel peterschrammel deleted the inremental-dp-assumptions branch April 30, 2019 15:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants