mirror of
https://github.com/Z3Prover/z3
synced 2025-04-24 17:45:32 +00:00
Moved extension_converter func_interp entry compression to func_interp.
Relates to #547
This commit is contained in:
parent
3b82604590
commit
ccd18283e7
4 changed files with 53 additions and 52 deletions
|
@ -43,41 +43,6 @@ static void display_decls_info(std::ostream & out, model_ref & md) {
|
|||
}
|
||||
}
|
||||
|
||||
bool extension_model_converter::is_fi_entry_expr(expr * e, unsigned arity, ptr_vector<expr> & args) {
|
||||
args.reset();
|
||||
if (!is_app(e) || !m().is_ite(to_app(e)))
|
||||
return false;
|
||||
|
||||
app * a = to_app(e);
|
||||
expr * c = a->get_arg(0);
|
||||
expr * t = a->get_arg(1);
|
||||
expr * f = a->get_arg(2);
|
||||
|
||||
if ((arity == 0) ||
|
||||
(arity == 1 && (!m().is_eq(c) || to_app(c)->get_num_args() != 2)) ||
|
||||
(arity > 1 && (!m().is_and(c) || to_app(c)->get_num_args() != arity)))
|
||||
return false;
|
||||
|
||||
args.resize(arity, 0);
|
||||
for (unsigned i = 0; i < arity; i++) {
|
||||
expr * ci = (arity == 1 && i == 0) ? to_app(c) : to_app(c)->get_arg(i);
|
||||
|
||||
if (!m().is_eq(ci) || to_app(ci)->get_num_args() != 2)
|
||||
return false;
|
||||
|
||||
expr * a0 = to_app(ci)->get_arg(0);
|
||||
expr * a1 = to_app(ci)->get_arg(1);
|
||||
if (is_var(a0) && to_var(a0)->get_idx() == i)
|
||||
args[i] = a1;
|
||||
else if (is_var(a1) && to_var(a1)->get_idx() == i)
|
||||
args[i] = a0;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void extension_model_converter::operator()(model_ref & md, unsigned goal_idx) {
|
||||
SASSERT(goal_idx == 0);
|
||||
TRACE("extension_mc", model_v2_pp(tout, *md); display_decls_info(tout, md););
|
||||
|
@ -97,14 +62,7 @@ void extension_model_converter::operator()(model_ref & md, unsigned goal_idx) {
|
|||
}
|
||||
else {
|
||||
func_interp * new_fi = alloc(func_interp, m(), arity);
|
||||
expr * e = val.get();
|
||||
ptr_vector<expr> args;
|
||||
while (is_fi_entry_expr(e, arity, args)) {
|
||||
TRACE("extension_mc", tout << "fi entry: " << mk_ismt2_pp(e, m()) << std::endl;);
|
||||
new_fi->insert_entry(args.c_ptr(), to_app(e)->get_arg(1));
|
||||
e = to_app(e)->get_arg(2);
|
||||
}
|
||||
new_fi->set_else(e);
|
||||
new_fi->set_else(val);
|
||||
md->register_decl(f, new_fi);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,9 +43,6 @@ public:
|
|||
void insert(func_decl * v, expr * def);
|
||||
|
||||
virtual model_converter * translate(ast_translation & translator);
|
||||
|
||||
private:
|
||||
bool is_fi_entry_expr(expr * e, unsigned arity, ptr_vector<expr> & args);
|
||||
};
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue