mirror of
https://github.com/Z3Prover/z3
synced 2025-04-23 09:05:31 +00:00
fixing cancellation code paths for inc_sat_solver
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
b1d673e3eb
commit
ca309341c3
5 changed files with 41 additions and 15 deletions
|
@ -3158,7 +3158,14 @@ namespace sat {
|
|||
init_search();
|
||||
propagate(false);
|
||||
if (inconsistent()) return l_false;
|
||||
init_assumptions(asms.size(), asms.c_ptr(), 0, 0);
|
||||
if (asms.empty()) {
|
||||
bool_var v = mk_var(true, false);
|
||||
literal lit(v, false);
|
||||
init_assumptions(1, &lit, 0, 0);
|
||||
}
|
||||
else {
|
||||
init_assumptions(asms.size(), asms.c_ptr(), 0, 0);
|
||||
}
|
||||
propagate(false);
|
||||
if (check_inconsistent()) return l_false;
|
||||
|
||||
|
@ -3169,6 +3176,7 @@ namespace sat {
|
|||
checkpoint();
|
||||
literal_set::iterator it = vars.begin(), end = vars.end();
|
||||
unsigned num_resolves = 0;
|
||||
lbool is_sat = l_true;
|
||||
for (; it != end; ++it) {
|
||||
literal lit = *it;
|
||||
if (value(lit) != l_undef) {
|
||||
|
@ -3179,8 +3187,10 @@ namespace sat {
|
|||
propagate(false);
|
||||
while (inconsistent()) {
|
||||
if (!resolve_conflict()) {
|
||||
TRACE("sat", tout << "inconsistent\n";);
|
||||
return l_false;
|
||||
TRACE("sat", display(tout << "inconsistent\n"););
|
||||
m_inconsistent = false;
|
||||
is_sat = l_undef;
|
||||
break;
|
||||
}
|
||||
propagate(false);
|
||||
++num_resolves;
|
||||
|
@ -3189,17 +3199,16 @@ namespace sat {
|
|||
break;
|
||||
}
|
||||
}
|
||||
lbool is_sat;
|
||||
while (true) {
|
||||
if (is_sat == l_true) {
|
||||
if (scope_lvl() == 1 && num_resolves > 0) {
|
||||
is_sat = l_undef;
|
||||
break;
|
||||
}
|
||||
is_sat = bounded_search();
|
||||
if (is_sat == l_undef) {
|
||||
restart();
|
||||
else {
|
||||
is_sat = bounded_search();
|
||||
if (is_sat == l_undef) {
|
||||
restart();
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (is_sat == l_false) {
|
||||
TRACE("sat", tout << "unsat\n";);
|
||||
|
|
|
@ -234,6 +234,7 @@ public:
|
|||
}
|
||||
|
||||
virtual lbool get_consequences_core(expr_ref_vector const& assumptions, expr_ref_vector const& vars, expr_ref_vector& conseq) {
|
||||
init_preprocess();
|
||||
TRACE("sat", tout << assumptions << "\n" << vars << "\n";);
|
||||
sat::literal_vector asms;
|
||||
sat::bool_var_vector bvars;
|
||||
|
@ -341,7 +342,7 @@ public:
|
|||
mk_bit_blaster_tactic(m, m_bb_rewriter.get()),
|
||||
//mk_aig_tactic(),
|
||||
using_params(mk_simplify_tactic(m), simp2_p));
|
||||
for (unsigned i = 0; i < m_num_scopes; ++i) {
|
||||
while (m_bb_rewriter->get_num_scopes() < m_num_scopes) {
|
||||
m_bb_rewriter->push();
|
||||
}
|
||||
m_preprocess->reset();
|
||||
|
@ -364,6 +365,7 @@ private:
|
|||
}
|
||||
catch (tactic_exception & ex) {
|
||||
IF_VERBOSE(0, verbose_stream() << "exception in tactic " << ex.msg() << "\n";);
|
||||
TRACE("sat", tout << "exception: " << ex.msg() << "\n";);
|
||||
m_preprocess = 0;
|
||||
m_bb_rewriter = 0;
|
||||
return l_undef;
|
||||
|
@ -518,10 +520,14 @@ private:
|
|||
}
|
||||
dep2asm_t dep2asm;
|
||||
goal_ref g = alloc(goal, m, true, false); // models, maybe cores are enabled
|
||||
for (; m_fmls_head < m_fmls.size(); ++m_fmls_head) {
|
||||
g->assert_expr(m_fmls[m_fmls_head].get());
|
||||
for (unsigned i = 0 ; i < m_fmls.size(); ++i) {
|
||||
g->assert_expr(m_fmls[i].get());
|
||||
}
|
||||
return internalize_goal(g, dep2asm);
|
||||
lbool res = internalize_goal(g, dep2asm);
|
||||
if (res != l_undef) {
|
||||
m_fmls_head = m_fmls.size();
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
void extract_assumptions(unsigned sz, expr* const* asms, dep2asm_t& dep2asm) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue