static void get_keys(M const & m, ptr_buffer<char> & keys) { typename M::iterator it = m.begin(); typename M::iterator end = m.end(); for (; it != end; ++it) { keys.push_back(const_cast<char*>(it->m_key)); } }
/** \brief Traverse args, and copy the non-numeral exprs to result, and accumulate the value of the numerals in k. */ void poly_simplifier_plugin::process_monomial(unsigned num_args, expr * const * args, numeral & k, ptr_buffer<expr> & result) { rational v; for (unsigned i = 0; i < num_args; i++) { expr * arg = args[i]; if (is_numeral(arg, v)) k *= v; else result.push_back(arg); } }
void sort_fun_decls(ast_manager & m, model_core const & md, ptr_buffer<func_decl> & result) { func_decl_set visited; ptr_vector<func_decl> todo; unsigned sz = md.get_num_functions(); for (unsigned i = 0; i < sz; i++) { func_decl * f = md.get_function(i); if (visited.contains(f)) continue; visited.insert(f); todo.push_back(f); while (!todo.empty()) { func_decl * curr = todo.back(); func_interp * curr_i = md.get_func_interp(curr); SASSERT(curr_i != 0); if (!curr_i->is_partial()) { func_decl_set deps; bool all_visited = true; collect_func_decls(m, curr_i->get_else(), deps); func_decl_set::iterator it2 = deps.begin(); func_decl_set::iterator end2 = deps.end(); for (; it2 != end2; ++it2) { func_decl * d = *it2; if (d->get_arity() > 0 && md.has_interpretation(d) && !visited.contains(d)) { todo.push_back(d); visited.insert(d); all_visited = false; } } if (!all_visited) continue; } todo.pop_back(); result.push_back(curr); } } }