mirror of
https://github.com/Z3Prover/z3
synced 2025-04-25 10:05:32 +00:00
Use nullptr.
This commit is contained in:
parent
f01328c65f
commit
76eb7b9ede
625 changed files with 4639 additions and 4639 deletions
|
@ -71,7 +71,7 @@ bool macro_finder::is_arith_macro(expr * n, proof * pr, expr_dependency * dep, e
|
|||
|
||||
quantifier_ref new_q(m);
|
||||
new_q = m.update_quantifier(to_quantifier(n), new_body);
|
||||
proof * new_pr = 0;
|
||||
proof * new_pr = nullptr;
|
||||
if (m.proofs_enabled()) {
|
||||
proof * rw = m.mk_rewrite(n, new_q);
|
||||
new_pr = m.mk_modus_ponens(pr, rw);
|
||||
|
@ -142,7 +142,7 @@ bool macro_finder::is_arith_macro(expr * n, proof * pr, vector<justified_expr>&
|
|||
|
||||
quantifier_ref new_q(m);
|
||||
new_q = m.update_quantifier(to_quantifier(n), new_body);
|
||||
proof * new_pr = 0;
|
||||
proof * new_pr = nullptr;
|
||||
if (m.proofs_enabled()) {
|
||||
proof * rw = m.mk_rewrite(n, new_q);
|
||||
new_pr = m.mk_modus_ponens(pr, rw);
|
||||
|
@ -163,7 +163,7 @@ bool macro_finder::is_arith_macro(expr * n, proof * pr, vector<justified_expr>&
|
|||
quantifier * q1 = m.update_quantifier(new_q, body1);
|
||||
expr * patterns[1] = { m.mk_pattern(k_app) };
|
||||
quantifier * q2 = m.update_quantifier(new_q, 1, patterns, body2);
|
||||
proof* pr1 = 0, *pr2 = 0;
|
||||
proof* pr1 = nullptr, *pr2 = nullptr;
|
||||
if (m.proofs_enabled()) {
|
||||
// new_pr : new_q
|
||||
// rw : [rewrite] new_q ~ q1 & q2
|
||||
|
@ -233,7 +233,7 @@ static void pseudo_predicate_macro2macro(ast_manager & m, app * head, app * t, e
|
|||
app * body_1 = m.mk_eq(head, ite);
|
||||
app * body_2 = m.mk_not(m.mk_eq(k_app, t));
|
||||
quantifier * q1 = m.update_quantifier(q, body_1);
|
||||
proof * pr1 = 0, *pr2 = 0;
|
||||
proof * pr1 = nullptr, *pr2 = nullptr;
|
||||
expr * pats[1] = { m.mk_pattern(k_app) };
|
||||
quantifier * q2 = m.update_quantifier(q, 1, pats, body_2); // erase patterns
|
||||
if (m.proofs_enabled()) {
|
||||
|
@ -268,8 +268,8 @@ bool macro_finder::expand_macros(unsigned num, expr * const * exprs, proof * con
|
|||
bool found_new_macro = false;
|
||||
for (unsigned i = 0; i < num; i++) {
|
||||
expr * n = exprs[i];
|
||||
proof * pr = m.proofs_enabled() ? prs[i] : 0;
|
||||
expr_dependency * depi = deps != 0 ? deps[i] : 0;
|
||||
proof * pr = m.proofs_enabled() ? prs[i] : nullptr;
|
||||
expr_dependency * depi = deps != nullptr ? deps[i] : nullptr;
|
||||
expr_ref new_n(m), def(m);
|
||||
proof_ref new_pr(m);
|
||||
expr_dependency_ref new_dep(m);
|
||||
|
@ -292,7 +292,7 @@ bool macro_finder::expand_macros(unsigned num, expr * const * exprs, proof * con
|
|||
new_exprs.push_back(new_n);
|
||||
if (m.proofs_enabled())
|
||||
new_prs.push_back(new_pr);
|
||||
if (deps != 0)
|
||||
if (deps != nullptr)
|
||||
new_deps.push_back(new_dep);
|
||||
}
|
||||
}
|
||||
|
@ -333,11 +333,11 @@ bool macro_finder::expand_macros(unsigned num, justified_expr const * fmls, vect
|
|||
bool found_new_macro = false;
|
||||
for (unsigned i = 0; i < num; i++) {
|
||||
expr * n = fmls[i].get_fml();
|
||||
proof * pr = m.proofs_enabled() ? fmls[i].get_proof() : 0;
|
||||
proof * pr = m.proofs_enabled() ? fmls[i].get_proof() : nullptr;
|
||||
expr_ref new_n(m), def(m);
|
||||
proof_ref new_pr(m);
|
||||
expr_dependency_ref new_dep(m);
|
||||
m_macro_manager.expand_macros(n, pr, 0, new_n, new_pr, new_dep);
|
||||
m_macro_manager.expand_macros(n, pr, nullptr, new_n, new_pr, new_dep);
|
||||
app_ref head(m), t(m);
|
||||
if (is_macro(new_n, head, def) && m_macro_manager.insert(head->get_decl(), to_quantifier(new_n.get()), new_pr)) {
|
||||
TRACE("macro_finder_found", tout << "found new macro: " << head->get_decl()->get_name() << "\n" << new_n << "\n";);
|
||||
|
|
|
@ -188,7 +188,7 @@ void macro_manager::display(std::ostream & out) {
|
|||
unsigned sz = m_decls.size();
|
||||
for (unsigned i = 0; i < sz; i++) {
|
||||
func_decl * f = m_decls.get(i);
|
||||
quantifier * q = 0;
|
||||
quantifier * q = nullptr;
|
||||
m_decl2macro.find(f, q);
|
||||
app * head;
|
||||
expr * def;
|
||||
|
@ -226,7 +226,7 @@ struct macro_manager::macro_expander_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 BR_FAILED;
|
||||
}
|
||||
|
||||
|
@ -255,7 +255,7 @@ struct macro_manager::macro_expander_cfg : public default_rewriter_cfg {
|
|||
erase_patterns = true;
|
||||
}
|
||||
if (erase_patterns) {
|
||||
result = m.update_quantifier(old_q, 0, 0, 0, 0, new_body);
|
||||
result = m.update_quantifier(old_q, 0, nullptr, 0, nullptr, new_body);
|
||||
}
|
||||
return erase_patterns;
|
||||
}
|
||||
|
@ -264,13 +264,13 @@ struct macro_manager::macro_expander_cfg : public default_rewriter_cfg {
|
|||
if (!is_app(_n))
|
||||
return false;
|
||||
app * n = to_app(_n);
|
||||
quantifier * q = 0;
|
||||
quantifier * q = nullptr;
|
||||
func_decl * d = n->get_decl();
|
||||
TRACE("macro_manager", tout << "trying to expand:\n" << mk_pp(n, m) << "\nd:\n" << d->get_name() << "\n";);
|
||||
if (mm.m_decl2macro.find(d, q)) {
|
||||
TRACE("macro_manager", tout << "expanding: " << mk_pp(n, m) << "\n";);
|
||||
app * head = 0;
|
||||
expr * def = 0;
|
||||
app * head = nullptr;
|
||||
expr * def = nullptr;
|
||||
mm.get_head_def(q, d, head, def);
|
||||
unsigned num = n->get_num_args();
|
||||
SASSERT(head && def);
|
||||
|
@ -292,14 +292,14 @@ struct macro_manager::macro_expander_cfg : public default_rewriter_cfg {
|
|||
expr_ref instance(m);
|
||||
s(q->get_expr(), num, subst_args.c_ptr(), instance);
|
||||
proof * qi_pr = m.mk_quant_inst(m.mk_or(m.mk_not(q), instance), num, subst_args.c_ptr());
|
||||
proof * q_pr = 0;
|
||||
proof * q_pr = nullptr;
|
||||
mm.m_decl2macro_pr.find(d, q_pr);
|
||||
SASSERT(q_pr != 0);
|
||||
proof * prs[2] = { qi_pr, q_pr };
|
||||
p = m.mk_unit_resolution(2, prs);
|
||||
}
|
||||
else {
|
||||
p = 0;
|
||||
p = nullptr;
|
||||
}
|
||||
expr_dependency * ed = mm.m_decl2macro_dep.find(d);
|
||||
m_used_macro_dependencies = m.mk_join(m_used_macro_dependencies, ed);
|
||||
|
|
|
@ -67,7 +67,7 @@ public:
|
|||
~macro_manager();
|
||||
ast_manager & get_manager() const { return m; }
|
||||
macro_util & get_util() { return m_util; }
|
||||
bool insert(func_decl * f, quantifier * m, proof * pr, expr_dependency * dep = 0);
|
||||
bool insert(func_decl * f, quantifier * m, proof * pr, expr_dependency * dep = nullptr);
|
||||
bool has_macros() const { return !m_macros.empty(); }
|
||||
void push_scope();
|
||||
void pop_scope(unsigned num_scopes);
|
||||
|
@ -82,7 +82,7 @@ public:
|
|||
unsigned get_first_macro_last_level() const { return m_scopes.empty() ? 0 : m_scopes.back().m_decls_lim; }
|
||||
func_decl * get_macro_func_decl(unsigned i) const { return m_decls.get(i); }
|
||||
func_decl * get_macro_interpretation(unsigned i, expr_ref & interp) const;
|
||||
quantifier * get_macro_quantifier(func_decl * f) const { quantifier * q = 0; m_decl2macro.find(f, q); return q; }
|
||||
quantifier * get_macro_quantifier(func_decl * f) const { quantifier * q = nullptr; m_decl2macro.find(f, q); return q; }
|
||||
void get_head_def(quantifier * q, func_decl * d, app * & head, expr * & def) const;
|
||||
void expand_macros(expr * n, proof * pr, expr_dependency * dep, expr_ref & r, proof_ref & new_pr, expr_dependency_ref & new_dep);
|
||||
|
||||
|
|
|
@ -33,8 +33,8 @@ macro_util::macro_util(ast_manager & m):
|
|||
m_arith(m),
|
||||
m_arith_rw(m),
|
||||
m_bv_rw(m),
|
||||
m_forbidden_set(0),
|
||||
m_curr_clause(0) {
|
||||
m_forbidden_set(nullptr),
|
||||
m_curr_clause(nullptr) {
|
||||
}
|
||||
|
||||
|
||||
|
@ -256,7 +256,7 @@ bool macro_util::is_arith_macro(expr * n, unsigned num_decls, app_ref & head, ex
|
|||
|
||||
inv = false;
|
||||
ptr_buffer<expr> args;
|
||||
expr * h = 0;
|
||||
expr * h = nullptr;
|
||||
unsigned lhs_num_args;
|
||||
expr * const * lhs_args;
|
||||
if (is_add(lhs)) {
|
||||
|
@ -270,13 +270,13 @@ bool macro_util::is_arith_macro(expr * n, unsigned num_decls, app_ref & head, ex
|
|||
for (unsigned i = 0; i < lhs_num_args; i++) {
|
||||
expr * arg = lhs_args[i];
|
||||
expr * neg_arg;
|
||||
if (h == 0 &&
|
||||
if (h == nullptr &&
|
||||
is_macro_head(arg, num_decls) &&
|
||||
!is_forbidden(to_app(arg)->get_decl()) &&
|
||||
!poly_contains_head(lhs, to_app(arg)->get_decl(), arg)) {
|
||||
h = arg;
|
||||
}
|
||||
else if (h == 0 && m_arith_rw.is_times_minus_one(arg, neg_arg) &&
|
||||
else if (h == nullptr && m_arith_rw.is_times_minus_one(arg, neg_arg) &&
|
||||
is_macro_head(neg_arg, num_decls) &&
|
||||
!is_forbidden(to_app(neg_arg)->get_decl()) &&
|
||||
!poly_contains_head(lhs, to_app(neg_arg)->get_decl(), arg)) {
|
||||
|
@ -287,7 +287,7 @@ bool macro_util::is_arith_macro(expr * n, unsigned num_decls, app_ref & head, ex
|
|||
args.push_back(arg);
|
||||
}
|
||||
}
|
||||
if (h == 0)
|
||||
if (h == nullptr)
|
||||
return false;
|
||||
head = to_app(h);
|
||||
expr_ref tmp(m_manager);
|
||||
|
@ -666,7 +666,7 @@ void macro_util::insert_macro(app * head, unsigned num_decls, expr * def, expr *
|
|||
expr_ref norm_def(m_manager);
|
||||
expr_ref norm_cond(m_manager);
|
||||
normalize_expr(head, num_decls, def, norm_def);
|
||||
if (cond != 0)
|
||||
if (cond != nullptr)
|
||||
normalize_expr(head, num_decls, cond, norm_cond);
|
||||
else if (!hint)
|
||||
norm_cond = m_manager.mk_true();
|
||||
|
@ -682,7 +682,7 @@ void macro_util::insert_quasi_macro(app * head, unsigned num_decls, expr * def,
|
|||
expr_ref new_cond(m_manager);
|
||||
if (!hint) {
|
||||
quasi_macro_head_to_macro_head(head, num_decls, new_head, extra_cond);
|
||||
if (cond == 0)
|
||||
if (cond == nullptr)
|
||||
new_cond = extra_cond;
|
||||
else
|
||||
bool_rewriter(m_manager).mk_and(cond, extra_cond, new_cond);
|
||||
|
@ -701,7 +701,7 @@ void macro_util::insert_quasi_macro(app * head, unsigned num_decls, expr * def,
|
|||
}
|
||||
|
||||
bool macro_util::rest_contains_decl(func_decl * f, expr * except_lit) {
|
||||
if (m_curr_clause == 0)
|
||||
if (m_curr_clause == nullptr)
|
||||
return false;
|
||||
SASSERT(is_clause(m_manager, m_curr_clause));
|
||||
unsigned num_lits = get_clause_num_literals(m_manager, m_curr_clause);
|
||||
|
@ -714,7 +714,7 @@ bool macro_util::rest_contains_decl(func_decl * f, expr * except_lit) {
|
|||
}
|
||||
|
||||
void macro_util::get_rest_clause_as_cond(expr * except_lit, expr_ref & extra_cond) {
|
||||
if (m_curr_clause == 0)
|
||||
if (m_curr_clause == nullptr)
|
||||
return;
|
||||
SASSERT(is_clause(m_manager, m_curr_clause));
|
||||
expr_ref_buffer neg_other_lits(m_manager);
|
||||
|
@ -795,7 +795,7 @@ void macro_util::collect_arith_macro_candidates(expr * lhs, expr * rhs, expr * a
|
|||
mk_sub(rhs, rest, def);
|
||||
// If is_poly_hint, rhs may contain variables that do not occur in to_app(arg).
|
||||
// So, we should re-check.
|
||||
if (!_is_poly_hint || is_poly_hint(def, to_app(arg), 0))
|
||||
if (!_is_poly_hint || is_poly_hint(def, to_app(arg), nullptr))
|
||||
add_arith_macro_candidate(to_app(arg), num_decls, def, atom, is_ineq, _is_poly_hint, r);
|
||||
}
|
||||
else if (is_times_minus_one(arg, neg_arg) && is_app(neg_arg)) {
|
||||
|
@ -816,7 +816,7 @@ void macro_util::collect_arith_macro_candidates(expr * lhs, expr * rhs, expr * a
|
|||
mk_sub(rest, rhs, def);
|
||||
// If is_poly_hint, rhs may contain variables that do not occur in to_app(neg_arg).
|
||||
// So, we should re-check.
|
||||
if (!_is_poly_hint || is_poly_hint(def, to_app(neg_arg), 0))
|
||||
if (!_is_poly_hint || is_poly_hint(def, to_app(neg_arg), nullptr))
|
||||
add_arith_macro_candidate(to_app(neg_arg), num_decls, def, atom, is_ineq, _is_poly_hint, r);
|
||||
}
|
||||
}
|
||||
|
@ -885,7 +885,7 @@ void macro_util::collect_macro_candidates_core(expr * atom, unsigned num_decls,
|
|||
insert_quasi_macro(to_app(lhs), num_decls, rhs, cond, false, true, false, r);
|
||||
}
|
||||
else if (is_hint_atom(lhs, rhs)) {
|
||||
insert_quasi_macro(to_app(lhs), num_decls, rhs, 0, false, true, true, r);
|
||||
insert_quasi_macro(to_app(lhs), num_decls, rhs, nullptr, false, true, true, r);
|
||||
}
|
||||
|
||||
if (is_quasi_macro_head(rhs, num_decls) &&
|
||||
|
@ -897,7 +897,7 @@ void macro_util::collect_macro_candidates_core(expr * atom, unsigned num_decls,
|
|||
insert_quasi_macro(to_app(rhs), num_decls, lhs, cond, false, true, false, r);
|
||||
}
|
||||
else if (is_hint_atom(rhs, lhs)) {
|
||||
insert_quasi_macro(to_app(rhs), num_decls, lhs, 0, false, true, true, r);
|
||||
insert_quasi_macro(to_app(rhs), num_decls, lhs, nullptr, false, true, true, r);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -905,7 +905,7 @@ void macro_util::collect_macro_candidates_core(expr * atom, unsigned num_decls,
|
|||
}
|
||||
|
||||
void macro_util::collect_macro_candidates(expr * atom, unsigned num_decls, macro_candidates & r) {
|
||||
m_curr_clause = 0;
|
||||
m_curr_clause = nullptr;
|
||||
r.reset();
|
||||
collect_macro_candidates_core(atom, num_decls, r);
|
||||
}
|
||||
|
@ -922,7 +922,7 @@ void macro_util::collect_macro_candidates(quantifier * q, macro_candidates & r)
|
|||
unsigned num_lits = get_clause_num_literals(m_manager, n);
|
||||
for (unsigned i = 0; i < num_lits; i++)
|
||||
collect_macro_candidates_core(get_clause_literal(m_manager, n, i), num_decls, r);
|
||||
m_curr_clause = 0;
|
||||
m_curr_clause = nullptr;
|
||||
}
|
||||
else {
|
||||
collect_macro_candidates_core(n, num_decls, r);
|
||||
|
|
|
@ -64,7 +64,7 @@ private:
|
|||
mutable bv_rewriter m_bv_rw;
|
||||
obj_hashtable<func_decl> * m_forbidden_set;
|
||||
|
||||
bool is_forbidden(func_decl * f) const { return m_forbidden_set != 0 && m_forbidden_set->contains(f); }
|
||||
bool is_forbidden(func_decl * f) const { return m_forbidden_set != nullptr && m_forbidden_set->contains(f); }
|
||||
bool poly_contains_head(expr * n, func_decl * f, expr * exception) const;
|
||||
|
||||
void collect_arith_macros(expr * n, unsigned num_decls, unsigned max_macros, bool allow_cond_macros,
|
||||
|
|
|
@ -281,10 +281,10 @@ bool quasi_macros::find_macros(unsigned n, expr * const * exprs) {
|
|||
quasi_macro_to_macro(to_quantifier(exprs[i]), a, t, macro);
|
||||
TRACE("quasi_macros", tout << "Found quasi macro: " << mk_pp(exprs[i], m_manager) << std::endl;
|
||||
tout << "Macro: " << mk_pp(macro, m_manager) << std::endl; );
|
||||
proof * pr = 0;
|
||||
proof * pr = nullptr;
|
||||
if (m_manager.proofs_enabled())
|
||||
pr = m_manager.mk_def_axiom(macro);
|
||||
expr_dependency * dep = 0;
|
||||
expr_dependency * dep = nullptr;
|
||||
if (m_macro_manager.insert(a->get_decl(), macro, pr, dep))
|
||||
res = true;
|
||||
}
|
||||
|
@ -320,7 +320,7 @@ bool quasi_macros::find_macros(unsigned n, justified_expr const * exprs) {
|
|||
quasi_macro_to_macro(to_quantifier(exprs[i].get_fml()), a, t, macro);
|
||||
TRACE("quasi_macros", tout << "Found quasi macro: " << mk_pp(exprs[i].get_fml(), m_manager) << std::endl;
|
||||
tout << "Macro: " << mk_pp(macro, m_manager) << std::endl; );
|
||||
proof * pr = 0;
|
||||
proof * pr = nullptr;
|
||||
if (m_manager.proofs_enabled())
|
||||
pr = m_manager.mk_def_axiom(macro);
|
||||
if (m_macro_manager.insert(a->get_decl(), macro, pr))
|
||||
|
@ -336,7 +336,7 @@ void quasi_macros::apply_macros(unsigned n, expr * const * exprs, proof * const
|
|||
expr_ref r(m_manager), rs(m_manager);
|
||||
proof_ref pr(m_manager), ps(m_manager);
|
||||
expr_dependency_ref dep(m_manager);
|
||||
proof * p = m_manager.proofs_enabled() ? prs[i] : 0;
|
||||
proof * p = m_manager.proofs_enabled() ? prs[i] : nullptr;
|
||||
|
||||
m_macro_manager.expand_macros(exprs[i], p, deps[i], r, pr, dep);
|
||||
m_rewriter(r);
|
||||
|
@ -366,9 +366,9 @@ void quasi_macros::apply_macros(unsigned n, justified_expr const* fmls, vector<j
|
|||
for ( unsigned i = 0 ; i < n ; i++ ) {
|
||||
expr_ref r(m_manager), rs(m_manager);
|
||||
proof_ref pr(m_manager), ps(m_manager);
|
||||
proof * p = m_manager.proofs_enabled() ? fmls[i].get_proof() : 0;
|
||||
proof * p = m_manager.proofs_enabled() ? fmls[i].get_proof() : nullptr;
|
||||
expr_dependency_ref dep(m_manager);
|
||||
m_macro_manager.expand_macros(fmls[i].get_fml(), p, 0, r, pr, dep);
|
||||
m_macro_manager.expand_macros(fmls[i].get_fml(), p, nullptr, r, pr, dep);
|
||||
m_rewriter(r);
|
||||
new_fmls.push_back(justified_expr(m_manager, r, pr));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue