@@ -61,6 +61,17 @@ class transt : public ternary_exprt
61
61
}
62
62
};
63
63
64
+ template <>
65
+ inline bool can_cast_expr<transt>(const exprt &base)
66
+ {
67
+ return base.id () == ID_trans;
68
+ }
69
+
70
+ inline void validate_expr (const transt &value)
71
+ {
72
+ validate_operands (value, 3 , " Transition systems must have three operands" );
73
+ }
74
+
64
75
// / Cast an exprt to a \ref transt
65
76
// / \a expr must be known to be \ref transt.
66
77
// / \param expr: Source expression
@@ -82,16 +93,6 @@ inline transt &to_trans_expr(exprt &expr)
82
93
return static_cast <transt &>(expr);
83
94
}
84
95
85
- template <>
86
- inline bool can_cast_expr<transt>(const exprt &base)
87
- {
88
- return base.id () == ID_trans;
89
- }
90
- inline void validate_expr (const transt &value)
91
- {
92
- validate_operands (value, 3 , " Transition systems must have three operands" );
93
- }
94
-
95
96
// / \brief Exponentiation
96
97
class power_exprt : public binary_exprt
97
98
{
@@ -107,6 +108,17 @@ class power_exprt : public binary_exprt
107
108
}
108
109
};
109
110
111
+ template <>
112
+ inline bool can_cast_expr<power_exprt>(const exprt &base)
113
+ {
114
+ return base.id () == ID_power;
115
+ }
116
+
117
+ inline void validate_expr (const power_exprt &value)
118
+ {
119
+ validate_operands (value, 2 , " Power must have two operands" );
120
+ }
121
+
110
122
// / \brief Cast an exprt to a \ref power_exprt
111
123
// /
112
124
// / \a expr must be known to be \ref power_exprt.
@@ -128,16 +140,6 @@ inline power_exprt &to_power_expr(exprt &expr)
128
140
return static_cast <power_exprt &>(expr);
129
141
}
130
142
131
- template <>
132
- inline bool can_cast_expr<power_exprt>(const exprt &base)
133
- {
134
- return base.id () == ID_power;
135
- }
136
- inline void validate_expr (const power_exprt &value)
137
- {
138
- validate_operands (value, 2 , " Power must have two operands" );
139
- }
140
-
141
143
// / \brief Falling factorial power
142
144
class factorial_power_exprt : public binary_exprt
143
145
{
@@ -153,6 +155,17 @@ class factorial_power_exprt : public binary_exprt
153
155
}
154
156
};
155
157
158
+ template <>
159
+ inline bool can_cast_expr<factorial_power_exprt>(const exprt &base)
160
+ {
161
+ return base.id () == ID_factorial_power;
162
+ }
163
+
164
+ inline void validate_expr (const factorial_power_exprt &value)
165
+ {
166
+ validate_operands (value, 2 , " Factorial power must have two operands" );
167
+ }
168
+
156
169
// / \brief Cast an exprt to a \ref factorial_power_exprt
157
170
// /
158
171
// / \a expr must be known to be \ref factorial_power_exprt.
@@ -176,16 +189,6 @@ inline factorial_power_exprt &to_factorial_expr(exprt &expr)
176
189
return static_cast <factorial_power_exprt &>(expr);
177
190
}
178
191
179
- template <>
180
- inline bool can_cast_expr<factorial_power_exprt>(const exprt &base)
181
- {
182
- return base.id () == ID_factorial_power;
183
- }
184
- inline void validate_expr (const factorial_power_exprt &value)
185
- {
186
- validate_operands (value, 2 , " Factorial power must have two operands" );
187
- }
188
-
189
192
class tuple_exprt : public multi_ary_exprt
190
193
{
191
194
public:
@@ -239,6 +242,17 @@ class function_application_exprt : public binary_exprt
239
242
}
240
243
};
241
244
245
+ template <>
246
+ inline bool can_cast_expr<function_application_exprt>(const exprt &base)
247
+ {
248
+ return base.id () == ID_function_application;
249
+ }
250
+
251
+ inline void validate_expr (const function_application_exprt &value)
252
+ {
253
+ validate_operands (value, 2 , " Function application must have two operands" );
254
+ }
255
+
242
256
// / \brief Cast an exprt to a \ref function_application_exprt
243
257
// /
244
258
// / \a expr must be known to be \ref function_application_exprt.
@@ -263,16 +277,6 @@ inline function_application_exprt &to_function_application_expr(exprt &expr)
263
277
return static_cast <function_application_exprt &>(expr);
264
278
}
265
279
266
- template <>
267
- inline bool can_cast_expr<function_application_exprt>(const exprt &base)
268
- {
269
- return base.id () == ID_function_application;
270
- }
271
- inline void validate_expr (const function_application_exprt &value)
272
- {
273
- validate_operands (value, 2 , " Function application must have two operands" );
274
- }
275
-
276
280
// / \brief A base class for quantifier expressions
277
281
class quantifier_exprt : public binary_predicate_exprt
278
282
{
@@ -306,6 +310,17 @@ class quantifier_exprt : public binary_predicate_exprt
306
310
}
307
311
};
308
312
313
+ template <>
314
+ inline bool can_cast_expr<quantifier_exprt>(const exprt &base)
315
+ {
316
+ return base.id () == ID_forall || base.id () == ID_exists;
317
+ }
318
+
319
+ inline void validate_expr (const quantifier_exprt &value)
320
+ {
321
+ validate_operands (value, 2 , " quantifier expressions must have two operands" );
322
+ }
323
+
309
324
// / \brief Cast an exprt to a \ref quantifier_exprt
310
325
// /
311
326
// / \a expr must be known to be \ref quantifier_exprt.
@@ -333,17 +348,6 @@ inline quantifier_exprt &to_quantifier_expr(exprt &expr)
333
348
return static_cast <quantifier_exprt &>(expr);
334
349
}
335
350
336
- template <>
337
- inline bool can_cast_expr<quantifier_exprt>(const exprt &base)
338
- {
339
- return base.id () == ID_forall || base.id () == ID_exists;
340
- }
341
-
342
- inline void validate_expr (const quantifier_exprt &value)
343
- {
344
- validate_operands (value, 2 , " quantifier expressions must have two operands" );
345
- }
346
-
347
351
// / \brief A forall expression
348
352
class forall_exprt : public quantifier_exprt
349
353
{
0 commit comments