SMT-RAT  24.02
Toolbox for Strategic and Parallel Satisfiability-Modulo-Theories Solving
McCallum.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "utils.h"
4 
5 namespace smtrat {
6 namespace cad {
7 namespace projection {
8 
9 /**
10  * Contains the implementation of McCallums projection operator as specified in @cite McCallum1985.
11  */
12 namespace mccallum {
13 
14 /**
15  * Implements the part of McCallums projection operator from @cite McCallum1985 that deals with a single polynomial `p`:
16  * \f$ coefficients(p) \cup \{ discriminant(p) \} \f$
17  */
18 template<typename Poly, typename Callback>
19 void single(const Poly& p, carl::Variable variable, Callback&& cb) {
20  SMTRAT_LOG_DEBUG("smtrat.cad.projection", "McCallum_single(" << p << ")");
21  SMTRAT_LOG_DEBUG("smtrat.cad.projection", "\t-> discriminant " << projection::discriminant(variable, p));
22  cb(projection::discriminant(variable, p));
23  for (const auto& coeff : p.coefficients()) {
24  if (coeff.is_constant()) continue;
25  SMTRAT_LOG_DEBUG("smtrat.cad.projection", "\t-> coefficient " << coeff);
26  returnPoly(projection::normalize(carl::to_univariate_polynomial(coeff, variable)), cb);
27  }
28 }
29 
30 /**
31  * Implements the part of McCallums projection operator from @cite McCallum1985 that deals with two polynomials `p` and `q`:
32  * \f$ \{ resultant(p, q) \} \f$
33  */
34 template<typename Poly, typename Callback>
35 void paired(const Poly& p, const UPoly& q, carl::Variable variable, Callback&& cb) {
36  SMTRAT_LOG_DEBUG("smtrat.cad.projection", "McCallum_paired(" << p << ", " << q << ")");
37  SMTRAT_LOG_DEBUG("smtrat.cad.projection", "\t-> resultant " << projection::resultant(variable, p, q));
38  returnPoly(projection::resultant(variable, p, q), cb);
39 }
40 
41 } // namespace mccallum
42 } // namespace projection
43 } // namespace cad
44 } // namespace smtrat
void paired(const Poly &p, const UPoly &q, carl::Variable variable, Callback &&cb)
Implements the part of McCallums projection operator from that deals with two polynomials p and q: .
Definition: McCallum.h:35
void single(const Poly &p, carl::Variable variable, Callback &&cb)
Implements the part of McCallums projection operator from that deals with a single polynomial p: .
Definition: McCallum.h:19
Poly resultant(carl::Variable variable, const Poly &p, const Poly &q)
Computes the resultant of two polynomials.
Definition: utils.h:48
void returnPoly(const Poly &p, Callback &&cb)
Definition: utils.h:95
Poly discriminant(carl::Variable variable, const Poly &p)
Computes the discriminant of a polynomial.
Definition: utils.h:63
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