52template <
typename factoryt>
56 const factoryt &factory)
59 const auto operand_terms =
61 return converted.at(expr);
63 return std::accumulate(
64 ++operand_terms.begin(),
66 *operand_terms.begin(),
74template <
typename target_typet>
79 return can_cast_type<target_typet>(operand.type());
153 const std::size_t c_bool_width = to_type.
get_width();
160static std::function<std::function<smt_termt(smt_termt)>(std::size_t)>
182 "Generation of SMT formula for type cast to fixed-point bitvector "
189 "Generation of SMT formula for type cast to floating-point bitvector "
193 const std::size_t from_width =
from_type.get_width();
194 const std::size_t to_width = to_type.
get_width();
195 if(to_width == from_width)
197 if(to_width < from_width)
199 const std::size_t extension_size = to_width - from_width;
231 "Generation of SMT formula for type cast to bit vector from type: " +
238 "Generation of SMT formula for type cast to bit vector from type: " +
252 return *converter.result;
259 const auto &from_term = converted.at(cast.
op());
269 "Generation of SMT formula for type cast expression: " + cast.
pretty());
277 "Generation of SMT formula for floating point type cast expression: " +
286 "Generation of SMT formula for struct construction expression: " +
287 struct_construction.
pretty());
295 "Generation of SMT formula for union construction expression: " +
296 union_construction.
pretty());
316 const auto &width = bit_vector_sort.
bit_width();
326 "Conversion of array SMT literal " + array_sort.
pretty());
334 const size_t bit_width =
338 const auto address = 0;
352 sort.accept(converter);
366 "Generation of SMT formula for concatenation expression: " +
382 "Generation of SMT formula for bitwise and expression: " +
383 bitwise_and_expr.
pretty());
399 "Generation of SMT formula for bitwise or expression: " +
400 bitwise_or_expr.
pretty());
416 "Generation of SMT formula for bitwise xor expression: " +
432 "Generation of SMT formula for bitnot_exprt: " + bitwise_not.
pretty());
447 "Generation of SMT formula for unary minus expression: " +
457 "Generation of SMT formula for unary plus expression: " +
466 "Generation of SMT formula for \"is negative\" expression: " +
475 converted.at(if_expression.
cond()),
509 converted.at(implies.
op0()), converted.at(implies.
op1()));
524 converted.at(equal.
op0()), converted.at(equal.
op1()));
532 converted.at(not_equal.
op0()), converted.at(not_equal.
op1()));
540 "Generation of SMT formula for floating point equality expression: " +
549 "Generation of SMT formula for floating point not equal expression: " +
550 float_not_equal.
pretty());
553template <
typename unsigned_factory_typet,
typename signed_factory_typet>
556 const unsigned_factory_typet &unsigned_factory,
557 const signed_factory_typet &signed_factory,
561 const auto &lhs = converted.at(binary_relation.
lhs());
562 const auto &rhs = converted.at(binary_relation.
rhs());
563 const typet operand_type = binary_relation.
lhs().
type();
572 const auto lhs_type_is_pointer =
574 const auto rhs_type_is_pointer =
577 lhs_type_is_pointer && rhs_type_is_pointer,
578 "pointer comparison requires that both operand types are pointers.");
579 return unsigned_factory(lhs, rhs);
584 return unsigned_factory(lhs, rhs);
586 return signed_factory(lhs, rhs);
590 "Generation of SMT formula for relational expression: " +
591 binary_relation.
pretty());
607 const auto greater_than_or_equal =
611 *greater_than_or_equal,
625 const auto less_than_or_equal =
644 return can_cast_type<integer_bitvector_typet>(operand.type());
654 "We are only handling a binary version of plus when it has a pointer "
659 for(
auto &operand : plus.
operands())
675 "An addition expression with both operands being pointers when they are "
676 "not dereferenced is malformed");
681 const auto pointer_size = pointer_sizes.at(base_type);
684 converted.at(pointer),
690 "Generation of SMT formula for plus expression: " + plus.
pretty());
699 const bool both_operands_bitvector =
706 const bool both_operands_pointers = lhs_is_pointer && rhs_is_pointer;
710 const bool one_operand_pointer = lhs_is_pointer || rhs_is_pointer;
712 if(both_operands_bitvector)
715 converted.at(minus.
lhs()), converted.at(minus.
rhs()));
717 else if(both_operands_pointers)
722 lhs_base_type == rhs_base_type,
723 "only pointers of the same object type can be subtracted.");
726 converted.at(minus.
lhs()), converted.at(minus.
rhs())),
727 pointer_sizes.at(lhs_base_type));
729 else if(one_operand_pointer)
735 "minus expressions of pointer and integer expect lhs to be the pointer");
739 converted.at(minus.
lhs()),
741 converted.at(minus.
rhs()), pointer_sizes.at(lhs_base_type)));
746 "Generation of SMT formula for minus expression: " + minus.
pretty());
757 const bool both_operands_bitvector =
761 const bool both_operands_unsigned =
765 if(both_operands_bitvector)
767 if(both_operands_unsigned)
779 "Generation of SMT formula for divide expression: " + divide.
pretty());
790 "Generation of SMT formula for floating point operation expression: " +
791 float_operation.
pretty());
798 const smt_termt &lhs = converted.at(truncation_modulo.
lhs());
799 const smt_termt &rhs = converted.at(truncation_modulo.
rhs());
801 const bool both_operands_bitvector =
805 const bool both_operands_unsigned =
809 if(both_operands_bitvector)
811 if(both_operands_unsigned)
823 "Generation of SMT formula for remainder (modulus) expression: " +
824 truncation_modulo.
pretty());
833 "Generation of SMT formula for euclidean modulo expression: " +
834 euclidean_modulo.
pretty());
845 return can_cast_type<integer_bitvector_typet>(operand.type());
854 "Generation of SMT formula for multiply expression: " +
873 type,
"Result of the address_of operator should have pointer type.");
875 const auto object = object_map.find(base);
877 object != object_map.end(),
878 "Objects should be tracked before converting their address to SMT terms");
879 const std::size_t object_id =
object->second.unique_id;
881 const std::size_t max_objects = std::size_t(1) << object_bits;
882 if(object_id >= max_objects)
885 "too many addressed objects: maximum number of objects is set to 2^n=" +
886 std::to_string(max_objects) +
" (with n=" + std::to_string(object_bits) +
888 "use the `--object-bits n` option to increase the maximum number"};
893 type->get_width() > object_bits,
894 "Pointer should be wider than object_bits in order to allow for offset "
896 const size_t offset_bits = type->get_width() - object_bits;
905 "Generation of SMT formula for address of expression: " +
924 "Generation of SMT formula for array comprehension expression: " +
925 array_comprehension.
pretty());
937template <
typename factoryt,
typename shiftt>
939 const factoryt &factory,
943 const smt_termt &first_operand = converted.at(shift.op0());
944 const smt_termt &second_operand = converted.at(shift.op1());
945 const auto first_bit_vector_sort =
947 const auto second_bit_vector_sort =
950 first_bit_vector_sort && second_bit_vector_sort,
951 "Shift expressions are expected to have bit vector operands.");
953 shift.type() == shift.op0().type(),
954 "Shift expression type must be equals to first operand type.");
955 const std::size_t first_width = first_bit_vector_sort->bit_width();
956 const std::size_t second_width = second_bit_vector_sort->
bit_width();
957 if(first_width > second_width)
964 else if(first_width < second_width)
966 const auto result = factory(
974 return factory(first_operand, second_operand);
992 *right_logical_shift,
1003 "Generation of SMT formula for shift expression: " + shift.
pretty());
1011 for(
auto it = ++with.
operands().begin(); it != with.
operands().end(); it += 2)
1013 const smt_termt &index_term = converted.at(it[0]);
1014 const smt_termt &value_term = converted.at(it[1]);
1029 "Generation of SMT formula for with expression: " + with.
pretty());
1037 "Generation of SMT formula for update expression: " + update.
pretty());
1045 "Generation of SMT formula for member extraction expression: " +
1046 member_extraction.
pretty());
1057 pointer_sort,
"Pointers should be encoded as bit vector sorted terms.");
1058 const std::size_t pointer_width = pointer_sort->bit_width();
1059 return apply_is_dynamic_object(
1077 width >= object_bits,
1078 "Width should be at least as big as the number of object bits.");
1081 width - 1, width - object_bits)(converted.at(pointer_expr));
1096 "Generation of SMT formula for string constant expression: " +
1097 string_constant.
pretty());
1105 "Generation of SMT formula for extract bit expression: " +
1113 const smt_termt &from = converted.at(extract_bits.
src());
1116 if(upper_value && lower_value)
1119 "Generation of SMT formula for extract bits expression: " +
1128 "Generation of SMT formula for bit vector replication expression: " +
1137 "Generation of SMT formula for byte extract expression: " +
1138 byte_extraction.
pretty());
1146 "Generation of SMT formula for byte update expression: " +
1155 "Generation of SMT formula for absolute value of expression: " +
1156 absolute_value_of.
pretty());
1164 "Generation of SMT formula for is not a number expression: " +
1173 "Generation of SMT formula for is finite expression: " +
1174 is_finite_expr.
pretty());
1182 "Generation of SMT formula for is infinite expression: " +
1183 is_infinite_expr.
pretty());
1191 "Generation of SMT formula for is infinite expression: " +
1192 is_normal_expr.
pretty());
1203 "Most significant bit can only be extracted from bit vector terms.");
1204 const size_t most_significant_bit_index = bit_vector_sort->bit_width() - 1;
1206 most_significant_bit_index, most_significant_bit_index);
1215 const smt_termt &left = converted.at(plus_overflow.
lhs());
1216 const smt_termt &right = converted.at(plus_overflow.
rhs());
1236 "Generation of SMT formula for plus overflow expression: " +
1244 const smt_termt &left = converted.at(minus_overflow.
lhs());
1245 const smt_termt &right = converted.at(minus_overflow.
rhs());
1268 "Generation of SMT formula for minus overflow expression: " +
1269 minus_overflow.
pretty());
1277 const auto &operand_type = mult_overflow.
lhs().
type();
1278 const smt_termt &left = converted.at(mult_overflow.
lhs());
1279 const smt_termt &right = converted.at(mult_overflow.
rhs());
1281 const auto unsigned_type =
1284 const std::size_t width = unsigned_type->get_width();
1291 const auto signed_type =
1296 const std::size_t width = signed_type->get_width();
1298 const auto multiplication =
1311 "Generation of SMT formula for multiply overflow expression: " +
1321 INVARIANT(type,
"Pointer object should have a bitvector-based type.");
1322 const auto converted_expr = converted.at(
pointer_object.pointer());
1323 const std::size_t width = type->get_width();
1326 width >= object_bits,
1327 "Width should be at least as big as the number of object bits.");
1328 const std::size_t ext = width - object_bits;
1330 width - 1, width - object_bits)(converted_expr);
1344 INVARIANT(type,
"Pointer offset should have a bitvector-based type.");
1345 const auto converted_expr = converted.at(
pointer_offset.pointer());
1346 const std::size_t width = type->get_width();
1348 if(offset_bits > width)
1349 offset_bits = width;
1350 const auto extract_op =
1352 if(width > offset_bits)
1364 "Generation of SMT formula for shift left overflow expression: " +
1383 "Generation of SMT formula for literal expression: " + literal.
pretty());
1391 "Generation of SMT formula for for all expression: " + for_all.
pretty());
1399 "Generation of SMT formula for exists expression: " +
exists.pretty());
1407 "Generation of SMT formula for vector expression: " + vector.
pretty());
1418 pointer_sort,
"Pointers should be encoded as bit vector sorted terms.");
1419 const std::size_t pointer_width = pointer_sort->bit_width();
1420 return call_object_size(
1430 "Generation of SMT formula for let expression: " + let.
pretty());
1438 "Generation of SMT formula for byte swap expression: " +
1447 "Generation of SMT formula for population count expression: " +
1448 population_count.
pretty());
1456 "Generation of SMT formula for count leading zeros expression: " +
1457 count_leading_zeros.
pretty());
1465 "Generation of SMT formula for byte swap expression: " +
1466 count_trailing_zeros.
pretty());
1474 "prophecy_r_or_w_ok expression should have been lowered by the decision "
1475 "procedure before conversion to smt terms");
1483 "prophecy_pointer_in_range expression should have been lowered by the "
1484 "decision procedure before conversion to smt terms");
1590 const auto float_equal =
1596 const auto float_not_equal =
1602 const auto converted_relational =
1605 return *converted_relational;
1620 const auto float_operation =
1630 const auto euclidean_modulo =
1640 else if(expr.
id() == ID_floatbv_rem)
1654 const auto array_comprehension =
1692 const auto is_dynamic_object =
1696 *is_dynamic_object, converted, apply_is_dynamic_object);
1699 const auto is_invalid_pointer =
1721 const auto byte_extraction =
1756 const auto minus_overflow =
1799 expr.
id() != ID_constraint_select_one,
1800 "constraint_select_one is not expected in smt conversion: " +
1811 const auto count_leading_zeros =
1817 const auto count_trailing_zeros =
1823 const auto prophecy_r_or_w_ok =
1829 const auto prophecy_pointer_in_range =
1836 "Generation of SMT formula for unknown kind of expression: " +
1840#ifndef CPROVER_INVARIANT_DO_NOT_CHECK
1841template <
typename functiont>
1855template <
typename functiont>
1866 if(!address_of_expr)
1868 const auto array_index_expr =
1870 if(!array_index_expr)
1874 array_index_expr->array(),
1876 array_index_expr->index()};
1886 std::function<
bool(
const exprt &)> filter,
1887 std::function<
void(
const exprt &)> visitor)
1892 bool operands_pushed;
1893 explicit stack_entryt(
const exprt *_e) : e(_e), operands_pushed(
false)
1898 std::stack<stack_entryt> stack;
1900 stack.emplace(&_expr);
1902 while(!stack.empty())
1904 auto &top = stack.top();
1905 if(top.operands_pushed)
1913 top.operands_pushed =
true;
1915 for(
auto &op : top.e->operands())
1928#ifndef CPROVER_INVARIANT_DO_NOT_CHECK
1929 static bool in_conversion =
false;
1932 "Conversion of expr to smt should be non-recursive. "
1933 "Re-entrance found in conversion of " +
1935 in_conversion =
true;
1936 const auto end_conversion =
at_scope_exit([&]() { in_conversion =
false; });
1942 [](
const exprt &expr) {
1952 [&](
const exprt &expr) {
1953 const auto find_result = sub_expression_map.find(expr);
1954 if(find_result != sub_expression_map.cend())
1963 sub_expression_map.emplace_hint(find_result, expr, std::move(term));
1965 return std::move(sub_expression_map.at(lowered_expr));
API to expression classes for bitvectors.
bool can_cast_type< signedbv_typet >(const typet &type)
Check whether a reference to a typet is a signedbv_typet.
const fixedbv_typet & to_fixedbv_type(const typet &type)
Cast a typet to a fixedbv_typet.
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< bv_typet >(const typet &type)
Check whether a reference to a typet is a bv_typet.
bool can_cast_type< unsignedbv_typet >(const typet &type)
Check whether a reference to a typet is a unsignedbv_typet.
const floatbv_typet & to_floatbv_type(const typet &type)
Cast a typet to a floatbv_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.
struct configt::bv_encodingt bv_encoding
A constant literal expression.
const irep_idt & get_value() const
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.
bool is_true() const
Return whether the expression is a constant representing true.
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.
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 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.
static optionalt< smt_termt > try_relational_conversion(const exprt &expr, const sub_expression_mapt &converted)
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.
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.
bool is_null_pointer(const constant_exprt &expr)
Returns true if expr has a pointer type and a value NULL; it also returns true when expr has value ze...
Deprecated expression utility functions.
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.
nonstd::optional< T > optionalt
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< array_typet >(const typet &type)
Check whether a reference to a typet is a array_typet.
bool can_cast_type< code_typet >(const typet &type)
Check whether a reference to a typet is a code_typet.
bool can_cast_type< bitvector_typet >(const typet &type)
Check whether a reference to a typet is a bitvector_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)
optionalt< smt_termt > result
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
void visit(const smt_array_sortt &array_sort) override
void visit(const smt_bit_vector_sortt &bit_vector_sort) override
const constant_exprt & member_input
void visit(const smt_bool_sortt &) override
sort_based_literal_convertert(const constant_exprt &input)
optionalt< smt_termt > result
std::unordered_map< typet, smt_termt, irep_hash > type_size_mapt