20 #include "../Assertables.h"
26 namespace onecellcad {
47 std::vector<std::vector<TagPoly>> &polys,
int sectionHeuristic,
int sectorHeuristic) {
51 for (
auto &poly : polys) {
61 for (
int i = (
int)
point.
dim() - 1; i >= 0; i--) {
67 for (
auto &poly : polys[i]) {
70 "Building failed, " << poly.poly <<
" vanishes early at "
75 int locDeg = (int)
getDegree(poly, rootVariable);
96 assert(t.
level == (
size_t) i);
99 assert(!isolatedRoots.empty());
102 std::size_t rootIdx = 0;
104 for (
const auto &root : isolatedRoots) {
106 if (root == pointComp) {
123 SMTRAT_LOG_TRACE(
"smtrat.cad",
"Add discriminant: " << disc <<
" (if not const)");
129 "Add leadcoefficient: " << ldcf <<
" (if not const)");
133 std::vector<std::tuple<RAN, TagPoly>> upper;
134 std::vector<std::tuple<RAN, TagPoly>> lower;
135 std::vector<std::pair<Poly, Poly>> resultants;
136 std::vector<Poly> noDisc1;
137 std::vector<Poly> noDisc2;
138 std::vector<Poly> noLdcf;
142 if (sectionHeuristic == 1) {
143 for (
auto &poly : polys[i]) {
146 if (poly.poly != t.
poly) {
147 resultants.emplace_back(std::make_pair(t.
poly, poly.poly));
152 #ifdef SMTRAT_DEVOPTION_Statistics
153 getStatistic().resultantBarrierCreated();
156 }
else if (sectionHeuristic == 2) {
157 for (
auto &poly : polys[i]) {
163 if (isolatedRoots.empty()) {
172 if (isolatedRoots.front() >= pointComp) {
175 << isolatedRoots.front());
176 upper.emplace_back(std::make_tuple(isolatedRoots.front(), poly));
177 }
else if (isolatedRoots.back() <= pointComp) {
180 << isolatedRoots.back());
181 lower.emplace_back(std::make_tuple(isolatedRoots.back(), poly));
183 auto lb = std::lower_bound(isolatedRoots.begin(), isolatedRoots.end(),
185 if (*(lb - 1) == std::get<Section>(cell[i]).isolatedRoot) {
187 lower.emplace_back(std::make_tuple(*(lb - 1), poly));
191 "Smallest root above PointComp(2): " << *lb);
192 upper.emplace_back(std::make_tuple(*lb, poly));
194 "Biggest root below PointComp(2): " << *(lb - 1));
195 lower.emplace_back(std::make_tuple(*(lb - 1), poly));
202 "Add discriminant: " << disc <<
" (if not const)");
207 std::sort(lower.begin(), lower.end(), [](
auto const &t1,
auto const &t2) {
208 return std::get<0>(t1) < std::get<0>(t2);
210 std::sort(upper.begin(), upper.end(), [](
auto const &t1,
auto const &t2) {
211 return std::get<0>(t1) < std::get<0>(t2);
215 if (!lower.empty()) {
216 for (
auto it = lower.begin(); it != lower.end() - 1; it++) {
217 resultants.emplace_back(std::make_pair(std::get<1>(*it).poly,
218 std::get<1>(*(it + 1)).poly));
219 #ifdef SMTRAT_DEVOPTION_Statistics
220 getStatistic().resultantBarrierCreated();
225 if (!lower.empty() && !upper.empty()) {
226 resultants.emplace_back(std::make_pair(std::get<1>(lower.back()).poly,
227 std::get<1>(upper.front()).poly));
230 if (!upper.empty()) {
231 for (
auto it = upper.begin(); it != upper.end() - 1; it++) {
232 resultants.emplace_back(std::make_pair(std::get<1>(*it).poly,
233 std::get<1>(*(it + 1)).poly));
234 #ifdef SMTRAT_DEVOPTION_Statistics
235 getStatistic().resultantBarrierCreated();
241 if (!lower.empty() && std::find_if(upper.begin(), upper.end(),
242 [&](
auto const &t1) {
243 return (std::get<1>(t1).poly == std::get<1>(*lower.begin()).poly);
245 noLdcf.emplace_back(std::get<1>(*lower.begin()).poly);
247 if (!upper.empty() && std::find_if(lower.begin(), lower.end(),
248 [&](
auto const &t1) {
249 return (std::get<1>(t1).poly == std::get<1>(*(upper.end() - 1)).poly);
251 noLdcf.emplace_back(std::get<1>(*(upper.end() - 1)).poly);
254 for (
auto &poly : polys[i]) {
257 SMTRAT_LOG_TRACE(
"smtrat.cad",
"Add leadcoefficient: " << ldcf <<
" (if not const)");
262 }
else if (sectionHeuristic == 3) {
263 for (
auto &poly : polys[i]) {
268 if (isolatedRoots.empty()) {
277 poly.deg =
getDegree(poly, rootVariable);
278 if (isolatedRoots.front() >= pointComp) {
281 << isolatedRoots.front());
282 upper.emplace_back(std::make_tuple(isolatedRoots.front(), poly));
283 }
else if (isolatedRoots.back() <= pointComp) {
286 << isolatedRoots.back());
287 lower.emplace_back(std::make_tuple(isolatedRoots.back(), poly));
289 auto lb = std::lower_bound(isolatedRoots.begin(), isolatedRoots.end(), pointComp);
290 if (*(lb - 1) == std::get<Section>(cell[i]).isolatedRoot) {
292 lower.emplace_back(std::make_tuple(*(lb - 1), poly));
296 "Smallest root above PointComp(2): " << *lb);
297 upper.emplace_back(std::make_tuple(*lb, poly));
299 "Biggest root below PointComp(2): " << *(lb - 1));
300 lower.emplace_back(std::make_tuple(*(lb - 1), poly));
306 std::sort(lower.begin(), lower.end(), [](
auto const &t1,
auto const &t2) {
307 return std::get<0>(t1) < std::get<0>(t2);
309 std::sort(upper.begin(), upper.end(), [](
auto const &t1,
auto const &t2) {
310 return std::get<0>(t1) < std::get<0>(t2);
314 if (!lower.empty()) {
317 for (
auto it = lower.begin() + 1; it != lower.end(); it++) {
318 if (std::get<0>(*(it - 1)) == std::get<0>(*it) &&
319 std::get<1>(*(it - 1)).deg < std::get<1>(*it).deg) {
320 std::iter_swap(it - 1, it);
324 auto mark = lower.rend()-1;
325 while (mark != lower.rbegin()) {
326 auto cur = std::min_element(lower.rbegin(), mark, [](
auto const &t1,
auto const &t2) {
327 return std::get<1>(t1).deg < std::get<1>(t2).deg;
330 for (
auto it = cur + 1; it != mark+1; it++) {
331 resultants.emplace_back(std::make_pair(std::get<1>(*cur).poly, std::get<1>(*it).poly));
333 if (std::find_if(upper.begin(), upper.end(),
334 [&](
auto const &t1) { return (std::get<1>(t1).poly == std::get<1>(*it).poly); }) != upper.end()) {
335 noLdcf.emplace_back(std::get<1>(*it).poly);
341 #ifdef SMTRAT_DEVOPTION_Statistics
342 getStatistic().resultantBarrierCreated();
347 if (!resultants.empty()) {
349 for (
auto &res : resultants) {
350 if (res.first == t.
poly) {
351 noDisc1.push_back(res.second);
353 if (res.second == t.
poly) {
354 noDisc1.push_back(res.first);
357 if (!noDisc1.empty()) {
360 for (
auto it = noDisc1.begin(); it != noDisc1.end();) {
362 for (
auto &res : resultants) {
363 if ((res.first == *it && res.second != t.
poly) ||
364 (res.second == *it && res.first != t.
poly)) {
365 it = noDisc1.erase(it);
376 std::vector<std::pair<Poly, Poly>> tmpResultants;
377 if (!upper.empty()) {
380 for (
auto it = upper.begin() + 1; it != upper.end(); it++) {
381 if (std::get<0>(*(it - 1)) == std::get<0>(*it) &&
382 std::get<1>(*(it - 1)).deg > std::get<1>(*it).deg) {
383 std::iter_swap(it - 1, it);
387 auto mark = upper.end()-1;
388 while (mark != upper.begin()) {
389 auto cur = std::min_element(upper.begin(), mark, [](
auto const &t1,
auto const &t2) {
390 return std::get<1>(t1).deg < std::get<1>(t2).deg;
393 for (
auto it = cur + 1; it != mark+1; it++) {
394 tmpResultants.emplace_back(std::make_pair(std::get<1>(*cur).poly, std::get<1>(*it).poly));
396 if (std::find_if(lower.begin(), lower.end(),
397 [&](
auto const &t1) { return (std::get<1>(t1).poly == std::get<1>(*it).poly); }) != lower.end()) {
398 noLdcf.emplace_back(std::get<1>(*it).poly);
404 #ifdef SMTRAT_DEVOPTION_Statistics
405 getStatistic().resultantBarrierCreated();
410 if (!tmpResultants.empty()) {
412 for (
auto &res : tmpResultants) {
413 if (res.first == t.
poly) {
414 noDisc2.push_back(res.second);
416 if (res.second == t.
poly) {
417 noDisc2.push_back(res.first);
420 if (!noDisc2.empty()) {
423 for (
auto it = noDisc2.begin(); it != noDisc2.end();) {
425 for (
auto &res : tmpResultants) {
426 if ((res.first == *it && res.second != t.
poly) ||
427 (res.second == *it && res.first != t.
poly)) {
428 it = noDisc2.erase(it);
436 resultants.insert(resultants.end(), tmpResultants.begin(), tmpResultants.end());
437 tmpResultants.clear();
441 if (!lower.empty() && !upper.empty()) {
442 resultants.emplace_back(std::make_pair(std::get<1>(lower.back()).poly,
443 std::get<1>(upper.front()).poly));
447 for (
auto &poly : polys[i]) {
450 SMTRAT_LOG_TRACE(
"smtrat.cad",
"Add discriminant: " << disc <<
" (if not const)");
456 SMTRAT_LOG_TRACE(
"smtrat.cad",
"Add leadcoefficient: " << ldcf <<
" (if not const)");
462 SMTRAT_LOG_WARN(
"smtrat.cad",
"Building failed: Incorrect heuristic input");
466 for (
auto &poly : polys[i]) {
467 if (poly.poly != t.
poly) {
472 if (coeff.has_value()) {
473 SMTRAT_LOG_TRACE(
"smtrat.cad",
"Add result of coeffNonNull: " << coeff.value() <<
" (if not const)");
476 if (sectionHeuristic == 1) {
479 SMTRAT_LOG_TRACE(
"smtrat.cad",
"Add discriminant: " << disc <<
" (if not const)");
494 Sector §or = std::get<Sector>(cell[i]);
500 std::vector<TagPoly> upper1;
501 std::vector<TagPoly> lower1;
502 std::vector<std::tuple<RAN, TagPoly, int>> upper2;
503 std::vector<std::tuple<RAN, TagPoly, int>> lower2;
504 std::vector<Poly> noLdcf;
510 for (
const auto &poly : polys[i]) {
515 if (isolatedRoots.empty()) {
524 std::optional<RAN> closestLower, closestUpper;
525 int rootIdx = 0, lowerRootIdx = 0, upperRootIdx = 0;
527 for (
const auto &root : isolatedRoots) {
529 if (root < pointComp) {
531 if (!closestLower || *closestLower < root) {
533 lowerRootIdx = rootIdx;
538 if (!closestUpper || root < *closestUpper) {
540 upperRootIdx = rootIdx;
551 asRootExpr(rootVariable, poly.poly, lowerRootIdx),
560 closestUpper < (*(sector.
highBound)).isolatedRoot) {
562 asRootExpr(rootVariable, poly.poly, upperRootIdx),
570 }
else if (sectorHeuristic == 1) {
573 std::optional<RAN> closestLower, closestUpper;
574 for (
const auto &poly : polys[i]) {
579 if (isolatedRoots.empty()) {
588 bool up =
false, low =
false;
590 for (
const auto &root : isolatedRoots) {
592 if (root < pointComp) {
595 if (!closestLower || *closestLower < root) {
598 lower2.emplace_back(std::make_tuple(root, poly, rootIdx));
599 }
else if (*closestLower == root) {
600 lower2.emplace_back(std::make_tuple(root, poly, rootIdx));
605 if (!closestUpper || root < *closestUpper) {
608 upper2.emplace_back(std::make_tuple(root, poly, rootIdx));
609 }
else if (*closestUpper == root) {
610 upper2.emplace_back(std::make_tuple(root, poly, rootIdx));
619 lower1.push_back(poly);
623 upper1.push_back(poly);
628 if (!lower2.empty()) {
629 for (
auto elem : lower2) {
630 std::get<1>(elem).deg =
getDegree(std::get<1>(elem), rootVariable);
632 auto smallest = *std::min_element(lower2.begin(), lower2.end(),
633 [](
auto const &t1,
auto const &t2) {
634 return std::get<1>(t1).deg < std::get<1>(t2).deg;
637 curLow = std::get<1>(smallest);
640 std::get<0>(smallest)};
645 if (!upper2.empty()) {
646 for (
auto elem : upper2) {
647 std::get<1>(elem).deg =
getDegree(std::get<1>(elem), rootVariable);
649 auto smallest = *std::min_element(upper2.begin(), upper2.end(),
650 [](
auto const &t1,
auto const &t2) {
651 return std::get<1>(t1).deg < std::get<1>(t2).deg;
654 curUp = std::get<1>(smallest);
657 std::get<0>(smallest)};
663 for (
auto &poly : polys[i]) {
665 noLdcf.emplace_back(poly.poly);
669 }
else if (sectorHeuristic == 2) {
671 for (
const auto &poly : polys[i]) {
676 if (isolatedRoots.empty()) {
685 if (isolatedRoots.front() > pointComp) {
688 << isolatedRoots.front());
689 upper2.emplace_back(std::make_tuple(isolatedRoots.front(), poly, 1));
690 }
else if (isolatedRoots.back() < pointComp) {
693 << isolatedRoots.back());
694 lower2.emplace_back(std::make_tuple(isolatedRoots.back(), poly,
695 isolatedRoots.end() -
696 isolatedRoots.begin()));
698 auto lb = std::lower_bound(isolatedRoots.begin(), isolatedRoots.end(),
701 SMTRAT_LOG_DEBUG(
"smtrat.cad",
"Smallest root above PointComp(2): " << *lb);
703 std::make_tuple(*lb, poly, (
int) (lb - isolatedRoots.begin()) + 1));
705 "Biggest root below PointComp(2): " << *(lb - 1));
706 lower2.emplace_back(std::make_tuple(*(lb - 1), poly,
707 (
int) (lb - isolatedRoots.begin())));
712 std::sort(lower2.begin(), lower2.end(), [](
auto const &t1,
auto const &t2) {
713 return std::get<0>(t1) < std::get<0>(t2);
715 std::sort(upper2.begin(), upper2.end(), [](
auto const &t1,
auto const &t2) {
716 return std::get<0>(t1) < std::get<0>(t2);
719 if (!lower2.empty()) {
721 auto curPos = lower2.rbegin();
723 auto it = lower2.rbegin() + 1;
724 while (it != lower2.rend()) {
725 if (std::get<0>(*it) == std::get<0>(*curPos)) {
727 curDeg = (int)
getDegree(std::get<1>(*curPos), rootVariable);
729 int degree = (int)
getDegree(std::get<1>(*it), rootVariable);
730 if (degree < curDeg) {
739 std::iter_swap(curPos.base() - 1, lower2.end() - 1);
743 curLow = std::get<1>(lower2.back());
745 asRootExpr(rootVariable, curLow.
poly, std::get<2>(lower2.back())),
746 std::get<0>(lower2.back())};
754 if (!upper2.empty()) {
756 auto curPos = upper2.begin();
758 auto it = upper2.begin() + 1;
759 while (it != upper2.end()) {
760 if (std::get<0>(*it) == std::get<0>(*curPos)) {
762 curDeg = (int)
getDegree(std::get<1>(*curPos), rootVariable);
764 int degree = (int)
getDegree(std::get<1>(*it), rootVariable);
765 if (degree < curDeg) {
774 std::iter_swap(curPos, upper2.begin());
777 curUp = std::get<1>(upper2.front());
779 asRootExpr(rootVariable, curUp.
poly, std::get<2>(upper2.front())),
780 std::get<0>(upper2.front())};
787 }
else if (sectorHeuristic == 3) {
789 for (
auto &poly : polys[i]) {
794 if (isolatedRoots.empty()) {
803 poly.deg =
getDegree(poly, rootVariable);
804 if (isolatedRoots.front() > pointComp) {
807 << isolatedRoots.front());
808 upper2.emplace_back(std::make_tuple(isolatedRoots.front(), poly, 1));
809 }
else if (isolatedRoots.back() < pointComp) {
812 << isolatedRoots.back());
813 lower2.emplace_back(std::make_tuple(isolatedRoots.back(), poly, (
int) (isolatedRoots.end() - isolatedRoots.begin())));
815 auto lb = std::lower_bound(isolatedRoots.begin(), isolatedRoots.end(), pointComp);
817 SMTRAT_LOG_DEBUG(
"smtrat.cad",
"Smallest root above PointComp(2): " << *lb);
818 upper2.emplace_back(std::make_tuple(*lb, poly, (
int) (lb - isolatedRoots.begin()) + 1));
820 "Biggest root below PointComp(2): " << *(lb - 1));
821 lower2.emplace_back(std::make_tuple(*(lb - 1), poly, (
int) (lb - isolatedRoots.begin())));
825 std::sort(lower2.begin(), lower2.end(), [](
auto const &t1,
auto const &t2) {
826 return std::get<0>(t1) < std::get<0>(t2);
828 std::sort(upper2.begin(), upper2.end(), [](
auto const &t1,
auto const &t2) {
829 return std::get<0>(t1) < std::get<0>(t2);
832 if (!lower2.empty()) {
835 for (
auto it = lower2.begin() + 1; it != lower2.end(); it++) {
836 if (std::get<0>(*(it - 1)) == std::get<0>(*it) &&
837 std::get<1>(*(it - 1)).deg > std::get<1>(*it).deg) {
838 std::iter_swap(it - 1, it);
843 curLow = std::get<1>(lower2.back());
845 asRootExpr(rootVariable, curLow.
poly, std::get<2>(lower2.back())),
846 std::get<0>(lower2.back())};
853 if (!upper2.empty()) {
856 for (
auto it = upper2.begin() + 1; it != upper2.end(); it++) {
857 if (std::get<0>(*(it - 1)) == std::get<0>(*it) &&
858 std::get<1>(*(it - 1)).deg > std::get<1>(*it).deg) {
859 std::iter_swap(it - 1, it);
864 curUp = std::get<1>(upper2.front());
866 asRootExpr(rootVariable, curUp.
poly, std::get<2>(upper2.front())),
867 std::get<0>(upper2.front())};
875 SMTRAT_LOG_WARN(
"smtrat.cad",
"Building failed: Incorrect heuristic input");
884 for (
auto &poly : polys[i]) {
888 "Add discriminant(" << poly.poly <<
") = " << disc <<
" (if not const)");
893 if (coeff.has_value()) {
895 "Add result of coeffNonNull: " << coeff.value() <<
" (if not const)");
903 std::vector<std::pair<Poly, Poly>> resultants;
906 sector.
lowBound->boundFunction.poly() !=
907 sector.
highBound->boundFunction.poly()) {
909 resultants.emplace_back(std::make_pair(curLow.
poly, curUp.
poly));
912 if (sectorHeuristic == 1) {
915 for (
const auto &l : lower1) {
916 if (l.poly != curLow.
poly) {
917 resultants.emplace_back(std::make_pair(l.poly, curLow.
poly));
920 #ifdef SMTRAT_DEVOPTION_Statistics
921 getStatistic().resultantBarrierCreated();
926 for (
const auto &u : upper1) {
927 if (u.poly != curUp.
poly) {
928 resultants.emplace_back(std::make_pair(u.poly, curUp.
poly));
931 #ifdef SMTRAT_DEVOPTION_Statistics
932 getStatistic().resultantBarrierCreated();
937 for (
auto &element : lower2) {
938 if (std::find_if(upper2.begin(), upper2.end(),
939 [&](
auto const &t1) { return (std::get<1>(t1).poly == std::get<1>(element).poly); }) !=
941 noLdcf.emplace_back(std::get<1>(element).poly);
945 for (
auto &element : upper2) {
946 if (std::find_if(lower2.begin(), lower2.end(),
947 [&](
auto const &t1) { return (std::get<1>(t1).poly == std::get<1>(element).poly); }) !=
949 noLdcf.emplace_back(std::get<1>(element).poly);
953 }
else if (sectorHeuristic == 2) {
956 for (
auto it = lower2.begin(); it != lower2.end() - 1; it++) {
957 resultants.emplace_back(std::make_pair(std::get<1>(*it).poly,
958 std::get<1>(*(it + 1)).poly));
959 #ifdef SMTRAT_DEVOPTION_Statistics
960 getStatistic().resultantBarrierCreated();
966 for (
auto it = upper2.begin(); it != upper2.end() - 1; it++) {
967 resultants.emplace_back(std::make_pair(std::get<1>(*it).poly,
968 std::get<1>(*(it + 1)).poly));
969 #ifdef SMTRAT_DEVOPTION_Statistics
970 getStatistic().resultantBarrierCreated();
976 if (!lower2.empty() && std::find_if(upper2.begin(), upper2.end(), [&](
auto const &t1) {
977 return (std::get<1>(t1).poly == std::get<1>(*lower2.begin()).poly);
978 }) != upper2.end()) {
979 noLdcf.emplace_back(std::get<1>(*lower2.begin()).poly);
981 if (!upper2.empty() && std::find_if(lower2.begin(), lower2.end(), [&](
auto const &t1) {
982 return (std::get<1>(t1).poly == std::get<1>(*(upper2.end() - 1)).poly);
983 }) != lower2.end()) {
984 noLdcf.emplace_back(std::get<1>(*(upper2.end() - 1)).poly);
987 }
else if (sectorHeuristic == 3) {
989 if (!lower2.empty()) {
992 for (
auto it = lower2.begin() + 1; it != lower2.end(); it++) {
993 if (std::get<0>(*(it - 1)) == std::get<0>(*it) &&
994 std::get<1>(*(it - 1)).deg < std::get<1>(*it).deg) {
995 std::iter_swap(it - 1, it);
999 auto mark = lower2.rend()-1;
1000 while (mark != lower2.rbegin()) {
1001 auto cur = std::min_element(lower2.rbegin(), mark,
1002 [](
auto const &t1,
auto const &t2) {
1003 return std::get<1>(t1).deg < std::get<1>(t2).deg;
1006 for (
auto it = cur + 1; it != mark+1; it++) {
1007 resultants.emplace_back(std::get<1>(*cur).poly, std::get<1>(*it).poly);
1009 if (std::find_if(upper2.begin(), upper2.end(),
1010 [&](
auto const &t1) { return (std::get<1>(t1).poly == std::get<1>(*it).poly); }) !=
1012 noLdcf.emplace_back(std::get<1>(*it).poly);
1017 #ifdef SMTRAT_DEVOPTION_Statistics
1018 getStatistic().resultantBarrierCreated();
1023 if (!upper2.empty()) {
1026 for (
auto it = upper2.begin() + 1; it != upper2.end(); it++) {
1027 if (std::get<0>(*(it - 1)) == std::get<0>(*it) &&
1028 std::get<1>(*(it - 1)).deg > std::get<1>(*it).deg) {
1029 std::iter_swap(it - 1, it);
1033 auto mark = upper2.end()-1;
1034 while (mark != upper2.begin()) {
1035 auto cur = std::min_element(upper2.begin(), mark,
1036 [](
auto const &t1,
auto const &t2) {
1037 return std::get<1>(t1).deg <
1038 std::get<1>(t2).deg;
1041 for (
auto it = cur + 1; it != mark+1; it++) {
1042 resultants.emplace_back(std::get<1>(*cur).poly, std::get<1>(*it).poly);
1044 if (std::find_if(lower2.begin(), lower2.end(),
1045 [&](
auto const &t1) { return (std::get<1>(t1).poly == std::get<1>(*it).poly); }) !=
1047 noLdcf.emplace_back(std::get<1>(*it).poly);
1052 #ifdef SMTRAT_DEVOPTION_Statistics
1053 getStatistic().resultantBarrierCreated();
1059 SMTRAT_LOG_WARN(
"smtrat.cad",
"Building failed: Incorrect heuristic input");
1060 return std::nullopt;
1071 for (
auto &poly : polys[i]) {
1072 if (!
contains(noLdcf, poly.poly)) {
1074 SMTRAT_LOG_TRACE(
"smtrat.cad",
"Add leadcoefficient(" << poly.poly <<
") = " << ldcf <<
" (if not const)");
const std::vector< carl::Variable > & variableOrder
Variables can also be indexed by level.
std::optional< Poly > coeffNonNull(const TagPoly &boundCandidate)
bool isPointRootOfPoly(const std::size_t polyLevel, const Poly &poly)
bool vanishesEarly(const std::size_t polyLevel, const Poly &poly)
Check if an n-variate 'poly' p(x1,..,xn) with n>=1 already becomes the zero poly after plugging in p(...
std::vector< RAN > isolateLastVariableRoots(const std::size_t polyLevel, const Poly &poly)
src/lib/datastructures/mcsat/onecellcad/OneCellCAD.h Given a poly p(x1,..,xn), return all roots of th...
bool isMainPointInsideCell(const CADCell &cell)
const RealAlgebraicPoint< Rational > & point
OneCellCAD(const std::vector< carl::Variable > &variableOrder, const RealAlgebraicPoint< Rational > &point)
std::size_t dim() const
Give the dimension/number of components of this point.
std::optional< CADCell > constructCADCellEnclosingPoint(std::vector< std::vector< TagPoly >> &polys, int sectionHeuristic, int sectorHeuristic)
Construct a single CADCell that contains the given 'point' and is sign-invariant for the given polyno...
void sort(T *array, int size, LessThan lt)
std::vector< std::variant< Sector, Section > > CADCell
Represent a single cell [brown15].
bool isNonConstIrreducible(const PolyType &poly)
bool contains(const std::vector< TagPoly > &polys, const Poly &poly)
std::vector< Poly > asMultiPolys(const std::vector< TagPoly > polys)
void appendOnCorrectLevel(const Poly &poly, InvarianceType tag, std::vector< std::vector< TagPoly >> &polys, std::vector< carl::Variable > variableOrder)
std::size_t getDegree(TagPoly p, carl::Variable v)
bool polyVarsAreAllInList(const std::vector< PolyType > &polys, const std::vector< carl::Variable > &variables)
Poly leadcoefficient(const carl::Variable &mainVariable, const Poly &p)
MultivariateRootT asRootExpr(carl::Variable rootVariable, Poly poly, std::size_t rootIdx)
CADCell fullSpaceCell(std::size_t cellComponentCount)
void addResultants(std::vector< std::pair< Poly, Poly >> &resultants, std::vector< std::vector< TagPoly >> &polys, carl::Variable mainVar, const std::vector< carl::Variable > &variableOrder)
std::vector< std::pair< Poly, Poly > > duplicateElimination(std::vector< std::pair< Poly, Poly >> vec)
bool hasOnlyNonConstIrreducibles(const std::vector< PolyType > &polys)
Poly discriminant(const carl::Variable &mainVariable, const Poly &p)
Projection related utilities for onecellcad.
Class to create the formulas for axioms.
carl::MultivariatePolynomial< Rational > Poly
#define SMTRAT_LOG_TRACE(channel, msg)
#define SMTRAT_LOG_WARN(channel, msg)
#define SMTRAT_LOG_INFO(channel, msg)
#define SMTRAT_LOG_DEBUG(channel, msg)
Represent a cell's (closed-interval-boundary) component along th k-th axis.
Represent a cell's open-interval boundary object along one single axis by two irreducible,...
std::optional< Section > highBound
A std:nullopt highBound represents infinity.
std::optional< Section > lowBound
A std::nullopt lowBound represents negative infinity.