3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2026-02-03 07:46:23 +00:00

Refactor mk_and and mk_app to use std::span API (#8285)

* Initial plan

* Refactor mk_and and mk_app to use std::span

- Made mk_and(unsigned num_args, expr * const * args) private
- Added new public mk_and(std::span<expr* const> args) method
- Added new public mk_app(family_id fid, decl_kind k, std::span<expr* const> args) method
- Updated all convenience overloads to use std::span version
- Updated all external call sites to use the new std::span API

Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>

* Fix remaining test files to use std::span API

- Updated src/test/sorting_network.cpp
- Updated src/test/ho_matcher.cpp with explicit cast to resolve ambiguity

Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>

* Revert overlapping changes superseded by PR #8286

Reverted 30 files to match the state from PR #8286 (commit ebc0688) which refactored mk_and/mk_or call sites to use vector overloads. This supersedes the std::span changes in those files.

Retained std::span changes in files unique to this PR:
- Core API changes (ast.h, ast.cpp)
- Files not affected by PR #8286 (api_context.cpp, ast_util.cpp, bool_rewriter.h, datatype_rewriter.cpp, dom_simplifier.cpp, factor_rewriter.cpp, pb2bv_rewriter.cpp, quant_hoist.cpp, spacer_cluster_util.cpp, sortmax.cpp, array_axioms.cpp, smtfd_solver.cpp, goal.cpp, ho_matcher.cpp, qe_arith.cpp, sorting_network.cpp)
- Special case in hnf.cpp where both PRs modified different lines

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-22 16:58:38 -08:00 committed by GitHub
parent 97b24a345f
commit 058a8c082d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
20 changed files with 33 additions and 25 deletions

View file

@ -111,12 +111,12 @@ namespace euf {
s = m_arith.mk_add(s, m.mk_app(f.get(), zero));
pat = m_arith.mk_add(m.mk_app(sum, 3, args), m_array.mk_select(F, L1));
pat = m_arith.mk_add(m.mk_app(sum, (unsigned)3, args), m_array.mk_select(F, L1));
IF_VERBOSE(0, verbose_stream() << "test5a: " << pat << " =?= " << s << "\n";);
m_matcher.add_pattern(pat.get());
m_matcher(pat, s, 4);
pat = m_arith.mk_add(m_array.mk_select(F, L1), m.mk_app(sum, 3, args));
pat = m_arith.mk_add(m_array.mk_select(F, L1), m.mk_app(sum, (unsigned)3, args));
IF_VERBOSE(0, verbose_stream() << "test5b: " << pat << " =?= " << s << "\n";);
m_matcher.add_pattern(pat.get());
m_matcher(pat, s, 4);

View file

@ -193,7 +193,7 @@ static app_ref generate_ineqs(ast_manager& m, sort* s, vector<expr_ref_vector>&
static void test_c(app* x, expr_ref_vector const& c) {
ast_manager& m = c.get_manager();
expr_ref fml(m);
fml = m.mk_and(c.size(), c.data());
fml = m.mk_and(std::span<expr* const>(c.data(), c.size()));
test(x, fml);
}

View file

@ -163,7 +163,7 @@ struct ast_ext2 {
return trail(m.mk_or(n, lits));
}
pliteral mk_min(unsigned n, pliteral const* lits) {
return trail(m.mk_and(n, lits));
return trail(m.mk_and(std::span<expr* const>(lits, n)));
}
pliteral mk_not(pliteral a) { if (m.is_not(a,a)) return a;
return trail(m.mk_not(a));