mirror of
https://github.com/Z3Prover/z3
synced 2025-07-18 18:36:41 +00:00
add assertions
This commit is contained in:
parent
9a987237d5
commit
c11bd79484
2 changed files with 25 additions and 19 deletions
|
@ -428,10 +428,9 @@ namespace sat {
|
||||||
}
|
}
|
||||||
|
|
||||||
++m_stats.m_non_learned_generation;
|
++m_stats.m_non_learned_generation;
|
||||||
if (!m_searching) {
|
if (!m_searching)
|
||||||
m_mc.add_clause(num_lits, lits);
|
m_mc.add_clause(num_lits, lits);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
switch (num_lits) {
|
switch (num_lits) {
|
||||||
|
@ -945,6 +944,7 @@ namespace sat {
|
||||||
|
|
||||||
void solver::assign_core(literal l, justification j) {
|
void solver::assign_core(literal l, justification j) {
|
||||||
SASSERT(value(l) == l_undef);
|
SASSERT(value(l) == l_undef);
|
||||||
|
SASSERT(!m_trail.contains(l) && !m_trail.contains(~l));
|
||||||
TRACE("sat_assign_core", tout << l << " " << j << "\n";);
|
TRACE("sat_assign_core", tout << l << " " << j << "\n";);
|
||||||
if (j.level() == 0) {
|
if (j.level() == 0) {
|
||||||
if (m_config.m_drat)
|
if (m_config.m_drat)
|
||||||
|
@ -3654,11 +3654,14 @@ namespace sat {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
m_trail.shrink(old_sz);
|
m_trail.shrink(old_sz);
|
||||||
|
DEBUG_CODE(for (literal l : m_trail) SASSERT(lvl(l.var()) <= new_lvl););
|
||||||
m_qhead = m_trail.size();
|
m_qhead = m_trail.size();
|
||||||
if (!m_replay_assign.empty()) IF_VERBOSE(20, verbose_stream() << "replay assign: " << m_replay_assign.size() << "\n");
|
if (!m_replay_assign.empty()) IF_VERBOSE(20, verbose_stream() << "replay assign: " << m_replay_assign.size() << "\n");
|
||||||
CTRACE("sat", !m_replay_assign.empty(), tout << "replay-assign: " << m_replay_assign << "\n";);
|
CTRACE("sat", !m_replay_assign.empty(), tout << "replay-assign: " << m_replay_assign << "\n";);
|
||||||
for (unsigned i = m_replay_assign.size(); i-- > 0; ) {
|
for (unsigned i = m_replay_assign.size(); i-- > 0; ) {
|
||||||
literal lit = m_replay_assign[i];
|
literal lit = m_replay_assign[i];
|
||||||
|
SASSERT(value(lit) == l_true);
|
||||||
|
SASSERT(!m_trail.contains(lit) && !m_trail.contains(~lit));
|
||||||
m_trail.push_back(lit);
|
m_trail.push_back(lit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3709,11 +3712,11 @@ namespace sat {
|
||||||
//
|
//
|
||||||
|
|
||||||
void solver::user_push() {
|
void solver::user_push() {
|
||||||
|
|
||||||
pop_to_base_level();
|
pop_to_base_level();
|
||||||
m_free_var_freeze.push_back(m_free_vars);
|
m_free_var_freeze.push_back(m_free_vars);
|
||||||
m_free_vars.reset(); // resetting free_vars forces new variables to be assigned above new_v
|
m_free_vars.reset(); // resetting free_vars forces new variables to be assigned above new_v
|
||||||
bool_var new_v = mk_var(true, false);
|
bool_var new_v = mk_var(true, false);
|
||||||
|
SASSERT(new_v + 1 == m_justification.size()); // there are no active variables that have higher values
|
||||||
literal lit = literal(new_v, false);
|
literal lit = literal(new_v, false);
|
||||||
m_user_scope_literals.push_back(lit);
|
m_user_scope_literals.push_back(lit);
|
||||||
m_cut_simplifier = nullptr; // for simplicity, wipe it out
|
m_cut_simplifier = nullptr; // for simplicity, wipe it out
|
||||||
|
@ -4832,20 +4835,22 @@ namespace sat {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void solver::init_visited() {
|
void solver::init_ts(unsigned n, svector<unsigned>& v, unsigned& ts) {
|
||||||
if (m_visited.empty()) {
|
if (v.empty())
|
||||||
m_visited_ts = 0;
|
ts = 0;
|
||||||
}
|
|
||||||
m_visited_ts++;
|
ts++;
|
||||||
if (m_visited_ts == 0) {
|
if (ts == 0) {
|
||||||
m_visited_ts = 1;
|
ts = 1;
|
||||||
m_visited.reset();
|
v.reset();
|
||||||
}
|
|
||||||
while (m_visited.size() < 2*num_vars()) {
|
|
||||||
m_visited.push_back(0);
|
|
||||||
}
|
}
|
||||||
|
while (v.size() < n)
|
||||||
|
v.push_back(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void solver::init_visited() {
|
||||||
|
init_ts(2 * num_vars(), m_visited, m_visited_ts);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -343,6 +343,7 @@ namespace sat {
|
||||||
void push_reinit_stack(clause & c);
|
void push_reinit_stack(clause & c);
|
||||||
void push_reinit_stack(literal l1, literal l2);
|
void push_reinit_stack(literal l1, literal l2);
|
||||||
|
|
||||||
|
void init_ts(unsigned n, svector<unsigned>& v, unsigned& ts);
|
||||||
void init_visited();
|
void init_visited();
|
||||||
void mark_visited(literal l) { m_visited[l.index()] = m_visited_ts; }
|
void mark_visited(literal l) { m_visited[l.index()] = m_visited_ts; }
|
||||||
void mark_visited(bool_var v) { mark_visited(literal(v, false)); }
|
void mark_visited(bool_var v) { mark_visited(literal(v, false)); }
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue