mirror of
https://github.com/Z3Prover/z3
synced 2025-04-24 01:25:31 +00:00
fix #5289
This commit is contained in:
parent
4d41db2920
commit
b1606487f0
9 changed files with 88 additions and 41 deletions
|
@ -24,6 +24,7 @@ Revision History:
|
|||
#include "ast/rewriter/th_rewriter.h"
|
||||
#include "ast/array_decl_plugin.h"
|
||||
#include "ast/bv_decl_plugin.h"
|
||||
#include "ast/recfun_decl_plugin.h"
|
||||
#include "ast/well_sorted.h"
|
||||
#include "ast/used_symbols.h"
|
||||
#include "ast/for_each_expr.h"
|
||||
|
@ -582,3 +583,32 @@ void model::reset_eval_cache() {
|
|||
m_mev.reset();
|
||||
}
|
||||
|
||||
void model::add_rec_funs() {
|
||||
recfun::util u(m);
|
||||
func_decl_ref_vector recfuns = u.get_rec_funs();
|
||||
for (func_decl* f : recfuns) {
|
||||
auto& def = u.get_def(f);
|
||||
expr* rhs = def.get_rhs();
|
||||
if (!rhs)
|
||||
continue;
|
||||
if (has_interpretation(f))
|
||||
continue;
|
||||
if (f->get_arity() == 0) {
|
||||
register_decl(f, rhs);
|
||||
continue;
|
||||
}
|
||||
|
||||
func_interp* fi = alloc(func_interp, m, f->get_arity());
|
||||
// reverse argument order so that variable 0 starts at the beginning.
|
||||
expr_ref_vector subst(m);
|
||||
for (unsigned i = 0; i < f->get_arity(); ++i) {
|
||||
subst.push_back(m.mk_var(i, f->get_domain(i)));
|
||||
}
|
||||
var_subst sub(m, true);
|
||||
expr_ref bodyr = sub(rhs, subst);
|
||||
|
||||
fi->set_else(bodyr);
|
||||
register_decl(f, fi);
|
||||
}
|
||||
TRACE("model", tout << *this << "\n";);
|
||||
}
|
||||
|
|
|
@ -108,6 +108,7 @@ public:
|
|||
void reset_eval_cache();
|
||||
bool has_solver();
|
||||
void set_solver(expr_solver* solver);
|
||||
void add_rec_funs();
|
||||
|
||||
class scoped_model_completion {
|
||||
bool m_old_completion;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue