-
Notifications
You must be signed in to change notification settings - Fork 274
decision_proceduret interface #4497
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
src/solvers/flattening/functions.h
Outdated
@@ -37,7 +39,7 @@ class functionst | |||
} | |||
|
|||
protected: | |||
prop_convt &prop_conv; | |||
decision_proceduret &decision_procedure; |
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.
It's strange to see a file live under flattening
but then not actually use the propositional variant of a decision procedure.
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.
It really is a 'lowering', and should move there.
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.
Now moved.
1934a1b
to
0fe5d36
Compare
162168d
to
cabf713
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.
Lgtm as an intermediate step
cabf713
to
384f64e
Compare
Literal is not the correct term in this context. It's a boolean variable that is equal to a predicate. I don't see anything specific to DPLL SAT here. The problem is that the interface exposes the implementation by using |
src/solvers/prop/prop_conv.h
Outdated
|
||
// API that provides a "handle" in the form of a literalt | ||
// for expressions. | ||
|
||
class prop_convt:public decision_proceduret | ||
class prop_convt : public prop_decision_proceduret |
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.
That means smt2_convt
still implements prop_decision_proceduret
.
The more I think about this PR the more doubts I have.
The predicate handle interface is something useful to have also in smt2
. It is required for some of our algorithms and hence it doesn't make sense not to have a common interface for SAT-based implementations and SMT-based ones. IMO prop_decision_proceduret
should be generalised, renamed and moved up into solvers/
.
384f64e
to
4e1b143
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.
This PR failed Diffblue compatibility checks (cbmc commit: 4e1b143).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/107502331
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.
The problem here is the confusion between an interface and a particular realisation. The It's fully agreed that the 'handle' for a propositional expression is useful. However, that handle shouldn't be fixed to be an integer with a sign flag. None of the users of the current interface in fact care about that. In particular, observe that |
Furthermore, note that |
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.
Stopped short of blocking this PR, but admittedly I'm not very happy with the current state.
- Moving functions.{h,cpp} to lowering seems like the right thing to do and should just happen, maybe in a separate PR if there is further discussion on this one.
- Let's please stop using (possibly ambiguous) abbreviations. If "prop" stands for "propositional" then let's use "propositional." If it means something else then it is even more urgent that it be spelled out.
- The main concern: it seems ok that an
smt_convt
(also) is-aprop_convt
. But the class hierarchy appears messed up to me. Why is the conversion a decision procedure? And is there actually value in theprop_convt
interface at all?
Ok, let's split:
|
Would you mind elaborating as to why |
Ah, ok, let me be more precise: right now, |
Ok. But can we at this point achieve a clean separation between a decision procedure (which ought to implement the |
1.-3. are an improvement, in particular, generalising the handle interface (which would have made the motivation for #4440 clearer). The changes here are orthogonal to #4450, #4451 and #4054, though, which tackle a different problem: distinguishing the various (incremental) solver features so that we don't have a god-interface @kroening, can you sketch a plan how you'd like to move this forward beyond 1.-3.? |
@tautschnig on _convt being a decision procedure: The problem here is that an algorithm, i.e., an implementation got used as an interface. The variants of *_convt do implement decision procedures, so should inherit from |
Can we just fix this?
Maybe the fix is just to rename
That last part I again struggle with: is "encoding" and "solver" the same thing? Maybe "encoding" is such an integral part of a solver that it is. In my opinion, we care about the process going from an |
Roadmap proposal:
|
That is what steps 1-3 in the proposed roadmap do.
There is more work to do than just rename; the final name might be something well understood in the academic community, say "theory_combinationt". We could go for "solver_combinationt" to make it less scary.
An encoding (or "reduction") is one way of realising a solver, but there are certainly others. The process to go from a formula to a model is commonly a "decision procedure". Implementing that via reduction to something simpler is very common these days, but not essence of it. The current |
I don't think |
Also, #4450 (comment) must be accounted for. |
The lower bar for these refactorings is to make #4361 pass CI with MiniSAT. I'd call them a success if it also passes with Z3. |
In addition to what @peterschrammel said:
I would just ask for a design involving that "final" name rather than intermediate steps that will come and go. |
@peterschrammel The key problem with #4361 is freezing. |
@tautschnig I am not to concerned about the final name of the implementation of the combination solver. Users won't see it; they see the interface, and they see an instance that comes with a particular set of theories. |
Then this needs to be solved with highest priority - otherwise it is a stopper in doing this refactoring if we end up with the "right interfaces" that are not usable. |
b20067a
to
541383f
Compare
Item 1 now there! |
541383f
to
f810a35
Compare
src/solvers/prop/prop_conv.h
Outdated
@@ -22,6 +22,9 @@ class prop_convt:public decision_proceduret | |||
|
|||
using decision_proceduret::operator(); | |||
|
|||
// handle |
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.
Maybe the notes from the roadmap (explaining that this could be a literal_exprt
or a symbol or a BDD node or ...) can be copied in here instead of this comment?
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.
Shouldn't that be abstract here and implemented in prop_conv_solvert
? Only prop_conv_solvert
would use literal_exprt
, other implementations of prop_convt
might not?
@@ -54,6 +60,7 @@ class decision_proceduret | |||
|
|||
/// Return value of literal \p l from satisfying assignment. | |||
/// Return tvt::UNKNOWN if not available | |||
/// This will go away, use get instead. |
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.
Mark as deprecated?
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.
Will remove the usage first (not a lot).
@@ -34,8 +34,14 @@ class decision_proceduret | |||
void set_to_false(const exprt &expr); | |||
|
|||
/// Convert a Boolean expression and return the corresponding literal | |||
/// This will go away, use handle(expr) instead |
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.
Mark as deprecated? The sooner we mark it as deprecated, the earlier we can remove it ;-)
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.
This PR failed Diffblue compatibility checks (cbmc commit: b20067a).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/108055107
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.
f810a35
to
9c3774b
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.
✔️
Passed Diffblue compatibility checks (cbmc commit: 9c3774b).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/108163619
This re-establishes a simpler interface for solvers. In particular, the concept of 'literal' is not exposed, which is specific to DPLL-style SAT solvers.
The new interface is in particular a much better fit for SMT2 solvers, which right now need to emulate a CNF-style interface.