mirror of
https://github.com/Z3Prover/z3
synced 2025-08-03 09:50:23 +00:00
merge with master
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
commit
c513f3ca09
883 changed files with 13979 additions and 16480 deletions
|
@ -27,8 +27,9 @@ Revision History:
|
|||
#include "ast/macros/quasi_macros.h"
|
||||
#include "smt/asserted_formulas.h"
|
||||
|
||||
asserted_formulas::asserted_formulas(ast_manager & m, smt_params & p):
|
||||
asserted_formulas::asserted_formulas(ast_manager & m, smt_params & sp, params_ref const& p):
|
||||
m(m),
|
||||
m_smt_params(sp),
|
||||
m_params(p),
|
||||
m_rewriter(m),
|
||||
m_substitution(m),
|
||||
|
@ -46,7 +47,6 @@ asserted_formulas::asserted_formulas(ast_manager & m, smt_params & p):
|
|||
m_refine_inj_axiom(*this),
|
||||
m_max_bv_sharing_fn(*this),
|
||||
m_elim_term_ite(*this),
|
||||
m_pull_cheap_ite_trees(*this),
|
||||
m_pull_nested_quantifiers(*this),
|
||||
m_elim_bvs_from_quantifiers(*this),
|
||||
m_cheap_quant_fourier_motzkin(*this),
|
||||
|
@ -66,20 +66,20 @@ asserted_formulas::asserted_formulas(ast_manager & m, smt_params & p):
|
|||
}
|
||||
|
||||
void asserted_formulas::setup() {
|
||||
switch (m_params.m_lift_ite) {
|
||||
switch (m_smt_params.m_lift_ite) {
|
||||
case LI_FULL:
|
||||
m_params.m_ng_lift_ite = LI_NONE;
|
||||
m_smt_params.m_ng_lift_ite = LI_NONE;
|
||||
break;
|
||||
case LI_CONSERVATIVE:
|
||||
if (m_params.m_ng_lift_ite == LI_CONSERVATIVE)
|
||||
m_params.m_ng_lift_ite = LI_NONE;
|
||||
if (m_smt_params.m_ng_lift_ite == LI_CONSERVATIVE)
|
||||
m_smt_params.m_ng_lift_ite = LI_NONE;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (m_params.m_relevancy_lvl == 0)
|
||||
m_params.m_relevancy_lemma = false;
|
||||
if (m_smt_params.m_relevancy_lvl == 0)
|
||||
m_smt_params.m_relevancy_lemma = false;
|
||||
}
|
||||
|
||||
|
||||
|
@ -90,7 +90,7 @@ void asserted_formulas::push_assertion(expr * e, proof * pr, vector<justified_ex
|
|||
if (inconsistent()) {
|
||||
return;
|
||||
}
|
||||
expr* e1 = 0;
|
||||
expr* e1 = nullptr;
|
||||
if (m.is_false(e)) {
|
||||
result.push_back(justified_expr(m, e, pr));
|
||||
m_inconsistent = true;
|
||||
|
@ -101,14 +101,14 @@ void asserted_formulas::push_assertion(expr * e, proof * pr, vector<justified_ex
|
|||
else if (m.is_and(e)) {
|
||||
for (unsigned i = 0; i < to_app(e)->get_num_args(); ++i) {
|
||||
expr* arg = to_app(e)->get_arg(i);
|
||||
proof_ref _pr(m.proofs_enabled() ? m.mk_and_elim(pr, i) : 0, m);
|
||||
proof_ref _pr(m.proofs_enabled() ? m.mk_and_elim(pr, i) : nullptr, m);
|
||||
push_assertion(arg, _pr, result);
|
||||
}
|
||||
}
|
||||
else if (m.is_not(e, e1) && m.is_or(e1)) {
|
||||
for (unsigned i = 0; i < to_app(e1)->get_num_args(); ++i) {
|
||||
expr* arg = to_app(e1)->get_arg(i);
|
||||
proof_ref _pr(m.proofs_enabled() ? m.mk_not_or_elim(pr, i) : 0, m);
|
||||
proof_ref _pr(m.proofs_enabled() ? m.mk_not_or_elim(pr, i) : nullptr, m);
|
||||
expr_ref narg(mk_not(m, arg), m);
|
||||
push_assertion(narg, _pr, result);
|
||||
}
|
||||
|
@ -118,20 +118,24 @@ void asserted_formulas::push_assertion(expr * e, proof * pr, vector<justified_ex
|
|||
}
|
||||
}
|
||||
|
||||
void asserted_formulas::updt_params(params_ref const& p) {
|
||||
m_params.append(p);
|
||||
}
|
||||
|
||||
void asserted_formulas::set_eliminate_and(bool flag) {
|
||||
if (flag == m_elim_and) return;
|
||||
m_elim_and = flag;
|
||||
params_ref p;
|
||||
p.set_bool("pull_cheap_ite", false);
|
||||
p.set_bool("elim_and", flag);
|
||||
p.set_bool("arith_ineq_lhs", true);
|
||||
p.set_bool("sort_sums", true);
|
||||
p.set_bool("rewrite_patterns", true);
|
||||
p.set_bool("eq2ineq", m_params.m_arith_eq2ineq);
|
||||
p.set_bool("gcd_rounding", true);
|
||||
p.set_bool("expand_select_store", true);
|
||||
p.set_bool("bv_sort_ac", true);
|
||||
m_rewriter.updt_params(p);
|
||||
if (m_smt_params.m_pull_cheap_ite) m_params.set_bool("pull_cheap_ite", true);
|
||||
m_params.set_bool("elim_and", flag);
|
||||
m_params.set_bool("arith_ineq_lhs", true);
|
||||
m_params.set_bool("sort_sums", true);
|
||||
m_params.set_bool("rewrite_patterns", true);
|
||||
m_params.set_bool("eq2ineq", m_smt_params.m_arith_eq2ineq);
|
||||
m_params.set_bool("gcd_rounding", true);
|
||||
m_params.set_bool("expand_select_store", true);
|
||||
m_params.set_bool("bv_sort_ac", true);
|
||||
m_params.set_bool("som", true);
|
||||
m_rewriter.updt_params(m_params);
|
||||
flush_cache();
|
||||
}
|
||||
|
||||
|
@ -143,7 +147,7 @@ void asserted_formulas::assert_expr(expr * e, proof * _in_pr) {
|
|||
if (inconsistent())
|
||||
return;
|
||||
|
||||
if (m_params.m_preprocess) {
|
||||
if (m_smt_params.m_preprocess) {
|
||||
TRACE("assert_expr_bug", tout << r << "\n";);
|
||||
set_eliminate_and(false); // do not eliminate and before nnf.
|
||||
m_rewriter(e, r, pr);
|
||||
|
@ -226,7 +230,7 @@ void asserted_formulas::reduce() {
|
|||
return;
|
||||
if (m_qhead == m_formulas.size())
|
||||
return;
|
||||
if (!m_params.m_preprocess)
|
||||
if (!m_smt_params.m_preprocess)
|
||||
return;
|
||||
if (m_macro_manager.has_macros())
|
||||
invoke(m_find_macros);
|
||||
|
@ -240,7 +244,6 @@ void asserted_formulas::reduce() {
|
|||
if (!invoke(m_nnf_cnf)) return;
|
||||
set_eliminate_and(true);
|
||||
if (!invoke(m_reduce_asserted_formulas)) return;
|
||||
if (!invoke(m_pull_cheap_ite_trees)) return;
|
||||
if (!invoke(m_pull_nested_quantifiers)) return;
|
||||
if (!invoke(m_lift_ite)) return;
|
||||
if (!invoke(m_ng_lift_ite)) return;
|
||||
|
@ -376,7 +379,7 @@ void asserted_formulas::nnf_cnf() {
|
|||
unsigned sz2 = push_todo.size();
|
||||
for (unsigned k = 0; k < sz2; k++) {
|
||||
expr * n = push_todo.get(k);
|
||||
pr = 0;
|
||||
pr = nullptr;
|
||||
m_rewriter(n, r1, pr1);
|
||||
CASSERT("well_sorted",is_well_sorted(m, r1));
|
||||
if (canceled()) {
|
||||
|
@ -512,11 +515,14 @@ void asserted_formulas::update_substitution(expr* n, proof* pr) {
|
|||
}
|
||||
TRACE("propagate_values", tout << "incompatible " << mk_pp(n, m) << "\n";);
|
||||
}
|
||||
if (m.is_not(n, n1)) {
|
||||
m_scoped_substitution.insert(n1, m.mk_false(), m.proofs_enabled() ? m.mk_iff_false(pr) : nullptr);
|
||||
proof_ref pr1(m);
|
||||
if (m.is_not(n, n1)) {
|
||||
pr1 = m.proofs_enabled() ? m.mk_iff_false(pr) : nullptr;
|
||||
m_scoped_substitution.insert(n1, m.mk_false(), pr1);
|
||||
}
|
||||
else {
|
||||
m_scoped_substitution.insert(n, m.mk_true(), m.proofs_enabled() ? m.mk_iff_true(pr) : nullptr);
|
||||
pr1 = m.proofs_enabled() ? m.mk_iff_true(pr) : nullptr;
|
||||
m_scoped_substitution.insert(n, m.mk_true(), pr1);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -596,15 +602,15 @@ void asserted_formulas::compute_depth(expr* e) {
|
|||
|
||||
proof * asserted_formulas::get_inconsistency_proof() const {
|
||||
if (!inconsistent())
|
||||
return 0;
|
||||
return nullptr;
|
||||
if (!m.proofs_enabled())
|
||||
return 0;
|
||||
return nullptr;
|
||||
for (justified_expr const& j : m_formulas) {
|
||||
if (m.is_false(j.get_fml()))
|
||||
return j.get_proof();
|
||||
}
|
||||
UNREACHABLE();
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void asserted_formulas::refine_inj_axiom_fn::simplify(justified_expr const& j, expr_ref& n, proof_ref& p) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue