mirror of
https://github.com/Z3Prover/z3
synced 2025-04-27 19:05:51 +00:00
fix #1675, regression in core processing in maxres
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
26e9321517
commit
335d672bf1
43 changed files with 246 additions and 321 deletions
|
@ -66,12 +66,10 @@ model * model::copy() const {
|
|||
return m;
|
||||
}
|
||||
|
||||
// Remark: eval is for backward compatibility. We should use model_evaluator.
|
||||
bool model::eval(expr * e, expr_ref & result, bool model_completion) {
|
||||
model_evaluator ev(*this);
|
||||
ev.set_model_completion(model_completion);
|
||||
bool model::eval_expr(expr * e, expr_ref & result, bool model_completion) {
|
||||
scoped_model_completion _smc(*this, model_completion);
|
||||
try {
|
||||
ev(e, result);
|
||||
result = (*this)(e);
|
||||
return true;
|
||||
}
|
||||
catch (model_evaluator_exception & ex) {
|
||||
|
|
|
@ -46,8 +46,7 @@ public:
|
|||
|
||||
model * copy() const;
|
||||
|
||||
bool eval(func_decl * f, expr_ref & r) const { return model_core::eval(f, r); }
|
||||
bool eval(expr * e, expr_ref & result, bool model_completion = false);
|
||||
bool eval_expr(expr * e, expr_ref & result, bool model_completion = false);
|
||||
|
||||
expr * get_some_value(sort * s) override;
|
||||
ptr_vector<expr> const & get_universe(sort * s) const override;
|
||||
|
@ -93,8 +92,6 @@ public:
|
|||
m_model.set_model_completion(m_old_completion);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ public:
|
|||
virtual ~model_core();
|
||||
|
||||
ast_manager & get_manager() const { return m_manager; }
|
||||
ast_manager& m() { return m_manager; }
|
||||
ast_manager& m() const { return m_manager; }
|
||||
|
||||
unsigned get_num_decls() const { return m_decls.size(); }
|
||||
func_decl * get_decl(unsigned i) const { return m_decls[i]; }
|
||||
|
|
|
@ -535,9 +535,8 @@ bool model_implicant::extract_array_func_interp(expr* a, vector<expr_ref_vector>
|
|||
*/
|
||||
void model_implicant::eval_array_eq(app* e, expr* arg1, expr* arg2) {
|
||||
TRACE("pdr", tout << "array equality: " << mk_pp(e, m) << "\n";);
|
||||
expr_ref v1(m), v2(m);
|
||||
m_model->eval(arg1, v1);
|
||||
m_model->eval(arg2, v2);
|
||||
expr_ref v1 = (*m_model)(arg1);
|
||||
expr_ref v2 = (*m_model)(arg2);
|
||||
if (v1 == v2) {
|
||||
set_true(e);
|
||||
return;
|
||||
|
@ -587,8 +586,8 @@ void model_implicant::eval_array_eq(app* e, expr* arg1, expr* arg2) {
|
|||
args2.append(store[i].size()-1, store[i].c_ptr());
|
||||
s1 = m_array.mk_select(args1.size(), args1.c_ptr());
|
||||
s2 = m_array.mk_select(args2.size(), args2.c_ptr());
|
||||
m_model->eval(s1, w1);
|
||||
m_model->eval(s2, w2);
|
||||
w1 = (*m_model)(s1);
|
||||
w2 = (*m_model)(s2);
|
||||
if (w1 == w2) {
|
||||
continue;
|
||||
}
|
||||
|
@ -621,9 +620,9 @@ void model_implicant::eval_eq(app* e, expr* arg1, expr* arg2) {
|
|||
eval_array_eq(e, arg1, arg2);
|
||||
}
|
||||
else if (is_x(arg1) || is_x(arg2)) {
|
||||
expr_ref eq(m), vl(m);
|
||||
expr_ref eq(m);
|
||||
eq = m.mk_eq(arg1, arg2);
|
||||
m_model->eval(eq, vl);
|
||||
expr_ref vl = (*m_model)(eq);
|
||||
if (m.is_true(vl)) {
|
||||
set_bool(e, true);
|
||||
}
|
||||
|
@ -837,8 +836,7 @@ bool model_implicant::check_model(ptr_vector<expr> const& formulas) {
|
|||
eval_basic(curr);
|
||||
}
|
||||
else {
|
||||
expr_ref vl(m);
|
||||
m_model->eval(curr, vl);
|
||||
expr_ref vl = (*m_model)(curr);
|
||||
assign_value(curr, vl);
|
||||
}
|
||||
|
||||
|
@ -884,7 +882,7 @@ expr_ref model_implicant::eval(model_ref& model, func_decl* d) {
|
|||
expr_ref model_implicant::eval(model_ref& model, expr* e) {
|
||||
expr_ref result(m);
|
||||
m_model = model;
|
||||
VERIFY(m_model->eval(e, result, true));
|
||||
result = (*m_model)(e);
|
||||
if (m_array.is_array(e)) {
|
||||
vector<expr_ref_vector> stores;
|
||||
expr_ref_vector args(m);
|
||||
|
|
|
@ -302,3 +302,8 @@ void model_smt2_pp(std::ostream & out, ast_manager & m, model_core const & md, u
|
|||
pp_consts(out, *(ctx.get()), md, indent);
|
||||
pp_funs(out, *(ctx.get()), md, indent);
|
||||
}
|
||||
|
||||
std::ostream& operator<<(std::ostream& out, model_core const& m) {
|
||||
model_smt2_pp(out, m.m(), m, 0);
|
||||
return out;
|
||||
}
|
||||
|
|
|
@ -25,5 +25,6 @@ Revision History:
|
|||
|
||||
void model_smt2_pp(std::ostream & out, ast_printer_context & ctx, model_core const & m, unsigned indent);
|
||||
void model_smt2_pp(std::ostream & out, ast_manager & m, model_core const & md, unsigned indent);
|
||||
std::ostream& operator<<(std::ostream& out, model_core const& m);
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue