4 #include <carl-arith/poly/umvpoly/functions/Substitution.h>
5 #include <carl-formula/model/evaluation/ModelEvaluation.h>
15 carl::Sign
sgn(carl::Variable v,
const Poly& p,
const RAN& r) {
19 if (res.isRational()) {
21 }
else if (res.isRAN()) {
25 return carl::Sign::ZERO;
28 std::optional<ModelValue>
get_root(carl::Variable v,
const Poly& p) {
29 auto res = carl::real_roots(carl::to_univariate_polynomial(p, v));
30 if (!res.is_univariate() || res.roots().empty()) {
33 return res.roots().front();
39 while (carl::is_zero(
evaluate(v, p, r))) {
50 auto res = carl::real_roots(carl::to_univariate_polynomial(p, v));
51 if (!res.is_univariate() || res.roots().empty()) {
54 test = sample_below(res.roots().front());
58 test = sample_above(res.roots().back());
62 for (std::size_t i = 0; i < res.roots().size() - 1; ++i) {
63 test = sample_between(res.roots()[i], res.roots()[i+1]);
Rational evaluate(carl::Variable v, const Poly &p, const Rational &r)
ModelValue get_non_root(carl::Variable v, const Poly &p)
carl::Sign sgn_of_invariant_poly(carl::Variable v, const Poly &p)
std::optional< ModelValue > get_value_for_sgn(carl::Variable v, const Poly &p, carl::Sign sign)
std::optional< ModelValue > get_root(carl::Variable v, const Poly &p)
carl::Sign sgn(carl::Variable v, const Poly &p, const RAN &r)
bool is_constant(const T &t)
Checks whether the constraint is constant, i.e.
bool substitute(const FormulaT &constr, const carl::Variable var, const carl::vs::Term< Poly > &term, FormulaT &result)
carl::ModelValue< Rational, Poly > ModelValue
carl::Model< Rational, Poly > Model
carl::MultivariatePolynomial< Rational > Poly