mirror of
https://github.com/Z3Prover/z3
synced 2026-02-18 06:34:22 +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
1bf463d77a
commit
2436943794
475 changed files with 3237 additions and 3237 deletions
|
|
@ -273,7 +273,7 @@ ATOMIC_CMD(labels_cmd, "labels", "retrieve Simplify-like labels", {
|
|||
svector<symbol> labels;
|
||||
ctx.get_check_sat_result()->get_labels(labels);
|
||||
ctx.regular_stream() << "(labels";
|
||||
for (unsigned i = 0; i < labels.size(); i++) {
|
||||
for (unsigned i = 0; i < labels.size(); ++i) {
|
||||
ctx.regular_stream() << " " << labels[i];
|
||||
}
|
||||
ctx.regular_stream() << ")" << std::endl;
|
||||
|
|
@ -893,7 +893,7 @@ public:
|
|||
ptr_vector<sort> & array_sort_args = m_domain;
|
||||
sort_ref_buffer domain(ctx.m());
|
||||
unsigned arity = m_f->get_arity();
|
||||
for (unsigned i = 0; i < arity; i++) {
|
||||
for (unsigned i = 0; i < arity; ++i) {
|
||||
array_sort_args.push_back(m_f->get_domain(i));
|
||||
domain.push_back(array_sort->instantiate(ctx.pm(), array_sort_args.size(), array_sort_args.data()));
|
||||
array_sort_args.pop_back();
|
||||
|
|
|
|||
|
|
@ -174,7 +174,7 @@ bool func_decls::clash(func_decl * f) const {
|
|||
continue;
|
||||
unsigned num = g->get_arity();
|
||||
unsigned i;
|
||||
for (i = 0; i < num; i++)
|
||||
for (i = 0; i < num; ++i)
|
||||
if (g->get_domain(i) != f->get_domain(i))
|
||||
break;
|
||||
if (i == num)
|
||||
|
|
@ -208,7 +208,7 @@ bool func_decls::check_signature(ast_manager& m, func_decl* f, unsigned arity, s
|
|||
if (!domain)
|
||||
return true;
|
||||
coerced = false;
|
||||
for (unsigned i = 0; i < arity; i++) {
|
||||
for (unsigned i = 0; i < arity; ++i) {
|
||||
sort* s1 = f->get_domain(i);
|
||||
sort* s2 = domain[i];
|
||||
if (s1 == s2)
|
||||
|
|
@ -232,7 +232,7 @@ bool func_decls::check_poly_signature(ast_manager& m, func_decl* f, unsigned ari
|
|||
return false;
|
||||
if (f->get_arity() != arity)
|
||||
return false;
|
||||
for (unsigned i = 0; i < arity; i++)
|
||||
for (unsigned i = 0; i < arity; ++i)
|
||||
if (!sub.match(f->get_domain(i), domain[i]))
|
||||
return false;
|
||||
if (!range)
|
||||
|
|
@ -290,7 +290,7 @@ func_decl * func_decls::find(ast_manager & m, unsigned num_args, expr * const *
|
|||
if (!more_than_one())
|
||||
first();
|
||||
ptr_buffer<sort> sorts;
|
||||
for (unsigned i = 0; i < num_args; i++) {
|
||||
for (unsigned i = 0; i < num_args; ++i) {
|
||||
if (!args[i])
|
||||
return nullptr;
|
||||
sorts.push_back(args[i]->get_sort());
|
||||
|
|
@ -314,7 +314,7 @@ func_decl * func_decls::get_entry(unsigned inx) {
|
|||
else {
|
||||
func_decl_set * fs = UNTAG(func_decl_set *, m_decls);
|
||||
auto b = fs->begin();
|
||||
for (unsigned i = 0; i < inx; i++)
|
||||
for (unsigned i = 0; i < inx; ++i)
|
||||
b++;
|
||||
return *b;
|
||||
}
|
||||
|
|
@ -1149,7 +1149,7 @@ func_decl * cmd_context::find_func_decl(symbol const & s, unsigned num_indices,
|
|||
}
|
||||
else {
|
||||
buffer<parameter> ps;
|
||||
for (unsigned i = 0; i < num_indices; i++)
|
||||
for (unsigned i = 0; i < num_indices; ++i)
|
||||
ps.push_back(parameter(indices[i]));
|
||||
f = m().mk_func_decl(fid, k, num_indices, ps.data(), arity, domain, range);
|
||||
}
|
||||
|
|
@ -1268,12 +1268,12 @@ bool cmd_context::try_mk_declared_app(symbol const &s, unsigned num_args, expr *
|
|||
unsigned sz = get_array_arity(s);
|
||||
if (sz != num_args)
|
||||
return false;
|
||||
for (unsigned i = 0; i < sz; i++)
|
||||
for (unsigned i = 0; i < sz; ++i)
|
||||
if (args[i]->get_sort() != get_array_domain(s, i))
|
||||
return false;
|
||||
expr_ref_vector new_args(m());
|
||||
new_args.push_back(m().mk_const(f));
|
||||
for (unsigned i = 0; i < num_args; i++)
|
||||
for (unsigned i = 0; i < num_args; ++i)
|
||||
new_args.push_back(args[i]);
|
||||
result = au.mk_select(new_args.size(), new_args.data());
|
||||
return true;
|
||||
|
|
@ -1290,7 +1290,7 @@ bool cmd_context::try_mk_macro_app(symbol const & s, unsigned num_args, expr * c
|
|||
TRACE(macro_bug, tout << "well_sorted_check_enabled(): " << well_sorted_check_enabled() << "\n";
|
||||
tout << "s: " << s << "\n";
|
||||
tout << "body:\n" << mk_ismt2_pp(_t, m()) << "\n";
|
||||
tout << "args:\n"; for (unsigned i = 0; i < num_args; i++) tout << mk_ismt2_pp(args[i], m()) << "\n" << mk_pp(args[i]->get_sort(), m()) << "\n";);
|
||||
tout << "args:\n"; for (unsigned i = 0; i < num_args; ++i) tout << mk_ismt2_pp(args[i], m()) << "\n" << mk_pp(args[i]->get_sort(), m()) << "\n";);
|
||||
scoped_rlimit no_limit(m().limit(), 0);
|
||||
result = rev_subst()(_t, coerced_args);
|
||||
if (well_sorted_check_enabled() && !is_well_sorted(m(), result))
|
||||
|
|
@ -1649,7 +1649,7 @@ void cmd_context::push() {
|
|||
}
|
||||
|
||||
void cmd_context::push(unsigned n) {
|
||||
for (unsigned i = 0; i < n; i++)
|
||||
for (unsigned i = 0; i < n; ++i)
|
||||
push();
|
||||
}
|
||||
|
||||
|
|
@ -2123,7 +2123,7 @@ void cmd_context::complete_model(model_ref& md) const {
|
|||
}
|
||||
}
|
||||
|
||||
for (unsigned i = 0; i < md->get_num_functions(); i++) {
|
||||
for (unsigned i = 0; i < md->get_num_functions(); ++i) {
|
||||
func_decl * f = md->get_function(i);
|
||||
func_interp * fi = md->get_func_interp(f);
|
||||
IF_VERBOSE(12, verbose_stream() << "(model.completion " << f->get_name() << ")\n"; );
|
||||
|
|
@ -2135,7 +2135,7 @@ void cmd_context::complete_model(model_ref& md) const {
|
|||
|
||||
for (auto& [k, v] : m_func_decls) {
|
||||
IF_VERBOSE(12, verbose_stream() << "(model.completion " << k << ")\n"; );
|
||||
for (unsigned i = 0; i < v.get_num_entries(); i++) {
|
||||
for (unsigned i = 0; i < v.get_num_entries(); ++i) {
|
||||
func_decl * f = v.get_entry(i);
|
||||
|
||||
if (md->has_interpretation(f))
|
||||
|
|
@ -2338,14 +2338,14 @@ void cmd_context::set_solver_factory(solver_factory * f) {
|
|||
// assert formulas and create scopes in the new solver.
|
||||
unsigned lim = 0;
|
||||
for (scope& s : m_scopes) {
|
||||
for (unsigned i = lim; i < s.m_assertions_lim; i++) {
|
||||
for (unsigned i = lim; i < s.m_assertions_lim; ++i) {
|
||||
m_solver->assert_expr(m_assertions[i]);
|
||||
}
|
||||
lim = s.m_assertions_lim;
|
||||
m_solver->push();
|
||||
}
|
||||
unsigned sz = m_assertions.size();
|
||||
for (unsigned i = lim; i < sz; i++) {
|
||||
for (unsigned i = lim; i < sz; ++i) {
|
||||
m_solver->assert_expr(m_assertions[i]);
|
||||
}
|
||||
}
|
||||
|
|
@ -2493,7 +2493,7 @@ void cmd_context::display_smt2_benchmark(std::ostream & out, unsigned num, expr
|
|||
out << "(set-logic " << logic << ")" << std::endl;
|
||||
// collect uninterpreted function declarations
|
||||
decl_collector decls(m());
|
||||
for (unsigned i = 0; i < num; i++)
|
||||
for (unsigned i = 0; i < num; ++i)
|
||||
decls.visit(assertions[i]);
|
||||
|
||||
// TODO: display uninterpreted sort decls, and datatype decls.
|
||||
|
|
@ -2503,7 +2503,7 @@ void cmd_context::display_smt2_benchmark(std::ostream & out, unsigned num, expr
|
|||
out << std::endl;
|
||||
}
|
||||
|
||||
for (unsigned i = 0; i < num; i++) {
|
||||
for (unsigned i = 0; i < num; ++i) {
|
||||
out << "(assert ";
|
||||
display(out, assertions[i], 8);
|
||||
out << ")" << std::endl;
|
||||
|
|
|
|||
|
|
@ -246,7 +246,7 @@ UNARY_CMD(used_vars_cmd, "dbg-used-vars", "<expr>", "test used_vars functor", CP
|
|||
arg = to_quantifier(arg)->get_expr();
|
||||
proc(arg);
|
||||
ctx.regular_stream() << "(vars";
|
||||
for (unsigned i = 0; i < proc.get_max_found_var_idx_plus_1(); i++) {
|
||||
for (unsigned i = 0; i < proc.get_max_found_var_idx_plus_1(); ++i) {
|
||||
sort * s = proc.get(i);
|
||||
ctx.regular_stream() << "\n (" << std::left << std::setw(6) << i << " ";
|
||||
if (s != 0)
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ static void factor(cmd_context & ctx, expr * t, polynomial::factor_params const
|
|||
ctx.regular_stream() << std::endl << f0;
|
||||
unsigned num_factors = fs.distinct_factors();
|
||||
expr_ref f(ctx.m());
|
||||
for (unsigned i = 0; i < num_factors; i++) {
|
||||
for (unsigned i = 0; i < num_factors; ++i) {
|
||||
ctx.regular_stream() << std::endl;
|
||||
if (fs.get_degree(i) > 1)
|
||||
ctx.regular_stream() << "(^ ";
|
||||
|
|
@ -137,7 +137,7 @@ class poly_isolate_roots_cmd : public cmd {
|
|||
polynomial::var_vector xs;
|
||||
m_pm.vars(m_p, xs);
|
||||
unsigned num_assigned = 0;
|
||||
for (unsigned i = 0; i < xs.size(); i++) {
|
||||
for (unsigned i = 0; i < xs.size(); ++i) {
|
||||
if (m_x2v.contains(xs[i]))
|
||||
num_assigned++;
|
||||
}
|
||||
|
|
@ -148,7 +148,7 @@ class poly_isolate_roots_cmd : public cmd {
|
|||
ctx.regular_stream() << "(roots";
|
||||
pp_params params;
|
||||
bool pp_decimal = params.decimal();
|
||||
for (unsigned i = 0; i < rs.size(); i++) {
|
||||
for (unsigned i = 0; i < rs.size(); ++i) {
|
||||
ctx.regular_stream() << std::endl;
|
||||
if (!pp_decimal)
|
||||
m_am.display_root_smt2(ctx.regular_stream(), rs[i]);
|
||||
|
|
|
|||
|
|
@ -196,7 +196,7 @@ class psort_app : public psort {
|
|||
m.inc_ref(d);
|
||||
m.inc_ref(num_args, args);
|
||||
SASSERT(num_args == m_decl->get_num_params() || m_decl->has_var_params());
|
||||
DEBUG_CODE(if (num_args == num_params) { for (unsigned i = 0; i < num_params; i++) args[i]->check_num_params(this); });
|
||||
DEBUG_CODE(if (num_args == num_params) { for (unsigned i = 0; i < num_params; ++i) args[i]->check_num_params(this); });
|
||||
}
|
||||
|
||||
void finalize(pdecl_manager & m) override {
|
||||
|
|
@ -247,7 +247,7 @@ public:
|
|||
return false;
|
||||
SASSERT(m_args.size() == _other->m_args.size());
|
||||
unsigned sz = m_args.size();
|
||||
for (unsigned i = 0; i < sz; i++) {
|
||||
for (unsigned i = 0; i < sz; ++i) {
|
||||
if (m_args[i] != _other->m_args[i])
|
||||
return false;
|
||||
}
|
||||
|
|
@ -260,7 +260,7 @@ public:
|
|||
else {
|
||||
out << "(" << m_decl->get_name();
|
||||
unsigned sz = m_args.size();
|
||||
for (unsigned i = 0; i < sz; i++) {
|
||||
for (unsigned i = 0; i < sz; ++i) {
|
||||
out << " ";
|
||||
m_args[i]->display(out);
|
||||
}
|
||||
|
|
@ -319,7 +319,7 @@ sort * psort_user_decl::instantiate(pdecl_manager & m, unsigned n, sort * const
|
|||
return r;
|
||||
if (m_def == nullptr) {
|
||||
buffer<parameter> ps;
|
||||
for (unsigned i = 0; i < n; i++)
|
||||
for (unsigned i = 0; i < n; ++i)
|
||||
ps.push_back(parameter(s[i]));
|
||||
r = m.m().mk_uninterpreted_sort(m_name, ps.size(), ps.data());
|
||||
}
|
||||
|
|
@ -334,7 +334,7 @@ sort * psort_user_decl::instantiate(pdecl_manager & m, unsigned n, sort * const
|
|||
void display_sort_args(std::ostream & out, unsigned num_params) {
|
||||
if (num_params > 0)
|
||||
out << " (";
|
||||
for (unsigned i = 0; i < num_params; i++) {
|
||||
for (unsigned i = 0; i < num_params; ++i) {
|
||||
if (i > 0) out << " ";
|
||||
out << "s_" << i;
|
||||
}
|
||||
|
|
@ -406,7 +406,7 @@ sort * psort_builtin_decl::instantiate(pdecl_manager & m, unsigned n, sort * con
|
|||
}
|
||||
else {
|
||||
buffer<parameter> params;
|
||||
for (unsigned i = 0; i < n; i++)
|
||||
for (unsigned i = 0; i < n; ++i)
|
||||
params.push_back(parameter(s[i]));
|
||||
sort * r = m.m().mk_sort(m_fid, m_kind, n, params.data());
|
||||
m.save_info(r, this, n, s);
|
||||
|
|
@ -422,7 +422,7 @@ sort * psort_builtin_decl::instantiate(pdecl_manager & m, unsigned n, unsigned c
|
|||
}
|
||||
else {
|
||||
buffer<parameter> params;
|
||||
for (unsigned i = 0; i < n; i++)
|
||||
for (unsigned i = 0; i < n; ++i)
|
||||
params.push_back(parameter(s[i]));
|
||||
sort * r = m.m().mk_sort(m_fid, m_kind, n, params.data());
|
||||
m.save_info(r, this, n, s);
|
||||
|
|
@ -720,7 +720,7 @@ sort* pdecl_manager::instantiate_datatype(psort_decl* p, symbol const& name, uns
|
|||
}
|
||||
buffer<parameter> ps;
|
||||
ps.push_back(parameter(name));
|
||||
for (unsigned i = 0; i < n; i++)
|
||||
for (unsigned i = 0; i < n; ++i)
|
||||
ps.push_back(parameter(s[i]));
|
||||
datatype_util util(m.m());
|
||||
r = m.m().mk_sort(util.get_family_id(), DATATYPE_SORT, ps.size(), ps.data());
|
||||
|
|
|
|||
|
|
@ -345,11 +345,11 @@ public:
|
|||
|
||||
void lazy_dec_ref(pdecl * p) { p->dec_ref(); if (p->get_ref_count() == 0) m_to_delete.push_back(p); }
|
||||
template<typename T>
|
||||
void lazy_dec_ref(unsigned num, T * const * ps) { for (unsigned i = 0; i < num; i++) lazy_dec_ref(ps[i]); }
|
||||
void lazy_dec_ref(unsigned num, T * const * ps) { for (unsigned i = 0; i < num; ++i) lazy_dec_ref(ps[i]); }
|
||||
void inc_ref(pdecl * p) { if (p) { p->inc_ref(); } }
|
||||
void dec_ref(pdecl * p) { if (p) { lazy_dec_ref(p); del_decls(); } }
|
||||
template<typename T>
|
||||
void inc_ref(unsigned num, T * const * ps) { for (unsigned i = 0; i < num; i++) inc_ref(ps[i]); }
|
||||
void inc_ref(unsigned num, T * const * ps) { for (unsigned i = 0; i < num; ++i) inc_ref(ps[i]); }
|
||||
template<typename T>
|
||||
void dec_ref(unsigned num, T * const * ps) { lazy_dec_ref(num, ps); del_decls(); }
|
||||
psort_inst_cache * mk_inst_cache(unsigned num_params);
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ static simplifier_factory mk_and_then(cmd_context & ctx, sexpr * n) {
|
|||
if (num_children == 2)
|
||||
return sexpr2simplifier(ctx, n->get_child(1));
|
||||
std::vector<simplifier_factory> args;
|
||||
for (unsigned i = 1; i < num_children; i++)
|
||||
for (unsigned i = 1; i < num_children; ++i)
|
||||
args.push_back(sexpr2simplifier(ctx, n->get_child(i)));
|
||||
simplifier_factory result = [args](ast_manager& m, const params_ref& p, dependent_expr_state& st) {
|
||||
scoped_ptr<then_simplifier> s = alloc(then_simplifier, m, p, st);
|
||||
|
|
|
|||
|
|
@ -330,7 +330,7 @@ public:
|
|||
bool print_dependencies = p.get_bool("print_dependencies", false);
|
||||
ctx.regular_stream() << "(goals\n";
|
||||
unsigned sz = result_goals.size();
|
||||
for (unsigned i = 0; i < sz; i++) {
|
||||
for (unsigned i = 0; i < sz; ++i) {
|
||||
if (print_dependencies)
|
||||
result_goals[i]->display_with_dependencies(ctx);
|
||||
else
|
||||
|
|
@ -353,7 +353,7 @@ public:
|
|||
goal * fg = result_goals[0];
|
||||
unsigned sz = fg->size();
|
||||
ptr_buffer<expr> assertions;
|
||||
for (unsigned i = 0; i < sz; i++) {
|
||||
for (unsigned i = 0; i < sz; ++i) {
|
||||
assertions.push_back(fg->form(i));
|
||||
}
|
||||
ctx.display_smt2_benchmark(ctx.regular_stream(), assertions.size(), assertions.data());
|
||||
|
|
@ -362,7 +362,7 @@ public:
|
|||
// create a big OR
|
||||
expr_ref_buffer or_args(m);
|
||||
ptr_vector<expr> formulas;
|
||||
for (unsigned i = 0; i < num_goals; i++) {
|
||||
for (unsigned i = 0; i < num_goals; ++i) {
|
||||
formulas.reset();
|
||||
result_goals[i]->get_formulas(formulas);
|
||||
if (formulas.size() == 1)
|
||||
|
|
@ -407,7 +407,7 @@ static tactic * mk_and_then(cmd_context & ctx, sexpr * n) {
|
|||
if (num_children == 2)
|
||||
return sexpr2tactic(ctx, n->get_child(1));
|
||||
tactic_ref_buffer args;
|
||||
for (unsigned i = 1; i < num_children; i++)
|
||||
for (unsigned i = 1; i < num_children; ++i)
|
||||
args.push_back(sexpr2tactic(ctx, n->get_child(i)));
|
||||
return and_then(args.size(), args.data());
|
||||
}
|
||||
|
|
@ -420,7 +420,7 @@ static tactic * mk_or_else(cmd_context & ctx, sexpr * n) {
|
|||
if (num_children == 2)
|
||||
return sexpr2tactic(ctx, n->get_child(1));
|
||||
tactic_ref_buffer args;
|
||||
for (unsigned i = 1; i < num_children; i++)
|
||||
for (unsigned i = 1; i < num_children; ++i)
|
||||
args.push_back(sexpr2tactic(ctx, n->get_child(i)));
|
||||
return or_else(args.size(), args.data());
|
||||
}
|
||||
|
|
@ -433,7 +433,7 @@ static tactic * mk_par(cmd_context & ctx, sexpr * n) {
|
|||
if (num_children == 2)
|
||||
return sexpr2tactic(ctx, n->get_child(1));
|
||||
tactic_ref_buffer args;
|
||||
for (unsigned i = 1; i < num_children; i++)
|
||||
for (unsigned i = 1; i < num_children; ++i)
|
||||
args.push_back(sexpr2tactic(ctx, n->get_child(i)));
|
||||
return par(args.size(), args.data());
|
||||
}
|
||||
|
|
@ -446,7 +446,7 @@ static tactic * mk_par_then(cmd_context & ctx, sexpr * n) {
|
|||
if (num_children == 2)
|
||||
return sexpr2tactic(ctx, n->get_child(1));
|
||||
tactic_ref_buffer args;
|
||||
for (unsigned i = 1; i < num_children; i++)
|
||||
for (unsigned i = 1; i < num_children; ++i)
|
||||
args.push_back(sexpr2tactic(ctx, n->get_child(i)));
|
||||
return par_and_then(args.size(), args.data());
|
||||
}
|
||||
|
|
@ -580,7 +580,7 @@ static tactic * mk_echo(cmd_context & ctx, sexpr * n) {
|
|||
if (num_children < 2)
|
||||
throw cmd_exception("invalid echo tactic, must have at least one argument", n->get_line(), n->get_pos());
|
||||
tactic_ref res;
|
||||
for (unsigned i = 1; i < num_children; i++) {
|
||||
for (unsigned i = 1; i < num_children; ++i) {
|
||||
sexpr * curr = n->get_child(i);
|
||||
bool last = (i == num_children - 1);
|
||||
tactic * t;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue