3 #include <carl-arith/poly/umvpoly/functions/Factorization.h>
4 #include <carl-arith/poly/umvpoly/functions/PrimitivePart.h>
5 #include <carl-arith/poly/umvpoly/functions/Resultant.h>
6 #include <carl-arith/poly/umvpoly/functions/SquareFreePart.h>
7 #include <carl-arith/poly/umvpoly/functions/to_univariate_polynomial.h>
11 namespace projection {
18 template<
typename Poly>
20 if (is_zero(p))
return false;
21 if (p.is_constant())
return true;
22 auto def = carl::definiteness(p);
23 if (def == carl::Definiteness::POSITIVE)
return true;
24 if (def == carl::Definiteness::NEGATIVE)
return true;
31 template<
typename Poly>
33 auto res = carl::pseudo_primitive_part(carl::squareFreePart(p)).normalized();
34 SMTRAT_LOG_TRACE(
"smtrat.cad.projection",
"Normalizing " << p <<
" to " << res);
47 template<
typename Poly>
50 SMTRAT_LOG_TRACE(
"smtrat.cad.projection",
"resultant(" << p <<
", " << q <<
") = " << res);
62 template<
typename Poly>
65 SMTRAT_LOG_TRACE(
"smtrat.cad.projection",
"discriminant(" << p <<
") = " << dis);
73 template<
typename Poly>
76 this->emplace_back(p);
77 while (!is_zero(this->back())) {
78 this->emplace_back(this->back());
79 this->back().truncate();
82 SMTRAT_LOG_TRACE(
"smtrat.cad.projection",
"Reducta of " << p <<
" = " << *
this);
89 template<
typename Poly>
91 return carl::principalSubresultantsCoefficients(p, q);
94 template<
typename Poly,
typename Callback>
97 for (
const auto& fact: carl::factorization(carl::MultivariatePolynomial<Rational>(p),
false)) {
98 auto uf = carl::to_univariate_polynomial(fact.first, p.main_var());
Poly resultant(carl::Variable variable, const Poly &p, const Poly &q)
Computes the resultant of two polynomials.
void returnPoly(const Poly &p, Callback &&cb)
Poly discriminant(carl::Variable variable, const Poly &p)
Computes the discriminant of a polynomial.
std::vector< Poly > PSC(const Poly &p, const Poly &q)
Computes the Principal Subresultant Coefficients of two polynomials.
Poly normalize(const Poly &p)
Normalizes the given Poly by removing constant and duplicate factors.
bool doesNotVanish(const Poly &p)
Tries to determine whether the given Poly vanishes for some assignment.
Poly discriminant(const carl::Variable &mainVariable, const Poly &p)
Projection related utilities for onecellcad.
Poly resultant(const carl::Variable &mainVariable, const Poly &p1, const Poly &p2)
Class to create the formulas for axioms.
carl::MultivariatePolynomial< Rational > Poly
#define SMTRAT_LOG_TRACE(channel, msg)
#define SMTRAT_LOG_DEBUG(channel, msg)
Construct the set of reducta of the given polynomial.