mirror of
https://github.com/Z3Prover/z3
synced 2025-10-05 15:33:59 +00:00
merge with Z3Prover/master
This commit is contained in:
parent
57845d4809
commit
aacb7289be
1147 changed files with 59004 additions and 63575 deletions
|
@ -70,6 +70,7 @@ z3_add_component(smt
|
|||
euclid
|
||||
fpa
|
||||
grobner
|
||||
nlsat
|
||||
lp
|
||||
macros
|
||||
normal_forms
|
||||
|
|
|
@ -42,7 +42,7 @@ namespace smt {
|
|||
m_n2(n2) {
|
||||
}
|
||||
|
||||
virtual void undo(context & ctx) {
|
||||
void undo(context & ctx) override {
|
||||
m_already_processed.erase(m_n1, m_n2);
|
||||
TRACE("arith_eq_adapter_profile", tout << "del #" << m_n1->get_owner_id() << " #" << m_n2->get_owner_id() << "\n";);
|
||||
}
|
||||
|
@ -67,9 +67,9 @@ namespace smt {
|
|||
m_ge(ge) {
|
||||
}
|
||||
|
||||
virtual ~arith_eq_relevancy_eh() {}
|
||||
~arith_eq_relevancy_eh() override {}
|
||||
|
||||
virtual void operator()(relevancy_propagator & rp) {
|
||||
void operator()(relevancy_propagator & rp) override {
|
||||
if (!rp.is_relevant(m_n1))
|
||||
return;
|
||||
if (!rp.is_relevant(m_n2))
|
||||
|
@ -154,8 +154,8 @@ namespace smt {
|
|||
// Requires that the theory arithmetic internalizer accept non simplified terms of the form t1 - t2
|
||||
// if t1 and t2 already have slacks (theory variables) associated with them.
|
||||
// It also accepts terms with repeated variables (Issue #429).
|
||||
app * le = 0;
|
||||
app * ge = 0;
|
||||
app * le = nullptr;
|
||||
app * ge = nullptr;
|
||||
if (m_util.is_numeral(t1))
|
||||
std::swap(t1, t2);
|
||||
if (m_util.is_numeral(t2)) {
|
||||
|
|
|
@ -53,7 +53,7 @@ namespace smt {
|
|||
expr * m_t1_eq_t2;
|
||||
expr * m_le;
|
||||
expr * m_ge;
|
||||
data():m_t1_eq_t2(0), m_le(0), m_ge(0) {}
|
||||
data():m_t1_eq_t2(nullptr), m_le(nullptr), m_ge(nullptr) {}
|
||||
data(expr * t1_eq_t2, expr * le, expr * ge):m_t1_eq_t2(t1_eq_t2), m_le(le), m_ge(ge) {}
|
||||
};
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
@ -331,6 +334,7 @@ void asserted_formulas::find_macros_core() {
|
|||
reduce_and_solve();
|
||||
}
|
||||
|
||||
|
||||
void asserted_formulas::apply_quasi_macros() {
|
||||
TRACE("before_quasi_macros", display(tout););
|
||||
vector<justified_expr> new_fmls;
|
||||
|
@ -375,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()) {
|
||||
|
@ -416,7 +420,7 @@ void asserted_formulas::simplify_fmls::operator()() {
|
|||
|
||||
|
||||
void asserted_formulas::reduce_and_solve() {
|
||||
IF_IVERBOSE(10, verbose_stream() << "(smt.reducing)\n";);
|
||||
IF_VERBOSE(10, verbose_stream() << "(smt.reducing)\n";);
|
||||
flush_cache(); // collect garbage
|
||||
m_reduce_asserted_formulas();
|
||||
}
|
||||
|
@ -496,7 +500,8 @@ unsigned asserted_formulas::propagate_values(unsigned i) {
|
|||
|
||||
void asserted_formulas::update_substitution(expr* n, proof* pr) {
|
||||
expr* lhs, *rhs, *n1;
|
||||
if (is_ground(n) && (m.is_eq(n, lhs, rhs) || m.is_iff(n, lhs, rhs))) {
|
||||
proof_ref pr1(m);
|
||||
if (is_ground(n) && m.is_eq(n, lhs, rhs)) {
|
||||
compute_depth(lhs);
|
||||
compute_depth(rhs);
|
||||
if (is_gt(lhs, rhs)) {
|
||||
|
@ -506,13 +511,13 @@ void asserted_formulas::update_substitution(expr* n, proof* pr) {
|
|||
}
|
||||
if (is_gt(rhs, lhs)) {
|
||||
TRACE("propagate_values", tout << "insert " << mk_pp(rhs, m) << " -> " << mk_pp(lhs, m) << "\n";);
|
||||
m_scoped_substitution.insert(rhs, lhs, m.proofs_enabled() ? m.mk_symmetry(pr) : nullptr);
|
||||
pr1 = m.proofs_enabled() ? m.mk_symmetry(pr) : nullptr;
|
||||
m_scoped_substitution.insert(rhs, lhs, pr1);
|
||||
return;
|
||||
}
|
||||
TRACE("propagate_values", tout << "incompatible " << mk_pp(n, m) << "\n";);
|
||||
}
|
||||
proof_ref pr1(m);
|
||||
if (m.is_not(n, n1)) {
|
||||
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);
|
||||
}
|
||||
|
@ -522,6 +527,7 @@ void asserted_formulas::update_substitution(expr* n, proof* pr) {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
\brief implement a Knuth-Bendix ordering on expressions.
|
||||
*/
|
||||
|
@ -597,15 +603,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) {
|
||||
|
@ -627,9 +633,9 @@ unsigned asserted_formulas::get_total_size() const {
|
|||
return r;
|
||||
}
|
||||
|
||||
|
||||
#ifdef Z3DEBUG
|
||||
void pp(asserted_formulas & f) {
|
||||
f.display(std::cout);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -26,7 +26,6 @@ Revision History:
|
|||
#include "ast/rewriter/bit2int.h"
|
||||
#include "ast/rewriter/maximize_ac_sharing.h"
|
||||
#include "ast/rewriter/distribute_forall.h"
|
||||
#include "ast/rewriter/pull_ite_tree.h"
|
||||
#include "ast/rewriter/push_app_ite.h"
|
||||
#include "ast/rewriter/inj_axiom.h"
|
||||
#include "ast/rewriter/bv_elim.h"
|
||||
|
@ -44,7 +43,8 @@ Revision History:
|
|||
class asserted_formulas {
|
||||
|
||||
ast_manager & m;
|
||||
smt_params & m_params;
|
||||
smt_params & m_smt_params;
|
||||
params_ref m_params;
|
||||
th_rewriter m_rewriter;
|
||||
expr_substitution m_substitution;
|
||||
scoped_expr_substitution m_scoped_substitution;
|
||||
|
@ -82,80 +82,80 @@ class asserted_formulas {
|
|||
class reduce_asserted_formulas_fn : public simplify_fmls {
|
||||
public:
|
||||
reduce_asserted_formulas_fn(asserted_formulas& af): simplify_fmls(af, "reduce-asserted") {}
|
||||
virtual void simplify(justified_expr const& j, expr_ref& n, proof_ref& p) { af.m_rewriter(j.get_fml(), n, p); }
|
||||
void simplify(justified_expr const& j, expr_ref& n, proof_ref& p) override { af.m_rewriter(j.get_fml(), n, p); }
|
||||
};
|
||||
|
||||
class find_macros_fn : public simplify_fmls {
|
||||
public:
|
||||
find_macros_fn(asserted_formulas& af): simplify_fmls(af, "find-macros") {}
|
||||
virtual void operator()() { af.find_macros_core(); }
|
||||
virtual bool should_apply() const { return af.m_params.m_macro_finder && af.has_quantifiers(); }
|
||||
virtual void simplify(justified_expr const& j, expr_ref& n, proof_ref& p) { UNREACHABLE(); }
|
||||
void operator()() override { af.find_macros_core(); }
|
||||
bool should_apply() const override { return af.m_smt_params.m_macro_finder && af.has_quantifiers(); }
|
||||
void simplify(justified_expr const& j, expr_ref& n, proof_ref& p) override { UNREACHABLE(); }
|
||||
};
|
||||
|
||||
class apply_quasi_macros_fn : public simplify_fmls {
|
||||
public:
|
||||
apply_quasi_macros_fn(asserted_formulas& af): simplify_fmls(af, "find-quasi-macros") {}
|
||||
virtual void operator()() { af.apply_quasi_macros(); }
|
||||
virtual bool should_apply() const { return af.m_params.m_quasi_macros && af.has_quantifiers(); }
|
||||
virtual void simplify(justified_expr const& j, expr_ref& n, proof_ref& p) { UNREACHABLE(); }
|
||||
void operator()() override { af.apply_quasi_macros(); }
|
||||
bool should_apply() const override { return af.m_smt_params.m_quasi_macros && af.has_quantifiers(); }
|
||||
void simplify(justified_expr const& j, expr_ref& n, proof_ref& p) override { UNREACHABLE(); }
|
||||
};
|
||||
|
||||
class nnf_cnf_fn : public simplify_fmls {
|
||||
public:
|
||||
nnf_cnf_fn(asserted_formulas& af): simplify_fmls(af, "nnf-cnf") {}
|
||||
virtual void operator()() { af.nnf_cnf(); }
|
||||
virtual bool should_apply() const { return af.m_params.m_nnf_cnf || (af.m_params.m_mbqi && af.has_quantifiers()); }
|
||||
virtual void simplify(justified_expr const& j, expr_ref& n, proof_ref& p) { UNREACHABLE(); }
|
||||
void operator()() override { af.nnf_cnf(); }
|
||||
bool should_apply() const override { return af.m_smt_params.m_nnf_cnf || (af.m_smt_params.m_mbqi && af.has_quantifiers()); }
|
||||
void simplify(justified_expr const& j, expr_ref& n, proof_ref& p) override { UNREACHABLE(); }
|
||||
};
|
||||
|
||||
class propagate_values_fn : public simplify_fmls {
|
||||
public:
|
||||
propagate_values_fn(asserted_formulas& af): simplify_fmls(af, "propagate-values") {}
|
||||
virtual void operator()() { af.propagate_values(); }
|
||||
virtual bool should_apply() const { return af.m_params.m_propagate_values; }
|
||||
virtual void simplify(justified_expr const& j, expr_ref& n, proof_ref& p) { UNREACHABLE(); }
|
||||
void operator()() override { af.propagate_values(); }
|
||||
bool should_apply() const override { return af.m_smt_params.m_propagate_values; }
|
||||
void simplify(justified_expr const& j, expr_ref& n, proof_ref& p) override { UNREACHABLE(); }
|
||||
};
|
||||
|
||||
class distribute_forall_fn : public simplify_fmls {
|
||||
distribute_forall m_functor;
|
||||
public:
|
||||
distribute_forall_fn(asserted_formulas& af): simplify_fmls(af, "distribute-forall"), m_functor(af.m) {}
|
||||
virtual void simplify(justified_expr const& j, expr_ref& n, proof_ref& p) { m_functor(j.get_fml(), n); }
|
||||
virtual bool should_apply() const { return af.m_params.m_distribute_forall && af.has_quantifiers(); }
|
||||
virtual void post_op() { af.reduce_and_solve(); TRACE("asserted_formulas", af.display(tout);); }
|
||||
void simplify(justified_expr const& j, expr_ref& n, proof_ref& p) override { m_functor(j.get_fml(), n); }
|
||||
bool should_apply() const override { return af.m_smt_params.m_distribute_forall && af.has_quantifiers(); }
|
||||
void post_op() override { af.reduce_and_solve(); TRACE("asserted_formulas", af.display(tout);); }
|
||||
};
|
||||
|
||||
class pattern_inference_fn : public simplify_fmls {
|
||||
pattern_inference_rw m_infer;
|
||||
public:
|
||||
pattern_inference_fn(asserted_formulas& af): simplify_fmls(af, "pattern-inference"), m_infer(af.m, af.m_params) {}
|
||||
virtual void simplify(justified_expr const& j, expr_ref& n, proof_ref& p) { m_infer(j.get_fml(), n, p); }
|
||||
virtual bool should_apply() const { return af.m_params.m_ematching && af.has_quantifiers(); }
|
||||
pattern_inference_fn(asserted_formulas& af): simplify_fmls(af, "pattern-inference"), m_infer(af.m, af.m_smt_params) {}
|
||||
void simplify(justified_expr const& j, expr_ref& n, proof_ref& p) override { m_infer(j.get_fml(), n, p); }
|
||||
bool should_apply() const override { return af.m_smt_params.m_ematching && af.has_quantifiers(); }
|
||||
};
|
||||
|
||||
class refine_inj_axiom_fn : public simplify_fmls {
|
||||
public:
|
||||
refine_inj_axiom_fn(asserted_formulas& af): simplify_fmls(af, "refine-injectivity") {}
|
||||
virtual void simplify(justified_expr const& j, expr_ref& n, proof_ref& p);
|
||||
virtual bool should_apply() const { return af.m_params.m_refine_inj_axiom && af.has_quantifiers(); }
|
||||
void simplify(justified_expr const& j, expr_ref& n, proof_ref& p) override;
|
||||
bool should_apply() const override { return af.m_smt_params.m_refine_inj_axiom && af.has_quantifiers(); }
|
||||
};
|
||||
|
||||
class max_bv_sharing_fn : public simplify_fmls {
|
||||
public:
|
||||
max_bv_sharing_fn(asserted_formulas& af): simplify_fmls(af, "maximizing-bv-sharing") {}
|
||||
virtual void simplify(justified_expr const& j, expr_ref& n, proof_ref& p) { af.m_bv_sharing(j.get_fml(), n, p); }
|
||||
virtual bool should_apply() const { return af.m_params.m_max_bv_sharing; }
|
||||
virtual void post_op() { af.m_reduce_asserted_formulas(); }
|
||||
void simplify(justified_expr const& j, expr_ref& n, proof_ref& p) override { af.m_bv_sharing(j.get_fml(), n, p); }
|
||||
bool should_apply() const override { return af.m_smt_params.m_max_bv_sharing; }
|
||||
void post_op() override { af.m_reduce_asserted_formulas(); }
|
||||
};
|
||||
|
||||
class elim_term_ite_fn : public simplify_fmls {
|
||||
elim_term_ite_rw m_elim;
|
||||
public:
|
||||
elim_term_ite_fn(asserted_formulas& af): simplify_fmls(af, "elim-term-ite"), m_elim(af.m, af.m_defined_names) {}
|
||||
virtual void simplify(justified_expr const& j, expr_ref& n, proof_ref& p) { m_elim(j.get_fml(), n, p); }
|
||||
virtual bool should_apply() const { return af.m_params.m_eliminate_term_ite && af.m_params.m_lift_ite != LI_FULL; }
|
||||
virtual void post_op() { af.m_formulas.append(m_elim.new_defs()); af.reduce_and_solve(); m_elim.reset(); }
|
||||
void simplify(justified_expr const& j, expr_ref& n, proof_ref& p) override { m_elim(j.get_fml(), n, p); }
|
||||
bool should_apply() const override { return af.m_smt_params.m_eliminate_term_ite && af.m_smt_params.m_lift_ite != LI_FULL; }
|
||||
void post_op() override { af.m_formulas.append(m_elim.new_defs()); af.reduce_and_solve(); m_elim.reset(); }
|
||||
};
|
||||
|
||||
#define MK_SIMPLIFIERA(NAME, FUNCTOR, MSG, APP, ARG, REDUCE) \
|
||||
|
@ -172,13 +172,12 @@ class asserted_formulas {
|
|||
|
||||
#define MK_SIMPLIFIERF(NAME, FUNCTOR, MSG, APP, REDUCE) MK_SIMPLIFIERA(NAME, FUNCTOR, MSG, APP, (af.m), REDUCE)
|
||||
|
||||
MK_SIMPLIFIERF(pull_cheap_ite_trees, pull_cheap_ite_tree_rw, "pull-cheap-ite-trees", af.m_params.m_pull_cheap_ite_trees, false);
|
||||
MK_SIMPLIFIERF(pull_nested_quantifiers, pull_nested_quant, "pull-nested-quantifiers", af.m_params.m_pull_nested_quantifiers && af.has_quantifiers(), false);
|
||||
MK_SIMPLIFIERF(cheap_quant_fourier_motzkin, elim_bounds_rw, "cheap-fourier-motzkin", af.m_params.m_eliminate_bounds && af.has_quantifiers(), true);
|
||||
MK_SIMPLIFIERF(elim_bvs_from_quantifiers, bv_elim_rw, "eliminate-bit-vectors-from-quantifiers", af.m_params.m_bb_quantifiers, true);
|
||||
MK_SIMPLIFIERF(apply_bit2int, bit2int, "propagate-bit-vector-over-integers", af.m_params.m_simplify_bit2int, true);
|
||||
MK_SIMPLIFIERA(lift_ite, push_app_ite_rw, "lift-ite", af.m_params.m_lift_ite != LI_NONE, (af.m, af.m_params.m_lift_ite == LI_CONSERVATIVE), true);
|
||||
MK_SIMPLIFIERA(ng_lift_ite, ng_push_app_ite_rw, "lift-ite", af.m_params.m_ng_lift_ite != LI_NONE, (af.m, af.m_params.m_ng_lift_ite == LI_CONSERVATIVE), true);
|
||||
MK_SIMPLIFIERF(pull_nested_quantifiers, pull_nested_quant, "pull-nested-quantifiers", af.m_smt_params.m_pull_nested_quantifiers && af.has_quantifiers(), false);
|
||||
MK_SIMPLIFIERF(cheap_quant_fourier_motzkin, elim_bounds_rw, "cheap-fourier-motzkin", af.m_smt_params.m_eliminate_bounds && af.has_quantifiers(), true);
|
||||
MK_SIMPLIFIERF(elim_bvs_from_quantifiers, bv_elim_rw, "eliminate-bit-vectors-from-quantifiers", af.m_smt_params.m_bb_quantifiers, true);
|
||||
MK_SIMPLIFIERF(apply_bit2int, bit2int, "propagate-bit-vector-over-integers", af.m_smt_params.m_simplify_bit2int, true);
|
||||
MK_SIMPLIFIERA(lift_ite, push_app_ite_rw, "lift-ite", af.m_smt_params.m_lift_ite != LI_NONE, (af.m, af.m_smt_params.m_lift_ite == LI_CONSERVATIVE), true);
|
||||
MK_SIMPLIFIERA(ng_lift_ite, ng_push_app_ite_rw, "lift-ite", af.m_smt_params.m_ng_lift_ite != LI_NONE, (af.m, af.m_smt_params.m_ng_lift_ite == LI_CONSERVATIVE), true);
|
||||
|
||||
|
||||
reduce_asserted_formulas_fn m_reduce_asserted_formulas;
|
||||
|
@ -187,7 +186,6 @@ class asserted_formulas {
|
|||
refine_inj_axiom_fn m_refine_inj_axiom;
|
||||
max_bv_sharing_fn m_max_bv_sharing_fn;
|
||||
elim_term_ite_fn m_elim_term_ite;
|
||||
pull_cheap_ite_trees m_pull_cheap_ite_trees;
|
||||
pull_nested_quantifiers m_pull_nested_quantifiers;
|
||||
elim_bvs_from_quantifiers m_elim_bvs_from_quantifiers;
|
||||
cheap_quant_fourier_motzkin m_cheap_quant_fourier_motzkin;
|
||||
|
@ -219,14 +217,14 @@ class asserted_formulas {
|
|||
bool is_gt(expr* lhs, expr* rhs);
|
||||
void compute_depth(expr* e);
|
||||
unsigned depth(expr* e) { return m_expr2depth[e]; }
|
||||
bool pull_cheap_ite_trees();
|
||||
|
||||
void init(unsigned num_formulas, expr * const * formulas, proof * const * prs);
|
||||
|
||||
public:
|
||||
asserted_formulas(ast_manager & m, smt_params & p);
|
||||
asserted_formulas(ast_manager & m, smt_params & smtp, params_ref const& p);
|
||||
~asserted_formulas();
|
||||
|
||||
void updt_params(params_ref const& p);
|
||||
bool has_quantifiers() const { return m_has_quantifiers; }
|
||||
void setup();
|
||||
void assert_expr(expr * e, proof * in_pr);
|
||||
|
|
|
@ -44,7 +44,7 @@ void cached_var_subst::reset() {
|
|||
void cached_var_subst::operator()(quantifier * qa, unsigned num_bindings, smt::enode * const * bindings, expr_ref & result) {
|
||||
m_new_keys.reserve(num_bindings+1, 0);
|
||||
key * new_key = m_new_keys[num_bindings];
|
||||
if (new_key == 0)
|
||||
if (new_key == nullptr)
|
||||
new_key = static_cast<key*>(m_region.allocate(sizeof(key) + sizeof(expr*)*num_bindings));
|
||||
|
||||
new_key->m_qa = qa;
|
||||
|
@ -52,7 +52,7 @@ void cached_var_subst::operator()(quantifier * qa, unsigned num_bindings, smt::e
|
|||
for (unsigned i = 0; i < num_bindings; i++)
|
||||
new_key->m_bindings[i] = bindings[i]->get_owner();
|
||||
|
||||
instances::entry * entry = m_instances.insert_if_not_there2(new_key, 0);
|
||||
instances::entry * entry = m_instances.insert_if_not_there2(new_key, nullptr);
|
||||
if (entry->get_data().m_key != new_key) {
|
||||
SASSERT(entry->get_data().m_value != 0);
|
||||
// entry was already there
|
||||
|
|
|
@ -47,8 +47,7 @@ float cost_evaluator::eval(expr * f) const {
|
|||
return 1.0f;
|
||||
return 0.0f;
|
||||
case OP_ITE: return E(0) != 0.0f ? E(1) : E(2);
|
||||
case OP_EQ:
|
||||
case OP_IFF: return E(0) == E(1) ? 1.0f : 0.0f;
|
||||
case OP_EQ: return E(0) == E(1) ? 1.0f : 0.0f;
|
||||
case OP_XOR: return E(0) != E(1) ? 1.0f : 0.0f;
|
||||
case OP_IMPLIES:
|
||||
if (E(0) == 0.0f)
|
||||
|
|
|
@ -39,12 +39,12 @@ namespace smt {
|
|||
SASSERT(m_app1->get_id() < m_app2->get_id());
|
||||
}
|
||||
|
||||
virtual char const * get_name() const { return "dyn-ack"; }
|
||||
char const * get_name() const override { return "dyn-ack"; }
|
||||
|
||||
virtual void get_antecedents(conflict_resolution & cr) {
|
||||
void get_antecedents(conflict_resolution & cr) override {
|
||||
}
|
||||
|
||||
virtual void display_debug_info(conflict_resolution & cr, std::ostream & out) {
|
||||
void display_debug_info(conflict_resolution & cr, std::ostream & out) override {
|
||||
ast_manager & m = cr.get_manager();
|
||||
out << "m_app1:\n" << mk_pp(m_app1, m) << "\n";
|
||||
out << "m_app2:\n" << mk_pp(m_app2, m) << "\n";
|
||||
|
@ -70,7 +70,7 @@ namespace smt {
|
|||
}
|
||||
}
|
||||
|
||||
virtual proof * mk_proof(conflict_resolution & cr) {
|
||||
proof * mk_proof(conflict_resolution & cr) override {
|
||||
ast_manager & m = cr.get_manager();
|
||||
context & ctx = cr.get_context();
|
||||
unsigned num_args = m_app1->get_num_args();
|
||||
|
@ -288,8 +288,8 @@ namespace smt {
|
|||
dyn_ack_clause_del_eh(dyn_ack_manager & m):
|
||||
m_manager(m) {
|
||||
}
|
||||
virtual ~dyn_ack_clause_del_eh() {}
|
||||
virtual void operator()(ast_manager & m, clause * cls) {
|
||||
~dyn_ack_clause_del_eh() override {}
|
||||
void operator()(ast_manager & m, clause * cls) override {
|
||||
m_manager.del_clause_eh(cls);
|
||||
dealloc(this);
|
||||
}
|
||||
|
@ -299,7 +299,7 @@ namespace smt {
|
|||
TRACE("dyn_ack", tout << "del_clause_eh: "; m_context.display_clause(tout, cls); tout << "\n";);
|
||||
m_context.m_stats.m_num_del_dyn_ack++;
|
||||
|
||||
app_pair p((app*)0,(app*)0);
|
||||
app_pair p((app*)nullptr,(app*)nullptr);
|
||||
if (m_clause2app_pair.find(cls, p)) {
|
||||
SASSERT(p.first && p.second);
|
||||
m_instantiated.erase(p);
|
||||
|
@ -371,7 +371,7 @@ namespace smt {
|
|||
lits.push_back(mk_eq(n1, n2));
|
||||
clause_del_eh * del_eh = alloc(dyn_ack_clause_del_eh, *this);
|
||||
|
||||
justification * js = 0;
|
||||
justification * js = nullptr;
|
||||
if (m_manager.proofs_enabled())
|
||||
js = alloc(dyn_ack_justification, n1, n2);
|
||||
clause * cls = m_context.mk_clause(lits.size(), lits.c_ptr(), js, CLS_AUX_LEMMA, del_eh);
|
||||
|
@ -423,7 +423,7 @@ namespace smt {
|
|||
lits.push_back(mk_eq(n1, n2));
|
||||
clause_del_eh * del_eh = alloc(dyn_ack_clause_del_eh, *this);
|
||||
|
||||
justification * js = 0;
|
||||
justification * js = nullptr;
|
||||
if (m_manager.proofs_enabled())
|
||||
js = alloc(dyn_ack_justification, n1, n2);
|
||||
clause * cls = m_context.mk_clause(lits.size(), lits.c_ptr(), js, CLS_AUX_LEMMA, del_eh);
|
||||
|
|
|
@ -110,13 +110,15 @@ void expr_context_simplifier::reduce_rec(app * a, expr_ref & result) {
|
|||
case OP_OR:
|
||||
reduce_or(a->get_num_args(), a->get_args(), result);
|
||||
return;
|
||||
case OP_IFF: {
|
||||
expr_ref tmp1(m_manager), tmp2(m_manager);
|
||||
reduce_rec(a->get_arg(0), tmp1);
|
||||
reduce_rec(a->get_arg(1), tmp2);
|
||||
m_simp.mk_iff(tmp1.get(), tmp2.get(), result);
|
||||
return;
|
||||
}
|
||||
case OP_EQ:
|
||||
if (m_manager.is_iff(a)) {
|
||||
expr_ref tmp1(m_manager), tmp2(m_manager);
|
||||
reduce_rec(a->get_arg(0), tmp1);
|
||||
reduce_rec(a->get_arg(1), tmp2);
|
||||
m_simp.mk_iff(tmp1.get(), tmp2.get(), result);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case OP_XOR: {
|
||||
expr_ref tmp1(m_manager), tmp2(m_manager);
|
||||
reduce_rec(a->get_arg(0), tmp1);
|
||||
|
@ -311,7 +313,7 @@ bool expr_context_simplifier::is_false(expr* e) const {
|
|||
//
|
||||
|
||||
expr_strong_context_simplifier::expr_strong_context_simplifier(smt_params& p, ast_manager& m):
|
||||
m_manager(m), m_arith(m), m_fn(0,m), m_solver(m, p) {
|
||||
m_manager(m), m_arith(m), m_fn(nullptr,m), m_solver(m, p) {
|
||||
sort* i_sort = m_arith.mk_int();
|
||||
m_fn = m.mk_func_decl(symbol(0xbeef101), i_sort, m.mk_bool_sort());
|
||||
}
|
||||
|
@ -358,7 +360,7 @@ void expr_strong_context_simplifier::simplify_basic(expr* fml, expr_ref& result)
|
|||
m_solver.push();
|
||||
while (!todo.empty()) {
|
||||
|
||||
r = 0;
|
||||
r = nullptr;
|
||||
ptr_buffer<expr> args;
|
||||
expr* e = todo.back();
|
||||
unsigned pos = parent_ids.back();
|
||||
|
@ -405,7 +407,7 @@ void expr_strong_context_simplifier::simplify_basic(expr* fml, expr_ref& result)
|
|||
self_pos = self_ids.back();
|
||||
sz = a->get_num_args();
|
||||
|
||||
n2 = 0;
|
||||
n2 = nullptr;
|
||||
for (unsigned i = 0; i < sz; ++i) {
|
||||
expr* arg = a->get_arg(i);
|
||||
|
||||
|
@ -580,7 +582,7 @@ void expr_strong_context_simplifier::simplify_model_based(expr* fml, expr_ref& r
|
|||
}
|
||||
assignment_map.insert(a, value);
|
||||
}
|
||||
else if (m.is_iff(a, n1, n2) || m.is_eq(a, n1, n2)) {
|
||||
else if (m.is_eq(a, n1, n2)) {
|
||||
lbool v1 = assignment_map.find(n1);
|
||||
lbool v2 = assignment_map.find(n2);
|
||||
if (v1 == l_undef || v2 == l_undef) {
|
||||
|
@ -620,7 +622,7 @@ void expr_strong_context_simplifier::simplify_model_based(expr* fml, expr_ref& r
|
|||
m_solver.push();
|
||||
while (!todo.empty()) {
|
||||
|
||||
r = 0;
|
||||
r = nullptr;
|
||||
ptr_buffer<expr> args;
|
||||
expr* e = todo.back();
|
||||
unsigned pos = parent_ids.back();
|
||||
|
@ -681,7 +683,7 @@ void expr_strong_context_simplifier::simplify_model_based(expr* fml, expr_ref& r
|
|||
self_pos = self_ids.back();
|
||||
sz = a->get_num_args();
|
||||
|
||||
n2 = 0;
|
||||
n2 = nullptr;
|
||||
for (unsigned i = 0; i < sz; ++i) {
|
||||
expr* arg = a->get_arg(i);
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ namespace smt {
|
|||
m_data(d),
|
||||
m_data_hash(d_h),
|
||||
m_num_args(n),
|
||||
m_args(0) {
|
||||
m_args(nullptr) {
|
||||
m_args = new (r) enode*[n];
|
||||
memcpy(m_args, args, sizeof(enode*) * n);
|
||||
}
|
||||
|
@ -54,7 +54,7 @@ namespace smt {
|
|||
fingerprint * fingerprint_set::insert(void * data, unsigned data_hash, unsigned num_args, enode * const * args) {
|
||||
fingerprint * d = mk_dummy(data, data_hash, num_args, args);
|
||||
if (m_set.contains(d))
|
||||
return 0;
|
||||
return nullptr;
|
||||
TRACE("fingerprint_bug", tout << "1) inserting: " << data_hash << " num_args: " << num_args;
|
||||
for (unsigned i = 0; i < num_args; i++) tout << " " << args[i]->get_owner_id();
|
||||
tout << "\n";);
|
||||
|
@ -64,7 +64,7 @@ namespace smt {
|
|||
TRACE("fingerprint_bug", tout << "failed: " << data_hash << " num_args: " << num_args;
|
||||
for (unsigned i = 0; i < num_args; i++) tout << " " << d->m_args[i]->get_owner_id();
|
||||
tout << "\n";);
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
TRACE("fingerprint_bug", tout << "2) inserting: " << data_hash << " num_args: " << num_args;
|
||||
for (unsigned i = 0; i < num_args; i++) tout << " " << args[i]->get_owner_id();
|
||||
|
|
226
src/smt/mam.cpp
226
src/smt/mam.cpp
|
@ -188,7 +188,7 @@ namespace smt {
|
|||
1) Variables: (f ... X ...)
|
||||
2) Ground terms: (f ... t ...)
|
||||
3) depth 2 joint: (f ... (g ... X ...) ...)
|
||||
Joint2 stores the declartion g, and the position of variable X, and its idx.
|
||||
Joint2 stores the declaration g, and the position of variable X, and its idx.
|
||||
|
||||
\remark Z3 has no support for depth 3 joints (f ... (g ... (h ... X ...) ...) ....)
|
||||
*/
|
||||
|
@ -211,7 +211,7 @@ namespace smt {
|
|||
approx_set m_lbl_set; // singleton set containing m_label
|
||||
/*
|
||||
The following field is an array of tagged pointers.
|
||||
Each positon contains:
|
||||
Each position contains:
|
||||
1- null (no joint), NULL_TAG
|
||||
2- a boxed integer (i.e., register that contains the variable bind) VAR_TAG
|
||||
3- an enode pointer (ground term) GROUND_TERM_TAG
|
||||
|
@ -423,20 +423,20 @@ namespace smt {
|
|||
instruction * curr = head;
|
||||
out << *curr;
|
||||
curr = curr->m_next;
|
||||
while (curr != 0 && curr->m_opcode != CHOOSE && curr->m_opcode != NOOP) {
|
||||
while (curr != nullptr && curr->m_opcode != CHOOSE && curr->m_opcode != NOOP) {
|
||||
out << "\n";
|
||||
out << *curr;
|
||||
curr = curr->m_next;
|
||||
}
|
||||
out << "\n";
|
||||
if (curr != 0) {
|
||||
if (curr != nullptr) {
|
||||
display_children(out, static_cast<choose*>(curr), indent + 1);
|
||||
}
|
||||
}
|
||||
|
||||
void display_children(std::ostream & out, choose * first_child, unsigned indent) const {
|
||||
choose * curr = first_child;
|
||||
while (curr != 0) {
|
||||
while (curr != nullptr) {
|
||||
display_seq(out, curr, indent);
|
||||
curr = curr->m_alt;
|
||||
}
|
||||
|
@ -485,7 +485,7 @@ namespace smt {
|
|||
m_filter_candidates(filter_candidates),
|
||||
m_num_regs(num_args + 1),
|
||||
m_num_choices(0),
|
||||
m_root(0) {
|
||||
m_root(nullptr) {
|
||||
DEBUG_CODE(m_context = 0;);
|
||||
#ifdef _PROFILE_MAM
|
||||
m_counter = 0;
|
||||
|
@ -569,10 +569,9 @@ namespace smt {
|
|||
if (m_context) {
|
||||
ast_manager & m = m_context->get_manager();
|
||||
out << "patterns:\n";
|
||||
ptr_vector<app>::const_iterator it = m_patterns.begin();
|
||||
ptr_vector<app>::const_iterator end = m_patterns.end();
|
||||
for (; it != end; ++it)
|
||||
out << mk_pp(*it, m) << "\n";
|
||||
for (expr* p : m_patterns) {
|
||||
out << mk_pp(p, m) << "\n";
|
||||
}
|
||||
}
|
||||
#endif
|
||||
out << "function: " << m_root_lbl->get_name();
|
||||
|
@ -607,7 +606,7 @@ namespace smt {
|
|||
void * mem = m_region.allocate(size);
|
||||
OP * r = new (mem) OP;
|
||||
r->m_opcode = op;
|
||||
r->m_next = 0;
|
||||
r->m_next = nullptr;
|
||||
#ifdef _PROFILE_MAM
|
||||
r->m_counter = 0;
|
||||
#endif
|
||||
|
@ -696,7 +695,7 @@ namespace smt {
|
|||
|
||||
choose * mk_noop() {
|
||||
choose * r = mk_instr<choose>(NOOP, sizeof(choose));
|
||||
r->m_alt = 0;
|
||||
r->m_alt = nullptr;
|
||||
return r;
|
||||
}
|
||||
|
||||
|
@ -831,10 +830,8 @@ namespace smt {
|
|||
void init(code_tree * t, quantifier * qa, app * mp, unsigned first_idx) {
|
||||
SASSERT(m_ast_manager.is_pattern(mp));
|
||||
#ifdef Z3DEBUG
|
||||
svector<check_mark>::iterator it = m_mark.begin();
|
||||
svector<check_mark>::iterator end = m_mark.end();
|
||||
for (; it != end; ++it) {
|
||||
SASSERT(*it == NOT_CHECKED);
|
||||
for (auto cm : m_mark) {
|
||||
SASSERT(cm == NOT_CHECKED);
|
||||
}
|
||||
#endif
|
||||
m_tree = t;
|
||||
|
@ -865,9 +862,7 @@ namespace smt {
|
|||
That is, during execution time, the variables will be already bound
|
||||
*/
|
||||
bool all_args_are_bound_vars(app * n) {
|
||||
unsigned num_args = n->get_num_args();
|
||||
for (unsigned i = 0; i < num_args; i++) {
|
||||
expr * arg = n->get_arg(i);
|
||||
for (expr* arg : *n) {
|
||||
if (!is_var(arg))
|
||||
return false;
|
||||
if (m_vars[to_var(arg)->get_idx()] == -1)
|
||||
|
@ -884,9 +879,7 @@ namespace smt {
|
|||
if (n->is_ground()) {
|
||||
return;
|
||||
}
|
||||
unsigned num_args = n->get_num_args();
|
||||
for (unsigned i = 0; i < num_args; i++) {
|
||||
expr * arg = n->get_arg(i);
|
||||
for (expr* arg : *n) {
|
||||
if (is_var(arg)) {
|
||||
sz++;
|
||||
unsigned var_id = to_var(arg)->get_idx();
|
||||
|
@ -923,15 +916,12 @@ namespace smt {
|
|||
*/
|
||||
void linearise_core() {
|
||||
m_aux.reset();
|
||||
app * first_app = 0;
|
||||
app * first_app = nullptr;
|
||||
unsigned first_app_reg;
|
||||
unsigned first_app_sz;
|
||||
unsigned first_app_num_unbound_vars;
|
||||
// generate first the non-BIND operations
|
||||
unsigned_vector::iterator it = m_todo.begin();
|
||||
unsigned_vector::iterator end = m_todo.end();
|
||||
for (; it != end; ++it) {
|
||||
unsigned reg = *it;
|
||||
for (unsigned reg : m_todo) {
|
||||
expr * p = m_registers[reg];
|
||||
SASSERT(!is_quantifier(p));
|
||||
if (is_var(p)) {
|
||||
|
@ -1111,7 +1101,7 @@ namespace smt {
|
|||
// multi_pattern support
|
||||
for (unsigned i = 1; i < num_args; i++) {
|
||||
// select the pattern with the biggest number of bound variables
|
||||
app * best = 0;
|
||||
app * best = nullptr;
|
||||
unsigned best_num_bvars = 0;
|
||||
unsigned best_j = 0;
|
||||
bool found_bounded_mp = false;
|
||||
|
@ -1127,7 +1117,7 @@ namespace smt {
|
|||
found_bounded_mp = true;
|
||||
break;
|
||||
}
|
||||
if (best == 0 || (num_bvars > best_num_bvars)) {
|
||||
if (best == nullptr || (num_bvars > best_num_bvars)) {
|
||||
best = p;
|
||||
best_num_bvars = num_bvars;
|
||||
best_j = j;
|
||||
|
@ -1249,10 +1239,7 @@ namespace smt {
|
|||
SASSERT(head->m_next == 0);
|
||||
m_seq.push_back(m_ct_manager.mk_yield(m_qa, m_mp, m_qa->get_num_decls(), reinterpret_cast<unsigned*>(m_vars.begin())));
|
||||
|
||||
ptr_vector<instruction>::iterator it = m_seq.begin();
|
||||
ptr_vector<instruction>::iterator end = m_seq.end();
|
||||
for (; it != end; ++it) {
|
||||
instruction * curr = *it;
|
||||
for (instruction * curr : m_seq) {
|
||||
head->m_next = curr;
|
||||
head = curr;
|
||||
}
|
||||
|
@ -1286,16 +1273,16 @@ namespace smt {
|
|||
|
||||
choose * find_best_child(choose * first_child) {
|
||||
unsigned num_too_simple = 0;
|
||||
choose * best_child = 0;
|
||||
choose * best_child = nullptr;
|
||||
unsigned max_compatibility = 0;
|
||||
choose * curr_child = first_child;
|
||||
while (curr_child != 0) {
|
||||
while (curr_child != nullptr) {
|
||||
bool simple = false;
|
||||
unsigned curr_compatibility = get_compatibility_measure(curr_child, simple);
|
||||
if (simple) {
|
||||
num_too_simple++;
|
||||
if (num_too_simple > FIND_BEST_CHILD_THRESHOLD)
|
||||
return 0; // it is unlikely we will find a compatible node
|
||||
return nullptr; // it is unlikely we will find a compatible node
|
||||
}
|
||||
if (curr_compatibility > max_compatibility) {
|
||||
best_child = curr_child;
|
||||
|
@ -1310,7 +1297,7 @@ namespace smt {
|
|||
unsigned ireg = instr->m_ireg;
|
||||
expr * n = m_registers[ireg];
|
||||
return
|
||||
n != 0 &&
|
||||
n != nullptr &&
|
||||
is_app(n) &&
|
||||
// It is wasteful to use a bind of a ground term.
|
||||
// Actually, in the rest of the code I assume that.
|
||||
|
@ -1450,7 +1437,7 @@ namespace smt {
|
|||
unsigned weight = 0;
|
||||
unsigned num_instr = 0;
|
||||
instruction * curr = child->m_next;
|
||||
while (curr != 0 && curr->m_opcode != CHOOSE && curr->m_opcode != NOOP) {
|
||||
while (curr != nullptr && curr->m_opcode != CHOOSE && curr->m_opcode != NOOP) {
|
||||
num_instr++;
|
||||
switch (curr->m_opcode) {
|
||||
case BIND1: case BIND2: case BIND3: case BIND4: case BIND5: case BIND6: case BINDN:
|
||||
|
@ -1493,12 +1480,10 @@ namespace smt {
|
|||
}
|
||||
curr = curr->m_next;
|
||||
}
|
||||
if (num_instr > SIMPLE_SEQ_THRESHOLD || (curr != 0 && curr->m_opcode == CHOOSE))
|
||||
if (num_instr > SIMPLE_SEQ_THRESHOLD || (curr != nullptr && curr->m_opcode == CHOOSE))
|
||||
simple = false;
|
||||
unsigned_vector::iterator it = m_to_reset.begin();
|
||||
unsigned_vector::iterator end = m_to_reset.end();
|
||||
for (; it != end; ++it)
|
||||
m_registers[*it] = 0;
|
||||
for (unsigned reg : m_to_reset)
|
||||
m_registers[reg] = 0;
|
||||
return weight;
|
||||
}
|
||||
|
||||
|
@ -1509,7 +1494,7 @@ namespace smt {
|
|||
TRACE("mam_compiler_detail", tout << "processing head: " << *head << "\n";);
|
||||
instruction * curr = head->m_next;
|
||||
instruction * last = head;
|
||||
while (curr != 0 && curr->m_opcode != CHOOSE && curr->m_opcode != NOOP) {
|
||||
while (curr != nullptr && curr->m_opcode != CHOOSE && curr->m_opcode != NOOP) {
|
||||
TRACE("mam_compiler_detail", tout << "processing instr: " << *curr << "\n";);
|
||||
switch (curr->m_opcode) {
|
||||
case BIND1: case BIND2: case BIND3: case BIND4: case BIND5: case BIND6: case BINDN:
|
||||
|
@ -1680,7 +1665,7 @@ namespace smt {
|
|||
SASSERT(curr->m_opcode == CHOOSE);
|
||||
choose * first_child = static_cast<choose *>(curr);
|
||||
choose * best_child = find_best_child(first_child);
|
||||
if (best_child == 0) {
|
||||
if (best_child == nullptr) {
|
||||
// There is no compatible child
|
||||
// Suppose the sequence is:
|
||||
// head -> c1 -> ... -> (cn == last) -> first_child;
|
||||
|
@ -1716,23 +1701,19 @@ namespace smt {
|
|||
m_num_choices++;
|
||||
// set: head -> c1 -> c2 -> c3 -> new_child_head1
|
||||
curr = head;
|
||||
ptr_vector<instruction>::iterator it1 = m_compatible.begin();
|
||||
ptr_vector<instruction>::iterator end1 = m_compatible.end();
|
||||
for (; it1 != end1; ++it1) {
|
||||
set_next(curr, *it1);
|
||||
curr = *it1;
|
||||
for (instruction* instr : m_compatible) {
|
||||
set_next(curr, instr);
|
||||
curr = instr;
|
||||
}
|
||||
set_next(curr, new_child_head1);
|
||||
// set: new_child_head1:CHOOSE(new_child_head2) -> i1 -> i2 -> first_child_head
|
||||
curr = new_child_head1;
|
||||
ptr_vector<instruction>::iterator it2 = m_incompatible.begin();
|
||||
ptr_vector<instruction>::iterator end2 = m_incompatible.end();
|
||||
for (; it2 != end2; ++it2) {
|
||||
for (instruction* inc : m_incompatible) {
|
||||
if (curr == new_child_head1)
|
||||
curr->m_next = *it2; // new_child_head1 is a new node, I don't need to save trail
|
||||
curr->m_next = inc; // new_child_head1 is a new node, I don't need to save trail
|
||||
else
|
||||
set_next(curr, *it2);
|
||||
curr = *it2;
|
||||
set_next(curr, inc);
|
||||
curr = inc;
|
||||
}
|
||||
set_next(curr, first_child_head);
|
||||
// build new_child_head2:NOOP -> linearise()
|
||||
|
@ -1902,7 +1883,7 @@ namespace smt {
|
|||
curr = curr->get_next();
|
||||
}
|
||||
while (curr != first);
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
enode * get_next_f_app(func_decl * lbl, unsigned num_expected_args, enode * first, enode * curr) {
|
||||
|
@ -1914,7 +1895,7 @@ namespace smt {
|
|||
}
|
||||
curr = curr->get_next();
|
||||
}
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2094,7 +2075,7 @@ namespace smt {
|
|||
enode_vector * interpreter::mk_depth2_vector(joint2 * j2, func_decl * f, unsigned i) {
|
||||
enode * n = m_registers[j2->m_reg]->get_root();
|
||||
if (n->get_num_parents() == 0)
|
||||
return 0;
|
||||
return nullptr;
|
||||
unsigned num_args = n->get_num_args();
|
||||
enode_vector * v = mk_enode_vector();
|
||||
enode_vector::const_iterator it1 = n->begin_parents();
|
||||
|
@ -2132,7 +2113,7 @@ namespace smt {
|
|||
// quick filter... check if any of the joint points have zero parents...
|
||||
for (unsigned i = 0; i < num_args; i++) {
|
||||
void * bare = c->m_joints[i];
|
||||
enode * n = 0;
|
||||
enode * n = nullptr;
|
||||
switch (GET_TAG(bare)) {
|
||||
case NULL_TAG:
|
||||
goto non_depth1;
|
||||
|
@ -2147,20 +2128,20 @@ namespace smt {
|
|||
}
|
||||
r = n->get_root();
|
||||
if (m_use_filters && r->get_plbls().empty_intersection(c->m_lbl_set))
|
||||
return 0;
|
||||
return nullptr;
|
||||
if (r->get_num_parents() == 0)
|
||||
return 0;
|
||||
return nullptr;
|
||||
non_depth1:
|
||||
;
|
||||
}
|
||||
// traverse each joint and select the best one.
|
||||
enode_vector * best_v = 0;
|
||||
enode_vector * best_v = nullptr;
|
||||
for (unsigned i = 0; i < num_args; i++) {
|
||||
enode * bare = c->m_joints[i];
|
||||
enode_vector * curr_v = 0;
|
||||
enode_vector * curr_v = nullptr;
|
||||
switch (GET_TAG(bare)) {
|
||||
case NULL_TAG:
|
||||
curr_v = 0;
|
||||
curr_v = nullptr;
|
||||
break;
|
||||
case GROUND_TERM_TAG:
|
||||
curr_v = mk_depth1_vector(UNTAG(enode *, bare), lbl, i);
|
||||
|
@ -2172,14 +2153,14 @@ namespace smt {
|
|||
curr_v = mk_depth2_vector(UNTAG(joint2 *, bare), lbl, i);
|
||||
break;
|
||||
}
|
||||
if (curr_v != 0) {
|
||||
if (curr_v->size() < min_sz && (best_v == 0 || curr_v->size() < best_v->size())) {
|
||||
if (curr_v != nullptr) {
|
||||
if (curr_v->size() < min_sz && (best_v == nullptr || curr_v->size() < best_v->size())) {
|
||||
if (best_v)
|
||||
recycle_enode_vector(best_v);
|
||||
best_v = curr_v;
|
||||
if (best_v->empty()) {
|
||||
recycle_enode_vector(best_v);
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@ -2191,10 +2172,10 @@ namespace smt {
|
|||
bp.m_instr = c;
|
||||
bp.m_old_max_generation = m_max_generation;
|
||||
bp.m_old_used_enodes_size = m_used_enodes.size();
|
||||
if (best_v == 0) {
|
||||
if (best_v == nullptr) {
|
||||
TRACE("mam_bug", tout << "m_top: " << m_top << ", m_backtrack_stack.size(): " << m_backtrack_stack.size() << "\n";
|
||||
tout << *c << "\n";);
|
||||
bp.m_to_recycle = 0;
|
||||
bp.m_to_recycle = nullptr;
|
||||
bp.m_it = m_context.begin_enodes_of(lbl);
|
||||
bp.m_end = m_context.end_enodes_of(lbl);
|
||||
}
|
||||
|
@ -2211,7 +2192,7 @@ namespace smt {
|
|||
break;
|
||||
}
|
||||
if (bp.m_it == bp.m_end)
|
||||
return 0;
|
||||
return nullptr;
|
||||
m_top++;
|
||||
update_max_generation(*(bp.m_it));
|
||||
return *(bp.m_it);
|
||||
|
@ -2648,7 +2629,7 @@ namespace smt {
|
|||
m_num_args = static_cast<const cont *>(m_pc)->m_num_args;
|
||||
m_oreg = static_cast<const cont *>(m_pc)->m_oreg;
|
||||
m_app = init_continue(static_cast<const cont *>(m_pc), m_num_args);
|
||||
if (m_app == 0)
|
||||
if (m_app == nullptr)
|
||||
goto backtrack;
|
||||
m_pattern_instances.push_back(m_app);
|
||||
TRACE("mam_int", tout << "continue candidate:\n" << mk_ll_pp(m_app->get_owner(), m_ast_manager););
|
||||
|
@ -2844,7 +2825,7 @@ namespace smt {
|
|||
unsigned m_lbl_id;
|
||||
public:
|
||||
mk_tree_trail(ptr_vector<code_tree> & t, unsigned id):m_trees(t), m_lbl_id(id) {}
|
||||
virtual void undo(mam_impl & m) {
|
||||
void undo(mam_impl & m) override {
|
||||
dealloc(m_trees[m_lbl_id]);
|
||||
m_trees[m_lbl_id] = 0;
|
||||
}
|
||||
|
@ -2911,7 +2892,7 @@ namespace smt {
|
|||
if (lbl_id < m_trees.size())
|
||||
return m_trees[lbl_id];
|
||||
else
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
ptr_vector<code_tree>::iterator begin_code_trees() {
|
||||
|
@ -2974,11 +2955,11 @@ namespace smt {
|
|||
if (p1->m_label != p2->m_label ||
|
||||
p1->m_arg_idx != p2->m_arg_idx ||
|
||||
p1->m_pattern_idx != p2->m_pattern_idx ||
|
||||
(p1->m_child == 0) != (p2->m_child == 0)) {
|
||||
(p1->m_child == nullptr) != (p2->m_child == nullptr)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (p1->m_child == 0 && p2->m_child == 0)
|
||||
if (p1->m_child == nullptr && p2->m_child == nullptr)
|
||||
return true;
|
||||
|
||||
p1 = p1->m_child;
|
||||
|
@ -3014,11 +2995,11 @@ namespace smt {
|
|||
m_arg_idx(p->m_arg_idx),
|
||||
m_ground_arg_idx(p->m_ground_arg_idx),
|
||||
m_ground_arg(p->m_ground_arg),
|
||||
m_code(0),
|
||||
m_code(nullptr),
|
||||
m_filter(h(p->m_label)),
|
||||
m_sibling(0),
|
||||
m_first_child(0),
|
||||
m_todo(0) {
|
||||
m_sibling(nullptr),
|
||||
m_first_child(nullptr),
|
||||
m_todo(nullptr) {
|
||||
#ifdef _PROFILE_PATH_TREE
|
||||
m_counter = 0;
|
||||
m_num_eq_visited = 0;
|
||||
|
@ -3029,7 +3010,7 @@ namespace smt {
|
|||
|
||||
void display(std::ostream & out, unsigned indent) {
|
||||
path_tree * curr = this;
|
||||
while (curr != 0) {
|
||||
while (curr != nullptr) {
|
||||
for (unsigned i = 0; i < indent; i++) out << " ";
|
||||
out << curr->m_label->get_name() << ":" << curr->m_arg_idx;
|
||||
if (curr->m_ground_arg)
|
||||
|
@ -3104,7 +3085,7 @@ namespace smt {
|
|||
enode * m_enode;
|
||||
public:
|
||||
add_shared_enode_trail(enode * n):m_enode(n) {}
|
||||
virtual void undo(mam_impl & m) { m.m_shared_enodes.erase(m_enode); }
|
||||
void undo(mam_impl & m) override { m.m_shared_enodes.erase(m_enode); }
|
||||
};
|
||||
|
||||
#ifdef Z3DEBUG
|
||||
|
@ -3122,7 +3103,7 @@ namespace smt {
|
|||
}
|
||||
|
||||
void add_candidate(code_tree * t, enode * app) {
|
||||
if (t != 0) {
|
||||
if (t != nullptr) {
|
||||
TRACE("mam_candidate", tout << "adding candidate:\n" << mk_ll_pp(app->get_owner(), m_ast_manager););
|
||||
if (!t->has_candidates())
|
||||
m_to_match.push_back(t);
|
||||
|
@ -3221,7 +3202,7 @@ namespace smt {
|
|||
for (unsigned j = 0; j < APPROX_SET_CAPACITY; j++) {
|
||||
m_pp[i][j].first = 0;
|
||||
m_pp[i][j].second = 0;
|
||||
m_pc[i][j] = 0;
|
||||
m_pc[i][j] = nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3240,10 +3221,10 @@ namespace smt {
|
|||
SASSERT(m_ast_manager.is_pattern(mp));
|
||||
SASSERT(p != 0);
|
||||
unsigned pat_idx = p->m_pattern_idx;
|
||||
path_tree * head = 0;
|
||||
path_tree * curr = 0;
|
||||
path_tree * prev = 0;
|
||||
while (p != 0) {
|
||||
path_tree * head = nullptr;
|
||||
path_tree * curr = nullptr;
|
||||
path_tree * prev = nullptr;
|
||||
while (p != nullptr) {
|
||||
curr = new (m_region) path_tree(p, m_lbl_hasher);
|
||||
if (prev)
|
||||
prev->m_first_child = curr;
|
||||
|
@ -3260,9 +3241,9 @@ namespace smt {
|
|||
void insert(path_tree * t, path * p, quantifier * qa, app * mp) {
|
||||
SASSERT(m_ast_manager.is_pattern(mp));
|
||||
path_tree * head = t;
|
||||
path_tree * prev_sibling = 0;
|
||||
path_tree * prev_sibling = nullptr;
|
||||
bool found_label = false;
|
||||
while (t != 0) {
|
||||
while (t != nullptr) {
|
||||
if (t->m_label == p->m_label) {
|
||||
found_label = true;
|
||||
if (t->m_arg_idx == p->m_arg_idx &&
|
||||
|
@ -3270,8 +3251,8 @@ namespace smt {
|
|||
t->m_ground_arg_idx == p->m_ground_arg_idx
|
||||
) {
|
||||
// found compatible node
|
||||
if (t->m_first_child == 0) {
|
||||
if (p->m_child == 0) {
|
||||
if (t->m_first_child == nullptr) {
|
||||
if (p->m_child == nullptr) {
|
||||
SASSERT(t->m_code != 0);
|
||||
insert_code(t, qa, mp, p->m_pattern_idx);
|
||||
}
|
||||
|
@ -3281,7 +3262,7 @@ namespace smt {
|
|||
}
|
||||
}
|
||||
else {
|
||||
if (p->m_child == 0) {
|
||||
if (p->m_child == nullptr) {
|
||||
if (t->m_code) {
|
||||
insert_code(t, qa, mp, p->m_pattern_idx);
|
||||
}
|
||||
|
@ -3367,10 +3348,7 @@ namespace smt {
|
|||
void update_vars(unsigned short var_id, path * p, quantifier * qa, app * mp) {
|
||||
paths & var_paths = m_var_paths[var_id];
|
||||
bool found = false;
|
||||
paths::iterator it = var_paths.begin();
|
||||
paths::iterator end = var_paths.end();
|
||||
for (; it != end; ++it) {
|
||||
path * curr_path = *it;
|
||||
for (path* curr_path : var_paths) {
|
||||
if (is_equal(p, curr_path))
|
||||
found = true;
|
||||
func_decl * lbl1 = curr_path->m_label;
|
||||
|
@ -3393,7 +3371,7 @@ namespace smt {
|
|||
return mk_enode(m_context, qa, to_app(arg));
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -3460,7 +3438,7 @@ namespace smt {
|
|||
unsigned num_patterns = mp->get_num_args();
|
||||
for (unsigned i = 0; i < num_patterns; i++) {
|
||||
app * pat = to_app(mp->get_arg(i));
|
||||
update_filters(pat, 0, qa, mp, i);
|
||||
update_filters(pat, nullptr, qa, mp, i);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3496,7 +3474,7 @@ namespace smt {
|
|||
\brief Collect new E-matching candidates using the inverted path index t.
|
||||
*/
|
||||
void collect_parents(enode * r, path_tree * t) {
|
||||
if (t == 0)
|
||||
if (t == nullptr)
|
||||
return;
|
||||
#ifdef _PROFILE_PATH_TREE
|
||||
t->m_watch.start();
|
||||
|
@ -3604,7 +3582,7 @@ namespace smt {
|
|||
// Filter 2.
|
||||
(
|
||||
// curr_tree has no support for the filter based on a ground argument.
|
||||
curr_tree->m_ground_arg == 0 ||
|
||||
curr_tree->m_ground_arg == nullptr ||
|
||||
// checks whether the child of the parent is equal to the expected ground argument.
|
||||
is_eq(curr_tree->m_ground_arg, curr_parent->get_arg(curr_tree->m_ground_arg_idx))
|
||||
)) {
|
||||
|
@ -3614,7 +3592,7 @@ namespace smt {
|
|||
}
|
||||
if (curr_tree->m_first_child) {
|
||||
path_tree * child = curr_tree->m_first_child;
|
||||
if (child->m_todo == 0) {
|
||||
if (child->m_todo == nullptr) {
|
||||
child->m_todo = mk_tmp_vector();
|
||||
m_todo.push_back(child);
|
||||
}
|
||||
|
@ -3636,7 +3614,7 @@ namespace smt {
|
|||
}
|
||||
}
|
||||
recycle(t->m_todo);
|
||||
t->m_todo = 0;
|
||||
t->m_todo = nullptr;
|
||||
// remove both marks.
|
||||
unmark_enodes(to_unmark->size(), to_unmark->c_ptr());
|
||||
unmark_enodes2(to_unmark2->size(), to_unmark2->c_ptr());
|
||||
|
@ -3661,18 +3639,12 @@ namespace smt {
|
|||
TRACE("incremental_matcher", tout << "pp: plbls1: " << plbls1 << ", plbls2: " << plbls2 << "\n";);
|
||||
TRACE("mam_info", tout << "pp: " << plbls1.size() * plbls2.size() << "\n";);
|
||||
if (!plbls1.empty() && !plbls2.empty()) {
|
||||
approx_set::iterator it1 = plbls1.begin();
|
||||
approx_set::iterator end1 = plbls1.end();
|
||||
for (; it1 != end1; ++it1) {
|
||||
for (unsigned plbl1 : plbls1) {
|
||||
if (m_context.get_cancel_flag()) {
|
||||
break;
|
||||
}
|
||||
unsigned plbl1 = *it1;
|
||||
SASSERT(plbls1.may_contain(plbl1));
|
||||
approx_set::iterator it2 = plbls2.begin();
|
||||
approx_set::iterator end2 = plbls2.end();
|
||||
for (; it2 != end2; ++it2) {
|
||||
unsigned plbl2 = *it2;
|
||||
for (unsigned plbl2 : plbls2) {
|
||||
SASSERT(plbls2.may_contain(plbl2));
|
||||
unsigned n_plbl1 = plbl1;
|
||||
unsigned n_plbl2 = plbl2;
|
||||
|
@ -3812,18 +3784,18 @@ namespace smt {
|
|||
m_interpreter(ctx, *this, use_filters),
|
||||
m_trees(m_ast_manager, m_compiler, m_trail_stack),
|
||||
m_region(m_trail_stack.get_region()),
|
||||
m_r1(0),
|
||||
m_r2(0) {
|
||||
m_r1(nullptr),
|
||||
m_r2(nullptr) {
|
||||
DEBUG_CODE(m_trees.set_context(&ctx););
|
||||
DEBUG_CODE(m_check_missing_instances = false;);
|
||||
reset_pp_pc();
|
||||
}
|
||||
|
||||
virtual ~mam_impl() {
|
||||
~mam_impl() override {
|
||||
m_trail_stack.reset();
|
||||
}
|
||||
|
||||
virtual void add_pattern(quantifier * qa, app * mp) {
|
||||
void add_pattern(quantifier * qa, app * mp) override {
|
||||
SASSERT(m_ast_manager.is_pattern(mp));
|
||||
TRACE("trigger_bug", tout << "adding pattern\n" << mk_ismt2_pp(qa, m_ast_manager) << "\n" << mk_ismt2_pp(mp, m_ast_manager) << "\n";);
|
||||
TRACE("mam_bug", tout << "adding pattern\n" << mk_pp(qa, m_ast_manager) << "\n" << mk_pp(mp, m_ast_manager) << "\n";);
|
||||
|
@ -3846,11 +3818,11 @@ namespace smt {
|
|||
m_trees.add_pattern(qa, mp, i);
|
||||
}
|
||||
|
||||
virtual void push_scope() {
|
||||
void push_scope() override {
|
||||
m_trail_stack.push_scope();
|
||||
}
|
||||
|
||||
virtual void pop_scope(unsigned num_scopes) {
|
||||
void pop_scope(unsigned num_scopes) override {
|
||||
if (!m_to_match.empty()) {
|
||||
ptr_vector<code_tree>::iterator it = m_to_match.begin();
|
||||
ptr_vector<code_tree>::iterator end = m_to_match.end();
|
||||
|
@ -3864,7 +3836,7 @@ namespace smt {
|
|||
m_trail_stack.pop_scope(num_scopes);
|
||||
}
|
||||
|
||||
virtual void reset() {
|
||||
void reset() override {
|
||||
m_trail_stack.reset();
|
||||
m_trees.reset();
|
||||
m_to_match.reset();
|
||||
|
@ -3875,7 +3847,7 @@ namespace smt {
|
|||
m_tmp_region.reset();
|
||||
}
|
||||
|
||||
virtual void display(std::ostream& out) {
|
||||
void display(std::ostream& out) override {
|
||||
out << "mam:\n";
|
||||
m_lbl_hasher.display(out);
|
||||
ptr_vector<code_tree>::iterator it = m_trees.begin_code_trees();
|
||||
|
@ -3886,7 +3858,7 @@ namespace smt {
|
|||
}
|
||||
}
|
||||
|
||||
virtual void match() {
|
||||
void match() override {
|
||||
TRACE("trigger_bug", tout << "match\n"; display(tout););
|
||||
ptr_vector<code_tree>::iterator it = m_to_match.begin();
|
||||
ptr_vector<code_tree>::iterator end = m_to_match.end();
|
||||
|
@ -3903,7 +3875,7 @@ namespace smt {
|
|||
}
|
||||
}
|
||||
|
||||
virtual void rematch(bool use_irrelevant) {
|
||||
void rematch(bool use_irrelevant) override {
|
||||
ptr_vector<code_tree>::iterator it = m_trees.begin_code_trees();
|
||||
ptr_vector<code_tree>::iterator end = m_trees.end_code_trees();
|
||||
unsigned lbl = 0;
|
||||
|
@ -3924,7 +3896,7 @@ namespace smt {
|
|||
}
|
||||
|
||||
#ifdef Z3DEBUG
|
||||
virtual bool check_missing_instances() {
|
||||
bool check_missing_instances() override {
|
||||
TRACE("missing_instance", tout << "checking for missing instances...\n";);
|
||||
flet<bool> l(m_check_missing_instances, true);
|
||||
rematch(false);
|
||||
|
@ -3932,7 +3904,7 @@ namespace smt {
|
|||
}
|
||||
#endif
|
||||
|
||||
virtual void on_match(quantifier * qa, app * pat, unsigned num_bindings, enode * const * bindings, unsigned max_generation, ptr_vector<enode> & used_enodes) {
|
||||
void on_match(quantifier * qa, app * pat, unsigned num_bindings, enode * const * bindings, unsigned max_generation, ptr_vector<enode> & used_enodes) override {
|
||||
TRACE("trigger_bug", tout << "found match " << mk_pp(qa, m_ast_manager) << "\n";);
|
||||
#ifdef Z3DEBUG
|
||||
if (m_check_missing_instances) {
|
||||
|
@ -3955,13 +3927,13 @@ namespace smt {
|
|||
m_context.add_instance(qa, pat, num_bindings, bindings, max_generation, min_gen, max_gen, used_enodes);
|
||||
}
|
||||
|
||||
virtual bool is_shared(enode * n) const {
|
||||
bool is_shared(enode * n) const override {
|
||||
return !m_shared_enodes.empty() && m_shared_enodes.contains(n);
|
||||
}
|
||||
|
||||
// This method is invoked when n becomes relevant.
|
||||
// If lazy == true, then n is not added to the list of candidate enodes for matching. That is, the method just updates the lbls.
|
||||
virtual void relevant_eh(enode * n, bool lazy) {
|
||||
void relevant_eh(enode * n, bool lazy) override {
|
||||
TRACE("trigger_bug", tout << "relevant_eh:\n" << mk_ismt2_pp(n->get_owner(), m_ast_manager) << "\n";
|
||||
tout << "mam: " << this << "\n";);
|
||||
TRACE("mam", tout << "relevant_eh: #" << n->get_owner_id() << "\n";);
|
||||
|
@ -3984,11 +3956,11 @@ namespace smt {
|
|||
}
|
||||
}
|
||||
|
||||
virtual bool has_work() const {
|
||||
bool has_work() const override {
|
||||
return !m_to_match.empty() || !m_new_patterns.empty();
|
||||
}
|
||||
|
||||
virtual void add_eq_eh(enode * r1, enode * r2) {
|
||||
void add_eq_eh(enode * r1, enode * r2) override {
|
||||
flet<enode *> l1(m_r1, r1);
|
||||
flet<enode *> l2(m_r2, r2);
|
||||
|
||||
|
|
|
@ -157,8 +157,8 @@ interval::interval(v_dependency_manager & m):
|
|||
m_upper(true),
|
||||
m_lower_open(true),
|
||||
m_upper_open(true),
|
||||
m_lower_dep(0),
|
||||
m_upper_dep(0) {
|
||||
m_lower_dep(nullptr),
|
||||
m_upper_dep(nullptr) {
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -215,12 +215,12 @@ interval::interval(v_dependency_manager & m, rational const & val, bool open, bo
|
|||
m_lower_dep = d;
|
||||
m_upper = ext_numeral(true);
|
||||
m_upper_open = true;
|
||||
m_upper_dep = 0;
|
||||
m_upper_dep = nullptr;
|
||||
}
|
||||
else {
|
||||
m_lower = ext_numeral(false);
|
||||
m_lower_open = true;
|
||||
m_lower_dep = 0;
|
||||
m_lower_dep = nullptr;
|
||||
m_upper = ext_numeral(val);
|
||||
m_upper_open = open;
|
||||
m_upper_dep = d;
|
||||
|
@ -252,8 +252,8 @@ interval & interval::operator+=(interval const & other) {
|
|||
m_upper += other.m_upper;
|
||||
m_lower_open |= other.m_lower_open;
|
||||
m_upper_open |= other.m_upper_open;
|
||||
m_lower_dep = m_lower.is_infinite() ? 0 : m_manager.mk_join(m_lower_dep, other.m_lower_dep);
|
||||
m_upper_dep = m_upper.is_infinite() ? 0 : m_manager.mk_join(m_upper_dep, other.m_upper_dep);
|
||||
m_lower_dep = m_lower.is_infinite() ? nullptr : m_manager.mk_join(m_lower_dep, other.m_lower_dep);
|
||||
m_upper_dep = m_upper.is_infinite() ? nullptr : m_manager.mk_join(m_upper_dep, other.m_upper_dep);
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
@ -283,7 +283,7 @@ v_dependency * interval::join_opt(v_dependency * d1, v_dependency * d2, v_depend
|
|||
return join(d1, d2);
|
||||
if (opt2 == d1 || opt2 == d2)
|
||||
return join(d1, d2);
|
||||
if (opt1 == 0 || opt2 == 0)
|
||||
if (opt1 == nullptr || opt2 == nullptr)
|
||||
return join(d1, d2);
|
||||
// TODO: more opts...
|
||||
return join(d1, d2, opt1);
|
||||
|
@ -331,8 +331,8 @@ interval & interval::operator*=(interval const & other) {
|
|||
m_upper_open = a_o || c_o; SASSERT(a.is_neg() && c.is_neg());
|
||||
m_lower = new_lower;
|
||||
m_upper = new_upper;
|
||||
m_lower_dep = m_lower.is_infinite() ? 0 : join(b_d, d_d);
|
||||
m_upper_dep = m_upper.is_infinite() ? 0 : join_opt(a_d, c_d, b_d, d_d);
|
||||
m_lower_dep = m_lower.is_infinite() ? nullptr : join(b_d, d_d);
|
||||
m_upper_dep = m_upper.is_infinite() ? nullptr : join_opt(a_d, c_d, b_d, d_d);
|
||||
}
|
||||
else if (other.is_M()) {
|
||||
// a <= x <= b <= 0, y <= d, d > 0 --> a*d <= x*y (uses the fact that b is not positive)
|
||||
|
@ -344,8 +344,8 @@ interval & interval::operator*=(interval const & other) {
|
|||
m_upper_open = a_o || c_o;
|
||||
m_lower = new_lower;
|
||||
m_upper = new_upper;
|
||||
m_lower_dep = m_lower.is_infinite() ? 0 : join(a_d, d_d, b_d);
|
||||
m_upper_dep = m_upper.is_infinite() ? 0 : join(a_d, c_d, b_d);
|
||||
m_lower_dep = m_lower.is_infinite() ? nullptr : join(a_d, d_d, b_d);
|
||||
m_upper_dep = m_upper.is_infinite() ? nullptr : join(a_d, c_d, b_d);
|
||||
}
|
||||
else {
|
||||
// a <= x <= b <= 0, 0 <= c <= y <= d --> a*d <= x*y (uses the fact that x is neg (b is not positive) or y is pos (c is not negative))
|
||||
|
@ -359,8 +359,8 @@ interval & interval::operator*=(interval const & other) {
|
|||
m_upper_open = (is_N0_old || other.is_P0()) ? false : (b_o || c_o);
|
||||
m_lower = new_lower;
|
||||
m_upper = new_upper;
|
||||
m_lower_dep = m_lower.is_infinite() ? 0 : join_opt(a_d, d_d, b_d, c_d);
|
||||
m_upper_dep = m_upper.is_infinite() ? 0 : join(b_d, c_d);
|
||||
m_lower_dep = m_lower.is_infinite() ? nullptr : join_opt(a_d, d_d, b_d, c_d);
|
||||
m_upper_dep = m_upper.is_infinite() ? nullptr : join(b_d, c_d);
|
||||
}
|
||||
}
|
||||
else if (is_M()) {
|
||||
|
@ -374,8 +374,8 @@ interval & interval::operator*=(interval const & other) {
|
|||
m_upper_open = a_o || c_o; SASSERT(a.is_neg() && c.is_neg());
|
||||
m_lower = new_lower;
|
||||
m_upper = new_upper;
|
||||
m_lower_dep = m_lower.is_infinite() ? 0 : join(b_d, c_d, d_d);
|
||||
m_upper_dep = m_upper.is_infinite() ? 0 : join(a_d, c_d, d_d);
|
||||
m_lower_dep = m_lower.is_infinite() ? nullptr : join(b_d, c_d, d_d);
|
||||
m_upper_dep = m_upper.is_infinite() ? nullptr : join(a_d, c_d, d_d);
|
||||
}
|
||||
else if (other.is_M()) {
|
||||
TRACE("interval_bug", tout << "(M, M)\n";);
|
||||
|
@ -404,8 +404,8 @@ interval & interval::operator*=(interval const & other) {
|
|||
m_upper = bd;
|
||||
m_upper_open = bd_o;
|
||||
}
|
||||
m_lower_dep = m_lower.is_infinite() ? 0 : join(a_d, b_d, c_d, d_d);
|
||||
m_upper_dep = m_upper.is_infinite() ? 0 : join(a_d, b_d, c_d, d_d);
|
||||
m_lower_dep = m_lower.is_infinite() ? nullptr : join(a_d, b_d, c_d, d_d);
|
||||
m_upper_dep = m_upper.is_infinite() ? nullptr : join(a_d, b_d, c_d, d_d);
|
||||
}
|
||||
else {
|
||||
// a < 0, a <= x, 0 <= c <= y <= d --> a*d <= x*y (uses the fact that c is not negative)
|
||||
|
@ -418,8 +418,8 @@ interval & interval::operator*=(interval const & other) {
|
|||
m_upper_open = b_o || d_o; SASSERT(b.is_pos() && d.is_pos());
|
||||
m_lower = new_lower;
|
||||
m_upper = new_upper;
|
||||
m_lower_dep = m_lower.is_infinite() ? 0 : join(a_d, d_d, c_d);
|
||||
m_upper_dep = m_upper.is_infinite() ? 0 : join(b_d, d_d, c_d);
|
||||
m_lower_dep = m_lower.is_infinite() ? nullptr : join(a_d, d_d, c_d);
|
||||
m_upper_dep = m_upper.is_infinite() ? nullptr : join(b_d, d_d, c_d);
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@ -435,8 +435,8 @@ interval & interval::operator*=(interval const & other) {
|
|||
m_upper_open = (is_P0_old || other.is_N0()) ? false : a_o || d_o;
|
||||
m_lower = new_lower;
|
||||
m_upper = new_upper;
|
||||
m_lower_dep = m_lower.is_infinite() ? 0 : join_opt(b_d, c_d, a_d, d_d);
|
||||
m_upper_dep = m_upper.is_infinite() ? 0 : join(a_d, d_d);
|
||||
m_lower_dep = m_lower.is_infinite() ? nullptr : join_opt(b_d, c_d, a_d, d_d);
|
||||
m_upper_dep = m_upper.is_infinite() ? nullptr : join(a_d, d_d);
|
||||
}
|
||||
else if (other.is_M()) {
|
||||
// 0 <= a <= x <= b, c <= y --> b*c <= x*y (uses the fact that a is not negative)
|
||||
|
@ -448,8 +448,8 @@ interval & interval::operator*=(interval const & other) {
|
|||
m_upper_open = b_o || d_o;
|
||||
m_lower = new_lower;
|
||||
m_upper = new_upper;
|
||||
m_lower_dep = m_lower.is_infinite() ? 0 : join(b_d, c_d, a_d);
|
||||
m_upper_dep = m_upper.is_infinite() ? 0 : join(b_d, d_d, a_d);
|
||||
m_lower_dep = m_lower.is_infinite() ? nullptr : join(b_d, c_d, a_d);
|
||||
m_upper_dep = m_upper.is_infinite() ? nullptr : join(b_d, d_d, a_d);
|
||||
}
|
||||
else {
|
||||
// 0 <= a <= x, 0 <= c <= y --> a*c <= x*y
|
||||
|
@ -462,8 +462,8 @@ interval & interval::operator*=(interval const & other) {
|
|||
m_upper_open = b_o || d_o; SASSERT(b.is_pos() && d.is_pos());
|
||||
m_lower = new_lower;
|
||||
m_upper = new_upper;
|
||||
m_lower_dep = m_lower.is_infinite() ? 0 : join(a_d, c_d);
|
||||
m_upper_dep = m_upper.is_infinite() ? 0 : join_opt(b_d, d_d, a_d, c_d);
|
||||
m_lower_dep = m_lower.is_infinite() ? nullptr : join(a_d, c_d);
|
||||
m_upper_dep = m_upper.is_infinite() ? nullptr : join_opt(b_d, d_d, a_d, c_d);
|
||||
}
|
||||
}
|
||||
TRACE("interval_bug", tout << "operator*= result: " << *this << "\n";);
|
||||
|
@ -590,7 +590,7 @@ void interval::expt(unsigned n) {
|
|||
// 0 < a <= x <= b --> x^n <= b^n (use lower and upper bound -- need the fact that x is positive)
|
||||
m_lower.expt(n);
|
||||
m_upper.expt(n);
|
||||
m_upper_dep = m_upper.is_infinite() ? 0 : m_manager.mk_join(m_lower_dep, m_upper_dep);
|
||||
m_upper_dep = m_upper.is_infinite() ? nullptr : m_manager.mk_join(m_lower_dep, m_upper_dep);
|
||||
}
|
||||
else if (m_upper.is_neg()) {
|
||||
// [l, u]^n = [u^n, l^n] if u < 0
|
||||
|
@ -601,7 +601,7 @@ void interval::expt(unsigned n) {
|
|||
std::swap(m_lower_dep, m_upper_dep);
|
||||
m_lower.expt(n);
|
||||
m_upper.expt(n);
|
||||
m_upper_dep = m_upper.is_infinite() ? 0 : m_manager.mk_join(m_lower_dep, m_upper_dep);
|
||||
m_upper_dep = m_upper.is_infinite() ? nullptr : m_manager.mk_join(m_lower_dep, m_upper_dep);
|
||||
}
|
||||
else {
|
||||
// [l, u]^n = [0, max{l^n, u^n}] otherwise
|
||||
|
@ -614,10 +614,10 @@ void interval::expt(unsigned n) {
|
|||
m_upper = m_lower;
|
||||
m_upper_open = m_lower_open;
|
||||
}
|
||||
m_upper_dep = m_upper.is_infinite() ? 0 : m_manager.mk_join(m_lower_dep, m_upper_dep);
|
||||
m_upper_dep = m_upper.is_infinite() ? nullptr : m_manager.mk_join(m_lower_dep, m_upper_dep);
|
||||
m_lower = ext_numeral(0);
|
||||
m_lower_open = false;
|
||||
m_lower_dep = 0;
|
||||
m_lower_dep = nullptr;
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -80,7 +80,7 @@ class old_interval {
|
|||
public:
|
||||
explicit old_interval(v_dependency_manager & m);
|
||||
explicit old_interval(v_dependency_manager & m, rational const & lower, bool l_open, v_dependency * l_dep, rational const & upper, bool u_open, v_dependency * u_dep);
|
||||
explicit old_interval(v_dependency_manager & m, rational const & val, v_dependency * l_dep = 0, v_dependency * u_dep = 0);
|
||||
explicit old_interval(v_dependency_manager & m, rational const & val, v_dependency * l_dep = nullptr, v_dependency * u_dep = nullptr);
|
||||
explicit old_interval(v_dependency_manager & m, rational const & val, bool open, bool lower, v_dependency * d);
|
||||
explicit old_interval(v_dependency_manager & m, ext_numeral const& lower, bool l_open, v_dependency * l_dep, ext_numeral const & upper, bool u_open, v_dependency * u_dep);
|
||||
old_interval(old_interval const & other);
|
||||
|
|
|
@ -41,12 +41,11 @@ void preprocessor_params::display(std::ostream & out) const {
|
|||
|
||||
DISPLAY_PARAM(m_lift_ite);
|
||||
DISPLAY_PARAM(m_ng_lift_ite);
|
||||
DISPLAY_PARAM(m_pull_cheap_ite_trees);
|
||||
DISPLAY_PARAM(m_pull_cheap_ite);
|
||||
DISPLAY_PARAM(m_pull_nested_quantifiers);
|
||||
DISPLAY_PARAM(m_eliminate_term_ite);
|
||||
DISPLAY_PARAM(m_macro_finder);
|
||||
DISPLAY_PARAM(m_propagate_values);
|
||||
DISPLAY_PARAM(m_propagate_booleans);
|
||||
DISPLAY_PARAM(m_refine_inj_axiom);
|
||||
DISPLAY_PARAM(m_eliminate_bounds);
|
||||
DISPLAY_PARAM(m_simplify_bit2int);
|
||||
|
|
|
@ -32,12 +32,11 @@ struct preprocessor_params : public pattern_inference_params,
|
|||
public bit_blaster_params {
|
||||
lift_ite_kind m_lift_ite;
|
||||
lift_ite_kind m_ng_lift_ite; // lift ite for non ground terms
|
||||
bool m_pull_cheap_ite_trees;
|
||||
bool m_pull_cheap_ite;
|
||||
bool m_pull_nested_quantifiers;
|
||||
bool m_eliminate_term_ite;
|
||||
bool m_macro_finder;
|
||||
bool m_propagate_values;
|
||||
bool m_propagate_booleans;
|
||||
bool m_refine_inj_axiom;
|
||||
bool m_eliminate_bounds;
|
||||
bool m_simplify_bit2int;
|
||||
|
@ -54,12 +53,11 @@ public:
|
|||
preprocessor_params(params_ref const & p = params_ref()):
|
||||
m_lift_ite(LI_NONE),
|
||||
m_ng_lift_ite(LI_NONE),
|
||||
m_pull_cheap_ite_trees(false),
|
||||
m_pull_cheap_ite(false),
|
||||
m_pull_nested_quantifiers(false),
|
||||
m_eliminate_term_ite(false),
|
||||
m_macro_finder(false),
|
||||
m_propagate_values(true),
|
||||
m_propagate_booleans(false), // TODO << check peformance
|
||||
m_refine_inj_axiom(true),
|
||||
m_eliminate_bounds(false),
|
||||
m_simplify_bit2int(false),
|
||||
|
|
|
@ -35,12 +35,12 @@ void qi_params::updt_params(params_ref const & _p) {
|
|||
m_qi_lazy_threshold = p.qi_lazy_threshold();
|
||||
m_qi_cost = p.qi_cost();
|
||||
m_qi_max_eager_multipatterns = p.qi_max_multi_patterns();
|
||||
m_qi_quick_checker = static_cast<quick_checker_mode>(p.qi_quick_checker());
|
||||
}
|
||||
|
||||
#define DISPLAY_PARAM(X) out << #X"=" << X << std::endl;
|
||||
|
||||
void qi_params::display(std::ostream & out) const {
|
||||
DISPLAY_PARAM(m_qi_ematching);
|
||||
DISPLAY_PARAM(m_qi_cost);
|
||||
DISPLAY_PARAM(m_qi_new_gen);
|
||||
DISPLAY_PARAM(m_qi_eager_threshold);
|
||||
|
|
|
@ -29,7 +29,6 @@ enum quick_checker_mode {
|
|||
};
|
||||
|
||||
struct qi_params {
|
||||
bool m_qi_ematching;
|
||||
std::string m_qi_cost;
|
||||
std::string m_qi_new_gen;
|
||||
double m_qi_eager_threshold;
|
||||
|
@ -99,7 +98,7 @@ struct qi_params {
|
|||
m_mbqi_max_iterations(1000),
|
||||
m_mbqi_trace(false),
|
||||
m_mbqi_force_template(10),
|
||||
m_mbqi_id(0)
|
||||
m_mbqi_id(nullptr)
|
||||
{
|
||||
updt_params(p);
|
||||
}
|
||||
|
|
|
@ -39,6 +39,7 @@ void smt_params::updt_local_params(params_ref const & _p) {
|
|||
m_timeout = p.timeout();
|
||||
m_rlimit = p.rlimit();
|
||||
m_max_conflicts = p.max_conflicts();
|
||||
m_restart_max = p.restart_max();
|
||||
m_core_validate = p.core_validate();
|
||||
m_logic = _p.get_sym("logic", m_logic);
|
||||
m_string_solver = p.string_solver();
|
||||
|
|
|
@ -99,6 +99,7 @@ struct smt_params : public preprocessor_params,
|
|||
unsigned m_phase_caching_off;
|
||||
bool m_minimize_lemmas;
|
||||
unsigned m_max_conflicts;
|
||||
unsigned m_restart_max;
|
||||
bool m_simplify_clauses;
|
||||
unsigned m_tick;
|
||||
bool m_display_features;
|
||||
|
|
|
@ -21,6 +21,7 @@ def_module_params(module_name='smt',
|
|||
('timeout', UINT, UINT_MAX, 'timeout (in milliseconds) (UINT_MAX and 0 mean no timeout)'),
|
||||
('rlimit', UINT, 0, 'resource limit (0 means no limit)'),
|
||||
('max_conflicts', UINT, UINT_MAX, 'maximum number of conflicts before giving up.'),
|
||||
('restart.max', UINT, UINT_MAX, 'maximal number of restarts.'),
|
||||
('mbqi', BOOL, True, 'model based quantifier instantiation (MBQI)'),
|
||||
('mbqi.max_cexs', UINT, 1, 'initial maximal number of counterexamples used in MBQI, each counterexample generates a quantifier instantiation'),
|
||||
('mbqi.max_cexs_incr', UINT, 0, 'increment for MBQI_MAX_CEXS, the increment is performed after each round of MBQI'),
|
||||
|
@ -35,10 +36,11 @@ def_module_params(module_name='smt',
|
|||
('qi.lazy_threshold', DOUBLE, 20.0, 'threshold for lazy quantifier instantiation'),
|
||||
('qi.cost', STRING, '(+ weight generation)', 'expression specifying what is the cost of a given quantifier instantiation'),
|
||||
('qi.max_multi_patterns', UINT, 0, 'specify the number of extra multi patterns'),
|
||||
('qi.quick_checker', UINT, 0, 'specify quick checker mode, 0 - no quick checker, 1 - using unsat instances, 2 - using both unsat and no-sat instances'),
|
||||
('bv.reflect', BOOL, True, 'create enode for every bit-vector term'),
|
||||
('bv.enable_int2bv', BOOL, True, 'enable support for int2bv and bv2int operators'),
|
||||
('arith.random_initial_value', BOOL, False, 'use random initial values in the simplex-based procedure for linear arithmetic'),
|
||||
('arith.solver', UINT, 2, 'arithmetic solver: 0 - no solver, 1 - bellman-ford based solver (diff. logic only), 2 - simplex based solver, 3 - floyd-warshall based solver (diff. logic only) and no theory combination'),
|
||||
('arith.solver', UINT, 2, 'arithmetic solver: 0 - no solver, 1 - bellman-ford based solver (diff. logic only), 2 - simplex based solver, 3 - floyd-warshall based solver (diff. logic only) and no theory combination 4 - utvpi, 5 - infinitary lra, 6 - lra solver'),
|
||||
('arith.nl', BOOL, True, '(incomplete) nonlinear arithmetic support based on Groebner basis and interval propagation'),
|
||||
('arith.nl.gb', BOOL, True, 'groebner Basis computation, this option is ignored when arith.nl=false'),
|
||||
('arith.nl.branching', BOOL, True, 'branching on integer variables in non linear clusters'),
|
||||
|
@ -52,6 +54,8 @@ def_module_params(module_name='smt',
|
|||
('arith.ignore_int', BOOL, False, 'treat integer variables as real'),
|
||||
('arith.dump_lemmas', BOOL, False, 'dump arithmetic theory lemmas to files'),
|
||||
('arith.greatest_error_pivot', BOOL, False, 'Pivoting strategy'),
|
||||
('arith.eager_eq_axioms', BOOL, True, 'eager equality axioms'),
|
||||
('arith.auto_config_simplex', BOOL, False, 'force simplex solver in auto_config'),
|
||||
('pb.conflict_frequency', UINT, 1000, 'conflict frequency for Pseudo-Boolean theory'),
|
||||
('pb.learn_complements', BOOL, True, 'learn complement literals for Pseudo-Boolean theory'),
|
||||
('pb.enable_compilation', BOOL, True, 'enable compilation into sorting circuits for Pseudo-Boolean'),
|
||||
|
@ -74,11 +78,17 @@ def_module_params(module_name='smt',
|
|||
('str.fast_length_tester_cache', BOOL, False, 'cache length tester constants instead of regenerating them'),
|
||||
('str.fast_value_tester_cache', BOOL, True, 'cache value tester constants instead of regenerating them'),
|
||||
('str.string_constant_cache', BOOL, True, 'cache all generated string constants generated from anywhere in theory_str'),
|
||||
('str.use_binary_search', BOOL, True, 'use a binary search heuristic for finding concrete length values for free variables in theory_str (set to False to use linear search)'),
|
||||
('str.use_binary_search', BOOL, False, 'use a binary search heuristic for finding concrete length values for free variables in theory_str (set to False to use linear search)'),
|
||||
('str.binary_search_start', UINT, 64, 'initial upper bound for theory_str binary search'),
|
||||
('theory_aware_branching', BOOL, False, 'Allow the context to use extra information from theory solvers regarding literal branching prioritization.'),
|
||||
('str.finite_overlap_models', BOOL, False, 'attempt a finite model search for overlapping variables instead of completely giving up on the arrangement'),
|
||||
('str.overlap_priority', DOUBLE, -0.1, 'theory-aware priority for overlapping variable cases; use smt.theory_aware_branching=true'),
|
||||
('str.regex_automata', BOOL, True, 'use automata-based reasoning for regular expressions (Z3str3 only)'),
|
||||
('str.regex_automata_difficulty_threshold', UINT, 1000, 'difficulty threshold for regex automata heuristics'),
|
||||
('str.regex_automata_intersection_difficulty_threshold', UINT, 1000, 'difficulty threshold for regex intersection heuristics'),
|
||||
('str.regex_automata_failed_automaton_threshold', UINT, 10, 'number of failed automaton construction attempts after which a full automaton is automatically built'),
|
||||
('str.regex_automata_failed_intersection_threshold', UINT, 10, 'number of failed automaton intersection attempts after which intersection is always computed'),
|
||||
('str.regex_automata_length_attempt_threshold', UINT, 10, 'number of length/path constraint attempts before checking unsatisfiability of regex terms'),
|
||||
('core.minimize', BOOL, False, 'minimize unsat core produced by SMT context'),
|
||||
('core.extend_patterns', BOOL, False, 'extend unsat core with literals that trigger (potential) quantifier instances'),
|
||||
('core.extend_patterns.max_distance', UINT, UINT_MAX, 'limits the distance of a pattern-extended unsat core'),
|
||||
|
|
|
@ -37,6 +37,9 @@ void theory_arith_params::updt_params(params_ref const & _p) {
|
|||
m_arith_bound_prop = static_cast<bound_prop_mode>(p.arith_propagation_mode());
|
||||
m_arith_dump_lemmas = p.arith_dump_lemmas();
|
||||
m_arith_reflect = p.arith_reflect();
|
||||
m_arith_eager_eq_axioms = p.arith_eager_eq_axioms();
|
||||
m_arith_auto_config_simplex = p.arith_auto_config_simplex();
|
||||
|
||||
arith_rewriter_params ap(_p);
|
||||
m_arith_eq2ineq = ap.eq2ineq();
|
||||
}
|
||||
|
|
|
@ -23,12 +23,13 @@ Revision History:
|
|||
#include "util/params.h"
|
||||
|
||||
enum arith_solver_id {
|
||||
AS_NO_ARITH,
|
||||
AS_DIFF_LOGIC,
|
||||
AS_ARITH,
|
||||
AS_DENSE_DIFF_LOGIC,
|
||||
AS_UTVPI,
|
||||
AS_OPTINF
|
||||
AS_NO_ARITH, // 0
|
||||
AS_DIFF_LOGIC, // 1
|
||||
AS_ARITH, // 2
|
||||
AS_DENSE_DIFF_LOGIC, // 3
|
||||
AS_UTVPI, // 4
|
||||
AS_OPTINF, // 5
|
||||
AS_LRA // 6
|
||||
};
|
||||
|
||||
enum bound_prop_mode {
|
||||
|
|
|
@ -31,4 +31,10 @@ void theory_str_params::updt_params(params_ref const & _p) {
|
|||
m_UseBinarySearch = p.str_use_binary_search();
|
||||
m_BinarySearchInitialUpperBound = p.str_binary_search_start();
|
||||
m_OverlapTheoryAwarePriority = p.str_overlap_priority();
|
||||
m_RegexAutomata = p.str_regex_automata();
|
||||
m_RegexAutomata_DifficultyThreshold = p.str_regex_automata_difficulty_threshold();
|
||||
m_RegexAutomata_IntersectionDifficultyThreshold = p.str_regex_automata_intersection_difficulty_threshold();
|
||||
m_RegexAutomata_FailedAutomatonThreshold = p.str_regex_automata_failed_automaton_threshold();
|
||||
m_RegexAutomata_FailedIntersectionThreshold = p.str_regex_automata_failed_intersection_threshold();
|
||||
m_RegexAutomata_LengthAttemptThreshold = p.str_regex_automata_length_attempt_threshold();
|
||||
}
|
||||
|
|
|
@ -80,6 +80,43 @@ struct theory_str_params {
|
|||
|
||||
double m_OverlapTheoryAwarePriority;
|
||||
|
||||
/*
|
||||
* If RegexAutomata is set to true,
|
||||
* Z3str3 will use automata-based methods to reason about
|
||||
* regular expression constraints.
|
||||
*/
|
||||
bool m_RegexAutomata;
|
||||
|
||||
/*
|
||||
* RegexAutomata_DifficultyThreshold is the lowest difficulty above which Z3str3
|
||||
* will not eagerly construct an automaton for a regular expression term.
|
||||
*/
|
||||
unsigned m_RegexAutomata_DifficultyThreshold;
|
||||
|
||||
/*
|
||||
* RegexAutomata_IntersectionDifficultyThreshold is the lowest difficulty above which Z3str3
|
||||
* will not eagerly intersect automata to check unsatisfiability.
|
||||
*/
|
||||
unsigned m_RegexAutomata_IntersectionDifficultyThreshold;
|
||||
|
||||
/*
|
||||
* RegexAutomata_FailedAutomatonThreshold is the number of failed attempts to build an automaton
|
||||
* after which a full automaton (i.e. with no length information) will be built regardless of difficulty.
|
||||
*/
|
||||
unsigned m_RegexAutomata_FailedAutomatonThreshold;
|
||||
|
||||
/*
|
||||
* RegexAutomaton_FailedIntersectionThreshold is the number of failed attempts to perform automaton
|
||||
* intersection after which intersection will always be performed regardless of difficulty.
|
||||
*/
|
||||
unsigned m_RegexAutomata_FailedIntersectionThreshold;
|
||||
|
||||
/*
|
||||
* RegexAutomaton_LengthAttemptThreshold is the number of attempts to satisfy length/path constraints
|
||||
* before which we begin checking unsatisfiability of a regex term.
|
||||
*/
|
||||
unsigned m_RegexAutomata_LengthAttemptThreshold;
|
||||
|
||||
theory_str_params(params_ref const & p = params_ref()):
|
||||
m_StrongArrangements(true),
|
||||
m_AggressiveLengthTesting(false),
|
||||
|
@ -91,7 +128,13 @@ struct theory_str_params {
|
|||
m_FiniteOverlapModels(false),
|
||||
m_UseBinarySearch(false),
|
||||
m_BinarySearchInitialUpperBound(64),
|
||||
m_OverlapTheoryAwarePriority(-0.1)
|
||||
m_OverlapTheoryAwarePriority(-0.1),
|
||||
m_RegexAutomata(true),
|
||||
m_RegexAutomata_DifficultyThreshold(1000),
|
||||
m_RegexAutomata_IntersectionDifficultyThreshold(1000),
|
||||
m_RegexAutomata_FailedAutomatonThreshold(10),
|
||||
m_RegexAutomata_FailedIntersectionThreshold(10),
|
||||
m_RegexAutomata_LengthAttemptThreshold(10)
|
||||
{
|
||||
updt_params(p);
|
||||
}
|
||||
|
|
|
@ -62,7 +62,7 @@ void array_factory::get_some_args_for(sort * s, ptr_buffer<expr> & args) {
|
|||
|
||||
expr * array_factory::get_some_value(sort * s) {
|
||||
TRACE("array_factory", tout << mk_pp(s, m_manager) << "\n";);
|
||||
value_set * set = 0;
|
||||
value_set * set = nullptr;
|
||||
if (m_sort2value_set.find(s, set) && !set->empty())
|
||||
return *(set->begin());
|
||||
func_interp * fi;
|
||||
|
@ -99,7 +99,7 @@ bool array_factory::mk_two_diff_values_for(sort * s) {
|
|||
}
|
||||
|
||||
bool array_factory::get_some_values(sort * s, expr_ref & v1, expr_ref & v2) {
|
||||
value_set * set = 0;
|
||||
value_set * set = nullptr;
|
||||
if (!m_sort2value_set.find(s, set) || set->size() == 0) {
|
||||
if (!mk_two_diff_values_for(s))
|
||||
return false;
|
||||
|
@ -111,7 +111,7 @@ bool array_factory::get_some_values(sort * s, expr_ref & v1, expr_ref & v2) {
|
|||
if (set->size() == 1) {
|
||||
v1 = *(set->begin());
|
||||
v2 = get_fresh_value(s);
|
||||
return v2.get() != 0;
|
||||
return v2.get() != nullptr;
|
||||
}
|
||||
else {
|
||||
SASSERT(set->size() >= 2);
|
||||
|
@ -139,7 +139,7 @@ expr * array_factory::get_fresh_value(sort * s) {
|
|||
}
|
||||
sort * range = get_array_range(s);
|
||||
expr * range_val = m_model.get_fresh_value(range);
|
||||
if (range_val != 0) {
|
||||
if (range_val != nullptr) {
|
||||
// easy case
|
||||
func_interp * fi;
|
||||
expr * val = mk_array_interp(s, fi);
|
||||
|
@ -170,7 +170,7 @@ expr * array_factory::get_fresh_value(sort * s) {
|
|||
if (!found) {
|
||||
expr * arg1 = m_model.get_fresh_value(d);
|
||||
expr * arg2 = m_model.get_fresh_value(d);
|
||||
if (arg1 != 0 && arg2 != 0) {
|
||||
if (arg1 != nullptr && arg2 != nullptr) {
|
||||
found = true;
|
||||
args1.push_back(arg1);
|
||||
args2.push_back(arg2);
|
||||
|
@ -201,6 +201,6 @@ expr * array_factory::get_fresh_value(sort * s) {
|
|||
|
||||
// failed to create a fresh array value
|
||||
TRACE("array_factory_bug", tout << "failed to build fresh array value\n";);
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
|
|
@ -32,13 +32,13 @@ class array_factory : public struct_factory {
|
|||
public:
|
||||
array_factory(ast_manager & m, proto_model & md);
|
||||
|
||||
virtual ~array_factory() {}
|
||||
~array_factory() override {}
|
||||
|
||||
virtual expr * get_some_value(sort * s);
|
||||
expr * get_some_value(sort * s) override;
|
||||
|
||||
virtual bool get_some_values(sort * s, expr_ref & v1, expr_ref & v2);
|
||||
bool get_some_values(sort * s, expr_ref & v1, expr_ref & v2) override;
|
||||
|
||||
virtual expr * get_fresh_value(sort * s);
|
||||
expr * get_fresh_value(sort * s) override;
|
||||
};
|
||||
|
||||
#endif /* ARRAY_FACTORY_H_ */
|
||||
|
|
|
@ -27,7 +27,7 @@ datatype_factory::datatype_factory(ast_manager & m, proto_model & md):
|
|||
}
|
||||
|
||||
expr * datatype_factory::get_some_value(sort * s) {
|
||||
value_set * set = 0;
|
||||
value_set * set = nullptr;
|
||||
if (m_sort2value_set.find(s, set) && !set->empty())
|
||||
return *(set->begin());
|
||||
func_decl * c = m_util.get_non_rec_constructor(s);
|
||||
|
@ -46,7 +46,7 @@ expr * datatype_factory::get_some_value(sort * s) {
|
|||
\brief Return the last fresh (or almost) fresh value of sort s.
|
||||
*/
|
||||
expr * datatype_factory::get_last_fresh_value(sort * s) {
|
||||
expr * val = 0;
|
||||
expr * val = nullptr;
|
||||
if (m_last_fresh_value.find(s, val)) {
|
||||
TRACE("datatype", tout << "cached fresh value: " << mk_pp(val, m_manager) << "\n";);
|
||||
return val;
|
||||
|
@ -98,7 +98,7 @@ expr * datatype_factory::get_almost_fresh_value(sort * s) {
|
|||
sort * s_arg = constructor->get_domain(i);
|
||||
if (!found_fresh_arg && (!m_util.is_datatype(s_arg) || !m_util.are_siblings(s, s_arg))) {
|
||||
expr * new_arg = m_model.get_fresh_value(s_arg);
|
||||
if (new_arg != 0) {
|
||||
if (new_arg != nullptr) {
|
||||
found_fresh_arg = true;
|
||||
args.push_back(new_arg);
|
||||
continue;
|
||||
|
@ -131,7 +131,7 @@ expr * datatype_factory::get_almost_fresh_value(sort * s) {
|
|||
}
|
||||
}
|
||||
SASSERT(!m_util.is_recursive(s));
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
|
@ -160,7 +160,7 @@ expr * datatype_factory::get_fresh_value(sort * s) {
|
|||
sort * s_arg = constructor->get_domain(i);
|
||||
if (!found_fresh_arg && (!m_util.is_recursive(s) || !m_util.is_datatype(s_arg) || !m_util.are_siblings(s, s_arg))) {
|
||||
expr * new_arg = m_model.get_fresh_value(s_arg);
|
||||
if (new_arg != 0) {
|
||||
if (new_arg != nullptr) {
|
||||
found_fresh_arg = true;
|
||||
args.push_back(new_arg);
|
||||
continue;
|
||||
|
@ -204,7 +204,7 @@ expr * datatype_factory::get_fresh_value(sort * s) {
|
|||
<< found_sibling << "\n";);
|
||||
if (!found_sibling && m_util.is_datatype(s_arg) && m_util.are_siblings(s, s_arg)) {
|
||||
found_sibling = true;
|
||||
expr * maybe_new_arg = 0;
|
||||
expr * maybe_new_arg = nullptr;
|
||||
if (num_iterations <= 1) {
|
||||
maybe_new_arg = get_almost_fresh_value(s_arg);
|
||||
}
|
||||
|
@ -245,6 +245,6 @@ expr * datatype_factory::get_fresh_value(sort * s) {
|
|||
// Search for value that was not created before.
|
||||
SASSERT(!m_util.is_recursive(s));
|
||||
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
|
|
@ -33,9 +33,9 @@ class datatype_factory : public struct_factory {
|
|||
|
||||
public:
|
||||
datatype_factory(ast_manager & m, proto_model & md);
|
||||
virtual ~datatype_factory() {}
|
||||
virtual expr * get_some_value(sort * s);
|
||||
virtual expr * get_fresh_value(sort * s);
|
||||
~datatype_factory() override {}
|
||||
expr * get_some_value(sort * s) override;
|
||||
expr * get_fresh_value(sort * s) override;
|
||||
};
|
||||
|
||||
#endif /* DATATYPE_FACTORY_H_ */
|
||||
|
|
|
@ -26,17 +26,17 @@ Revision History:
|
|||
class numeral_factory : public simple_factory<rational> {
|
||||
public:
|
||||
numeral_factory(ast_manager & m, family_id fid):simple_factory<rational>(m, fid) {}
|
||||
virtual ~numeral_factory() {}
|
||||
~numeral_factory() override {}
|
||||
};
|
||||
|
||||
class arith_factory : public numeral_factory {
|
||||
arith_util m_util;
|
||||
|
||||
virtual app * mk_value_core(rational const & val, sort * s);
|
||||
app * mk_value_core(rational const & val, sort * s) override;
|
||||
|
||||
public:
|
||||
arith_factory(ast_manager & m);
|
||||
virtual ~arith_factory();
|
||||
~arith_factory() override;
|
||||
|
||||
app * mk_num_value(rational const & val, bool is_int);
|
||||
};
|
||||
|
@ -44,11 +44,11 @@ public:
|
|||
class bv_factory : public numeral_factory {
|
||||
bv_util m_util;
|
||||
|
||||
virtual app * mk_value_core(rational const & val, sort * s);
|
||||
app * mk_value_core(rational const & val, sort * s) override;
|
||||
|
||||
public:
|
||||
bv_factory(ast_manager & m);
|
||||
virtual ~bv_factory();
|
||||
~bv_factory() override;
|
||||
|
||||
app * mk_num_value(rational const & val, unsigned bv_size);
|
||||
};
|
||||
|
|
|
@ -53,11 +53,11 @@ void proto_model::register_aux_decl(func_decl * d) {
|
|||
*/
|
||||
void proto_model::reregister_decl(func_decl * f, func_interp * new_fi, func_decl * f_aux) {
|
||||
func_interp * fi = get_func_interp(f);
|
||||
if (fi == 0) {
|
||||
if (fi == nullptr) {
|
||||
register_decl(f, new_fi);
|
||||
}
|
||||
else {
|
||||
if (f_aux != 0) {
|
||||
if (f_aux != nullptr) {
|
||||
register_decl(f_aux, fi);
|
||||
m_aux_decls.insert(f_aux);
|
||||
}
|
||||
|
@ -135,7 +135,7 @@ void proto_model::cleanup_func_interp(func_interp * fi, func_decl_set & found_au
|
|||
todo.pop_back();
|
||||
func_decl * a_decl = to_app(a)->get_decl();
|
||||
expr * ai = get_const_interp(a_decl);
|
||||
if (ai == 0) {
|
||||
if (ai == nullptr) {
|
||||
ai = get_some_value(a_decl->get_range());
|
||||
register_decl(a_decl, ai);
|
||||
}
|
||||
|
@ -148,7 +148,7 @@ void proto_model::cleanup_func_interp(func_interp * fi, func_decl_set & found_au
|
|||
bool visited = true;
|
||||
args.reset();
|
||||
for (expr* t_arg : *t) {
|
||||
expr * arg = 0;
|
||||
expr * arg = nullptr;
|
||||
if (!cache.find(t_arg, arg)) {
|
||||
visited = false;
|
||||
todo.push_back(t_arg);
|
||||
|
@ -342,11 +342,17 @@ void proto_model::compress() {
|
|||
\brief Complete the interpretation fi of f if it is partial.
|
||||
If f does not have an interpretation in the given model, then this is a noop.
|
||||
*/
|
||||
void proto_model::complete_partial_func(func_decl * f) {
|
||||
void proto_model::complete_partial_func(func_decl * f, bool use_fresh) {
|
||||
func_interp * fi = get_func_interp(f);
|
||||
if (fi && fi->is_partial()) {
|
||||
expr * else_value = fi->get_max_occ_result();
|
||||
if (else_value == 0)
|
||||
expr * else_value;
|
||||
if (use_fresh) {
|
||||
else_value = get_fresh_value(f->get_range());
|
||||
}
|
||||
else {
|
||||
else_value = fi->get_max_occ_result();
|
||||
}
|
||||
if (else_value == nullptr)
|
||||
else_value = get_some_value(f->get_range());
|
||||
fi->set_else(else_value);
|
||||
}
|
||||
|
@ -355,14 +361,14 @@ void proto_model::complete_partial_func(func_decl * f) {
|
|||
/**
|
||||
\brief Set the (else) field of function interpretations...
|
||||
*/
|
||||
void proto_model::complete_partial_funcs() {
|
||||
void proto_model::complete_partial_funcs(bool use_fresh) {
|
||||
if (m_model_partial)
|
||||
return;
|
||||
|
||||
// m_func_decls may be "expanded" when we invoke get_some_value.
|
||||
// So, we must not use iterators to traverse it.
|
||||
for (unsigned i = 0; i < m_func_decls.size(); i++) {
|
||||
complete_partial_func(m_func_decls[i]);
|
||||
for (unsigned i = 0; i < m_func_decls.size(); ++i) {
|
||||
complete_partial_func(m_func_decls.get(i), use_fresh);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@ class proto_model : public model_core {
|
|||
|
||||
public:
|
||||
proto_model(ast_manager & m, params_ref const & p = params_ref());
|
||||
virtual ~proto_model() {}
|
||||
~proto_model() override {}
|
||||
|
||||
void register_factory(value_factory * f) { m_factories.register_plugin(f); }
|
||||
|
||||
|
@ -69,7 +69,7 @@ public:
|
|||
|
||||
value_factory * get_factory(family_id fid);
|
||||
|
||||
virtual expr * get_some_value(sort * s);
|
||||
expr * get_some_value(sort * s) override;
|
||||
|
||||
bool get_some_values(sort * s, expr_ref & v1, expr_ref & v2);
|
||||
|
||||
|
@ -93,15 +93,15 @@ public:
|
|||
void freeze_universe(sort * s);
|
||||
bool is_finite(sort * s) const;
|
||||
obj_hashtable<expr> const & get_known_universe(sort * s) const;
|
||||
virtual ptr_vector<expr> const & get_universe(sort * s) const;
|
||||
virtual unsigned get_num_uninterpreted_sorts() const;
|
||||
virtual sort * get_uninterpreted_sort(unsigned idx) const;
|
||||
ptr_vector<expr> const & get_universe(sort * s) const override;
|
||||
unsigned get_num_uninterpreted_sorts() const override;
|
||||
sort * get_uninterpreted_sort(unsigned idx) const override;
|
||||
|
||||
//
|
||||
// Complete partial function interps
|
||||
//
|
||||
void complete_partial_func(func_decl * f);
|
||||
void complete_partial_funcs();
|
||||
void complete_partial_func(func_decl * f, bool use_fresh);
|
||||
void complete_partial_funcs(bool use_fresh);
|
||||
|
||||
//
|
||||
// Create final model object.
|
||||
|
|
|
@ -20,7 +20,7 @@ Revision History:
|
|||
#include "smt/proto_model/proto_model.h"
|
||||
|
||||
struct_factory::value_set * struct_factory::get_value_set(sort * s) {
|
||||
value_set * set = 0;
|
||||
value_set * set = nullptr;
|
||||
if (!m_sort2value_set.find(s, set)) {
|
||||
set = alloc(value_set);
|
||||
m_sort2value_set.insert(s, set);
|
||||
|
|
|
@ -43,11 +43,11 @@ protected:
|
|||
public:
|
||||
struct_factory(ast_manager & m, family_id fid, proto_model & md);
|
||||
|
||||
virtual ~struct_factory();
|
||||
~struct_factory() override;
|
||||
|
||||
virtual bool get_some_values(sort * s, expr_ref & v1, expr_ref & v2);
|
||||
bool get_some_values(sort * s, expr_ref & v1, expr_ref & v2) override;
|
||||
|
||||
virtual void register_value(expr * array_value);
|
||||
void register_value(expr * array_value) override;
|
||||
};
|
||||
|
||||
#endif /* STRUCT_FACTORY_H_ */
|
||||
|
|
|
@ -34,7 +34,7 @@ basic_factory::basic_factory(ast_manager & m):
|
|||
expr * basic_factory::get_some_value(sort * s) {
|
||||
if (m_manager.is_bool(s))
|
||||
return m_manager.mk_false();
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool basic_factory::get_some_values(sort * s, expr_ref & v1, expr_ref & v2) {
|
||||
|
@ -47,7 +47,7 @@ bool basic_factory::get_some_values(sort * s, expr_ref & v1, expr_ref & v2) {
|
|||
}
|
||||
|
||||
expr * basic_factory::get_fresh_value(sort * s) {
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
user_sort_factory::user_sort_factory(ast_manager & m):
|
||||
|
@ -56,7 +56,7 @@ user_sort_factory::user_sort_factory(ast_manager & m):
|
|||
|
||||
void user_sort_factory::freeze_universe(sort * s) {
|
||||
if (!m_finite.contains(s)) {
|
||||
value_set * set = 0;
|
||||
value_set * set = nullptr;
|
||||
m_sort2value_set.find(s, set);
|
||||
if (!m_sort2value_set.find(s, set) || set->m_values.empty()) {
|
||||
// we cannot freeze an empty universe.
|
||||
|
@ -68,7 +68,7 @@ void user_sort_factory::freeze_universe(sort * s) {
|
|||
}
|
||||
|
||||
obj_hashtable<expr> const & user_sort_factory::get_known_universe(sort * s) const {
|
||||
value_set * set = 0;
|
||||
value_set * set = nullptr;
|
||||
if (m_sort2value_set.find(s, set)) {
|
||||
return set->m_values;
|
||||
}
|
||||
|
@ -77,7 +77,7 @@ obj_hashtable<expr> const & user_sort_factory::get_known_universe(sort * s) cons
|
|||
|
||||
expr * user_sort_factory::get_some_value(sort * s) {
|
||||
if (is_finite(s)) {
|
||||
value_set * set = 0;
|
||||
value_set * set = nullptr;
|
||||
m_sort2value_set.find(s, set);
|
||||
SASSERT(set != 0);
|
||||
SASSERT(!set->m_values.empty());
|
||||
|
@ -88,7 +88,7 @@ expr * user_sort_factory::get_some_value(sort * s) {
|
|||
|
||||
bool user_sort_factory::get_some_values(sort * s, expr_ref & v1, expr_ref & v2) {
|
||||
if (is_finite(s)) {
|
||||
value_set * set = 0;
|
||||
value_set * set = nullptr;
|
||||
if (m_sort2value_set.find(s, set) && set->m_values.size() >= 2) {
|
||||
obj_hashtable<expr>::iterator it = set->m_values.begin();
|
||||
v1 = *it;
|
||||
|
@ -103,7 +103,7 @@ bool user_sort_factory::get_some_values(sort * s, expr_ref & v1, expr_ref & v2)
|
|||
|
||||
expr * user_sort_factory::get_fresh_value(sort * s) {
|
||||
if (is_finite(s))
|
||||
return 0;
|
||||
return nullptr;
|
||||
return simple_factory<unsigned>::get_fresh_value(s);
|
||||
}
|
||||
|
||||
|
|
|
@ -64,13 +64,13 @@ class basic_factory : public value_factory {
|
|||
public:
|
||||
basic_factory(ast_manager & m);
|
||||
|
||||
virtual expr * get_some_value(sort * s);
|
||||
expr * get_some_value(sort * s) override;
|
||||
|
||||
virtual bool get_some_values(sort * s, expr_ref & v1, expr_ref & v2);
|
||||
bool get_some_values(sort * s, expr_ref & v1, expr_ref & v2) override;
|
||||
|
||||
virtual expr * get_fresh_value(sort * s);
|
||||
expr * get_fresh_value(sort * s) override;
|
||||
|
||||
virtual void register_value(expr * n) { }
|
||||
void register_value(expr * n) override { }
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -95,7 +95,7 @@ protected:
|
|||
ptr_vector<value_set> m_sets;
|
||||
|
||||
value_set * get_value_set(sort * s) {
|
||||
value_set * set = 0;
|
||||
value_set * set = nullptr;
|
||||
if (!m_sort2value_set.find(s, set)) {
|
||||
set = alloc(value_set);
|
||||
m_sort2value_set.insert(s, set);
|
||||
|
@ -133,13 +133,13 @@ public:
|
|||
m_sorts(m) {
|
||||
}
|
||||
|
||||
virtual ~simple_factory() {
|
||||
~simple_factory() override {
|
||||
std::for_each(m_sets.begin(), m_sets.end(), delete_proc<value_set>());
|
||||
}
|
||||
|
||||
virtual expr * get_some_value(sort * s) {
|
||||
value_set * set = 0;
|
||||
expr * result = 0;
|
||||
expr * get_some_value(sort * s) override {
|
||||
value_set * set = nullptr;
|
||||
expr * result = nullptr;
|
||||
if (m_sort2value_set.find(s, set) && !set->m_values.empty())
|
||||
result = *(set->m_values.begin());
|
||||
else
|
||||
|
@ -147,8 +147,8 @@ public:
|
|||
return result;
|
||||
}
|
||||
|
||||
virtual bool get_some_values(sort * s, expr_ref & v1, expr_ref & v2) {
|
||||
value_set * set = 0;
|
||||
bool get_some_values(sort * s, expr_ref & v1, expr_ref & v2) override {
|
||||
value_set * set = nullptr;
|
||||
if (m_sort2value_set.find(s, set)) {
|
||||
switch (set->m_values.size()) {
|
||||
case 0:
|
||||
|
@ -176,12 +176,12 @@ public:
|
|||
return true;
|
||||
}
|
||||
|
||||
virtual expr * get_fresh_value(sort * s) {
|
||||
expr * get_fresh_value(sort * s) override {
|
||||
value_set * set = get_value_set(s);
|
||||
bool is_new = false;
|
||||
expr * result = 0;
|
||||
expr * result = nullptr;
|
||||
sort_info* s_info = s->get_info();
|
||||
sort_size const* sz = s_info?&s_info->get_num_elements():0;
|
||||
sort_size const* sz = s_info?&s_info->get_num_elements():nullptr;
|
||||
bool has_max = false;
|
||||
Number max_size(0);
|
||||
if (sz && sz->is_finite() && sz->size() < UINT_MAX) {
|
||||
|
@ -195,14 +195,14 @@ public:
|
|||
result = mk_value(next, s, is_new);
|
||||
next++;
|
||||
if (has_max && next > max_size + start) {
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
SASSERT(result != 0);
|
||||
return result;
|
||||
}
|
||||
|
||||
virtual void register_value(expr * n) {
|
||||
void register_value(expr * n) override {
|
||||
sort * s = this->m_manager.get_sort(n);
|
||||
value_set * set = get_value_set(s);
|
||||
if (!set->m_values.contains(n)) {
|
||||
|
@ -228,10 +228,10 @@ public:
|
|||
class user_sort_factory : public simple_factory<unsigned> {
|
||||
obj_hashtable<sort> m_finite; //!< set of sorts that are marked as finite.
|
||||
obj_hashtable<expr> m_empty_universe;
|
||||
virtual app * mk_value_core(unsigned const & val, sort * s);
|
||||
app * mk_value_core(unsigned const & val, sort * s) override;
|
||||
public:
|
||||
user_sort_factory(ast_manager & m);
|
||||
virtual ~user_sort_factory() {}
|
||||
~user_sort_factory() override {}
|
||||
|
||||
/**
|
||||
\brief Make the universe of \c s finite, by preventing new
|
||||
|
@ -257,13 +257,13 @@ public:
|
|||
*/
|
||||
obj_hashtable<sort> const & get_finite_sorts() const { return m_finite; }
|
||||
|
||||
virtual expr * get_some_value(sort * s);
|
||||
expr * get_some_value(sort * s) override;
|
||||
|
||||
virtual bool get_some_values(sort * s, expr_ref & v1, expr_ref & v2);
|
||||
bool get_some_values(sort * s, expr_ref & v1, expr_ref & v2) override;
|
||||
|
||||
virtual expr * get_fresh_value(sort * s);
|
||||
expr * get_fresh_value(sort * s) override;
|
||||
|
||||
virtual void register_value(expr * n);
|
||||
void register_value(expr * n) override;
|
||||
};
|
||||
|
||||
#endif /* VALUE_FACTORY_H_ */
|
||||
|
|
|
@ -128,7 +128,7 @@ namespace smt {
|
|||
|
||||
unsigned qi_queue::get_new_gen(quantifier * q, unsigned generation, float cost) {
|
||||
// max_top_generation and min_top_generation are not available for computing inc_gen
|
||||
set_values(q, 0, generation, 0, 0, cost);
|
||||
set_values(q, nullptr, generation, 0, 0, cost);
|
||||
float r = m_evaluator(m_new_gen_function, m_vals.size(), m_vals.c_ptr());
|
||||
return static_cast<unsigned>(r);
|
||||
}
|
||||
|
|
|
@ -23,23 +23,23 @@ Notes:
|
|||
class include_cmd : public cmd {
|
||||
char const * m_filename;
|
||||
public:
|
||||
include_cmd() : cmd("include"), m_filename(0) {}
|
||||
virtual char const * get_usage() const { return "<string>"; }
|
||||
virtual char const * get_descr(cmd_context & ctx) const { return "include a file"; }
|
||||
virtual unsigned get_arity() const { return 1; }
|
||||
virtual cmd_arg_kind next_arg_kind(cmd_context & ctx) const { return CPK_STRING; }
|
||||
virtual void set_next_arg(cmd_context & ctx, char const * val) { m_filename = val; }
|
||||
virtual void failure_cleanup(cmd_context & ctx) {}
|
||||
virtual void execute(cmd_context & ctx) {
|
||||
include_cmd() : cmd("include"), m_filename(nullptr) {}
|
||||
char const * get_usage() const override { return "<string>"; }
|
||||
char const * get_descr(cmd_context & ctx) const override { return "include a file"; }
|
||||
unsigned get_arity() const override { return 1; }
|
||||
cmd_arg_kind next_arg_kind(cmd_context & ctx) const override { return CPK_STRING; }
|
||||
void set_next_arg(cmd_context & ctx, char const * val) override { m_filename = val; }
|
||||
void failure_cleanup(cmd_context & ctx) override {}
|
||||
void execute(cmd_context & ctx) override {
|
||||
std::ifstream is(m_filename);
|
||||
if (is.bad() || is.fail())
|
||||
throw cmd_exception(std::string("failed to open file '") + m_filename + "'");
|
||||
parse_smt2_commands(ctx, is, false, params_ref(), m_filename);
|
||||
is.close();
|
||||
}
|
||||
virtual void prepare(cmd_context & ctx) { reset(ctx); }
|
||||
virtual void reset(cmd_context & ctx) { m_filename = 0; }
|
||||
virtual void finalize(cmd_context & ctx) { reset(ctx); }
|
||||
void prepare(cmd_context & ctx) override { reset(ctx); }
|
||||
void reset(cmd_context & ctx) override { m_filename = nullptr; }
|
||||
void finalize(cmd_context & ctx) override { reset(ctx); }
|
||||
};
|
||||
|
||||
void install_smt2_extra_cmds(cmd_context & ctx) {
|
||||
|
|
|
@ -108,8 +108,8 @@ namespace smt {
|
|||
|
||||
void almost_cg_table::insert(enode * n) {
|
||||
table::entry * entry = m_table.find_core(n);
|
||||
if (entry == 0) {
|
||||
list<enode*> * new_lst = new (m_region) list<enode*>(n, 0);
|
||||
if (entry == nullptr) {
|
||||
list<enode*> * new_lst = new (m_region) list<enode*>(n, nullptr);
|
||||
m_table.insert(n, new_lst);
|
||||
}
|
||||
else {
|
||||
|
@ -119,7 +119,7 @@ namespace smt {
|
|||
}
|
||||
|
||||
list<enode*> * almost_cg_table::find(enode * n) {
|
||||
list<enode*> * result = 0;
|
||||
list<enode*> * result = nullptr;
|
||||
m_table.find(n, result);
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -57,7 +57,7 @@ namespace smt {
|
|||
table m_table;
|
||||
|
||||
public:
|
||||
almost_cg_table(enode * r1 = 0, enode * r2 = 0);
|
||||
almost_cg_table(enode * r1 = nullptr, enode * r2 = nullptr);
|
||||
void reset(enode * r1, enode * r2) { m_r1 = r1->get_root(); m_r2 = r2->get_root(); reset(); }
|
||||
void reset();
|
||||
void insert(enode *);
|
||||
|
|
|
@ -91,7 +91,7 @@ namespace smt {
|
|||
}
|
||||
};
|
||||
|
||||
const b_justification null_b_justification(static_cast<clause*>(0));
|
||||
const b_justification null_b_justification(static_cast<clause*>(nullptr));
|
||||
|
||||
inline std::ostream& operator<<(std::ostream& out, b_justification::kind k) {
|
||||
switch (k) {
|
||||
|
|
|
@ -75,42 +75,42 @@ namespace smt {
|
|||
m_queue(1024, bool_var_act_lt(ctx.get_activity_vector())) {
|
||||
}
|
||||
|
||||
virtual void activity_increased_eh(bool_var v) {
|
||||
void activity_increased_eh(bool_var v) override {
|
||||
if (m_queue.contains(v))
|
||||
m_queue.decreased(v);
|
||||
}
|
||||
|
||||
virtual void mk_var_eh(bool_var v) {
|
||||
void mk_var_eh(bool_var v) override {
|
||||
m_queue.reserve(v+1);
|
||||
SASSERT(!m_queue.contains(v));
|
||||
m_queue.insert(v);
|
||||
}
|
||||
|
||||
virtual void del_var_eh(bool_var v) {
|
||||
void del_var_eh(bool_var v) override {
|
||||
if (m_queue.contains(v))
|
||||
m_queue.erase(v);
|
||||
}
|
||||
|
||||
virtual void unassign_var_eh(bool_var v) {
|
||||
void unassign_var_eh(bool_var v) override {
|
||||
if (!m_queue.contains(v))
|
||||
m_queue.insert(v);
|
||||
}
|
||||
|
||||
virtual void relevant_eh(expr * n) {}
|
||||
void relevant_eh(expr * n) override {}
|
||||
|
||||
virtual void init_search_eh() {}
|
||||
void init_search_eh() override {}
|
||||
|
||||
virtual void end_search_eh() {}
|
||||
void end_search_eh() override {}
|
||||
|
||||
virtual void reset() {
|
||||
void reset() override {
|
||||
m_queue.reset();
|
||||
}
|
||||
|
||||
virtual void push_scope() {}
|
||||
void push_scope() override {}
|
||||
|
||||
virtual void pop_scope(unsigned num_scopes) {}
|
||||
void pop_scope(unsigned num_scopes) override {}
|
||||
|
||||
virtual void next_case_split(bool_var & next, lbool & phase) {
|
||||
void next_case_split(bool_var & next, lbool & phase) override {
|
||||
phase = l_undef;
|
||||
|
||||
if (m_context.get_random_value() < static_cast<int>(m_params.m_random_var_freq * random_gen::max_value())) {
|
||||
|
@ -129,7 +129,7 @@ namespace smt {
|
|||
next = null_bool_var;
|
||||
}
|
||||
|
||||
virtual void display(std::ostream & out) {
|
||||
void display(std::ostream & out) override {
|
||||
bool first = true;
|
||||
for (unsigned v : m_queue) {
|
||||
if (m_context.get_assignment(v) == l_undef) {
|
||||
|
@ -144,7 +144,7 @@ namespace smt {
|
|||
out << "\n";
|
||||
}
|
||||
|
||||
virtual ~act_case_split_queue() {};
|
||||
~act_case_split_queue() override {};
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -159,7 +159,7 @@ namespace smt {
|
|||
m_delayed_queue(1024, bool_var_act_lt(ctx.get_activity_vector())) {
|
||||
}
|
||||
|
||||
virtual void activity_increased_eh(bool_var v) {
|
||||
void activity_increased_eh(bool_var v) override {
|
||||
act_case_split_queue::activity_increased_eh(v);
|
||||
if (m_queue.contains(v))
|
||||
m_queue.decreased(v);
|
||||
|
@ -167,7 +167,7 @@ namespace smt {
|
|||
m_delayed_queue.decreased(v);
|
||||
}
|
||||
|
||||
virtual void mk_var_eh(bool_var v) {
|
||||
void mk_var_eh(bool_var v) override {
|
||||
m_queue.reserve(v+1);
|
||||
m_delayed_queue.reserve(v+1);
|
||||
SASSERT(!m_delayed_queue.contains(v));
|
||||
|
@ -178,28 +178,28 @@ namespace smt {
|
|||
m_queue.insert(v);
|
||||
}
|
||||
|
||||
virtual void del_var_eh(bool_var v) {
|
||||
void del_var_eh(bool_var v) override {
|
||||
act_case_split_queue::del_var_eh(v);
|
||||
if (m_delayed_queue.contains(v))
|
||||
m_delayed_queue.erase(v);
|
||||
}
|
||||
|
||||
virtual void relevant_eh(expr * n) {}
|
||||
void relevant_eh(expr * n) override {}
|
||||
|
||||
virtual void init_search_eh() {}
|
||||
void init_search_eh() override {}
|
||||
|
||||
virtual void end_search_eh() {}
|
||||
void end_search_eh() override {}
|
||||
|
||||
virtual void reset() {
|
||||
void reset() override {
|
||||
act_case_split_queue::reset();
|
||||
m_delayed_queue.reset();
|
||||
}
|
||||
|
||||
virtual void push_scope() {}
|
||||
void push_scope() override {}
|
||||
|
||||
virtual void pop_scope(unsigned num_scopes) {}
|
||||
void pop_scope(unsigned num_scopes) override {}
|
||||
|
||||
virtual void next_case_split(bool_var & next, lbool & phase) {
|
||||
void next_case_split(bool_var & next, lbool & phase) override {
|
||||
act_case_split_queue::next_case_split(next, phase);
|
||||
if (next != null_bool_var)
|
||||
return;
|
||||
|
@ -229,7 +229,7 @@ namespace smt {
|
|||
m_cache_domain(ctx.get_manager()) {
|
||||
}
|
||||
|
||||
virtual void mk_var_eh(bool_var v) {
|
||||
void mk_var_eh(bool_var v) override {
|
||||
expr * n = m_context.bool_var2expr(v);
|
||||
double act;
|
||||
if (m_cache.find(n, act))
|
||||
|
@ -237,7 +237,7 @@ namespace smt {
|
|||
act_case_split_queue::mk_var_eh(v);
|
||||
}
|
||||
|
||||
virtual void del_var_eh(bool_var v) {
|
||||
void del_var_eh(bool_var v) override {
|
||||
if (m_context.is_searching()) {
|
||||
double act = m_context.get_activity(v);
|
||||
if (act > 0.0) {
|
||||
|
@ -249,14 +249,14 @@ namespace smt {
|
|||
act_case_split_queue::del_var_eh(v);
|
||||
}
|
||||
|
||||
virtual void init_search_eh() {
|
||||
void init_search_eh() override {
|
||||
m_cache.reset();
|
||||
m_cache_domain.reset();
|
||||
}
|
||||
|
||||
virtual void end_search_eh() {}
|
||||
void end_search_eh() override {}
|
||||
|
||||
virtual void reset() {
|
||||
void reset() override {
|
||||
init_search_eh();
|
||||
}
|
||||
};
|
||||
|
@ -322,15 +322,15 @@ namespace smt {
|
|||
m_head2(0) {
|
||||
}
|
||||
|
||||
virtual void activity_increased_eh(bool_var v) {}
|
||||
void activity_increased_eh(bool_var v) override {}
|
||||
|
||||
virtual void mk_var_eh(bool_var v) {}
|
||||
void mk_var_eh(bool_var v) override {}
|
||||
|
||||
virtual void del_var_eh(bool_var v) {}
|
||||
void del_var_eh(bool_var v) override {}
|
||||
|
||||
virtual void unassign_var_eh(bool_var v) {}
|
||||
void unassign_var_eh(bool_var v) override {}
|
||||
|
||||
virtual void relevant_eh(expr * n) {
|
||||
void relevant_eh(expr * n) override {
|
||||
if (!m_manager.is_bool(n))
|
||||
return;
|
||||
bool is_or = m_manager.is_or(n);
|
||||
|
@ -361,15 +361,15 @@ namespace smt {
|
|||
m_queue2.push_back(n);
|
||||
}
|
||||
|
||||
virtual void init_search_eh() {
|
||||
void init_search_eh() override {
|
||||
m_bs_num_bool_vars = m_context.get_num_bool_vars();
|
||||
}
|
||||
|
||||
virtual void end_search_eh() {
|
||||
void end_search_eh() override {
|
||||
m_bs_num_bool_vars = UINT_MAX;
|
||||
}
|
||||
|
||||
virtual void reset() {
|
||||
void reset() override {
|
||||
m_queue.reset();
|
||||
m_head = 0;
|
||||
m_queue2.reset();
|
||||
|
@ -377,7 +377,7 @@ namespace smt {
|
|||
m_scopes.reset();
|
||||
}
|
||||
|
||||
virtual void push_scope() {
|
||||
void push_scope() override {
|
||||
m_scopes.push_back(scope());
|
||||
scope & s = m_scopes.back();
|
||||
s.m_queue_trail = m_queue.size();
|
||||
|
@ -387,7 +387,7 @@ namespace smt {
|
|||
TRACE("case_split", tout << "head: " << m_head << "\n";);
|
||||
}
|
||||
|
||||
virtual void pop_scope(unsigned num_scopes) {
|
||||
void pop_scope(unsigned num_scopes) override {
|
||||
SASSERT(num_scopes <= m_scopes.size());
|
||||
unsigned new_lvl = m_scopes.size() - num_scopes;
|
||||
scope & s = m_scopes[new_lvl];
|
||||
|
@ -419,7 +419,7 @@ namespace smt {
|
|||
val = l_true;
|
||||
}
|
||||
if ((is_or && val == l_true) || (is_and && val == l_false)) {
|
||||
expr * undef_child = 0;
|
||||
expr * undef_child = nullptr;
|
||||
if (!has_child_assigned_to(m_context, to_app(curr), val, undef_child, m_params.m_rel_case_split_order)) {
|
||||
if (m_manager.has_trace_stream()) {
|
||||
m_manager.trace_stream() << "[decide-and-or] #" << curr->get_id() << " #" << undef_child->get_id() << "\n";
|
||||
|
@ -443,7 +443,7 @@ namespace smt {
|
|||
next = null_bool_var;
|
||||
}
|
||||
|
||||
virtual void next_case_split(bool_var & next, lbool & phase) {
|
||||
void next_case_split(bool_var & next, lbool & phase) override {
|
||||
next_case_split_core(m_queue, m_head, next, phase);
|
||||
if (next == null_bool_var)
|
||||
next_case_split_core(m_queue2, m_head2, next, phase);
|
||||
|
@ -471,7 +471,7 @@ namespace smt {
|
|||
out << "\n";
|
||||
}
|
||||
|
||||
virtual void display(std::ostream & out) {
|
||||
void display(std::ostream & out) override {
|
||||
if (m_queue.empty() && m_queue2.empty())
|
||||
return;
|
||||
out << "case-splits:\n";
|
||||
|
@ -507,9 +507,9 @@ namespace smt {
|
|||
m_delayed_queue(1024, bool_var_act_lt(ctx.get_activity_vector())) {
|
||||
}
|
||||
|
||||
virtual void activity_increased_eh(bool_var v) {}
|
||||
void activity_increased_eh(bool_var v) override {}
|
||||
|
||||
virtual void mk_var_eh(bool_var v) {
|
||||
void mk_var_eh(bool_var v) override {
|
||||
if (m_context.is_searching()) {
|
||||
SASSERT(v >= m_bs_num_bool_vars);
|
||||
m_delayed_queue.reserve(v+1);
|
||||
|
@ -517,19 +517,19 @@ namespace smt {
|
|||
}
|
||||
}
|
||||
|
||||
virtual void del_var_eh(bool_var v) {
|
||||
void del_var_eh(bool_var v) override {
|
||||
if (v >= m_bs_num_bool_vars && m_delayed_queue.contains(v))
|
||||
m_delayed_queue.erase(v);
|
||||
}
|
||||
|
||||
virtual void unassign_var_eh(bool_var v) {
|
||||
void unassign_var_eh(bool_var v) override {
|
||||
if (v < m_bs_num_bool_vars)
|
||||
return;
|
||||
if (!m_delayed_queue.contains(v))
|
||||
m_delayed_queue.insert(v);
|
||||
}
|
||||
|
||||
virtual void relevant_eh(expr * n) {
|
||||
void relevant_eh(expr * n) override {
|
||||
if (!m_manager.is_bool(n))
|
||||
return;
|
||||
bool is_or = m_manager.is_or(n);
|
||||
|
@ -558,22 +558,22 @@ namespace smt {
|
|||
m_queue.push_back(n);
|
||||
}
|
||||
|
||||
virtual void init_search_eh() {
|
||||
void init_search_eh() override {
|
||||
m_bs_num_bool_vars = m_context.get_num_bool_vars();
|
||||
}
|
||||
|
||||
virtual void end_search_eh() {
|
||||
void end_search_eh() override {
|
||||
m_bs_num_bool_vars = UINT_MAX;
|
||||
}
|
||||
|
||||
virtual void reset() {
|
||||
void reset() override {
|
||||
m_queue.reset();
|
||||
m_head = 0;
|
||||
m_delayed_queue.reset();
|
||||
m_scopes.reset();
|
||||
}
|
||||
|
||||
virtual void push_scope() {
|
||||
void push_scope() override {
|
||||
m_scopes.push_back(scope());
|
||||
scope & s = m_scopes.back();
|
||||
s.m_queue_trail = m_queue.size();
|
||||
|
@ -581,7 +581,7 @@ namespace smt {
|
|||
TRACE("case_split", tout << "head: " << m_head << "\n";);
|
||||
}
|
||||
|
||||
virtual void pop_scope(unsigned num_scopes) {
|
||||
void pop_scope(unsigned num_scopes) override {
|
||||
SASSERT(num_scopes <= m_scopes.size());
|
||||
unsigned new_lvl = m_scopes.size() - num_scopes;
|
||||
scope & s = m_scopes[new_lvl];
|
||||
|
@ -611,7 +611,7 @@ namespace smt {
|
|||
val = l_true;
|
||||
}
|
||||
if ((is_or && val == l_true) || (is_and && val == l_false)) {
|
||||
expr * undef_child = 0;
|
||||
expr * undef_child = nullptr;
|
||||
if (!has_child_assigned_to(m_context, to_app(curr), val, undef_child, m_params.m_rel_case_split_order)) {
|
||||
TRACE("case_split", tout << "found AND/OR candidate: #" << curr->get_id() << " #" << undef_child->get_id() << "\n";);
|
||||
literal l = m_context.get_literal(undef_child);
|
||||
|
@ -632,7 +632,7 @@ namespace smt {
|
|||
next = null_bool_var;
|
||||
}
|
||||
|
||||
virtual void next_case_split(bool_var & next, lbool & phase) {
|
||||
void next_case_split(bool_var & next, lbool & phase) override {
|
||||
if (m_context.get_random_value() < static_cast<int>(0.02 * random_gen::max_value())) {
|
||||
next = m_context.get_random_value() % m_context.get_num_b_internalized();
|
||||
TRACE("random_split", tout << "next: " << next << " get_assignment(next): " << m_context.get_assignment(next) << "\n";);
|
||||
|
@ -664,7 +664,7 @@ namespace smt {
|
|||
out << "\n";
|
||||
}
|
||||
|
||||
virtual void display(std::ostream & out) {
|
||||
void display(std::ostream & out) override {
|
||||
if (m_queue.empty())
|
||||
return;
|
||||
out << "case-splits:\n";
|
||||
|
@ -747,19 +747,19 @@ namespace smt {
|
|||
m_head(0),
|
||||
m_bs_num_bool_vars(UINT_MAX),
|
||||
m_priority_queue2(0, generation_lt(*this)),
|
||||
m_current_goal(0) {
|
||||
m_current_goal(nullptr) {
|
||||
set_global_generation();
|
||||
}
|
||||
|
||||
virtual void activity_increased_eh(bool_var v) {}
|
||||
void activity_increased_eh(bool_var v) override {}
|
||||
|
||||
virtual void mk_var_eh(bool_var v) {}
|
||||
void mk_var_eh(bool_var v) override {}
|
||||
|
||||
virtual void del_var_eh(bool_var v) {}
|
||||
void del_var_eh(bool_var v) override {}
|
||||
|
||||
virtual void unassign_var_eh(bool_var v) {}
|
||||
void unassign_var_eh(bool_var v) override {}
|
||||
|
||||
virtual void relevant_eh(expr * n) {
|
||||
void relevant_eh(expr * n) override {
|
||||
if (get_generation(n) == 0 && m_current_generation != 0)
|
||||
set_generation_rec(n, m_current_generation);
|
||||
|
||||
|
@ -793,21 +793,21 @@ namespace smt {
|
|||
add_to_queue2(n);
|
||||
}
|
||||
|
||||
virtual void internalize_instance_eh(expr * e, unsigned gen)
|
||||
void internalize_instance_eh(expr * e, unsigned gen) override
|
||||
{
|
||||
//lower_generation(e, gen);
|
||||
}
|
||||
|
||||
virtual void init_search_eh() {
|
||||
void init_search_eh() override {
|
||||
m_bs_num_bool_vars = m_context.get_num_bool_vars();
|
||||
set_global_generation();
|
||||
}
|
||||
|
||||
virtual void end_search_eh() {
|
||||
void end_search_eh() override {
|
||||
m_bs_num_bool_vars = UINT_MAX;
|
||||
}
|
||||
|
||||
virtual void reset() {
|
||||
void reset() override {
|
||||
m_queue.reset();
|
||||
m_head = 0;
|
||||
m_queue2.reset();
|
||||
|
@ -816,7 +816,7 @@ namespace smt {
|
|||
set_global_generation();
|
||||
}
|
||||
|
||||
virtual void push_scope() {
|
||||
void push_scope() override {
|
||||
m_scopes.push_back(scope());
|
||||
scope & s = m_scopes.back();
|
||||
s.m_queue_trail = m_queue.size();
|
||||
|
@ -827,7 +827,7 @@ namespace smt {
|
|||
TRACE("case_split", tout << "head: " << m_head << "\n";);
|
||||
}
|
||||
|
||||
virtual void pop_scope(unsigned num_scopes) {
|
||||
void pop_scope(unsigned num_scopes) override {
|
||||
SASSERT(num_scopes <= m_scopes.size());
|
||||
unsigned new_lvl = m_scopes.size() - num_scopes;
|
||||
scope & s = m_scopes[new_lvl];
|
||||
|
@ -875,7 +875,7 @@ namespace smt {
|
|||
val = l_true;
|
||||
}
|
||||
if ((is_or && val == l_true) || (is_and && val == l_false)) {
|
||||
expr * undef_child = 0;
|
||||
expr * undef_child = nullptr;
|
||||
if (!has_child_assigned_to(m_context, to_app(curr), val, undef_child, m_params.m_rel_case_split_order)) {
|
||||
if (m_manager.has_trace_stream()) {
|
||||
m_manager.trace_stream() << "[decide-and-or] #" << curr->get_id() << " #" << undef_child->get_id() << "\n";
|
||||
|
@ -898,7 +898,7 @@ namespace smt {
|
|||
next = null_bool_var;
|
||||
}
|
||||
|
||||
virtual void next_case_split(bool_var & next, lbool & phase) {
|
||||
void next_case_split(bool_var & next, lbool & phase) override {
|
||||
phase = l_undef;
|
||||
next = null_bool_var;
|
||||
|
||||
|
@ -943,7 +943,7 @@ namespace smt {
|
|||
out << "\n";
|
||||
}
|
||||
|
||||
virtual void display(std::ostream & out) {
|
||||
void display(std::ostream & out) override {
|
||||
if (m_queue.empty() && m_queue2.empty())
|
||||
return;
|
||||
out << "case-splits:\n";
|
||||
|
@ -951,7 +951,7 @@ namespace smt {
|
|||
//display_core(out, m_queue2, m_head2, 2);
|
||||
}
|
||||
|
||||
virtual void assign_lit_eh(literal l) {
|
||||
void assign_lit_eh(literal l) override {
|
||||
// if (m_current_generation > stop_gen)
|
||||
// m_current_generation--;
|
||||
|
||||
|
@ -1128,41 +1128,41 @@ namespace smt {
|
|||
m_queue(1024, theory_aware_act_lt(ctx.get_activity_vector(), m_theory_var_priority)) {
|
||||
}
|
||||
|
||||
virtual void activity_increased_eh(bool_var v) {
|
||||
void activity_increased_eh(bool_var v) override {
|
||||
if (m_queue.contains(v))
|
||||
m_queue.decreased(v);
|
||||
}
|
||||
|
||||
virtual void mk_var_eh(bool_var v) {
|
||||
void mk_var_eh(bool_var v) override {
|
||||
m_queue.reserve(v+1);
|
||||
m_queue.insert(v);
|
||||
}
|
||||
|
||||
virtual void del_var_eh(bool_var v) {
|
||||
void del_var_eh(bool_var v) override {
|
||||
if (m_queue.contains(v))
|
||||
m_queue.erase(v);
|
||||
}
|
||||
|
||||
virtual void unassign_var_eh(bool_var v) {
|
||||
void unassign_var_eh(bool_var v) override {
|
||||
if (!m_queue.contains(v))
|
||||
m_queue.insert(v);
|
||||
}
|
||||
|
||||
virtual void relevant_eh(expr * n) {}
|
||||
void relevant_eh(expr * n) override {}
|
||||
|
||||
virtual void init_search_eh() {}
|
||||
void init_search_eh() override {}
|
||||
|
||||
virtual void end_search_eh() {}
|
||||
void end_search_eh() override {}
|
||||
|
||||
virtual void reset() {
|
||||
void reset() override {
|
||||
m_queue.reset();
|
||||
}
|
||||
|
||||
virtual void push_scope() {}
|
||||
void push_scope() override {}
|
||||
|
||||
virtual void pop_scope(unsigned num_scopes) {}
|
||||
void pop_scope(unsigned num_scopes) override {}
|
||||
|
||||
virtual void next_case_split(bool_var & next, lbool & phase) {
|
||||
void next_case_split(bool_var & next, lbool & phase) override {
|
||||
int threshold = static_cast<int>(m_params.m_random_var_freq * random_gen::max_value());
|
||||
SASSERT(threshold >= 0);
|
||||
if (m_context.get_random_value() < threshold) {
|
||||
|
@ -1187,7 +1187,7 @@ namespace smt {
|
|||
}
|
||||
}
|
||||
|
||||
virtual void add_theory_aware_branching_info(bool_var v, double priority, lbool phase) {
|
||||
void add_theory_aware_branching_info(bool_var v, double priority, lbool phase) override {
|
||||
TRACE("theory_aware_branching", tout << "Add theory-aware branching information for l#" << v << ": priority=" << priority << std::endl;);
|
||||
m_theory_vars.insert(v);
|
||||
m_theory_var_phase.insert(v, phase);
|
||||
|
@ -1203,7 +1203,7 @@ namespace smt {
|
|||
// m_theory_queue.insert(v);
|
||||
}
|
||||
|
||||
virtual void display(std::ostream & out) {
|
||||
void display(std::ostream & out) override {
|
||||
bool first = true;
|
||||
bool_var_act_queue::const_iterator it = m_queue.begin();
|
||||
bool_var_act_queue::const_iterator end = m_queue.end();
|
||||
|
@ -1222,7 +1222,7 @@ namespace smt {
|
|||
|
||||
}
|
||||
|
||||
virtual ~theory_aware_branching_queue() {};
|
||||
~theory_aware_branching_queue() override {};
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -307,17 +307,17 @@ namespace smt {
|
|||
|
||||
enode * find(enode * n) const {
|
||||
SASSERT(n->get_num_args() > 0);
|
||||
enode * r = 0;
|
||||
enode * r = nullptr;
|
||||
void * t = const_cast<cg_table*>(this)->get_table(n);
|
||||
switch (static_cast<table_kind>(GET_TAG(t))) {
|
||||
case UNARY:
|
||||
return UNTAG(unary_table*, t)->find(n, r) ? r : 0;
|
||||
return UNTAG(unary_table*, t)->find(n, r) ? r : nullptr;
|
||||
case BINARY:
|
||||
return UNTAG(binary_table*, t)->find(n, r) ? r : 0;
|
||||
return UNTAG(binary_table*, t)->find(n, r) ? r : nullptr;
|
||||
case BINARY_COMM:
|
||||
return UNTAG(comm_table*, t)->find(n, r) ? r : 0;
|
||||
return UNTAG(comm_table*, t)->find(n, r) ? r : nullptr;
|
||||
default:
|
||||
return UNTAG(table*, t)->find(n, r) ? r : 0;
|
||||
return UNTAG(table*, t)->find(n, r) ? r : nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -61,8 +61,20 @@ namespace smt {
|
|||
return is_true ? any_arg(a, true) : all_args(a, false);
|
||||
case OP_AND:
|
||||
return is_true ? all_args(a, true) : any_arg(a, false);
|
||||
case OP_IFF:
|
||||
if (is_true) {
|
||||
case OP_EQ:
|
||||
if (!m_manager.is_iff(a)) {
|
||||
enode * lhs = get_enode_eq_to(a->get_arg(0));
|
||||
enode * rhs = get_enode_eq_to(a->get_arg(1));
|
||||
if (lhs && rhs && m_context.is_relevant(lhs) && m_context.is_relevant(rhs)) {
|
||||
if (is_true && lhs->get_root() == rhs->get_root())
|
||||
return true;
|
||||
// if (!is_true && m_context.is_ext_diseq(lhs, rhs, 2))
|
||||
if (!is_true && m_context.is_diseq(lhs, rhs))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
else if (is_true) {
|
||||
return
|
||||
(check(a->get_arg(0), true) &&
|
||||
check(a->get_arg(1), true)) ||
|
||||
|
@ -86,18 +98,6 @@ namespace smt {
|
|||
}
|
||||
return check(a->get_arg(1), is_true) && check(a->get_arg(2), is_true);
|
||||
}
|
||||
case OP_EQ: {
|
||||
enode * lhs = get_enode_eq_to(a->get_arg(0));
|
||||
enode * rhs = get_enode_eq_to(a->get_arg(1));
|
||||
if (lhs && rhs && m_context.is_relevant(lhs) && m_context.is_relevant(rhs)) {
|
||||
if (is_true && lhs->get_root() == rhs->get_root())
|
||||
return true;
|
||||
// if (!is_true && m_context.is_ext_diseq(lhs, rhs, 2))
|
||||
if (!is_true && m_context.is_diseq(lhs, rhs))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -125,28 +125,28 @@ namespace smt {
|
|||
unsigned num = n->get_num_args();
|
||||
for (unsigned i = 0; i < num; i++) {
|
||||
enode * arg = get_enode_eq_to(n->get_arg(i));
|
||||
if (arg == 0)
|
||||
return 0;
|
||||
if (arg == nullptr)
|
||||
return nullptr;
|
||||
buffer.push_back(arg);
|
||||
}
|
||||
enode * e = m_context.get_enode_eq_to(n->get_decl(), num, buffer.c_ptr());
|
||||
if (e == 0)
|
||||
return 0;
|
||||
return m_context.is_relevant(e) ? e : 0;
|
||||
if (e == nullptr)
|
||||
return nullptr;
|
||||
return m_context.is_relevant(e) ? e : nullptr;
|
||||
}
|
||||
|
||||
enode * checker::get_enode_eq_to(expr * n) {
|
||||
if (is_var(n)) {
|
||||
unsigned idx = to_var(n)->get_idx();
|
||||
if (idx >= m_num_bindings)
|
||||
return 0;
|
||||
return nullptr;
|
||||
return m_bindings[m_num_bindings - idx - 1];
|
||||
}
|
||||
if (m_context.e_internalized(n) && m_context.is_relevant(n))
|
||||
return m_context.get_enode(n);
|
||||
if (!is_app(n) || to_app(n)->get_num_args() == 0)
|
||||
return 0;
|
||||
enode * r = 0;
|
||||
return nullptr;
|
||||
enode * r = nullptr;
|
||||
if (n->get_ref_count() > 1 && m_to_enode_cache.find(n, r))
|
||||
return r;
|
||||
r = get_enode_eq_to_core(to_app(n));
|
||||
|
@ -179,7 +179,7 @@ namespace smt {
|
|||
m_context(c),
|
||||
m_manager(c.get_manager()),
|
||||
m_num_bindings(0),
|
||||
m_bindings(0) {
|
||||
m_bindings(nullptr) {
|
||||
}
|
||||
|
||||
};
|
||||
|
|
|
@ -47,8 +47,8 @@ namespace smt {
|
|||
|
||||
public:
|
||||
checker(context & c);
|
||||
bool is_sat(expr * n, unsigned num_bindings = 0, enode * const * bindings = 0);
|
||||
bool is_unsat(expr * n, unsigned num_bindings = 0, enode * const * bindings = 0);
|
||||
bool is_sat(expr * n, unsigned num_bindings = 0, enode * const * bindings = nullptr);
|
||||
bool is_unsat(expr * n, unsigned num_bindings = 0, enode * const * bindings = nullptr);
|
||||
};
|
||||
|
||||
};
|
||||
|
|
|
@ -25,11 +25,11 @@ namespace smt {
|
|||
\brief Create a new clause.
|
||||
bool_var2expr_map is a mapping from bool_var -> expr, it is only used if save_atoms == true.
|
||||
*/
|
||||
clause * clause::mk(ast_manager & m, unsigned num_lits, literal * lits, clause_kind k, justification * js,
|
||||
clause * clause::mk(ast_manager & m, unsigned num_lits, literal * lits, clause_kind k, justification * js,
|
||||
clause_del_eh * del_eh, bool save_atoms, expr * const * bool_var2expr_map) {
|
||||
SASSERT(k == CLS_AUX || js == 0 || !js->in_region());
|
||||
SASSERT(num_lits >= 2);
|
||||
unsigned sz = get_obj_size(num_lits, k, save_atoms, del_eh != 0, js != 0);
|
||||
unsigned sz = get_obj_size(num_lits, k, save_atoms, del_eh != nullptr, js != nullptr);
|
||||
void * mem = m.get_allocator().allocate(sz);
|
||||
clause * cls = new (mem) clause();
|
||||
cls->m_num_literals = num_lits;
|
||||
|
@ -38,8 +38,8 @@ namespace smt {
|
|||
cls->m_reinit = save_atoms;
|
||||
cls->m_reinternalize_atoms = save_atoms;
|
||||
cls->m_has_atoms = save_atoms;
|
||||
cls->m_has_del_eh = del_eh != 0;
|
||||
cls->m_has_justification = js != 0;
|
||||
cls->m_has_del_eh = del_eh != nullptr;
|
||||
cls->m_has_justification = js != nullptr;
|
||||
cls->m_deleted = false;
|
||||
SASSERT(!m.proofs_enabled() || js != 0);
|
||||
memcpy(cls->m_lits, lits, sizeof(literal) * num_lits);
|
||||
|
@ -67,7 +67,7 @@ namespace smt {
|
|||
}});
|
||||
return cls;
|
||||
}
|
||||
|
||||
|
||||
void clause::deallocate(ast_manager & m) {
|
||||
clause_del_eh * del_eh = get_del_eh();
|
||||
if (del_eh)
|
||||
|
@ -92,7 +92,7 @@ namespace smt {
|
|||
unsigned num_atoms = get_num_atoms();
|
||||
for (unsigned i = 0; i < num_atoms; i++) {
|
||||
m.dec_ref(get_atom(i));
|
||||
const_cast<expr**>(get_atoms_addr())[i] = 0;
|
||||
const_cast<expr**>(get_atoms_addr())[i] = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -115,4 +115,3 @@ namespace smt {
|
|||
}
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -149,8 +149,8 @@ namespace smt {
|
|||
void release_atoms(ast_manager & m);
|
||||
|
||||
public:
|
||||
static clause * mk(ast_manager & m, unsigned num_lits, literal * lits, clause_kind k, justification * js = 0,
|
||||
clause_del_eh * del_eh = 0, bool save_atoms = false, expr * const * bool_var2expr_map = 0);
|
||||
static clause * mk(ast_manager & m, unsigned num_lits, literal * lits, clause_kind k, justification * js = nullptr,
|
||||
clause_del_eh * del_eh = nullptr, bool save_atoms = false, expr * const * bool_var2expr_map = nullptr);
|
||||
|
||||
void deallocate(ast_manager & m);
|
||||
|
||||
|
@ -192,13 +192,13 @@ namespace smt {
|
|||
return m_lits[idx];
|
||||
}
|
||||
|
||||
literal * begin_literals() { return m_lits; }
|
||||
literal * begin() { return m_lits; }
|
||||
|
||||
literal * end_literals() { return m_lits + m_num_literals; }
|
||||
literal * end() { return m_lits + m_num_literals; }
|
||||
|
||||
literal const * begin_literals() const { return m_lits; }
|
||||
literal const * begin() const { return m_lits; }
|
||||
|
||||
literal const * end_literals() const { return m_lits + m_num_literals; }
|
||||
literal const * end() const { return m_lits + m_num_literals; }
|
||||
|
||||
unsigned get_activity() const {
|
||||
SASSERT(is_lemma());
|
||||
|
@ -211,11 +211,11 @@ namespace smt {
|
|||
}
|
||||
|
||||
clause_del_eh * get_del_eh() const {
|
||||
return m_has_del_eh ? *(get_del_eh_addr()) : 0;
|
||||
return m_has_del_eh ? *(get_del_eh_addr()) : nullptr;
|
||||
}
|
||||
|
||||
justification * get_justification() const {
|
||||
return m_has_justification ? *(get_justification_addr()) : 0;
|
||||
return m_has_justification ? *(get_justification_addr()) : nullptr;
|
||||
}
|
||||
|
||||
unsigned get_num_atoms() const {
|
||||
|
@ -253,7 +253,7 @@ namespace smt {
|
|||
clause_del_eh * del_eh = get_del_eh();
|
||||
if (del_eh) {
|
||||
(*del_eh)(m, this);
|
||||
*(const_cast<clause_del_eh **>(get_del_eh_addr())) = 0;
|
||||
*(const_cast<clause_del_eh **>(get_del_eh_addr())) = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ namespace smt {
|
|||
m_assigned_literals(assigned_literals),
|
||||
m_lemma_atoms(m),
|
||||
m_todo_js_qhead(0),
|
||||
m_antecedents(0),
|
||||
m_antecedents(nullptr),
|
||||
m_watches(watches),
|
||||
m_new_proofs(m),
|
||||
m_lemma_proof(m)
|
||||
|
@ -204,7 +204,7 @@ namespace smt {
|
|||
eq2literals(p.first, p.second);
|
||||
}
|
||||
if (m_todo_js_qhead == m_todo_js.size()) {
|
||||
m_antecedents = 0;
|
||||
m_antecedents = nullptr;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -480,7 +480,7 @@ namespace smt {
|
|||
|
||||
// save space for first uip
|
||||
m_lemma.push_back(null_literal);
|
||||
m_lemma_atoms.push_back(0);
|
||||
m_lemma_atoms.push_back(nullptr);
|
||||
|
||||
unsigned num_marks = 0;
|
||||
if (not_l != null_literal) {
|
||||
|
@ -758,7 +758,7 @@ namespace smt {
|
|||
return pr;
|
||||
}
|
||||
m_todo_pr.push_back(tp_elem(n1, n2));
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -766,12 +766,12 @@ namespace smt {
|
|||
*/
|
||||
proof * conflict_resolution::norm_eq_proof(enode * n1, enode * n2, proof * pr) {
|
||||
if (!pr)
|
||||
return 0;
|
||||
return nullptr;
|
||||
SASSERT(m_manager.has_fact(pr));
|
||||
app * fact = to_app(m_manager.get_fact(pr));
|
||||
app * n1_owner = n1->get_owner();
|
||||
app * n2_owner = n2->get_owner();
|
||||
bool is_eq = m_manager.is_eq(fact) || m_manager.is_iff(fact);
|
||||
bool is_eq = m_manager.is_eq(fact);
|
||||
if (!is_eq || (fact->get_arg(0) != n2_owner && fact->get_arg(1) != n2_owner)) {
|
||||
CTRACE("norm_eq_proof_bug", !m_ctx.is_true(n2) && !m_ctx.is_false(n2),
|
||||
tout << "n1: #" << n1->get_owner_id() << ", n2: #" << n2->get_owner_id() << "\n";
|
||||
|
@ -794,7 +794,7 @@ namespace smt {
|
|||
TRACE("norm_eq_proof",
|
||||
tout << "#" << n1->get_owner_id() << " = #" << n2->get_owner_id() << "\n";
|
||||
tout << mk_ll_pp(pr, m_manager, true, false););
|
||||
SASSERT(m_manager.is_eq(fact) || m_manager.is_iff(fact));
|
||||
SASSERT(m_manager.is_eq(fact));
|
||||
SASSERT((fact->get_arg(0) == n1->get_owner() && fact->get_arg(1) == n2->get_owner()) ||
|
||||
(fact->get_arg(1) == n1->get_owner() && fact->get_arg(0) == n2->get_owner()));
|
||||
if (fact->get_arg(0) == n1_owner && fact->get_arg(1) == n2_owner)
|
||||
|
@ -814,7 +814,7 @@ namespace smt {
|
|||
switch (js.get_kind()) {
|
||||
case eq_justification::AXIOM:
|
||||
UNREACHABLE();
|
||||
return 0;
|
||||
return nullptr;
|
||||
case eq_justification::EQUATION:
|
||||
TRACE("proof_gen_bug", tout << js.get_literal() << "\n"; m_ctx.display_literal_info(tout, js.get_literal()););
|
||||
return norm_eq_proof(n1, n2, get_proof(js.get_literal()));
|
||||
|
@ -845,11 +845,11 @@ namespace smt {
|
|||
visited = false;
|
||||
}
|
||||
if (!visited)
|
||||
return 0;
|
||||
return nullptr;
|
||||
app * e1 = n1->get_owner();
|
||||
app * e2 = n2->get_owner();
|
||||
app * e2_prime = m_manager.mk_app(e2->get_decl(), e2->get_arg(1), e2->get_arg(0));
|
||||
proof * pr1 = 0;
|
||||
proof * pr1 = nullptr;
|
||||
if (!prs.empty()) {
|
||||
pr1 = m_manager.mk_congruence(e1, e2_prime, prs.size(), prs.c_ptr());
|
||||
m_new_proofs.push_back(pr1);
|
||||
|
@ -877,14 +877,14 @@ namespace smt {
|
|||
}
|
||||
}
|
||||
if (!visited)
|
||||
return 0;
|
||||
return nullptr;
|
||||
proof * pr = m_manager.mk_congruence(n1->get_owner(), n2->get_owner(), prs.size(), prs.c_ptr());
|
||||
m_new_proofs.push_back(pr);
|
||||
return pr;
|
||||
}
|
||||
default:
|
||||
UNREACHABLE();
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -899,7 +899,7 @@ namespace smt {
|
|||
return pr;
|
||||
}
|
||||
m_todo_pr.push_back(tp_elem(l));
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -945,7 +945,7 @@ namespace smt {
|
|||
SASSERT(js);
|
||||
proof * pr = get_proof(js);
|
||||
ptr_buffer<proof> prs;
|
||||
bool visited = pr != 0;
|
||||
bool visited = pr != nullptr;
|
||||
TRACE("get_proof_bug", if (pr != 0) tout << js->get_name() << "\n";);
|
||||
CTRACE("get_proof_bug_after", invocation_counter >= DUMP_AFTER_NUM_INVOCATIONS, if (pr != 0) tout << js->get_name() << "\n";);
|
||||
CTRACE("get_proof_bug_after", invocation_counter >= DUMP_AFTER_NUM_INVOCATIONS, if (pr != 0) js->display_debug_info(*this, tout););
|
||||
|
@ -973,7 +973,7 @@ namespace smt {
|
|||
visited = false;
|
||||
}
|
||||
if (!visited)
|
||||
return 0;
|
||||
return nullptr;
|
||||
expr_ref l_exr(m_manager);
|
||||
m_ctx.literal2expr(l, l_exr);
|
||||
TRACE("get_proof_bug",
|
||||
|
@ -1033,8 +1033,9 @@ namespace smt {
|
|||
return pr;
|
||||
}
|
||||
SASSERT(js != 0);
|
||||
TRACE("proof_gen_bug", tout << js << "\n";);
|
||||
m_todo_pr.push_back(tp_elem(js));
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void conflict_resolution::init_mk_proof() {
|
||||
|
@ -1061,7 +1062,7 @@ namespace smt {
|
|||
SASSERT(js.get_kind() != b_justification::AXIOM);
|
||||
if (js.get_kind() == b_justification::CLAUSE) {
|
||||
clause * cls = js.get_clause();
|
||||
bool visited = get_proof(cls->get_justification()) != 0;
|
||||
bool visited = get_proof(cls->get_justification()) != nullptr;
|
||||
unsigned num_lits = cls->get_num_literals();
|
||||
unsigned i = 0;
|
||||
if (l != false_literal) {
|
||||
|
@ -1070,20 +1071,20 @@ namespace smt {
|
|||
}
|
||||
else {
|
||||
SASSERT(cls->get_literal(1) == l);
|
||||
if (get_proof(~cls->get_literal(0)) == 0)
|
||||
if (get_proof(~cls->get_literal(0)) == nullptr)
|
||||
visited = false;
|
||||
i = 2;
|
||||
}
|
||||
}
|
||||
for (; i < num_lits; i++) {
|
||||
SASSERT(cls->get_literal(i) != l);
|
||||
if (get_proof(~cls->get_literal(i)) == 0)
|
||||
if (get_proof(~cls->get_literal(i)) == nullptr)
|
||||
visited = false;
|
||||
}
|
||||
return visited;
|
||||
}
|
||||
else
|
||||
return get_proof(js.get_justification()) != 0;
|
||||
return get_proof(js.get_justification()) != nullptr;
|
||||
}
|
||||
|
||||
void conflict_resolution::mk_proof(literal l, b_justification js) {
|
||||
|
@ -1114,11 +1115,11 @@ namespace smt {
|
|||
UNREACHABLE();
|
||||
break;
|
||||
case eq_justification::EQUATION:
|
||||
if (get_proof(js.get_literal()) == 0)
|
||||
if (get_proof(js.get_literal()) == nullptr)
|
||||
visited = false;
|
||||
break;
|
||||
case eq_justification::JUSTIFICATION:
|
||||
if (get_proof(js.get_justification()) == 0)
|
||||
if (get_proof(js.get_justification()) == nullptr)
|
||||
visited = false;
|
||||
break;
|
||||
case eq_justification::CONGRUENCE: {
|
||||
|
@ -1132,16 +1133,16 @@ namespace smt {
|
|||
enode * c1_2 = n1->get_arg(1);
|
||||
enode * c2_1 = n2->get_arg(0);
|
||||
enode * c2_2 = n2->get_arg(1);
|
||||
if (c1_1 != c2_2 && get_proof(c1_1, c2_2) == 0)
|
||||
if (c1_1 != c2_2 && get_proof(c1_1, c2_2) == nullptr)
|
||||
visited = false;
|
||||
if (c1_2 != c2_1 && get_proof(c1_2, c2_1) == 0)
|
||||
if (c1_2 != c2_1 && get_proof(c1_2, c2_1) == nullptr)
|
||||
visited = false;
|
||||
}
|
||||
else {
|
||||
for (unsigned i = 0; i < num_args; i++) {
|
||||
enode * c1 = n1->get_arg(i);
|
||||
enode * c2 = n2->get_arg(i);
|
||||
if (c1 != c2 && get_proof(c1, c2) == 0)
|
||||
if (c1 != c2 && get_proof(c1, c2) == nullptr)
|
||||
visited = false;
|
||||
}
|
||||
}
|
||||
|
@ -1204,7 +1205,7 @@ namespace smt {
|
|||
}
|
||||
prs2.pop_back();
|
||||
}
|
||||
proof * pr = 0;
|
||||
proof * pr = nullptr;
|
||||
SASSERT(!prs1.empty());
|
||||
if (prs1.size() == 1)
|
||||
pr = prs1[0];
|
||||
|
@ -1290,13 +1291,13 @@ namespace smt {
|
|||
}
|
||||
|
||||
SASSERT(visit_b_justification(consequent, conflict));
|
||||
proof * pr = 0;
|
||||
proof * pr = nullptr;
|
||||
if (not_l == null_literal) {
|
||||
pr = get_proof(false_literal, conflict);
|
||||
SASSERT(pr);
|
||||
}
|
||||
else {
|
||||
proof * prs[2] = { 0, 0};
|
||||
proof * prs[2] = { nullptr, nullptr};
|
||||
m_lit2proof.find(not_l, prs[0]);
|
||||
SASSERT(prs[0]);
|
||||
prs[1] = get_proof(consequent, conflict);
|
||||
|
@ -1310,13 +1311,13 @@ namespace smt {
|
|||
m_ctx.literal2expr(lit, l_expr);
|
||||
lits.push_back(l_expr);
|
||||
}
|
||||
expr * fact = 0;
|
||||
expr * fact = nullptr;
|
||||
switch (lits.size()) {
|
||||
case 0: fact = 0; break;
|
||||
case 0: fact = nullptr; break;
|
||||
case 1: fact = lits[0]; break;
|
||||
default: fact = m_manager.mk_or(lits.size(), lits.c_ptr());
|
||||
}
|
||||
if (fact == 0)
|
||||
if (fact == nullptr)
|
||||
m_lemma_proof = pr;
|
||||
else
|
||||
m_lemma_proof = m_manager.mk_lemma(pr, fact);
|
||||
|
|
|
@ -96,7 +96,7 @@ namespace smt {
|
|||
};
|
||||
tp_elem(literal l):m_kind(LITERAL), m_lidx(l.index()) {}
|
||||
tp_elem(enode * lhs, enode * rhs):m_kind(EQUALITY), m_lhs(lhs), m_rhs(rhs) {}
|
||||
tp_elem(justification * js):m_kind(JUSTIFICATION), m_js(js) {}
|
||||
tp_elem(justification * js):m_kind(JUSTIFICATION), m_js(js) { SASSERT(js);}
|
||||
};
|
||||
|
||||
svector<tp_elem> m_todo_pr;
|
||||
|
|
|
@ -244,7 +244,7 @@ namespace smt {
|
|||
}
|
||||
literal lit = mk_diseq(k, v);
|
||||
literals.push_back(lit);
|
||||
mk_clause(literals.size(), literals.c_ptr(), 0);
|
||||
mk_clause(literals.size(), literals.c_ptr(), nullptr);
|
||||
TRACE("context", display_literals_verbose(tout, literals.size(), literals.c_ptr()););
|
||||
}
|
||||
}
|
||||
|
@ -637,15 +637,14 @@ namespace smt {
|
|||
model_ref mdl;
|
||||
for (unsigned i = 0; i < unfixed.size(); ++i) {
|
||||
push();
|
||||
for (unsigned j = 0; j < assumptions.size(); ++j) {
|
||||
assert_expr(assumptions[j]);
|
||||
}
|
||||
for (expr* a : assumptions)
|
||||
assert_expr(a);
|
||||
TRACE("context", tout << "checking unfixed: " << mk_pp(unfixed[i], m) << "\n";);
|
||||
lbool is_sat = check();
|
||||
SASSERT(is_sat != l_false);
|
||||
if (is_sat == l_true) {
|
||||
get_model(mdl);
|
||||
mdl->eval(unfixed[i], tmp);
|
||||
tmp = (*mdl)(unfixed[i]);
|
||||
if (m.is_value(tmp)) {
|
||||
tmp = m.mk_not(m.mk_eq(unfixed[i], tmp));
|
||||
assert_expr(tmp);
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -168,6 +168,8 @@ namespace smt {
|
|||
expr_ref_vector m_units_to_reassert;
|
||||
svector<char> m_units_to_reassert_sign;
|
||||
literal_vector m_assigned_literals;
|
||||
typedef std::pair<clause*, literal_vector> tmp_clause;
|
||||
vector<tmp_clause> m_tmp_clauses;
|
||||
unsigned m_qhead;
|
||||
unsigned m_simp_qhead;
|
||||
int m_simp_counter; //!< can become negative
|
||||
|
@ -203,11 +205,11 @@ namespace smt {
|
|||
struct scoped_mk_model {
|
||||
context & m_ctx;
|
||||
scoped_mk_model(context & ctx):m_ctx(ctx) {
|
||||
m_ctx.m_proto_model = 0;
|
||||
m_ctx.m_model = 0;
|
||||
m_ctx.m_proto_model = nullptr;
|
||||
m_ctx.m_model = nullptr;
|
||||
}
|
||||
~scoped_mk_model() {
|
||||
if (m_ctx.m_proto_model.get() != 0) {
|
||||
if (m_ctx.m_proto_model.get() != nullptr) {
|
||||
m_ctx.m_model = m_ctx.m_proto_model->mk_model();
|
||||
try {
|
||||
m_ctx.add_rec_funs_to_model();
|
||||
|
@ -215,7 +217,7 @@ namespace smt {
|
|||
catch (...) {
|
||||
// no op
|
||||
}
|
||||
m_ctx.m_proto_model = 0; // proto_model is not needed anymore.
|
||||
m_ctx.m_proto_model = nullptr; // proto_model is not needed anymore.
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -262,6 +264,8 @@ namespace smt {
|
|||
return m_params;
|
||||
}
|
||||
|
||||
void updt_params(params_ref const& p);
|
||||
|
||||
bool get_cancel_flag();
|
||||
|
||||
region & get_region() {
|
||||
|
@ -317,6 +321,7 @@ namespace smt {
|
|||
}
|
||||
#endif
|
||||
|
||||
clause_vector const& get_lemmas() const { return m_lemmas; }
|
||||
|
||||
literal get_literal(expr * n) const;
|
||||
|
||||
|
@ -514,12 +519,12 @@ namespace smt {
|
|||
|
||||
enode_vector::const_iterator begin_enodes_of(func_decl const * decl) const {
|
||||
unsigned id = decl->get_decl_id();
|
||||
return id < m_decl2enodes.size() ? m_decl2enodes[id].begin() : 0;
|
||||
return id < m_decl2enodes.size() ? m_decl2enodes[id].begin() : nullptr;
|
||||
}
|
||||
|
||||
enode_vector::const_iterator end_enodes_of(func_decl const * decl) const {
|
||||
unsigned id = decl->get_decl_id();
|
||||
return id < m_decl2enodes.size() ? m_decl2enodes[id].end() : 0;
|
||||
return id < m_decl2enodes.size() ? m_decl2enodes[id].end() : nullptr;
|
||||
}
|
||||
|
||||
ptr_vector<enode>::const_iterator begin_enodes() const {
|
||||
|
@ -619,8 +624,6 @@ namespace smt {
|
|||
|
||||
void remove_cls_occs(clause * cls);
|
||||
|
||||
void mark_as_deleted(clause * cls);
|
||||
|
||||
void del_clause(clause * cls);
|
||||
|
||||
void del_clauses(clause_vector & v, unsigned old_size);
|
||||
|
@ -645,6 +648,14 @@ namespace smt {
|
|||
|
||||
void reassert_units(unsigned units_to_reassert_lim);
|
||||
|
||||
public:
|
||||
// \brief exposed for PB solver to participate in GC
|
||||
|
||||
void remove_watch(bool_var v);
|
||||
|
||||
void mark_as_deleted(clause * cls);
|
||||
|
||||
|
||||
// -----------------------------------
|
||||
//
|
||||
// Internalization
|
||||
|
@ -746,7 +757,7 @@ namespace smt {
|
|||
friend class mk_bool_var_trail;
|
||||
class mk_bool_var_trail : public trail<context> {
|
||||
public:
|
||||
virtual void undo(context & ctx) { ctx.undo_mk_bool_var(); }
|
||||
void undo(context & ctx) override { ctx.undo_mk_bool_var(); }
|
||||
};
|
||||
mk_bool_var_trail m_mk_bool_var_trail;
|
||||
|
||||
|
@ -755,7 +766,7 @@ namespace smt {
|
|||
friend class mk_enode_trail;
|
||||
class mk_enode_trail : public trail<context> {
|
||||
public:
|
||||
virtual void undo(context & ctx) { ctx.undo_mk_enode(); }
|
||||
void undo(context & ctx) override { ctx.undo_mk_enode(); }
|
||||
};
|
||||
|
||||
mk_enode_trail m_mk_enode_trail;
|
||||
|
@ -822,17 +833,17 @@ namespace smt {
|
|||
|
||||
void internalize(expr * n, bool gate_ctx, unsigned generation);
|
||||
|
||||
clause * mk_clause(unsigned num_lits, literal * lits, justification * j, clause_kind k = CLS_AUX, clause_del_eh * del_eh = 0);
|
||||
clause * mk_clause(unsigned num_lits, literal * lits, justification * j, clause_kind k = CLS_AUX, clause_del_eh * del_eh = nullptr);
|
||||
|
||||
void mk_clause(literal l1, literal l2, justification * j);
|
||||
|
||||
void mk_clause(literal l1, literal l2, literal l3, justification * j);
|
||||
|
||||
void mk_th_axiom(theory_id tid, unsigned num_lits, literal * lits, unsigned num_params = 0, parameter * params = 0);
|
||||
void mk_th_axiom(theory_id tid, unsigned num_lits, literal * lits, unsigned num_params = 0, parameter * params = nullptr);
|
||||
|
||||
void mk_th_axiom(theory_id tid, literal l1, literal l2, unsigned num_params = 0, parameter * params = 0);
|
||||
void mk_th_axiom(theory_id tid, literal l1, literal l2, unsigned num_params = 0, parameter * params = nullptr);
|
||||
|
||||
void mk_th_axiom(theory_id tid, literal l1, literal l2, literal l3, unsigned num_params = 0, parameter * params = 0);
|
||||
void mk_th_axiom(theory_id tid, literal l1, literal l2, literal l3, unsigned num_params = 0, parameter * params = nullptr);
|
||||
|
||||
/*
|
||||
* Provide a hint to the core solver that the specified literals form a "theory case split".
|
||||
|
@ -883,10 +894,11 @@ namespace smt {
|
|||
failure m_last_search_failure;
|
||||
ptr_vector<theory> m_incomplete_theories; //!< theories that failed to produce a model
|
||||
bool m_searching;
|
||||
ptr_vector<expr> m_assumption_core;
|
||||
unsigned m_num_conflicts;
|
||||
unsigned m_num_conflicts_since_restart;
|
||||
unsigned m_num_conflicts_since_lemma_gc;
|
||||
unsigned m_num_restarts;
|
||||
unsigned m_num_simplifications;
|
||||
unsigned m_restart_threshold;
|
||||
unsigned m_restart_outer_threshold;
|
||||
unsigned m_luby_idx;
|
||||
|
@ -897,7 +909,7 @@ namespace smt {
|
|||
void trace_assign(literal l, b_justification j, bool decision) const;
|
||||
|
||||
public:
|
||||
void assign(literal l, b_justification j, bool decision = false) {
|
||||
void assign(literal l, const b_justification & j, bool decision = false) {
|
||||
SASSERT(l != false_literal);
|
||||
SASSERT(l != null_literal);
|
||||
switch (get_assignment(l)) {
|
||||
|
@ -998,9 +1010,9 @@ namespace smt {
|
|||
|
||||
void assign_quantifier(quantifier * q);
|
||||
|
||||
void set_conflict(b_justification js, literal not_l);
|
||||
void set_conflict(const b_justification & js, literal not_l);
|
||||
|
||||
void set_conflict(b_justification js) {
|
||||
void set_conflict(const b_justification & js) {
|
||||
set_conflict(js, null_literal);
|
||||
}
|
||||
|
||||
|
@ -1028,6 +1040,8 @@ namespace smt {
|
|||
|
||||
enode * get_enode_eq_to(func_decl * f, unsigned num_args, enode * const * args);
|
||||
|
||||
expr* next_decision();
|
||||
|
||||
protected:
|
||||
bool decide();
|
||||
|
||||
|
@ -1091,15 +1105,23 @@ namespace smt {
|
|||
|
||||
void assert_assumption(expr * a);
|
||||
|
||||
bool validate_assumptions(unsigned num_assumptions, expr * const * assumptions);
|
||||
bool validate_assumptions(expr_ref_vector const& asms);
|
||||
|
||||
void init_assumptions(unsigned num_assumptions, expr * const * assumptions);
|
||||
void init_assumptions(expr_ref_vector const& asms);
|
||||
|
||||
void init_clause(expr_ref_vector const& clause);
|
||||
|
||||
lbool decide_clause();
|
||||
|
||||
void reset_tmp_clauses();
|
||||
|
||||
void reset_assumptions();
|
||||
|
||||
void reset_clause();
|
||||
|
||||
void add_theory_assumptions(expr_ref_vector & theory_assumptions);
|
||||
|
||||
lbool mk_unsat_core();
|
||||
lbool mk_unsat_core(lbool result);
|
||||
|
||||
void validate_unsat_core();
|
||||
|
||||
|
@ -1387,7 +1409,7 @@ namespace smt {
|
|||
void flush();
|
||||
config_mode get_config_mode(bool use_static_features) const;
|
||||
virtual void setup_context(bool use_static_features);
|
||||
void setup_components(void);
|
||||
void setup_components();
|
||||
void pop_to_base_lvl();
|
||||
void pop_to_search_lvl();
|
||||
#ifdef Z3DEBUG
|
||||
|
@ -1460,7 +1482,7 @@ namespace smt {
|
|||
If l == 0, then the logic of this context is used in the new context.
|
||||
If p == 0, then this->m_params is used
|
||||
*/
|
||||
context * mk_fresh(symbol const * l = 0, smt_params * p = 0);
|
||||
context * mk_fresh(symbol const * l = nullptr, smt_params * p = nullptr);
|
||||
|
||||
static void copy(context& src, context& dst);
|
||||
|
||||
|
@ -1482,7 +1504,9 @@ namespace smt {
|
|||
|
||||
void pop(unsigned num_scopes);
|
||||
|
||||
lbool check(unsigned num_assumptions = 0, expr * const * assumptions = 0, bool reset_cancel = true, bool already_did_theory_assumptions = false);
|
||||
lbool check(unsigned num_assumptions = 0, expr * const * assumptions = nullptr, bool reset_cancel = true, bool already_did_theory_assumptions = false);
|
||||
|
||||
lbool check(expr_ref_vector const& cube, vector<expr_ref_vector> const& clauses);
|
||||
|
||||
lbool get_consequences(expr_ref_vector const& assumptions, expr_ref_vector const& vars, expr_ref_vector& conseq, expr_ref_vector& unfixed);
|
||||
|
||||
|
@ -1511,6 +1535,8 @@ namespace smt {
|
|||
|
||||
void internalize_assertion(expr * n, proof * pr, unsigned generation);
|
||||
|
||||
void internalize_proxies(expr_ref_vector const& asms, vector<std::pair<expr*,expr_ref>>& asm2proxy);
|
||||
|
||||
void internalize_instance(expr * body, proof * pr, unsigned generation) {
|
||||
internalize_assertion(body, pr, generation);
|
||||
if (relevancy())
|
||||
|
|
|
@ -43,13 +43,9 @@ namespace smt {
|
|||
}
|
||||
|
||||
bool context::check_clauses(clause_vector const & v) const {
|
||||
clause_vector::const_iterator it = v.begin();
|
||||
clause_vector::const_iterator end = v.end();
|
||||
for (; it != end; ++it) {
|
||||
clause * cls = *it;
|
||||
for (clause* cls : v)
|
||||
if (!cls->deleted())
|
||||
check_clause(cls);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -92,10 +88,7 @@ namespace smt {
|
|||
|
||||
bool context::check_lit_occs(literal l) const {
|
||||
clause_set const & v = m_lit_occs[l.index()];
|
||||
clause_set::iterator it = v.begin();
|
||||
clause_set::iterator end = v.end();
|
||||
for (; it != end; ++it) {
|
||||
clause * cls = *it;
|
||||
for (clause * cls : v) {
|
||||
unsigned num = cls->get_num_literals();
|
||||
unsigned i = 0;
|
||||
for (; i < num; i++)
|
||||
|
@ -138,10 +131,8 @@ namespace smt {
|
|||
}
|
||||
|
||||
bool context::check_enodes() const {
|
||||
ptr_vector<enode>::const_iterator it = m_enodes.begin();
|
||||
ptr_vector<enode>::const_iterator end = m_enodes.end();
|
||||
for (; it != end; ++it) {
|
||||
check_enode(*it);
|
||||
for (enode* n : m_enodes) {
|
||||
check_enode(n);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -157,11 +148,9 @@ namespace smt {
|
|||
}
|
||||
|
||||
bool context::check_missing_clause_propagation(clause_vector const & v) const {
|
||||
clause_vector::const_iterator it = v.begin();
|
||||
clause_vector::const_iterator end = v.end();
|
||||
for (; it != end; ++it) {
|
||||
CTRACE("missing_propagation", is_unit_clause(*it), display_clause_detail(tout, *it); tout << "\n";);
|
||||
SASSERT(!is_unit_clause(*it));
|
||||
for (clause * cls : v) {
|
||||
CTRACE("missing_propagation", is_unit_clause(cls), display_clause_detail(tout, cls); tout << "\n";);
|
||||
SASSERT(!is_unit_clause(cls));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -188,10 +177,7 @@ namespace smt {
|
|||
}
|
||||
|
||||
bool context::check_missing_eq_propagation() const {
|
||||
ptr_vector<enode>::const_iterator it = m_enodes.begin();
|
||||
ptr_vector<enode>::const_iterator end = m_enodes.end();
|
||||
for (; it != end; ++it) {
|
||||
enode * n = *it;
|
||||
for (enode* n : m_enodes) {
|
||||
SASSERT(!n->is_true_eq() || get_assignment(n) == l_true);
|
||||
if (n->is_eq() && get_assignment(n) == l_true) {
|
||||
SASSERT(n->is_true_eq());
|
||||
|
@ -201,13 +187,8 @@ namespace smt {
|
|||
}
|
||||
|
||||
bool context::check_missing_congruence() const {
|
||||
ptr_vector<enode>::const_iterator it = m_enodes.begin();
|
||||
ptr_vector<enode>::const_iterator end = m_enodes.end();
|
||||
for (; it != end; ++it) {
|
||||
enode * n = *it;
|
||||
ptr_vector<enode>::const_iterator it2 = m_enodes.begin();
|
||||
for (; it2 != end; ++it2) {
|
||||
enode * n2 = *it2;
|
||||
for (enode* n : m_enodes) {
|
||||
for (enode* n2 : m_enodes) {
|
||||
if (n->get_root() != n2->get_root()) {
|
||||
if (n->is_true_eq() && n2->is_true_eq())
|
||||
continue;
|
||||
|
@ -222,10 +203,7 @@ namespace smt {
|
|||
}
|
||||
|
||||
bool context::check_missing_bool_enode_propagation() const {
|
||||
ptr_vector<enode>::const_iterator it = m_enodes.begin();
|
||||
ptr_vector<enode>::const_iterator end = m_enodes.end();
|
||||
for (; it != end; ++it) {
|
||||
enode * n = *it;
|
||||
for (enode* n : m_enodes) {
|
||||
if (m_manager.is_bool(n->get_owner()) && get_assignment(n) == l_undef) {
|
||||
enode * first = n;
|
||||
do {
|
||||
|
@ -286,10 +264,7 @@ namespace smt {
|
|||
For all a, b. root(a) == root(b) ==> get_assignment(a) == get_assignment(b)
|
||||
*/
|
||||
bool context::check_eqc_bool_assignment() const {
|
||||
ptr_vector<enode>::const_iterator it = m_enodes.begin();
|
||||
ptr_vector<enode>::const_iterator end = m_enodes.end();
|
||||
for (; it != end; ++it) {
|
||||
enode * e = *it;
|
||||
for (enode* e : m_enodes) {
|
||||
if (m_manager.is_bool(e->get_owner())) {
|
||||
enode * r = e->get_root();
|
||||
CTRACE("eqc_bool", get_assignment(e) != get_assignment(r),
|
||||
|
@ -343,24 +318,24 @@ namespace smt {
|
|||
TRACE("check_th_diseq_propagation", tout << "checking theory: " << m_manager.get_family_name(th_id) << "\n";);
|
||||
// if the theory doesn't use diseqs, then the diseqs are not propagated.
|
||||
if (th->use_diseqs() && rhs->get_th_var(th_id) != null_theory_var) {
|
||||
bool found = false;
|
||||
// lhs and rhs are attached to theory th_id
|
||||
svector<new_th_eq>::const_iterator it = m_propagated_th_diseqs.begin();
|
||||
svector<new_th_eq>::const_iterator end = m_propagated_th_diseqs.end();
|
||||
for (; it != end; ++it) {
|
||||
if (it->m_th_id == th_id) {
|
||||
enode * lhs_prime = th->get_enode(it->m_lhs)->get_root();
|
||||
enode * rhs_prime = th->get_enode(it->m_rhs)->get_root();
|
||||
for (new_th_eq const& eq : m_propagated_th_diseqs) {
|
||||
if (eq.m_th_id == th_id) {
|
||||
enode * lhs_prime = th->get_enode(eq.m_lhs)->get_root();
|
||||
enode * rhs_prime = th->get_enode(eq.m_rhs)->get_root();
|
||||
TRACE("check_th_diseq_propagation",
|
||||
tout << m_manager.get_family_name(it->m_th_id) << "\n";);
|
||||
tout << m_manager.get_family_name(eq.m_th_id) << "\n";);
|
||||
|
||||
if ((lhs == lhs_prime && rhs == rhs_prime) ||
|
||||
(rhs == lhs_prime && lhs == rhs_prime)) {
|
||||
TRACE("check_th_diseq_propagation", tout << "ok v" << v << " " << get_assignment(v) << "\n";);
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (it == end) {
|
||||
if (!found) {
|
||||
// missed theory diseq propagation
|
||||
display(std::cout);
|
||||
std::cout << "checking theory: " << m_manager.get_family_name(th_id) << "\n";
|
||||
|
@ -369,8 +344,7 @@ namespace smt {
|
|||
std::cout << "lhs: #" << lhs->get_owner_id() << ", rhs: #" << rhs->get_owner_id() << "\n";
|
||||
std::cout << mk_bounded_pp(lhs->get_owner(), m_manager) << " " << mk_bounded_pp(rhs->get_owner(), m_manager) << "\n";
|
||||
}
|
||||
|
||||
SASSERT(it != end);
|
||||
VERIFY(found);
|
||||
}
|
||||
l = l->get_next();
|
||||
}
|
||||
|
@ -381,11 +355,9 @@ namespace smt {
|
|||
}
|
||||
|
||||
bool context::check_missing_diseq_conflict() const {
|
||||
svector<enode_pair>::const_iterator it = m_diseq_vector.begin();
|
||||
svector<enode_pair>::const_iterator end = m_diseq_vector.end();
|
||||
for (; it != end; ++it) {
|
||||
enode * n1 = it->first;
|
||||
enode * n2 = it->second;
|
||||
for (enode_pair const& p : m_diseq_vector) {
|
||||
enode * n1 = p.first;
|
||||
enode * n2 = p.second;
|
||||
if (n1->get_root() == n2->get_root()) {
|
||||
TRACE("diseq_bug",
|
||||
tout << "n1: #" << n1->get_owner_id() << ", n2: #" << n2->get_owner_id() <<
|
||||
|
@ -420,10 +392,7 @@ namespace smt {
|
|||
return true;
|
||||
}
|
||||
ast_manager& m = m_manager;
|
||||
literal_vector::const_iterator it = m_assigned_literals.begin();
|
||||
literal_vector::const_iterator end = m_assigned_literals.end();
|
||||
for (; it != end; ++it) {
|
||||
literal lit = *it;
|
||||
for (literal lit : m_assigned_literals) {
|
||||
if (!is_relevant(lit)) {
|
||||
continue;
|
||||
}
|
||||
|
@ -435,7 +404,7 @@ namespace smt {
|
|||
if (is_quantifier(n) && m.is_rec_fun_def(to_quantifier(n))) {
|
||||
continue;
|
||||
}
|
||||
switch (get_assignment(*it)) {
|
||||
switch (get_assignment(lit)) {
|
||||
case l_undef:
|
||||
break;
|
||||
case l_true:
|
||||
|
|
|
@ -19,7 +19,7 @@ Revision History:
|
|||
#include "smt/smt_context.h"
|
||||
#include "ast/ast_ll_pp.h"
|
||||
#include "ast/ast_pp.h"
|
||||
#include "ast/ast_smt_pp.h"
|
||||
#include "ast/ast_pp_util.h"
|
||||
#include "util/stats.h"
|
||||
|
||||
namespace smt {
|
||||
|
@ -43,11 +43,10 @@ namespace smt {
|
|||
return out << "RESOURCE_LIMIT";
|
||||
case THEORY:
|
||||
if (!m_incomplete_theories.empty()) {
|
||||
ptr_vector<theory>::const_iterator it = m_incomplete_theories.begin();
|
||||
ptr_vector<theory>::const_iterator end = m_incomplete_theories.end();
|
||||
for (bool first = true; it != end; ++it) {
|
||||
bool first = true;
|
||||
for (theory* th : m_incomplete_theories) {
|
||||
if (first) first = false; else out << " ";
|
||||
out << (*it)->get_name();
|
||||
out << th->get_name();
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@ -173,12 +172,10 @@ namespace smt {
|
|||
|
||||
void context::display_binary_clauses(std::ostream & out) const {
|
||||
bool first = true;
|
||||
vector<watch_list>::const_iterator it = m_watches.begin();
|
||||
vector<watch_list>::const_iterator end = m_watches.end();
|
||||
for (unsigned l_idx = 0; it != end; ++it, ++l_idx) {
|
||||
literal l1 = to_literal(l_idx);
|
||||
unsigned l_idx = 0;
|
||||
for (watch_list const& wl : m_watches) {
|
||||
literal l1 = to_literal(l_idx++);
|
||||
literal neg_l1 = ~l1;
|
||||
watch_list const & wl = *it;
|
||||
literal const * it2 = wl.begin_literals();
|
||||
literal const * end2 = wl.end_literals();
|
||||
for (; it2 != end2; ++it2) {
|
||||
|
@ -291,10 +288,7 @@ namespace smt {
|
|||
}
|
||||
|
||||
void context::display_theories(std::ostream & out) const {
|
||||
ptr_vector<theory>::const_iterator it = m_theory_set.begin();
|
||||
ptr_vector<theory>::const_iterator end = m_theory_set.end();
|
||||
for (; it != end; ++it) {
|
||||
theory * th = *it;
|
||||
for (theory* th : m_theory_set) {
|
||||
th->display(out);
|
||||
}
|
||||
}
|
||||
|
@ -347,10 +341,7 @@ namespace smt {
|
|||
}
|
||||
|
||||
void context::display_parent_eqs(std::ostream & out, enode * n) const {
|
||||
enode_vector::iterator it = n->begin_parents();
|
||||
enode_vector::iterator end = n->end_parents();
|
||||
for (; it != end; ++it) {
|
||||
enode * parent = *it;
|
||||
for (enode* parent : n->get_parents()) {
|
||||
if (parent->is_eq())
|
||||
display_eq_detail(out, parent);
|
||||
}
|
||||
|
@ -393,10 +384,8 @@ namespace smt {
|
|||
#endif
|
||||
m_qmanager->collect_statistics(st);
|
||||
m_asserted_formulas.collect_statistics(st);
|
||||
ptr_vector<theory>::const_iterator it = m_theory_set.begin();
|
||||
ptr_vector<theory>::const_iterator end = m_theory_set.end();
|
||||
for (; it != end; ++it) {
|
||||
(*it)->collect_statistics(st);
|
||||
for (theory* th : m_theory_set) {
|
||||
th->collect_statistics(st);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -413,19 +402,23 @@ namespace smt {
|
|||
}
|
||||
|
||||
void context::display_lemma_as_smt_problem(std::ostream & out, unsigned num_antecedents, literal const * antecedents, literal consequent, symbol const& logic) const {
|
||||
ast_smt_pp pp(m_manager);
|
||||
pp.set_benchmark_name("lemma");
|
||||
pp.set_status("unsat");
|
||||
pp.set_logic(logic);
|
||||
ast_pp_util visitor(m_manager);
|
||||
expr_ref_vector fmls(m_manager);
|
||||
visitor.collect(fmls);
|
||||
expr_ref n(m_manager);
|
||||
for (unsigned i = 0; i < num_antecedents; i++) {
|
||||
literal l = antecedents[i];
|
||||
expr_ref n(m_manager);
|
||||
literal2expr(l, n);
|
||||
pp.add_assumption(n);
|
||||
fmls.push_back(n);
|
||||
}
|
||||
expr_ref n(m_manager);
|
||||
literal2expr(~consequent, n);
|
||||
pp.display_smt2(out, n);
|
||||
if (consequent != false_literal) {
|
||||
literal2expr(~consequent, n);
|
||||
fmls.push_back(n);
|
||||
}
|
||||
if (logic != symbol::null) out << "(set-logic " << logic << ")\n";
|
||||
visitor.collect(fmls);
|
||||
visitor.display_decls(out);
|
||||
visitor.display_asserts(out, fmls, true);
|
||||
}
|
||||
|
||||
static unsigned g_lemma_id = 0;
|
||||
|
@ -448,25 +441,29 @@ namespace smt {
|
|||
void context::display_lemma_as_smt_problem(std::ostream & out, unsigned num_antecedents, literal const * antecedents,
|
||||
unsigned num_eq_antecedents, enode_pair const * eq_antecedents,
|
||||
literal consequent, symbol const& logic) const {
|
||||
ast_smt_pp pp(m_manager);
|
||||
pp.set_benchmark_name("lemma");
|
||||
pp.set_status("unsat");
|
||||
pp.set_logic(logic);
|
||||
ast_pp_util visitor(m_manager);
|
||||
expr_ref_vector fmls(m_manager);
|
||||
visitor.collect(fmls);
|
||||
expr_ref n(m_manager);
|
||||
for (unsigned i = 0; i < num_antecedents; i++) {
|
||||
literal l = antecedents[i];
|
||||
expr_ref n(m_manager);
|
||||
literal2expr(l, n);
|
||||
pp.add_assumption(n);
|
||||
fmls.push_back(n);
|
||||
}
|
||||
for (unsigned i = 0; i < num_eq_antecedents; i++) {
|
||||
enode_pair const & p = eq_antecedents[i];
|
||||
expr_ref eq(m_manager);
|
||||
eq = m_manager.mk_eq(p.first->get_owner(), p.second->get_owner());
|
||||
pp.add_assumption(eq);
|
||||
n = m_manager.mk_eq(p.first->get_owner(), p.second->get_owner());
|
||||
fmls.push_back(n);
|
||||
}
|
||||
expr_ref n(m_manager);
|
||||
literal2expr(~consequent, n);
|
||||
pp.display_smt2(out, n);
|
||||
if (consequent != false_literal) {
|
||||
literal2expr(~consequent, n);
|
||||
fmls.push_back(n);
|
||||
}
|
||||
|
||||
if (logic != symbol::null) out << "(set-logic " << logic << ")\n";
|
||||
visitor.collect(fmls);
|
||||
visitor.display_decls(out);
|
||||
visitor.display_asserts(out, fmls, true);
|
||||
}
|
||||
|
||||
void context::display_lemma_as_smt_problem(unsigned num_antecedents, literal const * antecedents,
|
||||
|
@ -490,10 +487,7 @@ namespace smt {
|
|||
*/
|
||||
void context::display_normalized_enodes(std::ostream & out) const {
|
||||
out << "normalized enodes:\n";
|
||||
ptr_vector<enode>::const_iterator it = m_enodes.begin();
|
||||
ptr_vector<enode>::const_iterator end = m_enodes.end();
|
||||
for (; it != end; ++it) {
|
||||
enode * n = *it;
|
||||
for (enode * n : m_enodes) {
|
||||
out << "#";
|
||||
out.width(5);
|
||||
out << std::left << n->get_owner_id() << " #";
|
||||
|
@ -524,28 +518,23 @@ namespace smt {
|
|||
}
|
||||
|
||||
void context::display_enodes_lbls(std::ostream & out) const {
|
||||
ptr_vector<enode>::const_iterator it = m_enodes.begin();
|
||||
ptr_vector<enode>::const_iterator end = m_enodes.end();
|
||||
for (; it != end; ++it) {
|
||||
enode * n = *it;
|
||||
for (enode* n : m_enodes) {
|
||||
n->display_lbls(out);
|
||||
}
|
||||
}
|
||||
|
||||
void context::display_decl2enodes(std::ostream & out) const {
|
||||
out << "decl2enodes:\n";
|
||||
vector<enode_vector>::const_iterator it1 = m_decl2enodes.begin();
|
||||
vector<enode_vector>::const_iterator end1 = m_decl2enodes.end();
|
||||
for (unsigned id = 0; it1 != end1; ++it1, ++id) {
|
||||
enode_vector const & v = *it1;
|
||||
unsigned id = 0;
|
||||
for (enode_vector const& v : m_decl2enodes) {
|
||||
if (!v.empty()) {
|
||||
out << "id " << id << " ->";
|
||||
enode_vector::const_iterator it2 = v.begin();
|
||||
enode_vector::const_iterator end2 = v.end();
|
||||
for (; it2 != end2; ++it2)
|
||||
out << " #" << (*it2)->get_owner_id();
|
||||
for (enode* n : v) {
|
||||
out << " #" << n->get_owner_id();
|
||||
}
|
||||
out << "\n";
|
||||
}
|
||||
++id;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -588,20 +577,20 @@ namespace smt {
|
|||
case b_justification::BIN_CLAUSE: {
|
||||
literal l2 = j.get_literal();
|
||||
out << "bin-clause ";
|
||||
display_literal(out, l2);
|
||||
display_literal_verbose(out, l2);
|
||||
break;
|
||||
}
|
||||
case b_justification::CLAUSE: {
|
||||
clause * cls = j.get_clause();
|
||||
out << "clause ";
|
||||
if (cls) display_literals(out, cls->get_num_literals(), cls->begin_literals());
|
||||
if (cls) out << literal_vector(cls->get_num_literals(), cls->begin());
|
||||
break;
|
||||
}
|
||||
case b_justification::JUSTIFICATION: {
|
||||
out << "justification " << j.get_justification()->get_from_theory() << ": ";
|
||||
literal_vector lits;
|
||||
const_cast<conflict_resolution&>(*m_conflict_resolution).justification2literals(j.get_justification(), lits);
|
||||
display_literals(out, lits);
|
||||
display_literals_verbose(out, lits);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
|
|
@ -32,7 +32,7 @@ namespace smt {
|
|||
n->m_owner = owner;
|
||||
n->m_root = n;
|
||||
n->m_next = n;
|
||||
n->m_cg = 0;
|
||||
n->m_cg = nullptr;
|
||||
n->m_class_size = 1;
|
||||
n->m_generation = generation;
|
||||
n->m_func_decl_id = UINT_MAX;
|
||||
|
@ -130,11 +130,11 @@ namespace smt {
|
|||
if (m_th_var_list.get_th_var() == null_theory_var) {
|
||||
m_th_var_list.set_th_var(v);
|
||||
m_th_var_list.set_th_id(id);
|
||||
m_th_var_list.set_next(0);
|
||||
m_th_var_list.set_next(nullptr);
|
||||
}
|
||||
else {
|
||||
theory_var_list * l = &m_th_var_list;
|
||||
while (l->get_next() != 0) {
|
||||
while (l->get_next() != nullptr) {
|
||||
SASSERT(l->get_th_id() != id);
|
||||
l = l->get_next();
|
||||
}
|
||||
|
@ -172,11 +172,11 @@ namespace smt {
|
|||
SASSERT(get_th_var(id) != null_theory_var);
|
||||
if (m_th_var_list.get_th_id() == id) {
|
||||
theory_var_list * next = m_th_var_list.get_next();
|
||||
if (next == 0) {
|
||||
if (next == nullptr) {
|
||||
// most common case
|
||||
m_th_var_list.set_th_var(null_theory_var);
|
||||
m_th_var_list.set_th_id(null_theory_id);
|
||||
m_th_var_list.set_next(0);
|
||||
m_th_var_list.set_next(nullptr);
|
||||
}
|
||||
else {
|
||||
m_th_var_list = *next;
|
||||
|
@ -405,7 +405,7 @@ namespace smt {
|
|||
tmp_enode::tmp_enode():
|
||||
m_app(0),
|
||||
m_capacity(0),
|
||||
m_enode_data(0) {
|
||||
m_enode_data(nullptr) {
|
||||
SASSERT(m_app.get_app()->get_decl() == 0);
|
||||
set_capacity(5);
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ namespace smt {
|
|||
enode * m_target;
|
||||
eq_justification m_justification;
|
||||
trans_justification():
|
||||
m_target(0),
|
||||
m_target(nullptr),
|
||||
m_justification(null_eq_justification) {
|
||||
}
|
||||
};
|
||||
|
@ -116,7 +116,7 @@ namespace smt {
|
|||
|
||||
|
||||
theory_var_list * get_th_var_list() {
|
||||
return m_th_var_list.get_th_var() == null_theory_var ? 0 : &m_th_var_list;
|
||||
return m_th_var_list.get_th_var() == null_theory_var ? nullptr : &m_th_var_list;
|
||||
}
|
||||
|
||||
friend class set_merge_tf_trail;
|
||||
|
@ -216,6 +216,28 @@ namespace smt {
|
|||
return m_args;
|
||||
}
|
||||
|
||||
class const_args {
|
||||
enode const& n;
|
||||
public:
|
||||
const_args(enode const& n):n(n) {}
|
||||
const_args(enode const* n):n(*n) {}
|
||||
enode_vector::const_iterator begin() const { return n.m_args; }
|
||||
enode_vector::const_iterator end() const { return n.m_args + n.get_num_args(); }
|
||||
};
|
||||
|
||||
class args {
|
||||
enode & n;
|
||||
public:
|
||||
args(enode & n):n(n) {}
|
||||
args(enode * n):n(*n) {}
|
||||
enode_vector::iterator begin() const { return n.m_args; }
|
||||
enode_vector::iterator end() const { return n.m_args + n.get_num_args(); }
|
||||
};
|
||||
|
||||
const_args get_const_args() const { return const_args(this); }
|
||||
|
||||
// args get_args() { return args(this); }
|
||||
|
||||
// unsigned get_id() const {
|
||||
// return m_id;
|
||||
// }
|
||||
|
@ -285,6 +307,28 @@ namespace smt {
|
|||
return m_commutative;
|
||||
}
|
||||
|
||||
class const_parents {
|
||||
enode const& n;
|
||||
public:
|
||||
const_parents(enode const& _n):n(_n) {}
|
||||
const_parents(enode const* _n):n(*_n) {}
|
||||
enode_vector::const_iterator begin() const { return n.begin_parents(); }
|
||||
enode_vector::const_iterator end() const { return n.end_parents(); }
|
||||
};
|
||||
|
||||
class parents {
|
||||
enode& n;
|
||||
public:
|
||||
parents(enode & _n):n(_n) {}
|
||||
parents(enode * _n):n(*_n) {}
|
||||
enode_vector::iterator begin() const { return n.begin_parents(); }
|
||||
enode_vector::iterator end() const { return n.end_parents(); }
|
||||
};
|
||||
|
||||
parents get_parents() { return parents(this); }
|
||||
|
||||
const_parents get_const_parents() const { return const_parents(this); }
|
||||
|
||||
unsigned get_num_parents() const {
|
||||
return m_parents.size();
|
||||
}
|
||||
|
@ -306,7 +350,7 @@ namespace smt {
|
|||
}
|
||||
|
||||
theory_var_list const * get_th_var_list() const {
|
||||
return m_th_var_list.get_th_var() == null_theory_var ? 0 : &m_th_var_list;
|
||||
return m_th_var_list.get_th_var() == null_theory_var ? nullptr : &m_th_var_list;
|
||||
}
|
||||
|
||||
bool has_th_vars() const {
|
||||
|
|
|
@ -78,7 +78,7 @@ namespace smt {
|
|||
}
|
||||
};
|
||||
|
||||
const eq_justification null_eq_justification(static_cast<justification*>(0));
|
||||
const eq_justification null_eq_justification(static_cast<justification*>(nullptr));
|
||||
};
|
||||
|
||||
#endif /* SMT_EQ_JUSTIFICATION_H_ */
|
||||
|
|
|
@ -93,8 +93,8 @@ namespace smt {
|
|||
for_each_relevant_expr(ctx),
|
||||
m_buffer(b) {
|
||||
}
|
||||
virtual ~collect_relevant_label_lits() {}
|
||||
virtual void operator()(expr * n);
|
||||
~collect_relevant_label_lits() override {}
|
||||
void operator()(expr * n) override;
|
||||
};
|
||||
|
||||
class collect_relevant_labels : public for_each_relevant_expr {
|
||||
|
@ -104,8 +104,8 @@ namespace smt {
|
|||
for_each_relevant_expr(ctx),
|
||||
m_buffer(b) {
|
||||
}
|
||||
virtual ~collect_relevant_labels() {}
|
||||
virtual void operator()(expr * n);
|
||||
~collect_relevant_labels() override {}
|
||||
void operator()(expr * n) override;
|
||||
};
|
||||
|
||||
};
|
||||
|
|
|
@ -96,7 +96,7 @@ namespace smt {
|
|||
++m_stats_calls;
|
||||
m_solver.push();
|
||||
m_solver.assert_expr(m.mk_not(m.mk_eq(s, t)));
|
||||
bool is_eq = l_false == m_solver.check_sat(0,0);
|
||||
bool is_eq = l_false == m_solver.check_sat(0,nullptr);
|
||||
m_solver.pop(1);
|
||||
TRACE("get_implied_equalities", tout << mk_pp(t, m) << " = " << mk_pp(s, m) << " " << (is_eq?"eq":"unrelated") << "\n";);
|
||||
if (is_eq) {
|
||||
|
@ -123,7 +123,7 @@ namespace smt {
|
|||
m_stats_timer.start();
|
||||
m_solver.push();
|
||||
m_solver.assert_expr(m.mk_not(m.mk_eq(s, t)));
|
||||
bool is_eq = l_false == m_solver.check_sat(0,0);
|
||||
bool is_eq = l_false == m_solver.check_sat(0,nullptr);
|
||||
m_solver.pop(1);
|
||||
m_stats_timer.stop();
|
||||
TRACE("get_implied_equalities", tout << mk_pp(t, m) << " = " << mk_pp(s, m) << " " << (is_eq?"eq":"unrelated") << "\n";);
|
||||
|
@ -155,7 +155,7 @@ namespace smt {
|
|||
m_solver.push();
|
||||
unsigned arity = get_array_arity(srt);
|
||||
expr_ref_vector args(m);
|
||||
args.push_back(0);
|
||||
args.push_back(nullptr);
|
||||
for (unsigned i = 0; i < arity; ++i) {
|
||||
sort* srt_i = get_array_domain(srt, i);
|
||||
expr* idx = m.mk_fresh_const("index", srt_i);
|
||||
|
@ -163,10 +163,10 @@ namespace smt {
|
|||
}
|
||||
for (unsigned i = 0; i < terms.size(); ++i) {
|
||||
args[0] = terms[i].term;
|
||||
terms[i].term = m.mk_app(m_array_util.get_family_id(), OP_SELECT, 0, 0, args.size(), args.c_ptr());
|
||||
terms[i].term = m.mk_app(m_array_util.get_family_id(), OP_SELECT, 0, nullptr, args.size(), args.c_ptr());
|
||||
}
|
||||
assert_relevant(terms);
|
||||
VERIFY(m_solver.check_sat(0,0) != l_false);
|
||||
VERIFY(m_solver.check_sat(0,nullptr) != l_false);
|
||||
model_ref model1;
|
||||
m_solver.get_model(model1);
|
||||
SASSERT(model1.get());
|
||||
|
@ -199,7 +199,7 @@ namespace smt {
|
|||
|
||||
for (unsigned i = 0; i < terms.size(); ++i) {
|
||||
expr* t = terms[i].term;
|
||||
model->eval(t, vl);
|
||||
vl = (*model)(t);
|
||||
TRACE("get_implied_equalities", tout << mk_pp(t, m) << " |-> " << mk_pp(vl, m) << "\n";);
|
||||
reduce_value(model, vl);
|
||||
if (!m.is_value(vl)) {
|
||||
|
@ -215,7 +215,7 @@ namespace smt {
|
|||
expr* s = terms[vec[j]].term;
|
||||
m_solver.push();
|
||||
m_solver.assert_expr(m.mk_not(m.mk_eq(t, s)));
|
||||
lbool is_sat = m_solver.check_sat(0,0);
|
||||
lbool is_sat = m_solver.check_sat(0,nullptr);
|
||||
m_solver.pop(1);
|
||||
TRACE("get_implied_equalities", tout << mk_pp(t, m) << " = " << mk_pp(s, m) << " " << is_sat << "\n";);
|
||||
if (is_sat == l_false) {
|
||||
|
@ -284,7 +284,7 @@ namespace smt {
|
|||
}
|
||||
|
||||
lbool reduce_cond(model_ref& model, expr* e) {
|
||||
expr* e1 = 0, *e2 = 0;
|
||||
expr* e1 = nullptr, *e2 = nullptr;
|
||||
if (m.is_eq(e, e1, e2) && m_array_util.is_as_array(e1) && m_array_util.is_as_array(e2)) {
|
||||
if (e1 == e2) {
|
||||
return l_true;
|
||||
|
@ -335,7 +335,7 @@ namespace smt {
|
|||
|
||||
m_solver.push();
|
||||
assert_relevant(num_terms, terms);
|
||||
lbool is_sat = m_solver.check_sat(0,0);
|
||||
lbool is_sat = m_solver.check_sat(0,nullptr);
|
||||
|
||||
if (is_sat != l_false) {
|
||||
model_ref model;
|
||||
|
|
|
@ -34,9 +34,10 @@ namespace smt {
|
|||
switch (to_app(n)->get_decl_kind()) {
|
||||
case OP_AND:
|
||||
case OP_OR:
|
||||
case OP_IFF:
|
||||
case OP_ITE:
|
||||
return true;
|
||||
case OP_EQ:
|
||||
return m.is_bool(to_app(n)->get_arg(0));
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
@ -121,7 +122,7 @@ namespace smt {
|
|||
bool visited = true;
|
||||
family_id fid = to_app(n)->get_family_id();
|
||||
theory * th = m_theories.get_plugin(fid);
|
||||
bool def_int = th == 0 || th->default_internalizer();
|
||||
bool def_int = th == nullptr || th->default_internalizer();
|
||||
if (!def_int) {
|
||||
ptr_buffer<expr> descendants;
|
||||
get_foreign_descendants(to_app(n), fid, descendants);
|
||||
|
@ -229,7 +230,7 @@ namespace smt {
|
|||
add_or_rel_watches(to_app(n));
|
||||
break;
|
||||
}
|
||||
case OP_IFF: {
|
||||
case OP_EQ: {
|
||||
expr * lhs = to_app(n)->get_arg(0);
|
||||
expr * rhs = to_app(n)->get_arg(1);
|
||||
internalize(lhs, true);
|
||||
|
@ -301,7 +302,7 @@ namespace smt {
|
|||
e->mark_as_interpreted();
|
||||
app_ref eq(m_manager.mk_eq(fapp, val), m_manager);
|
||||
TRACE("assert_distinct", tout << "eq: " << mk_pp(eq, m_manager) << "\n";);
|
||||
assert_default(eq, 0);
|
||||
assert_default(eq, nullptr);
|
||||
mark_as_relevant(eq.get());
|
||||
// TODO: we may want to hide the auxiliary values val and the function f from the model.
|
||||
}
|
||||
|
@ -369,7 +370,7 @@ namespace smt {
|
|||
else {
|
||||
TRACE("internalize_bug", tout << "creating enode for #" << n->get_id() << "\n";);
|
||||
mk_enode(to_app(n),
|
||||
true, /* supress arguments, we not not use CC for this kind of enode */
|
||||
true, /* suppress arguments, we not not use CC for this kind of enode */
|
||||
true, /* bool enode must be merged with true/false, since it is not in the context of a gate */
|
||||
false /* CC is not enabled */ );
|
||||
set_enode_flag(v, false);
|
||||
|
@ -381,7 +382,7 @@ namespace smt {
|
|||
return;
|
||||
}
|
||||
|
||||
if (m_manager.is_eq(n))
|
||||
if (m_manager.is_eq(n) && !m_manager.is_iff(n))
|
||||
internalize_eq(to_app(n), gate_ctx);
|
||||
else if (m_manager.is_distinct(n))
|
||||
internalize_distinct(to_app(n), gate_ctx);
|
||||
|
@ -453,7 +454,7 @@ namespace smt {
|
|||
// must be associated with an enode.
|
||||
if (!e_internalized(n)) {
|
||||
mk_enode(to_app(n),
|
||||
true, /* supress arguments, we not not use CC for this kind of enode */
|
||||
true, /* suppress arguments, we not not use CC for this kind of enode */
|
||||
true /* bool enode must be merged with true/false, since it is not in the context of a gate */,
|
||||
false /* CC is not enabled */);
|
||||
}
|
||||
|
@ -538,9 +539,7 @@ namespace smt {
|
|||
|
||||
bool _is_gate = is_gate(m_manager, n) || m_manager.is_not(n);
|
||||
// process args
|
||||
unsigned num = n->get_num_args();
|
||||
for (unsigned i = 0; i < num; i++) {
|
||||
expr * arg = n->get_arg(i);
|
||||
for (expr * arg : *n) {
|
||||
internalize(arg, _is_gate);
|
||||
}
|
||||
|
||||
|
@ -596,8 +595,9 @@ namespace smt {
|
|||
mk_or_cnstr(to_app(n));
|
||||
add_or_rel_watches(to_app(n));
|
||||
break;
|
||||
case OP_IFF:
|
||||
mk_iff_cnstr(to_app(n));
|
||||
case OP_EQ:
|
||||
if (m_manager.is_iff(n))
|
||||
mk_iff_cnstr(to_app(n));
|
||||
break;
|
||||
case OP_ITE:
|
||||
mk_ite_cnstr(to_app(n));
|
||||
|
@ -611,7 +611,6 @@ namespace smt {
|
|||
case OP_XOR:
|
||||
UNREACHABLE();
|
||||
case OP_OEQ:
|
||||
case OP_INTERP:
|
||||
UNREACHABLE();
|
||||
default:
|
||||
break;
|
||||
|
@ -631,7 +630,7 @@ namespace smt {
|
|||
set_merge_tf_trail(enode * n):
|
||||
m_node(n) {
|
||||
}
|
||||
virtual void undo(context & ctx) {
|
||||
void undo(context & ctx) override {
|
||||
m_node->m_merge_tf = false;
|
||||
}
|
||||
};
|
||||
|
@ -667,7 +666,7 @@ namespace smt {
|
|||
set_enode_flag_trail(bool_var v):
|
||||
m_var(v) {
|
||||
}
|
||||
virtual void undo(context & ctx) {
|
||||
void undo(context & ctx) override {
|
||||
bool_var_data & data = ctx.m_bdata[m_var];
|
||||
data.reset_enode_flag();
|
||||
}
|
||||
|
@ -695,7 +694,7 @@ namespace smt {
|
|||
void context::internalize_term(app * n) {
|
||||
if (e_internalized(n)) {
|
||||
theory * th = m_theories.get_plugin(n->get_family_id());
|
||||
if (th != 0) {
|
||||
if (th != nullptr) {
|
||||
// This code is necessary because some theories may decide
|
||||
// not to create theory variables for a nested application.
|
||||
// Example:
|
||||
|
@ -739,7 +738,7 @@ namespace smt {
|
|||
app_ref eq1(mk_eq_atom(n, t), m_manager);
|
||||
app_ref eq2(mk_eq_atom(n, e), m_manager);
|
||||
mk_enode(n,
|
||||
true /* supress arguments, I don't want to apply CC on ite terms */,
|
||||
true /* suppress arguments, I don't want to apply CC on ite terms */,
|
||||
false /* it is a term, so it should not be merged with true/false */,
|
||||
false /* CC is not enabled */);
|
||||
internalize(c, true);
|
||||
|
@ -797,7 +796,7 @@ namespace smt {
|
|||
}
|
||||
|
||||
enode * e = mk_enode(n,
|
||||
false, /* do not supress args */
|
||||
false, /* do not suppress args */
|
||||
false, /* it is a term, so it should not be merged with true/false */
|
||||
true);
|
||||
apply_sort_cnstr(n, e);
|
||||
|
@ -1271,7 +1270,7 @@ namespace smt {
|
|||
case CLS_AUX: {
|
||||
literal_buffer simp_lits;
|
||||
if (!simplify_aux_clause_literals(num_lits, lits, simp_lits))
|
||||
return 0; // clause is equivalent to true;
|
||||
return nullptr; // clause is equivalent to true;
|
||||
DEBUG_CODE({
|
||||
for (unsigned i = 0; i < simp_lits.size(); i++) {
|
||||
SASSERT(get_assignment(simp_lits[i]) == l_true);
|
||||
|
@ -1284,7 +1283,7 @@ namespace smt {
|
|||
}
|
||||
case CLS_AUX_LEMMA: {
|
||||
if (!simplify_aux_lemma_literals(num_lits, lits))
|
||||
return 0; // clause is equivalent to true
|
||||
return nullptr; // clause is equivalent to true
|
||||
// simplify_aux_lemma_literals does not delete literals assigned to false, so
|
||||
// it is not necessary to create a unit_resolution_justification
|
||||
break;
|
||||
|
@ -1303,14 +1302,14 @@ namespace smt {
|
|||
if (j && !j->in_region())
|
||||
m_justifications.push_back(j);
|
||||
TRACE("mk_clause", tout << "empty clause... setting conflict\n";);
|
||||
set_conflict(j == 0 ? b_justification::mk_axiom() : b_justification(j));
|
||||
set_conflict(j == nullptr ? b_justification::mk_axiom() : b_justification(j));
|
||||
SASSERT(inconsistent());
|
||||
return 0;
|
||||
return nullptr;
|
||||
case 1:
|
||||
if (j && !j->in_region())
|
||||
m_justifications.push_back(j);
|
||||
assign(lits[0], j);
|
||||
return 0;
|
||||
return nullptr;
|
||||
case 2:
|
||||
if (use_binary_clause_opt(lits[0], lits[1], lemma)) {
|
||||
literal l1 = lits[0];
|
||||
|
@ -1321,7 +1320,7 @@ namespace smt {
|
|||
assign(l1, b_justification(~l2));
|
||||
|
||||
m_stats.m_num_mk_bin_clause++;
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
default: {
|
||||
m_stats.m_num_mk_clause++;
|
||||
|
@ -1345,6 +1344,7 @@ namespace smt {
|
|||
cls->swap_lits(1, w2_idx);
|
||||
TRACE("mk_th_lemma", display_clause(tout, cls); tout << "\n";);
|
||||
}
|
||||
// display_clause(std::cout, cls); std::cout << "\n";
|
||||
m_lemmas.push_back(cls);
|
||||
add_watch_literal(cls, 0);
|
||||
add_watch_literal(cls, 1);
|
||||
|
@ -1404,7 +1404,7 @@ namespace smt {
|
|||
}
|
||||
|
||||
void context::mk_th_axiom(theory_id tid, unsigned num_lits, literal * lits, unsigned num_params, parameter * params) {
|
||||
justification * js = 0;
|
||||
justification * js = nullptr;
|
||||
TRACE("mk_th_axiom",
|
||||
display_literals_verbose(tout, num_lits, lits);
|
||||
tout << "\n";);
|
||||
|
@ -1449,12 +1449,12 @@ namespace smt {
|
|||
|
||||
void context::mk_gate_clause(unsigned num_lits, literal * lits) {
|
||||
if (m_manager.proofs_enabled()) {
|
||||
proof * pr = mk_clause_def_axiom(num_lits, lits, 0);
|
||||
proof * pr = mk_clause_def_axiom(num_lits, lits, nullptr);
|
||||
TRACE("gate_clause", tout << mk_ll_pp(pr, m_manager););
|
||||
mk_clause(num_lits, lits, mk_justification(justification_proof_wrapper(*this, pr)));
|
||||
}
|
||||
else {
|
||||
mk_clause(num_lits, lits, 0);
|
||||
mk_clause(num_lits, lits, nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1487,7 +1487,7 @@ namespace smt {
|
|||
mk_clause(num_lits, lits, mk_justification(justification_proof_wrapper(*this, pr)));
|
||||
}
|
||||
else {
|
||||
mk_clause(num_lits, lits, 0);
|
||||
mk_clause(num_lits, lits, nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1506,7 +1506,7 @@ namespace smt {
|
|||
relevancy_eh * eh = m_relevancy_propagator->mk_and_relevancy_eh(n);
|
||||
unsigned num = n->get_num_args();
|
||||
for (unsigned i = 0; i < num; i++) {
|
||||
// if one child is assigned to false, the the and-parent must be notified
|
||||
// if one child is assigned to false, the and-parent must be notified
|
||||
literal l = get_literal(n->get_arg(i));
|
||||
add_rel_watch(~l, eh);
|
||||
}
|
||||
|
@ -1518,7 +1518,7 @@ namespace smt {
|
|||
relevancy_eh * eh = m_relevancy_propagator->mk_or_relevancy_eh(n);
|
||||
unsigned num = n->get_num_args();
|
||||
for (unsigned i = 0; i < num; i++) {
|
||||
// if one child is assigned to true, the the or-parent must be notified
|
||||
// if one child is assigned to true, the or-parent must be notified
|
||||
literal l = get_literal(n->get_arg(i));
|
||||
add_rel_watch(l, eh);
|
||||
}
|
||||
|
@ -1612,7 +1612,7 @@ namespace smt {
|
|||
SASSERT(m_th_var != null_theory_var);
|
||||
}
|
||||
|
||||
virtual void undo(context & ctx) {
|
||||
void undo(context & ctx) override {
|
||||
theory_var v = m_enode->get_th_var(m_th_id);
|
||||
SASSERT(v != null_theory_var);
|
||||
SASSERT(m_th_var == v);
|
||||
|
@ -1637,7 +1637,7 @@ namespace smt {
|
|||
m_old_th_var(old_var) {
|
||||
}
|
||||
|
||||
virtual void undo(context & ctx) {
|
||||
void undo(context & ctx) override {
|
||||
SASSERT(m_enode->get_th_var(m_th_id) != null_theory_var);
|
||||
m_enode->replace_th_var(m_old_th_var, m_th_id);
|
||||
}
|
||||
|
|
|
@ -90,17 +90,17 @@ namespace smt {
|
|||
SASSERT(m_antecedent);
|
||||
ptr_buffer<proof> prs;
|
||||
proof * pr = cr.get_proof(m_antecedent);
|
||||
bool visited = pr != 0;
|
||||
bool visited = pr != nullptr;
|
||||
prs.push_back(pr);
|
||||
for (unsigned i = 0; i < m_num_literals; i++) {
|
||||
proof * pr = cr.get_proof(m_literals[i]);
|
||||
if (pr == 0)
|
||||
if (pr == nullptr)
|
||||
visited = false;
|
||||
else
|
||||
prs.push_back(pr);
|
||||
}
|
||||
if (!visited)
|
||||
return 0;
|
||||
return nullptr;
|
||||
ast_manager & m = cr.get_manager();
|
||||
TRACE("unit_resolution_justification_bug",
|
||||
tout << "in mk_proof\n";
|
||||
|
@ -150,7 +150,7 @@ namespace smt {
|
|||
}
|
||||
|
||||
if (!visited)
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
expr * lhs = m_node1->get_root()->get_owner();
|
||||
expr * rhs = m_node2->get_root()->get_owner();
|
||||
|
@ -178,7 +178,7 @@ namespace smt {
|
|||
proof * pr2 = m.mk_rewrite(m.get_fact(pr1), lit);
|
||||
return m.mk_modus_ponens(pr1, pr2);
|
||||
}
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void eq_propagation_justification::get_antecedents(conflict_resolution & cr) {
|
||||
|
@ -241,7 +241,7 @@ namespace smt {
|
|||
mk_pp(m.get_fact(pr), m) << "\n";);
|
||||
return pr;
|
||||
}
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
simple_justification::simple_justification(region & r, unsigned num_lits, literal const * lits):
|
||||
|
@ -266,7 +266,7 @@ namespace smt {
|
|||
bool visited = true;
|
||||
for (unsigned i = 0; i < m_num_literals; i++) {
|
||||
proof * pr = cr.get_proof(m_literals[i]);
|
||||
if (pr == 0)
|
||||
if (pr == nullptr)
|
||||
visited = false;
|
||||
else
|
||||
result.push_back(pr);
|
||||
|
@ -284,15 +284,15 @@ namespace smt {
|
|||
lits.push_back(l);
|
||||
}
|
||||
if (lits.size() == 1)
|
||||
return m.mk_th_lemma(m_th_id, lits.get(0), 0, 0, m_params.size(), m_params.c_ptr());
|
||||
return m.mk_th_lemma(m_th_id, lits.get(0), 0, nullptr, m_params.size(), m_params.c_ptr());
|
||||
else
|
||||
return m.mk_th_lemma(m_th_id, m.mk_or(lits.size(), lits.c_ptr()), 0, 0, m_params.size(), m_params.c_ptr());
|
||||
return m.mk_th_lemma(m_th_id, m.mk_or(lits.size(), lits.c_ptr()), 0, nullptr, m_params.size(), m_params.c_ptr());
|
||||
}
|
||||
|
||||
proof * theory_propagation_justification::mk_proof(conflict_resolution & cr) {
|
||||
ptr_buffer<proof> prs;
|
||||
if (!antecedent2proof(cr, prs))
|
||||
return 0;
|
||||
return nullptr;
|
||||
context & ctx = cr.get_context();
|
||||
ast_manager & m = cr.get_manager();
|
||||
expr_ref fact(m);
|
||||
|
@ -303,7 +303,7 @@ namespace smt {
|
|||
proof * theory_conflict_justification::mk_proof(conflict_resolution & cr) {
|
||||
ptr_buffer<proof> prs;
|
||||
if (!antecedent2proof(cr, prs))
|
||||
return 0;
|
||||
return nullptr;
|
||||
ast_manager & m = cr.get_manager();
|
||||
return m.mk_th_lemma(m_th_id, m.mk_false(), prs.size(), prs.c_ptr(), m_params.size(), m_params.c_ptr());
|
||||
}
|
||||
|
@ -334,7 +334,7 @@ namespace smt {
|
|||
for (unsigned i = 0; i < m_num_eqs; i++) {
|
||||
enode_pair const & p = m_eqs[i];
|
||||
proof * pr = cr.get_proof(p.first, p.second);
|
||||
if (pr == 0)
|
||||
if (pr == nullptr)
|
||||
visited = false;
|
||||
else
|
||||
result.push_back(pr);
|
||||
|
@ -345,7 +345,7 @@ namespace smt {
|
|||
proof * ext_theory_propagation_justification::mk_proof(conflict_resolution & cr) {
|
||||
ptr_buffer<proof> prs;
|
||||
if (!antecedent2proof(cr, prs))
|
||||
return 0;
|
||||
return nullptr;
|
||||
context & ctx = cr.get_context();
|
||||
ast_manager & m = cr.get_manager();
|
||||
expr_ref fact(m);
|
||||
|
@ -356,7 +356,7 @@ namespace smt {
|
|||
proof * ext_theory_conflict_justification::mk_proof(conflict_resolution & cr) {
|
||||
ptr_buffer<proof> prs;
|
||||
if (!antecedent2proof(cr, prs))
|
||||
return 0;
|
||||
return nullptr;
|
||||
ast_manager & m = cr.get_manager();
|
||||
return m.mk_th_lemma(m_th_id, m.mk_false(), prs.size(), prs.c_ptr(), m_params.size(), m_params.c_ptr());
|
||||
}
|
||||
|
@ -364,7 +364,7 @@ namespace smt {
|
|||
proof * ext_theory_eq_propagation_justification::mk_proof(conflict_resolution & cr) {
|
||||
ptr_buffer<proof> prs;
|
||||
if (!antecedent2proof(cr, prs))
|
||||
return 0;
|
||||
return nullptr;
|
||||
ast_manager & m = cr.get_manager();
|
||||
context & ctx = cr.get_context();
|
||||
expr * fact = ctx.mk_eq_atom(m_lhs->get_owner(), m_rhs->get_owner());
|
||||
|
@ -415,9 +415,9 @@ namespace smt {
|
|||
lits.push_back(l);
|
||||
}
|
||||
if (lits.size() == 1)
|
||||
return m.mk_th_lemma(m_th_id, lits.get(0), 0, 0, m_params.size(), m_params.c_ptr());
|
||||
return m.mk_th_lemma(m_th_id, lits.get(0), 0, nullptr, m_params.size(), m_params.c_ptr());
|
||||
else
|
||||
return m.mk_th_lemma(m_th_id, m.mk_or(lits.size(), lits.c_ptr()), 0, 0, m_params.size(), m_params.c_ptr());
|
||||
return m.mk_th_lemma(m_th_id, m.mk_or(lits.size(), lits.c_ptr()), 0, nullptr, m_params.size(), m_params.c_ptr());
|
||||
}
|
||||
|
||||
};
|
||||
|
|
|
@ -102,15 +102,15 @@ namespace smt {
|
|||
public:
|
||||
justification_proof_wrapper(context & ctx, proof * pr, bool in_region = true);
|
||||
|
||||
virtual bool has_del_eh() const {
|
||||
bool has_del_eh() const override {
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual void del_eh(ast_manager & m);
|
||||
void del_eh(ast_manager & m) override;
|
||||
|
||||
virtual proof * mk_proof(conflict_resolution & cr);
|
||||
proof * mk_proof(conflict_resolution & cr) override;
|
||||
|
||||
virtual char const * get_name() const { return "proof-wrapper"; }
|
||||
char const * get_name() const override { return "proof-wrapper"; }
|
||||
};
|
||||
|
||||
class unit_resolution_justification : public justification {
|
||||
|
@ -122,21 +122,21 @@ namespace smt {
|
|||
|
||||
unit_resolution_justification(justification * js, unsigned num_lits, literal const * lits);
|
||||
|
||||
~unit_resolution_justification();
|
||||
~unit_resolution_justification() override;
|
||||
|
||||
virtual bool has_del_eh() const {
|
||||
bool has_del_eh() const override {
|
||||
return !in_region() && m_antecedent && m_antecedent->has_del_eh();
|
||||
}
|
||||
|
||||
virtual void del_eh(ast_manager & m) {
|
||||
void del_eh(ast_manager & m) override {
|
||||
if (!in_region() && m_antecedent) m_antecedent->del_eh(m);
|
||||
}
|
||||
|
||||
virtual void get_antecedents(conflict_resolution & cr);
|
||||
void get_antecedents(conflict_resolution & cr) override;
|
||||
|
||||
virtual proof * mk_proof(conflict_resolution & cr);
|
||||
proof * mk_proof(conflict_resolution & cr) override;
|
||||
|
||||
virtual char const * get_name() const { return "unit-resolution"; }
|
||||
char const * get_name() const override { return "unit-resolution"; }
|
||||
};
|
||||
|
||||
class eq_conflict_justification : public justification {
|
||||
|
@ -150,11 +150,11 @@ namespace smt {
|
|||
m_js(js) {
|
||||
}
|
||||
|
||||
virtual void get_antecedents(conflict_resolution & cr);
|
||||
void get_antecedents(conflict_resolution & cr) override;
|
||||
|
||||
virtual proof * mk_proof(conflict_resolution & cr);
|
||||
proof * mk_proof(conflict_resolution & cr) override;
|
||||
|
||||
virtual char const * get_name() const { return "eq-conflict"; }
|
||||
char const * get_name() const override { return "eq-conflict"; }
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -166,11 +166,11 @@ namespace smt {
|
|||
eq_root_propagation_justification(enode * n):m_node(n) {
|
||||
}
|
||||
|
||||
virtual void get_antecedents(conflict_resolution & cr);
|
||||
void get_antecedents(conflict_resolution & cr) override;
|
||||
|
||||
virtual proof * mk_proof(conflict_resolution & cr);
|
||||
proof * mk_proof(conflict_resolution & cr) override;
|
||||
|
||||
virtual char const * get_name() const { return "eq-root"; }
|
||||
char const * get_name() const override { return "eq-root"; }
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -184,11 +184,11 @@ namespace smt {
|
|||
SASSERT(n1 != n2);
|
||||
}
|
||||
|
||||
virtual void get_antecedents(conflict_resolution & cr);
|
||||
void get_antecedents(conflict_resolution & cr) override;
|
||||
|
||||
virtual proof * mk_proof(conflict_resolution & cr);
|
||||
proof * mk_proof(conflict_resolution & cr) override;
|
||||
|
||||
virtual char const * get_name() const { return "eq-propagation"; }
|
||||
char const * get_name() const override { return "eq-propagation"; }
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -201,11 +201,11 @@ namespace smt {
|
|||
mp_iff_justification(enode * n1, enode * n2):m_node1(n1), m_node2(n2) {
|
||||
}
|
||||
|
||||
virtual void get_antecedents(conflict_resolution & cr);
|
||||
void get_antecedents(conflict_resolution & cr) override;
|
||||
|
||||
virtual proof * mk_proof(conflict_resolution & cr);
|
||||
proof * mk_proof(conflict_resolution & cr) override;
|
||||
|
||||
virtual char const * get_name() const { return "mp-iff"; }
|
||||
char const * get_name() const override { return "mp-iff"; }
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -221,11 +221,11 @@ namespace smt {
|
|||
public:
|
||||
simple_justification(region & r, unsigned num_lits, literal const * lits);
|
||||
|
||||
virtual void get_antecedents(conflict_resolution & cr);
|
||||
void get_antecedents(conflict_resolution & cr) override;
|
||||
|
||||
virtual proof * mk_proof(conflict_resolution & cr) = 0;
|
||||
proof * mk_proof(conflict_resolution & cr) override = 0;
|
||||
|
||||
virtual char const * get_name() const { return "simple"; }
|
||||
char const * get_name() const override { return "simple"; }
|
||||
|
||||
};
|
||||
|
||||
|
@ -240,13 +240,13 @@ namespace smt {
|
|||
unsigned num_params, parameter* params):
|
||||
simple_justification(r, num_lits, lits),
|
||||
m_th_id(fid), m_params(num_params, params) {}
|
||||
virtual ~simple_theory_justification() {}
|
||||
~simple_theory_justification() override {}
|
||||
|
||||
virtual bool has_del_eh() const { return !m_params.empty(); }
|
||||
bool has_del_eh() const override { return !m_params.empty(); }
|
||||
|
||||
virtual void del_eh(ast_manager & m) { m_params.reset(); }
|
||||
void del_eh(ast_manager & m) override { m_params.reset(); }
|
||||
|
||||
virtual theory_id get_from_theory() const { return m_th_id; }
|
||||
theory_id get_from_theory() const override { return m_th_id; }
|
||||
|
||||
};
|
||||
|
||||
|
@ -255,39 +255,39 @@ namespace smt {
|
|||
|
||||
theory_axiom_justification(family_id fid, region & r,
|
||||
unsigned num_lits, literal const * lits,
|
||||
unsigned num_params = 0, parameter* params = 0):
|
||||
unsigned num_params = 0, parameter* params = nullptr):
|
||||
simple_theory_justification(fid, r, num_lits, lits, num_params, params) {}
|
||||
|
||||
virtual void get_antecedents(conflict_resolution & cr) {}
|
||||
void get_antecedents(conflict_resolution & cr) override {}
|
||||
|
||||
virtual proof * mk_proof(conflict_resolution & cr);
|
||||
proof * mk_proof(conflict_resolution & cr) override;
|
||||
|
||||
virtual char const * get_name() const { return "theory-axiom"; }
|
||||
char const * get_name() const override { return "theory-axiom"; }
|
||||
};
|
||||
|
||||
class theory_propagation_justification : public simple_theory_justification {
|
||||
literal m_consequent;
|
||||
public:
|
||||
theory_propagation_justification(family_id fid, region & r, unsigned num_lits, literal const * lits, literal consequent,
|
||||
unsigned num_params = 0, parameter* params = 0):
|
||||
unsigned num_params = 0, parameter* params = nullptr):
|
||||
simple_theory_justification(fid, r, num_lits, lits, num_params, params), m_consequent(consequent) {}
|
||||
|
||||
virtual proof * mk_proof(conflict_resolution & cr);
|
||||
proof * mk_proof(conflict_resolution & cr) override;
|
||||
|
||||
|
||||
virtual char const * get_name() const { return "theory-propagation"; }
|
||||
char const * get_name() const override { return "theory-propagation"; }
|
||||
|
||||
};
|
||||
|
||||
class theory_conflict_justification : public simple_theory_justification {
|
||||
public:
|
||||
theory_conflict_justification(family_id fid, region & r, unsigned num_lits, literal const * lits,
|
||||
unsigned num_params = 0, parameter* params = 0):
|
||||
unsigned num_params = 0, parameter* params = nullptr):
|
||||
simple_theory_justification(fid, r, num_lits, lits, num_params, params) {}
|
||||
|
||||
virtual proof * mk_proof(conflict_resolution & cr);
|
||||
proof * mk_proof(conflict_resolution & cr) override;
|
||||
|
||||
virtual char const * get_name() const { return "theory-conflict"; }
|
||||
char const * get_name() const override { return "theory-conflict"; }
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -304,11 +304,11 @@ namespace smt {
|
|||
ext_simple_justification(region & r, unsigned num_lits, literal const * lits,
|
||||
unsigned num_eqs, enode_pair const * eqs);
|
||||
|
||||
virtual void get_antecedents(conflict_resolution & cr);
|
||||
void get_antecedents(conflict_resolution & cr) override;
|
||||
|
||||
virtual proof * mk_proof(conflict_resolution & cr) = 0;
|
||||
proof * mk_proof(conflict_resolution & cr) override = 0;
|
||||
|
||||
virtual char const * get_name() const { return "ext-simple"; }
|
||||
char const * get_name() const override { return "ext-simple"; }
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -322,16 +322,16 @@ namespace smt {
|
|||
public:
|
||||
ext_theory_simple_justification(family_id fid, region & r, unsigned num_lits, literal const * lits,
|
||||
unsigned num_eqs, enode_pair const * eqs,
|
||||
unsigned num_params = 0, parameter* params = 0):
|
||||
unsigned num_params = 0, parameter* params = nullptr):
|
||||
ext_simple_justification(r, num_lits, lits, num_eqs, eqs), m_th_id(fid), m_params(num_params, params) {}
|
||||
|
||||
virtual ~ext_theory_simple_justification() {}
|
||||
~ext_theory_simple_justification() override {}
|
||||
|
||||
virtual bool has_del_eh() const { return !m_params.empty(); }
|
||||
bool has_del_eh() const override { return !m_params.empty(); }
|
||||
|
||||
virtual void del_eh(ast_manager & m) { m_params.reset(); }
|
||||
void del_eh(ast_manager & m) override { m_params.reset(); }
|
||||
|
||||
virtual theory_id get_from_theory() const { return m_th_id; }
|
||||
theory_id get_from_theory() const override { return m_th_id; }
|
||||
};
|
||||
|
||||
class ext_theory_propagation_justification : public ext_theory_simple_justification {
|
||||
|
@ -341,25 +341,25 @@ namespace smt {
|
|||
unsigned num_lits, literal const * lits,
|
||||
unsigned num_eqs, enode_pair const * eqs,
|
||||
literal consequent,
|
||||
unsigned num_params = 0, parameter* params = 0):
|
||||
unsigned num_params = 0, parameter* params = nullptr):
|
||||
ext_theory_simple_justification(fid, r, num_lits, lits, num_eqs, eqs, num_params, params),
|
||||
m_consequent(consequent) {}
|
||||
|
||||
virtual proof * mk_proof(conflict_resolution & cr);
|
||||
proof * mk_proof(conflict_resolution & cr) override;
|
||||
|
||||
virtual char const * get_name() const { return "ext-theory-propagation"; }
|
||||
char const * get_name() const override { return "ext-theory-propagation"; }
|
||||
};
|
||||
|
||||
class ext_theory_conflict_justification : public ext_theory_simple_justification {
|
||||
public:
|
||||
ext_theory_conflict_justification(family_id fid, region & r, unsigned num_lits, literal const * lits,
|
||||
unsigned num_eqs, enode_pair const * eqs,
|
||||
unsigned num_params = 0, parameter* params = 0):
|
||||
unsigned num_params = 0, parameter* params = nullptr):
|
||||
ext_theory_simple_justification(fid, r, num_lits, lits, num_eqs, eqs, num_params, params) {}
|
||||
|
||||
virtual proof * mk_proof(conflict_resolution & cr);
|
||||
proof * mk_proof(conflict_resolution & cr) override;
|
||||
|
||||
virtual char const * get_name() const { return "ext-theory-conflict"; }
|
||||
char const * get_name() const override { return "ext-theory-conflict"; }
|
||||
};
|
||||
|
||||
class ext_theory_eq_propagation_justification : public ext_theory_simple_justification {
|
||||
|
@ -371,12 +371,12 @@ namespace smt {
|
|||
unsigned num_lits, literal const * lits,
|
||||
unsigned num_eqs, enode_pair const * eqs,
|
||||
enode * lhs, enode * rhs,
|
||||
unsigned num_params = 0, parameter* params = 0):
|
||||
unsigned num_params = 0, parameter* params = nullptr):
|
||||
ext_theory_simple_justification(fid, r, num_lits, lits, num_eqs, eqs, num_params, params), m_lhs(lhs), m_rhs(rhs) {}
|
||||
|
||||
virtual proof * mk_proof(conflict_resolution & cr);
|
||||
proof * mk_proof(conflict_resolution & cr) override;
|
||||
|
||||
virtual char const * get_name() const { return "ext-theory-eq-propagation"; }
|
||||
char const * get_name() const override { return "ext-theory-eq-propagation"; }
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -392,21 +392,21 @@ namespace smt {
|
|||
|
||||
public:
|
||||
theory_lemma_justification(family_id fid, context & ctx, unsigned num_lits, literal const * lits,
|
||||
unsigned num_params = 0, parameter* params = 0);
|
||||
unsigned num_params = 0, parameter* params = nullptr);
|
||||
|
||||
virtual ~theory_lemma_justification();
|
||||
~theory_lemma_justification() override;
|
||||
|
||||
virtual bool has_del_eh() const {
|
||||
bool has_del_eh() const override {
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual void del_eh(ast_manager & m);
|
||||
void del_eh(ast_manager & m) override;
|
||||
|
||||
virtual void get_antecedents(conflict_resolution & cr) {}
|
||||
void get_antecedents(conflict_resolution & cr) override {}
|
||||
|
||||
virtual proof * mk_proof(conflict_resolution & cr);
|
||||
proof * mk_proof(conflict_resolution & cr) override;
|
||||
|
||||
virtual char const * get_name() const { return "theory-lemma"; }
|
||||
char const * get_name() const override { return "theory-lemma"; }
|
||||
};
|
||||
|
||||
};
|
||||
|
|
|
@ -115,6 +115,10 @@ namespace smt {
|
|||
return m_kernel.check(num_assumptions, assumptions);
|
||||
}
|
||||
|
||||
lbool check(expr_ref_vector const& cube, vector<expr_ref_vector> const& clause) {
|
||||
return m_kernel.check(cube, clause);
|
||||
}
|
||||
|
||||
lbool get_consequences(expr_ref_vector const& assumptions, expr_ref_vector const& vars, expr_ref_vector& conseq, expr_ref_vector& unfixed) {
|
||||
return m_kernel.get_consequences(assumptions, vars, conseq, unfixed);
|
||||
}
|
||||
|
@ -123,7 +127,6 @@ namespace smt {
|
|||
return m_kernel.preferred_sat(asms, cores);
|
||||
}
|
||||
|
||||
|
||||
lbool find_mutexes(expr_ref_vector const& vars, vector<expr_ref_vector>& mutexes) {
|
||||
return m_kernel.find_mutexes(vars, mutexes);
|
||||
}
|
||||
|
@ -175,11 +178,15 @@ namespace smt {
|
|||
void get_guessed_literals(expr_ref_vector & result) {
|
||||
m_kernel.get_guessed_literals(result);
|
||||
}
|
||||
|
||||
|
||||
expr* next_decision() {
|
||||
return m_kernel.next_decision();
|
||||
}
|
||||
|
||||
void collect_statistics(::statistics & st) const {
|
||||
m_kernel.collect_statistics(st);
|
||||
}
|
||||
|
||||
|
||||
void reset_statistics() {
|
||||
}
|
||||
|
||||
|
@ -196,9 +203,7 @@ namespace smt {
|
|||
}
|
||||
|
||||
void updt_params(params_ref const & p) {
|
||||
// We don't need params2smt_params anymore. smt_params has support for reading params_ref.
|
||||
// The update is performed at smt_kernel "users".
|
||||
// params2smt_params(p, fparams());
|
||||
m_kernel.updt_params(p);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -218,7 +223,6 @@ namespace smt {
|
|||
imp::copy(*src.m_imp, *dst.m_imp);
|
||||
}
|
||||
|
||||
|
||||
bool kernel::set_logic(symbol logic) {
|
||||
return m_imp->set_logic(logic);
|
||||
}
|
||||
|
@ -263,9 +267,9 @@ namespace smt {
|
|||
}
|
||||
|
||||
void kernel::reset() {
|
||||
ast_manager & _m = m();
|
||||
ast_manager & _m = m();
|
||||
smt_params & fps = m_imp->fparams();
|
||||
params_ref ps = m_imp->params();
|
||||
params_ref ps = m_imp->params();
|
||||
#pragma omp critical (smt_kernel)
|
||||
{
|
||||
m_imp->~imp();
|
||||
|
@ -287,6 +291,11 @@ namespace smt {
|
|||
return r;
|
||||
}
|
||||
|
||||
lbool kernel::check(expr_ref_vector const& cube, vector<expr_ref_vector> const& clauses) {
|
||||
return m_imp->check(cube, clauses);
|
||||
}
|
||||
|
||||
|
||||
lbool kernel::get_consequences(expr_ref_vector const& assumptions, expr_ref_vector const& vars, expr_ref_vector& conseq, expr_ref_vector& unfixed) {
|
||||
return m_imp->get_consequences(assumptions, vars, conseq, unfixed);
|
||||
}
|
||||
|
@ -347,6 +356,10 @@ namespace smt {
|
|||
m_imp->get_guessed_literals(result);
|
||||
}
|
||||
|
||||
expr* kernel::next_decision() {
|
||||
return m_imp->next_decision();
|
||||
}
|
||||
|
||||
void kernel::display(std::ostream & out) const {
|
||||
m_imp->display(out);
|
||||
}
|
||||
|
|
|
@ -126,12 +126,14 @@ namespace smt {
|
|||
/**
|
||||
\brief Satisfiability check.
|
||||
*/
|
||||
lbool check(unsigned num_assumptions = 0, expr * const * assumptions = 0);
|
||||
lbool check(unsigned num_assumptions = 0, expr * const * assumptions = nullptr);
|
||||
|
||||
lbool check(expr_ref_vector const& asms) { return check(asms.size(), asms.c_ptr()); }
|
||||
|
||||
lbool check(app_ref_vector const& asms) { return check(asms.size(), (expr* const*)asms.c_ptr()); }
|
||||
|
||||
lbool check(expr_ref_vector const& cube, vector<expr_ref_vector> const& clauses);
|
||||
|
||||
/**
|
||||
\brief extract consequences among variables.
|
||||
*/
|
||||
|
@ -212,6 +214,11 @@ namespace smt {
|
|||
*/
|
||||
void get_guessed_literals(expr_ref_vector & result);
|
||||
|
||||
/**
|
||||
\brief return the next case split literal.
|
||||
*/
|
||||
expr* next_decision();
|
||||
|
||||
/**
|
||||
\brief (For debubbing purposes) Prints the state of the kernel
|
||||
*/
|
||||
|
|
|
@ -33,19 +33,19 @@ namespace smt {
|
|||
m(m),
|
||||
m_params(p),
|
||||
m_autil(m),
|
||||
m_qm(0),
|
||||
m_context(0),
|
||||
m_root2value(0),
|
||||
m_qm(nullptr),
|
||||
m_context(nullptr),
|
||||
m_root2value(nullptr),
|
||||
m_model_finder(mf),
|
||||
m_max_cexs(1),
|
||||
m_iteration_idx(0),
|
||||
m_curr_model(0),
|
||||
m_curr_model(nullptr),
|
||||
m_pinned_exprs(m) {
|
||||
}
|
||||
|
||||
model_checker::~model_checker() {
|
||||
m_aux_context = 0; // delete aux context before fparams
|
||||
m_fparams = 0;
|
||||
m_aux_context = nullptr; // delete aux context before fparams
|
||||
m_fparams = nullptr;
|
||||
}
|
||||
|
||||
quantifier * model_checker::get_flat_quantifier(quantifier * q) {
|
||||
|
@ -72,7 +72,7 @@ namespace smt {
|
|||
m_value2expr.insert(val, n->get_owner());
|
||||
}
|
||||
}
|
||||
expr * t = 0;
|
||||
expr * t = nullptr;
|
||||
m_value2expr.find(val, t);
|
||||
return t;
|
||||
}
|
||||
|
@ -111,10 +111,10 @@ namespace smt {
|
|||
ptr_buffer<expr> subst_args;
|
||||
unsigned num_decls = q->get_num_decls();
|
||||
subst_args.resize(num_decls, 0);
|
||||
sks.resize(num_decls, 0);
|
||||
sks.resize(num_decls, nullptr);
|
||||
for (unsigned i = 0; i < num_decls; i++) {
|
||||
sort * s = q->get_decl_sort(num_decls - i - 1);
|
||||
expr * sk = m.mk_fresh_const(0, s);
|
||||
expr * sk = m.mk_fresh_const(nullptr, s);
|
||||
sks[num_decls - i - 1] = sk;
|
||||
subst_args[num_decls - i - 1] = sk;
|
||||
if (m_curr_model->is_finite(s)) {
|
||||
|
@ -132,7 +132,7 @@ namespace smt {
|
|||
}
|
||||
|
||||
bool model_checker::add_instance(quantifier * q, model * cex, expr_ref_vector & sks, bool use_inv) {
|
||||
if (cex == 0) {
|
||||
if (cex == nullptr) {
|
||||
TRACE("model_checker", tout << "no model is available\n";);
|
||||
return false;
|
||||
}
|
||||
|
@ -158,7 +158,7 @@ namespace smt {
|
|||
if (use_inv) {
|
||||
unsigned sk_term_gen;
|
||||
expr * sk_term = m_model_finder.get_inv(q, i, sk_value, sk_term_gen);
|
||||
if (sk_term != 0) {
|
||||
if (sk_term != nullptr) {
|
||||
TRACE("model_checker", tout << "Found inverse " << mk_pp(sk_term, m) << "\n";);
|
||||
SASSERT(!m.is_model_value(sk_term));
|
||||
if (sk_term_gen > max_generation)
|
||||
|
@ -172,7 +172,7 @@ namespace smt {
|
|||
}
|
||||
else {
|
||||
expr * sk_term = get_term_from_ctx(sk_value);
|
||||
if (sk_term != 0) {
|
||||
if (sk_term != nullptr) {
|
||||
sk_value = sk_term;
|
||||
}
|
||||
}
|
||||
|
@ -323,7 +323,7 @@ namespace smt {
|
|||
bool is_undef = false;
|
||||
expr_ref_vector args(m);
|
||||
unsigned num_decls = q->get_num_decls();
|
||||
args.resize(num_decls, 0);
|
||||
args.resize(num_decls, nullptr);
|
||||
var_subst sub(m);
|
||||
expr_ref tmp(m), result(m);
|
||||
for (; it != end; ++it) {
|
||||
|
@ -438,7 +438,7 @@ namespace smt {
|
|||
}
|
||||
else if (!check(q)) {
|
||||
if (m_params.m_mbqi_trace || get_verbosity_level() >= 5) {
|
||||
verbose_stream() << "(smt.mbqi :failed " << q->get_qid() << ")\n";
|
||||
IF_VERBOSE(0, verbose_stream() << "(smt.mbqi :failed " << q->get_qid() << ")\n");
|
||||
}
|
||||
TRACE("model_checker", tout << "checking quantifier " << mk_pp(q, m) << " failed\n";);
|
||||
num_failures++;
|
||||
|
@ -502,7 +502,7 @@ namespace smt {
|
|||
expr_ref inst_expr(m);
|
||||
instantiate(m, q, inst->m_bindings, inst_expr);
|
||||
tout << "(assert " << mk_ismt2_pp(inst_expr, m) << ")\n";);
|
||||
m_context->add_instance(q, 0, num_decls, bindings.c_ptr(), gen, gen, gen, dummy);
|
||||
m_context->add_instance(q, nullptr, num_decls, bindings.c_ptr(), gen, gen, gen, dummy);
|
||||
TRACE("model_checker_bug_detail", tout << "after instantiating, inconsistent: " << m_context->inconsistent() << "\n";);
|
||||
}
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -29,10 +29,10 @@ namespace smt {
|
|||
|
||||
model_generator::model_generator(ast_manager & m):
|
||||
m_manager(m),
|
||||
m_context(0),
|
||||
m_context(nullptr),
|
||||
m_fresh_idx(1),
|
||||
m_asts(m_manager),
|
||||
m_model(0) {
|
||||
m_model(nullptr) {
|
||||
}
|
||||
|
||||
model_generator::~model_generator() {
|
||||
|
@ -44,7 +44,7 @@ namespace smt {
|
|||
m_fresh_idx = 1;
|
||||
m_root2value.reset();
|
||||
m_asts.reset();
|
||||
m_model = 0;
|
||||
m_model = nullptr;
|
||||
}
|
||||
|
||||
void model_generator::init_model() {
|
||||
|
@ -89,7 +89,7 @@ namespace smt {
|
|||
if (r == r->get_root() && m_context->is_relevant(r)) {
|
||||
roots.push_back(r);
|
||||
sort * s = m_manager.get_sort(r->get_owner());
|
||||
model_value_proc * proc = 0;
|
||||
model_value_proc * proc = nullptr;
|
||||
if (m_manager.is_bool(s)) {
|
||||
CTRACE("model", m_context->get_assignment(r) == l_undef,
|
||||
tout << mk_pp(r->get_owner(), m_manager) << "\n";);
|
||||
|
@ -177,7 +177,7 @@ namespace smt {
|
|||
if (m_manager.get_sort(r->get_owner()) != s)
|
||||
continue;
|
||||
SASSERT(r == r->get_root());
|
||||
model_value_proc * proc = 0;
|
||||
model_value_proc * proc = nullptr;
|
||||
root2proc.find(r, proc);
|
||||
SASSERT(proc);
|
||||
if (proc->is_fresh())
|
||||
|
@ -196,7 +196,7 @@ namespace smt {
|
|||
enode * n = src.get_enode();
|
||||
SASSERT(n == n->get_root());
|
||||
bool visited = true;
|
||||
model_value_proc * proc = 0;
|
||||
model_value_proc * proc = nullptr;
|
||||
root2proc.find(n, proc);
|
||||
SASSERT(proc);
|
||||
buffer<model_value_dependency> dependencies;
|
||||
|
@ -283,7 +283,7 @@ namespace smt {
|
|||
sz = roots.size();
|
||||
for (unsigned i = 0; i < sz; i++) {
|
||||
enode * r = roots[i];
|
||||
model_value_proc * proc = 0;
|
||||
model_value_proc * proc = nullptr;
|
||||
root2proc.find(r, proc);
|
||||
SASSERT(proc);
|
||||
if (!proc->is_fresh())
|
||||
|
@ -345,7 +345,7 @@ namespace smt {
|
|||
TRACE("mg_top_sort", tout << "#" << n->get_owner_id() << "\n";);
|
||||
dependencies.reset();
|
||||
dependency_values.reset();
|
||||
model_value_proc * proc = 0;
|
||||
model_value_proc * proc = nullptr;
|
||||
VERIFY(root2proc.find(n, proc));
|
||||
SASSERT(proc);
|
||||
proc->get_dependencies(dependencies);
|
||||
|
@ -364,7 +364,7 @@ namespace smt {
|
|||
enode * child = d.get_enode();
|
||||
TRACE("mg_top_sort", tout << "#" << n->get_owner_id() << " (" << mk_pp(n->get_owner(), m_manager) << "): " << mk_pp(child->get_owner(), m_manager) << " " << mk_pp(child->get_root()->get_owner(), m_manager) << "\n";);
|
||||
child = child->get_root();
|
||||
app * val = 0;
|
||||
app * val = nullptr;
|
||||
m_root2value.find(child, val);
|
||||
SASSERT(val);
|
||||
dependency_values.push_back(val);
|
||||
|
@ -387,6 +387,7 @@ namespace smt {
|
|||
enode * n = *it3;
|
||||
if (is_uninterp_const(n->get_owner()) && m_context->is_relevant(n)) {
|
||||
func_decl * d = n->get_owner()->get_decl();
|
||||
TRACE("mg_top_sort", tout << d->get_name() << " " << (m_hidden_ufs.contains(d)?"hidden":"visible") << "\n";);
|
||||
if (m_hidden_ufs.contains(d)) continue;
|
||||
expr * val = get_value(n);
|
||||
m_model->register_decl(d, val);
|
||||
|
@ -395,7 +396,7 @@ namespace smt {
|
|||
}
|
||||
|
||||
app * model_generator::get_value(enode * n) const {
|
||||
app * val = 0;
|
||||
app * val = nullptr;
|
||||
m_root2value.find(n->get_root(), val);
|
||||
SASSERT(val);
|
||||
return val;
|
||||
|
@ -438,7 +439,7 @@ namespace smt {
|
|||
args.push_back(arg);
|
||||
}
|
||||
func_interp * fi = m_model->get_func_interp(f);
|
||||
if (fi == 0) {
|
||||
if (fi == nullptr) {
|
||||
fi = alloc(func_interp, m_manager, f->get_arity());
|
||||
m_model->register_decl(f, fi);
|
||||
}
|
||||
|
@ -454,7 +455,7 @@ namespace smt {
|
|||
tout << "value: #" << n->get_owner_id() << "\n" << mk_ismt2_pp(result, m_manager) << "\n";);
|
||||
if (m_context->get_last_search_failure() == smt::THEORY) {
|
||||
// if the theory solvers are incomplete, then we cannot assume the e-graph is close under congruence
|
||||
if (fi->get_entry(args.c_ptr()) == 0)
|
||||
if (fi->get_entry(args.c_ptr()) == nullptr)
|
||||
fi->insert_new_entry(args.c_ptr(), result);
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -80,7 +80,7 @@ namespace smt {
|
|||
unsigned m_idx;
|
||||
expr * m_value;
|
||||
public:
|
||||
extra_fresh_value(sort * s, unsigned idx):m_sort(s), m_idx(idx), m_value(0) {}
|
||||
extra_fresh_value(sort * s, unsigned idx):m_sort(s), m_idx(idx), m_value(nullptr) {}
|
||||
sort * get_sort() const { return m_sort; }
|
||||
unsigned get_idx() const { return m_idx; }
|
||||
void set_value(expr * n) { SASSERT(m_value == 0); m_value = n; }
|
||||
|
@ -100,7 +100,7 @@ namespace smt {
|
|||
extra_fresh_value * m_value; //!< When m_fresh == true, contains the sort of the fresh value
|
||||
};
|
||||
public:
|
||||
model_value_dependency():m_fresh(true), m_value(0) {}
|
||||
model_value_dependency():m_fresh(true), m_value(nullptr) {}
|
||||
model_value_dependency(enode * n):m_fresh(false), m_enode(n->get_root()) {}
|
||||
model_value_dependency(extra_fresh_value * v):m_fresh(true), m_value(v) {}
|
||||
bool is_fresh_value() const { return m_fresh; }
|
||||
|
@ -159,16 +159,16 @@ namespace smt {
|
|||
app * m_value;
|
||||
public:
|
||||
expr_wrapper_proc(app * v):m_value(v) {}
|
||||
virtual app * mk_value(model_generator & m, ptr_vector<expr> & values) { return m_value; }
|
||||
app * mk_value(model_generator & m, ptr_vector<expr> & values) override { return m_value; }
|
||||
};
|
||||
|
||||
class fresh_value_proc : public model_value_proc {
|
||||
extra_fresh_value * m_value;
|
||||
public:
|
||||
fresh_value_proc(extra_fresh_value * v):m_value(v) {}
|
||||
virtual void get_dependencies(buffer<model_value_dependency> & result) { result.push_back(m_value); }
|
||||
virtual app * mk_value(model_generator & m, ptr_vector<expr> & values) { return to_app(values[0]); }
|
||||
virtual bool is_fresh() const { return true; }
|
||||
void get_dependencies(buffer<model_value_dependency> & result) override { result.push_back(m_value); }
|
||||
app * mk_value(model_generator & m, ptr_vector<expr> & values) override { return to_app(values[0]); }
|
||||
bool is_fresh() const override { return true; }
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -143,7 +143,7 @@ namespace smt {
|
|||
tout << "inserted: " << (f != 0) << "\n";
|
||||
);
|
||||
|
||||
return f != 0;
|
||||
return f != nullptr;
|
||||
}
|
||||
|
||||
void init_search_eh() {
|
||||
|
@ -222,7 +222,7 @@ namespace smt {
|
|||
|
||||
final_check_status final_check_eh(bool full) {
|
||||
if (full) {
|
||||
IF_VERBOSE(100, verbose_stream() << "(smt.final-check \"quantifiers\")\n";);
|
||||
IF_VERBOSE(100, if (!m_quantifiers.empty()) verbose_stream() << "(smt.final-check \"quantifiers\")\n";);
|
||||
final_check_status result = m_qi_queue.final_check_eh() ? FC_DONE : FC_CONTINUE;
|
||||
final_check_status presult = m_plugin->final_check_eh(full);
|
||||
if (presult != FC_DONE)
|
||||
|
@ -300,7 +300,7 @@ namespace smt {
|
|||
|
||||
bool quantifier_manager::add_instance(quantifier * q, unsigned num_bindings, enode * const * bindings, unsigned generation) {
|
||||
ptr_vector<enode> tmp;
|
||||
return add_instance(q, 0, num_bindings, bindings, generation, generation, generation, tmp);
|
||||
return add_instance(q, nullptr, num_bindings, bindings, generation, generation, generation, tmp);
|
||||
}
|
||||
|
||||
void quantifier_manager::init_search_eh() {
|
||||
|
@ -408,17 +408,17 @@ namespace smt {
|
|||
bool m_active;
|
||||
public:
|
||||
default_qm_plugin():
|
||||
m_qm(0),
|
||||
m_context(0),
|
||||
m_qm(nullptr),
|
||||
m_context(nullptr),
|
||||
m_new_enode_qhead(0),
|
||||
m_lazy_matching_idx(0),
|
||||
m_active(false) {
|
||||
}
|
||||
|
||||
virtual ~default_qm_plugin() {
|
||||
~default_qm_plugin() override {
|
||||
}
|
||||
|
||||
virtual void set_manager(quantifier_manager & qm) {
|
||||
void set_manager(quantifier_manager & qm) override {
|
||||
SASSERT(m_qm == 0);
|
||||
m_qm = &qm;
|
||||
m_context = &(qm.get_context());
|
||||
|
@ -434,11 +434,11 @@ namespace smt {
|
|||
m_model_checker->set_qm(qm);
|
||||
}
|
||||
|
||||
virtual quantifier_manager_plugin * mk_fresh() { return alloc(default_qm_plugin); }
|
||||
quantifier_manager_plugin * mk_fresh() override { return alloc(default_qm_plugin); }
|
||||
|
||||
virtual bool model_based() const { return m_fparams->m_mbqi; }
|
||||
bool model_based() const override { return m_fparams->m_mbqi; }
|
||||
|
||||
virtual bool mbqi_enabled(quantifier *q) const {
|
||||
bool mbqi_enabled(quantifier *q) const override {
|
||||
if (!m_fparams->m_mbqi_id) return true;
|
||||
const symbol &s = q->get_qid();
|
||||
size_t len = strlen(m_fparams->m_mbqi_id);
|
||||
|
@ -450,16 +450,16 @@ namespace smt {
|
|||
/* Quantifier id's must begin with the prefix specified by parameter
|
||||
mbqi.id to be instantiated with MBQI. The default value is the
|
||||
empty string, so all quantifiers are instantiated. */
|
||||
virtual void add(quantifier * q) {
|
||||
void add(quantifier * q) override {
|
||||
if (m_fparams->m_mbqi && mbqi_enabled(q)) {
|
||||
m_active = true;
|
||||
m_model_finder->register_quantifier(q);
|
||||
}
|
||||
}
|
||||
|
||||
virtual void del(quantifier * q) { }
|
||||
void del(quantifier * q) override { }
|
||||
|
||||
virtual void push() {
|
||||
void push() override {
|
||||
m_mam->push_scope();
|
||||
m_lazy_mam->push_scope();
|
||||
if (m_fparams->m_mbqi) {
|
||||
|
@ -467,7 +467,7 @@ namespace smt {
|
|||
}
|
||||
}
|
||||
|
||||
virtual void pop(unsigned num_scopes) {
|
||||
void pop(unsigned num_scopes) override {
|
||||
m_mam->pop_scope(num_scopes);
|
||||
m_lazy_mam->pop_scope(num_scopes);
|
||||
if (m_fparams->m_mbqi) {
|
||||
|
@ -475,7 +475,7 @@ namespace smt {
|
|||
}
|
||||
}
|
||||
|
||||
virtual void init_search_eh() {
|
||||
void init_search_eh() override {
|
||||
m_lazy_matching_idx = 0;
|
||||
if (m_fparams->m_mbqi) {
|
||||
m_model_finder->init_search_eh();
|
||||
|
@ -483,7 +483,7 @@ namespace smt {
|
|||
}
|
||||
}
|
||||
|
||||
virtual void assign_eh(quantifier * q) {
|
||||
void assign_eh(quantifier * q) override {
|
||||
m_active = true;
|
||||
ast_manager& m = m_context->get_manager();
|
||||
if (!m_fparams->m_ematching) {
|
||||
|
@ -531,23 +531,23 @@ namespace smt {
|
|||
return m_fparams->m_ematching && !m_qm->empty();
|
||||
}
|
||||
|
||||
virtual void add_eq_eh(enode * e1, enode * e2) {
|
||||
void add_eq_eh(enode * e1, enode * e2) override {
|
||||
if (use_ematching())
|
||||
m_mam->add_eq_eh(e1, e2);
|
||||
}
|
||||
|
||||
virtual void relevant_eh(enode * e) {
|
||||
void relevant_eh(enode * e) override {
|
||||
if (use_ematching()) {
|
||||
m_mam->relevant_eh(e, false);
|
||||
m_lazy_mam->relevant_eh(e, true);
|
||||
}
|
||||
}
|
||||
|
||||
virtual bool can_propagate() const {
|
||||
bool can_propagate() const override {
|
||||
return m_mam->has_work();
|
||||
}
|
||||
|
||||
virtual void restart_eh() {
|
||||
void restart_eh() override {
|
||||
if (m_fparams->m_mbqi) {
|
||||
m_model_finder->restart_eh();
|
||||
m_model_checker->restart_eh();
|
||||
|
@ -555,17 +555,17 @@ namespace smt {
|
|||
TRACE("mam_stats", m_mam->display(tout););
|
||||
}
|
||||
|
||||
virtual bool is_shared(enode * n) const {
|
||||
bool is_shared(enode * n) const override {
|
||||
return m_active && (m_mam->is_shared(n) || m_lazy_mam->is_shared(n));
|
||||
}
|
||||
|
||||
virtual void adjust_model(proto_model * m) {
|
||||
void adjust_model(proto_model * m) override {
|
||||
if (m_fparams->m_mbqi) {
|
||||
m_model_finder->fix_model(m);
|
||||
}
|
||||
}
|
||||
|
||||
virtual void propagate() {
|
||||
void propagate() override {
|
||||
m_mam->match();
|
||||
if (!m_context->relevancy() && use_ematching()) {
|
||||
ptr_vector<enode>::const_iterator it = m_context->begin_enodes();
|
||||
|
@ -585,8 +585,8 @@ namespace smt {
|
|||
}
|
||||
}
|
||||
|
||||
virtual quantifier_manager::check_model_result
|
||||
check_model(proto_model * m, obj_map<enode, app *> const & root2value) {
|
||||
quantifier_manager::check_model_result
|
||||
check_model(proto_model * m, obj_map<enode, app *> const & root2value) override {
|
||||
if (m_fparams->m_mbqi) {
|
||||
IF_VERBOSE(10, verbose_stream() << "(smt.mbqi)\n";);
|
||||
if (m_model_checker->check(m, root2value)) {
|
||||
|
@ -599,7 +599,7 @@ namespace smt {
|
|||
return quantifier_manager::UNKNOWN;
|
||||
}
|
||||
|
||||
virtual final_check_status final_check_eh(bool full) {
|
||||
final_check_status final_check_eh(bool full) override {
|
||||
if (!full) {
|
||||
if (m_fparams->m_qi_lazy_instantiation)
|
||||
return final_check_quant();
|
||||
|
|
|
@ -152,7 +152,7 @@ namespace smt {
|
|||
virtual bool mbqi_enabled(quantifier *q) const {return true;}
|
||||
|
||||
/**
|
||||
\brief Give a change to the plugin to adjust the interpretation of unintepreted functions.
|
||||
\brief Give a change to the plugin to adjust the interpretation of uninterpreted functions.
|
||||
It can basically change the "else" of each uninterpreted function.
|
||||
*/
|
||||
virtual void adjust_model(proto_model * m) = 0;
|
||||
|
|
|
@ -82,11 +82,13 @@ namespace smt {
|
|||
if (depth > 0)
|
||||
m_case_split_factor *= (num_args + 1);
|
||||
break;
|
||||
case OP_IFF:
|
||||
if (depth == 0)
|
||||
m_case_split_factor *= 4;
|
||||
else
|
||||
m_case_split_factor *= 9;
|
||||
case OP_EQ:
|
||||
if (m_manager.is_iff(n)) {
|
||||
if (depth == 0)
|
||||
m_case_split_factor *= 4;
|
||||
else
|
||||
m_case_split_factor *= 9;
|
||||
}
|
||||
break;
|
||||
case OP_ITE:
|
||||
if (depth == 0)
|
||||
|
|
|
@ -119,7 +119,7 @@ namespace smt {
|
|||
expr * m_expr;
|
||||
unsigned m_depth:31;
|
||||
bool m_depth_only:1; //!< track only the depth of this entry.
|
||||
entry():m_expr(0), m_depth(0), m_depth_only(false) {}
|
||||
entry():m_expr(nullptr), m_depth(0), m_depth_only(false) {}
|
||||
entry(expr * n, unsigned depth = 0, bool depth_only = false):m_expr(n), m_depth(depth), m_depth_only(depth_only) {}
|
||||
};
|
||||
ast_manager & m_manager;
|
||||
|
|
|
@ -108,7 +108,7 @@ namespace smt {
|
|||
if (n->get_family_id() != m_manager.get_basic_family_id())
|
||||
collect(arg, n->get_decl(), j);
|
||||
else
|
||||
collect(arg, 0, 0);
|
||||
collect(arg, nullptr, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -157,7 +157,7 @@ namespace smt {
|
|||
flet<bool> l(m_conservative, conservative);
|
||||
init(q);
|
||||
TRACE("collector", tout << "model checking: #" << q->get_id() << "\n" << mk_pp(q, m_manager) << "\n";);
|
||||
collect(q->get_expr(), 0, 0);
|
||||
collect(q->get_expr(), nullptr, 0);
|
||||
save_result(candidates);
|
||||
}
|
||||
|
||||
|
@ -251,7 +251,7 @@ namespace smt {
|
|||
TRACE("quick_checker_sizes", tout << "found new candidate\n";
|
||||
for (unsigned i = 0; i < m_num_bindings; i++) tout << "#" << m_bindings[i]->get_owner_id() << " "; tout << "\n";);
|
||||
unsigned max_generation = get_max_generation(m_num_bindings, m_bindings.c_ptr());
|
||||
if (m_context.add_instance(q, 0 /* no pattern was used */, m_num_bindings, m_bindings.c_ptr(), max_generation,
|
||||
if (m_context.add_instance(q, nullptr /* no pattern was used */, m_num_bindings, m_bindings.c_ptr(), max_generation,
|
||||
0, // min_top_generation is only available for instances created by the MAM
|
||||
0, // max_top_generation is only available for instances created by the MAM
|
||||
empty_used_enodes))
|
||||
|
@ -311,11 +311,6 @@ namespace smt {
|
|||
return is_true ? any_arg(a, true) : all_args(a, false);
|
||||
case OP_AND:
|
||||
return is_true ? all_args(a, true) : any_arg(a, false);
|
||||
case OP_IFF:
|
||||
if (is_true)
|
||||
return (check(a->get_arg(0), true) && check(a->get_arg(1), true)) || (check(a->get_arg(0), false) && check(a->get_arg(1), false));
|
||||
else
|
||||
return (check(a->get_arg(0), true) && check(a->get_arg(1), false)) || (check(a->get_arg(0), false) && check(a->get_arg(1), true));
|
||||
case OP_ITE:
|
||||
if (check(a->get_arg(0), true))
|
||||
return check(a->get_arg(1), is_true);
|
||||
|
@ -324,6 +319,13 @@ namespace smt {
|
|||
else
|
||||
return check(a->get_arg(1), is_true) && check(a->get_arg(2), is_true);
|
||||
case OP_EQ:
|
||||
if (m_manager.is_iff(a)) {
|
||||
if (is_true)
|
||||
return (check(a->get_arg(0), true) && check(a->get_arg(1), true)) || (check(a->get_arg(0), false) && check(a->get_arg(1), false));
|
||||
else
|
||||
return (check(a->get_arg(0), true) && check(a->get_arg(1), false)) || (check(a->get_arg(0), false) && check(a->get_arg(1), true));
|
||||
}
|
||||
|
||||
if (is_true) {
|
||||
return canonize(a->get_arg(0)) == canonize(a->get_arg(1));
|
||||
}
|
||||
|
|
|
@ -50,7 +50,7 @@ namespace smt {
|
|||
expr * m_expr;
|
||||
func_decl * m_parent;
|
||||
unsigned m_parent_pos;
|
||||
entry(expr * n = 0, func_decl * d = 0, unsigned p = 0):m_expr(n), m_parent(d), m_parent_pos(p) {}
|
||||
entry(expr * n = nullptr, func_decl * d = nullptr, unsigned p = 0):m_expr(n), m_parent(d), m_parent_pos(p) {}
|
||||
unsigned hash() const { return m_parent ? mk_mix(m_expr->get_id(), m_parent->get_id(), m_parent_pos) : m_expr->get_id(); }
|
||||
bool operator==(entry const & e) const { return m_expr == e.m_expr && m_parent == e.m_parent && m_parent_pos == e.m_parent_pos; }
|
||||
};
|
||||
|
|
|
@ -52,24 +52,24 @@ namespace smt {
|
|||
app * m_parent;
|
||||
public:
|
||||
and_relevancy_eh(app * p):m_parent(p) {}
|
||||
virtual ~and_relevancy_eh() {}
|
||||
virtual void operator()(relevancy_propagator & rp);
|
||||
~and_relevancy_eh() override {}
|
||||
void operator()(relevancy_propagator & rp) override;
|
||||
};
|
||||
|
||||
class or_relevancy_eh : public relevancy_eh {
|
||||
app * m_parent;
|
||||
public:
|
||||
or_relevancy_eh(app * p):m_parent(p) {}
|
||||
virtual ~or_relevancy_eh() {}
|
||||
virtual void operator()(relevancy_propagator & rp);
|
||||
~or_relevancy_eh() override {}
|
||||
void operator()(relevancy_propagator & rp) override;
|
||||
};
|
||||
|
||||
class ite_relevancy_eh : public relevancy_eh {
|
||||
app * m_parent;
|
||||
public:
|
||||
ite_relevancy_eh(app * p):m_parent(p) {}
|
||||
virtual ~ite_relevancy_eh() {}
|
||||
virtual void operator()(relevancy_propagator & rp);
|
||||
~ite_relevancy_eh() override {}
|
||||
void operator()(relevancy_propagator & rp) override;
|
||||
};
|
||||
|
||||
class ite_term_relevancy_eh : public relevancy_eh {
|
||||
|
@ -78,8 +78,8 @@ namespace smt {
|
|||
app * m_else_eq;
|
||||
public:
|
||||
ite_term_relevancy_eh(app * p, app * then_eq, app * else_eq):m_parent(p), m_then_eq(then_eq), m_else_eq(else_eq) {}
|
||||
virtual ~ite_term_relevancy_eh() {}
|
||||
virtual void operator()(relevancy_propagator & rp);
|
||||
~ite_term_relevancy_eh() override {}
|
||||
void operator()(relevancy_propagator & rp) override;
|
||||
};
|
||||
|
||||
relevancy_propagator::relevancy_propagator(context & ctx):
|
||||
|
@ -154,33 +154,33 @@ namespace smt {
|
|||
relevancy_propagator(ctx), m_qhead(0), m_relevant_exprs(ctx.get_manager()),
|
||||
m_propagating(false) {}
|
||||
|
||||
virtual ~relevancy_propagator_imp() {
|
||||
~relevancy_propagator_imp() override {
|
||||
undo_trail(0);
|
||||
}
|
||||
|
||||
relevancy_ehs * get_handlers(expr * n) {
|
||||
relevancy_ehs * r = 0;
|
||||
relevancy_ehs * r = nullptr;
|
||||
m_relevant_ehs.find(n, r);
|
||||
SASSERT(m_relevant_ehs.contains(n) || r == 0);
|
||||
return r;
|
||||
}
|
||||
|
||||
void set_handlers(expr * n, relevancy_ehs * ehs) {
|
||||
if (ehs == 0)
|
||||
if (ehs == nullptr)
|
||||
m_relevant_ehs.erase(n);
|
||||
else
|
||||
m_relevant_ehs.insert(n, ehs);
|
||||
}
|
||||
|
||||
relevancy_ehs * get_watches(expr * n, bool val) {
|
||||
relevancy_ehs * r = 0;
|
||||
relevancy_ehs * r = nullptr;
|
||||
m_watches[val ? 1 : 0].find(n, r);
|
||||
SASSERT(m_watches[val ? 1 : 0].contains(n) || r == 0);
|
||||
return r;
|
||||
}
|
||||
|
||||
void set_watches(expr * n, bool val, relevancy_ehs * ehs) {
|
||||
if (ehs == 0)
|
||||
if (ehs == nullptr)
|
||||
m_watches[val ? 1 : 0].erase(n);
|
||||
else
|
||||
m_watches[val ? 1 : 0].insert(n, ehs);
|
||||
|
@ -191,7 +191,7 @@ namespace smt {
|
|||
m_trail.push_back(t);
|
||||
}
|
||||
|
||||
virtual void add_handler(expr * source, relevancy_eh * eh) {
|
||||
void add_handler(expr * source, relevancy_eh * eh) override {
|
||||
if (!enabled())
|
||||
return;
|
||||
if (is_relevant_core(source)) {
|
||||
|
@ -204,7 +204,7 @@ namespace smt {
|
|||
}
|
||||
}
|
||||
|
||||
virtual void add_watch(expr * n, bool val, relevancy_eh * eh) {
|
||||
void add_watch(expr * n, bool val, relevancy_eh * eh) override {
|
||||
if (!enabled())
|
||||
return;
|
||||
lbool lval = m_context.find_assignment(n);
|
||||
|
@ -224,7 +224,7 @@ namespace smt {
|
|||
}
|
||||
}
|
||||
|
||||
virtual void add_watch(expr * n, bool val, expr * target) {
|
||||
void add_watch(expr * n, bool val, expr * target) override {
|
||||
if (!enabled())
|
||||
return;
|
||||
lbool lval = m_context.find_assignment(n);
|
||||
|
@ -244,18 +244,18 @@ namespace smt {
|
|||
|
||||
bool is_relevant_core(expr * n) const { return m_is_relevant.contains(n); }
|
||||
|
||||
virtual bool is_relevant(expr * n) const {
|
||||
bool is_relevant(expr * n) const override {
|
||||
return !enabled() || is_relevant_core(n);
|
||||
}
|
||||
|
||||
virtual void push() {
|
||||
void push() override {
|
||||
m_scopes.push_back(scope());
|
||||
scope & s = m_scopes.back();
|
||||
s.m_relevant_exprs_lim = m_relevant_exprs.size();
|
||||
s.m_trail_lim = m_trail.size();
|
||||
}
|
||||
|
||||
virtual void pop(unsigned num_scopes) {
|
||||
void pop(unsigned num_scopes) override {
|
||||
SASSERT(m_context.get_scope_level() == m_scopes.size());
|
||||
unsigned lvl = m_scopes.size();
|
||||
SASSERT(num_scopes <= lvl);
|
||||
|
@ -325,12 +325,12 @@ namespace smt {
|
|||
\brief Mark the given expression as relevant if it is not
|
||||
already marked.
|
||||
*/
|
||||
virtual void mark_as_relevant(expr * n) {
|
||||
void mark_as_relevant(expr * n) override {
|
||||
if (!enabled())
|
||||
return;
|
||||
if (!is_relevant_core(n)) {
|
||||
enode * e = m_context.find_enode(n);
|
||||
if (e != 0) {
|
||||
if (e != nullptr) {
|
||||
enode * curr = e;
|
||||
do {
|
||||
set_relevant(curr->get_owner());
|
||||
|
@ -376,7 +376,7 @@ namespace smt {
|
|||
case l_undef:
|
||||
break;
|
||||
case l_true: {
|
||||
expr * true_arg = 0;
|
||||
expr * true_arg = nullptr;
|
||||
unsigned num_args = n->get_num_args();
|
||||
for (unsigned i = 0; i < num_args; i++) {
|
||||
expr * arg = n->get_arg(i);
|
||||
|
@ -400,7 +400,7 @@ namespace smt {
|
|||
lbool val = m_context.find_assignment(n);
|
||||
switch (val) {
|
||||
case l_false: {
|
||||
expr * false_arg = 0;
|
||||
expr * false_arg = nullptr;
|
||||
unsigned num_args = n->get_num_args();
|
||||
for (unsigned i = 0; i < num_args; i++) {
|
||||
expr * arg = n->get_arg(i);
|
||||
|
@ -450,7 +450,7 @@ namespace smt {
|
|||
[m_qhead, m_relevant_exprs.size()) in the stack of
|
||||
relevant expressions.
|
||||
*/
|
||||
virtual void propagate() {
|
||||
void propagate() override {
|
||||
if (m_propagating) {
|
||||
return;
|
||||
}
|
||||
|
@ -487,18 +487,18 @@ namespace smt {
|
|||
}
|
||||
|
||||
relevancy_ehs * ehs = get_handlers(n);
|
||||
while (ehs != 0) {
|
||||
while (ehs != nullptr) {
|
||||
ehs->head()->operator()(*this, n);
|
||||
ehs = ehs->tail();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
virtual bool can_propagate() const {
|
||||
bool can_propagate() const override {
|
||||
return m_qhead < m_relevant_exprs.size();
|
||||
}
|
||||
|
||||
virtual void assign_eh(expr * n, bool val) {
|
||||
void assign_eh(expr * n, bool val) override {
|
||||
if (!enabled())
|
||||
return;
|
||||
ast_manager & m = get_manager();
|
||||
|
@ -510,13 +510,13 @@ namespace smt {
|
|||
propagate_relevant_and(to_app(n));
|
||||
}
|
||||
relevancy_ehs * ehs = get_watches(n, val);
|
||||
while (ehs != 0) {
|
||||
while (ehs != nullptr) {
|
||||
ehs->head()->operator()(*this, n, val);
|
||||
ehs = ehs->tail();
|
||||
}
|
||||
}
|
||||
|
||||
virtual void display(std::ostream & out) const {
|
||||
void display(std::ostream & out) const override {
|
||||
if (enabled() && !m_relevant_exprs.empty()) {
|
||||
out << "relevant exprs:\n";
|
||||
for (unsigned i = 0; i < m_relevant_exprs.size(); i++) {
|
||||
|
@ -527,7 +527,7 @@ namespace smt {
|
|||
}
|
||||
|
||||
#ifdef Z3DEBUG
|
||||
bool check_relevancy_app(app * n) const {
|
||||
bool check_relevancy_app(app * n) const {
|
||||
SASSERT(is_relevant(n));
|
||||
unsigned num_args = n->get_num_args();
|
||||
for (unsigned i = 0; i < num_args; i++) {
|
||||
|
@ -537,7 +537,7 @@ namespace smt {
|
|||
return true;
|
||||
}
|
||||
|
||||
virtual bool check_relevancy_or(app * n, bool root) const {
|
||||
bool check_relevancy_or(app * n, bool root) const override {
|
||||
lbool val = root ? l_true : m_context.find_assignment(n);
|
||||
if (val == l_false)
|
||||
return check_relevancy_app(n);
|
||||
|
@ -600,7 +600,7 @@ namespace smt {
|
|||
return true;
|
||||
}
|
||||
|
||||
bool check_relevancy(expr_ref_vector const & v) const {
|
||||
bool check_relevancy(expr_ref_vector const & v) const override {
|
||||
SASSERT(!can_propagate());
|
||||
ast_manager & m = get_manager();
|
||||
unsigned sz = v.size();
|
||||
|
|
|
@ -50,8 +50,8 @@ namespace smt {
|
|||
expr * m_target;
|
||||
public:
|
||||
simple_relevancy_eh(expr * t):m_target(t) {}
|
||||
virtual ~simple_relevancy_eh() {}
|
||||
virtual void operator()(relevancy_propagator & rp);
|
||||
~simple_relevancy_eh() override {}
|
||||
void operator()(relevancy_propagator & rp) override;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -63,8 +63,8 @@ namespace smt {
|
|||
expr * m_target;
|
||||
public:
|
||||
pair_relevancy_eh(expr * s1, expr * s2, expr * t):m_source1(s1), m_source2(s2), m_target(t) {}
|
||||
virtual ~pair_relevancy_eh() {}
|
||||
virtual void operator()(relevancy_propagator & rp);
|
||||
~pair_relevancy_eh() override {}
|
||||
void operator()(relevancy_propagator & rp) override;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -507,7 +507,7 @@ namespace smt {
|
|||
m_params.m_nnf_cnf = false;
|
||||
if (st.m_max_ite_tree_depth > 50) {
|
||||
m_params.m_arith_eq2ineq = false;
|
||||
m_params.m_pull_cheap_ite_trees = true;
|
||||
m_params.m_pull_cheap_ite = true;
|
||||
m_params.m_arith_propagate_eqs = true;
|
||||
m_params.m_relevancy_lvl = 2;
|
||||
m_params.m_relevancy_lemma = false;
|
||||
|
@ -574,19 +574,19 @@ namespace smt {
|
|||
m_params.m_bv_cc = false;
|
||||
m_params.m_bb_ext_gates = true;
|
||||
m_params.m_nnf_cnf = false;
|
||||
m_params.m_propagate_booleans = true;
|
||||
m_context.register_plugin(alloc(smt::theory_bv, m_manager, m_params, m_params));
|
||||
m_context.register_plugin(alloc(smt::theory_array, m_manager, m_params));
|
||||
setup_arrays();
|
||||
}
|
||||
|
||||
void setup::setup_QF_AX() {
|
||||
TRACE("setup", tout << "QF_AX\n";);
|
||||
m_params.m_array_mode = AR_SIMPLE;
|
||||
m_params.m_nnf_cnf = false;
|
||||
m_context.register_plugin(alloc(smt::theory_array, m_manager, m_params));
|
||||
setup_arrays();
|
||||
}
|
||||
|
||||
void setup::setup_QF_AX(static_features const & st) {
|
||||
m_params.m_array_mode = AR_SIMPLE;
|
||||
m_params.m_array_mode = st.m_has_ext_arrays ? AR_FULL : AR_SIMPLE;
|
||||
m_params.m_nnf_cnf = false;
|
||||
if (st.m_num_clauses == st.m_num_units) {
|
||||
m_params.m_relevancy_lvl = 0;
|
||||
|
@ -595,7 +595,7 @@ namespace smt {
|
|||
else {
|
||||
m_params.m_relevancy_lvl = 2;
|
||||
}
|
||||
m_context.register_plugin(alloc(smt::theory_array, m_manager, m_params));
|
||||
setup_arrays();
|
||||
}
|
||||
|
||||
void setup::setup_QF_AUFLIA() {
|
||||
|
@ -607,11 +607,11 @@ namespace smt {
|
|||
m_params.m_restart_factor = 1.5;
|
||||
m_params.m_phase_selection = PS_CACHING_CONSERVATIVE2;
|
||||
setup_i_arith();
|
||||
m_context.register_plugin(alloc(smt::theory_array, m_manager, m_params));
|
||||
setup_arrays();
|
||||
}
|
||||
|
||||
void setup::setup_QF_AUFLIA(static_features const & st) {
|
||||
m_params.m_array_mode = AR_SIMPLE;
|
||||
m_params.m_array_mode = st.m_has_ext_arrays ? AR_FULL : AR_SIMPLE;
|
||||
if (st.m_has_real)
|
||||
throw default_exception("Benchmark has real variables but it is marked as QF_AUFLIA (arrays, uninterpreted functions and linear integer arithmetic).");
|
||||
m_params.m_nnf_cnf = false;
|
||||
|
@ -631,7 +631,7 @@ namespace smt {
|
|||
// m_context.register_plugin(new smt::theory_si_arith(m_manager, m_params));
|
||||
// else
|
||||
setup_i_arith();
|
||||
m_context.register_plugin(alloc(smt::theory_array, m_manager, m_params));
|
||||
setup_arrays();
|
||||
}
|
||||
|
||||
void setup::setup_AUFLIA(bool simple_array) {
|
||||
|
@ -643,7 +643,6 @@ namespace smt {
|
|||
m_params.m_restart_factor = 1.5;
|
||||
m_params.m_eliminate_bounds = true;
|
||||
m_params.m_qi_quick_checker = MC_UNSAT;
|
||||
m_params.m_propagate_booleans = true;
|
||||
m_params.m_qi_lazy_threshold = 20;
|
||||
// m_params.m_qi_max_eager_multipatterns = 10; /// <<< HACK
|
||||
m_params.m_mbqi = true; // enabling MBQI and MACRO_FINDER by default :-)
|
||||
|
@ -671,7 +670,6 @@ namespace smt {
|
|||
m_params.m_phase_selection = PS_ALWAYS_FALSE;
|
||||
m_params.m_eliminate_bounds = true;
|
||||
m_params.m_qi_quick_checker = MC_UNSAT;
|
||||
m_params.m_propagate_booleans = true;
|
||||
m_params.m_qi_eager_threshold = 5;
|
||||
// Added for MBQI release
|
||||
m_params.m_qi_lazy_threshold = 20;
|
||||
|
@ -742,12 +740,11 @@ namespace smt {
|
|||
}
|
||||
|
||||
void setup::setup_i_arith() {
|
||||
// m_context.register_plugin(alloc(smt::theory_lra, m_manager, m_params));
|
||||
m_context.register_plugin(alloc(smt::theory_i_arith, m_manager, m_params));
|
||||
}
|
||||
|
||||
void setup::setup_r_arith() {
|
||||
// to disable theory lra
|
||||
// m_context.register_plugin(alloc(smt::theory_mi_arith, m_manager, m_params));
|
||||
m_context.register_plugin(alloc(smt::theory_lra, m_manager, m_params));
|
||||
}
|
||||
|
||||
|
@ -813,6 +810,9 @@ namespace smt {
|
|||
case AS_OPTINF:
|
||||
m_context.register_plugin(alloc(smt::theory_inf_arith, m_manager, m_params));
|
||||
break;
|
||||
case AS_LRA:
|
||||
setup_r_arith();
|
||||
break;
|
||||
default:
|
||||
if (m_params.m_arith_int_only && int_only)
|
||||
m_context.register_plugin(alloc(smt::theory_i_arith, m_manager, m_params));
|
||||
|
@ -1001,17 +1001,17 @@ namespace smt {
|
|||
}
|
||||
|
||||
if (st.num_theories() == 1 && st.m_has_arrays) {
|
||||
setup_QF_AX();
|
||||
setup_QF_AX(st);
|
||||
return;
|
||||
}
|
||||
|
||||
if (st.num_theories() == 2 && st.has_uf() && st.m_has_arrays && st.m_has_bv) {
|
||||
if (st.num_theories() == 2 && st.has_uf() && st.m_has_arrays && !st.m_has_ext_arrays && st.m_has_bv) {
|
||||
setup_QF_AUFBV();
|
||||
return;
|
||||
}
|
||||
|
||||
if (st.num_theories() == 2 && st.has_uf() && st.m_has_arrays && st.m_has_int) {
|
||||
setup_QF_AUFLIA();
|
||||
setup_QF_AUFLIA(st);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -30,9 +30,35 @@ Notes:
|
|||
namespace smt {
|
||||
|
||||
class smt_solver : public solver_na2as {
|
||||
|
||||
struct cuber {
|
||||
smt_solver& m_solver;
|
||||
unsigned m_round;
|
||||
expr_ref m_result;
|
||||
cuber(smt_solver& s):
|
||||
m_solver(s),
|
||||
m_round(0),
|
||||
m_result(s.get_manager()) {}
|
||||
expr_ref cube() {
|
||||
switch (m_round) {
|
||||
case 0:
|
||||
m_result = m_solver.m_context.next_decision();
|
||||
break;
|
||||
case 1:
|
||||
m_result = m_solver.get_manager().mk_not(m_result);
|
||||
break;
|
||||
default:
|
||||
m_result = m_solver.get_manager().mk_false();
|
||||
break;
|
||||
}
|
||||
++m_round;
|
||||
return m_result;
|
||||
}
|
||||
};
|
||||
|
||||
smt_params m_smt_params;
|
||||
smt::kernel m_context;
|
||||
progress_callback * m_callback;
|
||||
cuber* m_cuber;
|
||||
symbol m_logic;
|
||||
bool m_minimizing_core;
|
||||
bool m_core_extend_patterns;
|
||||
|
@ -45,6 +71,7 @@ namespace smt {
|
|||
solver_na2as(m),
|
||||
m_smt_params(p),
|
||||
m_context(m, m_smt_params),
|
||||
m_cuber(nullptr),
|
||||
m_minimizing_core(false),
|
||||
m_core_extend_patterns(false),
|
||||
m_core_extend_patterns_max_distance(UINT_MAX),
|
||||
|
@ -55,68 +82,91 @@ namespace smt {
|
|||
updt_params(p);
|
||||
}
|
||||
|
||||
virtual solver * translate(ast_manager & m, params_ref const & p) {
|
||||
solver * translate(ast_manager & m, params_ref const & p) override {
|
||||
ast_translation translator(get_manager(), m);
|
||||
|
||||
smt_solver * result = alloc(smt_solver, m, p, m_logic);
|
||||
smt::kernel::copy(m_context, result->m_context);
|
||||
|
||||
for (auto & kv : m_name2assertion)
|
||||
result->m_name2assertion.insert(translator(kv.m_key),
|
||||
translator(kv.m_value));
|
||||
|
||||
if (mc0())
|
||||
result->set_model_converter(mc0()->translate(translator));
|
||||
|
||||
for (auto & kv : m_name2assertion) {
|
||||
expr* val = translator(kv.m_value);
|
||||
expr* t = translator(kv.m_key);
|
||||
result->m_name2assertion.insert(t, val);
|
||||
result->solver_na2as::assert_expr(val, t);
|
||||
m.inc_ref(val);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
virtual ~smt_solver() {
|
||||
~smt_solver() override {
|
||||
dec_ref_values(get_manager(), m_name2assertion);
|
||||
dealloc(m_cuber);
|
||||
}
|
||||
|
||||
virtual void updt_params(params_ref const & p) {
|
||||
void updt_params(params_ref const & p) override {
|
||||
solver::updt_params(p);
|
||||
m_smt_params.updt_params(p);
|
||||
m_context.updt_params(p);
|
||||
smt_params_helper smth(p);
|
||||
m_smt_params.updt_params(solver::get_params());
|
||||
m_context.updt_params(solver::get_params());
|
||||
smt_params_helper smth(solver::get_params());
|
||||
m_core_extend_patterns = smth.core_extend_patterns();
|
||||
m_core_extend_patterns_max_distance = smth.core_extend_patterns_max_distance();
|
||||
m_core_extend_nonlocal_patterns = smth.core_extend_nonlocal_patterns();
|
||||
}
|
||||
|
||||
virtual void collect_param_descrs(param_descrs & r) {
|
||||
params_ref m_params_save;
|
||||
smt_params m_smt_params_save;
|
||||
|
||||
void push_params() override {
|
||||
m_params_save = params_ref();
|
||||
m_params_save.copy(solver::get_params());
|
||||
m_smt_params_save = m_smt_params;
|
||||
}
|
||||
|
||||
void pop_params() override {
|
||||
m_smt_params = m_smt_params_save;
|
||||
solver::reset_params(m_params_save);
|
||||
}
|
||||
|
||||
void collect_param_descrs(param_descrs & r) override {
|
||||
m_context.collect_param_descrs(r);
|
||||
}
|
||||
|
||||
virtual void collect_statistics(statistics & st) const {
|
||||
void collect_statistics(statistics & st) const override {
|
||||
m_context.collect_statistics(st);
|
||||
}
|
||||
|
||||
virtual lbool get_consequences_core(expr_ref_vector const& assumptions, expr_ref_vector const& vars, expr_ref_vector& conseq) {
|
||||
lbool get_consequences_core(expr_ref_vector const& assumptions, expr_ref_vector const& vars, expr_ref_vector& conseq) override {
|
||||
expr_ref_vector unfixed(m_context.m());
|
||||
return m_context.get_consequences(assumptions, vars, conseq, unfixed);
|
||||
}
|
||||
|
||||
virtual lbool find_mutexes(expr_ref_vector const& vars, vector<expr_ref_vector>& mutexes) {
|
||||
lbool find_mutexes(expr_ref_vector const& vars, vector<expr_ref_vector>& mutexes) override {
|
||||
return m_context.find_mutexes(vars, mutexes);
|
||||
}
|
||||
|
||||
virtual void assert_expr(expr * t) {
|
||||
void assert_expr_core(expr * t) override {
|
||||
m_context.assert_expr(t);
|
||||
}
|
||||
|
||||
virtual void assert_expr(expr * t, expr * a) {
|
||||
void assert_expr_core2(expr * t, expr * a) override {
|
||||
if (m_name2assertion.contains(a)) {
|
||||
throw default_exception("named assertion defined twice");
|
||||
}
|
||||
solver_na2as::assert_expr(t, a);
|
||||
solver_na2as::assert_expr_core2(t, a);
|
||||
get_manager().inc_ref(t);
|
||||
m_name2assertion.insert(a, t);
|
||||
}
|
||||
|
||||
virtual void push_core() {
|
||||
void push_core() override {
|
||||
m_context.push();
|
||||
}
|
||||
|
||||
virtual void pop_core(unsigned n) {
|
||||
void pop_core(unsigned n) override {
|
||||
unsigned cur_sz = m_assumptions.size();
|
||||
if (n > 0 && cur_sz > 0) {
|
||||
unsigned lvl = m_scopes.size();
|
||||
|
@ -135,11 +185,16 @@ namespace smt {
|
|||
m_context.pop(n);
|
||||
}
|
||||
|
||||
virtual lbool check_sat_core(unsigned num_assumptions, expr * const * assumptions) {
|
||||
lbool check_sat_core(unsigned num_assumptions, expr * const * assumptions) override {
|
||||
TRACE("solver_na2as", tout << "smt_solver::check_sat_core: " << num_assumptions << "\n";);
|
||||
return m_context.check(num_assumptions, assumptions);
|
||||
}
|
||||
|
||||
|
||||
lbool check_sat_cc_core(expr_ref_vector const& cube, vector<expr_ref_vector> const& clauses) override {
|
||||
return m_context.check(cube, clauses);
|
||||
}
|
||||
|
||||
struct scoped_minimize_core {
|
||||
smt_solver& s;
|
||||
expr_ref_vector m_assumptions;
|
||||
|
@ -154,17 +209,17 @@ namespace smt {
|
|||
}
|
||||
};
|
||||
|
||||
virtual void get_unsat_core(ptr_vector<expr> & r) {
|
||||
void get_unsat_core(expr_ref_vector & r) override {
|
||||
unsigned sz = m_context.get_unsat_core_size();
|
||||
for (unsigned i = 0; i < sz; i++) {
|
||||
r.push_back(m_context.get_unsat_core_expr(i));
|
||||
}
|
||||
|
||||
if (m_minimizing_core && smt_params_helper(get_params()).core_minimize()) {
|
||||
if (!m_minimizing_core && smt_params_helper(get_params()).core_minimize()) {
|
||||
scoped_minimize_core scm(*this);
|
||||
mus mus(*this);
|
||||
mus.add_soft(r.size(), r.c_ptr());
|
||||
ptr_vector<expr> r2;
|
||||
expr_ref_vector r2(m);
|
||||
if (l_true == mus.get_mus(r2)) {
|
||||
r.reset();
|
||||
r.append(r2);
|
||||
|
@ -177,44 +232,63 @@ namespace smt {
|
|||
add_nonlocal_pattern_literals_to_core(r);
|
||||
}
|
||||
|
||||
virtual void get_model(model_ref & m) {
|
||||
void get_model_core(model_ref & m) override {
|
||||
m_context.get_model(m);
|
||||
}
|
||||
|
||||
virtual proof * get_proof() {
|
||||
proof * get_proof() override {
|
||||
return m_context.get_proof();
|
||||
}
|
||||
|
||||
virtual std::string reason_unknown() const {
|
||||
std::string reason_unknown() const override {
|
||||
return m_context.last_failure_as_string();
|
||||
}
|
||||
|
||||
virtual void set_reason_unknown(char const* msg) {
|
||||
void set_reason_unknown(char const* msg) override {
|
||||
m_context.set_reason_unknown(msg);
|
||||
}
|
||||
|
||||
virtual void get_labels(svector<symbol> & r) {
|
||||
void get_labels(svector<symbol> & r) override {
|
||||
buffer<symbol> tmp;
|
||||
m_context.get_relevant_labels(0, tmp);
|
||||
m_context.get_relevant_labels(nullptr, tmp);
|
||||
r.append(tmp.size(), tmp.c_ptr());
|
||||
}
|
||||
|
||||
virtual ast_manager & get_manager() const { return m_context.m(); }
|
||||
ast_manager & get_manager() const override { return m_context.m(); }
|
||||
|
||||
virtual void set_progress_callback(progress_callback * callback) {
|
||||
m_callback = callback;
|
||||
void set_progress_callback(progress_callback * callback) override {
|
||||
m_context.set_progress_callback(callback);
|
||||
}
|
||||
|
||||
virtual unsigned get_num_assertions() const {
|
||||
unsigned get_num_assertions() const override {
|
||||
return m_context.size();
|
||||
}
|
||||
|
||||
virtual expr * get_assertion(unsigned idx) const {
|
||||
expr * get_assertion(unsigned idx) const override {
|
||||
SASSERT(idx < get_num_assertions());
|
||||
return m_context.get_formula(idx);
|
||||
}
|
||||
|
||||
expr_ref_vector cube(expr_ref_vector& vars, unsigned cutoff) override {
|
||||
ast_manager& m = get_manager();
|
||||
if (!m_cuber) {
|
||||
m_cuber = alloc(cuber, *this);
|
||||
}
|
||||
expr_ref result = m_cuber->cube();
|
||||
expr_ref_vector lits(m);
|
||||
if (m.is_false(result)) {
|
||||
dealloc(m_cuber);
|
||||
m_cuber = nullptr;
|
||||
}
|
||||
if (m.is_true(result)) {
|
||||
dealloc(m_cuber);
|
||||
m_cuber = nullptr;
|
||||
return lits;
|
||||
}
|
||||
lits.push_back(result);
|
||||
return lits;
|
||||
}
|
||||
|
||||
struct collect_fds_proc {
|
||||
ast_manager & m;
|
||||
func_decl_set & m_fds;
|
||||
|
@ -259,7 +333,7 @@ namespace smt {
|
|||
for_each_expr(p, visited, e);
|
||||
}
|
||||
|
||||
void compute_assrtn_fds(ptr_vector<expr> & core, vector<func_decl_set> & assrtn_fds) {
|
||||
void compute_assrtn_fds(expr_ref_vector & core, vector<func_decl_set> & assrtn_fds) {
|
||||
assrtn_fds.resize(m_name2assertion.size());
|
||||
unsigned i = 0;
|
||||
for (auto & kv : m_name2assertion) {
|
||||
|
@ -280,7 +354,7 @@ namespace smt {
|
|||
return false;
|
||||
}
|
||||
|
||||
void add_pattern_literals_to_core(ptr_vector<expr> & core) {
|
||||
void add_pattern_literals_to_core(expr_ref_vector & core) {
|
||||
ast_manager & m = get_manager();
|
||||
expr_ref_vector new_core_literals(m);
|
||||
|
||||
|
@ -339,7 +413,7 @@ namespace smt {
|
|||
for_each_expr(p, visited, e);
|
||||
}
|
||||
|
||||
void add_nonlocal_pattern_literals_to_core(ptr_vector<expr> & core) {
|
||||
void add_nonlocal_pattern_literals_to_core(expr_ref_vector & core) {
|
||||
ast_manager & m = get_manager();
|
||||
for (auto const& kv : m_name2assertion) {
|
||||
expr_ref name(kv.m_key, m);
|
||||
|
@ -351,8 +425,8 @@ namespace smt {
|
|||
collect_body_func_decls(assrtn, body_fds);
|
||||
|
||||
for (func_decl *fd : pattern_fds) {
|
||||
if (!body_fds.contains(fd)) {
|
||||
core.insert(name);
|
||||
if (!body_fds.contains(fd) && !core.contains(name)) {
|
||||
core.push_back(name);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -368,7 +442,7 @@ solver * mk_smt_solver(ast_manager & m, params_ref const & p, symbol const & log
|
|||
|
||||
class smt_solver_factory : public solver_factory {
|
||||
public:
|
||||
virtual solver * operator()(ast_manager & m, params_ref const & p, bool proofs_enabled, bool models_enabled, bool unsat_core_enabled, symbol const & logic) {
|
||||
solver * operator()(ast_manager & m, params_ref const & p, bool proofs_enabled, bool models_enabled, bool unsat_core_enabled, symbol const & logic) override {
|
||||
return mk_smt_solver(m, p, logic);
|
||||
}
|
||||
};
|
||||
|
|
|
@ -130,8 +130,8 @@ namespace smt {
|
|||
|
||||
theory::theory(family_id fid):
|
||||
m_id(fid),
|
||||
m_context(0),
|
||||
m_manager(0) {
|
||||
m_context(nullptr),
|
||||
m_manager(nullptr) {
|
||||
}
|
||||
|
||||
theory::~theory() {
|
||||
|
|
|
@ -235,7 +235,7 @@ namespace smt {
|
|||
disequality propagation.
|
||||
*/
|
||||
virtual justification * why_is_diseq(theory_var v1, theory_var v2) {
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -369,7 +369,7 @@ namespace smt {
|
|||
theory_var other = null_theory_var;
|
||||
TRACE("assume_eqs",
|
||||
tout << "#" << n->get_owner_id() << " is_relevant_and_shared: " << is_relevant_and_shared(n) << "\n";);
|
||||
if (n != 0 && is_relevant_and_shared(n)) {
|
||||
if (n != nullptr && is_relevant_and_shared(n)) {
|
||||
other = table.insert_if_not_there(v);
|
||||
if (other != v) {
|
||||
enode * n2 = get_enode(other);
|
||||
|
@ -423,7 +423,7 @@ namespace smt {
|
|||
\brief Return a functor that can build the value (interpretation) for n.
|
||||
*/
|
||||
virtual model_value_proc * mk_value(enode * n, model_generator & mg) {
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
virtual bool include_func_interp(func_decl* f) {
|
||||
|
|
|
@ -32,10 +32,10 @@ namespace smt {
|
|||
theory_var_list():
|
||||
m_th_id(null_theory_id),
|
||||
m_th_var(null_theory_var),
|
||||
m_next(0) {
|
||||
m_next(nullptr) {
|
||||
}
|
||||
|
||||
theory_var_list(theory_id t, theory_var v, theory_var_list * n = 0):
|
||||
theory_var_list(theory_id t, theory_var v, theory_var_list * n = nullptr):
|
||||
m_th_id(t),
|
||||
m_th_var(v),
|
||||
m_next(n) {
|
||||
|
|
|
@ -21,6 +21,7 @@ Revision History:
|
|||
|
||||
#include "util/list.h"
|
||||
#include "util/vector.h"
|
||||
#include "util/hashtable.h"
|
||||
#include "util/lbool.h"
|
||||
|
||||
class model;
|
||||
|
|
|
@ -43,11 +43,11 @@ public:
|
|||
m_fn = m.mk_func_decl(symbol(0xbeef101), i_sort, m.mk_bool_sort());
|
||||
}
|
||||
|
||||
virtual tactic * translate(ast_manager & m) {
|
||||
tactic * translate(ast_manager & m) override {
|
||||
return alloc(ctx_solver_simplify_tactic, m, m_params);
|
||||
}
|
||||
|
||||
virtual ~ctx_solver_simplify_tactic() {
|
||||
~ctx_solver_simplify_tactic() override {
|
||||
obj_map<sort, func_decl*>::iterator it = m_fns.begin(), end = m_fns.end();
|
||||
for (; it != end; ++it) {
|
||||
m.dec_ref(it->m_value);
|
||||
|
@ -55,33 +55,28 @@ public:
|
|||
m_fns.reset();
|
||||
}
|
||||
|
||||
virtual void updt_params(params_ref const & p) {
|
||||
void updt_params(params_ref const & p) override {
|
||||
m_solver.updt_params(p);
|
||||
}
|
||||
|
||||
virtual void collect_param_descrs(param_descrs & r) {
|
||||
void collect_param_descrs(param_descrs & r) override {
|
||||
m_solver.collect_param_descrs(r);
|
||||
}
|
||||
|
||||
virtual void collect_statistics(statistics & st) const {
|
||||
void collect_statistics(statistics & st) const override {
|
||||
st.update("solver-simplify-steps", m_num_steps);
|
||||
}
|
||||
|
||||
virtual void reset_statistics() { m_num_steps = 0; }
|
||||
void reset_statistics() override { m_num_steps = 0; }
|
||||
|
||||
virtual void operator()(goal_ref const & in,
|
||||
goal_ref_buffer & result,
|
||||
model_converter_ref & mc,
|
||||
proof_converter_ref & pc,
|
||||
expr_dependency_ref & core) {
|
||||
|
||||
mc = 0; pc = 0; core = 0;
|
||||
void operator()(goal_ref const & in,
|
||||
goal_ref_buffer & result) override {
|
||||
reduce(*(in.get()));
|
||||
in->inc_depth();
|
||||
result.push_back(in.get());
|
||||
}
|
||||
|
||||
virtual void cleanup() {
|
||||
void cleanup() override {
|
||||
reset_statistics();
|
||||
m_solver.reset();
|
||||
}
|
||||
|
@ -127,7 +122,7 @@ protected:
|
|||
m_solver.pop(1);
|
||||
});
|
||||
g.reset();
|
||||
g.assert_expr(fml, 0, 0);
|
||||
g.assert_expr(fml, nullptr, nullptr);
|
||||
IF_VERBOSE(TACTIC_VERBOSITY_LVL, verbose_stream() << "(ctx-solver-simplify :num-steps " << m_num_steps << ")\n";);
|
||||
SASSERT(g.is_well_sorted());
|
||||
}
|
||||
|
@ -141,7 +136,7 @@ protected:
|
|||
m_parent(p), m_self(s), m_idx(i), m_expr(e)
|
||||
{}
|
||||
expr_pos():
|
||||
m_parent(0), m_self(0), m_idx(0), m_expr(0)
|
||||
m_parent(0), m_self(0), m_idx(0), m_expr(nullptr)
|
||||
{}
|
||||
};
|
||||
|
||||
|
@ -194,7 +189,7 @@ protected:
|
|||
|
||||
a = to_app(e);
|
||||
sz = a->get_num_args();
|
||||
n2 = 0;
|
||||
n2 = nullptr;
|
||||
|
||||
for (unsigned i = 0; i < sz; ++i) {
|
||||
expr* arg = a->get_arg(i);
|
||||
|
|
|
@ -16,19 +16,21 @@ Author:
|
|||
Notes:
|
||||
|
||||
--*/
|
||||
#include "tactic/tactic.h"
|
||||
#include "tactic/tactical.h"
|
||||
#include "util/lp/lp_params.hpp"
|
||||
#include "ast/rewriter/rewriter_types.h"
|
||||
#include "ast/ast_util.h"
|
||||
#include "smt/smt_kernel.h"
|
||||
#include "smt/params/smt_params.h"
|
||||
#include "smt/params/smt_params_helper.hpp"
|
||||
#include "util/lp/lp_params.hpp"
|
||||
#include "ast/rewriter/rewriter_types.h"
|
||||
#include "tactic/filter_model_converter.h"
|
||||
#include "ast/ast_util.h"
|
||||
#include "solver/solver2tactic.h"
|
||||
#include "smt/smt_solver.h"
|
||||
#include "tactic/tactic.h"
|
||||
#include "tactic/tactical.h"
|
||||
#include "tactic/generic_model_converter.h"
|
||||
#include "solver/solver2tactic.h"
|
||||
#include "solver/solver.h"
|
||||
#include "solver/mus.h"
|
||||
#include "solver/parallel_tactic.h"
|
||||
#include "solver/parallel_params.hpp"
|
||||
|
||||
typedef obj_map<expr, expr *> expr2expr_map;
|
||||
|
||||
|
@ -47,17 +49,17 @@ class smt_tactic : public tactic {
|
|||
public:
|
||||
smt_tactic(params_ref const & p):
|
||||
m_params_ref(p),
|
||||
m_ctx(0),
|
||||
m_callback(0) {
|
||||
m_ctx(nullptr),
|
||||
m_callback(nullptr) {
|
||||
updt_params_core(p);
|
||||
TRACE("smt_tactic", tout << "p: " << p << "\n";);
|
||||
}
|
||||
|
||||
virtual tactic * translate(ast_manager & m) {
|
||||
tactic * translate(ast_manager & m) override {
|
||||
return alloc(smt_tactic, m_params_ref);
|
||||
}
|
||||
|
||||
virtual ~smt_tactic() {
|
||||
~smt_tactic() override {
|
||||
SASSERT(m_ctx == 0);
|
||||
}
|
||||
|
||||
|
@ -74,7 +76,7 @@ public:
|
|||
m_fail_if_inconclusive = p.get_bool("fail_if_inconclusive", true);
|
||||
}
|
||||
|
||||
virtual void updt_params(params_ref const & p) {
|
||||
void updt_params(params_ref const & p) override {
|
||||
TRACE("smt_tactic", tout << "updt_params: " << p << "\n";);
|
||||
updt_params_core(p);
|
||||
fparams().updt_params(p);
|
||||
|
@ -86,7 +88,7 @@ public:
|
|||
SASSERT(p.get_bool("auto_config", fparams().m_auto_config) == fparams().m_auto_config);
|
||||
}
|
||||
|
||||
virtual void collect_param_descrs(param_descrs & r) {
|
||||
void collect_param_descrs(param_descrs & r) override {
|
||||
r.insert("candidate_models", CPK_BOOL, "(default: false) create candidate models even when quantifier or theory reasoning is incomplete.");
|
||||
r.insert("fail_if_inconclusive", CPK_BOOL, "(default: true) fail if found unsat (sat) for under (over) approximated goal.");
|
||||
smt_params_helper::collect_param_descrs(r);
|
||||
|
@ -94,25 +96,25 @@ public:
|
|||
}
|
||||
|
||||
|
||||
virtual void collect_statistics(statistics & st) const {
|
||||
void collect_statistics(statistics & st) const override {
|
||||
if (m_ctx)
|
||||
m_ctx->collect_statistics(st); // ctx is still running...
|
||||
else
|
||||
st.copy(m_stats);
|
||||
}
|
||||
|
||||
virtual void cleanup() {
|
||||
void cleanup() override {
|
||||
}
|
||||
|
||||
virtual void reset_statistics() {
|
||||
void reset_statistics() override {
|
||||
m_stats.reset();
|
||||
}
|
||||
|
||||
virtual void set_logic(symbol const & l) {
|
||||
void set_logic(symbol const & l) override {
|
||||
m_logic = l;
|
||||
}
|
||||
|
||||
virtual void set_progress_callback(progress_callback * callback) {
|
||||
void set_progress_callback(progress_callback * callback) override {
|
||||
m_callback = callback;
|
||||
}
|
||||
|
||||
|
@ -136,7 +138,7 @@ public:
|
|||
|
||||
~scoped_init_ctx() {
|
||||
smt::kernel * d = m_owner.m_ctx;
|
||||
m_owner.m_ctx = 0;
|
||||
m_owner.m_ctx = nullptr;
|
||||
|
||||
if (d)
|
||||
dealloc(d);
|
||||
|
@ -144,14 +146,10 @@ public:
|
|||
};
|
||||
|
||||
|
||||
virtual void operator()(goal_ref const & in,
|
||||
goal_ref_buffer & result,
|
||||
model_converter_ref & mc,
|
||||
proof_converter_ref & pc,
|
||||
expr_dependency_ref & core) {
|
||||
void operator()(goal_ref const & in,
|
||||
goal_ref_buffer & result) override {
|
||||
try {
|
||||
IF_VERBOSE(10, verbose_stream() << "(smt.tactic start)\n";);
|
||||
mc = 0; pc = 0; core = 0;
|
||||
SASSERT(in->is_well_sorted());
|
||||
ast_manager & m = in->m();
|
||||
TRACE("smt_tactic", tout << this << "\nAUTO_CONFIG: " << fparams().m_auto_config << " HIDIV0: " << fparams().m_hi_div0 << " "
|
||||
|
@ -169,7 +167,7 @@ public:
|
|||
expr_ref_vector clauses(m);
|
||||
expr2expr_map bool2dep;
|
||||
ptr_vector<expr> assumptions;
|
||||
ref<filter_model_converter> fmc;
|
||||
ref<generic_model_converter> fmc;
|
||||
if (in->unsat_core_enabled()) {
|
||||
extract_clauses_and_dependencies(in, clauses, assumptions, bool2dep, fmc);
|
||||
TRACE("mus", in->display_with_dependencies(tout);
|
||||
|
@ -221,8 +219,12 @@ public:
|
|||
m_ctx->get_model(md);
|
||||
buffer<symbol> r;
|
||||
m_ctx->get_relevant_labels(0, r);
|
||||
mc = model_and_labels2model_converter(md.get(), r);
|
||||
labels_vec rv;
|
||||
rv.append(r.size(), r.c_ptr());
|
||||
model_converter_ref mc;
|
||||
mc = model_and_labels2model_converter(md.get(), rv);
|
||||
mc = concat(fmc.get(), mc.get());
|
||||
in->add(mc.get());
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -233,8 +235,8 @@ public:
|
|||
}
|
||||
// formula is unsat, reset the goal, and store false there.
|
||||
in->reset();
|
||||
proof * pr = 0;
|
||||
expr_dependency * lcore = 0;
|
||||
proof * pr = nullptr;
|
||||
expr_dependency * lcore = nullptr;
|
||||
if (in->proofs_enabled())
|
||||
pr = m_ctx->get_proof();
|
||||
if (in->unsat_core_enabled()) {
|
||||
|
@ -270,7 +272,9 @@ public:
|
|||
m_ctx->get_model(md);
|
||||
buffer<symbol> r;
|
||||
m_ctx->get_relevant_labels(0, r);
|
||||
mc = model_and_labels2model_converter(md.get(), r);
|
||||
labels_vec rv;
|
||||
rv.append(r.size(), r.c_ptr());
|
||||
in->add(model_and_labels2model_converter(md.get(), rv));
|
||||
}
|
||||
return;
|
||||
default:
|
||||
|
@ -299,3 +303,18 @@ tactic * mk_smt_tactic_using(bool auto_config, params_ref const & _p) {
|
|||
return using_params(r, p);
|
||||
}
|
||||
|
||||
tactic * mk_psmt_tactic(ast_manager& m, params_ref const& p, symbol const& logic) {
|
||||
parallel_params pp(p);
|
||||
return pp.enable() ? mk_parallel_tactic(mk_smt_solver(m, p, logic), p) : mk_smt_tactic(p);
|
||||
}
|
||||
|
||||
tactic * mk_psmt_tactic_using(ast_manager& m, bool auto_config, params_ref const& _p, symbol const& logic) {
|
||||
parallel_params pp(_p);
|
||||
params_ref p = _p;
|
||||
p.set_bool("auto_config", auto_config);
|
||||
return using_params(pp.enable() ? mk_parallel_tactic(mk_smt_solver(m, p, logic), p) : mk_smt_tactic(p), p);
|
||||
}
|
||||
|
||||
tactic * mk_parallel_smt_tactic(ast_manager& m, params_ref const& p) {
|
||||
return mk_parallel_tactic(mk_smt_solver(m, p, symbol::null), p);
|
||||
}
|
||||
|
|
|
@ -31,8 +31,13 @@ tactic * mk_smt_tactic(params_ref const & p = params_ref());
|
|||
// syntax sugar for using_params(mk_smt_tactic(), p) where p = (:auto_config, auto_config)
|
||||
tactic * mk_smt_tactic_using(bool auto_config = true, params_ref const & p = params_ref());
|
||||
|
||||
tactic * mk_psmt_tactic(ast_manager& m, params_ref const& p, symbol const& logic = symbol::null);
|
||||
tactic * mk_psmt_tactic_using(ast_manager& m, bool auto_config, params_ref const& p, symbol const& logic = symbol::null);
|
||||
tactic * mk_parallel_smt_tactic(ast_manager& m, params_ref const& p);
|
||||
|
||||
|
||||
/*
|
||||
ADD_TACTIC("smt", "apply a SAT based SMT solver.", "mk_smt_tactic(p)")
|
||||
ADD_TACTIC("psmt", "builtin strategy for SMT tactic in parallel.", "mk_parallel_smt_tactic(m, p)")
|
||||
*/
|
||||
#endif
|
||||
|
|
|
@ -37,22 +37,19 @@ struct unit_subsumption_tactic : public tactic {
|
|||
m_clauses(m) {
|
||||
}
|
||||
|
||||
void cleanup() {}
|
||||
void cleanup() override {}
|
||||
|
||||
virtual void operator()(/* in */ goal_ref const & in,
|
||||
/* out */ goal_ref_buffer & result,
|
||||
/* out */ model_converter_ref & mc,
|
||||
/* out */ proof_converter_ref & pc,
|
||||
/* out */ expr_dependency_ref & core) {
|
||||
void operator()(/* in */ goal_ref const & in,
|
||||
/* out */ goal_ref_buffer & result) override {
|
||||
reduce_core(in, result);
|
||||
}
|
||||
|
||||
virtual void updt_params(params_ref const& p) {
|
||||
void updt_params(params_ref const& p) override {
|
||||
m_params = p;
|
||||
// m_context.updt_params(p); does not exist.
|
||||
}
|
||||
|
||||
virtual tactic* translate(ast_manager& m) {
|
||||
tactic* translate(ast_manager& m) override {
|
||||
return alloc(unit_subsumption_tactic, m, m_params);
|
||||
}
|
||||
|
||||
|
@ -109,9 +106,7 @@ struct unit_subsumption_tactic : public tactic {
|
|||
}
|
||||
|
||||
void insert_result(goal_ref& result) {
|
||||
for (unsigned i = 0; i < m_deleted.size(); ++i) {
|
||||
result->update(m_deleted[i], m.mk_true()); // TBD proof?
|
||||
}
|
||||
for (auto d : m_deleted) result->update(d, m.mk_true()); // TBD proof?
|
||||
}
|
||||
|
||||
void init(goal_ref const& g) {
|
||||
|
|
|
@ -31,6 +31,7 @@ Revision History:
|
|||
#include "smt/params/theory_arith_params.h"
|
||||
#include "smt/arith_eq_adapter.h"
|
||||
#include "smt/proto_model/numeral_factory.h"
|
||||
#include "smt/smt_context.h"
|
||||
#include "util/obj_pair_hashtable.h"
|
||||
#include "smt/old_interval.h"
|
||||
#include "math/grobner/grobner.h"
|
||||
|
@ -306,16 +307,16 @@ namespace smt {
|
|||
public:
|
||||
atom(bool_var bv, theory_var v, inf_numeral const & k, atom_kind kind);
|
||||
atom_kind get_atom_kind() const { return static_cast<atom_kind>(m_atom_kind); }
|
||||
virtual ~atom() {}
|
||||
~atom() override {}
|
||||
inline inf_numeral const & get_k() const { return m_k; }
|
||||
bool_var get_bool_var() const { return m_bvar; }
|
||||
bool is_true() const { return m_is_true; }
|
||||
void assign_eh(bool is_true, inf_numeral const & epsilon);
|
||||
virtual bool has_justification() const { return true; }
|
||||
virtual void push_justification(antecedents& a, numeral const& coeff, bool proofs_enabled) {
|
||||
bool has_justification() const override { return true; }
|
||||
void push_justification(antecedents& a, numeral const& coeff, bool proofs_enabled) override {
|
||||
a.push_lit(literal(get_bool_var(), !m_is_true), coeff, proofs_enabled);
|
||||
}
|
||||
virtual void display(theory_arith const& th, std::ostream& out) const;
|
||||
void display(theory_arith const& th, std::ostream& out) const override;
|
||||
};
|
||||
|
||||
class eq_bound : public bound {
|
||||
|
@ -328,13 +329,13 @@ namespace smt {
|
|||
m_rhs(rhs) {
|
||||
SASSERT(m_lhs->get_root() == m_rhs->get_root());
|
||||
}
|
||||
virtual ~eq_bound() {}
|
||||
virtual bool has_justification() const { return true; }
|
||||
virtual void push_justification(antecedents& a, numeral const& coeff, bool proofs_enabled) {
|
||||
~eq_bound() override {}
|
||||
bool has_justification() const override { return true; }
|
||||
void push_justification(antecedents& a, numeral const& coeff, bool proofs_enabled) override {
|
||||
SASSERT(m_lhs->get_root() == m_rhs->get_root());
|
||||
a.push_eq(enode_pair(m_lhs, m_rhs), coeff, proofs_enabled);
|
||||
}
|
||||
virtual void display(theory_arith const& th, std::ostream& out) const;
|
||||
void display(theory_arith const& th, std::ostream& out) const override;
|
||||
};
|
||||
|
||||
class derived_bound : public bound {
|
||||
|
@ -344,14 +345,14 @@ namespace smt {
|
|||
friend class theory_arith;
|
||||
public:
|
||||
derived_bound(theory_var v, inf_numeral const & val, bound_kind k):bound(v, val, k, false) {}
|
||||
virtual ~derived_bound() {}
|
||||
~derived_bound() override {}
|
||||
literal_vector const& lits() const { return m_lits; }
|
||||
eq_vector const& eqs() const { return m_eqs; }
|
||||
virtual bool has_justification() const { return true; }
|
||||
virtual void push_justification(antecedents& a, numeral const& coeff, bool proofs_enabled);
|
||||
bool has_justification() const override { return true; }
|
||||
void push_justification(antecedents& a, numeral const& coeff, bool proofs_enabled) override;
|
||||
virtual void push_lit(literal l, numeral const&) { m_lits.push_back(l); }
|
||||
virtual void push_eq(enode_pair const& p, numeral const&) { m_eqs.push_back(p); }
|
||||
virtual void display(theory_arith const& th, std::ostream& out) const;
|
||||
void display(theory_arith const& th, std::ostream& out) const override;
|
||||
|
||||
};
|
||||
|
||||
|
@ -361,12 +362,12 @@ namespace smt {
|
|||
friend class theory_arith;
|
||||
public:
|
||||
justified_derived_bound(theory_var v, inf_numeral const & val, bound_kind k):derived_bound(v, val, k) {}
|
||||
virtual ~justified_derived_bound() {}
|
||||
virtual bool has_justification() const { return true; }
|
||||
virtual void push_justification(antecedents& a, numeral const& coeff, bool proofs_enabled);
|
||||
virtual void push_lit(literal l, numeral const& coeff);
|
||||
~justified_derived_bound() override {}
|
||||
bool has_justification() const override { return true; }
|
||||
void push_justification(antecedents& a, numeral const& coeff, bool proofs_enabled) override;
|
||||
void push_lit(literal l, numeral const& coeff) override;
|
||||
|
||||
virtual void push_eq(enode_pair const& p, numeral const& coeff);
|
||||
void push_eq(enode_pair const& p, numeral const& coeff) override;
|
||||
};
|
||||
|
||||
typedef int_hashtable<int_hash, default_eq<int> > literal_idx_set;
|
||||
|
@ -510,7 +511,7 @@ namespace smt {
|
|||
typedef int_hashtable<var_value_hash, var_value_eq> var_value_table;
|
||||
var_value_table m_var_value_table;
|
||||
|
||||
virtual theory_var mk_var(enode * n);
|
||||
theory_var mk_var(enode * n) override;
|
||||
|
||||
void found_unsupported_op(app * n);
|
||||
void found_underspecified_op(app * n);
|
||||
|
@ -561,16 +562,16 @@ namespace smt {
|
|||
bound * upper(theory_var v) const { return m_bounds[1][v]; }
|
||||
inf_numeral const & lower_bound(theory_var v) const { SASSERT(lower(v) != 0); return lower(v)->get_value(); }
|
||||
inf_numeral const & upper_bound(theory_var v) const { SASSERT(upper(v) != 0); return upper(v)->get_value(); }
|
||||
bool below_lower(theory_var v) const { bound * l = lower(v); return l != 0 && get_value(v) < l->get_value(); }
|
||||
bool above_upper(theory_var v) const { bound * u = upper(v); return u != 0 && get_value(v) > u->get_value(); }
|
||||
bool below_upper(theory_var v) const { bound * u = upper(v); return u == 0 || get_value(v) < u->get_value(); }
|
||||
bool above_lower(theory_var v) const { bound * l = lower(v); return l == 0 || get_value(v) > l->get_value(); }
|
||||
bool below_lower(theory_var v) const { bound * l = lower(v); return l != nullptr && get_value(v) < l->get_value(); }
|
||||
bool above_upper(theory_var v) const { bound * u = upper(v); return u != nullptr && get_value(v) > u->get_value(); }
|
||||
bool below_upper(theory_var v) const { bound * u = upper(v); return u == nullptr || get_value(v) < u->get_value(); }
|
||||
bool above_lower(theory_var v) const { bound * l = lower(v); return l == nullptr || get_value(v) > l->get_value(); }
|
||||
bool at_bound(theory_var v) const;
|
||||
bool at_lower(theory_var v) const { bound * l = lower(v); return l != 0 && get_value(v) == l->get_value(); }
|
||||
bool at_upper(theory_var v) const { bound * u = upper(v); return u != 0 && get_value(v) == u->get_value(); }
|
||||
bool is_free(theory_var v) const { return lower(v) == 0 && upper(v) == 0; }
|
||||
bool is_non_free(theory_var v) const { return lower(v) != 0 || upper(v) != 0; }
|
||||
bool is_bounded(theory_var v) const { return lower(v) != 0 && upper(v) != 0; }
|
||||
bool at_lower(theory_var v) const { bound * l = lower(v); return l != nullptr && get_value(v) == l->get_value(); }
|
||||
bool at_upper(theory_var v) const { bound * u = upper(v); return u != nullptr && get_value(v) == u->get_value(); }
|
||||
bool is_free(theory_var v) const { return lower(v) == nullptr && upper(v) == nullptr; }
|
||||
bool is_non_free(theory_var v) const { return lower(v) != nullptr || upper(v) != nullptr; }
|
||||
bool is_bounded(theory_var v) const { return lower(v) != nullptr && upper(v) != nullptr; }
|
||||
bool is_free(expr * n) const {
|
||||
SASSERT(get_context().e_internalized(n) && get_context().get_enode(n)->get_th_var(get_id()) != null_theory_var);
|
||||
return is_free(get_context().get_enode(n)->get_th_var(get_id()));
|
||||
|
@ -635,24 +636,24 @@ namespace smt {
|
|||
struct compare_atoms {
|
||||
bool operator()(atom* a1, atom* a2) const { return a1->get_k() < a2->get_k(); }
|
||||
};
|
||||
virtual bool default_internalizer() const { return false; }
|
||||
virtual bool internalize_atom(app * n, bool gate_ctx);
|
||||
virtual bool internalize_term(app * term);
|
||||
virtual void internalize_eq_eh(app * atom, bool_var v);
|
||||
virtual void apply_sort_cnstr(enode * n, sort * s);
|
||||
bool default_internalizer() const override { return false; }
|
||||
bool internalize_atom(app * n, bool gate_ctx) override;
|
||||
bool internalize_term(app * term) override;
|
||||
void internalize_eq_eh(app * atom, bool_var v) override;
|
||||
void apply_sort_cnstr(enode * n, sort * s) override;
|
||||
|
||||
virtual void assign_eh(bool_var v, bool is_true);
|
||||
virtual void new_eq_eh(theory_var v1, theory_var v2);
|
||||
virtual bool use_diseqs() const;
|
||||
virtual void new_diseq_eh(theory_var v1, theory_var v2);
|
||||
void assign_eh(bool_var v, bool is_true) override;
|
||||
void new_eq_eh(theory_var v1, theory_var v2) override;
|
||||
bool use_diseqs() const override;
|
||||
void new_diseq_eh(theory_var v1, theory_var v2) override;
|
||||
|
||||
virtual void push_scope_eh();
|
||||
virtual void pop_scope_eh(unsigned num_scopes);
|
||||
void push_scope_eh() override;
|
||||
void pop_scope_eh(unsigned num_scopes) override;
|
||||
|
||||
virtual void relevant_eh(app * n);
|
||||
void relevant_eh(app * n) override;
|
||||
|
||||
virtual void restart_eh();
|
||||
virtual void init_search_eh();
|
||||
void restart_eh() override;
|
||||
void init_search_eh() override;
|
||||
/**
|
||||
\brief True if the assignment may be changed during final
|
||||
check. assume_eqs, check_int_feasibility,
|
||||
|
@ -660,7 +661,7 @@ namespace smt {
|
|||
satisfy their respective constraints. However, when they
|
||||
do that the may create inconsistencies in the other
|
||||
modules. I use m_liberal_final_check to avoid infinite
|
||||
loops where the modules keep changing the assigment and no
|
||||
loops where the modules keep changing the assignment and no
|
||||
progress is made. If m_liberal_final_check is set to false,
|
||||
these modules will avoid mutating the assignment to satisfy
|
||||
constraints.
|
||||
|
@ -669,18 +670,18 @@ namespace smt {
|
|||
*/
|
||||
bool m_liberal_final_check;
|
||||
final_check_status final_check_core();
|
||||
virtual final_check_status final_check_eh();
|
||||
final_check_status final_check_eh() override;
|
||||
|
||||
virtual bool can_propagate();
|
||||
virtual void propagate();
|
||||
bool can_propagate() override;
|
||||
void propagate() override;
|
||||
bool propagate_core();
|
||||
void failed();
|
||||
|
||||
|
||||
virtual void flush_eh();
|
||||
virtual void reset_eh();
|
||||
void flush_eh() override;
|
||||
void reset_eh() override;
|
||||
|
||||
virtual bool validate_eq_in_model(theory_var v1, theory_var v2, bool is_true) const;
|
||||
bool validate_eq_in_model(theory_var v1, theory_var v2, bool is_true) const override;
|
||||
|
||||
// -----------------------------------
|
||||
//
|
||||
|
@ -867,7 +868,7 @@ namespace smt {
|
|||
void propagate_cheap_eq(unsigned rid);
|
||||
void propagate_eq_to_core(theory_var x, theory_var y, antecedents& antecedents);
|
||||
|
||||
virtual bool is_shared(theory_var v) const;
|
||||
bool is_shared(theory_var v) const override;
|
||||
|
||||
// -----------------------------------
|
||||
//
|
||||
|
@ -909,7 +910,7 @@ namespace smt {
|
|||
/**
|
||||
\brief See comment in theory::mk_eq_atom
|
||||
*/
|
||||
virtual app * mk_eq_atom(expr * lhs, expr * rhs) { return m_util.mk_eq(lhs, rhs); }
|
||||
app * mk_eq_atom(expr * lhs, expr * rhs) override { return m_util.mk_eq(lhs, rhs); }
|
||||
|
||||
// -----------------------------------
|
||||
//
|
||||
|
@ -1039,13 +1040,13 @@ namespace smt {
|
|||
// -----------------------------------
|
||||
public:
|
||||
theory_arith(ast_manager & m, theory_arith_params & params);
|
||||
virtual ~theory_arith();
|
||||
~theory_arith() override;
|
||||
|
||||
virtual theory * mk_fresh(context * new_ctx);
|
||||
theory * mk_fresh(context * new_ctx) override;
|
||||
|
||||
virtual void setup();
|
||||
void setup() override;
|
||||
|
||||
virtual char const * get_name() const { return "arithmetic"; }
|
||||
char const * get_name() const override { return "arithmetic"; }
|
||||
|
||||
// -----------------------------------
|
||||
//
|
||||
|
@ -1058,15 +1059,15 @@ namespace smt {
|
|||
void compute_epsilon();
|
||||
void refine_epsilon();
|
||||
|
||||
virtual void init_model(model_generator & m);
|
||||
virtual model_value_proc * mk_value(enode * n, model_generator & mg);
|
||||
void init_model(model_generator & m) override;
|
||||
model_value_proc * mk_value(enode * n, model_generator & mg) override;
|
||||
|
||||
// -----------------------------------
|
||||
//
|
||||
// Model checker
|
||||
//
|
||||
// -----------------------------------
|
||||
virtual bool get_value(enode * n, expr_ref & r);
|
||||
bool get_value(enode * n, expr_ref & r) override;
|
||||
|
||||
bool get_lower(enode* n, expr_ref& r);
|
||||
bool get_upper(enode* n, expr_ref& r);
|
||||
|
@ -1078,10 +1079,10 @@ namespace smt {
|
|||
// Optimization
|
||||
//
|
||||
// -----------------------------------
|
||||
virtual inf_eps_rational<inf_rational> maximize(theory_var v, expr_ref& blocker, bool& has_shared);
|
||||
virtual inf_eps_rational<inf_rational> value(theory_var v);
|
||||
virtual theory_var add_objective(app* term);
|
||||
expr_ref mk_ge(filter_model_converter& fm, theory_var v, inf_numeral const& val);
|
||||
expr_ref mk_ge(generic_model_converter& fm, theory_var v, inf_numeral const& val);
|
||||
inf_eps_rational<inf_rational> maximize(theory_var v, expr_ref& blocker, bool& has_shared) override;
|
||||
inf_eps_rational<inf_rational> value(theory_var v) override;
|
||||
theory_var add_objective(app* term) override;
|
||||
void enable_record_conflict(expr* bound);
|
||||
void record_conflict(unsigned num_lits, literal const * lits,
|
||||
unsigned num_eqs, enode_pair const * eqs,
|
||||
|
@ -1102,8 +1103,8 @@ namespace smt {
|
|||
//
|
||||
// -----------------------------------
|
||||
public:
|
||||
virtual void collect_statistics(::statistics & st) const;
|
||||
virtual void display(std::ostream & out) const;
|
||||
void collect_statistics(::statistics & st) const override;
|
||||
void display(std::ostream & out) const override;
|
||||
protected:
|
||||
void display_row(std::ostream & out, unsigned r_id, bool compact = true) const;
|
||||
void display_row(std::ostream & out, row const & r, bool compact = true) const;
|
||||
|
|
|
@ -23,7 +23,7 @@ Revision History:
|
|||
#include "smt/theory_arith.h"
|
||||
#include "smt/smt_farkas_util.h"
|
||||
#include "ast/rewriter/th_rewriter.h"
|
||||
#include "tactic/filter_model_converter.h"
|
||||
#include "tactic/generic_model_converter.h"
|
||||
|
||||
namespace smt {
|
||||
|
||||
|
@ -279,7 +279,7 @@ namespace smt {
|
|||
return it;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
template<typename Ext>
|
||||
|
@ -357,7 +357,7 @@ namespace smt {
|
|||
|
||||
template<typename Ext>
|
||||
parameter * theory_arith<Ext>::antecedents_t::params(char const* name) {
|
||||
if (empty()) return 0;
|
||||
if (empty()) return nullptr;
|
||||
init();
|
||||
m_params[0] = parameter(symbol(name));
|
||||
return m_params.c_ptr();
|
||||
|
@ -444,19 +444,19 @@ namespace smt {
|
|||
template<typename Ext>
|
||||
bool theory_arith<Ext>::at_bound(theory_var v) const {
|
||||
bound * l = lower(v);
|
||||
if (l != 0 && get_value(v) == l->get_value())
|
||||
if (l != nullptr && get_value(v) == l->get_value())
|
||||
return true;
|
||||
bound * u = upper(v);
|
||||
return u != 0 && get_value(v) == u->get_value();
|
||||
return u != nullptr && get_value(v) == u->get_value();
|
||||
}
|
||||
|
||||
template<typename Ext>
|
||||
bool theory_arith<Ext>::is_fixed(theory_var v) const {
|
||||
bound * l = lower(v);
|
||||
if (l == 0)
|
||||
if (l == nullptr)
|
||||
return false;
|
||||
bound * u = upper(v);
|
||||
if (u == 0)
|
||||
if (u == nullptr)
|
||||
return false;
|
||||
return l->get_value() == u->get_value();
|
||||
}
|
||||
|
@ -483,7 +483,7 @@ namespace smt {
|
|||
while (true) {
|
||||
column const & c = m_columns[v];
|
||||
if (c.size() == 0)
|
||||
return 0;
|
||||
return nullptr;
|
||||
int quasi_base_rid = -1;
|
||||
typename svector<col_entry>::const_iterator it = c.begin_entries();
|
||||
typename svector<col_entry>::const_iterator end = c.end_entries();
|
||||
|
@ -533,7 +533,7 @@ namespace smt {
|
|||
typename theory_arith<Ext>::col_entry const * theory_arith<Ext>::get_row_for_eliminating(theory_var v) const {
|
||||
column const & c = m_columns[v];
|
||||
if (c.size() == 0)
|
||||
return 0;
|
||||
return nullptr;
|
||||
typename svector<col_entry>::const_iterator it = c.begin_entries();
|
||||
typename svector<col_entry>::const_iterator end = c.end_entries();
|
||||
for (; it != end; ++it) {
|
||||
|
@ -556,7 +556,7 @@ namespace smt {
|
|||
return it;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
template<typename Ext>
|
||||
|
@ -1117,14 +1117,14 @@ namespace smt {
|
|||
This allows to handle inequalities with non-standard numbers.
|
||||
*/
|
||||
template<typename Ext>
|
||||
expr_ref theory_arith<Ext>::mk_ge(filter_model_converter& fm, theory_var v, inf_numeral const& val) {
|
||||
expr_ref theory_arith<Ext>::mk_ge(generic_model_converter& fm, theory_var v, inf_numeral const& val) {
|
||||
ast_manager& m = get_manager();
|
||||
context& ctx = get_context();
|
||||
std::ostringstream strm;
|
||||
strm << val << " <= " << mk_pp(get_enode(v)->get_owner(), get_manager());
|
||||
app* b = m.mk_const(symbol(strm.str().c_str()), m.mk_bool_sort());
|
||||
if (!ctx.b_internalized(b)) {
|
||||
fm.insert(b->get_decl());
|
||||
fm.hide(b->get_decl());
|
||||
bool_var bv = ctx.mk_bool_var(b);
|
||||
ctx.set_var_theory(bv, get_id());
|
||||
// ctx.set_enode_flag(bv, true);
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -117,7 +117,7 @@ namespace smt {
|
|||
for (; it != end; ++it) {
|
||||
if (!it->is_dead()) {
|
||||
theory_var v = it->m_var;
|
||||
if (lower(v) != 0 && upper(v) != 0)
|
||||
if (lower(v) != nullptr && upper(v) != nullptr)
|
||||
continue;
|
||||
bad++;
|
||||
if (bad > 2) {
|
||||
|
|
|
@ -50,15 +50,15 @@ namespace smt {
|
|||
bound * l = lower(v);
|
||||
bound * u = upper(v);
|
||||
const inf_numeral & val = get_value(v);
|
||||
if (l != 0 && u != 0) {
|
||||
if (l != nullptr && u != nullptr) {
|
||||
if (val != l->get_value() && val != u->get_value())
|
||||
set_value(v, l->get_value());
|
||||
}
|
||||
else if (l != 0) {
|
||||
else if (l != nullptr) {
|
||||
if (val != l->get_value())
|
||||
set_value(v, l->get_value());
|
||||
}
|
||||
else if (u != 0) {
|
||||
else if (u != nullptr) {
|
||||
if (val != u->get_value())
|
||||
set_value(v, u->get_value());
|
||||
}
|
||||
|
@ -200,10 +200,12 @@ namespace smt {
|
|||
SASSERT(is_int(v));
|
||||
SASSERT(!get_value(v).is_int());
|
||||
m_stats.m_branches++;
|
||||
TRACE("arith_int", tout << "branching v" << v << " = " << get_value(v) << "\n";
|
||||
display_var(tout, v););
|
||||
numeral k = ceil(get_value(v));
|
||||
rational _k = k.to_rational();
|
||||
TRACE("arith_int", tout << "branching v" << v << " = " << get_value(v) << "\n";
|
||||
display_var(tout, v);
|
||||
tout << "k = " << k << ", _k = "<< _k << std::endl;
|
||||
);
|
||||
expr_ref bound(get_manager());
|
||||
expr* e = get_enode(v)->get_owner();
|
||||
bound = m_util.mk_ge(e, m_util.mk_numeral(_k, m_util.is_int(e)));
|
||||
|
@ -245,12 +247,12 @@ namespace smt {
|
|||
numeral const_coeff(0);
|
||||
|
||||
bound* l = lower(b), *u = upper(b);
|
||||
if (l != 0 && get_value(b) - inf_numeral(1) < l->get_value()) {
|
||||
if (l != nullptr && get_value(b) - inf_numeral(1) < l->get_value()) {
|
||||
SASSERT(l->get_value() <= get_value(b));
|
||||
is_tight = true;
|
||||
const_coeff = l->get_value().get_rational();
|
||||
}
|
||||
else if (u != 0 && get_value(b) + inf_numeral(1) > u->get_value()) {
|
||||
else if (u != nullptr && get_value(b) + inf_numeral(1) > u->get_value()) {
|
||||
SASSERT(get_value(b) <= u->get_value());
|
||||
is_tight = true;
|
||||
const_coeff = u->get_value().get_rational();
|
||||
|
@ -472,7 +474,7 @@ namespace smt {
|
|||
bounds.num_params(), bounds.params("gomory-cut")) {
|
||||
}
|
||||
// Remark: the assignment must be propagated back to arith
|
||||
virtual theory_id get_from_theory() const { return null_theory_id; }
|
||||
theory_id get_from_theory() const override { return null_theory_id; }
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -1074,7 +1076,7 @@ namespace smt {
|
|||
derived_bound * new_bound = alloc(derived_bound, v, inf_numeral(k), lower ? B_LOWER : B_UPPER);
|
||||
t.m_tmp_lit_set.reset();
|
||||
t.m_tmp_eq_set.reset();
|
||||
if (old_bound != 0) {
|
||||
if (old_bound != nullptr) {
|
||||
t.accumulate_justification(*old_bound, *new_bound, numeral(0) /* refine for proof gen */, t.m_tmp_lit_set, t.m_tmp_eq_set);
|
||||
}
|
||||
unsigned_vector::const_iterator it = js.begin();
|
||||
|
@ -1174,8 +1176,8 @@ namespace smt {
|
|||
c2 = rational(c);
|
||||
TRACE("euclidean_solver_new", tout << "new fixed: " << c2 << "\n";);
|
||||
propagated = true;
|
||||
mk_lower(v, c2, 0, m_js);
|
||||
mk_upper(v, c2, 0, m_js);
|
||||
mk_lower(v, c2, nullptr, m_js);
|
||||
mk_upper(v, c2, nullptr, m_js);
|
||||
}
|
||||
else {
|
||||
TRACE("euclidean_solver", tout << "inequality can be tightned, since all coefficients are multiple of: " << g << "\n";);
|
||||
|
@ -1187,7 +1189,7 @@ namespace smt {
|
|||
bound * l = t.lower(v);
|
||||
bound * u = t.upper(v);
|
||||
c2 = rational(c);
|
||||
if (l != 0) {
|
||||
if (l != nullptr) {
|
||||
rational l_old = l->get_value().get_rational().to_rational();
|
||||
rational l_new = g*ceil((l_old - c2)/g) + c2;
|
||||
TRACE("euclidean_solver_new", tout << "new lower: " << l_new << " old: " << l_old << "\n";
|
||||
|
@ -1197,7 +1199,7 @@ namespace smt {
|
|||
mk_lower(v, l_new, l, m_js);
|
||||
}
|
||||
}
|
||||
if (u != 0) {
|
||||
if (u != nullptr) {
|
||||
rational u_old = u->get_value().get_rational().to_rational();
|
||||
rational u_new = g*floor((u_old - c2)/g) + c2;
|
||||
TRACE("euclidean_solver_new", tout << "new upper: " << u_new << " old: " << u_old << "\n";);
|
||||
|
@ -1223,7 +1225,7 @@ namespace smt {
|
|||
continue; // skip equations...
|
||||
if (!t.is_int(v))
|
||||
continue; // skip non integer definitions...
|
||||
if (t.lower(v) == 0 && t.upper(v) == 0)
|
||||
if (t.lower(v) == nullptr && t.upper(v) == nullptr)
|
||||
continue; // there is nothing to be tightned
|
||||
if (tight_bounds(v))
|
||||
propagated = true;
|
||||
|
|
|
@ -141,8 +141,8 @@ namespace smt {
|
|||
\brief Return the number of variables that
|
||||
do not have bounds associated with it.
|
||||
The result is 0, 1, or 2. The value 2 means "2 or more".
|
||||
The second value is the idx of the a variable that does not
|
||||
have bounds associated with it. It is only usefull when the first value is 1.
|
||||
The second value is the idx of the variable that does not
|
||||
have bounds associated with it. It is only useful when the first value is 1.
|
||||
The second value is -1 if such variable does not exist, that is, the first
|
||||
value is 0.
|
||||
|
||||
|
@ -161,14 +161,14 @@ namespace smt {
|
|||
template<typename Ext>
|
||||
std::pair<unsigned, int> theory_arith<Ext>::analyze_monomial(expr * m) const {
|
||||
SASSERT(is_pure_monomial(m));
|
||||
expr * var = 0;
|
||||
expr * var = nullptr;
|
||||
unsigned power = 0;
|
||||
unsigned c = 0;
|
||||
int free_var_idx = -1;
|
||||
int idx = 0;
|
||||
for (unsigned i = 0; i < to_app(m)->get_num_args(); i++) {
|
||||
expr * arg = to_app(m)->get_arg(i);
|
||||
if (var == 0) {
|
||||
if (var == nullptr) {
|
||||
var = arg;
|
||||
power = 1;
|
||||
}
|
||||
|
@ -227,7 +227,7 @@ namespace smt {
|
|||
SASSERT(!m_util.is_numeral(m));
|
||||
if (m_util.is_mul(m)) {
|
||||
unsigned num_vars = 0;
|
||||
expr * var = 0;
|
||||
expr * var = nullptr;
|
||||
for (unsigned i = 0; i < to_app(m)->get_num_args(); i++) {
|
||||
expr * curr = to_app(m)->get_arg(i);
|
||||
if (var != curr) {
|
||||
|
@ -252,12 +252,12 @@ namespace smt {
|
|||
m = get_monomial_body(m);
|
||||
if (m_util.is_mul(m)) {
|
||||
unsigned curr_idx = 0;
|
||||
expr * var = 0;
|
||||
expr * var = nullptr;
|
||||
unsigned power = 0;
|
||||
unsigned j;
|
||||
for (j = 0; j < to_app(m)->get_num_args(); j++) {
|
||||
expr * arg = to_app(m)->get_arg(j);
|
||||
if (var == 0) {
|
||||
if (var == nullptr) {
|
||||
var = arg;
|
||||
power = 1;
|
||||
}
|
||||
|
@ -471,7 +471,7 @@ namespace smt {
|
|||
}
|
||||
}
|
||||
bound * old_lower = lower(v);
|
||||
if (old_lower == 0 || new_lower > old_lower->get_value()) {
|
||||
if (old_lower == nullptr || new_lower > old_lower->get_value()) {
|
||||
TRACE("non_linear", tout << "NEW lower bound for v" << v << " " << new_lower << "\n";
|
||||
display_interval(tout, i); tout << "\n";);
|
||||
mk_derived_nl_bound(v, new_lower, B_LOWER, i.get_lower_dependencies());
|
||||
|
@ -494,7 +494,7 @@ namespace smt {
|
|||
}
|
||||
}
|
||||
bound * old_upper = upper(v);
|
||||
if (old_upper == 0 || new_upper < old_upper->get_value()) {
|
||||
if (old_upper == nullptr || new_upper < old_upper->get_value()) {
|
||||
TRACE("non_linear", tout << "NEW upper bound for v" << v << " " << new_upper << "\n";
|
||||
display_interval(tout, i); tout << "\n";);
|
||||
mk_derived_nl_bound(v, new_upper, B_UPPER, i.get_upper_dependencies());
|
||||
|
@ -788,7 +788,7 @@ namespace smt {
|
|||
TRACE("non_linear", tout << "BRANCHING on v" << v << "\n";);
|
||||
m_stats.m_nl_branching++;
|
||||
SASSERT(is_int(v));
|
||||
expr * bound = 0;
|
||||
expr * bound = nullptr;
|
||||
if (lower(v))
|
||||
bound = m_util.mk_le(var2expr(v), m_util.mk_numeral(lower_bound(v).get_rational().to_rational(), true));
|
||||
else if (upper(v))
|
||||
|
@ -857,7 +857,7 @@ namespace smt {
|
|||
if (!is_fixed(_var))
|
||||
return arg;
|
||||
}
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -882,12 +882,12 @@ namespace smt {
|
|||
|
||||
numeral k = get_monomial_fixed_var_product(m);
|
||||
TRACE("non_linear", tout << "new linear monomial... k: " << k << "\n";);
|
||||
expr * x_n = k.is_zero() ? 0 : get_monomial_non_fixed_var(m);
|
||||
expr * x_n = k.is_zero() ? nullptr : get_monomial_non_fixed_var(m);
|
||||
TRACE("non_linear_bug", if (x_n != 0) { tout << "x_n: " << mk_bounded_pp(x_n, get_manager()) << "\nx_n: #" << x_n->get_id() << "\n"; });
|
||||
context & ctx = get_context();
|
||||
derived_bound * new_lower = 0;
|
||||
derived_bound * new_upper = 0;
|
||||
if (x_n != 0) {
|
||||
derived_bound * new_lower = nullptr;
|
||||
derived_bound * new_upper = nullptr;
|
||||
if (x_n != nullptr) {
|
||||
// All but one of the x_i variables are assigned.
|
||||
// Let x_n be the unassigned variable.
|
||||
// Then, we know that x_1*...*x_n = k*x_n, where k is the product of beta(x_1)*...*beta(x_{n-1})
|
||||
|
@ -1267,7 +1267,7 @@ namespace smt {
|
|||
expr * var = ce.second;
|
||||
if (!c.is_one()) {
|
||||
rational c2;
|
||||
expr * m = 0;
|
||||
expr * m = nullptr;
|
||||
if (m_util.is_numeral(var, c2))
|
||||
m = m_util.mk_numeral(c*c2, m_util.is_int(var) && c.is_int() && c2.is_int());
|
||||
else
|
||||
|
@ -1492,7 +1492,7 @@ namespace smt {
|
|||
r.push_back(coeff_expr(kv.first, f));
|
||||
}
|
||||
}
|
||||
expr * s = cross_nested(e, 0);
|
||||
expr * s = cross_nested(e, nullptr);
|
||||
if (!r.empty()) {
|
||||
expr * q = horner(r, var);
|
||||
// TODO: improve here
|
||||
|
@ -1519,7 +1519,7 @@ namespace smt {
|
|||
template<typename Ext>
|
||||
expr * theory_arith<Ext>::cross_nested(sbuffer<coeff_expr> & p, expr * var) {
|
||||
TRACE("non_linear", tout << "p.size: " << p.size() << "\n";);
|
||||
if (var == 0) {
|
||||
if (var == nullptr) {
|
||||
sbuffer<var_num_occs> varinfo;
|
||||
get_polynomial_info(p, varinfo);
|
||||
if (varinfo.empty())
|
||||
|
@ -1556,7 +1556,7 @@ namespace smt {
|
|||
tout << "b: " << b << "\n";
|
||||
tout << "nm: " << nm << "\n";);
|
||||
SASSERT(n != nm);
|
||||
expr * new_expr = 0;
|
||||
expr * new_expr = nullptr;
|
||||
if (nm < n) {
|
||||
std::swap(n, nm);
|
||||
std::swap(a, b);
|
||||
|
@ -1576,7 +1576,7 @@ namespace smt {
|
|||
expr * xm_a2b = m_util.mk_add(m_util.mk_numeral(a2b, m_util.is_int(var)), xm);
|
||||
expr * xm_a2b2 = m_util.mk_mul(xm_a2b, xm_a2b);
|
||||
expr * rhs = m_util.mk_add(xm_a2b2, m_util.mk_numeral(ma2b2, m_util.is_int(var)));
|
||||
expr * rhs2 = 0;
|
||||
expr * rhs2 = nullptr;
|
||||
if (n > m)
|
||||
rhs2 = m_util.mk_mul(power(var, n - m), rhs);
|
||||
else
|
||||
|
@ -1593,7 +1593,7 @@ namespace smt {
|
|||
if (rest.empty())
|
||||
return new_expr;
|
||||
TRACE("non_linear", tout << "rest size: " << rest.size() << ", i1: " << i1 << ", i2: " << i2 << "\n";);
|
||||
expr * h = cross_nested(rest, 0);
|
||||
expr * h = cross_nested(rest, nullptr);
|
||||
expr * r = m_util.mk_add(new_expr, h);
|
||||
m_nl_new_exprs.push_back(r);
|
||||
return r;
|
||||
|
@ -1631,7 +1631,7 @@ namespace smt {
|
|||
tout << "c:\n" << mk_ismt2_pp(cn, get_manager()) << "\n";);
|
||||
interval i = evaluate_as_interval(cn);
|
||||
TRACE("cross_nested", tout << "interval: " << i << "\n";);
|
||||
v_dependency * d = 0;
|
||||
v_dependency * d = nullptr;
|
||||
if (!i.minus_infinity() && (i.get_lower_value().is_pos() || (i.get_lower_value().is_zero() && i.is_lower_open())))
|
||||
d = i.get_lower_dependencies();
|
||||
else if (!i.plus_infinity() && (i.get_upper_value().is_neg() || (i.get_upper_value().is_zero() && i.is_upper_open())))
|
||||
|
@ -1823,7 +1823,7 @@ namespace smt {
|
|||
if (!coeff.is_zero())
|
||||
return gb.mk_monomial(coeff, vars.size(), vars.c_ptr());
|
||||
else
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1834,7 +1834,7 @@ namespace smt {
|
|||
void theory_arith<Ext>::add_row_to_gb(row const & r, grobner & gb) {
|
||||
TRACE("non_linear", tout << "adding row to gb\n"; display_row(tout, r););
|
||||
ptr_buffer<grobner::monomial> monomials;
|
||||
v_dependency * dep = 0;
|
||||
v_dependency * dep = nullptr;
|
||||
m_tmp_var_set.reset();
|
||||
typename vector<row_entry>::const_iterator it = r.begin_entries();
|
||||
typename vector<row_entry>::const_iterator end = r.end_entries();
|
||||
|
@ -1860,7 +1860,7 @@ namespace smt {
|
|||
template<typename Ext>
|
||||
void theory_arith<Ext>::add_monomial_def_to_gb(theory_var v, grobner & gb) {
|
||||
ptr_buffer<grobner::monomial> monomials;
|
||||
v_dependency * dep = 0;
|
||||
v_dependency * dep = nullptr;
|
||||
m_tmp_var_set.reset();
|
||||
expr * m = var2expr(v);
|
||||
SASSERT(is_pure_monomial(m));
|
||||
|
@ -1872,7 +1872,7 @@ namespace smt {
|
|||
dep = m_dep_manager.mk_join(dep, m_dep_manager.mk_join(m_dep_manager.mk_leaf(lower(v)), m_dep_manager.mk_leaf(upper(v))));
|
||||
coeff *= lower_bound(v).get_rational().to_rational();
|
||||
if (!coeff.is_zero())
|
||||
monomials.push_back(gb.mk_monomial(coeff, 0, 0));
|
||||
monomials.push_back(gb.mk_monomial(coeff, 0, nullptr));
|
||||
}
|
||||
else {
|
||||
monomials.push_back(gb.mk_monomial(coeff, 1, &m));
|
||||
|
@ -1904,12 +1904,12 @@ namespace smt {
|
|||
template<typename Ext>
|
||||
interval theory_arith<Ext>::mk_interval_for(grobner::monomial const * m) {
|
||||
interval r(m_dep_manager, rational(m->get_coeff()));
|
||||
expr * var = 0;
|
||||
expr * var = nullptr;
|
||||
unsigned power = 0;
|
||||
unsigned num_vars = m->get_degree();
|
||||
for (unsigned i = 0; i < num_vars; i++) {
|
||||
expr * curr = m->get_var(i);
|
||||
if (var == 0) {
|
||||
if (var == nullptr) {
|
||||
var = curr;
|
||||
power = 1;
|
||||
}
|
||||
|
@ -1922,7 +1922,7 @@ namespace smt {
|
|||
power = 1;
|
||||
}
|
||||
}
|
||||
if (var != 0)
|
||||
if (var != nullptr)
|
||||
mul_bound_of(var, power, r);
|
||||
return r;
|
||||
}
|
||||
|
@ -1957,7 +1957,7 @@ namespace smt {
|
|||
return false;
|
||||
}
|
||||
TRACE("non_linear_bug", tout << "is_inconsistent, r: " << r << "\n";);
|
||||
v_dependency * interval_deps = 0;
|
||||
v_dependency * interval_deps = nullptr;
|
||||
bool conflict = false;
|
||||
if (!r.minus_infinity() && (r.get_lower_value().is_pos() || (r.get_lower_value().is_zero() && r.is_lower_open()))) {
|
||||
interval_deps = r.get_lower_dependencies();
|
||||
|
@ -2002,11 +2002,11 @@ namespace smt {
|
|||
return false;
|
||||
if (!m->get_coeff().is_perfect_square(r))
|
||||
return false;
|
||||
expr * var = 0;
|
||||
expr * var = nullptr;
|
||||
unsigned power = 0;
|
||||
for (unsigned i = 0; i < num_vars; i++) {
|
||||
expr * curr = m->get_var(i);
|
||||
if (var == 0) {
|
||||
if (var == nullptr) {
|
||||
var = curr;
|
||||
power = 1;
|
||||
}
|
||||
|
@ -2050,18 +2050,18 @@ namespace smt {
|
|||
unsigned i1, i2, i12;
|
||||
i1 = i2 = i12 = 0;
|
||||
while (true) {
|
||||
expr * v1 = 0;
|
||||
expr * v2 = 0;
|
||||
expr * v12 = 0;
|
||||
expr * v1 = nullptr;
|
||||
expr * v2 = nullptr;
|
||||
expr * v12 = nullptr;
|
||||
if (i1 < num1)
|
||||
v1 = m1_sq->get_var(i1);
|
||||
if (i2 < num2)
|
||||
v2 = m2_sq->get_var(i2);
|
||||
if (i12 < num12)
|
||||
v12 = m1m2->get_var(i12);
|
||||
if (v1 == 0 && v2 == 0 && v12 == 0)
|
||||
if (v1 == nullptr && v2 == nullptr && v12 == nullptr)
|
||||
return true;
|
||||
if (v12 == 0)
|
||||
if (v12 == nullptr)
|
||||
return false;
|
||||
if (v1 == v12) {
|
||||
SASSERT(m1_sq->get_var(i1+1) == v1);
|
||||
|
@ -2162,7 +2162,7 @@ namespace smt {
|
|||
}
|
||||
if (monomials.size() == num)
|
||||
return false; // didn't find any perfect square.
|
||||
interval ge_zero(m_dep_manager, rational(0), false, true, 0);
|
||||
interval ge_zero(m_dep_manager, rational(0), false, true, nullptr);
|
||||
if (is_inconsistent(ge_zero, monomials.size(), monomials.c_ptr(), eq->get_dependency())) {
|
||||
TRACE("non_linear", tout << "found conflict\n"; gb.display_equation(tout, *eq););
|
||||
return true;
|
||||
|
|
|
@ -504,7 +504,7 @@ namespace smt {
|
|||
pp.add_assumption(eq);
|
||||
}
|
||||
else {
|
||||
if (lower(v) != 0) {
|
||||
if (lower(v) != nullptr) {
|
||||
inf_numeral k_inf = lower_bound(v);
|
||||
rational k = k_inf.get_rational().to_rational();
|
||||
expr_ref ineq(m);
|
||||
|
@ -514,7 +514,7 @@ namespace smt {
|
|||
ineq = m_util.mk_lt(m_util.mk_numeral(k, is_int(v)), n);
|
||||
pp.add_assumption(ineq);
|
||||
}
|
||||
if (upper(v) != 0) {
|
||||
if (upper(v) != nullptr) {
|
||||
inf_numeral k_inf = upper_bound(v);
|
||||
rational k = k_inf.get_rational().to_rational();
|
||||
expr_ref ineq(m);
|
||||
|
|
|
@ -55,19 +55,19 @@ namespace smt {
|
|||
th_trail_stack m_trail_stack;
|
||||
unsigned m_final_check_idx;
|
||||
|
||||
virtual void init(context * ctx);
|
||||
virtual theory_var mk_var(enode * n);
|
||||
virtual bool internalize_atom(app * atom, bool gate_ctx);
|
||||
virtual bool internalize_term(app * term);
|
||||
virtual void apply_sort_cnstr(enode * n, sort * s);
|
||||
virtual void new_eq_eh(theory_var v1, theory_var v2);
|
||||
virtual void new_diseq_eh(theory_var v1, theory_var v2);
|
||||
virtual void relevant_eh(app * n);
|
||||
virtual void push_scope_eh();
|
||||
virtual void pop_scope_eh(unsigned num_scopes);
|
||||
virtual final_check_status final_check_eh();
|
||||
virtual void reset_eh();
|
||||
virtual void init_search_eh() { m_final_check_idx = 0; }
|
||||
void init(context * ctx) override;
|
||||
theory_var mk_var(enode * n) override;
|
||||
bool internalize_atom(app * atom, bool gate_ctx) override;
|
||||
bool internalize_term(app * term) override;
|
||||
void apply_sort_cnstr(enode * n, sort * s) override;
|
||||
void new_eq_eh(theory_var v1, theory_var v2) override;
|
||||
void new_diseq_eh(theory_var v1, theory_var v2) override;
|
||||
void relevant_eh(app * n) override;
|
||||
void push_scope_eh() override;
|
||||
void pop_scope_eh(unsigned num_scopes) override;
|
||||
final_check_status final_check_eh() override;
|
||||
void reset_eh() override;
|
||||
void init_search_eh() override { m_final_check_idx = 0; }
|
||||
|
||||
virtual void set_prop_upward(theory_var v);
|
||||
virtual void set_prop_upward(enode* n);
|
||||
|
@ -96,15 +96,15 @@ namespace smt {
|
|||
static void display_ids(std::ostream & out, unsigned n, enode * const * v);
|
||||
public:
|
||||
theory_array(ast_manager & m, theory_array_params & params);
|
||||
virtual ~theory_array();
|
||||
~theory_array() override;
|
||||
|
||||
virtual theory * mk_fresh(context * new_ctx) { return alloc(theory_array, new_ctx->get_manager(), new_ctx->get_fparams()); }
|
||||
theory * mk_fresh(context * new_ctx) override { return alloc(theory_array, new_ctx->get_manager(), new_ctx->get_fparams()); }
|
||||
|
||||
virtual char const * get_name() const { return "array"; }
|
||||
char const * get_name() const override { return "array"; }
|
||||
|
||||
virtual void display_var(std::ostream & out, theory_var v) const;
|
||||
virtual void display(std::ostream & out) const;
|
||||
virtual void collect_statistics(::statistics & st) const;
|
||||
void display(std::ostream & out) const override;
|
||||
void collect_statistics(::statistics & st) const override;
|
||||
th_trail_stack & get_trail_stack() { return m_trail_stack; }
|
||||
virtual void merge_eh(theory_var v1, theory_var v2, theory_var, theory_var);
|
||||
static void after_merge_eh(theory_var r1, theory_var r2, theory_var v1, theory_var v2) {}
|
||||
|
|
|
@ -41,7 +41,7 @@ namespace smt {
|
|||
}
|
||||
|
||||
app * theory_array_base::mk_select(unsigned num_args, expr * const * args) {
|
||||
app * r = get_manager().mk_app(get_family_id(), OP_SELECT, 0, 0, num_args, args);
|
||||
app * r = get_manager().mk_app(get_family_id(), OP_SELECT, 0, nullptr, num_args, args);
|
||||
TRACE("mk_var_bug", tout << "mk_select: " << r->get_id() << " num_args: " << num_args;
|
||||
for (unsigned i = 0; i < num_args; i++) tout << " " << args[i]->get_id();
|
||||
tout << "\n";);
|
||||
|
@ -49,7 +49,7 @@ namespace smt {
|
|||
}
|
||||
|
||||
app * theory_array_base::mk_store(unsigned num_args, expr * const * args) {
|
||||
return get_manager().mk_app(get_family_id(), OP_STORE, 0, 0, num_args, args);
|
||||
return get_manager().mk_app(get_family_id(), OP_STORE, 0, nullptr, num_args, args);
|
||||
}
|
||||
|
||||
app * theory_array_base::mk_default(expr * a) {
|
||||
|
@ -152,7 +152,7 @@ namespace smt {
|
|||
expr_ref sel1(m), sel2(m);
|
||||
bool init = false;
|
||||
literal conseq = null_literal;
|
||||
expr * conseq_expr = 0;
|
||||
expr * conseq_expr = nullptr;
|
||||
|
||||
for (unsigned i = 0; i < num_args; i++) {
|
||||
enode * idx1 = js[i];
|
||||
|
@ -212,7 +212,7 @@ namespace smt {
|
|||
|
||||
func_decl_ref_vector * theory_array_base::register_sort(sort * s_array) {
|
||||
unsigned dimension = get_dimension(s_array);
|
||||
func_decl_ref_vector * ext_skolems = 0;
|
||||
func_decl_ref_vector * ext_skolems = nullptr;
|
||||
if (!m_sort2skolem.find(s_array, ext_skolems)) {
|
||||
array_util util(get_manager());
|
||||
ast_manager & m = get_manager();
|
||||
|
@ -305,7 +305,7 @@ namespace smt {
|
|||
context & ctx = get_context();
|
||||
ast_manager & m = get_manager();
|
||||
|
||||
func_decl_ref_vector * funcs = 0;
|
||||
func_decl_ref_vector * funcs = nullptr;
|
||||
sort * s = m.get_sort(e1);
|
||||
|
||||
VERIFY(m_sort2skolem.find(s, funcs));
|
||||
|
@ -495,7 +495,7 @@ namespace smt {
|
|||
void theory_array_base::restore_sorts(unsigned old_size) {
|
||||
while (m_sorts_trail.size() > old_size) {
|
||||
sort * s = m_sorts_trail.back();
|
||||
func_decl_ref_vector * funcs = 0;
|
||||
func_decl_ref_vector * funcs = nullptr;
|
||||
if (m_sort2skolem.find(s, funcs)) {
|
||||
m_sort2skolem.remove(s);
|
||||
dealloc(funcs);
|
||||
|
@ -672,9 +672,9 @@ namespace smt {
|
|||
|
||||
theory_array_base::select_set * theory_array_base::get_select_set(enode * n) {
|
||||
enode * r = n->get_root();
|
||||
select_set * set = 0;
|
||||
select_set * set = nullptr;
|
||||
m_selects.find(r, set);
|
||||
if (set == 0) {
|
||||
if (set == nullptr) {
|
||||
set = alloc(select_set);
|
||||
m_selects.insert(r, set);
|
||||
m_selects_domain.push_back(r);
|
||||
|
@ -795,7 +795,7 @@ namespace smt {
|
|||
m_sort(s),
|
||||
m_num_entries(0),
|
||||
m_dim(0),
|
||||
m_else(0),
|
||||
m_else(nullptr),
|
||||
m_unspecified_else(false) {
|
||||
m_dependencies.push_back(model_value_dependency(v));
|
||||
}
|
||||
|
@ -814,7 +814,7 @@ namespace smt {
|
|||
m_sort(s),
|
||||
m_num_entries(0),
|
||||
m_dim(0),
|
||||
m_else(0),
|
||||
m_else(nullptr),
|
||||
m_unspecified_else(false) {
|
||||
m_dependencies.push_back(model_value_dependency(else_value));
|
||||
}
|
||||
|
@ -824,11 +824,11 @@ namespace smt {
|
|||
m_sort(s),
|
||||
m_num_entries(0),
|
||||
m_dim(0),
|
||||
m_else(0),
|
||||
m_else(nullptr),
|
||||
m_unspecified_else(true) {
|
||||
}
|
||||
|
||||
virtual ~array_value_proc() {}
|
||||
~array_value_proc() override {}
|
||||
|
||||
void add_entry(unsigned num_args, enode * const * args, enode * value) {
|
||||
SASSERT(num_args > 0);
|
||||
|
@ -840,11 +840,11 @@ namespace smt {
|
|||
m_dependencies.push_back(model_value_dependency(value));
|
||||
}
|
||||
|
||||
virtual void get_dependencies(buffer<model_value_dependency> & result) {
|
||||
void get_dependencies(buffer<model_value_dependency> & result) override {
|
||||
result.append(m_dependencies.size(), m_dependencies.c_ptr());
|
||||
}
|
||||
|
||||
virtual app * mk_value(model_generator & mg, ptr_vector<expr> & values) {
|
||||
app * mk_value(model_generator & mg, ptr_vector<expr> & values) override {
|
||||
// values must have size = m_num_entries * (m_dim + 1) + ((m_else || m_unspecified_else) ? 0 : 1)
|
||||
// an array value is a lookup table + else_value
|
||||
// each entry has m_dim indexes that map to a value.
|
||||
|
@ -888,14 +888,14 @@ namespace smt {
|
|||
SASSERT(v != null_theory_var);
|
||||
sort * s = get_manager().get_sort(n->get_owner());
|
||||
enode * else_val_n = get_default(v);
|
||||
array_value_proc * result = 0;
|
||||
array_value_proc * result = nullptr;
|
||||
|
||||
if (m_use_unspecified_default) {
|
||||
SASSERT(else_val_n == 0);
|
||||
result = alloc(array_value_proc, get_id(), s);
|
||||
}
|
||||
else {
|
||||
if (else_val_n != 0) {
|
||||
if (else_val_n != nullptr) {
|
||||
SASSERT(get_context().is_relevant(else_val_n));
|
||||
result = alloc(array_value_proc, get_id(), s, else_val_n);
|
||||
}
|
||||
|
@ -905,7 +905,7 @@ namespace smt {
|
|||
// DISABLED. It seems wrong, since different nodes can share the same
|
||||
// else_val according to the mg class.
|
||||
// SASSERT(else_val == 0 || get_context().is_relevant(UNTAG(app*, else_val)));
|
||||
if (else_val == 0) {
|
||||
if (else_val == nullptr) {
|
||||
sort * range = to_sort(s->get_parameter(s->get_num_parameters() - 1).get_ast());
|
||||
// IMPORTANT:
|
||||
// The implementation should not assume a fresh value is created for
|
||||
|
@ -925,9 +925,9 @@ namespace smt {
|
|||
}
|
||||
}
|
||||
SASSERT(result != 0);
|
||||
select_set * sel_set = 0;
|
||||
select_set * sel_set = nullptr;
|
||||
m_selects.find(n->get_root(), sel_set);
|
||||
if (sel_set != 0) {
|
||||
if (sel_set != nullptr) {
|
||||
ptr_buffer<enode> args;
|
||||
select_set::iterator it = sel_set->begin();
|
||||
select_set::iterator end = sel_set->end();
|
||||
|
|
|
@ -123,15 +123,15 @@ namespace smt {
|
|||
//
|
||||
//
|
||||
// --------------------------------------------------
|
||||
virtual bool is_shared(theory_var v) const;
|
||||
bool is_shared(theory_var v) const override;
|
||||
void collect_shared_vars(sbuffer<theory_var> & result);
|
||||
unsigned mk_interface_eqs();
|
||||
|
||||
virtual bool can_propagate();
|
||||
virtual void propagate();
|
||||
virtual void push_scope_eh();
|
||||
virtual void pop_scope_eh(unsigned num_scopes);
|
||||
virtual void reset_eh();
|
||||
bool can_propagate() override;
|
||||
void propagate() override;
|
||||
void push_scope_eh() override;
|
||||
void pop_scope_eh(unsigned num_scopes) override;
|
||||
void reset_eh() override;
|
||||
|
||||
void reset_queues();
|
||||
// -----------------------------------
|
||||
|
@ -177,7 +177,7 @@ namespace smt {
|
|||
void set_default(theory_var v, enode* n);
|
||||
enode* get_default(theory_var v);
|
||||
|
||||
virtual void init_model(model_generator & m);
|
||||
void init_model(model_generator & m) override;
|
||||
bool is_unspecified_default_ok() const;
|
||||
void collect_defaults();
|
||||
void collect_selects();
|
||||
|
@ -185,12 +185,12 @@ namespace smt {
|
|||
void propagate_selects_to_store_parents(enode * r, enode_pair_vector & todo);
|
||||
void propagate_selects();
|
||||
select_set * get_select_set(enode * n);
|
||||
virtual void finalize_model(model_generator & m);
|
||||
virtual model_value_proc * mk_value(enode * n, model_generator & m);
|
||||
void finalize_model(model_generator & m) override;
|
||||
model_value_proc * mk_value(enode * n, model_generator & m) override;
|
||||
|
||||
public:
|
||||
theory_array_base(ast_manager & m);
|
||||
virtual ~theory_array_base() { restore_sorts(0); }
|
||||
~theory_array_base() override { restore_sorts(0); }
|
||||
};
|
||||
|
||||
};
|
||||
|
|
|
@ -746,7 +746,7 @@ namespace smt {
|
|||
}
|
||||
|
||||
app* theory_array_full::mk_epsilon(sort* s) {
|
||||
app* eps = 0;
|
||||
app* eps = nullptr;
|
||||
if (m_sort2epsilon.find(s, eps)) {
|
||||
return eps;
|
||||
}
|
||||
|
|
|
@ -42,29 +42,29 @@ namespace smt {
|
|||
protected:
|
||||
|
||||
//virtual final_check_status final_check_eh();
|
||||
virtual void reset_eh();
|
||||
void reset_eh() override;
|
||||
|
||||
virtual void set_prop_upward(theory_var v);
|
||||
virtual void set_prop_upward(enode* n);
|
||||
virtual void set_prop_upward(theory_var v, var_data* d);
|
||||
virtual unsigned get_lambda_equiv_size(theory_var v, var_data* d);
|
||||
void set_prop_upward(theory_var v) override;
|
||||
void set_prop_upward(enode* n) override;
|
||||
void set_prop_upward(theory_var v, var_data* d) override;
|
||||
unsigned get_lambda_equiv_size(theory_var v, var_data* d) override;
|
||||
|
||||
|
||||
virtual bool internalize_term(app * term);
|
||||
virtual bool internalize_atom(app * atom, bool gate_ctx);
|
||||
virtual void pop_scope_eh(unsigned num_scopes);
|
||||
virtual theory_var mk_var(enode * n);
|
||||
virtual void relevant_eh(app * n);
|
||||
bool internalize_term(app * term) override;
|
||||
bool internalize_atom(app * atom, bool gate_ctx) override;
|
||||
void pop_scope_eh(unsigned num_scopes) override;
|
||||
theory_var mk_var(enode * n) override;
|
||||
void relevant_eh(app * n) override;
|
||||
|
||||
void add_const(theory_var v, enode* c);
|
||||
void add_map(theory_var v, enode* s);
|
||||
void add_parent_map(theory_var v, enode* s);
|
||||
void add_as_array(theory_var v, enode* arr);
|
||||
|
||||
virtual void add_parent_select(theory_var v, enode * s);
|
||||
void add_parent_select(theory_var v, enode * s) override;
|
||||
void add_parent_default(theory_var v);
|
||||
|
||||
virtual final_check_status assert_delayed_axioms();
|
||||
final_check_status assert_delayed_axioms() override;
|
||||
|
||||
bool instantiate_default_const_axiom(enode* cnst);
|
||||
bool instantiate_default_store_axiom(enode* store);
|
||||
|
@ -87,14 +87,14 @@ namespace smt {
|
|||
|
||||
public:
|
||||
theory_array_full(ast_manager & m, theory_array_params & params);
|
||||
virtual ~theory_array_full();
|
||||
~theory_array_full() override;
|
||||
|
||||
virtual theory * mk_fresh(context * new_ctx);
|
||||
theory * mk_fresh(context * new_ctx) override;
|
||||
|
||||
virtual void merge_eh(theory_var v1, theory_var v2, theory_var, theory_var);
|
||||
virtual void display_var(std::ostream & out, theory_var v) const;
|
||||
virtual void collect_statistics(::statistics & st) const;
|
||||
virtual void init(context* ctx) {
|
||||
void merge_eh(theory_var v1, theory_var v2, theory_var, theory_var) override;
|
||||
void display_var(std::ostream & out, theory_var v) const override;
|
||||
void collect_statistics(::statistics & st) const override;
|
||||
void init(context* ctx) override {
|
||||
// the parent class is theory_array.
|
||||
// theory::init(ctx);
|
||||
theory_array::init(ctx);
|
||||
|
|
|
@ -65,7 +65,7 @@ namespace smt {
|
|||
bool_var m_var;
|
||||
public:
|
||||
mk_atom_trail(bool_var v):m_var(v) {}
|
||||
virtual void undo(theory_bv & th) {
|
||||
void undo(theory_bv & th) override {
|
||||
theory_bv::atom * a = th.get_bv2a(m_var);
|
||||
a->~atom();
|
||||
th.erase_bv2a(m_var);
|
||||
|
@ -213,7 +213,7 @@ namespace smt {
|
|||
theory_bv::bit_atom * m_atom;
|
||||
public:
|
||||
add_var_pos_trail(theory_bv::bit_atom * a):m_atom(a) {}
|
||||
virtual void undo(theory_bv & th) {
|
||||
void undo(theory_bv & th) override {
|
||||
SASSERT(m_atom->m_occs);
|
||||
m_atom->m_occs = m_atom->m_occs->m_next;
|
||||
}
|
||||
|
@ -373,7 +373,7 @@ namespace smt {
|
|||
void get_proof(conflict_resolution & cr, literal l, ptr_buffer<proof> & prs, bool & visited) {
|
||||
if (l.var() == true_bool_var)
|
||||
return;
|
||||
proof * pr = 0;
|
||||
proof * pr = nullptr;
|
||||
if (cr.get_context().get_assignment(l) == l_true)
|
||||
pr = cr.get_proof(l);
|
||||
else
|
||||
|
@ -389,12 +389,12 @@ namespace smt {
|
|||
m_th(th), m_var1(v1), m_var2(v2) {
|
||||
}
|
||||
|
||||
virtual void get_antecedents(conflict_resolution & cr) {
|
||||
void get_antecedents(conflict_resolution & cr) override {
|
||||
mark_bits(cr, m_th.m_bits[m_var1]);
|
||||
mark_bits(cr, m_th.m_bits[m_var2]);
|
||||
}
|
||||
|
||||
virtual proof * mk_proof(conflict_resolution & cr) {
|
||||
proof * mk_proof(conflict_resolution & cr) override {
|
||||
ptr_buffer<proof> prs;
|
||||
context & ctx = cr.get_context();
|
||||
bool visited = true;
|
||||
|
@ -408,17 +408,17 @@ namespace smt {
|
|||
get_proof(cr, *it2, prs, visited);
|
||||
}
|
||||
if (!visited)
|
||||
return 0;
|
||||
return nullptr;
|
||||
expr * fact = ctx.mk_eq_atom(m_th.get_enode(m_var1)->get_owner(), m_th.get_enode(m_var2)->get_owner());
|
||||
ast_manager & m = ctx.get_manager();
|
||||
return m.mk_th_lemma(get_from_theory(), fact, prs.size(), prs.c_ptr());
|
||||
}
|
||||
|
||||
virtual theory_id get_from_theory() const {
|
||||
theory_id get_from_theory() const override {
|
||||
return m_th.get_id();
|
||||
}
|
||||
|
||||
virtual char const * get_name() const { return "bv-fixed-eq"; }
|
||||
char const * get_name() const override { return "bv-fixed-eq"; }
|
||||
|
||||
};
|
||||
|
||||
|
@ -1510,13 +1510,13 @@ namespace smt {
|
|||
bit_eq_justification(theory_id th_id, enode * v1, enode * v2, literal c, literal a):
|
||||
m_v1(v1), m_v2(v2), m_th_id(th_id), m_consequent(c), m_antecedent(a) {}
|
||||
|
||||
virtual void get_antecedents(conflict_resolution & cr) {
|
||||
void get_antecedents(conflict_resolution & cr) override {
|
||||
cr.mark_eq(m_v1, m_v2);
|
||||
if (m_antecedent.var() != true_bool_var)
|
||||
cr.mark_literal(m_antecedent);
|
||||
}
|
||||
|
||||
virtual proof * mk_proof(conflict_resolution & cr) {
|
||||
proof * mk_proof(conflict_resolution & cr) override {
|
||||
bool visited = true;
|
||||
ptr_buffer<proof> prs;
|
||||
proof * pr = cr.get_proof(m_v1, m_v2);
|
||||
|
@ -1532,7 +1532,7 @@ namespace smt {
|
|||
visited = false;
|
||||
}
|
||||
if (!visited)
|
||||
return 0;
|
||||
return nullptr;
|
||||
context & ctx = cr.get_context();
|
||||
ast_manager & m = cr.get_manager();
|
||||
expr_ref fact(m);
|
||||
|
@ -1540,11 +1540,11 @@ namespace smt {
|
|||
return m.mk_th_lemma(get_from_theory(), fact, prs.size(), prs.c_ptr());
|
||||
}
|
||||
|
||||
virtual theory_id get_from_theory() const {
|
||||
theory_id get_from_theory() const override {
|
||||
return m_th_id;
|
||||
}
|
||||
|
||||
virtual char const * get_name() const { return "bv-bit-eq"; }
|
||||
char const * get_name() const override { return "bv-bit-eq"; }
|
||||
};
|
||||
|
||||
inline justification * theory_bv::mk_bit_eq_justification(theory_var v1, theory_var v2, literal consequent, literal antecedent) {
|
||||
|
|
|
@ -52,22 +52,22 @@ namespace smt {
|
|||
theory_var m_var;
|
||||
unsigned m_idx;
|
||||
var_pos_occ * m_next;
|
||||
var_pos_occ(theory_var v = null_theory_var, unsigned idx = 0, var_pos_occ * next = 0):m_var(v), m_idx(idx), m_next(next) {}
|
||||
var_pos_occ(theory_var v = null_theory_var, unsigned idx = 0, var_pos_occ * next = nullptr):m_var(v), m_idx(idx), m_next(next) {}
|
||||
};
|
||||
|
||||
struct bit_atom : public atom {
|
||||
var_pos_occ * m_occs;
|
||||
bit_atom():m_occs(0) {}
|
||||
virtual ~bit_atom() {}
|
||||
virtual bool is_bit() const { return true; }
|
||||
bit_atom():m_occs(nullptr) {}
|
||||
~bit_atom() override {}
|
||||
bool is_bit() const override { return true; }
|
||||
};
|
||||
|
||||
struct le_atom : public atom {
|
||||
literal m_var;
|
||||
literal m_def;
|
||||
le_atom(literal v, literal d):m_var(v), m_def(d) {}
|
||||
virtual ~le_atom() {}
|
||||
virtual bool is_bit() const { return false; }
|
||||
~le_atom() override {}
|
||||
bool is_bit() const override { return false; }
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -216,21 +216,21 @@ namespace smt {
|
|||
void assert_bv2int_axiom(app* n);
|
||||
|
||||
protected:
|
||||
virtual void init(context * ctx);
|
||||
virtual theory_var mk_var(enode * n);
|
||||
virtual bool internalize_atom(app * atom, bool gate_ctx);
|
||||
virtual bool internalize_term(app * term);
|
||||
virtual void apply_sort_cnstr(enode * n, sort * s);
|
||||
virtual void new_eq_eh(theory_var v1, theory_var v2);
|
||||
virtual void new_diseq_eh(theory_var v1, theory_var v2);
|
||||
void init(context * ctx) override;
|
||||
theory_var mk_var(enode * n) override;
|
||||
bool internalize_atom(app * atom, bool gate_ctx) override;
|
||||
bool internalize_term(app * term) override;
|
||||
void apply_sort_cnstr(enode * n, sort * s) override;
|
||||
void new_eq_eh(theory_var v1, theory_var v2) override;
|
||||
void new_diseq_eh(theory_var v1, theory_var v2) override;
|
||||
virtual void expand_diseq(theory_var v1, theory_var v2);
|
||||
virtual void assign_eh(bool_var v, bool is_true);
|
||||
virtual void relevant_eh(app * n);
|
||||
virtual void push_scope_eh();
|
||||
virtual void pop_scope_eh(unsigned num_scopes);
|
||||
virtual final_check_status final_check_eh();
|
||||
virtual void reset_eh();
|
||||
virtual bool include_func_interp(func_decl* f);
|
||||
void assign_eh(bool_var v, bool is_true) override;
|
||||
void relevant_eh(app * n) override;
|
||||
void push_scope_eh() override;
|
||||
void pop_scope_eh(unsigned num_scopes) override;
|
||||
final_check_status final_check_eh() override;
|
||||
void reset_eh() override;
|
||||
bool include_func_interp(func_decl* f) override;
|
||||
svector<theory_var> m_merge_aux[2]; //!< auxiliary vector used in merge_zero_one_bits
|
||||
bool merge_zero_one_bits(theory_var r1, theory_var r2);
|
||||
|
||||
|
@ -240,16 +240,16 @@ namespace smt {
|
|||
//
|
||||
// -----------------------------------
|
||||
bv_factory * m_factory;
|
||||
virtual void init_model(model_generator & m);
|
||||
virtual model_value_proc * mk_value(enode * n, model_generator & mg);
|
||||
void init_model(model_generator & m) override;
|
||||
model_value_proc * mk_value(enode * n, model_generator & mg) override;
|
||||
|
||||
public:
|
||||
theory_bv(ast_manager & m, theory_bv_params const & params, bit_blaster_params const & bb_params);
|
||||
virtual ~theory_bv();
|
||||
~theory_bv() override;
|
||||
|
||||
virtual theory * mk_fresh(context * new_ctx);
|
||||
theory * mk_fresh(context * new_ctx) override;
|
||||
|
||||
virtual char const * get_name() const { return "bit-vector"; }
|
||||
char const * get_name() const override { return "bit-vector"; }
|
||||
|
||||
th_trail_stack & get_trail_stack() { return m_trail_stack; }
|
||||
void merge_eh(theory_var, theory_var, theory_var v1, theory_var v2);
|
||||
|
@ -259,8 +259,8 @@ namespace smt {
|
|||
void display_var(std::ostream & out, theory_var v) const;
|
||||
void display_bit_atom(std::ostream & out, bool_var v, bit_atom const * a) const;
|
||||
void display_atoms(std::ostream & out) const;
|
||||
virtual void display(std::ostream & out) const;
|
||||
virtual void collect_statistics(::statistics & st) const;
|
||||
void display(std::ostream & out) const override;
|
||||
void collect_statistics(::statistics & st) const override;
|
||||
|
||||
bool get_fixed_value(app* x, numeral & result) const;
|
||||
|
||||
|
|
|
@ -30,12 +30,47 @@ namespace smt {
|
|||
class dt_eq_justification : public ext_theory_eq_propagation_justification {
|
||||
public:
|
||||
dt_eq_justification(family_id fid, region & r, literal antecedent, enode * lhs, enode * rhs):
|
||||
ext_theory_eq_propagation_justification(fid, r, 1, &antecedent, 0, 0, lhs, rhs) {
|
||||
ext_theory_eq_propagation_justification(fid, r, 1, &antecedent, 0, nullptr, lhs, rhs) {
|
||||
}
|
||||
// Remark: the assignment must be propagated back to the datatype theory.
|
||||
virtual theory_id get_from_theory() const { return null_theory_id; }
|
||||
theory_id get_from_theory() const override { return null_theory_id; }
|
||||
};
|
||||
|
||||
theory_datatype::final_check_st::final_check_st(theory_datatype * th) : th(th) {
|
||||
SASSERT(th->m_to_unmark.empty());
|
||||
SASSERT(th->m_to_unmark2.empty());
|
||||
th->m_used_eqs.reset();
|
||||
th->m_stack.reset();
|
||||
th->m_parent.reset();
|
||||
}
|
||||
|
||||
theory_datatype::final_check_st::~final_check_st() {
|
||||
unmark_enodes(th->m_to_unmark.size(), th->m_to_unmark.c_ptr());
|
||||
unmark_enodes2(th->m_to_unmark2.size(), th->m_to_unmark2.c_ptr());
|
||||
th->m_to_unmark.reset();
|
||||
th->m_to_unmark2.reset();
|
||||
th->m_used_eqs.reset();
|
||||
th->m_stack.reset();
|
||||
th->m_parent.reset();
|
||||
}
|
||||
|
||||
void theory_datatype::oc_mark_on_stack(enode * n) {
|
||||
n = n->get_root();
|
||||
n->set_mark();
|
||||
m_to_unmark.push_back(n);
|
||||
}
|
||||
|
||||
void theory_datatype::oc_mark_cycle_free(enode * n) {
|
||||
n = n->get_root();
|
||||
n->set_mark2();
|
||||
m_to_unmark2.push_back(n);
|
||||
}
|
||||
|
||||
void theory_datatype::oc_push_stack(enode * n) {
|
||||
m_stack.push_back(std::make_pair(EXIT, n));
|
||||
m_stack.push_back(std::make_pair(ENTER, n));
|
||||
}
|
||||
|
||||
|
||||
theory* theory_datatype::mk_fresh(context* new_ctx) {
|
||||
return alloc(theory_datatype, new_ctx->get_manager(), m_params);
|
||||
|
@ -167,7 +202,7 @@ namespace smt {
|
|||
func_decl * upd = n->get_decl();
|
||||
func_decl * acc = to_func_decl(upd->get_parameter(0).get_ast());
|
||||
func_decl * con = m_util.get_accessor_constructor(acc);
|
||||
func_decl * rec = m_util.get_constructor_recognizer(con);
|
||||
func_decl * rec = m_util.get_constructor_is(con);
|
||||
ptr_vector<func_decl> const & accessors = *m_util.get_constructor_accessors(con);
|
||||
app_ref rec_app(m.mk_app(rec, arg1), m);
|
||||
ctx.internalize(rec_app, false);
|
||||
|
@ -340,12 +375,12 @@ namespace smt {
|
|||
func_decl * c = m_util.get_recognizer_constructor(r);
|
||||
if (is_true) {
|
||||
SASSERT(tv != null_theory_var);
|
||||
if (d->m_constructor != 0 && d->m_constructor->get_decl() == c)
|
||||
if (d->m_constructor != nullptr && d->m_constructor->get_decl() == c)
|
||||
return; // do nothing
|
||||
assert_is_constructor_axiom(arg, c, literal(v));
|
||||
}
|
||||
else {
|
||||
if (d->m_constructor != 0) {
|
||||
if (d->m_constructor != nullptr) {
|
||||
if (d->m_constructor->get_decl() == c) {
|
||||
// conflict
|
||||
sign_recognizer_conflict(d->m_constructor, n);
|
||||
|
@ -389,10 +424,11 @@ namespace smt {
|
|||
final_check_status theory_datatype::final_check_eh() {
|
||||
int num_vars = get_num_vars();
|
||||
final_check_status r = FC_DONE;
|
||||
final_check_st _guard(this); // RAII for managing state
|
||||
for (int v = 0; v < num_vars; v++) {
|
||||
if (v == static_cast<int>(m_find.find(v))) {
|
||||
enode * node = get_enode(v);
|
||||
if (occurs_check(node)) {
|
||||
if (!oc_cycle_free(node) && occurs_check(node)) {
|
||||
// conflict was detected...
|
||||
// return...
|
||||
return FC_CONTINUE;
|
||||
|
@ -400,7 +436,7 @@ namespace smt {
|
|||
if (m_params.m_dt_lazy_splits > 0) {
|
||||
// using lazy case splits...
|
||||
var_data * d = m_var_data[v];
|
||||
if (d->m_constructor == 0) {
|
||||
if (d->m_constructor == nullptr) {
|
||||
mk_split(v);
|
||||
r = FC_CONTINUE;
|
||||
}
|
||||
|
@ -410,6 +446,73 @@ namespace smt {
|
|||
return r;
|
||||
}
|
||||
|
||||
// Assuming `app` is equal to a constructor term, return the constructor enode
|
||||
inline enode * theory_datatype::oc_get_cstor(enode * app) {
|
||||
theory_var v = app->get_root()->get_th_var(get_id());
|
||||
SASSERT(v != null_theory_var);
|
||||
v = m_find.find(v);
|
||||
var_data * d = m_var_data[v];
|
||||
SASSERT(d->m_constructor);
|
||||
return d->m_constructor;
|
||||
}
|
||||
|
||||
// explain the cycle root -> ... -> app -> root
|
||||
void theory_datatype::occurs_check_explain(enode * app, enode * root) {
|
||||
TRACE("datatype", tout << "occurs_check_explain " << mk_bounded_pp(app->get_owner(), get_manager()) << " <-> " << mk_bounded_pp(root->get_owner(), get_manager()) << "\n";);
|
||||
enode* app_parent = nullptr;
|
||||
|
||||
// first: explain that root=v, given that app=cstor(...,v,...)
|
||||
for (enode * arg : enode::args(oc_get_cstor(app))) {
|
||||
// found an argument which is equal to root
|
||||
if (arg->get_root() == root->get_root()) {
|
||||
if (arg != root)
|
||||
m_used_eqs.push_back(enode_pair(arg, root));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// now explain app=cstor(..,v,..) where v=root, and recurse with parent of app
|
||||
while (app->get_root() != root->get_root()) {
|
||||
enode * app_cstor = oc_get_cstor(app);
|
||||
if (app != app_cstor)
|
||||
m_used_eqs.push_back(enode_pair(app, app_cstor));
|
||||
app_parent = m_parent[app->get_root()];
|
||||
app = app_parent;
|
||||
}
|
||||
|
||||
SASSERT(app->get_root() == root->get_root());
|
||||
if (app != root)
|
||||
m_used_eqs.push_back(enode_pair(app, root));
|
||||
}
|
||||
|
||||
// start exploring subgraph below `app`
|
||||
bool theory_datatype::occurs_check_enter(enode * app) {
|
||||
oc_mark_on_stack(app);
|
||||
theory_var v = app->get_root()->get_th_var(get_id());
|
||||
if (v != null_theory_var) {
|
||||
v = m_find.find(v);
|
||||
var_data * d = m_var_data[v];
|
||||
if (d->m_constructor) {
|
||||
for (enode * arg : enode::args(d->m_constructor)) {
|
||||
if (oc_cycle_free(arg)) {
|
||||
continue;
|
||||
}
|
||||
if (oc_on_stack(arg)) {
|
||||
// arg was explored before app, and is still on the stack: cycle
|
||||
occurs_check_explain(app, arg);
|
||||
return true;
|
||||
}
|
||||
// explore `arg` (with parent `app`)
|
||||
if (m_util.is_datatype(get_manager().get_sort(arg->get_owner()))) {
|
||||
m_parent.insert(arg->get_root(), app);
|
||||
oc_push_stack(arg);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
\brief Check if n can be reached starting from n and following equalities and constructors.
|
||||
For example, occur_check(a1) returns true in the following set of equalities:
|
||||
|
@ -418,17 +521,39 @@ namespace smt {
|
|||
a3 = cons(v3, a1)
|
||||
*/
|
||||
bool theory_datatype::occurs_check(enode * n) {
|
||||
TRACE("datatype", tout << "occurs check: #" << n->get_owner_id() << "\n";);
|
||||
m_to_unmark.reset();
|
||||
m_used_eqs.reset();
|
||||
m_main = n;
|
||||
bool res = occurs_check_core(m_main);
|
||||
unmark_enodes(m_to_unmark.size(), m_to_unmark.c_ptr());
|
||||
TRACE("datatype", tout << "occurs check: #" << n->get_owner_id() << " " << mk_bounded_pp(n->get_owner(), get_manager()) << "\n";);
|
||||
m_stats.m_occurs_check++;
|
||||
|
||||
bool res = false;
|
||||
oc_push_stack(n);
|
||||
|
||||
// DFS traversal from `n`. Look at top element and explore it.
|
||||
while (!res && !m_stack.empty()) {
|
||||
stack_op op = m_stack.back().first;
|
||||
enode * app = m_stack.back().second;
|
||||
m_stack.pop_back();
|
||||
|
||||
if (oc_cycle_free(app)) continue;
|
||||
|
||||
TRACE("datatype", tout << "occurs check loop: #" << app->get_owner_id() << " " << mk_bounded_pp(app->get_owner(), get_manager()) << (op==ENTER?" enter":" exit")<< "\n";);
|
||||
|
||||
switch (op) {
|
||||
case ENTER:
|
||||
res = occurs_check_enter(app);
|
||||
break;
|
||||
|
||||
case EXIT:
|
||||
oc_mark_cycle_free(app);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (res) {
|
||||
// m_used_eqs should contain conflict
|
||||
context & ctx = get_context();
|
||||
region & r = ctx.get_region();
|
||||
ctx.set_conflict(ctx.mk_justification(ext_theory_conflict_justification(get_id(), r, 0, 0, m_used_eqs.size(), m_used_eqs.c_ptr())));
|
||||
TRACE("occurs_check",
|
||||
ctx.set_conflict(ctx.mk_justification(ext_theory_conflict_justification(get_id(), r, 0, nullptr, m_used_eqs.size(), m_used_eqs.c_ptr())));
|
||||
TRACE("datatype",
|
||||
tout << "occurs_check: true\n";
|
||||
for (enode_pair const& p : m_used_eqs) {
|
||||
tout << "eq: #" << p.first->get_owner_id() << " #" << p.second->get_owner_id() << "\n";
|
||||
|
@ -437,48 +562,6 @@ namespace smt {
|
|||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
\brief Auxiliary method for occurs_check.
|
||||
TODO: improve performance.
|
||||
*/
|
||||
bool theory_datatype::occurs_check_core(enode * app) {
|
||||
if (app->is_marked())
|
||||
return false;
|
||||
|
||||
m_stats.m_occurs_check++;
|
||||
app->set_mark();
|
||||
m_to_unmark.push_back(app);
|
||||
|
||||
TRACE("datatype", tout << "occurs check_core: #" << app->get_owner_id() << " #" << m_main->get_owner_id() << "\n";);
|
||||
|
||||
theory_var v = app->get_root()->get_th_var(get_id());
|
||||
if (v != null_theory_var) {
|
||||
v = m_find.find(v);
|
||||
var_data * d = m_var_data[v];
|
||||
if (d->m_constructor) {
|
||||
if (app != d->m_constructor)
|
||||
m_used_eqs.push_back(enode_pair(app, d->m_constructor));
|
||||
unsigned num_args = d->m_constructor->get_num_args();
|
||||
for (unsigned i = 0; i < num_args; i++) {
|
||||
enode * arg = d->m_constructor->get_arg(i);
|
||||
if (arg->get_root() == m_main->get_root()) {
|
||||
if (arg != m_main)
|
||||
m_used_eqs.push_back(enode_pair(arg, m_main));
|
||||
return true;
|
||||
}
|
||||
if (m_util.is_datatype(get_manager().get_sort(arg->get_owner())) && occurs_check_core(arg))
|
||||
return true;
|
||||
}
|
||||
if (app != d->m_constructor) {
|
||||
SASSERT(m_used_eqs.back().first == app);
|
||||
SASSERT(m_used_eqs.back().second == d->m_constructor);
|
||||
m_used_eqs.pop_back();
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void theory_datatype::reset_eh() {
|
||||
m_trail_stack.reset();
|
||||
|
@ -551,11 +634,11 @@ namespace smt {
|
|||
public:
|
||||
datatype_value_proc(func_decl * d):m_constructor(d) {}
|
||||
void add_dependency(enode * n) { m_dependencies.push_back(model_value_dependency(n)); }
|
||||
virtual ~datatype_value_proc() {}
|
||||
virtual void get_dependencies(buffer<model_value_dependency> & result) {
|
||||
~datatype_value_proc() override {}
|
||||
void get_dependencies(buffer<model_value_dependency> & result) override {
|
||||
result.append(m_dependencies.size(), m_dependencies.c_ptr());
|
||||
}
|
||||
virtual app * mk_value(model_generator & mg, ptr_vector<expr> & values) {
|
||||
app * mk_value(model_generator & mg, ptr_vector<expr> & values) override {
|
||||
SASSERT(values.size() == m_dependencies.size());
|
||||
return mg.get_manager().mk_app(m_constructor, values.size(), values.c_ptr());
|
||||
}
|
||||
|
@ -581,21 +664,21 @@ namespace smt {
|
|||
SASSERT(v1 == static_cast<int>(m_find.find(v1)));
|
||||
var_data * d1 = m_var_data[v1];
|
||||
var_data * d2 = m_var_data[v2];
|
||||
if (d2->m_constructor != 0) {
|
||||
if (d2->m_constructor != nullptr) {
|
||||
context & ctx = get_context();
|
||||
if (d1->m_constructor != 0 && d1->m_constructor->get_decl() != d2->m_constructor->get_decl()) {
|
||||
if (d1->m_constructor != nullptr && d1->m_constructor->get_decl() != d2->m_constructor->get_decl()) {
|
||||
region & r = ctx.get_region();
|
||||
enode_pair p(d1->m_constructor, d2->m_constructor);
|
||||
SASSERT(d1->m_constructor->get_root() == d2->m_constructor->get_root());
|
||||
ctx.set_conflict(ctx.mk_justification(ext_theory_conflict_justification(get_id(), r, 0, 0, 1, &p)));
|
||||
ctx.set_conflict(ctx.mk_justification(ext_theory_conflict_justification(get_id(), r, 0, nullptr, 1, &p)));
|
||||
}
|
||||
if (d1->m_constructor == 0) {
|
||||
if (d1->m_constructor == nullptr) {
|
||||
m_trail_stack.push(set_ptr_trail<theory_datatype, enode>(d1->m_constructor));
|
||||
// check whether there is a recognizer in d1 that conflicts with d2->m_constructor;
|
||||
if (!d1->m_recognizers.empty()) {
|
||||
unsigned c_idx = m_util.get_constructor_idx(d2->m_constructor->get_decl());
|
||||
enode * recognizer = d1->m_recognizers[c_idx];
|
||||
if (recognizer != 0 && ctx.get_assignment(recognizer) == l_false) {
|
||||
if (recognizer != nullptr && ctx.get_assignment(recognizer) == l_false) {
|
||||
sign_recognizer_conflict(d2->m_constructor, recognizer);
|
||||
return;
|
||||
}
|
||||
|
@ -634,7 +717,7 @@ namespace smt {
|
|||
// Otherwise, it will be set when assign_eh is invoked.
|
||||
return;
|
||||
}
|
||||
if (val == l_false && d->m_constructor != 0) {
|
||||
if (val == l_false && d->m_constructor != nullptr) {
|
||||
func_decl * c_decl = m_util.get_recognizer_constructor(recognizer->get_decl());
|
||||
if (d->m_constructor->get_decl() == c_decl) {
|
||||
// conflict
|
||||
|
@ -710,7 +793,7 @@ namespace smt {
|
|||
literal consequent;
|
||||
if (!r) {
|
||||
ptr_vector<func_decl> const & constructors = *m_util.get_datatype_constructors(dt);
|
||||
func_decl * rec = m_util.get_constructor_recognizer(constructors[unassigned_idx]);
|
||||
func_decl * rec = m_util.get_constructor_is(constructors[unassigned_idx]);
|
||||
app * rec_app = get_manager().mk_app(rec, n->get_owner());
|
||||
ctx.internalize(rec_app, false);
|
||||
consequent = literal(ctx.get_bool_var(rec_app));
|
||||
|
@ -747,16 +830,16 @@ namespace smt {
|
|||
unsigned non_rec_idx = m_util.get_constructor_idx(non_rec_c);
|
||||
var_data * d = m_var_data[v];
|
||||
SASSERT(d->m_constructor == 0);
|
||||
func_decl * r = 0;
|
||||
func_decl * r = nullptr;
|
||||
m_stats.m_splits++;
|
||||
|
||||
if (d->m_recognizers.empty()) {
|
||||
r = m_util.get_constructor_recognizer(non_rec_c);
|
||||
r = m_util.get_constructor_is(non_rec_c);
|
||||
}
|
||||
else {
|
||||
enode * recognizer = d->m_recognizers[non_rec_idx];
|
||||
if (recognizer == 0) {
|
||||
r = m_util.get_constructor_recognizer(non_rec_c);
|
||||
if (recognizer == nullptr) {
|
||||
r = m_util.get_constructor_is(non_rec_c);
|
||||
}
|
||||
else if (!ctx.is_relevant(recognizer)) {
|
||||
ctx.mark_as_relevant(recognizer);
|
||||
|
@ -773,10 +856,10 @@ namespace smt {
|
|||
ptr_vector<enode>::const_iterator end = d->m_recognizers.end();
|
||||
for (unsigned idx = 0; it != end; ++it, ++idx) {
|
||||
enode * curr = *it;
|
||||
if (curr == 0) {
|
||||
if (curr == nullptr) {
|
||||
ptr_vector<func_decl> const & constructors = *m_util.get_datatype_constructors(s);
|
||||
// found empty slot...
|
||||
r = m_util.get_constructor_recognizer(constructors[idx]);
|
||||
r = m_util.get_constructor_is(constructors[idx]);
|
||||
break;
|
||||
}
|
||||
else if (!ctx.is_relevant(curr)) {
|
||||
|
@ -787,7 +870,7 @@ namespace smt {
|
|||
return;
|
||||
}
|
||||
}
|
||||
if (r == 0)
|
||||
if (r == nullptr)
|
||||
return; // all recognizers are asserted to false... conflict will be detected...
|
||||
}
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue