3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-24 17:45:32 +00:00

reworking cancellation

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2015-12-11 16:21:24 -08:00
parent 981f8226fe
commit baee4225a7
145 changed files with 172 additions and 958 deletions

View file

@ -119,7 +119,6 @@ struct aig_manager::imp {
aig_lit m_false;
bool m_default_gate_encoding;
unsigned long long m_max_memory;
volatile bool m_cancel;
void dec_ref_core(aig * n) {
SASSERT(n->m_ref_count > 0);
@ -131,7 +130,7 @@ struct aig_manager::imp {
void checkpoint() {
if (memory::get_allocation_size() > m_max_memory)
throw aig_exception(TACTIC_MAX_MEMORY_MSG);
if (m_cancel)
if (m().canceled())
throw aig_exception(TACTIC_CANCELED_MSG);
cooperate("aig");
}
@ -1309,8 +1308,7 @@ public:
m_num_aigs(0),
m_var2exprs(m),
m_allocator("aig"),
m_true(mk_var(m.mk_true())),
m_cancel(false) {
m_true(mk_var(m.mk_true())) {
SASSERT(is_true(m_true));
m_false = m_true;
m_false.invert();
@ -1328,7 +1326,6 @@ public:
ast_manager & m() const { return m_var2exprs.get_manager(); }
void set_cancel(bool f) { m_cancel = f; }
void inc_ref(aig * n) { n->m_ref_count++; }
void inc_ref(aig_lit const & r) { inc_ref(r.ptr()); }
@ -1754,8 +1751,5 @@ unsigned aig_manager::get_num_aigs() const {
return m_imp->get_num_aigs();
}
void aig_manager::set_cancel(bool f) {
m_imp->set_cancel(f);
}

View file

@ -73,7 +73,6 @@ public:
void display(std::ostream & out, aig_ref const & r) const;
void display_smt2(std::ostream & out, aig_ref const & r) const;
unsigned get_num_aigs() const;
void set_cancel(bool f);
};
#endif

View file

@ -111,14 +111,6 @@ public:
virtual void cleanup() {}
protected:
virtual void set_cancel(bool f) {
#pragma omp critical (aig_tactic)
{
if (m_aig_manager)
m_aig_manager->set_cancel(f);
}
}
};
tactic * mk_aig_tactic(params_ref const & p) {

View file

@ -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) {

View file

@ -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() {}
};

View file

@ -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,

View file

@ -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) {

View file

@ -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) {

View file

@ -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;

View file

@ -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) {
}

View file

@ -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) {

View file

@ -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) {

View file

@ -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);

View file

@ -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);

View file

@ -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) {

View file

@ -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) {

View file

@ -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) {

View file

@ -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;

View file

@ -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);

View file

@ -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) {

View file

@ -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) {

View file

@ -49,9 +49,6 @@ class bit_blaster_tactic : public tactic {
ast_manager & m() const { return m_rewriter->m(); }
void set_cancel(bool f) {
m_rewriter->set_cancel(f);
}
void operator()(goal_ref const & g,
goal_ref_buffer & result,
@ -163,11 +160,6 @@ public:
return m_imp->get_num_steps();
}
protected:
virtual void set_cancel(bool f) {
if (m_imp)
m_imp->set_cancel(f);
}
};

View file

@ -377,9 +377,6 @@ class bv1_blaster_tactic : public tactic {
ast_manager & m() const { return m_rw.m(); }
void set_cancel(bool f) {
m_rw.set_cancel(f);
}
void operator()(goal_ref const & g,
goal_ref_buffer & result,
@ -478,11 +475,6 @@ public:
return m_imp->get_num_steps();
}
protected:
virtual void set_cancel(bool f) {
if (m_imp)
m_imp->set_cancel(f);
}
};
tactic * mk_bv1_blaster_tactic(ast_manager & m, params_ref const & p) {

View file

@ -43,7 +43,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();
virtual void set_cancel(bool f);
};
tactic * mk_bv_size_reduction_tactic(ast_manager & m, params_ref const & p) {
@ -64,13 +63,11 @@ struct bv_size_reduction_tactic::imp {
ref<filter_model_converter> m_fmc;
scoped_ptr<expr_replacer> m_replacer;
bool m_produce_models;
volatile bool m_cancel;
imp(ast_manager & _m):
m(_m),
m_util(m),
m_replacer(mk_default_expr_replacer(m)),
m_cancel(false) {
m_replacer(mk_default_expr_replacer(m)) {
}
void update_signed_lower(app * v, numeral const & k) {
@ -178,7 +175,7 @@ struct bv_size_reduction_tactic::imp {
}
void checkpoint() {
if (m_cancel)
if (m.canceled())
throw tactic_exception(TACTIC_CANCELED_MSG);
}
@ -375,10 +372,6 @@ struct bv_size_reduction_tactic::imp {
TRACE("after_bv_size_reduction", g.display(tout); if (m_mc) m_mc->display(tout););
}
void set_cancel(bool f) {
m_replacer->set_cancel(f);
m_cancel = f;
}
};
bv_size_reduction_tactic::bv_size_reduction_tactic(ast_manager & m) {
@ -404,10 +397,6 @@ void bv_size_reduction_tactic::operator()(goal_ref const & g,
SASSERT(g->is_well_sorted());
}
void bv_size_reduction_tactic::set_cancel(bool f) {
if (m_imp)
m_imp->set_cancel(f);
}
void bv_size_reduction_tactic::cleanup() {
imp * d = alloc(imp, m_imp->m);

View file

@ -34,7 +34,6 @@ class bvarray2uf_tactic : public tactic {
bool m_produce_models;
bool m_produce_proofs;
bool m_produce_cores;
volatile bool m_cancel;
bvarray2uf_rewriter m_rw;
ast_manager & m() { return m_manager; }
@ -44,17 +43,13 @@ class bvarray2uf_tactic : public tactic {
m_produce_models(false),
m_produce_proofs(false),
m_produce_cores(false),
m_cancel(false),
m_rw(m, p) {
updt_params(p);
}
void set_cancel(bool f) {
m_cancel = f;
}
void checkpoint() {
if (m_cancel)
if (m_manager.canceled())
throw tactic_exception(TACTIC_CANCELED_MSG);
}
@ -155,11 +150,6 @@ public:
dealloc(d);
}
virtual void set_cancel(bool f) {
if (m_imp)
m_imp->set_cancel(f);
}
};

View file

@ -229,10 +229,6 @@ class elim_small_bv_tactic : public tactic {
m_rw(m, p) {
}
void set_cancel(bool f) {
m_rw.set_cancel(f);
}
void updt_params(params_ref const & p) {
m_rw.cfg().updt_params(p);
}
@ -318,10 +314,6 @@ public:
dealloc(d);
}
virtual void set_cancel(bool f) {
if (m_imp)
m_imp->set_cancel(f);
}
};
tactic * mk_elim_small_bv_tactic(ast_manager & m, params_ref const & p) {

View file

@ -235,11 +235,7 @@ class max_bv_sharing_tactic : public tactic {
}
ast_manager & m() const { return m_rw.m(); }
void set_cancel(bool f) {
m_rw.set_cancel(f);
}
void operator()(goal_ref const & g,
goal_ref_buffer & result,
model_converter_ref & mc,
@ -318,11 +314,6 @@ public:
}
dealloc(d);
}
virtual void set_cancel(bool f) {
if (m_imp)
m_imp->set_cancel(f);
}
};
tactic * mk_max_bv_sharing_tactic(ast_manager & m, params_ref const & p) {

View file

@ -109,9 +109,6 @@ class blast_term_ite_tactic : public tactic {
m_rw(m, p) {
}
void set_cancel(bool f) {
m_rw.set_cancel(f);
}
void updt_params(params_ref const & p) {
m_rw.cfg().updt_params(p);
@ -198,11 +195,6 @@ public:
}
}
virtual void set_cancel(bool f) {
if (m_imp)
m_imp->set_cancel(f);
}
static void blast_term_ite(expr_ref& fml) {
ast_manager& m = fml.get_manager();
scoped_no_proof _sp(m);

View file

@ -30,13 +30,12 @@ struct cofactor_elim_term_ite::imp {
params_ref m_params;
unsigned long long m_max_memory;
bool m_cofactor_equalities;
volatile bool m_cancel;
void checkpoint() {
cooperate("cofactor ite");
if (memory::get_allocation_size() > m_max_memory)
throw tactic_exception(TACTIC_MAX_MEMORY_MSG);
if (m_cancel)
if (m.canceled())
throw tactic_exception(TACTIC_CANCELED_MSG);
}
@ -315,9 +314,6 @@ struct cofactor_elim_term_ite::imp {
r.insert("cofactor_equalities", CPK_BOOL, "(default: true) use equalities to rewrite bodies of ite-expressions. This is potentially expensive.");
}
void set_cancel(bool f) {
m_cancel = f;
}
struct cofactor_rw_cfg : public default_rewriter_cfg {
ast_manager & m;
@ -659,7 +655,6 @@ struct cofactor_elim_term_ite::imp {
m(_m),
m_params(p),
m_cofactor_equalities(true) {
m_cancel = false;
updt_params(p);
}
@ -698,10 +693,6 @@ void cofactor_elim_term_ite::operator()(expr * t, expr_ref & r) {
m_imp->operator()(t, r);
}
void cofactor_elim_term_ite::set_cancel(bool f) {
if (m_imp)
m_imp->set_cancel(f);
}
void cofactor_elim_term_ite::cleanup() {
ast_manager & m = m_imp->m;

View file

@ -35,10 +35,7 @@ public:
void operator()(expr * t, expr_ref & r);
void cancel() { set_cancel(true); }
void reset_cancel() { set_cancel(false); }
void cleanup();
void set_cancel(bool f);
};

View file

@ -73,7 +73,6 @@ public:
virtual void cleanup() { return m_elim_ite.cleanup(); }
virtual void set_cancel(bool f) { m_elim_ite.set_cancel(f); }
};
tactic * mk_cofactor_term_ite_tactic(ast_manager & m, params_ref const & p) {

View file

@ -57,21 +57,16 @@ struct ctx_simplify_tactic::imp {
unsigned m_max_depth;
unsigned m_max_steps;
bool m_bail_on_blowup;
volatile bool m_cancel;
imp(ast_manager & _m, params_ref const & p):
m(_m),
m_allocator("context-simplifier"),
m_occs(true, true),
m_mk_app(m, p) {
m_cancel = false;
m_scope_lvl = 0;
updt_params(p);
}
void set_cancel(bool f) {
m_cancel = f;
}
~imp() {
pop(m_scope_lvl);
@ -100,7 +95,7 @@ struct ctx_simplify_tactic::imp {
cooperate("ctx_simplify_tactic");
if (memory::get_allocation_size() > m_max_memory)
throw tactic_exception(TACTIC_MAX_MEMORY_MSG);
if (m_cancel)
if (m.canceled())
throw tactic_exception(TACTIC_CANCELED_MSG);
}
@ -541,10 +536,6 @@ void ctx_simplify_tactic::operator()(goal_ref const & in,
result.push_back(in.get());
}
void ctx_simplify_tactic::set_cancel(bool f) {
if (m_imp)
m_imp->set_cancel(f);
}
void ctx_simplify_tactic::cleanup() {
ast_manager & m = m_imp->m;

View file

@ -45,8 +45,6 @@ public:
expr_dependency_ref & core);
virtual void cleanup();
protected:
virtual void set_cancel(bool f);
};
inline tactic * mk_ctx_simplify_tactic(ast_manager & m, params_ref const & p = params_ref()) {

View file

@ -28,11 +28,7 @@ class der_tactic : public tactic {
}
ast_manager & m() const { return m_manager; }
void set_cancel(bool f) {
m_r.set_cancel(f);
}
void reset() {
m_r.reset();
}
@ -98,10 +94,6 @@ public:
dealloc(d);
}
virtual void set_cancel(bool f) {
if (m_imp)
m_imp->set_cancel(f);
}
};
tactic * mk_der_tactic(ast_manager & m) {

View file

@ -140,11 +140,6 @@ public:
}
}
virtual void set_cancel(bool f) {
if (m_rw)
m_rw->set_cancel(f);
}
virtual void cleanup() {}
};

View file

@ -94,9 +94,6 @@ class elim_term_ite_tactic : public tactic {
m_rw(m, p) {
}
void set_cancel(bool f) {
m_rw.set_cancel(f);
}
void updt_params(params_ref const & p) {
m_rw.cfg().updt_params(p);
@ -182,10 +179,6 @@ public:
dealloc(d);
}
virtual void set_cancel(bool f) {
if (m_imp)
m_imp->set_cancel(f);
}
};
tactic * mk_elim_term_ite_tactic(ast_manager & m, params_ref const & p) {

View file

@ -993,10 +993,6 @@ class elim_uncnstr_tactic : public tactic {
}
}
void set_cancel(bool f) {
if (m_rw)
m_rw->set_cancel(f);
}
};
imp * m_imp;
@ -1058,11 +1054,6 @@ public:
m_imp->m_num_elim_apps = 0;
}
protected:
virtual void set_cancel(bool f) {
if (m_imp)
m_imp->set_cancel(f);
}
};
tactic * mk_elim_uncnstr_tactic(ast_manager & m, params_ref const & p) {

View file

@ -29,20 +29,14 @@ Revision History:
class occf_tactic : public tactic {
struct imp {
ast_manager & m;
volatile bool m_cancel;
filter_model_converter * m_mc;
imp(ast_manager & _m):
m(_m) {
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("occf");
}
@ -233,11 +227,6 @@ public:
dealloc(d);
}
protected:
virtual void set_cancel(bool f) {
if (m_imp)
m_imp->set_cancel(f);
}
};
tactic * mk_occf_tactic(ast_manager & m, params_ref const & p) {

View file

@ -264,9 +264,6 @@ public:
return m_progress;
}
virtual void set_cancel(bool f) {
}
virtual void updt_params(params_ref const & p) {
}

View file

@ -54,9 +54,6 @@ class propagate_values_tactic : public tactic {
ast_manager & m() const { return m_manager; }
void set_cancel(bool f) {
m_r.set_cancel(f);
}
bool is_shared(expr * t) {
return m_occs.is_shared(t);
@ -267,11 +264,6 @@ public:
dealloc(d);
}
protected:
virtual void set_cancel(bool f) {
if (m_imp)
m_imp->set_cancel(f);
}
};
tactic * mk_propagate_values_tactic(ast_manager & m, params_ref const & p) {

View file

@ -75,7 +75,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();
virtual void set_cancel(bool f);
};
tactic * mk_reduce_args_tactic(ast_manager & m, params_ref const & p) {
@ -85,21 +84,16 @@ tactic * mk_reduce_args_tactic(ast_manager & m, params_ref const & p) {
struct reduce_args_tactic::imp {
ast_manager & m_manager;
bool m_produce_models;
volatile bool m_cancel;
ast_manager & m() const { return m_manager; }
imp(ast_manager & m):
m_manager(m) {
m_cancel = false;
}
void set_cancel(bool f) {
m_cancel = f;
}
void checkpoint() {
if (m_cancel)
if (m_manager.canceled())
throw tactic_exception(TACTIC_CANCELED_MSG);
cooperate("reduce-args");
}
@ -535,11 +529,6 @@ void reduce_args_tactic::operator()(goal_ref const & g,
SASSERT(g->is_well_sorted());
}
void reduce_args_tactic::set_cancel(bool f) {
if (m_imp)
m_imp->set_cancel(f);
}
void reduce_args_tactic::cleanup() {
ast_manager & m = m_imp->m();
imp * d = alloc(imp, m);

View file

@ -36,9 +36,6 @@ struct simplify_tactic::imp {
ast_manager & m() const { return m_manager; }
void set_cancel(bool f) {
m_r.set_cancel(f);
}
void reset() {
m_r.reset();
@ -111,10 +108,6 @@ void simplify_tactic::operator()(goal_ref const & in,
}
}
void simplify_tactic::set_cancel(bool f) {
if (m_imp)
m_imp->set_cancel(f);
}
void simplify_tactic::cleanup() {
ast_manager & m = m_imp->m();

View file

@ -45,8 +45,6 @@ public:
unsigned get_num_steps() const;
virtual tactic * translate(ast_manager & m) { return alloc(simplify_tactic, m, m_params); }
protected:
virtual void set_cancel(bool f);
};

View file

@ -48,7 +48,6 @@ class solve_eqs_tactic : public tactic {
bool m_produce_proofs;
bool m_produce_unsat_cores;
bool m_produce_models;
volatile bool m_cancel;
imp(ast_manager & m, params_ref const & p, expr_replacer * r, bool owner):
m_manager(m),
@ -56,8 +55,8 @@ class solve_eqs_tactic : public tactic {
m_r_owner(r == 0 || owner),
m_a_util(m),
m_num_steps(0),
m_num_eliminated_vars(0),
m_cancel(false) {
m_num_eliminated_vars(0)
{
updt_params(p);
if (m_r == 0)
m_r = mk_default_expr_replacer(m);
@ -75,14 +74,9 @@ class solve_eqs_tactic : public tactic {
m_theory_solver = p.get_bool("theory_solver", true);
m_max_occs = p.get_uint("solve_eqs_max_occs", UINT_MAX);
}
void set_cancel(bool f) {
m_cancel = f;
m_r->set_cancel(f);
}
void checkpoint() {
if (m_cancel)
if (m().canceled())
throw tactic_exception(TACTIC_CANCELED_MSG);
cooperate("solve-eqs");
}
@ -772,10 +766,6 @@ public:
m_imp->m_num_eliminated_vars = 0;
}
virtual void set_cancel(bool f) {
if (m_imp)
m_imp->set_cancel(f);
}
};
tactic * mk_solve_eqs_tactic(ast_manager & m, params_ref const & p, expr_replacer * r) {

View file

@ -105,7 +105,6 @@ class tseitin_cnf_tactic : public tactic {
unsigned long long m_max_memory;
unsigned m_num_aux_vars;
volatile bool m_cancel;
imp(ast_manager & _m, params_ref const & p):
m(_m),
@ -115,8 +114,7 @@ class tseitin_cnf_tactic : public tactic {
m_clauses(_m),
m_deps(_m),
m_rw(_m),
m_num_aux_vars(0),
m_cancel(false) {
m_num_aux_vars(0) {
updt_params(p);
m_rw.set_flat(false);
}
@ -756,13 +754,10 @@ class tseitin_cnf_tactic : public tactic {
if (r == CONT) goto loop; \
if (r == DONE) { m_frame_stack.pop_back(); continue; }
void set_cancel(bool f) {
m_cancel = f;
}
void checkpoint() {
cooperate("tseitin cnf");
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);
@ -908,11 +903,6 @@ public:
dealloc(d);
}
virtual void set_cancel(bool f) {
if (m_imp)
m_imp->set_cancel(f);
}
virtual void collect_statistics(statistics & st) const {
st.update("cnf encoding aux vars", m_imp->m_num_aux_vars);
}

View file

@ -91,14 +91,6 @@ void extension_model_converter::operator()(model_ref & md, unsigned goal_idx) {
TRACE("extension_mc", model_v2_pp(tout, *md); display_decls_info(tout, md););
}
void extension_model_converter::cancel() {
#pragma omp critical (extension_model_converter)
{
if (m_eval)
m_eval->cancel();
}
}
void extension_model_converter::display(std::ostream & out) {
ast_manager & m = m_vars.get_manager();
out << "(extension-model-converter";

View file

@ -40,8 +40,6 @@ public:
virtual void operator()(model_ref & md, unsigned goal_idx);
virtual void cancel();
virtual void display(std::ostream & out);
// register a variable that was eliminated

View file

@ -46,10 +46,6 @@ class fpa2bv_tactic : public tactic {
m_rw.cfg().updt_params(p);
}
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,
@ -166,11 +162,6 @@ public:
dealloc(d);
}
protected:
virtual void set_cancel(bool f) {
if (m_imp)
m_imp->set_cancel(f);
}
};
tactic * mk_fpa2bv_tactic(ast_manager & m, params_ref const & p) {

View file

@ -73,7 +73,6 @@ class nl_purify_tactic : public tactic {
params_ref m_params;
bool m_produce_proofs;
ref<filter_model_converter> m_fmc;
bool m_cancel;
tactic_ref m_nl_tac; // nlsat tactic
goal_ref m_nl_g; // nlsat goal
ref<solver> m_solver; // SMT solver
@ -289,7 +288,7 @@ private:
arith_util & u() { return m_util; }
void check_point() {
if (m_cancel) {
if (m.canceled()) {
throw tactic_exception("canceled");
}
}
@ -701,7 +700,6 @@ public:
m_util(m),
m_params(p),
m_fmc(0),
m_cancel(false),
m_nl_tac(mk_nlsat_tactic(m, p)),
m_nl_g(0),
m_solver(mk_smt_solver(m, p, symbol::null)),
@ -721,17 +719,6 @@ public:
return alloc(nl_purify_tactic, m, m_params);
}
virtual void set_cancel(bool f) {
m_nl_tac->set_cancel(f);
if (f) {
m_solver->cancel();
}
else {
m_solver->reset_cancel();
}
m_cancel = f;
}
virtual void collect_statistics(statistics & st) const {
m_nl_tac->collect_statistics(st);
m_solver->collect_statistics(st);

View file

@ -37,7 +37,6 @@ sls_engine::sls_engine(ast_manager & m, params_ref const & p) :
m_zero(m_mpz_manager.mk_z(0)),
m_one(m_mpz_manager.mk_z(1)),
m_two(m_mpz_manager.mk_z(2)),
m_cancel(false),
m_bv_util(m),
m_tracker(m, m_bv_util, m_mpz_manager, m_powers),
m_evaluator(m, m_bv_util, m_tracker, m_mpz_manager, m_powers)
@ -95,7 +94,7 @@ void sls_engine::collect_statistics(statistics& st) const {
}
void sls_engine::checkpoint() {
if (m_cancel)
if (m_manager.canceled())
throw tactic_exception(TACTIC_CANCELED_MSG);
cooperate("sls");
}

View file

@ -64,7 +64,6 @@ protected:
powers m_powers;
mpz m_zero, m_one, m_two;
bool m_produce_models;
volatile bool m_cancel;
bv_util m_bv_util;
sls_tracker m_tracker;
sls_evaluator m_evaluator;
@ -93,9 +92,6 @@ public:
ast_manager & m() const { return m_manager; }
void set_cancel(bool f) { m_cancel = f; }
void cancel() { set_cancel(true); }
void reset_cancel() { set_cancel(false); }
void updt_params(params_ref const & _p);

View file

@ -95,10 +95,6 @@ public:
m_engine->reset_statistics();
}
virtual void set_cancel(bool f) {
if (m_engine)
m_engine->set_cancel(f);
}
};
tactic * mk_sls_tactic(ast_manager & m, params_ref const & p) {

View file

@ -22,19 +22,7 @@ Notes:
#include"stopwatch.h"
#include"model_v2_pp.h"
void tactic::cancel() {
#pragma omp critical (tactic_cancel)
{
set_cancel(true);
}
}
void tactic::reset_cancel() {
#pragma omp critical (tactic_cancel)
{
set_cancel(false);
}
}
struct tactic_report::imp {
char const * m_id;

View file

@ -44,9 +44,6 @@ public:
virtual void updt_params(params_ref const & p) {}
virtual void collect_param_descrs(param_descrs & r) {}
void cancel();
void reset_cancel();
/**
\brief Apply tactic to goal \c in.
@ -101,8 +98,6 @@ protected:
friend class unary_tactical;
friend class nl_purify_tactic;
virtual void set_cancel(bool f) {}
};
typedef ref<tactic> tactic_ref;

View file

@ -27,18 +27,12 @@ class binary_tactical : public tactic {
protected:
tactic * m_t1;
tactic * m_t2;
volatile bool m_cancel;
void checkpoint() {
if (m_cancel)
throw tactic_exception(TACTIC_CANCELED_MSG);
}
public:
binary_tactical(tactic * t1, tactic * t2):
m_t1(t1),
m_t2(t2),
m_cancel(false) {
m_t2(t2) {
SASSERT(m_t1);
SASSERT(m_t2);
m_t1->inc_ref();
@ -99,11 +93,6 @@ public:
protected:
virtual void set_cancel(bool f) {
m_cancel = f;
m_t1->set_cancel(f);
m_t2->set_cancel(f);
}
template<typename T>
tactic * translate_core(ast_manager & m) {
@ -147,7 +136,6 @@ public:
SASSERT(!is_decided(r1) || (!pc1 && !core1)); // the pc and core of decided goals is 0
unsigned r1_size = r1.size();
SASSERT(r1_size > 0);
checkpoint();
if (r1_size == 1) {
if (r1[0]->is_decided()) {
result.push_back(r1[0]);
@ -168,7 +156,6 @@ public:
sbuffer<unsigned> sz_buffer;
goal_ref_buffer r2;
for (unsigned i = 0; i < r1_size; i++) {
checkpoint();
goal_ref g = r1[i];
r2.reset();
model_converter_ref mc2;
@ -293,15 +280,9 @@ tactic * and_then(unsigned num, tactic * const * ts) {
class nary_tactical : public tactic {
protected:
ptr_vector<tactic> m_ts;
volatile bool m_cancel;
void checkpoint() {
if (m_cancel)
throw tactic_exception(TACTIC_CANCELED_MSG);
}
public:
nary_tactical(unsigned num, tactic * const * ts):
m_cancel(false) {
nary_tactical(unsigned num, tactic * const * ts) {
for (unsigned i = 0; i < num; i++) {
SASSERT(ts[i]);
m_ts.push_back(ts[i]);
@ -383,15 +364,6 @@ public:
protected:
virtual void set_cancel(bool f) {
m_cancel = f;
ptr_vector<tactic>::iterator it = m_ts.begin();
ptr_vector<tactic>::iterator end = m_ts.end();
for (; it != end; ++it)
if (*it)
(*it)->set_cancel(f);
}
template<typename T>
tactic * translate_core(ast_manager & m) {
ptr_buffer<tactic> new_ts;
@ -422,7 +394,6 @@ public:
unsigned sz = m_ts.size();
unsigned i;
for (i = 0; i < sz; i++) {
checkpoint();
tactic * t = m_ts[i];
result.reset();
mc = 0;
@ -568,7 +539,6 @@ public:
if (first) {
for (unsigned j = 0; j < sz; j++) {
if (static_cast<unsigned>(i) != j) {
ts.get(j)->cancel();
managers[j]->limit().cancel();
}
}
@ -673,7 +643,6 @@ public:
SASSERT(!is_decided(r1) || (!pc1 && !core1)); // the pc and core of decided goals is 0
unsigned r1_size = r1.size();
SASSERT(r1_size > 0);
checkpoint();
if (r1_size == 1) {
// Only one subgoal created... no need for parallelism
if (r1[0]->is_decided()) {
@ -771,7 +740,6 @@ public:
if (curr_failed) {
for (unsigned j = 0; j < r1_size; j++) {
if (static_cast<unsigned>(i) != j) {
ts2.get(j)->cancel();
managers[j]->limit().cancel();
}
}
@ -793,7 +761,6 @@ public:
if (first) {
for (unsigned j = 0; j < r1_size; j++) {
if (static_cast<unsigned>(i) != j) {
ts2.get(j)->cancel();
managers[j]->limit().cancel();
}
}
@ -929,18 +896,11 @@ tactic * par_and_then(unsigned num, tactic * const * ts) {
class unary_tactical : public tactic {
protected:
tactic * m_t;
volatile bool m_cancel;
void checkpoint() {
if (m_cancel)
throw tactic_exception(TACTIC_CANCELED_MSG);
}
public:
unary_tactical(tactic * t):
m_t(t),
m_cancel(false) {
m_t(t) {
SASSERT(t);
t->inc_ref();
}
@ -971,11 +931,6 @@ public:
virtual void set_logic(symbol const& l) { m_t->set_logic(l); }
virtual void set_progress_callback(progress_callback * callback) { m_t->set_progress_callback(callback); }
protected:
virtual void set_cancel(bool f) {
m_cancel = f;
if (m_t)
m_t->set_cancel(f);
}
template<typename T>
tactic * translate_core(ast_manager & m) {
@ -1029,7 +984,6 @@ class repeat_tactical : public unary_tactical {
}
unsigned r1_size = r1.size();
SASSERT(r1_size > 0);
checkpoint();
if (r1_size == 1) {
if (r1[0]->is_decided()) {
result.push_back(r1[0]);
@ -1050,7 +1004,6 @@ class repeat_tactical : public unary_tactical {
sbuffer<unsigned> sz_buffer;
goal_ref_buffer r2;
for (unsigned i = 0; i < r1_size; i++) {
checkpoint();
goal_ref g = r1[i];
r2.reset();
model_converter_ref mc2;
@ -1199,7 +1152,7 @@ public:
model_converter_ref & mc,
proof_converter_ref & pc,
expr_dependency_ref & core) {
cancel_eh<tactic> eh(*m_t);
cancel_eh<reslimit> eh(in->m().limit());
{
// Warning: scoped_timer is not thread safe in Linux.
scoped_timer timer(m_timeout, &eh);

View file

@ -30,21 +30,16 @@ class macro_finder_tactic : public tactic {
struct imp {
ast_manager & m_manager;
bool m_cancel;
bool m_elim_and;
imp(ast_manager & m, params_ref const & p) :
m_manager(m),
m_cancel(false),
m_elim_and(false) {
updt_params(p);
}
ast_manager & m() const { return m_manager; }
void set_cancel(bool f) {
m_cancel = f;
}
void operator()(goal_ref const & g,
goal_ref_buffer & result,
@ -152,10 +147,7 @@ public:
dealloc(d);
}
virtual void set_cancel(bool f) {
if (m_imp)
m_imp->set_cancel(f);
}
};
tactic * mk_macro_finder_tactic(ast_manager & m, params_ref const & p) {

View file

@ -31,17 +31,13 @@ class quasi_macros_tactic : public tactic {
struct imp {
ast_manager & m_manager;
bool m_cancel;
imp(ast_manager & m, params_ref const & p) : m_manager(m),m_cancel(false) {
imp(ast_manager & m, params_ref const & p) : m_manager(m) {
updt_params(p);
}
ast_manager & m() const { return m_manager; }
void set_cancel(bool f) {
m_cancel = f;
}
void operator()(goal_ref const & g,
goal_ref_buffer & result,
@ -80,7 +76,7 @@ class quasi_macros_tactic : public tactic {
}
while (more) { // CMW: use repeat(...) ?
if (m_cancel)
if (m().canceled())
throw tactic_exception(TACTIC_CANCELED_MSG);
new_forms.reset();
@ -159,10 +155,6 @@ public:
dealloc(d);
}
virtual void set_cancel(bool f) {
if (m_imp)
m_imp->set_cancel(f);
}
};
tactic * mk_quasi_macros_tactic(ast_manager & m, params_ref const & p) {

View file

@ -26,18 +26,13 @@ class ufbv_rewriter_tactic : public tactic {
struct imp {
ast_manager & m_manager;
bool m_cancel;
imp(ast_manager & m, params_ref const & p) : m_manager(m),m_cancel(false) {
imp(ast_manager & m, params_ref const & p) : m_manager(m) {
updt_params(p);
}
ast_manager & m() const { return m_manager; }
void set_cancel(bool f) {
m_cancel = f;
}
void operator()(goal_ref const & g,
goal_ref_buffer & result,
model_converter_ref & mc,
@ -127,10 +122,6 @@ public:
dealloc(d);
}
virtual void set_cancel(bool f) {
if (m_imp)
m_imp->set_cancel(f);
}
};
tactic * mk_ufbv_rewriter_tactic(ast_manager & m, params_ref const & p) {