Skip to content

Commit b551f2f

Browse files
committed
Enforce bound polynomial LC protection in compute_omit_lc functions
Move the invariant that bound-defining polynomials must never have their LC omitted from add_level_projections_sector() into the source functions: - compute_omit_lc_both_sides() - compute_omit_lc_chain_extremes() This centralizes the protection and removes the redundant override check.
1 parent 8fa67ce commit b551f2f

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

src/nlsat/levelwise.cpp

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -658,11 +658,17 @@ namespace nlsat {
658658
if (require_leaf)
659659
compute_resultant_graph_degree();
660660

661+
// Identify bound polynomial indices (must never omit LC)
662+
unsigned l_bound_idx = is_set(m_l_rf) ? m_rel.m_rfunc[m_l_rf].ps_idx : UINT_MAX;
663+
unsigned u_bound_idx = is_set(m_u_rf) ? m_rel.m_rfunc[m_u_rf].ps_idx : UINT_MAX;
664+
661665
for (unsigned i = 0; i < m_level_ps.size(); ++i) {
662666
if (m_side_mask[i] != 3)
663667
continue;
664668
if (require_leaf && m_deg_in_order_graph[i] != 1)
665669
continue;
670+
if (i == l_bound_idx || i == u_bound_idx)
671+
continue;
666672
m_omit_lc[i] = true;
667673
}
668674
}
@@ -681,14 +687,18 @@ namespace nlsat {
681687
compute_side_mask();
682688
unsigned n = m_rel.m_rfunc.size();
683689

684-
// Lower extreme: omit if it also appears on upper side
690+
// Identify bound polynomial indices (must never omit LC)
691+
unsigned l_bound_idx = is_set(m_l_rf) ? m_rel.m_rfunc[m_l_rf].ps_idx : UINT_MAX;
692+
unsigned u_bound_idx = is_set(m_u_rf) ? m_rel.m_rfunc[m_u_rf].ps_idx : UINT_MAX;
693+
694+
// Lower extreme: omit if it also appears on upper side (and not a bound)
685695
unsigned idx_lower = m_rel.m_rfunc[0].ps_idx;
686-
if (m_side_mask[idx_lower] & 2)
696+
if ((m_side_mask[idx_lower] & 2) && idx_lower != l_bound_idx && idx_lower != u_bound_idx)
687697
m_omit_lc[idx_lower] = true;
688698

689-
// Upper extreme: omit if it also appears on lower side
699+
// Upper extreme: omit if it also appears on lower side (and not a bound)
690700
unsigned idx_upper = m_rel.m_rfunc[n - 1].ps_idx;
691-
if (m_side_mask[idx_upper] & 1)
701+
if ((m_side_mask[idx_upper] & 1) && idx_upper != l_bound_idx && idx_upper != u_bound_idx)
692702
m_omit_lc[idx_upper] = true;
693703
}
694704

@@ -1475,11 +1485,6 @@ namespace nlsat {
14751485
bool is_lower_bound = is_set(m_l_rf) && i == m_rel.m_rfunc[m_l_rf].ps_idx;
14761486
bool is_upper_bound = is_set(m_u_rf) && i == m_rel.m_rfunc[m_u_rf].ps_idx;
14771487

1478-
// Per Algorithm 2, Line 13 of projective_delineability.pdf:
1479-
// Bound-defining polynomials MUST have their LC projected for delineability
1480-
if (is_lower_bound || is_upper_bound)
1481-
add_lc = true;
1482-
14831488
TRACE(lws,
14841489
tout << " poly[" << i << "] is_lower=" << is_lower_bound << " is_upper=" << is_upper_bound;
14851490
tout << " omit_lc[i]=" << (i < m_omit_lc.size() ? (m_omit_lc[i] ? "true" : "false") : "N/A");

0 commit comments

Comments
 (0)