mirror of
https://github.com/Z3Prover/z3
synced 2025-05-02 21:37:02 +00:00
reworking cancellation
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
981f8226fe
commit
baee4225a7
145 changed files with 172 additions and 958 deletions
|
@ -62,7 +62,6 @@ class add_bounds_tactic : public tactic {
|
|||
ast_manager & m;
|
||||
rational m_lower;
|
||||
rational m_upper;
|
||||
volatile bool m_cancel;
|
||||
|
||||
imp(ast_manager & _m, params_ref const & p):
|
||||
m(_m) {
|
||||
|
@ -74,9 +73,6 @@ class add_bounds_tactic : public tactic {
|
|||
m_upper = p.get_rat("add_bound_upper", rational(2));
|
||||
}
|
||||
|
||||
void set_cancel(bool f) {
|
||||
m_cancel = f;
|
||||
}
|
||||
|
||||
struct add_bound_proc {
|
||||
arith_util m_util;
|
||||
|
@ -180,11 +176,6 @@ public:
|
|||
dealloc(d);
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual void set_cancel(bool f) {
|
||||
if (m_imp)
|
||||
m_imp->set_cancel(f);
|
||||
}
|
||||
};
|
||||
|
||||
tactic * mk_add_bounds_tactic(ast_manager & m, params_ref const & p) {
|
||||
|
|
|
@ -13,24 +13,15 @@ struct arith_bounds_tactic : public tactic {
|
|||
|
||||
ast_manager& m;
|
||||
arith_util a;
|
||||
volatile bool m_cancel;
|
||||
|
||||
arith_bounds_tactic(ast_manager& m):
|
||||
m(m),
|
||||
a(m),
|
||||
m_cancel(false)
|
||||
a(m)
|
||||
{
|
||||
}
|
||||
|
||||
ast_manager& get_manager() { return m; }
|
||||
|
||||
void set_cancel(bool f) {
|
||||
m_cancel = f;
|
||||
}
|
||||
|
||||
virtual void cleanup() {
|
||||
m_cancel = false;
|
||||
}
|
||||
|
||||
virtual void operator()(/* in */ goal_ref const & in,
|
||||
/* out */ goal_ref_buffer & result,
|
||||
|
@ -45,7 +36,7 @@ struct arith_bounds_tactic : public tactic {
|
|||
}
|
||||
|
||||
void checkpoint() {
|
||||
if (m_cancel) {
|
||||
if (m.canceled()) {
|
||||
throw tactic_exception(TACTIC_CANCELED_MSG);
|
||||
}
|
||||
}
|
||||
|
@ -155,6 +146,7 @@ struct arith_bounds_tactic : public tactic {
|
|||
TRACE("arith_subsumption", s->display(tout); );
|
||||
}
|
||||
|
||||
virtual void cleanup() {}
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -462,10 +462,6 @@ public:
|
|||
virtual void collect_param_descrs(param_descrs & r) {
|
||||
}
|
||||
|
||||
void set_cancel(bool f) {
|
||||
m_rw1.set_cancel(f);
|
||||
m_rw2.set_cancel(f);
|
||||
}
|
||||
|
||||
virtual void operator()(goal_ref const & g,
|
||||
goal_ref_buffer & result,
|
||||
|
|
|
@ -40,7 +40,6 @@ class degree_shift_tactic : public tactic {
|
|||
rational m_one;
|
||||
bool m_produce_models;
|
||||
bool m_produce_proofs;
|
||||
volatile bool m_cancel;
|
||||
|
||||
expr * mk_power(expr * t, rational const & k) {
|
||||
if (k.is_one())
|
||||
|
@ -96,15 +95,11 @@ class degree_shift_tactic : public tactic {
|
|||
m_pinned(_m),
|
||||
m_one(1),
|
||||
m_rw(0) {
|
||||
m_cancel = false;
|
||||
}
|
||||
|
||||
void set_cancel(bool f) {
|
||||
m_cancel = f;
|
||||
}
|
||||
|
||||
void checkpoint() {
|
||||
if (m_cancel)
|
||||
if (m.canceled())
|
||||
throw tactic_exception(TACTIC_CANCELED_MSG);
|
||||
cooperate("degree_shift");
|
||||
}
|
||||
|
@ -326,12 +321,7 @@ public:
|
|||
}
|
||||
dealloc(d);
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual void set_cancel(bool f) {
|
||||
if (m_imp)
|
||||
m_imp->set_cancel(f);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
tactic * mk_degree_shift_tactic(ast_manager & m, params_ref const & p) {
|
||||
|
|
|
@ -45,7 +45,6 @@ class diff_neq_tactic : public tactic {
|
|||
vector<diseqs> m_var_diseqs;
|
||||
typedef svector<int> decision_stack;
|
||||
decision_stack m_stack;
|
||||
volatile bool m_cancel;
|
||||
|
||||
bool m_produce_models;
|
||||
rational m_max_k;
|
||||
|
@ -58,7 +57,6 @@ class diff_neq_tactic : public tactic {
|
|||
u(m),
|
||||
m_var2expr(m) {
|
||||
updt_params(p);
|
||||
m_cancel = false;
|
||||
}
|
||||
|
||||
void updt_params(params_ref const & p) {
|
||||
|
@ -67,11 +65,7 @@ class diff_neq_tactic : public tactic {
|
|||
if (m_max_k >= rational(INT_MAX/2))
|
||||
m_max_k = rational(INT_MAX/2);
|
||||
}
|
||||
|
||||
void set_cancel(bool f) {
|
||||
m_cancel = f;
|
||||
}
|
||||
|
||||
|
||||
void throw_not_supported() {
|
||||
throw tactic_exception("goal is not diff neq");
|
||||
}
|
||||
|
@ -294,7 +288,7 @@ class diff_neq_tactic : public tactic {
|
|||
init_forbidden();
|
||||
unsigned nvars = num_vars();
|
||||
while (m_stack.size() < nvars) {
|
||||
if (m_cancel)
|
||||
if (m.canceled())
|
||||
throw tactic_exception(TACTIC_CANCELED_MSG);
|
||||
TRACE("diff_neq_tactic", display_model(tout););
|
||||
var x = m_stack.size();
|
||||
|
@ -407,11 +401,6 @@ public:
|
|||
dealloc(d);
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual void set_cancel(bool f) {
|
||||
if (m_imp)
|
||||
m_imp->set_cancel(f);
|
||||
}
|
||||
};
|
||||
|
||||
tactic * mk_diff_neq_tactic(ast_manager & m, params_ref const & p) {
|
||||
|
|
|
@ -136,10 +136,7 @@ public:
|
|||
|
||||
virtual ~elim01_tactic() {
|
||||
}
|
||||
|
||||
void set_cancel(bool f) {
|
||||
}
|
||||
|
||||
|
||||
virtual void updt_params(params_ref const & p) {
|
||||
m_max_hi = rational(p.get_uint("max_coefficient", m_max_hi_default));
|
||||
m_params = p;
|
||||
|
|
|
@ -139,9 +139,6 @@ public:
|
|||
virtual ~eq2bv_tactic() {
|
||||
}
|
||||
|
||||
void set_cancel(bool f) {
|
||||
m_rw.set_cancel(f);
|
||||
}
|
||||
|
||||
void updt_params(params_ref const & p) {
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ class factor_tactic : public tactic {
|
|||
rw_cfg(ast_manager & _m, params_ref const & p):
|
||||
m(_m),
|
||||
m_util(_m),
|
||||
m_pm(m_qm),
|
||||
m_pm(m.limit(), m_qm),
|
||||
m_expr2poly(m, m_pm) {
|
||||
updt_params(p);
|
||||
}
|
||||
|
@ -251,10 +251,6 @@ class factor_tactic : public tactic {
|
|||
m_rw(m, p) {
|
||||
}
|
||||
|
||||
void set_cancel(bool f) {
|
||||
m_rw.set_cancel(f);
|
||||
m_rw.cfg().m_pm.set_cancel(f);
|
||||
}
|
||||
|
||||
void updt_params(params_ref const & p) {
|
||||
m_rw.cfg().updt_params(p);
|
||||
|
@ -341,10 +337,7 @@ public:
|
|||
dealloc(d);
|
||||
}
|
||||
|
||||
virtual void set_cancel(bool f) {
|
||||
if (m_imp)
|
||||
m_imp->set_cancel(f);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
tactic * mk_factor_tactic(ast_manager & m, params_ref const & p) {
|
||||
|
|
|
@ -247,11 +247,7 @@ class fix_dl_var_tactic : public tactic {
|
|||
void updt_params(params_ref const & p) {
|
||||
m_rw.updt_params(p);
|
||||
}
|
||||
|
||||
void set_cancel(bool f) {
|
||||
m_rw.set_cancel(f);
|
||||
}
|
||||
|
||||
|
||||
void operator()(goal_ref const & g,
|
||||
goal_ref_buffer & result,
|
||||
model_converter_ref & mc,
|
||||
|
@ -345,11 +341,6 @@ public:
|
|||
}
|
||||
dealloc(d);
|
||||
}
|
||||
|
||||
virtual void set_cancel(bool f) {
|
||||
if (m_imp)
|
||||
m_imp->set_cancel(f);
|
||||
}
|
||||
};
|
||||
|
||||
tactic * mk_fix_dl_var_tactic(ast_manager & m, params_ref const & p) {
|
||||
|
|
|
@ -44,7 +44,6 @@ class fm_tactic : public tactic {
|
|||
ast_manager & m;
|
||||
ptr_vector<func_decl> m_xs;
|
||||
vector<clauses> m_clauses;
|
||||
volatile bool m_cancel;
|
||||
|
||||
enum r_kind {
|
||||
NONE,
|
||||
|
@ -182,7 +181,6 @@ class fm_tactic : public tactic {
|
|||
|
||||
virtual void operator()(model_ref & md, unsigned goal_idx) {
|
||||
TRACE("fm_mc", model_v2_pp(tout, *md); display(tout););
|
||||
m_cancel = false;
|
||||
model_evaluator ev(*(md.get()));
|
||||
ev.set_model_completion(true);
|
||||
arith_util u(m);
|
||||
|
@ -199,7 +197,7 @@ class fm_tactic : public tactic {
|
|||
clauses::iterator it = m_clauses[i].begin();
|
||||
clauses::iterator end = m_clauses[i].end();
|
||||
for (; it != end; ++it) {
|
||||
if (m_cancel) throw tactic_exception(TACTIC_CANCELED_MSG);
|
||||
if (m.canceled()) throw tactic_exception(TACTIC_CANCELED_MSG);
|
||||
switch (process(x, *it, u, ev, val)) {
|
||||
case NONE:
|
||||
TRACE("fm_mc", tout << "no bound for:\n" << mk_ismt2_pp(*it, m) << "\n";);
|
||||
|
@ -244,9 +242,6 @@ class fm_tactic : public tactic {
|
|||
TRACE("fm_mc", model_v2_pp(tout, *md););
|
||||
}
|
||||
|
||||
virtual void cancel() {
|
||||
m_cancel = true;
|
||||
}
|
||||
|
||||
virtual void display(std::ostream & out) {
|
||||
out << "(fm-model-converter";
|
||||
|
@ -394,7 +389,6 @@ class fm_tactic : public tactic {
|
|||
obj_hashtable<func_decl> m_forbidden_set; // variables that cannot be eliminated because occur in non OCC ineq part
|
||||
goal_ref m_new_goal;
|
||||
ref<fm_model_converter> m_mc;
|
||||
volatile bool m_cancel;
|
||||
id_gen m_id_gen;
|
||||
bool m_produce_models;
|
||||
bool m_fm_real_only;
|
||||
|
@ -784,7 +778,6 @@ class fm_tactic : public tactic {
|
|||
m_var2expr(m),
|
||||
m_inconsistent_core(m) {
|
||||
updt_params(p);
|
||||
m_cancel = false;
|
||||
}
|
||||
|
||||
~imp() {
|
||||
|
@ -801,9 +794,6 @@ class fm_tactic : public tactic {
|
|||
m_fm_occ = p.get_bool("fm_occ", false);
|
||||
}
|
||||
|
||||
void set_cancel(bool f) {
|
||||
m_cancel = f;
|
||||
}
|
||||
|
||||
struct forbidden_proc {
|
||||
imp & m_owner;
|
||||
|
@ -1552,7 +1542,7 @@ class fm_tactic : public tactic {
|
|||
|
||||
void checkpoint() {
|
||||
cooperate("fm");
|
||||
if (m_cancel)
|
||||
if (m.canceled())
|
||||
throw tactic_exception(TACTIC_CANCELED_MSG);
|
||||
if (memory::get_allocation_size() > m_max_memory)
|
||||
throw tactic_exception(TACTIC_MAX_MEMORY_MSG);
|
||||
|
@ -1676,10 +1666,6 @@ public:
|
|||
r.insert("fm_extra", CPK_UINT, "(default: 0) max. increase on the number of inequalities for each FM variable elimination step.");
|
||||
}
|
||||
|
||||
virtual void set_cancel(bool f) {
|
||||
if (m_imp)
|
||||
m_imp->set_cancel(f);
|
||||
}
|
||||
|
||||
virtual void cleanup() {
|
||||
imp * d = alloc(imp, m_imp->m, m_params);
|
||||
|
|
|
@ -152,11 +152,7 @@ public:
|
|||
dealloc(m_todo);
|
||||
dealloc(m_01s);
|
||||
}
|
||||
|
||||
void set_cancel(bool f) {
|
||||
m_rw.set_cancel(f);
|
||||
}
|
||||
|
||||
|
||||
void updt_params(params_ref const & p) {
|
||||
m_params = p;
|
||||
m_compile_equality = p.get_bool("compile_equality", false);
|
||||
|
|
|
@ -60,9 +60,6 @@ class lia2pb_tactic : public tactic {
|
|||
updt_params_core(p);
|
||||
}
|
||||
|
||||
void set_cancel(bool f) {
|
||||
m_rw.set_cancel(f);
|
||||
}
|
||||
|
||||
bool is_target_core(expr * n, rational & u) {
|
||||
if (!is_uninterp_const(n))
|
||||
|
@ -356,11 +353,6 @@ public:
|
|||
dealloc(d);
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual void set_cancel(bool f) {
|
||||
if (m_imp)
|
||||
m_imp->set_cancel(f);
|
||||
}
|
||||
};
|
||||
|
||||
tactic * mk_lia2pb_tactic(ast_manager & m, params_ref const & p) {
|
||||
|
|
|
@ -52,9 +52,6 @@ class normalize_bounds_tactic : public tactic {
|
|||
updt_params_core(p);
|
||||
}
|
||||
|
||||
void set_cancel(bool f) {
|
||||
m_rw.set_cancel(f);
|
||||
}
|
||||
|
||||
bool is_target(expr * var, rational & val) {
|
||||
bool strict;
|
||||
|
@ -198,12 +195,6 @@ public:
|
|||
}
|
||||
dealloc(d);
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual void set_cancel(bool f) {
|
||||
if (m_imp)
|
||||
m_imp->set_cancel(f);
|
||||
}
|
||||
};
|
||||
|
||||
tactic * mk_normalize_bounds_tactic(ast_manager & m, params_ref const & p) {
|
||||
|
|
|
@ -884,10 +884,6 @@ private:
|
|||
r.erase("elim_and");
|
||||
}
|
||||
|
||||
void set_cancel(bool f) {
|
||||
m_rw.set_cancel(f);
|
||||
}
|
||||
|
||||
virtual void operator()(goal_ref const & g,
|
||||
goal_ref_buffer & result,
|
||||
model_converter_ref & mc,
|
||||
|
@ -1015,11 +1011,7 @@ public:
|
|||
dealloc(d);
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual void set_cancel(bool f) {
|
||||
if (m_imp)
|
||||
m_imp->set_cancel(f);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
tactic * mk_pb2bv_tactic(ast_manager & m, params_ref const & p) {
|
||||
|
|
|
@ -33,7 +33,7 @@ class arith_degree_probe : public probe {
|
|||
unsigned long long m_acc_degree;
|
||||
unsigned m_counter;
|
||||
|
||||
proc(ast_manager & _m):m(_m), m_pm(m_qm), m_expr2poly(m, m_pm), m_util(m) {
|
||||
proc(ast_manager & _m):m(_m), m_pm(m.limit(), m_qm), m_expr2poly(m, m_pm), m_util(m) {
|
||||
m_max_degree = 0;
|
||||
m_acc_degree = 0;
|
||||
m_counter = 0;
|
||||
|
|
|
@ -55,8 +55,6 @@ public:
|
|||
virtual void operator()(goal_ref const & g, goal_ref_buffer & result, model_converter_ref & mc, proof_converter_ref & pc, expr_dependency_ref & core);
|
||||
|
||||
virtual void cleanup();
|
||||
protected:
|
||||
virtual void set_cancel(bool f);
|
||||
};
|
||||
|
||||
tactic * mk_propagate_ineqs_tactic(ast_manager & m, params_ref const & p) {
|
||||
|
@ -512,9 +510,6 @@ struct propagate_ineqs_tactic::imp {
|
|||
TRACE("propagate_ineqs_tactic", r->display(tout););
|
||||
}
|
||||
|
||||
void set_cancel(bool f) {
|
||||
// TODO
|
||||
}
|
||||
};
|
||||
|
||||
propagate_ineqs_tactic::propagate_ineqs_tactic(ast_manager & m, params_ref const & p):
|
||||
|
@ -546,10 +541,6 @@ void propagate_ineqs_tactic::operator()(goal_ref const & g,
|
|||
SASSERT(r->is_well_sorted());
|
||||
}
|
||||
|
||||
void propagate_ineqs_tactic::set_cancel(bool f) {
|
||||
if (m_imp)
|
||||
m_imp->set_cancel(f);
|
||||
}
|
||||
|
||||
void propagate_ineqs_tactic::cleanup() {
|
||||
imp * d = alloc(imp, m_imp->m, m_params);
|
||||
|
|
|
@ -748,8 +748,6 @@ public:
|
|||
virtual void cleanup() {
|
||||
}
|
||||
|
||||
virtual void set_cancel(bool f) {
|
||||
}
|
||||
};
|
||||
|
||||
tactic * mk_purify_arith_tactic(ast_manager & m, params_ref const & p) {
|
||||
|
|
|
@ -66,9 +66,6 @@ class recover_01_tactic : public tactic {
|
|||
updt_params_core(p);
|
||||
}
|
||||
|
||||
void set_cancel(bool f) {
|
||||
m_rw.set_cancel(f);
|
||||
}
|
||||
|
||||
bool save_clause(expr * c) {
|
||||
if (!m.is_or(c))
|
||||
|
@ -432,12 +429,6 @@ public:
|
|||
}
|
||||
dealloc(d);
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual void set_cancel(bool f) {
|
||||
if (m_imp)
|
||||
m_imp->set_cancel(f);
|
||||
}
|
||||
};
|
||||
|
||||
tactic * mk_recover_01_tactic(ast_manager & m, params_ref const & p) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue