3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2026-06-08 10:00:56 +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:
Copilot 2026-01-14 19:55:31 -08:00 committed by GitHub
parent 1bf463d77a
commit 2436943794
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
475 changed files with 3237 additions and 3237 deletions

View file

@ -117,7 +117,7 @@ class add_bounds_tactic : public tactic {
expr_fast_mark1 visited;
add_bound_proc proc(bm, *(g.get()), m_lower, m_upper);
unsigned sz = g->size();
for (unsigned i = 0; i < sz; i++)
for (unsigned i = 0; i < sz; ++i)
quick_for_each_expr(proc, visited, g->form(i));
visited.reset();
g->inc_depth();

View file

@ -153,7 +153,7 @@ class diff_neq_tactic : public tactic {
// throws exception if contains unbounded variable
void check_unbounded() {
unsigned num = num_vars();
for (var x = 0; x < num; x++) {
for (var x = 0; x < num; ++x) {
if (m_lower[x] == INT_MIN || m_upper[x] == INT_MAX)
throw_not_supported();
// possible extension: support bound normalization here
@ -166,7 +166,7 @@ class diff_neq_tactic : public tactic {
expr * lhs;
expr * rhs;
unsigned sz = g.size();
for (unsigned i = 0; i < sz; i++) {
for (unsigned i = 0; i < sz; ++i) {
expr * f = g.form(i);
TRACE(diff_neq_tactic, tout << "processing: " << mk_ismt2_pp(f, m) << "\n";);
if (u.is_le(f, lhs, rhs))
@ -183,10 +183,10 @@ class diff_neq_tactic : public tactic {
void display(std::ostream & out) {
unsigned num = num_vars();
for (var x = 0; x < num; x++) {
for (var x = 0; x < num; ++x) {
out << m_lower[x] << " <= " << mk_ismt2_pp(m_var2expr.get(x), m) << " <= " << m_upper[x] << "\n";
}
for (var x = 0; x < num; x++) {
for (var x = 0; x < num; ++x) {
diseqs::iterator it = m_var_diseqs[x].begin();
diseqs::iterator end = m_var_diseqs[x].end();
for (; it != end; ++it) {
@ -197,7 +197,7 @@ class diff_neq_tactic : public tactic {
void display_model(std::ostream & out) {
unsigned num = m_stack.size();
for (var x = 0; x < num; x++) {
for (var x = 0; x < num; ++x) {
out << mk_ismt2_pp(m_var2expr.get(x), m) << " := " << m_stack[x] << "\n";
}
}
@ -208,7 +208,7 @@ class diff_neq_tactic : public tactic {
void init_forbidden() {
int max = 0;
unsigned num = num_vars();
for (var x = 0; x < num; x++) {
for (var x = 0; x < num; ++x) {
if (m_upper[x] > max)
max = m_upper[x];
}
@ -250,10 +250,10 @@ class diff_neq_tactic : public tactic {
max = bad_v;
}
// reset forbidden
for (int i = starting_at + 1; i <= max; i++)
for (int i = starting_at + 1; i <= max; ++i)
m_forbidden[i] = false;
DEBUG_CODE({
for (unsigned i = 0; i < m_forbidden.size(); i++) {
for (unsigned i = 0; i < m_forbidden.size(); ++i) {
SASSERT(!m_forbidden[i]);
}
});
@ -305,7 +305,7 @@ class diff_neq_tactic : public tactic {
model * md = alloc(model, m);
unsigned num = num_vars();
SASSERT(m_stack.size() == num);
for (var x = 0; x < num; x++) {
for (var x = 0; x < num; ++x) {
func_decl * d = to_app(m_var2expr.get(x))->get_decl();
md->register_decl(d, u.mk_numeral(rational(m_stack[x]), true));
}

View file

@ -188,7 +188,7 @@ public:
return;
}
for (unsigned i = 0; i < g->size(); i++) {
for (unsigned i = 0; i < g->size(); ++i) {
collect_fd(g->form(i));
}
cleanup_fd(mc1);
@ -198,7 +198,7 @@ public:
return;
}
for (unsigned i = 0; !g->inconsistent() && i < g->size(); i++) {
for (unsigned i = 0; !g->inconsistent() && i < g->size(); ++i) {
expr_ref new_curr(m);
proof_ref new_pr(m);
app_ref var(m);

View file

@ -59,7 +59,7 @@ class factor_tactic : public tactic {
void mk_eq(polynomial::factors const & fs, expr_ref & result) {
expr_ref_buffer args(m);
expr_ref arg(m);
for (unsigned i = 0; i < fs.distinct_factors(); i++) {
for (unsigned i = 0; i < fs.distinct_factors(); ++i) {
m_expr2poly.to_expr(fs[i], true, arg);
args.push_back(arg);
}
@ -70,7 +70,7 @@ class factor_tactic : public tactic {
void mk_split_eq(polynomial::factors const & fs, expr_ref & result) {
expr_ref_buffer args(m);
expr_ref arg(m);
for (unsigned i = 0; i < fs.distinct_factors(); i++) {
for (unsigned i = 0; i < fs.distinct_factors(); ++i) {
m_expr2poly.to_expr(fs[i], true, arg);
args.push_back(m.mk_eq(arg, mk_zero_for(arg)));
}
@ -100,7 +100,7 @@ class factor_tactic : public tactic {
SASSERT(k == OP_LT || k == OP_GT || k == OP_LE || k == OP_GE);
expr_ref_buffer args(m);
expr_ref arg(m);
for (unsigned i = 0; i < fs.distinct_factors(); i++) {
for (unsigned i = 0; i < fs.distinct_factors(); ++i) {
m_expr2poly.to_expr(fs[i], true, arg);
if (fs.get_degree(i) % 2 == 0)
arg = m_util.mk_power(arg, m_util.mk_numeral(rational(2), m_util.is_int(arg)));
@ -113,7 +113,7 @@ class factor_tactic : public tactic {
// See mk_split_strict_comp and mk_split_nonstrict_comp
void split_even_odd(bool strict, polynomial::factors const & fs, expr_ref_buffer & even_eqs, expr_ref_buffer & odd_factors) {
expr_ref arg(m);
for (unsigned i = 0; i < fs.distinct_factors(); i++) {
for (unsigned i = 0; i < fs.distinct_factors(); ++i) {
m_expr2poly.to_expr(fs[i], true, arg);
if (fs.get_degree(i) % 2 == 0) {
expr * eq = m.mk_eq(arg, mk_zero_for(arg));
@ -264,7 +264,7 @@ class factor_tactic : public tactic {
expr_ref new_curr(m);
proof_ref new_pr(m);
unsigned size = g->size();
for (unsigned idx = 0; !g->inconsistent() && idx < size; idx++) {
for (unsigned idx = 0; !g->inconsistent() && idx < size; ++idx) {
expr * curr = g->form(idx);
m_rw(curr, new_curr, new_pr);
if (produce_proofs) {

View file

@ -76,7 +76,7 @@ class fm_tactic : public tactic {
bool is_lower = false;
bool found = false;
for (unsigned i = 0; i < num_lits; i++) {
for (unsigned i = 0; i < num_lits; ++i) {
expr * l = lits[i];
expr * atom;
if (is_uninterp_const(l) || (m.is_not(l, atom) && is_uninterp_const(atom))) {
@ -109,7 +109,7 @@ class fm_tactic : public tactic {
num_mons = 1;
mons = &lhs;
}
for (unsigned j = 0; j < num_mons; j++) {
for (unsigned j = 0; j < num_mons; ++j) {
expr * monomial = mons[j];
expr * ai;
expr * xi;
@ -296,7 +296,7 @@ class fm_tactic : public tactic {
out << "(fm-model-converter";
SASSERT(m_xs.size() == m_clauses.size());
unsigned sz = m_xs.size();
for (unsigned i = 0; i < sz; i++) {
for (unsigned i = 0; i < sz; ++i) {
out << "\n(" << m_xs[i]->get_name();
clauses const & cs = m_clauses[i];
for (auto& c : cs)
@ -310,7 +310,7 @@ class fm_tactic : public tactic {
ast_manager & to_m = translator.to();
fm_model_converter * res = alloc(fm_model_converter, to_m);
unsigned sz = m_xs.size();
for (unsigned i = 0; i < sz; i++) {
for (unsigned i = 0; i < sz; ++i) {
func_decl * new_x = translator(m_xs[i]);
to_m.inc_ref(new_x);
res->m_xs.push_back(new_x);
@ -503,7 +503,7 @@ class fm_tactic : public tactic {
expr_fast_mark2 visited;
bool all_forbidden = true;
for (unsigned i = 0; i < num_mons; i++) {
for (unsigned i = 0; i < num_mons; ++i) {
expr * x;
if (!is_linear_mon_core(mons[i], x))
return false;
@ -532,7 +532,7 @@ class fm_tactic : public tactic {
if (m_fm_occ && m.is_or(t)) {
unsigned num = to_app(t)->get_num_args();
bool found = false;
for (unsigned i = 0; i < num; i++) {
for (unsigned i = 0; i < num; ++i) {
expr * l = to_app(t)->get_arg(i);
if (is_literal(l)) {
continue;
@ -566,7 +566,7 @@ class fm_tactic : public tactic {
}
void del_constraints(unsigned sz, constraint * const * cs) {
for (unsigned i = 0; i < sz; i++)
for (unsigned i = 0; i < sz; ++i)
del_constraint(cs[i]);
}
@ -590,18 +590,18 @@ class fm_tactic : public tactic {
cnstr->m_strict = strict;
cnstr->m_num_vars = num_vars;
cnstr->m_lits = reinterpret_cast<literal*>(mem_lits);
for (unsigned i = 0; i < num_lits; i++)
for (unsigned i = 0; i < num_lits; ++i)
cnstr->m_lits[i] = lits[i];
cnstr->m_xs = reinterpret_cast<var*>(mem_xs);
cnstr->m_as = reinterpret_cast<rational*>(mem_as);
for (unsigned i = 0; i < num_vars; i++) {
for (unsigned i = 0; i < num_vars; ++i) {
TRACE(mk_constraint_bug, tout << "xs[" << i << "]: " << xs[i] << "\n";);
cnstr->m_xs[i] = xs[i];
new (cnstr->m_as + i) rational(as[i]);
}
cnstr->m_c = c;
DEBUG_CODE({
for (unsigned i = 0; i < num_vars; i++) {
for (unsigned i = 0; i < num_vars; ++i) {
SASSERT(cnstr->m_xs[i] == xs[i]);
SASSERT(cnstr->m_as[i] == as[i]);
}
@ -622,13 +622,13 @@ class fm_tactic : public tactic {
// multiply as and c, by the lcm of their denominators
void mk_int(unsigned num, rational * as, rational & c) {
rational l = denominator(c);
for (unsigned i = 0; i < num; i++)
for (unsigned i = 0; i < num; ++i)
l = lcm(l, denominator(as[i]));
if (l.is_one())
return;
c *= l;
SASSERT(c.is_int());
for (unsigned i = 0; i < num; i++) {
for (unsigned i = 0; i < num; ++i) {
as[i] *= l;
SASSERT(as[i].is_int());
}
@ -641,7 +641,7 @@ class fm_tactic : public tactic {
rational g = c.m_c;
if (g.is_neg())
g.neg();
for (unsigned i = 0; i < c.m_num_vars; i++) {
for (unsigned i = 0; i < c.m_num_vars; ++i) {
if (g.is_one())
break;
if (c.m_as[i].is_pos())
@ -652,12 +652,12 @@ class fm_tactic : public tactic {
if (g.is_one())
return;
c.m_c /= g;
for (unsigned i = 0; i < c.m_num_vars; i++)
for (unsigned i = 0; i < c.m_num_vars; ++i)
c.m_as[i] /= g;
}
void display(std::ostream & out, constraint const & c) const {
for (unsigned i = 0; i < c.m_num_lits; i++) {
for (unsigned i = 0; i < c.m_num_lits; ++i) {
literal l = c.m_lits[i];
if (sign(l))
out << "~";
@ -668,7 +668,7 @@ class fm_tactic : public tactic {
out << "(";
if (c.m_num_vars == 0)
out << "0";
for (unsigned i = 0; i < c.m_num_vars; i++) {
for (unsigned i = 0; i < c.m_num_vars; ++i) {
if (i > 0)
out << " + ";
if (!c.m_as[i].is_one())
@ -706,12 +706,12 @@ class fm_tactic : public tactic {
m_counter += c1.m_num_lits + c2.m_num_lits;
for (unsigned i = 0; i < c1.m_num_vars; i++) {
for (unsigned i = 0; i < c1.m_num_vars; ++i) {
m_var2pos[c1.m_xs[i]] = i;
}
bool failed = false;
for (unsigned i = 0; i < c2.m_num_vars; i++) {
for (unsigned i = 0; i < c2.m_num_vars; ++i) {
unsigned pos1 = m_var2pos[c2.m_xs[i]];
if (pos1 == UINT_MAX || c1.m_as[pos1] != c2.m_as[i]) {
failed = true;
@ -719,21 +719,21 @@ class fm_tactic : public tactic {
}
}
for (unsigned i = 0; i < c1.m_num_vars; i++) {
for (unsigned i = 0; i < c1.m_num_vars; ++i) {
m_var2pos[c1.m_xs[i]] = UINT_MAX;
}
if (failed)
return false;
for (unsigned i = 0; i < c2.m_num_lits; i++) {
for (unsigned i = 0; i < c2.m_num_lits; ++i) {
literal l = c2.m_lits[i];
bvar b = lit2bvar(l);
SASSERT(m_bvar2sign[b] == 0);
m_bvar2sign[b] = sign(l) ? -1 : 1;
}
for (unsigned i = 0; i < c1.m_num_lits; i++) {
for (unsigned i = 0; i < c1.m_num_lits; ++i) {
literal l = c1.m_lits[i];
bvar b = lit2bvar(l);
char s = sign(l) ? -1 : 1;
@ -743,7 +743,7 @@ class fm_tactic : public tactic {
}
}
for (unsigned i = 0; i < c2.m_num_lits; i++) {
for (unsigned i = 0; i < c2.m_num_lits; ++i) {
literal l = c2.m_lits[i];
bvar b = lit2bvar(l);
m_bvar2sign[b] = 0;
@ -761,7 +761,7 @@ class fm_tactic : public tactic {
var best = UINT_MAX;
unsigned best_sz = UINT_MAX;
bool best_lower = false;
for (unsigned i = 0; i < c.m_num_vars; i++) {
for (unsigned i = 0; i < c.m_num_vars; ++i) {
var xi = c.m_xs[i];
if (is_forbidden(xi))
continue; // variable is not in the index
@ -854,7 +854,7 @@ class fm_tactic : public tactic {
expr_fast_mark1 visited;
forbidden_proc proc(*this);
unsigned sz = g.size();
for (unsigned i = 0; i < sz; i++) {
for (unsigned i = 0; i < sz; ++i) {
expr * f = g.form(i);
if (is_occ(f))
continue;
@ -905,7 +905,7 @@ class fm_tactic : public tactic {
}
bool all_int(constraint const & c) const {
for (unsigned i = 0; i < c.m_num_vars; i++) {
for (unsigned i = 0; i < c.m_num_vars; ++i) {
if (!is_int(c.m_xs[i]))
return false;
}
@ -924,7 +924,7 @@ class fm_tactic : public tactic {
else {
bool int_cnstr = all_int(c);
ptr_buffer<expr> ms;
for (unsigned i = 0; i < c.m_num_vars; i++) {
for (unsigned i = 0; i < c.m_num_vars; ++i) {
expr * x = m_var2expr.get(c.m_xs[i]);
if (!int_cnstr && is_int(c.m_xs[i]))
x = m_util.mk_to_real(x);
@ -955,7 +955,7 @@ class fm_tactic : public tactic {
}
ptr_buffer<expr> lits;
for (unsigned i = 0; i < c.m_num_lits; i++) {
for (unsigned i = 0; i < c.m_num_lits; ++i) {
literal l = c.m_lits[i];
if (sign(l))
lits.push_back(m.mk_not(m_bvar2expr.get(lit2bvar(l))));
@ -1049,7 +1049,7 @@ class fm_tactic : public tactic {
#if Z3DEBUG
bool found_ineq = false;
#endif
for (unsigned i = 0; i < num; i++) {
for (unsigned i = 0; i < num; ++i) {
expr * l = args[i];
if (is_literal(l)) {
lits.push_back(to_literal(l));
@ -1080,7 +1080,7 @@ class fm_tactic : public tactic {
}
bool all_int = true;
for (unsigned j = 0; j < num_mons; j++) {
for (unsigned j = 0; j < num_mons; ++j) {
expr * monomial = mons[j];
expr * a;
rational a_val;
@ -1108,7 +1108,7 @@ class fm_tactic : public tactic {
}
}
TRACE(to_var_bug, tout << "before mk_constraint: "; for (unsigned i = 0; i < xs.size(); i++) tout << " " << xs[i]; tout << "\n";);
TRACE(to_var_bug, tout << "before mk_constraint: "; for (unsigned i = 0; i < xs.size(); ++i) tout << " " << xs[i]; tout << "\n";);
constraint * new_c = mk_constraint(lits.size(),
lits.data(),
@ -1138,7 +1138,7 @@ class fm_tactic : public tactic {
bool r = false;
for (unsigned i = 0; i < c->m_num_vars; i++) {
for (unsigned i = 0; i < c->m_num_vars; ++i) {
var x = c->m_xs[i];
if (!is_forbidden(x)) {
r = true;
@ -1164,7 +1164,7 @@ class fm_tactic : public tactic {
void init_use_list(goal const & g) {
unsigned sz = g.size();
for (unsigned i = 0; i < sz; i++) {
for (unsigned i = 0; i < sz; ++i) {
if (m_inconsistent)
return;
expr * f = g.form(i);
@ -1204,7 +1204,7 @@ class fm_tactic : public tactic {
void sort_candidates(var_vector & xs) {
svector<x_cost> x_cost_vector;
unsigned num = num_vars();
for (var x = 0; x < num; x++) {
for (var x = 0; x < num; ++x) {
if (!is_forbidden(x)) {
x_cost_vector.push_back(x_cost(x, get_cost(x)));
}
@ -1222,7 +1222,7 @@ class fm_tactic : public tactic {
void cleanup_constraints(constraints & cs) {
unsigned j = 0;
unsigned sz = cs.size();
for (unsigned i = 0; i < sz; i++) {
for (unsigned i = 0; i < sz; ++i) {
constraint * c = cs[i];
if (c->m_dead)
continue;
@ -1238,7 +1238,7 @@ class fm_tactic : public tactic {
void analyze(constraint const & c, var x, bool & all_int, bool & unit_coeff) const {
all_int = true;
unit_coeff = true;
for (unsigned i = 0; i < c.m_num_vars; i++) {
for (unsigned i = 0; i < c.m_num_vars; ++i) {
if (!is_int(c.m_xs[i])) {
all_int = false;
return;
@ -1304,7 +1304,7 @@ class fm_tactic : public tactic {
}
void get_coeff(constraint const & c, var x, rational & a) {
for (unsigned i = 0; i < c.m_num_vars; i++) {
for (unsigned i = 0; i < c.m_num_vars; ++i) {
if (c.m_xs[i] == x) {
a = c.m_as[i];
return;
@ -1333,7 +1333,7 @@ class fm_tactic : public tactic {
rational new_c = l.m_c*b + u.m_c*a;
bool new_strict = l.m_strict || u.m_strict;
for (unsigned i = 0; i < l.m_num_vars; i++) {
for (unsigned i = 0; i < l.m_num_vars; ++i) {
var xi = l.m_xs[i];
if (xi == x)
continue;
@ -1346,7 +1346,7 @@ class fm_tactic : public tactic {
SASSERT(new_xs.size() == new_as.size());
}
for (unsigned i = 0; i < u.m_num_vars; i++) {
for (unsigned i = 0; i < u.m_num_vars; ++i) {
var xi = u.m_xs[i];
if (xi == x)
continue;
@ -1364,7 +1364,7 @@ class fm_tactic : public tactic {
bool all_int = true;
unsigned sz = new_xs.size();
unsigned j = 0;
for (unsigned i = 0; i < sz; i++) {
for (unsigned i = 0; i < sz; ++i) {
if (new_as[i].is_zero())
continue;
if (!is_int(new_xs[i]))
@ -1384,7 +1384,7 @@ class fm_tactic : public tactic {
}
// reset m_var2pos
for (unsigned i = 0; i < l.m_num_vars; i++) {
for (unsigned i = 0; i < l.m_num_vars; ++i) {
m_var2pos[l.m_xs[i]] = UINT_MAX;
}
@ -1398,7 +1398,7 @@ class fm_tactic : public tactic {
}
new_lits.reset();
for (unsigned i = 0; i < l.m_num_lits; i++) {
for (unsigned i = 0; i < l.m_num_lits; ++i) {
literal lit = l.m_lits[i];
bvar p = lit2bvar(lit);
m_bvar2sign[p] = sign(lit) ? -1 : 1;
@ -1406,7 +1406,7 @@ class fm_tactic : public tactic {
}
bool tautology = false;
for (unsigned i = 0; i < u.m_num_lits && !tautology; i++) {
for (unsigned i = 0; i < u.m_num_lits && !tautology; ++i) {
literal lit = u.m_lits[i];
bvar p = lit2bvar(lit);
switch (m_bvar2sign[p]) {
@ -1427,7 +1427,7 @@ class fm_tactic : public tactic {
}
// reset m_bvar2sign
for (unsigned i = 0; i < l.m_num_lits; i++) {
for (unsigned i = 0; i < l.m_num_lits; ++i) {
literal lit = l.m_lits[i];
bvar p = lit2bvar(lit);
m_bvar2sign[p] = 0;
@ -1510,8 +1510,8 @@ class fm_tactic : public tactic {
unsigned limit = num_old_cnstrs + m_fm_extra;
unsigned num_new_cnstrs = 0;
new_constraints.reset();
for (unsigned i = 0; i < num_lowers; i++) {
for (unsigned j = 0; j < num_uppers; j++) {
for (unsigned i = 0; i < num_lowers; ++i) {
for (unsigned j = 0; j < num_uppers; ++j) {
if (m_inconsistent || num_new_cnstrs > limit) {
TRACE(fm, tout << "too many new constraints: " << num_new_cnstrs << "\n";);
del_constraints(new_constraints.size(), new_constraints.data());
@ -1533,7 +1533,7 @@ class fm_tactic : public tactic {
m_counter += sz;
for (unsigned i = 0; i < sz; i++) {
for (unsigned i = 0; i < sz; ++i) {
constraint * c = new_constraints[i];
backward_subsumption(*c);
register_constraint(c);
@ -1601,7 +1601,7 @@ class fm_tactic : public tactic {
m_mc = alloc(fm_model_converter, m);
unsigned num = candidates.size();
for (unsigned i = 0; i < num; i++) {
for (unsigned i = 0; i < num; ++i) {
checkpoint();
if (m_counter > m_fm_limit)
break;
@ -1636,7 +1636,7 @@ class fm_tactic : public tactic {
void display(std::ostream & out) const {
unsigned num = num_vars();
for (var x = 0; x < num; x++) {
for (var x = 0; x < num; ++x) {
if (is_forbidden(x))
continue;
out << mk_ismt2_pp(m_var2expr.get(x), m) << "\n";

View file

@ -205,7 +205,7 @@ public:
TRACE(pb, tout << "add bound " << lo << " " << hi << ": " << mk_pp(x, m) << "\n";);
}
}
for (unsigned i = 0; !g->inconsistent() && i < g->size(); i++) {
for (unsigned i = 0; !g->inconsistent() && i < g->size(); ++i) {
checkpoint();
expr_ref new_curr(m), tmp(m);

View file

@ -151,7 +151,7 @@ class lia2pb_tactic : public tactic {
expr_fast_mark1 visited;
visitor proc(*this);
unsigned sz = g.size();
for (unsigned i = 0; i < sz; i++) {
for (unsigned i = 0; i < sz; ++i) {
expr * f = g.form(i);
for_each_expr_core<visitor, expr_fast_mark1, true, true>(proc, visited, f);
}
@ -236,7 +236,7 @@ class lia2pb_tactic : public tactic {
def_args.reset();
rational a(1);
unsigned num_bits = u.get_num_bits();
for (unsigned i = 0; i < num_bits; i++) {
for (unsigned i = 0; i < num_bits; ++i) {
app * x_prime = m.mk_fresh_const(nullptr, m_util.mk_int());
g->assert_expr(m_util.mk_le(zero, x_prime));
g->assert_expr(m_util.mk_le(x_prime, one));
@ -271,7 +271,7 @@ class lia2pb_tactic : public tactic {
expr_ref new_curr(m);
proof_ref new_pr(m);
unsigned size = g->size();
for (unsigned idx = 0; !g->inconsistent() && idx < size; idx++) {
for (unsigned idx = 0; !g->inconsistent() && idx < size; ++idx) {
expr * curr = g->form(idx);
expr_dependency * dep = nullptr;
m_rw(curr, new_curr, new_pr);

View file

@ -119,7 +119,7 @@ class normalize_bounds_tactic : public tactic {
m_rw.set_substitution(&subst);
expr_ref new_curr(m);
for (unsigned idx = 0; !in->inconsistent() && idx < in->size(); idx++) {
for (unsigned idx = 0; !in->inconsistent() && idx < in->size(); ++idx) {
expr * curr = in->form(idx);
proof_ref new_pr(m);
m_rw(curr, new_curr, new_pr);

View file

@ -199,7 +199,7 @@ private:
expr_fast_mark1 visited;
only_01_visitor proc(m_arith_util, m_pb, m_bm);
unsigned sz = g->size();
for (unsigned i = 0; i < sz; i++) {
for (unsigned i = 0; i < sz; ++i) {
expr * f = g->form(i);
for_each_expr_core<only_01_visitor, expr_fast_mark1, true, true>(proc, visited, f);
}
@ -360,7 +360,7 @@ private:
}
static bool is_cardinality(polynomial const & m_p, numeral const & m_c) {
for (unsigned i = 0; i < m_p.size(); i++) {
for (unsigned i = 0; i < m_p.size(); ++i) {
if (!m_p[i].m_a.is_one())
return false;
}
@ -377,7 +377,7 @@ private:
if (is_card && m_c.is_one()) {
ptr_buffer<expr> args;
for (unsigned i = 0; i < m_p.size(); i++) {
for (unsigned i = 0; i < m_p.size(); ++i) {
args.push_back(mon_lit2lit(m_p[i]));
}
r = m.mk_or(args.size(), args.data());
@ -386,7 +386,7 @@ private:
if (is_card && m_c == numeral(m_p.size())) {
ptr_buffer<expr> args;
for (unsigned i = 0; i < m_p.size(); i++) {
for (unsigned i = 0; i < m_p.size(); ++i) {
args.push_back(mon_lit2lit(m_p[i]));
}
m_b_rw.mk_and(args.size(), args.data(), r);
@ -414,8 +414,8 @@ private:
expr_ref_vector tmp(m);
tmp.resize(rowsz, m.mk_true());
for (unsigned i = 0; i < k; i++) {
for (unsigned j = 0; j < rowsz; j++) {
for (unsigned i = 0; i < k; ++i) {
for (unsigned j = 0; j < rowsz; ++j) {
expr_ref new_ite(m);
m_b_rw.mk_ite(mon_lit2lit(m_p[i + j]),
tmp.get(j),
@ -435,7 +435,7 @@ private:
// [Leo] improving number of bits needed.
// using (sum-of-coeffs).get_num_bits()
numeral sum;
for (unsigned i = 0; i < m_p.size(); i++) {
for (unsigned i = 0; i < m_p.size(); ++i) {
monomial const & mo = m_p[i];
SASSERT(mo.m_a.is_pos());
sum += mo.m_a;
@ -458,7 +458,7 @@ private:
ptr_buffer<expr> lhs_args;
for (unsigned i = 0; i < m_p.size(); i++) {
for (unsigned i = 0; i < m_p.size(); ++i) {
monomial const & mo = m_p[i];
// encode using if-then-else
expr * bv_monom =
@ -483,7 +483,7 @@ private:
unsigned sz = m_p.size();
unsigned i;
for (i = 2; i < sz; i++) {
for (i = 2; i < sz; ++i) {
if (m_p[i].m_a != m_c)
break;
}
@ -494,7 +494,7 @@ private:
}
// copy lits [0, i) to m_clause
for (unsigned j = 0; j < i; j++)
for (unsigned j = 0; j < i; ++j)
m_clause.push_back(monomial(numeral(1), m_p[j].m_lit));
app * new_var = m.mk_fresh_const(nullptr, m_arith_util.mk_int());
@ -503,7 +503,7 @@ private:
m_clause.push_back(monomial(numeral(1), lit(new_var, true)));
// remove monomials [0, i) from m_p and add new_var in the beginning
for (unsigned j = i; j < sz; j++) {
for (unsigned j = i; j < sz; ++j) {
m_p[j - i + 1] = m_p[j];
}
m_p.shrink(sz - i + 1);
@ -598,7 +598,7 @@ private:
unsigned n = sz/2;
if (c != rational::power_of_two(n) - numeral(1))
return false;
for (unsigned i = 0; i < n; i++) {
for (unsigned i = 0; i < n; ++i) {
monomial const & m1 = p[i*2];
monomial const & m2 = p[i*2+1];
if (m1.m_lit.sign() == m2.m_lit.sign())
@ -745,7 +745,7 @@ private:
unsigned sz = to_app(lhs)->get_num_args();
expr * const * ms = to_app(lhs)->get_args();
expr * a, * x;
for (unsigned i = 0; i < sz; i++) {
for (unsigned i = 0; i < sz; ++i) {
expr * m = ms[i];
if (is_uninterp_const(m))
continue;
@ -759,7 +759,7 @@ private:
polynomial m_p;
numeral m_c;
m_c = c;
for (unsigned i = 0; i < sz; i++) {
for (unsigned i = 0; i < sz; ++i) {
expr * m = ms[i];
if (is_uninterp_const(m)) {
add_bounds_dependencies(m);
@ -789,7 +789,7 @@ private:
}
else if (k == LE) {
m_c.neg();
for (unsigned i = 0; i < sz; i++) {
for (unsigned i = 0; i < sz; ++i) {
monomial & m = m_p[i];
SASSERT(m.m_a.is_nonneg());
m_c += m.m_a;
@ -818,7 +818,7 @@ private:
polynomial m_p2;
numeral m_c2 = m_c;
m_c2.neg();
for (unsigned i = 0; i < sz; i++) {
for (unsigned i = 0; i < sz; ++i) {
monomial m = m_p[i];
SASSERT(m.m_a.is_nonneg());
m_c2 += m.m_a;
@ -914,7 +914,7 @@ private:
}
unsigned size = g->size();
for (unsigned i = 0; i < size; i++)
for (unsigned i = 0; i < size; ++i)
m_bm(g->form(i), g->dep(i), g->pr(i));
TRACE(pb2bv, m_bm.display(tout););
@ -933,7 +933,7 @@ private:
expr_ref new_curr(m);
proof_ref new_pr(m);
expr_ref new_f(m);
for (unsigned idx = 0; idx < size; idx++) {
for (unsigned idx = 0; idx < size; ++idx) {
expr * curr = g->form(idx);
expr * atom;
bool pos;
@ -957,7 +957,7 @@ private:
throw_tactic(p.e);
}
for (unsigned idx = 0; idx < size; idx++)
for (unsigned idx = 0; idx < size; ++idx)
g->update(idx, new_exprs.get(idx), nullptr, (m_produce_unsat_cores) ? new_deps.get(idx) : g->dep(idx));
expr_ref_vector fmls(m);
@ -974,7 +974,7 @@ private:
mc1->hide(f);
// store temp int constants in the filter
unsigned num_temps = m_temporary_ints.size();
for (unsigned i = 0; i < num_temps; i++)
for (unsigned i = 0; i < num_temps; ++i)
mc1->hide(m_temporary_ints.get(i));
pb2bv_model_converter * mc2 = alloc(pb2bv_model_converter, m, m_const2bit, m_bm);
mc = concat(mc1, mc2);
@ -1043,7 +1043,7 @@ struct is_pb_probe : public probe {
try {
ast_manager & m = g.m();
bound_manager bm(m);
for (unsigned i = 0; i < g.size(); i++)
for (unsigned i = 0; i < g.size(); ++i)
bm(g.form(i), g.dep(i), g.pr(i));
arith_util a_util(m);
pb_util pb(m);
@ -1051,7 +1051,7 @@ struct is_pb_probe : public probe {
pb2bv_tactic::only_01_visitor proc(a_util, pb, bm);
unsigned sz = g.size();
for (unsigned i = 0; i < sz; i++) {
for (unsigned i = 0; i < sz; ++i) {
expr * f = g.form(i);
for_each_expr_core<pb2bv_tactic::only_01_visitor, expr_fast_mark1, true, true>(proc, visited, f);
}

View file

@ -350,7 +350,7 @@ static bool is_lp(goal const & g) {
ast_manager & m = g.m();
arith_util u(m);
unsigned sz = g.size();
for (unsigned i = 0; i < sz; i++) {
for (unsigned i = 0; i < sz; ++i) {
expr * f = g.form(i);
bool sign = false;
while (m.is_not(f, f))

View file

@ -153,7 +153,7 @@ struct purify_arith_proc {
find_unsafe_proc proc(*this);
expr_fast_mark1 visited;
unsigned sz = m_goal.size();
for (unsigned i = 0; i < sz; i++) {
for (unsigned i = 0; i < sz; ++i) {
expr * curr = m_goal.form(i);
for_each_expr_core<find_unsafe_proc, expr_fast_mark1, true, true>(proc, visited, curr);
}
@ -243,7 +243,7 @@ struct purify_arith_proc {
expr_fast_mark1 visited;
proc p(*this);
unsigned sz = m_owner.m_goal.size();
for (unsigned i = 0; i < sz; i++) {
for (unsigned i = 0; i < sz; ++i) {
expr* f = m_owner.m_goal.form(i);
for_each_expr_core<proc, expr_fast_mark1, true, true>(p, visited, f);
}
@ -523,7 +523,7 @@ struct purify_arith_proc {
unsigned sz = p.size();
SASSERT(sz > 2);
ptr_buffer<expr> args;
for (unsigned i = 0; i < sz; i++) {
for (unsigned i = 0; i < sz; ++i) {
if (am.qm().is_zero(p[i]))
continue;
rational coeff = rational(p[i]);
@ -780,7 +780,7 @@ struct purify_arith_proc {
expr_ref new_curr(m());
proof_ref new_pr(m());
unsigned sz = m_goal.size();
for (unsigned i = 0; !m_goal.inconsistent() && i < sz; i++) {
for (unsigned i = 0; !m_goal.inconsistent() && i < sz; ++i) {
expr * curr = m_goal.form(i);
r(curr, new_curr, new_pr);
if (m_produce_proofs) {
@ -794,7 +794,7 @@ struct purify_arith_proc {
sz = r.cfg().m_new_cnstrs.size();
TRACE(purify_arith, tout << r.cfg().m_new_cnstrs << "\n";);
TRACE(purify_arith, tout << r.cfg().m_new_cnstr_prs << "\n";);
for (unsigned i = 0; i < sz; i++) {
for (unsigned i = 0; i < sz; ++i) {
m_goal.assert_expr(r.cfg().m_new_cnstrs.get(i), m_produce_proofs ? r.cfg().m_new_cnstr_prs.get(i) : nullptr, nullptr);
}
auto const& divs = r.cfg().m_divs;

View file

@ -169,13 +169,13 @@ class recover_01_tactic : public tactic {
return false;
idx = 0;
unsigned val = 1;
for (unsigned i = 0; i < num; i++) {
for (unsigned i = 0; i < num; ++i) {
expr * lit = zero_cls->get_arg(i);
if (m.is_eq(lit))
continue;
// search for lit or ~lit in cls
unsigned j;
for (j = 0; j < num; j++) {
for (j = 0; j < num; ++j) {
expr * lit2 = cls->get_arg(j);
if (m.is_eq(lit2))
continue;
@ -193,7 +193,7 @@ class recover_01_tactic : public tactic {
// find k
unsigned i;
for (i = 0; i < num; i++) {
for (i = 0; i < num; ++i) {
expr * lhs, * rhs;
if (m.is_eq(cls->get_arg(i), lhs, rhs) && (m_util.is_numeral(lhs, k) || m_util.is_numeral(rhs, k)))
break;
@ -264,13 +264,13 @@ class recover_01_tactic : public tactic {
unsigned num_bits = cls_size - 1;
// check if idxs are consistent
for (unsigned idx = 0; idx < expected_num_clauses; idx++) {
for (unsigned idx = 0; idx < expected_num_clauses; ++idx) {
if (!found[idx])
return false; // case is missing
rational expected_k;
unsigned idx_aux = idx;
unsigned idx_bit = 1;
for (unsigned j = 0; j < num_bits; j++) {
for (unsigned j = 0; j < num_bits; ++j) {
if (idx_aux % 2 == 1) {
expected_k += idx2coeff[idx_bit];
}
@ -285,7 +285,7 @@ class recover_01_tactic : public tactic {
expr_ref def(m);
bool real_ctx = m_util.is_real(x->get_range());
unsigned idx_bit = 1;
for (unsigned i = 0; i < cls_size; i++) {
for (unsigned i = 0; i < cls_size; ++i) {
expr * lit = zero_cls->get_arg(i);
if (m.is_eq(lit))
continue;
@ -322,7 +322,7 @@ class recover_01_tactic : public tactic {
SASSERT(new_goal->prec() == g->prec());
new_goal->inc_depth();
for (unsigned i = 0; i < g->size(); i++) {
for (unsigned i = 0; i < g->size(); ++i) {
expr * f = g->form(i);
if (save_clause(f))
saved = true;
@ -367,7 +367,7 @@ class recover_01_tactic : public tactic {
m_rw.set_substitution(subst);
expr_ref new_curr(m);
proof_ref new_pr(m);
for (unsigned idx = 0; idx < new_goal->size(); idx++) {
for (unsigned idx = 0; idx < new_goal->size(); ++idx) {
expr * curr = new_goal->form(idx);
m_rw(curr, new_curr);
new_goal->update(idx, new_curr);