Skip to content

Commit 669417a

Browse files
committed
BMC: LHS of SVA throughout is a state predicate
The LHS of the SVA throughout operator is a state predicate, not a full property. Hence, use the appropriate instantiation function.
1 parent bdbdbcf commit 669417a

File tree

5 files changed

+15
-38
lines changed

5 files changed

+15
-38
lines changed

src/trans-word-level/instantiate_word_level.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ exprt instantiate(
207207

208208
/*******************************************************************\
209209
210-
Function: instantiate_property
210+
Function: instantiate_state_predicate
211211
212212
Inputs:
213213
@@ -217,11 +217,12 @@ Function: instantiate_property
217217
218218
\*******************************************************************/
219219

220-
exprt instantiate_property(
220+
exprt instantiate_state_predicate(
221221
const exprt &expr,
222222
const mp_integer &current,
223223
const mp_integer &no_timeframes)
224224
{
225+
PRECONDITION(expr.type().id() == ID_bool);
225226
wl_instantiatet wl_instantiate(no_timeframes, false);
226227
return wl_instantiate(expr, current);
227228
}

src/trans-word-level/instantiate_word_level.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ exprt instantiate(
2121

2222
// Instantiate an atomic state predicate in the given time frame.
2323
// Must not contain next_symbol or any temporal operators.
24-
exprt instantiate_property(
24+
exprt instantiate_state_predicate(
2525
const exprt &,
2626
const mp_integer &current,
2727
const mp_integer &no_timeframes);

src/trans-word-level/property.cpp

Lines changed: 6 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,8 @@ static obligationst property_obligations_rec(
511511
{
512512
// we rely on NNF
513513
auto &if_expr = to_if_expr(property_expr);
514-
auto cond = instantiate_property(if_expr.cond(), current, no_timeframes);
514+
auto cond =
515+
instantiate_state_predicate(if_expr.cond(), current, no_timeframes);
515516
auto obligations_true =
516517
property_obligations_rec(if_expr.true_case(), current, no_timeframes)
517518
.conjunction();
@@ -571,7 +572,8 @@ static obligationst property_obligations_rec(
571572
{
572573
// state formula
573574
return obligationst{
574-
current, instantiate_property(property_expr, current, no_timeframes)};
575+
current,
576+
instantiate_state_predicate(property_expr, current, no_timeframes)};
575577
}
576578
}
577579
else if(property_expr.id() == ID_sva_implies)
@@ -739,7 +741,8 @@ static obligationst property_obligations_rec(
739741
else
740742
{
741743
return obligationst{
742-
current, instantiate_property(property_expr, current, no_timeframes)};
744+
current,
745+
instantiate_state_predicate(property_expr, current, no_timeframes)};
743746
}
744747
}
745748

@@ -755,26 +758,6 @@ Function: property_obligations
755758
756759
\*******************************************************************/
757760

758-
obligationst property_obligations(
759-
const exprt &property_expr,
760-
const mp_integer &t,
761-
const mp_integer &no_timeframes)
762-
{
763-
return property_obligations_rec(property_expr, t, no_timeframes);
764-
}
765-
766-
/*******************************************************************\
767-
768-
Function: property_obligations
769-
770-
Inputs:
771-
772-
Outputs:
773-
774-
Purpose:
775-
776-
\*******************************************************************/
777-
778761
obligationst property_obligations(
779762
const exprt &property_expr,
780763
const mp_integer &no_timeframes)

src/trans-word-level/property.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,4 @@ exprt::operandst property(
2222
/// Is the given property supported by word-level unwinding?
2323
bool bmc_supports_property(const exprt &);
2424

25-
class obligationst;
26-
27-
obligationst property_obligations(
28-
const exprt &,
29-
const mp_integer &t,
30-
const mp_integer &no_timeframes);
31-
3225
#endif

src/trans-word-level/sequence.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ Author: Daniel Kroening, [email protected]
1818

1919
#include "instantiate_word_level.h"
2020
#include "obligations.h"
21-
#include "property.h"
2221

2322
// condition on counters for ocurrences of non-consecutive repetitions
2423
exprt sequence_count_condition(
@@ -259,9 +258,9 @@ sequence_matchest instantiate_sequence_rec(
259258

260259
for(mp_integer new_t = t; new_t <= match.end_time; ++new_t)
261260
{
262-
auto obligations =
263-
property_obligations(throughout.lhs(), new_t, no_timeframes);
264-
conjuncts.push_back(obligations.conjunction().second);
261+
auto lhs_inst =
262+
instantiate_state_predicate(throughout.lhs(), new_t, no_timeframes);
263+
conjuncts.push_back(lhs_inst);
265264
}
266265

267266
result.emplace_back(match.end_time, conjunction(conjuncts));
@@ -437,7 +436,8 @@ sequence_matchest instantiate_sequence_rec(
437436
{
438437
// a state predicate
439438
auto &predicate = to_sva_boolean_expr(expr).op();
440-
auto instantiated = instantiate_property(predicate, t, no_timeframes);
439+
auto instantiated =
440+
instantiate_state_predicate(predicate, t, no_timeframes);
441441
return {{t, instantiated}};
442442
}
443443
else

0 commit comments

Comments
 (0)