@@ -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)
@@ -1048,11 +1054,17 @@ exprt variable_encoding(exprt src, const binding_exprt::variablest &variables)
1048
1054
{
1049
1055
auto &forall_expr = to_forall_expr (src);
1050
1056
if (
1051
- forall_expr.variables ().size () = = 1 &&
1052
- forall_expr.symbol ().type ().id () == ID_state)
1057
+ forall_expr.variables ().size () > = 1 &&
1058
+ forall_expr.variables (). front ().type ().id () == ID_state)
1053
1059
{
1060
+ // replace 'state' by the program variables
1061
+ forall_exprt::variablest new_variables = variables;
1062
+ new_variables.insert (
1063
+ new_variables.end (),
1064
+ forall_expr.variables ().begin () + 1 ,
1065
+ forall_expr.variables ().end ());
1054
1066
forall_expr
1055
- .variables () = variables ;
1067
+ .variables () = std::move (new_variables) ;
1056
1068
return std::move (forall_expr);
1057
1069
}
1058
1070
}
0 commit comments