3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2026-02-19 15:04:42 +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 Nikolaj Bjorner
parent 851b8ea31c
commit 317dd92105
475 changed files with 3237 additions and 3237 deletions

View file

@ -345,7 +345,7 @@ bool asserted_formulas::invoke(simplify_fmls& s) {
void asserted_formulas::display(std::ostream & out) const {
out << "asserted formulas:\n";
for (unsigned i = 0; i < m_formulas.size(); i++) {
for (unsigned i = 0; i < m_formulas.size(); ++i) {
if (i == m_qhead)
out << "[HEAD] ==>\n";
out << mk_pp(m_formulas[i].fml(), m) << "\n";
@ -453,7 +453,7 @@ void asserted_formulas::nnf_cnf() {
unsigned i = m_qhead;
unsigned sz = m_formulas.size();
TRACE(nnf_bug, tout << "i: " << i << " sz: " << sz << "\n";);
for (; i < sz; i++) {
for (; i < sz; ++i) {
expr * n = m_formulas[i].fml();
TRACE(nnf_bug, tout << "processing:\n" << mk_pp(n, m) << "\n";);
proof_ref pr(m_formulas[i].pr(), m);
@ -472,7 +472,7 @@ void asserted_formulas::nnf_cnf() {
return;
}
unsigned sz2 = push_todo.size();
for (unsigned k = 0; k < sz2; k++) {
for (unsigned k = 0; k < sz2; ++k) {
expr * n = push_todo.get(k);
pr = nullptr;
m_rewriter(n, r1, pr1);
@ -491,7 +491,7 @@ void asserted_formulas::nnf_cnf() {
void asserted_formulas::simplify_fmls::operator()() {
vector<justified_expr> new_fmls;
unsigned sz = af.m_formulas.size();
for (unsigned i = af.m_qhead; i < sz; i++) {
for (unsigned i = af.m_qhead; i < sz; ++i) {
auto& j = af.m_formulas[i];
expr_ref result(m);
proof_ref result_pr(m);
@ -548,7 +548,7 @@ void asserted_formulas::propagate_values() {
unsigned prop = num_prop;
TRACE(propagate_values, display(tout << "before:\n"););
unsigned i = m_qhead;
for (; i < sz; i++) {
for (; i < sz; ++i) {
prop += propagate_values(i);
}
flush_cache();

View file

@ -303,7 +303,7 @@ struct check_logic::imp {
return; // nothing to check
unsigned num_args = n->get_num_args();
bool found_non_numeral = false;
for (unsigned i = 0; i < num_args; i++) {
for (unsigned i = 0; i < num_args; ++i) {
if (!is_numeral(n->get_arg(i))) {
if (found_non_numeral)
fail("logic does not support nonlinear arithmetic");
@ -337,7 +337,7 @@ struct check_logic::imp {
if (num_args == 0)
return false;
expr * arg = t->get_arg(0);
for (unsigned i = 1; i < num_args; i++) {
for (unsigned i = 1; i < num_args; ++i) {
if (t->get_arg(i) != arg)
return false;
}
@ -352,7 +352,7 @@ struct check_logic::imp {
while (true) {
expr * non_numeral = nullptr;
unsigned num_args = t->get_num_args();
for (unsigned i = 0; i < num_args; i++) {
for (unsigned i = 0; i < num_args; ++i) {
expr * arg = t->get_arg(i);
if (is_numeral(arg))
continue;
@ -418,7 +418,7 @@ struct check_logic::imp {
// Check if the arith args of n are of the form (t + k) where k is a numeral.
void check_diff_args(app * n) {
unsigned num_args = n->get_num_args();
for (unsigned i = 0; i < num_args; i++) {
for (unsigned i = 0; i < num_args; ++i) {
if (is_arith(n))
check_diff_arg(n);
}
@ -510,7 +510,7 @@ struct check_logic::imp {
if (arity > 0) {
if (!m_uf && f->get_family_id() == null_family_id)
fail("logic does not support uninterpreted functions");
for (unsigned i = 0; i < arity; i++)
for (unsigned i = 0; i < arity; ++i)
check_sort(f->get_domain(i));
}
check_sort(f->get_range());

View file

@ -96,7 +96,7 @@ private:
bool has_quantifiers() const {
unsigned sz = get_num_assertions();
for (unsigned i = 0; i < sz; i++) {
for (unsigned i = 0; i < sz; ++i) {
if (::has_quantifiers(get_assertion(i)))
return true;
}

View file

@ -31,7 +31,7 @@ void extract_clauses_and_dependencies(goal_ref const& g, expr_ref_vector& clause
ast_manager& m = g->m();
expr_ref_vector clause(m);
unsigned sz = g->size();
for (unsigned i = 0; i < sz; i++) {
for (unsigned i = 0; i < sz; ++i) {
expr * f = g->form(i);
expr_dependency * d = g->dep(i);
if (d == nullptr || !g->unsat_core_enabled()) {

View file

@ -233,7 +233,7 @@ lbool tactic2solver::check_sat_core2(unsigned num_assumptions, expr * const * as
for (expr* e : m_assertions) {
g->assert_expr(e);
}
for (unsigned i = 0; i < num_assumptions; i++) {
for (unsigned i = 0; i < num_assumptions; ++i) {
proof_ref pr(m.mk_asserted(assumptions[i]), m);
expr_dependency_ref ans(m.mk_leaf(assumptions[i]), m);
g->assert_expr(assumptions[i], pr, ans);