1 |
|
/****************************************************************************** |
2 |
|
* This file is part of the cvc5 project. |
3 |
|
* |
4 |
|
* Copyright (c) 2010-2021 by the authors listed in the file AUTHORS |
5 |
|
* in the top-level source directory and their institutional affiliations. |
6 |
|
* All rights reserved. See the file COPYING in the top-level source |
7 |
|
* directory for licensing information. |
8 |
|
* **************************************************************************** |
9 |
|
* |
10 |
|
* This header file was automatically generated by: |
11 |
|
* |
12 |
|
* ../../../src/expr/mkkind /barrett/scratch/cvc4-nightly/src/cvc5-2021-09-13/src/expr/type_properties_template.h /barrett/scratch/cvc4-nightly/src/cvc5-2021-09-13/src/theory/builtin/kinds /barrett/scratch/cvc4-nightly/src/cvc5-2021-09-13/src/theory/booleans/kinds /barrett/scratch/cvc4-nightly/src/cvc5-2021-09-13/src/theory/uf/kinds /barrett/scratch/cvc4-nightly/src/cvc5-2021-09-13/src/theory/arith/kinds /barrett/scratch/cvc4-nightly/src/cvc5-2021-09-13/src/theory/bv/kinds /barrett/scratch/cvc4-nightly/src/cvc5-2021-09-13/src/theory/fp/kinds /barrett/scratch/cvc4-nightly/src/cvc5-2021-09-13/src/theory/arrays/kinds /barrett/scratch/cvc4-nightly/src/cvc5-2021-09-13/src/theory/datatypes/kinds /barrett/scratch/cvc4-nightly/src/cvc5-2021-09-13/src/theory/sep/kinds /barrett/scratch/cvc4-nightly/src/cvc5-2021-09-13/src/theory/sets/kinds /barrett/scratch/cvc4-nightly/src/cvc5-2021-09-13/src/theory/bags/kinds /barrett/scratch/cvc4-nightly/src/cvc5-2021-09-13/src/theory/strings/kinds /barrett/scratch/cvc4-nightly/src/cvc5-2021-09-13/src/theory/quantifiers/kinds |
13 |
|
* |
14 |
|
* for the cvc5 project. |
15 |
|
*/ |
16 |
|
|
17 |
|
/* THIS FILE IS AUTOMATICALLY GENERATED, DO NOT EDIT ! */ |
18 |
|
/* THIS FILE IS AUTOMATICALLY GENERATED, DO NOT EDIT ! */ |
19 |
|
/* THIS FILE IS AUTOMATICALLY GENERATED, DO NOT EDIT ! */ |
20 |
|
/* THIS FILE IS AUTOMATICALLY GENERATED, DO NOT EDIT ! */ |
21 |
|
/* THIS FILE IS AUTOMATICALLY GENERATED, DO NOT EDIT ! */ |
22 |
|
/* THIS FILE IS AUTOMATICALLY GENERATED, DO NOT EDIT ! */ |
23 |
|
|
24 |
|
/* THIS FILE IS AUTOMATICALLY GENERATED, DO NOT EDIT ! */ |
25 |
|
/* THIS FILE IS AUTOMATICALLY GENERATED, DO NOT EDIT ! */ |
26 |
|
/* THIS FILE IS AUTOMATICALLY GENERATED, DO NOT EDIT ! */ |
27 |
|
/* THIS FILE IS AUTOMATICALLY GENERATED, DO NOT EDIT ! */ |
28 |
|
/* THIS FILE IS AUTOMATICALLY GENERATED, DO NOT EDIT ! */ |
29 |
|
/* THIS FILE IS AUTOMATICALLY GENERATED, DO NOT EDIT ! */ |
30 |
|
|
31 |
|
/* Edit the template file instead: */ |
32 |
|
/* /barrett/scratch/cvc4-nightly/src/cvc5-2021-09-13/src/expr/type_properties_template.h */ |
33 |
|
|
34 |
|
/****************************************************************************** |
35 |
|
* Top contributors (to current version): |
36 |
|
* Morgan Deters, Mathias Preiner |
37 |
|
* |
38 |
|
* This file is part of the cvc5 project. |
39 |
|
* |
40 |
|
* Copyright (c) 2009-2021 by the authors listed in the file AUTHORS |
41 |
|
* in the top-level source directory and their institutional affiliations. |
42 |
|
* All rights reserved. See the file COPYING in the top-level source |
43 |
|
* directory for licensing information. |
44 |
|
* **************************************************************************** |
45 |
|
* |
46 |
|
* Template for the Type properties header. |
47 |
|
*/ |
48 |
|
|
49 |
|
#include "cvc5_private.h" |
50 |
|
|
51 |
|
#ifndef CVC5__TYPE_PROPERTIES_H |
52 |
|
#define CVC5__TYPE_PROPERTIES_H |
53 |
|
|
54 |
|
#include <sstream> |
55 |
|
|
56 |
|
#include "base/check.h" |
57 |
|
#include "expr/kind.h" |
58 |
|
#include "expr/node.h" |
59 |
|
#include "expr/type_node.h" |
60 |
|
#include "options/language.h" |
61 |
|
|
62 |
|
// clang-format off |
63 |
|
|
64 |
|
#include "theory/builtin/theory_builtin_type_rules.h" |
65 |
|
|
66 |
|
#include "theory/builtin/theory_builtin_type_rules.h" |
67 |
|
|
68 |
|
#include "expr/node_manager.h" |
69 |
|
|
70 |
|
#include "expr/node_manager.h" |
71 |
|
|
72 |
|
#include "expr/node_manager.h" |
73 |
|
|
74 |
|
#include "theory/bv/theory_bv_type_rules.h" |
75 |
|
|
76 |
|
#include "theory/type_enumerator.h" |
77 |
|
|
78 |
|
#include "expr/node_manager.h" |
79 |
|
|
80 |
|
#include "theory/fp/theory_fp_type_rules.h" |
81 |
|
|
82 |
|
#include "theory/type_enumerator.h" |
83 |
|
|
84 |
|
#include "theory/arrays/theory_arrays_type_rules.h" |
85 |
|
|
86 |
|
#include "theory/arrays/theory_arrays_type_rules.h" |
87 |
|
|
88 |
|
#include "theory/datatypes/theory_datatypes_type_rules.h" |
89 |
|
|
90 |
|
#include "theory/builtin/theory_builtin_type_rules.h" |
91 |
|
|
92 |
|
#include "theory/builtin/theory_builtin_type_rules.h" |
93 |
|
|
94 |
|
#include "theory/builtin/theory_builtin_type_rules.h" |
95 |
|
|
96 |
|
#include "expr/dtype.h" |
97 |
|
|
98 |
|
#include "expr/dtype.h" |
99 |
|
|
100 |
|
#include "expr/dtype.h" |
101 |
|
|
102 |
|
#include "expr/dtype.h" |
103 |
|
|
104 |
|
#include "theory/sets/theory_sets_type_rules.h" |
105 |
|
|
106 |
|
#include "theory/sets/theory_sets_type_rules.h" |
107 |
|
|
108 |
|
#include "theory/bags/theory_bags_type_rules.h" |
109 |
|
|
110 |
|
#include "theory/bags/theory_bags_type_rules.h" |
111 |
|
|
112 |
|
#include "util/string.h" |
113 |
|
|
114 |
|
#include "util/string.h" |
115 |
|
|
116 |
|
#include "theory/strings/theory_strings_type_rules.h" |
117 |
|
|
118 |
|
#include "theory/strings/theory_strings_type_rules.h" |
119 |
|
|
120 |
|
// clang-format on |
121 |
|
|
122 |
|
namespace cvc5 { |
123 |
|
namespace kind { |
124 |
|
|
125 |
|
/** |
126 |
|
* Return the cardinality of the type constant represented by the |
127 |
|
* TypeConstant argument. This function is auto-generated from Theory |
128 |
|
* "kinds" files, so includes contributions from each theory regarding |
129 |
|
* that theory's types. |
130 |
|
*/ |
131 |
9785 |
inline Cardinality getCardinality(TypeConstant tc) |
132 |
|
{ |
133 |
9785 |
switch (tc) |
134 |
|
{ |
135 |
|
// clang-format off |
136 |
|
|
137 |
|
case BUILTIN_OPERATOR_TYPE: return Cardinality(Cardinality::INTEGERS); |
138 |
|
|
139 |
|
case SEXPR_TYPE: return Cardinality(Cardinality::INTEGERS); |
140 |
|
|
141 |
736 |
case BOOLEAN_TYPE: return Cardinality(2); |
142 |
|
|
143 |
112 |
case REAL_TYPE: return Cardinality(Cardinality::REALS); |
144 |
|
|
145 |
8907 |
case INTEGER_TYPE: return Cardinality(Cardinality::INTEGERS); |
146 |
|
|
147 |
|
case ROUNDINGMODE_TYPE: return Cardinality(5); |
148 |
|
|
149 |
30 |
case STRING_TYPE: return Cardinality(Cardinality::INTEGERS); |
150 |
|
|
151 |
|
case REGEXP_TYPE: return Cardinality(Cardinality::INTEGERS); |
152 |
|
|
153 |
|
case BOUND_VAR_LIST_TYPE: return Cardinality(Cardinality::INTEGERS); |
154 |
|
|
155 |
|
case INST_PATTERN_TYPE: return Cardinality(Cardinality::INTEGERS); |
156 |
|
|
157 |
|
case INST_PATTERN_LIST_TYPE: return Cardinality(Cardinality::INTEGERS); |
158 |
|
|
159 |
|
// clang-format on |
160 |
|
default: InternalError() << "No cardinality known for type constant " << tc; |
161 |
|
} |
162 |
|
} /* getCardinality(TypeConstant) */ |
163 |
|
|
164 |
|
/** |
165 |
|
* Return the cardinality of the type represented by the TypeNode |
166 |
|
* argument. This function is auto-generated from Theory "kinds" |
167 |
|
* files, so includes contributions from each theory regarding that |
168 |
|
* theory's types. |
169 |
|
*/ |
170 |
16805 |
inline Cardinality getCardinality(TypeNode typeNode) { |
171 |
16805 |
AssertArgument(!typeNode.isNull(), typeNode); |
172 |
16805 |
switch(Kind k = typeNode.getKind()) { |
173 |
9785 |
case TYPE_CONSTANT: |
174 |
9785 |
return getCardinality(typeNode.getConst<TypeConstant>()); |
175 |
|
// clang-format off |
176 |
|
|
177 |
841 |
case SORT_TYPE: return Cardinality(Cardinality::INTEGERS); |
178 |
|
|
179 |
156 |
case FUNCTION_TYPE: return ::cvc5::theory::builtin::FunctionProperties::computeCardinality(typeNode); |
180 |
|
|
181 |
2550 |
case BITVECTOR_TYPE: return ::cvc5::theory::bv::CardinalityComputer::computeCardinality(typeNode); |
182 |
|
|
183 |
|
case FLOATINGPOINT_TYPE: return ::cvc5::theory::fp::CardinalityComputer::computeCardinality(typeNode); |
184 |
|
|
185 |
294 |
case ARRAY_TYPE: return ::cvc5::theory::arrays::ArraysProperties::computeCardinality(typeNode); |
186 |
|
|
187 |
2 |
case CONSTRUCTOR_TYPE: return ::cvc5::theory::datatypes::ConstructorProperties::computeCardinality(typeNode); |
188 |
|
|
189 |
|
case SELECTOR_TYPE: return ::cvc5::theory::builtin::FunctionProperties::computeCardinality(typeNode); |
190 |
|
|
191 |
|
case TESTER_TYPE: return ::cvc5::theory::builtin::FunctionProperties::computeCardinality(typeNode); |
192 |
|
|
193 |
|
case UPDATER_TYPE: return ::cvc5::theory::builtin::FunctionProperties::computeCardinality(typeNode); |
194 |
|
|
195 |
3177 |
case DATATYPE_TYPE: return typeNode.getDType().getCardinality(typeNode); |
196 |
|
|
197 |
|
case PARAMETRIC_DATATYPE: return typeNode.getDType().getCardinality(typeNode); |
198 |
|
|
199 |
|
case SET_TYPE: return ::cvc5::theory::sets::SetsProperties::computeCardinality(typeNode); |
200 |
|
|
201 |
|
case BAG_TYPE: return ::cvc5::theory::bags::BagsProperties::computeCardinality(typeNode); |
202 |
|
|
203 |
|
case SEQUENCE_TYPE: return ::cvc5::theory::strings::SequenceProperties::computeCardinality(typeNode); |
204 |
|
|
205 |
|
// clang-format on |
206 |
|
default: |
207 |
|
InternalError() << "A theory kinds file did not provide a cardinality " |
208 |
|
<< "or cardinality computer for type:\n" |
209 |
|
<< typeNode << "\nof kind " << k; |
210 |
|
} |
211 |
|
}/* getCardinality(TypeNode) */ |
212 |
|
|
213 |
|
inline bool isWellFounded(TypeConstant tc) { |
214 |
|
switch(tc) { |
215 |
|
// clang-format off |
216 |
|
|
217 |
|
case BUILTIN_OPERATOR_TYPE: return false; |
218 |
|
|
219 |
|
case SEXPR_TYPE: return false; |
220 |
|
|
221 |
|
case BOOLEAN_TYPE: return true; |
222 |
|
|
223 |
|
case REAL_TYPE: return true; |
224 |
|
|
225 |
|
case INTEGER_TYPE: return true; |
226 |
|
|
227 |
|
case ROUNDINGMODE_TYPE: return true; |
228 |
|
|
229 |
|
case STRING_TYPE: return true; |
230 |
|
|
231 |
|
case REGEXP_TYPE: return true; |
232 |
|
|
233 |
|
case BOUND_VAR_LIST_TYPE: return false; |
234 |
|
|
235 |
|
case INST_PATTERN_TYPE: return false; |
236 |
|
|
237 |
|
case INST_PATTERN_LIST_TYPE: return false; |
238 |
|
|
239 |
|
// clang-format on |
240 |
|
default: |
241 |
|
InternalError() << "No well-foundedness status known for type constant: " |
242 |
|
<< tc; |
243 |
|
} |
244 |
|
}/* isWellFounded(TypeConstant) */ |
245 |
|
|
246 |
|
inline bool isWellFounded(TypeNode typeNode) { |
247 |
|
AssertArgument(!typeNode.isNull(), typeNode); |
248 |
|
switch(Kind k = typeNode.getKind()) { |
249 |
|
case TYPE_CONSTANT: |
250 |
|
return isWellFounded(typeNode.getConst<TypeConstant>()); |
251 |
|
// clang-format off |
252 |
|
|
253 |
|
case SORT_TYPE: return ::cvc5::theory::builtin::SortProperties::isWellFounded(typeNode); |
254 |
|
|
255 |
|
case FUNCTION_TYPE: return ::cvc5::theory::builtin::FunctionProperties::isWellFounded(typeNode); |
256 |
|
|
257 |
|
case BITVECTOR_TYPE: return true; |
258 |
|
|
259 |
|
case FLOATINGPOINT_TYPE: return true; |
260 |
|
|
261 |
|
case ARRAY_TYPE: return ::cvc5::theory::arrays::ArraysProperties::isWellFounded(typeNode); |
262 |
|
|
263 |
|
case DATATYPE_TYPE: return typeNode.getDType().isWellFounded(); |
264 |
|
|
265 |
|
case PARAMETRIC_DATATYPE: return typeNode.getDType().isWellFounded(); |
266 |
|
|
267 |
|
case SET_TYPE: return ::cvc5::theory::sets::SetsProperties::isWellFounded(typeNode); |
268 |
|
|
269 |
|
case BAG_TYPE: return ::cvc5::theory::bags::BagsProperties::isWellFounded(typeNode); |
270 |
|
|
271 |
|
case SEQUENCE_TYPE: return ::cvc5::theory::strings::SequenceProperties::isWellFounded(typeNode); |
272 |
|
|
273 |
|
// clang-format on |
274 |
|
default: |
275 |
|
InternalError() << "A theory kinds file did not provide a well-foundedness " |
276 |
|
<< "or well-foundedness computer for type:\n" |
277 |
|
<< typeNode << "\nof kind " << k; |
278 |
|
} |
279 |
|
}/* isWellFounded(TypeNode) */ |
280 |
|
|
281 |
1130 |
inline Node mkGroundTerm(TypeConstant tc) |
282 |
|
{ |
283 |
1130 |
switch (tc) |
284 |
|
{ |
285 |
|
// clang-format off |
286 |
|
|
287 |
|
case BUILTIN_OPERATOR_TYPE: Unhandled() << tc; |
288 |
|
|
289 |
|
case SEXPR_TYPE: Unhandled() << tc; |
290 |
|
|
291 |
21 |
case BOOLEAN_TYPE: return NodeManager::currentNM()->mkConst(false); |
292 |
|
|
293 |
21 |
case REAL_TYPE: return NodeManager::currentNM()->mkConst(Rational(0)); |
294 |
|
|
295 |
852 |
case INTEGER_TYPE: return NodeManager::currentNM()->mkConst(Rational(0)); |
296 |
|
|
297 |
|
case ROUNDINGMODE_TYPE: return NodeManager::currentNM()->mkConst<RoundingMode>(RoundingMode()); |
298 |
|
|
299 |
236 |
case STRING_TYPE: return NodeManager::currentNM()->mkConst(::cvc5::String()); |
300 |
|
|
301 |
|
case REGEXP_TYPE: return NodeManager::currentNM()->mkNode(REGEXP_EMPTY); |
302 |
|
|
303 |
|
case BOUND_VAR_LIST_TYPE: Unhandled() << tc; |
304 |
|
|
305 |
|
case INST_PATTERN_TYPE: Unhandled() << tc; |
306 |
|
|
307 |
|
case INST_PATTERN_LIST_TYPE: Unhandled() << tc; |
308 |
|
|
309 |
|
// clang-format on |
310 |
|
default: |
311 |
|
InternalError() << "No ground term known for type constant: " << tc; |
312 |
|
} |
313 |
|
} /* mkGroundTerm(TypeConstant) */ |
314 |
|
|
315 |
116425 |
inline Node mkGroundTerm(TypeNode typeNode) |
316 |
|
{ |
317 |
116425 |
AssertArgument(!typeNode.isNull(), typeNode); |
318 |
116425 |
switch (Kind k = typeNode.getKind()) |
319 |
|
{ |
320 |
1130 |
case TYPE_CONSTANT: |
321 |
1130 |
return mkGroundTerm(typeNode.getConst<TypeConstant>()); |
322 |
|
// clang-format off |
323 |
|
|
324 |
333 |
case SORT_TYPE: return ::cvc5::theory::builtin::SortProperties::mkGroundTerm(typeNode); |
325 |
|
|
326 |
1 |
case FUNCTION_TYPE: return ::cvc5::theory::builtin::FunctionProperties::mkGroundTerm(typeNode); |
327 |
|
|
328 |
353 |
case BITVECTOR_TYPE: return (*cvc5::theory::TypeEnumerator(typeNode)); |
329 |
|
|
330 |
|
case FLOATINGPOINT_TYPE: return (*cvc5::theory::TypeEnumerator(typeNode)); |
331 |
|
|
332 |
15 |
case ARRAY_TYPE: return ::cvc5::theory::arrays::ArraysProperties::mkGroundTerm(typeNode); |
333 |
|
|
334 |
114583 |
case DATATYPE_TYPE: return typeNode.getDType().mkGroundTerm(typeNode); |
335 |
|
|
336 |
4 |
case PARAMETRIC_DATATYPE: return typeNode.getDType().mkGroundTerm(typeNode); |
337 |
|
|
338 |
6 |
case SET_TYPE: return ::cvc5::theory::sets::SetsProperties::mkGroundTerm(typeNode); |
339 |
|
|
340 |
|
case BAG_TYPE: return ::cvc5::theory::bags::BagsProperties::mkGroundTerm(typeNode); |
341 |
|
|
342 |
|
case SEQUENCE_TYPE: return ::cvc5::theory::strings::SequenceProperties::mkGroundTerm(typeNode); |
343 |
|
|
344 |
|
// clang-format on |
345 |
|
default: |
346 |
|
InternalError() << "A theory kinds file did not provide a ground term " |
347 |
|
<< "or ground term computer for type:\n" |
348 |
|
<< typeNode << "\nof kind " << k; |
349 |
|
} |
350 |
|
} /* mkGroundTerm(TypeNode) */ |
351 |
|
|
352 |
|
} // namespace kind |
353 |
|
} // namespace cvc5 |
354 |
|
|
355 |
|
#endif /* CVC5__TYPE_PROPERTIES_H */ |