mirror of
https://github.com/Z3Prover/z3
synced 2025-06-28 08:58:44 +00:00
reduce boilerplate in qe_lite
This commit is contained in:
parent
3760107bb8
commit
e920648c1e
1 changed files with 80 additions and 104 deletions
|
@ -2213,7 +2213,6 @@ namespace fm {
|
||||||
} // anonymous namespace
|
} // anonymous namespace
|
||||||
|
|
||||||
class qe_lite::impl {
|
class qe_lite::impl {
|
||||||
public:
|
|
||||||
struct elim_cfg : public default_rewriter_cfg {
|
struct elim_cfg : public default_rewriter_cfg {
|
||||||
impl& m_imp;
|
impl& m_imp;
|
||||||
ast_manager& m;
|
ast_manager& m;
|
||||||
|
@ -2403,21 +2402,16 @@ void qe_lite::operator()(uint_set const& index_set, bool index_of_bound, expr_re
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
class qe_lite_tactic : public tactic {
|
class qe_lite_tactic : public tactic {
|
||||||
|
|
||||||
struct imp {
|
|
||||||
ast_manager& m;
|
ast_manager& m;
|
||||||
|
params_ref m_params;
|
||||||
qe_lite m_qe;
|
qe_lite m_qe;
|
||||||
|
|
||||||
imp(ast_manager& m, params_ref const & p):
|
|
||||||
m(m),
|
|
||||||
m_qe(m, p, true)
|
|
||||||
{}
|
|
||||||
|
|
||||||
void checkpoint() {
|
void checkpoint() {
|
||||||
if (m.canceled())
|
if (m.canceled())
|
||||||
throw tactic_exception(m.limit().get_cancel_msg());
|
throw tactic_exception(m.limit().get_cancel_msg());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
void debug_diff(expr* a, expr* b) {
|
void debug_diff(expr* a, expr* b) {
|
||||||
ptr_vector<expr> as, bs;
|
ptr_vector<expr> as, bs;
|
||||||
as.push_back(a);
|
as.push_back(a);
|
||||||
|
@ -2452,9 +2446,29 @@ class qe_lite_tactic : public tactic {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
public:
|
||||||
|
qe_lite_tactic(ast_manager & m, params_ref const & p):
|
||||||
|
m(m),
|
||||||
|
m_params(p),
|
||||||
|
m_qe(m, p, true) {}
|
||||||
|
|
||||||
|
tactic * translate(ast_manager & m) override {
|
||||||
|
return alloc(qe_lite_tactic, m, m_params);
|
||||||
|
}
|
||||||
|
|
||||||
|
void updt_params(params_ref const & p) override {
|
||||||
|
m_params = p;
|
||||||
|
// m_imp->updt_params(p);
|
||||||
|
}
|
||||||
|
|
||||||
|
void collect_param_descrs(param_descrs & r) override {
|
||||||
|
// m_imp->collect_param_descrs(r);
|
||||||
|
}
|
||||||
|
|
||||||
void operator()(goal_ref const & g,
|
void operator()(goal_ref const & g,
|
||||||
goal_ref_buffer & result) {
|
goal_ref_buffer & result) override {
|
||||||
SASSERT(g->is_well_sorted());
|
SASSERT(g->is_well_sorted());
|
||||||
tactic_report report("qe-lite", *g);
|
tactic_report report("qe-lite", *g);
|
||||||
proof_ref new_pr(m);
|
proof_ref new_pr(m);
|
||||||
|
@ -2490,40 +2504,6 @@ class qe_lite_tactic : public tactic {
|
||||||
SASSERT(g->is_well_sorted());
|
SASSERT(g->is_well_sorted());
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
params_ref m_params;
|
|
||||||
imp * m_imp;
|
|
||||||
|
|
||||||
public:
|
|
||||||
qe_lite_tactic(ast_manager & m, params_ref const & p):
|
|
||||||
m_params(p) {
|
|
||||||
m_imp = alloc(imp, m, p);
|
|
||||||
}
|
|
||||||
|
|
||||||
~qe_lite_tactic() override {
|
|
||||||
dealloc(m_imp);
|
|
||||||
}
|
|
||||||
|
|
||||||
tactic * translate(ast_manager & m) override {
|
|
||||||
return alloc(qe_lite_tactic, m, m_params);
|
|
||||||
}
|
|
||||||
|
|
||||||
void updt_params(params_ref const & p) override {
|
|
||||||
m_params = p;
|
|
||||||
// m_imp->updt_params(p);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void collect_param_descrs(param_descrs & r) override {
|
|
||||||
// m_imp->collect_param_descrs(r);
|
|
||||||
}
|
|
||||||
|
|
||||||
void operator()(goal_ref const & in,
|
|
||||||
goal_ref_buffer & result) override {
|
|
||||||
(*m_imp)(in, result);
|
|
||||||
}
|
|
||||||
|
|
||||||
void collect_statistics(statistics & st) const override {
|
void collect_statistics(statistics & st) const override {
|
||||||
// m_imp->collect_statistics(st);
|
// m_imp->collect_statistics(st);
|
||||||
}
|
}
|
||||||
|
@ -2533,16 +2513,12 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
void cleanup() override {
|
void cleanup() override {
|
||||||
ast_manager & m = m_imp->m;
|
m_qe.~qe_lite();
|
||||||
m_imp->~imp();
|
new (&m_qe) qe_lite(m, m_params, true);
|
||||||
m_imp = new (m_imp) imp(m, m_params);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
tactic * mk_qe_lite_tactic(ast_manager & m, params_ref const & p) {
|
tactic * mk_qe_lite_tactic(ast_manager & m, params_ref const & p) {
|
||||||
return alloc(qe_lite_tactic, m, p);
|
return alloc(qe_lite_tactic, m, p);
|
||||||
}
|
}
|
||||||
|
|
||||||
template class rewriter_tpl<qe_lite::impl::elim_cfg>;
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue