Skip to content

Commit b54448c

Browse files
authored
Merge pull request #4310 from smowton/smowton/fix/symex-exist-quant
Symex: clean up quantifier rewriting
2 parents 83d0f61 + 9891174 commit b54448c

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

src/goto-symex/symex_main.cpp

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -83,13 +83,14 @@ void goto_symext::symex_assert(
8383
exprt condition = instruction.get_condition();
8484
clean_expr(condition, state, false);
8585

86-
// we are willing to re-write some quantified expressions
86+
// First, push negations in and perhaps convert existential quantifiers into
87+
// universals:
8788
if(has_subexpr(condition, ID_exists) || has_subexpr(condition, ID_forall))
88-
{
89-
// have negation pushed inwards as far as possible
9089
do_simplify(condition);
90+
91+
// Second, L2-rename universal quantifiers:
92+
if(has_subexpr(condition, ID_forall))
9193
rewrite_quantifiers(condition, state);
92-
}
9394

9495
// now rename, enables propagation
9596
exprt l2_condition = state.rename(std::move(condition), ns);
@@ -139,12 +140,13 @@ void goto_symext::symex_assume_l2(statet &state, const exprt &cond)
139140
return;
140141

141142
// 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);
144146

145147
if(state.threads.size()==1)
146148
{
147-
exprt tmp = cond;
149+
exprt tmp = rewritten_cond;
148150
state.guard.guard_expr(tmp);
149151
target.assumption(state.guard.as_expr(), tmp, state.source);
150152
}
@@ -155,7 +157,7 @@ void goto_symext::symex_assume_l2(statet &state, const exprt &cond)
155157
// x=0; assume(x==1);
156158
// assert(x!=42); x=42;
157159
else
158-
state.guard.add(cond);
160+
state.guard.add(rewritten_cond);
159161

160162
if(state.atomic_section_id!=0 &&
161163
state.guard.is_false())

0 commit comments

Comments
 (0)