Skip to content

Commit 1754d78

Browse files
committed
BMC: encode properties using timeframe/handle pair
The property encoding interface is changed to return a timeframe/handle pair, instead of just a condition per timeframe. This allows determining the appropriate size of the counterexample trace.
1 parent 87c6f81 commit 1754d78

File tree

1 file changed

+44
-6
lines changed

1 file changed

+44
-6
lines changed

src/trans-word-level/property.cpp

Lines changed: 44 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,14 +70,15 @@ Function: property
7070
7171
\*******************************************************************/
7272

73-
void property(
73+
std::map<std::size_t, exprt::operandst> property_obligations(
7474
const exprt &property_expr,
75-
exprt::operandst &prop_handles,
7675
message_handlert &message_handler,
7776
decision_proceduret &solver,
7877
std::size_t no_timeframes,
7978
const namespacet &ns)
8079
{
80+
std::map<std::size_t, exprt::operandst> obligations;
81+
8182
messaget message(message_handler);
8283

8384
// Initial state only property?
@@ -87,14 +88,13 @@ void property(
8788
property_expr.id() == ID_sva_nexttime ||
8889
property_expr.id() == ID_sva_s_nexttime)
8990
{
90-
prop_handles.resize(no_timeframes, true_exprt());
9191
if(no_timeframes > 0)
9292
{
9393
exprt tmp = instantiate(property_expr, 0, no_timeframes, ns);
94-
prop_handles.push_back(solver.handle(tmp));
94+
obligations[0].push_back(solver.handle(tmp));
9595
}
9696

97-
return;
97+
return obligations;
9898
}
9999

100100
// We want AG p.
@@ -115,7 +115,45 @@ void property(
115115
instantiate(p, c, no_timeframes, ns);
116116

117117
auto handle = solver.handle(tmp);
118-
prop_handles.push_back(std::move(handle));
118+
obligations[c].push_back(std::move(handle));
119+
}
120+
121+
return obligations;
122+
}
123+
124+
/*******************************************************************\
125+
126+
Function: property
127+
128+
Inputs:
129+
130+
Outputs:
131+
132+
Purpose:
133+
134+
\*******************************************************************/
135+
136+
void property(
137+
const exprt &property_expr,
138+
exprt::operandst &prop_handles,
139+
message_handlert &message_handler,
140+
decision_proceduret &solver,
141+
std::size_t no_timeframes,
142+
const namespacet &ns)
143+
{
144+
// The first element of the pair is the length of the
145+
// counterexample, and the second is the condition that
146+
// must be valid for the property to hold.
147+
auto obligations = property_obligations(
148+
property_expr, message_handler, solver, no_timeframes, ns);
149+
150+
// Map obligations onto timeframes.
151+
prop_handles.resize(no_timeframes, true_exprt());
152+
for(auto &obligation_it : obligations)
153+
{
154+
auto t = obligation_it.first;
155+
DATA_INVARIANT(t < no_timeframes, "obligation must have valid timeframe");
156+
prop_handles[t] = conjunction(obligation_it.second);
119157
}
120158
}
121159

0 commit comments

Comments
 (0)