Skip to content

Commit a35a2f4

Browse files
committed
k-induction does not support $past
k-induction requires instrumentation of $past. This adds a removal step, and a precondition that $past has been removed.
1 parent a16080f commit a35a2f4

File tree

5 files changed

+29
-2
lines changed

5 files changed

+29
-2
lines changed

CHANGELOG

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
* SMV: abs, bool, count, max, min, toint, word1
1212
* BMC: new encoding for F, avoiding spurious traces
1313
* EBMC: verification results now have "result" verbosity level
14+
* Soundness fix for combination of $past and k-induction
1415

1516
# EBMC 5.6
1617

src/ebmc/instrument_past.cpp

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,14 @@ void collect_past(const exprt &expr, past_sett &past_set)
3030
}
3131
}
3232

33-
void collect_past(transition_systemt &transition_system, past_sett &past_set)
33+
void collect_past(
34+
const transition_systemt &transition_system,
35+
past_sett &past_set)
3436
{
3537
collect_past(transition_system.trans_expr, past_set);
3638
}
3739

38-
void collect_past(ebmc_propertiest &properties, past_sett &past_set)
40+
void collect_past(const ebmc_propertiest &properties, past_sett &past_set)
3941
{
4042
for(auto &property : properties.properties)
4143
{
@@ -199,3 +201,14 @@ void instrument_past(
199201
instrument_past_model(past_map, transition_system);
200202
instrument_past_model(past_map, properties);
201203
}
204+
205+
bool has_past(
206+
const transition_systemt &transition_system,
207+
const ebmc_propertiest &properties)
208+
{
209+
past_sett past_set;
210+
collect_past(transition_system, past_set);
211+
collect_past(properties, past_set);
212+
213+
return !past_set.empty();
214+
}

src/ebmc/instrument_past.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ Author: Daniel Kroening, [email protected]
1515
#include "ebmc_properties.h"
1616
#include "transition_system.h"
1717

18+
bool has_past(const transition_systemt &, const ebmc_propertiest &);
19+
1820
void instrument_past(transition_systemt &, ebmc_propertiest &);
1921

2022
#endif // EBMC_INSTRUMENT_PAST_H

src/ebmc/k_induction.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ Author: Daniel Kroening, [email protected]
1818
#include "bmc.h"
1919
#include "ebmc_error.h"
2020
#include "ebmc_solver_factory.h"
21+
#include "instrument_past.h"
2122
#include "liveness_to_safety.h"
2223

2324
#include <fstream>
@@ -185,6 +186,9 @@ Function: k_inductiont::operator()
185186

186187
void k_inductiont::operator()()
187188
{
189+
// check that $past is not present
190+
PRECONDITION(!has_past(transition_system, properties));
191+
188192
// Unsupported assumption? Mark as such.
189193
bool assumption_unsupported = false;
190194
for(auto &property : properties.properties)

src/ebmc/property_checker.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ Author: Daniel Kroening, [email protected]
2121
#include "ebmc_error.h"
2222
#include "ebmc_solver_factory.h"
2323
#include "ic3_engine.h"
24+
#include "instrument_past.h"
2425
#include "k_induction.h"
2526
#include "netlist.h"
2627
#include "output_file.h"
@@ -461,6 +462,12 @@ property_checker_resultt property_checker(
461462
!cmdline.isset("k-induction") &&
462463
!cmdline.isset("ic3") && !cmdline.isset("bound");
463464

465+
if(cmdline.isset("k-induction") || use_heuristic_engine)
466+
{
467+
// The step case of k-induction can't do $past
468+
instrument_past(transition_system, properties);
469+
}
470+
464471
auto result = [&]() -> property_checker_resultt
465472
{
466473
if(cmdline.isset("bdd") || cmdline.isset("show-bdds"))

0 commit comments

Comments
 (0)