CBMC
Loading...
Searching...
No Matches
boolbv.cpp
Go to the documentation of this file.
1/*******************************************************************\
2
3Module:
4
5Author: Daniel Kroening, kroening@kroening.com
6
7\*******************************************************************/
8
9#include "boolbv.h"
10
11#include <util/arith_tools.h>
12#include <util/bitvector_expr.h>
14#include <util/byte_operators.h>
15#include <util/config.h>
16#include <util/floatbv_expr.h>
17#include <util/magic.h>
19#include <util/mp_arith.h>
20#include <util/simplify_expr.h>
21#include <util/std_expr.h>
23
25
26#include "literal_vector_expr.h"
27
28#include <algorithm>
29
31{
32 const bool little_endian =
34 return endianness_map(type, little_endian);
35}
36
41 const exprt &expr,
42 std::optional<std::size_t> expected_width)
43{
44 // check cache first
45 std::pair<bv_cachet::iterator, bool> cache_result=
46 bv_cache.insert(std::make_pair(expr, bvt()));
47
48 // get a reference to the cache entry
49 auto &cache_entry = cache_result.first->second;
50
51 if(!cache_result.second)
52 {
53 // Found in cache
54 return cache_entry;
55 }
56
57 // Iterators into hash_maps do not remain valid when inserting
58 // more elements recursively. C++11 ยง23.2.5/13
59 // However, the _reference_ to the entry does!
61
64 "bitvector width shall match the indicated expected width",
67
68 // check
69 for(const auto &literal : cache_entry)
70 {
71 if(freeze_all && !literal.is_constant())
73
75 literal.var_no() != literalt::unused_var_no(),
76 "variable number must be different from the unused variable number",
79 }
80
81 return cache_entry;
82}
83
85{
86 if(expr.type().id() == ID_bool)
87 return prop_conv_solvert::handle(expr);
88 auto bv = convert_bv(expr);
89 set_frozen(bv); // for incremental usage
90 return literal_vector_exprt{bv, expr.type()};
91}
92
96{
97 ignoring(expr);
98
99 // try to make it free bits
100 std::size_t width=boolbv_width(expr.type());
101 return prop.new_variables(width);
102}
103
110{
111 if(expr.is_boolean())
112 return {convert(expr)};
113
114 if(expr.id()==ID_index)
115 return convert_index(to_index_expr(expr));
116 else if(expr.id()==ID_constraint_select_one)
118 else if(expr.id()==ID_member)
119 return convert_member(to_member_expr(expr));
120 else if(expr.id()==ID_with)
121 return convert_with(to_with_expr(expr));
122 else if(expr.id()==ID_update)
123 return convert_update(to_update_expr(expr));
124 else if(expr.id() == ID_update_bit)
126 else if(expr.id()==ID_case)
127 return convert_case(to_case_expr(expr));
128 else if(expr.id()==ID_cond)
129 return convert_cond(to_cond_expr(expr));
130 else if(expr.id()==ID_if)
131 return convert_if(to_if_expr(expr));
132 else if(expr.is_constant())
134 else if(expr.id()==ID_typecast)
136 else if(expr.id()==ID_symbol)
137 return convert_symbol(to_symbol_expr(expr));
138 else if(expr.id()==ID_plus || expr.id()==ID_minus ||
139 expr.id()=="no-overflow-plus" ||
140 expr.id()=="no-overflow-minus")
141 return convert_add_sub(expr);
142 else if(expr.id() == ID_mult)
143 return convert_mult(to_mult_expr(expr));
144 else if(expr.id()==ID_div)
145 return convert_div(to_div_expr(expr));
146 else if(expr.id()==ID_mod)
147 return convert_mod(to_mod_expr(expr));
148 else if(expr.id()==ID_shl || expr.id()==ID_ashr || expr.id()==ID_lshr ||
149 expr.id()==ID_rol || expr.id()==ID_ror)
150 return convert_shift(to_shift_expr(expr));
151 else if(
152 expr.id() == ID_floatbv_plus || expr.id() == ID_floatbv_minus ||
153 expr.id() == ID_floatbv_mult || expr.id() == ID_floatbv_div)
154 {
156 }
157 else if(expr.id() == ID_floatbv_fma)
158 {
160 }
161 else if(expr.id() == ID_floatbv_mod)
163 else if(expr.id() == ID_floatbv_rem)
165 else if(expr.id()==ID_floatbv_typecast)
167 else if(expr.id() == ID_floatbv_round_to_integral)
170 else if(expr.id()==ID_concatenation)
172 else if(expr.id()==ID_replication)
174 else if(expr.id()==ID_extractbits)
176 else if(expr.id() == ID_zero_extend)
177 return convert_bitvector(to_zero_extend_expr(expr).lower());
178 else if(expr.id()==ID_bitnot || expr.id()==ID_bitand ||
179 expr.id()==ID_bitor || expr.id()==ID_bitxor ||
180 expr.id()==ID_bitxnor || expr.id()==ID_bitnor ||
181 expr.id()==ID_bitnand)
182 return convert_bitwise(expr);
183 else if(expr.id() == ID_unary_minus)
185 else if(expr.id()==ID_unary_plus)
186 {
187 return convert_bitvector(to_unary_plus_expr(expr).op());
188 }
189 else if(expr.id()==ID_abs)
190 return convert_abs(to_abs_expr(expr));
191 else if(expr.id() == ID_bswap)
192 return convert_bswap(to_bswap_expr(expr));
193 else if(expr.id()==ID_byte_extract_little_endian ||
196 else if(expr.id()==ID_byte_update_little_endian ||
199 else if(expr.id()==ID_nondet_symbol ||
200 expr.id()=="quant_symbol")
201 return convert_symbol(expr);
202 else if(expr.id()==ID_struct)
203 return convert_struct(to_struct_expr(expr));
204 else if(expr.id()==ID_union)
205 return convert_union(to_union_expr(expr));
206 else if(expr.id() == ID_empty_union)
208 else if(expr.id()==ID_string_constant)
209 return convert_bitvector(
211 else if(expr.id() == ID_named_term)
212 {
213 const auto &named_term_expr = to_named_term_expr(expr);
215 return convert_symbol(named_term_expr.symbol());
216 }
217 else if(expr.id()==ID_array)
218 return convert_array(expr);
219 else if(expr.id()==ID_complex)
220 return convert_complex(to_complex_expr(expr));
221 else if(expr.id()==ID_complex_real)
223 else if(expr.id()==ID_complex_imag)
225 else if(expr.id() == ID_array_comprehension)
227 else if(expr.id()==ID_array_of)
229 else if(expr.id()==ID_let)
230 return convert_let(to_let_expr(expr));
231 else if(expr.id()==ID_function_application)
234 else if(expr.id()==ID_reduction_or || expr.id()==ID_reduction_and ||
235 expr.id()==ID_reduction_nor || expr.id()==ID_reduction_nand ||
236 expr.id()==ID_reduction_xor || expr.id()==ID_reduction_xnor)
238 else if(expr.id()==ID_not)
239 return convert_not(to_not_expr(expr));
240 else if(expr.id()==ID_power)
241 return convert_power(to_power_expr(expr));
242 else if(expr.id() == ID_popcount)
244 else if(expr.id() == ID_count_leading_zeros)
245 {
246 return convert_bv(
248 }
249 else if(expr.id() == ID_count_trailing_zeros)
250 {
251 return convert_bv(
253 }
254 else if(expr.id() == ID_bitreverse)
256 else if(expr.id() == ID_saturating_minus || expr.id() == ID_saturating_plus)
258 else if(
259 const auto overflow_with_result =
261 {
263 }
264 else if(expr.id() == ID_find_first_set)
265 return convert_bv(simplify_expr(to_find_first_set_expr(expr).lower(), ns));
266 else if(expr.id() == ID_literal_vector)
267 return to_literal_vector_expr(expr).bv();
268
269 return conversion_failed(expr);
270}
271
273{
274 std::size_t width=boolbv_width(expr.type());
275
276 const exprt &array_size = expr.type().size();
277
279
280 typet counter_type = expr.arg().type();
281
282 bvt bv;
283 bv.resize(width);
284
285 for(mp_integer i = 0; i < size; ++i)
286 {
287 exprt counter=from_integer(i, counter_type);
288
289 exprt body = expr.instantiate({counter});
290
291 const bvt &tmp = convert_bv(body);
292
293 INVARIANT(
294 size * tmp.size() == width,
295 "total bitvector width shall equal the number of operands times the size "
296 "per operand");
297
298 std::size_t offset = numeric_cast_v<std::size_t>(i * tmp.size());
299
300 for(std::size_t j=0; j<tmp.size(); j++)
301 bv[offset+j]=tmp[j];
302 }
303
304 return bv;
305}
306
308{
309 const typet &type=expr.type();
310 std::size_t width=boolbv_width(type);
311
312 const irep_idt &identifier = expr.get(ID_identifier);
313 CHECK_RETURN(!identifier.empty());
314
315 bvt bv = map.get_literals(identifier, type, width);
316
318 std::all_of(
319 bv.begin(),
320 bv.end(),
321 [this](const literalt &l) {
322 return l.var_no() < prop.no_variables() || l.is_constant();
323 }),
324 "variable number of non-constant literals should be within bounds",
325 id2string(identifier));
326
327 return bv;
328}
329
330
332 const function_application_exprt &expr)
333{
334 // record
335 functions.record(expr);
336
337 // make it free bits
338 return prop.new_variables(boolbv_width(expr.type()));
339}
340
341
343{
344 PRECONDITION(expr.is_boolean());
345
346 if(expr.id()==ID_typecast)
348 else if(expr.id()==ID_equal)
349 return convert_equality(to_equal_expr(expr));
350 else if(expr.id()==ID_verilog_case_equality ||
353 else if(expr.id()==ID_notequal)
354 {
355 const auto &notequal_expr = to_notequal_expr(expr);
356 return !convert_equality(
358 }
359 else if(expr.id()==ID_ieee_float_equal ||
361 {
363 }
364 else if(expr.id()==ID_le || expr.id()==ID_ge ||
365 expr.id()==ID_lt || expr.id()==ID_gt)
366 {
368 }
369 else if(expr.id()==ID_extractbit)
371 else if(expr.id()==ID_forall)
373 else if(expr.id()==ID_exists)
375 else if(expr.id()==ID_let)
376 {
377 bvt bv=convert_let(to_let_expr(expr));
378
379 DATA_INVARIANT(bv.size()==1,
380 "convert_let must return 1-bit vector for boolean let");
381
382 return bv[0];
383 }
384 else if(expr.id()==ID_index)
385 {
387 CHECK_RETURN(bv.size() == 1);
388 return bv[0];
389 }
390 else if(expr.id()==ID_member)
391 {
393 CHECK_RETURN(bv.size() == 1);
394 return bv[0];
395 }
396 else if(expr.id()==ID_case)
397 {
398 bvt bv = convert_case(to_case_expr(expr));
399 CHECK_RETURN(bv.size() == 1);
400 return bv[0];
401 }
402 else if(expr.id()==ID_cond)
403 {
404 bvt bv = convert_cond(to_cond_expr(expr));
405 CHECK_RETURN(bv.size() == 1);
406 return bv[0];
407 }
408 else if(expr.id()==ID_sign)
409 {
410 const auto &op = to_sign_expr(expr).op();
411 const bvt &bv = convert_bv(op);
412 CHECK_RETURN(!bv.empty());
413 const irep_idt type_id = op.type().id();
415 return bv_utils.sign_bit(bv);
417 return const_literal(false);
418 }
419 else if(expr.id()==ID_reduction_or || expr.id()==ID_reduction_and ||
420 expr.id()==ID_reduction_nor || expr.id()==ID_reduction_nand ||
421 expr.id()==ID_reduction_xor || expr.id()==ID_reduction_xnor)
422 return convert_reduction(to_unary_expr(expr));
423 else if(expr.id() == ID_onehot)
424 return convert_onehot(to_onehot_expr(expr));
425 else if(expr.id() == ID_onehot0)
426 return convert_onehot(to_onehot0_expr(expr));
427 else if(
428 const auto binary_overflow =
430 {
432 }
433 else if(
434 const auto unary_overflow =
436 {
438 }
439 else if(expr.id()==ID_isnan)
440 {
441 const auto &op = to_unary_expr(expr).op();
442 const bvt &bv = convert_bv(op);
443
444 if(op.type().id() == ID_floatbv)
445 {
447 return float_utils.is_NaN(bv);
448 }
449 else if(op.type().id() == ID_fixedbv)
450 return const_literal(false);
451 }
452 else if(expr.id()==ID_isfinite)
453 {
454 const auto &op = to_unary_expr(expr).op();
455 const bvt &bv = convert_bv(op);
456
457 if(op.type().id() == ID_floatbv)
458 {
460 return prop.land(
461 !float_utils.is_infinity(bv),
462 !float_utils.is_NaN(bv));
463 }
464 else if(op.id() == ID_fixedbv)
465 return const_literal(true);
466 }
467 else if(expr.id()==ID_isinf)
468 {
469 const auto &op = to_unary_expr(expr).op();
470 const bvt &bv = convert_bv(op);
471
472 if(op.type().id() == ID_floatbv)
473 {
475 return float_utils.is_infinity(bv);
476 }
477 else if(op.type().id() == ID_fixedbv)
478 return const_literal(false);
479 }
480 else if(expr.id()==ID_isnormal)
481 {
482 const auto &op = to_unary_expr(expr).op();
483
484 if(op.type().id() == ID_floatbv)
485 {
486 const bvt &bv = convert_bv(op);
488 return float_utils.is_normal(bv);
489 }
490 else if(op.type().id() == ID_fixedbv)
491 return const_literal(true);
492 }
493 else if(expr.id() == ID_function_application)
494 {
496 return prop.new_variable();
497 }
498
499 return SUB::convert_rest(expr);
500}
501
503{
505 return true;
506
507 const typet &type = expr.lhs().type();
508
509 if(
510 expr.lhs().id() == ID_symbol && type == expr.rhs().type() &&
511 type.id() != ID_bool)
512 {
513 // see if it is an unbounded array
514 if(is_unbounded_array(type))
515 return true;
516
517 const bvt &bv1=convert_bv(expr.rhs());
518
519 const irep_idt &identifier = to_symbol_expr(expr.lhs()).identifier();
520
521 map.set_literals(identifier, type, bv1);
522
523 if(freeze_all)
525
526 return false;
527 }
528
529 return true;
530}
531
532void boolbvt::set_to(const exprt &expr, bool value)
533{
534 PRECONDITION(expr.is_boolean());
535
538 return;
539 SUB::set_to(expr, value);
540}
541
542bool boolbvt::is_unbounded_array(const typet &type) const
543{
544 if(type.id()!=ID_array)
545 return false;
546
548 return true;
549
550 const auto &size_opt = bv_width.get_width_opt(type);
551 if(!size_opt.has_value())
552 return true;
553
556 return true;
557
558 return false;
559}
560
562{
563 // to ensure freshness of the new identifiers
565
567 result.reserve(binding.variables().size());
568
569 for(const auto &binding : binding.variables())
570 {
571 const auto &old_identifier = binding.identifier();
572
573 // produce a new identifier
575 "boolbvt::scope::" + std::to_string(scope_counter) +
577
578 result.emplace_back(new_identifier, binding.type());
579 }
580
581 return result;
582}
583
584void boolbvt::print_assignment(std::ostream &out) const
585{
587 map.show(out);
588}
589
591{
592 const struct_typet::componentst &components = src.components();
593 offset_mapt dest;
594 dest.reserve(components.size());
595 std::size_t offset = 0;
596 for(const auto &comp : components)
597 {
598 dest.push_back(offset);
599 offset += boolbv_width(comp.type());
600 }
601 return dest;
602}
configt config
Definition config.cpp:25
constant_exprt from_integer(const mp_integer &int_value, const typet &type)
API to expression classes for bitvectors.
const onehot0_exprt & to_onehot0_expr(const exprt &expr)
Cast an exprt to a onehot0_exprt.
const replication_exprt & to_replication_expr(const exprt &expr)
Cast an exprt to a replication_exprt.
const shift_exprt & to_shift_expr(const exprt &expr)
Cast an exprt to a shift_exprt.
const popcount_exprt & to_popcount_expr(const exprt &expr)
Cast an exprt to a popcount_exprt.
const extractbits_exprt & to_extractbits_expr(const exprt &expr)
Cast an exprt to an extractbits_exprt.
const onehot_exprt & to_onehot_expr(const exprt &expr)
Cast an exprt to a onehot_exprt.
const find_first_set_exprt & to_find_first_set_expr(const exprt &expr)
Cast an exprt to a find_first_set_exprt.
const update_bit_exprt & to_update_bit_expr(const exprt &expr)
Cast an exprt to an update_bit_exprt.
const bswap_exprt & to_bswap_expr(const exprt &expr)
Cast an exprt to a bswap_exprt.
const count_leading_zeros_exprt & to_count_leading_zeros_expr(const exprt &expr)
Cast an exprt to a count_leading_zeros_exprt.
const bitreverse_exprt & to_bitreverse_expr(const exprt &expr)
Cast an exprt to a bitreverse_exprt.
const extractbit_exprt & to_extractbit_expr(const exprt &expr)
Cast an exprt to an extractbit_exprt.
const concatenation_exprt & to_concatenation_expr(const exprt &expr)
Cast an exprt to a concatenation_exprt.
const zero_extend_exprt & to_zero_extend_expr(const exprt &expr)
Cast an exprt to a zero_extend_exprt.
const count_trailing_zeros_exprt & to_count_trailing_zeros_expr(const exprt &expr)
Cast an exprt to a count_trailing_zeros_exprt.
Pre-defined bitvector types.
const floatbv_typet & to_floatbv_type(const typet &type)
Cast a typet to a floatbv_typet.
Expression classes for byte-level operators.
const byte_update_exprt & to_byte_update_expr(const exprt &expr)
const byte_extract_exprt & to_byte_extract_expr(const exprt &expr)
ait supplies three of the four components needed: an abstract interpreter (in this case handling func...
Definition ai.h:566
Expression to define a mapping from an argument (index) to elements.
Definition std_expr.h:3586
const array_typet & type() const
Definition std_expr.h:3600
const symbol_exprt & arg() const
Definition std_expr.h:3610
const namespacet & ns
Definition arrays.h:63
exprt & lhs()
Definition std_expr.h:679
exprt & rhs()
Definition std_expr.h:689
A base class for variable bindings (quantifiers, let, lambda)
Definition std_expr.h:3170
variablest & variables()
Definition std_expr.h:3191
exprt instantiate(const exprt::operandst &) const
substitute free occurrences of the variables in where() by the given values
Definition std_expr.cpp:419
std::vector< symbol_exprt > variablest
Definition std_expr.h:3172
void set_literals(const irep_idt &identifier, const typet &type, const bvt &literals)
void show(std::ostream &out) const
const bvt & get_literals(const irep_idt &identifier, const typet &type, std::size_t width)
virtual std::optional< std::size_t > get_width_opt(const typet &type) const
virtual bvt convert_with(const with_exprt &expr)
virtual bvt convert_array(const exprt &expr)
Flatten array.
virtual literalt convert_bv_rel(const binary_relation_exprt &)
Flatten <, >, <= and >= expressions.
bv_cachet bv_cache
Definition boolbv.h:139
virtual literalt convert_onehot(const unary_exprt &expr)
virtual bvt convert_index(const exprt &array, const mp_integer &index)
index operator with constant index
virtual const bvt & convert_bv(const exprt &expr, const std::optional< std::size_t > expected_width={})
Convert expression to vector of literalts, using an internal cache to speed up conversion if availabl...
Definition boolbv.cpp:40
std::size_t scope_counter
Definition boolbv.h:297
virtual bvt convert_constraint_select_one(const exprt &expr)
virtual bvt convert_power(const power_exprt &expr)
virtual bvt convert_complex_imag(const complex_imag_exprt &expr)
virtual literalt convert_reduction(const unary_exprt &expr)
virtual bvt convert_popcount(const popcount_exprt &expr)
virtual literalt convert_ieee_float_rel(const binary_relation_exprt &)
virtual bvt convert_complex_real(const complex_real_exprt &expr)
virtual bvt convert_complex(const complex_exprt &expr)
virtual bvt convert_let(const let_exprt &)
virtual bvt convert_byte_extract(const byte_extract_exprt &expr)
offset_mapt build_offset_map(const struct_typet &src)
Definition boolbv.cpp:590
virtual bvt convert_bitvector(const exprt &expr)
Converts an expression into its gate-level representation and returns a vector of literals correspond...
Definition boolbv.cpp:109
binding_exprt::variablest fresh_binding(const binding_exprt &)
create new, unique variables for the given binding
Definition boolbv.cpp:561
virtual literalt convert_typecast(const typecast_exprt &expr)
conversion from bitvector types to boolean
virtual bvt convert_bswap(const bswap_exprt &expr)
bool is_unbounded_array(const typet &type) const override
Definition boolbv.cpp:542
virtual bvt convert_mod(const mod_exprt &expr)
virtual bvt convert_add_sub(const exprt &expr)
virtual bvt convert_constant(const constant_exprt &expr)
virtual literalt convert_quantifier(const quantifier_exprt &expr)
virtual bool boolbv_set_equality_to_true(const equal_exprt &expr)
Definition boolbv.cpp:502
virtual bvt convert_mult(const mult_exprt &expr)
exprt handle(const exprt &) override
Generate a handle, which is an expression that has the same value as the argument in any model that i...
Definition boolbv.cpp:84
virtual bvt convert_member(const member_exprt &expr)
virtual bvt convert_case(const case_exprt &)
virtual literalt convert_verilog_case_equality(const binary_relation_exprt &expr)
virtual bvt convert_function_application(const function_application_exprt &expr)
Definition boolbv.cpp:331
virtual bvt convert_cond(const cond_exprt &)
virtual bvt convert_empty_union(const empty_union_exprt &expr)
virtual bvt convert_if(const if_exprt &expr)
Definition boolbv_if.cpp:12
virtual bvt convert_union(const union_exprt &expr)
void set_to(const exprt &expr, bool value) override
For a Boolean expression expr, add the constraint 'expr' if value is true, otherwise add 'not expr'.
Definition boolbv.cpp:532
virtual bvt convert_byte_update(const byte_update_exprt &expr)
boolbv_widtht bv_width
Definition boolbv.h:120
virtual literalt convert_extractbit(const extractbit_exprt &expr)
unbounded_arrayt unbounded_array
Definition boolbv.h:92
virtual bvt convert_floatbv_op(const ieee_float_op_exprt &)
void print_assignment(std::ostream &out) const override
Print satisfying assignment to out.
Definition boolbv.cpp:584
virtual bvt convert_not(const not_exprt &expr)
virtual bvt convert_extractbits(const extractbits_exprt &expr)
virtual bvt convert_shift(const binary_exprt &expr)
virtual bvt convert_update(const update_exprt &)
virtual bvt convert_unary_minus(const unary_minus_exprt &expr)
virtual bvt convert_div(const div_exprt &expr)
virtual literalt convert_binary_overflow(const binary_overflow_exprt &expr)
virtual bvt convert_array_of(const array_of_exprt &expr)
Flatten arrays constructed from a single element.
bv_utilst bv_utils
Definition boolbv.h:121
virtual bvt convert_floatbv_mod_rem(const binary_exprt &)
virtual bvt convert_saturating_add_sub(const binary_exprt &expr)
virtual bvt convert_overflow_result(const overflow_result_exprt &expr)
virtual bvt convert_bitwise(const exprt &expr)
virtual bvt convert_array_comprehension(const array_comprehension_exprt &)
Definition boolbv.cpp:272
virtual bvt convert_bv_reduction(const unary_exprt &expr)
virtual literalt convert_equality(const equal_exprt &expr)
functionst functions
Definition boolbv.h:124
bvt conversion_failed(const exprt &expr)
Print that the expression of x has failed conversion, then return a vector of x's width.
Definition boolbv.cpp:95
virtual endianness_mapt endianness_map(const typet &type, bool little_endian) const
Definition boolbv.h:112
virtual literalt convert_unary_overflow(const unary_overflow_exprt &expr)
virtual std::size_t boolbv_width(const typet &type) const
Definition boolbv.h:106
virtual bvt convert_symbol(const exprt &expr)
Definition boolbv.cpp:307
virtual bvt convert_update_bit(const update_bit_exprt &)
virtual bvt convert_floatbv_typecast(const floatbv_typecast_exprt &expr)
virtual bvt convert_floatbv_fma(const floatbv_fma_exprt &)
virtual bvt convert_bv_typecast(const typecast_exprt &expr)
virtual bvt convert_concatenation(const concatenation_exprt &expr)
virtual bvt convert_struct(const struct_exprt &expr)
virtual bvt convert_bitreverse(const bitreverse_exprt &expr)
virtual bvt convert_replication(const replication_exprt &expr)
literalt convert_rest(const exprt &expr) override
Definition boolbv.cpp:342
virtual bvt convert_floatbv_round_to_integral(const floatbv_round_to_integral_exprt &)
std::vector< std::size_t > offset_mapt
Definition boolbv.h:290
virtual bvt convert_abs(const abs_exprt &expr)
boolbv_mapt map
Definition boolbv.h:127
static literalt sign_bit(const bvt &op)
Definition bv_utils.h:138
struct configt::ansi_ct ansi_c
virtual void print_assignment(std::ostream &out) const =0
Print satisfying assignment to out.
void set_to_true(const exprt &)
For a Boolean expression expr, add the constraint 'expr'.
virtual void set_to(const exprt &, bool value)=0
For a Boolean expression expr, add the constraint 'expr' if value is true, otherwise add 'not expr'.
dstringt has one field, an unsigned integer no which is an index into a static table of strings.
Definition dstring.h:38
bool empty() const
Definition dstring.h:89
Maps a big-endian offset to a little-endian offset.
Equality.
Definition std_expr.h:1339
Base class for all expressions.
Definition expr.h:57
const source_locationt & find_source_location() const
Get a source_locationt from the expression or from its operands (non-recursively).
Definition expr.cpp:68
bool is_boolean() const
Return whether the expression represents a Boolean.
Definition expr.h:229
bool is_constant() const
Return whether the expression is a constant.
Definition expr.h:213
typet & type()
Return the type of the expression.
Definition expr.h:85
Application of (mathematical) function.
void record(const function_application_exprt &function_application)
Definition functions.cpp:15
const irep_idt & get(const irep_idt &name) const
Definition irep.cpp:44
const irep_idt & id() const
Definition irep.h:388
static var_not unused_var_no()
Definition literal.h:176
void set_frozen(literalt)
virtual void ignoring(const exprt &expr)
literalt convert(const exprt &expr) override
Convert a Boolean expression and return the corresponding literal.
virtual literalt convert_rest(const exprt &expr)
exprt handle(const exprt &expr) override
Generate a handle, which is an expression that has the same value as the argument in any model that i...
virtual literalt land(literalt a, literalt b)=0
virtual void set_frozen(literalt)
Definition prop.h:117
virtual bvt new_variables(std::size_t width)
generates a bitvector of given width with new variables
Definition prop.cpp:30
virtual literalt new_variable()=0
Structure type, corresponds to C style structs.
Definition std_types.h:231
const componentst & components() const
Definition std_types.h:147
std::vector< componentt > componentst
Definition std_types.h:140
The type of an expression, extends irept.
Definition type.h:29
API to expression classes for floating-point arithmetic.
const ieee_float_op_exprt & to_ieee_float_op_expr(const exprt &expr)
Cast an exprt to an ieee_float_op_exprt.
const floatbv_fma_exprt & to_floatbv_fma_expr(const exprt &expr)
const floatbv_round_to_integral_exprt & to_floatbv_round_to_integral_expr(const exprt &expr)
Cast an exprt to a floatbv_round_to_integral_exprt.
const floatbv_typecast_exprt & to_floatbv_typecast_expr(const exprt &expr)
Cast an exprt to a floatbv_typecast_exprt.
const std::string & id2string(const irep_idt &d)
Definition irep.h:44
std::vector< literalt > bvt
Definition literal.h:201
literalt const_literal(bool value)
Definition literal.h:188
const literal_vector_exprt & to_literal_vector_expr(const exprt &expr)
Cast a generic exprt to a literal_vector_exprt.
Magic numbers used throughout the codebase.
const std::size_t MAX_FLATTENED_ARRAY_SIZE
Definition magic.h:11
API to expression classes for 'mathematical' expressions.
const quantifier_exprt & to_quantifier_expr(const exprt &expr)
Cast an exprt to a quantifier_exprt.
const power_exprt & to_power_expr(const exprt &expr)
Cast an exprt to a power_exprt.
const function_application_exprt & to_function_application_expr(const exprt &expr)
Cast an exprt to a function_application_exprt.
exprt simplify_expr(exprt src, const namespacet &ns)
BigInt mp_integer
Definition smt_terms.h:17
#define CHECK_RETURN(CONDITION)
Definition invariant.h:495
#define DATA_INVARIANT(CONDITION, REASON)
This condition should be used to document that assumptions that are made on goto_functions,...
Definition invariant.h:534
#define PRECONDITION(CONDITION)
Definition invariant.h:463
#define INVARIANT_WITH_DIAGNOSTICS(CONDITION, REASON,...)
Same as invariant, with one or more diagnostics attached Diagnostics can be of any type that has a sp...
Definition invariant.h:437
#define INVARIANT(CONDITION, REASON)
This macro uses the wrapper function 'invariant_violated_string'.
Definition invariant.h:423
API to expression classes.
const struct_exprt & to_struct_expr(const exprt &expr)
Cast an exprt to a struct_exprt.
Definition std_expr.h:1843
const array_of_exprt & to_array_of_expr(const exprt &expr)
Cast an exprt to an array_of_exprt.
Definition std_expr.h:1552
const binary_relation_exprt & to_binary_relation_expr(const exprt &expr)
Cast an exprt to a binary_relation_exprt.
Definition std_expr.h:828
const unary_plus_exprt & to_unary_plus_expr(const exprt &expr)
Cast an exprt to a unary_plus_exprt.
Definition std_expr.h:539
const index_exprt & to_index_expr(const exprt &expr)
Cast an exprt to an index_exprt.
Definition std_expr.h:1494
const mod_exprt & to_mod_expr(const exprt &expr)
Cast an exprt to a mod_exprt.
Definition std_expr.h:1260
const mult_exprt & to_mult_expr(const exprt &expr)
Cast an exprt to a mult_exprt.
Definition std_expr.h:1134
const array_comprehension_exprt & to_array_comprehension_expr(const exprt &expr)
Cast an exprt to a array_comprehension_exprt.
Definition std_expr.h:3648
const named_term_exprt & to_named_term_expr(const exprt &expr)
Cast an exprt to a named_term_exprt.
Definition std_expr.h:3821
const array_exprt & to_array_expr(const exprt &expr)
Cast an exprt to an array_exprt.
Definition std_expr.h:1614
const cond_exprt & to_cond_expr(const exprt &expr)
Cast an exprt to a cond_exprt.
Definition std_expr.h:3443
const typecast_exprt & to_typecast_expr(const exprt &expr)
Cast an exprt to a typecast_exprt.
Definition std_expr.h:2024
const div_exprt & to_div_expr(const exprt &expr)
Cast an exprt to a div_exprt.
Definition std_expr.h:1196
const binary_exprt & to_binary_expr(const exprt &expr)
Cast an exprt to a binary_exprt.
Definition std_expr.h:721
const notequal_exprt & to_notequal_expr(const exprt &expr)
Cast an exprt to an notequal_exprt.
Definition std_expr.h:1413
const unary_exprt & to_unary_expr(const exprt &expr)
Cast an exprt to a unary_exprt.
Definition std_expr.h:424
const let_exprt & to_let_expr(const exprt &expr)
Cast an exprt to a let_exprt.
Definition std_expr.h:3383
const abs_exprt & to_abs_expr(const exprt &expr)
Cast an exprt to a abs_exprt.
Definition std_expr.h:459
const if_exprt & to_if_expr(const exprt &expr)
Cast an exprt to an if_exprt.
Definition std_expr.h:2501
const member_exprt & to_member_expr(const exprt &expr)
Cast an exprt to a member_exprt.
Definition std_expr.h:2953
const empty_union_exprt & to_empty_union_expr(const exprt &expr)
Cast an exprt to an empty_union_exprt.
Definition std_expr.h:1803
const complex_imag_exprt & to_complex_imag_expr(const exprt &expr)
Cast an exprt to a complex_imag_exprt.
Definition std_expr.h:1977
const union_exprt & to_union_expr(const exprt &expr)
Cast an exprt to a union_exprt.
Definition std_expr.h:1765
const complex_real_exprt & to_complex_real_expr(const exprt &expr)
Cast an exprt to a complex_real_exprt.
Definition std_expr.h:1940
const case_exprt & to_case_expr(const exprt &expr)
Cast an exprt to a case_exprt.
Definition std_expr.h:3562
const constant_exprt & to_constant_expr(const exprt &expr)
Cast an exprt to a constant_exprt.
Definition std_expr.h:3078
const not_exprt & to_not_expr(const exprt &expr)
Cast an exprt to an not_exprt.
Definition std_expr.h:2408
const symbol_exprt & to_symbol_expr(const exprt &expr)
Cast an exprt to a symbol_exprt.
Definition std_expr.h:221
const with_exprt & to_with_expr(const exprt &expr)
Cast an exprt to a with_exprt.
Definition std_expr.h:2573
const complex_exprt & to_complex_expr(const exprt &expr)
Cast an exprt to a complex_exprt.
Definition std_expr.h:1903
const update_exprt & to_update_expr(const exprt &expr)
Cast an exprt to an update_exprt.
Definition std_expr.h:2762
const unary_minus_exprt & to_unary_minus_expr(const exprt &expr)
Cast an exprt to a unary_minus_exprt.
Definition std_expr.h:502
const equal_exprt & to_equal_expr(const exprt &expr)
Cast an exprt to an equal_exprt.
Definition std_expr.h:1375
const sign_exprt & to_sign_expr(const exprt &expr)
Cast an exprt to a sign_exprt.
Definition std_expr.h:632
const string_constantt & to_string_constant(const exprt &expr)