@@ -663,8 +663,14 @@ exprt state_encodingt::assignment_constraint(loct loc, exprt lhs, exprt rhs)
663
663
664
664
auto new_state = update_state_exprt (s, address, new_value);
665
665
666
- return forall_states_expr (
667
- loc, function_application_exprt (out_state_expr (loc), {new_state}));
666
+ forall_exprt::variablest binding = {state_expr ()};
667
+ binding.insert (binding.end (), nondet_symbols.begin (), nondet_symbols.end ());
668
+
669
+ return forall_exprt (
670
+ std::move (binding),
671
+ implies_exprt (
672
+ function_application_exprt (in_state_expr (loc), {state_expr ()}),
673
+ function_application_exprt (out_state_expr (loc), {new_state})));
668
674
}
669
675
670
676
void state_encodingt::setup_incoming (const goto_functiont &goto_function)
@@ -1042,11 +1048,17 @@ exprt variable_encoding(exprt src, const binding_exprt::variablest &variables)
1042
1048
{
1043
1049
auto &forall_expr = to_forall_expr (src);
1044
1050
if (
1045
- forall_expr.variables ().size () = = 1 &&
1046
- forall_expr.symbol ().type ().id () == ID_state)
1051
+ forall_expr.variables ().size () > = 1 &&
1052
+ forall_expr.variables (). front ().type ().id () == ID_state)
1047
1053
{
1054
+ // replace 'state' by the program variables
1055
+ forall_exprt::variablest new_variables = variables;
1056
+ new_variables.insert (
1057
+ new_variables.end (),
1058
+ forall_expr.variables ().begin () + 1 ,
1059
+ forall_expr.variables ().end ());
1048
1060
forall_expr
1049
- .variables () = variables ;
1061
+ .variables () = std::move (new_variables) ;
1050
1062
return std::move (forall_expr);
1051
1063
}
1052
1064
}
0 commit comments