3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-23 17:15:31 +00:00

Use nullptr.

This commit is contained in:
Bruce Mitchener 2018-02-12 14:05:55 +07:00
parent f01328c65f
commit 76eb7b9ede
625 changed files with 4639 additions and 4639 deletions

View file

@ -43,7 +43,7 @@ public:
unsigned m_src;
unsigned m_dst;
public:
move(M& m, unsigned s, unsigned d, T* t = 0): m(m), m_t(t), m_src(s), m_dst(d) {
move(M& m, unsigned s, unsigned d, T* t = nullptr): m(m), m_t(t), m_src(s), m_dst(d) {
if (t) m.inc_ref(t);
}
~move() {
@ -69,7 +69,7 @@ public:
unsigned src() const { return m_src; }
T* t() const { return m_t; }
bool is_epsilon() const { return m_t == 0; }
bool is_epsilon() const { return m_t == nullptr; }
};
typedef vector<move> moves;
private:
@ -407,7 +407,7 @@ public:
mvs1.push_back(move(m, mv1.src(), dst1, t));
}
for (move const& mv1 : mvs1) {
remove(mv1.src(), dst, 0);
remove(mv1.src(), dst, nullptr);
add(mv1);
}
remove(dst, dst1, t);
@ -431,7 +431,7 @@ public:
else {
continue;
}
remove(src, dst, 0);
remove(src, dst, nullptr);
--j;
}
}

View file

@ -399,7 +399,7 @@ typename symbolic_automata<T, M>::automaton_t* symbolic_automata<T, M>::mk_produ
continue;
}
else if (is_sat == l_undef) {
return 0;
return nullptr;
}
unsigned_pair tgt_pair(mvsA[i].dst(), mvsB[j].dst());
unsigned tgt;

View file

@ -506,8 +506,8 @@ struct euclidean_solver::imp {
}
imp(numeral_manager * m):
m_manager(m == 0 ? alloc(numeral_manager) : m),
m_owns_m(m == 0),
m_manager(m == nullptr ? alloc(numeral_manager) : m),
m_owns_m(m == nullptr),
m_decompose_buffer(*m_manager),
m_as_buffer(*m_manager),
m_bs_buffer(*m_manager),
@ -550,7 +550,7 @@ struct euclidean_solver::imp {
return;
equation * eq;
if (j == null_justification) {
eq = mk_eq(num, as, xs, c, 0, 0, 0);
eq = mk_eq(num, as, xs, c, 0, nullptr, nullptr);
}
else {
mpq one(1);
@ -694,7 +694,7 @@ struct euclidean_solver::imp {
mpz new_c;
decompose(m_next_pos_a, m_next_a, eq.m_c, new_c, eq.m_c);
// create auxiliary equation
equation * new_eq = mk_eq(m_tmp_xs.size(), buffer.c_ptr(), m_tmp_xs.c_ptr(), new_c, 0, 0, 0, false);
equation * new_eq = mk_eq(m_tmp_xs.size(), buffer.c_ptr(), m_tmp_xs.c_ptr(), new_c, 0, nullptr, nullptr, false);
// new_eq doesn't need to normalized, since it has unit coefficients
TRACE("euclidean_solver", tout << "decomposition: new parameter x" << p << " aux eq:\n";
display(tout, *new_eq); tout << "\n";

View file

@ -29,7 +29,7 @@ grobner::grobner(ast_manager & m, v_dependency_manager & d):
m_var_lt(m_var2weight),
m_monomial_lt(m_var_lt),
m_changed_leading_term(false),
m_unsat(0) {
m_unsat(nullptr) {
}
grobner::~grobner() {
@ -116,7 +116,7 @@ void grobner::reset() {
m_to_process.reset();
m_equations_to_unfreeze.reset();
m_equations_to_delete.reset();
m_unsat = 0;
m_unsat = nullptr;
}
void grobner::display_var(std::ostream & out, expr * var) const {
@ -410,7 +410,7 @@ void grobner::assert_monomial_tautology(expr * m) {
m1->m_vars.push_back(m);
eq->m_monomials.push_back(m1);
normalize_coeff(eq->m_monomials);
init_equation(eq, static_cast<v_dependency*>(0)); \
init_equation(eq, static_cast<v_dependency*>(nullptr)); \
m_to_process.insert(eq);
}
@ -625,7 +625,7 @@ grobner::equation * grobner::copy_equation(equation const * eq) {
grobner::equation * grobner::simplify(equation const * source, equation * target) {
TRACE("grobner", tout << "simplifying: "; display_equation(tout, *target); tout << "using: "; display_equation(tout, *source););
if (source->get_num_monomials() == 0)
return 0;
return nullptr;
m_stats.m_simplify++;
bool result = false;
bool simplified;
@ -676,7 +676,7 @@ grobner::equation * grobner::simplify(equation const * source, equation * target
}
while (simplified && !m_manager.canceled());
TRACE("grobner", tout << "result: "; display_equation(tout, *target););
return result ? target : 0;
return result ? target : nullptr;
}
/**
@ -702,13 +702,13 @@ grobner::equation * grobner::simplify_using_processed(equation * eq) {
eq = new_eq;
}
if (m_manager.canceled()) {
return 0;
return nullptr;
}
}
}
while (simplified);
TRACE("grobner", tout << "simplification result: "; display_equation(tout, *eq););
return result ? eq : 0;
return result ? eq : nullptr;
}
/**
@ -732,7 +732,7 @@ bool grobner::is_better_choice(equation * eq1, equation * eq2) {
\brief Pick next unprocessed equation
*/
grobner::equation * grobner::pick_next() {
equation * r = 0;
equation * r = nullptr;
ptr_buffer<equation> to_delete;
equation_set::iterator it = m_to_process.begin();
equation_set::iterator end = m_to_process.end();
@ -767,7 +767,7 @@ bool grobner::simplify_processed(equation * eq) {
m_changed_leading_term = false;
// if the leading term is simplified, then the equation has to be moved to m_to_process
equation * new_curr = simplify(eq, curr);
if (new_curr != 0) {
if (new_curr != nullptr) {
if (new_curr != curr) {
m_equations_to_unfreeze.push_back(curr);
to_remove.push_back(curr);
@ -817,7 +817,7 @@ void grobner::simplify_to_process(equation * eq) {
for (; it != end; ++it) {
equation * curr = *it;
equation * new_curr = simplify(eq, curr);
if (new_curr != 0 && new_curr != curr) {
if (new_curr != nullptr && new_curr != curr) {
m_equations_to_unfreeze.push_back(curr);
to_insert.push_back(new_curr);
to_remove.push_back(curr);
@ -947,7 +947,7 @@ bool grobner::compute_basis_step() {
}
#endif
equation * new_eq = simplify_using_processed(eq);
if (new_eq != 0 && eq != new_eq) {
if (new_eq != nullptr && eq != new_eq) {
// equation was updated using non destructive updates
m_equations_to_unfreeze.push_back(eq);
eq = new_eq;

View file

@ -220,25 +220,25 @@ public:
\brief Assert the given equality.
This method assumes eq is simplified.
*/
void assert_eq(expr * eq, v_dependency * ex = 0);
void assert_eq(expr * eq, v_dependency * ex = nullptr);
/**
\brief Assert the equality monomials[0] + ... + monomials[num_monomials - 1] = 0.
This method assumes the monomials were simplified.
*/
void assert_eq_0(unsigned num_monomials, expr * const * monomials, v_dependency * ex = 0);
void assert_eq_0(unsigned num_monomials, expr * const * monomials, v_dependency * ex = nullptr);
/**
\brief Assert the equality monomials[0] + ... + monomials[num_monomials - 1] = 0.
This method assumes the monomials were simplified.
*/
void assert_eq_0(unsigned num_monomials, monomial * const * monomials, v_dependency * ex = 0);
void assert_eq_0(unsigned num_monomials, monomial * const * monomials, v_dependency * ex = nullptr);
/**
\brief Assert the equality coeffs[0] * monomials[0] + ... + coeffs[num_monomials-1] * monomials[num_monomials - 1] = 0.
This method assumes the monomials were simplified.
*/
void assert_eq_0(unsigned num_monomials, rational const * coeffs, expr * const * monomials, v_dependency * ex = 0);
void assert_eq_0(unsigned num_monomials, rational const * coeffs, expr * const * monomials, v_dependency * ex = nullptr);
/**
\brief Assert the monomial tautology (quote (x_1 * ... * x_n)) - x_1 * ... * x_n = 0
@ -263,7 +263,7 @@ public:
/**
\brief Return true if an inconsistency was detected.
*/
bool inconsistent() const { return m_unsat != 0; }
bool inconsistent() const { return m_unsat != nullptr; }
/**
\brief Simplify the given expression using the equalities asserted

View file

@ -195,9 +195,9 @@ public:
m_le(le),
m_num_keys(0),
m_do_reshuffle(4),
m_root(0),
m_spare_leaf(0),
m_spare_trie(0)
m_root(nullptr),
m_spare_leaf(nullptr),
m_spare_trie(nullptr)
{}
~heap_trie() {
@ -283,7 +283,7 @@ public:
++m_stats.m_num_removes;
// assumption: key is in table.
node* n = m_root;
node* m = 0;
node* m = nullptr;
for (unsigned i = 0; i < num_keys(); ++i) {
n->dec_ref();
VERIFY (to_trie(n)->find(get_key(keys, i), m));

View file

@ -174,7 +174,7 @@ class hilbert_basis::value_index2 {
struct checker : public ht::check_value {
hilbert_basis* hb;
offset_t m_value;
checker(): hb(0) {}
checker(): hb(nullptr) {}
bool operator()(unsigned const& v) override {
if (m_value.m_offset != v) { // && hb->is_subsumed(m_value, offset_t(v))) {
return true;
@ -278,7 +278,7 @@ public:
m_zero.insert(idx, vs);
}
else {
value_index* map = 0;
value_index* map = nullptr;
if (!m_neg.find(vs.weight(), map)) {
map = alloc(value_index, hb);
map->reset(m_num_ineqs);

View file

@ -48,7 +48,7 @@ namespace algebraic_numbers {
unsigned m_sign_lower:1;
unsigned m_not_rational:1; // if true we know for sure it is not a rational
unsigned m_i:29; // number is the i-th root of p, 0 if it is not known which root of p the number is.
algebraic_cell():m_p_sz(0), m_p(0), m_minimal(false), m_not_rational(false), m_i(0) {}
algebraic_cell():m_p_sz(0), m_p(nullptr), m_minimal(false), m_not_rational(false), m_i(0) {}
bool is_minimal() const { return m_minimal != 0; }
};
@ -186,7 +186,7 @@ namespace algebraic_numbers {
for (unsigned i = 0; i < c->m_p_sz; i++)
qm().del(c->m_p[i]);
m_allocator.deallocate(sizeof(mpz)*c->m_p_sz, c->m_p);
c->m_p = 0;
c->m_p = nullptr;
c->m_p_sz = 0;
}
@ -201,13 +201,13 @@ namespace algebraic_numbers {
}
void del(numeral & a) {
if (a.m_cell == 0)
if (a.m_cell == nullptr)
return;
if (a.is_basic())
del(a.to_basic());
else
del(a.to_algebraic());
a.m_cell = 0;
a.m_cell = nullptr;
}
void reset(numeral & a) {
@ -215,7 +215,7 @@ namespace algebraic_numbers {
}
bool is_zero(numeral const & a) {
return a.m_cell == 0;
return a.m_cell == nullptr;
}
bool is_pos(numeral const & a) {
@ -361,7 +361,7 @@ namespace algebraic_numbers {
basic_cell * mk_basic_cell(mpq & n) {
if (qm().is_zero(n))
return 0;
return nullptr;
void * mem = static_cast<basic_cell*>(m_allocator.allocate(sizeof(basic_cell)));
basic_cell * c = new (mem) basic_cell();
qm().swap(c->m_value, n);
@ -1037,7 +1037,7 @@ namespace algebraic_numbers {
unsigned target_i = UINT_MAX; // index of sequence that is isolating
int target_lV = 0, target_uV = 0;
for (unsigned i = 0; i < num_fs; i++) {
if (seqs[i] == 0)
if (seqs[i] == nullptr)
continue; // sequence was discarded because it does not contain the root.
TRACE("anum_mk_binary", tout << "sequence " << i << "\n"; upm().display(tout, *(seqs[i])); tout << "\n";);
int lV = upm().sign_variations_at(*(seqs[i]), r_i.lower());
@ -1050,7 +1050,7 @@ namespace algebraic_numbers {
);
if (V <= 0) {
// discard sequence, since factor does not contain the root
seqs.set(i, 0);
seqs.set(i, nullptr);
}
else if (V == 1) {
target_i = i;
@ -1115,7 +1115,7 @@ namespace algebraic_numbers {
unsigned target_i = UINT_MAX; // index of sequence that is isolating
int target_lV = 0, target_uV = 0;
for (unsigned i = 0; i < num_fs; i++) {
if (seqs[i] == 0)
if (seqs[i] == nullptr)
continue; // sequence was discarded because it does not contain the root.
int lV = upm().sign_variations_at(*(seqs[i]), r_i.lower());
int uV = upm().sign_variations_at(*(seqs[i]), r_i.upper());
@ -1126,7 +1126,7 @@ namespace algebraic_numbers {
);
if (V <= 0) {
// discard sequence, since factor does not contain the root
seqs.set(i, 0);
seqs.set(i, nullptr);
}
else if (V == 1) {
target_i = i;
@ -2772,7 +2772,7 @@ namespace algebraic_numbers {
manager::manager(reslimit& lim, unsynch_mpq_manager & m, params_ref const & p, small_object_allocator * a) {
m_own_allocator = false;
m_allocator = a;
if (m_allocator == 0) {
if (m_allocator == nullptr) {
m_own_allocator = true;
m_allocator = alloc(small_object_allocator, "algebraic");
}

View file

@ -58,7 +58,7 @@ namespace algebraic_numbers {
typedef _scoped_numeral<manager> scoped_numeral;
typedef _scoped_numeral_vector<manager> scoped_numeral_vector;
manager(reslimit& rl, unsynch_mpq_manager & m, params_ref const & p = params_ref(), small_object_allocator * a = 0);
manager(reslimit& rl, unsynch_mpq_manager & m, params_ref const & p = params_ref(), small_object_allocator * a = nullptr);
~manager();
static void get_param_descrs(param_descrs & r);
@ -372,7 +372,7 @@ namespace algebraic_numbers {
basic_cell * to_basic() const { SASSERT(is_basic()); return UNTAG(basic_cell*, m_cell); }
algebraic_cell * to_algebraic() const { SASSERT(!is_basic()); return UNTAG(algebraic_cell*, m_cell); }
public:
anum():m_cell(0) {}
anum():m_cell(nullptr) {}
};
};

View file

@ -510,7 +510,7 @@ namespace polynomial {
monomial * allocate(unsigned capacity) {
void * mem = memory::allocate(monomial::get_obj_size(capacity));
return new (mem) monomial(UINT_MAX, 0, 0, 0);
return new (mem) monomial(UINT_MAX, 0, nullptr, 0);
}
void deallocate(monomial * ptr, unsigned capacity) {
@ -776,10 +776,10 @@ namespace polynomial {
tmp_monomial m_tmp3;
svector<power> m_powers_tmp;
public:
monomial_manager(small_object_allocator * a = 0) {
monomial_manager(small_object_allocator * a = nullptr) {
m_ref_count = 0;
m_next_var = 0;
if (a == 0) {
if (a == nullptr) {
m_allocator = alloc(small_object_allocator, "polynomial");
m_own_allocator = true;
}
@ -787,7 +787,7 @@ namespace polynomial {
m_allocator = a;
m_own_allocator = false;
}
m_unit = mk_monomial(0, static_cast<power const *>(0));
m_unit = mk_monomial(0, static_cast<power const *>(nullptr));
inc_ref(m_unit);
}
@ -1185,7 +1185,7 @@ namespace polynomial {
sqrt_tmp.reserve(sz);
for (unsigned i = 0; i < sz; i++) {
if (m->degree(i) % 2 == 1)
return 0;
return nullptr;
sqrt_tmp.set_power(i, power(m->get_var(i), m->degree(i) / 2));
}
sqrt_tmp.set_size(sz);
@ -1927,7 +1927,7 @@ namespace polynomial {
}
public:
som_buffer():m_owner(0) {}
som_buffer():m_owner(nullptr) {}
void reset() {
if (empty())
@ -2173,7 +2173,7 @@ namespace polynomial {
public:
som_buffer_vector() {
m_owner = 0;
m_owner = nullptr;
}
~som_buffer_vector() {
@ -2185,7 +2185,7 @@ namespace polynomial {
void set_owner(imp * owner) {
SASSERT(m_owner == owner || m_owner == 0);
if (m_owner == 0) {
if (m_owner == nullptr) {
m_owner = owner;
unsigned sz = m_buffers.size();
for (unsigned i = 0; i < sz; i++) {
@ -2222,7 +2222,7 @@ namespace polynomial {
numeral_vector m_tmp_as;
monomial_vector m_tmp_ms;
public:
cheap_som_buffer():m_owner(0) {}
cheap_som_buffer():m_owner(nullptr) {}
void set_owner(imp * o) { m_owner = o; }
bool empty() const { return m_tmp_ms.empty(); }
@ -2306,12 +2306,12 @@ namespace polynomial {
cheap_som_buffer m_cheap_som_buffer2;
void init() {
m_del_eh = 0;
m_del_eh = nullptr;
m_som_buffer.set_owner(this);
m_som_buffer2.set_owner(this);
m_cheap_som_buffer.set_owner(this);
m_cheap_som_buffer2.set_owner(this);
m_zero = mk_polynomial_core(0, 0, 0);
m_zero = mk_polynomial_core(0, nullptr, nullptr);
m().set(m_zero_numeral, 0);
inc_ref(m_zero);
numeral one(1);
@ -2326,7 +2326,7 @@ namespace polynomial {
m_wrapper(w),
m_manager(m),
m_upm(lim, m) {
if (mm == 0)
if (mm == nullptr)
mm = alloc(monomial_manager);
m_monomial_manager = mm;
m_monomial_manager->inc_ref();
@ -2419,13 +2419,13 @@ namespace polynomial {
void del(polynomial * p) {
TRACE("polynomial", tout << "deleting: "; p->display(tout, m_manager); tout << "\n";);
if (m_del_eh != 0) {
if (m_del_eh != nullptr) {
del_eh * curr = m_del_eh;
do {
(*curr)(p);
curr = curr->m_next;
}
while (curr != 0);
while (curr != nullptr);
}
unsigned sz = p->size();
unsigned obj_sz = polynomial::get_obj_size(sz);
@ -2924,7 +2924,7 @@ namespace polynomial {
imp * m_imp;
ptr_vector<newton_interpolator> m_data;
public:
newton_interpolator_vector():m_imp(0) {}
newton_interpolator_vector():m_imp(nullptr) {}
~newton_interpolator_vector() {
flush();
@ -2983,7 +2983,7 @@ namespace polynomial {
ms.push_back(p->m(i));
}
std::sort(ms.begin(), ms.end(), lex_lt2(x));
monomial * prev = 0;
monomial * prev = nullptr;
for (unsigned i = 0; i < sz; i++) {
monomial * orig_m = ms[i];
monomial * m;
@ -3831,7 +3831,7 @@ namespace polynomial {
r = mk_const(d_a);
return;
}
if (C_star.get() == 0) {
if (C_star.get() == nullptr) {
C_star = q;
m().set(bound, p);
}
@ -4153,7 +4153,7 @@ namespace polynomial {
counter = 0;
min_deg_q = deg_q;
// start from scratch
if (sk == 0) {
if (sk == nullptr) {
interpolator.reset();
interpolator.add(val, q);
}
@ -4165,7 +4165,7 @@ namespace polynomial {
}
else if (deg_q == min_deg_q) {
TRACE("mgcd_detail", tout << "adding sample point...\n";);
if (sk == 0) {
if (sk == nullptr) {
interpolator.add(val, q);
}
else {
@ -4178,7 +4178,7 @@ namespace polynomial {
continue;
}
bool found_candidate = false;
if (sk == 0) {
if (sk == nullptr) {
SASSERT(interpolator.num_sample_points() > 0);
interpolator.mk(x, H);
TRACE("mgcd_detail", tout << "idx: " << idx << "\ncandidate H: " << H << "\n";);
@ -4214,14 +4214,14 @@ namespace polynomial {
r = mul(ci_g, r);
done = true;
}
else if (sk != 0) {
else if (sk != nullptr) {
throw sparse_mgcd_failed();
}
}
if (done) {
TRACE("mgcd", tout << "idx: " << idx << "\nresult: " << r << "\n";);
if (sk == 0 && m_use_sparse_gcd) {
if (sk == nullptr && m_use_sparse_gcd) {
// save skeleton
skeleton * new_sk = alloc(skeleton, *this, H, x);
m_mgcd_skeletons.set(idx, new_sk);
@ -4255,7 +4255,7 @@ namespace polynomial {
m_mgcd_skeletons.reset();
for (unsigned i = 0; i < num_vars; i++) {
vars.push_back(var_min_degrees[i].get_var());
m_mgcd_skeletons.push_back(0);
m_mgcd_skeletons.push_back(nullptr);
}
scoped_numeral c_u(m()), c_v(m());
@ -4311,7 +4311,7 @@ namespace polynomial {
r = mk_const(d_a);
return;
}
if (C_star.get() == 0) {
if (C_star.get() == nullptr) {
C_star = q;
m().set(bound, p);
}
@ -4903,7 +4903,7 @@ namespace polynomial {
*/
template<bool Exact_d, bool Quotient, bool ModD>
void pseudo_division_core(polynomial const * p, polynomial const * q, var x, unsigned & d, polynomial_ref & Q, polynomial_ref & R,
var2degree const * x2d = 0) {
var2degree const * x2d = nullptr) {
SASSERT(is_valid(x));
SASSERT(!ModD || x2d != 0);
TRACE("polynomial", tout << "pseudo_division\np: "; p->display(tout, m_manager);
@ -5138,7 +5138,7 @@ namespace polynomial {
}
monomial const * m_r = R.m(max_R);
numeral const & a_r = R.a(max_R);
monomial * m_r_q = 0;
monomial * m_r_q = nullptr;
VERIFY(div(m_r, m_q, m_r_q));
TRACE("polynomial", tout << "m_r: "; m_r->display(tout); tout << "\nm_q: "; m_q->display(tout); tout << "\n";
if (m_r_q) { tout << "m_r_q: "; m_r_q->display(tout); tout << "\n"; });
@ -5175,7 +5175,7 @@ namespace polynomial {
}
monomial const * m_r = R.m(max_R);
numeral const & a_r = R.a(max_R);
monomial * m_r_q = 0;
monomial * m_r_q = nullptr;
bool q_div_r = div(m_r, m_q, m_r_q);
m_r_q_ref = m_r_q;
TRACE("polynomial", tout << "m_r: "; m_r->display(tout); tout << "\nm_q: "; m_q->display(tout); tout << "\n";
@ -5639,7 +5639,7 @@ namespace polynomial {
pw(h1, d1, hs1);
hs1 = mul(g1, hs1);
G3 = exact_div(Gh3, hs1);
hs1 = 0;
hs1 = nullptr;
}
// prepare for next iteration
@ -6083,7 +6083,7 @@ namespace polynomial {
polynomial_vector::iterator end2 = m_polynomials.end();
for (; it2 != end2; ++it2) {
polynomial * p = *it2;
if (p == 0)
if (p == nullptr)
continue;
p->make_first_maximal();
SASSERT(p->size() <= 1 || !p->lex_sorted());
@ -6404,7 +6404,7 @@ namespace polynomial {
result = const_cast<polynomial*>(r);
return;
}
result = 0;
result = nullptr;
polynomial_ref p1(pm()), q1(pm());
polynomial_ref_buffer ps(pm());
unsigned sz = r->size();

View file

@ -192,7 +192,7 @@ namespace polynomial {
private:
imp * m_imp;
public:
manager(reslimit& lim, numeral_manager & m, monomial_manager * mm = 0);
manager(reslimit& lim, numeral_manager & m, monomial_manager * mm = nullptr);
manager(reslimit& lim, numeral_manager & m, small_object_allocator * a);
~manager();
@ -227,7 +227,7 @@ namespace polynomial {
friend class manager;
del_eh * m_next;
public:
del_eh():m_next(0) {}
del_eh():m_next(nullptr) {}
virtual void operator()(polynomial * p) = 0;
};

View file

@ -47,7 +47,7 @@ namespace polynomial {
m_x(x),
m_hash(h),
m_result_sz(0),
m_result(0) {
m_result(nullptr) {
}
struct hash_proc { unsigned operator()(psc_chain_entry const * entry) const { return entry->m_hash; } };
@ -69,7 +69,7 @@ namespace polynomial {
m_p(p),
m_hash(h),
m_result_sz(0),
m_result(0) {
m_result(nullptr) {
}
struct hash_proc { unsigned operator()(factor_entry const * entry) const { return entry->m_hash; } };

View file

@ -63,8 +63,8 @@ namespace rpolynomial {
m_wrapper(w),
m_manager(m),
m_allocator(a),
m_own_allocator(a == 0) {
if (a == 0)
m_own_allocator(a == nullptr) {
if (a == nullptr)
m_allocator = alloc(small_object_allocator, "rpolynomial");
}
@ -107,7 +107,7 @@ namespace rpolynomial {
unsigned sz = p->size();
for (unsigned i = 0; i < sz; i++) {
poly_or_num * pn = p->arg(i);
if (pn == 0)
if (pn == nullptr)
continue;
if (is_num(pn)) {
del_numeral(to_num_ptr(pn));
@ -141,11 +141,11 @@ namespace rpolynomial {
static bool is_const(polynomial const * p) {
SASSERT(p == 0 || (p->max_var() == null_var) == (p->size() == 1 && p->arg(0) != 0 && is_num(p->arg(0))));
return p == 0 || p->max_var() == null_var;
return p == nullptr || p->max_var() == null_var;
}
bool is_zero(polynomial const * p) {
return p == 0;
return p == nullptr;
}
static bool is_univariate(polynomial const * p) {
@ -154,7 +154,7 @@ namespace rpolynomial {
unsigned sz = p->size();
for (unsigned i = 0; i < sz; i++) {
poly_or_num * pn = p->arg(i);
if (pn == 0)
if (pn == nullptr)
continue;
if (is_poly(pn))
return false;
@ -169,7 +169,7 @@ namespace rpolynomial {
SASSERT(sz > 0);
SASSERT(p->arg(sz - 1) != 0);
for (unsigned i = 0; i < sz - 1; i++) {
if (p->arg(i) != 0)
if (p->arg(i) != nullptr)
return false;
}
SASSERT(is_poly(p->arg(sz - 1)));
@ -179,13 +179,13 @@ namespace rpolynomial {
unsigned degree(polynomial const * p) {
SASSERT(p != 0);
SASSERT(p->size() > 0);
return p == 0 ? 0 : p->size() - 1;
return p == nullptr ? 0 : p->size() - 1;
}
bool eq(polynomial const * p1, polynomial const * p2) {
if (p1 == p2)
return true;
if (p1 == 0 || p2 == 0)
if (p1 == nullptr || p2 == nullptr)
return false;
if (p1->size() != p2->size())
return false;
@ -195,9 +195,9 @@ namespace rpolynomial {
for (unsigned i = 0; i < sz; i++) {
poly_or_num * pn1 = p1->arg(i);
poly_or_num * pn2 = p2->arg(i);
if (pn1 == 0 && pn2 == 0)
if (pn1 == nullptr && pn2 == nullptr)
continue;
if (pn1 == 0 || pn2 == 0)
if (pn1 == nullptr || pn2 == nullptr)
return false;
if (is_num(pn1) && is_num(pn2)) {
if (!m_manager.eq(to_num(pn1), to_num(pn2)))
@ -217,7 +217,7 @@ namespace rpolynomial {
void inc_ref_args(unsigned sz, poly_or_num * const * args) {
for (unsigned i = 0; i < sz; i++) {
poly_or_num * pn = args[i];
if (pn == 0 || is_num(pn))
if (pn == nullptr || is_num(pn))
continue;
inc_ref(to_poly(pn));
}
@ -226,7 +226,7 @@ namespace rpolynomial {
void dec_ref_args(unsigned sz, poly_or_num * const * args) {
for (unsigned i = 0; i < sz; i++) {
poly_or_num * pn = args[i];
if (pn == 0 || is_num(pn))
if (pn == nullptr || is_num(pn))
continue;
dec_ref(to_poly(pn));
}
@ -234,7 +234,7 @@ namespace rpolynomial {
unsigned trim(unsigned sz, poly_or_num * const * args) {
while (sz > 0) {
if (args[sz - 1] != 0)
if (args[sz - 1] != nullptr)
return sz;
sz--;
}
@ -281,8 +281,8 @@ namespace rpolynomial {
polynomial * mk_poly(unsigned sz, poly_or_num * const * args, var max_var) {
poly_or_num * _p = mk_poly_core(sz, args, max_var);
if (_p == 0)
return 0;
if (_p == nullptr)
return nullptr;
else if (is_num(_p))
return allocate_poly(1, &_p, null_var);
else
@ -291,7 +291,7 @@ namespace rpolynomial {
polynomial * mk_const(numeral const & n) {
if (m_manager.is_zero(n))
return 0;
return nullptr;
numeral * a = mk_numeral();
m_manager.set(*a, n);
poly_or_num * _a = to_poly_or_num(a);
@ -322,8 +322,8 @@ namespace rpolynomial {
}
poly_or_num * unpack(polynomial const * p) {
if (p == 0) {
return 0;
if (p == nullptr) {
return nullptr;
}
else if (is_const(p)) {
SASSERT(p->size() == 1);
@ -336,8 +336,8 @@ namespace rpolynomial {
}
polynomial * pack(poly_or_num * p) {
if (p == 0)
return 0;
if (p == nullptr)
return nullptr;
else if (is_num(p))
return mk_poly(1, &p, null_var);
else
@ -345,8 +345,8 @@ namespace rpolynomial {
}
poly_or_num * mul_core(numeral const & c, poly_or_num * p) {
if (m_manager.is_zero(c) || p == 0) {
return 0;
if (m_manager.is_zero(c) || p == nullptr) {
return nullptr;
}
else if (is_num(p)) {
numeral * r = mk_numeral();
@ -379,7 +379,7 @@ namespace rpolynomial {
if (m_manager.is_zero(c)) {
return p;
}
else if (p == 0) {
else if (p == nullptr) {
numeral * r = mk_numeral();
m_manager.set(*r, c);
return to_poly_or_num(r);
@ -388,7 +388,7 @@ namespace rpolynomial {
numeral a;
m_manager.add(c, to_num(p), a);
if (m_manager.is_zero(a))
return 0;
return nullptr;
numeral * new_arg = mk_numeral();
m_manager.swap(*new_arg, a);
return to_poly_or_num(new_arg);
@ -662,7 +662,7 @@ namespace rpolynomial {
while (i > 0) {
--i;
poly_or_num * pn = p->arg(i);
if (pn == 0)
if (pn == nullptr)
continue;
if (first)
first = false;
@ -730,7 +730,7 @@ namespace rpolynomial {
}
bool manager::is_zero(polynomial const * p) {
return p == 0;
return p == nullptr;
}
#if 0

View file

@ -51,7 +51,7 @@ namespace rpolynomial {
private:
imp * m_imp;
public:
manager(numeral_manager & m, small_object_allocator * a = 0);
manager(numeral_manager & m, small_object_allocator * a = nullptr);
~manager();
numeral_manager & m() const;

View file

@ -190,7 +190,7 @@ namespace upolynomial {
// Copy elements from p to buffer.
void core_manager::set(unsigned sz, numeral const * p, numeral_vector & buffer) {
if (p != 0 && buffer.c_ptr() == p) {
if (p != nullptr && buffer.c_ptr() == p) {
SASSERT(buffer.size() == sz);
return;
}

View file

@ -117,7 +117,7 @@ namespace upolynomial {
numeral_vector m_sqf_tmp2;
numeral_vector m_pw_tmp;
static bool is_alias(numeral const * p, numeral_vector & buffer) { return buffer.c_ptr() != 0 && buffer.c_ptr() == p; }
static bool is_alias(numeral const * p, numeral_vector & buffer) { return buffer.c_ptr() != nullptr && buffer.c_ptr() == p; }
void neg_core(unsigned sz1, numeral const * p1, numeral_vector & buffer);
void add_core(unsigned sz1, numeral const * p1, unsigned sz2, numeral const * p2, numeral_vector & buffer);
void sub_core(unsigned sz1, numeral const * p1, unsigned sz2, numeral const * p2, numeral_vector & buffer);

View file

@ -49,7 +49,7 @@ void mpz_matrix_manager::mk(unsigned m, unsigned n, mpz_matrix & A) {
}
void mpz_matrix_manager::del(mpz_matrix & A) {
if (A.a_ij != 0) {
if (A.a_ij != nullptr) {
for (unsigned i = 0; i < A.m; i++)
for (unsigned j = 0; j < A.n; j++)
nm().del(A(i,j));
@ -57,7 +57,7 @@ void mpz_matrix_manager::del(mpz_matrix & A) {
m_allocator.deallocate(sz, A.a_ij);
A.m = 0;
A.n = 0;
A.a_ij = 0;
A.a_ij = nullptr;
}
}
@ -208,7 +208,7 @@ bool mpz_matrix_manager::eliminate(mpz_matrix & A, mpz * b, unsigned k1, unsigne
// a_ik <- 0
nm().set(A(i, k2), 0);
// normalize row i
if (!normalize_row(A.row(i), A.n, b ? &(b[i]) : 0, int_solver))
if (!normalize_row(A.row(i), A.n, b ? &(b[i]) : nullptr, int_solver))
return false;
}
SASSERT(nm().is_zero(A(i, k2)));
@ -386,7 +386,7 @@ unsigned mpz_matrix_manager::linear_independent_rows(mpz_matrix const & _A, unsi
r_sz++;
if (r_sz >= A.n())
break;
eliminate(A, 0, k1, k2, false);
eliminate(A, nullptr, k1, k2, false);
k2++;
}
std::sort(r, r + r_sz);

View file

@ -45,7 +45,7 @@ class mpz_matrix {
unsigned n;
mpz * a_ij;
public:
mpz_matrix():m(0), n(0), a_ij(0) {}
mpz_matrix():m(0), n(0), a_ij(nullptr) {}
mpz const & operator()(unsigned i, unsigned j) const {
SASSERT(i < m);
SASSERT(j < n);

View file

@ -162,7 +162,7 @@ namespace realclosure {
// To cope with this issue, we cache the value m_interval in m_old_interval whenever the width of m_interval is below
// a give threshold. Then, after finishing OP, we restore the old_interval.
mpbqi * m_old_interval;
value(bool rat):m_ref_count(0), m_rational(rat), m_old_interval(0) {}
value(bool rat):m_ref_count(0), m_rational(rat), m_old_interval(nullptr) {}
bool is_rational() const { return m_rational; }
mpbqi const & interval() const { return m_interval; }
mpbqi & interval() { return m_interval; }
@ -220,7 +220,7 @@ namespace realclosure {
mpbqi m_interval;
mpbqi * m_old_interval;
extension(kind k, unsigned idx):m_ref_count(0), m_kind(k), m_idx(idx), m_old_interval(0) {}
extension(kind k, unsigned idx):m_ref_count(0), m_kind(k), m_idx(idx), m_old_interval(nullptr) {}
unsigned idx() const { return m_idx; }
kind knd() const { return static_cast<kind>(m_kind); }
@ -256,7 +256,7 @@ namespace realclosure {
unsigned m_mark:1; // auxiliary mark used during deletion
int m_sign; // Sign of the polynomial associated with m_q_idx
sign_condition * m_prev; // Antecedent
sign_condition():m_q_idx(0), m_mark(false), m_sign(0), m_prev(0) {}
sign_condition():m_q_idx(0), m_mark(false), m_sign(0), m_prev(nullptr) {}
sign_condition(unsigned qidx, int sign, sign_condition * prev):m_q_idx(qidx), m_mark(false), m_sign(sign), m_prev(prev) {}
sign_condition * prev() const { return m_prev; }
@ -287,13 +287,13 @@ namespace realclosure {
unsigned m_sc_idx; //!< != UINT_MAX if m_sign_det != 0, in this case m_sc_idx < m_sign_det->m_sign_conditions.size()
bool m_depends_on_infinitesimals; //!< True if the polynomial p depends on infinitesimal extensions.
algebraic(unsigned idx):extension(ALGEBRAIC, idx), m_sign_det(0), m_sc_idx(0), m_depends_on_infinitesimals(false) {}
algebraic(unsigned idx):extension(ALGEBRAIC, idx), m_sign_det(nullptr), m_sc_idx(0), m_depends_on_infinitesimals(false) {}
polynomial const & p() const { return m_p; }
bool depends_on_infinitesimals() const { return m_depends_on_infinitesimals; }
sign_det * sdt() const { return m_sign_det; }
unsigned sc_idx() const { return m_sc_idx; }
unsigned num_roots_inside_interval() const { return m_sign_det == 0 ? 1 : m_sign_det->num_roots(); }
unsigned num_roots_inside_interval() const { return m_sign_det == nullptr ? 1 : m_sign_det->num_roots(); }
mpbqi & iso_interval() { return m_iso_interval; }
};
@ -497,8 +497,8 @@ namespace realclosure {
imp(reslimit& lim, unsynch_mpq_manager & qm, params_ref const & p, small_object_allocator * a):
m_limit(lim),
m_allocator(a == 0 ? alloc(small_object_allocator, "realclosure") : a),
m_own_allocator(a == 0),
m_allocator(a == nullptr ? alloc(small_object_allocator, "realclosure") : a),
m_own_allocator(a == nullptr),
m_qm(qm),
m_mm(m_qm, *m_allocator),
m_bqm(m_qm),
@ -509,8 +509,8 @@ namespace realclosure {
mpq one(1);
m_one = mk_rational(one);
inc_ref(m_one);
m_pi = 0;
m_e = 0;
m_pi = nullptr;
m_e = nullptr;
m_exec_depth = 0;
@ -657,7 +657,7 @@ namespace realclosure {
*/
template<typename T>
void save_interval(T * v, ptr_vector<T> & to_restore) {
if (v->m_old_interval != 0)
if (v->m_old_interval != nullptr)
return; // interval was already saved.
to_restore.push_back(v);
inc_ref(v);
@ -698,7 +698,7 @@ namespace realclosure {
set_interval(v->m_interval, *(v->m_old_interval));
bqim().del(*(v->m_old_interval));
allocator().deallocate(sizeof(mpbqi), v->m_old_interval);
v->m_old_interval = 0;
v->m_old_interval = nullptr;
dec_ref(v);
}
to_restore.reset();
@ -811,12 +811,12 @@ namespace realclosure {
}
void inc_ref_sign_det(sign_det * sd) {
if (sd != 0)
if (sd != nullptr)
sd->m_ref_count++;
}
void dec_ref_sign_det(sign_det * sd) {
if (sd != 0) {
if (sd != nullptr) {
sd->m_ref_count--;
if (sd->m_ref_count == 0) {
del_sign_det(sd);
@ -887,7 +887,7 @@ namespace realclosure {
void del(numeral & a) {
dec_ref(a.m_value);
a.m_value = 0;
a.m_value = nullptr;
}
void del(numeral_vector & v) {
@ -910,7 +910,7 @@ namespace realclosure {
\brief Return true if v is zero.
*/
static bool is_zero(value * v) {
return v == 0;
return v == nullptr;
}
/**
@ -1260,14 +1260,14 @@ namespace realclosure {
}
rational_function_value * mk_rational_function_value_core(algebraic * ext, unsigned num_sz, value * const * num) {
return mk_rational_function_value_core(ext, num_sz, num, 0, 0);
return mk_rational_function_value_core(ext, num_sz, num, 0, nullptr);
}
/**
\brief Create a value using the given extension.
*/
rational_function_value * mk_rational_function_value(extension * ext) {
value * num[2] = { 0, one() };
value * num[2] = { nullptr, one() };
value * den[1] = { one() };
rational_function_value * v = mk_rational_function_value_core(ext, 2, num, 1, den);
set_interval(v->interval(), ext->interval());
@ -1838,7 +1838,7 @@ namespace realclosure {
interval contains only one root of p.
*/
void add_root(unsigned p_sz, value * const * p, mpbqi const & interval, mpbqi const & iso_interval, numeral_vector & roots) {
add_root(p_sz, p, interval, iso_interval, 0, UINT_MAX, roots);
add_root(p_sz, p, interval, iso_interval, nullptr, UINT_MAX, roots);
}
/**
@ -1965,7 +1965,7 @@ namespace realclosure {
// Sequence of sign conditions associated with the columns of M_s
// These are sign conditions on the polynomials in qs.
scoped_sign_conditions scs(*this);
scs.push_back(0);
scs.push_back(nullptr);
// Starting configuration
//
@ -2322,7 +2322,7 @@ namespace realclosure {
if (num_neg_roots > 0) {
if (num_neg_roots == 1) {
add_root(n, p, neg_interval, minf_zero, 0, UINT_MAX, roots);
add_root(n, p, neg_interval, minf_zero, nullptr, UINT_MAX, roots);
}
else {
if (has_neg_lower) {
@ -2336,7 +2336,7 @@ namespace realclosure {
if (num_pos_roots > 0) {
if (num_pos_roots == 1) {
add_root(n, p, pos_interval, zero_inf, 0, UINT_MAX, roots);
add_root(n, p, pos_interval, zero_inf, nullptr, UINT_MAX, roots);
}
else {
if (has_pos_upper) {
@ -2668,7 +2668,7 @@ namespace realclosure {
\brief Remove 0s
*/
void adjust_size(value_ref_buffer & r) {
while (!r.empty() && r.back() == 0) {
while (!r.empty() && r.back() == nullptr) {
r.pop_back();
}
}
@ -2753,7 +2753,7 @@ namespace realclosure {
void mul(value * a, unsigned sz, value * const * p, value_ref_buffer & r) {
SASSERT(p != r.c_ptr());
r.reset();
if (a == 0)
if (a == nullptr)
return;
value_ref a_i(*this);
for (unsigned i = 0; i < sz; i++) {
@ -2778,7 +2778,7 @@ namespace realclosure {
value_ref tmp(*this);
for (unsigned i = 0; i < sz1; i++) {
checkpoint();
if (p1[i] == 0)
if (p1[i] == nullptr)
continue;
for (unsigned j = 0; j < sz2; j++) {
// r[i+j] <- r[i+j] + p1[i]*p2[j]
@ -3060,7 +3060,7 @@ namespace realclosure {
bool struct_eq(value * a, value * b) const {
if (a == b)
return true;
else if (a == 0 || b == 0)
else if (a == nullptr || b == nullptr)
return false;
else if (is_nz_rational(a) && is_nz_rational(b))
return qm().eq(to_mpq(a), to_mpq(b));
@ -3112,7 +3112,7 @@ namespace realclosure {
- a is a rational_function_value of the form p_a(x)/1 where the coefficients of p_a also have clean denominators.
*/
bool has_clean_denominators(value * a) const {
if (a == 0)
if (a == nullptr)
return true;
else if (is_nz_rational(a))
return qm().is_int(to_mpq(a));
@ -3150,7 +3150,7 @@ namespace realclosure {
INC_DEPTH();
TRACE("rcf_clean", tout << "clean_denominators_core [" << m_exec_depth << "]\na: "; display(tout, a, false); tout << "\n";);
p.reset(); q.reset();
if (a == 0) {
if (a == nullptr) {
p = a;
q = one();
}
@ -3205,8 +3205,8 @@ namespace realclosure {
dens.push_back(a_d);
}
else {
nums.push_back(0);
dens.push_back(0);
nums.push_back(nullptr);
dens.push_back(nullptr);
}
}
if (all_one) {
@ -3258,7 +3258,7 @@ namespace realclosure {
value_ref m(*this);
for (unsigned i = 0; i < p_sz; i++) {
if (!nums[i]) {
norm_p.push_back(0);
norm_p.push_back(nullptr);
}
else {
SASSERT(dens[i]);
@ -3348,7 +3348,7 @@ namespace realclosure {
If g != 0, then it will compute the gcd of g and the coefficients in a.
*/
bool gcd_int_coeffs(value * a, mpz & g) {
if (a == 0) {
if (a == nullptr) {
return false;
}
else if (is_nz_rational(a)) {
@ -3410,7 +3410,7 @@ namespace realclosure {
for (unsigned i = 0; i < p.size(); i++) {
if (p[i]) {
a = p[i];
p.set(i, 0);
p.set(i, nullptr);
exact_div_z(a, g);
p.set(i, a);
}
@ -3448,7 +3448,7 @@ namespace realclosure {
new_ais.push_back(ai);
}
else {
new_ais.push_back(0);
new_ais.push_back(nullptr);
}
}
rational_function_value * r = mk_rational_function_value_core(rf->ext(), new_ais.size(), new_ais.c_ptr(), 1, &m_one);
@ -3759,7 +3759,7 @@ namespace realclosure {
while (i > 0) {
checkpoint();
--i;
if (p[i] != 0)
if (p[i] != nullptr)
bqim().add(r, interval(p[i]), r);
if (i > 0)
bqim().mul(r, bi, r);
@ -3772,7 +3772,7 @@ namespace realclosure {
*/
bool has_refineable_approx_coeffs(unsigned n, value * const * p) {
for (unsigned i = 0; i < n; i++) {
if (p[i] != 0) {
if (p[i] != nullptr) {
mpbqi & a_i = interval(p[i]);
if (a_i.lower_is_inf() || a_i.upper_is_inf())
return false;
@ -3786,7 +3786,7 @@ namespace realclosure {
*/
void mk_polynomial_value(unsigned n, value * const * p, value * b, value_ref & r) {
SASSERT(n > 0);
if (n == 1 || b == 0) {
if (n == 1 || b == nullptr) {
r = p[0];
}
else {
@ -3798,7 +3798,7 @@ namespace realclosure {
unsigned i = n - 1;
while (i > 0) {
--i;
if (p[i] != 0)
if (p[i] != nullptr)
add(r, p[i], r); // r <- r + a_i
if (i > 0)
mul(r, b, r); // r <- r * b
@ -3856,7 +3856,7 @@ namespace realclosure {
int find_biggest_interval_magnitude(unsigned n, value * const * p) {
int r = INT_MIN;
for (unsigned i = 0; i < n; i++) {
if (p[i] != 0) {
if (p[i] != nullptr) {
mpbqi & a_i = interval(p[i]);
SASSERT(!a_i.lower_is_inf() && !a_i.upper_is_inf());
int m = magnitude(a_i);
@ -4089,7 +4089,7 @@ namespace realclosure {
*/
bool refine_coeffs_interval(unsigned n, value * const * p, unsigned prec) {
for (unsigned i = 0; i < n; i++) {
if (p[i] != 0 && !refine_interval(p[i], prec))
if (p[i] != nullptr && !refine_interval(p[i], prec))
return false;
}
return true;
@ -4243,7 +4243,7 @@ namespace realclosure {
bool refine_algebraic_interval(algebraic * a, unsigned prec) {
save_interval_if_too_small(a, prec);
if (a->sdt() != 0) {
if (a->sdt() != nullptr) {
// We don't bisect the interval, since it contains more than one root.
// To bisect this kind of interval we would have to use Tarski queries.
return false;
@ -4941,7 +4941,7 @@ namespace realclosure {
}
else {
// The new value is 0
r = 0;
r = nullptr;
}
}
}
@ -4979,7 +4979,7 @@ namespace realclosure {
// num <- a + b * ad
add(an.size(), an.c_ptr(), b_ad.size(), b_ad.c_ptr(), num);
if (num.empty())
r = 0;
r = nullptr;
else {
value_ref_buffer new_num(*this);
value_ref_buffer new_den(*this);
@ -5003,7 +5003,7 @@ namespace realclosure {
value_ref_buffer new_num(*this);
add(an.size(), an.c_ptr(), bn.size(), bn.c_ptr(), new_num);
if (new_num.empty())
r = 0;
r = nullptr;
else {
// We don't need to invoke normalize_algebraic even if x (== a->ext()) is algebraic.
// Reason: by construction the polynomials a->num() and b->num() are "normalized".
@ -5035,7 +5035,7 @@ namespace realclosure {
value_ref_buffer num(*this);
add(an_bd.size(), an_bd.c_ptr(), bn_ad.size(), bn_ad.c_ptr(), num);
if (num.empty()) {
r = 0;
r = nullptr;
}
else {
value_ref_buffer den(*this);
@ -5050,17 +5050,17 @@ namespace realclosure {
}
void add(value * a, value * b, value_ref & r) {
if (a == 0) {
if (a == nullptr) {
r = b;
}
else if (b == 0) {
else if (b == nullptr) {
r = a;
}
else if (is_nz_rational(a) && is_nz_rational(b)) {
scoped_mpq v(qm());
qm().add(to_mpq(a), to_mpq(b), v);
if (qm().is_zero(v))
r = 0;
r = nullptr;
else
r = mk_rational_and_swap(v);
}
@ -5079,17 +5079,17 @@ namespace realclosure {
}
void sub(value * a, value * b, value_ref & r) {
if (a == 0) {
if (a == nullptr) {
neg(b, r);
}
else if (b == 0) {
else if (b == nullptr) {
r = a;
}
else if (is_nz_rational(a) && is_nz_rational(b)) {
scoped_mpq v(qm());
qm().sub(to_mpq(a), to_mpq(b), v);
if (qm().is_zero(v))
r = 0;
r = nullptr;
else
r = mk_rational_and_swap(v);
}
@ -5118,8 +5118,8 @@ namespace realclosure {
}
void neg(value * a, value_ref & r) {
if (a == 0) {
r = 0;
if (a == nullptr) {
r = nullptr;
}
else if (is_nz_rational(a)) {
scoped_mpq v(qm());
@ -5155,7 +5155,7 @@ namespace realclosure {
}
else {
// The new value is 0
r = 0;
r = nullptr;
}
}
}
@ -5252,8 +5252,8 @@ namespace realclosure {
}
void mul(value * a, value * b, value_ref & r) {
if (a == 0 || b == 0) {
r = 0;
if (a == nullptr || b == nullptr) {
r = nullptr;
}
else if (is_rational_one(a)) {
r = b;
@ -5287,10 +5287,10 @@ namespace realclosure {
}
void div(value * a, value * b, value_ref & r) {
if (a == 0) {
r = 0;
if (a == nullptr) {
r = nullptr;
}
else if (b == 0) {
else if (b == nullptr) {
throw exception("division by zero");
}
else if (is_rational_one(b)) {
@ -5461,7 +5461,7 @@ namespace realclosure {
// r == 1/inv(new_a)
inv(new_a, r);
}
else if (alpha->sdt() == 0) {
else if (alpha->sdt() == nullptr) {
// Another easy case: we just have to replace
// alpha->p() with new_p.
// The m_iso_interval for p() is also an isolating interval for new_p,
@ -5552,7 +5552,7 @@ namespace realclosure {
}
void inv(value * a, value_ref & r) {
if (a == 0) {
if (a == nullptr) {
throw exception("division by zero");
}
if (is_nz_rational(a)) {
@ -5644,7 +5644,7 @@ namespace realclosure {
neg(a.m_value, neg_a);
p.push_back(neg_a);
for (unsigned i = 0; i < k - 1; i++)
p.push_back(0);
p.push_back(nullptr);
p.push_back(one());
numeral_vector roots;
@ -5687,9 +5687,9 @@ namespace realclosure {
// ---------------------------------
int compare(value * a, value * b) {
if (a == 0)
if (a == nullptr)
return -sign(b);
else if (b == 0)
else if (b == nullptr)
return sign(a);
else if (is_nz_rational(a) && is_nz_rational(b)) {
if (qm().eq(to_mpq(a), to_mpq(b)))
@ -5744,7 +5744,7 @@ namespace realclosure {
}
void mark(value * v) {
if (v == 0 || is_nz_rational(v))
if (v == nullptr || is_nz_rational(v))
return;
rational_function_value * rf = to_rational_function(v);
mark(rf->ext());
@ -5779,7 +5779,7 @@ namespace realclosure {
bool first = true;
while (i > 0) {
--i;
if (p[i] == 0)
if (p[i] == nullptr)
continue;
if (first)
first = false;
@ -5893,7 +5893,7 @@ namespace realclosure {
out << ", ";
display_interval(out, a->iso_interval(), pp);
out << ", ";
if (a->sdt() != 0)
if (a->sdt() != nullptr)
display_sign_conditions(out, a->sdt()->sc(a->sc_idx()), a->sdt()->qs(), compact, pp);
else
out << "{}";
@ -5931,7 +5931,7 @@ namespace realclosure {
}
void display(std::ostream & out, value * v, bool compact, bool pp=false) const {
if (v == 0)
if (v == nullptr)
out << "0";
else if (is_nz_rational(v))
qm().display(out, to_mpq(v));

View file

@ -48,7 +48,7 @@ namespace realclosure {
friend class save_interval_ctx;
imp * m_imp;
public:
manager(reslimit& lim, unsynch_mpq_manager & m, params_ref const & p = params_ref(), small_object_allocator * a = 0);
manager(reslimit& lim, unsynch_mpq_manager & m, params_ref const & p = params_ref(), small_object_allocator * a = nullptr);
~manager();
typedef num numeral;
typedef svector<numeral> numeral_vector;
@ -271,7 +271,7 @@ namespace realclosure {
friend struct manager::imp;
value * m_value;
public:
num():m_value(0) {}
num():m_value(nullptr) {}
// Low level functions for implementing the C API
void * c_ptr() { return m_value; }

View file

@ -745,7 +745,7 @@ namespace simplex {
numeral const& base_coeff = vs.m_base_coeff;
SASSERT(!m.is_zero(coeff));
bool base_to_lower = (m.is_pos(coeff) != m.is_pos(base_coeff)) == to_lower;
eps_numeral const* bound = 0;
eps_numeral const* bound = nullptr;
if (!base_to_lower && vs.m_upper_valid) {
bound = &vs.m_upper;
}

View file

@ -233,7 +233,7 @@ namespace simplex {
return it;
}
}
return 0;
return nullptr;
}
template<typename Ext>

View file

@ -111,11 +111,11 @@ public:
virtual void display_bounds(std::ostream & out) const = 0;
};
context * mk_mpq_context(reslimit& lim, unsynch_mpq_manager & m, params_ref const & p = params_ref(), small_object_allocator * a = 0);
context * mk_mpf_context(reslimit& lim, f2n<mpf_manager> & m, params_ref const & p = params_ref(), small_object_allocator * a = 0);
context * mk_hwf_context(reslimit& lim, f2n<hwf_manager> & m, unsynch_mpq_manager & qm, params_ref const & p = params_ref(), small_object_allocator * a = 0);
context * mk_mpff_context(reslimit& lim, mpff_manager & m, unsynch_mpq_manager & qm, params_ref const & p = params_ref(), small_object_allocator * a = 0);
context * mk_mpfx_context(reslimit& lim, mpfx_manager & m, unsynch_mpq_manager & qm, params_ref const & p = params_ref(), small_object_allocator * a = 0);
context * mk_mpq_context(reslimit& lim, unsynch_mpq_manager & m, params_ref const & p = params_ref(), small_object_allocator * a = nullptr);
context * mk_mpf_context(reslimit& lim, f2n<mpf_manager> & m, params_ref const & p = params_ref(), small_object_allocator * a = nullptr);
context * mk_hwf_context(reslimit& lim, f2n<hwf_manager> & m, unsynch_mpq_manager & qm, params_ref const & p = params_ref(), small_object_allocator * a = nullptr);
context * mk_mpff_context(reslimit& lim, mpff_manager & m, unsynch_mpq_manager & qm, params_ref const & p = params_ref(), small_object_allocator * a = nullptr);
context * mk_mpfx_context(reslimit& lim, mpfx_manager & m, unsynch_mpq_manager & qm, params_ref const & p = params_ref(), small_object_allocator * a = nullptr);
};

View file

@ -210,7 +210,7 @@ public:
bool inconsistent() const { return m_conflict != null_var; }
void set_conflict(var x) { SASSERT(!inconsistent()); m_conflict = x; }
bound * trail_stack() const { return m_trail; }
bound * parent_trail_stack() const { return m_parent == 0 ? 0 : m_parent->m_trail; }
bound * parent_trail_stack() const { return m_parent == nullptr ? nullptr : m_parent->m_trail; }
bound * lower(var x) const { return bm().get(m_lowers, x); }
bound * upper(var x) const { return bm().get(m_uppers, x); }
node * parent() const { return m_parent; }
@ -221,7 +221,7 @@ public:
/**
\brief Return true if x is unbounded in this node
*/
bool is_unbounded(var x) const { return lower(x) == 0 && upper(x) == 0; }
bool is_unbounded(var x) const { return lower(x) == nullptr && upper(x) == nullptr; }
void push(bound * b);
void set_first_child(node * n) { m_first_child = n; }
@ -275,32 +275,32 @@ public:
numeral const & lower(interval const & a) const {
if (a.m_constant) {
bound * b = a.m_node->lower(a.m_x);
return b == 0 ? a.m_l_val /* don't care */ : b->value();
return b == nullptr ? a.m_l_val /* don't care */ : b->value();
}
return a.m_l_val;
}
numeral const & upper(interval const & a) const {
if (a.m_constant) {
bound * b = a.m_node->upper(a.m_x);
return b == 0 ? a.m_u_val /* don't care */ : b->value();
return b == nullptr ? a.m_u_val /* don't care */ : b->value();
}
return a.m_u_val;
}
numeral & lower(interval & a) { SASSERT(!a.m_constant); return a.m_l_val; }
numeral & upper(interval & a) { SASSERT(!a.m_constant); return a.m_u_val; }
bool lower_is_inf(interval const & a) const { return a.m_constant ? a.m_node->lower(a.m_x) == 0 : a.m_l_inf; }
bool upper_is_inf(interval const & a) const { return a.m_constant ? a.m_node->upper(a.m_x) == 0 : a.m_u_inf; }
bool lower_is_inf(interval const & a) const { return a.m_constant ? a.m_node->lower(a.m_x) == nullptr : a.m_l_inf; }
bool upper_is_inf(interval const & a) const { return a.m_constant ? a.m_node->upper(a.m_x) == nullptr : a.m_u_inf; }
bool lower_is_open(interval const & a) const {
if (a.m_constant) {
bound * b = a.m_node->lower(a.m_x);
return b == 0 || b->is_open();
return b == nullptr || b->is_open();
}
return a.m_l_open;
}
bool upper_is_open(interval const & a) const {
if (a.m_constant) {
bound * b = a.m_node->upper(a.m_x);
return b == 0 || b->is_open();
return b == nullptr || b->is_open();
}
return a.m_u_open;
}
@ -367,7 +367,7 @@ public:
private:
void * m_data;
public:
watched():m_data(0) {}
watched():m_data(nullptr) {}
explicit watched(var x) { m_data = BOXTAGINT(void*, x, DEFINITION); }
explicit watched(clause * c) { m_data = TAG(void*, c, CLAUSE); }
kind get_kind() const { return static_cast<kind>(GET_TAG(m_data)); }
@ -563,7 +563,7 @@ private:
void add_clause_core(unsigned sz, ineq * const * atoms, bool lemma, bool watched);
void del_clause(clause * cls);
node * mk_node(node * parent = 0);
node * mk_node(node * parent = nullptr);
void del_node(node * n);
void del_nodes();

View file

@ -93,7 +93,7 @@ public:
if (!m_only_non_def || !this->ctx()->is_definition(x)) {
bound * lower = n->lower(x);
bound * upper = n->upper(x);
if (lower == 0 || upper == 0 || !nm.eq(lower->value(), upper->value())) {
if (lower == nullptr || upper == nullptr || !nm.eq(lower->value(), upper->value())) {
return x;
}
}
@ -205,11 +205,11 @@ public:
bound * lower = n->lower(x);
bound * upper = n->upper(x);
_scoped_numeral<numeral_manager> mid(nm);
if (lower == 0 && upper == 0) {
if (lower == nullptr && upper == nullptr) {
nm.set(mid, 0);
// mid == 0
}
else if (lower == 0) {
else if (lower == nullptr) {
_scoped_numeral<numeral_manager> delta(nm);
SASSERT(upper != 0);
nm.set(delta, static_cast<int>(m_delta));
@ -218,7 +218,7 @@ public:
nm.sub(mid, delta, mid);
// mid == upper - delta
}
else if (upper == 0) {
else if (upper == nullptr) {
_scoped_numeral<numeral_manager> delta(nm);
SASSERT(lower != 0);
nm.set(delta, static_cast<int>(m_delta));
@ -294,17 +294,17 @@ context_t<C>::node::node(context_t & s, unsigned id):
m_depth = 0;
unsigned num_vars = s.num_vars();
m_conflict = null_var;
m_trail = 0;
m_parent = 0;
m_first_child = 0;
m_next_sibling = 0;
m_prev = 0;
m_next = 0;
m_trail = nullptr;
m_parent = nullptr;
m_first_child = nullptr;
m_next_sibling = nullptr;
m_prev = nullptr;
m_next = nullptr;
bm().mk(m_lowers);
bm().mk(m_uppers);
for (unsigned i = 0; i < num_vars; i++) {
bm().push_back(m_lowers, 0);
bm().push_back(m_uppers, 0);
bm().push_back(m_lowers, nullptr);
bm().push_back(m_uppers, nullptr);
}
}
@ -318,10 +318,10 @@ context_t<C>::node::node(node * parent, unsigned id):
m_conflict = parent->m_conflict;
m_trail = parent->m_trail;
m_parent = parent;
m_first_child = 0;
m_first_child = nullptr;
m_next_sibling = parent->m_first_child;
m_prev = 0;
m_next = 0;
m_prev = nullptr;
m_next = nullptr;
parent->m_first_child = this;
}
@ -350,7 +350,7 @@ var context_t<C>::splitting_var(node * n) const {
if (n == m_root)
return null_var;
bound * b = n->trail_stack();
while (b != 0) {
while (b != nullptr) {
if (b->jst().is_axiom())
return b->x();
b = b->prev();
@ -416,16 +416,16 @@ template<typename C>
context_t<C>::context_t(reslimit& lim, C const & c, params_ref const & p, small_object_allocator * a):
m_limit(lim),
m_c(c),
m_own_allocator(a == 0),
m_allocator(a == 0 ? alloc(small_object_allocator, "subpaving") : a),
m_own_allocator(a == nullptr),
m_allocator(a == nullptr ? alloc(small_object_allocator, "subpaving") : a),
m_bm(*this, *m_allocator),
m_im(lim, interval_config(m_c.m())),
m_num_buffer(nm()) {
m_arith_failed = false;
m_timestamp = 0;
m_root = 0;
m_leaf_head = 0;
m_leaf_tail = 0;
m_root = nullptr;
m_leaf_head = nullptr;
m_leaf_tail = nullptr;
m_conflict = null_var;
m_qhead = 0;
m_display_proc = &m_default_display_proc;
@ -638,14 +638,14 @@ void context_t<C>::display_bounds(std::ostream & out, node * n) const {
for (unsigned x = 0; x < num; x++) {
bound * l = n->lower(x);
bound * u = n->upper(x);
if (l != 0) {
if (l != nullptr) {
display(out, l);
out << " ";
}
if (u != 0) {
if (u != nullptr) {
display(out, u);
}
if (l != 0 || u != 0)
if (l != nullptr || u != nullptr)
out << "\n";
}
}
@ -878,7 +878,7 @@ template<typename C>
typename context_t<C>::node * context_t<C>::mk_node(node * parent) {
void * mem = allocator().allocate(sizeof(node));
node * r;
if (parent == 0)
if (parent == nullptr)
r = new (mem) node(*this, m_node_id_gen.mk());
else
r = new (mem) node(parent, m_node_id_gen.mk());
@ -910,7 +910,7 @@ void context_t<C>::del_node(node * n) {
node * p = n->parent();
bound * b = n->trail_stack();
bound * b_old;
if (p != 0) {
if (p != nullptr) {
node * c = p->first_child();
if (c == n) {
// n is the first child
@ -928,7 +928,7 @@ void context_t<C>::del_node(node * n) {
b_old = p->trail_stack();
}
else {
b_old = 0;
b_old = nullptr;
}
while (b != b_old) {
bound * old = b;
@ -944,18 +944,18 @@ void context_t<C>::del_node(node * n) {
template<typename C>
void context_t<C>::del_nodes() {
ptr_buffer<node> todo;
if (m_root == 0)
if (m_root == nullptr)
return;
todo.push_back(m_root);
while (!todo.empty()) {
node * n = todo.back();
node * c = n->first_child();
if (c == 0) {
if (c == nullptr) {
del_node(n);
todo.pop_back();
}
else {
while (c != 0) {
while (c != nullptr) {
todo.push_back(c);
c = c->next_sibling();
}
@ -969,7 +969,7 @@ void context_t<C>::push_front(node * n) {
SASSERT(n->next() == 0);
SASSERT(n->prev() == 0);
n->set_next(m_leaf_head);
if (m_leaf_head != 0) {
if (m_leaf_head != nullptr) {
SASSERT(m_leaf_head->prev() == 0);
m_leaf_head->set_prev(n);
}
@ -986,7 +986,7 @@ void context_t<C>::push_back(node * n) {
SASSERT(n->next() == 0);
SASSERT(n->prev() == 0);
n->set_prev(m_leaf_tail);
if (m_leaf_tail != 0) {
if (m_leaf_tail != nullptr) {
SASSERT(m_leaf_tail->next() == 0);
m_leaf_tail->set_next(n);
}
@ -1001,14 +1001,14 @@ template<typename C>
void context_t<C>::reset_leaf_dlist() {
// Remove all nodes from the lead doubly linked list
node * n = m_leaf_head;
while (n != 0) {
while (n != nullptr) {
node * next = n->next();
n->set_next(0);
n->set_prev(0);
n->set_next(nullptr);
n->set_prev(nullptr);
n = next;
}
m_leaf_head = 0;
m_leaf_tail = 0;
m_leaf_head = nullptr;
m_leaf_tail = nullptr;
}
template<typename C>
@ -1016,18 +1016,18 @@ void context_t<C>::rebuild_leaf_dlist(node * n) {
reset_leaf_dlist();
// Reinsert all leaves in the leaf dlist.
ptr_buffer<node, 1024> todo;
if (m_root != 0)
if (m_root != nullptr)
todo.push_back(m_root);
while (!todo.empty()) {
node * n = todo.back();
todo.pop_back();
node * c = n->first_child();
if (c == 0) {
if (c == nullptr) {
if (!n->inconsistent())
push_front(n);
}
else {
while (c != 0) {
while (c != nullptr) {
SASSERT(c->parent() == n);
todo.push_back(c);
c = c->next_sibling();
@ -1043,19 +1043,19 @@ void context_t<C>::remove_from_leaf_dlist(node * n) {
SASSERT(prev == 0 || prev != next);
SASSERT(next == 0 || prev != next);
SASSERT(prev != n); SASSERT(next != n);
if (prev != 0) {
if (prev != nullptr) {
SASSERT(m_leaf_head != n);
prev->set_next(next);
n->set_prev(0);
n->set_prev(nullptr);
}
else if (m_leaf_head == n) {
m_leaf_head = next;
}
if (next != 0) {
if (next != nullptr) {
SASSERT(m_leaf_tail != n);
next->set_prev(prev);
n->set_next(0);
n->set_next(nullptr);
}
else if (m_leaf_tail == n) {
m_leaf_tail = prev;
@ -1067,18 +1067,18 @@ template<typename C>
void context_t<C>::collect_leaves(ptr_vector<node> & leaves) const {
// Copy all leaves to the given vector.
ptr_buffer<node, 1024> todo;
if (m_root != 0)
if (m_root != nullptr)
todo.push_back(m_root);
while (!todo.empty()) {
node * n = todo.back();
todo.pop_back();
node * c = n->first_child();
if (c == 0) {
if (c == nullptr) {
if (!n->inconsistent())
leaves.push_back(n);
}
else {
while (c != 0) {
while (c != nullptr) {
SASSERT(c->parent() == n);
todo.push_back(c);
c = c->next_sibling();
@ -1115,7 +1115,7 @@ void context_t<C>::del_definitions() {
unsigned sz = num_vars();
for (unsigned i = 0; i < sz; i++) {
definition * d = m_defs[i];
if (d == 0)
if (d == nullptr)
continue;
switch (d->get_kind()) {
case constraint::MONOMIAL:
@ -1219,24 +1219,24 @@ bool context_t<C>::relevant_new_bound(var x, numeral const & k, bool lower, bool
return true;
}
// If m_epsilon is zero, then bound is relevant only if it improves existing bound.
if (m_zero_epsilon && curr_lower != 0 && (nm().lt(k, curr_lower->value()) || ((curr_lower->is_open() || !open) && nm().eq(k, curr_lower->value())))) {
if (m_zero_epsilon && curr_lower != nullptr && (nm().lt(k, curr_lower->value()) || ((curr_lower->is_open() || !open) && nm().eq(k, curr_lower->value())))) {
// new lower bound does not improve existing bound
TRACE("subpaving_relevant_bound", tout << "irrelevant because does not improve existing bound.\n";);
return false;
}
if (curr_upper == 0 && nm().lt(m_max_bound, k)) {
if (curr_upper == nullptr && nm().lt(m_max_bound, k)) {
// new lower bound exceeds the :max-bound threshold
TRACE("subpaving_relevant_bound", tout << "irrelevant because exceeds :max-bound threshold.\n";);
return false;
}
if (!m_zero_epsilon && curr_lower != 0) {
if (!m_zero_epsilon && curr_lower != nullptr) {
// check if:
// new-lower > lower + m_epsilon * max(min(upper - lower, |lower|), 1)
numeral & min = m_tmp1;
numeral & abs_lower = m_tmp2;
nm().set(abs_lower, curr_lower->value());
nm().abs(abs_lower);
if (curr_upper != 0) {
if (curr_upper != nullptr) {
nm().sub(curr_upper->value(), curr_lower->value(), min);
if (nm().lt(abs_lower, min))
nm().set(min, abs_lower);
@ -1269,24 +1269,24 @@ bool context_t<C>::relevant_new_bound(var x, numeral const & k, bool lower, bool
return true;
}
// If m_epsilon is zero, then bound is relevant only if it improves existing bound.
if (m_zero_epsilon && curr_upper != 0 && (nm().lt(curr_upper->value(), k) || ((curr_upper->is_open() || !open) && nm().eq(k, curr_upper->value())))) {
if (m_zero_epsilon && curr_upper != nullptr && (nm().lt(curr_upper->value(), k) || ((curr_upper->is_open() || !open) && nm().eq(k, curr_upper->value())))) {
// new upper bound does not improve existing bound
TRACE("subpaving_relevant_bound", tout << "irrelevant because does not improve existing bound.\n";);
return false;
}
if (curr_lower == 0 && nm().lt(k, m_minus_max_bound)) {
if (curr_lower == nullptr && nm().lt(k, m_minus_max_bound)) {
// new upper bound exceeds the -:max-bound threshold
TRACE("subpaving_relevant_bound", tout << "irrelevant because exceeds -:max-bound threshold.\n";);
return false;
}
if (!m_zero_epsilon && curr_upper != 0) {
if (!m_zero_epsilon && curr_upper != nullptr) {
// check if:
// new-upper < upper - m_epsilon * max(min(upper - lower, |upper|), 1)
numeral & min = m_tmp1;
numeral & abs_upper = m_tmp2;
nm().set(abs_upper, curr_upper->value());
nm().abs(abs_upper);
if (curr_lower != 0) {
if (curr_lower != nullptr) {
nm().sub(curr_upper->value(), curr_lower->value(), min);
if (nm().lt(abs_upper, min))
nm().set(min, abs_upper);
@ -1323,14 +1323,14 @@ bool context_t<C>::is_zero(var x, node * n) const {
// Return true if lower(x) == upper(x) == 0 at n
bound * l = n->lower(x);
bound * u = n->upper(x);
return l != 0 && u != 0 && nm().is_zero(l->value()) && nm().is_zero(u->value()) && !l->is_open() && !u->is_open();
return l != nullptr && u != nullptr && nm().is_zero(l->value()) && nm().is_zero(u->value()) && !l->is_open() && !u->is_open();
}
template<typename C>
bool context_t<C>::is_upper_zero(var x, node * n) const {
// Return true if upper(x) is zero at node n
bound * u = n->upper(x);
return u != 0 && nm().is_zero(u->value()) && !u->is_open();
return u != nullptr && nm().is_zero(u->value()) && !u->is_open();
}
template<typename C>
@ -1338,7 +1338,7 @@ bool context_t<C>::conflicting_bounds(var x, node * n) const {
// Return true if upper(x) < lower(x) at node n
bound * l = n->lower(x);
bound * u = n->upper(x);
return l != 0 && u != 0 && (nm().lt(u->value(), l->value()) || ((l->is_open() || u->is_open()) && nm().eq(u->value(), l->value())));
return l != nullptr && u != nullptr && (nm().lt(u->value(), l->value()) || ((l->is_open() || u->is_open()) && nm().eq(u->value(), l->value())));
}
/**
@ -1351,20 +1351,20 @@ lbool context_t<C>::value(ineq * t, node * n) {
var x = t->x();
bound * u = n->upper(x);
bound * l = n->lower(x);
if (u == 0 && l == 0)
if (u == nullptr && l == nullptr)
return l_undef;
else if (t->is_lower()) {
if (u != 0 && (nm().lt(u->value(), t->value()) || ((u->is_open() || t->is_open()) && nm().eq(u->value(), t->value()))))
if (u != nullptr && (nm().lt(u->value(), t->value()) || ((u->is_open() || t->is_open()) && nm().eq(u->value(), t->value()))))
return l_false;
else if (l != 0 && (nm().gt(l->value(), t->value()) || ((l->is_open() || !t->is_open()) && nm().eq(l->value(), t->value()))))
else if (l != nullptr && (nm().gt(l->value(), t->value()) || ((l->is_open() || !t->is_open()) && nm().eq(l->value(), t->value()))))
return l_true;
else
return l_undef;
}
else {
if (l != 0 && (nm().gt(l->value(), t->value()) || ((l->is_open() || t->is_open()) && nm().eq(l->value(), t->value()))))
if (l != nullptr && (nm().gt(l->value(), t->value()) || ((l->is_open() || t->is_open()) && nm().eq(l->value(), t->value()))))
return l_false;
else if (u != 0 && (nm().lt(u->value(), t->value()) || ((u->is_open() || !t->is_open()) && nm().eq(u->value(), t->value()))))
else if (u != nullptr && (nm().lt(u->value(), t->value()) || ((u->is_open() || !t->is_open()) && nm().eq(u->value(), t->value()))))
return l_true;
else
return l_undef;
@ -1804,17 +1804,17 @@ void context_t<C>::init() {
template<typename C>
void context_t<C>::operator()() {
if (m_root == 0)
if (m_root == nullptr)
init();
TRACE("subpaving_stats", statistics st; collect_statistics(st); tout << "statistics:\n"; st.display_smt2(tout););
TRACE("subpaving_main", display_params(tout););
while (m_leaf_head != 0) {
while (m_leaf_head != nullptr) {
checkpoint();
SASSERT(m_queue.empty());
if (m_num_nodes > m_max_nodes)
break;
node * n = (*m_node_selector)(m_leaf_head, m_leaf_tail);
if (n == 0)
if (n == nullptr)
break;
TRACE("subpaving_main", tout << "selected node: #" << n->id() << ", depth: " << n->depth() << "\n";);
remove_from_leaf_dlist(n);
@ -1892,7 +1892,7 @@ void context_t<C>::collect_statistics(statistics & st) const {
template<typename C>
bool context_t<C>::is_bound_of(bound * b, node * n) const {
bound * c = n->trail_stack();
while (c != 0) {
while (c != nullptr) {
if (c == b)
return true;
if (c->timestamp() <= b->timestamp())
@ -1905,7 +1905,7 @@ bool context_t<C>::is_bound_of(bound * b, node * n) const {
template<typename C>
bool context_t<C>::check_leaf_dlist() const {
node * n = m_leaf_head;
while (n != 0) {
while (n != nullptr) {
node * next = n->next();
SASSERT(next != 0 || m_leaf_tail == n);
SASSERT(next == 0 || next->prev() == n);
@ -1917,13 +1917,13 @@ bool context_t<C>::check_leaf_dlist() const {
template<typename C>
bool context_t<C>::check_tree() const {
ptr_buffer<node> todo;
if (m_root != 0)
if (m_root != nullptr)
todo.push_back(m_root);
while (!todo.empty()) {
node * n = todo.back();
todo.pop_back();
node * c = n->first_child();
while (c != 0) {
while (c != nullptr) {
SASSERT(c->parent() == n);
todo.push_back(c);
c = c->next_sibling();

View file

@ -30,7 +30,7 @@ struct expr2subpaving::imp {
struct frame {
app * m_curr;
unsigned m_idx;
frame():m_curr(0), m_idx(0) {}
frame():m_curr(nullptr), m_idx(0) {}
frame(app * t):m_curr(t), m_idx(0) {}
};
@ -62,7 +62,7 @@ struct expr2subpaving::imp {
m_cached_numerators(m_qm),
m_cached_denominators(m_qm) {
if (e2v == 0) {
if (e2v == nullptr) {
m_expr2var = alloc(expr2var, m);
m_expr2var_owner = true;
}
@ -107,7 +107,7 @@ struct expr2subpaving::imp {
x = s().mk_var(is_int);
m_expr2var->insert(t, x);
if (x >= m_var2expr.size())
m_var2expr.resize(x+1, 0);
m_var2expr.resize(x+1, nullptr);
m_var2expr.set(x, t);
}
return x;

View file

@ -29,7 +29,7 @@ class expr2subpaving {
struct imp;
imp * m_imp;
public:
expr2subpaving(ast_manager & m, subpaving::context & s, expr2var * e2v = 0);
expr2subpaving(ast_manager & m, subpaving::context & s, expr2var * e2v = nullptr);
~expr2subpaving();
ast_manager & m() const;

View file

@ -41,8 +41,8 @@ class subpaving_tactic : public tactic {
ast_manager & m() const { return m_inv.get_manager(); }
void operator()(std::ostream & out, subpaving::var x) const override {
expr * t = m_inv.get(x, 0);
if (t != 0)
expr * t = m_inv.get(x, nullptr);
if (t != nullptr)
out << mk_ismt2_pp(t, m());
else
out << "k!" << x;
@ -160,7 +160,7 @@ class subpaving_tactic : public tactic {
}
void process_clause(expr * c) {
expr * const * args = 0;
expr * const * args = nullptr;
unsigned sz;
if (m().is_or(c)) {
args = to_app(c)->get_args();
@ -251,9 +251,9 @@ public:
m_imp->collect_statistics(m_stats);
result.reset();
result.push_back(in.get());
mc = 0;
pc = 0;
core = 0;
mc = nullptr;
pc = nullptr;
core = nullptr;
}
catch (z3_exception & ex) {
// convert all Z3 exceptions into tactic exceptions