mirror of
https://github.com/Z3Prover/z3
synced 2025-06-18 11:58:31 +00:00
enable more simplification in case inequality triggers a change.
This commit is contained in:
parent
4e21e126a8
commit
8fac89cdcc
5 changed files with 63 additions and 7 deletions
|
@ -36,6 +36,7 @@ class simplifier_solver : public solver {
|
|||
struct dep_expr_state : public dependent_expr_state {
|
||||
simplifier_solver& s;
|
||||
model_reconstruction_trail m_reconstruction_trail;
|
||||
bool m_updated = false;
|
||||
dep_expr_state(simplifier_solver& s) :dependent_expr_state(s.m), s(s), m_reconstruction_trail(s.m, m_trail) {}
|
||||
~dep_expr_state() override {}
|
||||
virtual unsigned qtail() const override { return s.m_fmls.size(); }
|
||||
|
@ -43,10 +44,13 @@ class simplifier_solver : public solver {
|
|||
void update(unsigned i, dependent_expr const& j) override {
|
||||
SASSERT(j.fml());
|
||||
check_false(j.fml());
|
||||
s.m_fmls[i] = j;
|
||||
s.m_fmls[i] = j;
|
||||
m_updated = true;
|
||||
}
|
||||
void add(dependent_expr const& j) override { check_false(j.fml()); s.m_fmls.push_back(j); }
|
||||
void add(dependent_expr const& j) override { m_updated = true; check_false(j.fml()); s.m_fmls.push_back(j); }
|
||||
bool inconsistent() override { return s.m_inconsistent; }
|
||||
bool updated() override { return m_updated; }
|
||||
void reset_updated() override { m_updated = false; }
|
||||
model_reconstruction_trail& model_trail() override { return m_reconstruction_trail; }
|
||||
std::ostream& display(std::ostream& out) const override {
|
||||
unsigned i = 0;
|
||||
|
@ -77,7 +81,7 @@ class simplifier_solver : public solver {
|
|||
expr_mark seen;
|
||||
unsigned j = qhead();
|
||||
for (unsigned i = qhead(); i < qtail(); ++i) {
|
||||
expr* f = s.m_fmls[i].fml();
|
||||
expr* f = s.m_fmls[i].fml(), *g = nullptr;
|
||||
if (seen.is_marked(f))
|
||||
continue;
|
||||
seen.mark(f, true);
|
||||
|
@ -89,6 +93,12 @@ class simplifier_solver : public solver {
|
|||
add(dependent_expr(s.m, arg, nullptr, d));
|
||||
continue;
|
||||
}
|
||||
if (s.m.is_not(f, g) && s.m.is_or(g)) {
|
||||
auto* d = s.m_fmls[i].dep();
|
||||
for (expr* arg : *to_app(g))
|
||||
add(dependent_expr(s.m, mk_not(s.m, arg), nullptr, d));
|
||||
continue;
|
||||
}
|
||||
if (i != j)
|
||||
s.m_fmls[j] = s.m_fmls[i];
|
||||
++j;
|
||||
|
|
|
@ -47,6 +47,17 @@ Notes:
|
|||
|
||||
void init_preprocess(ast_manager& m, params_ref const& p, then_simplifier& s, dependent_expr_state& st) {
|
||||
|
||||
auto mk_bound_simplifier = [&]() {
|
||||
auto* s1 = alloc(bound_simplifier, m, p, st);
|
||||
auto* s2 = alloc(then_simplifier, m, p, st);
|
||||
s2->add_simplifier(alloc(rewriter_simplifier, m, p, st));
|
||||
s2->add_simplifier(alloc(propagate_values, m, p, st));
|
||||
s2->add_simplifier(alloc(euf::solve_eqs, m, st));
|
||||
auto* r = alloc(if_change_simplifier, m, p, st);
|
||||
r->add_simplifier(s1);
|
||||
r->add_simplifier(s2);
|
||||
return r;
|
||||
};
|
||||
smt_params smtp(p);
|
||||
s.add_simplifier(alloc(rewriter_simplifier, m, p, st));
|
||||
if (smtp.m_propagate_values) s.add_simplifier(alloc(propagate_values, m, p, st));
|
||||
|
@ -60,7 +71,7 @@ void init_preprocess(ast_manager& m, params_ref const& p, then_simplifier& s, de
|
|||
if (smtp.m_refine_inj_axiom) s.add_simplifier(alloc(refine_inj_axiom_simplifier, m, p, st));
|
||||
if (smtp.m_bv_size_reduce) s.add_simplifier(alloc(bv::slice, m, st));
|
||||
if (smtp.m_distribute_forall) s.add_simplifier(alloc(distribute_forall_simplifier, m, p, st));
|
||||
if (smtp.m_bound_simplifier) s.add_simplifier(alloc(bound_simplifier, m, p, st));
|
||||
if (smtp.m_bound_simplifier) s.add_simplifier(mk_bound_simplifier());
|
||||
if (smtp.m_eliminate_bounds) s.add_simplifier(alloc(elim_bounds_simplifier, m, p, st));
|
||||
if (smtp.m_simplify_bit2int) s.add_simplifier(alloc(bit2int_simplifier, m, p, st));
|
||||
if (smtp.m_bb_quantifiers) s.add_simplifier(alloc(bv::elim_simplifier, m, p, st));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue