3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2026-02-19 07:04:22 +00:00

Refactor mk_and/mk_or call sites to use vector overloads (#8286)

* Initial plan

* Refactor mk_and and mk_or call sites to use overloaded methods

Changed 130 call sites across 64 files to use vector overloads directly instead of manually passing .size() and .data()/.c_ptr()

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

* Revert mk_or changes for ptr_buffer/ptr_vector (no overload exists in ast_util.h)

* Fix compilation errors from mk_and/mk_or refactoring

Fixed type mismatches by:
- Removing m parameter for expr_ref_vector (ast_util.h has mk_and/mk_or(expr_ref_vector) overloads)
- Reverting changes for ref_buffer types (no overload exists in ast_util.h, only in ast.h for m.mk_and)
- Verified build succeeds and Z3 works correctly

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

* Fix test files to use correct mk_and/mk_or overloads

Changed test/doc.cpp and test/udoc_relation.cpp to use mk_and(expr_ref_vector) and mk_or(expr_ref_vector) without m parameter

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 13:21:22 -08:00 committed by GitHub
parent d2e0354ce4
commit ebc0688470
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
61 changed files with 118 additions and 118 deletions

View file

@ -173,7 +173,7 @@ class test_doc_cls {
default: break;
}
}
result = mk_and(m, conjs.size(), conjs.data());
result = mk_and(conjs);
return result;
}
@ -197,7 +197,7 @@ class test_doc_cls {
break;
}
}
result = mk_and(m, conjs.size(), conjs.data());
result = mk_and(conjs);
return result;
}
@ -208,7 +208,7 @@ class test_doc_cls {
for (unsigned i = 0; i < d.neg().size(); ++i) {
conjs.push_back(m.mk_not(to_formula(d.neg()[i], m2)));
}
result = mk_and(m, conjs.size(), conjs.data());
result = mk_and(conjs);
return result;
}
@ -218,7 +218,7 @@ class test_doc_cls {
for (unsigned i = 0; i < ud.size(); ++i) {
disjs.push_back(to_formula(ud[i], m2));
}
result = mk_or(m, disjs.size(), disjs.data());
result = mk_or(disjs);
return result;
}
@ -299,7 +299,7 @@ class test_doc_cls {
fmls.push_back(m.mk_not(mk_conj(*t)));
d->neg().push_back(t);
}
fml1 = mk_and(m, fmls.size(), fmls.data());
fml1 = mk_and(fmls);
bool_vector to_merge(N, false);
bit_vector discard_cols;
discard_cols.resize(N, false);
@ -321,7 +321,7 @@ class test_doc_cls {
}
}
eqs.push_back(to_formula(*d, dm));
fml1 = mk_and(m, eqs.size(), eqs.data());
fml1 = mk_and(eqs);
if (dm.merge(*d, lo, 1, equalities, discard_cols)) {
fml2 = to_formula(*d, dm);
}

View file

@ -163,13 +163,13 @@ expr_ref hilbert_basis_validate::mk_validate(hilbert_basis& hb) {
}
eqs.push_back(m.mk_eq(xs[j].get(), a.mk_add(sum.size(), sum.data())));
}
fml = m.mk_and(eqs.size(), eqs.data());
fml = m.mk_and(eqs);
if (!names.empty()) {
fml = m.mk_exists(names.size(), sorts.data(), names.data(), fml);
}
fmls.push_back(fml);
}
fml1 = m.mk_or(fmls.size(), fmls.data());
fml1 = m.mk_or(fmls);
fmls.reset();
sz = hb.get_num_ineqs();
@ -194,7 +194,7 @@ expr_ref hilbert_basis_validate::mk_validate(hilbert_basis& hb) {
fmls.push_back(a.mk_ge(lhs, rhs));
}
}
fml2 = m.mk_and(fmls.size(), fmls.data());
fml2 = m.mk_and(fmls);
fml = m.mk_eq(fml1, fml2);
bounds.reset();
@ -204,7 +204,7 @@ expr_ref hilbert_basis_validate::mk_validate(hilbert_basis& hb) {
}
}
if (!bounds.empty()) {
fml = m.mk_implies(m.mk_and(bounds.size(), bounds.data()), fml);
fml = m.mk_implies(m.mk_and(bounds), fml);
}
return fml;

View file

@ -114,10 +114,10 @@ namespace dd {
for (unsigned i = 0; i < args.size(); ++i) {
args[i] = mk_not(m, args.get(i));
}
g = m.mk_not(m.mk_and(args.size(), args.data()));
g = m.mk_not(m.mk_and(args));
}
else if (m.is_and(a)) {
g = m.mk_and(args.size(), args.data());
g = m.mk_and(args);
trail.push_back(g);
}
else if (m.is_eq(a)) {

View file

@ -60,7 +60,7 @@ static void validate_quant_solutions(app* x, expr* fml, expr_ref_vector& guards)
// fml <=> guard_1 \/ guard_2 \/ ...
ast_manager& m = guards.get_manager();
expr_ref tmp(m), fml2(m);
tmp = m.mk_or(guards.size(), guards.c_ptr());
tmp = m.mk_or(guards);
expr* _x = x;
std::cout << mk_pp(fml, m) << "\n";
expr_abstract(m, 0, 1, &_x, fml, fml2);

View file

@ -900,7 +900,7 @@ public:
repl(tmp);
disj.push_back(tmp);
}
fml = mk_or(m, disj.size(), disj.data());
fml = mk_or(disj);
}
void apply_filter(udoc_relation& t, app* cond) {