@@ -83,13 +83,14 @@ void goto_symext::symex_assert(
83
83
exprt condition = instruction.get_condition ();
84
84
clean_expr (condition, state, false );
85
85
86
- // we are willing to re-write some quantified expressions
86
+ // First, push negations in and perhaps convert existential quantifiers into
87
+ // universals:
87
88
if (has_subexpr (condition, ID_exists) || has_subexpr (condition, ID_forall))
88
- {
89
- // have negation pushed inwards as far as possible
90
89
do_simplify (condition);
90
+
91
+ // Second, L2-rename universal quantifiers:
92
+ if (has_subexpr (condition, ID_forall))
91
93
rewrite_quantifiers (condition, state);
92
- }
93
94
94
95
// now rename, enables propagation
95
96
exprt l2_condition = state.rename (std::move (condition), ns);
@@ -139,12 +140,13 @@ void goto_symext::symex_assume_l2(statet &state, const exprt &cond)
139
140
return ;
140
141
141
142
// we are willing to re-write some quantified expressions
142
- if (has_subexpr (simplified_cond, ID_exists))
143
- rewrite_quantifiers (simplified_cond, state);
143
+ exprt rewritten_cond = cond;
144
+ if (has_subexpr (rewritten_cond, ID_exists))
145
+ rewrite_quantifiers (rewritten_cond, state);
144
146
145
147
if (state.threads .size ()==1 )
146
148
{
147
- exprt tmp = cond ;
149
+ exprt tmp = rewritten_cond ;
148
150
state.guard .guard_expr (tmp);
149
151
target.assumption (state.guard .as_expr (), tmp, state.source );
150
152
}
@@ -155,7 +157,7 @@ void goto_symext::symex_assume_l2(statet &state, const exprt &cond)
155
157
// x=0; assume(x==1);
156
158
// assert(x!=42); x=42;
157
159
else
158
- state.guard .add (cond );
160
+ state.guard .add (rewritten_cond );
159
161
160
162
if (state.atomic_section_id !=0 &&
161
163
state.guard .is_false ())
0 commit comments