SMT-RAT  24.02
Toolbox for Strategic and Parallel Satisfiability-Modulo-Theories Solving
Collins.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "utils.h"
4 
5 #include <carl-arith/poly/umvpoly/functions/Derivative.h>
6 
7 namespace smtrat {
8 namespace cad {
9 namespace projection {
10 
11 /**
12  * Contains the implementation of Collins projection operator as specified in @cite Collins1975 below Theorem 4.
13  */
14 namespace collins {
15 
16 /**
17  * Implements the part of Collins projection operator from @cite Collins1975 that deals with a single polynomial `p`:
18  * \f$ \bigcup_{B \in RED(p)} \{ ldcf(B) \} \cup PSC(B, B') \f$
19  */
20 template<typename Poly, typename Callback>
21 void single(const Poly& p, carl::Variable variable, Callback&& cb) {
22  SMTRAT_LOG_DEBUG("smtrat.cad.projection", "Collins_single(" << p << ")");
23 
24  // Separate into
25  // - leading coefficients of reducta which are all coefficients
26  // - PSC of all reducta
27  for (const auto& coeff : p.coefficients()) {
28  SMTRAT_LOG_DEBUG("smtrat.cad.projection", "reductum lcoeff: " << coeff);
29  returnPoly(projection::normalize(carl::to_univariate_polynomial(coeff, variable)), cb);
30  }
31 
33  projection::Reducta<Poly> RED_d(carl::derivative(p));
34  for (std::size_t i = 0; i < RED_d.size(); ++i) {
35  const auto& reducta = RED_p[i];
36  const auto& reducta_derivative = RED_d[i];
37  for (const auto& psc : projection::PSC(reducta, reducta_derivative)) {
38  SMTRAT_LOG_DEBUG("smtrat.cad.projection", "reducta psc: " << psc);
39  returnPoly(projection::normalize(carl::switch_main_variable(psc, variable)), cb);
40  }
41  }
42 }
43 
44 /**
45  * Implements the part of Collins projection operator from @cite Collins1975 that deals with two polynomials `p` and `q`:
46  * \f$ \bigcup_{B_1 \in RED(p), B_2 \in RED(q)} PSC(B_1, B_2) \f$
47  */
48 template<typename Poly, typename Callback>
49 void paired(const Poly& p, const UPoly& q, carl::Variable variable, Callback&& cb) {
50  SMTRAT_LOG_DEBUG("smtrat.cad.projection", "Collins_paired(" << p << ", " << q << ")");
53  for (const auto& reducta_p : RED_p) {
54  for (const auto& reducta_q : RED_q) {
55  for (const auto& psc : projection::PSC(reducta_p, reducta_q)) {
56  SMTRAT_LOG_DEBUG("smtrat.cad.projection", "reducta psc: " << psc);
57  returnPoly(projection::normalize(carl::switch_main_variable(psc, variable)), cb);
58  }
59  }
60  }
61 }
62 
63 } // namespace collins
64 } // namespace projection
65 } // namespace cad
66 } // namespace smtrat
void paired(const Poly &p, const UPoly &q, carl::Variable variable, Callback &&cb)
Implements the part of Collins projection operator from that deals with two polynomials p and q: .
Definition: Collins.h:49
void single(const Poly &p, carl::Variable variable, Callback &&cb)
Implements the part of Collins projection operator from that deals with a single polynomial p: .
Definition: Collins.h:21
void returnPoly(const Poly &p, Callback &&cb)
Definition: utils.h:95
std::vector< Poly > PSC(const Poly &p, const Poly &q)
Computes the Principal Subresultant Coefficients of two polynomials.
Definition: utils.h:90
Poly normalize(const Poly &p)
Normalizes the given Poly by removing constant and duplicate factors.
Definition: utils.h:32
carl::UnivariatePolynomial< Poly > UPoly
Definition: common.h:17
Class to create the formulas for axioms.
carl::MultivariatePolynomial< Rational > Poly
Definition: types.h:25
#define SMTRAT_LOG_DEBUG(channel, msg)
Definition: logging.h:35
Construct the set of reducta of the given polynomial.
Definition: utils.h:74