mirror of
https://github.com/Z3Prover/z3
synced 2025-04-23 17:15: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
|
@ -74,6 +74,8 @@ public:
|
|||
virtual bool inconsistent() = 0;
|
||||
virtual model_reconstruction_trail& model_trail() = 0;
|
||||
virtual void flatten_suffix() {}
|
||||
virtual bool updated() = 0;
|
||||
virtual void reset_updated() = 0;
|
||||
|
||||
trail_stack m_trail;
|
||||
void push() {
|
||||
|
@ -109,6 +111,9 @@ public:
|
|||
virtual void add(dependent_expr const& j) { throw default_exception("unexpected addition"); }
|
||||
virtual bool inconsistent() { return false; }
|
||||
virtual model_reconstruction_trail& model_trail() { throw default_exception("unexpected access to model reconstruction"); }
|
||||
virtual bool updated() { return false; }
|
||||
virtual void reset_updated() {}
|
||||
|
||||
};
|
||||
|
||||
inline std::ostream& operator<<(std::ostream& out, dependent_expr_state& st) {
|
||||
|
@ -147,7 +152,7 @@ protected:
|
|||
index_set indices() { return index_set(*this); }
|
||||
|
||||
proof* mp(proof* a, proof* b) { return (a && b) ? m.mk_modus_ponens(a, b) : nullptr; }
|
||||
|
||||
proof* tr(proof* a, proof* b) { return m.mk_transitivity(a, b); }
|
||||
public:
|
||||
dependent_expr_simplifier(ast_manager& m, dependent_expr_state& s) : m(m), m_fmls(s), m_trail(s.m_trail) {}
|
||||
virtual ~dependent_expr_simplifier() {}
|
||||
|
|
|
@ -51,6 +51,10 @@ class then_simplifier : public dependent_expr_simplifier {
|
|||
}
|
||||
};
|
||||
|
||||
protected:
|
||||
|
||||
bool m_bail_on_no_change = false;
|
||||
|
||||
public:
|
||||
|
||||
then_simplifier(ast_manager& m, params_ref const& p, dependent_expr_state& fmls):
|
||||
|
@ -72,9 +76,17 @@ public:
|
|||
break;
|
||||
s->reset_statistics();
|
||||
collect_stats _cs(*s);
|
||||
s->reduce();
|
||||
m_fmls.flatten_suffix();
|
||||
m_fmls.reset_updated();
|
||||
try {
|
||||
s->reduce();
|
||||
m_fmls.flatten_suffix();
|
||||
}
|
||||
catch (rewriter_exception &) {
|
||||
break;
|
||||
}
|
||||
TRACE("simplifier", tout << s->name() << "\n" << m_fmls);
|
||||
if (m_bail_on_no_change && !m_fmls.updated())
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -108,3 +120,14 @@ public:
|
|||
s->pop(n);
|
||||
}
|
||||
};
|
||||
|
||||
class if_change_simplifier : public then_simplifier {
|
||||
public:
|
||||
if_change_simplifier(ast_manager& m, params_ref const& p, dependent_expr_state& fmls):
|
||||
then_simplifier(m, p, fmls) {
|
||||
m_bail_on_no_change = true;
|
||||
}
|
||||
|
||||
char const* name() const override { return "if-change-then"; }
|
||||
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue