Skip to content

Commit b5ce8d2

Browse files
authored
Merge pull request #737 from diffblue/property-no-solver
word-level BMC: remove parameters for solver + ns
2 parents e2d9120 + 2221677 commit b5ce8d2

File tree

10 files changed

+75
-101
lines changed

10 files changed

+75
-101
lines changed

src/ebmc/k_induction.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ void k_inductiont::induction_step()
261261
const exprt &p = to_unary_expr(property.normalized_expr).op();
262262
for(std::size_t c = 0; c < no_timeframes; c++)
263263
{
264-
exprt tmp = instantiate(p, c, no_timeframes, ns);
264+
exprt tmp = instantiate(p, c, no_timeframes);
265265
solver.set_to_true(tmp);
266266
}
267267
}
@@ -272,15 +272,13 @@ void k_inductiont::induction_step()
272272
// assumption: time frames 0,...,k-1
273273
for(std::size_t c = 0; c < no_timeframes - 1; c++)
274274
{
275-
exprt tmp=
276-
instantiate(p, c, no_timeframes-1, ns);
275+
exprt tmp = instantiate(p, c, no_timeframes - 1);
277276
solver.set_to_true(tmp);
278277
}
279278

280279
// property: time frame k
281280
{
282-
exprt tmp=
283-
instantiate(p, no_timeframes-1, no_timeframes, ns);
281+
exprt tmp = instantiate(p, no_timeframes - 1, no_timeframes);
284282
solver.set_to_false(tmp);
285283
}
286284

src/ebmc/random_traces.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -478,8 +478,7 @@ void random_tracest::freeze(
478478
{
479479
for(auto &symbol : symbols)
480480
{
481-
auto symbol_in_timeframe =
482-
instantiate(symbol, i, number_of_timeframes, ns);
481+
auto symbol_in_timeframe = instantiate(symbol, i, number_of_timeframes);
483482
(void)solver.handle(symbol_in_timeframe);
484483
}
485484
}
@@ -508,7 +507,7 @@ std::vector<exprt> random_tracest::random_input_constraints(
508507
{
509508
for(auto &input : inputs)
510509
{
511-
auto input_in_timeframe = instantiate(input, i, number_of_timeframes, ns);
510+
auto input_in_timeframe = instantiate(input, i, number_of_timeframes);
512511
auto constraint =
513512
equal_exprt(input_in_timeframe, random_value(input.type()));
514513
result.push_back(constraint);
@@ -538,7 +537,7 @@ std::vector<exprt> random_tracest::random_initial_state_constraints(
538537

539538
for(auto &symbol : state_variables)
540539
{
541-
auto symbol_in_timeframe = instantiate(symbol, 0, 1, ns);
540+
auto symbol_in_timeframe = instantiate(symbol, 0, 1);
542541
auto constraint =
543542
equal_exprt(symbol_in_timeframe, random_value(symbol.type()));
544543
result.push_back(std::move(constraint));

src/ebmc/ranking_function.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -171,14 +171,13 @@ std::pair<tvt, std::optional<trans_tracet>> is_ranking_function(
171171
// c) p holds in timeframe 1
172172

173173
exprt ranking_function_decreases = less_than_exprt(
174-
instantiate(ranking_function, 1, 2, ns),
175-
instantiate(ranking_function, 0, 2, ns));
174+
instantiate(ranking_function, 1, 2), instantiate(ranking_function, 0, 2));
176175
solver.set_to_false(ranking_function_decreases);
177176

178-
exprt p_at_0 = instantiate(p, 0, 2, ns);
177+
exprt p_at_0 = instantiate(p, 0, 2);
179178
solver.set_to_false(p_at_0);
180179

181-
exprt p_at_1 = instantiate(p, 1, 2, ns);
180+
exprt p_at_1 = instantiate(p, 1, 2);
182181
solver.set_to_false(p_at_1);
183182

184183
decision_proceduret::resultt dec_result = solver();

src/trans-word-level/counterexample_word_level.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,17 @@ Author: Daniel Kroening, kroening@kroening.com
66
77
\*******************************************************************/
88

9-
#include <iostream>
9+
#include "counterexample_word_level.h"
10+
11+
#include <util/std_expr.h>
12+
#include <util/symbol_table.h>
1013

1114
#include <langapi/language_util.h>
15+
#include <solvers/decision_procedure.h>
1216

1317
#include "instantiate_word_level.h"
14-
#include "counterexample_word_level.h"
1518

16-
#include <util/std_expr.h>
17-
#include <util/symbol_table.h>
19+
#include <iostream>
1820

1921
/*******************************************************************\
2022

src/trans-word-level/instantiate_word_level.cpp

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,8 @@ symbol_exprt timeframe_symbol(const mp_integer &timeframe, symbol_exprt src)
7272
class wl_instantiatet
7373
{
7474
public:
75-
wl_instantiatet(const mp_integer &_no_timeframes, const namespacet &_ns)
76-
: no_timeframes(_no_timeframes), ns(_ns)
75+
explicit wl_instantiatet(const mp_integer &_no_timeframes)
76+
: no_timeframes(_no_timeframes)
7777
{
7878
}
7979

@@ -86,7 +86,6 @@ class wl_instantiatet
8686

8787
protected:
8888
const mp_integer &no_timeframes;
89-
const namespacet &ns;
9089

9190
[[nodiscard]] std::pair<mp_integer, exprt>
9291
instantiate_rec(exprt, const mp_integer &t) const;
@@ -145,7 +144,7 @@ wl_instantiatet::instantiate_rec(exprt expr, const mp_integer &t) const
145144
{
146145
// sequence expressions -- these may have multiple potential
147146
// match points, and evaluate to true if any of them matches
148-
const auto match_points = instantiate_sequence(expr, t, no_timeframes, ns);
147+
const auto match_points = instantiate_sequence(expr, t, no_timeframes);
149148
exprt::operandst disjuncts;
150149
disjuncts.reserve(match_points.size());
151150
mp_integer max = t;
@@ -228,10 +227,9 @@ Function: instantiate
228227
exprt instantiate(
229228
const exprt &expr,
230229
const mp_integer &t,
231-
const mp_integer &no_timeframes,
232-
const namespacet &ns)
230+
const mp_integer &no_timeframes)
233231
{
234-
wl_instantiatet wl_instantiate(no_timeframes, ns);
232+
wl_instantiatet wl_instantiate(no_timeframes);
235233
return wl_instantiate(expr, t).second;
236234
}
237235

@@ -250,9 +248,8 @@ Function: instantiate_property
250248
std::pair<mp_integer, exprt> instantiate_property(
251249
const exprt &expr,
252250
const mp_integer &current,
253-
const mp_integer &no_timeframes,
254-
const namespacet &ns)
251+
const mp_integer &no_timeframes)
255252
{
256-
wl_instantiatet wl_instantiate(no_timeframes, ns);
253+
wl_instantiatet wl_instantiate(no_timeframes);
257254
return wl_instantiate(expr, current);
258255
}

src/trans-word-level/instantiate_word_level.h

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,17 @@ Author: Daniel Kroening, kroening@kroening.com
1010
#define CPROVER_BMC_INSTANTIATE_WORD_LEVEL_H
1111

1212
#include <util/mp_arith.h>
13-
#include <util/namespace.h>
14-
15-
#include <solvers/prop/prop_conv.h>
13+
#include <util/std_expr.h>
1614

1715
exprt instantiate(
1816
const exprt &expr,
1917
const mp_integer &current,
20-
const mp_integer &no_timeframes,
21-
const namespacet &);
18+
const mp_integer &no_timeframes);
2219

2320
std::pair<mp_integer, exprt> instantiate_property(
2421
const exprt &,
2522
const mp_integer &current,
26-
const mp_integer &no_timeframes,
27-
const namespacet &);
23+
const mp_integer &no_timeframes);
2824

2925
std::string
3026
timeframe_identifier(const mp_integer &timeframe, const irep_idt &identifier);

0 commit comments

Comments
 (0)