@@ -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
// / \brief Application of (mathematical) function
190
193
class function_application_exprt : public binary_exprt
191
194
{
@@ -222,6 +225,17 @@ class function_application_exprt : public binary_exprt
222
225
}
223
226
};
224
227
228
+ template <>
229
+ inline bool can_cast_expr<function_application_exprt>(const exprt &base)
230
+ {
231
+ return base.id () == ID_function_application;
232
+ }
233
+
234
+ inline void validate_expr (const function_application_exprt &value)
235
+ {
236
+ validate_operands (value, 2 , " Function application must have two operands" );
237
+ }
238
+
225
239
// / \brief Cast an exprt to a \ref function_application_exprt
226
240
// /
227
241
// / \a expr must be known to be \ref function_application_exprt.
@@ -246,16 +260,6 @@ inline function_application_exprt &to_function_application_expr(exprt &expr)
246
260
return static_cast <function_application_exprt &>(expr);
247
261
}
248
262
249
- template <>
250
- inline bool can_cast_expr<function_application_exprt>(const exprt &base)
251
- {
252
- return base.id () == ID_function_application;
253
- }
254
- inline void validate_expr (const function_application_exprt &value)
255
- {
256
- validate_operands (value, 2 , " Function application must have two operands" );
257
- }
258
-
259
263
// / \brief A base class for quantifier expressions
260
264
class quantifier_exprt : public binary_predicate_exprt
261
265
{
@@ -289,6 +293,17 @@ class quantifier_exprt : public binary_predicate_exprt
289
293
}
290
294
};
291
295
296
+ template <>
297
+ inline bool can_cast_expr<quantifier_exprt>(const exprt &base)
298
+ {
299
+ return base.id () == ID_forall || base.id () == ID_exists;
300
+ }
301
+
302
+ inline void validate_expr (const quantifier_exprt &value)
303
+ {
304
+ validate_operands (value, 2 , " quantifier expressions must have two operands" );
305
+ }
306
+
292
307
// / \brief Cast an exprt to a \ref quantifier_exprt
293
308
// /
294
309
// / \a expr must be known to be \ref quantifier_exprt.
@@ -316,17 +331,6 @@ inline quantifier_exprt &to_quantifier_expr(exprt &expr)
316
331
return static_cast <quantifier_exprt &>(expr);
317
332
}
318
333
319
- template <>
320
- inline bool can_cast_expr<quantifier_exprt>(const exprt &base)
321
- {
322
- return base.id () == ID_forall || base.id () == ID_exists;
323
- }
324
-
325
- inline void validate_expr (const quantifier_exprt &value)
326
- {
327
- validate_operands (value, 2 , " quantifier expressions must have two operands" );
328
- }
329
-
330
334
// / \brief A forall expression
331
335
class forall_exprt : public quantifier_exprt
332
336
{
0 commit comments