Пример #1
0
bool uses_theory(expr * n, family_id fid, expr_mark & visited) {
    uses_theory_ns::proc p(fid);
    try {
        for_each_expr(p, visited, n);
    }
    catch (uses_theory_ns::found) {
        return true;
    }
    return false;
}
Пример #2
0
bool has_skolem_functions(expr * n) {
    has_skolem_functions_ns::proc p;
    try {
        for_each_expr(p, n);
    }
    catch (has_skolem_functions_ns::found) {
        return true;
    }
    return false;
}
bool array_property_recognizer::operator()(unsigned num_fmls, expr* const* fmls) {
    is_array_property_ns::proc p(m_manager);
    try {
        for (unsigned i = 0; i < num_fmls; ++i) {
            for_each_expr(p, fmls[i]);
        }
    }
    catch (is_array_property_ns::bad) {
        return false;
    }
    return p.has_quantifier();
}
Пример #4
0
 bool simplify(goal_ref const& g, pb_preproc_model_converter& mc) {
     reset();
     normalize(g);
     if (g->inconsistent()) {
         return false;
     }
     for (unsigned i = 0; i < g->size(); ++i) {
         process_vars(i, g);
     }
     
     if (m_ge.empty()) {
         return false;
     }
     
     for (unsigned i = 0; i < m_ge.size(); ++i) {
         classify_vars(i, to_app(g->form(m_ge[i])));
     }
     
     declassifier dcl(m_vars);
     expr_mark visited;        
     for (unsigned i = 0; !m_vars.empty() && i < m_other.size(); ++i) {
         for_each_expr(dcl, visited, g->form(m_other[i]));
     }
     
     if (m_vars.empty()) {
         return false;
     }
     
     // display_annotation(tout, g);
     m_progress = false;
     // first eliminate variables
     var_map::iterator it = next_resolvent(m_vars.begin()); 
     while (it != m_vars.end()) {            
         app * e = it->m_key;
         rec const& r = it->m_value;
         TRACE("pb", tout << mk_pp(e, m) << " " << r.pos.size() << " " << r.neg.size() << "\n";);
         if (r.pos.empty()) {                
             replace(r.neg, e, m.mk_false(), g);
             mc.set_value(e, false);
         }
         else if (r.neg.empty()) {
             replace(r.pos, e, m.mk_true(), g);
             mc.set_value(e, true);
         }
         if (g->inconsistent()) return false;
         ++it;
         it = next_resolvent(it);
     }        
void array_property_expander::operator()(unsigned num_fmls, expr* const* fmls, expr_ref_vector& result) {
    ast_manager& m = m_manager;
    unsigned offset = 0;
    for (unsigned i = 0; i < num_fmls; ++i) {
        bool change = false;
        expr_ref e(m);
        result.push_back(fmls[i]);
        do {
            array_property_exp::proc p(m, offset);
            e = result[i].get();
            for_each_expr(p, e);
            result[i] = p.find(e);
            change = e != result[i].get();
        }
        while (change);        
    }
}
Пример #6
0
bool pattern_validator::process(uint_set & found_vars, unsigned num_bindings, unsigned num_new_bindings, expr * n) {
    // I'm traversing the DAG as a tree, this is not a problem since pattern are supposed to be small ASTs.
    if (n->get_kind() == AST_VAR) {
        warning_msg("invalid pattern: variable.");
        return false;
    }

    pattern_validation_functor f(found_vars, num_bindings, num_new_bindings, m_bfid, m_lfid);
    for_each_expr(f, n);
    if (!f.m_result)
        return false;
    if (!f.m_found_a_var) {
        warning_msg("pattern does not contain any variable.");
        return false;
    }
    return true;
}
    void operator()(goal_ref const & g, goal_ref_buffer & result,
                    model_converter_ref & mc, proof_converter_ref & pc,
                    expr_dependency_ref & core) override {
        mc = nullptr;
        tactic_report report("collect-statistics", *g);

        collect_proc cp(m, m_stats);
        expr_mark visited;
        const unsigned sz = g->size();
        for (unsigned i = 0; i < sz; i++)
            for_each_expr(cp, visited, g->form(i));

        std::cout << "(" << std::endl;
        stats_type::iterator it = m_stats.begin();
        stats_type::iterator end = m_stats.end();
        for (; it != end; it++)
            std::cout << " :" << it->first << "    " << it->second << std::endl;
        std::cout << ")" << std::endl;

        g->inc_depth();
        result.push_back(g.get());
    }
Пример #8
0
unsigned get_num_exprs(expr * n, expr_mark & visited) {
    expr_counter_proc counter;
    for_each_expr(counter, visited, n);
    return counter.m_num;
}
Пример #9
0
 void apply(expr_ref& e) {
     for_each_expr(*this, e);
     e = get_expr(e);
 }
Пример #10
0
quantifier * find_quantifier(expr * n) {
    find_q::proc p;
    for_each_expr(p, n);
    return p.m_q;
}
void collect_func_decls(ast_manager & m, expr * n, func_decl_set & r, bool ng_only) {
    collect_dependencies_proc proc(m, r, ng_only);
    for_each_expr(proc, n);
}