3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-24 01:25:31 +00:00
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2020-04-03 16:37:59 -07:00
parent 0b856638e9
commit 426e4cc75c
65 changed files with 135 additions and 146 deletions

View file

@ -180,13 +180,13 @@ void asserted_formulas::get_assertions(ptr_vector<expr> & result) const {
void asserted_formulas::push_scope() {
reduce();
commit();
SASSERT(inconsistent() || m_qhead == m_formulas.size() || m.canceled());
SASSERT(inconsistent() || m_qhead == m_formulas.size() || m.limit().get_cancel_flag());
TRACE("asserted_formulas_scopes", tout << "before push: " << m_scopes.size() << "\n";);
m_scoped_substitution.push();
m_scopes.push_back(scope());
scope & s = m_scopes.back();
s.m_formulas_lim = m_formulas.size();
SASSERT(inconsistent() || s.m_formulas_lim == m_qhead || m.canceled());
SASSERT(inconsistent() || s.m_formulas_lim == m_qhead || m.limit().get_cancel_flag());
s.m_inconsistent_old = m_inconsistent;
m_defined_names.push();
m_elim_term_ite.push();

View file

@ -212,7 +212,7 @@ class asserted_formulas {
bool invoke(simplify_fmls& s);
void swap_asserted_formulas(vector<justified_expr>& new_fmls);
void push_assertion(expr * e, proof * pr, vector<justified_expr>& result);
bool canceled() { return m.canceled(); }
bool canceled() { return !m.inc(); }
bool check_well_sorted() const;
unsigned get_total_size() const;

View file

@ -522,7 +522,7 @@ namespace smt {
unsigned num_restarts = 0;
while (true) {
if (m.canceled()) {
if (!m.inc()) {
is_sat = l_undef;
break;
}

View file

@ -264,7 +264,7 @@ namespace smt {
bool context::check_th_diseq_propagation() const {
TRACE("check_th_diseq_propagation", tout << "m_propagated_th_diseqs.size() " << m_propagated_th_diseqs.size() << "\n";);
int num = get_num_bool_vars();
if (inconsistent() || get_manager().canceled()) {
if (inconsistent() || get_manager().limit().get_cancel_flag()) {
return true;
}
for (bool_var v = 0; v < num; v++) {

View file

@ -96,7 +96,7 @@ protected:
m_solver.push();
reduce(fml);
m_solver.pop(1);
if (m.canceled())
if (!m.inc())
return;
SASSERT(m_solver.get_scope_level() == 0);
TRACE("ctx_solver_simplify_tactic",
@ -172,7 +172,7 @@ protected:
names.push_back(n);
m_solver.push();
while (!todo.empty() && !m.canceled()) {
while (!todo.empty() && m.inc()) {
expr_ref res(m);
args.reset();
expr* e = todo.back().m_expr;
@ -244,7 +244,7 @@ protected:
names.pop_back();
m_solver.pop(1);
}
if (!m.canceled()) {
if (m.inc()) {
VERIFY(cache.find(fml, path_r));
result = path_r.m_expr;
}

View file

@ -57,9 +57,7 @@ struct unit_subsumption_tactic : public tactic {
}
void checkpoint() {
if (m.canceled()) {
throw tactic_exception(m.limit().get_cancel_msg());
}
tactic::checkpoint(m);
}
void reduce_core(goal_ref const& g, goal_ref_buffer& result) {

View file

@ -215,7 +215,7 @@ namespace smt {
template<typename Ext>
bool theory_arith<Ext>::valid_assignment() const {
if (get_manager().canceled())
if (get_manager().limit().get_cancel_flag())
return true;
if (valid_row_assignment() &&
satisfy_bounds() &&

View file

@ -1862,7 +1862,10 @@ namespace smt {
literal l = lits[i];
if (l.var() == true_bool_var) {
unsigned is_true = (l == true_literal);
SASSERT(!bits[!is_true][i]); // no complementary bits
if (bits[!is_true][i]) {
// expect a conflict later on.
return true;
}
if (!bits[is_true][i]) {
bits[is_true][i] = true;
num_bits++;
@ -1888,6 +1891,8 @@ namespace smt {
}
bool theory_bv::check_invariant() {
if (get_manager().limit().get_cancel_flag())
return true;
if (get_context().inconsistent())
return true;
unsigned num = get_num_vars();

View file

@ -164,7 +164,7 @@ class theory_lra::imp {
imp& m_imp;
public:
resource_limit(imp& i): m_imp(i) { }
bool get_cancel_flag() override { return m_imp.m.canceled(); }
bool get_cancel_flag() override { return !m_imp.m.inc(); }
};
@ -1563,7 +1563,7 @@ public:
void init_variable_values() {
reset_variable_values();
if (!m.canceled() && m_solver.get() && th.get_num_vars() > 0) {
if (m.inc() && m_solver.get() && th.get_num_vars() > 0) {
TRACE("arith", display(tout << "update variable values\n"););
lp().get_model(m_variable_values);
}
@ -1721,7 +1721,7 @@ public:
return FC_CONTINUE;
case l_undef:
TRACE("arith", tout << "check feasiable is undef\n";);
return m.canceled() ? FC_CONTINUE : FC_GIVEUP;
return m.inc() ? FC_CONTINUE : FC_GIVEUP;
default:
UNREACHABLE();
break;
@ -2019,7 +2019,7 @@ public:
lbool check_lia() {
TRACE("arith",);
if (m.canceled()) {
if (!m.inc()) {
TRACE("arith", tout << "canceled\n";);
return l_undef;
}
@ -2177,7 +2177,7 @@ public:
lbool check_nra() {
m_use_nra_model = false;
if (m.canceled()) {
if (!m.inc()) {
TRACE("arith", tout << "canceled\n";);
return l_undef;
}
@ -2259,7 +2259,7 @@ public:
}
lbool lbl = make_feasible();
if (m.canceled())
if (!m.inc())
return;
switch(lbl) {
@ -2297,7 +2297,7 @@ public:
lp().propagate_bounds_for_touched_rows(bp);
if (m.canceled()) {
if (!m.inc()) {
return;
}
@ -2305,7 +2305,7 @@ public:
get_infeasibility_explanation_and_set_conflict();
}
else {
for (unsigned i = 0; !m.canceled() && !ctx().inconsistent() && i < bp.m_ibounds.size(); ++i) {
for (unsigned i = 0; m.inc() && !ctx().inconsistent() && i < bp.m_ibounds.size(); ++i) {
propagate_lp_solver_bound(bp.m_ibounds[i]);
}
}
@ -3398,7 +3398,7 @@ public:
else {
rational r = get_value(v);
TRACE("arith", tout << mk_pp(o, m) << " v" << v << " := " << r << "\n";);
SASSERT("integer variables should have integer values: " && (!a.is_int(o) || r.is_int() || m.canceled()));
SASSERT("integer variables should have integer values: " && (!a.is_int(o) || r.is_int() || m.limit().get_cancel_flag()));
if (a.is_int(o) && !r.is_int()) r = floor(r);
return alloc(expr_wrapper_proc, m_factory->mk_value(r, m.get_sort(o)));
}