Esempio n. 1
0
    bool sieve_relation_plugin::can_handle_signature(const relation_signature & s) {
        //we do not want this plugin to handle anything by default
        return false;
#if 0
        relation_signature inner_sig;
        extract_inner_signature(s, inner_sig);
        SASSERT(inner_sig.size()<=s.size());
        return !inner_sig.empty() && inner_sig.size()!=s.size();
#endif
    }
Esempio n. 2
0
 void sieve_relation_plugin::collect_inner_signature(const relation_signature & s, 
         const svector<bool> & inner_columns, relation_signature & inner_sig) {
     SASSERT(inner_columns.size()==s.size());
     inner_sig.reset();
     unsigned n = s.size();
     for(unsigned i=0; i<n; i++) {
         if(inner_columns[i]) {
             inner_sig.push_back(s[i]);
         }
     }
 }
Esempio n. 3
0
 bool udoc_plugin::can_handle_signature(const relation_signature & sig) {
     for (unsigned i = 0; i < sig.size(); ++i) {
         if (!is_finite_sort(sig[i]))
             return false;
     }
     return true;
 }
Esempio n. 4
0
 unsigned udoc_plugin::num_signature_bits(relation_signature const& sig) { 
     unsigned result = 0;
     for (unsigned i = 0; i < sig.size(); ++i) {
         result += num_sort_bits(sig[i]);
     }
     return result;
 }
Esempio n. 5
0
    relation_mutator_fn * sieve_relation_plugin::mk_filter_interpreted_fn(const relation_base & rb, 
            app * condition) {
        if(&rb.get_plugin()!=this) {
            return 0;
        }
        ast_manager & m = get_ast_manager();
        const sieve_relation & r = static_cast<const sieve_relation &>(rb);
        const relation_signature sig = r.get_signature();
        unsigned sz = sig.size();

        var_idx_set& cond_vars = get_context().get_rule_manager().collect_vars(condition);
        expr_ref_vector subst_vect(m);
        subst_vect.resize(sz);
        unsigned subst_ofs = sz-1;
        for(unsigned i=0; i<sz; i++) {
            if(!cond_vars.contains(i)) {
                continue;
            }
            if(!r.is_inner_col(i)) {
                //If the condition involves columns which do not belong to the inner relation, 
                //we do nothing (which introduces imprecision).
                //Maybe we might try to do some quantifier elimination...
                return alloc(identity_relation_mutator_fn);
            }
            subst_vect[subst_ofs-i] = m.mk_var(r.m_sig2inner[i], sig[i]);
        }
        expr_ref inner_cond(m);
        get_context().get_var_subst()(condition, subst_vect.size(), subst_vect.c_ptr(), inner_cond);

        relation_mutator_fn * inner_fun = get_manager().mk_filter_interpreted_fn(r.get_inner(), to_app(inner_cond));
        if(!inner_fun) {
            return 0;
        }
        return alloc(filter_fn, inner_fun);
    }
Esempio n. 6
0
 bool interval_relation_plugin::can_handle_signature(const relation_signature & sig) {
     for (unsigned i = 0; i < sig.size(); ++i) {
         if (!m_arith.is_int(sig[i]) && !m_arith.is_real(sig[i])) {
             return false;
         }
     }
     return true;
 }
Esempio n. 7
0
    void sieve_relation_plugin::extract_inner_signature(const relation_signature & s, 
            relation_signature & inner_sig) {
        UNREACHABLE();
#if 0
        svector<bool> inner_cols(s.size());
        extract_inner_columns(s, inner_cols.c_ptr());
        collect_inner_signature(s, inner_cols, inner_sig);
#endif
    }
Esempio n. 8
0
    void sieve_relation_plugin::extract_inner_columns(const relation_signature & s, relation_plugin & inner, 
            svector<bool> & inner_columns) {
        SASSERT(inner_columns.size()==s.size());
        unsigned n = s.size();
        relation_signature inner_sig_singleton;
        for(unsigned i=0; i<n; i++) {
            inner_sig_singleton.reset();
            inner_sig_singleton.push_back(s[i]);
            inner_columns[i] = inner.can_handle_signature(inner_sig_singleton);
        }
#if Z3DEBUG 
        //we assume that if a relation plugin can handle two sets of columns separetely, 
        //it can also handle them in one relation
        relation_signature inner_sig;
        collect_inner_signature(s, inner_columns, inner_sig);
        SASSERT(inner.can_handle_signature(inner_sig));
#endif
    }
Esempio n. 9
0
    sieve_relation::sieve_relation(sieve_relation_plugin & p, const relation_signature & s,
                const bool * inner_columns, relation_base * inner) 
            : relation_base(p, s), m_inner_cols(s.size(), inner_columns), m_inner(inner) { 
        unsigned n = s.size();
        for(unsigned i=0; i<n; i++) {
            if(inner_columns && inner_columns[i]) {
                unsigned inner_idx = m_inner2sig.size();
                SASSERT(get_inner().get_signature()[inner_idx]==s[i]);
                m_sig2inner.push_back(inner_idx);
                m_inner2sig.push_back(i);
            }
            else {
                m_sig2inner.push_back(UINT_MAX);
                m_ignored_cols.push_back(i);
            }
        }

        set_kind(p.get_relation_kind(*this, inner_columns));
    }
Esempio n. 10
0
        rename_fn(external_relation_plugin& p, sort* relation_sort, const relation_signature & orig_sig, unsigned cycle_len, const unsigned * cycle) 
            : convenient_relation_rename_fn(orig_sig, cycle_len, cycle),
              m_plugin(p),
              m_rename_fn(p.get_ast_manager()) {

            ast_manager& m = p.get_ast_manager();
            family_id fid  = p.get_family_id();
            vector<parameter> params;
            for (unsigned i = 0; i < cycle_len; ++i) {
                SASSERT(cycle[i] < orig_sig.size());
                params.push_back(parameter(cycle[i]));
            }
            m_rename_fn = m.mk_func_decl(fid, OP_RA_RENAME, params.size(), params.c_ptr(), 1, &relation_sort);
        }
Esempio n. 11
0
 transformer_fn(relation_transformer_fn * inner_fun, const relation_signature & result_sig, 
             const bool * result_inner_cols)
         : m_result_inner_cols(result_sig.size(), result_inner_cols), m_inner_fun(inner_fun) {
     get_result_signature() = result_sig;
 }
Esempio n. 12
0
 family_id sieve_relation_plugin::get_relation_kind(const relation_signature & sig, 
         const bool * inner_columns, family_id inner_kind) {
     rel_spec spec(sig.size(), inner_columns, inner_kind);
     return m_spec_store.get_relation_kind(sig, spec);
 }