Skip to content

Commit f936530

Browse files
committed
liveness-to-safety for IC3 and BDDs
This adds support for the combination of IC3 or BDDs and the liveness-to-safety translation.
1 parent 6d92f04 commit f936530

File tree

7 files changed

+33
-13
lines changed

7 files changed

+33
-13
lines changed

src/ebmc/bdd_engine.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ Author: Daniel Kroening, [email protected]
1111
#include <util/format_expr.h>
1212

1313
#include <ebmc/ebmc_properties.h>
14+
#include <ebmc/liveness_to_safety.h>
1415
#include <ebmc/transition_system.h>
1516
#include <solvers/bdd/miniBDD/miniBDD.h>
1617
#include <solvers/sat/satcheck.h>
@@ -177,13 +178,18 @@ int bdd_enginet::operator()()
177178
properties = ebmc_propertiest::from_command_line(
178179
cmdline, transition_system, message.get_message_handler());
179180

181+
// possibly apply liveness-to-safety
182+
if(cmdline.isset("liveness-to-safety"))
183+
liveness_to_safety(transition_system, properties);
184+
180185
const auto property_map = properties.make_property_map();
181186

182187
message.status() << "Building netlist" << messaget::eom;
183188

184189
convert_trans_to_netlist(
185190
transition_system.symbol_table,
186191
transition_system.main_symbol->name,
192+
transition_system.trans_expr,
187193
property_map,
188194
netlist,
189195
message.get_message_handler());

src/ebmc/cegar/bmc_cegar.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,11 +230,15 @@ void bmc_cegart::make_netlist()
230230

231231
try
232232
{
233+
const symbolt &module_symbol = ns.lookup(main_module);
234+
const transt &trans = to_trans_expr(module_symbol.value);
235+
233236
std::map<irep_idt, exprt> property_map;
234237

235238
convert_trans_to_netlist(
236239
symbol_table,
237240
main_module,
241+
trans,
238242
property_map,
239243
concrete_netlist,
240244
get_message_handler());

src/ebmc/ebmc_base.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -428,6 +428,7 @@ bool ebmc_baset::make_netlist(netlistt &netlist)
428428
convert_trans_to_netlist(
429429
transition_system.symbol_table,
430430
transition_system.main_symbol->name,
431+
transition_system.trans_expr,
431432
properties.make_property_map(),
432433
netlist,
433434
message.get_message_handler());

src/ebmc/ebmc_parse_options.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,15 @@ int ebmc_parse_optionst::doit()
239239
ebmc_baset ebmc_base(cmdline, ui_message_handler);
240240
ebmc_base.transition_system = std::move(transition_system);
241241

242+
auto result = ebmc_base.get_properties();
243+
244+
if(result != -1)
245+
return result;
246+
247+
// possibly apply liveness-to-safety
248+
if(cmdline.isset("liveness-to-safety"))
249+
liveness_to_safety(ebmc_base.transition_system, ebmc_base.properties);
250+
242251
if(cmdline.isset("show-varmap"))
243252
{
244253
netlistt netlist;
@@ -274,15 +283,6 @@ int ebmc_parse_optionst::doit()
274283
return 0;
275284
}
276285

277-
auto result = ebmc_base.get_properties();
278-
279-
if(result != -1)
280-
return result;
281-
282-
// possibly apply liveness-to-safety
283-
if(cmdline.isset("liveness-to-safety"))
284-
liveness_to_safety(ebmc_base.transition_system, ebmc_base.properties);
285-
286286
if(cmdline.isset("smv-netlist"))
287287
{
288288
netlistt netlist;

src/ic3/m1ain.cc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ Author: Eugene Goldberg, [email protected]
1212
#include <util/ui_message.h>
1313

1414
#include <ebmc/ebmc_properties.h>
15+
#include <ebmc/liveness_to_safety.h>
1516
#include <ebmc/report_results.h>
1617

1718
#include <trans-netlist/netlist.h>
@@ -95,12 +96,17 @@ int ic3_enginet::operator()()
9596
properties = ebmc_propertiest::from_command_line(
9697
cmdline, transition_system, message.get_message_handler());
9798

99+
// possibly apply liveness-to-safety
100+
if(cmdline.isset("liveness-to-safety"))
101+
liveness_to_safety(transition_system, properties);
102+
98103
// make net-list
99104
message.status() << "Generating Netlist" << messaget::eom;
100105

101106
convert_trans_to_netlist(
102107
transition_system.symbol_table,
103108
transition_system.main_symbol->name,
109+
transition_system.trans_expr,
104110
properties.make_property_map(),
105111
netlist,
106112
message.get_message_handler());

src/trans-netlist/trans_to_netlist.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ class convert_trans_to_netlistt:public messaget
5151

5252
void operator()(
5353
const irep_idt &module,
54+
const transt &,
5455
const std::map<irep_idt, exprt> &properties);
5556

5657
protected:
@@ -256,6 +257,7 @@ Function: convert_trans_to_netlistt::operator()
256257

257258
void convert_trans_to_netlistt::operator()(
258259
const irep_idt &module,
260+
const transt &trans,
259261
const std::map<irep_idt, exprt> &properties)
260262
{
261263
// setup
@@ -287,9 +289,7 @@ void convert_trans_to_netlistt::operator()(
287289
}
288290
}
289291

290-
const symbolt &module_symbol=ns.lookup(module);
291-
const transt &trans=to_trans_expr(module_symbol.value);
292-
mode = module_symbol.mode;
292+
mode = ns.lookup(module).mode;
293293

294294
// build the net-list
295295
aig_prop_constraintt aig_prop(dest, get_message_handler());
@@ -806,11 +806,12 @@ Function: convert_trans_to_netlist
806806
void convert_trans_to_netlist(
807807
symbol_table_baset &symbol_table,
808808
const irep_idt &module,
809+
const transt &trans_expr,
809810
const std::map<irep_idt, exprt> &properties,
810811
netlistt &dest,
811812
message_handlert &message_handler)
812813
{
813814
convert_trans_to_netlistt c(symbol_table, dest, message_handler);
814815

815-
c(module, properties);
816+
c(module, trans_expr, properties);
816817
}

src/trans-netlist/trans_to_netlist.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,15 @@ Author: Daniel Kroening, [email protected]
1010
#define CPROVER_TRANS_NETLIST_TRANS_H
1111

1212
#include <util/expr.h>
13+
#include <util/mathematical_expr.h>
1314
#include <util/message.h>
1415
#include <util/namespace.h>
1516
#include <util/symbol_table_base.h>
1617

1718
void convert_trans_to_netlist(
1819
symbol_table_baset &,
1920
const irep_idt &module,
21+
const transt &,
2022
const std::map<irep_idt, exprt> &properties,
2123
class netlistt &dest,
2224
message_handlert &);

0 commit comments

Comments
 (0)