mirror of
https://github.com/Z3Prover/z3
synced 2025-10-16 04:20:25 +00:00
Fix missing boolean propagation after boolean conflict
Usually in SAT solving, the conflict clause has at least two false literals at the max level (otherwise, the last literal would have been propagated at an earlier level). But here we are adding clauses on demand; so after backtracking we may have the case that the conflict clause has exactly one undefined literal that must be propagated explicitly.
This commit is contained in:
parent
783bd60598
commit
0d56edb65c
7 changed files with 66 additions and 20 deletions
|
@ -69,9 +69,11 @@ namespace polysat {
|
|||
m_clauses[clause_level].push_back(cl);
|
||||
}
|
||||
|
||||
void constraint_manager::store(clause* cl, bool value_propagate) {
|
||||
void constraint_manager::store(clause* cl) {
|
||||
VERIFY(!cl->is_active());
|
||||
register_clause(cl);
|
||||
watch(*cl, value_propagate);
|
||||
watch(*cl);
|
||||
cl->set_active();
|
||||
}
|
||||
|
||||
// Release constraints at the given level and above.
|
||||
|
@ -137,12 +139,11 @@ namespace polysat {
|
|||
SASSERT(std::all_of(cl.begin() + 1, cl.end(), [&](auto lit) { return get_watch_level(lit) <= get_watch_level(cl[1]); }));
|
||||
}
|
||||
|
||||
void constraint_manager::watch(clause& cl, bool value_propagate) {
|
||||
void constraint_manager::watch(clause& cl) {
|
||||
if (cl.empty())
|
||||
return;
|
||||
|
||||
if (value_propagate) {
|
||||
#if 1
|
||||
{
|
||||
// First, try to bool-propagate.
|
||||
// Otherwise, we might get a clause-conflict and a missed propagation after resolving the conflict.
|
||||
// With this, we will get a constraint-conflict instead.
|
||||
|
@ -180,7 +181,6 @@ namespace polysat {
|
|||
s.assign_eval(~lit);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
if (cl.size() == 1) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue