@@ -20,13 +20,12 @@ Author: Daniel Kroening
20
20
21
21
#include < goto-programs/goto_functions.h>
22
22
23
- #include < solvers/prop/prop_conv.h>
24
- #include < solvers/prop/prop.h>
23
+ #include < solvers/decision_procedure.h>
25
24
26
25
#include " partial_order_concurrency.h"
27
26
28
27
static exprt build_full_lhs_rec (
29
- const prop_convt &prop_conv ,
28
+ const decision_proceduret &decision_procedure ,
30
29
const namespacet &ns,
31
30
const exprt &src_original, // original identifiers
32
31
const exprt &src_ssa) // renamed identifiers
@@ -39,17 +38,18 @@ static exprt build_full_lhs_rec(
39
38
if (id==ID_index)
40
39
{
41
40
// get index value from src_ssa
42
- exprt index_value=prop_conv .get (to_index_expr (src_ssa).index ());
41
+ exprt index_value = decision_procedure .get (to_index_expr (src_ssa).index ());
43
42
44
43
if (index_value.is_not_nil ())
45
44
{
46
45
simplify (index_value, ns);
47
46
index_exprt tmp=to_index_expr (src_original);
48
47
tmp.index ()=index_value;
49
- tmp.array ()=
50
- build_full_lhs_rec (prop_conv, ns,
51
- to_index_expr (src_original).array (),
52
- to_index_expr (src_ssa).array ());
48
+ tmp.array () = build_full_lhs_rec (
49
+ decision_procedure,
50
+ ns,
51
+ to_index_expr (src_original).array (),
52
+ to_index_expr (src_ssa).array ());
53
53
return std::move (tmp);
54
54
}
55
55
@@ -58,22 +58,29 @@ static exprt build_full_lhs_rec(
58
58
else if (id==ID_member)
59
59
{
60
60
member_exprt tmp=to_member_expr (src_original);
61
- tmp.struct_op ()=build_full_lhs_rec (
62
- prop_conv, ns,
61
+ tmp.struct_op () = build_full_lhs_rec (
62
+ decision_procedure,
63
+ ns,
63
64
to_member_expr (src_original).struct_op (),
64
65
to_member_expr (src_ssa).struct_op ());
65
66
}
66
67
else if (id==ID_if)
67
68
{
68
69
if_exprt tmp2=to_if_expr (src_original);
69
70
70
- tmp2.false_case ()=build_full_lhs_rec (prop_conv, ns,
71
- tmp2.false_case (), to_if_expr (src_ssa).false_case ());
71
+ tmp2.false_case () = build_full_lhs_rec (
72
+ decision_procedure,
73
+ ns,
74
+ tmp2.false_case (),
75
+ to_if_expr (src_ssa).false_case ());
72
76
73
- tmp2.true_case ()=build_full_lhs_rec (prop_conv, ns,
74
- tmp2.true_case (), to_if_expr (src_ssa).true_case ());
77
+ tmp2.true_case () = build_full_lhs_rec (
78
+ decision_procedure,
79
+ ns,
80
+ tmp2.true_case (),
81
+ to_if_expr (src_ssa).true_case ());
75
82
76
- exprt tmp=prop_conv .get (to_if_expr (src_ssa).cond ());
83
+ exprt tmp = decision_procedure .get (to_if_expr (src_ssa).cond ());
77
84
78
85
if (tmp.is_true ())
79
86
return tmp2.true_case ();
@@ -85,16 +92,19 @@ static exprt build_full_lhs_rec(
85
92
else if (id==ID_typecast)
86
93
{
87
94
typecast_exprt tmp=to_typecast_expr (src_original);
88
- tmp.op ()=build_full_lhs_rec (prop_conv, ns,
89
- to_typecast_expr (src_original).op (), to_typecast_expr (src_ssa).op ());
95
+ tmp.op () = build_full_lhs_rec (
96
+ decision_procedure,
97
+ ns,
98
+ to_typecast_expr (src_original).op (),
99
+ to_typecast_expr (src_ssa).op ());
90
100
return std::move (tmp);
91
101
}
92
102
else if (id==ID_byte_extract_little_endian ||
93
103
id==ID_byte_extract_big_endian)
94
104
{
95
105
byte_extract_exprt tmp = to_byte_extract_expr (src_original);
96
106
tmp.op () = build_full_lhs_rec (
97
- prop_conv , ns, tmp.op (), to_byte_extract_expr (src_ssa).op ());
107
+ decision_procedure , ns, tmp.op (), to_byte_extract_expr (src_ssa).op ());
98
108
99
109
// re-write into big case-split
100
110
}
@@ -169,7 +179,8 @@ static void update_internal_field(
169
179
170
180
// / Replace nondet values that appear in \p type by their values as found by
171
181
// / \p solver.
172
- static void replace_nondet_in_type (typet &type, const prop_convt &solver)
182
+ static void
183
+ replace_nondet_in_type (typet &type, const decision_proceduret &solver)
173
184
{
174
185
if (type.id () == ID_array)
175
186
{
@@ -182,7 +193,8 @@ static void replace_nondet_in_type(typet &type, const prop_convt &solver)
182
193
183
194
// / Replace nondet values that appear in the type of \p expr and its
184
195
// / subexpressions type by their values as found by \p solver.
185
- static void replace_nondet_in_type (exprt &expr, const prop_convt &solver)
196
+ static void
197
+ replace_nondet_in_type (exprt &expr, const decision_proceduret &solver)
186
198
{
187
199
replace_nondet_in_type (expr.type (), solver);
188
200
for (auto &sub : expr.operands ())
@@ -192,7 +204,7 @@ static void replace_nondet_in_type(exprt &expr, const prop_convt &solver)
192
204
void build_goto_trace (
193
205
const symex_target_equationt &target,
194
206
ssa_step_predicatet is_last_step_to_keep,
195
- const prop_convt &prop_conv ,
207
+ const decision_proceduret &decision_procedure ,
196
208
const namespacet &ns,
197
209
goto_tracet &goto_trace)
198
210
{
@@ -218,14 +230,14 @@ void build_goto_trace(
218
230
{
219
231
if (
220
232
last_step_to_keep == target.SSA_steps .end () &&
221
- is_last_step_to_keep (it, prop_conv ))
233
+ is_last_step_to_keep (it, decision_procedure ))
222
234
{
223
235
last_step_to_keep = it;
224
236
}
225
237
226
238
const SSA_stept &SSA_step = *it;
227
239
228
- if (prop_conv. l_get (SSA_step.guard_literal )!= tvt ( true ))
240
+ if (!decision_procedure. get (SSA_step.guard_handle ). is_true ( ))
229
241
continue ;
230
242
231
243
if (it->is_constraint () ||
@@ -250,7 +262,7 @@ void build_goto_trace(
250
262
// these are just used to get the time stamp -- the clock type is
251
263
// computed to be of the minimal necessary size, but we don't need to
252
264
// know it to get the value so just use typeless
253
- exprt clock_value = prop_conv .get (
265
+ exprt clock_value = decision_procedure .get (
254
266
symbol_exprt::typeless (partial_order_concurrencyt::rw_clock_id (it)));
255
267
256
268
const auto cv = numeric_cast<mp_integer>(clock_value);
@@ -342,7 +354,7 @@ void build_goto_trace(
342
354
goto_trace_step.function_arguments = SSA_step.converted_function_arguments ;
343
355
344
356
for (auto &arg : goto_trace_step.function_arguments )
345
- arg = prop_conv .get (arg);
357
+ arg = decision_procedure .get (arg);
346
358
347
359
// update internal field for specific variables in the counterexample
348
360
update_internal_field (SSA_step, goto_trace_step, ns);
@@ -359,15 +371,20 @@ void build_goto_trace(
359
371
if (SSA_step.original_full_lhs .is_not_nil ())
360
372
{
361
373
goto_trace_step.full_lhs = build_full_lhs_rec (
362
- prop_conv, ns, SSA_step.original_full_lhs , SSA_step.ssa_full_lhs );
363
- replace_nondet_in_type (goto_trace_step.full_lhs , prop_conv);
374
+ decision_procedure,
375
+ ns,
376
+ SSA_step.original_full_lhs ,
377
+ SSA_step.ssa_full_lhs );
378
+ replace_nondet_in_type (goto_trace_step.full_lhs , decision_procedure);
364
379
}
365
380
366
381
if (SSA_step.ssa_full_lhs .is_not_nil ())
367
382
{
368
- goto_trace_step.full_lhs_value = prop_conv.get (SSA_step.ssa_full_lhs );
383
+ goto_trace_step.full_lhs_value =
384
+ decision_procedure.get (SSA_step.ssa_full_lhs );
369
385
simplify (goto_trace_step.full_lhs_value , ns);
370
- replace_nondet_in_type (goto_trace_step.full_lhs_value , prop_conv);
386
+ replace_nondet_in_type (
387
+ goto_trace_step.full_lhs_value , decision_procedure);
371
388
}
372
389
373
390
for (const auto &j : SSA_step.converted_io_args )
@@ -378,7 +395,7 @@ void build_goto_trace(
378
395
}
379
396
else
380
397
{
381
- exprt tmp = prop_conv .get (j);
398
+ exprt tmp = decision_procedure .get (j);
382
399
goto_trace_step.io_args .push_back (tmp);
383
400
}
384
401
}
@@ -388,7 +405,7 @@ void build_goto_trace(
388
405
goto_trace_step.cond_expr = SSA_step.cond_expr ;
389
406
390
407
goto_trace_step.cond_value =
391
- prop_conv. l_get (SSA_step.cond_literal ).is_true ();
408
+ decision_procedure. get (SSA_step.cond_handle ).is_true ();
392
409
}
393
410
394
411
if (ssa_step_it == last_step_to_keep)
@@ -400,31 +417,33 @@ void build_goto_trace(
400
417
void build_goto_trace (
401
418
const symex_target_equationt &target,
402
419
symex_target_equationt::SSA_stepst::const_iterator last_step_to_keep,
403
- const prop_convt &prop_conv ,
420
+ const decision_proceduret &decision_procedure ,
404
421
const namespacet &ns,
405
422
goto_tracet &goto_trace)
406
423
{
407
- const auto is_last_step_to_keep = [last_step_to_keep](
408
- symex_target_equationt::SSA_stepst::const_iterator it, const prop_convt &) {
409
- return last_step_to_keep == it;
410
- };
424
+ const auto is_last_step_to_keep =
425
+ [last_step_to_keep](
426
+ symex_target_equationt::SSA_stepst::const_iterator it,
427
+ const decision_proceduret &) { return last_step_to_keep == it; };
411
428
412
429
return build_goto_trace (
413
- target, is_last_step_to_keep, prop_conv , ns, goto_trace);
430
+ target, is_last_step_to_keep, decision_procedure , ns, goto_trace);
414
431
}
415
432
416
433
static bool is_failed_assertion_step (
417
434
symex_target_equationt::SSA_stepst::const_iterator step,
418
- const prop_convt &prop_conv )
435
+ const decision_proceduret &decision_procedure )
419
436
{
420
- return step->is_assert () && prop_conv.l_get (step->cond_literal ).is_false ();
437
+ return step->is_assert () &&
438
+ decision_procedure.get (step->cond_handle ).is_false ();
421
439
}
422
440
423
441
void build_goto_trace (
424
442
const symex_target_equationt &target,
425
- const prop_convt &prop_conv ,
443
+ const decision_proceduret &decision_procedure ,
426
444
const namespacet &ns,
427
445
goto_tracet &goto_trace)
428
446
{
429
- build_goto_trace (target, is_failed_assertion_step, prop_conv, ns, goto_trace);
447
+ build_goto_trace (
448
+ target, is_failed_assertion_step, decision_procedure, ns, goto_trace);
430
449
}
0 commit comments