3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2026-02-25 09:41:19 +00:00

add new polynomials from handle_nullified to m_todo

Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
This commit is contained in:
Lev Nachmanson 2026-02-18 10:54:39 -10:00
parent df419c137d
commit d8f2b5ca01
4 changed files with 31 additions and 162 deletions

View file

@ -1217,12 +1217,18 @@ namespace nlsat {
// Line 10/11: detect nullification + pick a non-zero coefficient witness per p.
m_witnesses.clear();
m_witnesses.reserve(m_level_ps.size());
for (unsigned i = 0; i < m_level_ps.size(); ++i) {
// Fixpoint loop: handle_nullified_poly may add more polynomials back at m_level
// via request_factorized. Drain them from m_todo into m_level_ps and
// compute witnesses for the new entries until no more appear.
for (unsigned i = 0; i < m_level_ps.size(); i++) {
polynomial_ref p(m_level_ps.get(i), m_pm);
polynomial_ref w = choose_nonzero_coeff(p, m_level);
if (!w)
handle_nullified_poly(p);
m_witnesses.push_back(w);
// Absorb any same-level polys that handle_nullified_poly added to m_todo
if (i + 1 == m_level_ps.size())
m_todo.extract_polys_at_level(m_level, m_level_ps);
}
}

View file

@ -112,6 +112,27 @@ namespace nlsat {
return x;
}
unsigned todo_set::extract_polys_at_level(var x, polynomial_ref_vector& out) {
pmanager& pm = m_set.m();
unsigned sz = m_set.size();
unsigned j = 0;
unsigned count = 0;
for (unsigned i = 0; i < sz; i++) {
poly* p = m_set.get(i);
if (pm.max_var(p) == x) {
out.push_back(p);
m_in_set[pm.id(p)] = false;
++count;
}
else {
m_set.set(j, p);
j++;
}
}
m_set.shrink(j);
return count;
}
/**
\brief Wrapper for factorization
*/

View file

@ -44,6 +44,9 @@ namespace nlsat {
them in max_polys. Return the maximal variable
*/
var extract_max_polys(polynomial_ref_vector& max_polys);
// Extract polynomials whose max_var equals \c x, appending them to \c out.
// Returns the number of polynomials extracted.
unsigned extract_polys_at_level(var x, polynomial_ref_vector& out);
};
inline std::ostream& display(std::ostream& out, pmanager& pm, polynomial_ref const& p, display_var_proc const& proc) {