SMT-RAT  24.02
Toolbox for Strategic and Parallel Satisfiability-Modulo-Theories Solving
properties.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <functional>
4 #include "../datastructures/polynomials.h"
5 
6 /**
7  * Contains all properties that are stored in a derivation.
8  *
9  * Note that not all properties have a representation here as not all of them are stored but resolved directly in the derivation rules.
10  */
12 
13 struct poly_sgn_inv {
14  static constexpr bool is_flag = false;
16  size_t level() const {
17  return poly.level;
18  }
19  std::size_t hash_on_level() const {
20  return std::hash<std::size_t>()(poly.id);
21  }
22 };
23 inline bool operator==(const poly_sgn_inv& lhs, const poly_sgn_inv& rhs) {
24  return lhs.poly == rhs.poly;
25 }
26 inline bool operator<(const poly_sgn_inv& lhs, const poly_sgn_inv& rhs) {
27  return lhs.poly < rhs.poly;
28 }
29 inline std::ostream& operator<<(std::ostream& os, const poly_sgn_inv& data) {
30  os << data.poly << " si";
31  return os;
32 }
33 
35  static constexpr bool is_flag = false;
37  size_t level() const {
38  return poly.level;
39  }
40  std::size_t hash_on_level() const {
41  return std::hash<std::size_t>()(poly.id);
42  }
43 };
44 inline bool operator==(const poly_irreducible_sgn_inv& lhs, const poly_irreducible_sgn_inv& rhs) {
45  return lhs.poly == rhs.poly;
46 }
47 inline bool operator<(const poly_irreducible_sgn_inv& lhs, const poly_irreducible_sgn_inv& rhs) {
48  return lhs.poly < rhs.poly;
49 }
50 inline std::ostream& operator<<(std::ostream& os, const poly_irreducible_sgn_inv& data) {
51  os << data.poly << " si and irreducible";
52  return os;
53 }
54 
56  static constexpr bool is_flag = false;
58  size_t level() const {
59  return poly.level;
60  }
61  std::size_t hash_on_level() const {
62  return std::hash<std::size_t>()(poly.id);
63  }
64 };
65 inline bool operator==(const poly_semi_sgn_inv& lhs, const poly_semi_sgn_inv& rhs) {
66  return lhs.poly == rhs.poly;
67 }
68 inline bool operator<(const poly_semi_sgn_inv& lhs, const poly_semi_sgn_inv& rhs) {
69  return lhs.poly < rhs.poly;
70 }
71 inline std::ostream& operator<<(std::ostream& os, const poly_semi_sgn_inv& data) {
72  os << data.poly << " semi-si";
73  return os;
74 }
75 
77  static constexpr bool is_flag = false;
79  size_t level() const {
80  return poly.level;
81  }
82  std::size_t hash_on_level() const {
83  return std::hash<std::size_t>()(poly.id);
84  }
85 };
87  return lhs.poly == rhs.poly;
88 }
90  return lhs.poly < rhs.poly;
91 }
92 inline std::ostream& operator<<(std::ostream& os, const poly_irreducible_semi_sgn_inv& data) {
93  os << data.poly << " semi-si and irreducible";
94  return os;
95 }
96 
97 struct poly_ord_inv {
98  static constexpr bool is_flag = false;
100  size_t level() const {
101  return poly.level;
102  }
103  std::size_t hash_on_level() const {
104  return std::hash<std::size_t>()(poly.id);
105  }
106 };
107 inline bool operator==(const poly_ord_inv& lhs, const poly_ord_inv& rhs) {
108  return lhs.poly == rhs.poly;
109 }
110 inline bool operator<(const poly_ord_inv& lhs, const poly_ord_inv& rhs) {
111  return lhs.poly < rhs.poly;
112 }
113 inline std::ostream& operator<<(std::ostream& os, const poly_ord_inv& data) {
114  os << data.poly << " oi";
115  return os;
116 }
117 
118 struct poly_del {
119  static constexpr bool is_flag = false;
121  size_t level() const {
122  return poly.base_level;
123  }
124  std::size_t hash_on_level() const {
125  return std::hash<std::size_t>()(poly.id);
126  }
127 };
128 inline bool operator==(const poly_del& lhs, const poly_del& rhs) {
129  return lhs.poly == rhs.poly;
130 }
131 inline bool operator<(const poly_del& lhs, const poly_del& rhs) {
132  return lhs.poly < rhs.poly;
133 }
134 inline std::ostream& operator<<(std::ostream& os, const poly_del& data) {
135  os << data.poly << " delineable";
136  return os;
137 }
138 
140  static constexpr bool is_flag = false;
142  size_t level() const {
143  return poly.base_level;
144  }
145  std::size_t hash_on_level() const {
146  return std::hash<std::size_t>()(poly.id);
147  }
148 };
149 inline bool operator==(const poly_proj_del& lhs, const poly_proj_del& rhs) {
150  return lhs.poly == rhs.poly;
151 }
152 inline bool operator<(const poly_proj_del& lhs, const poly_proj_del& rhs) {
153  return lhs.poly < rhs.poly;
154 }
155 inline std::ostream& operator<<(std::ostream& os, const poly_proj_del& data) {
156  os << data.poly << " projectively delineable";
157  return os;
158 }
159 
161  static constexpr bool is_flag = true;
162  std::size_t lvl;
163  std::size_t level() const {
164  return lvl;
165  }
166  std::size_t hash_on_level() const {
167  return 0;
168  }
169 };
170 inline bool operator==(const cell_connected& lhs, const cell_connected& rhs) {
171  return lhs.lvl == rhs.lvl;
172 }
173 inline bool operator<(const cell_connected& lhs, const cell_connected& rhs) {
174  return lhs.lvl < rhs.lvl;
175 }
176 inline std::ostream& operator<<(std::ostream& os, const cell_connected& data) {
177  os << data.lvl << " connected";
178  return os;
179 }
180 
182  static constexpr bool is_flag = false;
184  size_t level() const {
185  return poly.level;
186  }
187  std::size_t hash_on_level() const {
188  return std::hash<std::size_t>()(poly.id);
189  }
190 };
191 inline bool operator==(const poly_ord_inv_base& lhs, const poly_ord_inv_base& rhs) {
192  return lhs.poly == rhs.poly;
193 }
194 inline bool operator<(const poly_ord_inv_base& lhs, const poly_ord_inv_base& rhs) {
195  return lhs.poly < rhs.poly;
196 }
197 inline std::ostream& operator<<(std::ostream& os, const poly_ord_inv_base& data) {
198  os << data.poly << " ord inv base";
199  return os;
200 }
201 
203  static constexpr bool is_flag = false;
205  std::size_t lvl;
206  size_t level() const {
207  return lvl;
208  }
209  std::size_t hash_on_level() const {
210  return ordering.data().size();
211  // auto hasher = std::hash<std::size_t>();
212  // std::size_t seed = ordering.data().size();
213  // for(auto& i : ordering.data()) {
214  // std::size_t subseed = 0;
215  // subseed ^= hasher(i.first.poly.id) + 0x9e3779b9 + (seed<<6) + (seed>>2);
216  // subseed ^= hasher(i.first.index) + 0x9e3779b9 + (seed<<6) + (seed>>2);
217  // subseed ^= hasher(i.second.poly.id) + 0x9e3779b9 + (seed<<6) + (seed>>2);
218  // subseed ^= hasher(i.second.index) + 0x9e3779b9 + (seed<<6) + (seed>>2);
219  // seed ^= subseed + 0x9e3779b9 + (seed << 6) + (seed >> 2);
220  // }
221  // return seed;
222  }
223 };
224 inline bool operator==(const root_ordering_holds& lhs, const root_ordering_holds& rhs) {
225  return lhs.ordering.data() == rhs.ordering.data();
226 }
227 inline bool operator<(const root_ordering_holds& lhs, const root_ordering_holds& rhs) {
228  return lhs.ordering.data() < rhs.ordering.data();
229 }
230 inline std::ostream& operator<<(std::ostream& os, const root_ordering_holds& data) {
231  os << data.ordering << " holds";
232  return os;
233 }
234 
235 }
Describes an ordering of IndexedRoots.
Definition: roots.h:400
Contains all properties that are stored in a derivation.
Definition: properties.h:11
bool operator==(const poly_sgn_inv &lhs, const poly_sgn_inv &rhs)
Definition: properties.h:23
std::ostream & operator<<(std::ostream &os, const poly_sgn_inv &data)
Definition: properties.h:29
bool operator<(const poly_sgn_inv &lhs, const poly_sgn_inv &rhs)
Definition: properties.h:26
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