mirror of
https://github.com/Z3Prover/z3
synced 2025-04-23 09:05:31 +00:00
parent
bd59fceaec
commit
dde0c9bd0d
7 changed files with 39 additions and 25 deletions
|
@ -94,7 +94,7 @@ void inductive_property::to_model(model_ref& md) const {
|
|||
for (unsigned j = 0; j < sig.size(); ++j) {
|
||||
sig_vars.push_back(m.mk_const(sig[sig.size() - j - 1]));
|
||||
}
|
||||
expr_ref q = expr_abstract(m, 0, sig_vars.size(), sig_vars.c_ptr(), prop);
|
||||
expr_ref q = expr_abstract(sig_vars, prop);
|
||||
md->register_decl(ri.m_pred, q);
|
||||
}
|
||||
TRACE("spacer", tout << *md;);
|
||||
|
|
|
@ -67,8 +67,8 @@ namespace datalog {
|
|||
void operator()(model_ref & old_model) override {
|
||||
model_ref new_model = alloc(model, m);
|
||||
for (unsigned i = 0; i < m_new_funcs.size(); ++i) {
|
||||
func_decl* p = m_new_funcs[i].get();
|
||||
func_decl* q = m_old_funcs[i].get();
|
||||
func_decl* p = m_new_funcs.get(i);
|
||||
func_decl* q = m_old_funcs.get(i);
|
||||
expr_ref_vector const& sub = m_subst[i];
|
||||
sort_ref_vector const& sorts = m_sorts[i];
|
||||
bool_vector const& is_bound = m_bound[i];
|
||||
|
@ -76,7 +76,6 @@ namespace datalog {
|
|||
expr_ref body(m);
|
||||
unsigned arity_q = q->get_arity();
|
||||
SASSERT(0 < p->get_arity());
|
||||
func_interp* g = alloc(func_interp, m, arity_q);
|
||||
|
||||
if (f) {
|
||||
body = f->get_interp();
|
||||
|
@ -88,11 +87,11 @@ namespace datalog {
|
|||
for (unsigned i = 0; i < p->get_arity(); ++i) {
|
||||
args.push_back(m.mk_var(i, p->get_domain(i)));
|
||||
}
|
||||
body = m.mk_app(p, args.size(), args.c_ptr());
|
||||
body = m.mk_app(p, args);
|
||||
}
|
||||
// Create quantifier wrapper around body.
|
||||
|
||||
TRACE("dl", tout << mk_pp(body, m) << "\n";);
|
||||
TRACE("dl", tout << body << "\n";);
|
||||
// 1. replace variables by the compound terms from
|
||||
// the original predicate.
|
||||
expr_safe_replace rep(m);
|
||||
|
@ -102,7 +101,7 @@ namespace datalog {
|
|||
rep(body);
|
||||
rep.reset();
|
||||
|
||||
TRACE("dl", tout << mk_pp(body, m) << "\n";);
|
||||
TRACE("dl", tout << body << "\n";);
|
||||
// 2. replace bound variables by constants.
|
||||
expr_ref_vector consts(m), bound(m), _free(m);
|
||||
svector<symbol> names;
|
||||
|
@ -123,21 +122,21 @@ namespace datalog {
|
|||
rep(body);
|
||||
rep.reset();
|
||||
|
||||
TRACE("dl", tout << mk_pp(body, m) << "\n";);
|
||||
TRACE("dl", tout << body << "\n";);
|
||||
// 3. abstract and quantify those variables that should be bound.
|
||||
expr_abstract(m, 0, bound.size(), bound.c_ptr(), body, body);
|
||||
body = expr_abstract(bound, body);
|
||||
body = m.mk_forall(names.size(), bound_sorts.c_ptr(), names.c_ptr(), body);
|
||||
|
||||
TRACE("dl", tout << mk_pp(body, m) << "\n";);
|
||||
TRACE("dl", tout << body << "\n";);
|
||||
// 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())));
|
||||
unsigned j = 0;
|
||||
for (expr* f : _free) {
|
||||
rep.insert(f, m.mk_var(j++, m.get_sort(f)));
|
||||
}
|
||||
rep(body);
|
||||
g->set_else(body);
|
||||
TRACE("dl", tout << mk_pp(body, m) << "\n";);
|
||||
|
||||
new_model->register_decl(q, g);
|
||||
new_model->register_decl(q, body);
|
||||
TRACE("dl", tout << body << "\n";);
|
||||
}
|
||||
old_model = new_model;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue