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();
    }
Esempio n. 2
0
bool is_unbounded(assertion_set const & s) {
    ast_manager & m = s.m();
    bound_manager bm(m);
    bm(s);
    is_unbounded_proc proc(bm);
    return test(s, proc);
}
Esempio n. 3
0
 /**
    \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);
     }
 }
Esempio n. 4
0
 /**
    \brief Store in r the current set of assertions.
    r is (owned) by the external assertion set
 */
 void solver_exp::get_assertions(assertion_set & r) {
     SASSERT(&(r.m()) == &m_ext_mng);
     ast_translation translator(m, m_ext_mng, false);
     unsigned sz = m_assertions.size();
     for (unsigned i = 0; i < sz; i++) {
         expr * f = m_assertions.form(i);
         r.assert_expr(translator(f));
     }
 }
 /**
    \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);
     }
 }