diff --git a/src/ast/ast.cpp b/src/ast/ast.cpp index dee55cf98c4..0a34d3e12d8 100644 --- a/src/ast/ast.cpp +++ b/src/ast/ast.cpp @@ -3296,7 +3296,7 @@ proof * ast_manager::mk_redundant_del(expr* e) { return mk_clause_trail_elem(nullptr, e, PR_REDUNDANT_DEL); } -proof * ast_manager::mk_clause_trail(unsigned n, proof* const* ps) { +proof * ast_manager::mk_clause_trail(unsigned n, expr* const* ps) { ptr_buffer args; args.append(n, (expr**) ps); return mk_app(basic_family_id, PR_CLAUSE_TRAIL, 0, nullptr, args.size(), args.data()); diff --git a/src/ast/ast.h b/src/ast/ast.h index 2400e05a6e7..8fae83b26c6 100644 --- a/src/ast/ast.h +++ b/src/ast/ast.h @@ -2335,7 +2335,7 @@ class ast_manager { proof * mk_th_assumption_add(proof* pr, expr* e); proof * mk_th_lemma_add(proof* pr, expr* e); proof * mk_redundant_del(expr* e); - proof * mk_clause_trail(unsigned n, proof* const* ps); + proof * mk_clause_trail(unsigned n, expr* const* ps); proof * mk_def_axiom(expr * ax); proof * mk_unit_resolution(unsigned num_proofs, proof * const * proofs); diff --git a/src/ast/ast_pp_util.cpp b/src/ast/ast_pp_util.cpp index c0608522fbe..2b7e72a9192 100644 --- a/src/ast/ast_pp_util.cpp +++ b/src/ast/ast_pp_util.cpp @@ -43,11 +43,11 @@ void ast_pp_util::display_decls(std::ostream& out) { for (unsigned i = m_sorts; i < n; ++i) pp.display_sort_decl(out, coll.get_sorts()[i], seen); m_sorts = n; - + n = coll.get_num_decls(); for (unsigned i = m_decls; i < n; ++i) { func_decl* f = coll.get_func_decls()[i]; - if (f->get_family_id() == null_family_id && !m_removed.contains(f)) + if (coll.should_declare(f) && !m_removed.contains(f)) ast_smt2_pp(out, f, m_env) << "\n"; } m_decls = n; @@ -80,7 +80,7 @@ void ast_pp_util::display_skolem_decls(std::ostream& out) { unsigned n = coll.get_num_decls(); for (unsigned i = m_decls; i < n; ++i) { func_decl* f = coll.get_func_decls()[i]; - if (f->get_family_id() == null_family_id && !m_removed.contains(f) && f->is_skolem()) + if (coll.should_declare(f) && !m_removed.contains(f) && f->is_skolem()) ast_smt2_pp(out, f, m_env) << "\n"; } m_decls = n; diff --git a/src/ast/decl_collector.cpp b/src/ast/decl_collector.cpp index 7786a79d42c..5619f546b89 100644 --- a/src/ast/decl_collector.cpp +++ b/src/ast/decl_collector.cpp @@ -24,7 +24,7 @@ Revision History: void decl_collector::visit_sort(sort * n) { SASSERT(!m_visited.is_marked(n)); family_id fid = n->get_family_id(); - if (m().is_uninterp(n)) + if (m.is_uninterp(n)) m_sorts.push_back(n); else if (fid == m_dt_fid) { m_sorts.push_back(n); @@ -43,7 +43,7 @@ void decl_collector::visit_sort(sort * n) { } bool decl_collector::is_bool(sort * s) { - return m().is_bool(s); + return m.is_bool(s); } void decl_collector::visit_func(func_decl * n) { @@ -51,10 +51,10 @@ void decl_collector::visit_func(func_decl * n) { if (!m_visited.is_marked(n)) { family_id fid = n->get_family_id(); - if (fid == null_family_id) + if (should_declare(n)) m_decls.push_back(n); else if (fid == m_rec_fid) { - recfun::util u(m()); + recfun::util u(m); if (u.has_def(n)) { m_rec_decls.push_back(n); m_todo.push_back(u.get_def(n).get_rhs()); @@ -69,12 +69,17 @@ void decl_collector::visit_func(func_decl * n) { } } +bool decl_collector::should_declare(func_decl* f) const { + return f->get_family_id() == null_family_id || m.is_model_value(f); +} + + decl_collector::decl_collector(ast_manager & m): - m_manager(m), + m(m), m_trail(m), m_dt_util(m), m_ar_util(m) { - m_basic_fid = m_manager.get_basic_family_id(); + m_basic_fid = m.get_basic_family_id(); m_dt_fid = m_dt_util.get_family_id(); recfun::util rec_util(m); m_rec_fid = rec_util.get_family_id(); @@ -83,7 +88,7 @@ decl_collector::decl_collector(ast_manager & m): void decl_collector::visit(ast* n) { if (m_visited.is_marked(n)) return; - datatype_util util(m()); + datatype_util util(m); m_todo.push_back(n); while (!m_todo.empty()) { n = m_todo.back(); diff --git a/src/ast/decl_collector.h b/src/ast/decl_collector.h index 31cabe796ef..a7f79d008ab 100644 --- a/src/ast/decl_collector.h +++ b/src/ast/decl_collector.h @@ -26,7 +26,7 @@ Revision History: #include "ast/array_decl_plugin.h" class decl_collector { - ast_manager & m_manager; + ast_manager & m; lim_svector m_sorts; lim_svector m_decls; lim_svector m_rec_decls; @@ -48,10 +48,10 @@ class decl_collector { void collect_deps(top_sort& st); void collect_deps(sort* s, sort_set& set); - public: decl_collector(ast_manager & m); - ast_manager & m() { return m_manager; } + + bool should_declare(func_decl* f) const; void reset() { m_sorts.reset(); m_decls.reset(); m_visited.reset(); m_trail.reset(); } void visit_func(func_decl* n); diff --git a/src/sat/smt/q_mbi.cpp b/src/sat/smt/q_mbi.cpp index 21830c16200..21842ec7699 100644 --- a/src/sat/smt/q_mbi.cpp +++ b/src/sat/smt/q_mbi.cpp @@ -357,8 +357,7 @@ namespace q { return expr_ref(m); } else if (!(*p)(*m_model, vars, fmls)) { - TRACE("q", tout << "theory projection failed\n"); - return expr_ref(m); + TRACE("q", tout << "theory projection failed - use value\n"); } } for (app* v : vars) { diff --git a/src/smt/smt_clause_proof.cpp b/src/smt/smt_clause_proof.cpp index 521510b596c..3bb2a1fdfb3 100644 --- a/src/smt/smt_clause_proof.cpp +++ b/src/smt/smt_clause_proof.cpp @@ -233,7 +233,7 @@ namespace smt { TRACE("context", tout << "get-proof " << ctx.get_fparams().m_clause_proof << "\n";); if (!ctx.get_fparams().m_clause_proof) return proof_ref(m); - proof_ref_vector ps(m); + expr_ref_vector ps(m); for (auto& info : m_trail) { expr_ref fact = mk_or(info.m_clause); proof* pr = info.m_proof; diff --git a/src/solver/check_sat_result.cpp b/src/solver/check_sat_result.cpp index e946dd430e0..c0f3979aa3a 100644 --- a/src/solver/check_sat_result.cpp +++ b/src/solver/check_sat_result.cpp @@ -41,8 +41,10 @@ void check_sat_result::set_reason_unknown(event_handler& eh) { proof* check_sat_result::get_proof() { if (!m_log.empty() && !m_proof) { - app* last = m_log.back(); - m_log.push_back(to_app(m.get_fact(last))); + SASSERT(is_app(m_log.back())); + app* last = to_app(m_log.back()); + expr* fact = m.get_fact(last); + m_log.push_back(fact); m_proof = m.mk_clause_trail(m_log.size(), m_log.data()); } if (m_proof) diff --git a/src/solver/check_sat_result.h b/src/solver/check_sat_result.h index 936f6d3dfa3..2269a14449a 100644 --- a/src/solver/check_sat_result.h +++ b/src/solver/check_sat_result.h @@ -40,7 +40,7 @@ Module Name: class check_sat_result { protected: ast_manager& m; - proof_ref_vector m_log; + expr_ref_vector m_log; proof_ref m_proof; unsigned m_ref_count = 0; lbool m_status = l_undef;