17 if(type.
id() == ID_unsignedbv)
19 else if(type.
id() == ID_bool)
21 else if(type.
id() == ID_integer)
23 else if(type.
id() == ID_real)
25 else if(type.
id() == ID_array)
28 out <<
"(Array " <<
smt2_format(array_type.size().type()) <<
' '
31 else if(type.
id() == ID_floatbv)
36 out <<
"(_ FloatingPoint " << floatbv_type.get_e() <<
' '
37 << floatbv_type.get_f() + 1 <<
')';
40 out <<
"? " << type.
id();
50 const auto &value = constant_expr.get_value();
53 if(expr_type.
id() == ID_unsignedbv)
57 const auto int_value = numeric_cast_v<mp_integer>(constant_expr);
59 out <<
"(_ bv" << int_value <<
" " << width <<
")";
61 else if(expr_type.
id() == ID_bool)
70 else if(expr_type.
id() == ID_integer)
73 auto int_value = numeric_cast_v<mp_integer>(constant_expr);
75 out <<
"(- " << -int_value <<
')';
79 else if(expr_type.
id() == ID_string)
83 for(
const auto &c : value)
94 else if(expr_type.
id() == ID_floatbv)
97 const size_t e = v.
spec.
e;
98 const size_t f = v.
spec.
f + 1;
102 out <<
"(_ NaN " << e <<
" " << f <<
")";
107 out <<
"(_ -oo " << e <<
" " << f <<
")";
109 out <<
"(_ +oo " << e <<
" " << f <<
")";
119 <<
"#b" << binaryString.substr(0, 1) <<
" "
120 <<
"#b" << binaryString.substr(1, e) <<
" "
121 <<
"#b" << binaryString.substr(1 + e, f - 1) <<
")";
127 else if(expr.
id() == ID_symbol)
139 else if(expr.
id() == ID_with && expr.
type().
id() == ID_array)
142 out <<
"(store " <<
smt2_format(with_expr.old()) <<
' '
146 else if(expr.
id() == ID_array_list)
150 for(std::size_t i = 0; i < array_list_expr.operands().size(); i += 2)
158 for(std::size_t i = 0; i < array_list_expr.operands().size(); i += 2)
161 i < array_list_expr.operands().size() - 1,
162 "array_list has even number of operands");
163 out <<
' ' <<
smt2_format(array_list_expr.operands()[i]) <<
' '
164 <<
smt2_format(array_list_expr.operands()[i + 1]) <<
')';
168 out <<
"? " << expr.
id();
Pre-defined bitvector types.
const floatbv_typet & to_floatbv_type(const typet &type)
Cast a typet to a floatbv_typet.
const unsignedbv_typet & to_unsignedbv_type(const typet &type)
Cast a typet to an unsignedbv_typet.
const typet & element_type() const
The type of the elements of the array.
std::size_t get_width() const
Base class for all expressions.
bool is_true() const
Return whether the expression is a constant representing true.
bool is_false() const
Return whether the expression is a constant representing false.
typet & type()
Return the type of the expression.
bool is_constant() const
Return whether the expression is a constant.
std::size_t width() const
bool get_bool(const irep_idt &name) const
const std::string & id_string() const
const irep_idt & id() const
const irep_idt & get_identifier() const
The type of an expression, extends irept.
static std::string binary(const constant_exprt &src)
const std::string integer2binary(const mp_integer &n, std::size_t width)
#define DATA_INVARIANT(CONDITION, REASON)
This condition should be used to document that assumptions that are made on goto_functions,...
const constant_exprt & to_constant_expr(const exprt &expr)
Cast an exprt to a constant_exprt.
const symbol_exprt & to_symbol_expr(const exprt &expr)
Cast an exprt to a symbol_exprt.
const multi_ary_exprt & to_multi_ary_expr(const exprt &expr)
Cast an exprt to a multi_ary_exprt.
const with_exprt & to_with_expr(const exprt &expr)
Cast an exprt to a with_exprt.
const array_typet & to_array_type(const typet &type)
Cast a typet to an array_typet.