static void display_decls_info(std::ostream & out, model_ref & md) { ast_manager & m = md->get_manager(); unsigned sz = md->get_num_decls(); for (unsigned i = 0; i < sz; i++) { func_decl * d = md->get_decl(i); out << d->get_name(); out << " ("; for (unsigned j = 0; j < d->get_arity(); j++) out << mk_pp(d->get_domain(j), m); out << mk_pp(d->get_range(), m); out << ") "; if (d->get_info()) out << *(d->get_info()); out << " :id " << d->get_id() << "\n"; } }
virtual void operator()(model_ref & old_model) { model_ref new_model = alloc(model, m); for (unsigned i = 0; i < m_new_funcs.size(); ++i) { func_decl* p = m_new_funcs[i].get(); func_decl* q = m_old_funcs[i].get(); expr_ref_vector const& sub = m_subst[i]; sort_ref_vector const& sorts = m_sorts[i]; svector<bool> const& is_bound = m_bound[i]; func_interp* f = old_model->get_func_interp(p); expr_ref body(m); unsigned arity_q = q->get_arity(); SASSERT(0 < p->get_arity()); func_interp* g = alloc(func_interp, m, arity_q); if (f) { body = f->get_interp(); SASSERT(!f->is_partial()); SASSERT(body); } else { body = m.mk_false(); } // Create quantifier wrapper around body. TRACE("dl", tout << mk_pp(body, m) << "\n";); // 1. replace variables by the compound terms from // the original predicate. expr_safe_replace rep(m); for (unsigned i = 0; i < sub.size(); ++i) { rep.insert(m.mk_var(i, m.get_sort(sub[i])), sub[i]); } rep(body); rep.reset(); TRACE("dl", tout << mk_pp(body, m) << "\n";);
void make_model(model_ref& destination) { { for (unsigned i = 0; i < m_abstr_model->get_num_uninterpreted_sorts(); i++) { sort * const s = m_abstr_model->get_uninterpreted_sort(i); ptr_vector<expr> u = m_abstr_model->get_universe(s); destination->register_usort(s, u.size(), u.c_ptr()); } } for (unsigned i = 0; i < m_abstr_model->get_num_functions(); i++) { func_decl * const fd = m_abstr_model->get_function(i); func_interp * const fi = m_abstr_model->get_func_interp(fd); destination->register_decl(fd, fi); } { const app2val_t::iterator e = m_app2val.end(); app2val_t::iterator i = m_app2val.end(); for (; i != e; ++i) { app * a = i->m_key; if (a->get_num_args()) continue; destination->register_decl(a->get_decl(), i->m_value); } } obj_map<func_decl, func_interp*> interpretations; { const values2val_t::iterator e = m_values2val.end(); values2val_t::iterator i = m_values2val.end(); for (; i != e; ++i) add_entry(i->m_key, i->m_value.value, interpretations); } { obj_map<func_decl, func_interp*>::iterator ie = interpretations.end(); obj_map<func_decl, func_interp*>::iterator ii = interpretations.begin(); for (; ii != ie; ++ii) { func_decl* const fd = ii->m_key; func_interp* const fi = ii->get_value(); fi->set_else(m_m.get_some_value(fd->get_range())); destination->register_decl(fd, fi); } } }
virtual void operator()(model_ref & mdl, unsigned goal_idx) { SASSERT(goal_idx == 0); for (unsigned i = 0; i < m_const.size(); ++i) { mdl->register_decl(m_const[i].first->get_decl(), m_const[i].second); } }