3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2026-06-02 23:27:53 +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

@ -230,7 +230,7 @@ namespace mbp {
expr_ref val (m);
unsigned num_diff = diff_val_consts.size ();
SASSERT (num_diff == I.size ());
for (unsigned i = 0; i < num_diff; i++) {
for (unsigned i = 0; i < num_diff; ++i) {
// mk val term
ptr_vector<expr> sel_args;
sel_args.push_back (arr);
@ -276,7 +276,7 @@ namespace mbp {
expr_ref_vector idx_diseq (m);
if (!I.empty ()) {
expr_ref_vector vals = (*m_mev)(idxs);
for (unsigned i = 0; i < I.size () && !idx_in_I; i++) {
for (unsigned i = 0; i < I.size () && !idx_in_I; ++i) {
if (is_eq(idxs, I.get(i))) {
idx_in_I = true;
}
@ -351,7 +351,7 @@ namespace mbp {
TRACE(qe,
tout << "after factoring selects:\n";
tout << mk_pp (p_exp, m) << "\n";
for (unsigned i = m_aux_lits_v.size () - m_aux_vars.size (); i < m_aux_lits_v.size (); i++) {
for (unsigned i = m_aux_lits_v.size () - m_aux_vars.size (); i < m_aux_lits_v.size (); ++i) {
tout << mk_pp (m_aux_lits_v.get (i), m) << "\n";
}
);
@ -402,7 +402,7 @@ namespace mbp {
}
unsigned nd = 0; // nesting depth
for (nd = 1; m_arr_u.is_store (store); nd++, store = to_app (store->get_arg (0))) {
for (nd = 1; m_arr_u.is_store (store); ++nd, store = to_app (store->get_arg (0))) {
/* empty */ ;
}
if (store != m_v) {
@ -445,7 +445,7 @@ namespace mbp {
DEBUG_CODE(for (unsigned i = 0; i + 1 < true_eqs.size(); ++i) SASSERT(true_eqs[i].first <= true_eqs[i+1].first););
// search for subst term
for (unsigned i = 0; !m_subst_term_v && i < true_eqs.size(); i++) {
for (unsigned i = 0; !m_subst_term_v && i < true_eqs.size(); ++i) {
app* eq = true_eqs[i].second;
m_true_sub_v.insert (eq, m.mk_true ());
// try to find subst term
@ -502,7 +502,7 @@ namespace mbp {
m_mev = &mev;
unsigned j = 0;
for (unsigned i = 0; i < arr_vars.size (); i++) {
for (unsigned i = 0; i < arr_vars.size (); ++i) {
reset_v ();
m_v = arr_vars.get (i);
if (!m_arr_u.is_array (m_v)) {
@ -898,7 +898,7 @@ namespace mbp {
expr_ref_vector idxs(m, arity, a->get_args() + 1);
expr_ref_vector vals = (*m_mev)(idxs);
bool is_new = true;
for (unsigned j = start; j < m_idxs.size (); j++) {
for (unsigned j = start; j < m_idxs.size (); ++j) {
if (!is_eq(m_idxs[j].val, vals)) continue;
// idx belongs to the jth equivalence class;
// substitute sel term with ith sel const

View file

@ -409,10 +409,10 @@ struct mbp_array_tg::impl {
}
if (!m_use_mdl)
return progress;
for (unsigned i = 0; i < rdTerms.size(); i++) {
for (unsigned i = 0; i < rdTerms.size(); ++i) {
app* e1 = rdTerms.get(i);
expr* a1 = e1->get_arg(0);
for (unsigned j = i + 1; j < rdTerms.size(); j++) {
for (unsigned j = i + 1; j < rdTerms.size(); ++j) {
app* e2 = rdTerms.get(j);
if (!is_seen(e1, e2) && a1 == e2) {
mark_seen(e1, e2);

View file

@ -85,7 +85,7 @@ struct mbp_dt_tg::impl {
m_dt_util.get_accessor_constructor(to_app(term)->get_decl());
ptr_vector<func_decl> const *accessors =
m_dt_util.get_constructor_accessors(cons);
for (unsigned i = 0; i < accessors->size(); i++) {
for (unsigned i = 0; i < accessors->size(); ++i) {
func_decl *d = accessors->get(i);
sel = m.mk_app(d, v);
u = m_tg.get_const_in_class(sel);
@ -111,7 +111,7 @@ struct mbp_dt_tg::impl {
tout << "applying deconstruct_eq on " << expr_ref(cons, m););
ptr_vector<func_decl> const *accessors =
m_dt_util.get_constructor_accessors(to_app(cons)->get_decl());
for (unsigned i = 0; i < accessors->size(); i++) {
for (unsigned i = 0; i < accessors->size(); ++i) {
expr_ref a(m.mk_app(accessors->get(i), rhs), m);
expr *newRhs = to_app(cons)->get_arg(i);
m_tg.add_eq(a, newRhs);
@ -139,7 +139,7 @@ struct mbp_dt_tg::impl {
}
m_tg.add_lit(a);
for (unsigned i = 0; i < accessors->size(); i++) {
for (unsigned i = 0; i < accessors->size(); ++i) {
expr_ref a(m.mk_app(accessors->get(i), rhs), m);
expr *newRhs = to_app(cons)->get_arg(i);
if (!m_mdl.are_equal(a, newRhs)) {
@ -156,7 +156,7 @@ struct mbp_dt_tg::impl {
TRACE(mbp_tg, tout << "Iterating over terms of tg";);
// Not resetting terms because get_terms calls resize on terms
m_tg.get_terms(terms, false);
for (unsigned i = 0; i < terms.size(); i++) {
for (unsigned i = 0; i < terms.size(); ++i) {
term = terms.get(i);
if (is_seen(term)) continue;
if (m_tg.is_cgr(term)) continue;