3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-08-28 14:08:55 +00:00

fix bug in conflict::is_valid exposed by testing unit propagation

This commit is contained in:
Nikolaj Bjorner 2023-04-02 14:54:20 -07:00
parent dcc87a682c
commit ae57475483
3 changed files with 34 additions and 9 deletions

View file

@ -211,8 +211,8 @@ namespace polysat {
bool conflict::is_valid() const {
SASSERT(!empty());
// If m_dep is set, the corresponding constraint was asserted at m_level and is not valid earlier.
if (!m_dep.is_null())
return m_level <= s.m_level;
if (!m_dep.is_null() && m_level >= s.m_level)
return false;
// All conflict constraints must be bool-assigned.
for (unsigned lit_idx : m_literals)
if (!s.m_bvars.is_assigned(sat::to_literal(lit_idx)))
@ -636,8 +636,8 @@ namespace polysat {
if (s.m_bvars.is_assumption(lit)) {
// only assumptions have external dependencies
dependency const d = s.m_bvars.dep(lit);
if (!d.is_null())
deps.insert(d.val());
if (!d.is_null())
deps.insert(d.val());
}
else if (s.m_bvars.is_bool_propagation(lit)) {
IF_VERBOSE(11, verbose_stream() << " reason " << *s.m_bvars.reason(lit) << "\n";);

View file

@ -95,10 +95,33 @@ namespace polysat {
}
lbool solver::unit_propagate() {
#if 1
return l_undef;
// disabled to allow debugging unsoundness for watched literals
#elif 1
unsigned level = m_level;
SASSERT(!m_is_solving);
backjump(base_level());
if (!is_conflict())
propagate();
VERIFY(level == m_level);
if (is_conflict()) {
++m_stats.m_num_conflicts;
return l_false;
}
return l_undef;
#else
flet<uint64_t> _max_d(m_config.m_max_conflicts, m_stats.m_num_conflicts + 2);
return check_sat();
unsigned level = m_level;
lbool r = check_sat();
if (r != l_false) {
backjump(level);
m_conflict.reset();
}
SASSERT(level == m_level);
return r;
#endif
}
dd::pdd_manager& solver::sz2pdd(unsigned sz) const {