Skip to content

Commit 879bb4b

Browse files
avoid circular dependencies in justifications that get updated. fixes #7443
1 parent 1856ab7 commit 879bb4b

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

src/sat/sat_solver.cpp

+6-6
Original file line numberDiff line numberDiff line change
@@ -518,12 +518,12 @@ namespace sat {
518518
}
519519

520520
bool solver::propagate_bin_clause(literal l1, literal l2) {
521-
if (value(l2) == l_false) {
521+
if (value(l2) == l_false && value(l1) != l_true) {
522522
m_stats.m_bin_propagate++;
523523
assign(l1, justification(lvl(l2), l2));
524524
return true;
525525
}
526-
if (value(l1) == l_false) {
526+
if (value(l1) == l_false && value(l2) != l_true) {
527527
m_stats.m_bin_propagate++;
528528
assign(l2, justification(lvl(l1), l1));
529529
return true;
@@ -4579,7 +4579,6 @@ namespace sat {
45794579
void solver::extract_fixed_consequences(literal_set const& unfixed_lits, literal_set const& assumptions, bool_var_set& unfixed_vars, vector<literal_vector>& conseq) {
45804580
for (literal lit: unfixed_lits) {
45814581
TRACE("sat", tout << "extract: " << lit << " " << value(lit) << " " << lvl(lit) << "\n";);
4582-
45834582
if (lvl(lit) <= 1 && value(lit) == l_true) {
45844583
extract_fixed_consequences(lit, assumptions, unfixed_vars, conseq);
45854584
}
@@ -4606,7 +4605,8 @@ namespace sat {
46064605
case justification::NONE:
46074606
break;
46084607
case justification::BINARY:
4609-
if (!check_domain(lit, ~js.get_literal())) return false;
4608+
if (!check_domain(lit, ~js.get_literal()))
4609+
return false;
46104610
s |= m_antecedents.find(js.get_literal().var());
46114611
break;
46124612
case justification::CLAUSE: {
@@ -4680,9 +4680,9 @@ namespace sat {
46804680
SASSERT(m_todo_antecedents.empty());
46814681
m_todo_antecedents.push_back(lit);
46824682
while (!m_todo_antecedents.empty()) {
4683-
if (extract_fixed_consequences1(m_todo_antecedents.back(), assumptions, unfixed, conseq)) {
4683+
auto lit = m_todo_antecedents.back();
4684+
if (extract_fixed_consequences1(lit, assumptions, unfixed, conseq))
46844685
m_todo_antecedents.pop_back();
4685-
}
46864686
}
46874687
}
46884688

src/sat/sat_solver.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@ namespace sat {
406406
}
407407
}
408408
void update_assign(literal l, justification j) {
409-
if (j.level() == 0 && !m_trim)
409+
if (j.level() == 0 && !m_trim && lvl(l) != 0)
410410
m_justification[l.var()] = j;
411411
}
412412
void assign_unit(literal l) { assign(l, justification(0)); }

0 commit comments

Comments
 (0)