コード例 #1
0
ファイル: model_v2_pp.cpp プロジェクト: Moondee/Artemis
static void display_function(std::ostream & out, model_core const & md, func_decl * f, bool partial) {
    ast_manager & m = md.get_manager();
    func_interp * g = md.get_func_interp(f);
    out << f->get_name() << " -> {\n";
    unsigned num_entries = g->num_entries();
    unsigned arity       = g->get_arity();
    char const * else_str = num_entries == 0 ? "  " : "  else -> ";
    unsigned else_indent  = static_cast<unsigned>(strlen(else_str));
    for (unsigned i = 0; i < num_entries; i++) {
        func_entry const * entry = g->get_entry(i);
        out << "  ";
        for (unsigned j = 0; j < arity; j++) {
            expr * arg = entry->get_arg(j);
            out << mk_pp(arg, m);
            out << " ";
        }
        out << "-> "; 
        out << mk_pp(entry->get_result(), m);
        out << "\n";
    }
    if (partial) {
        out << else_str << "#unspecified\n";
    }
    else {
        expr * else_val = g->get_else();
        out << else_str;
        if (else_val)
            out << mk_pp(else_val, m, else_indent);
        else
            out << "#unspecified";
        out << "\n";
    }
    out << "}\n";
}
コード例 #2
0
ファイル: model_pp.cpp プロジェクト: Moondee/Artemis
static void display_constants(std::ostream & out, model_core const & md) {
    ast_manager & m = md.get_manager();
    unsigned sz = md.get_num_constants();
    for (unsigned i = 0; i < sz; i++) {
        func_decl * c = md.get_constant(i);
        char const * d = "(define ";
        std::string n  = c->get_name().str();
        unsigned indent = static_cast<unsigned>(n.length() + strlen(d) + 1);
        out << d << n << " " << mk_ismt2_pp(md.get_const_interp(c), m, indent) << ")\n";
    }
}
コード例 #3
0
ファイル: model_v2_pp.cpp プロジェクト: Moondee/Artemis
static void display_constants(std::ostream & out, model_core const & md) {
    ast_manager & m = md.get_manager();
    unsigned sz = md.get_num_constants();
    for (unsigned i = 0; i < sz; i++) {
        func_decl * d = md.get_constant(i);

        std::string name   = d->get_name().str();
        const char * arrow = " -> "; 
        out << name << arrow;
        unsigned indent = static_cast<unsigned>(name.length() + strlen(arrow));
        out << mk_pp(md.get_const_interp(d), m, indent) << "\n";
    }
}
コード例 #4
0
ファイル: model_pp.cpp プロジェクト: Moondee/Artemis
static void display_uninterp_sorts(std::ostream & out, model_core const & md) {
    ast_manager & m = md.get_manager();
    unsigned sz = md.get_num_uninterpreted_sorts();
    for (unsigned i = 0; i < sz; i++) {
        sort * s = md.get_uninterpreted_sort(i);
        out << "(define-sort " << mk_pp(s, m); 
        ptr_vector<expr> const & univ  = md.get_universe(s);
        ptr_vector<expr>::const_iterator it  = univ.begin();
        ptr_vector<expr>::const_iterator end = univ.end();
        for (; it != end; ++it) {
            out << " " << mk_ismt2_pp(*it, m);
        }
        out << ")\n";
    }
}
コード例 #5
0
ファイル: model_pp.cpp プロジェクト: Moondee/Artemis
static void display_functions(std::ostream & out, model_core const & md) {
    ast_manager & m = md.get_manager();
    unsigned sz = md.get_num_functions();
    for (unsigned i = 0; i < sz; i++) {
        func_decl * f = md.get_function(i);
        out << "(define (" << f->get_name();
        unsigned arity = f->get_arity();
        func_interp * fi = md.get_func_interp(f);
        for (unsigned j = 0; j < arity; j++) {
            out << " " << "x!" << j;
        }
        out << ")\n";
        
        unsigned num_entries = fi->num_entries();
        for (unsigned j = 0; j < num_entries; j++) {
            func_entry const * curr = fi->get_entry(j);
            out << "  (if ";
            if (arity > 1)
                out << "(and ";
            for (unsigned j = 0; j < arity; j++) {
                out << "(= x!" << j << " " << mk_ismt2_pp(curr->get_arg(j), m) << ")";
                if (j + 1 < arity)
                    out << " ";
            }
            if (arity > 1)
                out << ")";
            out << " " << mk_ismt2_pp(curr->get_result(), m) << "\n";
        }
        if (num_entries > 0)
            out << "  ";
        if (fi->is_partial())
            out << "  #unspecified";
        else {
            pp_params const & params = get_pp_default_params();
            out << "  " << mk_ismt2_pp(fi->get_else(), m, params, 5, arity, "x");
        }
        for (unsigned j = 0; j < num_entries; j++)
            out << ")";
        out << ")\n";
    }
}