Skip to content

Commit

Permalink
fixes to mbqi in the new core based on #6575
Browse files Browse the repository at this point in the history
  • Loading branch information
NikolajBjorner committed Feb 11, 2023
1 parent d52e893 commit 1b0c76e
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 21 deletions.
2 changes: 1 addition & 1 deletion src/ast/ast.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<expr> args;
args.append(n, (expr**) ps);
return mk_app(basic_family_id, PR_CLAUSE_TRAIL, 0, nullptr, args.size(), args.data());
Expand Down
2 changes: 1 addition & 1 deletion src/ast/ast.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
6 changes: 3 additions & 3 deletions src/ast/ast_pp_util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
19 changes: 12 additions & 7 deletions src/ast/decl_collector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -43,18 +43,18 @@ 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) {
func_decl* g;

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());
Expand All @@ -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();
Expand All @@ -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();
Expand Down
6 changes: 3 additions & 3 deletions src/ast/decl_collector.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Revision History:
#include "ast/array_decl_plugin.h"

class decl_collector {
ast_manager & m_manager;
ast_manager & m;
lim_svector<sort*> m_sorts;
lim_svector<func_decl*> m_decls;
lim_svector<func_decl*> m_rec_decls;
Expand All @@ -48,10 +48,10 @@ class decl_collector {
void collect_deps(top_sort<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);
Expand Down
3 changes: 1 addition & 2 deletions src/sat/smt/q_mbi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion src/smt/smt_clause_proof.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 4 additions & 2 deletions src/solver/check_sat_result.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/solver/check_sat_result.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 1b0c76e

Please sign in to comment.