Skip to content

Commit 6bd46b0

Browse files
fix #7363. Replay relevancy on unit literals that are re-asserted during backtracking.
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
1 parent cfd00ad commit 6bd46b0

File tree

3 files changed

+19
-15
lines changed

3 files changed

+19
-15
lines changed

src/smt/mam.cpp

+5-3
Original file line numberDiff line numberDiff line change
@@ -3940,9 +3940,11 @@ namespace {
39403940
}
39413941
return;
39423942
}
3943-
for (unsigned i = 0; i < num_bindings; i++) {
3944-
SASSERT(bindings[i]->get_generation() <= max_generation);
3945-
}
3943+
DEBUG_CODE(
3944+
for (unsigned i = 0; i < num_bindings; i++) {
3945+
SASSERT(bindings[i]->get_generation() <= max_generation);
3946+
});
3947+
39463948
#endif
39473949
unsigned min_gen = 0, max_gen = 0;
39483950
m_interpreter.get_min_max_top_generation(min_gen, max_gen);

src/smt/smt_context.cpp

+7-10
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ namespace smt {
7171
m_l_internalized_stack(m),
7272
m_final_check_idx(0),
7373
m_cg_table(m),
74-
m_units_to_reassert(m),
7574
m_conflict(null_b_justification),
7675
m_not_l(null_literal),
7776
m_conflict_resolution(mk_conflict_resolution(m, *this, m_dyn_ack_manager, p, m_assigned_literals, m_watches)),
@@ -2186,7 +2185,7 @@ namespace smt {
21862185
unsigned i = s.m_units_to_reassert_lim;
21872186
unsigned sz = m_units_to_reassert.size();
21882187
for (; i < sz; i++) {
2189-
expr * unit = m_units_to_reassert.get(i);
2188+
expr* unit = m_units_to_reassert[i].m_unit.get();
21902189
cache_generation(unit, new_scope_lvl);
21912190
}
21922191
}
@@ -2377,19 +2376,18 @@ namespace smt {
23772376
unsigned i = units_to_reassert_lim;
23782377
unsigned sz = m_units_to_reassert.size();
23792378
for (; i < sz; i++) {
2380-
expr * unit = m_units_to_reassert.get(i);
2379+
auto& [unit, sign, is_relevant] = m_units_to_reassert[i];
23812380
bool gate_ctx = true;
23822381
internalize(unit, gate_ctx);
23832382
bool_var v = get_bool_var(unit);
2384-
bool sign = m_units_to_reassert_sign[i] != 0;
23852383
literal l(v, sign);
23862384
assign(l, b_justification::mk_axiom());
2385+
if (is_relevant)
2386+
mark_as_relevant(l);
23872387
TRACE("reassert_units", tout << "reasserting #" << unit->get_id() << " " << sign << " @ " << m_scope_lvl << "\n";);
23882388
}
2389-
if (at_base_level()) {
2390-
m_units_to_reassert.reset();
2391-
m_units_to_reassert_sign.reset();
2392-
}
2389+
if (at_base_level())
2390+
m_units_to_reassert.reset();
23932391
}
23942392

23952393
/**
@@ -4310,8 +4308,7 @@ namespace smt {
43104308
bool unit_sign = lits[0].sign();
43114309
while (m.is_not(unit, unit))
43124310
unit_sign = !unit_sign;
4313-
m_units_to_reassert.push_back(unit);
4314-
m_units_to_reassert_sign.push_back(unit_sign);
4311+
m_units_to_reassert.push_back({ expr_ref(unit, m), unit_sign, is_relevant(unit) });
43154312
TRACE("reassert_units", tout << "asserting " << mk_pp(unit, m) << " #" << unit->get_id() << " " << unit_sign << " @ " << m_scope_lvl << "\n";);
43164313
}
43174314

src/smt/smt_context.h

+7-2
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,12 @@ namespace smt {
7171
enode_pp(enode* n, context const& ctx): ctx(ctx), n(n) {}
7272
};
7373

74+
struct replay_unit {
75+
expr_ref m_unit;
76+
bool m_sign;
77+
bool m_relevant;
78+
};
79+
7480
class context {
7581
friend class model_generator;
7682
friend class lookahead;
@@ -183,8 +189,7 @@ namespace smt {
183189
clause_vector m_aux_clauses;
184190
clause_vector m_lemmas;
185191
vector<clause_vector> m_clauses_to_reinit;
186-
expr_ref_vector m_units_to_reassert;
187-
svector<char> m_units_to_reassert_sign;
192+
vector<replay_unit> m_units_to_reassert;
188193
literal_vector m_assigned_literals;
189194
typedef std::pair<clause*, literal_vector> tmp_clause;
190195
vector<tmp_clause> m_tmp_clauses;

0 commit comments

Comments
 (0)