51template <
typename factoryt>
55 const factoryt &factory)
58 const auto operand_terms =
60 return converted.at(expr);
62 return std::accumulate(
63 ++operand_terms.begin(),
65 *operand_terms.begin(),
73template <
typename target_typet>
78 return can_cast_type<target_typet>(operand.type());
152 const std::size_t c_bool_width = to_type.
get_width();
159static std::function<std::function<smt_termt(smt_termt)>(std::size_t)>
181 "Generation of SMT formula for type cast to fixed-point bitvector "
188 "Generation of SMT formula for type cast to floating-point bitvector "
192 const std::size_t from_width =
from_type.get_width();
193 const std::size_t to_width = to_type.
get_width();
194 if(to_width == from_width)
196 if(to_width < from_width)
198 const std::size_t extension_size = to_width - from_width;
230 "Generation of SMT formula for type cast to bit vector from type: " +
237 "Generation of SMT formula for type cast to bit vector from type: " +
251 return *converter.result;
258 const auto &from_term = converted.at(cast.
op());
268 "Generation of SMT formula for type cast expression: " + cast.
pretty());
276 "Generation of SMT formula for floating point type cast expression: " +
285 "Generation of SMT formula for struct construction expression: " +
286 struct_construction.
pretty());
294 "Generation of SMT formula for union construction expression: " +
295 union_construction.
pretty());
315 const auto &width = bit_vector_sort.
bit_width();
325 "Conversion of array SMT literal " + array_sort.
pretty());
333 const size_t bit_width =
337 const auto address = 0;
351 sort.accept(converter);
365 "Generation of SMT formula for concatenation expression: " +
381 "Generation of SMT formula for bitwise and expression: " +
382 bitwise_and_expr.
pretty());
398 "Generation of SMT formula for bitwise or expression: " +
399 bitwise_or_expr.
pretty());
415 "Generation of SMT formula for bitwise xor expression: " +
431 "Generation of SMT formula for bitnot_exprt: " + bitwise_not.
pretty());
446 "Generation of SMT formula for unary minus expression: " +
456 "Generation of SMT formula for unary plus expression: " +
465 "Generation of SMT formula for \"is negative\" expression: " +
474 converted.at(if_expression.
cond()),
508 converted.at(implies.
op0()), converted.at(implies.
op1()));
523 converted.at(equal.
op0()), converted.at(equal.
op1()));
531 converted.at(not_equal.
op0()), converted.at(not_equal.
op1()));
539 "Generation of SMT formula for floating point equality expression: " +
548 "Generation of SMT formula for floating point not equal expression: " +
549 float_not_equal.
pretty());
552template <
typename unsigned_factory_typet,
typename signed_factory_typet>
555 const unsigned_factory_typet &unsigned_factory,
556 const signed_factory_typet &signed_factory,
560 const auto &lhs = converted.at(binary_relation.
lhs());
561 const auto &rhs = converted.at(binary_relation.
rhs());
562 const typet operand_type = binary_relation.
lhs().
type();
571 const auto lhs_type_is_pointer =
573 const auto rhs_type_is_pointer =
576 lhs_type_is_pointer && rhs_type_is_pointer,
577 "pointer comparison requires that both operand types are pointers.");
578 return unsigned_factory(lhs, rhs);
583 return unsigned_factory(lhs, rhs);
585 return signed_factory(lhs, rhs);
589 "Generation of SMT formula for relational expression: " +
590 binary_relation.
pretty());
606 const auto greater_than_or_equal =
610 *greater_than_or_equal,
624 const auto less_than_or_equal =
643 return can_cast_type<integer_bitvector_typet>(operand.type());
653 "We are only handling a binary version of plus when it has a pointer "
658 for(
auto &operand : plus.
operands())
674 "An addition expression with both operands being pointers when they are "
675 "not dereferenced is malformed");
680 const auto pointer_size = pointer_sizes.at(base_type);
683 converted.at(pointer),
689 "Generation of SMT formula for plus expression: " + plus.
pretty());
698 const bool both_operands_bitvector =
705 const bool both_operands_pointers = lhs_is_pointer && rhs_is_pointer;
709 const bool one_operand_pointer = lhs_is_pointer || rhs_is_pointer;
711 if(both_operands_bitvector)
714 converted.at(minus.
lhs()), converted.at(minus.
rhs()));
716 else if(both_operands_pointers)
721 lhs_base_type == rhs_base_type,
722 "only pointers of the same object type can be subtracted.");
725 converted.at(minus.
lhs()), converted.at(minus.
rhs())),
726 pointer_sizes.at(lhs_base_type));
728 else if(one_operand_pointer)
734 "minus expressions of pointer and integer expect lhs to be the pointer");
738 converted.at(minus.
lhs()),
740 converted.at(minus.
rhs()), pointer_sizes.at(lhs_base_type)));
745 "Generation of SMT formula for minus expression: " + minus.
pretty());
756 const bool both_operands_bitvector =
760 const bool both_operands_unsigned =
764 if(both_operands_bitvector)
766 if(both_operands_unsigned)
778 "Generation of SMT formula for divide expression: " + divide.
pretty());
789 "Generation of SMT formula for floating point operation expression: " +
790 float_operation.
pretty());
797 const smt_termt &lhs = converted.at(truncation_modulo.
lhs());
798 const smt_termt &rhs = converted.at(truncation_modulo.
rhs());
800 const bool both_operands_bitvector =
804 const bool both_operands_unsigned =
808 if(both_operands_bitvector)
810 if(both_operands_unsigned)
822 "Generation of SMT formula for remainder (modulus) expression: " +
823 truncation_modulo.
pretty());
832 "Generation of SMT formula for euclidean modulo expression: " +
833 euclidean_modulo.
pretty());
844 return can_cast_type<integer_bitvector_typet>(operand.type());
853 "Generation of SMT formula for multiply expression: " +
872 type,
"Result of the address_of operator should have pointer type.");
874 const auto object = object_map.find(base);
876 object != object_map.end(),
877 "Objects should be tracked before converting their address to SMT terms");
878 const std::size_t object_id =
object->second.unique_id;
879 const std::size_t object_bits =
config.bv_encoding.object_bits;
880 const std::size_t max_objects = std::size_t(1) << object_bits;
881 if(object_id >= max_objects)
884 "too many addressed objects: maximum number of objects is set to 2^n=" +
885 std::to_string(max_objects) +
" (with n=" + std::to_string(object_bits) +
887 "use the `--object-bits n` option to increase the maximum number"};
892 type->get_width() > object_bits,
893 "Pointer should be wider than object_bits in order to allow for offset "
895 const size_t offset_bits = type->get_width() - object_bits;
902 "Generation of SMT formula for address of expression: " +
921 "Generation of SMT formula for array comprehension expression: " +
922 array_comprehension.
pretty());
934template <
typename factoryt,
typename shiftt>
936 const factoryt &factory,
940 const smt_termt &first_operand = converted.at(shift.op0());
941 const smt_termt &second_operand = converted.at(shift.op1());
942 const auto first_bit_vector_sort =
944 const auto second_bit_vector_sort =
947 first_bit_vector_sort && second_bit_vector_sort,
948 "Shift expressions are expected to have bit vector operands.");
950 shift.type() == shift.op0().type(),
951 "Shift expression type must be equals to first operand type.");
952 const std::size_t first_width = first_bit_vector_sort->bit_width();
953 const std::size_t second_width = second_bit_vector_sort->
bit_width();
954 if(first_width > second_width)
961 else if(first_width < second_width)
963 const auto result = factory(
971 return factory(first_operand, second_operand);
989 *right_logical_shift,
1000 "Generation of SMT formula for shift expression: " + shift.
pretty());
1008 for(
auto it = ++with.
operands().begin(); it != with.
operands().end(); it += 2)
1010 const smt_termt &index_term = converted.at(it[0]);
1011 const smt_termt &value_term = converted.at(it[1]);
1026 "Generation of SMT formula for with expression: " + with.
pretty());
1034 "Generation of SMT formula for update expression: " + update.
pretty());
1042 "Generation of SMT formula for member extraction expression: " +
1043 member_extraction.
pretty());
1054 pointer_sort,
"Pointers should be encoded as bit vector sorted terms.");
1055 const std::size_t pointer_width = pointer_sort->bit_width();
1056 return apply_is_dynamic_object(
1059 pointer_width -
config.bv_encoding.object_bits)(pointer)});
1071 const std::size_t object_bits =
config.bv_encoding.object_bits;
1074 width >= object_bits,
1075 "Width should be at least as big as the number of object bits.");
1078 width - 1, width - object_bits)(converted.at(pointer_expr));
1083 invalid_pointer.unique_id,
config.bv_encoding.object_bits);
1093 "Generation of SMT formula for string constant expression: " +
1094 string_constant.
pretty());
1102 "Generation of SMT formula for extract bit expression: " +
1110 const smt_termt &from = converted.at(extract_bits.
src());
1111 const auto bit_vector_sort =
1114 bit_vector_sort,
"Extract can only be applied to bit vector terms.");
1118 *index_value + bit_vector_sort->bit_width() - 1, *index_value)(from);
1120 "Generation of SMT formula for extract bits expression: " +
1129 "Generation of SMT formula for bit vector replication expression: " +
1138 "Generation of SMT formula for byte extract expression: " +
1139 byte_extraction.
pretty());
1147 "Generation of SMT formula for byte update expression: " +
1156 "Generation of SMT formula for absolute value of expression: " +
1157 absolute_value_of.
pretty());
1165 "Generation of SMT formula for is not a number expression: " +
1174 "Generation of SMT formula for is finite expression: " +
1175 is_finite_expr.
pretty());
1183 "Generation of SMT formula for is infinite expression: " +
1184 is_infinite_expr.
pretty());
1192 "Generation of SMT formula for is infinite expression: " +
1193 is_normal_expr.
pretty());
1204 "Most significant bit can only be extracted from bit vector terms.");
1205 const size_t most_significant_bit_index = bit_vector_sort->bit_width() - 1;
1207 most_significant_bit_index, most_significant_bit_index);
1216 const smt_termt &left = converted.at(plus_overflow.
lhs());
1217 const smt_termt &right = converted.at(plus_overflow.
rhs());
1237 "Generation of SMT formula for plus overflow expression: " +
1245 const smt_termt &left = converted.at(minus_overflow.
lhs());
1246 const smt_termt &right = converted.at(minus_overflow.
rhs());
1269 "Generation of SMT formula for minus overflow expression: " +
1270 minus_overflow.
pretty());
1278 const auto &operand_type = mult_overflow.
lhs().
type();
1279 const smt_termt &left = converted.at(mult_overflow.
lhs());
1280 const smt_termt &right = converted.at(mult_overflow.
rhs());
1282 const auto unsigned_type =
1285 const std::size_t width = unsigned_type->get_width();
1292 const auto signed_type =
1297 const std::size_t width = signed_type->get_width();
1299 const auto multiplication =
1312 "Generation of SMT formula for multiply overflow expression: " +
1322 INVARIANT(type,
"Pointer object should have a bitvector-based type.");
1323 const auto converted_expr = converted.at(
pointer_object.pointer());
1324 const std::size_t width = type->get_width();
1325 const std::size_t object_bits =
config.bv_encoding.object_bits;
1327 width >= object_bits,
1328 "Width should be at least as big as the number of object bits.");
1329 const std::size_t ext = width - object_bits;
1331 width - 1, width - object_bits)(converted_expr);
1345 INVARIANT(type,
"Pointer offset should have a bitvector-based type.");
1346 const auto converted_expr = converted.at(
pointer_offset.pointer());
1347 const std::size_t width = type->get_width();
1348 std::size_t offset_bits = width -
config.bv_encoding.object_bits;
1349 if(offset_bits > width)
1350 offset_bits = width;
1351 const auto extract_op =
1353 if(width > offset_bits)
1365 "Generation of SMT formula for shift left overflow expression: " +
1384 "Generation of SMT formula for literal expression: " + literal.
pretty());
1392 "Generation of SMT formula for for all expression: " + for_all.
pretty());
1400 "Generation of SMT formula for exists expression: " +
exists.pretty());
1408 "Generation of SMT formula for vector expression: " + vector.
pretty());
1419 pointer_sort,
"Pointers should be encoded as bit vector sorted terms.");
1420 const std::size_t pointer_width = pointer_sort->bit_width();
1421 return call_object_size(
1424 pointer_width -
config.bv_encoding.object_bits)(pointer)});
1431 "Generation of SMT formula for let expression: " + let.
pretty());
1439 "Generation of SMT formula for byte swap expression: " +
1448 "Generation of SMT formula for population count expression: " +
1449 population_count.
pretty());
1457 "Generation of SMT formula for count leading zeros expression: " +
1458 count_leading_zeros.
pretty());
1466 "Generation of SMT formula for count trailing zeros expression: " +
1467 count_trailing_zeros.
pretty());
1475 "zero_extend expression should have been lowered by the decision "
1476 "procedure before conversion to smt terms");
1484 "prophecy_r_or_w_ok expression should have been lowered by the decision "
1485 "procedure before conversion to smt terms");
1493 "prophecy_pointer_in_range expression should have been lowered by the "
1494 "decision procedure before conversion to smt terms");
1600 const auto float_equal =
1606 const auto float_not_equal =
1612 const auto converted_relational =
1615 return *converted_relational;
1630 const auto float_operation =
1640 const auto euclidean_modulo =
1650 else if(expr.
id() == ID_floatbv_rem)
1664 const auto array_comprehension =
1702 const auto is_dynamic_object =
1706 *is_dynamic_object, converted, apply_is_dynamic_object);
1709 const auto is_invalid_pointer =
1731 const auto byte_extraction =
1766 const auto minus_overflow =
1809 expr.
id() != ID_constraint_select_one,
1810 "constraint_select_one is not expected in smt conversion: " +
1821 const auto count_leading_zeros =
1827 const auto count_trailing_zeros =
1837 const auto prophecy_r_or_w_ok =
1843 const auto prophecy_pointer_in_range =
1850 "Generation of SMT formula for unknown kind of expression: " +
1854#ifndef CPROVER_INVARIANT_DO_NOT_CHECK
1855template <
typename functiont>
1869template <
typename functiont>
1880 if(!address_of_expr)
1882 const auto array_index_expr =
1884 if(!array_index_expr)
1888 array_index_expr->array(),
1890 array_index_expr->index()};
1900 std::function<
bool(
const exprt &)> filter,
1901 std::function<
void(
const exprt &)> visitor)
1906 bool operands_pushed;
1907 explicit stack_entryt(
const exprt *_e) : e(_e), operands_pushed(
false)
1912 std::stack<stack_entryt> stack;
1914 stack.emplace(&_expr);
1916 while(!stack.empty())
1918 auto &top = stack.top();
1919 if(top.operands_pushed)
1927 top.operands_pushed =
true;
1929 for(
auto &op : top.e->operands())
1942#ifndef CPROVER_INVARIANT_DO_NOT_CHECK
1943 static bool in_conversion =
false;
1946 "Conversion of expr to smt should be non-recursive. "
1947 "Re-entrance found in conversion of " +
1949 in_conversion =
true;
1950 const auto end_conversion =
at_scope_exit([&]() { in_conversion =
false; });
1956 [](
const exprt &expr) {
1966 [&](
const exprt &expr) {
1967 const auto find_result = sub_expression_map.find(expr);
1968 if(find_result != sub_expression_map.cend())
1977 sub_expression_map.emplace_hint(find_result, expr, std::move(term));
1979 return std::move(sub_expression_map.at(lowered_expr));
API to expression classes for bitvectors.
bool can_cast_type< integer_bitvector_typet >(const typet &type)
Check whether a reference to a typet is an integer_bitvector_typet.
bool can_cast_type< unsignedbv_typet >(const typet &type)
Check whether a reference to a typet is a unsignedbv_typet.
Expression classes for byte-level operators.
pointer_typet pointer_type(const typet &subtype)
Operator to return the address of an object.
Thrown when an unexpected error occurs during the analysis (e.g., when the SAT solver returns an erro...
Expression to define a mapping from an argument (index) to elements.
Array constructor from list of elements.
Array constructor from single element.
typet index_type() const
The type of the index expressions into any instance of this type.
const typet & element_type() const
The type of the elements of the array.
A base class for relations, i.e., binary predicates whose two operands have the same type.
Bit-wise negation of bit-vectors.
Base class of fixed-width bit-vector types.
std::size_t get_width() const
The byte swap expression.
Expression corresponding to op() where the bytes starting at position offset (given in number of byte...
Concatenation of bit-vector operands.
A constant literal expression.
bool is_null_pointer() const
Returns true if expr has a pointer type and a value NULL; it also returns true when expr has value ze...
The count leading zeros (counting the number of zero bits starting from the most-significant bit) exp...
The count trailing zeros (counting the number of zero bits starting from the least-significant bit) e...
Boute's Euclidean definition of Modulo – to match SMT-LIB2.
Base class for all expressions.
void visit_pre(std::function< void(exprt &)>)
typet & type()
Return the type of the expression.
Semantic type conversion from/to floating-point formats.
IEEE-floating-point equality.
IEEE floating-point disequality.
IEEE floating-point operations These have two data operands (op0 and op1) and one rounding mode (op2)...
The trinary if-then-else operator.
Unbounded, signed integers (mathematical integers, not bitvectors)
std::string pretty(unsigned indent=0, unsigned max_indent=0) const
const irep_idt & id() const
Evaluates to true if the operand is a pointer to a dynamic object.
Evaluates to true if the operand is finite.
Evaluates to true if the operand is infinite.
Evaluates to true if the operand is NaN.
Evaluates to true if the operand is a normal number.
Extract member of struct or union.
Modulo defined as lhs-(rhs * truncate(lhs/rhs)).
Binary multiplication Associativity is not specified.
A base class for multi-ary expressions Associativity is not specified.
Expression to hold a nondeterministic choice.
const irep_idt & get_identifier() const
Expression for finding the size (in bytes) of the object a pointer points to.
The plus expression Associativity is not specified.
A numerical identifier for the object a pointer points to.
The offset (in bytes) of a pointer relative to the object.
The pointer type These are both 'bitvector_typet' (they have a width) and 'type_with_subtypet' (they ...
const typet & base_type() const
The type of the data what we point to.
The popcount (counting the number of bits set to 1) expression.
pointer_in_range (see pointer_in_range_exprt) with prophecy expressions to encode whether a pointer r...
A base class for a predicate that indicates that an address range is ok to read or write or both.
A base class for shift and rotate operators.
Sign of an expression Predicate is true if _op is negative, false otherwise.
static const smt_function_application_termt::factoryt< storet > store
static const smt_function_application_termt::factoryt< selectt > select
std::size_t bit_width() const
static const smt_function_application_termt::factoryt< ort > make_or
static const smt_function_application_termt::factoryt< unsigned_less_than_or_equalt > unsigned_less_than_or_equal
static const smt_function_application_termt::factoryt< signed_less_than_or_equalt > signed_less_than_or_equal
static const smt_function_application_termt::factoryt< addt > add
static const smt_function_application_termt::factoryt< arithmetic_shift_rightt > arithmetic_shift_right
static const smt_function_application_termt::factoryt< signed_greater_than_or_equalt > signed_greater_than_or_equal
static const smt_function_application_termt::factoryt< unsigned_greater_thant > unsigned_greater_than
static const smt_function_application_termt::factoryt< unsigned_remaindert > unsigned_remainder
static const smt_function_application_termt::factoryt< unsigned_greater_than_or_equalt > unsigned_greater_than_or_equal
static const smt_function_application_termt::factoryt< xort > make_xor
static const smt_function_application_termt::factoryt< nott > make_not
static const smt_function_application_termt::factoryt< shift_leftt > shift_left
static const smt_function_application_termt::factoryt< multiplyt > multiply
static smt_function_application_termt::factoryt< sign_extendt > sign_extend(std::size_t i)
static const smt_function_application_termt::factoryt< signed_less_thant > signed_less_than
static smt_function_application_termt::factoryt< zero_extendt > zero_extend(std::size_t i)
static smt_function_application_termt::factoryt< extractt > extract(std::size_t i, std::size_t j)
Makes a factory for extract function applications.
static const smt_function_application_termt::factoryt< signed_greater_thant > signed_greater_than
static const smt_function_application_termt::factoryt< logical_shift_rightt > logical_shift_right
static const smt_function_application_termt::factoryt< negatet > negate
Arithmetic negation in two's complement.
static const smt_function_application_termt::factoryt< concatt > concat
static const smt_function_application_termt::factoryt< unsigned_dividet > unsigned_divide
static const smt_function_application_termt::factoryt< unsigned_less_thant > unsigned_less_than
static const smt_function_application_termt::factoryt< signed_dividet > signed_divide
static const smt_function_application_termt::factoryt< signed_remaindert > signed_remainder
static const smt_function_application_termt::factoryt< subtractt > subtract
static const smt_function_application_termt::factoryt< andt > make_and
static const smt_function_application_termt::factoryt< distinctt > distinct
Makes applications of the function which returns true iff its two arguments are not identical.
static const smt_function_application_termt::factoryt< if_then_elset > if_then_else
static const smt_function_application_termt::factoryt< impliest > implies
static const smt_function_application_termt::factoryt< ort > make_or
static const smt_function_application_termt::factoryt< equalt > equal
static const smt_function_application_termt::factoryt< andt > make_and
static const smt_function_application_termt::factoryt< xort > make_xor
static const smt_function_application_termt::factoryt< nott > make_not
Stores identifiers in unescaped and unquoted form.
std::string pretty(unsigned indent=0, unsigned max_indent=0) const
const sub_classt * cast() const &
void accept(smt_sort_const_downcast_visitort &) const
const smt_sortt & get_sort() const
Struct constructor from list of elements.
Expression to hold a symbol (variable)
const irep_idt & get_identifier() const
Semantic type conversion.
The type of an expression, extends irept.
The unary minus expression.
The unary plus expression.
Union constructor from single element.
Operator to update elements in structs and arrays.
Vector constructor from list of elements.
Operator to update elements in structs and arrays.
zero extension The operand is converted to the given type by either a) truncating if the new type is ...
void filtered_visit_post(const exprt &_expr, std::function< bool(const exprt &)> filter, std::function< void(const exprt &)> visitor)
Post order traversal where the children of a node are only visited if applying the filter function to...
exprt lower_address_of_array_index(exprt expr)
Lower the address_of(array[idx]) sub expressions in expr to idx + address_of(array),...
static smt_termt convert_bit_vector_cast(const smt_termt &from_term, const typet &from_type, const bitvector_typet &to_type)
static std::optional< smt_termt > try_relational_conversion(const exprt &expr, const sub_expression_mapt &converted)
static smt_termt most_significant_bit_is_set(const smt_termt &input)
Constructs a term which is true if the most significant bit of input is set.
static smt_termt convert_array_update_to_smt(const with_exprt &with, const sub_expression_mapt &converted)
static smt_termt make_bitvector_resize_cast(const smt_termt &from_term, const bitvector_typet &from_type, const bitvector_typet &to_type)
static std::function< std::function< smt_termt(smt_termt)>(std::size_t)> extension_for_type(const typet &type)
static smt_termt convert_multiary_operator_to_terms(const multi_ary_exprt &expr, const sub_expression_mapt &converted, const factoryt &factory)
Converts operator expressions with 2 or more operands to terms expressed as binary operator applicati...
std::unordered_map< exprt, smt_termt, irep_hash > sub_expression_mapt
Post order visitation is used in order to construct the the smt terms bottom upwards without using re...
static smt_termt make_not_zero(const smt_termt &input, const typet &source_type)
Makes a term which is true if input is not 0 / false.
static smt_termt convert_relational_to_smt(const binary_relation_exprt &binary_relation, const unsigned_factory_typet &unsigned_factory, const signed_factory_typet &signed_factory, const sub_expression_mapt &converted)
static smt_termt dispatch_expr_to_smt_conversion(const exprt &expr, const sub_expression_mapt &converted, const smt_object_mapt &object_map, const type_size_mapt &pointer_sizes, const smt_object_sizet::make_applicationt &call_object_size, const smt_is_dynamic_objectt::make_applicationt &apply_is_dynamic_object)
static smt_termt convert_to_smt_shift(const factoryt &factory, const shiftt &shift, const sub_expression_mapt &converted)
static smt_sortt convert_type_to_smt_sort(const bool_typet &type)
static smt_termt convert_c_bool_cast(const smt_termt &from_term, const typet &from_type, const bitvector_typet &to_type)
Returns a cast to C bool expressed in smt terms.
at_scope_exitt< functiont > at_scope_exit(functiont exit_function)
static bool operands_are_of_type(const exprt &expr)
Ensures that all operands of the argument expression have related types.
static smt_termt convert_expr_to_smt(const symbol_exprt &symbol_expr)
Templated functions to cast to specific exprt-derived classes.
auto type_checked_cast(TType &base) -> typename detail::expr_dynamic_cast_return_typet< T, TType >::type
Cast a reference to a generic typet to a specific derived class and checks that the type could be con...
auto type_try_dynamic_cast(TType &base) -> typename detail::expr_try_dynamic_cast_return_typet< T, TType >::type
Try to cast a reference to a generic typet to a specific derived class.
bool can_cast_type(const typet &base)
Check whether a reference to a generic typet is of a specific derived class.
auto expr_try_dynamic_cast(TExpr &base) -> typename detail::expr_try_dynamic_cast_return_typet< T, TExpr >::type
Try to cast a reference to a generic exprt to a specific derived class.
API to expression classes for floating-point arithmetic.
std::string from_type(const namespacet &ns, const irep_idt &identifier, const typet &type)
API to expression classes for 'mathematical' expressions.
mini_bddt exists(const mini_bddt &u, const unsigned var)
mp_integer bitwise_xor(const mp_integer &a, const mp_integer &b)
bitwise 'xor' of two nonnegative integers
exprt make_invalid_pointer_expr()
Create the invalid pointer constant.
exprt find_object_base_expression(const address_of_exprt &address_of)
The model of addresses we use consists of a unique object identifier and an offset.
std::unordered_map< exprt, decision_procedure_objectt, irep_hash > smt_object_mapt
Mapping from an object's base expression to the set of information about it which we track.
API to expression classes for Pointers.
bool can_cast_type< pointer_typet >(const typet &type)
Check whether a reference to a typet is a pointer_typet.
const pointer_typet & to_pointer_type(const typet &type)
Cast a typet to a pointer_typet.
exprt pointer_offset(const exprt &pointer)
exprt object_size(const exprt &pointer)
exprt pointer_object(const exprt &p)
Various predicates over pointers in programs.
Ranges: pair of begin and end iterators, which can be initialized from containers,...
ranget< iteratort > make_range(iteratort begin, iteratort end)
#define UNIMPLEMENTED_FEATURE(FEATURE)
#define UNREACHABLE
This should be used to mark dead code.
#define PRECONDITION(CONDITION)
#define INVARIANT(CONDITION, REASON)
This macro uses the wrapper function 'invariant_violated_string'.
#define POSTCONDITION(CONDITION)
#define UNREACHABLE_BECAUSE(REASON)
API to expression classes.
const binary_exprt & to_binary_expr(const exprt &expr)
Cast an exprt to a binary_exprt.
const unary_exprt & to_unary_expr(const exprt &expr)
Cast an exprt to a unary_exprt.
bool can_cast_type< code_typet >(const typet &type)
Check whether a reference to a typet is a code_typet.
binary_relation_exprt less_than(exprt lhs, exprt rhs)
binary_relation_exprt greater_than(exprt lhs, exprt rhs)
at_scope_exitt(functiont exit_function)
smt_function_application_termt::factoryt< smt_command_functiont > make_applicationt
Function which makes applications of the smt function.
smt_function_application_termt::factoryt< smt_command_functiont > make_applicationt
Function which makes applications of the smt function.
void visit(const smt_array_sortt &) override
const smt_termt & from_term
sort_based_cast_to_bit_vector_convertert(const smt_termt &from_term, const typet &from_type, const bitvector_typet &to_type)
void visit(const smt_bool_sortt &) override
const bitvector_typet & to_type
void visit(const smt_bit_vector_sortt &) override
std::optional< smt_termt > result
void visit(const smt_array_sortt &array_sort) override
void visit(const smt_bit_vector_sortt &bit_vector_sort) override
std::optional< smt_termt > result
const constant_exprt & member_input
void visit(const smt_bool_sortt &) override
sort_based_literal_convertert(const constant_exprt &input)
std::unordered_map< typet, smt_termt, irep_hash > type_size_mapt