3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2026-03-14 17:19:59 +00:00

Merge pull request #8918 from Z3Prover/copilot/code-simplification-march-2026

Simplify conditional logic in sls_euf_plugin.cpp and extract sign condition helper in realclosure.cpp
This commit is contained in:
Nikolaj Bjorner 2026-03-10 10:03:22 -07:00 committed by GitHub
commit bb11a56a67
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 37 additions and 45 deletions

View file

@ -287,34 +287,35 @@ namespace sls {
if (m.is_eq(e)) {
a = g.find(to_app(e)->get_arg(0));
b = g.find(to_app(e)->get_arg(1));
}
if (lit.sign() && m.is_eq(e)) {
if (a && b && a->get_root() == b->get_root()) {
IF_VERBOSE(0, verbose_stream() << "not disequal " << lit << " " << mk_pp(e, m) << "\n");
ctx.display(verbose_stream());
UNREACHABLE();
if (lit.sign()) {
if (a && b && a->get_root() == b->get_root()) {
IF_VERBOSE(0, verbose_stream() << "not disequal " << lit << " " << mk_pp(e, m) << "\n");
ctx.display(verbose_stream());
UNREACHABLE();
}
}
else {
if (a && b && a->get_root() != b->get_root()) {
IF_VERBOSE(0, verbose_stream() << "not equal " << lit << " " << mk_pp(e, m) << "\n");
//UNREACHABLE();
}
}
}
else if (!lit.sign() && m.is_eq(e)) {
if (a && b && a->get_root() != b->get_root()) {
IF_VERBOSE(0, verbose_stream() << "not equal " << lit << " " << mk_pp(e, m) << "\n");
//UNREACHABLE();
}
}
else if (to_app(e)->get_family_id() != basic_family_id && lit.sign()) {
else if (to_app(e)->get_family_id() != basic_family_id) {
auto* ne = g.find(e);
auto* nf = g.find(m.mk_false());
if (ne && nf && ne->get_root() != nf->get_root()) {
IF_VERBOSE(0, verbose_stream() << "not false " << lit << " " << mk_pp(e, m) << "\n");
//UNREACHABLE();
if (lit.sign()) {
auto* nf = g.find(m.mk_false());
if (ne && nf && ne->get_root() != nf->get_root()) {
IF_VERBOSE(0, verbose_stream() << "not false " << lit << " " << mk_pp(e, m) << "\n");
//UNREACHABLE();
}
}
}
else if (to_app(e)->get_family_id() != basic_family_id && !lit.sign()) {
auto* ne = g.find(e);
auto* nt = g.find(m.mk_true());
if (ne && nt && ne->get_root() != nt->get_root()) {
IF_VERBOSE(0, verbose_stream() << "not true " << lit << " " << mk_pp(e, m) << "\n");
//UNREACHABLE();
else {
auto* nt = g.find(m.mk_true());
if (ne && nt && ne->get_root() != nt->get_root()) {
IF_VERBOSE(0, verbose_stream() << "not true " << lit << " " << mk_pp(e, m) << "\n");
//UNREACHABLE();
}
}
}

View file

@ -3448,16 +3448,21 @@ namespace realclosure {
return true;
}
unsigned get_sign_condition_size(numeral const &a, unsigned i) {
algebraic * ext = to_algebraic(to_rational_function(a)->ext());
sign_condition* get_ith_sign_condition(algebraic* ext, unsigned i) {
const sign_det * sdt = ext->sdt();
if (!sdt)
return 0;
return nullptr;
sign_condition * sc = sdt->sc(ext->sc_idx());
while (i) {
if (sc) sc = sc->prev();
while (i && sc) {
sc = sc->prev();
i--;
}
return sc;
}
unsigned get_sign_condition_size(numeral const &a, unsigned i) {
algebraic * ext = to_algebraic(to_rational_function(a)->ext());
sign_condition * sc = get_ith_sign_condition(ext, i);
if (!sc)
return 0;
return ext->sdt()->qs()[sc->qidx()].size();
@ -3468,14 +3473,7 @@ namespace realclosure {
if (!is_algebraic(a))
return 0;
algebraic * ext = to_algebraic(to_rational_function(a)->ext());
const sign_det * sdt = ext->sdt();
if (!sdt)
return 0;
sign_condition * sc = sdt->sc(ext->sc_idx());
while (i) {
if (sc) sc = sc->prev();
i--;
}
sign_condition * sc = get_ith_sign_condition(ext, i);
if (!sc)
return 0;
const polynomial & q = ext->sdt()->qs()[sc->qidx()];
@ -3487,14 +3485,7 @@ namespace realclosure {
if (!is_algebraic(a))
return numeral();
algebraic * ext = to_algebraic(to_rational_function(a)->ext());
const sign_det * sdt = ext->sdt();
if (!sdt)
return numeral();
sign_condition * sc = sdt->sc(ext->sc_idx());
while (i) {
if (sc) sc = sc->prev();
i--;
}
sign_condition * sc = get_ith_sign_condition(ext, i);
if (!sc)
return numeral();
const polynomial & q = ext->sdt()->qs()[sc->qidx()];