void model_evaluator_array_util::eval_exprs(model& mdl, expr_ref_vector& es) { for (unsigned j = 0; j < es.size(); ++j) { if (m_array.is_as_array(es.get (j))) { expr_ref r (m); eval(mdl, es.get (j), r); es.set (j, r); } } }
void display(std::ostream & out, expr_ref_vector & r, bool ll=true) { ast_mark v; for (unsigned i = 0; i < r.size(); i++) { if (ll) ast_ll_pp(out, r.get_manager(), r.get(i), v); else out << mk_pp(r.get(i), r.get_manager()); out << "\n"; } }
bool itp_solver::mk_proxies (expr_ref_vector &v, unsigned from) { bool dirty = false; for (unsigned i = from, sz = v.size(); i < sz; ++i) { app *p = mk_proxy (v.get (i)); dirty |= (v.get (i) != p); v[i] = p; } return dirty; }
void itp_solver::undo_proxies (expr_ref_vector &r) { app_ref e(m); // expand proxies for (unsigned i = 0, sz = r.size (); i < sz; ++i) if (is_proxy(r.get(i), e)) { SASSERT (m.is_or (e)); r[i] = e->get_arg (1); } }
/** Factors input vector v into equivalence classes and the rest */ void factor_eqs(expr_ref_vector &v, expr_equiv_class &equiv) { ast_manager &m = v.get_manager(); arith_util arith(m); expr *e1 = 0, *e2 = 0; flatten_and(v); unsigned j = 0; for (unsigned i = 0; i < v.size(); ++i) { if (m.is_eq(v.get(i), e1, e2)) { if (arith.is_zero(e1)) { std::swap(e1, e2); } // y + -1*x == 0 expr* a0 = 0, *a1 = 0, *x = 0; if (arith.is_zero(e2) && arith.is_add(e1, a0, a1)) { if (arith.is_times_minus_one(a1, x)) { e1 = a0; e2 = x; } else if (arith.is_times_minus_one(a0, x)) { e1 = a1; e2 = x; } } equiv.merge(e1, e2); } else { if (j < i) { v[j] = v.get(i); } j++; } } v.shrink(j); }
lbool tactic2solver::check_sat_core(unsigned num_assumptions, expr * const * assumptions) { if (m_tactic.get() == 0) return l_false; ast_manager & m = m_assertions.m(); m_result = alloc(simple_check_sat_result, m); m_tactic->cleanup(); m_tactic->updt_params(m_params); m_tactic->set_logic(m_logic); goal_ref g = alloc(goal, m, m_produce_proofs, m_produce_models, m_produce_unsat_cores); unsigned sz = m_assertions.size(); for (unsigned i = 0; i < sz; i++) { g->assert_expr(m_assertions.get(i)); } for (unsigned i = 0; i < num_assumptions; i++) { g->assert_expr(assumptions[i], m.mk_asserted(assumptions[i]), m.mk_leaf(assumptions[i])); } model_ref md; proof_ref pr(m); expr_dependency_ref core(m); std::string reason_unknown = "unknown"; try { switch (::check_sat(*m_tactic, g, md, pr, core, reason_unknown)) { case l_true: m_result->set_status(l_true); break; case l_false: m_result->set_status(l_false); break; default: m_result->set_status(l_undef); if (reason_unknown != "") m_result->m_unknown = reason_unknown; break; } } catch (z3_error & ex) { throw ex; } catch (z3_exception & ex) { TRACE("tactic2solver", tout << "exception: " << ex.msg() << "\n";); m_result->set_status(l_undef); m_result->m_unknown = ex.msg(); }
func_decl * get_name_decl(unsigned i) const { return to_app(m_names.get(i))->get_decl(); }
bool contains_unsupported(expr_ref_vector & b2a, expr_ref_vector & x2t) { for (unsigned x = 0; x < x2t.size(); x++) { if (!is_uninterp_const(x2t.get(x))) { TRACE("unsupported", tout << "unsupported atom:\n" << mk_ismt2_pp(x2t.get(x), m) << "\n";); return true; }