3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-06-28 08:58:44 +00:00

adding SMT2 log file for solver interaction #867

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2019-10-08 11:44:47 -07:00
parent b6c13340bd
commit f6f3ca1507
9 changed files with 159 additions and 28 deletions

View file

@ -38,32 +38,63 @@ void ast_pp_util::collect(expr_ref_vector const& es) {
void ast_pp_util::display_decls(std::ostream& out) {
ast_smt_pp pp(m);
coll.order_deps();
bool first = m_num_decls == 0;
coll.order_deps(m_num_sorts);
unsigned n = coll.get_num_sorts();
for (unsigned i = 0; i < n; ++i) {
for (unsigned i = m_num_sorts; i < n; ++i) {
pp.display_ast_smt2(out, coll.get_sorts()[i], 0, 0, nullptr);
}
m_num_sorts = n;
n = coll.get_num_decls();
for (unsigned i = 0; i < n; ++i) {
for (unsigned i = m_num_decls; i < n; ++i) {
func_decl* f = coll.get_func_decls()[i];
if (f->get_family_id() == null_family_id && !m_removed.contains(f)) {
ast_smt2_pp(out, f, m_env) << "\n";
}
}
vector<std::pair<func_decl*, expr*>> recfuns;
recfun::util u(m);
func_decl_ref_vector funs = u.get_rec_funs();
if (funs.empty()) return;
for (func_decl * f : funs) {
recfuns.push_back(std::make_pair(f, u.get_def(f).get_rhs()));
m_num_decls = n;
if (first) {
vector<std::pair<func_decl*, expr*>> recfuns;
recfun::util u(m);
func_decl_ref_vector funs = u.get_rec_funs();
if (funs.empty()) return;
for (func_decl * f : funs) {
recfuns.push_back(std::make_pair(f, u.get_def(f).get_rhs()));
}
ast_smt2_pp_recdefs(out, recfuns, m_env);
}
ast_smt2_pp_recdefs(out, recfuns, m_env);
}
void ast_pp_util::remove_decl(func_decl* f) {
m_removed.insert(f);
}
std::ostream& ast_pp_util::display_expr(std::ostream& out, expr* f, bool neat) {
if (neat) {
ast_smt2_pp(out, f, m_env);
}
else {
ast_smt_pp ll_smt2_pp(m);
ll_smt2_pp.display_expr_smt2(out, f);
}
return out;
}
void ast_pp_util::display_assert(std::ostream& out, expr* f, bool neat) {
display_expr(out << "(assert ", f, neat) << ")\n";
}
void ast_pp_util::display_assert_and_track(std::ostream& out, expr* f, expr* t, bool neat) {
if (neat) {
ast_smt2_pp(out << "(assert (=> ", t, m_env) << " ";
ast_smt2_pp(out, f, m_env) << "))\n";
}
else {
ast_smt_pp ll_smt2_pp(m);
ll_smt2_pp.display_expr_smt2(out << "(assert (=> ", t); out << " ";
ll_smt2_pp.display_expr_smt2(out, f); out << "))\n";
}
}
void ast_pp_util::display_asserts(std::ostream& out, expr_ref_vector const& fmls, bool neat) {
if (neat) {