mirror of
https://github.com/Z3Prover/z3
synced 2025-04-12 04:03:39 +00:00
rewrite quantifiers in model evaluator #2171
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
006590f329
commit
5abc4a6d68
|
@ -839,3 +839,13 @@ expr_ref th_rewriter::mk_app(func_decl* f, unsigned num_args, expr* const* args)
|
||||||
void th_rewriter::set_solver(expr_solver* solver) {
|
void th_rewriter::set_solver(expr_solver* solver) {
|
||||||
m_imp->set_solver(solver);
|
m_imp->set_solver(solver);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool th_rewriter::reduce_quantifier(quantifier * old_q,
|
||||||
|
expr * new_body,
|
||||||
|
expr * const * new_patterns,
|
||||||
|
expr * const * new_no_patterns,
|
||||||
|
expr_ref & result,
|
||||||
|
proof_ref & result_pr) {
|
||||||
|
return m_imp->cfg().reduce_quantifier(old_q, new_body, new_patterns, new_no_patterns, result, result_pr);
|
||||||
|
}
|
||||||
|
|
|
@ -41,7 +41,7 @@ public:
|
||||||
static void get_param_descrs(param_descrs & r);
|
static void get_param_descrs(param_descrs & r);
|
||||||
unsigned get_cache_size() const;
|
unsigned get_cache_size() const;
|
||||||
unsigned get_num_steps() const;
|
unsigned get_num_steps() const;
|
||||||
|
|
||||||
void operator()(expr_ref& term);
|
void operator()(expr_ref& term);
|
||||||
void operator()(expr * t, expr_ref & result);
|
void operator()(expr * t, expr_ref & result);
|
||||||
void operator()(expr * t, expr_ref & result, proof_ref & result_pr);
|
void operator()(expr * t, expr_ref & result, proof_ref & result_pr);
|
||||||
|
@ -49,6 +49,13 @@ public:
|
||||||
|
|
||||||
expr_ref mk_app(func_decl* f, unsigned num_args, expr* const* args);
|
expr_ref mk_app(func_decl* f, unsigned num_args, expr* const* args);
|
||||||
|
|
||||||
|
bool reduce_quantifier(quantifier * old_q,
|
||||||
|
expr * new_body,
|
||||||
|
expr * const * new_patterns,
|
||||||
|
expr * const * new_no_patterns,
|
||||||
|
expr_ref & result,
|
||||||
|
proof_ref & result_pr);
|
||||||
|
|
||||||
void cleanup();
|
void cleanup();
|
||||||
void reset();
|
void reset();
|
||||||
|
|
||||||
|
|
|
@ -30,6 +30,7 @@ Revision History:
|
||||||
#include "ast/rewriter/datatype_rewriter.h"
|
#include "ast/rewriter/datatype_rewriter.h"
|
||||||
#include "ast/rewriter/array_rewriter.h"
|
#include "ast/rewriter/array_rewriter.h"
|
||||||
#include "ast/rewriter/fpa_rewriter.h"
|
#include "ast/rewriter/fpa_rewriter.h"
|
||||||
|
#include "ast/rewriter/th_rewriter.h"
|
||||||
#include "ast/rewriter/rewriter_def.h"
|
#include "ast/rewriter/rewriter_def.h"
|
||||||
#include "ast/ast_pp.h"
|
#include "ast/ast_pp.h"
|
||||||
#include "ast/ast_util.h"
|
#include "ast/ast_util.h"
|
||||||
|
@ -126,6 +127,17 @@ struct evaluator_cfg : public default_rewriter_cfg {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool reduce_quantifier(quantifier * old_q,
|
||||||
|
expr * new_body,
|
||||||
|
expr * const * new_patterns,
|
||||||
|
expr * const * new_no_patterns,
|
||||||
|
expr_ref & result,
|
||||||
|
proof_ref & result_pr) {
|
||||||
|
th_rewriter th(m);
|
||||||
|
return th.reduce_quantifier(old_q, new_body, new_patterns, new_no_patterns, result, result_pr);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
br_status reduce_app(func_decl * f, unsigned num, expr * const * args, expr_ref & result, proof_ref & result_pr) {
|
br_status reduce_app(func_decl * f, unsigned num, expr * const * args, expr_ref & result, proof_ref & result_pr) {
|
||||||
result_pr = nullptr;
|
result_pr = nullptr;
|
||||||
family_id fid = f->get_family_id();
|
family_id fid = f->get_family_id();
|
||||||
|
|
|
@ -3332,7 +3332,7 @@ public:
|
||||||
vi = m_theory_var2var_index[v];
|
vi = m_theory_var2var_index[v];
|
||||||
st = m_solver->maximize_term(vi, term_max);
|
st = m_solver->maximize_term(vi, term_max);
|
||||||
}
|
}
|
||||||
TRACE("arith", display(tout << st << " v" << v << " vi: " << vi << "\n"););
|
TRACE("arith", display(tout << st << " v" << v << " vi: " << vi << " " << term_max << "\n"););
|
||||||
switch (st) {
|
switch (st) {
|
||||||
case lp::lp_status::OPTIMAL: {
|
case lp::lp_status::OPTIMAL: {
|
||||||
init_variable_values();
|
init_variable_values();
|
||||||
|
|
Loading…
Reference in a new issue