mirror of
https://github.com/Z3Prover/z3
synced 2025-04-24 09:35:32 +00:00
merge with master
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
commit
c513f3ca09
883 changed files with 13979 additions and 16480 deletions
|
@ -30,13 +30,13 @@ class aig_lit {
|
|||
friend class aig_ref;
|
||||
aig * m_ref;
|
||||
public:
|
||||
aig_lit(aig * n = 0):m_ref(n) {}
|
||||
aig_lit(aig * n = nullptr):m_ref(n) {}
|
||||
aig_lit(aig_ref const & r):m_ref(static_cast<aig*>(r.m_ref)) {}
|
||||
bool is_inverted() const { return (reinterpret_cast<size_t>(m_ref) & static_cast<size_t>(1)) == static_cast<size_t>(1); }
|
||||
void invert() { m_ref = reinterpret_cast<aig*>(reinterpret_cast<size_t>(m_ref) ^ static_cast<size_t>(1)); }
|
||||
aig * ptr() const { return reinterpret_cast<aig*>(reinterpret_cast<size_t>(m_ref) & ~static_cast<size_t>(1)); }
|
||||
aig * ptr_non_inverted() const { SASSERT(!is_inverted()); return m_ref; }
|
||||
bool is_null() const { return m_ref == 0; }
|
||||
bool is_null() const { return m_ref == nullptr; }
|
||||
friend bool operator==(aig_lit const & r1, aig_lit const & r2) { return r1.m_ref == r2.m_ref; }
|
||||
friend bool operator!=(aig_lit const & r1, aig_lit const & r2) { return r1.m_ref != r2.m_ref; }
|
||||
aig_lit & operator=(aig_lit const & r) { m_ref = r.m_ref; return *this; }
|
||||
|
@ -151,7 +151,7 @@ struct aig_manager::imp {
|
|||
m_num_aigs--;
|
||||
if (is_var(n)) {
|
||||
m_var_id_gen.recycle(n->m_id);
|
||||
m_var2exprs.set(n->m_id, 0);
|
||||
m_var2exprs.set(n->m_id, nullptr);
|
||||
}
|
||||
else {
|
||||
m_table.erase(n);
|
||||
|
@ -267,7 +267,7 @@ struct aig_manager::imp {
|
|||
}
|
||||
if (b == r) {
|
||||
if (sign1) {
|
||||
// subsitution
|
||||
// substitution
|
||||
// not (a and b) and r --> (not a) and r IF b == r
|
||||
l = a;
|
||||
l.invert();
|
||||
|
@ -795,7 +795,7 @@ struct aig_manager::imp {
|
|||
m_cache.resize(idx+1);
|
||||
return false;
|
||||
}
|
||||
return m_cache.get(idx) != 0;
|
||||
return m_cache.get(idx) != nullptr;
|
||||
}
|
||||
|
||||
void cache_result(aig * n, expr * t) {
|
||||
|
@ -958,14 +958,14 @@ struct aig_manager::imp {
|
|||
}
|
||||
unsigned idx = to_idx(t);
|
||||
cache.reserve(idx+1);
|
||||
if (cache.get(idx) != 0) {
|
||||
if (cache.get(idx) != nullptr) {
|
||||
todo.pop_back();
|
||||
continue;
|
||||
}
|
||||
bool ok = true;
|
||||
for (unsigned i = 0; i < 2; i++) {
|
||||
aig * c = t->m_children[i].ptr();
|
||||
if (!is_var(c) && cache.get(to_idx(c), 0) == 0) {
|
||||
if (!is_var(c) && cache.get(to_idx(c), nullptr) == nullptr) {
|
||||
todo.push_back(c);
|
||||
ok = false;
|
||||
}
|
||||
|
@ -979,7 +979,7 @@ struct aig_manager::imp {
|
|||
if (is_var(c))
|
||||
args[i] = m.m_var2exprs.get(c->m_id);
|
||||
else
|
||||
args[i] = cache.get(to_idx(c), 0);
|
||||
args[i] = cache.get(to_idx(c), nullptr);
|
||||
if (!l.is_inverted())
|
||||
args[i] = invert(args[i]);
|
||||
}
|
||||
|
@ -1007,16 +1007,16 @@ struct aig_manager::imp {
|
|||
aig_lit n = roots.back();
|
||||
roots.pop_back();
|
||||
if (n.is_inverted()) {
|
||||
g.assert_expr(invert(process_root(n.ptr())), 0, 0);
|
||||
g.assert_expr(invert(process_root(n.ptr())), nullptr, nullptr);
|
||||
continue;
|
||||
}
|
||||
aig * p = n.ptr();
|
||||
if (m.is_ite(p)) {
|
||||
g.assert_expr(process_root(p), 0, 0);
|
||||
g.assert_expr(process_root(p), nullptr, nullptr);
|
||||
continue;
|
||||
}
|
||||
if (is_var(p)) {
|
||||
g.assert_expr(m.var2expr(p), 0, 0);
|
||||
g.assert_expr(m.var2expr(p), nullptr, nullptr);
|
||||
continue;
|
||||
}
|
||||
roots.push_back(left(p));
|
||||
|
@ -1079,7 +1079,7 @@ struct aig_manager::imp {
|
|||
|
||||
bool visit(aig * p) {
|
||||
if (is_var(p)) {
|
||||
push_result(0);
|
||||
push_result(nullptr);
|
||||
return true;
|
||||
}
|
||||
if (is_cached(p))
|
||||
|
@ -1652,8 +1652,8 @@ public:
|
|||
|
||||
|
||||
aig_ref::aig_ref():
|
||||
m_manager(0),
|
||||
m_ref(0) {
|
||||
m_manager(nullptr),
|
||||
m_ref(nullptr) {
|
||||
}
|
||||
|
||||
aig_ref::aig_ref(aig_manager & m, aig_lit const & l):
|
||||
|
@ -1663,15 +1663,15 @@ aig_ref::aig_ref(aig_manager & m, aig_lit const & l):
|
|||
}
|
||||
|
||||
aig_ref::~aig_ref() {
|
||||
if (m_ref != 0) {
|
||||
if (m_ref != nullptr) {
|
||||
m_manager->m_imp->dec_ref(aig_lit(*this));
|
||||
}
|
||||
}
|
||||
|
||||
aig_ref & aig_ref::operator=(aig_ref const & r) {
|
||||
if (r.m_ref != 0)
|
||||
if (r.m_ref != nullptr)
|
||||
r.m_manager->m_imp->inc_ref(aig_lit(r));
|
||||
if (m_ref != 0)
|
||||
if (m_ref != nullptr)
|
||||
m_manager->m_imp->dec_ref(aig_lit(*this));
|
||||
m_ref = r.m_ref;
|
||||
m_manager = r.m_manager;
|
||||
|
|
|
@ -37,16 +37,16 @@ class aig_tactic : public tactic {
|
|||
|
||||
~mk_aig_manager() {
|
||||
dealloc(m_owner.m_aig_manager);
|
||||
m_owner.m_aig_manager = 0;
|
||||
m_owner.m_aig_manager = nullptr;
|
||||
}
|
||||
};
|
||||
|
||||
public:
|
||||
aig_tactic(params_ref const & p = params_ref()):m_aig_manager(0) {
|
||||
aig_tactic(params_ref const & p = params_ref()):m_aig_manager(nullptr) {
|
||||
updt_params(p);
|
||||
}
|
||||
|
||||
virtual tactic * translate(ast_manager & m) {
|
||||
tactic * translate(ast_manager & m) override {
|
||||
aig_tactic * t = alloc(aig_tactic);
|
||||
t->m_max_memory = m_max_memory;
|
||||
t->m_aig_gate_encoding = m_aig_gate_encoding;
|
||||
|
@ -54,13 +54,13 @@ public:
|
|||
return t;
|
||||
}
|
||||
|
||||
virtual void updt_params(params_ref const & p) {
|
||||
void updt_params(params_ref const & p) override {
|
||||
m_max_memory = megabytes_to_bytes(p.get_uint("max_memory", UINT_MAX));
|
||||
m_aig_gate_encoding = p.get_bool("aig_default_gate_encoding", true);
|
||||
m_aig_per_assertion = p.get_bool("aig_per_assertion", true);
|
||||
}
|
||||
|
||||
virtual void collect_param_descrs(param_descrs & r) {
|
||||
void collect_param_descrs(param_descrs & r) override {
|
||||
insert_max_memory(r);
|
||||
r.insert("aig_per_assertion", CPK_BOOL, "(default: true) process one assertion at a time.");
|
||||
}
|
||||
|
@ -77,7 +77,7 @@ public:
|
|||
expr_ref new_f(g->m());
|
||||
m_aig_manager->to_formula(r, new_f);
|
||||
expr_dependency * ed = g->dep(i);
|
||||
g->update(i, new_f, 0, ed);
|
||||
g->update(i, new_f, nullptr, ed);
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@ -90,14 +90,14 @@ public:
|
|||
SASSERT(g->is_well_sorted());
|
||||
}
|
||||
|
||||
virtual void operator()(goal_ref const & g, goal_ref_buffer & result) {
|
||||
void operator()(goal_ref const & g, goal_ref_buffer & result) override {
|
||||
fail_if_proof_generation("aig", g);
|
||||
operator()(g);
|
||||
g->inc_depth();
|
||||
result.push_back(g.get());
|
||||
}
|
||||
|
||||
virtual void cleanup() {}
|
||||
void cleanup() override {}
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -48,10 +48,10 @@ bool is_unbounded(goal const & g) {
|
|||
|
||||
class is_unbounded_probe : public probe {
|
||||
public:
|
||||
virtual result operator()(goal const & g) {
|
||||
result operator()(goal const & g) override {
|
||||
return is_unbounded(g);
|
||||
}
|
||||
virtual ~is_unbounded_probe() {}
|
||||
~is_unbounded_probe() override {}
|
||||
};
|
||||
|
||||
probe * mk_is_unbounded_probe() {
|
||||
|
@ -138,30 +138,30 @@ public:
|
|||
m_imp = alloc(imp, m, p);
|
||||
}
|
||||
|
||||
virtual tactic * translate(ast_manager & m) {
|
||||
tactic * translate(ast_manager & m) override {
|
||||
return alloc(add_bounds_tactic, m, m_params);
|
||||
}
|
||||
|
||||
virtual ~add_bounds_tactic() {
|
||||
~add_bounds_tactic() override {
|
||||
dealloc(m_imp);
|
||||
}
|
||||
|
||||
virtual void updt_params(params_ref const & p) {
|
||||
void updt_params(params_ref const & p) override {
|
||||
m_params = p;
|
||||
m_imp->updt_params(p);
|
||||
}
|
||||
|
||||
virtual void collect_param_descrs(param_descrs & r) {
|
||||
void collect_param_descrs(param_descrs & r) override {
|
||||
r.insert("add_bound_lower", CPK_NUMERAL, "(default: -2) lower bound to be added to unbounded variables.");
|
||||
r.insert("add_bound_upper", CPK_NUMERAL, "(default: 2) upper bound to be added to unbounded variables.");
|
||||
}
|
||||
|
||||
virtual void operator()(goal_ref const & g,
|
||||
goal_ref_buffer & result) {
|
||||
void operator()(goal_ref const & g,
|
||||
goal_ref_buffer & result) override {
|
||||
(*m_imp)(g, result);
|
||||
}
|
||||
|
||||
virtual void cleanup() {
|
||||
void cleanup() override {
|
||||
imp * d = alloc(imp, m_imp->m, m_params);
|
||||
std::swap(d, m_imp);
|
||||
dealloc(d);
|
||||
|
|
|
@ -23,12 +23,12 @@ struct arith_bounds_tactic : public tactic {
|
|||
ast_manager& get_manager() { return m; }
|
||||
|
||||
|
||||
virtual void operator()(/* in */ goal_ref const & in,
|
||||
/* out */ goal_ref_buffer & result) {
|
||||
void operator()(/* in */ goal_ref const & in,
|
||||
/* out */ goal_ref_buffer & result) override {
|
||||
bounds_arith_subsumption(in, result);
|
||||
}
|
||||
|
||||
virtual tactic* translate(ast_manager & mgr) {
|
||||
tactic* translate(ast_manager & mgr) override {
|
||||
return alloc(arith_bounds_tactic, mgr);
|
||||
}
|
||||
|
||||
|
@ -47,7 +47,7 @@ struct arith_bounds_tactic : public tactic {
|
|||
|
||||
void mk_proof(proof_ref& pr, goal_ref const& s, unsigned i, unsigned j) {
|
||||
if (s->proofs_enabled()) {
|
||||
proof* th_lemma = m.mk_th_lemma(a.get_family_id(), m.mk_implies(s->form(i), s->form(j)), 0, 0);
|
||||
proof* th_lemma = m.mk_th_lemma(a.get_family_id(), m.mk_implies(s->form(i), s->form(j)), 0, nullptr);
|
||||
pr = m.mk_modus_ponens(s->pr(i), th_lemma);
|
||||
}
|
||||
}
|
||||
|
@ -143,7 +143,7 @@ struct arith_bounds_tactic : public tactic {
|
|||
TRACE("arith_subsumption", s->display(tout); );
|
||||
}
|
||||
|
||||
virtual void cleanup() {}
|
||||
void cleanup() override {}
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -214,22 +214,22 @@ bool bound_manager::is_disjunctive_bound(expr * f, expr_dependency * d) {
|
|||
if (!m().is_or(f)) return false;
|
||||
unsigned sz = to_app(f)->get_num_args();
|
||||
if (sz == 0) return false;
|
||||
expr * x, * y, * v = 0;
|
||||
expr * x, * y, * v = nullptr;
|
||||
bool is_int;
|
||||
for (unsigned i = 0; i < sz; ++i) {
|
||||
expr * e = to_app(f)->get_arg(i);
|
||||
if (!m().is_eq(e, x, y)) return false;
|
||||
if (is_uninterp_const(x) &&
|
||||
is_numeral(y, n, is_int) && is_int &&
|
||||
(x == v || v == 0)) {
|
||||
if (v == 0) { v = x; lo = hi = n; }
|
||||
(x == v || v == nullptr)) {
|
||||
if (v == nullptr) { v = x; lo = hi = n; }
|
||||
if (n < lo) lo = n;
|
||||
if (n > hi) hi = n;
|
||||
}
|
||||
else if (is_uninterp_const(y) &&
|
||||
is_numeral(x, n, is_int) && is_int &&
|
||||
(y == v || v == 0)) {
|
||||
if (v == 0) { v = y; lo = hi = n; }
|
||||
(y == v || v == nullptr)) {
|
||||
if (v == nullptr) { v = y; lo = hi = n; }
|
||||
if (n < lo) lo = n;
|
||||
if (n > hi) hi = n;
|
||||
}
|
||||
|
|
|
@ -52,7 +52,7 @@ public:
|
|||
ast_manager & m() const { return m_util.get_manager(); }
|
||||
|
||||
void operator()(goal const & g);
|
||||
void operator()(expr * n, expr_dependency * d = 0);
|
||||
void operator()(expr * n, expr_dependency * d = nullptr);
|
||||
|
||||
bool has_lower(expr * c, numeral & v, bool & strict) const {
|
||||
limit l;
|
||||
|
@ -78,14 +78,14 @@ public:
|
|||
expr_dependency * d;
|
||||
if (m_lower_deps.find(c, d))
|
||||
return d;
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
expr_dependency * upper_dep(expr * c) const {
|
||||
expr_dependency * d;
|
||||
if (m_upper_deps.find(c, d))
|
||||
return d;
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool has_lower(expr * c) const {
|
||||
|
|
|
@ -182,7 +182,7 @@ void bound_propagator::mk_eq(unsigned sz, mpz * as, var * xs) {
|
|||
}
|
||||
|
||||
void bound_propagator::init_eq(linear_equation * eq) {
|
||||
if (eq == 0)
|
||||
if (eq == nullptr)
|
||||
return;
|
||||
unsigned c_idx = m_constraints.size();
|
||||
m_constraints.push_back(constraint());
|
||||
|
@ -383,7 +383,7 @@ bool bound_propagator::relevant_bound(var x, double new_k) const {
|
|||
if (LOWER && has_lower(x)) tout << "old: " << m.to_string(m_lowers[x]->m_k) << " | " << m_lowers[x]->m_approx_k << "\n";
|
||||
if (!LOWER && has_upper(x)) tout << "old: " << m.to_string(m_uppers[x]->m_k) << " | " << m_uppers[x]->m_approx_k << "\n";);
|
||||
bound * b = LOWER ? m_lowers[x] : m_uppers[x];
|
||||
if (b == 0)
|
||||
if (b == nullptr)
|
||||
return true; // variable did not have a bound
|
||||
|
||||
double interval_size;
|
||||
|
@ -537,7 +537,7 @@ bool bound_propagator::propagate_eq(unsigned c_idx) {
|
|||
bound * u_i = m_uppers[x_i];
|
||||
if (a_i < 0.0) {
|
||||
if (!ll_failed) {
|
||||
if (l_i == 0) {
|
||||
if (l_i == nullptr) {
|
||||
if (ll_i == UINT_MAX)
|
||||
ll_i = i;
|
||||
else
|
||||
|
@ -549,7 +549,7 @@ bool bound_propagator::propagate_eq(unsigned c_idx) {
|
|||
}
|
||||
|
||||
if (!uu_failed) {
|
||||
if (u_i == 0) {
|
||||
if (u_i == nullptr) {
|
||||
if (uu_i == UINT_MAX)
|
||||
uu_i = i;
|
||||
else
|
||||
|
@ -562,7 +562,7 @@ bool bound_propagator::propagate_eq(unsigned c_idx) {
|
|||
}
|
||||
else {
|
||||
if (!ll_failed) {
|
||||
if (u_i == 0) {
|
||||
if (u_i == nullptr) {
|
||||
if (ll_i == UINT_MAX)
|
||||
ll_i = i;
|
||||
else
|
||||
|
@ -574,7 +574,7 @@ bool bound_propagator::propagate_eq(unsigned c_idx) {
|
|||
}
|
||||
|
||||
if (!uu_failed) {
|
||||
if (l_i == 0) {
|
||||
if (l_i == nullptr) {
|
||||
if (uu_i == UINT_MAX)
|
||||
uu_i = i;
|
||||
else
|
||||
|
@ -780,7 +780,7 @@ bool bound_propagator::upper(var x, mpq & k, bool & strict, unsigned & ts) const
|
|||
|
||||
bound_propagator::bound * bound_propagator::bound::at(unsigned timestamp) {
|
||||
bound * r = this;
|
||||
while (r != 0 && r->m_timestamp >= timestamp)
|
||||
while (r != nullptr && r->m_timestamp >= timestamp)
|
||||
r = r->m_prev;
|
||||
return r;
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ void bv2int_rewriter_ctx::collect_power2(goal const& s) {
|
|||
expr* f = s.form(j);
|
||||
if (!m.is_or(f)) continue;
|
||||
unsigned sz = to_app(f)->get_num_args();
|
||||
expr* x, *y, *v = 0;
|
||||
expr* x, *y, *v = nullptr;
|
||||
rational n;
|
||||
vector<rational> bounds;
|
||||
bool is_int, ok = true;
|
||||
|
@ -50,12 +50,12 @@ void bv2int_rewriter_ctx::collect_power2(goal const& s) {
|
|||
break;
|
||||
}
|
||||
if (arith.is_numeral(y, n, is_int) && is_int &&
|
||||
(x == v || v == 0)) {
|
||||
(x == v || v == nullptr)) {
|
||||
v = x;
|
||||
bounds.push_back(n);
|
||||
}
|
||||
else if (arith.is_numeral(x, n, is_int) && is_int &&
|
||||
(y == v || v == 0)) {
|
||||
(y == v || v == nullptr)) {
|
||||
v = y;
|
||||
bounds.push_back(n);
|
||||
}
|
||||
|
|
|
@ -103,7 +103,7 @@ struct bv2int_rewriter_cfg : public default_rewriter_cfg {
|
|||
bool rewrite_patterns() const { return false; }
|
||||
bool flat_assoc(func_decl * f) const { return false; }
|
||||
br_status reduce_app(func_decl * f, unsigned num, expr * const * args, expr_ref & result, proof_ref & result_pr) {
|
||||
result_pr = 0;
|
||||
result_pr = nullptr;
|
||||
return m_r.mk_app_core(f, num, args, result);
|
||||
}
|
||||
bv2int_rewriter_cfg(ast_manager & m, bv2int_rewriter_ctx& ctx):m_r(m, ctx) {}
|
||||
|
|
|
@ -181,7 +181,7 @@ struct bv2real_rewriter_cfg : public default_rewriter_cfg {
|
|||
bool rewrite_patterns() const { return false; }
|
||||
bool flat_assoc(func_decl * f) const { return false; }
|
||||
br_status reduce_app(func_decl * f, unsigned num, expr * const * args, expr_ref & result, proof_ref & result_pr) {
|
||||
result_pr = 0;
|
||||
result_pr = nullptr;
|
||||
return m_r.mk_app_core(f, num, args, result);
|
||||
}
|
||||
bv2real_rewriter_cfg(ast_manager & m, bv2real_util& u):m_r(m, u) {}
|
||||
|
@ -216,7 +216,7 @@ struct bv2real_elim_rewriter_cfg : public default_rewriter_cfg {
|
|||
bool rewrite_patterns() const { return false; }
|
||||
bool flat_assoc(func_decl * f) const { return false; }
|
||||
br_status reduce_app(func_decl * f, unsigned num, expr * const * args, expr_ref & result, proof_ref & result_pr) {
|
||||
result_pr = 0;
|
||||
result_pr = nullptr;
|
||||
return m_r.mk_app_core(f, num, args, result);
|
||||
}
|
||||
bv2real_elim_rewriter_cfg(bv2real_util& u):m_r(u) {}
|
||||
|
|
|
@ -36,24 +36,24 @@ public:
|
|||
m_params(p) {
|
||||
}
|
||||
|
||||
virtual tactic * translate(ast_manager & m) {
|
||||
tactic * translate(ast_manager & m) override {
|
||||
return alloc(card2bv_tactic, m, m_params);
|
||||
}
|
||||
|
||||
virtual ~card2bv_tactic() {
|
||||
~card2bv_tactic() override {
|
||||
}
|
||||
|
||||
virtual void updt_params(params_ref const & p) {
|
||||
void updt_params(params_ref const & p) override {
|
||||
m_params = p;
|
||||
}
|
||||
|
||||
virtual void collect_param_descrs(param_descrs & r) {
|
||||
void collect_param_descrs(param_descrs & r) override {
|
||||
r.insert("keep_cardinality_constraints", CPK_BOOL, "(default: true) retain cardinality constraints for solver");
|
||||
}
|
||||
|
||||
|
||||
virtual void operator()(goal_ref const & g,
|
||||
goal_ref_buffer & result) {
|
||||
void operator()(goal_ref const & g,
|
||||
goal_ref_buffer & result) override {
|
||||
TRACE("card2bv-before", g->display(tout););
|
||||
SASSERT(g->is_well_sorted());
|
||||
result.reset();
|
||||
|
@ -97,7 +97,7 @@ public:
|
|||
SASSERT(g->is_well_sorted());
|
||||
}
|
||||
|
||||
virtual void cleanup() {
|
||||
void cleanup() override {
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -79,7 +79,7 @@ namespace pb {
|
|||
bool rewrite_patterns() const { return false; }
|
||||
bool flat_assoc(func_decl * f) const { return false; }
|
||||
br_status reduce_app(func_decl * f, unsigned num, expr * const * args, expr_ref & result, proof_ref & result_pr) {
|
||||
result_pr = 0;
|
||||
result_pr = nullptr;
|
||||
return m_r.mk_app_core(f, num, args, result);
|
||||
}
|
||||
card2bv_rewriter_cfg(ast_manager & m):m_r(m) {}
|
||||
|
|
|
@ -93,7 +93,7 @@ class degree_shift_tactic : public tactic {
|
|||
m_autil(_m),
|
||||
m_pinned(_m),
|
||||
m_one(1),
|
||||
m_rw(0) {
|
||||
m_rw(nullptr) {
|
||||
}
|
||||
|
||||
|
||||
|
@ -196,7 +196,7 @@ class degree_shift_tactic : public tactic {
|
|||
|
||||
void prepare_substitution(model_converter_ref & mc) {
|
||||
SASSERT(!m_var2degree.empty());
|
||||
generic_model_converter * xmc = 0;
|
||||
generic_model_converter * xmc = nullptr;
|
||||
if (m_produce_models) {
|
||||
xmc = alloc(generic_model_converter, m, "degree_shift");
|
||||
mc = xmc;
|
||||
|
@ -257,12 +257,12 @@ class degree_shift_tactic : public tactic {
|
|||
if (kv.m_value.is_even()) {
|
||||
app * new_var = m_var2var.find(kv.m_key);
|
||||
app * new_c = m_autil.mk_ge(new_var, m_autil.mk_numeral(rational(0), false));
|
||||
proof * new_pr = 0;
|
||||
proof * new_pr = nullptr;
|
||||
if (m_produce_proofs) {
|
||||
proof * pr = m_var2pr.find(kv.m_key);
|
||||
new_pr = m.mk_th_lemma(m_autil.get_family_id(), new_c, 1, &pr);
|
||||
}
|
||||
g->assert_expr(new_c, new_pr, 0);
|
||||
g->assert_expr(new_c, new_pr, nullptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -280,20 +280,20 @@ public:
|
|||
m_imp = alloc(imp, m);
|
||||
}
|
||||
|
||||
virtual tactic * translate(ast_manager & m) {
|
||||
tactic * translate(ast_manager & m) override {
|
||||
return alloc(degree_shift_tactic, m);
|
||||
}
|
||||
|
||||
virtual ~degree_shift_tactic() {
|
||||
~degree_shift_tactic() override {
|
||||
dealloc(m_imp);
|
||||
}
|
||||
|
||||
virtual void operator()(goal_ref const & in,
|
||||
goal_ref_buffer & result) {
|
||||
void operator()(goal_ref const & in,
|
||||
goal_ref_buffer & result) override {
|
||||
(*m_imp)(in, result);
|
||||
}
|
||||
|
||||
virtual void cleanup() {
|
||||
void cleanup() override {
|
||||
imp * d = alloc(imp, m_imp->m);
|
||||
std::swap(d, m_imp);
|
||||
dealloc(d);
|
||||
|
|
|
@ -95,13 +95,13 @@ class diff_neq_tactic : public tactic {
|
|||
if (is_uninterp_const(lhs) && u.is_numeral(rhs, k) && m_max_neg_k <= k && k <= m_max_k) {
|
||||
var x = mk_var(lhs);
|
||||
int _k = static_cast<int>(k.get_int64());
|
||||
m_upper[x] = _k;
|
||||
m_upper[x] = std::min(m_upper[x], _k);
|
||||
|
||||
}
|
||||
else if (is_uninterp_const(rhs) && u.is_numeral(lhs, k) && m_max_neg_k <= k && k <= m_max_k) {
|
||||
var x = mk_var(rhs);
|
||||
int _k = static_cast<int>(k.get_int64());
|
||||
m_lower[x] = _k;
|
||||
m_lower[x] = std::max(m_lower[x], _k);
|
||||
}
|
||||
else {
|
||||
throw_not_supported();
|
||||
|
@ -352,28 +352,28 @@ public:
|
|||
m_imp = alloc(imp, m, p);
|
||||
}
|
||||
|
||||
virtual tactic * translate(ast_manager & m) {
|
||||
tactic * translate(ast_manager & m) override {
|
||||
return alloc(diff_neq_tactic, m, m_params);
|
||||
}
|
||||
|
||||
virtual ~diff_neq_tactic() {
|
||||
~diff_neq_tactic() override {
|
||||
dealloc(m_imp);
|
||||
}
|
||||
|
||||
virtual void updt_params(params_ref const & p) {
|
||||
void updt_params(params_ref const & p) override {
|
||||
m_params = p;
|
||||
m_imp->updt_params(p);
|
||||
}
|
||||
|
||||
virtual void collect_param_descrs(param_descrs & r) {
|
||||
void collect_param_descrs(param_descrs & r) override {
|
||||
r.insert("diff_neq_max_k", CPK_UINT, "(default: 1024) maximum variable upper bound for diff neq solver.");
|
||||
}
|
||||
|
||||
virtual void collect_statistics(statistics & st) const {
|
||||
void collect_statistics(statistics & st) const override {
|
||||
st.update("conflicts", m_imp->m_num_conflicts);
|
||||
}
|
||||
|
||||
virtual void reset_statistics() {
|
||||
void reset_statistics() override {
|
||||
m_imp->m_num_conflicts = 0;
|
||||
}
|
||||
|
||||
|
@ -381,12 +381,12 @@ public:
|
|||
\brief Fix a DL variable in s to 0.
|
||||
If s is not really in the difference logic fragment, then this is a NOOP.
|
||||
*/
|
||||
virtual void operator()(goal_ref const & in,
|
||||
goal_ref_buffer & result) {
|
||||
void operator()(goal_ref const & in,
|
||||
goal_ref_buffer & result) override {
|
||||
(*m_imp)(in, result);
|
||||
}
|
||||
|
||||
virtual void cleanup() {
|
||||
void cleanup() override {
|
||||
imp * d = alloc(imp, m_imp->m, m_params);
|
||||
d->m_num_conflicts = m_imp->m_num_conflicts;
|
||||
std::swap(d, m_imp);
|
||||
|
|
267
src/tactic/arith/elim01_tactic.cpp
Normal file
267
src/tactic/arith/elim01_tactic.cpp
Normal file
|
@ -0,0 +1,267 @@
|
|||
/*++
|
||||
Copyright (c) 2013 Microsoft Corporation
|
||||
|
||||
Module Name:
|
||||
|
||||
elim01_tactic.cpp
|
||||
|
||||
Abstract:
|
||||
|
||||
Replace 0-1 integer variables by Booleans.
|
||||
|
||||
Author:
|
||||
|
||||
Nikolaj Bjorner (nbjorner) 2013-12-7
|
||||
|
||||
Notes:
|
||||
|
||||
--*/
|
||||
#include "tactic/tactical.h"
|
||||
#include "util/cooperate.h"
|
||||
#include "tactic/arith/bound_manager.h"
|
||||
#include "ast/ast_pp.h"
|
||||
#include "ast/rewriter/expr_safe_replace.h"
|
||||
#include "ast/arith_decl_plugin.h"
|
||||
#include "tactic/arith/elim01_tactic.h"
|
||||
#include "model/model_smt2_pp.h"
|
||||
#include "ast/rewriter/th_rewriter.h"
|
||||
|
||||
class bool2int_model_converter : public model_converter {
|
||||
ast_manager& m;
|
||||
arith_util a;
|
||||
func_decl_ref_vector m_refs;
|
||||
obj_hashtable<func_decl> m_bools;
|
||||
vector<ptr_vector<func_decl> > m_nums_as_bool;
|
||||
ptr_vector<func_decl> m_nums_as_int;
|
||||
public:
|
||||
|
||||
bool2int_model_converter(ast_manager& m):
|
||||
m(m),
|
||||
a(m),
|
||||
m_refs(m)
|
||||
{}
|
||||
|
||||
void operator()(model_ref & old_model, unsigned goal_idx) override {
|
||||
SASSERT(goal_idx == 0);
|
||||
model * new_model = alloc(model, m);
|
||||
unsigned num = old_model->get_num_constants();
|
||||
for (unsigned i = 0; i < m_nums_as_int.size(); ++i) {
|
||||
func_decl* f_old = m_nums_as_int[i];
|
||||
rational val(0);
|
||||
rational po(1);
|
||||
bool is_value = true;
|
||||
for (unsigned j = 0; is_value && j < m_nums_as_bool[i].size(); ++j) {
|
||||
func_decl* f = m_nums_as_bool[i][j];
|
||||
expr* fi = old_model->get_const_interp(f);
|
||||
if (!fi) {
|
||||
is_value = false;
|
||||
}
|
||||
else if (m.is_true(fi)) {
|
||||
val += po;
|
||||
}
|
||||
else if (!m.is_false(fi)) {
|
||||
is_value = false;
|
||||
}
|
||||
po *= rational(2);
|
||||
}
|
||||
if (is_value) {
|
||||
expr* fi = a.mk_numeral(val, true);
|
||||
new_model->register_decl(f_old, fi);
|
||||
}
|
||||
}
|
||||
for (unsigned i = 0; i < num; ++i) {
|
||||
func_decl* f = old_model->get_constant(i);
|
||||
expr* fi = old_model->get_const_interp(f);
|
||||
if (!m_bools.contains(f)) {
|
||||
new_model->register_decl(f, fi);
|
||||
}
|
||||
}
|
||||
num = old_model->get_num_functions();
|
||||
for (unsigned i = 0; i < num; i++) {
|
||||
func_decl * f = old_model->get_function(i);
|
||||
func_interp * fi = old_model->get_func_interp(f);
|
||||
new_model->register_decl(f, fi->copy());
|
||||
}
|
||||
new_model->copy_usort_interps(*old_model);
|
||||
old_model = new_model;
|
||||
}
|
||||
|
||||
void insert(func_decl* x_new, func_decl* x_old) {
|
||||
m_refs.push_back(x_new);
|
||||
m_refs.push_back(x_old);
|
||||
m_bools.insert(x_new);
|
||||
m_nums_as_int.push_back(x_old);
|
||||
m_nums_as_bool.push_back(ptr_vector<func_decl>());
|
||||
m_nums_as_bool.back().push_back(x_new);
|
||||
}
|
||||
|
||||
void insert(func_decl* x_old, unsigned sz, func_decl * const* x_new) {
|
||||
m_nums_as_int.push_back(x_old);
|
||||
m_nums_as_bool.push_back(ptr_vector<func_decl>());
|
||||
m_refs.push_back(x_old);
|
||||
for (unsigned i = 0; i < sz; ++i) {
|
||||
m_refs.push_back(x_new[i]);
|
||||
m_nums_as_bool.back().push_back(x_new[i]);
|
||||
m_bools.insert(x_new[i]);
|
||||
}
|
||||
}
|
||||
|
||||
model_converter * translate(ast_translation & translator) override {
|
||||
bool2int_model_converter* mc = alloc(bool2int_model_converter, translator.to());
|
||||
for (unsigned i = 0; i < m_nums_as_int.size(); ++i) {
|
||||
mc->insert(m_nums_as_int[i], m_nums_as_bool[i].size(), m_nums_as_bool[i].c_ptr());
|
||||
}
|
||||
return mc;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
class elim01_tactic : public tactic {
|
||||
public:
|
||||
typedef obj_hashtable<expr> expr_set;
|
||||
ast_manager & m;
|
||||
arith_util a;
|
||||
th_rewriter m_rewriter;
|
||||
params_ref m_params;
|
||||
unsigned m_max_hi_default;
|
||||
rational m_max_hi;
|
||||
|
||||
elim01_tactic(ast_manager & _m, params_ref const & p):
|
||||
m(_m),
|
||||
a(m),
|
||||
m_rewriter(m),
|
||||
m_max_hi_default(8),
|
||||
m_max_hi(rational(m_max_hi_default)) {
|
||||
}
|
||||
|
||||
~elim01_tactic() override {
|
||||
}
|
||||
|
||||
void updt_params(params_ref const & p) override {
|
||||
m_max_hi = rational(p.get_uint("max_coefficient", m_max_hi_default));
|
||||
m_params = p;
|
||||
}
|
||||
|
||||
void collect_param_descrs(param_descrs & r) override {
|
||||
r.insert("max_coefficient", CPK_UINT, "(default: 1) maximal upper bound for finite range -> Bool conversion");
|
||||
}
|
||||
|
||||
|
||||
void operator()(goal_ref const & g,
|
||||
goal_ref_buffer & result,
|
||||
model_converter_ref & mc,
|
||||
proof_converter_ref & pc,
|
||||
expr_dependency_ref & core) override {
|
||||
SASSERT(g->is_well_sorted());
|
||||
mc = nullptr; pc = nullptr; core = nullptr;
|
||||
|
||||
tactic_report report("elim01", *g);
|
||||
|
||||
expr_safe_replace sub(m);
|
||||
bool2int_model_converter* b2i = alloc(bool2int_model_converter, m);
|
||||
mc = b2i;
|
||||
bound_manager bounds(m);
|
||||
expr_ref_vector axioms(m);
|
||||
bounds(*g);
|
||||
|
||||
rational zero(0);
|
||||
bound_manager::iterator bit = bounds.begin(), bend = bounds.end();
|
||||
for (; bit != bend; ++bit) {
|
||||
if (!is_app(*bit)) continue;
|
||||
app* x = to_app(*bit);
|
||||
bool s1 = false, s2 = false;
|
||||
rational lo, hi;
|
||||
if (a.is_int(x) &&
|
||||
bounds.has_lower(x, lo, s1) && !s1 && zero <= lo &&
|
||||
bounds.has_upper(x, hi, s2) && !s2 && hi <= m_max_hi && lo <= hi) {
|
||||
add_variable(b2i, sub, x, lo.get_unsigned(), hi.get_unsigned(), axioms);
|
||||
}
|
||||
else if (a.is_int(x)) {
|
||||
TRACE("pb", tout << "Not adding variable " << mk_pp(x, m) << " has lower: "
|
||||
<< bounds.has_lower(x, lo, s1) << " " << lo << " has upper: "
|
||||
<< bounds.has_upper(x, hi, s2) << " " << hi << "\n";);
|
||||
}
|
||||
}
|
||||
|
||||
if (sub.empty()) {
|
||||
result.push_back(g.get());
|
||||
return;
|
||||
}
|
||||
|
||||
expr_ref new_curr(m), tmp_curr(m);
|
||||
proof_ref new_pr(m);
|
||||
for (unsigned i = 0; i < g->size(); i++) {
|
||||
expr * curr = g->form(i);
|
||||
sub(curr, tmp_curr);
|
||||
m_rewriter(tmp_curr, new_curr);
|
||||
if (m.proofs_enabled()) {
|
||||
new_pr = m.mk_rewrite(curr, new_curr);
|
||||
new_pr = m.mk_modus_ponens(g->pr(i), new_pr);
|
||||
}
|
||||
g->update(i, new_curr, new_pr, g->dep(i));
|
||||
}
|
||||
for (unsigned i = 0; i < axioms.size(); ++i) {
|
||||
g->assert_expr(axioms[i].get());
|
||||
}
|
||||
g->inc_depth();
|
||||
result.push_back(g.get());
|
||||
TRACE("pb", g->display(tout););
|
||||
SASSERT(g->is_well_sorted());
|
||||
|
||||
// TBD: support proof conversion (or not..)
|
||||
}
|
||||
|
||||
tactic * translate(ast_manager & m) override {
|
||||
return alloc(elim01_tactic, m, m_params);
|
||||
}
|
||||
|
||||
void cleanup() override {}
|
||||
|
||||
void add_variable(bool2int_model_converter* b2i,
|
||||
expr_safe_replace& sub,
|
||||
app* x,
|
||||
unsigned min_value,
|
||||
unsigned max_value,
|
||||
expr_ref_vector& axioms) {
|
||||
std::string name = x->get_decl()->get_name().str();
|
||||
unsigned sh = 0;
|
||||
app_ref_vector xs(m), ites(m);
|
||||
func_decl_ref_vector xfs(m);
|
||||
app_ref zero(m), sum(m);
|
||||
zero = a.mk_numeral(rational(0), true);
|
||||
while (max_value >= (1ul << sh)) {
|
||||
xs.push_back(m.mk_fresh_const(name.c_str(), m.mk_bool_sort()));
|
||||
xfs.push_back(xs.back()->get_decl());
|
||||
ites.push_back(m.mk_ite(xs.back(), a.mk_numeral(rational(1 << sh), true), zero));
|
||||
++sh;
|
||||
}
|
||||
switch (ites.size()) {
|
||||
case 0:
|
||||
sum = zero;
|
||||
break;
|
||||
case 1:
|
||||
sum = ites[0].get();
|
||||
break;
|
||||
default:
|
||||
sum = a.mk_add(ites.size(), (expr*const*)ites.c_ptr());
|
||||
break;
|
||||
}
|
||||
TRACE("pb", tout << mk_pp(x, m) << " " << sum << " max: " << max_value << "\n";);
|
||||
|
||||
sub.insert(x, sum);
|
||||
b2i->insert(x->get_decl(), xfs.size(), xfs.c_ptr());
|
||||
// if max_value+1 is not a power of two:
|
||||
if ((max_value & (max_value + 1)) != 0) {
|
||||
axioms.push_back(a.mk_le(sum, a.mk_numeral(rational(max_value), true)));
|
||||
}
|
||||
if (min_value > 0) {
|
||||
axioms.push_back(a.mk_ge(sum, a.mk_numeral(rational(min_value), true)));
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
tactic * mk_elim01_tactic(ast_manager & m, params_ref const & p) {
|
||||
return clean(alloc(elim01_tactic, m, p));
|
||||
}
|
||||
|
|
@ -59,7 +59,7 @@ class eq2bv_tactic : public tactic {
|
|||
bool rewrite_patterns() const { return false; }
|
||||
bool flat_assoc(func_decl * f) const { return false; }
|
||||
br_status reduce_app(func_decl * f, unsigned num, expr * const * args, expr_ref & result, proof_ref & result_pr) {
|
||||
result_pr = 0;
|
||||
result_pr = nullptr;
|
||||
return mk_app_core(f, num, args, result);
|
||||
}
|
||||
eq_rewriter_cfg(eq2bv_tactic& t):m(t.m), t(t) {}
|
||||
|
@ -82,7 +82,7 @@ class eq2bv_tactic : public tactic {
|
|||
m_map.insert(c_new, c_old);
|
||||
}
|
||||
|
||||
virtual void operator()(model_ref& mdl) {
|
||||
void operator()(model_ref& mdl) override {
|
||||
ast_manager& m = mdl->get_manager();
|
||||
bv_util bv(m);
|
||||
arith_util a(m);
|
||||
|
@ -105,7 +105,7 @@ class eq2bv_tactic : public tactic {
|
|||
mdl = new_m;
|
||||
}
|
||||
|
||||
virtual model_converter* translate(ast_translation & translator) {
|
||||
model_converter* translate(ast_translation & translator) override {
|
||||
bvmc* v = alloc(bvmc);
|
||||
for (auto const& kv : m_map) {
|
||||
v->m_map.insert(translator(kv.m_key), translator(kv.m_value));
|
||||
|
@ -144,14 +144,14 @@ public:
|
|||
m_bounds(m) {
|
||||
}
|
||||
|
||||
virtual ~eq2bv_tactic() {
|
||||
~eq2bv_tactic() override {
|
||||
}
|
||||
|
||||
|
||||
void updt_params(params_ref const & p) {
|
||||
void updt_params(params_ref const & p) override {
|
||||
}
|
||||
|
||||
virtual void operator()(goal_ref const & g, goal_ref_buffer & result) {
|
||||
void operator()(goal_ref const & g, goal_ref_buffer & result) override {
|
||||
SASSERT(g->is_well_sorted());
|
||||
m_trail.reset();
|
||||
m_fd.reset();
|
||||
|
@ -178,7 +178,7 @@ public:
|
|||
expr_ref new_curr(m);
|
||||
proof_ref new_pr(m);
|
||||
if (is_bound(g->form(i))) {
|
||||
g->update(i, m.mk_true(), 0, 0);
|
||||
g->update(i, m.mk_true(), nullptr, nullptr);
|
||||
continue;
|
||||
}
|
||||
m_rw(g->form(i), new_curr, new_pr);
|
||||
|
@ -215,14 +215,14 @@ public:
|
|||
}
|
||||
|
||||
|
||||
virtual tactic * translate(ast_manager & m) {
|
||||
tactic * translate(ast_manager & m) override {
|
||||
return alloc(eq2bv_tactic, m);
|
||||
}
|
||||
|
||||
virtual void collect_param_descrs(param_descrs & r) {
|
||||
void collect_param_descrs(param_descrs & r) override {
|
||||
}
|
||||
|
||||
virtual void cleanup() {
|
||||
void cleanup() override {
|
||||
}
|
||||
|
||||
void cleanup_fd(ref<bvmc>& mc) {
|
||||
|
|
|
@ -289,27 +289,27 @@ public:
|
|||
m_imp = alloc(imp, m, p);
|
||||
}
|
||||
|
||||
virtual tactic * translate(ast_manager & m) {
|
||||
tactic * translate(ast_manager & m) override {
|
||||
return alloc(factor_tactic, m, m_params);
|
||||
}
|
||||
|
||||
virtual ~factor_tactic() {
|
||||
~factor_tactic() override {
|
||||
dealloc(m_imp);
|
||||
}
|
||||
|
||||
virtual void updt_params(params_ref const & p) {
|
||||
void updt_params(params_ref const & p) override {
|
||||
m_params = p;
|
||||
m_imp->m_rw.cfg().updt_params(p);
|
||||
}
|
||||
|
||||
virtual void collect_param_descrs(param_descrs & r) {
|
||||
void collect_param_descrs(param_descrs & r) override {
|
||||
r.insert("split_factors", CPK_BOOL,
|
||||
"(default: true) apply simplifications such as (= (* p1 p2) 0) --> (or (= p1 0) (= p2 0)).");
|
||||
polynomial::factor_params::get_param_descrs(r);
|
||||
}
|
||||
|
||||
virtual void operator()(goal_ref const & in,
|
||||
goal_ref_buffer & result) {
|
||||
void operator()(goal_ref const & in,
|
||||
goal_ref_buffer & result) override {
|
||||
try {
|
||||
(*m_imp)(in, result);
|
||||
}
|
||||
|
@ -321,7 +321,7 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
virtual void cleanup() {
|
||||
void cleanup() override {
|
||||
imp * d = alloc(imp, m_imp->m, m_params);
|
||||
std::swap(d, m_imp);
|
||||
dealloc(d);
|
||||
|
|
|
@ -44,7 +44,7 @@ class fix_dl_var_tactic : public tactic {
|
|||
m_util(u) {
|
||||
}
|
||||
|
||||
void throw_failed(expr * ctx1, expr * ctx2 = 0) {
|
||||
void throw_failed(expr * ctx1, expr * ctx2 = nullptr) {
|
||||
TRACE("fix_dl_var", tout << mk_ismt2_pp(ctx1, m) << "\n"; if (ctx2) tout << mk_ismt2_pp(ctx2, m) << "\n";);
|
||||
throw failed();
|
||||
}
|
||||
|
@ -178,7 +178,7 @@ class fix_dl_var_tactic : public tactic {
|
|||
}
|
||||
|
||||
app * most_occs(obj_map<app, unsigned> & occs, unsigned & best) {
|
||||
app * r = 0;
|
||||
app * r = nullptr;
|
||||
best = 0;
|
||||
obj_map<app, unsigned>::iterator it = occs.begin();
|
||||
obj_map<app, unsigned>::iterator end = occs.end();
|
||||
|
@ -196,7 +196,7 @@ class fix_dl_var_tactic : public tactic {
|
|||
|
||||
app * most_occs() {
|
||||
// We try to choose a variable that when set to 0 will generate many bounded variables.
|
||||
// That is why we give preference to variables occuring in non-nested inequalities.
|
||||
// That is why we give preference to variables occurring in non-nested inequalities.
|
||||
unsigned best1, best2;
|
||||
app * r1, * r2;
|
||||
r1 = most_occs(m_non_nested_occs, best1);
|
||||
|
@ -227,7 +227,7 @@ class fix_dl_var_tactic : public tactic {
|
|||
return most_occs();
|
||||
}
|
||||
catch (failed) {
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -256,7 +256,7 @@ class fix_dl_var_tactic : public tactic {
|
|||
m_produce_models = g->models_enabled();
|
||||
|
||||
app * var = is_target(u)(*g);
|
||||
if (var != 0) {
|
||||
if (var != nullptr) {
|
||||
IF_VERBOSE(TACTIC_VERBOSITY_LVL, verbose_stream() << "(fixing-at-zero " << var->get_decl()->get_name() << ")\n";);
|
||||
tactic_report report("fix-dl-var", *g);
|
||||
|
||||
|
@ -299,25 +299,25 @@ public:
|
|||
m_imp = alloc(imp, m, p);
|
||||
}
|
||||
|
||||
virtual tactic * translate(ast_manager & m) {
|
||||
tactic * translate(ast_manager & m) override {
|
||||
return alloc(fix_dl_var_tactic, m, m_params);
|
||||
}
|
||||
|
||||
virtual ~fix_dl_var_tactic() {
|
||||
~fix_dl_var_tactic() override {
|
||||
dealloc(m_imp);
|
||||
}
|
||||
|
||||
virtual void updt_params(params_ref const & p) {
|
||||
void updt_params(params_ref const & p) override {
|
||||
m_params = p;
|
||||
m_imp->updt_params(p);
|
||||
}
|
||||
|
||||
virtual void collect_param_descrs(param_descrs & r) {
|
||||
void collect_param_descrs(param_descrs & r) override {
|
||||
th_rewriter::get_param_descrs(r);
|
||||
}
|
||||
|
||||
virtual void operator()(goal_ref const & in,
|
||||
goal_ref_buffer & result) {
|
||||
void operator()(goal_ref const & in,
|
||||
goal_ref_buffer & result) override {
|
||||
try {
|
||||
(*m_imp)(in, result);
|
||||
}
|
||||
|
@ -326,7 +326,7 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
virtual void cleanup() {
|
||||
void cleanup() override {
|
||||
imp * d = alloc(imp, m_imp->m, m_params);
|
||||
std::swap(d, m_imp);
|
||||
dealloc(d);
|
||||
|
|
|
@ -54,7 +54,7 @@ class fm_tactic : public tactic {
|
|||
bool is_false(model_ref & md, app * p) {
|
||||
SASSERT(is_uninterp_const(p));
|
||||
expr * val = md->get_const_interp(p->get_decl());
|
||||
if (val == 0) {
|
||||
if (val == nullptr) {
|
||||
// if it is don't care, then set to false
|
||||
md->register_decl(p->get_decl(), m.mk_false());
|
||||
return true;
|
||||
|
@ -164,7 +164,7 @@ class fm_tactic : public tactic {
|
|||
public:
|
||||
fm_model_converter(ast_manager & _m):m(_m) {}
|
||||
|
||||
virtual ~fm_model_converter() {
|
||||
~fm_model_converter() override {
|
||||
m.dec_array_ref(m_xs.size(), m_xs.c_ptr());
|
||||
vector<clauses>::iterator it = m_clauses.begin();
|
||||
vector<clauses>::iterator end = m_clauses.end();
|
||||
|
@ -180,9 +180,9 @@ class fm_tactic : public tactic {
|
|||
m_clauses.back().swap(c);
|
||||
}
|
||||
|
||||
virtual void get_units(obj_map<expr, bool>& units) { units.reset(); }
|
||||
void get_units(obj_map<expr, bool>& units) override { units.reset(); }
|
||||
|
||||
virtual void operator()(model_ref & md) {
|
||||
void operator()(model_ref & md) override {
|
||||
TRACE("fm_mc", model_v2_pp(tout, *md); display(tout););
|
||||
model_evaluator ev(*(md.get()));
|
||||
ev.set_model_completion(true);
|
||||
|
@ -246,7 +246,7 @@ class fm_tactic : public tactic {
|
|||
}
|
||||
|
||||
|
||||
virtual void display(std::ostream & out) {
|
||||
void display(std::ostream & out) override {
|
||||
out << "(fm-model-converter";
|
||||
SASSERT(m_xs.size() == m_clauses.size());
|
||||
unsigned sz = m_xs.size();
|
||||
|
@ -263,7 +263,7 @@ class fm_tactic : public tactic {
|
|||
out << ")\n";
|
||||
}
|
||||
|
||||
virtual model_converter * translate(ast_translation & translator) {
|
||||
model_converter * translate(ast_translation & translator) override {
|
||||
ast_manager & to_m = translator.to();
|
||||
fm_model_converter * res = alloc(fm_model_converter, to_m);
|
||||
unsigned sz = m_xs.size();
|
||||
|
@ -830,7 +830,7 @@ class fm_tactic : public tactic {
|
|||
reset_constraints();
|
||||
m_bvar2expr.reset();
|
||||
m_bvar2sign.reset();
|
||||
m_bvar2expr.push_back(0); // bvar 0 is not used
|
||||
m_bvar2expr.push_back(nullptr); // bvar 0 is not used
|
||||
m_bvar2sign.push_back(0);
|
||||
m_expr2var.reset();
|
||||
m_is_int.reset();
|
||||
|
@ -840,11 +840,11 @@ class fm_tactic : public tactic {
|
|||
m_expr2var.reset();
|
||||
m_lowers.reset();
|
||||
m_uppers.reset();
|
||||
m_new_goal = 0;
|
||||
m_mc = 0;
|
||||
m_new_goal = nullptr;
|
||||
m_mc = nullptr;
|
||||
m_counter = 0;
|
||||
m_inconsistent = false;
|
||||
m_inconsistent_core = 0;
|
||||
m_inconsistent_core = nullptr;
|
||||
init_forbidden_set(g);
|
||||
}
|
||||
|
||||
|
@ -880,7 +880,7 @@ class fm_tactic : public tactic {
|
|||
// 0 <= 0 -- > true
|
||||
if (c.m_c.is_pos() || (!c.m_strict && c.m_c.is_zero()))
|
||||
return m.mk_true();
|
||||
ineq = 0;
|
||||
ineq = nullptr;
|
||||
}
|
||||
else {
|
||||
bool int_cnstr = all_int(c);
|
||||
|
@ -1117,7 +1117,7 @@ class fm_tactic : public tactic {
|
|||
}
|
||||
else {
|
||||
TRACE("add_constraint_bug", tout << "all variables are forbidden "; display(tout, *c); tout << "\n";);
|
||||
m_new_goal->assert_expr(to_expr(*c), 0, c->m_dep);
|
||||
m_new_goal->assert_expr(to_expr(*c), nullptr, c->m_dep);
|
||||
del_constraint(c);
|
||||
return false;
|
||||
}
|
||||
|
@ -1132,7 +1132,7 @@ class fm_tactic : public tactic {
|
|||
if (is_occ(f))
|
||||
add_constraint(f, g.dep(i));
|
||||
else
|
||||
m_new_goal->assert_expr(f, 0, g.dep(i));
|
||||
m_new_goal->assert_expr(f, nullptr, g.dep(i));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1369,7 +1369,7 @@ class fm_tactic : public tactic {
|
|||
display(tout, l);
|
||||
tout << "\n";
|
||||
display(tout, u); tout << "\n";);
|
||||
return 0; // no constraint needs to be created.
|
||||
return nullptr; // no constraint needs to be created.
|
||||
}
|
||||
|
||||
new_lits.reset();
|
||||
|
@ -1413,7 +1413,7 @@ class fm_tactic : public tactic {
|
|||
display(tout, l);
|
||||
tout << "\n";
|
||||
display(tout, u); tout << "\n";);
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
expr_dependency * new_dep = m.mk_join(l.m_dep, u.m_dep);
|
||||
|
@ -1425,7 +1425,7 @@ class fm_tactic : public tactic {
|
|||
display(tout, u); tout << "\n";);
|
||||
m_inconsistent = true;
|
||||
m_inconsistent_core = new_dep;
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
constraint * new_cnstr = mk_constraint(new_lits.size(),
|
||||
|
@ -1495,7 +1495,7 @@ class fm_tactic : public tactic {
|
|||
constraint const & l_c = *(l[i]);
|
||||
constraint const & u_c = *(u[j]);
|
||||
constraint * new_c = resolve(l_c, u_c, x);
|
||||
if (new_c != 0) {
|
||||
if (new_c != nullptr) {
|
||||
num_new_cnstrs++;
|
||||
new_constraints.push_back(new_c);
|
||||
}
|
||||
|
@ -1530,7 +1530,7 @@ class fm_tactic : public tactic {
|
|||
c->m_dead = true;
|
||||
expr * new_f = to_expr(*c);
|
||||
TRACE("fm_bug", tout << "asserting...\n" << mk_ismt2_pp(new_f, m) << "\nnew_dep: " << c->m_dep << "\n";);
|
||||
m_new_goal->assert_expr(new_f, 0, c->m_dep);
|
||||
m_new_goal->assert_expr(new_f, nullptr, c->m_dep);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1569,7 +1569,7 @@ class fm_tactic : public tactic {
|
|||
|
||||
if (m_inconsistent) {
|
||||
m_new_goal->reset();
|
||||
m_new_goal->assert_expr(m.mk_false(), 0, m_inconsistent_core);
|
||||
m_new_goal->assert_expr(m.mk_false(), nullptr, m_inconsistent_core);
|
||||
}
|
||||
else {
|
||||
TRACE("fm", display(tout););
|
||||
|
@ -1593,7 +1593,7 @@ class fm_tactic : public tactic {
|
|||
eliminated++;
|
||||
if (m_inconsistent) {
|
||||
m_new_goal->reset();
|
||||
m_new_goal->assert_expr(m.mk_false(), 0, m_inconsistent_core);
|
||||
m_new_goal->assert_expr(m.mk_false(), nullptr, m_inconsistent_core);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -1641,20 +1641,20 @@ public:
|
|||
m_imp = alloc(imp, m, p);
|
||||
}
|
||||
|
||||
virtual tactic * translate(ast_manager & m) {
|
||||
tactic * translate(ast_manager & m) override {
|
||||
return alloc(fm_tactic, m, m_params);
|
||||
}
|
||||
|
||||
virtual ~fm_tactic() {
|
||||
~fm_tactic() override {
|
||||
dealloc(m_imp);
|
||||
}
|
||||
|
||||
virtual void updt_params(params_ref const & p) {
|
||||
void updt_params(params_ref const & p) override {
|
||||
m_params = p;
|
||||
m_imp->updt_params(p);
|
||||
}
|
||||
|
||||
virtual void collect_param_descrs(param_descrs & r) {
|
||||
void collect_param_descrs(param_descrs & r) override {
|
||||
insert_produce_models(r);
|
||||
insert_max_memory(r);
|
||||
r.insert("fm_real_only", CPK_BOOL, "(default: true) consider only real variables for fourier-motzkin elimination.");
|
||||
|
@ -1666,14 +1666,14 @@ public:
|
|||
}
|
||||
|
||||
|
||||
virtual void cleanup() {
|
||||
void cleanup() override {
|
||||
imp * d = alloc(imp, m_imp->m, m_params);
|
||||
std::swap(d, m_imp);
|
||||
dealloc(d);
|
||||
}
|
||||
|
||||
virtual void operator()(goal_ref const & in,
|
||||
goal_ref_buffer & result) {
|
||||
void operator()(goal_ref const & in,
|
||||
goal_ref_buffer & result) override {
|
||||
(*m_imp)(in, result);
|
||||
}
|
||||
};
|
||||
|
|
|
@ -91,7 +91,7 @@ class lia2card_tactic : public tactic {
|
|||
bool rewrite_patterns() const { return false; }
|
||||
bool flat_assoc(func_decl * f) const { return false; }
|
||||
br_status reduce_app(func_decl * f, unsigned num, expr * const * args, expr_ref & result, proof_ref & result_pr) {
|
||||
result_pr = 0;
|
||||
result_pr = nullptr;
|
||||
return mk_app_core(f, num, args, result);
|
||||
}
|
||||
lia_rewriter_cfg(lia2card_tactic& t):m(t.m), t(t), a(m), args(m) {}
|
||||
|
@ -129,11 +129,11 @@ public:
|
|||
m_max_ub = 100;
|
||||
}
|
||||
|
||||
virtual ~lia2card_tactic() {
|
||||
~lia2card_tactic() override {
|
||||
dealloc(m_todo);
|
||||
}
|
||||
|
||||
void updt_params(params_ref const & p) {
|
||||
void updt_params(params_ref const & p) override {
|
||||
m_params = p;
|
||||
m_compile_equality = p.get_bool("compile_equality", true);
|
||||
}
|
||||
|
@ -161,7 +161,7 @@ public:
|
|||
return expr_ref(r, m);
|
||||
}
|
||||
|
||||
virtual void operator()(goal_ref const & g, goal_ref_buffer & result) {
|
||||
void operator()(goal_ref const & g, goal_ref_buffer & result) override {
|
||||
SASSERT(g->is_well_sorted());
|
||||
m_bounds.reset();
|
||||
m_mc.reset();
|
||||
|
@ -351,21 +351,20 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
virtual tactic * translate(ast_manager & m) {
|
||||
tactic * translate(ast_manager & m) override {
|
||||
return alloc(lia2card_tactic, m, m_params);
|
||||
}
|
||||
|
||||
virtual void collect_param_descrs(param_descrs & r) {
|
||||
void collect_param_descrs(param_descrs & r) override {
|
||||
r.insert("compile_equality", CPK_BOOL,
|
||||
"(default:false) compile equalities into pseudo-Boolean equality");
|
||||
}
|
||||
|
||||
virtual void cleanup() {
|
||||
bounds_map* d = alloc(bounds_map);
|
||||
void cleanup() override {
|
||||
ptr_vector<expr>* todo = alloc(ptr_vector<expr>);
|
||||
std::swap(m_todo, todo);
|
||||
dealloc(d);
|
||||
dealloc(todo);
|
||||
m_bounds.reset();
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -244,7 +244,7 @@ class lia2pb_tactic : public tactic {
|
|||
rational a(1);
|
||||
unsigned num_bits = u.get_num_bits();
|
||||
for (unsigned i = 0; i < num_bits; i++) {
|
||||
app * x_prime = m.mk_fresh_const(0, m_util.mk_int());
|
||||
app * x_prime = m.mk_fresh_const(nullptr, m_util.mk_int());
|
||||
g->assert_expr(m_util.mk_le(zero, x_prime));
|
||||
g->assert_expr(m_util.mk_le(x_prime, one));
|
||||
if (a.is_one())
|
||||
|
@ -257,14 +257,14 @@ class lia2pb_tactic : public tactic {
|
|||
}
|
||||
SASSERT(def_args.size() > 1);
|
||||
expr * def = m_util.mk_add(def_args.size(), def_args.c_ptr());
|
||||
expr_dependency * dep = 0;
|
||||
expr_dependency * dep = nullptr;
|
||||
if (m_produce_unsat_cores) {
|
||||
dep = m.mk_join(m_bm.lower_dep(x), m_bm.upper_dep(x));
|
||||
if (dep != 0)
|
||||
if (dep != nullptr)
|
||||
m_new_deps.push_back(dep);
|
||||
}
|
||||
TRACE("lia2pb", tout << mk_ismt2_pp(x, m) << " -> " << dep << "\n";);
|
||||
subst.insert(x, def, 0, dep);
|
||||
subst.insert(x, def, nullptr, dep);
|
||||
if (m_produce_models) {
|
||||
gmc->add(x, def);
|
||||
}
|
||||
|
@ -280,7 +280,7 @@ class lia2pb_tactic : public tactic {
|
|||
unsigned size = g->size();
|
||||
for (unsigned idx = 0; idx < size; idx++) {
|
||||
expr * curr = g->form(idx);
|
||||
expr_dependency * dep = 0;
|
||||
expr_dependency * dep = nullptr;
|
||||
m_rw(curr, new_curr, new_pr);
|
||||
if (m_produce_unsat_cores) {
|
||||
dep = m.mk_join(m_rw.get_used_dependencies(), g->dep(idx));
|
||||
|
@ -307,27 +307,27 @@ public:
|
|||
m_imp = alloc(imp, m, p);
|
||||
}
|
||||
|
||||
virtual tactic * translate(ast_manager & m) {
|
||||
tactic * translate(ast_manager & m) override {
|
||||
return alloc(lia2pb_tactic, m, m_params);
|
||||
}
|
||||
|
||||
virtual ~lia2pb_tactic() {
|
||||
~lia2pb_tactic() override {
|
||||
dealloc(m_imp);
|
||||
}
|
||||
|
||||
virtual void updt_params(params_ref const & p) {
|
||||
void updt_params(params_ref const & p) override {
|
||||
m_params = p;
|
||||
m_imp->updt_params(p);
|
||||
}
|
||||
|
||||
virtual void collect_param_descrs(param_descrs & r) {
|
||||
void collect_param_descrs(param_descrs & r) override {
|
||||
r.insert("lia2pb_partial", CPK_BOOL, "(default: false) partial lia2pb conversion.");
|
||||
r.insert("lia2pb_max_bits", CPK_UINT, "(default: 32) maximum number of bits to be used (per variable) in lia2pb.");
|
||||
r.insert("lia2pb_total_bits", CPK_UINT, "(default: 2048) total number of bits to be used (per problem) in lia2pb.");
|
||||
}
|
||||
|
||||
virtual void operator()(goal_ref const & in,
|
||||
goal_ref_buffer & result) {
|
||||
void operator()(goal_ref const & in,
|
||||
goal_ref_buffer & result) override {
|
||||
try {
|
||||
(*m_imp)(in, result);
|
||||
}
|
||||
|
@ -336,7 +336,7 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
virtual void cleanup() {
|
||||
void cleanup() override {
|
||||
imp * d = alloc(imp, m_imp->m, m_params);
|
||||
std::swap(d, m_imp);
|
||||
dealloc(d);
|
||||
|
|
|
@ -174,7 +174,7 @@ linear_equation * linear_equation_manager::mk(unsigned sz, mpz * as, var * xs, b
|
|||
}
|
||||
sz = j;
|
||||
if (sz <= 1)
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
else {
|
||||
DEBUG_CODE({
|
||||
|
@ -265,7 +265,7 @@ linear_equation * linear_equation_manager::mk(mpz const & b1, linear_equation co
|
|||
m.del(new_a);
|
||||
SASSERT(m_int_buffer.size() == m_var_buffer.size());
|
||||
if (m_int_buffer.empty())
|
||||
return 0;
|
||||
return nullptr;
|
||||
return mk_core(m_int_buffer.size(), m_int_buffer.c_ptr(), m_var_buffer.c_ptr());
|
||||
}
|
||||
|
||||
|
|
|
@ -74,7 +74,7 @@ class nla2bv_tactic : public tactic {
|
|||
m_vars(m),
|
||||
m_defs(m),
|
||||
m_trail(m),
|
||||
m_fmc(0) {
|
||||
m_fmc(nullptr) {
|
||||
m_default_bv_size = m_num_bits = p.get_uint("nla2bv_bv_size", 4);
|
||||
}
|
||||
|
||||
|
@ -406,28 +406,28 @@ class nla2bv_tactic : public tactic {
|
|||
}
|
||||
|
||||
~scoped_set_imp() {
|
||||
m_owner.m_imp = 0;
|
||||
m_owner.m_imp = nullptr;
|
||||
}
|
||||
};
|
||||
|
||||
public:
|
||||
nla2bv_tactic(params_ref const & p):
|
||||
m_params(p),
|
||||
m_imp(0) {
|
||||
m_imp(nullptr) {
|
||||
}
|
||||
|
||||
virtual tactic * translate(ast_manager & m) {
|
||||
tactic * translate(ast_manager & m) override {
|
||||
return alloc(nla2bv_tactic, m_params);
|
||||
}
|
||||
|
||||
virtual ~nla2bv_tactic() {
|
||||
~nla2bv_tactic() override {
|
||||
}
|
||||
|
||||
virtual void updt_params(params_ref const & p) {
|
||||
void updt_params(params_ref const & p) override {
|
||||
m_params = p;
|
||||
}
|
||||
|
||||
virtual void collect_param_descrs(param_descrs & r) {
|
||||
void collect_param_descrs(param_descrs & r) override {
|
||||
r.insert("nla2bv_max_bv_size", CPK_UINT, "(default: inf) maximum bit-vector size used by nla2bv tactic");
|
||||
r.insert("nla2bv_bv_size", CPK_UINT, "(default: 4) default bit-vector size used by nla2bv tactic.");
|
||||
r.insert("nla2bv_root", CPK_UINT, "(default: 2) nla2bv tactic encodes reals into bit-vectors using expressions of the form a+b*sqrt(c), this parameter sets the value of c used in the encoding.");
|
||||
|
@ -439,8 +439,8 @@ public:
|
|||
arithmetic in place of non-linear integer arithmetic.
|
||||
\return false if transformation is not possible.
|
||||
*/
|
||||
virtual void operator()(goal_ref const & g,
|
||||
goal_ref_buffer & result) {
|
||||
void operator()(goal_ref const & g,
|
||||
goal_ref_buffer & result) override {
|
||||
SASSERT(g->is_well_sorted());
|
||||
fail_if_proof_generation("nla2bv", g);
|
||||
fail_if_unsat_core_generation("nla2bv", g);
|
||||
|
@ -455,7 +455,7 @@ public:
|
|||
SASSERT(g->is_well_sorted());
|
||||
}
|
||||
|
||||
virtual void cleanup(void) {
|
||||
void cleanup() override {
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -92,7 +92,7 @@ class normalize_bounds_tactic : public tactic {
|
|||
return;
|
||||
}
|
||||
|
||||
generic_model_converter * gmc = 0;
|
||||
generic_model_converter * gmc = nullptr;
|
||||
if (produce_models) {
|
||||
gmc = alloc(generic_model_converter, m, "normalize_bounds");
|
||||
in->add(gmc);
|
||||
|
@ -105,7 +105,7 @@ class normalize_bounds_tactic : public tactic {
|
|||
if (is_target(x, val)) {
|
||||
num_norm_bounds++;
|
||||
sort * s = m.get_sort(x);
|
||||
app * x_prime = m.mk_fresh_const(0, s);
|
||||
app * x_prime = m.mk_fresh_const(nullptr, s);
|
||||
expr * def = m_util.mk_add(x_prime, m_util.mk_numeral(val, s));
|
||||
subst.insert(x, def);
|
||||
if (produce_models) {
|
||||
|
@ -145,25 +145,25 @@ public:
|
|||
m_imp = alloc(imp, m, p);
|
||||
}
|
||||
|
||||
virtual tactic * translate(ast_manager & m) {
|
||||
tactic * translate(ast_manager & m) override {
|
||||
return alloc(normalize_bounds_tactic, m, m_params);
|
||||
}
|
||||
|
||||
virtual ~normalize_bounds_tactic() {
|
||||
~normalize_bounds_tactic() override {
|
||||
dealloc(m_imp);
|
||||
}
|
||||
|
||||
virtual void updt_params(params_ref const & p) {
|
||||
void updt_params(params_ref const & p) override {
|
||||
m_imp->updt_params(p);
|
||||
}
|
||||
|
||||
virtual void collect_param_descrs(param_descrs & r) {
|
||||
void collect_param_descrs(param_descrs & r) override {
|
||||
insert_produce_models(r);
|
||||
r.insert("norm_int_only", CPK_BOOL, "(default: true) normalize only the bounds of integer constants.");
|
||||
}
|
||||
|
||||
virtual void operator()(goal_ref const & in,
|
||||
goal_ref_buffer & result) {
|
||||
void operator()(goal_ref const & in,
|
||||
goal_ref_buffer & result) override {
|
||||
try {
|
||||
(*m_imp)(in, result);
|
||||
}
|
||||
|
@ -172,7 +172,7 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
virtual void cleanup() {
|
||||
void cleanup() override {
|
||||
ast_manager & m = m_imp->m;
|
||||
imp * d = alloc(imp, m, m_params);
|
||||
std::swap(d, m_imp);
|
||||
|
|
|
@ -38,7 +38,7 @@ pb2bv_model_converter::pb2bv_model_converter(ast_manager & _m, obj_map<func_decl
|
|||
if (!c2bit.contains(d)) {
|
||||
SASSERT(d->get_arity() == 0);
|
||||
m.inc_ref(d);
|
||||
m_c2bit.push_back(func_decl_pair(d, static_cast<func_decl*>(0)));
|
||||
m_c2bit.push_back(func_decl_pair(d, static_cast<func_decl*>(nullptr)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -62,7 +62,7 @@ void pb2bv_model_converter::operator()(model_ref & md) {
|
|||
for (auto const& kv : m_c2bit) {
|
||||
if (kv.second) {
|
||||
expr * val = md->get_const_interp(kv.second);
|
||||
if (val == 0 || m.is_false(val)) {
|
||||
if (val == nullptr || m.is_false(val)) {
|
||||
/* false's and don't cares get the integer 0 solution*/
|
||||
md->register_decl(kv.first, a_util.mk_numeral(rational(0), true));
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ class pb2bv_model_converter : public model_converter {
|
|||
public:
|
||||
pb2bv_model_converter(ast_manager & _m);
|
||||
pb2bv_model_converter(ast_manager & _m, obj_map<func_decl, expr*> const & c2bit, bound_manager const & bm);
|
||||
virtual ~pb2bv_model_converter();
|
||||
~pb2bv_model_converter() override;
|
||||
void operator()(model_ref & md) override;
|
||||
void display(std::ostream & out) override;
|
||||
void get_units(obj_map<expr, bool>& units) override;
|
||||
|
|
|
@ -216,7 +216,7 @@ private:
|
|||
}
|
||||
|
||||
bool get_subst(expr * s, expr * & t, proof * & t_pr) {
|
||||
t_pr = 0;
|
||||
t_pr = nullptr;
|
||||
if (owner.is_constraint_core(s)) {
|
||||
owner.convert(to_app(s), m_saved_res, true, false);
|
||||
t = m_saved_res;
|
||||
|
@ -328,12 +328,12 @@ private:
|
|||
func_decl * fd = x->get_decl();
|
||||
obj_map<func_decl, expr*> & const2lit = sign ? m_not_const2bit : m_const2bit;
|
||||
|
||||
expr * r = 0;
|
||||
expr * r = nullptr;
|
||||
const2lit.find(fd, r);
|
||||
if (r != 0)
|
||||
if (r != nullptr)
|
||||
return r;
|
||||
|
||||
r = m.mk_fresh_const(0, m.mk_bool_sort());
|
||||
r = m.mk_fresh_const(nullptr, m.mk_bool_sort());
|
||||
expr * not_r = m.mk_not(r);
|
||||
m_const2bit.insert(fd, r);
|
||||
m_not_const2bit.insert(fd, not_r);
|
||||
|
@ -490,7 +490,7 @@ private:
|
|||
for (unsigned j = 0; j < i; j++)
|
||||
m_clause.push_back(monomial(numeral(1), m_p[j].m_lit));
|
||||
|
||||
app * new_var = m.mk_fresh_const(0, m_arith_util.mk_int());
|
||||
app * new_var = m.mk_fresh_const(nullptr, m_arith_util.mk_int());
|
||||
m_temporary_ints.push_back(new_var);
|
||||
|
||||
m_clause.push_back(monomial(numeral(1), lit(new_var, true)));
|
||||
|
@ -943,7 +943,7 @@ private:
|
|||
}
|
||||
|
||||
for (unsigned idx = 0; idx < size; idx++)
|
||||
g->update(idx, new_exprs[idx].get(), 0, (m_produce_unsat_cores) ? new_deps[idx].get() : g->dep(idx));
|
||||
g->update(idx, new_exprs[idx].get(), nullptr, (m_produce_unsat_cores) ? new_deps[idx].get() : g->dep(idx));
|
||||
|
||||
if (m_produce_models) {
|
||||
model_converter_ref mc;
|
||||
|
@ -980,29 +980,29 @@ public:
|
|||
m_imp = alloc(imp, m, p);
|
||||
}
|
||||
|
||||
virtual tactic * translate(ast_manager & m) {
|
||||
tactic * translate(ast_manager & m) override {
|
||||
return alloc(pb2bv_tactic, m, m_params);
|
||||
}
|
||||
|
||||
virtual ~pb2bv_tactic() {
|
||||
~pb2bv_tactic() override {
|
||||
dealloc(m_imp);
|
||||
}
|
||||
|
||||
virtual void updt_params(params_ref const & p) {
|
||||
void updt_params(params_ref const & p) override {
|
||||
m_params = p;
|
||||
m_imp->updt_params(p);
|
||||
}
|
||||
|
||||
virtual void collect_param_descrs(param_descrs & r) {
|
||||
void collect_param_descrs(param_descrs & r) override {
|
||||
m_imp->collect_param_descrs(r);
|
||||
}
|
||||
|
||||
virtual void operator()(goal_ref const & in,
|
||||
goal_ref_buffer & result) {
|
||||
void operator()(goal_ref const & in,
|
||||
goal_ref_buffer & result) override {
|
||||
(*m_imp)(in, result);
|
||||
}
|
||||
|
||||
virtual void cleanup() {
|
||||
void cleanup() override {
|
||||
ast_manager & m = m_imp->m;
|
||||
imp * d = alloc(imp, m, m_params);
|
||||
std::swap(d, m_imp);
|
||||
|
@ -1017,7 +1017,7 @@ tactic * mk_pb2bv_tactic(ast_manager & m, params_ref const & p) {
|
|||
}
|
||||
|
||||
struct is_pb_probe : public probe {
|
||||
virtual result operator()(goal const & g) {
|
||||
result operator()(goal const & g) override {
|
||||
try {
|
||||
ast_manager & m = g.m();
|
||||
bound_manager bm(m);
|
||||
|
|
|
@ -74,7 +74,7 @@ class arith_degree_probe : public probe {
|
|||
public:
|
||||
arith_degree_probe(bool avg):m_avg(avg) {}
|
||||
|
||||
virtual result operator()(goal const & g) {
|
||||
result operator()(goal const & g) override {
|
||||
proc p(g.m());
|
||||
for_each_expr_at(p, g);
|
||||
if (m_avg)
|
||||
|
@ -117,7 +117,7 @@ class arith_bw_probe : public probe {
|
|||
public:
|
||||
arith_bw_probe(bool avg):m_avg(avg) {}
|
||||
|
||||
virtual result operator()(goal const & g) {
|
||||
result operator()(goal const & g) override {
|
||||
proc p(g.m());
|
||||
for_each_expr_at(p, g);
|
||||
if (m_avg)
|
||||
|
@ -269,14 +269,14 @@ static bool is_qfauflia(goal const & g) {
|
|||
|
||||
class is_qflia_probe : public probe {
|
||||
public:
|
||||
virtual result operator()(goal const & g) {
|
||||
result operator()(goal const & g) override {
|
||||
return is_qflia(g);
|
||||
}
|
||||
};
|
||||
|
||||
class is_qfauflia_probe : public probe {
|
||||
public:
|
||||
virtual result operator()(goal const & g) {
|
||||
result operator()(goal const & g) override {
|
||||
return is_qfauflia(g);
|
||||
}
|
||||
};
|
||||
|
@ -288,7 +288,7 @@ static bool is_qflra(goal const & g) {
|
|||
|
||||
class is_qflra_probe : public probe {
|
||||
public:
|
||||
virtual result operator()(goal const & g) {
|
||||
result operator()(goal const & g) override {
|
||||
return is_qflra(g);
|
||||
}
|
||||
};
|
||||
|
@ -300,7 +300,7 @@ static bool is_qflira(goal const & g) {
|
|||
|
||||
class is_qflira_probe : public probe {
|
||||
public:
|
||||
virtual result operator()(goal const & g) {
|
||||
result operator()(goal const & g) override {
|
||||
return is_qflira(g);
|
||||
}
|
||||
};
|
||||
|
@ -344,14 +344,14 @@ static bool is_mip(goal const & g) {
|
|||
|
||||
class is_ilp_probe : public probe {
|
||||
public:
|
||||
virtual result operator()(goal const & g) {
|
||||
result operator()(goal const & g) override {
|
||||
return is_ilp(g);
|
||||
}
|
||||
};
|
||||
|
||||
class is_mip_probe : public probe {
|
||||
public:
|
||||
virtual result operator()(goal const & g) {
|
||||
result operator()(goal const & g) override {
|
||||
return is_mip(g);
|
||||
}
|
||||
};
|
||||
|
@ -583,56 +583,56 @@ struct is_non_qfufnra_functor {
|
|||
|
||||
class is_qfnia_probe : public probe {
|
||||
public:
|
||||
virtual result operator()(goal const & g) {
|
||||
result operator()(goal const & g) override {
|
||||
return is_qfnia(g);
|
||||
}
|
||||
};
|
||||
|
||||
class is_qfnra_probe : public probe {
|
||||
public:
|
||||
virtual result operator()(goal const & g) {
|
||||
result operator()(goal const & g) override {
|
||||
return is_qfnra(g);
|
||||
}
|
||||
};
|
||||
|
||||
class is_nia_probe : public probe {
|
||||
public:
|
||||
virtual result operator()(goal const & g) {
|
||||
result operator()(goal const & g) override {
|
||||
return is_nia(g);
|
||||
}
|
||||
};
|
||||
|
||||
class is_nra_probe : public probe {
|
||||
public:
|
||||
virtual result operator()(goal const & g) {
|
||||
result operator()(goal const & g) override {
|
||||
return is_nra(g);
|
||||
}
|
||||
};
|
||||
|
||||
class is_nira_probe : public probe {
|
||||
public:
|
||||
virtual result operator()(goal const & g) {
|
||||
result operator()(goal const & g) override {
|
||||
return is_nira(g);
|
||||
}
|
||||
};
|
||||
|
||||
class is_lia_probe : public probe {
|
||||
public:
|
||||
virtual result operator()(goal const & g) {
|
||||
result operator()(goal const & g) override {
|
||||
return is_lia(g);
|
||||
}
|
||||
};
|
||||
|
||||
class is_lra_probe : public probe {
|
||||
public:
|
||||
virtual result operator()(goal const & g) {
|
||||
result operator()(goal const & g) override {
|
||||
return is_lra(g);
|
||||
}
|
||||
};
|
||||
|
||||
class is_lira_probe : public probe {
|
||||
public:
|
||||
virtual result operator()(goal const & g) {
|
||||
result operator()(goal const & g) override {
|
||||
return is_lira(g);
|
||||
}
|
||||
};
|
||||
|
@ -644,7 +644,7 @@ static bool is_qfufnra(goal const& g) {
|
|||
|
||||
class is_qfufnra_probe : public probe {
|
||||
public:
|
||||
virtual result operator()(goal const & g) {
|
||||
result operator()(goal const & g) override {
|
||||
return is_qfufnra(g);
|
||||
}
|
||||
};
|
||||
|
|
|
@ -43,18 +43,18 @@ class propagate_ineqs_tactic : public tactic {
|
|||
public:
|
||||
propagate_ineqs_tactic(ast_manager & m, params_ref const & p);
|
||||
|
||||
virtual tactic * translate(ast_manager & m) {
|
||||
tactic * translate(ast_manager & m) override {
|
||||
return alloc(propagate_ineqs_tactic, m, m_params);
|
||||
}
|
||||
|
||||
virtual ~propagate_ineqs_tactic();
|
||||
~propagate_ineqs_tactic() override;
|
||||
|
||||
virtual void updt_params(params_ref const & p);
|
||||
virtual void collect_param_descrs(param_descrs & r) {}
|
||||
void updt_params(params_ref const & p) override;
|
||||
void collect_param_descrs(param_descrs & r) override {}
|
||||
|
||||
virtual void operator()(goal_ref const & g, goal_ref_buffer & result);
|
||||
void operator()(goal_ref const & g, goal_ref_buffer & result) override;
|
||||
|
||||
virtual void cleanup();
|
||||
void cleanup() override;
|
||||
};
|
||||
|
||||
tactic * mk_propagate_ineqs_tactic(ast_manager & m, params_ref const & p) {
|
||||
|
@ -354,7 +354,7 @@ struct propagate_ineqs_tactic::imp {
|
|||
void find_ite_bounds(expr * root) {
|
||||
TRACE("find_ite_bounds_bug", display_bounds(tout););
|
||||
expr * n = root;
|
||||
expr * target = 0;
|
||||
expr * target = nullptr;
|
||||
expr * c, * t, * e;
|
||||
expr * x, * y;
|
||||
bool has_l, has_u;
|
||||
|
@ -374,7 +374,7 @@ struct propagate_ineqs_tactic::imp {
|
|||
break;
|
||||
}
|
||||
else if (is_x_minus_y_eq_0(n, x, y)) {
|
||||
n = 0;
|
||||
n = nullptr;
|
||||
}
|
||||
else {
|
||||
break;
|
||||
|
@ -394,7 +394,7 @@ struct propagate_ineqs_tactic::imp {
|
|||
break;
|
||||
}
|
||||
|
||||
if (target == 0) {
|
||||
if (target == nullptr) {
|
||||
target = x;
|
||||
if (lower(y, curr, curr_strict)) {
|
||||
has_l = true;
|
||||
|
@ -448,7 +448,7 @@ struct propagate_ineqs_tactic::imp {
|
|||
if (!has_l && !has_u)
|
||||
break;
|
||||
|
||||
if (n == 0) {
|
||||
if (n == nullptr) {
|
||||
TRACE("find_ite_bounds", tout << "found bounds for: " << mk_ismt2_pp(target, m) << "\n";
|
||||
tout << "has_l: " << has_l << " " << nm.to_string(l_min) << " l_strict: " << l_strict << "\n";
|
||||
tout << "has_u: " << has_u << " " << nm.to_string(u_max) << " u_strict: " << u_strict << "\n";
|
||||
|
@ -484,7 +484,7 @@ struct propagate_ineqs_tactic::imp {
|
|||
m_new_goal->inc_depth();
|
||||
r = m_new_goal.get();
|
||||
if (!collect_bounds(*g)) {
|
||||
m_new_goal = 0;
|
||||
m_new_goal = nullptr;
|
||||
r = g;
|
||||
return; // nothing to be done
|
||||
}
|
||||
|
|
|
@ -169,8 +169,8 @@ struct purify_arith_proc {
|
|||
}
|
||||
std::pair<expr*, expr*> pair;
|
||||
if (!m_sin_cos.find(to_app(theta), pair)) {
|
||||
pair.first = m().mk_fresh_const(0, u().mk_real());
|
||||
pair.second = m().mk_fresh_const(0, u().mk_real());
|
||||
pair.first = m().mk_fresh_const(nullptr, u().mk_real());
|
||||
pair.second = m().mk_fresh_const(nullptr, u().mk_real());
|
||||
m_sin_cos.insert(to_app(theta), pair);
|
||||
m_pinned.push_back(pair.first);
|
||||
m_pinned.push_back(pair.second);
|
||||
|
@ -213,7 +213,7 @@ struct purify_arith_proc {
|
|||
bool elim_inverses() const { return m_owner.m_elim_inverses; }
|
||||
|
||||
expr * mk_fresh_var(bool is_int) {
|
||||
expr * r = m().mk_fresh_const(0, is_int ? u().mk_int() : u().mk_real());
|
||||
expr * r = m().mk_fresh_const(nullptr, is_int ? u().mk_int() : u().mk_real());
|
||||
m_new_vars.push_back(r);
|
||||
return r;
|
||||
}
|
||||
|
@ -240,7 +240,7 @@ struct purify_arith_proc {
|
|||
}
|
||||
|
||||
void mk_def_proof(expr * k, expr * def, proof_ref & result_pr) {
|
||||
result_pr = 0;
|
||||
result_pr = nullptr;
|
||||
if (produce_proofs()) {
|
||||
expr * eq = m().mk_eq(k, def);
|
||||
proof * pr1 = m().mk_def_intro(eq);
|
||||
|
@ -690,7 +690,7 @@ struct purify_arith_proc {
|
|||
};
|
||||
|
||||
void process_quantifier(quantifier * q, expr_ref & result, proof_ref & result_pr) {
|
||||
result_pr = 0;
|
||||
result_pr = nullptr;
|
||||
rw r(*this);
|
||||
expr_ref new_body(m());
|
||||
proof_ref new_body_pr(m());
|
||||
|
@ -760,7 +760,7 @@ struct purify_arith_proc {
|
|||
sz = r.cfg().m_new_cnstrs.size();
|
||||
TRACE("purify_arith", tout << r.cfg().m_new_cnstrs << "\n";);
|
||||
for (unsigned i = 0; i < sz; i++) {
|
||||
m_goal.assert_expr(r.cfg().m_new_cnstrs.get(i), m_produce_proofs ? r.cfg().m_new_cnstr_prs.get(i) : 0, 0);
|
||||
m_goal.assert_expr(r.cfg().m_new_cnstrs.get(i), m_produce_proofs ? r.cfg().m_new_cnstr_prs.get(i) : nullptr, nullptr);
|
||||
}
|
||||
|
||||
// add generic_model_converter to eliminate auxiliary variables from model
|
||||
|
@ -799,18 +799,18 @@ public:
|
|||
m_params(p) {
|
||||
}
|
||||
|
||||
virtual tactic * translate(ast_manager & m) {
|
||||
tactic * translate(ast_manager & m) override {
|
||||
return alloc(purify_arith_tactic, m, m_params);
|
||||
}
|
||||
|
||||
virtual ~purify_arith_tactic() {
|
||||
~purify_arith_tactic() override {
|
||||
}
|
||||
|
||||
virtual void updt_params(params_ref const & p) {
|
||||
void updt_params(params_ref const & p) override {
|
||||
m_params = p;
|
||||
}
|
||||
|
||||
virtual void collect_param_descrs(param_descrs & r) {
|
||||
void collect_param_descrs(param_descrs & r) override {
|
||||
r.insert("complete", CPK_BOOL,
|
||||
"(default: true) add constraints to make sure that any interpretation of a underspecified arithmetic operators is a function. The result will include additional uninterpreted functions/constants: /0, div0, mod0, 0^0, neg-root");
|
||||
r.insert("elim_root_objects", CPK_BOOL,
|
||||
|
@ -820,8 +820,8 @@ public:
|
|||
th_rewriter::get_param_descrs(r);
|
||||
}
|
||||
|
||||
virtual void operator()(goal_ref const & g,
|
||||
goal_ref_buffer & result) {
|
||||
void operator()(goal_ref const & g,
|
||||
goal_ref_buffer & result) override {
|
||||
try {
|
||||
SASSERT(g->is_well_sorted());
|
||||
tactic_report report("purify-arith", *g);
|
||||
|
@ -845,7 +845,7 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
virtual void cleanup() {
|
||||
void cleanup() override {
|
||||
}
|
||||
|
||||
};
|
||||
|
|
|
@ -16,7 +16,7 @@ Abstract:
|
|||
Remarks:
|
||||
- The semantics of division by zero is not specified. Thus,
|
||||
uninterpreted functions are used. An ExRCF procedure may
|
||||
treat the unintepreted function applications as fresh
|
||||
treat the uninterpreted function applications as fresh
|
||||
constants. Then, in any model produced by this procedure,
|
||||
the interpretation for division by zero must be checked.
|
||||
|
||||
|
|
|
@ -69,7 +69,7 @@ class recover_01_tactic : public tactic {
|
|||
bool save_clause(expr * c) {
|
||||
if (!m.is_or(c))
|
||||
return false;
|
||||
func_decl * x = 0;
|
||||
func_decl * x = nullptr;
|
||||
app * cls = to_app(c);
|
||||
if (cls->get_num_args() <= 1 || cls->get_num_args() >= m_cls_max_size)
|
||||
return false;
|
||||
|
@ -83,7 +83,7 @@ class recover_01_tactic : public tactic {
|
|||
else if (m.is_not(lit, arg) && is_uninterp_const(arg)) {
|
||||
// negative literal
|
||||
}
|
||||
else if (x == 0 && m.is_eq(lit, lhs, rhs)) {
|
||||
else if (x == nullptr && m.is_eq(lit, lhs, rhs)) {
|
||||
// x = k literal
|
||||
if (is_uninterp_const(lhs) && m_util.is_numeral(rhs)) {
|
||||
x = to_app(lhs)->get_decl();
|
||||
|
@ -100,7 +100,7 @@ class recover_01_tactic : public tactic {
|
|||
}
|
||||
}
|
||||
|
||||
if (x != 0) {
|
||||
if (x != nullptr) {
|
||||
var2clauses::obj_map_entry * entry = m_var2clauses.insert_if_not_there2(x, ptr_vector<app>());
|
||||
if (entry->get_data().m_value.empty() || entry->get_data().m_value.back()->get_num_args() == cls->get_num_args()) {
|
||||
entry->get_data().m_value.push_back(cls);
|
||||
|
@ -132,7 +132,7 @@ class recover_01_tactic : public tactic {
|
|||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// Find coeff (the k of literal (x = k)) of clause cls.
|
||||
|
@ -197,7 +197,7 @@ class recover_01_tactic : public tactic {
|
|||
SASSERT(is_uninterp_const(atom));
|
||||
expr * var;
|
||||
if (!bool2int.find(atom, var)) {
|
||||
var = m.mk_fresh_const(0, m_util.mk_int());
|
||||
var = m.mk_fresh_const(nullptr, m_util.mk_int());
|
||||
new_goal->assert_expr(m_util.mk_le(m_util.mk_numeral(rational(0), true), var));
|
||||
new_goal->assert_expr(m_util.mk_le(var, m_util.mk_numeral(rational(1), true)));
|
||||
expr * bool_def = m.mk_eq(var, m_util.mk_numeral(rational(1), true));
|
||||
|
@ -223,7 +223,7 @@ class recover_01_tactic : public tactic {
|
|||
if (clauses.size() < expected_num_clauses) // using < instead of != because we tolerate duplicates
|
||||
return false;
|
||||
app * zero_cls = find_zero_cls(x, clauses);
|
||||
if (zero_cls == 0)
|
||||
if (zero_cls == nullptr)
|
||||
return false;
|
||||
|
||||
buffer<bool> found; // marks which idx were found
|
||||
|
@ -381,26 +381,26 @@ public:
|
|||
m_imp = alloc(imp, m, p);
|
||||
}
|
||||
|
||||
virtual tactic * translate(ast_manager & m) {
|
||||
tactic * translate(ast_manager & m) override {
|
||||
return alloc(recover_01_tactic, m, m_params);
|
||||
}
|
||||
|
||||
virtual ~recover_01_tactic() {
|
||||
~recover_01_tactic() override {
|
||||
dealloc(m_imp);
|
||||
}
|
||||
|
||||
virtual void updt_params(params_ref const & p) {
|
||||
void updt_params(params_ref const & p) override {
|
||||
m_params = p;
|
||||
m_imp->updt_params(p);
|
||||
}
|
||||
|
||||
virtual void collect_param_descrs(param_descrs & r) {
|
||||
void collect_param_descrs(param_descrs & r) override {
|
||||
th_rewriter::get_param_descrs(r);
|
||||
r.insert("recover_01_max_bits", CPK_UINT, "(default: 10) maximum number of bits to consider in a clause.");
|
||||
}
|
||||
|
||||
void operator()(goal_ref const & g,
|
||||
goal_ref_buffer & result) {
|
||||
goal_ref_buffer & result) override {
|
||||
try {
|
||||
(*m_imp)(g, result);
|
||||
}
|
||||
|
@ -409,7 +409,7 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
virtual void cleanup() {
|
||||
void cleanup() override {
|
||||
imp * d = alloc(imp, m_imp->m, m_params);
|
||||
std::swap(d, m_imp);
|
||||
dealloc(d);
|
||||
|
|
|
@ -52,7 +52,7 @@ struct bit_blaster_model_converter : public model_converter {
|
|||
m_newbits.push_back(f);
|
||||
}
|
||||
|
||||
virtual ~bit_blaster_model_converter() {
|
||||
~bit_blaster_model_converter() override {
|
||||
}
|
||||
|
||||
void collect_bits(obj_hashtable<func_decl> & bits) {
|
||||
|
@ -123,7 +123,7 @@ struct bit_blaster_model_converter : public model_converter {
|
|||
SASSERT(is_uninterp_const(bit));
|
||||
func_decl * bit_decl = to_app(bit)->get_decl();
|
||||
expr * bit_val = old_model->get_const_interp(bit_decl);
|
||||
if (bit_val == 0) {
|
||||
if (bit_val == nullptr) {
|
||||
goto bail;
|
||||
}
|
||||
if (m().is_true(bit_val))
|
||||
|
@ -141,7 +141,7 @@ struct bit_blaster_model_converter : public model_converter {
|
|||
func_decl * bit_decl = to_app(bit)->get_decl();
|
||||
expr * bit_val = old_model->get_const_interp(bit_decl);
|
||||
// remark: if old_model does not assign bit_val, then assume it is false.
|
||||
if (bit_val == 0) {
|
||||
if (bit_val == nullptr) {
|
||||
goto bail;
|
||||
}
|
||||
if (!util.is_zero(bit_val))
|
||||
|
|
|
@ -110,21 +110,21 @@ public:
|
|||
m_imp = alloc(imp, m, m_rewriter, p);
|
||||
}
|
||||
|
||||
virtual tactic * translate(ast_manager & m) {
|
||||
tactic * translate(ast_manager & m) override {
|
||||
SASSERT(!m_rewriter); // assume translation isn't used where rewriter is external.
|
||||
return alloc(bit_blaster_tactic, m, 0, m_params);
|
||||
return alloc(bit_blaster_tactic, m, nullptr, m_params);
|
||||
}
|
||||
|
||||
virtual ~bit_blaster_tactic() {
|
||||
~bit_blaster_tactic() override {
|
||||
dealloc(m_imp);
|
||||
}
|
||||
|
||||
virtual void updt_params(params_ref const & p) {
|
||||
void updt_params(params_ref const & p) override {
|
||||
m_params = p;
|
||||
m_imp->updt_params(p);
|
||||
}
|
||||
|
||||
virtual void collect_param_descrs(param_descrs & r) {
|
||||
void collect_param_descrs(param_descrs & r) override {
|
||||
insert_max_memory(r);
|
||||
insert_max_steps(r);
|
||||
r.insert("blast_mul", CPK_BOOL, "(default: true) bit-blast multipliers (and dividers, remainders).");
|
||||
|
@ -133,8 +133,8 @@ public:
|
|||
r.insert("blast_full", CPK_BOOL, "(default: false) bit-blast any term with bit-vector sort, this option will make E-matching ineffective in any pattern containing bit-vector terms.");
|
||||
}
|
||||
|
||||
virtual void operator()(goal_ref const & g,
|
||||
goal_ref_buffer & result) {
|
||||
void operator()(goal_ref const & g,
|
||||
goal_ref_buffer & result) override {
|
||||
try {
|
||||
(*m_imp)(g, result);
|
||||
}
|
||||
|
@ -143,7 +143,7 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
virtual void cleanup() {
|
||||
void cleanup() override {
|
||||
imp * d = alloc(imp, m_imp->m(), m_rewriter, m_params);
|
||||
std::swap(d, m_imp);
|
||||
dealloc(d);
|
||||
|
@ -158,7 +158,7 @@ public:
|
|||
|
||||
|
||||
tactic * mk_bit_blaster_tactic(ast_manager & m, params_ref const & p) {
|
||||
return clean(alloc(bit_blaster_tactic, m, 0, p));
|
||||
return clean(alloc(bit_blaster_tactic, m, nullptr, p));
|
||||
}
|
||||
|
||||
tactic * mk_bit_blaster_tactic(ast_manager & m, bit_blaster_rewriter* rw, params_ref const & p) {
|
||||
|
|
|
@ -107,7 +107,7 @@ class bv1_blaster_tactic : public tactic {
|
|||
sort * b = butil().mk_sort(1);
|
||||
ptr_buffer<expr> bits;
|
||||
for (unsigned i = 0; i < bv_size; i++) {
|
||||
bits.push_back(m().mk_fresh_const(0, b));
|
||||
bits.push_back(m().mk_fresh_const(nullptr, b));
|
||||
m_newbits.push_back(to_app(bits.back())->get_decl());
|
||||
}
|
||||
r = butil().mk_concat(bits.size(), bits.c_ptr());
|
||||
|
@ -255,7 +255,7 @@ class bv1_blaster_tactic : public tactic {
|
|||
}
|
||||
|
||||
br_status reduce_app(func_decl * f, unsigned num, expr * const * args, expr_ref & result, proof_ref & result_pr) {
|
||||
result_pr = 0;
|
||||
result_pr = nullptr;
|
||||
if (num == 0 && f->get_family_id() == null_family_id && butil().is_bv_sort(f->get_range())) {
|
||||
mk_const(f, result);
|
||||
return BR_DONE;
|
||||
|
@ -424,20 +424,20 @@ public:
|
|||
m_imp = alloc(imp, m, p);
|
||||
}
|
||||
|
||||
virtual tactic * translate(ast_manager & m) {
|
||||
tactic * translate(ast_manager & m) override {
|
||||
return alloc(bv1_blaster_tactic, m, m_params);
|
||||
}
|
||||
|
||||
virtual ~bv1_blaster_tactic() {
|
||||
~bv1_blaster_tactic() override {
|
||||
dealloc(m_imp);
|
||||
}
|
||||
|
||||
virtual void updt_params(params_ref const & p) {
|
||||
void updt_params(params_ref const & p) override {
|
||||
m_params = p;
|
||||
m_imp->m_rw.cfg().updt_params(p);
|
||||
}
|
||||
|
||||
virtual void collect_param_descrs(param_descrs & r) {
|
||||
void collect_param_descrs(param_descrs & r) override {
|
||||
insert_max_memory(r);
|
||||
insert_max_steps(r);
|
||||
}
|
||||
|
@ -452,12 +452,12 @@ public:
|
|||
It also does not support quantifiers.
|
||||
Return a model_converter that converts any model for the updated set into a model for the old set.
|
||||
*/
|
||||
virtual void operator()(goal_ref const & g,
|
||||
goal_ref_buffer & result) {
|
||||
void operator()(goal_ref const & g,
|
||||
goal_ref_buffer & result) override {
|
||||
(*m_imp)(g, result);
|
||||
}
|
||||
|
||||
virtual void cleanup() {
|
||||
void cleanup() override {
|
||||
imp * d = alloc(imp, m_imp->m(), m_params);
|
||||
std::swap(d, m_imp);
|
||||
dealloc(d);
|
||||
|
@ -475,7 +475,7 @@ tactic * mk_bv1_blaster_tactic(ast_manager & m, params_ref const & p) {
|
|||
|
||||
class is_qfbv_eq_probe : public probe {
|
||||
public:
|
||||
virtual result operator()(goal const & g) {
|
||||
result operator()(goal const & g) override {
|
||||
bv1_blaster_tactic t(g.m());
|
||||
return t.is_target(g);
|
||||
|
||||
|
|
|
@ -68,7 +68,7 @@ struct bv_bound_chk_rewriter_cfg : public default_rewriter_cfg {
|
|||
}
|
||||
|
||||
br_status reduce_app_core(func_decl * f, unsigned num, expr * const * args, expr_ref & result, proof_ref & result_pr) {
|
||||
result_pr = 0;
|
||||
result_pr = nullptr;
|
||||
const family_id fid = f->get_family_id();
|
||||
if (fid != m_b_rw.get_fid()) return BR_FAILED;
|
||||
bv_bounds bvb(m());
|
||||
|
@ -111,7 +111,7 @@ struct bv_bound_chk_rewriter : public rewriter_tpl<bv_bound_chk_rewriter_cfg> {
|
|||
updt_params(p);
|
||||
}
|
||||
|
||||
virtual ~bv_bound_chk_rewriter() {}
|
||||
~bv_bound_chk_rewriter() override {}
|
||||
|
||||
void updt_params(params_ref const & _p) {
|
||||
m_cfg.updt_params(_p);
|
||||
|
@ -135,13 +135,13 @@ class bv_bound_chk_tactic : public tactic {
|
|||
bv_bound_chk_stats m_stats;
|
||||
public:
|
||||
bv_bound_chk_tactic(ast_manager & m, params_ref const & p);
|
||||
virtual ~bv_bound_chk_tactic();
|
||||
void operator()(goal_ref const & g, goal_ref_buffer & result) override;
|
||||
virtual tactic * translate(ast_manager & m);
|
||||
virtual void updt_params(params_ref const & p);
|
||||
void cleanup();
|
||||
void collect_statistics(statistics & st) const;
|
||||
void reset_statistics();
|
||||
~bv_bound_chk_tactic() override;
|
||||
tactic * translate(ast_manager & m) override;
|
||||
void updt_params(params_ref const & p) override;
|
||||
void cleanup() override;
|
||||
void collect_statistics(statistics & st) const override;
|
||||
void reset_statistics() override;
|
||||
};
|
||||
|
||||
class bv_bound_chk_tactic::imp {
|
||||
|
|
|
@ -194,7 +194,7 @@ namespace {
|
|||
|
||||
bool is_bound(expr *e, expr*& v, interval& b) const {
|
||||
uint64 n;
|
||||
expr *lhs = 0, *rhs = 0;
|
||||
expr *lhs = nullptr, *rhs = nullptr;
|
||||
unsigned sz;
|
||||
|
||||
if (m_bv.is_bv_ule(e, lhs, rhs)) {
|
||||
|
@ -305,7 +305,7 @@ namespace {
|
|||
updt_params(p);
|
||||
}
|
||||
|
||||
virtual void updt_params(params_ref const & p) {
|
||||
void updt_params(params_ref const & p) override {
|
||||
m_propagate_eq = p.get_bool("propagate_eq", false);
|
||||
}
|
||||
|
||||
|
@ -313,7 +313,7 @@ namespace {
|
|||
r.insert("propagate-eq", CPK_BOOL, "(default: false) propagate equalities from inequalities");
|
||||
}
|
||||
|
||||
virtual ~bv_bounds_simplifier() {
|
||||
~bv_bounds_simplifier() override {
|
||||
for (unsigned i = 0, e = m_expr_vars.size(); i < e; ++i) {
|
||||
dealloc(m_expr_vars[i]);
|
||||
}
|
||||
|
@ -322,7 +322,7 @@ namespace {
|
|||
}
|
||||
}
|
||||
|
||||
virtual bool assert_expr(expr * t, bool sign) {
|
||||
bool assert_expr(expr * t, bool sign) override {
|
||||
while (m.is_not(t, t)) {
|
||||
sign = !sign;
|
||||
}
|
||||
|
@ -353,7 +353,7 @@ namespace {
|
|||
return true;
|
||||
}
|
||||
|
||||
virtual bool simplify(expr* t, expr_ref& result) {
|
||||
bool simplify(expr* t, expr_ref& result) override {
|
||||
expr* t1;
|
||||
interval b;
|
||||
|
||||
|
@ -382,7 +382,7 @@ namespace {
|
|||
}
|
||||
|
||||
interval ctx, intr;
|
||||
result = 0;
|
||||
result = nullptr;
|
||||
|
||||
if (b.is_full() && b.tight) {
|
||||
result = m.mk_true();
|
||||
|
@ -465,7 +465,7 @@ namespace {
|
|||
return false;
|
||||
}
|
||||
|
||||
virtual bool may_simplify(expr* t) {
|
||||
bool may_simplify(expr* t) override {
|
||||
if (m_bv.is_numeral(t))
|
||||
return false;
|
||||
|
||||
|
@ -504,7 +504,7 @@ namespace {
|
|||
return false;
|
||||
}
|
||||
|
||||
virtual void pop(unsigned num_scopes) {
|
||||
void pop(unsigned num_scopes) override {
|
||||
TRACE("bv", tout << "pop: " << num_scopes << "\n";);
|
||||
if (m_scopes.empty())
|
||||
return;
|
||||
|
@ -526,11 +526,11 @@ namespace {
|
|||
m_scopes.shrink(target);
|
||||
}
|
||||
|
||||
virtual simplifier * translate(ast_manager & m) {
|
||||
simplifier * translate(ast_manager & m) override {
|
||||
return alloc(bv_bounds_simplifier, m, m_params);
|
||||
}
|
||||
|
||||
virtual unsigned scope_level() const {
|
||||
unsigned scope_level() const override {
|
||||
return m_scopes.size();
|
||||
}
|
||||
};
|
||||
|
@ -561,7 +561,7 @@ namespace {
|
|||
|
||||
bool is_bound(expr *e, expr*& v, interval& b) const {
|
||||
uint64 n;
|
||||
expr *lhs = 0, *rhs = 0;
|
||||
expr *lhs = nullptr, *rhs = nullptr;
|
||||
unsigned sz = 0;
|
||||
|
||||
if (m_bv.is_bv_ule(e, lhs, rhs)) {
|
||||
|
@ -622,7 +622,7 @@ namespace {
|
|||
r.insert("propagate-eq", CPK_BOOL, "(default: false) propagate equalities from inequalities");
|
||||
}
|
||||
|
||||
virtual ~dom_bv_bounds_simplifier() {
|
||||
~dom_bv_bounds_simplifier() override {
|
||||
for (unsigned i = 0, e = m_expr_vars.size(); i < e; ++i) {
|
||||
dealloc(m_expr_vars[i]);
|
||||
}
|
||||
|
@ -631,7 +631,7 @@ namespace {
|
|||
}
|
||||
}
|
||||
|
||||
virtual bool assert_expr(expr * t, bool sign) {
|
||||
bool assert_expr(expr * t, bool sign) override {
|
||||
while (m.is_not(t, t)) {
|
||||
sign = !sign;
|
||||
}
|
||||
|
@ -662,7 +662,7 @@ namespace {
|
|||
return true;
|
||||
}
|
||||
|
||||
virtual void operator()(expr_ref& r) {
|
||||
void operator()(expr_ref& r) override {
|
||||
expr* t1, * t = r;
|
||||
interval b;
|
||||
|
||||
|
@ -781,7 +781,7 @@ namespace {
|
|||
return false;
|
||||
}
|
||||
|
||||
virtual void pop(unsigned num_scopes) {
|
||||
void pop(unsigned num_scopes) override {
|
||||
TRACE("bv", tout << "pop: " << num_scopes << "\n";);
|
||||
if (m_scopes.empty())
|
||||
return;
|
||||
|
@ -803,11 +803,11 @@ namespace {
|
|||
m_scopes.shrink(target);
|
||||
}
|
||||
|
||||
virtual dom_simplifier * translate(ast_manager & m) {
|
||||
dom_simplifier * translate(ast_manager & m) override {
|
||||
return alloc(dom_bv_bounds_simplifier, m, m_params);
|
||||
}
|
||||
|
||||
virtual unsigned scope_level() const {
|
||||
unsigned scope_level() const override {
|
||||
return m_scopes.size();
|
||||
}
|
||||
|
||||
|
|
|
@ -33,15 +33,15 @@ class bv_size_reduction_tactic : public tactic {
|
|||
public:
|
||||
bv_size_reduction_tactic(ast_manager & m);
|
||||
|
||||
virtual tactic * translate(ast_manager & m) {
|
||||
tactic * translate(ast_manager & m) override {
|
||||
return alloc(bv_size_reduction_tactic, m);
|
||||
}
|
||||
|
||||
virtual ~bv_size_reduction_tactic();
|
||||
~bv_size_reduction_tactic() override;
|
||||
|
||||
virtual void operator()(goal_ref const & g, goal_ref_buffer & result);
|
||||
void operator()(goal_ref const & g, goal_ref_buffer & result) override;
|
||||
|
||||
virtual void cleanup();
|
||||
void cleanup() override;
|
||||
};
|
||||
|
||||
tactic * mk_bv_size_reduction_tactic(ast_manager & m, params_ref const & p) {
|
||||
|
@ -183,8 +183,8 @@ struct bv_size_reduction_tactic::imp {
|
|||
return;
|
||||
TRACE("before_bv_size_reduction", g.display(tout););
|
||||
m_produce_models = g.models_enabled();
|
||||
mc = 0;
|
||||
m_mc = 0;
|
||||
mc = nullptr;
|
||||
m_mc = nullptr;
|
||||
unsigned num_reduced = 0;
|
||||
{
|
||||
tactic_report report("bv-size-reduction", g);
|
||||
|
@ -210,11 +210,11 @@ struct bv_size_reduction_tactic::imp {
|
|||
unsigned bv_sz = m_util.get_bv_size(v);
|
||||
numeral l = m_util.norm(it->m_value, bv_sz, true);
|
||||
obj_map<app, numeral>::obj_map_entry * entry = m_signed_uppers.find_core(v);
|
||||
if (entry != 0) {
|
||||
if (entry != nullptr) {
|
||||
numeral u = m_util.norm(entry->get_data().m_value, bv_sz, true);
|
||||
TRACE("bv_size_reduction", tout << l << " <= " << v->get_decl()->get_name() << " <= " << u << "\n";);
|
||||
expr * new_def = 0;
|
||||
app * new_const = 0;
|
||||
expr * new_def = nullptr;
|
||||
app * new_const = nullptr;
|
||||
if (l > u) {
|
||||
g.assert_expr(m.mk_false());
|
||||
return;
|
||||
|
@ -234,7 +234,7 @@ struct bv_size_reduction_tactic::imp {
|
|||
unsigned i_nb = l_nb;
|
||||
TRACE("bv_size_reduction", tout << " l <= " << v->get_decl()->get_name() << " <= u <= 0 " << " --> " << i_nb << " bits\n";);
|
||||
if (i_nb < v_nb) {
|
||||
new_const = m.mk_fresh_const(0, m_util.mk_sort(i_nb));
|
||||
new_const = m.mk_fresh_const(nullptr, m_util.mk_sort(i_nb));
|
||||
new_def = m_util.mk_concat(m_util.mk_numeral(numeral(-1), v_nb - i_nb), new_const);
|
||||
}
|
||||
}
|
||||
|
@ -244,7 +244,7 @@ struct bv_size_reduction_tactic::imp {
|
|||
unsigned i_nb = ((l_nb > u_nb) ? l_nb : u_nb) + 1;
|
||||
TRACE("bv_size_reduction", tout << " l <= " << v->get_decl()->get_name() << " <= 0 <= u " << " --> " << i_nb << " bits\n";);
|
||||
if (i_nb < v_nb) {
|
||||
new_const = m.mk_fresh_const(0, m_util.mk_sort(i_nb));
|
||||
new_const = m.mk_fresh_const(nullptr, m_util.mk_sort(i_nb));
|
||||
new_def = m_util.mk_sign_extend(v_nb - i_nb, new_const);
|
||||
}
|
||||
}
|
||||
|
@ -255,7 +255,7 @@ struct bv_size_reduction_tactic::imp {
|
|||
unsigned v_nb = m_util.get_bv_size(v);
|
||||
TRACE("bv_size_reduction", tout << l << " <= " << v->get_decl()->get_name() << " <= " << u << " --> " << u_nb << " bits\n";);
|
||||
if (u_nb < v_nb) {
|
||||
new_const = m.mk_fresh_const(0, m_util.mk_sort(u_nb));
|
||||
new_const = m.mk_fresh_const(nullptr, m_util.mk_sort(u_nb));
|
||||
new_def = m_util.mk_concat(m_util.mk_numeral(numeral(0), v_nb - u_nb), new_const);
|
||||
}
|
||||
}
|
||||
|
@ -364,8 +364,8 @@ struct bv_size_reduction_tactic::imp {
|
|||
if (m_fmc) {
|
||||
mc = concat(m_fmc.get(), mc.get());
|
||||
}
|
||||
m_mc = 0;
|
||||
m_fmc = 0;
|
||||
m_mc = nullptr;
|
||||
m_fmc = nullptr;
|
||||
}
|
||||
report_tactic_progress(":bv-reduced", num_reduced);
|
||||
TRACE("after_bv_size_reduction", g.display(tout); if (m_mc) m_mc->display(tout););
|
||||
|
@ -397,8 +397,8 @@ void bv_size_reduction_tactic::operator()(goal_ref const & g,
|
|||
|
||||
|
||||
void bv_size_reduction_tactic::cleanup() {
|
||||
imp * d = alloc(imp, m_imp->m);
|
||||
std::swap(d, m_imp);
|
||||
dealloc(d);
|
||||
ast_manager & m = m_imp->m;
|
||||
m_imp->~imp();
|
||||
new (m_imp) imp(m);
|
||||
}
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ bvarray2uf_rewriter_cfg::bvarray2uf_rewriter_cfg(ast_manager & m, params_ref con
|
|||
m_bindings(m),
|
||||
m_bv_util(m),
|
||||
m_array_util(m),
|
||||
m_fmc(0),
|
||||
m_fmc(nullptr),
|
||||
extra_assertions(m) {
|
||||
updt_params(p);
|
||||
// We need to make sure that the mananger has the BV and array plugins loaded.
|
||||
|
@ -107,7 +107,7 @@ func_decl_ref bvarray2uf_rewriter_cfg::mk_uf_for_array(expr * e) {
|
|||
if (m_array_util.is_as_array(e))
|
||||
return func_decl_ref(static_cast<func_decl*>(to_app(e)->get_decl()->get_parameter(0).get_ast()), m_manager);
|
||||
else {
|
||||
func_decl * bv_f = 0;
|
||||
func_decl * bv_f = nullptr;
|
||||
if (!m_arrays_fs.find(e, bv_f)) {
|
||||
sort * domain = get_index_sort(e);
|
||||
sort * range = get_value_sort(e);
|
||||
|
@ -182,7 +182,7 @@ br_status bvarray2uf_rewriter_cfg::reduce_app(func_decl * f, unsigned num, expr
|
|||
func_decl_ref itefd(m_manager);
|
||||
e = m_manager.mk_ite(c, f_ta, f_fa);
|
||||
|
||||
func_decl * bv_f = 0;
|
||||
func_decl * bv_f = nullptr;
|
||||
if (!m_arrays_fs.find(f_a, bv_f)) {
|
||||
sort * domain = get_index_sort(args[1]);
|
||||
sort * range = get_value_sort(args[1]);
|
||||
|
|
|
@ -110,29 +110,29 @@ public:
|
|||
m_imp = alloc(imp, m, p);
|
||||
}
|
||||
|
||||
virtual tactic * translate(ast_manager & m) {
|
||||
tactic * translate(ast_manager & m) override {
|
||||
return alloc(bvarray2uf_tactic, m, m_params);
|
||||
}
|
||||
|
||||
virtual ~bvarray2uf_tactic() {
|
||||
~bvarray2uf_tactic() override {
|
||||
dealloc(m_imp);
|
||||
}
|
||||
|
||||
virtual void updt_params(params_ref const & p) {
|
||||
void updt_params(params_ref const & p) override {
|
||||
m_params = p;
|
||||
m_imp->updt_params(p);
|
||||
}
|
||||
|
||||
virtual void collect_param_descrs(param_descrs & r) {
|
||||
void collect_param_descrs(param_descrs & r) override {
|
||||
insert_produce_models(r);
|
||||
}
|
||||
|
||||
virtual void operator()(goal_ref const & in,
|
||||
goal_ref_buffer & result) {
|
||||
void operator()(goal_ref const & in,
|
||||
goal_ref_buffer & result) override {
|
||||
(*m_imp)(in, result);
|
||||
}
|
||||
|
||||
virtual void cleanup() {
|
||||
void cleanup() override {
|
||||
ast_manager & m = m_imp->m();
|
||||
imp * d = alloc(imp, m, m_params);
|
||||
std::swap(d, m_imp);
|
||||
|
|
|
@ -93,8 +93,8 @@ class dt2bv_tactic : public tactic {
|
|||
struct sort_pred : public i_sort_pred {
|
||||
dt2bv_tactic& m_t;
|
||||
sort_pred(dt2bv_tactic& t): m_t(t) {}
|
||||
virtual ~sort_pred() {}
|
||||
virtual bool operator()(sort* s) {
|
||||
~sort_pred() override {}
|
||||
bool operator()(sort* s) override {
|
||||
return m_t.m_fd_sorts.contains(s);
|
||||
}
|
||||
};
|
||||
|
@ -105,17 +105,17 @@ public:
|
|||
dt2bv_tactic(ast_manager& m, params_ref const& p):
|
||||
m(m), m_params(p), m_dt(m), m_bv(m), m_is_fd(*this) {}
|
||||
|
||||
virtual tactic * translate(ast_manager & m) {
|
||||
tactic * translate(ast_manager & m) override {
|
||||
return alloc(dt2bv_tactic, m, m_params);
|
||||
}
|
||||
|
||||
virtual void updt_params(params_ref const & p) {
|
||||
void updt_params(params_ref const & p) override {
|
||||
}
|
||||
|
||||
virtual void collect_param_descrs(param_descrs & r) {
|
||||
void collect_param_descrs(param_descrs & r) override {
|
||||
}
|
||||
|
||||
virtual void operator()(goal_ref const & g, goal_ref_buffer & result) {
|
||||
void operator()(goal_ref const & g, goal_ref_buffer & result) override {
|
||||
bool produce_proofs = g->proofs_enabled();
|
||||
tactic_report report("dt2bv", *g);
|
||||
unsigned size = g->size();
|
||||
|
@ -158,7 +158,7 @@ public:
|
|||
SASSERT(g->is_well_sorted());
|
||||
}
|
||||
|
||||
virtual void cleanup() {
|
||||
void cleanup() override {
|
||||
m_fd_sorts.reset();
|
||||
m_non_fd_sorts.reset();
|
||||
}
|
||||
|
|
|
@ -52,7 +52,7 @@ class elim_small_bv_tactic : public tactic {
|
|||
m_bindings(_m),
|
||||
m_num_eliminated(0) {
|
||||
updt_params(p);
|
||||
m_goal = 0;
|
||||
m_goal = nullptr;
|
||||
m_max_steps = UINT_MAX;
|
||||
}
|
||||
|
||||
|
@ -77,13 +77,13 @@ class elim_small_bv_tactic : public tactic {
|
|||
expr_ref res(m);
|
||||
expr_ref_vector substitution(m);
|
||||
|
||||
substitution.resize(num_decls, 0);
|
||||
substitution.resize(num_decls, nullptr);
|
||||
substitution[num_decls - idx - 1] = replacement;
|
||||
|
||||
// (VAR 0) is in the first position of substitution; (VAR num_decls-1) is in the last position.
|
||||
|
||||
for (unsigned i = 0; i < max_var_idx_p1; i++)
|
||||
substitution.push_back(0);
|
||||
substitution.push_back(nullptr);
|
||||
|
||||
// (VAR num_decls) ... (VAR num_decls+sz-1); are in positions num_decls .. num_decls+sz-1
|
||||
|
||||
|
@ -175,7 +175,7 @@ class elim_small_bv_tactic : public tactic {
|
|||
|
||||
TRACE("elim_small_bv", tout << "elimination result: " << mk_ismt2_pp(result, m) << std::endl; );
|
||||
|
||||
result_pr = 0; // proofs NIY
|
||||
result_pr = nullptr; // proofs NIY
|
||||
m_bindings.shrink(old_sz);
|
||||
return true;
|
||||
}
|
||||
|
@ -263,31 +263,31 @@ public:
|
|||
m_imp = alloc(imp, m, p);
|
||||
}
|
||||
|
||||
virtual tactic * translate(ast_manager & m) {
|
||||
tactic * translate(ast_manager & m) override {
|
||||
return alloc(elim_small_bv_tactic, m, m_params);
|
||||
}
|
||||
|
||||
virtual ~elim_small_bv_tactic() {
|
||||
~elim_small_bv_tactic() override {
|
||||
dealloc(m_imp);
|
||||
}
|
||||
|
||||
virtual void updt_params(params_ref const & p) {
|
||||
void updt_params(params_ref const & p) override {
|
||||
m_params = p;
|
||||
m_imp->m_rw.cfg().updt_params(p);
|
||||
}
|
||||
|
||||
virtual void collect_param_descrs(param_descrs & r) {
|
||||
void collect_param_descrs(param_descrs & r) override {
|
||||
insert_max_memory(r);
|
||||
insert_max_steps(r);
|
||||
r.insert("max_bits", CPK_UINT, "(default: 4) maximum bit-vector size of quantified bit-vectors to be eliminated.");
|
||||
}
|
||||
|
||||
virtual void operator()(goal_ref const & in,
|
||||
goal_ref_buffer & result) {
|
||||
void operator()(goal_ref const & in,
|
||||
goal_ref_buffer & result) override {
|
||||
(*m_imp)(in, result);
|
||||
}
|
||||
|
||||
virtual void cleanup() {
|
||||
void cleanup() override {
|
||||
ast_manager & m = m_imp->m;
|
||||
m_imp->~imp();
|
||||
m_imp = new (m_imp) imp(m, m_params);
|
||||
|
|
|
@ -84,7 +84,7 @@ class max_bv_sharing_tactic : public tactic {
|
|||
return m().mk_app(f, arg1, arg2);
|
||||
if (s.contains(expr_pair(arg2, arg1)))
|
||||
return m().mk_app(f, arg2, arg1);
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
struct ref_count_lt {
|
||||
|
@ -106,10 +106,10 @@ class max_bv_sharing_tactic : public tactic {
|
|||
|
||||
ptr_buffer<expr, 128> _args;
|
||||
bool first = false;
|
||||
expr * num = 0;
|
||||
expr * num = nullptr;
|
||||
for (unsigned i = 0; i < num_args; i++) {
|
||||
expr * arg = args[i];
|
||||
if (num == 0 && m_util.is_numeral(arg)) {
|
||||
if (num == nullptr && m_util.is_numeral(arg)) {
|
||||
if (i == 0) first = true;
|
||||
num = arg;
|
||||
}
|
||||
|
@ -128,7 +128,7 @@ class max_bv_sharing_tactic : public tactic {
|
|||
for (unsigned i = 0; i < num_args - 1; i++) {
|
||||
for (unsigned j = i + 1; j < num_args; j++) {
|
||||
expr * r = reuse(s, f, _args[i], _args[j]);
|
||||
if (r != 0) {
|
||||
if (r != nullptr) {
|
||||
TRACE("bv_sharing_detail", tout << "reusing args: " << i << " " << j << "\n";);
|
||||
_args[i] = r;
|
||||
SASSERT(num_args > 1);
|
||||
|
@ -186,7 +186,7 @@ class max_bv_sharing_tactic : public tactic {
|
|||
}
|
||||
num_args = j;
|
||||
if (num_args == 1) {
|
||||
if (num == 0) {
|
||||
if (num == nullptr) {
|
||||
result = _args[0];
|
||||
}
|
||||
else {
|
||||
|
@ -209,7 +209,7 @@ class max_bv_sharing_tactic : public tactic {
|
|||
case OP_BMUL:
|
||||
case OP_BOR:
|
||||
case OP_BXOR:
|
||||
result_pr = 0;
|
||||
result_pr = nullptr;
|
||||
return reduce_ac_app(f, num, args, result);
|
||||
default:
|
||||
return BR_FAILED;
|
||||
|
@ -274,35 +274,36 @@ public:
|
|||
m_imp = alloc(imp, m, p);
|
||||
}
|
||||
|
||||
virtual tactic * translate(ast_manager & m) {
|
||||
tactic * translate(ast_manager & m) override {
|
||||
return alloc(max_bv_sharing_tactic, m, m_params);
|
||||
}
|
||||
|
||||
virtual ~max_bv_sharing_tactic() {
|
||||
~max_bv_sharing_tactic() override {
|
||||
dealloc(m_imp);
|
||||
}
|
||||
|
||||
virtual void updt_params(params_ref const & p) {
|
||||
void updt_params(params_ref const & p) override {
|
||||
m_params = p;
|
||||
m_imp->m_rw.cfg().updt_params(p);
|
||||
}
|
||||
|
||||
virtual void collect_param_descrs(param_descrs & r) {
|
||||
void collect_param_descrs(param_descrs & r) override {
|
||||
insert_max_memory(r);
|
||||
insert_max_steps(r);
|
||||
r.insert("max_args", CPK_UINT,
|
||||
"(default: 128) maximum number of arguments (per application) that will be considered by the greedy (quadratic) heuristic.");
|
||||
}
|
||||
|
||||
virtual void operator()(goal_ref const & in,
|
||||
goal_ref_buffer & result) {
|
||||
void operator()(goal_ref const & in,
|
||||
goal_ref_buffer & result) override {
|
||||
(*m_imp)(in, result);
|
||||
}
|
||||
|
||||
virtual void cleanup() {
|
||||
imp * d = alloc(imp, m_imp->m(), m_params);
|
||||
std::swap(d, m_imp);
|
||||
dealloc(d);
|
||||
void cleanup() override {
|
||||
ast_manager & m = m_imp->m();
|
||||
params_ref p = std::move(m_params);
|
||||
m_imp->~imp();
|
||||
new (m_imp) imp(m, p);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -59,16 +59,16 @@ protected:
|
|||
public:
|
||||
concat_converter(T * c1, T * c2):m_c1(c1), m_c2(c2) {}
|
||||
|
||||
virtual ~concat_converter() {}
|
||||
~concat_converter() override {}
|
||||
|
||||
virtual void cancel() {
|
||||
void cancel() override {
|
||||
m_c2->cancel();
|
||||
m_c1->cancel();
|
||||
}
|
||||
|
||||
virtual char const * get_name() const = 0;
|
||||
|
||||
virtual void display(std::ostream & out) {
|
||||
void display(std::ostream & out) override {
|
||||
m_c1->display(out);
|
||||
m_c2->display(out);
|
||||
}
|
||||
|
@ -83,10 +83,10 @@ protected:
|
|||
|
||||
template<typename T2>
|
||||
T * translate_core(ast_translation & translator) {
|
||||
T * t1 = m_c1 ? m_c1->translate(translator) : 0;
|
||||
T * t1 = m_c1 ? m_c1->translate(translator) : nullptr;
|
||||
ptr_buffer<T> t2s;
|
||||
for (T* c : m_c2s)
|
||||
t2s.push_back(c ? c->translate(translator) : 0);
|
||||
t2s.push_back(c ? c->translate(translator) : nullptr);
|
||||
return alloc(T2, t1, m_c2s.size(), t2s.c_ptr(), m_szs.c_ptr());
|
||||
}
|
||||
|
||||
|
@ -102,12 +102,12 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
virtual ~concat_star_converter() {
|
||||
~concat_star_converter() override {
|
||||
for (T* c : m_c2s)
|
||||
if (c) c->dec_ref();
|
||||
}
|
||||
|
||||
virtual void cancel() {
|
||||
void cancel() override {
|
||||
if (m_c1)
|
||||
m_c1->cancel();
|
||||
for (T* c : m_c2s)
|
||||
|
@ -116,7 +116,7 @@ public:
|
|||
|
||||
virtual char const * get_name() const = 0;
|
||||
|
||||
virtual void display(std::ostream & out) {
|
||||
void display(std::ostream & out) override {
|
||||
if (m_c1)
|
||||
m_c1->display(out);
|
||||
for (T* c : m_c2s)
|
||||
|
|
|
@ -146,32 +146,31 @@ public:
|
|||
m_imp = alloc(imp, m, p);
|
||||
}
|
||||
|
||||
virtual tactic * translate(ast_manager & m) {
|
||||
tactic * translate(ast_manager & m) override {
|
||||
return alloc(blast_term_ite_tactic, m, m_params);
|
||||
}
|
||||
|
||||
virtual ~blast_term_ite_tactic() {
|
||||
~blast_term_ite_tactic() override {
|
||||
dealloc(m_imp);
|
||||
}
|
||||
|
||||
virtual void updt_params(params_ref const & p) {
|
||||
void updt_params(params_ref const & p) override {
|
||||
m_params = p;
|
||||
m_imp->m_rw.cfg().updt_params(p);
|
||||
}
|
||||
|
||||
virtual void collect_param_descrs(param_descrs & r) {
|
||||
void collect_param_descrs(param_descrs & r) override {
|
||||
insert_max_memory(r);
|
||||
insert_max_steps(r);
|
||||
r.insert("max_args", CPK_UINT,
|
||||
"(default: 128) maximum number of arguments (per application) that will be considered by the greedy (quadratic) heuristic.");
|
||||
}
|
||||
|
||||
virtual void operator()(goal_ref const & in,
|
||||
goal_ref_buffer & result) {
|
||||
void operator()(goal_ref const & in, goal_ref_buffer & result) override {
|
||||
(*m_imp)(in, result);
|
||||
}
|
||||
|
||||
virtual void cleanup() {
|
||||
void cleanup() override {
|
||||
ast_manager & m = m_imp->m;
|
||||
dealloc(m_imp);
|
||||
m_imp = alloc(imp, m, m_params);
|
||||
|
|
|
@ -219,7 +219,7 @@ struct cofactor_elim_term_ite::imp {
|
|||
break;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -286,7 +286,7 @@ struct cofactor_elim_term_ite::imp {
|
|||
break;
|
||||
}
|
||||
}
|
||||
expr * best = 0;
|
||||
expr * best = nullptr;
|
||||
unsigned best_occs = 0;
|
||||
obj_map<expr, unsigned>::iterator it = occs.begin();
|
||||
obj_map<expr, unsigned>::iterator end = occs.end();
|
||||
|
@ -329,7 +329,7 @@ struct cofactor_elim_term_ite::imp {
|
|||
bool m_strict_upper;
|
||||
app * m_upper;
|
||||
|
||||
cofactor_rw_cfg(ast_manager & _m, imp & owner, obj_hashtable<expr> * has_term_ite = 0):
|
||||
cofactor_rw_cfg(ast_manager & _m, imp & owner, obj_hashtable<expr> * has_term_ite = nullptr):
|
||||
m(_m),
|
||||
m_owner(owner),
|
||||
m_has_term_ite(has_term_ite),
|
||||
|
@ -349,13 +349,13 @@ struct cofactor_elim_term_ite::imp {
|
|||
if (m.is_not(t)) {
|
||||
m_atom = to_app(t)->get_arg(0);
|
||||
m_sign = true;
|
||||
m_term = 0;
|
||||
m_term = nullptr;
|
||||
// TODO: bounds
|
||||
}
|
||||
else {
|
||||
m_atom = t;
|
||||
m_sign = false;
|
||||
m_term = 0;
|
||||
m_term = nullptr;
|
||||
expr * lhs;
|
||||
expr * rhs;
|
||||
if (m_owner.m_cofactor_equalities && m.is_eq(t, lhs, rhs)) {
|
||||
|
@ -377,19 +377,19 @@ struct cofactor_elim_term_ite::imp {
|
|||
bool rewrite_patterns() const { return false; }
|
||||
|
||||
br_status reduce_app(func_decl * f, unsigned num, expr * const * args, expr_ref & result, proof_ref & result_pr) {
|
||||
result_pr = 0;
|
||||
result_pr = nullptr;
|
||||
return m_mk_app.mk_core(f, num, args, result);
|
||||
}
|
||||
|
||||
bool get_subst(expr * s, expr * & t, proof * & pr) {
|
||||
pr = 0;
|
||||
pr = nullptr;
|
||||
|
||||
if (s == m_atom) {
|
||||
t = m_sign ? m.mk_false() : m.mk_true();
|
||||
return true;
|
||||
}
|
||||
|
||||
if (s == m_term && m_value != 0) {
|
||||
if (s == m_term && m_value != nullptr) {
|
||||
t = m_value;
|
||||
return true;
|
||||
}
|
||||
|
@ -406,7 +406,7 @@ struct cofactor_elim_term_ite::imp {
|
|||
struct cofactor_rw : rewriter_tpl<cofactor_rw_cfg> {
|
||||
cofactor_rw_cfg m_cfg;
|
||||
public:
|
||||
cofactor_rw(ast_manager & m, imp & owner, obj_hashtable<expr> * has_term_ite = 0):
|
||||
cofactor_rw(ast_manager & m, imp & owner, obj_hashtable<expr> * has_term_ite = nullptr):
|
||||
rewriter_tpl<cofactor_rw_cfg>(m, false, m_cfg),
|
||||
m_cfg(m, owner, has_term_ite) {
|
||||
}
|
||||
|
@ -444,7 +444,7 @@ struct cofactor_elim_term_ite::imp {
|
|||
|
||||
bool get_subst(expr * s, expr * & t, proof * & t_pr) {
|
||||
if (m_candidates.contains(s)) {
|
||||
t_pr = 0;
|
||||
t_pr = nullptr;
|
||||
|
||||
if (m_cache.find(s, t))
|
||||
return true;
|
||||
|
@ -455,7 +455,7 @@ struct cofactor_elim_term_ite::imp {
|
|||
while (true) {
|
||||
// expr * c = m_owner.get_best(curr);
|
||||
expr * c = m_owner.get_first(curr);
|
||||
if (c == 0) {
|
||||
if (c == nullptr) {
|
||||
m_cache.insert(s, curr);
|
||||
m_cache_domain.push_back(curr);
|
||||
t = curr.get();
|
||||
|
@ -532,7 +532,7 @@ struct cofactor_elim_term_ite::imp {
|
|||
while (true) {
|
||||
expr * c = m_owner.get_best(curr);
|
||||
// expr * c = m_owner.get_first(curr);
|
||||
if (c == 0) {
|
||||
if (c == nullptr) {
|
||||
r = curr.get();
|
||||
return;
|
||||
}
|
||||
|
@ -607,7 +607,7 @@ struct cofactor_elim_term_ite::imp {
|
|||
unsigned num = to_app(t)->get_num_args();
|
||||
for (unsigned i = 0; i < num; i++) {
|
||||
expr * arg = to_app(t)->get_arg(i);
|
||||
expr * new_arg = 0;
|
||||
expr * new_arg = nullptr;
|
||||
TRACE("cofactor_bug", tout << "collecting child: " << arg->get_id() << "\n";);
|
||||
m_cache.find(arg, new_arg);
|
||||
SASSERT(new_arg != 0);
|
||||
|
@ -645,7 +645,7 @@ struct cofactor_elim_term_ite::imp {
|
|||
m_cache_domain.push_back(new_t);
|
||||
m_frames.pop_back();
|
||||
}
|
||||
expr * result = 0;
|
||||
expr * result = nullptr;
|
||||
m_cache.find(t, result);
|
||||
r = result;
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ class cofactor_term_ite_tactic : public tactic {
|
|||
expr * f = g.form(i);
|
||||
expr_ref new_f(m);
|
||||
m_elim_ite(f, new_f);
|
||||
g.update(i, new_f, 0, g.dep(i));
|
||||
g.update(i, new_f, nullptr, g.dep(i));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -46,13 +46,13 @@ public:
|
|||
m_elim_ite(m, p) {
|
||||
}
|
||||
|
||||
virtual tactic * translate(ast_manager & m) {
|
||||
tactic * translate(ast_manager & m) override {
|
||||
return alloc(cofactor_term_ite_tactic, m, m_params);
|
||||
}
|
||||
|
||||
virtual ~cofactor_term_ite_tactic() {}
|
||||
virtual void updt_params(params_ref const & p) { m_params = p; m_elim_ite.updt_params(p); }
|
||||
virtual void collect_param_descrs(param_descrs & r) { m_elim_ite.collect_param_descrs(r); }
|
||||
~cofactor_term_ite_tactic() override {}
|
||||
void updt_params(params_ref const & p) override { m_params = p; m_elim_ite.updt_params(p); }
|
||||
void collect_param_descrs(param_descrs & r) override { m_elim_ite.collect_param_descrs(r); }
|
||||
|
||||
void operator()(goal_ref const & g, goal_ref_buffer& result) override {
|
||||
SASSERT(g->is_well_sorted());
|
||||
|
@ -66,7 +66,7 @@ public:
|
|||
SASSERT(g->is_well_sorted());
|
||||
}
|
||||
|
||||
virtual void cleanup() { return m_elim_ite.cleanup(); }
|
||||
void cleanup() override { return m_elim_ite.cleanup(); }
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -51,19 +51,19 @@ public:
|
|||
m_params(p) {
|
||||
}
|
||||
|
||||
virtual ~collect_statistics_tactic() {}
|
||||
~collect_statistics_tactic() override {}
|
||||
|
||||
virtual tactic * translate(ast_manager & m_) {
|
||||
tactic * translate(ast_manager & m_) override {
|
||||
return alloc(collect_statistics_tactic, m_, m_params);
|
||||
}
|
||||
|
||||
virtual void updt_params(params_ref const & p) {
|
||||
void updt_params(params_ref const & p) override {
|
||||
m_params = p;
|
||||
}
|
||||
|
||||
virtual void collect_param_descrs(param_descrs & r) {}
|
||||
void collect_param_descrs(param_descrs & r) override {}
|
||||
|
||||
virtual void operator()(goal_ref const & g, goal_ref_buffer & result) {
|
||||
void operator()(goal_ref const & g, goal_ref_buffer & result) override {
|
||||
tactic_report report("collect-statistics", *g);
|
||||
|
||||
collect_proc cp(m, m_stats);
|
||||
|
@ -81,13 +81,13 @@ public:
|
|||
result.push_back(g.get());
|
||||
}
|
||||
|
||||
virtual void cleanup() {}
|
||||
void cleanup() override {}
|
||||
|
||||
virtual void collect_statistics(statistics & st) const {
|
||||
void collect_statistics(statistics & st) const override {
|
||||
}
|
||||
|
||||
virtual void reset_statistics() { reset(); }
|
||||
virtual void reset() { cleanup(); }
|
||||
void reset_statistics() override { reset(); }
|
||||
void reset() override { cleanup(); }
|
||||
|
||||
protected:
|
||||
class collect_proc {
|
||||
|
|
|
@ -33,13 +33,13 @@ class ctx_propagate_assertions : public ctx_simplify_tactic::simplifier {
|
|||
void assert_eq_core(expr * t, app * val);
|
||||
public:
|
||||
ctx_propagate_assertions(ast_manager& m);
|
||||
virtual ~ctx_propagate_assertions() {}
|
||||
virtual bool assert_expr(expr * t, bool sign);
|
||||
virtual bool simplify(expr* t, expr_ref& result);
|
||||
~ctx_propagate_assertions() override {}
|
||||
bool assert_expr(expr * t, bool sign) override;
|
||||
bool simplify(expr* t, expr_ref& result) override;
|
||||
void push();
|
||||
virtual void pop(unsigned num_scopes);
|
||||
virtual unsigned scope_level() const { return m_scopes.size(); }
|
||||
virtual simplifier * translate(ast_manager & m);
|
||||
void pop(unsigned num_scopes) override;
|
||||
unsigned scope_level() const override { return m_scopes.size(); }
|
||||
simplifier * translate(ast_manager & m) override;
|
||||
};
|
||||
|
||||
|
||||
|
@ -148,7 +148,7 @@ struct ctx_simplify_tactic::imp {
|
|||
struct cache_cell {
|
||||
expr * m_from;
|
||||
cached_result * m_result;
|
||||
cache_cell():m_from(0), m_result(0) {}
|
||||
cache_cell():m_from(nullptr), m_result(nullptr) {}
|
||||
};
|
||||
|
||||
ast_manager & m;
|
||||
|
@ -217,7 +217,7 @@ struct ctx_simplify_tactic::imp {
|
|||
bool check_cache() {
|
||||
for (unsigned i = 0; i < m_cache.size(); i++) {
|
||||
cache_cell & cell = m_cache[i];
|
||||
if (cell.m_from != 0) {
|
||||
if (cell.m_from != nullptr) {
|
||||
SASSERT(cell.m_result != 0);
|
||||
cached_result * curr = cell.m_result;
|
||||
while (curr) {
|
||||
|
@ -235,10 +235,10 @@ struct ctx_simplify_tactic::imp {
|
|||
m_cache.reserve(id+1);
|
||||
cache_cell & cell = m_cache[id];
|
||||
void * mem = m_allocator.allocate(sizeof(cached_result));
|
||||
if (cell.m_from == 0) {
|
||||
if (cell.m_from == nullptr) {
|
||||
// new_entry
|
||||
cell.m_from = from;
|
||||
cell.m_result = new (mem) cached_result(to, scope_level(), 0);
|
||||
cell.m_result = new (mem) cached_result(to, scope_level(), nullptr);
|
||||
m.inc_ref(from);
|
||||
m.inc_ref(to);
|
||||
}
|
||||
|
@ -281,9 +281,9 @@ struct ctx_simplify_tactic::imp {
|
|||
if (to_delete->m_next) tout << mk_ismt2_pp(to_delete->m_next->m_to, m); else tout << "<null>";
|
||||
tout << "\n";);
|
||||
cell.m_result = to_delete->m_next;
|
||||
if (cell.m_result == 0) {
|
||||
if (cell.m_result == nullptr) {
|
||||
m.dec_ref(cell.m_from);
|
||||
cell.m_from = 0;
|
||||
cell.m_from = nullptr;
|
||||
}
|
||||
m_allocator.deallocate(sizeof(cached_result), to_delete);
|
||||
}
|
||||
|
@ -316,7 +316,7 @@ struct ctx_simplify_tactic::imp {
|
|||
return false;
|
||||
cache_cell & cell = m_cache[id];
|
||||
SASSERT(cell.m_result == 0 || cell.m_result->m_lvl <= scope_level());
|
||||
if (cell.m_result != 0 && cell.m_result->m_lvl == scope_level()) {
|
||||
if (cell.m_result != nullptr && cell.m_result->m_lvl == scope_level()) {
|
||||
SASSERT(cell.m_from == t);
|
||||
SASSERT(cell.m_result->m_to != 0);
|
||||
r = cell.m_result->m_to;
|
||||
|
@ -326,7 +326,7 @@ struct ctx_simplify_tactic::imp {
|
|||
}
|
||||
|
||||
void simplify(expr * t, expr_ref & r) {
|
||||
r = 0;
|
||||
r = nullptr;
|
||||
if (m_depth >= m_max_depth || m_num_steps >= m_max_steps || !is_app(t) || !m_simp->may_simplify(t)) {
|
||||
r = t;
|
||||
return;
|
||||
|
@ -534,7 +534,7 @@ struct ctx_simplify_tactic::imp {
|
|||
if (i < sz - 1 && !m.is_true(r) && !m.is_false(r) && !g.dep(i) && !assert_expr(r, false)) {
|
||||
r = m.mk_false();
|
||||
}
|
||||
g.update(i, r, 0, g.dep(i));
|
||||
g.update(i, r, nullptr, g.dep(i));
|
||||
}
|
||||
pop(scope_level() - old_lvl);
|
||||
|
||||
|
@ -549,7 +549,7 @@ struct ctx_simplify_tactic::imp {
|
|||
if (i > 0 && !m.is_true(r) && !m.is_false(r) && !g.dep(i) && !assert_expr(r, false)) {
|
||||
r = m.mk_false();
|
||||
}
|
||||
g.update(i, r, 0, g.dep(i));
|
||||
g.update(i, r, nullptr, g.dep(i));
|
||||
}
|
||||
pop(scope_level() - old_lvl);
|
||||
SASSERT(scope_level() == 0);
|
||||
|
@ -582,7 +582,7 @@ struct ctx_simplify_tactic::imp {
|
|||
for (unsigned i = 0; !g.inconsistent() && i < sz; ++i) {
|
||||
expr * t = g.form(i);
|
||||
process(t, r);
|
||||
proof* new_pr = m.mk_modus_ponens(g.pr(i), m.mk_rewrite_star(t, r, 0, 0)); // TODO :-)
|
||||
proof* new_pr = m.mk_modus_ponens(g.pr(i), m.mk_rewrite(t, r));
|
||||
g.update(i, r, new_pr, g.dep(i));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -46,18 +46,17 @@ protected:
|
|||
public:
|
||||
ctx_simplify_tactic(ast_manager & m, simplifier* simp, params_ref const & p = params_ref());
|
||||
|
||||
virtual tactic * translate(ast_manager & m);
|
||||
tactic * translate(ast_manager & m) override;
|
||||
|
||||
virtual ~ctx_simplify_tactic();
|
||||
~ctx_simplify_tactic() override;
|
||||
|
||||
virtual void updt_params(params_ref const & p);
|
||||
void updt_params(params_ref const & p) override;
|
||||
static void get_param_descrs(param_descrs & r);
|
||||
virtual void collect_param_descrs(param_descrs & r) { get_param_descrs(r); }
|
||||
void collect_param_descrs(param_descrs & r) override { get_param_descrs(r); }
|
||||
|
||||
virtual void operator()(goal_ref const & in,
|
||||
goal_ref_buffer & result);
|
||||
void operator()(goal_ref const & in, goal_ref_buffer & result) override;
|
||||
|
||||
virtual void cleanup();
|
||||
void cleanup() override;
|
||||
};
|
||||
|
||||
tactic * mk_ctx_simplify_tactic(ast_manager & m, params_ref const & p = params_ref());
|
||||
|
|
|
@ -65,22 +65,22 @@ public:
|
|||
m_imp = alloc(imp, m);
|
||||
}
|
||||
|
||||
virtual tactic * translate(ast_manager & m) {
|
||||
tactic * translate(ast_manager & m) override {
|
||||
return alloc(der_tactic, m);
|
||||
}
|
||||
|
||||
virtual ~der_tactic() {
|
||||
~der_tactic() override {
|
||||
dealloc(m_imp);
|
||||
}
|
||||
|
||||
virtual void operator()(goal_ref const & in,
|
||||
goal_ref_buffer & result) {
|
||||
void operator()(goal_ref const & in,
|
||||
goal_ref_buffer & result) override {
|
||||
(*m_imp)(*(in.get()));
|
||||
in->inc_depth();
|
||||
result.push_back(in.get());
|
||||
}
|
||||
|
||||
virtual void cleanup() {
|
||||
void cleanup() override {
|
||||
ast_manager & m = m_imp->m();
|
||||
imp * d = alloc(imp, m);
|
||||
std::swap(d, m_imp);
|
||||
|
|
|
@ -93,14 +93,14 @@ class distribute_forall_tactic : public tactic {
|
|||
rw * m_rw;
|
||||
|
||||
public:
|
||||
distribute_forall_tactic():m_rw(0) {}
|
||||
distribute_forall_tactic():m_rw(nullptr) {}
|
||||
|
||||
virtual tactic * translate(ast_manager & m) {
|
||||
tactic * translate(ast_manager & m) override {
|
||||
return alloc(distribute_forall_tactic);
|
||||
}
|
||||
|
||||
virtual void operator()(goal_ref const & g,
|
||||
goal_ref_buffer & result) {
|
||||
void operator()(goal_ref const & g,
|
||||
goal_ref_buffer & result) override {
|
||||
SASSERT(g->is_well_sorted());
|
||||
ast_manager & m = g->m();
|
||||
bool produce_proofs = g->proofs_enabled();
|
||||
|
@ -128,10 +128,10 @@ public:
|
|||
result.push_back(g.get());
|
||||
TRACE("distribute-forall", g->display(tout););
|
||||
SASSERT(g->is_well_sorted());
|
||||
m_rw = 0;
|
||||
m_rw = nullptr;
|
||||
}
|
||||
|
||||
virtual void cleanup() {}
|
||||
void cleanup() override {}
|
||||
};
|
||||
|
||||
tactic * mk_distribute_forall_tactic(ast_manager & m, params_ref const & p) {
|
||||
|
|
|
@ -100,7 +100,7 @@ bool expr_dominators::compute_dominators() {
|
|||
for (unsigned i = 0; i + 1 < m_post2expr.size(); ++i) {
|
||||
expr * child = m_post2expr[i];
|
||||
ptr_vector<expr> const& p = m_parents[child];
|
||||
expr * new_idom = 0, *idom2 = 0;
|
||||
expr * new_idom = nullptr, *idom2 = nullptr;
|
||||
|
||||
for (expr * pred : p) {
|
||||
if (m_doms.contains(pred)) {
|
||||
|
@ -199,7 +199,7 @@ void dom_simplify_tactic::cleanup() {
|
|||
|
||||
expr_ref dom_simplify_tactic::simplify_ite(app * ite) {
|
||||
expr_ref r(m);
|
||||
expr * c = 0, *t = 0, *e = 0;
|
||||
expr * c = nullptr, *t = nullptr, *e = nullptr;
|
||||
VERIFY(m.is_ite(ite, c, t, e));
|
||||
unsigned old_lvl = scope_level();
|
||||
expr_ref new_c = simplify_arg(c);
|
||||
|
@ -254,7 +254,7 @@ expr_ref dom_simplify_tactic::simplify_arg(expr * e) {
|
|||
*/
|
||||
expr_ref dom_simplify_tactic::simplify_rec(expr * e0) {
|
||||
expr_ref r(m);
|
||||
expr* e = 0;
|
||||
expr* e = nullptr;
|
||||
|
||||
TRACE("simplify", tout << "depth: " << m_depth << " " << mk_pp(e0, m) << "\n";);
|
||||
if (!m_result.find(e0, e)) {
|
||||
|
@ -372,9 +372,9 @@ void dom_simplify_tactic::simplify_goal(goal& g) {
|
|||
}
|
||||
CTRACE("simplify", r != g.form(i), tout << r << " " << mk_pp(g.form(i), m) << "\n";);
|
||||
change |= r != g.form(i);
|
||||
proof* new_pr = 0;
|
||||
proof* new_pr = nullptr;
|
||||
if (g.proofs_enabled()) {
|
||||
new_pr = m.mk_modus_ponens(g.pr(i), m.mk_rewrite_star(g.form(i), r, 0, 0));
|
||||
new_pr = m.mk_modus_ponens(g.pr(i), m.mk_rewrite(g.form(i), r));
|
||||
}
|
||||
g.update(i, r, new_pr, g.dep(i));
|
||||
}
|
||||
|
@ -392,9 +392,9 @@ void dom_simplify_tactic::simplify_goal(goal& g) {
|
|||
}
|
||||
change |= r != g.form(i);
|
||||
CTRACE("simplify", r != g.form(i), tout << r << " " << mk_pp(g.form(i), m) << "\n";);
|
||||
proof* new_pr = 0;
|
||||
proof* new_pr = nullptr;
|
||||
if (g.proofs_enabled()) {
|
||||
new_pr = m.mk_modus_ponens(g.pr(i), m.mk_rewrite_star(g.form(i), r, 0, 0));
|
||||
new_pr = m.mk_modus_ponens(g.pr(i), m.mk_rewrite(g.form(i), r));
|
||||
}
|
||||
g.update(i, r, new_pr, g.dep(i));
|
||||
}
|
||||
|
@ -440,14 +440,14 @@ bool expr_substitution_simplifier::assert_expr(expr * t, bool sign) {
|
|||
m_scoped_substitution.push();
|
||||
expr* tt;
|
||||
if (!sign) {
|
||||
update_substitution(t, 0);
|
||||
update_substitution(t, nullptr);
|
||||
}
|
||||
else if (m.is_not(t, tt)) {
|
||||
update_substitution(tt, 0);
|
||||
update_substitution(tt, nullptr);
|
||||
}
|
||||
else {
|
||||
expr_ref nt(m.mk_not(t), m);
|
||||
update_substitution(nt, 0);
|
||||
update_substitution(nt, nullptr);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -111,7 +111,7 @@ class dom_simplify_tactic : public tactic {
|
|||
|
||||
bool is_subexpr(expr * a, expr * b);
|
||||
|
||||
expr_ref get_cached(expr* t) { expr* r = 0; if (!m_result.find(t, r)) r = t; return expr_ref(r, m); }
|
||||
expr_ref get_cached(expr* t) { expr* r = nullptr; if (!m_result.find(t, r)) r = t; return expr_ref(r, m); }
|
||||
void cache(expr *t, expr* r) { m_result.insert(t, r); m_trail.push_back(r); }
|
||||
|
||||
ptr_vector<expr> const & tree(expr * e);
|
||||
|
@ -129,7 +129,7 @@ public:
|
|||
m_trail(m), m_args(m),
|
||||
m_dominators(m), m_depth(0), m_max_depth(1024), m_forward(true) {}
|
||||
|
||||
virtual ~dom_simplify_tactic();
|
||||
~dom_simplify_tactic() override;
|
||||
|
||||
tactic * translate(ast_manager & m) override;
|
||||
void updt_params(params_ref const & p) override {}
|
||||
|
@ -153,18 +153,18 @@ class expr_substitution_simplifier : public dom_simplifier {
|
|||
|
||||
public:
|
||||
expr_substitution_simplifier(ast_manager& m): m(m), m_subst(m), m_scoped_substitution(m_subst), m_trail(m) {}
|
||||
virtual ~expr_substitution_simplifier() {}
|
||||
virtual bool assert_expr(expr * t, bool sign);
|
||||
~expr_substitution_simplifier() override {}
|
||||
bool assert_expr(expr * t, bool sign) override;
|
||||
|
||||
void update_substitution(expr* n, proof* pr);
|
||||
|
||||
virtual void operator()(expr_ref& r) { r = m_scoped_substitution.find(r); }
|
||||
void operator()(expr_ref& r) override { r = m_scoped_substitution.find(r); }
|
||||
|
||||
virtual void pop(unsigned num_scopes) { m_scoped_substitution.pop(num_scopes); }
|
||||
void pop(unsigned num_scopes) override { m_scoped_substitution.pop(num_scopes); }
|
||||
|
||||
virtual unsigned scope_level() const { return m_scoped_substitution.scope_level(); }
|
||||
unsigned scope_level() const override { return m_scoped_substitution.scope_level(); }
|
||||
|
||||
virtual dom_simplifier * translate(ast_manager & m) {
|
||||
dom_simplifier * translate(ast_manager & m) override {
|
||||
SASSERT(m_subst.empty());
|
||||
return alloc(expr_substitution_simplifier, m);
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ class elim_term_ite_tactic : public tactic {
|
|||
proof_ref new_def_pr(m);
|
||||
app_ref _result(m);
|
||||
if (m_defined_names.mk_name(new_ite, new_def, new_def_pr, _result, result_pr)) {
|
||||
m_goal->assert_expr(new_def, new_def_pr, 0);
|
||||
m_goal->assert_expr(new_def, new_def_pr, nullptr);
|
||||
m_num_fresh++;
|
||||
if (m_produce_models) {
|
||||
if (!m_mc)
|
||||
|
@ -65,9 +65,9 @@ class elim_term_ite_tactic : public tactic {
|
|||
|
||||
rw_cfg(ast_manager & _m, params_ref const & p):
|
||||
m(_m),
|
||||
m_defined_names(m, 0 /* don't use prefix */) {
|
||||
m_defined_names(m, nullptr /* don't use prefix */) {
|
||||
updt_params(p);
|
||||
m_goal = 0;
|
||||
m_goal = nullptr;
|
||||
m_num_fresh = 0;
|
||||
}
|
||||
|
||||
|
@ -137,7 +137,7 @@ public:
|
|||
m_imp = alloc(imp, m, p);
|
||||
}
|
||||
|
||||
virtual ~elim_term_ite_tactic() {
|
||||
~elim_term_ite_tactic() override {
|
||||
dealloc(m_imp);
|
||||
}
|
||||
|
||||
|
|
|
@ -94,7 +94,7 @@ class elim_uncnstr_tactic : public tactic {
|
|||
return false; // variable already existed for this application
|
||||
}
|
||||
|
||||
v = m().mk_fresh_const(0, m().get_sort(t));
|
||||
v = m().mk_fresh_const(nullptr, m().get_sort(t));
|
||||
TRACE("elim_uncnstr_bug", tout << "eliminating:\n" << mk_ismt2_pp(t, m()) << "\n";);
|
||||
TRACE("elim_uncnstr_bug_ll", tout << "eliminating:\n" << mk_bounded_pp(t, m()) << "\n";);
|
||||
m_fresh_vars.push_back(v);
|
||||
|
@ -219,7 +219,7 @@ class elim_uncnstr_tactic : public tactic {
|
|||
t = arg1;
|
||||
}
|
||||
else {
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
sort * s = m().get_sort(arg1);
|
||||
|
@ -242,14 +242,14 @@ class elim_uncnstr_tactic : public tactic {
|
|||
// variables.
|
||||
//
|
||||
if (!m().is_fully_interp(s))
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
// If the interpreted sort has only one element,
|
||||
// then it is unsound to eliminate the unconstrained variable in the equality
|
||||
sort_size sz = s->get_num_elements();
|
||||
|
||||
if (sz.is_finite() && sz.size() <= 1)
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
if (!m_mc) {
|
||||
// easy case, model generation is disabled.
|
||||
|
@ -266,7 +266,7 @@ class elim_uncnstr_tactic : public tactic {
|
|||
add_def(v, m().mk_ite(u, t, d));
|
||||
return u;
|
||||
}
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
app * process_basic_app(func_decl * f, unsigned num, expr * const * args) {
|
||||
|
@ -298,7 +298,7 @@ class elim_uncnstr_tactic : public tactic {
|
|||
add_def(args[2], r);
|
||||
return r;
|
||||
}
|
||||
return 0;
|
||||
return nullptr;
|
||||
case OP_NOT:
|
||||
SASSERT(num == 1);
|
||||
if (uncnstr(args[0])) {
|
||||
|
@ -309,7 +309,7 @@ class elim_uncnstr_tactic : public tactic {
|
|||
add_def(args[0], m().mk_not(r));
|
||||
return r;
|
||||
}
|
||||
return 0;
|
||||
return nullptr;
|
||||
case OP_AND:
|
||||
if (num > 0 && uncnstr(num, args)) {
|
||||
app * r;
|
||||
|
@ -319,7 +319,7 @@ class elim_uncnstr_tactic : public tactic {
|
|||
add_defs(num, args, r, m().mk_true());
|
||||
return r;
|
||||
}
|
||||
return 0;
|
||||
return nullptr;
|
||||
case OP_OR:
|
||||
if (num > 0 && uncnstr(num, args)) {
|
||||
app * r;
|
||||
|
@ -329,13 +329,13 @@ class elim_uncnstr_tactic : public tactic {
|
|||
add_defs(num, args, r, m().mk_false());
|
||||
return r;
|
||||
}
|
||||
return 0;
|
||||
return nullptr;
|
||||
case OP_IFF:
|
||||
case OP_EQ:
|
||||
SASSERT(num == 2);
|
||||
return process_eq(f, args[0], args[1]);
|
||||
default:
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -352,7 +352,7 @@ class elim_uncnstr_tactic : public tactic {
|
|||
le = !le;
|
||||
}
|
||||
else {
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
app * u;
|
||||
if (!mk_fresh_uncnstr_var_for(f, arg1, arg2, u))
|
||||
|
@ -367,9 +367,9 @@ class elim_uncnstr_tactic : public tactic {
|
|||
|
||||
app * process_add(family_id fid, decl_kind add_k, decl_kind sub_k, unsigned num, expr * const * args) {
|
||||
if (num == 0)
|
||||
return 0;
|
||||
return nullptr;
|
||||
unsigned i;
|
||||
expr * v = 0;
|
||||
expr * v = nullptr;
|
||||
for (i = 0; i < num; i++) {
|
||||
expr * arg = args[i];
|
||||
if (uncnstr(arg)) {
|
||||
|
@ -377,8 +377,8 @@ class elim_uncnstr_tactic : public tactic {
|
|||
break;
|
||||
}
|
||||
}
|
||||
if (v == 0)
|
||||
return 0;
|
||||
if (v == nullptr)
|
||||
return nullptr;
|
||||
app * u;
|
||||
if (!mk_fresh_uncnstr_var_for(m().mk_app(fid, add_k, num, args), u))
|
||||
return u;
|
||||
|
@ -406,7 +406,7 @@ class elim_uncnstr_tactic : public tactic {
|
|||
|
||||
app * process_arith_mul(func_decl * f, unsigned num, expr * const * args) {
|
||||
if (num == 0)
|
||||
return 0;
|
||||
return nullptr;
|
||||
sort * s = m().get_sort(args[0]);
|
||||
if (uncnstr(num, args)) {
|
||||
app * r;
|
||||
|
@ -421,7 +421,7 @@ class elim_uncnstr_tactic : public tactic {
|
|||
rational val;
|
||||
if (num == 2 && uncnstr(args[1]) && m_a_util.is_numeral(args[0], val, is_int) && !is_int) {
|
||||
if (val.is_zero())
|
||||
return 0;
|
||||
return nullptr;
|
||||
app * r;
|
||||
if (!mk_fresh_uncnstr_var_for(f, num, args, r))
|
||||
return r;
|
||||
|
@ -431,7 +431,7 @@ class elim_uncnstr_tactic : public tactic {
|
|||
}
|
||||
return r;
|
||||
}
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
app * process_arith_app(func_decl * f, unsigned num, expr * const * args) {
|
||||
|
@ -449,13 +449,13 @@ class elim_uncnstr_tactic : public tactic {
|
|||
SASSERT(num == 2);
|
||||
return process_le_ge(f, args[0], args[1], false);
|
||||
default:
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
app * process_bv_mul(func_decl * f, unsigned num, expr * const * args) {
|
||||
if (num == 0)
|
||||
return 0;
|
||||
return nullptr;
|
||||
if (uncnstr(num, args)) {
|
||||
sort * s = m().get_sort(args[0]);
|
||||
app * r;
|
||||
|
@ -481,12 +481,12 @@ class elim_uncnstr_tactic : public tactic {
|
|||
add_def(args[1], m_bv_util.mk_bv_mul(m_bv_util.mk_numeral(inv, s), r));
|
||||
return r;
|
||||
}
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
app * process_extract(func_decl * f, expr * arg) {
|
||||
if (!uncnstr(arg))
|
||||
return 0;
|
||||
return nullptr;
|
||||
app * r;
|
||||
if (!mk_fresh_uncnstr_var_for(f, arg, r))
|
||||
return r;
|
||||
|
@ -522,14 +522,14 @@ class elim_uncnstr_tactic : public tactic {
|
|||
add_def(arg2, m_bv_util.mk_numeral(rational(1), s));
|
||||
return r;
|
||||
}
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
app * process_concat(func_decl * f, unsigned num, expr * const * args) {
|
||||
if (num == 0)
|
||||
return 0;
|
||||
return nullptr;
|
||||
if (!uncnstr(num, args))
|
||||
return 0;
|
||||
return nullptr;
|
||||
app * r;
|
||||
if (!mk_fresh_uncnstr_var_for(f, num, args, r))
|
||||
return r;
|
||||
|
@ -552,7 +552,7 @@ class elim_uncnstr_tactic : public tactic {
|
|||
// The result of bv_le is not just introducing a new fresh name,
|
||||
// we need a side condition.
|
||||
// TODO: the correct proof step
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
if (uncnstr(arg1)) {
|
||||
// v <= t
|
||||
|
@ -592,7 +592,7 @@ class elim_uncnstr_tactic : public tactic {
|
|||
add_def(v, m().mk_ite(r, t, m_bv_util.mk_bv_sub(t, m_bv_util.mk_numeral(rational(1), bv_sz))));
|
||||
return r;
|
||||
}
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
app * process_bv_app(func_decl * f, unsigned num, expr * const * args) {
|
||||
|
@ -629,7 +629,7 @@ class elim_uncnstr_tactic : public tactic {
|
|||
add_def(args[0], m().mk_app(f, r));
|
||||
return r;
|
||||
}
|
||||
return 0;
|
||||
return nullptr;
|
||||
case OP_BOR:
|
||||
if (num > 0 && uncnstr(num, args)) {
|
||||
sort * s = m().get_sort(args[0]);
|
||||
|
@ -640,9 +640,9 @@ class elim_uncnstr_tactic : public tactic {
|
|||
add_defs(num, args, r, m_bv_util.mk_numeral(rational(0), s));
|
||||
return r;
|
||||
}
|
||||
return 0;
|
||||
return nullptr;
|
||||
default:
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -659,7 +659,7 @@ class elim_uncnstr_tactic : public tactic {
|
|||
add_def(args[0], m_ar_util.mk_const_array(s, r));
|
||||
return r;
|
||||
}
|
||||
return 0;
|
||||
return nullptr;
|
||||
case OP_STORE:
|
||||
if (uncnstr(args[0]) && uncnstr(args[num-1])) {
|
||||
app * r;
|
||||
|
@ -672,7 +672,7 @@ class elim_uncnstr_tactic : public tactic {
|
|||
return r;
|
||||
}
|
||||
default:
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -699,7 +699,7 @@ class elim_uncnstr_tactic : public tactic {
|
|||
func_decl * c = m_dt_util.get_accessor_constructor(f);
|
||||
for (unsigned i = 0; i < c->get_arity(); i++)
|
||||
if (!m().is_fully_interp(c->get_domain(i)))
|
||||
return 0;
|
||||
return nullptr;
|
||||
app * u;
|
||||
if (!mk_fresh_uncnstr_var_for(f, num, args, u))
|
||||
return u;
|
||||
|
@ -729,7 +729,7 @@ class elim_uncnstr_tactic : public tactic {
|
|||
return u;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
br_status reduce_app(func_decl * f, unsigned num, expr * const * args, expr_ref & result, proof_ref & result_pr) {
|
||||
|
@ -744,7 +744,7 @@ class elim_uncnstr_tactic : public tactic {
|
|||
return BR_FAILED; // non-ground terms are not handled.
|
||||
}
|
||||
|
||||
app * u = 0;
|
||||
app * u = nullptr;
|
||||
|
||||
if (fid == m().get_basic_family_id())
|
||||
u = process_basic_app(f, num, args);
|
||||
|
@ -757,7 +757,7 @@ class elim_uncnstr_tactic : public tactic {
|
|||
else if (fid == m_dt_util.get_family_id())
|
||||
u = process_datatype_app(f, num, args);
|
||||
|
||||
if (u == 0)
|
||||
if (u == nullptr)
|
||||
return BR_FAILED;
|
||||
|
||||
result = u;
|
||||
|
@ -805,7 +805,7 @@ class elim_uncnstr_tactic : public tactic {
|
|||
|
||||
void init_mc(bool produce_models) {
|
||||
if (!produce_models) {
|
||||
m_mc = 0;
|
||||
m_mc = nullptr;
|
||||
return;
|
||||
}
|
||||
m_mc = alloc(mc, m(), "elim_uncstr");
|
||||
|
@ -814,12 +814,11 @@ class elim_uncnstr_tactic : public tactic {
|
|||
void init_rw(bool produce_proofs) {
|
||||
m_rw = alloc(rw, m(), produce_proofs, m_vars, m_mc.get(), m_max_memory, m_max_steps);
|
||||
}
|
||||
|
||||
void operator()(goal_ref const & g,
|
||||
goal_ref_buffer & result) {
|
||||
|
||||
void operator()(goal_ref const & g, goal_ref_buffer& result) {
|
||||
bool produce_models = g->models_enabled();
|
||||
bool produce_proofs = g->proofs_enabled();
|
||||
|
||||
|
||||
TRACE("elim_uncnstr_bug", g->display(tout););
|
||||
tactic_report report("elim-uncnstr-vars", *g);
|
||||
m_vars.reset();
|
||||
|
@ -832,10 +831,7 @@ class elim_uncnstr_tactic : public tactic {
|
|||
}
|
||||
bool modified = true;
|
||||
TRACE("elim_uncnstr", tout << "unconstrained variables...\n";
|
||||
obj_hashtable<expr>::iterator it = m_vars.begin();
|
||||
obj_hashtable<expr>::iterator end = m_vars.end();
|
||||
for (; it != end; ++it) {
|
||||
expr * v = *it;
|
||||
for (expr * v : m_vars) {
|
||||
tout << mk_ismt2_pp(v, m()) << " ";
|
||||
}
|
||||
tout << "\n";);
|
||||
|
@ -876,8 +872,8 @@ class elim_uncnstr_tactic : public tactic {
|
|||
g->set((model_converter*)nullptr);
|
||||
}
|
||||
}
|
||||
m_mc = 0;
|
||||
m_rw = 0;
|
||||
m_mc = nullptr;
|
||||
m_rw = nullptr;
|
||||
result.push_back(g.get());
|
||||
g->inc_depth();
|
||||
return;
|
||||
|
@ -897,7 +893,7 @@ class elim_uncnstr_tactic : public tactic {
|
|||
idx = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
imp * m_imp;
|
||||
|
@ -908,31 +904,31 @@ public:
|
|||
m_imp = alloc(imp, m, p);
|
||||
}
|
||||
|
||||
virtual tactic * translate(ast_manager & m) {
|
||||
tactic * translate(ast_manager & m) override {
|
||||
return alloc(elim_uncnstr_tactic, m, m_params);
|
||||
}
|
||||
|
||||
virtual ~elim_uncnstr_tactic() {
|
||||
~elim_uncnstr_tactic() override {
|
||||
dealloc(m_imp);
|
||||
}
|
||||
|
||||
virtual void updt_params(params_ref const & p) {
|
||||
void updt_params(params_ref const & p) override {
|
||||
m_params = p;
|
||||
m_imp->updt_params(p);
|
||||
}
|
||||
|
||||
virtual void collect_param_descrs(param_descrs & r) {
|
||||
void collect_param_descrs(param_descrs & r) override {
|
||||
insert_max_memory(r);
|
||||
insert_max_steps(r);
|
||||
}
|
||||
|
||||
virtual void operator()(goal_ref const & g,
|
||||
goal_ref_buffer & result) {
|
||||
void operator()(goal_ref const & g,
|
||||
goal_ref_buffer & result) override {
|
||||
(*m_imp)(g, result);
|
||||
report_tactic_progress(":num-elim-apps", get_num_elim_apps());
|
||||
}
|
||||
|
||||
virtual void cleanup() {
|
||||
void cleanup() override {
|
||||
unsigned num_elim_apps = get_num_elim_apps();
|
||||
ast_manager & m = m_imp->m_manager;
|
||||
imp * d = alloc(imp, m, m_params);
|
||||
|
@ -945,11 +941,11 @@ public:
|
|||
return m_imp->m_num_elim_apps;
|
||||
}
|
||||
|
||||
virtual void collect_statistics(statistics & st) const {
|
||||
void collect_statistics(statistics & st) const override {
|
||||
st.update("eliminated applications", get_num_elim_apps());
|
||||
}
|
||||
|
||||
virtual void reset_statistics() {
|
||||
void reset_statistics() override {
|
||||
m_imp->m_num_elim_apps = 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -246,28 +246,28 @@ public:
|
|||
m_eq = alloc(rewriter_eq, m, *m_map, p);
|
||||
}
|
||||
|
||||
virtual tactic * translate(ast_manager & m) {
|
||||
tactic * translate(ast_manager & m) override {
|
||||
return alloc(injectivity_tactic, m, m_params);
|
||||
}
|
||||
|
||||
virtual ~injectivity_tactic() {
|
||||
~injectivity_tactic() override {
|
||||
dealloc(m_finder);
|
||||
dealloc(m_eq);
|
||||
dealloc(m_map);
|
||||
}
|
||||
|
||||
virtual void updt_params(params_ref const & p) {
|
||||
void updt_params(params_ref const & p) override {
|
||||
m_params = p;
|
||||
m_finder->updt_params(p);
|
||||
}
|
||||
|
||||
virtual void collect_param_descrs(param_descrs & r) {
|
||||
void collect_param_descrs(param_descrs & r) override {
|
||||
insert_max_memory(r);
|
||||
insert_produce_models(r);
|
||||
}
|
||||
|
||||
virtual void operator()(goal_ref const & g,
|
||||
goal_ref_buffer & result) {
|
||||
void operator()(goal_ref const & g,
|
||||
goal_ref_buffer & result) override {
|
||||
(*m_finder)(g, result);
|
||||
|
||||
for (unsigned i = 0; i < g->size(); ++i) {
|
||||
|
@ -280,7 +280,7 @@ public:
|
|||
result.push_back(g.get());
|
||||
}
|
||||
|
||||
virtual void cleanup() {
|
||||
void cleanup() override {
|
||||
InjHelper * m = alloc(InjHelper, m_manager);
|
||||
finder * f = alloc(finder, m_manager, *m, m_params);
|
||||
rewriter_eq * r = alloc(rewriter_eq, m_manager, *m, m_params);
|
||||
|
|
|
@ -33,28 +33,27 @@ class nnf_tactic : public tactic {
|
|||
}
|
||||
|
||||
~set_nnf() {
|
||||
m_owner.m_nnf = 0;
|
||||
m_owner.m_nnf = nullptr;
|
||||
}
|
||||
};
|
||||
public:
|
||||
nnf_tactic(params_ref const & p):
|
||||
m_params(p),
|
||||
m_nnf(0) {
|
||||
m_nnf(nullptr) {
|
||||
TRACE("nnf", tout << "nnf_tactic constructor: " << p << "\n";);
|
||||
}
|
||||
|
||||
virtual tactic * translate(ast_manager & m) {
|
||||
tactic * translate(ast_manager & m) override {
|
||||
return alloc(nnf_tactic, m_params);
|
||||
}
|
||||
|
||||
virtual ~nnf_tactic() {}
|
||||
~nnf_tactic() override {}
|
||||
|
||||
virtual void updt_params(params_ref const & p) { m_params = p; }
|
||||
void updt_params(params_ref const & p) override { m_params = p; }
|
||||
|
||||
virtual void collect_param_descrs(param_descrs & r) { nnf::get_param_descrs(r); }
|
||||
void collect_param_descrs(param_descrs & r) override { nnf::get_param_descrs(r); }
|
||||
|
||||
virtual void operator()(goal_ref const & g,
|
||||
goal_ref_buffer & result) {
|
||||
void operator()(goal_ref const & g, goal_ref_buffer & result) override {
|
||||
TRACE("nnf", tout << "params: " << m_params << "\n"; g->display(tout););
|
||||
SASSERT(g->is_well_sorted());
|
||||
tactic_report report("nnf", *g);
|
||||
|
@ -85,9 +84,9 @@ public:
|
|||
sz = defs.size();
|
||||
for (unsigned i = 0; i < sz; i++) {
|
||||
if (produce_proofs)
|
||||
g->assert_expr(defs.get(i), def_prs.get(i), 0);
|
||||
g->assert_expr(defs.get(i), def_prs.get(i), nullptr);
|
||||
else
|
||||
g->assert_expr(defs.get(i), 0, 0);
|
||||
g->assert_expr(defs.get(i), nullptr, nullptr);
|
||||
}
|
||||
g->inc_depth();
|
||||
result.push_back(g.get());
|
||||
|
@ -102,7 +101,7 @@ public:
|
|||
SASSERT(g->is_well_sorted());
|
||||
}
|
||||
|
||||
virtual void cleanup() {}
|
||||
void cleanup() override {}
|
||||
};
|
||||
|
||||
tactic * mk_snf_tactic(ast_manager & m, params_ref const & p) {
|
||||
|
|
|
@ -9,7 +9,7 @@ Abstract:
|
|||
|
||||
Put clauses in the assertion set in
|
||||
OOC (one constraint per clause) form.
|
||||
Constraints occuring in formulas that
|
||||
Constraints occurring in formulas that
|
||||
are not clauses are ignored.
|
||||
The formula can be put into CNF by
|
||||
using mk_sat_preprocessor strategy.
|
||||
|
@ -68,7 +68,7 @@ class occf_tactic : public tactic {
|
|||
expr * m_bvar;
|
||||
unsigned m_gen_pos:1;
|
||||
unsigned m_gen_neg:1;
|
||||
bvar_info():m_bvar(0), m_gen_pos(false), m_gen_neg(false) {}
|
||||
bvar_info():m_bvar(nullptr), m_gen_pos(false), m_gen_neg(false) {}
|
||||
bvar_info(expr * var, bool sign):
|
||||
m_bvar(var),
|
||||
m_gen_pos(!sign),
|
||||
|
@ -86,20 +86,20 @@ class occf_tactic : public tactic {
|
|||
}
|
||||
|
||||
cnstr2bvar::obj_map_entry * entry = c2b.find_core(cnstr);
|
||||
if (entry == 0)
|
||||
return 0;
|
||||
if (entry == nullptr)
|
||||
return nullptr;
|
||||
bvar_info & info = entry->get_data().m_value;
|
||||
if (sign) {
|
||||
if (!info.m_gen_neg) {
|
||||
info.m_gen_neg = true;
|
||||
g->assert_expr(m.mk_or(info.m_bvar, m.mk_not(cnstr)), 0, 0);
|
||||
g->assert_expr(m.mk_or(info.m_bvar, m.mk_not(cnstr)), nullptr, nullptr);
|
||||
}
|
||||
return m.mk_not(info.m_bvar);
|
||||
}
|
||||
else {
|
||||
if (!info.m_gen_pos) {
|
||||
info.m_gen_pos = true;
|
||||
g->assert_expr(m.mk_or(m.mk_not(info.m_bvar), cnstr), 0, 0);
|
||||
g->assert_expr(m.mk_or(m.mk_not(info.m_bvar), cnstr), nullptr, nullptr);
|
||||
}
|
||||
return info.m_bvar;
|
||||
}
|
||||
|
@ -113,16 +113,16 @@ class occf_tactic : public tactic {
|
|||
}
|
||||
|
||||
SASSERT(!c2b.contains(cnstr));
|
||||
expr * bvar = m.mk_fresh_const(0, m.mk_bool_sort());
|
||||
expr * bvar = m.mk_fresh_const(nullptr, m.mk_bool_sort());
|
||||
if (produce_models)
|
||||
m_mc->hide(to_app(bvar)->get_decl());
|
||||
c2b.insert(cnstr, bvar_info(bvar, sign));
|
||||
if (sign) {
|
||||
g->assert_expr(m.mk_or(bvar, m.mk_not(cnstr)), 0, 0);
|
||||
g->assert_expr(m.mk_or(bvar, m.mk_not(cnstr)), nullptr, nullptr);
|
||||
return m.mk_not(bvar);
|
||||
}
|
||||
else {
|
||||
g->assert_expr(m.mk_or(m.mk_not(bvar), cnstr), 0, 0);
|
||||
g->assert_expr(m.mk_or(m.mk_not(bvar), cnstr), nullptr, nullptr);
|
||||
return bvar;
|
||||
}
|
||||
}
|
||||
|
@ -130,13 +130,12 @@ class occf_tactic : public tactic {
|
|||
void operator()(goal_ref const & g,
|
||||
goal_ref_buffer & result) {
|
||||
SASSERT(g->is_well_sorted());
|
||||
|
||||
fail_if_proof_generation("occf", g);
|
||||
|
||||
bool produce_models = g->models_enabled();
|
||||
tactic_report report("occf", *g);
|
||||
|
||||
m_mc = 0;
|
||||
m_mc = nullptr;
|
||||
|
||||
ptr_vector<expr> new_lits;
|
||||
|
||||
|
@ -156,17 +155,17 @@ class occf_tactic : public tactic {
|
|||
m_mc = alloc(generic_model_converter, m, "occf");
|
||||
g->add(m_mc);
|
||||
}
|
||||
expr * keep = 0;
|
||||
expr * keep = nullptr;
|
||||
new_lits.reset();
|
||||
unsigned num = cls->get_num_args();
|
||||
for (unsigned j = 0; j < num; j++) {
|
||||
expr * l = cls->get_arg(j);
|
||||
if (is_constraint(l)) {
|
||||
expr * new_l = get_aux_lit(c2b, l, g);
|
||||
if (new_l != 0) {
|
||||
if (new_l != nullptr) {
|
||||
new_lits.push_back(new_l);
|
||||
}
|
||||
else if (keep == 0) {
|
||||
else if (keep == nullptr) {
|
||||
keep = l;
|
||||
}
|
||||
else {
|
||||
|
@ -178,9 +177,9 @@ class occf_tactic : public tactic {
|
|||
new_lits.push_back(l);
|
||||
}
|
||||
}
|
||||
if (keep != 0)
|
||||
if (keep != nullptr)
|
||||
new_lits.push_back(keep);
|
||||
g->update(i, m.mk_or(new_lits.size(), new_lits.c_ptr()), 0, d);
|
||||
g->update(i, m.mk_or(new_lits.size(), new_lits.c_ptr()), nullptr, d);
|
||||
}
|
||||
g->inc_depth();
|
||||
result.push_back(g.get());
|
||||
|
@ -195,23 +194,23 @@ public:
|
|||
m_imp = alloc(imp, m);
|
||||
}
|
||||
|
||||
virtual tactic * translate(ast_manager & m) {
|
||||
tactic * translate(ast_manager & m) override {
|
||||
return alloc(occf_tactic, m);
|
||||
}
|
||||
|
||||
virtual ~occf_tactic() {
|
||||
~occf_tactic() override {
|
||||
dealloc(m_imp);
|
||||
}
|
||||
|
||||
virtual void updt_params(params_ref const & p) {}
|
||||
virtual void collect_param_descrs(param_descrs & r) {}
|
||||
void updt_params(params_ref const & p) override {}
|
||||
void collect_param_descrs(param_descrs & r) override {}
|
||||
|
||||
virtual void operator()(goal_ref const & in,
|
||||
goal_ref_buffer & result) {
|
||||
void operator()(goal_ref const & in,
|
||||
goal_ref_buffer & result) override {
|
||||
(*m_imp)(in, result);
|
||||
}
|
||||
|
||||
virtual void cleanup() {
|
||||
void cleanup() override {
|
||||
imp * d = alloc(imp, m_imp->m);
|
||||
std::swap(d, m_imp);
|
||||
dealloc(d);
|
||||
|
|
|
@ -9,7 +9,7 @@ Abstract:
|
|||
|
||||
Put clauses in the assertion set in
|
||||
OOC (one constraint per clause) form.
|
||||
Constraints occuring in formulas that
|
||||
Constraints occurring in formulas that
|
||||
are not clauses are ignored.
|
||||
The formula can be put into CNF by
|
||||
using mk_sat_preprocessor strategy.
|
||||
|
|
|
@ -101,9 +101,9 @@ public:
|
|||
pb_preprocess_tactic(ast_manager& m, params_ref const& p = params_ref()):
|
||||
m(m), pb(m), m_r(m) {}
|
||||
|
||||
virtual ~pb_preprocess_tactic() {}
|
||||
~pb_preprocess_tactic() override {}
|
||||
|
||||
virtual tactic * translate(ast_manager & m) {
|
||||
tactic * translate(ast_manager & m) override {
|
||||
return alloc(pb_preprocess_tactic, m);
|
||||
}
|
||||
|
||||
|
@ -212,7 +212,7 @@ public:
|
|||
if (!to_ge(g->form(k), args2, coeffs2, k2)) continue;
|
||||
if (subsumes(args1, coeffs1, k1, args2, coeffs2, k2)) {
|
||||
IF_VERBOSE(3, verbose_stream() << "replace " << mk_pp(g->form(k), m) << "\n";);
|
||||
g->update(k, m.mk_true(), 0, m.mk_join(g->dep(m_ge[i]), g->dep(k)));
|
||||
g->update(k, m.mk_true(), nullptr, m.mk_join(g->dep(m_ge[i]), g->dep(k)));
|
||||
m_progress = true;
|
||||
}
|
||||
}
|
||||
|
@ -223,15 +223,15 @@ public:
|
|||
return m_progress;
|
||||
}
|
||||
|
||||
virtual void updt_params(params_ref const & p) {
|
||||
void updt_params(params_ref const & p) override {
|
||||
}
|
||||
|
||||
virtual void cleanup() {
|
||||
void cleanup() override {
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
void reset() {
|
||||
void reset() override {
|
||||
m_ge.reset();
|
||||
m_other.reset();
|
||||
m_vars.reset();
|
||||
|
@ -290,12 +290,12 @@ private:
|
|||
for (unsigned j = 0; j < cuts.size(); ++j) {
|
||||
unsigned end = cuts[j];
|
||||
fml1 = decompose_cut(a, start, end, cut_args, cut_coeffs);
|
||||
g->assert_expr(fml1, 0, g->dep(i));
|
||||
g->assert_expr(fml1, nullptr, g->dep(i));
|
||||
start = end;
|
||||
TRACE("pb", tout << fml1 << "\n";);
|
||||
}
|
||||
fml2 = pb.mk_ge(cut_args.size(), cut_coeffs.c_ptr(), cut_args.c_ptr(), pb.get_k(e));
|
||||
g->update(i, fml2, 0, g->dep(i));
|
||||
g->update(i, fml2, nullptr, g->dep(i));
|
||||
TRACE("pb", tout << fml2 << "\n";);
|
||||
}
|
||||
}
|
||||
|
@ -540,8 +540,8 @@ private:
|
|||
tout << "resolve: " << mk_pp(fml1, m) << "\n" << mk_pp(fml2, m) << "\n" << tmp1 << "\n";
|
||||
tout << "to\n" << mk_pp(fml2, m) << " -> " << tmp2 << "\n";);
|
||||
|
||||
g->update(idx2, tmp2, 0, m.mk_join(g->dep(idx1), g->dep(idx2)));
|
||||
g->update(idx1, m.mk_true(), 0, 0);
|
||||
g->update(idx2, tmp2, nullptr, m.mk_join(g->dep(idx1), g->dep(idx2)));
|
||||
g->update(idx1, m.mk_true(), nullptr, nullptr);
|
||||
m_progress = true;
|
||||
//IF_VERBOSE(0, if (!g->inconsistent()) display_annotation(verbose_stream(), g););
|
||||
}
|
||||
|
@ -613,7 +613,7 @@ private:
|
|||
}
|
||||
}
|
||||
}
|
||||
m_r.set_substitution(0);
|
||||
m_r.set_substitution(nullptr);
|
||||
}
|
||||
|
||||
bool subsumes(expr_ref_vector const& args1,
|
||||
|
|
|
@ -39,7 +39,7 @@ class propagate_values_tactic : public tactic {
|
|||
imp(ast_manager & m, params_ref const & p):
|
||||
m(m),
|
||||
m_r(m, p),
|
||||
m_goal(0),
|
||||
m_goal(nullptr),
|
||||
m_occs(m, true /* track atoms */) {
|
||||
updt_params_core(p);
|
||||
}
|
||||
|
@ -93,7 +93,7 @@ class propagate_values_tactic : public tactic {
|
|||
if (m_goal->unsat_core_enabled()) {
|
||||
new_d = m_goal->dep(m_idx);
|
||||
expr_dependency * used_d = m_r.get_used_dependencies();
|
||||
if (used_d != 0) {
|
||||
if (used_d != nullptr) {
|
||||
new_d = m.mk_join(new_d, used_d);
|
||||
m_r.reset_used_dependencies();
|
||||
}
|
||||
|
@ -220,8 +220,7 @@ class propagate_values_tactic : public tactic {
|
|||
SASSERT(m_goal->is_well_sorted());
|
||||
TRACE("propagate_values", tout << "end\n"; m_goal->display(tout););
|
||||
TRACE("propagate_values_core", m_goal->display_with_dependencies(tout););
|
||||
//IF_VERBOSE(0, m_goal->display(verbose_stream()));
|
||||
m_goal = 0;
|
||||
m_goal = nullptr;
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -233,20 +232,20 @@ public:
|
|||
m_imp = alloc(imp, m, p);
|
||||
}
|
||||
|
||||
virtual tactic * translate(ast_manager & m) {
|
||||
tactic * translate(ast_manager & m) override {
|
||||
return alloc(propagate_values_tactic, m, m_params);
|
||||
}
|
||||
|
||||
virtual ~propagate_values_tactic() {
|
||||
~propagate_values_tactic() override {
|
||||
dealloc(m_imp);
|
||||
}
|
||||
|
||||
virtual void updt_params(params_ref const & p) {
|
||||
void updt_params(params_ref const & p) override {
|
||||
m_params = p;
|
||||
m_imp->updt_params(p);
|
||||
}
|
||||
|
||||
virtual void collect_param_descrs(param_descrs & r) {
|
||||
void collect_param_descrs(param_descrs & r) override {
|
||||
th_rewriter::get_param_descrs(r);
|
||||
r.insert("max_rounds", CPK_UINT, "(default: 2) maximum number of rounds.");
|
||||
}
|
||||
|
@ -260,10 +259,11 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
virtual void cleanup() {
|
||||
void cleanup() override {
|
||||
ast_manager & m = m_imp->m;
|
||||
dealloc(m_imp);
|
||||
m_imp = alloc(imp, m, m_params);
|
||||
params_ref p = std::move(m_params);
|
||||
m_imp->~imp();
|
||||
new (m_imp) imp(m, p);
|
||||
}
|
||||
|
||||
};
|
||||
|
|
|
@ -67,11 +67,11 @@ class reduce_args_tactic : public tactic {
|
|||
public:
|
||||
reduce_args_tactic(ast_manager & m);
|
||||
|
||||
virtual tactic * translate(ast_manager & m) {
|
||||
tactic * translate(ast_manager & m) override {
|
||||
return alloc(reduce_args_tactic, m);
|
||||
}
|
||||
|
||||
virtual ~reduce_args_tactic();
|
||||
~reduce_args_tactic() override;
|
||||
|
||||
void operator()(goal_ref const & g, goal_ref_buffer & result) override;
|
||||
void cleanup() override;
|
||||
|
@ -103,7 +103,7 @@ struct reduce_args_tactic::imp {
|
|||
}
|
||||
|
||||
static bool may_be_unique(ast_manager& m, bv_util& bv, expr* e, expr*& base) {
|
||||
base = 0;
|
||||
base = nullptr;
|
||||
return m.is_unique_value(e) || is_var_plus_offset(m, bv, e, base);
|
||||
}
|
||||
|
||||
|
@ -340,7 +340,7 @@ struct reduce_args_tactic::imp {
|
|||
}
|
||||
|
||||
br_status reduce_app(func_decl * f, unsigned num, expr * const * args, expr_ref & result, proof_ref & result_pr) {
|
||||
result_pr = 0;
|
||||
result_pr = nullptr;
|
||||
if (f->get_arity() == 0)
|
||||
return BR_FAILED; // ignore constants
|
||||
if (f->get_family_id() != null_family_id)
|
||||
|
@ -356,7 +356,7 @@ struct reduce_args_tactic::imp {
|
|||
}
|
||||
|
||||
app_ref tmp(m.mk_app(f, num, args), m);
|
||||
func_decl *& new_f = map->insert_if_not_there2(tmp, 0)->get_data().m_value;
|
||||
func_decl *& new_f = map->insert_if_not_there2(tmp, nullptr)->get_data().m_value;
|
||||
if (!new_f) {
|
||||
// create fresh symbol
|
||||
ptr_buffer<sort> domain;
|
||||
|
@ -397,7 +397,7 @@ struct reduce_args_tactic::imp {
|
|||
for (auto const& kv : decl2arg2funcs) {
|
||||
func_decl * f = kv.m_key;
|
||||
arg2func * map = kv.m_value;
|
||||
expr * def = 0;
|
||||
expr * def = nullptr;
|
||||
SASSERT(decl2args.contains(f));
|
||||
bit_vector & bv = decl2args.find(f);
|
||||
new_vars.reset();
|
||||
|
@ -415,7 +415,7 @@ struct reduce_args_tactic::imp {
|
|||
f_mc->hide(new_def);
|
||||
SASSERT(new_def->get_arity() == new_args.size());
|
||||
app * new_t = m_manager.mk_app(new_def, new_args.size(), new_args.c_ptr());
|
||||
if (def == 0) {
|
||||
if (def == nullptr) {
|
||||
def = new_t;
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -107,9 +107,9 @@ void simplify_tactic::operator()(goal_ref const & in,
|
|||
|
||||
void simplify_tactic::cleanup() {
|
||||
ast_manager & m = m_imp->m();
|
||||
imp * d = alloc(imp, m, m_params);
|
||||
std::swap(d, m_imp);
|
||||
dealloc(d);
|
||||
params_ref p = std::move(m_params);
|
||||
m_imp->~imp();
|
||||
new (m_imp) imp(m, p);
|
||||
}
|
||||
|
||||
unsigned simplify_tactic::get_num_steps() const {
|
||||
|
|
|
@ -28,7 +28,7 @@ class simplify_tactic : public tactic {
|
|||
params_ref m_params;
|
||||
public:
|
||||
simplify_tactic(ast_manager & m, params_ref const & ref = params_ref());
|
||||
virtual ~simplify_tactic();
|
||||
~simplify_tactic() override;
|
||||
|
||||
void updt_params(params_ref const & p) override;
|
||||
|
||||
|
|
|
@ -45,6 +45,7 @@ class solve_eqs_tactic : public tactic {
|
|||
expr_sparse_mark m_candidate_set;
|
||||
ptr_vector<expr> m_candidates;
|
||||
ptr_vector<app> m_vars;
|
||||
expr_sparse_mark m_nonzero;
|
||||
ptr_vector<app> m_ordered_vars;
|
||||
bool m_produce_proofs;
|
||||
bool m_produce_unsat_cores;
|
||||
|
@ -53,13 +54,12 @@ class solve_eqs_tactic : public tactic {
|
|||
imp(ast_manager & m, params_ref const & p, expr_replacer * r, bool owner):
|
||||
m_manager(m),
|
||||
m_r(r),
|
||||
m_r_owner(r == 0 || owner),
|
||||
m_r_owner(r == nullptr || owner),
|
||||
m_a_util(m),
|
||||
m_num_steps(0),
|
||||
m_num_eliminated_vars(0)
|
||||
{
|
||||
m_num_eliminated_vars(0) {
|
||||
updt_params(p);
|
||||
if (m_r == 0)
|
||||
if (m_r == nullptr)
|
||||
m_r = mk_default_expr_replacer(m);
|
||||
}
|
||||
|
||||
|
@ -79,7 +79,7 @@ class solve_eqs_tactic : public tactic {
|
|||
void checkpoint() {
|
||||
if (m().canceled())
|
||||
throw tactic_exception(m().limit().get_cancel_msg());
|
||||
cooperate("solve-eqs");
|
||||
cooperate("solve-eqs");
|
||||
}
|
||||
|
||||
// Check if the number of occurrences of t is below the specified threshold :solve-eqs-max-occs
|
||||
|
@ -99,7 +99,7 @@ class solve_eqs_tactic : public tactic {
|
|||
if (is_uninterp_const(lhs) && !m_candidate_vars.is_marked(lhs) && !occurs(lhs, rhs) && check_occs(lhs)) {
|
||||
var = to_app(lhs);
|
||||
def = rhs;
|
||||
pr = 0;
|
||||
pr = nullptr;
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
|
@ -107,7 +107,8 @@ class solve_eqs_tactic : public tactic {
|
|||
}
|
||||
}
|
||||
bool trivial_solve(expr * lhs, expr * rhs, app_ref & var, expr_ref & def, proof_ref & pr) {
|
||||
if (trivial_solve1(lhs, rhs, var, def, pr)) return true;
|
||||
if (trivial_solve1(lhs, rhs, var, def, pr))
|
||||
return true;
|
||||
if (trivial_solve1(rhs, lhs, var, def, pr)) {
|
||||
if (m_produce_proofs) {
|
||||
pr = m().mk_commutativity(m().mk_eq(lhs, rhs));
|
||||
|
@ -188,6 +189,77 @@ class solve_eqs_tactic : public tactic {
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void add_pos(expr* f) {
|
||||
expr* lhs = nullptr, *rhs = nullptr;
|
||||
rational val;
|
||||
if (m_a_util.is_le(f, lhs, rhs) && m_a_util.is_numeral(rhs, val) && val.is_neg()) {
|
||||
m_nonzero.mark(lhs);
|
||||
}
|
||||
else if (m_a_util.is_ge(f, lhs, rhs) && m_a_util.is_numeral(rhs, val) && val.is_pos()) {
|
||||
m_nonzero.mark(lhs);
|
||||
}
|
||||
else if (m().is_not(f, f)) {
|
||||
if (m_a_util.is_le(f, lhs, rhs) && m_a_util.is_numeral(rhs, val) && !val.is_neg()) {
|
||||
m_nonzero.mark(lhs);
|
||||
}
|
||||
else if (m_a_util.is_ge(f, lhs, rhs) && m_a_util.is_numeral(rhs, val) && !val.is_pos()) {
|
||||
m_nonzero.mark(lhs);
|
||||
}
|
||||
else if (m().is_eq(f, lhs, rhs) && m_a_util.is_numeral(rhs, val) && val.is_zero()) {
|
||||
m_nonzero.mark(lhs);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool is_nonzero(expr* e) {
|
||||
return m_nonzero.is_marked(e);
|
||||
}
|
||||
|
||||
bool isolate_var(app* arg, app_ref& var, expr_ref& div, unsigned i, app* lhs, expr* rhs) {
|
||||
if (!m_a_util.is_mul(arg)) return false;
|
||||
unsigned n = arg->get_num_args();
|
||||
for (unsigned j = 0; j < n; ++j) {
|
||||
expr* e = arg->get_arg(j);
|
||||
bool ok = is_uninterp_const(e) && check_occs(e) && !occurs(e, rhs) && !occurs_except(e, lhs, i);
|
||||
if (!ok) continue;
|
||||
var = to_app(e);
|
||||
for (unsigned k = 0; ok && k < n; ++k) {
|
||||
expr* arg_k = arg->get_arg(k);
|
||||
ok = k == j || (!occurs(var, arg_k) && is_nonzero(arg_k));
|
||||
}
|
||||
if (!ok) continue;
|
||||
ptr_vector<expr> args;
|
||||
for (unsigned k = 0; k < n; ++k) {
|
||||
if (k != j) args.push_back(arg->get_arg(k));
|
||||
}
|
||||
div = m_a_util.mk_mul(args.size(), args.c_ptr());
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool solve_nl(app * lhs, expr * rhs, expr* eq, app_ref& var, expr_ref & def, proof_ref & pr) {
|
||||
SASSERT(m_a_util.is_add(lhs));
|
||||
if (m_a_util.is_int(lhs)) return false;
|
||||
unsigned num = lhs->get_num_args();
|
||||
expr_ref div(m());
|
||||
for (unsigned i = 0; i < num; i++) {
|
||||
expr * arg = lhs->get_arg(i);
|
||||
if (is_app(arg) && isolate_var(to_app(arg), var, div, i, lhs, rhs)) {
|
||||
ptr_vector<expr> args;
|
||||
for (unsigned k = 0; k < num; ++k) {
|
||||
if (k != i) args.push_back(lhs->get_arg(k));
|
||||
}
|
||||
def = m_a_util.mk_sub(rhs, m_a_util.mk_add(args.size(), args.c_ptr()));
|
||||
def = m_a_util.mk_div(def, div);
|
||||
if (m_produce_proofs)
|
||||
pr = m().mk_rewrite(eq, m().mk_eq(var, def));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool solve_arith_core(app * lhs, expr * rhs, expr * eq, app_ref & var, expr_ref & def, proof_ref & pr) {
|
||||
SASSERT(m_a_util.is_add(lhs));
|
||||
|
@ -205,7 +277,8 @@ class solve_eqs_tactic : public tactic {
|
|||
break;
|
||||
}
|
||||
else if (m_a_util.is_mul(arg, a, v) &&
|
||||
is_uninterp_const(v) && !m_candidate_vars.is_marked(v) &&
|
||||
is_uninterp_const(v) &&
|
||||
!m_candidate_vars.is_marked(v) &&
|
||||
m_a_util.is_numeral(a, a_val) &&
|
||||
!a_val.is_zero() &&
|
||||
(!is_int || a_val.is_minus_one()) &&
|
||||
|
@ -253,16 +326,20 @@ class solve_eqs_tactic : public tactic {
|
|||
return
|
||||
(m_a_util.is_add(lhs) && solve_arith_core(to_app(lhs), rhs, eq, var, def, pr)) ||
|
||||
(m_a_util.is_add(rhs) && solve_arith_core(to_app(rhs), lhs, eq, var, def, pr));
|
||||
#if 0
|
||||
// better done inside of nlsat
|
||||
(m_a_util.is_add(lhs) && solve_nl(to_app(lhs), rhs, eq, var, def, pr)) ||
|
||||
(m_a_util.is_add(rhs) && solve_nl(to_app(rhs), lhs, eq, var, def, pr));
|
||||
#endif
|
||||
}
|
||||
|
||||
bool solve(expr * f, app_ref & var, expr_ref & def, proof_ref & pr) {
|
||||
if (m().is_eq(f)) {
|
||||
if (trivial_solve(to_app(f)->get_arg(0), to_app(f)->get_arg(1), var, def, pr))
|
||||
expr* arg1 = nullptr, *arg2 = nullptr;
|
||||
if (m().is_eq(f, arg1, arg2)) {
|
||||
if (trivial_solve(arg1, arg2, var, def, pr))
|
||||
return true;
|
||||
if (m_theory_solver) {
|
||||
expr * lhs = to_app(f)->get_arg(0);
|
||||
expr * rhs = to_app(f)->get_arg(1);
|
||||
if (solve_arith(lhs, rhs, f, var, def, pr))
|
||||
if (solve_arith(arg1, arg2, f, var, def, pr))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -317,16 +394,19 @@ class solve_eqs_tactic : public tactic {
|
|||
void collect(goal const & g) {
|
||||
m_subst->reset();
|
||||
m_norm_subst->reset();
|
||||
m_r->set_substitution(0);
|
||||
m_r->set_substitution(nullptr);
|
||||
m_candidate_vars.reset();
|
||||
m_candidate_set.reset();
|
||||
m_candidates.reset();
|
||||
m_vars.reset();
|
||||
|
||||
m_nonzero.reset();
|
||||
app_ref var(m());
|
||||
expr_ref def(m());
|
||||
proof_ref pr(m());
|
||||
unsigned size = g.size();
|
||||
for (unsigned idx = 0; idx < size; idx++) {
|
||||
add_pos(g.form(idx));
|
||||
}
|
||||
for (unsigned idx = 0; idx < size; idx++) {
|
||||
checkpoint();
|
||||
expr * f = g.form(idx);
|
||||
|
@ -373,12 +453,9 @@ class solve_eqs_tactic : public tactic {
|
|||
|
||||
typedef std::pair<expr *, unsigned> frame;
|
||||
svector<frame> todo;
|
||||
ptr_vector<app>::const_iterator it = m_vars.begin();
|
||||
ptr_vector<app>::const_iterator end = m_vars.end();
|
||||
unsigned num;
|
||||
for (; it != end; ++it) {
|
||||
unsigned num = 0;
|
||||
for (app* v : m_vars) {
|
||||
checkpoint();
|
||||
app * v = *it;
|
||||
if (!m_candidate_vars.is_marked(v))
|
||||
continue;
|
||||
todo.push_back(frame(v, 0));
|
||||
|
@ -423,7 +500,7 @@ class solve_eqs_tactic : public tactic {
|
|||
|
||||
// Must save t and its definition.
|
||||
// See comment in the beginning of the function
|
||||
expr * def = 0;
|
||||
expr * def = nullptr;
|
||||
proof * pr;
|
||||
expr_dependency * dep;
|
||||
m_subst->find(to_app(t), def, pr, dep);
|
||||
|
@ -437,7 +514,7 @@ class solve_eqs_tactic : public tactic {
|
|||
else {
|
||||
visiting.mark(t);
|
||||
fr.second = 1;
|
||||
expr * def = 0;
|
||||
expr * def = nullptr;
|
||||
proof * pr;
|
||||
expr_dependency * dep;
|
||||
m_subst->find(to_app(t), def, pr, dep);
|
||||
|
@ -482,11 +559,12 @@ class solve_eqs_tactic : public tactic {
|
|||
}
|
||||
|
||||
// cleanup
|
||||
it = m_vars.begin();
|
||||
for (unsigned idx = 0; it != end; ++it, ++idx) {
|
||||
if (!m_candidate_vars.is_marked(*it)) {
|
||||
unsigned idx = 0;
|
||||
for (expr* v : m_vars) {
|
||||
if (!m_candidate_vars.is_marked(v)) {
|
||||
m_candidate_set.mark(m_candidates[idx], false);
|
||||
}
|
||||
++idx;
|
||||
}
|
||||
|
||||
TRACE("solve_eqs",
|
||||
|
@ -508,9 +586,9 @@ class solve_eqs_tactic : public tactic {
|
|||
expr_dependency_ref new_dep(m());
|
||||
for (app * v : m_ordered_vars) {
|
||||
checkpoint();
|
||||
expr * def = 0;
|
||||
proof * pr = 0;
|
||||
expr_dependency * dep = 0;
|
||||
expr * def = nullptr;
|
||||
proof * pr = nullptr;
|
||||
expr_dependency * dep = nullptr;
|
||||
m_subst->find(v, def, pr, dep);
|
||||
SASSERT(def != 0);
|
||||
m_r->operator()(def, new_def, new_pr, new_dep);
|
||||
|
@ -564,7 +642,7 @@ class solve_eqs_tactic : public tactic {
|
|||
// so, we must remove remove the mark before doing the update
|
||||
m_candidate_set.mark(f, false);
|
||||
SASSERT(!m_candidate_set.is_marked(f));
|
||||
g.update(idx, m().mk_true(), m().mk_true_proof(), 0);
|
||||
g.update(idx, m().mk_true(), m().mk_true_proof(), nullptr);
|
||||
m_num_steps ++;
|
||||
continue;
|
||||
}
|
||||
|
@ -606,14 +684,14 @@ class solve_eqs_tactic : public tactic {
|
|||
IF_VERBOSE(100, if (!m_ordered_vars.empty()) verbose_stream() << "num. eliminated vars: " << m_ordered_vars.size() << "\n";);
|
||||
m_num_eliminated_vars += m_ordered_vars.size();
|
||||
if (m_produce_models) {
|
||||
if (mc.get() == 0)
|
||||
mc = alloc(gmc, m(), "solve_eqs");
|
||||
for (app * v : m_ordered_vars) {
|
||||
expr * def = 0;
|
||||
if (!mc.get())
|
||||
mc = alloc(gmc, m(), "solve-eqs");
|
||||
for (app* v : m_ordered_vars) {
|
||||
expr * def = nullptr;
|
||||
proof * pr;
|
||||
expr_dependency * dep;
|
||||
expr_dependency * dep = nullptr;
|
||||
m_norm_subst->find(v, def, pr, dep);
|
||||
SASSERT(def != 0);
|
||||
SASSERT(def);
|
||||
static_cast<gmc*>(mc.get())->add(v, def);
|
||||
}
|
||||
}
|
||||
|
@ -715,7 +793,7 @@ public:
|
|||
return alloc(solve_eqs_tactic, m, m_params, mk_expr_simp_replacer(m, m_params), true);
|
||||
}
|
||||
|
||||
virtual ~solve_eqs_tactic() {
|
||||
~solve_eqs_tactic() override {
|
||||
dealloc(m_imp);
|
||||
}
|
||||
|
||||
|
@ -731,7 +809,7 @@ public:
|
|||
}
|
||||
|
||||
void operator()(goal_ref const & in,
|
||||
goal_ref_buffer & result) override {
|
||||
goal_ref_buffer & result) override {
|
||||
(*m_imp)(in, result);
|
||||
report_tactic_progress(":num-elim-vars", m_imp->get_num_eliminated_vars());
|
||||
}
|
||||
|
@ -741,7 +819,7 @@ public:
|
|||
ast_manager & m = m_imp->m();
|
||||
expr_replacer * r = m_imp->m_r;
|
||||
if (r)
|
||||
r->set_substitution(0);
|
||||
r->set_substitution(nullptr);
|
||||
bool owner = m_imp->m_r_owner;
|
||||
m_imp->m_r_owner = false; // stole replacer
|
||||
|
||||
|
@ -762,7 +840,7 @@ public:
|
|||
};
|
||||
|
||||
tactic * mk_solve_eqs_tactic(ast_manager & m, params_ref const & p, expr_replacer * r) {
|
||||
if (r == 0)
|
||||
if (r == nullptr)
|
||||
return clean(alloc(solve_eqs_tactic, m, p, mk_expr_simp_replacer(m, p), true));
|
||||
else
|
||||
return clean(alloc(solve_eqs_tactic, m, p, r, false));
|
||||
|
|
|
@ -24,7 +24,7 @@ class ast_manager;
|
|||
class tactic;
|
||||
class expr_replacer;
|
||||
|
||||
tactic * mk_solve_eqs_tactic(ast_manager & m, params_ref const & p = params_ref(), expr_replacer * r = 0);
|
||||
tactic * mk_solve_eqs_tactic(ast_manager & m, params_ref const & p = params_ref(), expr_replacer * r = nullptr);
|
||||
|
||||
/*
|
||||
ADD_TACTIC("solve-eqs", "eliminate variables by solving equations.", "mk_solve_eqs_tactic(m, p)")
|
||||
|
|
|
@ -53,7 +53,7 @@ class split_clause_tactic : public tactic {
|
|||
split_pc(ast_manager & m, app * cls, proof * pr):m(m), m_clause(cls, m), m_clause_pr(pr, m) {
|
||||
}
|
||||
|
||||
virtual ~split_pc() { }
|
||||
~split_pc() override { }
|
||||
|
||||
proof_ref operator()(ast_manager & m, unsigned num_source, proof * const * source) override {
|
||||
// Let m_clause be of the form (l_0 or ... or l_{num_source - 1})
|
||||
|
@ -83,13 +83,13 @@ public:
|
|||
updt_params(ref);
|
||||
}
|
||||
|
||||
virtual tactic * translate(ast_manager & m) {
|
||||
tactic * translate(ast_manager & m) override {
|
||||
split_clause_tactic * t = alloc(split_clause_tactic);
|
||||
t->m_largest_clause = m_largest_clause;
|
||||
return t;
|
||||
}
|
||||
|
||||
virtual ~split_clause_tactic() {
|
||||
~split_clause_tactic() override {
|
||||
}
|
||||
|
||||
void updt_params(params_ref const & p) override {
|
||||
|
@ -119,7 +119,7 @@ public:
|
|||
for (expr* lit_i : *cls) {
|
||||
goal * subgoal_i = alloc(goal, *in);
|
||||
subgoal_i->set(in->mc());
|
||||
proof * pr_i = 0;
|
||||
proof * pr_i = nullptr;
|
||||
if (produce_proofs)
|
||||
pr_i = m.mk_hypothesis(lit_i);
|
||||
subgoal_i->update(cls_pos, lit_i, pr_i, cls_dep);
|
||||
|
@ -130,7 +130,7 @@ public:
|
|||
in->add(dependency_converter::concat(result.size(), result.c_ptr()));
|
||||
}
|
||||
|
||||
virtual void cleanup() {
|
||||
void cleanup() override {
|
||||
// do nothing this tactic is too simple
|
||||
}
|
||||
};
|
||||
|
|
|
@ -32,15 +32,15 @@ class symmetry_reduce_tactic : public tactic {
|
|||
public:
|
||||
symmetry_reduce_tactic(ast_manager & m);
|
||||
|
||||
virtual tactic * translate(ast_manager & m) {
|
||||
tactic * translate(ast_manager & m) override {
|
||||
return alloc(symmetry_reduce_tactic, m);
|
||||
}
|
||||
|
||||
virtual ~symmetry_reduce_tactic();
|
||||
~symmetry_reduce_tactic() override;
|
||||
|
||||
virtual void operator()(goal_ref const & g,
|
||||
goal_ref_buffer & result);
|
||||
virtual void cleanup();
|
||||
void operator()(goal_ref const & g,
|
||||
goal_ref_buffer & result) override;
|
||||
virtual void cleanup() override;
|
||||
};
|
||||
|
||||
class ac_rewriter {
|
||||
|
@ -85,7 +85,7 @@ struct ac_rewriter_cfg : public default_rewriter_cfg {
|
|||
bool rewrite_patterns() const { return false; }
|
||||
bool flat_assoc(func_decl * f) const { return false; }
|
||||
br_status reduce_app(func_decl * f, unsigned num, expr * const * args, expr_ref & result, proof_ref & result_pr) {
|
||||
result_pr = 0;
|
||||
result_pr = nullptr;
|
||||
return m_r.mk_app_core(f, num, args, result);
|
||||
}
|
||||
ac_rewriter_cfg(ast_manager & m):m_r(m) {}
|
||||
|
@ -472,7 +472,7 @@ private:
|
|||
T.reset();
|
||||
ptr_vector<expr> todo;
|
||||
todo.push_back(fml);
|
||||
app* t = 0;
|
||||
app* t = nullptr;
|
||||
while (!todo.empty()) {
|
||||
fml = todo.back();
|
||||
todo.pop_back();
|
||||
|
@ -487,24 +487,24 @@ private:
|
|||
bool is_range_restriction(expr* form, term_set const& C, app*& t) {
|
||||
if (!m().is_or(form)) return false;
|
||||
unsigned sz = to_app(form)->get_num_args();
|
||||
t = 0;
|
||||
t = nullptr;
|
||||
for (unsigned i = 0; i < sz; ++i) {
|
||||
expr* e = to_app(form)->get_arg(i);
|
||||
expr* e1, *e2;
|
||||
if (!m().is_eq(e, e1, e2)) return false;
|
||||
if (!is_app(e1) || !is_app(e2)) return false;
|
||||
app* a1 = to_app(e1), *a2 = to_app(e2);
|
||||
if (C.contains(a1) && (t == 0 || t == a2)) {
|
||||
if (C.contains(a1) && (t == nullptr || t == a2)) {
|
||||
t = a2;
|
||||
}
|
||||
else if (C.contains(a2) && (t == 0 || t == a1)) {
|
||||
else if (C.contains(a2) && (t == nullptr || t == a1)) {
|
||||
t = a1;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return t != 0;
|
||||
return t != nullptr;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -177,7 +177,7 @@ class tseitin_cnf_tactic : public tactic {
|
|||
goto start;
|
||||
case OP_OR:
|
||||
case OP_IFF:
|
||||
l = 0;
|
||||
l = nullptr;
|
||||
m_cache.find(to_app(n), l);
|
||||
SASSERT(l != 0);
|
||||
mk_lit(l, sign, r);
|
||||
|
@ -185,7 +185,7 @@ class tseitin_cnf_tactic : public tactic {
|
|||
case OP_ITE:
|
||||
case OP_EQ:
|
||||
if (m.is_bool(to_app(n)->get_arg(1))) {
|
||||
l = 0;
|
||||
l = nullptr;
|
||||
m_cache.find(to_app(n), l);
|
||||
SASSERT(l != 0);
|
||||
mk_lit(l, sign, r);
|
||||
|
@ -341,7 +341,7 @@ class tseitin_cnf_tactic : public tactic {
|
|||
|
||||
app * mk_fresh() {
|
||||
m_num_aux_vars++;
|
||||
app * v = m.mk_fresh_const(0, m.mk_bool_sort());
|
||||
app * v = m.mk_fresh_const(nullptr, m.mk_bool_sort());
|
||||
m_fresh_vars.push_back(v);
|
||||
if (m_mc)
|
||||
m_mc->hide(v->get_decl());
|
||||
|
@ -815,12 +815,12 @@ class tseitin_cnf_tactic : public tactic {
|
|||
if (m_produce_models)
|
||||
m_mc = alloc(generic_model_converter, m, "tseitin");
|
||||
else
|
||||
m_mc = 0;
|
||||
m_mc = nullptr;
|
||||
|
||||
unsigned size = g->size();
|
||||
for (unsigned idx = 0; idx < size; idx++) {
|
||||
process(g->form(idx), g->dep(idx));
|
||||
g->update(idx, m.mk_true(), 0, 0); // to save memory
|
||||
g->update(idx, m.mk_true(), nullptr, nullptr); // to save memory
|
||||
}
|
||||
|
||||
SASSERT(!m_produce_unsat_cores || m_clauses.size() == m_deps.size());
|
||||
|
@ -834,7 +834,7 @@ class tseitin_cnf_tactic : public tactic {
|
|||
continue;
|
||||
added.mark(cls);
|
||||
if (m_produce_unsat_cores)
|
||||
g->assert_expr(cls, 0, m_deps.get(i));
|
||||
g->assert_expr(cls, nullptr, m_deps.get(i));
|
||||
else
|
||||
g->assert_expr(cls);
|
||||
}
|
||||
|
@ -855,20 +855,20 @@ public:
|
|||
m_imp = alloc(imp, m, p);
|
||||
}
|
||||
|
||||
virtual tactic * translate(ast_manager & m) {
|
||||
tactic * translate(ast_manager & m) override {
|
||||
return alloc(tseitin_cnf_tactic, m, m_params);
|
||||
}
|
||||
|
||||
virtual ~tseitin_cnf_tactic() {
|
||||
~tseitin_cnf_tactic() override {
|
||||
dealloc(m_imp);
|
||||
}
|
||||
|
||||
virtual void updt_params(params_ref const & p) {
|
||||
void updt_params(params_ref const & p) override {
|
||||
m_params = p;
|
||||
m_imp->updt_params(p);
|
||||
}
|
||||
|
||||
virtual void collect_param_descrs(param_descrs & r) {
|
||||
void collect_param_descrs(param_descrs & r) override {
|
||||
insert_max_memory(r);
|
||||
r.insert("common_patterns", CPK_BOOL, "(default: true) minimize the number of auxiliary variables during CNF encoding by identifing commonly used patterns");
|
||||
r.insert("distributivity", CPK_BOOL, "(default: true) minimize the number of auxiliary variables during CNF encoding by applying distributivity over unshared subformulas");
|
||||
|
@ -877,13 +877,12 @@ public:
|
|||
r.insert("ite_extra", CPK_BOOL, "(default: true) add redundant clauses (that improve unit propagation) when encoding if-then-else formulas");
|
||||
}
|
||||
|
||||
virtual void operator()(goal_ref const & in,
|
||||
goal_ref_buffer & result) {
|
||||
void operator()(goal_ref const & in, goal_ref_buffer & result) override {
|
||||
(*m_imp)(in, result);
|
||||
report_tactic_progress(":cnf-aux-vars", m_imp->m_num_aux_vars);
|
||||
}
|
||||
|
||||
virtual void cleanup() {
|
||||
void cleanup() override {
|
||||
ast_manager & m = m_imp->m;
|
||||
imp * d = alloc(imp, m, m_params);
|
||||
d->m_num_aux_vars = m_imp->m_num_aux_vars;
|
||||
|
@ -891,11 +890,11 @@ public:
|
|||
dealloc(d);
|
||||
}
|
||||
|
||||
virtual void collect_statistics(statistics & st) const {
|
||||
void collect_statistics(statistics & st) const override {
|
||||
st.update("cnf encoding aux vars", m_imp->m_num_aux_vars);
|
||||
}
|
||||
|
||||
virtual void reset_statistics() {
|
||||
void reset_statistics() override {
|
||||
m_imp->m_num_aux_vars = 0;
|
||||
}
|
||||
};
|
||||
|
|
|
@ -33,7 +33,7 @@ public:
|
|||
|
||||
equiv_proof_converter(ast_manager& m): m(m), m_replace(m) {}
|
||||
|
||||
virtual ~equiv_proof_converter() {}
|
||||
~equiv_proof_converter() override {}
|
||||
|
||||
proof_ref operator()(ast_manager & m, unsigned num_source, proof * const * source) override {
|
||||
return m_replace(m, num_source, source);
|
||||
|
|
49
src/tactic/extension_model_converter.h
Normal file
49
src/tactic/extension_model_converter.h
Normal file
|
@ -0,0 +1,49 @@
|
|||
/*++
|
||||
Copyright (c) 2011 Microsoft Corporation
|
||||
|
||||
Module Name:
|
||||
|
||||
extension_model_converter.h
|
||||
|
||||
Abstract:
|
||||
|
||||
Model converter that introduces new interpretations into a model.
|
||||
It used to be called elim_var_model_converter
|
||||
|
||||
Author:
|
||||
|
||||
Leonardo (leonardo) 2011-10-21
|
||||
|
||||
Notes:
|
||||
|
||||
--*/
|
||||
#ifndef EXTENSION_MODEL_CONVERTER_H_
|
||||
#define EXTENSION_MODEL_CONVERTER_H_
|
||||
|
||||
#include "ast/ast.h"
|
||||
#include "tactic/model_converter.h"
|
||||
|
||||
|
||||
class extension_model_converter : public model_converter {
|
||||
func_decl_ref_vector m_vars;
|
||||
expr_ref_vector m_defs;
|
||||
public:
|
||||
extension_model_converter(ast_manager & m):m_vars(m), m_defs(m) {
|
||||
}
|
||||
|
||||
~extension_model_converter() override;
|
||||
|
||||
ast_manager & m() const { return m_vars.get_manager(); }
|
||||
|
||||
void operator()(model_ref & md) override;
|
||||
|
||||
void display(std::ostream & out) override;
|
||||
|
||||
// register a variable that was eliminated
|
||||
void insert(func_decl * v, expr * def);
|
||||
|
||||
model_converter * translate(ast_translation & translator) override;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
52
src/tactic/filter_model_converter.h
Normal file
52
src/tactic/filter_model_converter.h
Normal file
|
@ -0,0 +1,52 @@
|
|||
/*++
|
||||
Copyright (c) 2011 Microsoft Corporation
|
||||
|
||||
Module Name:
|
||||
|
||||
filter_model_converter.h
|
||||
|
||||
Abstract:
|
||||
|
||||
Filter decls from a model
|
||||
|
||||
Author:
|
||||
|
||||
Leonardo (leonardo) 2011-05-06
|
||||
|
||||
Notes:
|
||||
|
||||
--*/
|
||||
#ifndef FILTER_MODEL_CONVERTER_H_
|
||||
#define FILTER_MODEL_CONVERTER_H_
|
||||
|
||||
#include "tactic/model_converter.h"
|
||||
|
||||
class filter_model_converter : public model_converter {
|
||||
func_decl_ref_vector m_decls;
|
||||
public:
|
||||
filter_model_converter(ast_manager & m):m_decls(m) {}
|
||||
|
||||
~filter_model_converter() override;
|
||||
|
||||
ast_manager & m() const { return m_decls.get_manager(); }
|
||||
|
||||
void operator()(model_ref & md, unsigned goal_idx) override;
|
||||
|
||||
virtual void operator()(svector<symbol> & labels, unsigned goal_idx);
|
||||
|
||||
void operator()(model_ref & md) override { operator()(md, 0); } // TODO: delete
|
||||
|
||||
void cancel() override {}
|
||||
|
||||
void display(std::ostream & out) override;
|
||||
|
||||
void insert(func_decl * d) {
|
||||
m_decls.push_back(d);
|
||||
}
|
||||
|
||||
model_converter * translate(ast_translation & translator) override;
|
||||
};
|
||||
|
||||
typedef ref<filter_model_converter> filter_model_converter_ref;
|
||||
|
||||
#endif
|
|
@ -33,7 +33,7 @@ public:
|
|||
m_bv2fp(alloc(bv2fpa_converter, m, conv)) {
|
||||
}
|
||||
|
||||
virtual ~fpa2bv_model_converter() {
|
||||
~fpa2bv_model_converter() override {
|
||||
dealloc(m_bv2fp);
|
||||
}
|
||||
|
||||
|
@ -43,7 +43,6 @@ public:
|
|||
md = new_model;
|
||||
}
|
||||
|
||||
|
||||
void display(std::ostream & out) override;
|
||||
|
||||
model_converter * translate(ast_translation & translator) override;
|
||||
|
@ -51,7 +50,7 @@ public:
|
|||
protected:
|
||||
fpa2bv_model_converter(ast_manager & m) :
|
||||
m(m),
|
||||
m_bv2fp(0) {}
|
||||
m_bv2fp(nullptr) {}
|
||||
|
||||
void convert(model_core * mc, model * float_mdl);
|
||||
};
|
||||
|
|
|
@ -120,24 +120,24 @@ public:
|
|||
m_imp = alloc(imp, m, p);
|
||||
}
|
||||
|
||||
virtual tactic * translate(ast_manager & m) {
|
||||
tactic * translate(ast_manager & m) override {
|
||||
return alloc(fpa2bv_tactic, m, m_params);
|
||||
}
|
||||
|
||||
virtual ~fpa2bv_tactic() {
|
||||
~fpa2bv_tactic() override {
|
||||
dealloc(m_imp);
|
||||
}
|
||||
|
||||
virtual void updt_params(params_ref const & p) {
|
||||
void updt_params(params_ref const & p) override {
|
||||
m_params = p;
|
||||
m_imp->updt_params(p);
|
||||
}
|
||||
|
||||
virtual void collect_param_descrs(param_descrs & r) {
|
||||
void collect_param_descrs(param_descrs & r) override {
|
||||
}
|
||||
|
||||
virtual void operator()(goal_ref const & in,
|
||||
goal_ref_buffer & result) {
|
||||
void operator()(goal_ref const & in,
|
||||
goal_ref_buffer & result) override {
|
||||
try {
|
||||
(*m_imp)(in, result);
|
||||
}
|
||||
|
@ -146,7 +146,7 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
virtual void cleanup() {
|
||||
void cleanup() override {
|
||||
imp * d = alloc(imp, m_imp->m, m_params);
|
||||
std::swap(d, m_imp);
|
||||
dealloc(d);
|
||||
|
|
|
@ -66,10 +66,10 @@ struct is_non_fp_qfnra_predicate {
|
|||
|
||||
class is_fp_qfnra_probe : public probe {
|
||||
public:
|
||||
virtual result operator()(goal const & g) {
|
||||
result operator()(goal const & g) override {
|
||||
return !test<is_non_fp_qfnra_predicate>(g);
|
||||
}
|
||||
virtual ~is_fp_qfnra_probe() {}
|
||||
~is_fp_qfnra_probe() override {}
|
||||
};
|
||||
|
||||
probe * mk_is_fp_qfnra_probe() {
|
||||
|
@ -141,11 +141,11 @@ struct is_non_qffp_predicate {
|
|||
|
||||
class is_qffp_probe : public probe {
|
||||
public:
|
||||
virtual result operator()(goal const & g) {
|
||||
result operator()(goal const & g) override {
|
||||
return !test<is_non_qffp_predicate>(g);
|
||||
}
|
||||
|
||||
virtual ~is_qffp_probe() {}
|
||||
~is_qffp_probe() override {}
|
||||
};
|
||||
|
||||
probe * mk_is_qffp_probe() {
|
||||
|
|
|
@ -140,10 +140,10 @@ void goal::push_back(expr * f, proof * pr, expr_dependency * d) {
|
|||
}
|
||||
|
||||
void goal::quick_process(bool save_first, expr_ref& f, expr_dependency * d) {
|
||||
expr* g = 0;
|
||||
expr* g = nullptr;
|
||||
if (!m().is_and(f) && !(m().is_not(f, g) && m().is_or(g))) {
|
||||
if (!save_first) {
|
||||
push_back(f, 0, d);
|
||||
push_back(f, nullptr, d);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -187,7 +187,7 @@ void goal::quick_process(bool save_first, expr_ref& f, expr_dependency * d) {
|
|||
save_first = false;
|
||||
}
|
||||
else {
|
||||
push_back(curr, 0, d);
|
||||
push_back(curr, nullptr, d);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -256,7 +256,7 @@ void goal::assert_expr(expr * f, proof * pr, expr_dependency * d) {
|
|||
}
|
||||
|
||||
void goal::assert_expr(expr * f, expr_dependency * d) {
|
||||
assert_expr(f, proofs_enabled() ? m().mk_asserted(f) : 0, d);
|
||||
assert_expr(f, proofs_enabled() ? m().mk_asserted(f) : nullptr, d);
|
||||
}
|
||||
|
||||
void goal::get_formulas(ptr_vector<expr> & result) {
|
||||
|
@ -299,7 +299,7 @@ void goal::update(unsigned i, expr * f, proof * pr, expr_dependency * d) {
|
|||
quick_process(true, fr, d);
|
||||
if (!m_inconsistent) {
|
||||
if (m().is_false(fr)) {
|
||||
push_back(f, 0, d);
|
||||
push_back(f, nullptr, d);
|
||||
}
|
||||
else {
|
||||
m().set(m_forms, i, fr);
|
||||
|
@ -579,7 +579,7 @@ void goal::elim_redundancies() {
|
|||
if (neg_lits.is_marked(atom))
|
||||
continue;
|
||||
if (pos_lits.is_marked(atom)) {
|
||||
proof * p = 0;
|
||||
proof * p = nullptr;
|
||||
if (proofs_enabled()) {
|
||||
proof * prs[2] = { pr(get_idx(atom)), pr(i) };
|
||||
p = m().mk_unit_resolution(2, prs);
|
||||
|
@ -596,7 +596,7 @@ void goal::elim_redundancies() {
|
|||
if (pos_lits.is_marked(f))
|
||||
continue;
|
||||
if (neg_lits.is_marked(f)) {
|
||||
proof * p = 0;
|
||||
proof * p = nullptr;
|
||||
if (proofs_enabled()) {
|
||||
proof * prs[2] = { pr(get_not_idx(f)), pr(i) };
|
||||
p = m().mk_unit_resolution(2, prs);
|
||||
|
|
|
@ -114,17 +114,17 @@ public:
|
|||
void assert_expr(expr * f, proof * pr, expr_dependency * d);
|
||||
void assert_expr(expr * f, expr_dependency * d);
|
||||
void assert_expr(expr * f, expr * d) { assert_expr(f, m().mk_leaf(d)); }
|
||||
void assert_expr(expr * f) { assert_expr(f, static_cast<expr_dependency*>(0)); }
|
||||
void assert_expr(expr * f) { assert_expr(f, static_cast<expr_dependency*>(nullptr)); }
|
||||
|
||||
unsigned size() const { return m().size(m_forms); }
|
||||
|
||||
unsigned num_exprs() const;
|
||||
|
||||
expr * form(unsigned i) const { return m().get(m_forms, i); }
|
||||
proof * pr(unsigned i) const { return proofs_enabled() ? static_cast<proof*>(m().get(m_proofs, i)) : 0; }
|
||||
expr_dependency * dep(unsigned i) const { return unsat_core_enabled() ? m().get(m_dependencies, i) : 0; }
|
||||
proof * pr(unsigned i) const { return proofs_enabled() ? static_cast<proof*>(m().get(m_proofs, i)) : nullptr; }
|
||||
expr_dependency * dep(unsigned i) const { return unsat_core_enabled() ? m().get(m_dependencies, i) : nullptr; }
|
||||
|
||||
void update(unsigned i, expr * f, proof * pr = 0, expr_dependency * dep = 0);
|
||||
void update(unsigned i, expr * f, proof * pr = nullptr, expr_dependency * dep = nullptr);
|
||||
|
||||
void get_formulas(ptr_vector<expr> & result);
|
||||
void get_formulas(expr_ref_vector & result);
|
||||
|
|
|
@ -98,9 +98,9 @@ public:
|
|||
};
|
||||
|
||||
model_converter * concat(model_converter * mc1, model_converter * mc2) {
|
||||
if (mc1 == 0)
|
||||
if (mc1 == nullptr)
|
||||
return mc2;
|
||||
if (mc2 == 0)
|
||||
if (mc2 == nullptr)
|
||||
return mc1;
|
||||
return alloc(concat_model_converter, mc1, mc2);
|
||||
}
|
||||
|
@ -114,7 +114,7 @@ public:
|
|||
|
||||
model2mc(model * m, labels_vec const & r):m_model(m), m_labels(r) {}
|
||||
|
||||
virtual ~model2mc() {}
|
||||
~model2mc() override {}
|
||||
|
||||
void operator()(model_ref & m) override {
|
||||
m = m_model;
|
||||
|
|
799
src/tactic/nlsat_smt/nl_purify_tactic.cpp
Normal file
799
src/tactic/nlsat_smt/nl_purify_tactic.cpp
Normal file
|
@ -0,0 +1,799 @@
|
|||
/*++
|
||||
Copyright (c) 2015 Microsoft Corporation
|
||||
|
||||
Module Name:
|
||||
|
||||
nl_purify_tactic.cpp
|
||||
|
||||
Abstract:
|
||||
|
||||
Tactic for purifying quantifier-free formulas that mix QF_NRA and other theories.
|
||||
It is designed to allow cooprating between the nlsat solver and other theories
|
||||
in a decoupled way.
|
||||
|
||||
Let goal be formula F.
|
||||
Let NL goal be formula G.
|
||||
Assume F is in NNF.
|
||||
Assume F does not contain mix of real/integers.
|
||||
Assume F is quantifier-free (please, otherwise we need to reprocess from instantiated satisfiable formula)
|
||||
|
||||
For each atomic nl formula f,
|
||||
- introduce a propositional variable p
|
||||
- replace f by p
|
||||
- add clauses p => f to G
|
||||
|
||||
For each interface term t,
|
||||
- introduce interface variable v (or use t if it is already a variable)
|
||||
- replace t by v
|
||||
|
||||
Check satisfiability of G.
|
||||
If satisfiable, then check assignment to p and interface equalities on F
|
||||
If unsat:
|
||||
Retrieve core and add core to G.
|
||||
else:
|
||||
For interface equalities from model of F that are not equal in G, add
|
||||
For interface variables that are equal under one model, but not the other model,
|
||||
create interface predicate p_vw => v = w, add to both F, G.
|
||||
Add interface equations to assumptions, recheck F.
|
||||
If unsat retrieve core add to G.
|
||||
|
||||
Author:
|
||||
|
||||
Nikolaj Bjorner (nbjorner) 2015-5-5.
|
||||
|
||||
Revision History:
|
||||
|
||||
--*/
|
||||
#include "tactic/tactical.h"
|
||||
#include "tactic/nlsat_smt/nl_purify_tactic.h"
|
||||
#include "smt/tactic/smt_tactic.h"
|
||||
#include "ast/rewriter/rewriter.h"
|
||||
#include "nlsat/tactic/nlsat_tactic.h"
|
||||
#include "tactic/filter_model_converter.h"
|
||||
#include "util/obj_pair_hashtable.h"
|
||||
#include "ast/rewriter/rewriter_def.h"
|
||||
#include "ast/ast_pp.h"
|
||||
#include "util/trace.h"
|
||||
#include "smt/smt_solver.h"
|
||||
#include "solver/solver.h"
|
||||
#include "model/model_smt2_pp.h"
|
||||
#include "ast/rewriter/expr_safe_replace.h"
|
||||
#include "ast/ast_util.h"
|
||||
#include "solver/solver2tactic.h"
|
||||
|
||||
class nl_purify_tactic : public tactic {
|
||||
|
||||
enum polarity_t {
|
||||
pol_pos,
|
||||
pol_neg,
|
||||
pol_dual
|
||||
};
|
||||
|
||||
ast_manager & m;
|
||||
arith_util m_util;
|
||||
params_ref m_params;
|
||||
bool m_produce_proofs;
|
||||
ref<filter_model_converter> m_fmc;
|
||||
tactic_ref m_nl_tac; // nlsat tactic
|
||||
goal_ref m_nl_g; // nlsat goal
|
||||
ref<solver> m_solver; // SMT solver
|
||||
expr_ref_vector m_eq_preds; // predicates for equality between pairs of interface variables
|
||||
svector<lbool> m_eq_values; // truth value of the equality predicates in nlsat
|
||||
app_ref_vector m_new_reals; // interface real variables
|
||||
app_ref_vector m_new_preds; // abstraction predicates for smt_solver (hide real constraints)
|
||||
expr_ref_vector m_asms; // assumptions to pass to SMT solver
|
||||
ptr_vector<expr> m_ctx_asms; // assumptions passed by context
|
||||
obj_hashtable<expr> m_ctx_asms_set; // assumptions passed by context
|
||||
obj_hashtable<expr> m_used_asms;
|
||||
obj_map<expr, expr*> m_bool2dep;
|
||||
obj_pair_map<expr,expr,expr*> m_eq_pairs; // map pairs of interface variables to auxiliary predicates
|
||||
obj_map<expr,expr*> m_interface_cache; // map of compound real expression to interface variable.
|
||||
obj_map<expr, polarity_t> m_polarities; // polarities of sub-expressions
|
||||
|
||||
public:
|
||||
struct rw_cfg : public default_rewriter_cfg {
|
||||
enum mode_t {
|
||||
mode_interface_var,
|
||||
mode_bool_preds
|
||||
};
|
||||
ast_manager& m;
|
||||
nl_purify_tactic & m_owner;
|
||||
app_ref_vector& m_new_reals;
|
||||
app_ref_vector& m_new_preds;
|
||||
obj_map<expr, polarity_t>& m_polarities;
|
||||
obj_map<expr,expr*>& m_interface_cache;
|
||||
expr_ref_vector m_args;
|
||||
proof_ref_vector m_proofs;
|
||||
mode_t m_mode;
|
||||
|
||||
rw_cfg(nl_purify_tactic & o):
|
||||
m(o.m),
|
||||
m_owner(o),
|
||||
m_new_reals(o.m_new_reals),
|
||||
m_new_preds(o.m_new_preds),
|
||||
m_polarities(o.m_polarities),
|
||||
m_interface_cache(o.m_interface_cache),
|
||||
m_args(m),
|
||||
m_proofs(m),
|
||||
m_mode(mode_interface_var) {
|
||||
}
|
||||
|
||||
virtual ~rw_cfg() {}
|
||||
|
||||
arith_util & u() { return m_owner.m_util; }
|
||||
|
||||
expr * mk_interface_var(expr* arg, proof_ref& arg_pr) {
|
||||
expr* r;
|
||||
if (m_interface_cache.find(arg, r)) {
|
||||
return r;
|
||||
}
|
||||
if (is_uninterp_const(arg)) {
|
||||
m_interface_cache.insert(arg, arg);
|
||||
return arg;
|
||||
}
|
||||
r = m.mk_fresh_const(nullptr, u().mk_real());
|
||||
m_new_reals.push_back(to_app(r));
|
||||
m_owner.m_fmc->insert(to_app(r)->get_decl());
|
||||
m_interface_cache.insert(arg, r);
|
||||
expr_ref eq(m);
|
||||
eq = m.mk_eq(r, arg);
|
||||
if (is_real_expression(arg)) {
|
||||
m_owner.m_nl_g->assert_expr(eq); // m.mk_oeq(r, arg)
|
||||
}
|
||||
else {
|
||||
m_owner.m_solver->assert_expr(eq);
|
||||
}
|
||||
if (m_owner.m_produce_proofs) {
|
||||
arg_pr = m.mk_oeq(arg, r);
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
bool is_real_expression(expr* e) {
|
||||
return is_app(e) && (to_app(e)->get_family_id() == u().get_family_id());
|
||||
}
|
||||
|
||||
void mk_interface_bool(func_decl * f, unsigned num, expr* const* args, expr_ref& result, proof_ref& pr) {
|
||||
expr_ref old_pred(m.mk_app(f, num, args), m);
|
||||
polarity_t pol = m_polarities.find(old_pred);
|
||||
result = m.mk_fresh_const(nullptr, m.mk_bool_sort());
|
||||
m_polarities.insert(result, pol);
|
||||
m_new_preds.push_back(to_app(result));
|
||||
m_owner.m_fmc->insert(to_app(result)->get_decl());
|
||||
if (pol != pol_neg) {
|
||||
m_owner.m_nl_g->assert_expr(m.mk_or(m.mk_not(result), old_pred));
|
||||
}
|
||||
if (pol != pol_pos) {
|
||||
m_owner.m_nl_g->assert_expr(m.mk_or(result, m.mk_not(old_pred)));
|
||||
}
|
||||
if (m_owner.m_produce_proofs) {
|
||||
pr = m.mk_oeq(old_pred, result);
|
||||
}
|
||||
TRACE("nlsat_smt", tout << old_pred << " : " << result << "\n";);
|
||||
}
|
||||
|
||||
bool reduce_quantifier(quantifier * old_q,
|
||||
expr * new_body,
|
||||
expr * const * new_patterns,
|
||||
expr * const * new_no_patterns,
|
||||
expr_ref & result,
|
||||
proof_ref & result_pr) {
|
||||
throw tactic_exception("quantifiers are not supported in mixed-mode nlsat engine");
|
||||
}
|
||||
|
||||
br_status reduce_app(func_decl * f, unsigned num, expr* const* args, expr_ref& result, proof_ref & pr) {
|
||||
if (m_mode == mode_bool_preds) {
|
||||
return reduce_app_bool(f, num, args, result, pr);
|
||||
}
|
||||
else {
|
||||
return reduce_app_real(f, num, args, result, pr);
|
||||
}
|
||||
}
|
||||
|
||||
br_status reduce_app_bool(func_decl * f, unsigned num, expr* const* args, expr_ref& result, proof_ref & pr) {
|
||||
if (f->get_family_id() == m.get_basic_family_id()) {
|
||||
if (f->get_decl_kind() == OP_EQ && u().is_real(args[0])) {
|
||||
mk_interface_bool(f, num, args, result, pr);
|
||||
return BR_DONE;
|
||||
}
|
||||
else {
|
||||
return BR_FAILED;
|
||||
}
|
||||
}
|
||||
if (f->get_family_id() == u().get_family_id()) {
|
||||
switch (f->get_decl_kind()) {
|
||||
case OP_LE: case OP_GE: case OP_LT: case OP_GT:
|
||||
// these are the only real cases of non-linear atomic formulas besides equality.
|
||||
mk_interface_bool(f, num, args, result, pr);
|
||||
return BR_DONE;
|
||||
default:
|
||||
return BR_FAILED;
|
||||
}
|
||||
}
|
||||
return BR_FAILED;
|
||||
}
|
||||
|
||||
// (+ (f x) y)
|
||||
// (f (+ x y))
|
||||
//
|
||||
bool is_arith_op(expr* e) {
|
||||
return is_app(e) && to_app(e)->get_family_id() == u().get_family_id();
|
||||
}
|
||||
|
||||
br_status reduce_app_real(func_decl * f, unsigned num, expr* const* args, expr_ref& result, proof_ref & pr) {
|
||||
bool has_interface = false;
|
||||
bool is_arith = false;
|
||||
if (f->get_family_id() == u().get_family_id()) {
|
||||
switch (f->get_decl_kind()) {
|
||||
case OP_NUM:
|
||||
case OP_IRRATIONAL_ALGEBRAIC_NUM:
|
||||
return BR_FAILED;
|
||||
default:
|
||||
is_arith = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
m_args.reset();
|
||||
m_proofs.reset();
|
||||
for (unsigned i = 0; i < num; ++i) {
|
||||
expr* arg = args[i];
|
||||
proof_ref arg_pr(m);
|
||||
if (is_arith && !is_arith_op(arg)) {
|
||||
has_interface = true;
|
||||
m_args.push_back(mk_interface_var(arg, arg_pr));
|
||||
}
|
||||
else if (!is_arith && u().is_real(arg)) {
|
||||
has_interface = true;
|
||||
m_args.push_back(mk_interface_var(arg, arg_pr));
|
||||
}
|
||||
else {
|
||||
m_args.push_back(arg);
|
||||
}
|
||||
if (arg_pr) {
|
||||
m_proofs.push_back(arg_pr);
|
||||
}
|
||||
}
|
||||
if (has_interface) {
|
||||
result = m.mk_app(f, num, m_args.c_ptr());
|
||||
if (m_owner.m_produce_proofs) {
|
||||
pr = m.mk_oeq_congruence(m.mk_app(f, num, args), to_app(result), m_proofs.size(), m_proofs.c_ptr());
|
||||
}
|
||||
TRACE("nlsat_smt", tout << result << "\n";);
|
||||
return BR_DONE;
|
||||
}
|
||||
else {
|
||||
return BR_FAILED;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
private:
|
||||
|
||||
class rw : public rewriter_tpl<rw_cfg> {
|
||||
rw_cfg m_cfg;
|
||||
public:
|
||||
rw(nl_purify_tactic & o):
|
||||
rewriter_tpl<rw_cfg>(o.m, o.m_produce_proofs, m_cfg),
|
||||
m_cfg(o) {
|
||||
}
|
||||
void set_bool_mode() {
|
||||
m_cfg.m_mode = rw_cfg::mode_bool_preds;
|
||||
}
|
||||
void set_interface_var_mode() {
|
||||
m_cfg.m_mode = rw_cfg::mode_interface_var;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
arith_util & u() { return m_util; }
|
||||
|
||||
void check_point() {
|
||||
if (m.canceled()) {
|
||||
throw tactic_exception(Z3_CANCELED_MSG);
|
||||
}
|
||||
}
|
||||
|
||||
void display_result(std::ostream& out, goal_ref_buffer const& result) {
|
||||
for (unsigned i = 0; i < result.size(); ++i) {
|
||||
result[i]->display_with_dependencies(out << "goal\n");
|
||||
}
|
||||
}
|
||||
|
||||
void update_eq_values(model_ref& mdl) {
|
||||
expr_ref tmp(m);
|
||||
for (unsigned i = 0; i < m_eq_preds.size(); ++i) {
|
||||
expr* pred = m_eq_preds[i].get();
|
||||
m_eq_values[i] = l_undef;
|
||||
if (mdl->eval(pred, tmp)) {
|
||||
if (m.is_true(tmp)) {
|
||||
m_eq_values[i] = l_true;
|
||||
}
|
||||
else if (m.is_false(tmp)) {
|
||||
m_eq_values[i] = l_false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void solve(
|
||||
goal_ref const& g,
|
||||
goal_ref_buffer& result,
|
||||
expr_dependency_ref& core,
|
||||
model_converter_ref& mc) {
|
||||
|
||||
while (true) {
|
||||
check_point();
|
||||
TRACE("nlsat_smt", m_solver->display(tout << "SMT:\n"); m_nl_g->display(tout << "\nNL:\n"); );
|
||||
goal_ref tmp_nl = alloc(goal, m, true, false);
|
||||
model_converter_ref nl_mc;
|
||||
proof_converter_ref nl_pc;
|
||||
expr_dependency_ref nl_core(m);
|
||||
result.reset();
|
||||
tmp_nl->copy_from(*m_nl_g.get());
|
||||
(*m_nl_tac)(tmp_nl, result, nl_mc, nl_pc, nl_core);
|
||||
|
||||
if (is_decided_unsat(result)) {
|
||||
core2result(core, g, result);
|
||||
TRACE("nlsat_smt", tout << "unsat\n";);
|
||||
break;
|
||||
}
|
||||
if (!is_decided_sat(result)) {
|
||||
TRACE("nlsat_smt", tout << "not a unit\n";);
|
||||
break;
|
||||
}
|
||||
// extract evaluation on interface variables.
|
||||
// assert booleans that evaluate to true.
|
||||
// assert equalities between equal interface real variables.
|
||||
|
||||
model_ref mdl_nl, mdl_smt;
|
||||
if (nl_mc.get()) {
|
||||
model_converter2model(m, nl_mc.get(), mdl_nl);
|
||||
update_eq_values(mdl_nl);
|
||||
enforce_equalities(mdl_nl, m_nl_g);
|
||||
|
||||
setup_assumptions(mdl_nl);
|
||||
|
||||
TRACE("nlsat_smt",
|
||||
model_smt2_pp(tout << "nl model\n", m, *mdl_nl.get(), 0);
|
||||
m_solver->display(tout << "smt goal:\n"); tout << "\n";);
|
||||
}
|
||||
result.reset();
|
||||
lbool r = m_solver->check_sat(m_asms.size(), m_asms.c_ptr());
|
||||
if (r == l_false) {
|
||||
// extract the core from the result
|
||||
ptr_vector<expr> ecore, asms;
|
||||
expr_ref_vector clause(m);
|
||||
expr_ref fml(m);
|
||||
get_unsat_core(ecore, asms);
|
||||
|
||||
//
|
||||
// assumptions should also be used for the nlsat tactic,
|
||||
// but since it does not support assumptions at this time
|
||||
// we overapproximate the necessary core and accumulate
|
||||
// all assumptions that are ever used.
|
||||
//
|
||||
for (unsigned i = 0; i < asms.size(); ++i) {
|
||||
m_used_asms.insert(asms[i]);
|
||||
}
|
||||
if (ecore.empty()) {
|
||||
core2result(core, g, result);
|
||||
break;
|
||||
}
|
||||
for (unsigned i = 0; i < ecore.size(); ++i) {
|
||||
clause.push_back(mk_not(m, ecore[i]));
|
||||
}
|
||||
fml = mk_or(m, clause.size(), clause.c_ptr());
|
||||
m_nl_g->assert_expr(fml);
|
||||
continue;
|
||||
}
|
||||
else if (r == l_true) {
|
||||
m_solver->get_model(mdl_smt);
|
||||
if (enforce_equalities(mdl_smt, m_nl_g)) {
|
||||
// SMT enforced a new equality that wasn't true for nlsat.
|
||||
continue;
|
||||
}
|
||||
TRACE("nlsat_smt",
|
||||
m_fmc->display(tout << "joint state is sat\n");
|
||||
nl_mc->display(tout << "nl\n"););
|
||||
if (mdl_nl.get()) {
|
||||
merge_models(*mdl_nl.get(), mdl_smt);
|
||||
}
|
||||
mc = m_fmc.get();
|
||||
apply(mc, mdl_smt, 0);
|
||||
mc = model2model_converter(mdl_smt.get());
|
||||
result.push_back(alloc(goal, m));
|
||||
}
|
||||
else {
|
||||
TRACE("nlsat_smt", tout << "unknown\n";);
|
||||
}
|
||||
break;
|
||||
}
|
||||
TRACE("nlsat_smt", display_result(tout, result););
|
||||
}
|
||||
|
||||
void get_unsat_core(ptr_vector<expr>& core, ptr_vector<expr>& asms) {
|
||||
m_solver->get_unsat_core(core);
|
||||
for (unsigned i = 0; i < core.size(); ++i) {
|
||||
if (m_ctx_asms_set.contains(core[i])) {
|
||||
asms.push_back(core[i]);
|
||||
core[i] = core.back();
|
||||
core.pop_back();
|
||||
--i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void core2result(expr_dependency_ref & lcore, goal_ref const& g, goal_ref_buffer& result) {
|
||||
result.reset();
|
||||
proof * pr = nullptr;
|
||||
lcore = nullptr;
|
||||
g->reset();
|
||||
obj_hashtable<expr>::iterator it = m_used_asms.begin(), end = m_used_asms.end();
|
||||
for (; it != end; ++it) {
|
||||
lcore = m.mk_join(lcore, m.mk_leaf(m_bool2dep.find(*it)));
|
||||
}
|
||||
g->assert_expr(m.mk_false(), pr, lcore);
|
||||
TRACE("nlsat_smt", g->display_with_dependencies(tout););
|
||||
result.push_back(g.get());
|
||||
}
|
||||
|
||||
void setup_assumptions(model_ref& mdl) {
|
||||
m_asms.reset();
|
||||
m_asms.append(m_ctx_asms.size(), m_ctx_asms.c_ptr());
|
||||
app_ref_vector const& fresh_preds = m_new_preds;
|
||||
expr_ref tmp(m);
|
||||
for (unsigned i = 0; i < fresh_preds.size(); ++i) {
|
||||
expr* pred = fresh_preds[i];
|
||||
if (mdl->eval(pred, tmp)) {
|
||||
polarity_t pol = m_polarities.find(pred);
|
||||
// if assumptinon literals are used to satisfy NL state,
|
||||
// we have to assume them when satisfying SMT state
|
||||
if (pol != pol_neg && m.is_false(tmp)) {
|
||||
m_asms.push_back(m.mk_not(pred));
|
||||
}
|
||||
else if (pol != pol_pos && m.is_true(tmp)) {
|
||||
m_asms.push_back(pred);
|
||||
}
|
||||
}
|
||||
}
|
||||
for (unsigned i = 0; i < m_eq_preds.size(); ++i) {
|
||||
expr* pred = m_eq_preds[i].get();
|
||||
switch (m_eq_values[i]) {
|
||||
case l_true:
|
||||
m_asms.push_back(pred);
|
||||
break;
|
||||
case l_false:
|
||||
m_asms.push_back(m.mk_not(pred));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
TRACE("nlsat_smt",
|
||||
tout << "assumptions:\n" << m_asms << "\n";);
|
||||
}
|
||||
|
||||
bool enforce_equalities(model_ref& mdl, goal_ref const& nl_g) {
|
||||
TRACE("nlsat_smt", tout << "Enforce equalities " << m_interface_cache.size() << "\n";);
|
||||
bool new_equality = false;
|
||||
expr_ref_vector nums(m);
|
||||
obj_map<expr, expr*> num2var;
|
||||
obj_map<expr, expr*>::iterator it = m_interface_cache.begin(), end = m_interface_cache.end();
|
||||
for (; it != end; ++it) {
|
||||
expr_ref r(m);
|
||||
expr* v, *w, *pred;
|
||||
w = it->m_value;
|
||||
VERIFY(mdl->eval(w, r));
|
||||
TRACE("nlsat_smt", tout << mk_pp(w, m) << " |-> " << r << "\n";);
|
||||
nums.push_back(r);
|
||||
if (num2var.find(r, v)) {
|
||||
if (!m_eq_pairs.find(v, w, pred)) {
|
||||
pred = m.mk_fresh_const(nullptr, m.mk_bool_sort());
|
||||
m_eq_preds.push_back(pred);
|
||||
m_eq_values.push_back(l_true);
|
||||
m_fmc->insert(to_app(pred)->get_decl());
|
||||
nl_g->assert_expr(m.mk_or(m.mk_not(pred), m.mk_eq(w, v)));
|
||||
nl_g->assert_expr(m.mk_or(pred, m.mk_not(m.mk_eq(w, v))));
|
||||
m_solver->assert_expr(m.mk_iff(pred, m.mk_eq(w, v)));
|
||||
new_equality = true;
|
||||
m_eq_pairs.insert(v, w, pred);
|
||||
}
|
||||
else {
|
||||
// interface equality is already enforced.
|
||||
}
|
||||
}
|
||||
else {
|
||||
num2var.insert(r, w);
|
||||
}
|
||||
}
|
||||
return new_equality;
|
||||
}
|
||||
|
||||
void merge_models(model const& mdl_nl, model_ref& mdl_smt) {
|
||||
expr_safe_replace num2num(m);
|
||||
expr_ref result(m), val2(m);
|
||||
expr_ref_vector args(m);
|
||||
unsigned sz = mdl_nl.get_num_constants();
|
||||
for (unsigned i = 0; i < sz; ++i) {
|
||||
func_decl* v = mdl_nl.get_constant(i);
|
||||
if (u().is_real(v->get_range())) {
|
||||
expr* val = mdl_nl.get_const_interp(v);
|
||||
if (mdl_smt->eval(v, val2)) {
|
||||
if (val != val2) {
|
||||
num2num.insert(val2, val);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
sz = mdl_smt->get_num_functions();
|
||||
for (unsigned i = 0; i < sz; ++i) {
|
||||
func_decl* f = mdl_smt->get_function(i);
|
||||
if (has_real(f)) {
|
||||
unsigned arity = f->get_arity();
|
||||
func_interp* f1 = mdl_smt->get_func_interp(f);
|
||||
func_interp* f2 = alloc(func_interp, m, f->get_arity());
|
||||
for (unsigned j = 0; j < f1->num_entries(); ++j) {
|
||||
args.reset();
|
||||
func_entry const* entry = f1->get_entry(j);
|
||||
for (unsigned k = 0; k < arity; ++k) {
|
||||
translate(num2num, entry->get_arg(k), result);
|
||||
args.push_back(result);
|
||||
}
|
||||
translate(num2num, entry->get_result(), result);
|
||||
f2->insert_entry(args.c_ptr(), result);
|
||||
}
|
||||
translate(num2num, f1->get_else(), result);
|
||||
f2->set_else(result);
|
||||
mdl_smt->register_decl(f, f2);
|
||||
}
|
||||
}
|
||||
mdl_smt->copy_const_interps(mdl_nl);
|
||||
}
|
||||
|
||||
bool has_real(func_decl* f) {
|
||||
for (unsigned i = 0; i < f->get_arity(); ++i) {
|
||||
if (u().is_real(f->get_domain(i))) return true;
|
||||
}
|
||||
return u().is_real(f->get_range());
|
||||
}
|
||||
|
||||
void translate(expr_safe_replace& num2num, expr* e, expr_ref& result) {
|
||||
result = nullptr;
|
||||
if (e) {
|
||||
num2num(e, result);
|
||||
}
|
||||
}
|
||||
|
||||
void get_polarities(goal const& g) {
|
||||
ptr_vector<expr> forms;
|
||||
svector<polarity_t> pols;
|
||||
unsigned sz = g.size();
|
||||
for (unsigned i = 0; i < sz; ++i) {
|
||||
forms.push_back(g.form(i));
|
||||
pols.push_back(pol_pos);
|
||||
}
|
||||
polarity_t p, q;
|
||||
while (!forms.empty()) {
|
||||
expr* e = forms.back();
|
||||
p = pols.back();
|
||||
forms.pop_back();
|
||||
pols.pop_back();
|
||||
if (m_polarities.find(e, q)) {
|
||||
if (p == q || q == pol_dual) continue;
|
||||
p = pol_dual;
|
||||
}
|
||||
TRACE("nlsat_smt_verbose", tout << mk_pp(e, m) << "\n";);
|
||||
m_polarities.insert(e, p);
|
||||
if (is_quantifier(e) || is_var(e)) {
|
||||
throw tactic_exception("nl-purify tactic does not support quantifiers");
|
||||
}
|
||||
SASSERT(is_app(e));
|
||||
app* a = to_app(e);
|
||||
func_decl* f = a->get_decl();
|
||||
if (f->get_family_id() == m.get_basic_family_id() && p != pol_dual) {
|
||||
switch(f->get_decl_kind()) {
|
||||
case OP_NOT:
|
||||
p = neg(p);
|
||||
break;
|
||||
case OP_AND:
|
||||
case OP_OR:
|
||||
break;
|
||||
default:
|
||||
p = pol_dual;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else {
|
||||
p = pol_dual;
|
||||
}
|
||||
for (unsigned i = 0; i < a->get_num_args(); ++i) {
|
||||
forms.push_back(a->get_arg(i));
|
||||
pols.push_back(p);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
polarity_t neg(polarity_t p) {
|
||||
switch (p) {
|
||||
case pol_pos: return pol_neg;
|
||||
case pol_neg: return pol_pos;
|
||||
case pol_dual: return pol_dual;
|
||||
}
|
||||
return pol_dual;
|
||||
}
|
||||
|
||||
polarity_t join(polarity_t p, polarity_t q) {
|
||||
if (p == q) return p;
|
||||
return pol_dual;
|
||||
}
|
||||
|
||||
void rewrite_goal(rw& r, goal_ref const& g) {
|
||||
r.reset();
|
||||
expr_ref new_curr(m);
|
||||
proof_ref new_pr(m);
|
||||
unsigned sz = g->size();
|
||||
for (unsigned i = 0; i < sz; i++) {
|
||||
expr * curr = g->form(i);
|
||||
r(curr, new_curr, new_pr);
|
||||
if (m_produce_proofs) {
|
||||
proof * pr = g->pr(i);
|
||||
new_pr = m.mk_modus_ponens(pr, new_pr);
|
||||
}
|
||||
g->update(i, new_curr, new_pr, g->dep(i));
|
||||
}
|
||||
}
|
||||
|
||||
void remove_pure_arith(goal_ref const& g) {
|
||||
obj_map<expr, bool> is_pure;
|
||||
unsigned sz = g->size();
|
||||
for (unsigned i = 0; i < sz; i++) {
|
||||
expr * curr = g->form(i);
|
||||
if (is_pure_arithmetic(is_pure, curr)) {
|
||||
m_nl_g->assert_expr(curr, g->pr(i), g->dep(i));
|
||||
g->update(i, m.mk_true(), g->pr(i), g->dep(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool is_pure_arithmetic(obj_map<expr, bool>& is_pure, expr* e0) {
|
||||
ptr_vector<expr> todo;
|
||||
todo.push_back(e0);
|
||||
while (!todo.empty()) {
|
||||
expr* e = todo.back();
|
||||
if (is_pure.contains(e)) {
|
||||
todo.pop_back();
|
||||
continue;
|
||||
}
|
||||
if (!is_app(e)) {
|
||||
todo.pop_back();
|
||||
is_pure.insert(e, false);
|
||||
continue;
|
||||
}
|
||||
app* a = to_app(e);
|
||||
bool pure = false, all_found = true, p;
|
||||
pure |= (a->get_family_id() == u().get_family_id()) && u().is_real(a);
|
||||
pure |= (m.is_eq(e) && u().is_real(a->get_arg(0)));
|
||||
pure |= (a->get_family_id() == u().get_family_id()) && m.is_bool(a) && u().is_real(a->get_arg(0));
|
||||
pure |= (a->get_family_id() == m.get_basic_family_id());
|
||||
pure |= is_uninterp_const(a) && u().is_real(a);
|
||||
for (unsigned i = 0; i < a->get_num_args(); ++i) {
|
||||
if (!is_pure.find(a->get_arg(i), p)) {
|
||||
todo.push_back(a->get_arg(i));
|
||||
all_found = false;
|
||||
}
|
||||
else {
|
||||
pure &= p;
|
||||
}
|
||||
}
|
||||
if (all_found) {
|
||||
is_pure.insert(e, pure);
|
||||
todo.pop_back();
|
||||
}
|
||||
}
|
||||
return is_pure.find(e0);
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
nl_purify_tactic(ast_manager & m, params_ref const& p):
|
||||
m(m),
|
||||
m_util(m),
|
||||
m_params(p),
|
||||
m_fmc(nullptr),
|
||||
m_nl_tac(mk_nlsat_tactic(m, p)),
|
||||
m_nl_g(nullptr),
|
||||
m_solver(mk_smt_solver(m, p, symbol::null)),
|
||||
m_eq_preds(m),
|
||||
m_new_reals(m),
|
||||
m_new_preds(m),
|
||||
m_asms(m)
|
||||
{}
|
||||
|
||||
~nl_purify_tactic() override {}
|
||||
|
||||
void updt_params(params_ref const & p) override {
|
||||
m_params = p;
|
||||
}
|
||||
|
||||
tactic * translate(ast_manager& m) override {
|
||||
return alloc(nl_purify_tactic, m, m_params);
|
||||
}
|
||||
|
||||
void collect_statistics(statistics & st) const override {
|
||||
m_nl_tac->collect_statistics(st);
|
||||
m_solver->collect_statistics(st);
|
||||
}
|
||||
|
||||
void reset_statistics() override {
|
||||
m_nl_tac->reset_statistics();
|
||||
}
|
||||
|
||||
|
||||
void cleanup() override {
|
||||
m_solver = mk_smt_solver(m, m_params, symbol::null);
|
||||
m_nl_tac->cleanup();
|
||||
m_eq_preds.reset();
|
||||
m_eq_values.reset();
|
||||
m_new_reals.reset();
|
||||
m_new_preds.reset();
|
||||
m_eq_pairs.reset();
|
||||
m_polarities.reset();
|
||||
m_ctx_asms.reset();
|
||||
m_ctx_asms_set.reset();
|
||||
m_used_asms.reset();
|
||||
m_bool2dep.reset();
|
||||
}
|
||||
|
||||
void operator()(goal_ref const & g,
|
||||
goal_ref_buffer & result,
|
||||
model_converter_ref & mc,
|
||||
proof_converter_ref & pc,
|
||||
expr_dependency_ref & core) override {
|
||||
|
||||
tactic_report report("qfufnl-purify", *g);
|
||||
TRACE("nlsat_smt", g->display(tout););
|
||||
|
||||
m_produce_proofs = g->proofs_enabled();
|
||||
mc = nullptr; pc = nullptr; core = nullptr;
|
||||
|
||||
fail_if_proof_generation("qfufnra-purify", g);
|
||||
// fail_if_unsat_core_generation("qfufnra-purify", g);
|
||||
rw r(*this);
|
||||
expr_ref_vector clauses(m);
|
||||
m_nl_g = alloc(goal, m, true, false);
|
||||
m_fmc = alloc(filter_model_converter, m);
|
||||
|
||||
// first hoist interface variables,
|
||||
// then annotate subformulas by polarities,
|
||||
// finally extract polynomial inequalities by
|
||||
// creating a place-holder predicate inside the
|
||||
// original goal and extracing pure nlsat clauses.
|
||||
r.set_interface_var_mode();
|
||||
rewrite_goal(r, g);
|
||||
if (!g->unsat_core_enabled()) {
|
||||
remove_pure_arith(g);
|
||||
}
|
||||
get_polarities(*g.get());
|
||||
r.set_bool_mode();
|
||||
rewrite_goal(r, g);
|
||||
|
||||
extract_clauses_and_dependencies(g, clauses, m_ctx_asms, m_bool2dep, m_fmc);
|
||||
|
||||
TRACE("nlsat_smt", tout << clauses << "\n";);
|
||||
|
||||
for (unsigned i = 0; i < m_ctx_asms.size(); ++i) {
|
||||
m_ctx_asms_set.insert(m_ctx_asms[i]);
|
||||
}
|
||||
|
||||
for (unsigned i = 0; i < clauses.size(); ++i) {
|
||||
m_solver->assert_expr(clauses[i].get());
|
||||
}
|
||||
g->inc_depth();
|
||||
solve(g, result, core, mc);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
tactic * mk_nl_purify_tactic(ast_manager& m, params_ref const& p) {
|
||||
return alloc(nl_purify_tactic, m, p);
|
||||
}
|
|
@ -64,14 +64,14 @@ public:
|
|||
m_bounds.push_back(alloc(bound_manager, m));
|
||||
}
|
||||
|
||||
virtual ~bounded_int2bv_solver() {
|
||||
~bounded_int2bv_solver() override {
|
||||
while (!m_bounds.empty()) {
|
||||
dealloc(m_bounds.back());
|
||||
m_bounds.pop_back();
|
||||
}
|
||||
}
|
||||
|
||||
virtual solver* translate(ast_manager& dst_m, params_ref const& p) {
|
||||
solver* translate(ast_manager& dst_m, params_ref const& p) override {
|
||||
flush_assertions();
|
||||
bounded_int2bv_solver* result = alloc(bounded_int2bv_solver, dst_m, p, m_solver->translate(dst_m, p));
|
||||
ast_translation tr(m, dst_m);
|
||||
|
@ -89,7 +89,7 @@ public:
|
|||
return result;
|
||||
}
|
||||
|
||||
virtual void assert_expr_core(expr * t) {
|
||||
void assert_expr_core(expr * t) override {
|
||||
unsigned i = m_assertions.size();
|
||||
m_assertions.push_back(t);
|
||||
while (i < m_assertions.size()) {
|
||||
|
@ -105,14 +105,14 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
virtual void push_core() {
|
||||
void push_core() override {
|
||||
flush_assertions();
|
||||
m_solver->push();
|
||||
m_bv_fns_lim.push_back(m_bv_fns.size());
|
||||
m_bounds.push_back(alloc(bound_manager, m));
|
||||
}
|
||||
|
||||
virtual void pop_core(unsigned n) {
|
||||
void pop_core(unsigned n) override {
|
||||
m_assertions.reset();
|
||||
m_solver->pop(n);
|
||||
|
||||
|
@ -138,18 +138,18 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
virtual lbool check_sat_core(unsigned num_assumptions, expr * const * assumptions) {
|
||||
lbool check_sat_core(unsigned num_assumptions, expr * const * assumptions) override {
|
||||
flush_assertions();
|
||||
return m_solver->check_sat(num_assumptions, assumptions);
|
||||
}
|
||||
|
||||
virtual void updt_params(params_ref const & p) { solver::updt_params(p); m_solver->updt_params(p); }
|
||||
virtual void collect_param_descrs(param_descrs & r) { m_solver->collect_param_descrs(r); }
|
||||
virtual void set_produce_models(bool f) { m_solver->set_produce_models(f); }
|
||||
virtual void set_progress_callback(progress_callback * callback) { m_solver->set_progress_callback(callback); }
|
||||
virtual void collect_statistics(statistics & st) const { m_solver->collect_statistics(st); }
|
||||
virtual void get_unsat_core(ptr_vector<expr> & r) { m_solver->get_unsat_core(r); }
|
||||
virtual void get_model_core(model_ref & mdl) {
|
||||
void updt_params(params_ref const & p) override { solver::updt_params(p); m_solver->updt_params(p); }
|
||||
void collect_param_descrs(param_descrs & r) override { m_solver->collect_param_descrs(r); }
|
||||
void set_produce_models(bool f) override { m_solver->set_produce_models(f); }
|
||||
void set_progress_callback(progress_callback * callback) override { m_solver->set_progress_callback(callback); }
|
||||
void collect_statistics(statistics & st) const override { m_solver->collect_statistics(st); }
|
||||
void get_unsat_core(ptr_vector<expr> & r) override { m_solver->get_unsat_core(r); }
|
||||
void get_model_core(model_ref & mdl) override {
|
||||
m_solver->get_model(mdl);
|
||||
if (mdl) {
|
||||
model_converter_ref mc = local_model_converter();
|
||||
|
@ -182,14 +182,14 @@ public:
|
|||
mc = concat(mc.get(), m_solver->get_model_converter().get());
|
||||
return mc;
|
||||
}
|
||||
virtual proof * get_proof() { return m_solver->get_proof(); }
|
||||
virtual std::string reason_unknown() const { return m_solver->reason_unknown(); }
|
||||
virtual void set_reason_unknown(char const* msg) { m_solver->set_reason_unknown(msg); }
|
||||
virtual void get_labels(svector<symbol> & r) { m_solver->get_labels(r); }
|
||||
virtual ast_manager& get_manager() const { return m; }
|
||||
virtual expr_ref_vector cube(expr_ref_vector& vars, unsigned backtrack_level) { flush_assertions(); return m_solver->cube(vars, backtrack_level); }
|
||||
virtual lbool find_mutexes(expr_ref_vector const& vars, vector<expr_ref_vector>& mutexes) { return m_solver->find_mutexes(vars, mutexes); }
|
||||
virtual lbool get_consequences_core(expr_ref_vector const& asms, expr_ref_vector const& vars, expr_ref_vector& consequences) {
|
||||
proof * get_proof() override { return m_solver->get_proof(); }
|
||||
std::string reason_unknown() const override { return m_solver->reason_unknown(); }
|
||||
void set_reason_unknown(char const* msg) override { m_solver->set_reason_unknown(msg); }
|
||||
void get_labels(svector<symbol> & r) override { m_solver->get_labels(r); }
|
||||
ast_manager& get_manager() const override { return m; }
|
||||
expr_ref_vector cube(expr_ref_vector& vars, unsigned backtrack_level) override { flush_assertions(); return m_solver->cube(vars, backtrack_level); }
|
||||
lbool find_mutexes(expr_ref_vector const& vars, vector<expr_ref_vector>& mutexes) override { return m_solver->find_mutexes(vars, mutexes); }
|
||||
lbool get_consequences_core(expr_ref_vector const& asms, expr_ref_vector const& vars, expr_ref_vector& consequences) override {
|
||||
flush_assertions();
|
||||
expr_ref_vector bvars(m);
|
||||
for (unsigned i = 0; i < vars.size(); ++i) {
|
||||
|
@ -207,7 +207,7 @@ public:
|
|||
|
||||
// translate bit-vector consequences back to integer values
|
||||
for (unsigned i = 0; i < consequences.size(); ++i) {
|
||||
expr* a = 0, *b = 0, *u = 0, *v = 0;
|
||||
expr* a = nullptr, *b = nullptr, *u = nullptr, *v = nullptr;
|
||||
func_decl* f;
|
||||
rational num;
|
||||
unsigned bvsize;
|
||||
|
@ -331,12 +331,12 @@ private:
|
|||
m_rewriter.reset();
|
||||
}
|
||||
|
||||
virtual unsigned get_num_assertions() const {
|
||||
unsigned get_num_assertions() const override {
|
||||
flush_assertions();
|
||||
return m_solver->get_num_assertions();
|
||||
}
|
||||
|
||||
virtual expr * get_assertion(unsigned idx) const {
|
||||
expr * get_assertion(unsigned idx) const override {
|
||||
flush_assertions();
|
||||
return m_solver->get_assertion(idx);
|
||||
}
|
||||
|
|
|
@ -40,8 +40,8 @@ tactic * mk_default_tactic(ast_manager & m, params_ref const & p) {
|
|||
cond(mk_is_qflra_probe(), mk_qflra_tactic(m),
|
||||
cond(mk_is_qfnra_probe(), mk_qfnra_tactic(m),
|
||||
cond(mk_is_qfnia_probe(), mk_qfnia_tactic(m),
|
||||
cond(mk_is_nra_probe(), mk_nra_tactic(m),
|
||||
cond(mk_is_lira_probe(), mk_lira_tactic(m, p),
|
||||
cond(mk_is_nra_probe(), mk_nra_tactic(m),
|
||||
cond(mk_is_qffp_probe(), mk_qffp_tactic(m, p),
|
||||
mk_smt_tactic()))))))))))),
|
||||
p);
|
||||
|
|
|
@ -46,9 +46,9 @@ public:
|
|||
solver::updt_params(p);
|
||||
}
|
||||
|
||||
virtual ~enum2bv_solver() {}
|
||||
~enum2bv_solver() override {}
|
||||
|
||||
virtual solver* translate(ast_manager& dst_m, params_ref const& p) {
|
||||
solver* translate(ast_manager& dst_m, params_ref const& p) override {
|
||||
solver* result = alloc(enum2bv_solver, dst_m, p, m_solver->translate(dst_m, p));
|
||||
model_converter_ref mc = external_model_converter();
|
||||
if (mc) {
|
||||
|
@ -58,7 +58,7 @@ public:
|
|||
return result;
|
||||
}
|
||||
|
||||
virtual void assert_expr_core(expr * t) {
|
||||
void assert_expr_core(expr * t) override {
|
||||
expr_ref tmp(t, m);
|
||||
expr_ref_vector bounds(m);
|
||||
proof_ref tmp_proof(m);
|
||||
|
@ -68,17 +68,17 @@ public:
|
|||
m_solver->assert_expr(bounds);
|
||||
}
|
||||
|
||||
virtual void push_core() {
|
||||
void push_core() override {
|
||||
m_rewriter.push();
|
||||
m_solver->push();
|
||||
}
|
||||
|
||||
virtual void pop_core(unsigned n) {
|
||||
void pop_core(unsigned n) override {
|
||||
m_solver->pop(n);
|
||||
m_rewriter.pop(n);
|
||||
}
|
||||
|
||||
virtual lbool check_sat_core(unsigned num_assumptions, expr * const * assumptions) {
|
||||
lbool check_sat_core(unsigned num_assumptions, expr * const * assumptions) override {
|
||||
m_solver->updt_params(get_params());
|
||||
return m_solver->check_sat(num_assumptions, assumptions);
|
||||
}
|
||||
|
@ -160,7 +160,7 @@ public:
|
|||
|
||||
// translate bit-vector consequences back to enumeration types
|
||||
for (unsigned i = 0; i < consequences.size(); ++i) {
|
||||
expr* a = 0, *b = 0, *u = 0, *v = 0;
|
||||
expr* a = nullptr, *b = nullptr, *u = nullptr, *v = nullptr;
|
||||
func_decl* f;
|
||||
rational num;
|
||||
unsigned bvsize;
|
||||
|
@ -180,11 +180,11 @@ public:
|
|||
|
||||
|
||||
|
||||
virtual unsigned get_num_assertions() const {
|
||||
unsigned get_num_assertions() const override {
|
||||
return m_solver->get_num_assertions();
|
||||
}
|
||||
|
||||
virtual expr * get_assertion(unsigned idx) const {
|
||||
expr * get_assertion(unsigned idx) const override {
|
||||
return m_solver->get_assertion(idx);
|
||||
}
|
||||
|
||||
|
|
|
@ -45,9 +45,9 @@ public:
|
|||
solver::updt_params(p);
|
||||
}
|
||||
|
||||
virtual ~pb2bv_solver() {}
|
||||
~pb2bv_solver() override {}
|
||||
|
||||
virtual solver* translate(ast_manager& dst_m, params_ref const& p) {
|
||||
solver* translate(ast_manager& dst_m, params_ref const& p) override {
|
||||
flush_assertions();
|
||||
solver* result = alloc(pb2bv_solver, dst_m, p, m_solver->translate(dst_m, p));
|
||||
model_converter_ref mc = external_model_converter();
|
||||
|
@ -58,59 +58,60 @@ public:
|
|||
return result;
|
||||
}
|
||||
|
||||
virtual void assert_expr_core(expr * t) {
|
||||
void assert_expr_core(expr * t) override {
|
||||
m_assertions.push_back(t);
|
||||
}
|
||||
|
||||
virtual void push_core() {
|
||||
void push_core() override {
|
||||
flush_assertions();
|
||||
m_rewriter.push();
|
||||
m_solver->push();
|
||||
}
|
||||
|
||||
virtual void pop_core(unsigned n) {
|
||||
void pop_core(unsigned n) override {
|
||||
m_assertions.reset();
|
||||
m_solver->pop(n);
|
||||
m_rewriter.pop(n);
|
||||
}
|
||||
|
||||
virtual lbool check_sat_core(unsigned num_assumptions, expr * const * assumptions) {
|
||||
lbool check_sat_core(unsigned num_assumptions, expr * const * assumptions) override {
|
||||
flush_assertions();
|
||||
return m_solver->check_sat(num_assumptions, assumptions);
|
||||
}
|
||||
|
||||
virtual void updt_params(params_ref const & p) { solver::updt_params(p); m_rewriter.updt_params(p); m_solver->updt_params(p); }
|
||||
virtual void collect_param_descrs(param_descrs & r) { m_solver->collect_param_descrs(r); m_rewriter.collect_param_descrs(r);}
|
||||
virtual void set_produce_models(bool f) { m_solver->set_produce_models(f); }
|
||||
virtual void set_progress_callback(progress_callback * callback) { m_solver->set_progress_callback(callback); }
|
||||
virtual void collect_statistics(statistics & st) const {
|
||||
void updt_params(params_ref const & p) override { solver::updt_params(p); m_rewriter.updt_params(p); m_solver->updt_params(p); }
|
||||
void collect_param_descrs(param_descrs & r) override { m_solver->collect_param_descrs(r); m_rewriter.collect_param_descrs(r);}
|
||||
void set_produce_models(bool f) override { m_solver->set_produce_models(f); }
|
||||
void set_progress_callback(progress_callback * callback) override { m_solver->set_progress_callback(callback); }
|
||||
void collect_statistics(statistics & st) const override {
|
||||
m_rewriter.collect_statistics(st);
|
||||
m_solver->collect_statistics(st);
|
||||
}
|
||||
virtual void get_unsat_core(ptr_vector<expr> & r) { m_solver->get_unsat_core(r); }
|
||||
virtual void get_model_core(model_ref & mdl) {
|
||||
void get_unsat_core(ptr_vector<expr> & r) override { m_solver->get_unsat_core(r); }
|
||||
void get_model_core(model_ref & mdl) override {
|
||||
m_solver->get_model(mdl);
|
||||
if (mdl) {
|
||||
model_converter_ref mc = local_model_converter();
|
||||
if (mc) (*mc)(mdl);
|
||||
}
|
||||
}
|
||||
model_converter* external_model_converter() const {
|
||||
|
||||
model_converter* external_model_converter() const{
|
||||
return concat(mc0(), local_model_converter());
|
||||
}
|
||||
virtual model_converter_ref get_model_converter() const {
|
||||
model_converter_ref get_model_converter() const override {
|
||||
model_converter_ref mc = external_model_converter();
|
||||
mc = concat(mc.get(), m_solver->get_model_converter().get());
|
||||
return mc;
|
||||
}
|
||||
virtual proof * get_proof() { return m_solver->get_proof(); }
|
||||
virtual std::string reason_unknown() const { return m_solver->reason_unknown(); }
|
||||
virtual void set_reason_unknown(char const* msg) { m_solver->set_reason_unknown(msg); }
|
||||
virtual void get_labels(svector<symbol> & r) { m_solver->get_labels(r); }
|
||||
virtual ast_manager& get_manager() const { return m; }
|
||||
virtual expr_ref_vector cube(expr_ref_vector& vars, unsigned backtrack_level) { flush_assertions(); return m_solver->cube(vars, backtrack_level); }
|
||||
virtual lbool find_mutexes(expr_ref_vector const& vars, vector<expr_ref_vector>& mutexes) { return m_solver->find_mutexes(vars, mutexes); }
|
||||
virtual lbool get_consequences_core(expr_ref_vector const& asms, expr_ref_vector const& vars, expr_ref_vector& consequences) {
|
||||
proof * get_proof() override { return m_solver->get_proof(); }
|
||||
std::string reason_unknown() const override { return m_solver->reason_unknown(); }
|
||||
void set_reason_unknown(char const* msg) override { m_solver->set_reason_unknown(msg); }
|
||||
void get_labels(svector<symbol> & r) override { m_solver->get_labels(r); }
|
||||
ast_manager& get_manager() const override { return m; }
|
||||
expr_ref_vector cube(expr_ref_vector& vars, unsigned backtrack_level) override { flush_assertions(); return m_solver->cube(vars, backtrack_level); }
|
||||
lbool find_mutexes(expr_ref_vector const& vars, vector<expr_ref_vector>& mutexes) override { return m_solver->find_mutexes(vars, mutexes); }
|
||||
lbool get_consequences_core(expr_ref_vector const& asms, expr_ref_vector const& vars, expr_ref_vector& consequences) override {
|
||||
flush_assertions();
|
||||
return m_solver->get_consequences(asms, vars, consequences); }
|
||||
|
||||
|
@ -126,12 +127,12 @@ public:
|
|||
return filter;
|
||||
}
|
||||
|
||||
virtual unsigned get_num_assertions() const {
|
||||
unsigned get_num_assertions() const override {
|
||||
flush_assertions();
|
||||
return m_solver->get_num_assertions();
|
||||
}
|
||||
|
||||
virtual expr * get_assertion(unsigned idx) const {
|
||||
expr * get_assertion(unsigned idx) const override {
|
||||
flush_assertions();
|
||||
return m_solver->get_assertion(idx);
|
||||
}
|
||||
|
|
|
@ -101,7 +101,7 @@ tactic * mk_tactic_for_logic(ast_manager & m, params_ref const & p, symbol const
|
|||
static solver* mk_special_solver_for_logic(ast_manager & m, params_ref const & p, symbol const& logic) {
|
||||
if ((logic == "QF_FD" || logic == "SAT") && !m.proofs_enabled())
|
||||
return mk_fd_solver(m, p);
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
static solver* mk_solver_for_logic(ast_manager & m, params_ref const & p, symbol const& logic) {
|
||||
|
@ -119,8 +119,8 @@ class smt_strategic_solver_factory : public solver_factory {
|
|||
public:
|
||||
smt_strategic_solver_factory(symbol const & logic):m_logic(logic) {}
|
||||
|
||||
virtual ~smt_strategic_solver_factory() {}
|
||||
virtual solver * operator()(ast_manager & m, params_ref const & p, bool proofs_enabled, bool models_enabled, bool unsat_core_enabled, symbol const & logic) {
|
||||
~smt_strategic_solver_factory() override {}
|
||||
solver * operator()(ast_manager & m, params_ref const & p, bool proofs_enabled, bool models_enabled, bool unsat_core_enabled, symbol const & logic) override {
|
||||
symbol l;
|
||||
if (m_logic != symbol::null)
|
||||
l = m_logic;
|
||||
|
|
|
@ -27,7 +27,7 @@ Revision History:
|
|||
|
||||
class memory_probe : public probe {
|
||||
public:
|
||||
virtual result operator()(goal const & g) {
|
||||
result operator()(goal const & g) override {
|
||||
return result(static_cast<double>(memory::get_allocation_size())/static_cast<double>(1024*1024));
|
||||
}
|
||||
};
|
||||
|
@ -38,21 +38,21 @@ probe * mk_memory_probe() {
|
|||
|
||||
class depth_probe : public probe {
|
||||
public:
|
||||
virtual result operator()(goal const & g) {
|
||||
result operator()(goal const & g) override {
|
||||
return result(g.depth());
|
||||
}
|
||||
};
|
||||
|
||||
class size_probe : public probe {
|
||||
public:
|
||||
virtual result operator()(goal const & g) {
|
||||
result operator()(goal const & g) override {
|
||||
return result(g.size());
|
||||
}
|
||||
};
|
||||
|
||||
class num_exprs_probe : public probe {
|
||||
public:
|
||||
virtual result operator()(goal const & g) {
|
||||
result operator()(goal const & g) override {
|
||||
return result(g.num_exprs());
|
||||
}
|
||||
};
|
||||
|
@ -79,7 +79,7 @@ public:
|
|||
p->inc_ref();
|
||||
}
|
||||
|
||||
~unary_probe() {
|
||||
~unary_probe() override {
|
||||
m_p->dec_ref();
|
||||
}
|
||||
|
||||
|
@ -99,7 +99,7 @@ public:
|
|||
p2->inc_ref();
|
||||
}
|
||||
|
||||
~bin_probe() {
|
||||
~bin_probe() override {
|
||||
m_p1->dec_ref();
|
||||
m_p2->dec_ref();
|
||||
}
|
||||
|
@ -108,7 +108,7 @@ public:
|
|||
class not_probe : public unary_probe {
|
||||
public:
|
||||
not_probe(probe * p):unary_probe(p) {}
|
||||
virtual result operator()(goal const & g) {
|
||||
result operator()(goal const & g) override {
|
||||
return result(!m_p->operator()(g).is_true());
|
||||
}
|
||||
};
|
||||
|
@ -116,7 +116,7 @@ public:
|
|||
class and_probe : public bin_probe {
|
||||
public:
|
||||
and_probe(probe * p1, probe * p2):bin_probe(p1, p2) {}
|
||||
virtual result operator()(goal const & g) {
|
||||
result operator()(goal const & g) override {
|
||||
return result(m_p1->operator()(g).is_true() && m_p2->operator()(g).is_true());
|
||||
}
|
||||
};
|
||||
|
@ -124,7 +124,7 @@ public:
|
|||
class or_probe : public bin_probe {
|
||||
public:
|
||||
or_probe(probe * p1, probe * p2):bin_probe(p1, p2) {}
|
||||
virtual result operator()(goal const & g) {
|
||||
result operator()(goal const & g) override {
|
||||
return result(m_p1->operator()(g).is_true() || m_p2->operator()(g).is_true());
|
||||
}
|
||||
};
|
||||
|
@ -132,7 +132,7 @@ public:
|
|||
class eq_probe : public bin_probe {
|
||||
public:
|
||||
eq_probe(probe * p1, probe * p2):bin_probe(p1, p2) {}
|
||||
virtual result operator()(goal const & g) {
|
||||
result operator()(goal const & g) override {
|
||||
return result(m_p1->operator()(g).get_value() == m_p2->operator()(g).get_value());
|
||||
}
|
||||
};
|
||||
|
@ -140,7 +140,7 @@ public:
|
|||
class le_probe : public bin_probe {
|
||||
public:
|
||||
le_probe(probe * p1, probe * p2):bin_probe(p1, p2) {}
|
||||
virtual result operator()(goal const & g) {
|
||||
result operator()(goal const & g) override {
|
||||
return result(m_p1->operator()(g).get_value() <= m_p2->operator()(g).get_value());
|
||||
}
|
||||
};
|
||||
|
@ -148,7 +148,7 @@ public:
|
|||
class add_probe : public bin_probe {
|
||||
public:
|
||||
add_probe(probe * p1, probe * p2):bin_probe(p1, p2) {}
|
||||
virtual result operator()(goal const & g) {
|
||||
result operator()(goal const & g) override {
|
||||
return result(m_p1->operator()(g).get_value() + m_p2->operator()(g).get_value());
|
||||
}
|
||||
};
|
||||
|
@ -156,7 +156,7 @@ public:
|
|||
class sub_probe : public bin_probe {
|
||||
public:
|
||||
sub_probe(probe * p1, probe * p2):bin_probe(p1, p2) {}
|
||||
virtual result operator()(goal const & g) {
|
||||
result operator()(goal const & g) override {
|
||||
return result(m_p1->operator()(g).get_value() - m_p2->operator()(g).get_value());
|
||||
}
|
||||
};
|
||||
|
@ -164,7 +164,7 @@ public:
|
|||
class mul_probe : public bin_probe {
|
||||
public:
|
||||
mul_probe(probe * p1, probe * p2):bin_probe(p1, p2) {}
|
||||
virtual result operator()(goal const & g) {
|
||||
result operator()(goal const & g) override {
|
||||
return result(m_p1->operator()(g).get_value() * m_p2->operator()(g).get_value());
|
||||
}
|
||||
};
|
||||
|
@ -172,7 +172,7 @@ public:
|
|||
class div_probe : public bin_probe {
|
||||
public:
|
||||
div_probe(probe * p1, probe * p2):bin_probe(p1, p2) {}
|
||||
virtual result operator()(goal const & g) {
|
||||
result operator()(goal const & g) override {
|
||||
return result(m_p1->operator()(g).get_value() / m_p2->operator()(g).get_value());
|
||||
}
|
||||
};
|
||||
|
@ -182,7 +182,7 @@ class const_probe : public probe {
|
|||
public:
|
||||
const_probe(double v):m_val(v) {}
|
||||
|
||||
virtual result operator()(goal const & g) {
|
||||
result operator()(goal const & g) override {
|
||||
return result(m_val);
|
||||
}
|
||||
};
|
||||
|
@ -303,7 +303,7 @@ struct is_non_qfbv_predicate {
|
|||
|
||||
class is_propositional_probe : public probe {
|
||||
public:
|
||||
virtual result operator()(goal const & g) {
|
||||
result operator()(goal const & g) override {
|
||||
return !test<is_non_propositional_predicate>(g);
|
||||
}
|
||||
};
|
||||
|
@ -311,7 +311,7 @@ public:
|
|||
|
||||
class is_qfbv_probe : public probe {
|
||||
public:
|
||||
virtual result operator()(goal const & g) {
|
||||
result operator()(goal const & g) override {
|
||||
return !test<is_non_qfbv_predicate>(g);
|
||||
}
|
||||
};
|
||||
|
@ -353,7 +353,7 @@ struct is_non_qfaufbv_predicate {
|
|||
|
||||
class is_qfaufbv_probe : public probe {
|
||||
public:
|
||||
virtual result operator()(goal const & g) {
|
||||
result operator()(goal const & g) override {
|
||||
return !test<is_non_qfaufbv_predicate>(g);
|
||||
}
|
||||
};
|
||||
|
@ -391,7 +391,7 @@ struct is_non_qfufbv_predicate {
|
|||
|
||||
class is_qfufbv_probe : public probe {
|
||||
public:
|
||||
virtual result operator()(goal const & g) {
|
||||
result operator()(goal const & g) override {
|
||||
return !test<is_non_qfufbv_predicate>(g);
|
||||
}
|
||||
};
|
||||
|
@ -411,7 +411,7 @@ class num_consts_probe : public probe {
|
|||
family_id m_fid;
|
||||
unsigned m_counter;
|
||||
proc(ast_manager & _m, bool b, char const * family):m(_m), m_bool(b), m_counter(0) {
|
||||
if (family != 0)
|
||||
if (family != nullptr)
|
||||
m_fid = m.mk_family_id(family);
|
||||
else
|
||||
m_fid = null_family_id;
|
||||
|
@ -442,7 +442,7 @@ public:
|
|||
num_consts_probe(bool b, char const * f):
|
||||
m_bool(b), m_family(f) {
|
||||
}
|
||||
virtual result operator()(goal const & g) {
|
||||
result operator()(goal const & g) override {
|
||||
proc p(g.m(), m_bool, m_family);
|
||||
unsigned sz = g.size();
|
||||
expr_fast_mark1 visited;
|
||||
|
@ -454,11 +454,11 @@ public:
|
|||
};
|
||||
|
||||
probe * mk_num_consts_probe() {
|
||||
return alloc(num_consts_probe, false, 0);
|
||||
return alloc(num_consts_probe, false, nullptr);
|
||||
}
|
||||
|
||||
probe * mk_num_bool_consts_probe() {
|
||||
return alloc(num_consts_probe, true, 0);
|
||||
return alloc(num_consts_probe, true, nullptr);
|
||||
}
|
||||
|
||||
probe * mk_num_arith_consts_probe() {
|
||||
|
@ -471,21 +471,21 @@ probe * mk_num_bv_consts_probe() {
|
|||
|
||||
class produce_proofs_probe : public probe {
|
||||
public:
|
||||
virtual result operator()(goal const & g) {
|
||||
result operator()(goal const & g) override {
|
||||
return g.proofs_enabled();
|
||||
}
|
||||
};
|
||||
|
||||
class produce_models_probe : public probe {
|
||||
public:
|
||||
virtual result operator()(goal const & g) {
|
||||
result operator()(goal const & g) override {
|
||||
return g.models_enabled();
|
||||
}
|
||||
};
|
||||
|
||||
class produce_unsat_cores_probe : public probe {
|
||||
public:
|
||||
virtual result operator()(goal const & g) {
|
||||
result operator()(goal const & g) override {
|
||||
return g.unsat_core_enabled();
|
||||
}
|
||||
};
|
||||
|
@ -514,7 +514,7 @@ struct has_pattern_probe : public probe {
|
|||
}
|
||||
};
|
||||
public:
|
||||
virtual result operator()(goal const & g) {
|
||||
result operator()(goal const & g) override {
|
||||
try {
|
||||
expr_fast_mark1 visited;
|
||||
proc p;
|
||||
|
@ -544,7 +544,7 @@ struct has_quantifier_probe : public probe {
|
|||
void operator()(quantifier * n) { throw found(); }
|
||||
};
|
||||
public:
|
||||
virtual result operator()(goal const & g) {
|
||||
result operator()(goal const & g) override {
|
||||
try {
|
||||
expr_fast_mark1 visited;
|
||||
proc p;
|
||||
|
|
|
@ -39,9 +39,9 @@ public:
|
|||
};
|
||||
|
||||
proof_converter * concat(proof_converter * pc1, proof_converter * pc2) {
|
||||
if (pc1 == 0)
|
||||
if (pc1 == nullptr)
|
||||
return pc2;
|
||||
if (pc2 == 0)
|
||||
if (pc2 == nullptr)
|
||||
return pc1;
|
||||
return alloc(concat_proof_converter, pc1, pc2);
|
||||
}
|
||||
|
@ -62,6 +62,7 @@ public:
|
|||
proof_converter_ref_buffer pc_buffer;
|
||||
for (goal_ref g : m_goals) {
|
||||
pc_buffer.push_back(g->pc());
|
||||
|
||||
}
|
||||
return apply(m, m_pc, pc_buffer);
|
||||
}
|
||||
|
@ -85,7 +86,7 @@ class proof2pc : public proof_converter {
|
|||
proof_ref m_pr;
|
||||
public:
|
||||
proof2pc(ast_manager & m, proof * pr):m_pr(pr, m) {}
|
||||
virtual ~proof2pc() {}
|
||||
~proof2pc() override {}
|
||||
|
||||
proof_ref operator()(ast_manager & m, unsigned num_source, proof * const * source) override {
|
||||
SASSERT(num_source == 0);
|
||||
|
@ -102,8 +103,8 @@ public:
|
|||
};
|
||||
|
||||
proof_converter * proof2proof_converter(ast_manager & m, proof * pr) {
|
||||
if (pr == 0)
|
||||
return 0;
|
||||
if (pr == nullptr)
|
||||
return nullptr;
|
||||
return alloc(proof2pc, m, pr);
|
||||
}
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ class goal;
|
|||
|
||||
class proof_converter : public converter {
|
||||
public:
|
||||
virtual ~proof_converter() { }
|
||||
~proof_converter() override { }
|
||||
virtual proof_ref operator()(ast_manager & m, unsigned num_source, proof * const * source) = 0;
|
||||
virtual proof_converter * translate(ast_translation & translator) = 0;
|
||||
};
|
||||
|
|
|
@ -39,7 +39,7 @@ public:
|
|||
replace_map(ast_manager& m): map_proc(m) {}
|
||||
|
||||
void insert(expr* src, expr* dst) {
|
||||
m_map.insert(src, dst, 0);
|
||||
m_map.insert(src, dst, nullptr);
|
||||
}
|
||||
|
||||
void operator()(var* v) { visit(v); }
|
||||
|
|
|
@ -32,7 +32,7 @@ public:
|
|||
|
||||
replace_proof_converter(ast_manager& _m): m(_m), m_proofs(m) {}
|
||||
|
||||
virtual ~replace_proof_converter() {}
|
||||
~replace_proof_converter() override {}
|
||||
|
||||
proof_ref operator()(ast_manager & _m, unsigned num_source, proof * const * source) override;
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ public:
|
|||
TRACE("sine", tout << new_forms.size(););
|
||||
g->reset();
|
||||
for (unsigned i = 0; i < new_forms.size(); i++) {
|
||||
g->assert_expr(new_forms.get(i), 0, 0);
|
||||
g->assert_expr(new_forms.get(i), nullptr, nullptr);
|
||||
}
|
||||
g->inc_depth();
|
||||
g->updt_prec(goal::OVER);
|
||||
|
|
|
@ -43,7 +43,7 @@ bvsls_opt_engine::optimization_result bvsls_opt_engine::optimize(
|
|||
m_hard_tracker.initialize(m_assertions);
|
||||
setup_opt_tracker(objective, _maximize);
|
||||
|
||||
if (initial_model.get() != 0) {
|
||||
if (initial_model.get() != nullptr) {
|
||||
TRACE("sls_opt", tout << "Initial model provided: " << std::endl;
|
||||
for (unsigned i = 0; i < initial_model->get_num_constants(); i++) {
|
||||
func_decl * fd = initial_model->get_constant(i);
|
||||
|
|
|
@ -65,7 +65,7 @@ protected:
|
|||
unsigned & best_const, mpz & best_value, unsigned & new_bit, move_type & move,
|
||||
mpz const & max_score, expr * objective);
|
||||
|
||||
mpz top_score(void) {
|
||||
mpz top_score() {
|
||||
mpz res(0);
|
||||
obj_hashtable<expr> const & top_exprs = m_obj_tracker.get_top_exprs();
|
||||
for (obj_hashtable<expr>::iterator it = top_exprs.begin();
|
||||
|
|
|
@ -537,7 +537,7 @@ bailout:
|
|||
|
||||
void sls_engine::operator()(goal_ref const & g, model_converter_ref & mc) {
|
||||
if (g->inconsistent()) {
|
||||
mc = 0;
|
||||
mc = nullptr;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -565,7 +565,7 @@ void sls_engine::operator()(goal_ref const & g, model_converter_ref & mc) {
|
|||
g->reset();
|
||||
}
|
||||
else
|
||||
mc = 0;
|
||||
mc = nullptr;
|
||||
}
|
||||
|
||||
lbool sls_engine::operator()() {
|
||||
|
|
|
@ -99,7 +99,7 @@ public:
|
|||
|
||||
// stats const & get_stats(void) { return m_stats; }
|
||||
void collect_statistics(statistics & st) const;
|
||||
void reset_statistics(void) { m_stats.reset(); }
|
||||
void reset_statistics() { m_stats.reset(); }
|
||||
|
||||
bool full_eval(model & mdl);
|
||||
|
||||
|
@ -109,7 +109,7 @@ public:
|
|||
void mk_inv(unsigned bv_sz, const mpz & old_value, mpz & inverted);
|
||||
void mk_flip(sort * s, const mpz & old_value, unsigned bit, mpz & flipped);
|
||||
|
||||
lbool search(void);
|
||||
lbool search();
|
||||
|
||||
lbool operator()();
|
||||
void operator()(goal_ref const & g, model_converter_ref & mc);
|
||||
|
|
|
@ -42,25 +42,25 @@ public:
|
|||
m_engine = alloc(sls_engine, m, p);
|
||||
}
|
||||
|
||||
virtual tactic * translate(ast_manager & m) {
|
||||
tactic * translate(ast_manager & m) override {
|
||||
return alloc(sls_tactic, m, m_params);
|
||||
}
|
||||
|
||||
virtual ~sls_tactic() {
|
||||
~sls_tactic() override {
|
||||
dealloc(m_engine);
|
||||
}
|
||||
|
||||
virtual void updt_params(params_ref const & p) {
|
||||
void updt_params(params_ref const & p) override {
|
||||
m_params = p;
|
||||
m_engine->updt_params(p);
|
||||
}
|
||||
|
||||
virtual void collect_param_descrs(param_descrs & r) {
|
||||
void collect_param_descrs(param_descrs & r) override {
|
||||
sls_params::collect_param_descrs(r);
|
||||
}
|
||||
|
||||
virtual void operator()(goal_ref const & g,
|
||||
goal_ref_buffer & result) {
|
||||
void operator()(goal_ref const & g,
|
||||
goal_ref_buffer & result) override {
|
||||
SASSERT(g->is_well_sorted());
|
||||
result.reset();
|
||||
|
||||
|
@ -76,17 +76,17 @@ public:
|
|||
SASSERT(g->is_well_sorted());
|
||||
}
|
||||
|
||||
virtual void cleanup() {
|
||||
void cleanup() override {
|
||||
sls_engine * d = alloc(sls_engine, m, m_params);
|
||||
std::swap(d, m_engine);
|
||||
dealloc(d);
|
||||
}
|
||||
|
||||
virtual void collect_statistics(statistics & st) const {
|
||||
void collect_statistics(statistics & st) const override {
|
||||
m_engine->collect_statistics(st);
|
||||
}
|
||||
|
||||
virtual void reset_statistics() {
|
||||
void reset_statistics() override {
|
||||
m_engine->reset_statistics();
|
||||
}
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ class sls_tracker {
|
|||
mpz m_zero, m_one, m_two;
|
||||
|
||||
struct value_score {
|
||||
value_score() : m(0), value(unsynch_mpz_manager::mk_z(0)), score(0.0), score_prune(0.0), has_pos_occ(0), has_neg_occ(0), distance(0), touched(1) {};
|
||||
value_score() : m(nullptr), value(unsynch_mpz_manager::mk_z(0)), score(0.0), score_prune(0.0), has_pos_occ(0), has_neg_occ(0), distance(0), touched(1) {};
|
||||
value_score(value_score && other) :
|
||||
m(other.m),
|
||||
value(std::move(other.value)),
|
||||
|
@ -1038,7 +1038,7 @@ public:
|
|||
if (m_mpz_manager.neq(get_value(as[0]), m_one))
|
||||
return as[0];
|
||||
else
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
m_temp_constants.reset();
|
||||
|
||||
|
@ -1061,7 +1061,7 @@ public:
|
|||
}
|
||||
}
|
||||
if (pos == static_cast<unsigned>(-1))
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
m_touched++;
|
||||
m_scores.find(as[pos]).touched++;
|
||||
|
@ -1082,7 +1082,7 @@ public:
|
|||
for (unsigned i = 0; i < sz; i++)
|
||||
if (m_mpz_manager.neq(get_value(as[i]), m_one) && (get_random_uint(16) % ++cnt_unsat == 0)) pos = i;
|
||||
if (pos == static_cast<unsigned>(-1))
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
m_last_pos = pos;
|
||||
|
@ -1092,7 +1092,7 @@ public:
|
|||
expr * get_new_unsat_assertion(ptr_vector<expr> const & as) {
|
||||
unsigned sz = as.size();
|
||||
if (sz == 1)
|
||||
return 0;
|
||||
return nullptr;
|
||||
m_temp_constants.reset();
|
||||
|
||||
unsigned cnt_unsat = 0, pos = -1;
|
||||
|
@ -1100,7 +1100,7 @@ public:
|
|||
if ((i != m_last_pos) && m_mpz_manager.neq(get_value(as[i]), m_one) && (get_random_uint(16) % ++cnt_unsat == 0)) pos = i;
|
||||
|
||||
if (pos == static_cast<unsigned>(-1))
|
||||
return 0;
|
||||
return nullptr;
|
||||
return as[pos];
|
||||
}
|
||||
};
|
||||
|
|
|
@ -24,7 +24,6 @@ Notes:
|
|||
#include "tactic/core/solve_eqs_tactic.h"
|
||||
#include "tactic/core/elim_uncnstr_tactic.h"
|
||||
#include "smt/tactic/smt_tactic.h"
|
||||
// include"mip_tactic.h"
|
||||
#include "tactic/arith/add_bounds_tactic.h"
|
||||
#include "tactic/arith/pb2bv_tactic.h"
|
||||
#include "tactic/arith/lia2pb_tactic.h"
|
||||
|
@ -37,15 +36,12 @@ Notes:
|
|||
#include "tactic/arith/probe_arith.h"
|
||||
|
||||
struct quasi_pb_probe : public probe {
|
||||
virtual result operator()(goal const & g) {
|
||||
result operator()(goal const & g) override {
|
||||
bool found_non_01 = false;
|
||||
bound_manager bm(g.m());
|
||||
bm(g);
|
||||
rational l, u; bool st;
|
||||
bound_manager::iterator it = bm.begin();
|
||||
bound_manager::iterator end = bm.end();
|
||||
for (; it != end; ++it) {
|
||||
expr * t = *it;
|
||||
for (expr * t : bm) {
|
||||
if (bm.has_lower(t, l, st) && bm.has_upper(t, u, st) && (l.is_zero() || l.is_one()) && (u.is_zero() || u.is_one()))
|
||||
continue;
|
||||
if (found_non_01)
|
||||
|
|
|
@ -26,8 +26,10 @@ Notes:
|
|||
#include "tactic/bv/max_bv_sharing_tactic.h"
|
||||
#include "sat/tactic/sat_tactic.h"
|
||||
#include "tactic/arith/nla2bv_tactic.h"
|
||||
#include "tactic/arith/lia2card_tactic.h"
|
||||
#include "tactic/core/ctx_simplify_tactic.h"
|
||||
#include "tactic/core/cofactor_term_ite_tactic.h"
|
||||
#include "nlsat/tactic/qfnra_nlsat_tactic.h"
|
||||
|
||||
static tactic * mk_qfnia_bv_solver(ast_manager & m, params_ref const & p_ref) {
|
||||
params_ref p = p_ref;
|
||||
|
@ -61,8 +63,6 @@ static tactic * mk_qfnia_premable(ast_manager & m, params_ref const & p_ref) {
|
|||
ctx_simp_p.set_uint("max_depth", 30);
|
||||
ctx_simp_p.set_uint("max_steps", 5000000);
|
||||
|
||||
params_ref simp_p = p_ref;
|
||||
simp_p.set_bool("hoist_mul", true);
|
||||
|
||||
params_ref elim_p = p_ref;
|
||||
elim_p.set_uint("max_memory",20);
|
||||
|
@ -73,21 +73,46 @@ static tactic * mk_qfnia_premable(ast_manager & m, params_ref const & p_ref) {
|
|||
using_params(mk_ctx_simplify_tactic(m), ctx_simp_p),
|
||||
using_params(mk_simplify_tactic(m), pull_ite_p),
|
||||
mk_elim_uncnstr_tactic(m),
|
||||
skip_if_failed(using_params(mk_cofactor_term_ite_tactic(m), elim_p)),
|
||||
using_params(mk_simplify_tactic(m), simp_p));
|
||||
mk_lia2card_tactic(m),
|
||||
skip_if_failed(using_params(mk_cofactor_term_ite_tactic(m), elim_p)));
|
||||
}
|
||||
|
||||
static tactic * mk_qfnia_sat_solver(ast_manager & m, params_ref const & p) {
|
||||
params_ref nia2sat_p = p;
|
||||
nia2sat_p.set_uint("nla2bv_max_bv_size", 64);
|
||||
nia2sat_p.set_uint("nla2bv_max_bv_size", 64);
|
||||
params_ref simp_p = p;
|
||||
simp_p.set_bool("hoist_mul", true); // hoist multipliers to create smaller circuits.
|
||||
|
||||
return and_then(mk_nla2bv_tactic(m, nia2sat_p),
|
||||
return and_then(using_params(mk_simplify_tactic(m), simp_p),
|
||||
mk_nla2bv_tactic(m, nia2sat_p),
|
||||
mk_qfnia_bv_solver(m, p),
|
||||
mk_fail_if_undecided_tactic());
|
||||
}
|
||||
|
||||
static tactic * mk_qfnia_nlsat_solver(ast_manager & m, params_ref const & p) {
|
||||
params_ref nia2sat_p = p;
|
||||
nia2sat_p.set_uint("nla2bv_max_bv_size", 64);
|
||||
params_ref simp_p = p;
|
||||
simp_p.set_bool("som", true); // expand into sums of monomials
|
||||
simp_p.set_bool("factor", false);
|
||||
|
||||
|
||||
return and_then(using_params(mk_simplify_tactic(m), simp_p),
|
||||
try_for(mk_qfnra_nlsat_tactic(m, simp_p), 3000),
|
||||
mk_fail_if_undecided_tactic());
|
||||
}
|
||||
|
||||
static tactic * mk_qfnia_smt_solver(ast_manager& m, params_ref const& p) {
|
||||
params_ref simp_p = p;
|
||||
simp_p.set_bool("som", true); // expand into sums of monomials
|
||||
return and_then(using_params(mk_simplify_tactic(m), simp_p), mk_smt_tactic());
|
||||
}
|
||||
|
||||
tactic * mk_qfnia_tactic(ast_manager & m, params_ref const & p) {
|
||||
|
||||
return and_then(mk_qfnia_premable(m, p),
|
||||
or_else(mk_qfnia_sat_solver(m, p),
|
||||
mk_smt_tactic()));
|
||||
try_for(mk_qfnia_smt_solver(m, p), 2000),
|
||||
mk_qfnia_nlsat_solver(m, p),
|
||||
mk_qfnia_smt_solver(m, p)));
|
||||
}
|
||||
|
|
|
@ -33,7 +33,9 @@ static tactic * mk_qfnra_sat_solver(ast_manager& m, params_ref const& p, unsigne
|
|||
}
|
||||
|
||||
tactic * mk_qfnra_tactic(ast_manager & m, params_ref const& p) {
|
||||
params_ref p1 = p;
|
||||
params_ref p0 = p;
|
||||
p0.set_bool("inline_vars", true);
|
||||
params_ref p1 = p;
|
||||
p1.set_uint("seed", 11);
|
||||
p1.set_bool("factor", false);
|
||||
params_ref p2 = p;
|
||||
|
@ -42,7 +44,7 @@ tactic * mk_qfnra_tactic(ast_manager & m, params_ref const& p) {
|
|||
|
||||
return and_then(mk_simplify_tactic(m, p),
|
||||
mk_propagate_values_tactic(m, p),
|
||||
or_else(try_for(mk_qfnra_nlsat_tactic(m, p), 5000),
|
||||
or_else(try_for(mk_qfnra_nlsat_tactic(m, p0), 5000),
|
||||
try_for(mk_qfnra_nlsat_tactic(m, p1), 10000),
|
||||
mk_qfnra_sat_solver(m, p, 4),
|
||||
and_then(try_for(mk_smt_tactic(), 5000), mk_fail_if_undecided_tactic()),
|
||||
|
|
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