mirror of
https://github.com/Z3Prover/z3
synced 2025-08-07 03:31:23 +00:00
Add simplification customization for SMTLIB2
Add the ability to customize incremental pre-processing simplification for the SMTLIB2 front-end. The main new capability is to use pre-processing tactics in incremental mode that were previously not available. The main new capabilities are - solve-eqs - reduce-args - elim-unconstrained There are several more. Documentation and exposed simplifiers are populated incrementally. The current set of supported simplifiers can be inspected by using z3 with the --simplifiers flag or referring to https://microsoft.github.io/z3guide/docs/strategies/simplifiers Some pending features are: - add the ability to update parameters to simplifiers similar to how tactics can be controlled using parameters. - expose simplification solvers over the binary API.
This commit is contained in:
parent
dd0decfe5d
commit
6022c17131
32 changed files with 370 additions and 69 deletions
|
@ -89,7 +89,7 @@ class simplifier_solver : public solver {
|
|||
};
|
||||
|
||||
ast_manager& m;
|
||||
scoped_ptr<solver> s;
|
||||
solver_ref s;
|
||||
vector<dependent_expr> m_fmls;
|
||||
dep_expr_state m_preprocess_state;
|
||||
seq_simplifier m_preprocess;
|
||||
|
@ -143,7 +143,7 @@ class simplifier_solver : public solver {
|
|||
|
||||
public:
|
||||
|
||||
simplifier_solver(solver* s) :
|
||||
simplifier_solver(solver* s, simplifier_factory* fac) :
|
||||
solver(s->get_manager()),
|
||||
m(s->get_manager()),
|
||||
s(s),
|
||||
|
@ -152,7 +152,10 @@ public:
|
|||
m_assumptions(m),
|
||||
m_proof(m)
|
||||
{
|
||||
init_preprocess(m, s->get_params(), m_preprocess, m_preprocess_state);
|
||||
if (fac)
|
||||
m_preprocess.add_simplifier((*fac)(m, s->get_params(), m_preprocess_state));
|
||||
else
|
||||
init_preprocess(m, s->get_params(), m_preprocess, m_preprocess_state);
|
||||
}
|
||||
|
||||
void assert_expr_core2(expr* t, expr* a) override {
|
||||
|
@ -197,7 +200,8 @@ public:
|
|||
}
|
||||
|
||||
model_ref m_cached_model;
|
||||
void get_model_core(model_ref& m) override {
|
||||
void get_model_core(model_ref& m) override {
|
||||
CTRACE("simplifier", m_mc.get(), m_mc->display(tout));
|
||||
if (m_cached_model) {
|
||||
m = m_cached_model;
|
||||
return;
|
||||
|
@ -229,7 +233,7 @@ public:
|
|||
solver* translate(ast_manager& m, params_ref const& p) override {
|
||||
solver* new_s = s->translate(m, p);
|
||||
ast_translation tr(get_manager(), m);
|
||||
simplifier_solver* result = alloc(simplifier_solver, new_s);
|
||||
simplifier_solver* result = alloc(simplifier_solver, new_s, nullptr); // factory?
|
||||
for (dependent_expr const& f : m_fmls)
|
||||
result->m_fmls.push_back(dependent_expr(tr, f));
|
||||
if (m_mc)
|
||||
|
@ -311,7 +315,7 @@ public:
|
|||
|
||||
};
|
||||
|
||||
solver* mk_simplifier_solver(solver* s) {
|
||||
return alloc(simplifier_solver, s);
|
||||
solver* mk_simplifier_solver(solver* s, simplifier_factory* fac) {
|
||||
return alloc(simplifier_solver, s, fac);
|
||||
}
|
||||
|
||||
|
|
|
@ -20,6 +20,9 @@ Author:
|
|||
|
||||
class solver;
|
||||
class solver_factory;
|
||||
class dependent_expr_simplifier;
|
||||
class dependent_expr_state;
|
||||
typedef std::function<dependent_expr_simplifier*(ast_manager&, const params_ref&, dependent_expr_state& s)> simplifier_factory;
|
||||
|
||||
solver * mk_simplifier_solver(solver * s);
|
||||
solver * mk_simplifier_solver(solver * s, simplifier_factory* fac);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue