SMT-RAT  24.02
Toolbox for Strategic and Parallel Satisfiability-Modulo-Theories Solving
projections.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <optional>
4 
5 #include "../common.h"
6 
7 #include "polynomials.h"
8 #include "roots.h"
9 
10 #include <carl-arith/poly/ctxpoly/Functions.h>
11 #include <carl-arith/poly/libpoly/Functions.h>
12 
13 #include <carl-arith/poly/umvpoly/MultivariatePolynomial.h>
14 #include <carl-arith/poly/umvpoly/functions/Derivative.h>
15 #include <carl-arith/poly/Conversion.h>
16 
17 #include "../OCApproximationStatistics.h"
18 #include "../CADCellsStatistics.h"
19 
21 
22 namespace detail {
23 
25  boost::container::flat_map<PolyRef, PolyRef> res;
26  std::optional<PolyRef> disc;
27  std::optional<PolyRef> ldcf;
28  std::vector<PolyRef> factors_nonconst;
29  boost::container::flat_map<carl::Variable, PolyRef> derivatives;
30  std::size_t total_degree = 0;
31  std::vector<std::size_t> monomial_total_degrees;
32  std::vector<std::size_t> monomial_degrees;
33 };
34 
36  std::map<PolyRef, carl::RealRootsResult<RAN>> real_roots;
37  std::map<PolyRef, bool> is_zero;
38 };
39 
40 }
41 
42 /**
43  * Encapsulates all computations on polynomials.
44  * Computations are cached with respect to a PolyPool.
45  */
46 class Projections {
48  std::vector<std::vector<detail::PolyProperties>> m_poly_cache;
49  std::vector<std::map<Assignment,detail::AssignmentProperties>> m_assignment_cache;
50 
51  auto& cache(PolyRef p) {
52  assert(p.level > 0);
53  if (p.level-1 >= m_poly_cache.size()) {
54  m_poly_cache.resize(p.level);
55  }
56  if (p.id >= m_poly_cache[p.level-1].size()) {
57  m_poly_cache[p.level-1].resize(p.id+1);
58  }
59  return m_poly_cache[p.level-1][p.id];
60  }
61  const auto& cache(PolyRef p) const {
62  assert(p.level > 0);
63  assert(p.level-1 < m_poly_cache.size());
64  assert(p.id < m_poly_cache[p.level-1].size());
65  return m_poly_cache[p.level-1][p.id];
66  }
67  bool has_cache(PolyRef p) const {
68  assert(p.level > 0);
69  return (p.level-1 < m_poly_cache.size()) && (p.id < m_poly_cache[p.level-1].size());
70  }
71 
72  size_t level_of(const Assignment& a) const {
73  // return a.size();
74  std::size_t level = m_pool.var_order().size();
75  for(auto i = m_pool.var_order().rbegin(); i != m_pool.var_order().rend(); i++) {
76  if (a.find(*i) != a.end()) return level;
77  assert(level>0);
78  level--;
79  }
80  return level;
81  }
82 
83  auto& cache(const Assignment& a) {
84  m_assignment_cache.resize(level_of(a)+1);
85  return m_assignment_cache[level_of(a)][a];
86  }
87  const auto& cache(const Assignment& a) const {
88  assert(level_of(a) < m_assignment_cache.size());
89  assert(m_assignment_cache[level_of(a)].find(a) != m_assignment_cache[level_of(a)].end());
90  return m_assignment_cache[level_of(a)].at(a);
91  }
92 
93 public:
94  auto main_var(PolyRef p) const {
95  return m_pool.var_order()[p.level-1];
96  }
97 
98 private:
100  auto vars = carl::variables(m_pool(p));
101  // for(auto i = m_pool.var_order().rbegin(); i != m_pool.var_order().rend(); i++) {
102  // if (!vars.has(*i)) ass.erase(*i);
103  // else return ass;
104  // }
105  for (const auto var : m_pool.var_order()) {
106  if (!vars.has(var)) ass.erase(var);
107  }
108  return ass;
109  }
110 
112  auto vars = carl::variables(m_pool(p));
113  // for(auto i = m_pool.var_order().rbegin(); i != m_pool.var_order().rend(); i++) {
114  // if (!vars.has(*i) || *i == main_var(p)) ass.erase(*i);
115  // else return ass;
116  // }
117  for (const auto var : m_pool.var_order()) {
118  if (!vars.has(var) || var == main_var(p)) ass.erase(var);
119  }
120  return ass;
121  }
122 
123 public:
124  Projections(PolyPool& pool) : m_pool(pool) {}
125 
126  auto& polys() { return m_pool; }
127  const auto& polys() const { return m_pool; }
128 
129  // Clearing caches disabled as higher-level polynomials might still be needed (mainly in filtering):
130 
131  /// Clears all polynomials of the specified level and higher in the polynomial cache as well as their projection results.
132  void clear_cache(size_t /*level*/) {
133  return;
134  // assert(level > 0);
135  // m_pool.clear_levels(level);
136  // if (level <= m_poly_cache.size()) {
137  // m_poly_cache.erase(m_poly_cache.begin() + (level - 1), m_poly_cache.end());
138  // }
139  // if (level < m_assignment_cache.size()) {
140  // m_assignment_cache.erase(m_assignment_cache.begin() + level, m_assignment_cache.end());
141  // }
142  }
143 
144  /// Clears all projections cached with respect to this assignment.
145  void clear_assignment_cache(const Assignment& /*assignment*/) {
146  return;
147  // for (auto lvl = level_of(assignment); lvl < m_assignment_cache.size(); lvl++) {
148  // for (auto it = m_assignment_cache[lvl].begin(); it != m_assignment_cache[lvl].end(); ) {
149  // bool is_subset = true;
150  // for (const auto& e : it->first) {
151  // if (assignment.find(e.first) == assignment.end() || assignment.at(e.first) != e.second) {
152  // is_subset = false;
153  // break;
154  // }
155  // }
156  // if (is_subset) {
157  // it = m_assignment_cache[lvl].erase(it);
158  // } else {
159  // it++;
160  // }
161  // }
162  // }
163  }
164 
166  assert(p.level == q.level && p.id != q.id);
167 
168  if (p.id > q.id) return res(q,p);
169  assert(p.id < q.id);
170 
171  if (cache(p).res.find(q) != cache(p).res.end()) {
172  return cache(p).res[q];
173  } else {
174  #ifdef SMTRAT_DEVOPTION_Statistics
175  OCApproximationStatistics::get_instance().resultant();
176  #endif
177  SMTRAT_STATISTICS_CALL(statistics().projection_start());
178  auto result = m_pool(carl::resultant(m_pool(p), m_pool(q)));
179  assert(!is_zero(result));
180  cache(p).res.emplace(q, result);
181  SMTRAT_STATISTICS_CALL(statistics().projection_end());
183  return result;
184  }
185  }
186 
187  bool know_disc(PolyRef p) const {
188  if (!has_cache(p)) return false;
189  return (bool) cache(p).disc;
190  }
191 
192  bool know_res(PolyRef p, PolyRef q) const {
193  assert(p.level == q.level && p.id != q.id);
194  if (p.id > q.id) return know_res(q,p);
195  assert(p.id < q.id);
196  if (!has_cache(p)) return false;
197  return cache(p).res.find(q) != cache(p).res.end();
198  }
199 
200  bool known(const Polynomial& p) const {
201  return m_pool.known(p);
202  }
203 
205  if (cache(p).disc) {
206  return *cache(p).disc;
207  } else {
208  #ifdef SMTRAT_DEVOPTION_Statistics
209  OCApproximationStatistics::get_instance().discriminant();
210  #endif
211  SMTRAT_STATISTICS_CALL(statistics().projection_start());
213  assert(!is_zero(result));
214  cache(p).disc = result;
215  SMTRAT_STATISTICS_CALL(statistics().projection_end());
217  return result;
218  }
219  }
220 
222  if (cache(p).ldcf) {
223  return *cache(p).ldcf;
224  } else {
225  #ifdef SMTRAT_DEVOPTION_Statistics
226  OCApproximationStatistics::get_instance().coefficient();
227  #endif
228  SMTRAT_STATISTICS_CALL(statistics().projection_start());
229  auto result = m_pool(m_pool(p).lcoeff());
230  assert(!is_zero(result));
231  cache(p).ldcf = result;
232  SMTRAT_STATISTICS_CALL(statistics().projection_end());
233  SMTRAT_STATISTICS_CALL(statistics().leading_coefficient(total_degree(result), degree(result), result.level));
234  return result;
235  }
236  }
237 
238  const std::vector<PolyRef>& factors_nonconst(PolyRef p) {
239  if (cache(p).factors_nonconst.empty()) {
240  SMTRAT_STATISTICS_CALL(statistics().projection_start());
241  for (const auto& factor : carl::irreducible_factors(m_pool(p), false)) {
242  cache(p).factors_nonconst.emplace_back(m_pool(factor));
243  SMTRAT_STATISTICS_CALL(statistics().factor(total_degree(m_pool(factor)), degree(m_pool(factor)), m_pool(factor).level));
244  }
245  SMTRAT_STATISTICS_CALL(statistics().projection_end());
246  }
247  return cache(p).factors_nonconst;
248  }
249 
250  bool is_zero(const Assignment& sample, PolyRef p) {
251  auto restricted_sample = restrict_assignment(sample, p);
252  assert(p.level == level_of(restricted_sample));
253  if (restricted_sample.empty()) return is_zero(p);
254  if (cache(restricted_sample).is_zero.find(p) == cache(restricted_sample).is_zero.end()) {
255  auto mv = carl::evaluate(carl::BasicConstraint<Polynomial>(m_pool(p), carl::Relation::EQ), restricted_sample);
256  assert(!indeterminate(mv));
257  cache(restricted_sample).is_zero[p] = (bool) mv;
258  }
259  return cache(restricted_sample).is_zero[p];
260  }
261 
262  size_t num_roots(const Assignment& sample, PolyRef p) {
263  assert(p.level >= level_of(sample)+1);
264  assert(!carl::is_constant(m_pool(p)));
265  auto restricted_sample = restrict_base_assignment(sample, p);
266  assert(level_of(restricted_sample) == p.base_level);
267  if (cache(restricted_sample).real_roots.find(p) == cache(restricted_sample).real_roots.end()) {
268  SMTRAT_STATISTICS_CALL(statistics().projection_start());
269  cache(restricted_sample).real_roots.emplace(p, carl::real_roots(m_pool(p), restricted_sample));
270  SMTRAT_STATISTICS_CALL(statistics().projection_end());
271  SMTRAT_STATISTICS_CALL(statistics().real_roots_result(cache(restricted_sample).real_roots.at(p)));
272  }
273  assert(cache(restricted_sample).real_roots.at(p).is_univariate());
274  return cache(restricted_sample).real_roots.at(p).roots().size();
275  }
276 
277  const std::vector<RAN>& real_roots(const Assignment& sample, PolyRef p) {
278  assert(p.level >= level_of(sample)+1);
279  assert(!carl::is_constant(m_pool(p)));
280  auto restricted_sample = restrict_base_assignment(sample, p);
281  assert(level_of(restricted_sample) == p.base_level);
282  if (cache(restricted_sample).real_roots.find(p) == cache(restricted_sample).real_roots.end()) {
283  SMTRAT_STATISTICS_CALL(statistics().projection_start());
284  cache(restricted_sample).real_roots.emplace(p, carl::real_roots(m_pool(p), restricted_sample));
285  SMTRAT_STATISTICS_CALL(statistics().projection_end());
286  SMTRAT_STATISTICS_CALL(statistics().real_roots_result(cache(restricted_sample).real_roots.at(p)));
287  }
288  assert(cache(restricted_sample).real_roots.at(p).is_univariate());
289  return cache(restricted_sample).real_roots.at(p).roots();
290  }
291 
292  const std::vector<RAN> real_roots_reducible(const Assignment& sample, PolyRef p) {
293  assert(!carl::is_constant(m_pool(p)));
294  auto restricted_sample = restrict_base_assignment(sample, p);
295  assert(level_of(restricted_sample) == p.base_level);
296  std::vector<RAN> roots;
297  for (const auto& factor : factors_nonconst(p)) {
298  if (factor.level == p.level) {
299  if (!is_nullified(restricted_sample, factor)) {
300  const auto& r = real_roots(restricted_sample, factor);
301  roots.insert(roots.end(), r.begin(), r.end());
302  }
303  }
304  }
305  std::sort(roots.begin(), roots.end());
306  return roots;
307  }
308 
309  bool is_nullified(const Assignment& sample, PolyRef p) {
310  //assert(p.level >= level_of(sample)+1);
311  assert(!carl::is_constant(m_pool(p)));
312  auto restricted_sample = restrict_base_assignment(sample, p);
313  assert(level_of(restricted_sample) == p.base_level);
314  auto poly = m_pool(p);
315  if (carl::is_linear(poly)) return false;
316  if (cache(restricted_sample).real_roots.find(p) == cache(restricted_sample).real_roots.end()) {
317  SMTRAT_STATISTICS_CALL(statistics().projection_start());
318  cache(restricted_sample).real_roots.emplace(p, carl::real_roots(m_pool(p), restricted_sample));
319  SMTRAT_STATISTICS_CALL(statistics().projection_end());
320  SMTRAT_STATISTICS_CALL(statistics().real_roots_result(cache(restricted_sample).real_roots.at(p)));
321  }
322  return cache(restricted_sample).real_roots.at(p).is_nullified();
323  }
324 
325  bool is_ldcf_zero(const Assignment& sample, PolyRef p) {
326  return is_zero(sample, ldcf(p));
327  }
328 
329  bool is_disc_zero(const Assignment& sample, PolyRef p) {
330  return is_zero(sample, disc(p));
331  }
332 
333  bool is_const(PolyRef p) {
334  return carl::is_constant(m_pool(p));
335  }
336 
337  bool is_zero(PolyRef p) {
338  return carl::is_zero(m_pool(p));
339  }
340 
341  std::vector<PolyRef> coeffs(PolyRef p) {
342  std::vector<PolyRef> result;
343  SMTRAT_STATISTICS_CALL(statistics().projection_start());
344  for (const auto& coeff : m_pool(p).coefficients()) {
345  result.emplace_back(m_pool(coeff));
346  SMTRAT_STATISTICS_CALL(statistics().coefficient(total_degree(m_pool(coeff)), degree(m_pool(coeff)), m_pool(coeff).level));
347  }
348  SMTRAT_STATISTICS_CALL(statistics().projection_end());
349  return result;
350  }
351 
352  bool has_const_coeff(PolyRef p) const {
353  for (const auto& coeff : m_pool(p).coefficients()) {
354  if (carl::is_constant(coeff) && !carl::is_zero(coeff)) return true;
355  }
356  return false;
357  }
358 
359  PolyRef simplest_nonzero_coeff(const Assignment& sample, PolyRef p, std::function<bool(const Polynomial&,const Polynomial&)> compare) {
360  std::optional<Polynomial> result;
361  SMTRAT_STATISTICS_CALL(statistics().projection_start());
362  for (const auto& coeff : m_pool(p).coefficients()) {
363  auto mv = carl::evaluate(carl::BasicConstraint<Polynomial>(coeff, carl::Relation::NEQ), sample);
364  assert(!indeterminate(mv));
365  if (mv) {
366  if (!result || compare(coeff,*result)) {
367  result = coeff;
368  }
369  }
370  }
371  assert(result);
372  SMTRAT_STATISTICS_CALL(statistics().projection_end());
373  SMTRAT_STATISTICS_CALL(statistics().coefficient(total_degree(m_pool(*result)), degree(m_pool(*result)), m_pool(*result).level));
374  return m_pool(*result);
375  }
376 
377  std::vector<carl::Variable> variables(PolyRef p) {
378  return carl::variables(m_pool(p)).as_vector();
379  }
380 
381  PolyRef derivative(PolyRef p, carl::Variable var) {
382  if (cache(p).derivatives.find(var) != cache(p).derivatives.end()) {
383  return cache(p).derivatives[var];
384  } else {
385  SMTRAT_STATISTICS_CALL(statistics().projection_start());
386  auto input = m_pool(p);
387  PolyRef result;
388  if (input.main_var() == var) {
389  result = m_pool(carl::derivative(input));
390  } else {
391  assert(input.has(var));
392  result = m_pool(carl::convert<Polynomial>(m_pool.context(), carl::derivative(carl::convert<Poly>(input), var)));
393  }
394  // auto result = m_pool(carl::derivative(m_pool(p), var)); // not implemented
395  cache(p).derivatives.emplace(var, result);
396  assert(result.level <= p.level);
397  SMTRAT_STATISTICS_CALL(statistics().projection_end());
399  return result;
400  }
401  }
402 
403  std::size_t degree(PolyRef p) const {
404  return m_pool(p).degree();
405  }
406 
407  std::size_t total_degree(PolyRef p) {
408  if (p.level == 0) return 0;
409  if (cache(p).total_degree == 0) {
410  cache(p).total_degree = m_pool(p).total_degree();
411  }
412  return cache(p).total_degree;
413  }
414 
415  const std::vector<std::size_t>& monomial_total_degrees(PolyRef p) {
416  if (cache(p).monomial_total_degrees.empty()) {
417  cache(p).monomial_total_degrees = m_pool(p).monomial_total_degrees();
418  }
419  return cache(p).monomial_total_degrees;
420  }
421 
422  const std::vector<std::size_t>& monomial_degrees(PolyRef p) {
423  if (cache(p).monomial_degrees.empty()) {
424  cache(p).monomial_degrees = m_pool(p).monomial_degrees(main_var(p));
425  }
426  return cache(p).monomial_degrees;
427  }
428 
429  RAN evaluate(const Assignment& sample, IndexedRoot r) {
430  auto roots = real_roots(sample, r.poly);
431  assert(r.index <= roots.size());
432  return roots[r.index-1];
433  }
434 
435  inline std::pair<RAN,std::vector<datastructures::IndexedRoot>> evaluate_min(const Assignment& ass, const std::vector<datastructures::IndexedRoot>& roots) {
436  std::vector<datastructures::IndexedRoot> irs;
437  RAN value;
438  for (const auto& root : roots) {
439  auto v = evaluate(ass, root);
440  if (irs.empty() || v < value) {
441  irs.clear();
442  irs.push_back(root);
443  value = v;
444  } else if (v == value) {
445  irs.push_back(root);
446  }
447  }
448  return std::make_pair(value, irs);
449  }
450 
451  inline std::pair<RAN,std::vector<datastructures::IndexedRoot>> evaluate_max(const Assignment& ass, const std::vector<datastructures::IndexedRoot>& roots) {
452  std::vector<datastructures::IndexedRoot> irs;
453  RAN value;
454  for (const auto& root : roots) {
455  auto v = evaluate(ass, root);
456  if (irs.empty() || v > value) {
457  irs.clear();
458  irs.push_back(root);
459  value = v;
460  } else if (v == value) {
461  irs.push_back(root);
462  }
463  }
464  return std::make_pair(value, irs);
465  }
466 
467  inline std::pair<RAN,std::vector<datastructures::IndexedRoot>> evaluate(const Assignment& ass, const datastructures::CompoundMinMax& bound) {
468  std::vector<datastructures::IndexedRoot> irs;
469  RAN value;
470  for (const auto& roots : bound.roots) {
471  auto v = evaluate_max(ass, roots);
472  if (irs.empty() || v.first < value) {
473  irs.clear();
474  irs.insert(irs.end(), v.second.begin(), v.second.end());
475  value = v.first;
476  } else if (v.first == value) {
477  irs.insert(irs.end(), v.second.begin(), v.second.end());
478  }
479  }
480  return std::make_pair(value, irs);
481  }
482 
483  inline std::pair<RAN,std::vector<datastructures::IndexedRoot>> evaluate(const Assignment& ass, const datastructures::CompoundMaxMin& bound) {
484  std::vector<datastructures::IndexedRoot> irs;
485  RAN value;
486  for (const auto& roots : bound.roots) {
487  auto v = evaluate_min(ass, roots);
488  if (irs.empty() || v.first > value) {
489  irs.clear();
490  irs.insert(irs.end(), v.second.begin(), v.second.end());
491  value = v.first;
492  } else if (v.first == value) {
493  irs.insert(irs.end(), v.second.begin(), v.second.end());
494  }
495  }
496  return std::make_pair(value, irs);
497  }
498 
499  inline std::pair<RAN,std::vector<datastructures::IndexedRoot>> evaluate(const Assignment& ass, const datastructures::RootFunction& f) {
500  if (f.is_root()) return std::make_pair(evaluate(ass, f.root()), std::vector<datastructures::IndexedRoot>({ f.root() }));
501  else if (f.is_cminmax()) return evaluate(ass, f.cminmax());
502  else if (f.is_cmaxmin()) return evaluate(ass, f.cmaxmin());
503  else assert(false);
504  }
505 
506  PolyConstraint negation(const PolyConstraint& constraint) const {
507  return PolyConstraint{constraint.lhs, carl::inverse(constraint.relation)};
508  }
509 
510  auto evaluate(const Assignment& ass, const PolyConstraint& constraint) {
511  return carl::evaluate(polys()(constraint), ass);
512  }
513 
514 };
515 
516 }
const Polynomial::ContextType & context() const
Definition: polynomials.h:201
const VariableOrdering & var_order() const
Definition: polynomials.h:117
bool known(const Polynomial &poly) const
Definition: polynomials.h:187
Encapsulates all computations on polynomials.
Definition: projections.h:46
std::vector< std::map< Assignment, detail::AssignmentProperties > > m_assignment_cache
Definition: projections.h:49
const std::vector< PolyRef > & factors_nonconst(PolyRef p)
Definition: projections.h:238
PolyRef derivative(PolyRef p, carl::Variable var)
Definition: projections.h:381
bool known(const Polynomial &p) const
Definition: projections.h:200
std::pair< RAN, std::vector< datastructures::IndexedRoot > > evaluate_min(const Assignment &ass, const std::vector< datastructures::IndexedRoot > &roots)
Definition: projections.h:435
std::pair< RAN, std::vector< datastructures::IndexedRoot > > evaluate(const Assignment &ass, const datastructures::CompoundMinMax &bound)
Definition: projections.h:467
std::size_t degree(PolyRef p) const
Definition: projections.h:403
RAN evaluate(const Assignment &sample, IndexedRoot r)
Definition: projections.h:429
bool know_res(PolyRef p, PolyRef q) const
Definition: projections.h:192
void clear_cache(size_t)
Clears all polynomials of the specified level and higher in the polynomial cache as well as their pro...
Definition: projections.h:132
bool is_ldcf_zero(const Assignment &sample, PolyRef p)
Definition: projections.h:325
bool is_disc_zero(const Assignment &sample, PolyRef p)
Definition: projections.h:329
size_t level_of(const Assignment &a) const
Definition: projections.h:72
std::pair< RAN, std::vector< datastructures::IndexedRoot > > evaluate_max(const Assignment &ass, const std::vector< datastructures::IndexedRoot > &roots)
Definition: projections.h:451
const std::vector< std::size_t > & monomial_total_degrees(PolyRef p)
Definition: projections.h:415
bool is_nullified(const Assignment &sample, PolyRef p)
Definition: projections.h:309
std::vector< std::vector< detail::PolyProperties > > m_poly_cache
Definition: projections.h:48
const auto & cache(const Assignment &a) const
Definition: projections.h:87
PolyConstraint negation(const PolyConstraint &constraint) const
Definition: projections.h:506
void clear_assignment_cache(const Assignment &)
Clears all projections cached with respect to this assignment.
Definition: projections.h:145
const std::vector< std::size_t > & monomial_degrees(PolyRef p)
Definition: projections.h:422
const std::vector< RAN > & real_roots(const Assignment &sample, PolyRef p)
Definition: projections.h:277
auto evaluate(const Assignment &ass, const PolyConstraint &constraint)
Definition: projections.h:510
std::vector< carl::Variable > variables(PolyRef p)
Definition: projections.h:377
PolyRef simplest_nonzero_coeff(const Assignment &sample, PolyRef p, std::function< bool(const Polynomial &, const Polynomial &)> compare)
Definition: projections.h:359
size_t num_roots(const Assignment &sample, PolyRef p)
Definition: projections.h:262
std::pair< RAN, std::vector< datastructures::IndexedRoot > > evaluate(const Assignment &ass, const datastructures::RootFunction &f)
Definition: projections.h:499
PolyRef res(PolyRef p, PolyRef q)
Definition: projections.h:165
std::pair< RAN, std::vector< datastructures::IndexedRoot > > evaluate(const Assignment &ass, const datastructures::CompoundMaxMin &bound)
Definition: projections.h:483
const auto & cache(PolyRef p) const
Definition: projections.h:61
bool is_zero(const Assignment &sample, PolyRef p)
Definition: projections.h:250
Assignment restrict_assignment(Assignment ass, PolyRef p)
Definition: projections.h:99
Assignment restrict_base_assignment(Assignment ass, PolyRef p)
Definition: projections.h:111
const std::vector< RAN > real_roots_reducible(const Assignment &sample, PolyRef p)
Definition: projections.h:292
std::vector< PolyRef > coeffs(PolyRef p)
Definition: projections.h:341
const CompoundMinMax & cminmax() const
Definition: roots.h:118
const IndexedRoot & root() const
Definition: roots.h:117
const CompoundMaxMin & cmaxmin() const
Definition: roots.h:119
void sort(T *array, int size, LessThan lt)
Definition: Sort.h:67
int var(Lit p)
Definition: SolverTypes.h:64
static bool find(V &ts, const T &t)
Definition: Alg.h:47
Poly resultant(carl::Variable variable, const Poly &p, const Poly &q)
Computes the resultant of two polynomials.
Definition: utils.h:48
Poly discriminant(carl::Variable variable, const Poly &p)
Computes the discriminant of a polynomial.
Definition: utils.h:63
bool compare(const It &lhs, const It &rhs)
Main datastructures.
Definition: delineation.h:9
Polynomial::RootType RAN
Definition: common.h:24
carl::Assignment< RAN > Assignment
Definition: common.h:25
carl::ContextPolynomial< Rational > Polynomial
Definition: common.h:16
Rational evaluate(carl::Variable v, const Poly &p, const Rational &r)
Definition: utils.h:11
bool is_constant(const T &t)
Checks whether the constraint is constant, i.e.
std::vector< carl::Variable > vars(const std::pair< QuantifierType, std::vector< carl::Variable >> &p)
Definition: QEQuery.h:43
#define SMTRAT_STATISTICS_CALL(function)
Definition: Statistics.h:23
Represents the maximum function of the contained indexed root functions.
Definition: roots.h:82
std::vector< std::vector< IndexedRoot > > roots
Definition: roots.h:83
Represents the minimum function of the contained indexed root functions.
Definition: roots.h:54
std::vector< std::vector< IndexedRoot > > roots
Definition: roots.h:55
Represents the i-th root of a multivariate polynomial at its main variable (given an appropriate samp...
Definition: roots.h:15
PolyRef poly
A multivariate polynomial.
Definition: roots.h:17
size_t index
The index, must be > 0.
Definition: roots.h:19
id_t id
The id of the polynomial with respect to its level.
Definition: polynomials.h:20
level_t level
The level of the polynomial.
Definition: polynomials.h:18
level_t base_level
The base level of the polynomial.
Definition: polynomials.h:22
std::map< PolyRef, carl::RealRootsResult< RAN > > real_roots
Definition: projections.h:36
boost::container::flat_map< PolyRef, PolyRef > res
Definition: projections.h:25
boost::container::flat_map< carl::Variable, PolyRef > derivatives
Definition: projections.h:29