3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2026-03-19 03:23:10 +00:00

Cleanup fixedpoint options

Replace pdr options with spacer
Repace fixedpoint module with fp
This commit is contained in:
Arie Gurfinkel 2018-06-13 15:29:34 -07:00
parent 619f681d28
commit 9109968e55
23 changed files with 344 additions and 353 deletions

View file

@ -11,7 +11,7 @@ Abstract:
Author:
Ken McMillan
Ken McMillan
Andrey Rybalchenko
Nikolaj Bjorner (nbjorner) 2013-04-02
@ -23,13 +23,12 @@ Revision History:
#include "muz/base/dl_context.h"
#include "ast/rewriter/expr_safe_replace.h"
#include "ast/expr_abstract.h"
#include "muz/base/fixedpoint_params.hpp"
namespace datalog {
// model converter:
// model converter:
// Given model for P^(x, y, i, a[i])
// create model: P(x,y,a) == forall i . P^(x,y,i,a[i])
// requires substitution and list of bound variables.
@ -55,7 +54,7 @@ namespace datalog {
void display(std::ostream& out) override { display_add(out, m); }
void get_units(obj_map<expr, bool>& units) override { units.reset(); }
void get_units(obj_map<expr, bool>& units) override { units.reset(); }
void insert(func_decl* old_p, func_decl* new_p, expr_ref_vector& sub, sort_ref_vector& sorts, svector<bool> const& bound) {
m_old_funcs.push_back(old_p);
@ -74,7 +73,7 @@ namespace datalog {
sort_ref_vector const& sorts = m_sorts[i];
svector<bool> const& is_bound = m_bound[i];
func_interp* f = old_model->get_func_interp(p);
expr_ref body(m);
expr_ref body(m);
unsigned arity_q = q->get_arity();
SASSERT(0 < p->get_arity());
func_interp* g = alloc(func_interp, m, arity_q);
@ -82,7 +81,7 @@ namespace datalog {
if (f) {
body = f->get_interp();
SASSERT(!f->is_partial());
SASSERT(body);
SASSERT(body);
}
else {
expr_ref_vector args(m);
@ -94,7 +93,7 @@ namespace datalog {
// Create quantifier wrapper around body.
TRACE("dl", tout << mk_pp(body, m) << "\n";);
// 1. replace variables by the compound terms from
// 1. replace variables by the compound terms from
// the original predicate.
expr_safe_replace rep(m);
for (unsigned i = 0; i < sub.size(); ++i) {
@ -121,7 +120,7 @@ namespace datalog {
_free.push_back(consts.back());
}
}
rep(body);
rep(body);
rep.reset();
TRACE("dl", tout << mk_pp(body, m) << "\n";);
@ -130,18 +129,18 @@ namespace datalog {
body = m.mk_forall(names.size(), bound_sorts.c_ptr(), names.c_ptr(), body);
TRACE("dl", tout << mk_pp(body, m) << "\n";);
// 4. replace remaining constants by variables.
// 4. replace remaining constants by variables.
for (unsigned i = 0; i < _free.size(); ++i) {
rep.insert(_free[i].get(), m.mk_var(i, m.get_sort(_free[i].get())));
}
rep(body);
rep(body);
g->set_else(body);
TRACE("dl", tout << mk_pp(body, m) << "\n";);
new_model->register_decl(q, g);
}
}
old_model = new_model;
}
}
};
mk_quantifier_abstraction::mk_quantifier_abstraction(
@ -154,7 +153,7 @@ namespace datalog {
m_mc(nullptr) {
}
mk_quantifier_abstraction::~mk_quantifier_abstraction() {
mk_quantifier_abstraction::~mk_quantifier_abstraction() {
}
func_decl* mk_quantifier_abstraction::declare_pred(rule_set const& rules, rule_set& dst, func_decl* old_p) {
@ -178,7 +177,7 @@ namespace datalog {
func_decl* new_p = nullptr;
if (!m_old2new.find(old_p, new_p)) {
expr_ref_vector sub(m), vars(m);
svector<bool> bound;
svector<bool> bound;
sort_ref_vector domain(m), sorts(m);
expr_ref arg(m);
for (unsigned i = 0; i < sz; ++i) {
@ -208,7 +207,7 @@ namespace datalog {
bound.push_back(false);
sub.push_back(arg);
sorts.push_back(s0);
}
}
SASSERT(old_p->get_range() == m.mk_bool_sort());
new_p = m.mk_func_decl(old_p->get_name(), domain.size(), domain.c_ptr(), old_p->get_range());
m_refs.push_back(new_p);
@ -242,12 +241,12 @@ namespace datalog {
}
args.push_back(arg);
}
TRACE("dl",
TRACE("dl",
tout << mk_pp(new_p, m) << "\n";
for (unsigned i = 0; i < args.size(); ++i) {
tout << mk_pp(args[i].get(), m) << "\n";
});
return app_ref(m.mk_app(new_p, args.size(), args.c_ptr()), m);
return app_ref(m.mk_app(new_p, args.size(), args.c_ptr()), m);
}
app_ref mk_quantifier_abstraction::mk_tail(rule_set const& rules, rule_set& dst, app* p) {
@ -272,7 +271,7 @@ namespace datalog {
for (unsigned i = 0; i < sz; ++i) {
arg = ps->get_arg(i);
sort* s = m.get_sort(arg);
bool is_pattern = false;
bool is_pattern = false;
while (a.is_array(s)) {
is_pattern = true;
unsigned arity = get_array_arity(s);
@ -304,9 +303,9 @@ namespace datalog {
ptr_vector<expr> args2;
args2.push_back(arg);
args2.append(num_args, args);
return a.mk_select(args2.size(), args2.c_ptr());
return a.mk_select(args2.size(), args2.c_ptr());
}
rule_set * mk_quantifier_abstraction::operator()(rule_set const & source) {
if (!m_ctx.quantify_arrays()) {
return nullptr;
@ -334,10 +333,10 @@ namespace datalog {
}
rule_set * result = alloc(rule_set, m_ctx);
for (unsigned i = 0; i < sz; ++i) {
for (unsigned i = 0; i < sz; ++i) {
tail.reset();
rule & r = *source.get_rule(i);
TRACE("dl", r.display(m_ctx, tout); );
TRACE("dl", r.display(m_ctx, tout); );
unsigned cnt = vc.get_max_rule_var(r)+1;
unsigned utsz = r.get_uninterpreted_tail_size();
unsigned tsz = r.get_tail_size();
@ -352,8 +351,8 @@ namespace datalog {
proof_ref pr(m);
rm.mk_rule(fml, pr, *result, r.name());
TRACE("dl", result->last()->display(m_ctx, tout););
}
}
// proof converter: proofs are not necessarily preserved using this transformation.
if (m_old2new.empty()) {
@ -371,5 +370,3 @@ namespace datalog {
};