CBMC
Loading...
Searching...
No Matches
std_expr.h
Go to the documentation of this file.
1/*******************************************************************\
2
3Module: API to expression classes
4
5Author: Daniel Kroening, kroening@kroening.com
6
7\*******************************************************************/
8
9
10#ifndef CPROVER_UTIL_STD_EXPR_H
11#define CPROVER_UTIL_STD_EXPR_H
12
15
16#include "deprecate.h"
17#include "expr_cast.h"
18#include "invariant.h"
19#include "std_types.h"
20
23{
24public:
26 : expr_protectedt(_id, std::move(_type))
27 {
28 }
29
30 static void check(
31 const exprt &expr,
33 {
35 vm,
36 expr.operands().size() == 0,
37 "nullary expression must not have operands");
38 }
39
40 static void validate(
41 const exprt &expr,
42 const namespacet &,
44 {
45 check(expr, vm);
46 }
47
49 operandst &operands() = delete;
50 const operandst &operands() const = delete;
51
52 const exprt &op0() const = delete;
53 exprt &op0() = delete;
54 const exprt &op1() const = delete;
55 exprt &op1() = delete;
56 const exprt &op2() const = delete;
57 exprt &op2() = delete;
58 const exprt &op3() const = delete;
59 exprt &op3() = delete;
60
61 void copy_to_operands(const exprt &expr) = delete;
62 void copy_to_operands(const exprt &, const exprt &) = delete;
63 void copy_to_operands(const exprt &, const exprt &, const exprt &) = delete;
64};
65
68{
69public:
70 // constructor
72 const irep_idt &_id,
73 exprt _op0,
74 exprt _op1,
75 exprt _op2,
76 typet _type)
78 _id,
79 std::move(_type),
80 {std::move(_op0), std::move(_op1), std::move(_op2)})
81 {
82 }
83
84 // make op0 to op2 public
85 using exprt::op0;
86 using exprt::op1;
87 using exprt::op2;
88
89 const exprt &op3() const = delete;
90 exprt &op3() = delete;
91
92 static void check(
93 const exprt &expr,
95 {
97 vm,
98 expr.operands().size() == 3,
99 "ternary expression must have three operands");
100 }
101
102 static void validate(
103 const exprt &expr,
104 const namespacet &,
106 {
107 check(expr, vm);
108 }
109};
110
117inline const ternary_exprt &to_ternary_expr(const exprt &expr)
118{
120 return static_cast<const ternary_exprt &>(expr);
121}
122
125{
127 return static_cast<ternary_exprt &>(expr);
128}
129
132{
133public:
136 {
137 }
138
141 symbol_exprt(const irep_idt &identifier, typet type)
143 {
144 set_identifier(identifier);
145 }
146
152 {
153 return symbol_exprt(id, typet());
154 }
155
156 void set_identifier(const irep_idt &identifier)
157 {
158 set(ID_identifier, identifier);
159 }
160
162 {
163 return get(ID_identifier);
164 }
165
168 {
169 if(location.is_not_nil())
170 add_source_location() = std::move(location);
171 return *this;
172 }
173
176 {
177 if(location.is_not_nil())
178 add_source_location() = std::move(location);
179 return std::move(*this);
180 }
181
184 {
185 if(other.source_location().is_not_nil())
186 add_source_location() = other.source_location();
187 return *this;
188 }
189
192 {
193 if(other.source_location().is_not_nil())
194 add_source_location() = other.source_location();
195 return std::move(*this);
196 }
197};
198
199template <>
200inline bool can_cast_expr<symbol_exprt>(const exprt &base)
201{
202 return base.id() == ID_symbol;
203}
204
211inline const symbol_exprt &to_symbol_expr(const exprt &expr)
212{
213 PRECONDITION(expr.id() == ID_symbol);
215 return static_cast<const symbol_exprt &>(expr);
216}
217
220{
221 PRECONDITION(expr.id() == ID_symbol);
223 return static_cast<symbol_exprt &>(expr);
224}
225
226// NOLINTNEXTLINE(readability/namespace)
227namespace std
228{
229template <>
230// NOLINTNEXTLINE(readability/identifiers)
231struct hash<::symbol_exprt>
232{
233 size_t operator()(const ::symbol_exprt &sym)
234 {
235 return irep_id_hash()(sym.get_identifier());
236 }
237};
238} // namespace std
239
243{
244public:
248 : symbol_exprt(identifier, std::move(type))
249 {
250 }
251
253 {
255 }
256
258 {
259 return set(ID_C_static_lifetime, true);
260 }
261
266
267 bool is_thread_local() const
268 {
270 }
271
273 {
274 return set(ID_C_thread_local, true);
275 }
276
281};
282
285{
286public:
291 {
292 set_identifier(identifier);
293 }
294
299 irep_idt identifier,
300 typet type,
301 source_locationt location)
303 {
304 set_identifier(std::move(identifier));
305 add_source_location() = std::move(location);
306 }
307
308 void set_identifier(const irep_idt &identifier)
309 {
310 set(ID_identifier, identifier);
311 }
312
314 {
315 return get(ID_identifier);
316 }
317};
318
319template <>
321{
322 return base.id() == ID_nondet_symbol;
323}
324
325inline void validate_expr(const nondet_symbol_exprt &value)
326{
327 validate_operands(value, 0, "Symbols must not have operands");
328}
329
337{
340 return static_cast<const nondet_symbol_exprt &>(expr);
341}
342
345{
346 PRECONDITION(expr.id()==ID_symbol);
348 return static_cast<nondet_symbol_exprt &>(expr);
349}
350
351
354{
355public:
358 {
359 }
360
362 : expr_protectedt(_id, std::move(_type), {std::move(_op)})
363 {
364 }
365
366 static void check(
367 const exprt &expr,
369 {
371 vm,
372 expr.operands().size() == 1,
373 "unary expression must have one operand");
374 }
375
376 static void validate(
377 const exprt &expr,
378 const namespacet &,
380 {
381 check(expr, vm);
382 }
383
384 const exprt &op() const
385 {
386 return op0();
387 }
388
390 {
391 return op0();
392 }
393
394 const exprt &op1() const = delete;
395 exprt &op1() = delete;
396 const exprt &op2() const = delete;
397 exprt &op2() = delete;
398 const exprt &op3() const = delete;
399 exprt &op3() = delete;
400};
401
402template <>
403inline bool can_cast_expr<unary_exprt>(const exprt &base)
404{
405 return base.operands().size() == 1;
406}
407
414inline const unary_exprt &to_unary_expr(const exprt &expr)
415{
416 unary_exprt::check(expr);
417 return static_cast<const unary_exprt &>(expr);
418}
419
422{
423 unary_exprt::check(expr);
424 return static_cast<unary_exprt &>(expr);
425}
426
427
430{
431public:
433 {
434 }
435};
436
437template <>
438inline bool can_cast_expr<abs_exprt>(const exprt &base)
439{
440 return base.id() == ID_abs;
441}
442
449inline const abs_exprt &to_abs_expr(const exprt &expr)
450{
451 PRECONDITION(expr.id()==ID_abs);
452 abs_exprt::check(expr);
453 return static_cast<const abs_exprt &>(expr);
454}
455
458{
459 PRECONDITION(expr.id()==ID_abs);
460 abs_exprt::check(expr);
461 return static_cast<abs_exprt &>(expr);
462}
463
464
467{
468public:
470 : unary_exprt(ID_unary_minus, std::move(_op), std::move(_type))
471 {
472 }
473
476 {
477 }
478};
479
480template <>
482{
483 return base.id() == ID_unary_minus;
484}
485
493{
496 return static_cast<const unary_minus_exprt &>(expr);
497}
498
501{
504 return static_cast<unary_minus_exprt &>(expr);
505}
506
509{
510public:
513 {
514 }
515};
516
517template <>
519{
520 return base.id() == ID_unary_plus;
521}
522
529inline const unary_plus_exprt &to_unary_plus_expr(const exprt &expr)
530{
531 PRECONDITION(expr.id() == ID_unary_plus);
533 return static_cast<const unary_plus_exprt &>(expr);
534}
535
538{
539 PRECONDITION(expr.id() == ID_unary_plus);
541 return static_cast<unary_plus_exprt &>(expr);
542}
543
547{
548public:
549 explicit predicate_exprt(const irep_idt &_id)
551 {
552 }
553
554 static void check(
555 const exprt &expr,
557 {
558 }
559};
560
564{
565public:
567 : unary_exprt(_id, std::move(_op), bool_typet())
568 {
569 }
570
571 static void check(
572 const exprt &expr,
574 {
575 unary_exprt::check(expr);
577 }
578};
579
587{
589 return static_cast<const unary_predicate_exprt &>(expr);
590}
591
594{
596 return static_cast<unary_predicate_exprt &>(expr);
597}
598
602{
603public:
606 {
607 }
608};
609
610template <>
611inline bool can_cast_expr<sign_exprt>(const exprt &base)
612{
613 return base.id() == ID_sign;
614}
615
622inline const sign_exprt &to_sign_expr(const exprt &expr)
623{
624 PRECONDITION(expr.id() == ID_sign);
625 sign_exprt::check(expr);
626 return static_cast<const sign_exprt &>(expr);
627}
628
631{
632 PRECONDITION(expr.id() == ID_sign);
633 sign_exprt::check(expr);
634 return static_cast<sign_exprt &>(expr);
635}
636
639{
640public:
642 : expr_protectedt(_id, _lhs.type(), {_lhs, std::move(_rhs)})
643 {
644 }
645
647 : expr_protectedt(_id, std::move(_type), {std::move(_lhs), std::move(_rhs)})
648 {
649 }
650
651 static void check(
652 const exprt &expr,
654 {
656 vm,
657 expr.operands().size() == 2,
658 "binary expression must have two operands");
659 }
660
661 static void validate(
662 const exprt &expr,
663 const namespacet &,
665 {
666 check(expr, vm);
667 }
668
670 {
671 return exprt::op0();
672 }
673
674 const exprt &lhs() const
675 {
676 return exprt::op0();
677 }
678
680 {
681 return exprt::op1();
682 }
683
684 const exprt &rhs() const
685 {
686 return exprt::op1();
687 }
688
689 // make op0 and op1 public
690 using exprt::op0;
691 using exprt::op1;
692
693 const exprt &op2() const = delete;
694 exprt &op2() = delete;
695 const exprt &op3() const = delete;
696 exprt &op3() = delete;
697};
698
699template <>
700inline bool can_cast_expr<binary_exprt>(const exprt &base)
701{
702 return base.operands().size() == 2;
703}
704
711inline const binary_exprt &to_binary_expr(const exprt &expr)
712{
714 return static_cast<const binary_exprt &>(expr);
715}
716
719{
721 return static_cast<binary_exprt &>(expr);
722}
723
727{
728public:
730 : binary_exprt(std::move(_op0), _id, std::move(_op1), bool_typet())
731 {
732 }
733
734 static void check(
735 const exprt &expr,
737 {
738 binary_exprt::check(expr, vm);
739 predicate_exprt::check(expr, vm);
740 }
741
742 static void validate(
743 const exprt &expr,
744 const namespacet &ns,
746 {
747 binary_exprt::validate(expr, ns, vm);
748 predicate_exprt::validate(expr, ns, vm);
749 }
750};
751
759{
761 return static_cast<const binary_predicate_exprt &>(expr);
762}
763
766{
768 return static_cast<binary_predicate_exprt &>(expr);
769}
770
774{
775public:
780
781 static void check(
782 const exprt &expr,
784 {
786 }
787
788 static void validate(
789 const exprt &expr,
790 const namespacet &ns,
792 {
794
795 // we now can safely assume that 'expr' is a binary predicate
796 const auto &expr_binary = static_cast<const binary_predicate_exprt &>(expr);
797
798 // check that the types of the operands are the same
800 vm,
801 expr_binary.op0().type() == expr_binary.op1().type(),
802 "lhs and rhs of binary relation expression should have same type");
803 }
804};
805
806template <>
808{
809 return can_cast_expr<binary_exprt>(base);
810}
811
819{
821 return static_cast<const binary_relation_exprt &>(expr);
822}
823
826{
828 return static_cast<binary_relation_exprt &>(expr);
829}
830
833{
834public:
839};
840
841template <>
843{
844 return base.id() == ID_gt;
845}
846
856
857template <>
859{
860 return base.id() == ID_ge;
861}
862
865{
866public:
871};
872
873template <>
874inline bool can_cast_expr<less_than_exprt>(const exprt &base)
875{
876 return base.id() == ID_lt;
877}
878
888
889template <>
891{
892 return base.id() == ID_le;
893}
894
898{
899public:
901 : expr_protectedt(_id, std::move(_type))
902 {
903 operands() = std::move(_operands);
904 }
905
908 {
909 PRECONDITION(!_operands.empty());
910 type() = _operands.front().type();
911 operands() = std::move(_operands);
912 }
913
915 : expr_protectedt(_id, _lhs.type(), {_lhs, std::move(_rhs)})
916 {
917 }
918
920 : expr_protectedt(_id, std::move(_type), {std::move(_lhs), std::move(_rhs)})
921 {
922 }
923
924 // In contrast to exprt::opX, the methods
925 // below check the size.
927 {
928 PRECONDITION(operands().size() >= 1);
929 return operands().front();
930 }
931
933 {
934 PRECONDITION(operands().size() >= 2);
935 return operands()[1];
936 }
937
939 {
940 PRECONDITION(operands().size() >= 3);
941 return operands()[2];
942 }
943
945 {
946 PRECONDITION(operands().size() >= 4);
947 return operands()[3];
948 }
949
950 const exprt &op0() const
951 {
952 PRECONDITION(operands().size() >= 1);
953 return operands().front();
954 }
955
956 const exprt &op1() const
957 {
958 PRECONDITION(operands().size() >= 2);
959 return operands()[1];
960 }
961
962 const exprt &op2() const
963 {
964 PRECONDITION(operands().size() >= 3);
965 return operands()[2];
966 }
967
968 const exprt &op3() const
969 {
970 PRECONDITION(operands().size() >= 4);
971 return operands()[3];
972 }
973};
974
981inline const multi_ary_exprt &to_multi_ary_expr(const exprt &expr)
982{
983 return static_cast<const multi_ary_exprt &>(expr);
984}
985
988{
989 return static_cast<multi_ary_exprt &>(expr);
990}
991
992
996{
997public:
999 : multi_ary_exprt(std::move(_lhs), ID_plus, std::move(_rhs))
1000 {
1001 }
1002
1005 std::move(_lhs),
1006 ID_plus,
1007 std::move(_rhs),
1008 std::move(_type))
1009 {
1010 }
1011
1014 {
1015 }
1016
1018 : multi_ary_exprt(ID_plus, std::move(_operands), std::move(_type))
1019 {
1020 }
1021};
1022
1023template <>
1024inline bool can_cast_expr<plus_exprt>(const exprt &base)
1025{
1026 return base.id() == ID_plus;
1027}
1028
1035inline const plus_exprt &to_plus_expr(const exprt &expr)
1036{
1037 PRECONDITION(expr.id()==ID_plus);
1038 const plus_exprt &ret = static_cast<const plus_exprt &>(expr);
1040 return ret;
1041}
1042
1045{
1046 PRECONDITION(expr.id()==ID_plus);
1047 plus_exprt &ret = static_cast<plus_exprt &>(expr);
1049 return ret;
1050}
1051
1052
1055{
1056public:
1058 : binary_exprt(std::move(_lhs), ID_minus, std::move(_rhs))
1059 {
1060 }
1061};
1062
1063template <>
1064inline bool can_cast_expr<minus_exprt>(const exprt &base)
1065{
1066 return base.id() == ID_minus;
1067}
1068
1075inline const minus_exprt &to_minus_expr(const exprt &expr)
1076{
1077 PRECONDITION(expr.id()==ID_minus);
1078 minus_exprt::check(expr);
1079 return static_cast<const minus_exprt &>(expr);
1080}
1081
1084{
1085 PRECONDITION(expr.id()==ID_minus);
1086 minus_exprt::check(expr);
1087 return static_cast<minus_exprt &>(expr);
1088}
1089
1090
1094{
1095public:
1097 : multi_ary_exprt(std::move(_lhs), ID_mult, std::move(_rhs))
1098 {
1099 }
1100
1103 {
1104 }
1105
1110};
1111
1112template <>
1113inline bool can_cast_expr<mult_exprt>(const exprt &base)
1114{
1115 return base.id() == ID_mult;
1116}
1117
1124inline const mult_exprt &to_mult_expr(const exprt &expr)
1125{
1126 PRECONDITION(expr.id()==ID_mult);
1127 mult_exprt::check(expr);
1128 return static_cast<const mult_exprt &>(expr);
1129}
1130
1133{
1134 PRECONDITION(expr.id()==ID_mult);
1135 mult_exprt::check(expr);
1136 return static_cast<mult_exprt &>(expr);
1137}
1138
1139
1142{
1143public:
1145 : binary_exprt(std::move(_lhs), ID_div, std::move(_rhs))
1146 {
1147 }
1148
1151 {
1152 return op0();
1153 }
1154
1156 const exprt &dividend() const
1157 {
1158 return op0();
1159 }
1160
1163 {
1164 return op1();
1165 }
1166
1168 const exprt &divisor() const
1169 {
1170 return op1();
1171 }
1172};
1173
1174template <>
1175inline bool can_cast_expr<div_exprt>(const exprt &base)
1176{
1177 return base.id() == ID_div;
1178}
1179
1186inline const div_exprt &to_div_expr(const exprt &expr)
1187{
1188 PRECONDITION(expr.id()==ID_div);
1189 div_exprt::check(expr);
1190 return static_cast<const div_exprt &>(expr);
1191}
1192
1195{
1196 PRECONDITION(expr.id()==ID_div);
1197 div_exprt::check(expr);
1198 return static_cast<div_exprt &>(expr);
1199}
1200
1206{
1207public:
1209 : binary_exprt(std::move(_lhs), ID_mod, std::move(_rhs))
1210 {
1211 }
1212
1215 {
1216 return op0();
1217 }
1218
1220 const exprt &dividend() const
1221 {
1222 return op0();
1223 }
1224
1227 {
1228 return op1();
1229 }
1230
1232 const exprt &divisor() const
1233 {
1234 return op1();
1235 }
1236};
1237
1238template <>
1239inline bool can_cast_expr<mod_exprt>(const exprt &base)
1240{
1241 return base.id() == ID_mod;
1242}
1243
1250inline const mod_exprt &to_mod_expr(const exprt &expr)
1251{
1252 PRECONDITION(expr.id()==ID_mod);
1253 mod_exprt::check(expr);
1254 return static_cast<const mod_exprt &>(expr);
1255}
1256
1259{
1260 PRECONDITION(expr.id()==ID_mod);
1261 mod_exprt::check(expr);
1262 return static_cast<mod_exprt &>(expr);
1263}
1264
1267{
1268public:
1273
1276 {
1277 return op0();
1278 }
1279
1281 const exprt &dividend() const
1282 {
1283 return op0();
1284 }
1285
1288 {
1289 return op1();
1290 }
1291
1293 const exprt &divisor() const
1294 {
1295 return op1();
1296 }
1297};
1298
1299template <>
1301{
1302 return base.id() == ID_euclidean_mod;
1303}
1304
1312{
1313 PRECONDITION(expr.id() == ID_euclidean_mod);
1315 return static_cast<const euclidean_mod_exprt &>(expr);
1316}
1317
1320{
1321 PRECONDITION(expr.id() == ID_euclidean_mod);
1323 return static_cast<euclidean_mod_exprt &>(expr);
1324}
1325
1326
1329{
1330public:
1332 : binary_relation_exprt(std::move(_lhs), ID_equal, std::move(_rhs))
1333 {
1334 PRECONDITION(lhs().type() == rhs().type());
1335 }
1336
1337 static void check(
1338 const exprt &expr,
1340 {
1342 }
1343
1344 static void validate(
1345 const exprt &expr,
1346 const namespacet &ns,
1348 {
1349 binary_relation_exprt::validate(expr, ns, vm);
1350 }
1351};
1352
1353template <>
1354inline bool can_cast_expr<equal_exprt>(const exprt &base)
1355{
1356 return base.id() == ID_equal;
1357}
1358
1365inline const equal_exprt &to_equal_expr(const exprt &expr)
1366{
1367 PRECONDITION(expr.id()==ID_equal);
1368 equal_exprt::check(expr);
1369 return static_cast<const equal_exprt &>(expr);
1370}
1371
1374{
1375 PRECONDITION(expr.id()==ID_equal);
1376 equal_exprt::check(expr);
1377 return static_cast<equal_exprt &>(expr);
1378}
1379
1380
1383{
1384public:
1389};
1390
1391template <>
1392inline bool can_cast_expr<notequal_exprt>(const exprt &base)
1393{
1394 return base.id() == ID_notequal;
1395}
1396
1403inline const notequal_exprt &to_notequal_expr(const exprt &expr)
1404{
1405 PRECONDITION(expr.id()==ID_notequal);
1407 return static_cast<const notequal_exprt &>(expr);
1408}
1409
1412{
1413 PRECONDITION(expr.id()==ID_notequal);
1415 return static_cast<notequal_exprt &>(expr);
1416}
1417
1418
1421{
1422public:
1423 // _array must have either index or vector type.
1424 // When _array has array_type, the type of _index
1425 // must be array_type.index_type().
1426 // This will eventually be enforced using a precondition.
1428 : binary_exprt(
1429 _array,
1430 ID_index,
1431 std::move(_index),
1432 to_type_with_subtype(_array.type()).subtype())
1433 {
1434 const auto &array_op_type = _array.type();
1436 array_op_type.id() == ID_array || array_op_type.id() == ID_vector);
1437 }
1438
1440 : binary_exprt(
1441 std::move(_array),
1442 ID_index,
1443 std::move(_index),
1444 std::move(_type))
1445 {
1446 const auto &array_op_type = array().type();
1448 array_op_type.id() == ID_array || array_op_type.id() == ID_vector);
1449 }
1450
1452 {
1453 return op0();
1454 }
1455
1456 const exprt &array() const
1457 {
1458 return op0();
1459 }
1460
1462 {
1463 return op1();
1464 }
1465
1466 const exprt &index() const
1467 {
1468 return op1();
1469 }
1470};
1471
1472template <>
1473inline bool can_cast_expr<index_exprt>(const exprt &base)
1474{
1475 return base.id() == ID_index;
1476}
1477
1484inline const index_exprt &to_index_expr(const exprt &expr)
1485{
1486 PRECONDITION(expr.id()==ID_index);
1487 index_exprt::check(expr);
1488 return static_cast<const index_exprt &>(expr);
1489}
1490
1493{
1494 PRECONDITION(expr.id()==ID_index);
1495 index_exprt::check(expr);
1496 return static_cast<index_exprt &>(expr);
1497}
1498
1499
1502{
1503public:
1505 : unary_exprt(ID_array_of, std::move(_what), std::move(_type))
1506 {
1507 }
1508
1509 const array_typet &type() const
1510 {
1511 return static_cast<const array_typet &>(unary_exprt::type());
1512 }
1513
1515 {
1516 return static_cast<array_typet &>(unary_exprt::type());
1517 }
1518
1520 {
1521 return op0();
1522 }
1523
1524 const exprt &what() const
1525 {
1526 return op0();
1527 }
1528};
1529
1530template <>
1531inline bool can_cast_expr<array_of_exprt>(const exprt &base)
1532{
1533 return base.id() == ID_array_of;
1534}
1535
1542inline const array_of_exprt &to_array_of_expr(const exprt &expr)
1543{
1544 PRECONDITION(expr.id()==ID_array_of);
1546 return static_cast<const array_of_exprt &>(expr);
1547}
1548
1551{
1552 PRECONDITION(expr.id()==ID_array_of);
1554 return static_cast<array_of_exprt &>(expr);
1555}
1556
1557
1560{
1561public:
1563 : multi_ary_exprt(ID_array, std::move(_operands), std::move(_type))
1564 {
1565 }
1566
1567 const array_typet &type() const
1568 {
1569 return static_cast<const array_typet &>(multi_ary_exprt::type());
1570 }
1571
1573 {
1574 return static_cast<array_typet &>(multi_ary_exprt::type());
1575 }
1576
1578 {
1579 if(other.source_location().is_not_nil())
1580 add_source_location() = other.source_location();
1581 return *this;
1582 }
1583
1585 {
1586 if(other.source_location().is_not_nil())
1587 add_source_location() = other.source_location();
1588 return std::move(*this);
1589 }
1590};
1591
1592template <>
1593inline bool can_cast_expr<array_exprt>(const exprt &base)
1594{
1595 return base.id() == ID_array;
1596}
1597
1604inline const array_exprt &to_array_expr(const exprt &expr)
1605{
1606 PRECONDITION(expr.id()==ID_array);
1607 array_exprt::check(expr);
1608 return static_cast<const array_exprt &>(expr);
1609}
1610
1613{
1614 PRECONDITION(expr.id()==ID_array);
1615 array_exprt::check(expr);
1616 return static_cast<array_exprt &>(expr);
1617}
1618
1622{
1623public:
1625 : multi_ary_exprt(ID_array_list, std::move(_operands), std::move(_type))
1626 {
1627 }
1628
1629 const array_typet &type() const
1630 {
1631 return static_cast<const array_typet &>(multi_ary_exprt::type());
1632 }
1633
1635 {
1636 return static_cast<array_typet &>(multi_ary_exprt::type());
1637 }
1638
1640 void add(exprt index, exprt value)
1641 {
1642 add_to_operands(std::move(index), std::move(value));
1643 }
1644
1645 static void check(
1646 const exprt &expr,
1648 {
1649 DATA_CHECK(
1650 vm, expr.operands().size() % 2 == 0, "number of operands must be even");
1651 }
1652};
1653
1654template <>
1656{
1657 return base.id() == ID_array_list;
1658}
1659
1661{
1662 PRECONDITION(expr.id() == ID_array_list);
1664 return static_cast<const array_list_exprt &>(expr);
1665}
1666
1668{
1669 PRECONDITION(expr.id() == ID_array_list);
1671 return static_cast<array_list_exprt &>(expr);
1672}
1673
1676{
1677public:
1679 : multi_ary_exprt(ID_vector, std::move(_operands), std::move(_type))
1680 {
1681 }
1682};
1683
1684template <>
1685inline bool can_cast_expr<vector_exprt>(const exprt &base)
1686{
1687 return base.id() == ID_vector;
1688}
1689
1696inline const vector_exprt &to_vector_expr(const exprt &expr)
1697{
1698 PRECONDITION(expr.id()==ID_vector);
1699 vector_exprt::check(expr);
1700 return static_cast<const vector_exprt &>(expr);
1701}
1702
1705{
1706 PRECONDITION(expr.id()==ID_vector);
1707 vector_exprt::check(expr);
1708 return static_cast<vector_exprt &>(expr);
1709}
1710
1711
1714{
1715public:
1717 : unary_exprt(ID_union, std::move(_value), std::move(_type))
1718 {
1720 }
1721
1723 {
1724 return get(ID_component_name);
1725 }
1726
1727 void set_component_name(const irep_idt &component_name)
1728 {
1729 set(ID_component_name, component_name);
1730 }
1731
1732 std::size_t get_component_number() const
1733 {
1735 }
1736
1737 void set_component_number(std::size_t component_number)
1738 {
1739 set_size_t(ID_component_number, component_number);
1740 }
1741};
1742
1743template <>
1744inline bool can_cast_expr<union_exprt>(const exprt &base)
1745{
1746 return base.id() == ID_union;
1747}
1748
1755inline const union_exprt &to_union_expr(const exprt &expr)
1756{
1757 PRECONDITION(expr.id()==ID_union);
1758 union_exprt::check(expr);
1759 return static_cast<const union_exprt &>(expr);
1760}
1761
1764{
1765 PRECONDITION(expr.id()==ID_union);
1766 union_exprt::check(expr);
1767 return static_cast<union_exprt &>(expr);
1768}
1769
1773{
1774public:
1775 explicit empty_union_exprt(typet _type)
1776 : nullary_exprt(ID_empty_union, std::move(_type))
1777 {
1778 }
1779};
1780
1781template <>
1783{
1784 return base.id() == ID_empty_union;
1785}
1786
1794{
1795 PRECONDITION(expr.id() == ID_empty_union);
1797 return static_cast<const empty_union_exprt &>(expr);
1798}
1799
1802{
1803 PRECONDITION(expr.id() == ID_empty_union);
1805 return static_cast<empty_union_exprt &>(expr);
1806}
1807
1810{
1811public:
1813 : multi_ary_exprt(ID_struct, std::move(_operands), std::move(_type))
1814 {
1815 }
1816
1817 exprt &component(const irep_idt &name, const namespacet &ns);
1818 const exprt &component(const irep_idt &name, const namespacet &ns) const;
1819};
1820
1821template <>
1822inline bool can_cast_expr<struct_exprt>(const exprt &base)
1823{
1824 return base.id() == ID_struct;
1825}
1826
1833inline const struct_exprt &to_struct_expr(const exprt &expr)
1834{
1835 PRECONDITION(expr.id()==ID_struct);
1836 return static_cast<const struct_exprt &>(expr);
1837}
1838
1841{
1842 PRECONDITION(expr.id()==ID_struct);
1843 return static_cast<struct_exprt &>(expr);
1844}
1845
1846
1849{
1850public:
1852 : binary_exprt(
1853 std::move(_real),
1854 ID_complex,
1855 std::move(_imag),
1856 std::move(_type))
1857 {
1858 }
1859
1861 {
1862 return op0();
1863 }
1864
1865 const exprt &real() const
1866 {
1867 return op0();
1868 }
1869
1871 {
1872 return op1();
1873 }
1874
1875 const exprt &imag() const
1876 {
1877 return op1();
1878 }
1879};
1880
1881template <>
1882inline bool can_cast_expr<complex_exprt>(const exprt &base)
1883{
1884 return base.id() == ID_complex;
1885}
1886
1893inline const complex_exprt &to_complex_expr(const exprt &expr)
1894{
1895 PRECONDITION(expr.id()==ID_complex);
1897 return static_cast<const complex_exprt &>(expr);
1898}
1899
1902{
1903 PRECONDITION(expr.id()==ID_complex);
1905 return static_cast<complex_exprt &>(expr);
1906}
1907
1910{
1911public:
1912 explicit complex_real_exprt(const exprt &op)
1914 {
1915 }
1916};
1917
1918template <>
1920{
1921 return base.id() == ID_complex_real;
1922}
1923
1931{
1932 PRECONDITION(expr.id() == ID_complex_real);
1934 return static_cast<const complex_real_exprt &>(expr);
1935}
1936
1939{
1940 PRECONDITION(expr.id() == ID_complex_real);
1942 return static_cast<complex_real_exprt &>(expr);
1943}
1944
1947{
1948public:
1949 explicit complex_imag_exprt(const exprt &op)
1951 {
1952 }
1953};
1954
1955template <>
1957{
1958 return base.id() == ID_complex_imag;
1959}
1960
1968{
1969 PRECONDITION(expr.id() == ID_complex_imag);
1971 return static_cast<const complex_imag_exprt &>(expr);
1972}
1973
1976{
1977 PRECONDITION(expr.id() == ID_complex_imag);
1979 return static_cast<complex_imag_exprt &>(expr);
1980}
1981
1982
1985{
1986public:
1988 : unary_exprt(ID_typecast, std::move(op), std::move(_type))
1989 {
1990 }
1991
1992 // returns a typecast if the type doesn't already match
1993 static exprt conditional_cast(const exprt &expr, const typet &type)
1994 {
1995 if(expr.type() == type)
1996 return expr;
1997 else
1998 return typecast_exprt(expr, type);
1999 }
2000};
2001
2002template <>
2003inline bool can_cast_expr<typecast_exprt>(const exprt &base)
2004{
2005 return base.id() == ID_typecast;
2006}
2007
2014inline const typecast_exprt &to_typecast_expr(const exprt &expr)
2015{
2016 PRECONDITION(expr.id()==ID_typecast);
2018 return static_cast<const typecast_exprt &>(expr);
2019}
2020
2023{
2024 PRECONDITION(expr.id()==ID_typecast);
2026 return static_cast<typecast_exprt &>(expr);
2027}
2028
2033{
2034public:
2036 : multi_ary_exprt(std::move(op0), ID_and, std::move(op1), bool_typet())
2037 {
2038 }
2039
2042 ID_and,
2043 {std::move(op0), std::move(op1), std::move(op2)},
2044 bool_typet())
2045 {
2046 }
2047
2050 ID_and,
2051 {std::move(op0), std::move(op1), std::move(op2), std::move(op3)},
2052 bool_typet())
2053 {
2054 }
2055
2060};
2061
2065
2067
2072
2073template <>
2074inline bool can_cast_expr<and_exprt>(const exprt &base)
2075{
2076 return base.id() == ID_and;
2077}
2078
2085inline const and_exprt &to_and_expr(const exprt &expr)
2086{
2087 PRECONDITION(expr.id()==ID_and);
2088 and_exprt::check(expr);
2089 return static_cast<const and_exprt &>(expr);
2090}
2091
2094{
2095 PRECONDITION(expr.id()==ID_and);
2096 and_exprt::check(expr);
2097 return static_cast<and_exprt &>(expr);
2098}
2099
2108{
2109public:
2111 : multi_ary_exprt(std::move(op0), ID_nand, std::move(op1), bool_typet())
2112 {
2113 }
2114
2119};
2120
2127inline const nand_exprt &to_nand_expr(const exprt &expr)
2128{
2129 PRECONDITION(expr.id() == ID_nand);
2130 nand_exprt::check(expr);
2131 return static_cast<const nand_exprt &>(expr);
2132}
2133
2136{
2137 PRECONDITION(expr.id() == ID_nand);
2138 nand_exprt::check(expr);
2139 return static_cast<nand_exprt &>(expr);
2140}
2141
2144{
2145public:
2147 : binary_exprt(std::move(op0), ID_implies, std::move(op1), bool_typet())
2148 {
2149 }
2150};
2151
2152template <>
2153inline bool can_cast_expr<implies_exprt>(const exprt &base)
2154{
2155 return base.id() == ID_implies;
2156}
2157
2164inline const implies_exprt &to_implies_expr(const exprt &expr)
2165{
2166 PRECONDITION(expr.id()==ID_implies);
2168 return static_cast<const implies_exprt &>(expr);
2169}
2170
2173{
2174 PRECONDITION(expr.id()==ID_implies);
2176 return static_cast<implies_exprt &>(expr);
2177}
2178
2183{
2184public:
2186 : multi_ary_exprt(std::move(op0), ID_or, std::move(op1), bool_typet())
2187 {
2188 }
2189
2192 ID_or,
2193 {std::move(op0), std::move(op1), std::move(op2)},
2194 bool_typet())
2195 {
2196 }
2197
2200 ID_or,
2201 {std::move(op0), std::move(op1), std::move(op2), std::move(op3)},
2202 bool_typet())
2203 {
2204 }
2205
2210};
2211
2215
2217
2218template <>
2219inline bool can_cast_expr<or_exprt>(const exprt &base)
2220{
2221 return base.id() == ID_or;
2222}
2223
2230inline const or_exprt &to_or_expr(const exprt &expr)
2231{
2232 PRECONDITION(expr.id()==ID_or);
2233 or_exprt::check(expr);
2234 return static_cast<const or_exprt &>(expr);
2235}
2236
2239{
2240 PRECONDITION(expr.id()==ID_or);
2241 or_exprt::check(expr);
2242 return static_cast<or_exprt &>(expr);
2243}
2244
2253{
2254public:
2256 : multi_ary_exprt(std::move(op0), ID_nor, std::move(op1), bool_typet())
2257 {
2258 }
2259
2264};
2265
2272inline const nor_exprt &to_nor_expr(const exprt &expr)
2273{
2274 PRECONDITION(expr.id() == ID_nor);
2275 nor_exprt::check(expr);
2276 return static_cast<const nor_exprt &>(expr);
2277}
2278
2281{
2282 PRECONDITION(expr.id() == ID_nor);
2283 return static_cast<nor_exprt &>(expr);
2284}
2285
2290{
2291public:
2293 : multi_ary_exprt(std::move(_op0), ID_xor, std::move(_op1), bool_typet())
2294 {
2295 }
2296
2301};
2302
2303template <>
2304inline bool can_cast_expr<xor_exprt>(const exprt &base)
2305{
2306 return base.id() == ID_xor;
2307}
2308
2315inline const xor_exprt &to_xor_expr(const exprt &expr)
2316{
2317 PRECONDITION(expr.id()==ID_xor);
2318 xor_exprt::check(expr);
2319 return static_cast<const xor_exprt &>(expr);
2320}
2321
2324{
2325 PRECONDITION(expr.id()==ID_xor);
2326 xor_exprt::check(expr);
2327 return static_cast<xor_exprt &>(expr);
2328}
2329
2336{
2337public:
2339 : multi_ary_exprt(std::move(_op0), ID_xnor, std::move(_op1), bool_typet())
2340 {
2341 }
2342
2347};
2348
2349template <>
2350inline bool can_cast_expr<xnor_exprt>(const exprt &base)
2351{
2352 return base.id() == ID_xnor;
2353}
2354
2361inline const xnor_exprt &to_xnor_expr(const exprt &expr)
2362{
2363 PRECONDITION(expr.id() == ID_xnor);
2364 xnor_exprt::check(expr);
2365 return static_cast<const xnor_exprt &>(expr);
2366}
2367
2370{
2371 PRECONDITION(expr.id() == ID_xnor);
2372 xnor_exprt::check(expr);
2373 return static_cast<xnor_exprt &>(expr);
2374}
2375
2378{
2379public:
2381 {
2382 PRECONDITION(as_const(*this).op().is_boolean());
2383 }
2384};
2385
2386template <>
2387inline bool can_cast_expr<not_exprt>(const exprt &base)
2388{
2389 return base.id() == ID_not;
2390}
2391
2398inline const not_exprt &to_not_expr(const exprt &expr)
2399{
2400 PRECONDITION(expr.id()==ID_not);
2401 not_exprt::check(expr);
2402 return static_cast<const not_exprt &>(expr);
2403}
2404
2407{
2408 PRECONDITION(expr.id()==ID_not);
2409 not_exprt::check(expr);
2410 return static_cast<not_exprt &>(expr);
2411}
2412
2413
2416{
2417public:
2419 : ternary_exprt(ID_if, std::move(cond), t, std::move(f), t.type())
2420 {
2421 }
2422
2424 : ternary_exprt(
2425 ID_if,
2426 std::move(cond),
2427 std::move(t),
2428 std::move(f),
2429 std::move(type))
2430 {
2431 }
2432
2434 {
2435 return op0();
2436 }
2437
2438 const exprt &cond() const
2439 {
2440 return op0();
2441 }
2442
2444 {
2445 return op1();
2446 }
2447
2448 const exprt &true_case() const
2449 {
2450 return op1();
2451 }
2452
2454 {
2455 return op2();
2456 }
2457
2458 const exprt &false_case() const
2459 {
2460 return op2();
2461 }
2462
2463 static void check(
2464 const exprt &expr,
2466 {
2467 ternary_exprt::check(expr, vm);
2468 }
2469
2470 static void validate(
2471 const exprt &expr,
2472 const namespacet &ns,
2474 {
2475 ternary_exprt::validate(expr, ns, vm);
2476 }
2477};
2478
2479template <>
2480inline bool can_cast_expr<if_exprt>(const exprt &base)
2481{
2482 return base.id() == ID_if;
2483}
2484
2491inline const if_exprt &to_if_expr(const exprt &expr)
2492{
2493 PRECONDITION(expr.id()==ID_if);
2494 if_exprt::check(expr);
2495 return static_cast<const if_exprt &>(expr);
2496}
2497
2500{
2501 PRECONDITION(expr.id()==ID_if);
2502 if_exprt::check(expr);
2503 return static_cast<if_exprt &>(expr);
2504}
2505
2510{
2511public:
2514 ID_with,
2515 _old.type(),
2516 {_old, std::move(_where), std::move(_new_value)})
2517 {
2518 }
2519
2521 {
2522 return op0();
2523 }
2524
2525 const exprt &old() const
2526 {
2527 return op0();
2528 }
2529
2531 {
2532 return op1();
2533 }
2534
2535 const exprt &where() const
2536 {
2537 return op1();
2538 }
2539
2541 {
2542 return op2();
2543 }
2544
2545 const exprt &new_value() const
2546 {
2547 return op2();
2548 }
2549};
2550
2551template <>
2552inline bool can_cast_expr<with_exprt>(const exprt &base)
2553{
2554 return base.id() == ID_with;
2555}
2556
2563inline const with_exprt &to_with_expr(const exprt &expr)
2564{
2565 PRECONDITION(expr.id()==ID_with);
2566 with_exprt::check(expr);
2567 return static_cast<const with_exprt &>(expr);
2568}
2569
2572{
2573 PRECONDITION(expr.id()==ID_with);
2574 with_exprt::check(expr);
2575 return static_cast<with_exprt &>(expr);
2576}
2577
2579{
2580public:
2583 {
2584 }
2585
2586 const exprt &index() const
2587 {
2588 return op0();
2589 }
2590
2592 {
2593 return op0();
2594 }
2595};
2596
2597template <>
2599{
2600 return base.id() == ID_index_designator;
2601}
2602
2610{
2613 return static_cast<const index_designatort &>(expr);
2614}
2615
2618{
2621 return static_cast<index_designatort &>(expr);
2622}
2623
2625{
2626public:
2632
2634 {
2635 return get(ID_component_name);
2636 }
2637};
2638
2639template <>
2641{
2642 return base.id() == ID_member_designator;
2643}
2644
2652{
2655 return static_cast<const member_designatort &>(expr);
2656}
2657
2660{
2663 return static_cast<member_designatort &>(expr);
2664}
2665
2666
2669{
2670public:
2672 : ternary_exprt(
2673 ID_update,
2674 _old,
2675 std::move(_designator),
2676 std::move(_new_value),
2677 _old.type())
2678 {
2679 }
2680
2682 {
2683 return op0();
2684 }
2685
2686 const exprt &old() const
2687 {
2688 return op0();
2689 }
2690
2691 // the designator operands are either
2692 // 1) member_designator or
2693 // 2) index_designator
2694 // as defined above
2696 {
2697 return op1().operands();
2698 }
2699
2701 {
2702 return op1().operands();
2703 }
2704
2706 {
2707 return op2();
2708 }
2709
2710 const exprt &new_value() const
2711 {
2712 return op2();
2713 }
2714
2716 with_exprt make_with_expr() const;
2717
2718 static void check(
2719 const exprt &expr,
2721 {
2722 ternary_exprt::check(expr, vm);
2723 }
2724
2725 static void validate(
2726 const exprt &expr,
2727 const namespacet &ns,
2729 {
2730 ternary_exprt::validate(expr, ns, vm);
2731 }
2732};
2733
2734template <>
2735inline bool can_cast_expr<update_exprt>(const exprt &base)
2736{
2737 return base.id() == ID_update;
2738}
2739
2740inline void validate_expr(const update_exprt &value)
2741{
2743 value, 3, "Array/structure update must have three operands");
2744}
2745
2752inline const update_exprt &to_update_expr(const exprt &expr)
2753{
2754 PRECONDITION(expr.id()==ID_update);
2755 update_exprt::check(expr);
2756 return static_cast<const update_exprt &>(expr);
2757}
2758
2761{
2762 PRECONDITION(expr.id()==ID_update);
2763 update_exprt::check(expr);
2764 return static_cast<update_exprt &>(expr);
2765}
2766
2767
2768#if 0
2771{
2772public:
2774 const exprt &_array,
2775 const exprt &_index,
2776 const exprt &_new_value):
2778 {
2779 add_to_operands(_array, _index, _new_value);
2780 }
2781
2783 {
2784 operands().resize(3);
2785 }
2786
2787 exprt &array()
2788 {
2789 return op0();
2790 }
2791
2792 const exprt &array() const
2793 {
2794 return op0();
2795 }
2796
2797 exprt &index()
2798 {
2799 return op1();
2800 }
2801
2802 const exprt &index() const
2803 {
2804 return op1();
2805 }
2806
2807 exprt &new_value()
2808 {
2809 return op2();
2810 }
2811
2812 const exprt &new_value() const
2813 {
2814 return op2();
2815 }
2816};
2817
2818template<> inline bool can_cast_expr<array_update_exprt>(const exprt &base)
2819{
2820 return base.id()==ID_array_update;
2821}
2822
2823inline void validate_expr(const array_update_exprt &value)
2824{
2825 validate_operands(value, 3, "Array update must have three operands");
2826}
2827
2834inline const array_update_exprt &to_array_update_expr(const exprt &expr)
2835{
2837 const array_update_exprt &ret = static_cast<const array_update_exprt &>(expr);
2839 return ret;
2840}
2841
2844{
2846 array_update_exprt &ret = static_cast<array_update_exprt &>(expr);
2848 return ret;
2849}
2850
2851#endif
2852
2853
2856{
2857public:
2858 member_exprt(exprt op, const irep_idt &component_name, typet _type)
2859 : unary_exprt(ID_member, std::move(op), std::move(_type))
2860 {
2861 const auto &compound_type_id = compound().type().id();
2865 set_component_name(component_name);
2866 }
2867
2877
2879 {
2880 return get(ID_component_name);
2881 }
2882
2883 void set_component_name(const irep_idt &component_name)
2884 {
2885 set(ID_component_name, component_name);
2886 }
2887
2888 std::size_t get_component_number() const
2889 {
2891 }
2892
2893 // will go away, use compound()
2894 const exprt &struct_op() const
2895 {
2896 return op0();
2897 }
2898
2899 // will go away, use compound()
2901 {
2902 return op0();
2903 }
2904
2905 const exprt &compound() const
2906 {
2907 return op0();
2908 }
2909
2911 {
2912 return op0();
2913 }
2914
2915 static void check(
2916 const exprt &expr,
2918 {
2919 DATA_CHECK(
2920 vm,
2921 expr.operands().size() == 1,
2922 "member expression must have one operand");
2923 }
2924
2925 static void validate(
2926 const exprt &expr,
2927 const namespacet &ns,
2929};
2930
2931template <>
2932inline bool can_cast_expr<member_exprt>(const exprt &base)
2933{
2934 return base.id() == ID_member;
2935}
2936
2943inline const member_exprt &to_member_expr(const exprt &expr)
2944{
2945 PRECONDITION(expr.id()==ID_member);
2946 member_exprt::check(expr);
2947 return static_cast<const member_exprt &>(expr);
2948}
2949
2952{
2953 PRECONDITION(expr.id()==ID_member);
2954 member_exprt::check(expr);
2955 return static_cast<member_exprt &>(expr);
2956}
2957
2958
2961{
2962public:
2964 {
2965 }
2966};
2967
2968template <>
2969inline bool can_cast_expr<type_exprt>(const exprt &base)
2970{
2971 return base.id() == ID_type;
2972}
2973
2980inline const type_exprt &to_type_expr(const exprt &expr)
2981{
2983 type_exprt::check(expr);
2984 return static_cast<const type_exprt &>(expr);
2985}
2986
2989{
2991 type_exprt::check(expr);
2992 return static_cast<type_exprt &>(expr);
2993}
2994
2997{
2998public:
2999 constant_exprt(const irep_idt &_value, typet _type)
3000 : nullary_exprt(ID_constant, std::move(_type))
3001 {
3002 set_value(_value);
3003 }
3004
3005 const irep_idt &get_value() const
3006 {
3007 return get(ID_value);
3008 }
3009
3010 void set_value(const irep_idt &value)
3011 {
3012 set(ID_value, value);
3013 }
3014
3018 bool is_null_pointer() const;
3019
3020 using irept::operator==;
3021 using irept::operator!=;
3023 bool operator==(bool rhs) const;
3025 bool operator!=(bool rhs) const;
3027 bool operator==(int rhs) const;
3029 bool operator!=(int rhs) const;
3031 bool operator==(std::nullptr_t) const;
3033 bool operator!=(std::nullptr_t) const;
3034
3035 static void check(
3036 const exprt &expr,
3038
3039 static void validate(
3040 const exprt &expr,
3041 const namespacet &,
3043 {
3044 check(expr, vm);
3045 }
3046
3047protected:
3048 bool value_is_zero_string() const;
3049};
3050
3051template <>
3052inline bool can_cast_expr<constant_exprt>(const exprt &base)
3053{
3054 return base.is_constant();
3055}
3056
3057inline void validate_expr(const constant_exprt &value)
3058{
3059 validate_operands(value, 0, "Constants must not have operands");
3060}
3061
3068inline const constant_exprt &to_constant_expr(const exprt &expr)
3069{
3070 PRECONDITION(expr.is_constant());
3072 return static_cast<const constant_exprt &>(expr);
3073}
3074
3077{
3078 PRECONDITION(expr.is_constant());
3080 return static_cast<constant_exprt &>(expr);
3081}
3082
3085bool operator==(const exprt &lhs, bool rhs);
3086
3089bool operator!=(const exprt &lhs, bool rhs);
3090
3102bool operator==(const exprt &lhs, int rhs);
3103
3105bool operator!=(const exprt &lhs, int rhs);
3106
3109bool operator==(const exprt &lhs, std::nullptr_t);
3110
3112bool operator!=(const exprt &lhs, std::nullptr_t);
3113
3116{
3117public:
3121};
3122
3125{
3126public:
3130};
3131
3134{
3135public:
3140};
3141
3142template <>
3143inline bool can_cast_expr<nil_exprt>(const exprt &base)
3144{
3145 return base.id() == ID_nil;
3146}
3147
3150{
3151public:
3152 explicit infinity_exprt(typet _type)
3153 : nullary_exprt(ID_infinity, std::move(_type))
3154 {
3155 }
3156};
3157
3160{
3161public:
3162 using variablest = std::vector<symbol_exprt>;
3163
3166 irep_idt _id,
3167 const variablest &_variables,
3168 exprt _where,
3169 typet _type)
3170 : binary_exprt(
3172 ID_tuple,
3174 typet(ID_tuple)),
3175 _id,
3176 std::move(_where),
3177 std::move(_type))
3178 {
3179 }
3180
3182 {
3183 return (variablest &)to_multi_ary_expr(op0()).operands();
3184 }
3185
3186 const variablest &variables() const
3187 {
3188 return (variablest &)to_multi_ary_expr(op0()).operands();
3189 }
3190
3192 {
3193 return op1();
3194 }
3195
3196 const exprt &where() const
3197 {
3198 return op1();
3199 }
3200
3203 exprt instantiate(const exprt::operandst &) const;
3204
3207 exprt instantiate(const variablest &) const;
3208};
3209
3210template <>
3211inline bool can_cast_expr<binding_exprt>(const exprt &base)
3212{
3213 return base.id() == ID_forall || base.id() == ID_exists ||
3214 base.id() == ID_lambda || base.id() == ID_array_comprehension;
3215}
3216
3223inline const binding_exprt &to_binding_expr(const exprt &expr)
3224{
3226 expr.id() == ID_forall || expr.id() == ID_exists ||
3227 expr.id() == ID_lambda || expr.id() == ID_array_comprehension);
3229 return static_cast<const binding_exprt &>(expr);
3230}
3231
3239{
3241 expr.id() == ID_forall || expr.id() == ID_exists ||
3242 expr.id() == ID_lambda || expr.id() == ID_array_comprehension);
3244 return static_cast<binding_exprt &>(expr);
3245}
3246
3249{
3250public:
3254 const exprt &where)
3255 : binary_exprt(
3258 std::move(variables),
3259 where,
3260 where.type()),
3261 ID_let,
3263 where.type())
3264 {
3265 PRECONDITION(this->variables().size() == this->values().size());
3266 }
3267
3270 : let_exprt(
3272 operandst{std::move(value)},
3273 where)
3274 {
3275 }
3276
3278 {
3279 return static_cast<binding_exprt &>(op0());
3280 }
3281
3282 const binding_exprt &binding() const
3283 {
3284 return static_cast<const binding_exprt &>(op0());
3285 }
3286
3289 {
3290 auto &variables = binding().variables();
3291 PRECONDITION(variables.size() == 1);
3292 return variables.front();
3293 }
3294
3296 const symbol_exprt &symbol() const
3297 {
3298 const auto &variables = binding().variables();
3299 PRECONDITION(variables.size() == 1);
3300 return variables.front();
3301 }
3302
3305 {
3306 auto &values = this->values();
3307 PRECONDITION(values.size() == 1);
3308 return values.front();
3309 }
3310
3312 const exprt &value() const
3313 {
3314 const auto &values = this->values();
3315 PRECONDITION(values.size() == 1);
3316 return values.front();
3317 }
3318
3320 {
3321 return static_cast<multi_ary_exprt &>(op1()).operands();
3322 }
3323
3324 const operandst &values() const
3325 {
3326 return static_cast<const multi_ary_exprt &>(op1()).operands();
3327 }
3328
3331 {
3332 return binding().variables();
3333 }
3334
3337 {
3338 return binding().variables();
3339 }
3340
3343 {
3344 return binding().where();
3345 }
3346
3348 const exprt &where() const
3349 {
3350 return binding().where();
3351 }
3352
3353 static void validate(const exprt &, validation_modet);
3354};
3355
3356template <>
3357inline bool can_cast_expr<let_exprt>(const exprt &base)
3358{
3359 return base.id() == ID_let;
3360}
3361
3363{
3364 validate_operands(let_expr, 2, "Let must have two operands");
3365}
3366
3373inline const let_exprt &to_let_expr(const exprt &expr)
3374{
3375 PRECONDITION(expr.id()==ID_let);
3376 let_exprt::check(expr);
3377 return static_cast<const let_exprt &>(expr);
3378}
3379
3382{
3383 PRECONDITION(expr.id()==ID_let);
3384 let_exprt::check(expr);
3385 return static_cast<let_exprt &>(expr);
3386}
3387
3388
3393{
3394public:
3396 : multi_ary_exprt(ID_cond, std::move(_operands), std::move(_type))
3397 {
3398 }
3399
3403 void add_case(const exprt &condition, const exprt &value)
3404 {
3405 PRECONDITION(condition.is_boolean());
3406 operands().reserve(operands().size() + 2);
3407 operands().push_back(condition);
3408 operands().push_back(value);
3409 }
3410
3411 // a lowering to nested if_exprt
3412 exprt lower() const;
3413};
3414
3415template <>
3416inline bool can_cast_expr<cond_exprt>(const exprt &base)
3417{
3418 return base.id() == ID_cond;
3419}
3420
3421inline void validate_expr(const cond_exprt &value)
3422{
3424 value.operands().size() % 2 == 0, "cond must have even number of operands");
3425}
3426
3433inline const cond_exprt &to_cond_expr(const exprt &expr)
3434{
3435 PRECONDITION(expr.id() == ID_cond);
3436 cond_exprt::check(expr);
3437 return static_cast<const cond_exprt &>(expr);
3438}
3439
3442{
3443 PRECONDITION(expr.id() == ID_cond);
3444 cond_exprt::check(expr);
3445 return static_cast<cond_exprt &>(expr);
3446}
3447
3453// NOLINTNEXTLINE(readability/identifiers)
3454class DEPRECATED(SINCE(2026, 1, 18, "SMV-specific, has no other use"))
3456{
3457public:
3459 : multi_ary_exprt(ID_case, std::move(_operands), std::move(_type))
3460 {
3461 }
3462
3465 : multi_ary_exprt(ID_case, {std::move(_select_value)}, std::move(_type))
3466 {
3467 }
3468
3470 const exprt &select_value() const
3471 {
3472 PRECONDITION(!operands().empty());
3473 return operands()[0];
3474 }
3475
3478 {
3479 PRECONDITION(!operands().empty());
3480 return operands()[0];
3481 }
3482
3487 void add_case(const exprt &case_value, const exprt &result_value)
3488 {
3489 operands().reserve(operands().size() + 2);
3490 operands().push_back(case_value);
3491 operands().push_back(result_value);
3492 }
3493
3495 std::size_t number_of_cases() const
3496 {
3497 PRECONDITION(operands().size() >= 1);
3498 return (operands().size() - 1) / 2;
3499 }
3500
3502 const exprt &case_value(std::size_t i) const
3503 {
3504 PRECONDITION(i < number_of_cases());
3505 return operands()[1 + 2 * i];
3506 }
3507
3509 exprt &case_value(std::size_t i)
3510 {
3511 PRECONDITION(i < number_of_cases());
3512 return operands()[1 + 2 * i];
3513 }
3514
3516 const exprt &result_value(std::size_t i) const
3517 {
3518 PRECONDITION(i < number_of_cases());
3519 return operands()[1 + 2 * i + 1];
3520 }
3521
3523 exprt &result_value(std::size_t i)
3524 {
3525 PRECONDITION(i < number_of_cases());
3526 return operands()[1 + 2 * i + 1];
3527 }
3528
3529 static void check(const exprt &expr)
3530 {
3532 expr.operands().size() >= 1,
3533 "case expression must have at least one operand");
3535 expr.operands().size() % 2 == 1,
3536 "case expression must have odd number of operands");
3537 }
3538};
3539
3540template <>
3541inline bool can_cast_expr<case_exprt>(const exprt &base)
3542{
3543 return base.id() == ID_case;
3544}
3545
3552inline const case_exprt &to_case_expr(const exprt &expr)
3553{
3554 PRECONDITION(expr.id() == ID_case);
3555 case_exprt::check(expr);
3556 return static_cast<const case_exprt &>(expr);
3557}
3558
3561{
3562 PRECONDITION(expr.id() == ID_case);
3563 case_exprt::check(expr);
3564 return static_cast<case_exprt &>(expr);
3565}
3566
3576{
3577public:
3580 exprt body,
3581 array_typet _type)
3582 : binding_exprt(
3584 {std::move(arg)},
3585 std::move(body),
3586 std::move(_type))
3587 {
3588 }
3589
3590 const array_typet &type() const
3591 {
3592 return static_cast<const array_typet &>(binary_exprt::type());
3593 }
3594
3596 {
3597 return static_cast<array_typet &>(binary_exprt::type());
3598 }
3599
3600 const symbol_exprt &arg() const
3601 {
3602 auto &variables = this->variables();
3603 PRECONDITION(variables.size() == 1);
3604 return variables[0];
3605 }
3606
3608 {
3609 auto &variables = this->variables();
3610 PRECONDITION(variables.size() == 1);
3611 return variables[0];
3612 }
3613
3614 const exprt &body() const
3615 {
3616 return where();
3617 }
3618
3620 {
3621 return where();
3622 }
3623};
3624
3625template <>
3627{
3628 return base.id() == ID_array_comprehension;
3629}
3630
3637inline const array_comprehension_exprt &
3639{
3642 return static_cast<const array_comprehension_exprt &>(expr);
3643}
3644
3652
3653inline void validate_expr(const class class_method_descriptor_exprt &value);
3654
3657{
3658public:
3674 typet _type,
3678 : nullary_exprt(ID_virtual_function, std::move(_type))
3679 {
3682 set(ID_C_class, std::move(class_id));
3683 set(ID_C_base_name, std::move(base_method_name));
3684 set(ID_identifier, std::move(id));
3685 validate_expr(*this);
3686 }
3687
3695 {
3696 return get(ID_component_name);
3697 }
3698
3702 const irep_idt &class_id() const
3703 {
3704 return get(ID_C_class);
3705 }
3706
3710 {
3711 return get(ID_C_base_name);
3712 }
3713
3718 {
3719 return get(ID_identifier);
3720 }
3721};
3722
3723inline void validate_expr(const class class_method_descriptor_exprt &value)
3724{
3725 validate_operands(value, 0, "class method descriptor must not have operands");
3727 !value.mangled_method_name().empty(),
3728 "class method descriptor must have a mangled method name.");
3730 !value.class_id().empty(), "class method descriptor must have a class id.");
3732 !value.base_method_name().empty(),
3733 "class method descriptor must have a base method name.");
3735 value.get_identifier() == id2string(value.class_id()) + "." +
3737 "class method descriptor must have an identifier in the expected format.");
3738}
3739
3746inline const class_method_descriptor_exprt &
3748{
3751 return static_cast<const class_method_descriptor_exprt &>(expr);
3752}
3753
3754template <>
3756{
3757 return base.id() == ID_virtual_function;
3758}
3759
3766{
3767public:
3769 : binary_exprt(
3770 std::move(symbol),
3772 value, // not moved, for type
3773 value.type())
3774 {
3775 PRECONDITION(symbol.type() == type());
3776 }
3777
3778 const symbol_exprt &symbol() const
3779 {
3780 return static_cast<const symbol_exprt &>(op0());
3781 }
3782
3784 {
3785 return static_cast<symbol_exprt &>(op0());
3786 }
3787
3788 const exprt &value() const
3789 {
3790 return op1();
3791 }
3792
3794 {
3795 return op1();
3796 }
3797};
3798
3799template <>
3801{
3802 return base.id() == ID_named_term;
3803}
3804
3812{
3813 PRECONDITION(expr.id() == ID_named_term);
3815 return static_cast<const named_term_exprt &>(expr);
3816}
3817
3820{
3821 PRECONDITION(expr.id() == ID_named_term);
3823 return static_cast<named_term_exprt &>(expr);
3824}
3825
3826#endif // CPROVER_UTIL_STD_EXPR_H
const T & as_const(T &value)
Return a reference to the same object but ensures the type is const.
Definition as_const.h:14
Absolute value.
Definition std_expr.h:430
abs_exprt(exprt _op)
Definition std_expr.h:432
ait supplies three of the four components needed: an abstract interpreter (in this case handling func...
Definition ai.h:566
ait()
Definition ai.h:569
Boolean AND All operands must be boolean, and the result is always boolean.
Definition std_expr.h:2033
and_exprt(exprt op0, exprt op1, exprt op2)
Definition std_expr.h:2040
and_exprt(exprt op0, exprt op1)
Definition std_expr.h:2035
and_exprt(exprt op0, exprt op1, exprt op2, exprt op3)
Definition std_expr.h:2048
and_exprt(exprt::operandst _operands)
Definition std_expr.h:2056
Expression to define a mapping from an argument (index) to elements.
Definition std_expr.h:3576
const array_typet & type() const
Definition std_expr.h:3590
const symbol_exprt & arg() const
Definition std_expr.h:3600
const exprt & body() const
Definition std_expr.h:3614
array_typet & type()
Definition std_expr.h:3595
symbol_exprt & arg()
Definition std_expr.h:3607
array_comprehension_exprt(symbol_exprt arg, exprt body, array_typet _type)
Definition std_expr.h:3578
Array constructor from list of elements.
Definition std_expr.h:1560
array_exprt && with_source_location(const exprt &other) &&
Definition std_expr.h:1584
const array_typet & type() const
Definition std_expr.h:1567
array_exprt & with_source_location(const exprt &other) &
Definition std_expr.h:1577
array_exprt(operandst _operands, array_typet _type)
Definition std_expr.h:1562
array_typet & type()
Definition std_expr.h:1572
Array constructor from a list of index-element pairs Operands are index/value pairs,...
Definition std_expr.h:1622
static void check(const exprt &expr, const validation_modet vm=validation_modet::INVARIANT)
Definition std_expr.h:1645
void add(exprt index, exprt value)
add an index/value pair
Definition std_expr.h:1640
const array_typet & type() const
Definition std_expr.h:1629
array_list_exprt(operandst _operands, array_typet _type)
Definition std_expr.h:1624
array_typet & type()
Definition std_expr.h:1634
Array constructor from single element.
Definition std_expr.h:1502
array_typet & type()
Definition std_expr.h:1514
array_of_exprt(exprt _what, array_typet _type)
Definition std_expr.h:1504
const exprt & what() const
Definition std_expr.h:1524
const array_typet & type() const
Definition std_expr.h:1509
exprt & what()
Definition std_expr.h:1519
Arrays with given size.
Definition std_types.h:807
A base class for binary expressions.
Definition std_expr.h:639
exprt & lhs()
Definition std_expr.h:669
binary_exprt(const exprt &_lhs, const irep_idt &_id, exprt _rhs)
Definition std_expr.h:641
static void validate(const exprt &expr, const namespacet &, const validation_modet vm=validation_modet::INVARIANT)
Definition std_expr.h:661
const exprt & op2() const =delete
static void check(const exprt &expr, const validation_modet vm=validation_modet::INVARIANT)
Definition std_expr.h:651
exprt & rhs()
Definition std_expr.h:679
exprt & op0()
Definition expr.h:134
const exprt & lhs() const
Definition std_expr.h:674
exprt & op1()
Definition expr.h:137
exprt & op3()=delete
binary_exprt(exprt _lhs, const irep_idt &_id, exprt _rhs, typet _type)
Definition std_expr.h:646
const exprt & rhs() const
Definition std_expr.h:684
exprt & op2()=delete
const exprt & op3() const =delete
A base class for expressions that are predicates, i.e., Boolean-typed, and that take exactly two argu...
Definition std_expr.h:727
static void check(const exprt &expr, const validation_modet vm=validation_modet::INVARIANT)
Definition std_expr.h:734
binary_predicate_exprt(exprt _op0, const irep_idt &_id, exprt _op1)
Definition std_expr.h:729
static void validate(const exprt &expr, const namespacet &ns, const validation_modet vm=validation_modet::INVARIANT)
Definition std_expr.h:742
A base class for relations, i.e., binary predicates whose two operands have the same type.
Definition std_expr.h:774
binary_relation_exprt(exprt _lhs, const irep_idt &_id, exprt _rhs)
Definition std_expr.h:776
static void check(const exprt &expr, const validation_modet vm=validation_modet::INVARIANT)
Definition std_expr.h:781
static void validate(const exprt &expr, const namespacet &ns, const validation_modet vm=validation_modet::INVARIANT)
Definition std_expr.h:788
A base class for variable bindings (quantifiers, let, lambda)
Definition std_expr.h:3160
const variablest & variables() const
Definition std_expr.h:3186
const exprt & where() const
Definition std_expr.h:3196
exprt & where()
Definition std_expr.h:3191
variablest & variables()
Definition std_expr.h:3181
binding_exprt(irep_idt _id, const variablest &_variables, exprt _where, typet _type)
construct the binding expression
Definition std_expr.h:3165
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:3162
The Boolean type.
Definition std_types.h:36
Case expression: evaluates to the value corresponding to the first matching case.
Definition std_expr.h:3456
exprt & result_value(std::size_t i)
Get the result value for the i-th case.
Definition std_expr.h:3523
void add_case(const exprt &case_value, const exprt &result_value)
Add a case: value to compare and corresponding result.
Definition std_expr.h:3487
const exprt & case_value(std::size_t i) const
Get the case value for the i-th case.
Definition std_expr.h:3502
case_exprt(operandst _operands, typet _type)
Definition std_expr.h:3458
exprt & select_value()
Get the value that is being compared against.
Definition std_expr.h:3477
const exprt & result_value(std::size_t i) const
Get the result value for the i-th case.
Definition std_expr.h:3516
std::size_t number_of_cases() const
Get the number of cases (excluding the select value)
Definition std_expr.h:3495
case_exprt(exprt _select_value, typet _type)
Constructor with select value.
Definition std_expr.h:3464
static void check(const exprt &expr)
Definition std_expr.h:3529
exprt & case_value(std::size_t i)
Get the case value for the i-th case.
Definition std_expr.h:3509
const exprt & select_value() const
Get the value that is being compared against.
Definition std_expr.h:3470
An expression describing a method on a class.
Definition std_expr.h:3657
const irep_idt & base_method_name() const
The name of the method to which this expression is applied as would be seen in the source code.
Definition std_expr.h:3709
const irep_idt & mangled_method_name() const
The method name after mangling it by combining it with the descriptor.
Definition std_expr.h:3694
const irep_idt & get_identifier() const
A unique identifier of the combination of class and method overload to which this expression refers.
Definition std_expr.h:3717
class_method_descriptor_exprt(typet _type, irep_idt mangled_method_name, irep_idt class_id, irep_idt base_method_name)
Definition std_expr.h:3673
const irep_idt & class_id() const
Unique identifier in the symbol table, of the compile time type of the class which this expression is...
Definition std_expr.h:3702
Complex constructor from a pair of numbers.
Definition std_expr.h:1849
complex_exprt(exprt _real, exprt _imag, complex_typet _type)
Definition std_expr.h:1851
exprt real()
Definition std_expr.h:1860
exprt imag()
Definition std_expr.h:1870
const exprt & real() const
Definition std_expr.h:1865
const exprt & imag() const
Definition std_expr.h:1875
Imaginary part of the expression describing a complex number.
Definition std_expr.h:1947
complex_imag_exprt(const exprt &op)
Definition std_expr.h:1949
Real part of the expression describing a complex number.
Definition std_expr.h:1910
complex_real_exprt(const exprt &op)
Definition std_expr.h:1912
Complex numbers made of pair of given subtype.
Definition std_types.h:1133
this is a parametric version of an if-expression: it returns the value of the first case (using the o...
Definition std_expr.h:3393
void add_case(const exprt &condition, const exprt &value)
adds a case to a cond expression
Definition std_expr.h:3403
cond_exprt(operandst _operands, typet _type)
Definition std_expr.h:3395
exprt lower() const
Definition std_expr.cpp:458
A constant literal expression.
Definition std_expr.h:2997
static void validate(const exprt &expr, const namespacet &, const validation_modet vm=validation_modet::INVARIANT)
Definition std_expr.h:3039
const irep_idt & get_value() const
Definition std_expr.h:3005
bool operator!=(bool rhs) const
Return whether the expression lhs is not a constant of Boolean type or is not representing the Boolea...
Definition std_expr.cpp:47
bool value_is_zero_string() const
Definition std_expr.cpp:26
bool operator==(bool rhs) const
Return whether the expression lhs is a constant of Boolean type that is representing the Boolean valu...
Definition std_expr.cpp:42
constant_exprt(const irep_idt &_value, typet _type)
Definition std_expr.h:2999
void set_value(const irep_idt &value)
Definition std_expr.h:3010
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...
Definition std_expr.cpp:170
static void check(const exprt &expr, const validation_modet vm=validation_modet::INVARIANT)
Definition std_expr.cpp:210
Expression to hold a symbol (variable) with extra accessors to ID_c_static_lifetime and ID_C_thread_l...
Definition std_expr.h:243
decorated_symbol_exprt(const irep_idt &identifier, typet type)
Definition std_expr.h:247
bool is_static_lifetime() const
Definition std_expr.h:252
bool is_thread_local() const
Definition std_expr.h:267
Division.
Definition std_expr.h:1142
div_exprt(exprt _lhs, exprt _rhs)
Definition std_expr.h:1144
exprt & dividend()
The dividend of a division is the number that is being divided.
Definition std_expr.h:1150
const exprt & dividend() const
The dividend of a division is the number that is being divided.
Definition std_expr.h:1156
const exprt & divisor() const
The divisor of a division is the number the dividend is being divided by.
Definition std_expr.h:1168
exprt & divisor()
The divisor of a division is the number the dividend is being divided by.
Definition std_expr.h:1162
dstringt has one field, an unsigned integer no which is an index into a static table of strings.
Definition dstring.h:38
Union constructor to support unions without any member (a GCC/Clang feature).
Definition std_expr.h:1773
empty_union_exprt(typet _type)
Definition std_expr.h:1775
Equality.
Definition std_expr.h:1329
static void check(const exprt &expr, const validation_modet vm=validation_modet::INVARIANT)
Definition std_expr.h:1337
equal_exprt(exprt _lhs, exprt _rhs)
Definition std_expr.h:1331
static void validate(const exprt &expr, const namespacet &ns, const validation_modet vm=validation_modet::INVARIANT)
Definition std_expr.h:1344
Boute's Euclidean definition of Modulo – to match SMT-LIB2.
Definition std_expr.h:1267
exprt & divisor()
The divisor of a division is the number the dividend is being divided by.
Definition std_expr.h:1287
euclidean_mod_exprt(exprt _lhs, exprt _rhs)
Definition std_expr.h:1269
const exprt & divisor() const
The divisor of a division is the number the dividend is being divided by.
Definition std_expr.h:1293
exprt & dividend()
The dividend of a division is the number that is being divided.
Definition std_expr.h:1275
const exprt & dividend() const
The dividend of a division is the number that is being divided.
Definition std_expr.h:1281
Base class for all expressions.
Definition expr.h:350
exprt & op0()
Definition expr.h:134
exprt & op1()
Definition expr.h:137
exprt & op2()
Definition expr.h:140
Base class for all expressions.
Definition expr.h:57
std::vector< exprt > operandst
Definition expr.h:59
static void validate(const exprt &expr, const namespacet &, const validation_modet vm=validation_modet::INVARIANT)
Check that the expression is well-formed, assuming that its subexpressions and type have all ready be...
Definition expr.h:272
bool is_boolean() const
Return whether the expression represents a Boolean.
Definition expr.h:229
exprt & op0()
Definition expr.h:134
exprt & op1()
Definition expr.h:137
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
operandst & operands()
Definition expr.h:95
exprt & op2()
Definition expr.h:140
static void check(const exprt &, const validation_modet=validation_modet::INVARIANT)
Check that the expression is well-formed (shallow checks only, i.e., subexpressions and its type are ...
Definition expr.h:260
source_locationt & add_source_location()
Definition expr.h:241
void add_to_operands(const exprt &expr)
Add the given argument to the end of exprt's operands.
Definition expr.h:171
The Boolean constant false.
Definition std_expr.h:3125
Binary greater than operator expression.
Definition std_expr.h:833
greater_than_exprt(exprt _lhs, exprt _rhs)
Definition std_expr.h:835
Binary greater than or equal operator expression.
Definition std_expr.h:849
greater_than_or_equal_exprt(exprt _lhs, exprt _rhs)
Definition std_expr.h:851
The trinary if-then-else operator.
Definition std_expr.h:2416
const exprt & false_case() const
Definition std_expr.h:2458
exprt & cond()
Definition std_expr.h:2433
const exprt & cond() const
Definition std_expr.h:2438
if_exprt(exprt cond, const exprt &t, exprt f)
Definition std_expr.h:2418
const exprt & true_case() const
Definition std_expr.h:2448
exprt & false_case()
Definition std_expr.h:2453
if_exprt(exprt cond, exprt t, exprt f, typet type)
Definition std_expr.h:2423
exprt & true_case()
Definition std_expr.h:2443
static void check(const exprt &expr, const validation_modet vm=validation_modet::INVARIANT)
Definition std_expr.h:2463
static void validate(const exprt &expr, const namespacet &ns, const validation_modet vm=validation_modet::INVARIANT)
Definition std_expr.h:2470
Boolean implication.
Definition std_expr.h:2144
implies_exprt(exprt op0, exprt op1)
Definition std_expr.h:2146
const exprt & index() const
Definition std_expr.h:2586
index_designatort(exprt _index)
Definition std_expr.h:2581
exprt & index()
Definition std_expr.h:2591
Array index operator.
Definition std_expr.h:1421
exprt & index()
Definition std_expr.h:1461
index_exprt(exprt _array, exprt _index, typet _type)
Definition std_expr.h:1439
index_exprt(const exprt &_array, exprt _index)
Definition std_expr.h:1427
exprt & array()
Definition std_expr.h:1451
const exprt & index() const
Definition std_expr.h:1466
const exprt & array() const
Definition std_expr.h:1456
An expression denoting infinity.
Definition std_expr.h:3150
infinity_exprt(typet _type)
Definition std_expr.h:3152
bool get_bool(const irep_idt &name) const
Definition irep.cpp:57
std::size_t get_size_t(const irep_idt &name) const
Definition irep.cpp:67
const irep_idt & get(const irep_idt &name) const
Definition irep.cpp:44
void remove(const irep_idt &name)
Definition irep.cpp:87
void set(const irep_idt &name, const irep_idt &value)
Definition irep.h:412
void set_size_t(const irep_idt &name, const std::size_t value)
Definition irep.cpp:82
const irep_idt & id() const
Definition irep.h:388
Binary less than operator expression.
Definition std_expr.h:865
less_than_exprt(exprt _lhs, exprt _rhs)
Definition std_expr.h:867
Binary less than or equal operator expression.
Definition std_expr.h:881
less_than_or_equal_exprt(exprt _lhs, exprt _rhs)
Definition std_expr.h:883
A let expression.
Definition std_expr.h:3249
binding_exprt::variablest & variables()
convenience accessor for binding().variables()
Definition std_expr.h:3330
const binding_exprt & binding() const
Definition std_expr.h:3282
const binding_exprt::variablest & variables() const
convenience accessor for binding().variables()
Definition std_expr.h:3336
operandst & values()
Definition std_expr.h:3319
let_exprt(symbol_exprt symbol, exprt value, const exprt &where)
convenience constructor for the case of a single binding
Definition std_expr.h:3269
const exprt & where() const
convenience accessor for binding().where()
Definition std_expr.h:3348
static void validate(const exprt &, validation_modet)
Definition std_expr.cpp:362
const symbol_exprt & symbol() const
convenience accessor for the symbol of a single binding
Definition std_expr.h:3296
let_exprt(binding_exprt::variablest variables, operandst values, const exprt &where)
Definition std_expr.h:3251
exprt & value()
convenience accessor for the value of a single binding
Definition std_expr.h:3304
exprt & where()
convenience accessor for binding().where()
Definition std_expr.h:3342
binding_exprt & binding()
Definition std_expr.h:3277
const operandst & values() const
Definition std_expr.h:3324
const exprt & value() const
convenience accessor for the value of a single binding
Definition std_expr.h:3312
symbol_exprt & symbol()
convenience accessor for the symbol of a single binding
Definition std_expr.h:3288
irep_idt get_component_name() const
Definition std_expr.h:2633
member_designatort(const irep_idt &_component_name)
Definition std_expr.h:2627
Extract member of struct or union.
Definition std_expr.h:2856
const exprt & compound() const
Definition std_expr.h:2905
exprt & struct_op()
Definition std_expr.h:2900
const exprt & struct_op() const
Definition std_expr.h:2894
irep_idt get_component_name() const
Definition std_expr.h:2878
void set_component_name(const irep_idt &component_name)
Definition std_expr.h:2883
exprt & compound()
Definition std_expr.h:2910
static void validate(const exprt &expr, const namespacet &ns, const validation_modet vm=validation_modet::INVARIANT)
Check that the member expression has the right number of operands, refers to a component that exists ...
Definition std_expr.cpp:327
static void check(const exprt &expr, const validation_modet vm=validation_modet::INVARIANT)
Definition std_expr.h:2915
member_exprt(exprt op, const irep_idt &component_name, typet _type)
Definition std_expr.h:2858
std::size_t get_component_number() const
Definition std_expr.h:2888
member_exprt(exprt op, const struct_typet::componentt &c)
Definition std_expr.h:2868
Binary minus.
Definition std_expr.h:1055
minus_exprt(exprt _lhs, exprt _rhs)
Definition std_expr.h:1057
Modulo defined as lhs-(rhs * truncate(lhs/rhs)).
Definition std_expr.h:1206
exprt & dividend()
The dividend of a division is the number that is being divided.
Definition std_expr.h:1214
const exprt & dividend() const
The dividend of a division is the number that is being divided.
Definition std_expr.h:1220
exprt & divisor()
The divisor of a division is the number the dividend is being divided by.
Definition std_expr.h:1226
const exprt & divisor() const
The divisor of a division is the number the dividend is being divided by.
Definition std_expr.h:1232
mod_exprt(exprt _lhs, exprt _rhs)
Definition std_expr.h:1208
Binary multiplication Associativity is not specified.
Definition std_expr.h:1094
mult_exprt(exprt::operandst factors, typet type)
Definition std_expr.h:1106
mult_exprt(exprt _lhs, exprt _rhs)
Definition std_expr.h:1096
mult_exprt(exprt::operandst factors)
Definition std_expr.h:1101
A base class for multi-ary expressions Associativity is not specified.
Definition std_expr.h:898
exprt & op1()
Definition std_expr.h:932
const exprt & op0() const
Definition std_expr.h:950
multi_ary_exprt(exprt _lhs, const irep_idt &_id, exprt _rhs, typet _type)
Definition std_expr.h:919
const exprt & op2() const
Definition std_expr.h:962
const exprt & op3() const
Definition std_expr.h:968
exprt & op0()
Definition std_expr.h:926
exprt & op2()
Definition std_expr.h:938
multi_ary_exprt(const exprt &_lhs, const irep_idt &_id, exprt _rhs)
Definition std_expr.h:914
multi_ary_exprt(const irep_idt &_id, operandst _operands, typet _type)
Definition std_expr.h:900
const exprt & op1() const
Definition std_expr.h:956
multi_ary_exprt(const irep_idt &_id, operandst _operands)
Definition std_expr.h:906
exprt & op3()
Definition std_expr.h:944
Expression that introduces a new symbol that is equal to the operand.
Definition std_expr.h:3766
named_term_exprt(symbol_exprt symbol, exprt value)
Definition std_expr.h:3768
symbol_exprt & symbol()
Definition std_expr.h:3783
const exprt & value() const
Definition std_expr.h:3788
const symbol_exprt & symbol() const
Definition std_expr.h:3778
exprt & value()
Definition std_expr.h:3793
A namespacet is essentially one or two symbol tables bound together, to allow for symbol lookups in t...
Definition namespace.h:91
Boolean NAND.
Definition std_expr.h:2108
nand_exprt(exprt op0, exprt op1)
Definition std_expr.h:2110
nand_exprt(exprt::operandst _operands)
Definition std_expr.h:2115
The NIL expression.
Definition std_expr.h:3134
Expression to hold a nondeterministic choice.
Definition std_expr.h:285
void set_identifier(const irep_idt &identifier)
Definition std_expr.h:308
nondet_symbol_exprt(const irep_idt &identifier, typet type)
Definition std_expr.h:289
const irep_idt & get_identifier() const
Definition std_expr.h:313
nondet_symbol_exprt(irep_idt identifier, typet type, source_locationt location)
Definition std_expr.h:298
Boolean NOR.
Definition std_expr.h:2253
nor_exprt(exprt op0, exprt op1)
Definition std_expr.h:2255
nor_exprt(exprt::operandst _operands)
Definition std_expr.h:2260
Boolean negation.
Definition std_expr.h:2378
not_exprt(exprt _op)
Definition std_expr.h:2380
Disequality.
Definition std_expr.h:1383
notequal_exprt(exprt _lhs, exprt _rhs)
Definition std_expr.h:1385
An expression without operands.
Definition std_expr.h:23
exprt & op0()=delete
static void check(const exprt &expr, const validation_modet vm=validation_modet::INVARIANT)
Definition std_expr.h:30
static void validate(const exprt &expr, const namespacet &, const validation_modet vm=validation_modet::INVARIANT)
Definition std_expr.h:40
const exprt & op1() const =delete
nullary_exprt(const irep_idt &_id, typet _type)
Definition std_expr.h:25
const exprt & op0() const =delete
void copy_to_operands(const exprt &, const exprt &, const exprt &)=delete
exprt & op3()=delete
void copy_to_operands(const exprt &expr)=delete
operandst & operands()=delete
remove all operand methods
void copy_to_operands(const exprt &, const exprt &)=delete
const operandst & operands() const =delete
exprt & op1()=delete
exprt & op2()=delete
const exprt & op3() const =delete
const exprt & op2() const =delete
Boolean OR All operands must be boolean, and the result is always boolean.
Definition std_expr.h:2183
or_exprt(exprt op0, exprt op1, exprt op2)
Definition std_expr.h:2190
or_exprt(exprt::operandst _operands)
Definition std_expr.h:2206
or_exprt(exprt op0, exprt op1, exprt op2, exprt op3)
Definition std_expr.h:2198
or_exprt(exprt op0, exprt op1)
Definition std_expr.h:2185
The plus expression Associativity is not specified.
Definition std_expr.h:996
plus_exprt(exprt _lhs, exprt _rhs, typet _type)
Definition std_expr.h:1003
plus_exprt(exprt _lhs, exprt _rhs)
Definition std_expr.h:998
plus_exprt(operandst _operands, typet _type)
Definition std_expr.h:1017
plus_exprt(operandst _operands)
Definition std_expr.h:1012
A base class for expressions that are predicates, i.e., Boolean-typed.
Definition std_expr.h:547
predicate_exprt(const irep_idt &_id)
Definition std_expr.h:549
static void check(const exprt &expr, const validation_modet vm=validation_modet::INVARIANT)
Definition std_expr.h:554
Sign of an expression Predicate is true if _op is negative, false otherwise.
Definition std_expr.h:602
sign_exprt(exprt _op)
Definition std_expr.h:604
Struct constructor from list of elements.
Definition std_expr.h:1810
exprt & component(const irep_idt &name, const namespacet &ns)
Definition std_expr.cpp:308
struct_exprt(operandst _operands, typet _type)
Definition std_expr.h:1812
Expression to hold a symbol (variable)
Definition std_expr.h:132
void set_identifier(const irep_idt &identifier)
Definition std_expr.h:156
static symbol_exprt typeless(const irep_idt &id)
Generate a symbol_exprt without a proper type.
Definition std_expr.h:151
symbol_exprt & with_source_location(const exprt &other) &
Add the source location from other, if it has any.
Definition std_expr.h:183
symbol_exprt & with_source_location(source_locationt location) &
Add the source location from location, if it is non-nil.
Definition std_expr.h:167
symbol_exprt && with_source_location(source_locationt location) &&
Add the source location from location, if it is non-nil.
Definition std_expr.h:175
symbol_exprt && with_source_location(const exprt &other) &&
Add the source location from other, if it has any.
Definition std_expr.h:191
symbol_exprt(typet type)
Definition std_expr.h:135
symbol_exprt(const irep_idt &identifier, typet type)
Definition std_expr.h:141
const irep_idt & get_identifier() const
Definition std_expr.h:161
An expression with three operands.
Definition std_expr.h:68
static void validate(const exprt &expr, const namespacet &, const validation_modet vm=validation_modet::INVARIANT)
Definition std_expr.h:102
ternary_exprt(const irep_idt &_id, exprt _op0, exprt _op1, exprt _op2, typet _type)
Definition std_expr.h:71
const exprt & op3() const =delete
exprt & op0()
Definition expr.h:134
exprt & op1()
Definition expr.h:137
exprt & op2()
Definition expr.h:140
exprt & op3()=delete
static void check(const exprt &expr, const validation_modet vm=validation_modet::INVARIANT)
Definition std_expr.h:92
The Boolean constant true.
Definition std_expr.h:3116
An expression denoting a type.
Definition std_expr.h:2961
type_exprt(typet type)
Definition std_expr.h:2963
Semantic type conversion.
Definition std_expr.h:1985
static exprt conditional_cast(const exprt &expr, const typet &type)
Definition std_expr.h:1993
typecast_exprt(exprt op, typet _type)
Definition std_expr.h:1987
The type of an expression, extends irept.
Definition type.h:29
Generic base class for unary expressions.
Definition std_expr.h:354
unary_exprt(const irep_idt &_id, const exprt &_op)
Definition std_expr.h:356
const exprt & op3() const =delete
exprt & op2()=delete
static void check(const exprt &expr, const validation_modet vm=validation_modet::INVARIANT)
Definition std_expr.h:366
const exprt & op1() const =delete
exprt & op3()=delete
const exprt & op() const
Definition std_expr.h:384
unary_exprt(const irep_idt &_id, exprt _op, typet _type)
Definition std_expr.h:361
const exprt & op2() const =delete
exprt & op()
Definition std_expr.h:389
static void validate(const exprt &expr, const namespacet &, const validation_modet vm=validation_modet::INVARIANT)
Definition std_expr.h:376
exprt & op1()=delete
The unary minus expression.
Definition std_expr.h:467
unary_minus_exprt(exprt _op)
Definition std_expr.h:474
unary_minus_exprt(exprt _op, typet _type)
Definition std_expr.h:469
The unary plus expression.
Definition std_expr.h:509
unary_plus_exprt(exprt op)
Definition std_expr.h:511
A base class for expressions that are predicates, i.e., Boolean-typed, and that take exactly one argu...
Definition std_expr.h:564
static void check(const exprt &expr, const validation_modet vm=validation_modet::INVARIANT)
Definition std_expr.h:571
unary_predicate_exprt(const irep_idt &_id, exprt _op)
Definition std_expr.h:566
Union constructor from single element.
Definition std_expr.h:1714
std::size_t get_component_number() const
Definition std_expr.h:1732
void set_component_number(std::size_t component_number)
Definition std_expr.h:1737
void set_component_name(const irep_idt &component_name)
Definition std_expr.h:1727
irep_idt get_component_name() const
Definition std_expr.h:1722
union_exprt(const irep_idt &_component_name, exprt _value, typet _type)
Definition std_expr.h:1716
Operator to update elements in structs and arrays.
Definition std_expr.h:2669
exprt & old()
Definition std_expr.h:2681
with_exprt make_with_expr() const
converts an update expr into a (possibly nested) with expression
Definition std_expr.cpp:388
exprt::operandst & designator()
Definition std_expr.h:2695
exprt & new_value()
Definition std_expr.h:2705
static void validate(const exprt &expr, const namespacet &ns, const validation_modet vm=validation_modet::INVARIANT)
Definition std_expr.h:2725
const exprt & new_value() const
Definition std_expr.h:2710
update_exprt(const exprt &_old, exprt _designator, exprt _new_value)
Definition std_expr.h:2671
static void check(const exprt &expr, const validation_modet vm=validation_modet::INVARIANT)
Definition std_expr.h:2718
const exprt & old() const
Definition std_expr.h:2686
const exprt::operandst & designator() const
Definition std_expr.h:2700
Vector constructor from list of elements.
Definition std_expr.h:1676
vector_exprt(operandst _operands, vector_typet _type)
Definition std_expr.h:1678
The vector type.
Definition std_types.h:1064
Operator to update elements in structs and arrays.
Definition std_expr.h:2510
const exprt & old() const
Definition std_expr.h:2525
const exprt & where() const
Definition std_expr.h:2535
exprt & new_value()
Definition std_expr.h:2540
exprt & where()
Definition std_expr.h:2530
with_exprt(const exprt &_old, exprt _where, exprt _new_value)
Definition std_expr.h:2512
const exprt & new_value() const
Definition std_expr.h:2545
exprt & old()
Definition std_expr.h:2520
Boolean XNOR.
Definition std_expr.h:2336
xnor_exprt(exprt::operandst _operands)
Definition std_expr.h:2343
xnor_exprt(exprt _op0, exprt _op1)
Definition std_expr.h:2338
Boolean XOR All operands must be boolean, and the result is always boolean.
Definition std_expr.h:2290
xor_exprt(exprt _op0, exprt _op1)
Definition std_expr.h:2292
xor_exprt(exprt::operandst _operands)
Definition std_expr.h:2297
#define SINCE(year, month, day, msg)
Definition deprecate.h:26
#define DEPRECATED(msg)
Definition deprecate.h:23
Templated functions to cast to specific exprt-derived classes.
void validate_operands(const exprt &value, exprt::operandst::size_type number, const char *message, bool allow_more=false)
Definition expr_cast.h:250
const irept & get_nil_irep()
Definition irep.cpp:19
dstring_hash irep_id_hash
Definition irep.h:38
const std::string & id2string(const irep_idt &d)
Definition irep.h:44
STL namespace.
#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
bool can_cast_expr< equal_exprt >(const exprt &base)
Definition std_expr.h:1354
bool can_cast_expr< notequal_exprt >(const exprt &base)
Definition std_expr.h:1392
bool can_cast_expr< complex_exprt >(const exprt &base)
Definition std_expr.h:1882
bool can_cast_expr< not_exprt >(const exprt &base)
Definition std_expr.h:2387
const struct_exprt & to_struct_expr(const exprt &expr)
Cast an exprt to a struct_exprt.
Definition std_expr.h:1833
const array_list_exprt & to_array_list_expr(const exprt &expr)
Definition std_expr.h:1660
bool can_cast_expr< typecast_exprt >(const exprt &base)
Definition std_expr.h:2003
bool operator==(const exprt &lhs, bool rhs)
Return whether the expression lhs is a constant of Boolean type that is representing the Boolean valu...
Definition std_expr.cpp:32
const type_exprt & to_type_expr(const exprt &expr)
Cast an exprt to an type_exprt.
Definition std_expr.h:2980
const array_of_exprt & to_array_of_expr(const exprt &expr)
Cast an exprt to an array_of_exprt.
Definition std_expr.h:1542
bool can_cast_expr< struct_exprt >(const exprt &base)
Definition std_expr.h:1822
const binary_relation_exprt & to_binary_relation_expr(const exprt &expr)
Cast an exprt to a binary_relation_exprt.
Definition std_expr.h:818
const unary_plus_exprt & to_unary_plus_expr(const exprt &expr)
Cast an exprt to a unary_plus_exprt.
Definition std_expr.h:529
bool can_cast_expr< xor_exprt >(const exprt &base)
Definition std_expr.h:2304
const index_exprt & to_index_expr(const exprt &expr)
Cast an exprt to an index_exprt.
Definition std_expr.h:1484
bool can_cast_expr< mult_exprt >(const exprt &base)
Definition std_expr.h:1113
bool can_cast_expr< if_exprt >(const exprt &base)
Definition std_expr.h:2480
const binary_predicate_exprt & to_binary_predicate_expr(const exprt &expr)
Cast an exprt to a binary_predicate_exprt.
Definition std_expr.h:758
const class_method_descriptor_exprt & to_class_method_descriptor_expr(const exprt &expr)
Cast an exprt to a class_method_descriptor_exprt.
Definition std_expr.h:3747
bool can_cast_expr< named_term_exprt >(const exprt &base)
Definition std_expr.h:3800
bool can_cast_expr< binding_exprt >(const exprt &base)
Definition std_expr.h:3211
const mod_exprt & to_mod_expr(const exprt &expr)
Cast an exprt to a mod_exprt.
Definition std_expr.h:1250
const mult_exprt & to_mult_expr(const exprt &expr)
Cast an exprt to a mult_exprt.
Definition std_expr.h:1124
const and_exprt & to_and_expr(const exprt &expr)
Cast an exprt to a and_exprt.
Definition std_expr.h:2085
bool can_cast_expr< member_designatort >(const exprt &base)
Definition std_expr.h:2640
const array_comprehension_exprt & to_array_comprehension_expr(const exprt &expr)
Cast an exprt to a array_comprehension_exprt.
Definition std_expr.h:3638
const ternary_exprt & to_ternary_expr(const exprt &expr)
Cast an exprt to a ternary_exprt.
Definition std_expr.h:117
const named_term_exprt & to_named_term_expr(const exprt &expr)
Cast an exprt to a named_term_exprt.
Definition std_expr.h:3811
const xnor_exprt & to_xnor_expr(const exprt &expr)
Cast an exprt to a xnor_exprt.
Definition std_expr.h:2361
bool can_cast_expr< xnor_exprt >(const exprt &base)
Definition std_expr.h:2350
bool can_cast_expr< array_comprehension_exprt >(const exprt &base)
Definition std_expr.h:3626
const xor_exprt & to_xor_expr(const exprt &expr)
Cast an exprt to a xor_exprt.
Definition std_expr.h:2315
const or_exprt & to_or_expr(const exprt &expr)
Cast an exprt to a or_exprt.
Definition std_expr.h:2230
const array_exprt & to_array_expr(const exprt &expr)
Cast an exprt to an array_exprt.
Definition std_expr.h:1604
bool can_cast_expr< complex_imag_exprt >(const exprt &base)
Definition std_expr.h:1956
bool can_cast_expr< abs_exprt >(const exprt &base)
Definition std_expr.h:438
bool can_cast_expr< sign_exprt >(const exprt &base)
Definition std_expr.h:611
const unary_predicate_exprt & to_unary_predicate_expr(const exprt &expr)
Cast an exprt to a unary_predicate_exprt.
Definition std_expr.h:586
const cond_exprt & to_cond_expr(const exprt &expr)
Cast an exprt to a cond_exprt.
Definition std_expr.h:3433
bool can_cast_expr< type_exprt >(const exprt &base)
Definition std_expr.h:2969
exprt disjunction(const exprt::operandst &)
1) generates a disjunction for two or more operands 2) for one operand, returns the operand 3) return...
Definition std_expr.cpp:240
bool can_cast_expr< class_method_descriptor_exprt >(const exprt &base)
Definition std_expr.h:3755
const typecast_exprt & to_typecast_expr(const exprt &expr)
Cast an exprt to a typecast_exprt.
Definition std_expr.h:2014
const div_exprt & to_div_expr(const exprt &expr)
Cast an exprt to a div_exprt.
Definition std_expr.h:1186
bool can_cast_expr< unary_minus_exprt >(const exprt &base)
Definition std_expr.h:481
bool can_cast_expr< less_than_exprt >(const exprt &base)
Definition std_expr.h:874
bool can_cast_expr< with_exprt >(const exprt &base)
Definition std_expr.h:2552
const vector_exprt & to_vector_expr(const exprt &expr)
Cast an exprt to an vector_exprt.
Definition std_expr.h:1696
exprt conjunction(const exprt::operandst &)
1) generates a conjunction for two or more operands 2) for one operand, returns the operand 3) return...
Definition std_expr.cpp:275
bool can_cast_expr< minus_exprt >(const exprt &base)
Definition std_expr.h:1064
bool can_cast_expr< let_exprt >(const exprt &base)
Definition std_expr.h:3357
const binary_exprt & to_binary_expr(const exprt &expr)
Cast an exprt to a binary_exprt.
Definition std_expr.h:711
const plus_exprt & to_plus_expr(const exprt &expr)
Cast an exprt to a plus_exprt.
Definition std_expr.h:1035
const notequal_exprt & to_notequal_expr(const exprt &expr)
Cast an exprt to an notequal_exprt.
Definition std_expr.h:1403
bool can_cast_expr< plus_exprt >(const exprt &base)
Definition std_expr.h:1024
const nand_exprt & to_nand_expr(const exprt &expr)
Cast an exprt to a nand_exprt.
Definition std_expr.h:2127
const unary_exprt & to_unary_expr(const exprt &expr)
Cast an exprt to a unary_exprt.
Definition std_expr.h:414
const multi_ary_exprt & to_multi_ary_expr(const exprt &expr)
Cast an exprt to a multi_ary_exprt.
Definition std_expr.h:981
bool can_cast_expr< array_of_exprt >(const exprt &base)
Definition std_expr.h:1531
const let_exprt & to_let_expr(const exprt &expr)
Cast an exprt to a let_exprt.
Definition std_expr.h:3373
const abs_exprt & to_abs_expr(const exprt &expr)
Cast an exprt to a abs_exprt.
Definition std_expr.h:449
bool can_cast_expr< nondet_symbol_exprt >(const exprt &base)
Definition std_expr.h:320
bool can_cast_expr< case_exprt >(const exprt &base)
Definition std_expr.h:3541
bool can_cast_expr< constant_exprt >(const exprt &base)
Definition std_expr.h:3052
const if_exprt & to_if_expr(const exprt &expr)
Cast an exprt to an if_exprt.
Definition std_expr.h:2491
const member_exprt & to_member_expr(const exprt &expr)
Cast an exprt to a member_exprt.
Definition std_expr.h:2943
void validate_expr(const nondet_symbol_exprt &value)
Definition std_expr.h:325
bool can_cast_expr< index_exprt >(const exprt &base)
Definition std_expr.h:1473
bool can_cast_expr< symbol_exprt >(const exprt &base)
Definition std_expr.h:200
const empty_union_exprt & to_empty_union_expr(const exprt &expr)
Cast an exprt to an empty_union_exprt.
Definition std_expr.h:1793
const minus_exprt & to_minus_expr(const exprt &expr)
Cast an exprt to a minus_exprt.
Definition std_expr.h:1075
bool can_cast_expr< member_exprt >(const exprt &base)
Definition std_expr.h:2932
bool can_cast_expr< empty_union_exprt >(const exprt &base)
Definition std_expr.h:1782
const complex_imag_exprt & to_complex_imag_expr(const exprt &expr)
Cast an exprt to a complex_imag_exprt.
Definition std_expr.h:1967
const binding_exprt & to_binding_expr(const exprt &expr)
Cast an exprt to a binding_exprt.
Definition std_expr.h:3223
bool can_cast_expr< or_exprt >(const exprt &base)
Definition std_expr.h:2219
bool can_cast_expr< mod_exprt >(const exprt &base)
Definition std_expr.h:1239
const index_designatort & to_index_designator(const exprt &expr)
Cast an exprt to an index_designatort.
Definition std_expr.h:2609
const union_exprt & to_union_expr(const exprt &expr)
Cast an exprt to a union_exprt.
Definition std_expr.h:1755
bool can_cast_expr< cond_exprt >(const exprt &base)
Definition std_expr.h:3416
const complex_real_exprt & to_complex_real_expr(const exprt &expr)
Cast an exprt to a complex_real_exprt.
Definition std_expr.h:1930
bool can_cast_expr< update_exprt >(const exprt &base)
Definition std_expr.h:2735
bool can_cast_expr< binary_relation_exprt >(const exprt &base)
Definition std_expr.h:807
bool can_cast_expr< euclidean_mod_exprt >(const exprt &base)
Definition std_expr.h:1300
bool can_cast_expr< vector_exprt >(const exprt &base)
Definition std_expr.h:1685
const case_exprt & to_case_expr(const exprt &expr)
Cast an exprt to a case_exprt.
Definition std_expr.h:3552
const constant_exprt & to_constant_expr(const exprt &expr)
Cast an exprt to a constant_exprt.
Definition std_expr.h:3068
bool can_cast_expr< array_list_exprt >(const exprt &base)
Definition std_expr.h:1655
bool can_cast_expr< index_designatort >(const exprt &base)
Definition std_expr.h:2598
const not_exprt & to_not_expr(const exprt &expr)
Cast an exprt to an not_exprt.
Definition std_expr.h:2398
const symbol_exprt & to_symbol_expr(const exprt &expr)
Cast an exprt to a symbol_exprt.
Definition std_expr.h:211
const with_exprt & to_with_expr(const exprt &expr)
Cast an exprt to a with_exprt.
Definition std_expr.h:2563
const complex_exprt & to_complex_expr(const exprt &expr)
Cast an exprt to a complex_exprt.
Definition std_expr.h:1893
bool can_cast_expr< unary_plus_exprt >(const exprt &base)
Definition std_expr.h:518
bool can_cast_expr< and_exprt >(const exprt &base)
Definition std_expr.h:2074
bool can_cast_expr< greater_than_exprt >(const exprt &base)
Definition std_expr.h:842
const implies_exprt & to_implies_expr(const exprt &expr)
Cast an exprt to a implies_exprt.
Definition std_expr.h:2164
bool can_cast_expr< array_exprt >(const exprt &base)
Definition std_expr.h:1593
bool can_cast_expr< binary_exprt >(const exprt &base)
Definition std_expr.h:700
bool can_cast_expr< div_exprt >(const exprt &base)
Definition std_expr.h:1175
const update_exprt & to_update_expr(const exprt &expr)
Cast an exprt to an update_exprt.
Definition std_expr.h:2752
bool can_cast_expr< nil_exprt >(const exprt &base)
Definition std_expr.h:3143
const unary_minus_exprt & to_unary_minus_expr(const exprt &expr)
Cast an exprt to a unary_minus_exprt.
Definition std_expr.h:492
const equal_exprt & to_equal_expr(const exprt &expr)
Cast an exprt to an equal_exprt.
Definition std_expr.h:1365
bool operator!=(const exprt &lhs, bool rhs)
Return whether the expression lhs is not a constant of Boolean type or is not representing the Boolea...
Definition std_expr.cpp:37
bool can_cast_expr< greater_than_or_equal_exprt >(const exprt &base)
Definition std_expr.h:858
bool can_cast_expr< implies_exprt >(const exprt &base)
Definition std_expr.h:2153
bool can_cast_expr< unary_exprt >(const exprt &base)
Definition std_expr.h:403
bool can_cast_expr< less_than_or_equal_exprt >(const exprt &base)
Definition std_expr.h:890
const nondet_symbol_exprt & to_nondet_symbol_expr(const exprt &expr)
Cast an exprt to a nondet_symbol_exprt.
Definition std_expr.h:336
bool can_cast_expr< union_exprt >(const exprt &base)
Definition std_expr.h:1744
const member_designatort & to_member_designator(const exprt &expr)
Cast an exprt to an member_designatort.
Definition std_expr.h:2651
bool can_cast_expr< complex_real_exprt >(const exprt &base)
Definition std_expr.h:1919
const sign_exprt & to_sign_expr(const exprt &expr)
Cast an exprt to a sign_exprt.
Definition std_expr.h:622
const nor_exprt & to_nor_expr(const exprt &expr)
Cast an exprt to a nor_exprt.
Definition std_expr.h:2272
const euclidean_mod_exprt & to_euclidean_mod_expr(const exprt &expr)
Cast an exprt to a euclidean_mod_exprt.
Definition std_expr.h:1311
Pre-defined types.
const complex_typet & to_complex_type(const typet &type)
Cast a typet to a complex_typet.
Definition std_types.h:1158
size_t operator()(const ::symbol_exprt &sym)
Definition std_expr.h:233
const type_with_subtypet & to_type_with_subtype(const typet &type)
Definition type.h:208
#define DATA_CHECK(vm, condition, message)
This macro takes a condition which denotes a well-formedness criterion on goto programs,...
Definition validate.h:22
validation_modet