@@ -287,40 +287,41 @@ static smt_termt convert_relational_to_smt(
287
287
binary_relation.pretty ());
288
288
}
289
289
290
- static smt_termt
291
- convert_expr_to_smt (const binary_relation_exprt &binary_relation)
290
+ static optionalt<smt_termt> try_relational_conversion (const exprt &expr)
292
291
{
293
- if (can_cast_expr <greater_than_exprt>(binary_relation ))
292
+ if (const auto greater_than = expr_try_dynamic_cast <greater_than_exprt>(expr ))
294
293
{
295
294
return convert_relational_to_smt (
296
- binary_relation ,
295
+ *greater_than ,
297
296
smt_bit_vector_theoryt::unsigned_greater_than,
298
297
smt_bit_vector_theoryt::signed_greater_than);
299
298
}
300
- if (can_cast_expr<greater_than_or_equal_exprt>(binary_relation))
299
+ if (
300
+ const auto greater_than_or_equal =
301
+ expr_try_dynamic_cast<greater_than_or_equal_exprt>(expr))
301
302
{
302
303
return convert_relational_to_smt (
303
- binary_relation ,
304
+ *greater_than_or_equal ,
304
305
smt_bit_vector_theoryt::unsigned_greater_than_or_equal,
305
306
smt_bit_vector_theoryt::signed_greater_than_or_equal);
306
307
}
307
- if (can_cast_expr <less_than_exprt>(binary_relation ))
308
+ if (const auto less_than = expr_try_dynamic_cast <less_than_exprt>(expr ))
308
309
{
309
310
return convert_relational_to_smt (
310
- binary_relation ,
311
+ *less_than ,
311
312
smt_bit_vector_theoryt::unsigned_less_than,
312
313
smt_bit_vector_theoryt::signed_less_than);
313
314
}
314
- if (can_cast_expr<less_than_or_equal_exprt>(binary_relation))
315
+ if (
316
+ const auto less_than_or_equal =
317
+ expr_try_dynamic_cast<less_than_or_equal_exprt>(expr))
315
318
{
316
319
return convert_relational_to_smt (
317
- binary_relation ,
320
+ *less_than_or_equal ,
318
321
smt_bit_vector_theoryt::unsigned_less_than_or_equal,
319
322
smt_bit_vector_theoryt::signed_less_than_or_equal);
320
323
}
321
- UNIMPLEMENTED_FEATURE (
322
- " Generation of SMT formula for binary relation expression: " +
323
- binary_relation.pretty ());
324
+ return {};
324
325
}
325
326
326
327
static smt_termt convert_expr_to_smt (const plus_exprt &plus)
@@ -686,11 +687,9 @@ smt_termt convert_expr_to_smt(const exprt &expr)
686
687
{
687
688
return convert_expr_to_smt (*float_not_equal);
688
689
}
689
- if (
690
- const auto binary_relation =
691
- expr_try_dynamic_cast<binary_relation_exprt>(expr))
690
+ if (const auto converted_relational = try_relational_conversion (expr))
692
691
{
693
- return convert_expr_to_smt (*binary_relation) ;
692
+ return *converted_relational ;
694
693
}
695
694
if (const auto plus = expr_try_dynamic_cast<plus_exprt>(expr))
696
695
{
0 commit comments