mirror of
https://github.com/Z3Prover/z3
synced 2026-02-23 16:57:51 +00:00
Standardize for-loop increments to prefix form (++i) (#8199)
* Initial plan * Convert postfix to prefix increment in for loops Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com> * Fix member variable increment conversion bug Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com> * Update API generator to produce prefix increments Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>
This commit is contained in:
parent
851b8ea31c
commit
317dd92105
475 changed files with 3237 additions and 3237 deletions
|
|
@ -689,7 +689,7 @@ namespace realclosure {
|
|||
template<typename T>
|
||||
void restore_saved_intervals(ptr_vector<T> & to_restore) {
|
||||
unsigned sz = to_restore.size();
|
||||
for (unsigned i = 0; i < sz; i++) {
|
||||
for (unsigned i = 0; i < sz; ++i) {
|
||||
T * v = to_restore[i];
|
||||
set_interval(v->m_interval, *(v->m_old_interval));
|
||||
bqim().del(*(v->m_old_interval));
|
||||
|
|
@ -772,7 +772,7 @@ namespace realclosure {
|
|||
}
|
||||
|
||||
void finalize(array<polynomial> & ps) {
|
||||
for (unsigned i = 0; i < ps.size(); i++)
|
||||
for (unsigned i = 0; i < ps.size(); ++i)
|
||||
reset_p(ps[i]);
|
||||
ps.finalize(allocator());
|
||||
}
|
||||
|
|
@ -783,7 +783,7 @@ namespace realclosure {
|
|||
|
||||
void del_sign_conditions(unsigned sz, sign_condition * const * to_delete) {
|
||||
ptr_buffer<sign_condition> all_to_delete;
|
||||
for (unsigned i = 0; i < sz; i++) {
|
||||
for (unsigned i = 0; i < sz; ++i) {
|
||||
sign_condition * sc = to_delete[i];
|
||||
while (sc && sc->m_mark == false) {
|
||||
sc->m_mark = true;
|
||||
|
|
@ -791,7 +791,7 @@ namespace realclosure {
|
|||
sc = sc->m_prev;
|
||||
}
|
||||
}
|
||||
for (unsigned i = 0; i < all_to_delete.size(); i++) {
|
||||
for (unsigned i = 0; i < all_to_delete.size(); ++i) {
|
||||
del_sign_condition(all_to_delete[i]);
|
||||
}
|
||||
}
|
||||
|
|
@ -863,7 +863,7 @@ namespace realclosure {
|
|||
}
|
||||
|
||||
void inc_ref(unsigned sz, value * const * p) {
|
||||
for (unsigned i = 0; i < sz; i++)
|
||||
for (unsigned i = 0; i < sz; ++i)
|
||||
inc_ref(p[i]);
|
||||
}
|
||||
|
||||
|
|
@ -877,7 +877,7 @@ namespace realclosure {
|
|||
}
|
||||
|
||||
void dec_ref(unsigned sz, value * const * p) {
|
||||
for (unsigned i = 0; i < sz; i++)
|
||||
for (unsigned i = 0; i < sz; ++i)
|
||||
dec_ref(p[i]);
|
||||
}
|
||||
|
||||
|
|
@ -887,7 +887,7 @@ namespace realclosure {
|
|||
}
|
||||
|
||||
void del(numeral_vector & v) {
|
||||
for (unsigned i = 0; i < v.size(); i++)
|
||||
for (unsigned i = 0; i < v.size(); ++i)
|
||||
del(v[i]);
|
||||
}
|
||||
|
||||
|
|
@ -1104,7 +1104,7 @@ namespace realclosure {
|
|||
}
|
||||
|
||||
bool depends_on_infinitesimals(unsigned sz, value * const * p) const {
|
||||
for (unsigned i = 0; i < sz; i++)
|
||||
for (unsigned i = 0; i < sz; ++i)
|
||||
if (depends_on_infinitesimals(p[i]))
|
||||
return true;
|
||||
return false;
|
||||
|
|
@ -1466,7 +1466,7 @@ namespace realclosure {
|
|||
if (!abs_lower_magnitude(interval(p[n-1]), lc_mag))
|
||||
return false;
|
||||
N = -static_cast<int>(m_ini_precision);
|
||||
for (unsigned k = 2; k <= n; k++) {
|
||||
for (unsigned k = 2; k <= n; ++k) {
|
||||
value * a = p[n - k];
|
||||
if (!is_zero(a) && sign(a) != lc_sign) {
|
||||
int a_mag;
|
||||
|
|
@ -1512,7 +1512,7 @@ namespace realclosure {
|
|||
if (!abs_lower_magnitude(aux, lc_mag))
|
||||
return false;
|
||||
N = -static_cast<int>(m_ini_precision);
|
||||
for (unsigned k = 2; k <= n; k++) {
|
||||
for (unsigned k = 2; k <= n; ++k) {
|
||||
value * a = as[n - k];
|
||||
if (!is_zero(a)) {
|
||||
neg_root_adjust(interval(as[n-k]), n-k, aux);
|
||||
|
|
@ -1590,7 +1590,7 @@ namespace realclosure {
|
|||
derivative(n, p, p_prime);
|
||||
ds.push(p_prime.size(), p_prime.data());
|
||||
SASSERT(n >= 3);
|
||||
for (unsigned i = 0; i < n - 2; i++) {
|
||||
for (unsigned i = 0; i < n - 2; ++i) {
|
||||
SASSERT(ds.size() > 0);
|
||||
unsigned prev = ds.size() - 1;
|
||||
n = ds.size(prev);
|
||||
|
|
@ -1710,7 +1710,7 @@ namespace realclosure {
|
|||
) {
|
||||
SASSERT(taqrs.size() == prs.size());
|
||||
new_taqrs.reset(); new_prs.reset();
|
||||
for (unsigned i = 0; i < taqrs.size(); i++) {
|
||||
for (unsigned i = 0; i < taqrs.size(); ++i) {
|
||||
// Add prs * 1
|
||||
new_taqrs.push_back(taqrs[i]);
|
||||
new_prs.push(prs.size(i), prs.coeffs(i));
|
||||
|
|
@ -1776,7 +1776,7 @@ namespace realclosure {
|
|||
void set_array_p(array<polynomial> & ps, scoped_polynomial_seq const & prs) {
|
||||
unsigned sz = prs.size();
|
||||
ps.set(allocator(), sz, polynomial());
|
||||
for (unsigned i = 0; i < sz; i++) {
|
||||
for (unsigned i = 0; i < sz; ++i) {
|
||||
unsigned pi_sz = prs.size(i);
|
||||
value * const * pi = prs.coeffs(i);
|
||||
set_p(ps[i], pi_sz, pi);
|
||||
|
|
@ -1991,12 +1991,12 @@ namespace realclosure {
|
|||
SASSERT(M_s.m() == scs.size());
|
||||
TRACE(rcf_sign_det,
|
||||
tout << M_s;
|
||||
for (unsigned j = 0; j < scs.size(); j++) {
|
||||
for (unsigned j = 0; j < scs.size(); ++j) {
|
||||
display_sign_conditions(tout, scs[j]);
|
||||
tout << " = " << taqrs[j] << "\n";
|
||||
}
|
||||
tout << "qs:\n";
|
||||
for (unsigned j = 0; j < qs.size(); j++) {
|
||||
for (unsigned j = 0; j < qs.size(); ++j) {
|
||||
display_poly(tout, qs.size(j), qs.coeffs(j)); tout << "\n";
|
||||
});
|
||||
// We keep executing this loop until we have only one root for each sign condition in scs.
|
||||
|
|
@ -2028,9 +2028,9 @@ namespace realclosure {
|
|||
// Solve
|
||||
// new_M_s * sc_cardinalities = new_taqrs
|
||||
VERIFY(mm().solve(new_M_s, sc_cardinalities.data(), new_taqrs.data()));
|
||||
TRACE(rcf_sign_det, tout << "solution: "; for (unsigned i = 0; i < sc_cardinalities.size(); i++) { tout << sc_cardinalities[i] << " "; } tout << "\n";);
|
||||
TRACE(rcf_sign_det, tout << "solution: "; for (unsigned i = 0; i < sc_cardinalities.size(); ++i) { tout << sc_cardinalities[i] << " "; } tout << "\n";);
|
||||
// The solution must contain only positive values <= num_roots
|
||||
DEBUG_CODE(for (unsigned j = 0; j < sc_cardinalities.size(); j++) { SASSERT(0 <= sc_cardinalities[j] && sc_cardinalities[j] <= num_roots); });
|
||||
DEBUG_CODE(for (unsigned j = 0; j < sc_cardinalities.size(); ++j) { SASSERT(0 <= sc_cardinalities[j] && sc_cardinalities[j] <= num_roots); });
|
||||
// We should keep q only if it discriminated something.
|
||||
// That is,
|
||||
// If !use_q2, then There is an i s.t. sc_cardinalities[2*i] > 0 && sc_cardinalities[2*i] > 0
|
||||
|
|
@ -2051,7 +2051,7 @@ namespace realclosure {
|
|||
while (j < sc_cardinalities.size()) {
|
||||
sign_condition * sc = scs[k];
|
||||
k++;
|
||||
for (unsigned s = 0; s < step_sz; s++) {
|
||||
for (unsigned s = 0; s < step_sz; ++s) {
|
||||
// Remark: the second row of M contains the sign for q
|
||||
if (sc_cardinalities[j] > 0) {
|
||||
new_scs.push_back(mk_sign_condition(q_idx, M.get_int(1, s), sc));
|
||||
|
|
@ -2074,7 +2074,7 @@ namespace realclosure {
|
|||
// Update taqrs and prs
|
||||
prs.reset();
|
||||
taqrs.reset();
|
||||
for (unsigned j = 0; j < new_num_rows; j++) {
|
||||
for (unsigned j = 0; j < new_num_rows; ++j) {
|
||||
unsigned rid = new_row_idxs[j];
|
||||
prs.push(new_prs.size(rid), new_prs.coeffs(rid));
|
||||
taqrs.push_back(new_taqrs[rid]);
|
||||
|
|
@ -2089,21 +2089,21 @@ namespace realclosure {
|
|||
tout << "Final state\n";
|
||||
display_poly(tout, p_sz, p); tout << "\n";
|
||||
tout << M_s;
|
||||
for (unsigned j = 0; j < scs.size(); j++) {
|
||||
for (unsigned j = 0; j < scs.size(); ++j) {
|
||||
display_sign_conditions(tout, scs[j]);
|
||||
tout << " = " << taqrs[j] << "\n";
|
||||
}
|
||||
tout << "qs:\n";
|
||||
for (unsigned j = 0; j < qs.size(); j++) {
|
||||
for (unsigned j = 0; j < qs.size(); ++j) {
|
||||
display_poly(tout, qs.size(j), qs.coeffs(j)); tout << "\n";
|
||||
}
|
||||
tout << "prs:\n";
|
||||
for (unsigned j = 0; j < prs.size(); j++) {
|
||||
for (unsigned j = 0; j < prs.size(); ++j) {
|
||||
display_poly(tout, prs.size(j), prs.coeffs(j)); tout << "\n";
|
||||
});
|
||||
SASSERT(M_s.n() == M_s.m()); SASSERT(M_s.n() == static_cast<unsigned>(num_roots));
|
||||
sign_det * sd = mk_sign_det(M_s, prs, taqrs, qs, scs);
|
||||
for (unsigned idx = 0; idx < static_cast<unsigned>(num_roots); idx++) {
|
||||
for (unsigned idx = 0; idx < static_cast<unsigned>(num_roots); ++idx) {
|
||||
add_root(p_sz, p, interval, iso_interval, sd, idx, roots);
|
||||
}
|
||||
}
|
||||
|
|
@ -2115,7 +2115,7 @@ namespace realclosure {
|
|||
SASSERT(n >= 2);
|
||||
SASSERT(!is_zero(p[0]));
|
||||
SASSERT(!is_zero(p[n-1]));
|
||||
for (unsigned i = 1; i < n - 1; i++) {
|
||||
for (unsigned i = 1; i < n - 1; ++i) {
|
||||
if (!is_zero(p[i]))
|
||||
return false;
|
||||
}
|
||||
|
|
@ -2410,7 +2410,7 @@ namespace realclosure {
|
|||
\brief Root isolation entry point.
|
||||
*/
|
||||
void isolate_roots(unsigned n, numeral const * p, numeral_vector & roots) {
|
||||
TRACE(rcf_isolate_bug, tout << "isolate_roots: "; for (unsigned i = 0; i < n; i++) { display(tout, p[i]); tout << " "; } tout << "\n";);
|
||||
TRACE(rcf_isolate_bug, tout << "isolate_roots: "; for (unsigned i = 0; i < n; ++i) { display(tout, p[i]); tout << " "; } tout << "\n";);
|
||||
SASSERT(n > 0);
|
||||
SASSERT(!is_zero(p[n-1]));
|
||||
if (n == 1) {
|
||||
|
|
@ -2418,14 +2418,14 @@ namespace realclosure {
|
|||
return;
|
||||
}
|
||||
unsigned i = 0;
|
||||
for (; i < n; i++) {
|
||||
for (; i < n; ++i) {
|
||||
if (!is_zero(p[i]))
|
||||
break;
|
||||
}
|
||||
SASSERT(i < n);
|
||||
SASSERT(!is_zero(p[i]));
|
||||
ptr_buffer<value> nz_p;
|
||||
for (; i < n; i++)
|
||||
for (; i < n; ++i)
|
||||
nz_p.push_back(p[i].m_value);
|
||||
nz_isolate_roots(nz_p.size(), nz_p.data(), roots);
|
||||
if (nz_p.size() < n) {
|
||||
|
|
@ -2705,13 +2705,13 @@ namespace realclosure {
|
|||
value_ref a_i(*this);
|
||||
unsigned min = std::min(sz1, sz2);
|
||||
unsigned i = 0;
|
||||
for (; i < min; i++) {
|
||||
for (; i < min; ++i) {
|
||||
add(p1[i], p2[i], a_i);
|
||||
r.push_back(a_i);
|
||||
}
|
||||
for (; i < sz1; i++)
|
||||
for (; i < sz1; ++i)
|
||||
r.push_back(p1[i]);
|
||||
for (; i < sz2; i++)
|
||||
for (; i < sz2; ++i)
|
||||
r.push_back(p2[i]);
|
||||
SASSERT(r.size() == std::max(sz1, sz2));
|
||||
adjust_size(r);
|
||||
|
|
@ -2741,13 +2741,13 @@ namespace realclosure {
|
|||
value_ref a_i(*this);
|
||||
unsigned min = std::min(sz1, sz2);
|
||||
unsigned i = 0;
|
||||
for (; i < min; i++) {
|
||||
for (; i < min; ++i) {
|
||||
sub(p1[i], p2[i], a_i);
|
||||
r.push_back(a_i);
|
||||
}
|
||||
for (; i < sz1; i++)
|
||||
for (; i < sz1; ++i)
|
||||
r.push_back(p1[i]);
|
||||
for (; i < sz2; i++) {
|
||||
for (; i < sz2; ++i) {
|
||||
neg(p2[i], a_i);
|
||||
r.push_back(a_i);
|
||||
}
|
||||
|
|
@ -2778,7 +2778,7 @@ namespace realclosure {
|
|||
if (a == nullptr)
|
||||
return;
|
||||
value_ref a_i(*this);
|
||||
for (unsigned i = 0; i < sz; i++) {
|
||||
for (unsigned i = 0; i < sz; ++i) {
|
||||
mul(a, p[i], a_i);
|
||||
r.push_back(a_i);
|
||||
}
|
||||
|
|
@ -2798,11 +2798,11 @@ namespace realclosure {
|
|||
std::swap(p1, p2);
|
||||
}
|
||||
value_ref tmp(*this);
|
||||
for (unsigned i = 0; i < sz1; i++) {
|
||||
for (unsigned i = 0; i < sz1; ++i) {
|
||||
checkpoint();
|
||||
if (p1[i] == nullptr)
|
||||
continue;
|
||||
for (unsigned j = 0; j < sz2; j++) {
|
||||
for (unsigned j = 0; j < sz2; ++j) {
|
||||
// r[i+j] <- r[i+j] + p1[i]*p2[j]
|
||||
mul(p1[i], p2[j], tmp);
|
||||
add(r[i+j], tmp, tmp);
|
||||
|
|
@ -2821,7 +2821,7 @@ namespace realclosure {
|
|||
return;
|
||||
value_ref a_i(*this);
|
||||
unsigned sz = p.size();
|
||||
for (unsigned i = 0; i < sz; i++) {
|
||||
for (unsigned i = 0; i < sz; ++i) {
|
||||
div(p[i], a, a_i);
|
||||
p.set(i, a_i);
|
||||
}
|
||||
|
|
@ -2864,7 +2864,7 @@ namespace realclosure {
|
|||
// q[m_n] <- q[m_n] + r[sz1 - 1]/b_n
|
||||
add(q[m_n], ratio, aux);
|
||||
q.set(m_n, aux);
|
||||
for (unsigned i = 0; i < sz2 - 1; i++) {
|
||||
for (unsigned i = 0; i < sz2 - 1; ++i) {
|
||||
// r[i + m_n] <- r[i + m_n] - ratio * p2[i]
|
||||
mul(ratio, p2[i], aux);
|
||||
sub(r[i + m_n], aux, aux);
|
||||
|
|
@ -2891,7 +2891,7 @@ namespace realclosure {
|
|||
void div(unsigned sz, value * const * p, value * a, value_ref_buffer & r) {
|
||||
r.reset();
|
||||
value_ref a_i(*this);
|
||||
for (unsigned i = 0; i < sz; i++) {
|
||||
for (unsigned i = 0; i < sz; ++i) {
|
||||
div(p[i], a, a_i);
|
||||
r.push_back(a_i);
|
||||
}
|
||||
|
|
@ -2927,7 +2927,7 @@ namespace realclosure {
|
|||
}
|
||||
unsigned m_n = sz1 - sz2;
|
||||
div(r[sz1 - 1], b_n, ratio);
|
||||
for (unsigned i = 0; i < sz2 - 1; i++) {
|
||||
for (unsigned i = 0; i < sz2 - 1; ++i) {
|
||||
mul(ratio, p2[i], new_a);
|
||||
sub(r[i + m_n], new_a, new_a);
|
||||
r.set(i + m_n, new_a);
|
||||
|
|
@ -2977,14 +2977,14 @@ namespace realclosure {
|
|||
a_m = r[sz1 - 1];
|
||||
// don't need to update position sz1 - 1, since it will become 0
|
||||
if (!is_rational_one(b_n)) {
|
||||
for (unsigned i = 0; i < sz1 - 1; i++) {
|
||||
for (unsigned i = 0; i < sz1 - 1; ++i) {
|
||||
mul(r[i], b_n, new_a);
|
||||
r.set(i, new_a);
|
||||
}
|
||||
}
|
||||
// buffer: a_m * x^m + b_n * a_{m-1} * x^{m-1} + ... + b_n * a_0
|
||||
// don't need to process i = sz2 - 1, because r[sz1 - 1] will become 0.
|
||||
for (unsigned i = 0; i < sz2 - 1; i++) {
|
||||
for (unsigned i = 0; i < sz2 - 1; ++i) {
|
||||
mul(a_m, p2[i], new_a);
|
||||
sub(r[i + m_n], new_a, new_a);
|
||||
r.set(i + m_n, new_a);
|
||||
|
|
@ -3006,7 +3006,7 @@ namespace realclosure {
|
|||
SASSERT(p != r.data());
|
||||
r.reset();
|
||||
value_ref a_i(*this);
|
||||
for (unsigned i = 0; i < sz; i++) {
|
||||
for (unsigned i = 0; i < sz; ++i) {
|
||||
neg(p[i], a_i);
|
||||
r.push_back(a_i);
|
||||
}
|
||||
|
|
@ -3018,7 +3018,7 @@ namespace realclosure {
|
|||
void neg(value_ref_buffer & r) {
|
||||
value_ref a_i(*this);
|
||||
unsigned sz = r.size();
|
||||
for (unsigned i = 0; i < sz; i++) {
|
||||
for (unsigned i = 0; i < sz; ++i) {
|
||||
neg(r[i], a_i);
|
||||
r.set(i, a_i);
|
||||
}
|
||||
|
|
@ -3030,7 +3030,7 @@ namespace realclosure {
|
|||
void neg(polynomial & p) {
|
||||
value_ref a_i(*this);
|
||||
unsigned sz = p.size();
|
||||
for (unsigned i = 0; i < sz; i++) {
|
||||
for (unsigned i = 0; i < sz; ++i) {
|
||||
neg(p[i], a_i);
|
||||
inc_ref(a_i.get());
|
||||
dec_ref(p[i]);
|
||||
|
|
@ -3106,7 +3106,7 @@ namespace realclosure {
|
|||
bool struct_eq(unsigned sz_a, value * const * p_a, unsigned sz_b, value * const * p_b) const {
|
||||
if (sz_a != sz_b)
|
||||
return false;
|
||||
for (unsigned i = 0; i < sz_a; i++) {
|
||||
for (unsigned i = 0; i < sz_a; ++i) {
|
||||
if (!struct_eq(p_a[i], p_b[i]))
|
||||
return false;
|
||||
}
|
||||
|
|
@ -3148,7 +3148,7 @@ namespace realclosure {
|
|||
\brief See comment at has_clean_denominators(value * a)
|
||||
*/
|
||||
bool has_clean_denominators(unsigned sz, value * const * p) const {
|
||||
for (unsigned i = 0; i < sz; i++) {
|
||||
for (unsigned i = 0; i < sz; ++i) {
|
||||
if (!has_clean_denominators(p[i]))
|
||||
return false;
|
||||
}
|
||||
|
|
@ -3218,7 +3218,7 @@ namespace realclosure {
|
|||
value_ref_buffer nums(*this), dens(*this);
|
||||
value_ref a_n(*this), a_d(*this);
|
||||
bool all_one = true;
|
||||
for (unsigned i = 0; i < p_sz; i++) {
|
||||
for (unsigned i = 0; i < p_sz; ++i) {
|
||||
if (p[i]) {
|
||||
clean_denominators_core(p[i], a_n, a_d);
|
||||
nums.push_back(a_n);
|
||||
|
|
@ -3243,7 +3243,7 @@ namespace realclosure {
|
|||
bool found_z = false;
|
||||
SASSERT(nums.size() == p_sz);
|
||||
SASSERT(dens.size() == p_sz);
|
||||
for (unsigned i = 0; i < p_sz; i++) {
|
||||
for (unsigned i = 0; i < p_sz; ++i) {
|
||||
if (!dens[i])
|
||||
continue;
|
||||
if (is_nz_rational(dens[i])) {
|
||||
|
|
@ -3278,7 +3278,7 @@ namespace realclosure {
|
|||
d = lcm;
|
||||
value_ref_buffer multipliers(*this);
|
||||
value_ref m(*this);
|
||||
for (unsigned i = 0; i < p_sz; i++) {
|
||||
for (unsigned i = 0; i < p_sz; ++i) {
|
||||
if (!nums[i]) {
|
||||
norm_p.push_back(nullptr);
|
||||
}
|
||||
|
|
@ -3297,7 +3297,7 @@ namespace realclosure {
|
|||
is_z = true;
|
||||
}
|
||||
bool found_lt_eq = false;
|
||||
for (unsigned j = 0; j < p_sz; j++) {
|
||||
for (unsigned j = 0; j < p_sz; ++j) {
|
||||
TRACE(rcf_clean_bug, tout << "j: " << j << " "; display(tout, m, false); tout << "\n";);
|
||||
if (!dens[j])
|
||||
continue;
|
||||
|
|
@ -3547,7 +3547,7 @@ namespace realclosure {
|
|||
return false;
|
||||
}
|
||||
else {
|
||||
for (unsigned i = 0; i < p_sz; i++) {
|
||||
for (unsigned i = 0; i < p_sz; ++i) {
|
||||
if (p[i]) {
|
||||
if (!gcd_int_coeffs(p[i], g))
|
||||
return false;
|
||||
|
|
@ -3574,7 +3574,7 @@ namespace realclosure {
|
|||
if (gcd_int_coeffs(p.size(), p.data(), g) && !qm().is_one(g)) {
|
||||
SASSERT(qm().is_pos(g));
|
||||
value_ref a(*this);
|
||||
for (unsigned i = 0; i < p.size(); i++) {
|
||||
for (unsigned i = 0; i < p.size(); ++i) {
|
||||
if (p[i]) {
|
||||
a = p[i];
|
||||
p.set(i, nullptr);
|
||||
|
|
@ -3608,7 +3608,7 @@ namespace realclosure {
|
|||
value_ref_buffer new_ais(*this);
|
||||
value_ref ai(*this);
|
||||
polynomial const & p = rf->num();
|
||||
for (unsigned i = 0; i < p.size(); i++) {
|
||||
for (unsigned i = 0; i < p.size(); ++i) {
|
||||
if (p[i]) {
|
||||
ai = p[i];
|
||||
exact_div_z(ai, b);
|
||||
|
|
@ -3649,7 +3649,7 @@ namespace realclosure {
|
|||
value_ref a_i(*this);
|
||||
SASSERT(p[sz-1] != 0);
|
||||
if (!is_rational_one(p[sz-1])) {
|
||||
for (unsigned i = 0; i < sz - 1; i++) {
|
||||
for (unsigned i = 0; i < sz - 1; ++i) {
|
||||
div(p[i], p[sz-1], a_i);
|
||||
p.set(i, a_i);
|
||||
}
|
||||
|
|
@ -3759,7 +3759,7 @@ namespace realclosure {
|
|||
void derivative(unsigned sz, value * const * p, value_ref_buffer & r) {
|
||||
r.reset();
|
||||
if (sz > 1) {
|
||||
for (unsigned i = 1; i < sz; i++) {
|
||||
for (unsigned i = 1; i < sz; ++i) {
|
||||
value_ref a_i(*this);
|
||||
a_i = mk_rational(mpq(i));
|
||||
mul(a_i, p[i], a_i);
|
||||
|
|
@ -3937,7 +3937,7 @@ namespace realclosure {
|
|||
approximating the coefficients do not have -oo or oo as lower/upper bounds.
|
||||
*/
|
||||
bool has_refineable_approx_coeffs(unsigned n, value * const * p) {
|
||||
for (unsigned i = 0; i < n; i++) {
|
||||
for (unsigned i = 0; i < n; ++i) {
|
||||
if (p[i] != nullptr) {
|
||||
mpbqi & a_i = interval(p[i]);
|
||||
if (a_i.lower_is_inf() || a_i.upper_is_inf())
|
||||
|
|
@ -4021,7 +4021,7 @@ namespace realclosure {
|
|||
*/
|
||||
int find_biggest_interval_magnitude(unsigned n, value * const * p) {
|
||||
int r = INT_MIN;
|
||||
for (unsigned i = 0; i < n; i++) {
|
||||
for (unsigned i = 0; i < n; ++i) {
|
||||
if (p[i] != nullptr) {
|
||||
mpbqi & a_i = interval(p[i]);
|
||||
SASSERT(!a_i.lower_is_inf() && !a_i.upper_is_inf());
|
||||
|
|
@ -4109,7 +4109,7 @@ namespace realclosure {
|
|||
sign = 0;
|
||||
prev_sign = 0;
|
||||
unsigned i = 0;
|
||||
for (; i < sz; i++) {
|
||||
for (; i < sz; ++i) {
|
||||
// find next nonzero
|
||||
unsigned psz = seq.size(i);
|
||||
value * const * p = seq.coeffs(i);
|
||||
|
|
@ -4254,7 +4254,7 @@ namespace realclosure {
|
|||
\brief Refine the interval for each coefficient of in the polynomial p.
|
||||
*/
|
||||
bool refine_coeffs_interval(unsigned n, value * const * p, unsigned prec) {
|
||||
for (unsigned i = 0; i < n; i++) {
|
||||
for (unsigned i = 0; i < n; ++i) {
|
||||
if (p[i] != nullptr && !refine_interval(p[i], prec))
|
||||
return false;
|
||||
}
|
||||
|
|
@ -4517,7 +4517,7 @@ namespace realclosure {
|
|||
*/
|
||||
static unsigned first_non_zero(polynomial const & p) {
|
||||
unsigned sz = p.size();
|
||||
for (unsigned i = 0; i < sz; i++) {
|
||||
for (unsigned i = 0; i < sz; ++i) {
|
||||
if (p[i] != 0)
|
||||
return i;
|
||||
}
|
||||
|
|
@ -4531,7 +4531,7 @@ namespace realclosure {
|
|||
int sign_of_first_non_zero(polynomial const & p, unsigned start_idx) {
|
||||
unsigned sz = p.size();
|
||||
SASSERT(start_idx < sz);
|
||||
for (unsigned i = start_idx; i < sz; i++) {
|
||||
for (unsigned i = start_idx; i < sz; ++i) {
|
||||
if (p[i] != 0)
|
||||
return sign(p[i]);
|
||||
}
|
||||
|
|
@ -4810,7 +4810,7 @@ namespace realclosure {
|
|||
int_buffer new_taqrs;
|
||||
value_ref_buffer prq(*this);
|
||||
// fill new_taqrs using taqrs and the new tarski queries containing q (and q^2 when use_q2 == true).
|
||||
for (unsigned i = 0; i < taqrs.size(); i++) {
|
||||
for (unsigned i = 0; i < taqrs.size(); ++i) {
|
||||
// Add TaQ(p, prs[i] * 1; x->iso_interval())
|
||||
new_taqrs.push_back(taqrs[i]);
|
||||
// Add TaQ(p, prs[i] * q; x->iso_interval())
|
||||
|
|
@ -4832,16 +4832,16 @@ namespace realclosure {
|
|||
// - contains only 0 or 1
|
||||
// - !use_q2 IMPLIES for all i in [0, taqrs.size()) (sc_cardinalities[2*i] == 1) + (sc_cardinalities[2*i + 1] == 1) == 1
|
||||
// - use_q2 IMPLIES for all i in [0, taqrs.size()) (sc_cardinalities[3*i] == 1) + (sc_cardinalities[3*i + 1] == 1) + (sc_cardinalities[3*i + 2] == 1) == 1
|
||||
for (unsigned i = 0; i < sc_cardinalities.size(); i++) {
|
||||
for (unsigned i = 0; i < sc_cardinalities.size(); ++i) {
|
||||
SASSERT(sc_cardinalities[i] == 0 || sc_cardinalities[i] == 1);
|
||||
}
|
||||
if (!use_q2) {
|
||||
for (unsigned i = 0; i < taqrs.size(); i++) {
|
||||
for (unsigned i = 0; i < taqrs.size(); ++i) {
|
||||
SASSERT((sc_cardinalities[2*i] == 1) + (sc_cardinalities[2*i + 1] == 1) == 1);
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (unsigned i = 0; i < taqrs.size(); i++) {
|
||||
for (unsigned i = 0; i < taqrs.size(); ++i) {
|
||||
SASSERT((sc_cardinalities[3*i] == 1) + (sc_cardinalities[3*i + 1] == 1) + (sc_cardinalities[3*i + 2] == 1) == 1);
|
||||
}
|
||||
}
|
||||
|
|
@ -5667,7 +5667,7 @@ namespace realclosure {
|
|||
alpha_val = mk_rational_function_value(alpha);
|
||||
// search for the root that is equal to alpha
|
||||
unsigned i = 0;
|
||||
for (i = 0; i < roots.size(); i++) {
|
||||
for (i = 0; i < roots.size(); ++i) {
|
||||
if (compare(alpha_val, roots[i].m_value) == 0) {
|
||||
// found it;
|
||||
break;
|
||||
|
|
@ -5809,7 +5809,7 @@ namespace realclosure {
|
|||
value_ref neg_a(*this);
|
||||
neg(a.m_value, neg_a);
|
||||
p.push_back(neg_a);
|
||||
for (unsigned i = 0; i < k - 1; i++)
|
||||
for (unsigned i = 0; i < k - 1; ++i)
|
||||
p.push_back(nullptr);
|
||||
p.push_back(one());
|
||||
|
||||
|
|
@ -5904,7 +5904,7 @@ namespace realclosure {
|
|||
}
|
||||
|
||||
void mark(polynomial const & p) {
|
||||
for (unsigned i = 0; i < p.size(); i++) {
|
||||
for (unsigned i = 0; i < p.size(); ++i) {
|
||||
mark(p[i]);
|
||||
}
|
||||
}
|
||||
|
|
@ -5921,7 +5921,7 @@ namespace realclosure {
|
|||
|
||||
static unsigned num_nz_coeffs(polynomial const & p) {
|
||||
unsigned r = 0;
|
||||
for (unsigned i = 0; i < p.size(); i++) {
|
||||
for (unsigned i = 0; i < p.size(); ++i) {
|
||||
if (p[i])
|
||||
r++;
|
||||
}
|
||||
|
|
@ -6068,11 +6068,11 @@ namespace realclosure {
|
|||
|
||||
void display_poly(std::ostream & out, unsigned n, value * const * p) const {
|
||||
collect_algebraic_refs c;
|
||||
for (unsigned i = 0; i < n; i++)
|
||||
for (unsigned i = 0; i < n; ++i)
|
||||
c.mark(p[i]);
|
||||
display_polynomial(out, n, p, display_free_var_proc(), true, false);
|
||||
std::sort(c.m_found.begin(), c.m_found.end(), rank_lt_proc());
|
||||
for (unsigned i = 0; i < c.m_found.size(); i++) {
|
||||
for (unsigned i = 0; i < c.m_found.size(); ++i) {
|
||||
algebraic * ext = c.m_found[i];
|
||||
out << "\n r!" << ext->idx() << " := ";
|
||||
display_algebraic_def(out, ext, true, false);
|
||||
|
|
@ -6131,7 +6131,7 @@ namespace realclosure {
|
|||
std::sort(c.m_found.begin(), c.m_found.end(), rank_lt_proc());
|
||||
out << "[";
|
||||
display(out, a, true, pp);
|
||||
for (unsigned i = 0; i < c.m_found.size(); i++) {
|
||||
for (unsigned i = 0; i < c.m_found.size(); ++i) {
|
||||
algebraic * ext = c.m_found[i];
|
||||
if (pp)
|
||||
out << "; α<sub>" << ext->idx() << "</sub> := ";
|
||||
|
|
@ -6502,12 +6502,12 @@ void pp(realclosure::manager::imp * imp, realclosure::value * v) {
|
|||
}
|
||||
|
||||
void pp(realclosure::manager::imp * imp, unsigned sz, realclosure::value * const * p) {
|
||||
for (unsigned i = 0; i < sz; i++)
|
||||
for (unsigned i = 0; i < sz; ++i)
|
||||
pp(imp, p[i]);
|
||||
}
|
||||
|
||||
void pp(realclosure::manager::imp * imp, realclosure::manager::imp::value_ref_buffer const & p) {
|
||||
for (unsigned i = 0; i < p.size(); i++)
|
||||
for (unsigned i = 0; i < p.size(); ++i)
|
||||
pp(imp, p[i]);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue