virtual void operator()(/* in */  goal_ref const & in, 
                         /* out */ goal_ref_buffer & result, 
                         /* out */ model_converter_ref & mc, 
                         /* out */ proof_converter_ref & pc,
                         /* out */ expr_dependency_ref & core) {        
     reduce_core(in, result);
 }
Пример #2
0
/**
   \brief External interface for the simplifier. 
   A client will invoke operator()(s, r, p) to simplify s.
   The result is stored in r.
   When proof generation is enabled, a proof for the equivalence (or equisatisfiability)
   of s and r is stored in p.
   When proof generation is disabled, this method stores the "undefined proof" object in p.
*/
void simplifier::operator()(expr * s, expr_ref & r, proof_ref & p) {
    m_need_reset = true;
    reinitialize();
    expr  * s_orig = s;
    expr  * old_s;
    expr  * result;
    proof * result_proof;
    switch (m.proof_mode()) {
    case PGM_DISABLED: // proof generation is disabled.
        reduce_core(s); 
        // after executing reduce_core, the result of the simplification is in the cache
        get_cached(s, result, result_proof);
        r = result;
        p = m.mk_undef_proof();
        break;
    case PGM_COARSE: // coarse proofs... in this case, we do not produce a step by step (fine grain) proof to show the equivalence (or equisatisfiability) of s an r.
        m_subst_proofs.reset(); // m_subst_proofs is an auxiliary vector that is used to justify substitutions. See comment on method get_subst. 
        reduce_core(s);
        get_cached(s, result, result_proof);
        r = result;
        if (result == s)
            p = m.mk_reflexivity(s);
        else {
            remove_duplicates(m_subst_proofs);
            p = m.mk_rewrite_star(s, result, m_subst_proofs.size(), m_subst_proofs.c_ptr());
        }
        break;
    case PGM_FINE: // fine grain proofs... in this mode, every proof step (or most of them) is described.
        m_proofs.reset();
        old_s = 0;
        // keep simplyfing until no further simplifications are possible.
        while (s != old_s) {
            TRACE("simplifier", tout << "simplification pass... " << s->get_id() << "\n";);
            TRACE("simplifier_loop", tout << mk_ll_pp(s, m) << "\n";);
            reduce_core(s);
            get_cached(s, result, result_proof);
            SASSERT(is_rewrite_proof(s, result, result_proof));
            if (result_proof != 0) {
                m_proofs.push_back(result_proof);
            }
            old_s = s;
            s     = result;
        }