mirror of
https://github.com/Z3Prover/z3
synced 2025-04-12 20:18:18 +00:00
fix #4873
This commit is contained in:
parent
f71204c222
commit
7fe8298479
|
@ -158,8 +158,7 @@ bool quasi_macros::is_quasi_macro(expr * e, app_ref & a, expr_ref & t) const {
|
||||||
if (is_forall(e)) {
|
if (is_forall(e)) {
|
||||||
quantifier * q = to_quantifier(e);
|
quantifier * q = to_quantifier(e);
|
||||||
expr * qe = q->get_expr(), *lhs = nullptr, *rhs = nullptr;
|
expr * qe = q->get_expr(), *lhs = nullptr, *rhs = nullptr;
|
||||||
if ((m.is_eq(qe, lhs, rhs))) {
|
if (m.is_eq(qe, lhs, rhs)) {
|
||||||
|
|
||||||
if (is_non_ground_uninterp(lhs) && is_unique(to_app(lhs)->get_decl()) &&
|
if (is_non_ground_uninterp(lhs) && is_unique(to_app(lhs)->get_decl()) &&
|
||||||
!depends_on(rhs, to_app(lhs)->get_decl()) && fully_depends_on(to_app(lhs), q)) {
|
!depends_on(rhs, to_app(lhs)->get_decl()) && fully_depends_on(to_app(lhs), q)) {
|
||||||
a = to_app(lhs);
|
a = to_app(lhs);
|
||||||
|
@ -304,10 +303,8 @@ bool quasi_macros::find_macros(unsigned n, justified_expr const * exprs) {
|
||||||
find_occurrences(exprs[i].get_fml());
|
find_occurrences(exprs[i].get_fml());
|
||||||
|
|
||||||
TRACE("quasi_macros", tout << "Occurrences: " << std::endl;
|
TRACE("quasi_macros", tout << "Occurrences: " << std::endl;
|
||||||
for (occurrences_map::iterator it = m_occurrences.begin();
|
for (auto kv : m_occurrences)
|
||||||
it != m_occurrences.end();
|
tout << kv.m_key->get_name() << ": " << kv.m_value << std::endl; );
|
||||||
it++)
|
|
||||||
tout << it->m_key->get_name() << ": " << it->m_value << std::endl; );
|
|
||||||
|
|
||||||
// Find all macros
|
// Find all macros
|
||||||
for (unsigned i = 0 ; i < n ; i++) {
|
for (unsigned i = 0 ; i < n ; i++) {
|
||||||
|
@ -370,6 +367,7 @@ void quasi_macros::apply_macros(unsigned n, justified_expr const* fmls, vector<j
|
||||||
}
|
}
|
||||||
|
|
||||||
bool quasi_macros::operator()(unsigned n, justified_expr const* fmls, vector<justified_expr>& new_fmls) {
|
bool quasi_macros::operator()(unsigned n, justified_expr const* fmls, vector<justified_expr>& new_fmls) {
|
||||||
|
TRACE("quasi_macros", m_macro_manager.display(tout););
|
||||||
if (find_macros(n, fmls)) {
|
if (find_macros(n, fmls)) {
|
||||||
apply_macros(n, fmls, new_fmls);
|
apply_macros(n, fmls, new_fmls);
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -88,7 +88,7 @@ class asserted_formulas {
|
||||||
public:
|
public:
|
||||||
find_macros_fn(asserted_formulas& af): simplify_fmls(af, "find-macros") {}
|
find_macros_fn(asserted_formulas& af): simplify_fmls(af, "find-macros") {}
|
||||||
void operator()() override { af.find_macros_core(); }
|
void operator()() override { af.find_macros_core(); }
|
||||||
bool should_apply() const override { return af.m_smt_params.m_macro_finder && af.has_quantifiers(); }
|
bool should_apply() const override { return (af.m_smt_params.m_quasi_macros || af.m_smt_params.m_macro_finder) && af.has_quantifiers(); }
|
||||||
void simplify(justified_expr const& j, expr_ref& n, proof_ref& p) override { UNREACHABLE(); }
|
void simplify(justified_expr const& j, expr_ref& n, proof_ref& p) override { UNREACHABLE(); }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue