Exemplo n.º 1
0
 void finalize(pdecl_manager & m) {
     if (m_num_params == 0) {
         SASSERT(m_map.empty());
         if (m_const)
             m.m().dec_ref(m_const);
         m_const = 0;
     }
     else {
         SASSERT(m_const == 0);
         obj_map<sort, void *>::iterator it  = m_map.begin();
         obj_map<sort, void *>::iterator end = m_map.end();
         for (; it != end; ++it) {
             m.m().dec_ref((*it).m_key);
             if (m_num_params == 1) {
                 m.m().dec_ref(static_cast<sort*>((*it).m_value));
             }
             else {
                 psort_inst_cache * child = static_cast<psort_inst_cache*>((*it).m_value);
                 child->finalize(m);
                 child->~psort_inst_cache();
                 m.a().deallocate(sizeof(psort_inst_cache), child);
             }
         }
         m_map.reset();
     }
 }
Exemplo n.º 2
0
 void finalize(pdecl_manager & m) {
     if (m_num_params == 0) {
         SASSERT(m_map.empty());
         if (m_const)
             m.m().dec_ref(m_const);
         m_const = nullptr;
     }
     else {
         SASSERT(m_const == 0);
         for (auto kv : m_map) {
             m.m().dec_ref(kv.m_key);
             if (m_num_params == 1) {
                 m.m().dec_ref(static_cast<sort*>(kv.m_value));
             }
             else {
                 psort_inst_cache * child = static_cast<psort_inst_cache*>(kv.m_value);
                 child->finalize(m);
                 child->~psort_inst_cache();
                 m.a().deallocate(sizeof(psort_inst_cache), child);
             }
         }
         m_map.reset();
     }
 }
Exemplo n.º 3
0
 ~psort_inst_cache() { SASSERT(m_map.empty()); SASSERT(m_const == 0); }
Exemplo n.º 4
0
 bool empty() const { return m_num_params == 0 ? m_const == 0 : m_map.empty(); }
Exemplo n.º 5
0
    virtual void operator()(
        goal_ref const & g, 
        goal_ref_buffer & result, 
        model_converter_ref & mc, 
        proof_converter_ref & pc,
        expr_dependency_ref & core) {
        SASSERT(g->is_well_sorted());
        mc = 0; pc = 0; core = 0;
        m_trail.reset();
        m_fd.reset();
        m_max.reset();
        m_nonfd.reset();
        m_bounds.reset();
        ref<bvmc> mc1 = alloc(bvmc);

        tactic_report report("eq2bv", *g);

        m_bounds(*g);

        for (unsigned i = 0; i < g->size(); i++) {            
            collect_fd(g->form(i));
        }
        cleanup_fd(mc1);
        
        if (m_max.empty()) {
            result.push_back(g.get());
            return;
        }

        for (unsigned i = 0; i < g->size(); i++) {            
            expr_ref   new_curr(m);
            proof_ref  new_pr(m);  
            if (is_bound(g->form(i))) {
                g->update(i, m.mk_true(), 0, 0);
                continue;
            }
            m_rw(g->form(i), new_curr, new_pr);
            if (m.proofs_enabled() && !new_pr) {
                new_pr = m.mk_rewrite(g->form(i), new_curr);
                new_pr = m.mk_modus_ponens(g->pr(i), new_pr);
            }
            g->update(i, new_curr, new_pr, g->dep(i));
        }
        obj_map<expr, unsigned>::iterator it = m_max.begin(), end = m_max.end();
        for (; it != end; ++it) {
            expr* c = it->m_key;
            bool strict;
            rational r;
            if (m_bounds.has_lower(c, r, strict)) {
                SASSERT(!strict);
                expr* d = m_fd.find(c);
                g->assert_expr(bv.mk_ule(bv.mk_numeral(r, m.get_sort(d)), d), m_bounds.lower_dep(c));
            }
            if (m_bounds.has_upper(c, r, strict)) {
                SASSERT(!strict);
                expr* d = m_fd.find(c);
                g->assert_expr(bv.mk_ule(d, bv.mk_numeral(r, m.get_sort(d))), m_bounds.upper_dep(c));
            }
        }        
        g->inc_depth();
        mc = mc1.get();
        result.push_back(g.get());
        TRACE("pb", g->display(tout););