From b76ed6a47fc00d184fbceb518eeb5b18ea8ae93d Mon Sep 17 00:00:00 2001 From: Nikolaj Bjorner Date: Sun, 4 Dec 2022 10:19:39 -0800 Subject: [PATCH] proper fix to #6476 --- src/ast/simplifiers/demodulator_simplifier.cpp | 6 +++--- src/ast/substitution/demodulator_rewriter.cpp | 7 ++----- src/ast/substitution/demodulator_rewriter.h | 3 --- 3 files changed, 5 insertions(+), 11 deletions(-) diff --git a/src/ast/simplifiers/demodulator_simplifier.cpp b/src/ast/simplifiers/demodulator_simplifier.cpp index eb3585606..d7650717e 100644 --- a/src/ast/simplifiers/demodulator_simplifier.cpp +++ b/src/ast/simplifiers/demodulator_simplifier.cpp @@ -104,7 +104,7 @@ bool demodulator_simplifier::rewrite1(func_decl* f, expr_ref_vector const& args, if (!m_index.find_fwd(f, set)) return false; - TRACE("demodulator", tout << "trying to rewrite: " << f->get_name() << " args:\n" << m_new_args << "\n";); + TRACE("demodulator", tout << "trying to rewrite: " << f->get_name() << " args:\n" << args << "\n";); for (unsigned i : *set) { @@ -115,7 +115,7 @@ bool demodulator_simplifier::rewrite1(func_decl* f, expr_ref_vector const& args, SASSERT(lhs->get_decl() == f); - TRACE("demodulator", tout << "Matching with demodulator: " << mk_pp(d, m) << std::endl; ); + TRACE("demodulator", tout << "Matching with demodulator: " << mk_pp(lhs, m) << std::endl; ); if (m_match_subst(lhs, rhs, args.data(), np)) { TRACE("demodulator_bug", tout << "succeeded...\n" << mk_pp(rhs, m) << "\n===>\n" << np << "\n";); @@ -154,7 +154,7 @@ void demodulator_simplifier::reschedule_demodulators(func_decl* f, expr* lhs) { continue; if (!m_match_subst.can_rewrite(fml(i), lhs)) continue; - func_decl* f = p.first->get_decl(); + SASSERT(f == p.first->get_decl()); m_index.remove_fwd(f, i); m_index.remove_bwd(fml(i), i); m_todo.push_back(i); diff --git a/src/ast/substitution/demodulator_rewriter.cpp b/src/ast/substitution/demodulator_rewriter.cpp index 0b37308c9..7b06234dc 100644 --- a/src/ast/substitution/demodulator_rewriter.cpp +++ b/src/ast/substitution/demodulator_rewriter.cpp @@ -847,12 +847,9 @@ struct match_args_aux_proc { SASSERT(r.get_offset() == 1); throw no_match(); } - else { - m_subst.insert(n, 0, expr_offset(n, 1)); - } } - else - throw no_match(); + else + m_subst.insert(n, 0, expr_offset(n, 1)); } void operator()(quantifier * n) { throw no_match(); } void operator()(app * n) {} diff --git a/src/ast/substitution/demodulator_rewriter.h b/src/ast/substitution/demodulator_rewriter.h index 18befc198..3a1e442d5 100644 --- a/src/ast/substitution/demodulator_rewriter.h +++ b/src/ast/substitution/demodulator_rewriter.h @@ -111,8 +111,6 @@ class demodulator_match_subst { typedef std::pair expr_pair; typedef obj_pair_hashtable cache; - void reset(); - ast_manager & m; substitution m_subst; cache m_cache; @@ -229,7 +227,6 @@ class demodulator_rewriter final { void remove_bwd_idx(expr* q); bool check_fwd_idx_consistency(); void show_fwd_idx(std::ostream & out); - bool can_rewrite(expr * n, expr * lhs); expr * rewrite(expr * n); bool rewrite1(func_decl * f, expr_ref_vector const & args, expr_ref & np);