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
143 {
144 this->identifier(identifier);
145 }
146
150 {
151 return symbol_exprt{id, typet{}};
152 }
153
154 DEPRECATED(SINCE(2026, 1, 18, "use identifier(...) instead"))
156 {
157 this->identifier(identifier);
158 }
159
161 {
163 }
164
165 DEPRECATED(SINCE(2026, 1, 18, "use identifier() instead"))
167 {
168 return identifier();
169 }
170
171 const irep_idt &identifier() const
172 {
173 return get(ID_identifier);
174 }
175
178 {
179 if(location.is_not_nil())
180 add_source_location() = std::move(location);
181 return *this;
182 }
183
186 {
187 if(location.is_not_nil())
188 add_source_location() = std::move(location);
189 return std::move(*this);
190 }
191
194 {
195 if(other.source_location().is_not_nil())
196 add_source_location() = other.source_location();
197 return *this;
198 }
199
202 {
203 if(other.source_location().is_not_nil())
204 add_source_location() = other.source_location();
205 return std::move(*this);
206 }
207};
208
209template <>
210inline bool can_cast_expr<symbol_exprt>(const exprt &base)
211{
212 return base.id() == ID_symbol;
213}
214
221inline const symbol_exprt &to_symbol_expr(const exprt &expr)
222{
223 PRECONDITION(expr.id() == ID_symbol);
225 return static_cast<const symbol_exprt &>(expr);
226}
227
230{
231 PRECONDITION(expr.id() == ID_symbol);
233 return static_cast<symbol_exprt &>(expr);
234}
235
236// NOLINTNEXTLINE(readability/namespace)
237namespace std
238{
239template <>
240// NOLINTNEXTLINE(readability/identifiers)
241struct hash<::symbol_exprt>
242{
243 size_t operator()(const ::symbol_exprt &sym)
244 {
245 return irep_id_hash()(sym.identifier());
246 }
247};
248} // namespace std
249
253{
254public:
261
263 {
265 }
266
268 {
269 return set(ID_C_static_lifetime, true);
270 }
271
276
277 bool is_thread_local() const
278 {
280 }
281
283 {
284 return set(ID_C_thread_local, true);
285 }
286
291};
292
295{
296public:
301 {
302 set_identifier(identifier);
303 }
304
309 irep_idt identifier,
310 typet type,
311 source_locationt location)
313 {
314 set_identifier(std::move(identifier));
315 add_source_location() = std::move(location);
316 }
317
318 void set_identifier(const irep_idt &identifier)
319 {
320 set(ID_identifier, identifier);
321 }
322
324 {
325 return get(ID_identifier);
326 }
327};
328
329template <>
331{
332 return base.id() == ID_nondet_symbol;
333}
334
335inline void validate_expr(const nondet_symbol_exprt &value)
336{
337 validate_operands(value, 0, "Symbols must not have operands");
338}
339
347{
350 return static_cast<const nondet_symbol_exprt &>(expr);
351}
352
355{
356 PRECONDITION(expr.id()==ID_symbol);
358 return static_cast<nondet_symbol_exprt &>(expr);
359}
360
361
364{
365public:
368 {
369 }
370
372 : expr_protectedt(_id, std::move(_type), {std::move(_op)})
373 {
374 }
375
376 static void check(
377 const exprt &expr,
379 {
381 vm,
382 expr.operands().size() == 1,
383 "unary expression must have one operand");
384 }
385
386 static void validate(
387 const exprt &expr,
388 const namespacet &,
390 {
391 check(expr, vm);
392 }
393
394 const exprt &op() const
395 {
396 return op0();
397 }
398
400 {
401 return op0();
402 }
403
404 const exprt &op1() const = delete;
405 exprt &op1() = delete;
406 const exprt &op2() const = delete;
407 exprt &op2() = delete;
408 const exprt &op3() const = delete;
409 exprt &op3() = delete;
410};
411
412template <>
413inline bool can_cast_expr<unary_exprt>(const exprt &base)
414{
415 return base.operands().size() == 1;
416}
417
424inline const unary_exprt &to_unary_expr(const exprt &expr)
425{
426 unary_exprt::check(expr);
427 return static_cast<const unary_exprt &>(expr);
428}
429
432{
433 unary_exprt::check(expr);
434 return static_cast<unary_exprt &>(expr);
435}
436
437
440{
441public:
443 {
444 }
445};
446
447template <>
448inline bool can_cast_expr<abs_exprt>(const exprt &base)
449{
450 return base.id() == ID_abs;
451}
452
459inline const abs_exprt &to_abs_expr(const exprt &expr)
460{
461 PRECONDITION(expr.id()==ID_abs);
462 abs_exprt::check(expr);
463 return static_cast<const abs_exprt &>(expr);
464}
465
468{
469 PRECONDITION(expr.id()==ID_abs);
470 abs_exprt::check(expr);
471 return static_cast<abs_exprt &>(expr);
472}
473
474
477{
478public:
480 : unary_exprt(ID_unary_minus, std::move(_op), std::move(_type))
481 {
482 }
483
486 {
487 }
488};
489
490template <>
492{
493 return base.id() == ID_unary_minus;
494}
495
503{
506 return static_cast<const unary_minus_exprt &>(expr);
507}
508
511{
514 return static_cast<unary_minus_exprt &>(expr);
515}
516
519{
520public:
523 {
524 }
525};
526
527template <>
529{
530 return base.id() == ID_unary_plus;
531}
532
539inline const unary_plus_exprt &to_unary_plus_expr(const exprt &expr)
540{
541 PRECONDITION(expr.id() == ID_unary_plus);
543 return static_cast<const unary_plus_exprt &>(expr);
544}
545
548{
549 PRECONDITION(expr.id() == ID_unary_plus);
551 return static_cast<unary_plus_exprt &>(expr);
552}
553
557{
558public:
559 explicit predicate_exprt(const irep_idt &_id)
561 {
562 }
563
564 static void check(
565 const exprt &expr,
567 {
568 }
569};
570
574{
575public:
577 : unary_exprt(_id, std::move(_op), bool_typet())
578 {
579 }
580
581 static void check(
582 const exprt &expr,
584 {
585 unary_exprt::check(expr);
587 }
588};
589
597{
599 return static_cast<const unary_predicate_exprt &>(expr);
600}
601
604{
606 return static_cast<unary_predicate_exprt &>(expr);
607}
608
612{
613public:
616 {
617 }
618};
619
620template <>
621inline bool can_cast_expr<sign_exprt>(const exprt &base)
622{
623 return base.id() == ID_sign;
624}
625
632inline const sign_exprt &to_sign_expr(const exprt &expr)
633{
634 PRECONDITION(expr.id() == ID_sign);
635 sign_exprt::check(expr);
636 return static_cast<const sign_exprt &>(expr);
637}
638
641{
642 PRECONDITION(expr.id() == ID_sign);
643 sign_exprt::check(expr);
644 return static_cast<sign_exprt &>(expr);
645}
646
649{
650public:
652 : expr_protectedt(_id, _lhs.type(), {_lhs, std::move(_rhs)})
653 {
654 }
655
657 : expr_protectedt(_id, std::move(_type), {std::move(_lhs), std::move(_rhs)})
658 {
659 }
660
661 static void check(
662 const exprt &expr,
664 {
666 vm,
667 expr.operands().size() == 2,
668 "binary expression must have two operands");
669 }
670
671 static void validate(
672 const exprt &expr,
673 const namespacet &,
675 {
676 check(expr, vm);
677 }
678
680 {
681 return exprt::op0();
682 }
683
684 const exprt &lhs() const
685 {
686 return exprt::op0();
687 }
688
690 {
691 return exprt::op1();
692 }
693
694 const exprt &rhs() const
695 {
696 return exprt::op1();
697 }
698
699 // make op0 and op1 public
700 using exprt::op0;
701 using exprt::op1;
702
703 const exprt &op2() const = delete;
704 exprt &op2() = delete;
705 const exprt &op3() const = delete;
706 exprt &op3() = delete;
707};
708
709template <>
710inline bool can_cast_expr<binary_exprt>(const exprt &base)
711{
712 return base.operands().size() == 2;
713}
714
721inline const binary_exprt &to_binary_expr(const exprt &expr)
722{
724 return static_cast<const binary_exprt &>(expr);
725}
726
729{
731 return static_cast<binary_exprt &>(expr);
732}
733
737{
738public:
740 : binary_exprt(std::move(_op0), _id, std::move(_op1), bool_typet())
741 {
742 }
743
744 static void check(
745 const exprt &expr,
747 {
748 binary_exprt::check(expr, vm);
749 predicate_exprt::check(expr, vm);
750 }
751
752 static void validate(
753 const exprt &expr,
754 const namespacet &ns,
756 {
757 binary_exprt::validate(expr, ns, vm);
758 predicate_exprt::validate(expr, ns, vm);
759 }
760};
761
769{
771 return static_cast<const binary_predicate_exprt &>(expr);
772}
773
776{
778 return static_cast<binary_predicate_exprt &>(expr);
779}
780
784{
785public:
790
791 static void check(
792 const exprt &expr,
794 {
796 }
797
798 static void validate(
799 const exprt &expr,
800 const namespacet &ns,
802 {
804
805 // we now can safely assume that 'expr' is a binary predicate
806 const auto &expr_binary = static_cast<const binary_predicate_exprt &>(expr);
807
808 // check that the types of the operands are the same
810 vm,
811 expr_binary.op0().type() == expr_binary.op1().type(),
812 "lhs and rhs of binary relation expression should have same type");
813 }
814};
815
816template <>
818{
819 return can_cast_expr<binary_exprt>(base);
820}
821
829{
831 return static_cast<const binary_relation_exprt &>(expr);
832}
833
836{
838 return static_cast<binary_relation_exprt &>(expr);
839}
840
843{
844public:
849};
850
851template <>
853{
854 return base.id() == ID_gt;
855}
856
866
867template <>
869{
870 return base.id() == ID_ge;
871}
872
875{
876public:
881};
882
883template <>
884inline bool can_cast_expr<less_than_exprt>(const exprt &base)
885{
886 return base.id() == ID_lt;
887}
888
898
899template <>
901{
902 return base.id() == ID_le;
903}
904
908{
909public:
911 : expr_protectedt(_id, std::move(_type))
912 {
913 operands() = std::move(_operands);
914 }
915
918 {
919 PRECONDITION(!_operands.empty());
920 type() = _operands.front().type();
921 operands() = std::move(_operands);
922 }
923
925 : expr_protectedt(_id, _lhs.type(), {_lhs, std::move(_rhs)})
926 {
927 }
928
930 : expr_protectedt(_id, std::move(_type), {std::move(_lhs), std::move(_rhs)})
931 {
932 }
933
934 // In contrast to exprt::opX, the methods
935 // below check the size.
937 {
938 PRECONDITION(operands().size() >= 1);
939 return operands().front();
940 }
941
943 {
944 PRECONDITION(operands().size() >= 2);
945 return operands()[1];
946 }
947
949 {
950 PRECONDITION(operands().size() >= 3);
951 return operands()[2];
952 }
953
955 {
956 PRECONDITION(operands().size() >= 4);
957 return operands()[3];
958 }
959
960 const exprt &op0() const
961 {
962 PRECONDITION(operands().size() >= 1);
963 return operands().front();
964 }
965
966 const exprt &op1() const
967 {
968 PRECONDITION(operands().size() >= 2);
969 return operands()[1];
970 }
971
972 const exprt &op2() const
973 {
974 PRECONDITION(operands().size() >= 3);
975 return operands()[2];
976 }
977
978 const exprt &op3() const
979 {
980 PRECONDITION(operands().size() >= 4);
981 return operands()[3];
982 }
983};
984
991inline const multi_ary_exprt &to_multi_ary_expr(const exprt &expr)
992{
993 return static_cast<const multi_ary_exprt &>(expr);
994}
995
998{
999 return static_cast<multi_ary_exprt &>(expr);
1000}
1001
1002
1006{
1007public:
1009 : multi_ary_exprt(std::move(_lhs), ID_plus, std::move(_rhs))
1010 {
1011 }
1012
1015 std::move(_lhs),
1016 ID_plus,
1017 std::move(_rhs),
1018 std::move(_type))
1019 {
1020 }
1021
1024 {
1025 }
1026
1028 : multi_ary_exprt(ID_plus, std::move(_operands), std::move(_type))
1029 {
1030 }
1031};
1032
1033template <>
1034inline bool can_cast_expr<plus_exprt>(const exprt &base)
1035{
1036 return base.id() == ID_plus;
1037}
1038
1045inline const plus_exprt &to_plus_expr(const exprt &expr)
1046{
1047 PRECONDITION(expr.id()==ID_plus);
1048 const plus_exprt &ret = static_cast<const plus_exprt &>(expr);
1050 return ret;
1051}
1052
1055{
1056 PRECONDITION(expr.id()==ID_plus);
1057 plus_exprt &ret = static_cast<plus_exprt &>(expr);
1059 return ret;
1060}
1061
1062
1065{
1066public:
1068 : binary_exprt(std::move(_lhs), ID_minus, std::move(_rhs))
1069 {
1070 }
1071};
1072
1073template <>
1074inline bool can_cast_expr<minus_exprt>(const exprt &base)
1075{
1076 return base.id() == ID_minus;
1077}
1078
1085inline const minus_exprt &to_minus_expr(const exprt &expr)
1086{
1087 PRECONDITION(expr.id()==ID_minus);
1088 minus_exprt::check(expr);
1089 return static_cast<const minus_exprt &>(expr);
1090}
1091
1094{
1095 PRECONDITION(expr.id()==ID_minus);
1096 minus_exprt::check(expr);
1097 return static_cast<minus_exprt &>(expr);
1098}
1099
1100
1104{
1105public:
1107 : multi_ary_exprt(std::move(_lhs), ID_mult, std::move(_rhs))
1108 {
1109 }
1110
1113 {
1114 }
1115
1120};
1121
1122template <>
1123inline bool can_cast_expr<mult_exprt>(const exprt &base)
1124{
1125 return base.id() == ID_mult;
1126}
1127
1134inline const mult_exprt &to_mult_expr(const exprt &expr)
1135{
1136 PRECONDITION(expr.id()==ID_mult);
1137 mult_exprt::check(expr);
1138 return static_cast<const mult_exprt &>(expr);
1139}
1140
1143{
1144 PRECONDITION(expr.id()==ID_mult);
1145 mult_exprt::check(expr);
1146 return static_cast<mult_exprt &>(expr);
1147}
1148
1149
1152{
1153public:
1155 : binary_exprt(std::move(_lhs), ID_div, std::move(_rhs))
1156 {
1157 }
1158
1161 {
1162 return op0();
1163 }
1164
1166 const exprt &dividend() const
1167 {
1168 return op0();
1169 }
1170
1173 {
1174 return op1();
1175 }
1176
1178 const exprt &divisor() const
1179 {
1180 return op1();
1181 }
1182};
1183
1184template <>
1185inline bool can_cast_expr<div_exprt>(const exprt &base)
1186{
1187 return base.id() == ID_div;
1188}
1189
1196inline const div_exprt &to_div_expr(const exprt &expr)
1197{
1198 PRECONDITION(expr.id()==ID_div);
1199 div_exprt::check(expr);
1200 return static_cast<const div_exprt &>(expr);
1201}
1202
1205{
1206 PRECONDITION(expr.id()==ID_div);
1207 div_exprt::check(expr);
1208 return static_cast<div_exprt &>(expr);
1209}
1210
1216{
1217public:
1219 : binary_exprt(std::move(_lhs), ID_mod, std::move(_rhs))
1220 {
1221 }
1222
1225 {
1226 return op0();
1227 }
1228
1230 const exprt &dividend() const
1231 {
1232 return op0();
1233 }
1234
1237 {
1238 return op1();
1239 }
1240
1242 const exprt &divisor() const
1243 {
1244 return op1();
1245 }
1246};
1247
1248template <>
1249inline bool can_cast_expr<mod_exprt>(const exprt &base)
1250{
1251 return base.id() == ID_mod;
1252}
1253
1260inline const mod_exprt &to_mod_expr(const exprt &expr)
1261{
1262 PRECONDITION(expr.id()==ID_mod);
1263 mod_exprt::check(expr);
1264 return static_cast<const mod_exprt &>(expr);
1265}
1266
1269{
1270 PRECONDITION(expr.id()==ID_mod);
1271 mod_exprt::check(expr);
1272 return static_cast<mod_exprt &>(expr);
1273}
1274
1277{
1278public:
1283
1286 {
1287 return op0();
1288 }
1289
1291 const exprt &dividend() const
1292 {
1293 return op0();
1294 }
1295
1298 {
1299 return op1();
1300 }
1301
1303 const exprt &divisor() const
1304 {
1305 return op1();
1306 }
1307};
1308
1309template <>
1311{
1312 return base.id() == ID_euclidean_mod;
1313}
1314
1322{
1323 PRECONDITION(expr.id() == ID_euclidean_mod);
1325 return static_cast<const euclidean_mod_exprt &>(expr);
1326}
1327
1330{
1331 PRECONDITION(expr.id() == ID_euclidean_mod);
1333 return static_cast<euclidean_mod_exprt &>(expr);
1334}
1335
1336
1339{
1340public:
1342 : binary_relation_exprt(std::move(_lhs), ID_equal, std::move(_rhs))
1343 {
1344 PRECONDITION(lhs().type() == rhs().type());
1345 }
1346
1347 static void check(
1348 const exprt &expr,
1350 {
1352 }
1353
1354 static void validate(
1355 const exprt &expr,
1356 const namespacet &ns,
1358 {
1359 binary_relation_exprt::validate(expr, ns, vm);
1360 }
1361};
1362
1363template <>
1364inline bool can_cast_expr<equal_exprt>(const exprt &base)
1365{
1366 return base.id() == ID_equal;
1367}
1368
1375inline const equal_exprt &to_equal_expr(const exprt &expr)
1376{
1377 PRECONDITION(expr.id()==ID_equal);
1378 equal_exprt::check(expr);
1379 return static_cast<const equal_exprt &>(expr);
1380}
1381
1384{
1385 PRECONDITION(expr.id()==ID_equal);
1386 equal_exprt::check(expr);
1387 return static_cast<equal_exprt &>(expr);
1388}
1389
1390
1393{
1394public:
1399};
1400
1401template <>
1402inline bool can_cast_expr<notequal_exprt>(const exprt &base)
1403{
1404 return base.id() == ID_notequal;
1405}
1406
1413inline const notequal_exprt &to_notequal_expr(const exprt &expr)
1414{
1415 PRECONDITION(expr.id()==ID_notequal);
1417 return static_cast<const notequal_exprt &>(expr);
1418}
1419
1422{
1423 PRECONDITION(expr.id()==ID_notequal);
1425 return static_cast<notequal_exprt &>(expr);
1426}
1427
1428
1431{
1432public:
1433 // _array must have either index or vector type.
1434 // When _array has array_type, the type of _index
1435 // must be array_type.index_type().
1436 // This will eventually be enforced using a precondition.
1438 : binary_exprt(
1439 _array,
1440 ID_index,
1441 std::move(_index),
1442 to_type_with_subtype(_array.type()).subtype())
1443 {
1444 const auto &array_op_type = _array.type();
1446 array_op_type.id() == ID_array || array_op_type.id() == ID_vector);
1447 }
1448
1450 : binary_exprt(
1451 std::move(_array),
1452 ID_index,
1453 std::move(_index),
1454 std::move(_type))
1455 {
1456 const auto &array_op_type = array().type();
1458 array_op_type.id() == ID_array || array_op_type.id() == ID_vector);
1459 }
1460
1462 {
1463 return op0();
1464 }
1465
1466 const exprt &array() const
1467 {
1468 return op0();
1469 }
1470
1472 {
1473 return op1();
1474 }
1475
1476 const exprt &index() const
1477 {
1478 return op1();
1479 }
1480};
1481
1482template <>
1483inline bool can_cast_expr<index_exprt>(const exprt &base)
1484{
1485 return base.id() == ID_index;
1486}
1487
1494inline const index_exprt &to_index_expr(const exprt &expr)
1495{
1496 PRECONDITION(expr.id()==ID_index);
1497 index_exprt::check(expr);
1498 return static_cast<const index_exprt &>(expr);
1499}
1500
1503{
1504 PRECONDITION(expr.id()==ID_index);
1505 index_exprt::check(expr);
1506 return static_cast<index_exprt &>(expr);
1507}
1508
1509
1512{
1513public:
1515 : unary_exprt(ID_array_of, std::move(_what), std::move(_type))
1516 {
1517 }
1518
1519 const array_typet &type() const
1520 {
1521 return static_cast<const array_typet &>(unary_exprt::type());
1522 }
1523
1525 {
1526 return static_cast<array_typet &>(unary_exprt::type());
1527 }
1528
1530 {
1531 return op0();
1532 }
1533
1534 const exprt &what() const
1535 {
1536 return op0();
1537 }
1538};
1539
1540template <>
1541inline bool can_cast_expr<array_of_exprt>(const exprt &base)
1542{
1543 return base.id() == ID_array_of;
1544}
1545
1552inline const array_of_exprt &to_array_of_expr(const exprt &expr)
1553{
1554 PRECONDITION(expr.id()==ID_array_of);
1556 return static_cast<const array_of_exprt &>(expr);
1557}
1558
1561{
1562 PRECONDITION(expr.id()==ID_array_of);
1564 return static_cast<array_of_exprt &>(expr);
1565}
1566
1567
1570{
1571public:
1573 : multi_ary_exprt(ID_array, std::move(_operands), std::move(_type))
1574 {
1575 }
1576
1577 const array_typet &type() const
1578 {
1579 return static_cast<const array_typet &>(multi_ary_exprt::type());
1580 }
1581
1583 {
1584 return static_cast<array_typet &>(multi_ary_exprt::type());
1585 }
1586
1588 {
1589 if(other.source_location().is_not_nil())
1590 add_source_location() = other.source_location();
1591 return *this;
1592 }
1593
1595 {
1596 if(other.source_location().is_not_nil())
1597 add_source_location() = other.source_location();
1598 return std::move(*this);
1599 }
1600};
1601
1602template <>
1603inline bool can_cast_expr<array_exprt>(const exprt &base)
1604{
1605 return base.id() == ID_array;
1606}
1607
1614inline const array_exprt &to_array_expr(const exprt &expr)
1615{
1616 PRECONDITION(expr.id()==ID_array);
1617 array_exprt::check(expr);
1618 return static_cast<const array_exprt &>(expr);
1619}
1620
1623{
1624 PRECONDITION(expr.id()==ID_array);
1625 array_exprt::check(expr);
1626 return static_cast<array_exprt &>(expr);
1627}
1628
1632{
1633public:
1635 : multi_ary_exprt(ID_array_list, std::move(_operands), std::move(_type))
1636 {
1637 }
1638
1639 const array_typet &type() const
1640 {
1641 return static_cast<const array_typet &>(multi_ary_exprt::type());
1642 }
1643
1645 {
1646 return static_cast<array_typet &>(multi_ary_exprt::type());
1647 }
1648
1650 void add(exprt index, exprt value)
1651 {
1652 add_to_operands(std::move(index), std::move(value));
1653 }
1654
1655 static void check(
1656 const exprt &expr,
1658 {
1659 DATA_CHECK(
1660 vm, expr.operands().size() % 2 == 0, "number of operands must be even");
1661 }
1662};
1663
1664template <>
1666{
1667 return base.id() == ID_array_list;
1668}
1669
1671{
1672 PRECONDITION(expr.id() == ID_array_list);
1674 return static_cast<const array_list_exprt &>(expr);
1675}
1676
1678{
1679 PRECONDITION(expr.id() == ID_array_list);
1681 return static_cast<array_list_exprt &>(expr);
1682}
1683
1686{
1687public:
1689 : multi_ary_exprt(ID_vector, std::move(_operands), std::move(_type))
1690 {
1691 }
1692};
1693
1694template <>
1695inline bool can_cast_expr<vector_exprt>(const exprt &base)
1696{
1697 return base.id() == ID_vector;
1698}
1699
1706inline const vector_exprt &to_vector_expr(const exprt &expr)
1707{
1708 PRECONDITION(expr.id()==ID_vector);
1709 vector_exprt::check(expr);
1710 return static_cast<const vector_exprt &>(expr);
1711}
1712
1715{
1716 PRECONDITION(expr.id()==ID_vector);
1717 vector_exprt::check(expr);
1718 return static_cast<vector_exprt &>(expr);
1719}
1720
1721
1724{
1725public:
1727 : unary_exprt(ID_union, std::move(_value), std::move(_type))
1728 {
1730 }
1731
1733 {
1734 return get(ID_component_name);
1735 }
1736
1737 void set_component_name(const irep_idt &component_name)
1738 {
1739 set(ID_component_name, component_name);
1740 }
1741
1742 std::size_t get_component_number() const
1743 {
1745 }
1746
1747 void set_component_number(std::size_t component_number)
1748 {
1749 set_size_t(ID_component_number, component_number);
1750 }
1751};
1752
1753template <>
1754inline bool can_cast_expr<union_exprt>(const exprt &base)
1755{
1756 return base.id() == ID_union;
1757}
1758
1765inline const union_exprt &to_union_expr(const exprt &expr)
1766{
1767 PRECONDITION(expr.id()==ID_union);
1768 union_exprt::check(expr);
1769 return static_cast<const union_exprt &>(expr);
1770}
1771
1774{
1775 PRECONDITION(expr.id()==ID_union);
1776 union_exprt::check(expr);
1777 return static_cast<union_exprt &>(expr);
1778}
1779
1783{
1784public:
1785 explicit empty_union_exprt(typet _type)
1786 : nullary_exprt(ID_empty_union, std::move(_type))
1787 {
1788 }
1789};
1790
1791template <>
1793{
1794 return base.id() == ID_empty_union;
1795}
1796
1804{
1805 PRECONDITION(expr.id() == ID_empty_union);
1807 return static_cast<const empty_union_exprt &>(expr);
1808}
1809
1812{
1813 PRECONDITION(expr.id() == ID_empty_union);
1815 return static_cast<empty_union_exprt &>(expr);
1816}
1817
1820{
1821public:
1823 : multi_ary_exprt(ID_struct, std::move(_operands), std::move(_type))
1824 {
1825 }
1826
1827 exprt &component(const irep_idt &name, const namespacet &ns);
1828 const exprt &component(const irep_idt &name, const namespacet &ns) const;
1829};
1830
1831template <>
1832inline bool can_cast_expr<struct_exprt>(const exprt &base)
1833{
1834 return base.id() == ID_struct;
1835}
1836
1843inline const struct_exprt &to_struct_expr(const exprt &expr)
1844{
1845 PRECONDITION(expr.id()==ID_struct);
1846 return static_cast<const struct_exprt &>(expr);
1847}
1848
1851{
1852 PRECONDITION(expr.id()==ID_struct);
1853 return static_cast<struct_exprt &>(expr);
1854}
1855
1856
1859{
1860public:
1862 : binary_exprt(
1863 std::move(_real),
1864 ID_complex,
1865 std::move(_imag),
1866 std::move(_type))
1867 {
1868 }
1869
1871 {
1872 return op0();
1873 }
1874
1875 const exprt &real() const
1876 {
1877 return op0();
1878 }
1879
1881 {
1882 return op1();
1883 }
1884
1885 const exprt &imag() const
1886 {
1887 return op1();
1888 }
1889};
1890
1891template <>
1892inline bool can_cast_expr<complex_exprt>(const exprt &base)
1893{
1894 return base.id() == ID_complex;
1895}
1896
1903inline const complex_exprt &to_complex_expr(const exprt &expr)
1904{
1905 PRECONDITION(expr.id()==ID_complex);
1907 return static_cast<const complex_exprt &>(expr);
1908}
1909
1912{
1913 PRECONDITION(expr.id()==ID_complex);
1915 return static_cast<complex_exprt &>(expr);
1916}
1917
1920{
1921public:
1922 explicit complex_real_exprt(const exprt &op)
1924 {
1925 }
1926};
1927
1928template <>
1930{
1931 return base.id() == ID_complex_real;
1932}
1933
1941{
1942 PRECONDITION(expr.id() == ID_complex_real);
1944 return static_cast<const complex_real_exprt &>(expr);
1945}
1946
1949{
1950 PRECONDITION(expr.id() == ID_complex_real);
1952 return static_cast<complex_real_exprt &>(expr);
1953}
1954
1957{
1958public:
1959 explicit complex_imag_exprt(const exprt &op)
1961 {
1962 }
1963};
1964
1965template <>
1967{
1968 return base.id() == ID_complex_imag;
1969}
1970
1978{
1979 PRECONDITION(expr.id() == ID_complex_imag);
1981 return static_cast<const complex_imag_exprt &>(expr);
1982}
1983
1986{
1987 PRECONDITION(expr.id() == ID_complex_imag);
1989 return static_cast<complex_imag_exprt &>(expr);
1990}
1991
1992
1995{
1996public:
1998 : unary_exprt(ID_typecast, std::move(op), std::move(_type))
1999 {
2000 }
2001
2002 // returns a typecast if the type doesn't already match
2003 static exprt conditional_cast(const exprt &expr, const typet &type)
2004 {
2005 if(expr.type() == type)
2006 return expr;
2007 else
2008 return typecast_exprt(expr, type);
2009 }
2010};
2011
2012template <>
2013inline bool can_cast_expr<typecast_exprt>(const exprt &base)
2014{
2015 return base.id() == ID_typecast;
2016}
2017
2024inline const typecast_exprt &to_typecast_expr(const exprt &expr)
2025{
2026 PRECONDITION(expr.id()==ID_typecast);
2028 return static_cast<const typecast_exprt &>(expr);
2029}
2030
2033{
2034 PRECONDITION(expr.id()==ID_typecast);
2036 return static_cast<typecast_exprt &>(expr);
2037}
2038
2043{
2044public:
2046 : multi_ary_exprt(std::move(op0), ID_and, std::move(op1), bool_typet())
2047 {
2048 }
2049
2052 ID_and,
2053 {std::move(op0), std::move(op1), std::move(op2)},
2054 bool_typet())
2055 {
2056 }
2057
2060 ID_and,
2061 {std::move(op0), std::move(op1), std::move(op2), std::move(op3)},
2062 bool_typet())
2063 {
2064 }
2065
2070};
2071
2075
2077
2082
2083template <>
2084inline bool can_cast_expr<and_exprt>(const exprt &base)
2085{
2086 return base.id() == ID_and;
2087}
2088
2095inline const and_exprt &to_and_expr(const exprt &expr)
2096{
2097 PRECONDITION(expr.id()==ID_and);
2098 and_exprt::check(expr);
2099 return static_cast<const and_exprt &>(expr);
2100}
2101
2104{
2105 PRECONDITION(expr.id()==ID_and);
2106 and_exprt::check(expr);
2107 return static_cast<and_exprt &>(expr);
2108}
2109
2118{
2119public:
2121 : multi_ary_exprt(std::move(op0), ID_nand, std::move(op1), bool_typet())
2122 {
2123 }
2124
2129};
2130
2137inline const nand_exprt &to_nand_expr(const exprt &expr)
2138{
2139 PRECONDITION(expr.id() == ID_nand);
2140 nand_exprt::check(expr);
2141 return static_cast<const nand_exprt &>(expr);
2142}
2143
2146{
2147 PRECONDITION(expr.id() == ID_nand);
2148 nand_exprt::check(expr);
2149 return static_cast<nand_exprt &>(expr);
2150}
2151
2154{
2155public:
2157 : binary_exprt(std::move(op0), ID_implies, std::move(op1), bool_typet())
2158 {
2159 }
2160};
2161
2162template <>
2163inline bool can_cast_expr<implies_exprt>(const exprt &base)
2164{
2165 return base.id() == ID_implies;
2166}
2167
2174inline const implies_exprt &to_implies_expr(const exprt &expr)
2175{
2176 PRECONDITION(expr.id()==ID_implies);
2178 return static_cast<const implies_exprt &>(expr);
2179}
2180
2183{
2184 PRECONDITION(expr.id()==ID_implies);
2186 return static_cast<implies_exprt &>(expr);
2187}
2188
2193{
2194public:
2196 : multi_ary_exprt(std::move(op0), ID_or, std::move(op1), bool_typet())
2197 {
2198 }
2199
2202 ID_or,
2203 {std::move(op0), std::move(op1), std::move(op2)},
2204 bool_typet())
2205 {
2206 }
2207
2210 ID_or,
2211 {std::move(op0), std::move(op1), std::move(op2), std::move(op3)},
2212 bool_typet())
2213 {
2214 }
2215
2220};
2221
2225
2227
2228template <>
2229inline bool can_cast_expr<or_exprt>(const exprt &base)
2230{
2231 return base.id() == ID_or;
2232}
2233
2240inline const or_exprt &to_or_expr(const exprt &expr)
2241{
2242 PRECONDITION(expr.id()==ID_or);
2243 or_exprt::check(expr);
2244 return static_cast<const or_exprt &>(expr);
2245}
2246
2249{
2250 PRECONDITION(expr.id()==ID_or);
2251 or_exprt::check(expr);
2252 return static_cast<or_exprt &>(expr);
2253}
2254
2263{
2264public:
2266 : multi_ary_exprt(std::move(op0), ID_nor, std::move(op1), bool_typet())
2267 {
2268 }
2269
2274};
2275
2282inline const nor_exprt &to_nor_expr(const exprt &expr)
2283{
2284 PRECONDITION(expr.id() == ID_nor);
2285 nor_exprt::check(expr);
2286 return static_cast<const nor_exprt &>(expr);
2287}
2288
2291{
2292 PRECONDITION(expr.id() == ID_nor);
2293 return static_cast<nor_exprt &>(expr);
2294}
2295
2300{
2301public:
2303 : multi_ary_exprt(std::move(_op0), ID_xor, std::move(_op1), bool_typet())
2304 {
2305 }
2306
2311};
2312
2313template <>
2314inline bool can_cast_expr<xor_exprt>(const exprt &base)
2315{
2316 return base.id() == ID_xor;
2317}
2318
2325inline const xor_exprt &to_xor_expr(const exprt &expr)
2326{
2327 PRECONDITION(expr.id()==ID_xor);
2328 xor_exprt::check(expr);
2329 return static_cast<const xor_exprt &>(expr);
2330}
2331
2334{
2335 PRECONDITION(expr.id()==ID_xor);
2336 xor_exprt::check(expr);
2337 return static_cast<xor_exprt &>(expr);
2338}
2339
2346{
2347public:
2349 : multi_ary_exprt(std::move(_op0), ID_xnor, std::move(_op1), bool_typet())
2350 {
2351 }
2352
2357};
2358
2359template <>
2360inline bool can_cast_expr<xnor_exprt>(const exprt &base)
2361{
2362 return base.id() == ID_xnor;
2363}
2364
2371inline const xnor_exprt &to_xnor_expr(const exprt &expr)
2372{
2373 PRECONDITION(expr.id() == ID_xnor);
2374 xnor_exprt::check(expr);
2375 return static_cast<const xnor_exprt &>(expr);
2376}
2377
2380{
2381 PRECONDITION(expr.id() == ID_xnor);
2382 xnor_exprt::check(expr);
2383 return static_cast<xnor_exprt &>(expr);
2384}
2385
2388{
2389public:
2391 {
2392 PRECONDITION(as_const(*this).op().is_boolean());
2393 }
2394};
2395
2396template <>
2397inline bool can_cast_expr<not_exprt>(const exprt &base)
2398{
2399 return base.id() == ID_not;
2400}
2401
2408inline const not_exprt &to_not_expr(const exprt &expr)
2409{
2410 PRECONDITION(expr.id()==ID_not);
2411 not_exprt::check(expr);
2412 return static_cast<const not_exprt &>(expr);
2413}
2414
2417{
2418 PRECONDITION(expr.id()==ID_not);
2419 not_exprt::check(expr);
2420 return static_cast<not_exprt &>(expr);
2421}
2422
2423
2426{
2427public:
2429 : ternary_exprt(ID_if, std::move(cond), t, std::move(f), t.type())
2430 {
2431 }
2432
2434 : ternary_exprt(
2435 ID_if,
2436 std::move(cond),
2437 std::move(t),
2438 std::move(f),
2439 std::move(type))
2440 {
2441 }
2442
2444 {
2445 return op0();
2446 }
2447
2448 const exprt &cond() const
2449 {
2450 return op0();
2451 }
2452
2454 {
2455 return op1();
2456 }
2457
2458 const exprt &true_case() const
2459 {
2460 return op1();
2461 }
2462
2464 {
2465 return op2();
2466 }
2467
2468 const exprt &false_case() const
2469 {
2470 return op2();
2471 }
2472
2473 static void check(
2474 const exprt &expr,
2476 {
2477 ternary_exprt::check(expr, vm);
2478 }
2479
2480 static void validate(
2481 const exprt &expr,
2482 const namespacet &ns,
2484 {
2485 ternary_exprt::validate(expr, ns, vm);
2486 }
2487};
2488
2489template <>
2490inline bool can_cast_expr<if_exprt>(const exprt &base)
2491{
2492 return base.id() == ID_if;
2493}
2494
2501inline const if_exprt &to_if_expr(const exprt &expr)
2502{
2503 PRECONDITION(expr.id()==ID_if);
2504 if_exprt::check(expr);
2505 return static_cast<const if_exprt &>(expr);
2506}
2507
2510{
2511 PRECONDITION(expr.id()==ID_if);
2512 if_exprt::check(expr);
2513 return static_cast<if_exprt &>(expr);
2514}
2515
2520{
2521public:
2524 ID_with,
2525 _old.type(),
2526 {_old, std::move(_where), std::move(_new_value)})
2527 {
2528 }
2529
2531 {
2532 return op0();
2533 }
2534
2535 const exprt &old() const
2536 {
2537 return op0();
2538 }
2539
2541 {
2542 return op1();
2543 }
2544
2545 const exprt &where() const
2546 {
2547 return op1();
2548 }
2549
2551 {
2552 return op2();
2553 }
2554
2555 const exprt &new_value() const
2556 {
2557 return op2();
2558 }
2559};
2560
2561template <>
2562inline bool can_cast_expr<with_exprt>(const exprt &base)
2563{
2564 return base.id() == ID_with;
2565}
2566
2573inline const with_exprt &to_with_expr(const exprt &expr)
2574{
2575 PRECONDITION(expr.id()==ID_with);
2576 with_exprt::check(expr);
2577 return static_cast<const with_exprt &>(expr);
2578}
2579
2582{
2583 PRECONDITION(expr.id()==ID_with);
2584 with_exprt::check(expr);
2585 return static_cast<with_exprt &>(expr);
2586}
2587
2589{
2590public:
2593 {
2594 }
2595
2596 const exprt &index() const
2597 {
2598 return op0();
2599 }
2600
2602 {
2603 return op0();
2604 }
2605};
2606
2607template <>
2609{
2610 return base.id() == ID_index_designator;
2611}
2612
2620{
2623 return static_cast<const index_designatort &>(expr);
2624}
2625
2628{
2631 return static_cast<index_designatort &>(expr);
2632}
2633
2635{
2636public:
2642
2644 {
2645 return get(ID_component_name);
2646 }
2647};
2648
2649template <>
2651{
2652 return base.id() == ID_member_designator;
2653}
2654
2662{
2665 return static_cast<const member_designatort &>(expr);
2666}
2667
2670{
2673 return static_cast<member_designatort &>(expr);
2674}
2675
2676
2679{
2680public:
2682 : ternary_exprt(
2683 ID_update,
2684 _old,
2685 std::move(_designator),
2686 std::move(_new_value),
2687 _old.type())
2688 {
2689 }
2690
2692 {
2693 return op0();
2694 }
2695
2696 const exprt &old() const
2697 {
2698 return op0();
2699 }
2700
2701 // the designator operands are either
2702 // 1) member_designator or
2703 // 2) index_designator
2704 // as defined above
2706 {
2707 return op1().operands();
2708 }
2709
2711 {
2712 return op1().operands();
2713 }
2714
2716 {
2717 return op2();
2718 }
2719
2720 const exprt &new_value() const
2721 {
2722 return op2();
2723 }
2724
2726 with_exprt make_with_expr() const;
2727
2728 static void check(
2729 const exprt &expr,
2731 {
2732 ternary_exprt::check(expr, vm);
2733 }
2734
2735 static void validate(
2736 const exprt &expr,
2737 const namespacet &ns,
2739 {
2740 ternary_exprt::validate(expr, ns, vm);
2741 }
2742};
2743
2744template <>
2745inline bool can_cast_expr<update_exprt>(const exprt &base)
2746{
2747 return base.id() == ID_update;
2748}
2749
2750inline void validate_expr(const update_exprt &value)
2751{
2753 value, 3, "Array/structure update must have three operands");
2754}
2755
2762inline const update_exprt &to_update_expr(const exprt &expr)
2763{
2764 PRECONDITION(expr.id()==ID_update);
2765 update_exprt::check(expr);
2766 return static_cast<const update_exprt &>(expr);
2767}
2768
2771{
2772 PRECONDITION(expr.id()==ID_update);
2773 update_exprt::check(expr);
2774 return static_cast<update_exprt &>(expr);
2775}
2776
2777
2778#if 0
2781{
2782public:
2784 const exprt &_array,
2785 const exprt &_index,
2786 const exprt &_new_value):
2788 {
2789 add_to_operands(_array, _index, _new_value);
2790 }
2791
2793 {
2794 operands().resize(3);
2795 }
2796
2797 exprt &array()
2798 {
2799 return op0();
2800 }
2801
2802 const exprt &array() const
2803 {
2804 return op0();
2805 }
2806
2807 exprt &index()
2808 {
2809 return op1();
2810 }
2811
2812 const exprt &index() const
2813 {
2814 return op1();
2815 }
2816
2817 exprt &new_value()
2818 {
2819 return op2();
2820 }
2821
2822 const exprt &new_value() const
2823 {
2824 return op2();
2825 }
2826};
2827
2828template<> inline bool can_cast_expr<array_update_exprt>(const exprt &base)
2829{
2830 return base.id()==ID_array_update;
2831}
2832
2833inline void validate_expr(const array_update_exprt &value)
2834{
2835 validate_operands(value, 3, "Array update must have three operands");
2836}
2837
2844inline const array_update_exprt &to_array_update_expr(const exprt &expr)
2845{
2847 const array_update_exprt &ret = static_cast<const array_update_exprt &>(expr);
2849 return ret;
2850}
2851
2854{
2856 array_update_exprt &ret = static_cast<array_update_exprt &>(expr);
2858 return ret;
2859}
2860
2861#endif
2862
2863
2866{
2867public:
2868 member_exprt(exprt op, const irep_idt &component_name, typet _type)
2869 : unary_exprt(ID_member, std::move(op), std::move(_type))
2870 {
2871 const auto &compound_type_id = compound().type().id();
2875 set_component_name(component_name);
2876 }
2877
2887
2889 {
2890 return get(ID_component_name);
2891 }
2892
2893 void set_component_name(const irep_idt &component_name)
2894 {
2895 set(ID_component_name, component_name);
2896 }
2897
2898 std::size_t get_component_number() const
2899 {
2901 }
2902
2903 // will go away, use compound()
2904 const exprt &struct_op() const
2905 {
2906 return op0();
2907 }
2908
2909 // will go away, use compound()
2911 {
2912 return op0();
2913 }
2914
2915 const exprt &compound() const
2916 {
2917 return op0();
2918 }
2919
2921 {
2922 return op0();
2923 }
2924
2925 static void check(
2926 const exprt &expr,
2928 {
2929 DATA_CHECK(
2930 vm,
2931 expr.operands().size() == 1,
2932 "member expression must have one operand");
2933 }
2934
2935 static void validate(
2936 const exprt &expr,
2937 const namespacet &ns,
2939};
2940
2941template <>
2942inline bool can_cast_expr<member_exprt>(const exprt &base)
2943{
2944 return base.id() == ID_member;
2945}
2946
2953inline const member_exprt &to_member_expr(const exprt &expr)
2954{
2955 PRECONDITION(expr.id()==ID_member);
2956 member_exprt::check(expr);
2957 return static_cast<const member_exprt &>(expr);
2958}
2959
2962{
2963 PRECONDITION(expr.id()==ID_member);
2964 member_exprt::check(expr);
2965 return static_cast<member_exprt &>(expr);
2966}
2967
2968
2971{
2972public:
2974 {
2975 }
2976};
2977
2978template <>
2979inline bool can_cast_expr<type_exprt>(const exprt &base)
2980{
2981 return base.id() == ID_type;
2982}
2983
2990inline const type_exprt &to_type_expr(const exprt &expr)
2991{
2993 type_exprt::check(expr);
2994 return static_cast<const type_exprt &>(expr);
2995}
2996
2999{
3001 type_exprt::check(expr);
3002 return static_cast<type_exprt &>(expr);
3003}
3004
3007{
3008public:
3009 constant_exprt(const irep_idt &_value, typet _type)
3010 : nullary_exprt(ID_constant, std::move(_type))
3011 {
3012 set_value(_value);
3013 }
3014
3015 const irep_idt &get_value() const
3016 {
3017 return get(ID_value);
3018 }
3019
3020 void set_value(const irep_idt &value)
3021 {
3022 set(ID_value, value);
3023 }
3024
3028 bool is_null_pointer() const;
3029
3030 using irept::operator==;
3031 using irept::operator!=;
3033 bool operator==(bool rhs) const;
3035 bool operator!=(bool rhs) const;
3037 bool operator==(int rhs) const;
3039 bool operator!=(int rhs) const;
3041 bool operator==(std::nullptr_t) const;
3043 bool operator!=(std::nullptr_t) const;
3044
3045 static void check(
3046 const exprt &expr,
3048
3049 static void validate(
3050 const exprt &expr,
3051 const namespacet &,
3053 {
3054 check(expr, vm);
3055 }
3056
3057protected:
3058 bool value_is_zero_string() const;
3059};
3060
3061template <>
3062inline bool can_cast_expr<constant_exprt>(const exprt &base)
3063{
3064 return base.is_constant();
3065}
3066
3067inline void validate_expr(const constant_exprt &value)
3068{
3069 validate_operands(value, 0, "Constants must not have operands");
3070}
3071
3078inline const constant_exprt &to_constant_expr(const exprt &expr)
3079{
3080 PRECONDITION(expr.is_constant());
3082 return static_cast<const constant_exprt &>(expr);
3083}
3084
3087{
3088 PRECONDITION(expr.is_constant());
3090 return static_cast<constant_exprt &>(expr);
3091}
3092
3095bool operator==(const exprt &lhs, bool rhs);
3096
3099bool operator!=(const exprt &lhs, bool rhs);
3100
3112bool operator==(const exprt &lhs, int rhs);
3113
3115bool operator!=(const exprt &lhs, int rhs);
3116
3119bool operator==(const exprt &lhs, std::nullptr_t);
3120
3122bool operator!=(const exprt &lhs, std::nullptr_t);
3123
3126{
3127public:
3131};
3132
3135{
3136public:
3140};
3141
3144{
3145public:
3150};
3151
3152template <>
3153inline bool can_cast_expr<nil_exprt>(const exprt &base)
3154{
3155 return base.id() == ID_nil;
3156}
3157
3160{
3161public:
3162 explicit infinity_exprt(typet _type)
3163 : nullary_exprt(ID_infinity, std::move(_type))
3164 {
3165 }
3166};
3167
3170{
3171public:
3172 using variablest = std::vector<symbol_exprt>;
3173
3176 irep_idt _id,
3177 const variablest &_variables,
3178 exprt _where,
3179 typet _type)
3180 : binary_exprt(
3182 ID_tuple,
3184 typet(ID_tuple)),
3185 _id,
3186 std::move(_where),
3187 std::move(_type))
3188 {
3189 }
3190
3192 {
3193 return (variablest &)to_multi_ary_expr(op0()).operands();
3194 }
3195
3196 const variablest &variables() const
3197 {
3198 return (variablest &)to_multi_ary_expr(op0()).operands();
3199 }
3200
3202 {
3203 return op1();
3204 }
3205
3206 const exprt &where() const
3207 {
3208 return op1();
3209 }
3210
3213 exprt instantiate(const exprt::operandst &) const;
3214
3217 exprt instantiate(const variablest &) const;
3218};
3219
3220template <>
3221inline bool can_cast_expr<binding_exprt>(const exprt &base)
3222{
3223 return base.id() == ID_forall || base.id() == ID_exists ||
3224 base.id() == ID_lambda || base.id() == ID_array_comprehension;
3225}
3226
3233inline const binding_exprt &to_binding_expr(const exprt &expr)
3234{
3236 expr.id() == ID_forall || expr.id() == ID_exists ||
3237 expr.id() == ID_lambda || expr.id() == ID_array_comprehension);
3239 return static_cast<const binding_exprt &>(expr);
3240}
3241
3249{
3251 expr.id() == ID_forall || expr.id() == ID_exists ||
3252 expr.id() == ID_lambda || expr.id() == ID_array_comprehension);
3254 return static_cast<binding_exprt &>(expr);
3255}
3256
3259{
3260public:
3264 const exprt &where)
3265 : binary_exprt(
3268 std::move(variables),
3269 where,
3270 where.type()),
3271 ID_let,
3273 where.type())
3274 {
3275 PRECONDITION(this->variables().size() == this->values().size());
3276 }
3277
3280 : let_exprt(
3282 operandst{std::move(value)},
3283 where)
3284 {
3285 }
3286
3288 {
3289 return static_cast<binding_exprt &>(op0());
3290 }
3291
3292 const binding_exprt &binding() const
3293 {
3294 return static_cast<const binding_exprt &>(op0());
3295 }
3296
3299 {
3300 auto &variables = binding().variables();
3301 PRECONDITION(variables.size() == 1);
3302 return variables.front();
3303 }
3304
3306 const symbol_exprt &symbol() const
3307 {
3308 const auto &variables = binding().variables();
3309 PRECONDITION(variables.size() == 1);
3310 return variables.front();
3311 }
3312
3315 {
3316 auto &values = this->values();
3317 PRECONDITION(values.size() == 1);
3318 return values.front();
3319 }
3320
3322 const exprt &value() const
3323 {
3324 const auto &values = this->values();
3325 PRECONDITION(values.size() == 1);
3326 return values.front();
3327 }
3328
3330 {
3331 return static_cast<multi_ary_exprt &>(op1()).operands();
3332 }
3333
3334 const operandst &values() const
3335 {
3336 return static_cast<const multi_ary_exprt &>(op1()).operands();
3337 }
3338
3341 {
3342 return binding().variables();
3343 }
3344
3347 {
3348 return binding().variables();
3349 }
3350
3353 {
3354 return binding().where();
3355 }
3356
3358 const exprt &where() const
3359 {
3360 return binding().where();
3361 }
3362
3363 static void validate(const exprt &, validation_modet);
3364};
3365
3366template <>
3367inline bool can_cast_expr<let_exprt>(const exprt &base)
3368{
3369 return base.id() == ID_let;
3370}
3371
3373{
3374 validate_operands(let_expr, 2, "Let must have two operands");
3375}
3376
3383inline const let_exprt &to_let_expr(const exprt &expr)
3384{
3385 PRECONDITION(expr.id()==ID_let);
3386 let_exprt::check(expr);
3387 return static_cast<const let_exprt &>(expr);
3388}
3389
3392{
3393 PRECONDITION(expr.id()==ID_let);
3394 let_exprt::check(expr);
3395 return static_cast<let_exprt &>(expr);
3396}
3397
3398
3403{
3404public:
3406 : multi_ary_exprt(ID_cond, std::move(_operands), std::move(_type))
3407 {
3408 }
3409
3413 void add_case(const exprt &condition, const exprt &value)
3414 {
3415 PRECONDITION(condition.is_boolean());
3416 operands().reserve(operands().size() + 2);
3417 operands().push_back(condition);
3418 operands().push_back(value);
3419 }
3420
3421 // a lowering to nested if_exprt
3422 exprt lower() const;
3423};
3424
3425template <>
3426inline bool can_cast_expr<cond_exprt>(const exprt &base)
3427{
3428 return base.id() == ID_cond;
3429}
3430
3431inline void validate_expr(const cond_exprt &value)
3432{
3434 value.operands().size() % 2 == 0, "cond must have even number of operands");
3435}
3436
3443inline const cond_exprt &to_cond_expr(const exprt &expr)
3444{
3445 PRECONDITION(expr.id() == ID_cond);
3446 cond_exprt::check(expr);
3447 return static_cast<const cond_exprt &>(expr);
3448}
3449
3452{
3453 PRECONDITION(expr.id() == ID_cond);
3454 cond_exprt::check(expr);
3455 return static_cast<cond_exprt &>(expr);
3456}
3457
3463// NOLINTNEXTLINE(readability/identifiers)
3464class DEPRECATED(SINCE(2026, 1, 18, "SMV-specific, has no other use"))
3466{
3467public:
3469 : multi_ary_exprt(ID_case, std::move(_operands), std::move(_type))
3470 {
3471 }
3472
3475 : multi_ary_exprt(ID_case, {std::move(_select_value)}, std::move(_type))
3476 {
3477 }
3478
3480 const exprt &select_value() const
3481 {
3482 PRECONDITION(!operands().empty());
3483 return operands()[0];
3484 }
3485
3488 {
3489 PRECONDITION(!operands().empty());
3490 return operands()[0];
3491 }
3492
3497 void add_case(const exprt &case_value, const exprt &result_value)
3498 {
3499 operands().reserve(operands().size() + 2);
3500 operands().push_back(case_value);
3501 operands().push_back(result_value);
3502 }
3503
3505 std::size_t number_of_cases() const
3506 {
3507 PRECONDITION(operands().size() >= 1);
3508 return (operands().size() - 1) / 2;
3509 }
3510
3512 const exprt &case_value(std::size_t i) const
3513 {
3514 PRECONDITION(i < number_of_cases());
3515 return operands()[1 + 2 * i];
3516 }
3517
3519 exprt &case_value(std::size_t i)
3520 {
3521 PRECONDITION(i < number_of_cases());
3522 return operands()[1 + 2 * i];
3523 }
3524
3526 const exprt &result_value(std::size_t i) const
3527 {
3528 PRECONDITION(i < number_of_cases());
3529 return operands()[1 + 2 * i + 1];
3530 }
3531
3533 exprt &result_value(std::size_t i)
3534 {
3535 PRECONDITION(i < number_of_cases());
3536 return operands()[1 + 2 * i + 1];
3537 }
3538
3539 static void check(const exprt &expr)
3540 {
3542 expr.operands().size() >= 1,
3543 "case expression must have at least one operand");
3545 expr.operands().size() % 2 == 1,
3546 "case expression must have odd number of operands");
3547 }
3548};
3549
3550template <>
3551inline bool can_cast_expr<case_exprt>(const exprt &base)
3552{
3553 return base.id() == ID_case;
3554}
3555
3562inline const case_exprt &to_case_expr(const exprt &expr)
3563{
3564 PRECONDITION(expr.id() == ID_case);
3565 case_exprt::check(expr);
3566 return static_cast<const case_exprt &>(expr);
3567}
3568
3571{
3572 PRECONDITION(expr.id() == ID_case);
3573 case_exprt::check(expr);
3574 return static_cast<case_exprt &>(expr);
3575}
3576
3586{
3587public:
3590 exprt body,
3591 array_typet _type)
3592 : binding_exprt(
3594 {std::move(arg)},
3595 std::move(body),
3596 std::move(_type))
3597 {
3598 }
3599
3600 const array_typet &type() const
3601 {
3602 return static_cast<const array_typet &>(binary_exprt::type());
3603 }
3604
3606 {
3607 return static_cast<array_typet &>(binary_exprt::type());
3608 }
3609
3610 const symbol_exprt &arg() const
3611 {
3612 auto &variables = this->variables();
3613 PRECONDITION(variables.size() == 1);
3614 return variables[0];
3615 }
3616
3618 {
3619 auto &variables = this->variables();
3620 PRECONDITION(variables.size() == 1);
3621 return variables[0];
3622 }
3623
3624 const exprt &body() const
3625 {
3626 return where();
3627 }
3628
3630 {
3631 return where();
3632 }
3633};
3634
3635template <>
3637{
3638 return base.id() == ID_array_comprehension;
3639}
3640
3647inline const array_comprehension_exprt &
3649{
3652 return static_cast<const array_comprehension_exprt &>(expr);
3653}
3654
3662
3663inline void validate_expr(const class class_method_descriptor_exprt &value);
3664
3667{
3668public:
3684 typet _type,
3688 : nullary_exprt(ID_virtual_function, std::move(_type))
3689 {
3692 set(ID_C_class, std::move(class_id));
3693 set(ID_C_base_name, std::move(base_method_name));
3694 set(ID_identifier, std::move(id));
3695 validate_expr(*this);
3696 }
3697
3705 {
3706 return get(ID_component_name);
3707 }
3708
3712 const irep_idt &class_id() const
3713 {
3714 return get(ID_C_class);
3715 }
3716
3720 {
3721 return get(ID_C_base_name);
3722 }
3723
3728 {
3729 return get(ID_identifier);
3730 }
3731};
3732
3733inline void validate_expr(const class class_method_descriptor_exprt &value)
3734{
3735 validate_operands(value, 0, "class method descriptor must not have operands");
3737 !value.mangled_method_name().empty(),
3738 "class method descriptor must have a mangled method name.");
3740 !value.class_id().empty(), "class method descriptor must have a class id.");
3742 !value.base_method_name().empty(),
3743 "class method descriptor must have a base method name.");
3745 value.get_identifier() == id2string(value.class_id()) + "." +
3747 "class method descriptor must have an identifier in the expected format.");
3748}
3749
3756inline const class_method_descriptor_exprt &
3758{
3761 return static_cast<const class_method_descriptor_exprt &>(expr);
3762}
3763
3764template <>
3766{
3767 return base.id() == ID_virtual_function;
3768}
3769
3776{
3777public:
3779 : binary_exprt(
3780 std::move(symbol),
3782 value, // not moved, for type
3783 value.type())
3784 {
3785 PRECONDITION(symbol.type() == type());
3786 }
3787
3788 const symbol_exprt &symbol() const
3789 {
3790 return static_cast<const symbol_exprt &>(op0());
3791 }
3792
3794 {
3795 return static_cast<symbol_exprt &>(op0());
3796 }
3797
3798 const exprt &value() const
3799 {
3800 return op1();
3801 }
3802
3804 {
3805 return op1();
3806 }
3807};
3808
3809template <>
3811{
3812 return base.id() == ID_named_term;
3813}
3814
3822{
3823 PRECONDITION(expr.id() == ID_named_term);
3825 return static_cast<const named_term_exprt &>(expr);
3826}
3827
3830{
3831 PRECONDITION(expr.id() == ID_named_term);
3833 return static_cast<named_term_exprt &>(expr);
3834}
3835
3836#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:440
abs_exprt(exprt _op)
Definition std_expr.h:442
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:2043
and_exprt(exprt op0, exprt op1, exprt op2)
Definition std_expr.h:2050
and_exprt(exprt op0, exprt op1)
Definition std_expr.h:2045
and_exprt(exprt op0, exprt op1, exprt op2, exprt op3)
Definition std_expr.h:2058
and_exprt(exprt::operandst _operands)
Definition std_expr.h:2066
Expression to define a mapping from an argument (index) to elements.
Definition std_expr.h:3586
const array_typet & type() const
Definition std_expr.h:3600
const symbol_exprt & arg() const
Definition std_expr.h:3610
const exprt & body() const
Definition std_expr.h:3624
array_typet & type()
Definition std_expr.h:3605
symbol_exprt & arg()
Definition std_expr.h:3617
array_comprehension_exprt(symbol_exprt arg, exprt body, array_typet _type)
Definition std_expr.h:3588
Array constructor from list of elements.
Definition std_expr.h:1570
array_exprt && with_source_location(const exprt &other) &&
Definition std_expr.h:1594
const array_typet & type() const
Definition std_expr.h:1577
array_exprt & with_source_location(const exprt &other) &
Definition std_expr.h:1587
array_exprt(operandst _operands, array_typet _type)
Definition std_expr.h:1572
array_typet & type()
Definition std_expr.h:1582
Array constructor from a list of index-element pairs Operands are index/value pairs,...
Definition std_expr.h:1632
static void check(const exprt &expr, const validation_modet vm=validation_modet::INVARIANT)
Definition std_expr.h:1655
void add(exprt index, exprt value)
add an index/value pair
Definition std_expr.h:1650
const array_typet & type() const
Definition std_expr.h:1639
array_list_exprt(operandst _operands, array_typet _type)
Definition std_expr.h:1634
array_typet & type()
Definition std_expr.h:1644
Array constructor from single element.
Definition std_expr.h:1512
array_typet & type()
Definition std_expr.h:1524
array_of_exprt(exprt _what, array_typet _type)
Definition std_expr.h:1514
const exprt & what() const
Definition std_expr.h:1534
const array_typet & type() const
Definition std_expr.h:1519
exprt & what()
Definition std_expr.h:1529
Arrays with given size.
Definition std_types.h:806
A base class for binary expressions.
Definition std_expr.h:649
exprt & lhs()
Definition std_expr.h:679
binary_exprt(const exprt &_lhs, const irep_idt &_id, exprt _rhs)
Definition std_expr.h:651
static void validate(const exprt &expr, const namespacet &, const validation_modet vm=validation_modet::INVARIANT)
Definition std_expr.h:671
const exprt & op2() const =delete
static void check(const exprt &expr, const validation_modet vm=validation_modet::INVARIANT)
Definition std_expr.h:661
exprt & rhs()
Definition std_expr.h:689
exprt & op0()
Definition expr.h:134
const exprt & lhs() const
Definition std_expr.h:684
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:656
const exprt & rhs() const
Definition std_expr.h:694
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:737
static void check(const exprt &expr, const validation_modet vm=validation_modet::INVARIANT)
Definition std_expr.h:744
binary_predicate_exprt(exprt _op0, const irep_idt &_id, exprt _op1)
Definition std_expr.h:739
static void validate(const exprt &expr, const namespacet &ns, const validation_modet vm=validation_modet::INVARIANT)
Definition std_expr.h:752
A base class for relations, i.e., binary predicates whose two operands have the same type.
Definition std_expr.h:784
binary_relation_exprt(exprt _lhs, const irep_idt &_id, exprt _rhs)
Definition std_expr.h:786
static void check(const exprt &expr, const validation_modet vm=validation_modet::INVARIANT)
Definition std_expr.h:791
static void validate(const exprt &expr, const namespacet &ns, const validation_modet vm=validation_modet::INVARIANT)
Definition std_expr.h:798
A base class for variable bindings (quantifiers, let, lambda)
Definition std_expr.h:3170
const variablest & variables() const
Definition std_expr.h:3196
const exprt & where() const
Definition std_expr.h:3206
exprt & where()
Definition std_expr.h:3201
variablest & variables()
Definition std_expr.h:3191
binding_exprt(irep_idt _id, const variablest &_variables, exprt _where, typet _type)
construct the binding expression
Definition std_expr.h:3175
exprt instantiate(const exprt::operandst &) const
substitute free occurrences of the variables in where() by the given values
Definition std_expr.cpp:419
std::vector< symbol_exprt > variablest
Definition std_expr.h:3172
The Boolean type.
Definition std_types.h:35
Case expression: evaluates to the value corresponding to the first matching case.
Definition std_expr.h:3466
exprt & result_value(std::size_t i)
Get the result value for the i-th case.
Definition std_expr.h:3533
void add_case(const exprt &case_value, const exprt &result_value)
Add a case: value to compare and corresponding result.
Definition std_expr.h:3497
const exprt & case_value(std::size_t i) const
Get the case value for the i-th case.
Definition std_expr.h:3512
case_exprt(operandst _operands, typet _type)
Definition std_expr.h:3468
exprt & select_value()
Get the value that is being compared against.
Definition std_expr.h:3487
const exprt & result_value(std::size_t i) const
Get the result value for the i-th case.
Definition std_expr.h:3526
std::size_t number_of_cases() const
Get the number of cases (excluding the select value)
Definition std_expr.h:3505
case_exprt(exprt _select_value, typet _type)
Constructor with select value.
Definition std_expr.h:3474
static void check(const exprt &expr)
Definition std_expr.h:3539
exprt & case_value(std::size_t i)
Get the case value for the i-th case.
Definition std_expr.h:3519
const exprt & select_value() const
Get the value that is being compared against.
Definition std_expr.h:3480
An expression describing a method on a class.
Definition std_expr.h:3667
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:3719
const irep_idt & mangled_method_name() const
The method name after mangling it by combining it with the descriptor.
Definition std_expr.h:3704
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:3727
class_method_descriptor_exprt(typet _type, irep_idt mangled_method_name, irep_idt class_id, irep_idt base_method_name)
Definition std_expr.h:3683
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:3712
Complex constructor from a pair of numbers.
Definition std_expr.h:1859
complex_exprt(exprt _real, exprt _imag, complex_typet _type)
Definition std_expr.h:1861
exprt real()
Definition std_expr.h:1870
exprt imag()
Definition std_expr.h:1880
const exprt & real() const
Definition std_expr.h:1875
const exprt & imag() const
Definition std_expr.h:1885
Imaginary part of the expression describing a complex number.
Definition std_expr.h:1957
complex_imag_exprt(const exprt &op)
Definition std_expr.h:1959
Real part of the expression describing a complex number.
Definition std_expr.h:1920
complex_real_exprt(const exprt &op)
Definition std_expr.h:1922
Complex numbers made of pair of given subtype.
Definition std_types.h:1023
this is a parametric version of an if-expression: it returns the value of the first case (using the o...
Definition std_expr.h:3403
void add_case(const exprt &condition, const exprt &value)
adds a case to a cond expression
Definition std_expr.h:3413
cond_exprt(operandst _operands, typet _type)
Definition std_expr.h:3405
exprt lower() const
Definition std_expr.cpp:458
A constant literal expression.
Definition std_expr.h:3007
static void validate(const exprt &expr, const namespacet &, const validation_modet vm=validation_modet::INVARIANT)
Definition std_expr.h:3049
const irep_idt & get_value() const
Definition std_expr.h:3015
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:3009
void set_value(const irep_idt &value)
Definition std_expr.h:3020
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:253
decorated_symbol_exprt(const irep_idt &identifier, typet type)
Definition std_expr.h:257
bool is_static_lifetime() const
Definition std_expr.h:262
bool is_thread_local() const
Definition std_expr.h:277
Division.
Definition std_expr.h:1152
div_exprt(exprt _lhs, exprt _rhs)
Definition std_expr.h:1154
exprt & dividend()
The dividend of a division is the number that is being divided.
Definition std_expr.h:1160
const exprt & dividend() const
The dividend of a division is the number that is being divided.
Definition std_expr.h:1166
const exprt & divisor() const
The divisor of a division is the number the dividend is being divided by.
Definition std_expr.h:1178
exprt & divisor()
The divisor of a division is the number the dividend is being divided by.
Definition std_expr.h:1172
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:1783
empty_union_exprt(typet _type)
Definition std_expr.h:1785
Equality.
Definition std_expr.h:1339
static void check(const exprt &expr, const validation_modet vm=validation_modet::INVARIANT)
Definition std_expr.h:1347
equal_exprt(exprt _lhs, exprt _rhs)
Definition std_expr.h:1341
static void validate(const exprt &expr, const namespacet &ns, const validation_modet vm=validation_modet::INVARIANT)
Definition std_expr.h:1354
Boute's Euclidean definition of Modulo – to match SMT-LIB2.
Definition std_expr.h:1277
exprt & divisor()
The divisor of a division is the number the dividend is being divided by.
Definition std_expr.h:1297
euclidean_mod_exprt(exprt _lhs, exprt _rhs)
Definition std_expr.h:1279
const exprt & divisor() const
The divisor of a division is the number the dividend is being divided by.
Definition std_expr.h:1303
exprt & dividend()
The dividend of a division is the number that is being divided.
Definition std_expr.h:1285
const exprt & dividend() const
The dividend of a division is the number that is being divided.
Definition std_expr.h:1291
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:3135
Binary greater than operator expression.
Definition std_expr.h:843
greater_than_exprt(exprt _lhs, exprt _rhs)
Definition std_expr.h:845
Binary greater than or equal operator expression.
Definition std_expr.h:859
greater_than_or_equal_exprt(exprt _lhs, exprt _rhs)
Definition std_expr.h:861
The trinary if-then-else operator.
Definition std_expr.h:2426
const exprt & false_case() const
Definition std_expr.h:2468
exprt & cond()
Definition std_expr.h:2443
const exprt & cond() const
Definition std_expr.h:2448
if_exprt(exprt cond, const exprt &t, exprt f)
Definition std_expr.h:2428
const exprt & true_case() const
Definition std_expr.h:2458
exprt & false_case()
Definition std_expr.h:2463
if_exprt(exprt cond, exprt t, exprt f, typet type)
Definition std_expr.h:2433
exprt & true_case()
Definition std_expr.h:2453
static void check(const exprt &expr, const validation_modet vm=validation_modet::INVARIANT)
Definition std_expr.h:2473
static void validate(const exprt &expr, const namespacet &ns, const validation_modet vm=validation_modet::INVARIANT)
Definition std_expr.h:2480
Boolean implication.
Definition std_expr.h:2154
implies_exprt(exprt op0, exprt op1)
Definition std_expr.h:2156
const exprt & index() const
Definition std_expr.h:2596
index_designatort(exprt _index)
Definition std_expr.h:2591
exprt & index()
Definition std_expr.h:2601
Array index operator.
Definition std_expr.h:1431
exprt & index()
Definition std_expr.h:1471
index_exprt(exprt _array, exprt _index, typet _type)
Definition std_expr.h:1449
index_exprt(const exprt &_array, exprt _index)
Definition std_expr.h:1437
exprt & array()
Definition std_expr.h:1461
const exprt & index() const
Definition std_expr.h:1476
const exprt & array() const
Definition std_expr.h:1466
An expression denoting infinity.
Definition std_expr.h:3160
infinity_exprt(typet _type)
Definition std_expr.h:3162
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:875
less_than_exprt(exprt _lhs, exprt _rhs)
Definition std_expr.h:877
Binary less than or equal operator expression.
Definition std_expr.h:891
less_than_or_equal_exprt(exprt _lhs, exprt _rhs)
Definition std_expr.h:893
A let expression.
Definition std_expr.h:3259
binding_exprt::variablest & variables()
convenience accessor for binding().variables()
Definition std_expr.h:3340
const binding_exprt & binding() const
Definition std_expr.h:3292
const binding_exprt::variablest & variables() const
convenience accessor for binding().variables()
Definition std_expr.h:3346
operandst & values()
Definition std_expr.h:3329
let_exprt(symbol_exprt symbol, exprt value, const exprt &where)
convenience constructor for the case of a single binding
Definition std_expr.h:3279
const exprt & where() const
convenience accessor for binding().where()
Definition std_expr.h:3358
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:3306
let_exprt(binding_exprt::variablest variables, operandst values, const exprt &where)
Definition std_expr.h:3261
exprt & value()
convenience accessor for the value of a single binding
Definition std_expr.h:3314
exprt & where()
convenience accessor for binding().where()
Definition std_expr.h:3352
binding_exprt & binding()
Definition std_expr.h:3287
const operandst & values() const
Definition std_expr.h:3334
const exprt & value() const
convenience accessor for the value of a single binding
Definition std_expr.h:3322
symbol_exprt & symbol()
convenience accessor for the symbol of a single binding
Definition std_expr.h:3298
irep_idt get_component_name() const
Definition std_expr.h:2643
member_designatort(const irep_idt &_component_name)
Definition std_expr.h:2637
Extract member of struct or union.
Definition std_expr.h:2866
const exprt & compound() const
Definition std_expr.h:2915
exprt & struct_op()
Definition std_expr.h:2910
const exprt & struct_op() const
Definition std_expr.h:2904
irep_idt get_component_name() const
Definition std_expr.h:2888
void set_component_name(const irep_idt &component_name)
Definition std_expr.h:2893
exprt & compound()
Definition std_expr.h:2920
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:2925
member_exprt(exprt op, const irep_idt &component_name, typet _type)
Definition std_expr.h:2868
std::size_t get_component_number() const
Definition std_expr.h:2898
member_exprt(exprt op, const struct_typet::componentt &c)
Definition std_expr.h:2878
Binary minus.
Definition std_expr.h:1065
minus_exprt(exprt _lhs, exprt _rhs)
Definition std_expr.h:1067
Modulo defined as lhs-(rhs * truncate(lhs/rhs)).
Definition std_expr.h:1216
exprt & dividend()
The dividend of a division is the number that is being divided.
Definition std_expr.h:1224
const exprt & dividend() const
The dividend of a division is the number that is being divided.
Definition std_expr.h:1230
exprt & divisor()
The divisor of a division is the number the dividend is being divided by.
Definition std_expr.h:1236
const exprt & divisor() const
The divisor of a division is the number the dividend is being divided by.
Definition std_expr.h:1242
mod_exprt(exprt _lhs, exprt _rhs)
Definition std_expr.h:1218
Binary multiplication Associativity is not specified.
Definition std_expr.h:1104
mult_exprt(exprt::operandst factors, typet type)
Definition std_expr.h:1116
mult_exprt(exprt _lhs, exprt _rhs)
Definition std_expr.h:1106
mult_exprt(exprt::operandst factors)
Definition std_expr.h:1111
A base class for multi-ary expressions Associativity is not specified.
Definition std_expr.h:908
exprt & op1()
Definition std_expr.h:942
const exprt & op0() const
Definition std_expr.h:960
multi_ary_exprt(exprt _lhs, const irep_idt &_id, exprt _rhs, typet _type)
Definition std_expr.h:929
const exprt & op2() const
Definition std_expr.h:972
const exprt & op3() const
Definition std_expr.h:978
exprt & op0()
Definition std_expr.h:936
exprt & op2()
Definition std_expr.h:948
multi_ary_exprt(const exprt &_lhs, const irep_idt &_id, exprt _rhs)
Definition std_expr.h:924
multi_ary_exprt(const irep_idt &_id, operandst _operands, typet _type)
Definition std_expr.h:910
const exprt & op1() const
Definition std_expr.h:966
multi_ary_exprt(const irep_idt &_id, operandst _operands)
Definition std_expr.h:916
exprt & op3()
Definition std_expr.h:954
Expression that introduces a new symbol that is equal to the operand.
Definition std_expr.h:3776
named_term_exprt(symbol_exprt symbol, exprt value)
Definition std_expr.h:3778
symbol_exprt & symbol()
Definition std_expr.h:3793
const exprt & value() const
Definition std_expr.h:3798
const symbol_exprt & symbol() const
Definition std_expr.h:3788
exprt & value()
Definition std_expr.h:3803
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:2118
nand_exprt(exprt op0, exprt op1)
Definition std_expr.h:2120
nand_exprt(exprt::operandst _operands)
Definition std_expr.h:2125
The NIL expression.
Definition std_expr.h:3144
Expression to hold a nondeterministic choice.
Definition std_expr.h:295
void set_identifier(const irep_idt &identifier)
Definition std_expr.h:318
nondet_symbol_exprt(const irep_idt &identifier, typet type)
Definition std_expr.h:299
const irep_idt & get_identifier() const
Definition std_expr.h:323
nondet_symbol_exprt(irep_idt identifier, typet type, source_locationt location)
Definition std_expr.h:308
Boolean NOR.
Definition std_expr.h:2263
nor_exprt(exprt op0, exprt op1)
Definition std_expr.h:2265
nor_exprt(exprt::operandst _operands)
Definition std_expr.h:2270
Boolean negation.
Definition std_expr.h:2388
not_exprt(exprt _op)
Definition std_expr.h:2390
Disequality.
Definition std_expr.h:1393
notequal_exprt(exprt _lhs, exprt _rhs)
Definition std_expr.h:1395
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:2193
or_exprt(exprt op0, exprt op1, exprt op2)
Definition std_expr.h:2200
or_exprt(exprt::operandst _operands)
Definition std_expr.h:2216
or_exprt(exprt op0, exprt op1, exprt op2, exprt op3)
Definition std_expr.h:2208
or_exprt(exprt op0, exprt op1)
Definition std_expr.h:2195
The plus expression Associativity is not specified.
Definition std_expr.h:1006
plus_exprt(exprt _lhs, exprt _rhs, typet _type)
Definition std_expr.h:1013
plus_exprt(exprt _lhs, exprt _rhs)
Definition std_expr.h:1008
plus_exprt(operandst _operands, typet _type)
Definition std_expr.h:1027
plus_exprt(operandst _operands)
Definition std_expr.h:1022
A base class for expressions that are predicates, i.e., Boolean-typed.
Definition std_expr.h:557
predicate_exprt(const irep_idt &_id)
Definition std_expr.h:559
static void check(const exprt &expr, const validation_modet vm=validation_modet::INVARIANT)
Definition std_expr.h:564
Sign of an expression Predicate is true if _op is negative, false otherwise.
Definition std_expr.h:612
sign_exprt(exprt _op)
Definition std_expr.h:614
Struct constructor from list of elements.
Definition std_expr.h:1820
exprt & component(const irep_idt &name, const namespacet &ns)
Definition std_expr.cpp:308
struct_exprt(operandst _operands, typet _type)
Definition std_expr.h:1822
Expression to hold a symbol (variable)
Definition std_expr.h:132
void set_identifier(const irep_idt &identifier)
Definition std_expr.h:155
static symbol_exprt typeless(const irep_idt &id)
Generate a symbol_exprt without a proper type.
Definition std_expr.h:149
symbol_exprt & with_source_location(const exprt &other) &
Add the source location from other, if it has any.
Definition std_expr.h:193
symbol_exprt & with_source_location(source_locationt location) &
Add the source location from location, if it is non-nil.
Definition std_expr.h:177
symbol_exprt && with_source_location(source_locationt location) &&
Add the source location from location, if it is non-nil.
Definition std_expr.h:185
symbol_exprt && with_source_location(const exprt &other) &&
Add the source location from other, if it has any.
Definition std_expr.h:201
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:166
void identifier(const irep_idt &identifier)
Definition std_expr.h:160
const irep_idt & identifier() const
Definition std_expr.h:171
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:3126
An expression denoting a type.
Definition std_expr.h:2971
type_exprt(typet type)
Definition std_expr.h:2973
Semantic type conversion.
Definition std_expr.h:1995
static exprt conditional_cast(const exprt &expr, const typet &type)
Definition std_expr.h:2003
typecast_exprt(exprt op, typet _type)
Definition std_expr.h:1997
The type of an expression, extends irept.
Definition type.h:29
Generic base class for unary expressions.
Definition std_expr.h:364
unary_exprt(const irep_idt &_id, const exprt &_op)
Definition std_expr.h:366
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:376
const exprt & op1() const =delete
exprt & op3()=delete
const exprt & op() const
Definition std_expr.h:394
unary_exprt(const irep_idt &_id, exprt _op, typet _type)
Definition std_expr.h:371
const exprt & op2() const =delete
exprt & op()
Definition std_expr.h:399
static void validate(const exprt &expr, const namespacet &, const validation_modet vm=validation_modet::INVARIANT)
Definition std_expr.h:386
exprt & op1()=delete
The unary minus expression.
Definition std_expr.h:477
unary_minus_exprt(exprt _op)
Definition std_expr.h:484
unary_minus_exprt(exprt _op, typet _type)
Definition std_expr.h:479
The unary plus expression.
Definition std_expr.h:519
unary_plus_exprt(exprt op)
Definition std_expr.h:521
A base class for expressions that are predicates, i.e., Boolean-typed, and that take exactly one argu...
Definition std_expr.h:574
static void check(const exprt &expr, const validation_modet vm=validation_modet::INVARIANT)
Definition std_expr.h:581
unary_predicate_exprt(const irep_idt &_id, exprt _op)
Definition std_expr.h:576
Union constructor from single element.
Definition std_expr.h:1724
std::size_t get_component_number() const
Definition std_expr.h:1742
void set_component_number(std::size_t component_number)
Definition std_expr.h:1747
void set_component_name(const irep_idt &component_name)
Definition std_expr.h:1737
irep_idt get_component_name() const
Definition std_expr.h:1732
union_exprt(const irep_idt &_component_name, exprt _value, typet _type)
Definition std_expr.h:1726
Operator to update elements in structs and arrays.
Definition std_expr.h:2679
exprt & old()
Definition std_expr.h:2691
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:2705
exprt & new_value()
Definition std_expr.h:2715
static void validate(const exprt &expr, const namespacet &ns, const validation_modet vm=validation_modet::INVARIANT)
Definition std_expr.h:2735
const exprt & new_value() const
Definition std_expr.h:2720
update_exprt(const exprt &_old, exprt _designator, exprt _new_value)
Definition std_expr.h:2681
static void check(const exprt &expr, const validation_modet vm=validation_modet::INVARIANT)
Definition std_expr.h:2728
const exprt & old() const
Definition std_expr.h:2696
const exprt::operandst & designator() const
Definition std_expr.h:2710
Vector constructor from list of elements.
Definition std_expr.h:1686
vector_exprt(operandst _operands, vector_typet _type)
Definition std_expr.h:1688
The vector type.
Definition std_types.h:954
Operator to update elements in structs and arrays.
Definition std_expr.h:2520
const exprt & old() const
Definition std_expr.h:2535
const exprt & where() const
Definition std_expr.h:2545
exprt & new_value()
Definition std_expr.h:2550
exprt & where()
Definition std_expr.h:2540
with_exprt(const exprt &_old, exprt _where, exprt _new_value)
Definition std_expr.h:2522
const exprt & new_value() const
Definition std_expr.h:2555
exprt & old()
Definition std_expr.h:2530
Boolean XNOR.
Definition std_expr.h:2346
xnor_exprt(exprt::operandst _operands)
Definition std_expr.h:2353
xnor_exprt(exprt _op0, exprt _op1)
Definition std_expr.h:2348
Boolean XOR All operands must be boolean, and the result is always boolean.
Definition std_expr.h:2300
xor_exprt(exprt _op0, exprt _op1)
Definition std_expr.h:2302
xor_exprt(exprt::operandst _operands)
Definition std_expr.h:2307
#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:1364
bool can_cast_expr< notequal_exprt >(const exprt &base)
Definition std_expr.h:1402
bool can_cast_expr< complex_exprt >(const exprt &base)
Definition std_expr.h:1892
bool can_cast_expr< not_exprt >(const exprt &base)
Definition std_expr.h:2397
const struct_exprt & to_struct_expr(const exprt &expr)
Cast an exprt to a struct_exprt.
Definition std_expr.h:1843
const array_list_exprt & to_array_list_expr(const exprt &expr)
Definition std_expr.h:1670
bool can_cast_expr< typecast_exprt >(const exprt &base)
Definition std_expr.h:2013
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:2990
const array_of_exprt & to_array_of_expr(const exprt &expr)
Cast an exprt to an array_of_exprt.
Definition std_expr.h:1552
bool can_cast_expr< struct_exprt >(const exprt &base)
Definition std_expr.h:1832
const binary_relation_exprt & to_binary_relation_expr(const exprt &expr)
Cast an exprt to a binary_relation_exprt.
Definition std_expr.h:828
const unary_plus_exprt & to_unary_plus_expr(const exprt &expr)
Cast an exprt to a unary_plus_exprt.
Definition std_expr.h:539
bool can_cast_expr< xor_exprt >(const exprt &base)
Definition std_expr.h:2314
const index_exprt & to_index_expr(const exprt &expr)
Cast an exprt to an index_exprt.
Definition std_expr.h:1494
bool can_cast_expr< mult_exprt >(const exprt &base)
Definition std_expr.h:1123
bool can_cast_expr< if_exprt >(const exprt &base)
Definition std_expr.h:2490
const binary_predicate_exprt & to_binary_predicate_expr(const exprt &expr)
Cast an exprt to a binary_predicate_exprt.
Definition std_expr.h:768
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:3757
bool can_cast_expr< named_term_exprt >(const exprt &base)
Definition std_expr.h:3810
bool can_cast_expr< binding_exprt >(const exprt &base)
Definition std_expr.h:3221
const mod_exprt & to_mod_expr(const exprt &expr)
Cast an exprt to a mod_exprt.
Definition std_expr.h:1260
const mult_exprt & to_mult_expr(const exprt &expr)
Cast an exprt to a mult_exprt.
Definition std_expr.h:1134
const and_exprt & to_and_expr(const exprt &expr)
Cast an exprt to a and_exprt.
Definition std_expr.h:2095
bool can_cast_expr< member_designatort >(const exprt &base)
Definition std_expr.h:2650
const array_comprehension_exprt & to_array_comprehension_expr(const exprt &expr)
Cast an exprt to a array_comprehension_exprt.
Definition std_expr.h:3648
const 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:3821
const xnor_exprt & to_xnor_expr(const exprt &expr)
Cast an exprt to a xnor_exprt.
Definition std_expr.h:2371
bool can_cast_expr< xnor_exprt >(const exprt &base)
Definition std_expr.h:2360
bool can_cast_expr< array_comprehension_exprt >(const exprt &base)
Definition std_expr.h:3636
const xor_exprt & to_xor_expr(const exprt &expr)
Cast an exprt to a xor_exprt.
Definition std_expr.h:2325
const or_exprt & to_or_expr(const exprt &expr)
Cast an exprt to a or_exprt.
Definition std_expr.h:2240
const array_exprt & to_array_expr(const exprt &expr)
Cast an exprt to an array_exprt.
Definition std_expr.h:1614
bool can_cast_expr< complex_imag_exprt >(const exprt &base)
Definition std_expr.h:1966
bool can_cast_expr< abs_exprt >(const exprt &base)
Definition std_expr.h:448
bool can_cast_expr< sign_exprt >(const exprt &base)
Definition std_expr.h:621
const unary_predicate_exprt & to_unary_predicate_expr(const exprt &expr)
Cast an exprt to a unary_predicate_exprt.
Definition std_expr.h:596
const cond_exprt & to_cond_expr(const exprt &expr)
Cast an exprt to a cond_exprt.
Definition std_expr.h:3443
bool can_cast_expr< type_exprt >(const exprt &base)
Definition std_expr.h:2979
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:3765
const typecast_exprt & to_typecast_expr(const exprt &expr)
Cast an exprt to a typecast_exprt.
Definition std_expr.h:2024
const div_exprt & to_div_expr(const exprt &expr)
Cast an exprt to a div_exprt.
Definition std_expr.h:1196
bool can_cast_expr< unary_minus_exprt >(const exprt &base)
Definition std_expr.h:491
bool can_cast_expr< less_than_exprt >(const exprt &base)
Definition std_expr.h:884
bool can_cast_expr< with_exprt >(const exprt &base)
Definition std_expr.h:2562
const vector_exprt & to_vector_expr(const exprt &expr)
Cast an exprt to an vector_exprt.
Definition std_expr.h:1706
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:1074
bool can_cast_expr< let_exprt >(const exprt &base)
Definition std_expr.h:3367
const binary_exprt & to_binary_expr(const exprt &expr)
Cast an exprt to a binary_exprt.
Definition std_expr.h:721
const plus_exprt & to_plus_expr(const exprt &expr)
Cast an exprt to a plus_exprt.
Definition std_expr.h:1045
const notequal_exprt & to_notequal_expr(const exprt &expr)
Cast an exprt to an notequal_exprt.
Definition std_expr.h:1413
bool can_cast_expr< plus_exprt >(const exprt &base)
Definition std_expr.h:1034
const nand_exprt & to_nand_expr(const exprt &expr)
Cast an exprt to a nand_exprt.
Definition std_expr.h:2137
const unary_exprt & to_unary_expr(const exprt &expr)
Cast an exprt to a unary_exprt.
Definition std_expr.h:424
const multi_ary_exprt & to_multi_ary_expr(const exprt &expr)
Cast an exprt to a multi_ary_exprt.
Definition std_expr.h:991
bool can_cast_expr< array_of_exprt >(const exprt &base)
Definition std_expr.h:1541
const let_exprt & to_let_expr(const exprt &expr)
Cast an exprt to a let_exprt.
Definition std_expr.h:3383
const abs_exprt & to_abs_expr(const exprt &expr)
Cast an exprt to a abs_exprt.
Definition std_expr.h:459
bool can_cast_expr< nondet_symbol_exprt >(const exprt &base)
Definition std_expr.h:330
bool can_cast_expr< case_exprt >(const exprt &base)
Definition std_expr.h:3551
bool can_cast_expr< constant_exprt >(const exprt &base)
Definition std_expr.h:3062
const if_exprt & to_if_expr(const exprt &expr)
Cast an exprt to an if_exprt.
Definition std_expr.h:2501
const member_exprt & to_member_expr(const exprt &expr)
Cast an exprt to a member_exprt.
Definition std_expr.h:2953
void validate_expr(const nondet_symbol_exprt &value)
Definition std_expr.h:335
bool can_cast_expr< index_exprt >(const exprt &base)
Definition std_expr.h:1483
bool can_cast_expr< symbol_exprt >(const exprt &base)
Definition std_expr.h:210
const empty_union_exprt & to_empty_union_expr(const exprt &expr)
Cast an exprt to an empty_union_exprt.
Definition std_expr.h:1803
const minus_exprt & to_minus_expr(const exprt &expr)
Cast an exprt to a minus_exprt.
Definition std_expr.h:1085
bool can_cast_expr< member_exprt >(const exprt &base)
Definition std_expr.h:2942
bool can_cast_expr< empty_union_exprt >(const exprt &base)
Definition std_expr.h:1792
const complex_imag_exprt & to_complex_imag_expr(const exprt &expr)
Cast an exprt to a complex_imag_exprt.
Definition std_expr.h:1977
const binding_exprt & to_binding_expr(const exprt &expr)
Cast an exprt to a binding_exprt.
Definition std_expr.h:3233
bool can_cast_expr< or_exprt >(const exprt &base)
Definition std_expr.h:2229
bool can_cast_expr< mod_exprt >(const exprt &base)
Definition std_expr.h:1249
const index_designatort & to_index_designator(const exprt &expr)
Cast an exprt to an index_designatort.
Definition std_expr.h:2619
const union_exprt & to_union_expr(const exprt &expr)
Cast an exprt to a union_exprt.
Definition std_expr.h:1765
bool can_cast_expr< cond_exprt >(const exprt &base)
Definition std_expr.h:3426
const complex_real_exprt & to_complex_real_expr(const exprt &expr)
Cast an exprt to a complex_real_exprt.
Definition std_expr.h:1940
bool can_cast_expr< update_exprt >(const exprt &base)
Definition std_expr.h:2745
bool can_cast_expr< binary_relation_exprt >(const exprt &base)
Definition std_expr.h:817
bool can_cast_expr< euclidean_mod_exprt >(const exprt &base)
Definition std_expr.h:1310
bool can_cast_expr< vector_exprt >(const exprt &base)
Definition std_expr.h:1695
const case_exprt & to_case_expr(const exprt &expr)
Cast an exprt to a case_exprt.
Definition std_expr.h:3562
const constant_exprt & to_constant_expr(const exprt &expr)
Cast an exprt to a constant_exprt.
Definition std_expr.h:3078
bool can_cast_expr< array_list_exprt >(const exprt &base)
Definition std_expr.h:1665
bool can_cast_expr< index_designatort >(const exprt &base)
Definition std_expr.h:2608
const not_exprt & to_not_expr(const exprt &expr)
Cast an exprt to an not_exprt.
Definition std_expr.h:2408
const symbol_exprt & to_symbol_expr(const exprt &expr)
Cast an exprt to a symbol_exprt.
Definition std_expr.h:221
const with_exprt & to_with_expr(const exprt &expr)
Cast an exprt to a with_exprt.
Definition std_expr.h:2573
const complex_exprt & to_complex_expr(const exprt &expr)
Cast an exprt to a complex_exprt.
Definition std_expr.h:1903
bool can_cast_expr< unary_plus_exprt >(const exprt &base)
Definition std_expr.h:528
bool can_cast_expr< and_exprt >(const exprt &base)
Definition std_expr.h:2084
bool can_cast_expr< greater_than_exprt >(const exprt &base)
Definition std_expr.h:852
const implies_exprt & to_implies_expr(const exprt &expr)
Cast an exprt to a implies_exprt.
Definition std_expr.h:2174
bool can_cast_expr< array_exprt >(const exprt &base)
Definition std_expr.h:1603
bool can_cast_expr< binary_exprt >(const exprt &base)
Definition std_expr.h:710
bool can_cast_expr< div_exprt >(const exprt &base)
Definition std_expr.h:1185
const update_exprt & to_update_expr(const exprt &expr)
Cast an exprt to an update_exprt.
Definition std_expr.h:2762
bool can_cast_expr< nil_exprt >(const exprt &base)
Definition std_expr.h:3153
const unary_minus_exprt & to_unary_minus_expr(const exprt &expr)
Cast an exprt to a unary_minus_exprt.
Definition std_expr.h:502
const equal_exprt & to_equal_expr(const exprt &expr)
Cast an exprt to an equal_exprt.
Definition std_expr.h:1375
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:868
bool can_cast_expr< implies_exprt >(const exprt &base)
Definition std_expr.h:2163
bool can_cast_expr< unary_exprt >(const exprt &base)
Definition std_expr.h:413
bool can_cast_expr< less_than_or_equal_exprt >(const exprt &base)
Definition std_expr.h:900
const nondet_symbol_exprt & to_nondet_symbol_expr(const exprt &expr)
Cast an exprt to a nondet_symbol_exprt.
Definition std_expr.h:346
bool can_cast_expr< union_exprt >(const exprt &base)
Definition std_expr.h:1754
const member_designatort & to_member_designator(const exprt &expr)
Cast an exprt to an member_designatort.
Definition std_expr.h:2661
bool can_cast_expr< complex_real_exprt >(const exprt &base)
Definition std_expr.h:1929
const sign_exprt & to_sign_expr(const exprt &expr)
Cast an exprt to a sign_exprt.
Definition std_expr.h:632
const nor_exprt & to_nor_expr(const exprt &expr)
Cast an exprt to a nor_exprt.
Definition std_expr.h:2282
const euclidean_mod_exprt & to_euclidean_mod_expr(const exprt &expr)
Cast an exprt to a euclidean_mod_exprt.
Definition std_expr.h:1321
Pre-defined types.
const complex_typet & to_complex_type(const typet &type)
Cast a typet to a complex_typet.
Definition std_types.h:1048
size_t operator()(const ::symbol_exprt &sym)
Definition std_expr.h:243
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