std::string sym_mux::pp_model(const model_core & mdl) const { decl_vector consts; unsigned sz = mdl.get_num_constants(); for (unsigned i = 0; i < sz; i++) { func_decl * d = mdl.get_constant(i); consts.push_back(d); } std::sort(consts.begin(), consts.end(), decl_idx_comparator(*this)); std::stringstream res; decl_vector::iterator end = consts.end(); for (decl_vector::iterator it = consts.begin(); it != end; it++) { func_decl * d = *it; std::string name = d->get_name().str(); const char * arrow = " -> "; res << name << arrow; unsigned indent = static_cast<unsigned>(name.length() + strlen(arrow)); res << mk_pp(mdl.get_const_interp(d), m, indent) << "\n"; if (it + 1 != end) { unsigned idx1, idx2; if (!try_get_index(*it, idx1)) { idx1 = UINT_MAX; } if (!try_get_index(*(it + 1), idx2)) { idx2 = UINT_MAX; } if (idx1 != idx2) { res << "\n"; } } } return res.str(); }
static void display_constants(std::ostream & out, model_core const & md) { ast_manager & m = md.get_manager(); unsigned sz = md.get_num_constants(); for (unsigned i = 0; i < sz; i++) { func_decl * c = md.get_constant(i); char const * d = "(define "; std::string n = c->get_name().str(); unsigned indent = static_cast<unsigned>(n.length() + strlen(d) + 1); out << d << n << " " << mk_ismt2_pp(md.get_const_interp(c), m, indent) << ")\n"; } }
static void display_constants(std::ostream & out, model_core const & md) { ast_manager & m = md.get_manager(); unsigned sz = md.get_num_constants(); for (unsigned i = 0; i < sz; i++) { func_decl * d = md.get_constant(i); std::string name = d->get_name().str(); const char * arrow = " -> "; out << name << arrow; unsigned indent = static_cast<unsigned>(name.length() + strlen(arrow)); out << mk_pp(md.get_const_interp(d), m, indent) << "\n"; } }
static void pp_consts(std::ostream & out, ast_printer_context & ctx, model_core const & md, unsigned indent) { unsigned num = md.get_num_constants(); for (unsigned i = 0; i < num; i++) { func_decl * c = md.get_constant(i); expr * c_i = md.get_const_interp(c); pp_indent(out, indent); out << "(define-fun "; unsigned len = pp_symbol(out, c->get_name()); out << " () "; ctx.display(out, c->get_range(), indent + len + 16); out << "\n"; pp_indent(out, indent + TAB_SZ); ctx.display(out, c_i); out << ")\n"; } }