mirror of
https://github.com/Z3Prover/z3
synced 2025-04-23 00:55:31 +00:00
moving to resource managed cancellation
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
61dbb6168e
commit
32b6b2da44
41 changed files with 55 additions and 280 deletions
|
@ -898,7 +898,6 @@ namespace qe {
|
|||
|
||||
virtual void eliminate(bool is_forall, unsigned num_vars, app* const* vars, expr_ref& fml) = 0;
|
||||
|
||||
virtual void set_cancel(bool f) = 0;
|
||||
|
||||
virtual void updt_params(params_ref const& p) {}
|
||||
|
||||
|
@ -1408,10 +1407,6 @@ namespace qe {
|
|||
m_conjs.add_plugin(p);
|
||||
}
|
||||
|
||||
void set_cancel(bool f) {
|
||||
m_solver.set_cancel(f);
|
||||
m_rewriter.set_cancel(f);
|
||||
}
|
||||
|
||||
void check(unsigned num_vars, app* const* vars,
|
||||
expr* assumption, expr_ref& fml, bool get_first,
|
||||
|
@ -2032,7 +2027,6 @@ namespace qe {
|
|||
expr_ref m_assumption;
|
||||
bool m_produce_models;
|
||||
ptr_vector<quant_elim_plugin> m_plugins;
|
||||
volatile bool m_cancel;
|
||||
bool m_eliminate_variables_as_block;
|
||||
|
||||
public:
|
||||
|
@ -2041,7 +2035,6 @@ namespace qe {
|
|||
m_fparams(p),
|
||||
m_assumption(m),
|
||||
m_produce_models(m_fparams.m_model),
|
||||
m_cancel(false),
|
||||
m_eliminate_variables_as_block(true)
|
||||
{
|
||||
}
|
||||
|
@ -2055,16 +2048,9 @@ namespace qe {
|
|||
dealloc(m_plugins[i]);
|
||||
}
|
||||
}
|
||||
|
||||
void set_cancel(bool f) {
|
||||
for (unsigned i = 0; i < m_plugins.size(); ++i) {
|
||||
m_plugins[i]->set_cancel(f);
|
||||
}
|
||||
m_cancel = f;
|
||||
}
|
||||
|
||||
|
||||
void checkpoint() {
|
||||
if (m_cancel)
|
||||
if (m.canceled())
|
||||
throw tactic_exception(TACTIC_CANCELED_MSG);
|
||||
cooperate("qe");
|
||||
}
|
||||
|
@ -2409,11 +2395,6 @@ namespace qe {
|
|||
return is_sat != l_undef;
|
||||
}
|
||||
|
||||
void expr_quant_elim::set_cancel(bool f) {
|
||||
if (m_qe) {
|
||||
m_qe->set_cancel(f);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -313,8 +313,6 @@ namespace qe {
|
|||
bool solve_for_vars(unsigned num_vars, app* const* vars, expr* fml, guarded_defs& defs);
|
||||
|
||||
|
||||
void set_cancel(bool f);
|
||||
|
||||
private:
|
||||
void instantiate_expr(expr_ref_vector& bound, expr_ref& fml);
|
||||
void abstract_expr(unsigned sz, expr* const* bound, expr_ref& fml);
|
||||
|
@ -343,7 +341,6 @@ namespace qe {
|
|||
return m_quant_elim.first_elim(num_vars, vars, fml, defs);
|
||||
}
|
||||
|
||||
void set_cancel(bool f) {} // TBD: replace simplifier by rewriter
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -93,7 +93,6 @@ namespace eq {
|
|||
expr_ref_vector m_subst_map;
|
||||
expr_ref_buffer m_new_args;
|
||||
th_rewriter m_rewriter;
|
||||
volatile bool m_cancel;
|
||||
|
||||
void der_sort_vars(ptr_vector<var> & vars, ptr_vector<expr> & definitions, unsigned_vector & order) {
|
||||
order.reset();
|
||||
|
@ -738,7 +737,7 @@ namespace eq {
|
|||
|
||||
void checkpoint() {
|
||||
cooperate("der");
|
||||
if (m_cancel)
|
||||
if (m.canceled())
|
||||
throw tactic_exception(TACTIC_CANCELED_MSG);
|
||||
}
|
||||
|
||||
|
@ -752,8 +751,7 @@ namespace eq {
|
|||
m_new_exprs(m),
|
||||
m_subst_map(m),
|
||||
m_new_args(m),
|
||||
m_rewriter(m),
|
||||
m_cancel(false) {}
|
||||
m_rewriter(m) {}
|
||||
|
||||
void set_is_variable_proc(is_variable_proc& proc) { m_is_variable = &proc;}
|
||||
|
||||
|
@ -790,10 +788,6 @@ namespace eq {
|
|||
|
||||
ast_manager& get_manager() const { return m; }
|
||||
|
||||
void set_cancel(bool f) {
|
||||
m_rewriter.set_cancel(f);
|
||||
m_cancel = f;
|
||||
}
|
||||
|
||||
};
|
||||
}; // namespace eq
|
||||
|
@ -808,7 +802,6 @@ namespace ar {
|
|||
is_variable_proc* m_is_variable;
|
||||
ptr_vector<expr> m_todo;
|
||||
expr_mark m_visited;
|
||||
volatile bool m_cancel;
|
||||
|
||||
bool is_variable(expr * e) const {
|
||||
return (*m_is_variable)(e);
|
||||
|
@ -923,13 +916,13 @@ namespace ar {
|
|||
|
||||
void checkpoint() {
|
||||
cooperate("der");
|
||||
if (m_cancel)
|
||||
if (m.canceled())
|
||||
throw tactic_exception(TACTIC_CANCELED_MSG);
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
der(ast_manager& m): m(m), a(m), m_is_variable(0), m_cancel(false) {}
|
||||
der(ast_manager& m): m(m), a(m), m_is_variable(0) {}
|
||||
|
||||
void operator()(expr_ref_vector& fmls) {
|
||||
for (unsigned i = 0; i < fmls.size(); ++i) {
|
||||
|
@ -942,10 +935,6 @@ namespace ar {
|
|||
void operator()(expr* e) {}
|
||||
|
||||
void set_is_variable_proc(is_variable_proc& proc) { m_is_variable = &proc;}
|
||||
|
||||
void set_cancel(bool f) {
|
||||
m_cancel = f;
|
||||
}
|
||||
|
||||
};
|
||||
}; // namespace ar
|
||||
|
@ -1066,7 +1055,6 @@ namespace fm {
|
|||
vector<constraints> m_uppers;
|
||||
uint_set m_forbidden_set; // variables that cannot be eliminated because occur in non OCC ineq part
|
||||
expr_ref_vector m_new_fmls;
|
||||
volatile bool m_cancel;
|
||||
id_gen m_id_gen;
|
||||
bool m_fm_real_only;
|
||||
unsigned m_fm_limit;
|
||||
|
@ -1459,7 +1447,6 @@ namespace fm {
|
|||
m_var2expr(m),
|
||||
m_new_fmls(m),
|
||||
m_inconsistent_core(m) {
|
||||
m_cancel = false;
|
||||
updt_params();
|
||||
m_counter = 0;
|
||||
m_inconsistent = false;
|
||||
|
@ -1478,9 +1465,6 @@ namespace fm {
|
|||
m_fm_occ = true;
|
||||
}
|
||||
|
||||
void set_cancel(bool f) {
|
||||
m_cancel = f;
|
||||
}
|
||||
private:
|
||||
|
||||
struct forbidden_proc {
|
||||
|
@ -2222,7 +2206,7 @@ namespace fm {
|
|||
|
||||
void checkpoint() {
|
||||
cooperate("fm");
|
||||
if (m_cancel)
|
||||
if (m.canceled())
|
||||
throw tactic_exception(TACTIC_CANCELED_MSG);
|
||||
}
|
||||
public:
|
||||
|
@ -2453,14 +2437,6 @@ public:
|
|||
TRACE("qe_lite", for (unsigned i = 0; i < fmls.size(); ++i) tout << mk_pp(fmls[i].get(), m) << "\n";);
|
||||
}
|
||||
|
||||
void set_cancel(bool f) {
|
||||
m_der.set_cancel(f);
|
||||
m_array_der.set_cancel(f);
|
||||
m_fm.set_cancel(f);
|
||||
m_elim_star.set_cancel(f);
|
||||
m_rewriter.set_cancel(f);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
qe_lite::qe_lite(ast_manager& m) {
|
||||
|
@ -2475,9 +2451,6 @@ void qe_lite::operator()(app_ref_vector& vars, expr_ref& fml) {
|
|||
(*m_impl)(vars, fml);
|
||||
}
|
||||
|
||||
void qe_lite::set_cancel(bool f) {
|
||||
m_impl->set_cancel(f);
|
||||
}
|
||||
|
||||
void qe_lite::operator()(expr_ref& fml, proof_ref& pr) {
|
||||
(*m_impl)(fml, pr);
|
||||
|
@ -2496,21 +2469,14 @@ class qe_lite_tactic : public tactic {
|
|||
struct imp {
|
||||
ast_manager& m;
|
||||
qe_lite m_qe;
|
||||
volatile bool m_cancel;
|
||||
|
||||
imp(ast_manager& m, params_ref const& p):
|
||||
m(m),
|
||||
m_qe(m),
|
||||
m_cancel(false)
|
||||
m_qe(m)
|
||||
{}
|
||||
|
||||
void set_cancel(bool f) {
|
||||
m_cancel = f;
|
||||
m_qe.set_cancel(f);
|
||||
}
|
||||
|
||||
void checkpoint() {
|
||||
if (m_cancel)
|
||||
if (m.canceled())
|
||||
throw tactic_exception(TACTIC_CANCELED_MSG);
|
||||
cooperate("qe-lite");
|
||||
}
|
||||
|
|
|
@ -59,8 +59,6 @@ public:
|
|||
\brief full rewriting based light-weight quantifier elimination round.
|
||||
*/
|
||||
void operator()(expr_ref& fml, proof_ref& pr);
|
||||
|
||||
void set_cancel(bool f);
|
||||
};
|
||||
|
||||
tactic * mk_qe_lite_tactic(ast_manager & m, params_ref const & p = params_ref());
|
||||
|
|
|
@ -58,7 +58,6 @@ namespace qe {
|
|||
|
||||
ast_manager& m;
|
||||
expr_ref m_false;
|
||||
volatile bool m_cancel;
|
||||
smt_params m_fparams;
|
||||
params_ref m_params;
|
||||
unsigned m_extrapolate_strategy_param;
|
||||
|
@ -209,7 +208,6 @@ namespace qe {
|
|||
sat_tactic(ast_manager& m, params_ref const& p = params_ref()):
|
||||
m(m),
|
||||
m_false(m.mk_false(), m),
|
||||
m_cancel(false),
|
||||
m_params(p),
|
||||
m_extrapolate_strategy_param(0),
|
||||
m_projection_mode_param(true),
|
||||
|
@ -233,17 +231,6 @@ namespace qe {
|
|||
reset();
|
||||
}
|
||||
|
||||
virtual void set_cancel(bool f) {
|
||||
m_cancel = f;
|
||||
// not thread-safe when solvers are reset.
|
||||
// TBD: lock - this, reset() and init_Ms.
|
||||
for (unsigned i = 0; i < m_solvers.size(); ++i) {
|
||||
m_solvers[i]->set_cancel(f);
|
||||
}
|
||||
m_solver.set_cancel(f);
|
||||
m_ctx_rewriter.set_cancel(f);
|
||||
}
|
||||
|
||||
virtual void operator()(
|
||||
goal_ref const& goal,
|
||||
goal_ref_buffer& result,
|
||||
|
@ -674,7 +661,7 @@ namespace qe {
|
|||
}
|
||||
|
||||
void checkpoint() {
|
||||
if (m_cancel) {
|
||||
if (m.canceled()) {
|
||||
throw tactic_exception(TACTIC_CANCELED_MSG);
|
||||
}
|
||||
cooperate("qe-sat");
|
||||
|
|
|
@ -25,14 +25,12 @@ class qe_tactic : public tactic {
|
|||
struct imp {
|
||||
ast_manager & m;
|
||||
smt_params m_fparams;
|
||||
volatile bool m_cancel;
|
||||
qe::expr_quant_elim m_qe;
|
||||
|
||||
imp(ast_manager & _m, params_ref const & p):
|
||||
m(_m),
|
||||
m_qe(m, m_fparams) {
|
||||
updt_params(p);
|
||||
m_cancel = false;
|
||||
}
|
||||
|
||||
void updt_params(params_ref const & p) {
|
||||
|
@ -45,13 +43,8 @@ class qe_tactic : public tactic {
|
|||
m_qe.collect_param_descrs(r);
|
||||
}
|
||||
|
||||
void set_cancel(bool f) {
|
||||
m_cancel = f;
|
||||
m_qe.set_cancel(f);
|
||||
}
|
||||
|
||||
void checkpoint() {
|
||||
if (m_cancel)
|
||||
if (m.canceled())
|
||||
throw tactic_exception(TACTIC_CANCELED_MSG);
|
||||
cooperate("qe");
|
||||
}
|
||||
|
@ -141,11 +134,6 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual void set_cancel(bool f) {
|
||||
if (m_imp)
|
||||
m_imp->set_cancel(f);
|
||||
}
|
||||
};
|
||||
|
||||
tactic * mk_qe_tactic(ast_manager & m, params_ref const & p) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue