SMT-RAT  24.02
Toolbox for Strategic and Parallel Satisfiability-Modulo-Theories Solving
properties_util.h
Go to the documentation of this file.
1 #pragma once
2 
4 
5 inline auto get_level(const datastructures::IndexedRootOrdering& ordering) {
6  datastructures::level_t level = 0;
7  for (const auto& p : ordering.polys()) {
8  level = std::max(level, p.base_level);
9  }
10  return level;
11 }
12 
13 inline auto get_level(const datastructures::RootFunction& function) {
14  datastructures::level_t level = 0;
15  for (const auto& p : function.polys()) {
16  level = std::max(level, p.base_level);
17  }
18  return level;
19 }
20 
21 template<typename P>
22 void insert_root_ordering_holds(P& deriv, const datastructures::IndexedRootOrdering& ordering) { // transform to a rule?
23  if (false) {
24  deriv.insert(properties::root_ordering_holds{ ordering, get_level(ordering) });
25  } else {
26  std::vector<datastructures::IndexedRootOrdering> data_by_level;
27  data_by_level.resize(get_level(ordering));
28  for (const auto& e : ordering.data()) {
29  auto lvl = std::max(get_level(e.first), get_level(e.second));
30  assert(lvl <= data_by_level.size());
31  if (lvl > 0) {
32  if (e.is_strict) {
33  data_by_level[lvl-1].add_less(e.first, e.second);
34  } else {
35  data_by_level[lvl-1].add_leq(e.first, e.second);
36  }
37  }
38  }
39  for (std::size_t i = 0; i < data_by_level.size(); i++) {
40  if (!data_by_level[i].data().empty()) {
41  data_by_level[i].biggest_cell_wrt = ordering.biggest_cell_wrt;
42  deriv.insert(properties::root_ordering_holds{ data_by_level[i], i+1 });
43  }
44  }
45  }
46 }
47 
48 template<typename P>
50  if (false) {
51  return deriv.contains(properties::root_ordering_holds{ ordering, get_level(ordering) });
52  } else {
53  return true;
54  }
55 }
56 };
Describes an ordering of IndexedRoots.
Definition: roots.h:400
std::optional< SymbolicInterval > biggest_cell_wrt
Definition: roots.h:418
void polys(boost::container::flat_set< PolyRef > &result) const
Definition: roots.h:561
Contains all properties that are stored in a derivation.
Definition: properties.h:11
void insert_root_ordering_holds(P &deriv, const datastructures::IndexedRootOrdering &ordering)
auto get_level(const datastructures::IndexedRootOrdering &ordering)
bool contains_root_ordering_holds(P &deriv, const datastructures::IndexedRootOrdering &ordering)