35#include <unordered_map>
163 return "(_ BitVec " + std::to_string(
children[0]->
arity) +
")";
165 return "(_ FloatingPoint " + std::to_string(
children[0]->
arity) +
" " +
170 return "(Array " +
children[0]->toString() +
" " +
185 std::string
s =
"(Tuple";
187 s +=
" " +
ch->toString();
207 return "Transcendental";
213 return "RoundingMode";
221 "Cannot get bit width of non-bitvector sort");
227 "Cannot get exponent width of non-floating-point sort");
233 "Cannot get significand width of non-floating-point sort");
239 "Cannot get index sort of non-array sort");
245 "Cannot get element sort of non-array sort");
251 "Cannot get parameter sort of non-define-sort sort");
257 "Cannot get parameters of non-define-sort sort");
258 return std::vector<std::shared_ptr<Sort>>(
children.begin(),
264 "Cannot get output sort of non-define-sort sort");
271 return *
this == *
other;
276 size_t result = std::hash<int>{}(
static_cast<int>(
kind));
277 result ^= std::hash<std::string>{}(
name) + 0x9e3779b9 + (result << 6) +
280 std::hash<size_t>{}(
arity) + 0x9e3779b9 + (result << 6) + (result >> 2);
285 result ^=
child->hash() + 0x9e3779b9 + (result << 6) + (result >> 2);
293 size_t result = std::hash<int>{}(
static_cast<int>(
kind));
294 result ^= ((
isDec() ||
isDef()) ? 0 : std::hash<std::string>{}(
name)) +
295 0x9e3779b9 + (result << 6) + (result >> 2);
297 std::hash<size_t>{}(
arity) + 0x9e3779b9 + (result << 6) + (result >> 2);
302 result ^=
child->hash_without_name() + 0x9e3779b9 + (result << 6) +
314 std::vector<std::shared_ptr<Sort>>
sorts;
315 std::unordered_map<size_t,
316 std::vector<std::pair<std::shared_ptr<Sort>,
size_t>>>
323 std::shared_ptr<Sort>
getSort(
const size_t index)
const;
324 size_t getIndex(
const std::shared_ptr<Sort> &sort)
const;
328 std::shared_ptr<Sort>
createSort(
SORT_KIND kind, std::string name,
size_t arity, std::vector<std::shared_ptr<Sort>> children);
332 std::shared_ptr<Sort>
createSort(std::string name);
337 std::shared_ptr<Sort>
createFPSort(
size_t exp,
size_t sig);
339 std::shared_ptr<Sort> elem);
340 std::shared_ptr<Sort>
342 std::shared_ptr<Sort>
createSortDec(
const std::string &name,
size_t arity);
343 std::shared_ptr<Sort>
345 const std::vector<std::shared_ptr<Sort>> ¶ms,
346 std::shared_ptr<Sort> out_sort);
371 size_t getBitWidth(
const std::shared_ptr<Sort> &sort);
374 std::shared_ptr<Sort>
getIndexSort(
const std::shared_ptr<Sort> &sort);
375 std::shared_ptr<Sort>
getElemSort(
const std::shared_ptr<Sort> &sort);
376 std::shared_ptr<Sort>
getParamSort(
const std::shared_ptr<Sort> &sort,
378 std::vector<std::shared_ptr<Sort>>
379 getParams(
const std::shared_ptr<Sort> &sort);
380 std::shared_ptr<Sort>
getOutSort(
const std::shared_ptr<Sort> &sort);
390 inline static const std::shared_ptr<Sort>
INT_SORT =
398 inline static const std::shared_ptr<Sort>
STR_SORT =
400 inline static const std::shared_ptr<Sort>
REG_SORT =
402 inline static const std::shared_ptr<Sort>
EXT_SORT =
404 inline static const std::shared_ptr<Sort>
NAT_SORT =
411 std::make_shared<Sort>(
414 std::make_shared<Sort>(
417 std::make_shared<Sort>(
#define condAssert(cond, msg)
static const std::shared_ptr< Sort > INTOREAL_SORT
std::shared_ptr< Sort > getElemSort(const std::shared_ptr< Sort > &sort)
void initializeStaticSorts()
static std::shared_ptr< Sort > getFloat64()
static std::shared_ptr< Sort > getStr()
std::shared_ptr< Sort > createBVSort(size_t width)
static const std::shared_ptr< Sort > ROUNDING_MODE_SORT
std::unordered_map< size_t, std::vector< std::pair< std::shared_ptr< Sort >, size_t > > > sort_buckets
std::shared_ptr< Sort > getOutSort(const std::shared_ptr< Sort > &sort)
static const std::shared_ptr< Sort > ALGEBRAIC_SORT
std::shared_ptr< Sort > insertSortToBucket(const std::shared_ptr< Sort > &sort)
static const std::shared_ptr< Sort > STR_SORT
static const std::shared_ptr< Sort > TRANSCENDENTAL_SORT
size_t getBitWidth(const std::shared_ptr< Sort > &sort)
std::shared_ptr< Sort > createArraySort(std::shared_ptr< Sort > index, std::shared_ptr< Sort > elem)
static const std::shared_ptr< Sort > INT_SORT
static const std::shared_ptr< Sort > FLOAT32_SORT
std::vector< std::shared_ptr< Sort > > sorts
static std::shared_ptr< Sort > getRand()
std::shared_ptr< Sort > getParamSort(const std::shared_ptr< Sort > &sort, size_t index)
std::shared_ptr< Sort > createSort()
static std::shared_ptr< Sort > getFloat32()
static const std::shared_ptr< Sort > FLOAT16_SORT
static std::shared_ptr< Sort > getReal()
static std::shared_ptr< Sort > getRoundingMode()
std::shared_ptr< Sort > getIndexSort(const std::shared_ptr< Sort > &sort)
std::shared_ptr< Sort > createSortDef(const std::string &name, const std::vector< std::shared_ptr< Sort > > ¶ms, std::shared_ptr< Sort > out_sort)
static const std::shared_ptr< Sort > FLOAT64_SORT
std::shared_ptr< Sort > createSortDec(const std::string &name, size_t arity)
static std::shared_ptr< Sort > getExt()
static const std::shared_ptr< Sort > RAND_SORT
size_t getIndex(const std::shared_ptr< Sort > &sort) const
static std::shared_ptr< Sort > getUnknown()
std::shared_ptr< Sort > createFPSort(size_t exp, size_t sig)
std::shared_ptr< Sort > createTupleSort(const std::vector< std::shared_ptr< Sort > > &fields)
std::vector< std::shared_ptr< Sort > > getParams(const std::shared_ptr< Sort > &sort)
static std::shared_ptr< Sort > getNull()
std::shared_ptr< Sort > getSort(const size_t index) const
static const std::shared_ptr< Sort > REG_SORT
static std::shared_ptr< Sort > getInt()
static const std::shared_ptr< Sort > BOOL_SORT
static const std::shared_ptr< Sort > REAL_SORT
static const std::shared_ptr< Sort > UNKNOWN_SORT
static const std::shared_ptr< Sort > EXT_SORT
static std::shared_ptr< Sort > getIntOrReal()
static std::shared_ptr< Sort > getReg()
static const std::shared_ptr< Sort > NULL_SORT
size_t getSignificandWidth(const std::shared_ptr< Sort > &sort)
static const std::shared_ptr< Sort > NAT_SORT
static std::shared_ptr< Sort > getFloat16()
static std::shared_ptr< Sort > getAlgebraic()
static std::shared_ptr< Sort > getTranscendental()
static std::shared_ptr< Sort > getNat()
size_t getExponentWidth(const std::shared_ptr< Sort > &sort)
static std::shared_ptr< Sort > getBool()
size_t getSignificandWidth() const
size_t hash_without_name() const
bool isTranscendental() const
std::shared_ptr< Sort > getOutSort() const
std::shared_ptr< Sort > getIndexSort() const
size_t getExponentWidth() const
Sort(SORT_KIND kind, std::string name)
std::shared_ptr< Sort > getParamSort(size_t index) const
bool isRoundingMode() const
bool isEqTo(const Sort &other) const
bool operator!=(const Sort &other) const
void setName(const std::string &n)
std::shared_ptr< Sort > getElemSort() const
std::string toString() const
std::vector< std::shared_ptr< Sort > > getParams() const
Sort(SORT_KIND kind, std::string name, size_t arity)
size_t getBitWidth() const
Sort(SORT_KIND kind, std::string name, size_t arity, std::vector< std::shared_ptr< Sort > > children)
bool operator==(const Sort &other) const
bool isEqTo(const std::shared_ptr< Sort > &other) const
std::vector< std::shared_ptr< Sort > > children
std::shared_ptr< Sort > SortPtr
std::shared_ptr< SortManager > SortManagerPtr