File tree Expand file tree Collapse file tree 1 file changed +22
-6
lines changed Expand file tree Collapse file tree 1 file changed +22
-6
lines changed Original file line number Diff line number Diff line change @@ -744,6 +744,14 @@ literalt smt2_convt::convert(const exprt &expr)
744
744
no_boolean_variables++;
745
745
746
746
out << " ; convert\n " ;
747
+ out << " ; Converting var_no " << l.var_no () << " with expr ID of "
748
+ << expr.id_string () << " \n " ;
749
+ // We're converting the expression, so store it in the defined_expressions
750
+ // store and in future we use the literal instead of the whole expression
751
+ // Note that here we are always converting, so we do not need to consider
752
+ // other literal kinds, only "|B###|"
753
+ defined_expressions[expr] =
754
+ std::string{" |B" } + std::to_string (l.var_no ()) + " |" ;
747
755
out << " (define-fun " ;
748
756
convert_literal (l);
749
757
out << " () Bool " ;
@@ -4332,18 +4340,26 @@ void smt2_convt::set_to(const exprt &expr, bool value)
4332
4340
4333
4341
out << " ; set_to " << (value?" true" :" false" ) << " \n "
4334
4342
<< " (assert " ;
4335
-
4336
4343
if (!value)
4337
4344
{
4338
4345
out << " (not " ;
4339
- convert_expr (prepared_expr);
4340
- out << " )" ;
4346
+ }
4347
+ const auto found_literal = defined_expressions.find (expr);
4348
+ if (!(found_literal == defined_expressions.end ()))
4349
+ {
4350
+ // This is a converted expression, we can just assert the literal name
4351
+ // since the expression is already defined
4352
+ out << found_literal->second ;
4341
4353
}
4342
4354
else
4355
+ {
4343
4356
convert_expr (prepared_expr);
4344
-
4345
- out << " )" << " \n " ; // assert
4346
-
4357
+ }
4358
+ if (!value)
4359
+ {
4360
+ out << " )" ;
4361
+ }
4362
+ out << " )\n " ;
4347
4363
return ;
4348
4364
}
4349
4365
You can’t perform that action at this time.
0 commit comments