Skip to content

Commit 6a9f2e5

Browse files
authored
Merge pull request #734 from diffblue/fix-R
BMC: fix encoding of `p R q`
2 parents 78bb686 + bc87cd1 commit 6a9f2e5

File tree

5 files changed

+14
-29
lines changed

5 files changed

+14
-29
lines changed

regression/ebmc/smv/smv_ltlspec_R1.desc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ CORE broken-smt-backend
22
smv_ltlspec_R1.smv
33
--bound 10
44
^\[.*\] x >= 1 R x = 1: PROVED up to bound 10$
5-
^\[.*\] FALSE R x != 4: REFUTED$
5+
^\[.*\] FALSE R x != 4: PROVED up to bound 10$
66
^\[.*\] x = 2 R x = 1: REFUTED$
7-
^\[.*\] x >= 1 R x = 1 & FALSE R x != 4: REFUTED$
7+
^\[.*\] x >= 1 R x = 1 & FALSE R x != 4: PROVED up to bound 10$
88
^\[.*\] x = 2 R x = 1 & x >= 1 R x = 1: REFUTED$
99
^\[.*\] x = 2 R x = 1 \| x >= 1 R x = 1: PROVED up to bound 10$
1010
^EXIT=10$

regression/ebmc/smv/smv_ltlspec_R2.desc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ KNOWNBUG broken-smt-backend
22
smv_ltlspec_R2.smv
33
--bound 10
44
^\[.*\] FALSE R x != 3: REFUTED$
5-
^Counterexample with 4 states:$
5+
^Counterexample with 3 states:$
66
^x@0 = 1$
77
^x@1 = 2$
88
^x@2 = 3$
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
KNOWNBUG broken-smt-backend
1+
CORE broken-smt-backend
22
smv_ltlspec_R3.smv
33
--bound 1
44
^\[.*\] FALSE R x != 3: PROVED up to bound 1$
@@ -7,4 +7,3 @@ smv_ltlspec_R3.smv
77
--
88
^warning: ignoring
99
--
10-
The counterexample is wrong.
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
KNOWNBUG broken-smt-backend
1+
CORE broken-smt-backend
22
smv_ltlspec_R4.smv
33
--bound 10
44
^\[.*\] FALSE R x != 0: PROVED up to bound 10$
@@ -7,4 +7,3 @@ smv_ltlspec_R4.smv
77
--
88
^warning: ignoring
99
--
10-
Property fails.

src/trans-word-level/property.cpp

Lines changed: 9 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -405,30 +405,17 @@ static obligationst property_obligations_rec(
405405
{
406406
// we expand: p R q <=> q ∧ (p ∨ X(p R q))
407407
auto &R_expr = to_R_expr(property_expr);
408-
auto tmp_q =
409-
property_obligations_rec(R_expr.rhs(), solver, current, no_timeframes, ns)
410-
.conjunction()
411-
.second;
408+
auto &p = R_expr.lhs();
409+
auto &q = R_expr.rhs();
412410

413-
auto tmp_p =
414-
property_obligations_rec(R_expr.lhs(), solver, current, no_timeframes, ns)
415-
.conjunction()
416-
.second;
411+
// Once we reach the end of the unwinding, we replace X(p R q) by
412+
// true, and hence the expansion becomes "q" only.
413+
exprt expansion = (current + 1) < no_timeframes
414+
? and_exprt{q, or_exprt{p, X_exprt{property_expr}}}
415+
: q;
417416

418-
const auto next = current + 1;
419-
exprt expansion;
420-
421-
if(next < no_timeframes)
422-
{
423-
auto obligations_rec = property_obligations_rec(
424-
property_expr, solver, next, no_timeframes, ns);
425-
expansion = or_exprt{tmp_p, obligations_rec.conjunction().second};
426-
}
427-
else
428-
expansion = tmp_p;
429-
430-
DATA_INVARIANT(no_timeframes != 0, "must have timeframe");
431-
return obligationst{no_timeframes - 1, and_exprt{tmp_q, expansion}};
417+
return property_obligations_rec(
418+
expansion, solver, current, no_timeframes, ns);
432419
}
433420
else if(
434421
property_expr.id() == ID_sva_until_with ||

0 commit comments

Comments
 (0)