Skip to content

Context-based solver interface for incremental solvers [depends: 4451, blocks: 4361] #4054

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

@peterschrammel peterschrammel commented Feb 3, 2019

Based on #4451 - only review last 4 commits.

Upstreams part of 2LS's push/pop incremental solver interface

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

tautschnig
tautschnig previously approved these changes Feb 3, 2019
/// Solve the current formula
decision_proceduret::resultt dec_solve() override;

/// Convert a boolean expression \p expr
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nit pick: s/boolean/Boolean/

incremental_solvert::incremental_solvert(
const namespacet &ns,
prop_convt &prop_conv)
: prop_convt(ns), prop_conv(prop_conv)
Copy link
Collaborator

Choose a reason for hiding this comment

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

#4043 makes the useless namespacet go away...

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks!!!

Copy link
Collaborator

Choose a reason for hiding this comment

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

Though you'll now have to clean this one up...


/// A `prop_convt` that wraps another `prop_convt` and provides
/// a push/pop-context interface for incremental solving
class incremental_solvert : public prop_convt
Copy link
Collaborator

@tautschnig tautschnig Feb 3, 2019

Choose a reason for hiding this comment

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

I'm aware this is a non-trivial ask, but it would be really nice to have a unit test documenting 1) how this is used and 2) that it works as claimed. Just pushing two or three context and solve a simple Boolean problem.

{
// We create a new context literal.
literalt context_literal = prop_conv.convert(symbol_exprt(
"symex::context$" + std::to_string(context_literal_counter++),
Copy link
Collaborator

Choose a reason for hiding this comment

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

Make this magic string a static class member?

Copy link
Member

Choose a reason for hiding this comment

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

"symex" is certainly not happening here.

@kroening
Copy link
Member

kroening commented Feb 3, 2019

The naming here is confusing. The propt interface is already incremental (you could give it the get_number_of_solver_calls() method).

What gets added is the push/pop. Call it push_pop_solver? stack_solver?

@kroening
Copy link
Member

kroening commented Feb 3, 2019

Maybe context_solver?

@kroening
Copy link
Member

kroening commented Feb 3, 2019

Also, set_assumptions becomes unusable, I suppose? I would then add an implementation with PRECONDITION(false).

@peterschrammel peterschrammel changed the title Incremental solver interface Context-based solver interface for incremental solvers Feb 3, 2019
@peterschrammel peterschrammel force-pushed the incremental-solver-interface branch from a84771b to 157e191 Compare February 3, 2019 22:24
@peterschrammel peterschrammel force-pushed the incremental-solver-interface branch 4 times, most recently from f9663a4 to be7b0bb Compare February 3, 2019 23:01
{
// unsupported
UNREACHABLE;
}
Copy link
Member

Choose a reason for hiding this comment

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

Simply return false here!

{
// unsupported
UNREACHABLE;
}
Copy link
Member

Choose a reason for hiding this comment

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

Same here

@peterschrammel peterschrammel force-pushed the incremental-solver-interface branch 3 times, most recently from db3620a to d726a2b Compare February 6, 2019 09:25
@kroening
Copy link
Member

kroening commented Feb 6, 2019

The hierarchy is not quite right yet.
There should an interface, which extends decision_proceduret; it shouldn't prescribe implementation via propt.
Then there's a particular kind of implementing this, using propt, which will be derived from prop_convt.

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.

✔️
Passed Diffblue compatibility checks (cbmc commit: d726a2b).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/99902719

@tautschnig
Copy link
Collaborator

@peterschrammel This needs a rebase (and consideration of @kroening's comment).

@peterschrammel peterschrammel force-pushed the incremental-solver-interface branch from d726a2b to d5eb781 Compare March 10, 2019 16: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.

✔️
Passed Diffblue compatibility checks (cbmc commit: 76774fe).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/105672538

@martin-cs
Copy link
Collaborator

Seems like a reasonable thing to want (I note that push/pop seem to be loosing favour in the SMT community in favour of solver-under-assumption). Shout when this is ready to be reviewed.

decision_procedure_incrementalt will then be further split
into support for assumptions and contexts.
@peterschrammel peterschrammel changed the title [WIP] Context-based solver interface for incremental solvers [blocks: 4361] [WIP] Context-based solver interface for incremental solvers [depends: 4451, blocks: 4361] 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).
Puts the type check into a single place
@peterschrammel peterschrammel force-pushed the incremental-solver-interface branch from 76774fe to 56caec2 Compare March 28, 2019 23:35
Also allows using raw assumptions within contexts
(as required by minimization and refinement algorithms).
Must not bypass prop_conv_solvert::set_assumptions by calling
prop directly.
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: ac58131).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/106293396
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.

@peterschrammel peterschrammel changed the title [WIP] Context-based solver interface for incremental solvers [depends: 4451, blocks: 4361] Context-based solver interface for incremental solvers [depends: 4451, blocks: 4361] Mar 29, 2019
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: 9e50465).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/106306303
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.

@peterschrammel
Copy link
Member Author

Obsolete

@peterschrammel peterschrammel deleted the incremental-solver-interface branch April 30, 2019 15:50
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.

5 participants