mirror of
https://github.com/Z3Prover/z3
synced 2025-04-27 10:55:50 +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
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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()) {
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -140,11 +140,6 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
virtual void set_cancel(bool f) {
|
||||
if (m_rw)
|
||||
m_rw->set_cancel(f);
|
||||
}
|
||||
|
||||
virtual void cleanup() {}
|
||||
};
|
||||
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -264,9 +264,6 @@ public:
|
|||
return m_progress;
|
||||
}
|
||||
|
||||
virtual void set_cancel(bool f) {
|
||||
}
|
||||
|
||||
virtual void updt_params(params_ref const & p) {
|
||||
}
|
||||
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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);
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue