You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
TRACE(nlsat_explain, tout << "lc does no vaninsh\n";);
363
353
return;
354
+
}
355
+
TRACE(nlsat_explain, tout << "got a zero sign on lc\n";);
356
+
357
+
364
358
// lc is not the zero polynomial, but it vanished in the current interpretation.
365
359
// so we keep searching...
360
+
TRACE(nlsat_explain, tout << "adding zero assumption for var:"; m_solver.display_var(tout, x); tout << ", degree k:" << k << ", p:" ; display(tout, p) << "\n";);
361
+
366
362
add_zero_assumption(lc);
367
363
}
368
364
if (k == 0) {
369
365
// all coefficients of p vanished in the current interpretation,
370
366
// and were added as assumptions.
371
367
p = m_pm.mk_zero();
368
+
TRACE(nlsat_explain, tout << "all coefficients of p vanished\n";);
372
369
return;
373
370
}
374
371
k--;
@@ -621,25 +618,57 @@ namespace nlsat {
621
618
}
622
619
}
623
620
624
-
voidadd_sample_coeff(polynomial_ref_vector &ps, var x){
625
-
polynomial_ref p(m_pm);
626
-
polynomial_ref lc(m_pm);
627
-
unsigned sz = ps.size();
628
-
for (unsigned i = 0; i < sz; i++){
629
-
p = ps.get(i);
630
-
unsigned k = degree(p, x);
631
-
SASSERT(k > 0);
632
-
TRACE(nlsat_explain, tout << "add_lc, x: "; display_var(tout, x); tout << "\nk: " << k << "\n"; display(tout, p); tout << "\n";);
633
-
for(; k > 0; k--){
634
-
lc = m_pm.coeff(p, x, k);
635
-
add_factors(lc);
636
-
if (m_pm.nonzero_const_coeff(p, x, k)){
637
-
TRACE(nlsat_explain, tout << "constant coefficient, skipping...\n";);
621
+
boolis_well_oriented(polynomial_ref_vector &ps, var x) {
622
+
polynomial_ref p_poly(m_pm);
623
+
polynomial_ref lc_poly(m_pm);
624
+
polynomial_ref disc_poly(m_pm);
625
+
polynomial_ref current_coeff_poly(m_pm);
626
+
627
+
for (unsigned i = 0; i < ps.size(); i++) {
628
+
p_poly = ps.get(i);
629
+
unsigned k_deg = m_pm.degree(p_poly, x);
630
+
if (k_deg == 0)
631
+
continue;
632
+
// p_poly depends on x
633
+
lc_poly = m_pm.coeff(p_poly, x, k_deg);
634
+
if (sign(lc_poly) == 0) { // LC is zero
635
+
TRACE(nlsat_explain, tout << "Global !WO: LC of poly is zero. Poly: "; display(tout, p_poly); tout << " LC: "; display(tout, lc_poly) << "\\n";);
636
+
returnfalse;
637
+
}
638
+
639
+
disc_poly = discriminant(p_poly, x); // Use global helper
640
+
if (sign(disc_poly) == 0) { // Discriminant is zero
641
+
TRACE(nlsat_explain, tout << "Global !WO: Discriminant of poly is zero. Poly: "; display(tout, p_poly); tout << " Disc: "; display(tout, disc_poly) << "\\n";);
642
+
returnfalse;
643
+
}
644
+
645
+
}
646
+
returntrue;
647
+
}
648
+
649
+
// For each p in ps add the leading or all the coefficients of p to the projection,
650
+
// depending on the well-orientedness of ps.
651
+
voidadd_lcs(polynomial_ref_vector &ps, var x) {
652
+
polynomial_ref p_poly(m_pm);
653
+
polynomial_ref coeff(m_pm);
654
+
polynomial_ref disc_poly(m_pm);
655
+
656
+
bool wo = is_well_oriented(ps, x);
657
+
// Add coefficients based on well-orientedness
658
+
for (unsigned i = 0; i < ps.size(); i++) {
659
+
p_poly = ps.get(i);
660
+
unsigned k_deg = m_pm.degree(p_poly, x);
661
+
if (k_deg == 0) continue;
662
+
// p_poly depends on x
663
+
TRACE(nlsat_explain, tout << "processing poly of degree " << k_deg << " w.r.t x" << x << ": "; display(tout, p_poly); tout << (wo ? " (wo)" : " (!wo)") << "\\n";);
664
+
for (unsigned j_coeff_deg = k_deg; j_coeff_deg >= 1; j_coeff_deg--) {
0 commit comments