void formula_compiler::compile_formulas(assertion_set const & assertions) { ast_manager & m = assertions.m(); expr_fast_mark2 axioms; mark_axioms(assertions, axioms); unmark_nested_atoms(assertions, axioms); ptr_vector<expr> formulas; // send axioms to theories, and save formulas to compile unsigned sz = assertions.size(); for (unsigned i = 0; i < sz; i++) { expr * f = assertions.form(i); bool neg = false; while (m.is_not(f, f)) neg = !neg; if (axioms.is_marked(f)) { assert_axiom(f, neg); } else { formulas.push_back(f); } } // compile formulas into sat::solver m_to_sat(m, formulas.size(), formulas.c_ptr(), s.m_params, *(s.m_sat), s.m_atom2bvar); // register atoms nested in the boolean structure in the theories atom2bool_var::recent_iterator it = s.m_atom2bvar.begin_recent(); atom2bool_var::recent_iterator end = s.m_atom2bvar.end_recent(); for (; it != end; ++it) { expr * atom = *it; register_atom(atom, s.m_atom2bvar.to_bool_var(atom)); } s.m_atom2bvar.reset_recent(); }
/** \brief Assert an assertion set s (owned by the external manager) */ void solver_exp::assert_set(assertion_set const & s) { SASSERT(&(s.m()) == &m_ext_mng); ast_translation translator(m_ext_mng, m, false); unsigned sz = s.size(); for (unsigned i = 0; i < sz; i++) { assert_expr_core(s.form(i), translator); } }
/** \brief Unmark atoms that occur in the boolean structure. */ void formula_compiler::unmark_nested_atoms(assertion_set const & s, expr_fast_mark2 & axioms) { ast_manager & m = s.m(); expr_fast_mark1 visited; unmark_axioms_proc proc(axioms); unsigned sz = s.size(); for (unsigned i = 0; i < sz; i++) { expr * f = s.form(i); while (m.is_not(f, f)); if (axioms.is_marked(f)) continue; quick_for_each_expr(proc, visited, f); } }
void operator()(assertion_set & s, model_converter_ref & mc) { mc = 0; if (s.inconsistent()) return; as_st_report report("add-bounds", s); bound_manager bm(m); expr_fast_mark1 visited; add_bound_proc proc(bm, s, m_lower, m_upper); unsigned sz = s.size(); for (unsigned i = 0; i < sz; i++) quick_for_each_expr(proc, visited, s.form(i)); visited.reset(); report_st_progress(":added-bounds", proc.m_num_bounds); TRACE("add_bounds", s.display(tout););
void operator()(assertion_set & s, model_converter_ref & mc) { mc = 0; if (s.inconsistent()) return; { as_st_report report("elim-term-ite", s); m_rw.m_cfg.m_num_fresh = 0; m_rw.m_cfg.m_set = &s; expr_ref new_curr(m); proof_ref new_pr(m); unsigned size = s.size(); for (unsigned idx = 0; idx < size; idx++) { expr * curr = s.form(idx); m_rw(curr, new_curr, new_pr); if (m.proofs_enabled()) { proof * pr = s.pr(idx); new_pr = m.mk_modus_ponens(pr, new_pr); } s.update(idx, new_curr, new_pr); } mc = m_rw.m_cfg.m_mc.get(); } report_st_progress(":elim-term-ite-consts", m_rw.m_cfg.m_num_fresh); }