Skip to content

Commit 0158a8b

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 0158a8b

File tree

1 file changed

+47
-11
lines changed

1 file changed

+47
-11
lines changed

src/trans-word-level/property.cpp

+47-11
Original file line numberDiff line numberDiff line change
@@ -70,14 +70,17 @@ 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+
PRECONDITION(no_timeframes > 0);
81+
82+
std::map<std::size_t, exprt::operandst> obligations;
83+
8184
messaget message(message_handler);
8285

8386
// Initial state only property?
@@ -87,14 +90,9 @@ void property(
8790
property_expr.id() == ID_sva_nexttime ||
8891
property_expr.id() == ID_sva_s_nexttime)
8992
{
90-
prop_handles.resize(no_timeframes, true_exprt());
91-
if(no_timeframes > 0)
92-
{
93-
exprt tmp = instantiate(property_expr, 0, no_timeframes, ns);
94-
prop_handles.push_back(solver.handle(tmp));
95-
}
96-
97-
return;
93+
exprt tmp = instantiate(property_expr, 0, no_timeframes, ns);
94+
obligations[0].push_back(solver.handle(tmp));
95+
return obligations;
9896
}
9997

10098
// We want AG p.
@@ -115,7 +113,45 @@ void property(
115113
instantiate(p, c, no_timeframes, ns);
116114

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

0 commit comments

Comments
 (0)