Skip to content

Commit 9244ab0

Browse files
committed
word-level BMC: remove ns parameter
This delivers on the promise of #737 and really removes the unused namespacet parameter from the word-level BMC property encoder.
1 parent 7b44290 commit 9244ab0

File tree

1 file changed

+37
-41
lines changed

1 file changed

+37
-41
lines changed

src/trans-word-level/property.cpp

Lines changed: 37 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,7 @@ Function: property_obligations_rec
158158
static obligationst property_obligations_rec(
159159
const exprt &property_expr,
160160
const mp_integer &current,
161-
const mp_integer &no_timeframes,
162-
const namespacet &ns)
161+
const mp_integer &no_timeframes)
163162
{
164163
PRECONDITION(current >= 0 && current < no_timeframes);
165164

@@ -183,7 +182,7 @@ static obligationst property_obligations_rec(
183182

184183
for(mp_integer c = current; c < no_timeframes; ++c)
185184
{
186-
obligations.add(property_obligations_rec(phi, c, no_timeframes, ns));
185+
obligations.add(property_obligations_rec(phi, c, no_timeframes));
187186
}
188187

189188
return obligations;
@@ -212,7 +211,7 @@ static obligationst property_obligations_rec(
212211

213212
for(mp_integer u = current + lower; u <= current + upper; ++u)
214213
{
215-
auto obligations_rec = property_obligations_rec(op, u, no_timeframes, ns);
214+
auto obligations_rec = property_obligations_rec(op, u, no_timeframes);
216215
disjuncts.push_back(obligations_rec.conjunction().second);
217216
}
218217

@@ -244,7 +243,7 @@ static obligationst property_obligations_rec(
244243

245244
for(mp_integer j = current; j <= k; ++j)
246245
{
247-
auto tmp = property_obligations_rec(phi, j, no_timeframes, ns);
246+
auto tmp = property_obligations_rec(phi, j, no_timeframes);
248247
disjuncts.push_back(tmp.conjunction().second);
249248
}
250249

@@ -289,8 +288,7 @@ static obligationst property_obligations_rec(
289288

290289
for(mp_integer c = from; c <= to; ++c)
291290
{
292-
auto tmp =
293-
property_obligations_rec(phi, c, no_timeframes, ns).conjunction();
291+
auto tmp = property_obligations_rec(phi, c, no_timeframes).conjunction();
294292
time = std::max(time, tmp.first);
295293
disjuncts.push_back(tmp.second);
296294
}
@@ -338,7 +336,7 @@ static obligationst property_obligations_rec(
338336

339337
for(mp_integer c = from; c <= to; ++c)
340338
{
341-
obligations.add(property_obligations_rec(phi, c, no_timeframes, ns));
339+
obligations.add(property_obligations_rec(phi, c, no_timeframes));
342340
}
343341

344342
return obligations;
@@ -363,7 +361,7 @@ static obligationst property_obligations_rec(
363361

364362
if(next < no_timeframes)
365363
{
366-
return property_obligations_rec(phi, next, no_timeframes, ns);
364+
return property_obligations_rec(phi, next, no_timeframes);
367365
}
368366
else
369367
{
@@ -379,7 +377,7 @@ static obligationst property_obligations_rec(
379377
// p U q ≡ Fq ∧ (p W q)
380378
exprt tmp = and_exprt{F_exprt{q}, weak_U_exprt{p, q}};
381379

382-
return property_obligations_rec(tmp, current, no_timeframes, ns);
380+
return property_obligations_rec(tmp, current, no_timeframes);
383381
}
384382
else if(property_expr.id() == ID_sva_until || property_expr.id() == ID_weak_U)
385383
{
@@ -392,7 +390,7 @@ static obligationst property_obligations_rec(
392390
q,
393391
(current + 1) < no_timeframes ? and_exprt{p, X_exprt{property_expr}} : p};
394392

395-
return property_obligations_rec(tmp, current, no_timeframes, ns);
393+
return property_obligations_rec(tmp, current, no_timeframes);
396394
}
397395
else if(property_expr.id() == ID_R)
398396
{
@@ -407,7 +405,7 @@ static obligationst property_obligations_rec(
407405
? and_exprt{q, or_exprt{p, X_exprt{property_expr}}}
408406
: q;
409407

410-
return property_obligations_rec(expansion, current, no_timeframes, ns);
408+
return property_obligations_rec(expansion, current, no_timeframes);
411409
}
412410
else if(property_expr.id() == ID_strong_R)
413411
{
@@ -417,23 +415,23 @@ static obligationst property_obligations_rec(
417415
// p strongR q ≡ Fp ∧ (p R q)
418416
exprt tmp = and_exprt{F_exprt{q}, weak_U_exprt{p, q}};
419417

420-
return property_obligations_rec(tmp, current, no_timeframes, ns);
418+
return property_obligations_rec(tmp, current, no_timeframes);
421419
}
422420
else if(property_expr.id() == ID_sva_until_with)
423421
{
424422
// Rewrite to LTL (weak) R.
425423
// Note that lhs and rhs are flipped.
426424
auto &until_with = to_sva_until_with_expr(property_expr);
427425
auto R = R_exprt{until_with.rhs(), until_with.lhs()};
428-
return property_obligations_rec(R, current, no_timeframes, ns);
426+
return property_obligations_rec(R, current, no_timeframes);
429427
}
430428
else if(property_expr.id() == ID_sva_s_until_with)
431429
{
432430
// Rewrite to LTL (strong) R.
433431
// Note that lhs and rhs are flipped.
434432
auto &s_until_with = to_sva_s_until_with_expr(property_expr);
435433
auto strong_R = strong_R_exprt{s_until_with.rhs(), s_until_with.lhs()};
436-
return property_obligations_rec(strong_R, current, no_timeframes, ns);
434+
return property_obligations_rec(strong_R, current, no_timeframes);
437435
}
438436
else if(property_expr.id() == ID_and)
439437
{
@@ -443,7 +441,7 @@ static obligationst property_obligations_rec(
443441

444442
for(auto &op : to_and_expr(property_expr).operands())
445443
{
446-
obligations.add(property_obligations_rec(op, current, no_timeframes, ns));
444+
obligations.add(property_obligations_rec(op, current, no_timeframes));
447445
}
448446

449447
return obligations;
@@ -458,8 +456,7 @@ static obligationst property_obligations_rec(
458456

459457
for(auto &op : to_or_expr(property_expr).operands())
460458
{
461-
auto obligations =
462-
property_obligations_rec(op, current, no_timeframes, ns);
459+
auto obligations = property_obligations_rec(op, current, no_timeframes);
463460
auto conjunction = obligations.conjunction();
464461
t = std::max(t, conjunction.first);
465462
disjuncts.push_back(conjunction.second);
@@ -476,14 +473,14 @@ static obligationst property_obligations_rec(
476473
auto tmp = and_exprt{
477474
implies_exprt{equal_expr.lhs(), equal_expr.rhs()},
478475
implies_exprt{equal_expr.rhs(), equal_expr.lhs()}};
479-
return property_obligations_rec(tmp, current, no_timeframes, ns);
476+
return property_obligations_rec(tmp, current, no_timeframes);
480477
}
481478
else if(property_expr.id() == ID_implies)
482479
{
483480
// we rely on NNF
484481
auto &implies_expr = to_implies_expr(property_expr);
485482
auto tmp = or_exprt{not_exprt{implies_expr.lhs()}, implies_expr.rhs()};
486-
return property_obligations_rec(tmp, current, no_timeframes, ns);
483+
return property_obligations_rec(tmp, current, no_timeframes);
487484
}
488485
else if(property_expr.id() == ID_if)
489486
{
@@ -492,10 +489,10 @@ static obligationst property_obligations_rec(
492489
auto cond =
493490
instantiate_property(if_expr.cond(), current, no_timeframes).second;
494491
auto obligations_true =
495-
property_obligations_rec(if_expr.true_case(), current, no_timeframes, ns)
492+
property_obligations_rec(if_expr.true_case(), current, no_timeframes)
496493
.conjunction();
497494
auto obligations_false =
498-
property_obligations_rec(if_expr.false_case(), current, no_timeframes, ns)
495+
property_obligations_rec(if_expr.false_case(), current, no_timeframes)
499496
.conjunction();
500497
return obligationst{
501498
std::max(obligations_true.first, obligations_false.first),
@@ -507,7 +504,7 @@ static obligationst property_obligations_rec(
507504
{
508505
// drop reduntant type casts
509506
return property_obligations_rec(
510-
to_typecast_expr(property_expr).op(), current, no_timeframes, ns);
507+
to_typecast_expr(property_expr).op(), current, no_timeframes);
511508
}
512509
else if(property_expr.id() == ID_not)
513510
{
@@ -519,78 +516,78 @@ static obligationst property_obligations_rec(
519516
// ¬(φ U ψ) ≡ (¬φ R ¬ψ)
520517
auto &U = to_U_expr(op);
521518
auto R = R_exprt{not_exprt{U.lhs()}, not_exprt{U.rhs()}};
522-
return property_obligations_rec(R, current, no_timeframes, ns);
519+
return property_obligations_rec(R, current, no_timeframes);
523520
}
524521
else if(op.id() == ID_R)
525522
{
526523
// ¬(φ R ψ) ≡ (¬φ U ¬ψ)
527524
auto &R = to_R_expr(op);
528525
auto U = U_exprt{not_exprt{R.lhs()}, not_exprt{R.rhs()}};
529-
return property_obligations_rec(U, current, no_timeframes, ns);
526+
return property_obligations_rec(U, current, no_timeframes);
530527
}
531528
else if(op.id() == ID_G)
532529
{
533530
// ¬G φ ≡ F ¬φ
534531
auto &G = to_G_expr(op);
535532
auto F = F_exprt{not_exprt{G.op()}};
536-
return property_obligations_rec(F, current, no_timeframes, ns);
533+
return property_obligations_rec(F, current, no_timeframes);
537534
}
538535
else if(op.id() == ID_F)
539536
{
540537
// ¬F φ ≡ G ¬φ
541538
auto &F = to_F_expr(op);
542539
auto G = G_exprt{not_exprt{F.op()}};
543-
return property_obligations_rec(G, current, no_timeframes, ns);
540+
return property_obligations_rec(G, current, no_timeframes);
544541
}
545542
else if(op.id() == ID_X)
546543
{
547544
// ¬X φ ≡ X ¬φ
548545
auto &X = to_X_expr(op);
549546
auto negX = X_exprt{not_exprt{X.op()}};
550-
return property_obligations_rec(negX, current, no_timeframes, ns);
547+
return property_obligations_rec(negX, current, no_timeframes);
551548
}
552549
else if(op.id() == ID_implies)
553550
{
554551
// ¬(a->b) --> a && ¬b
555552
auto &implies_expr = to_implies_expr(op);
556553
auto and_expr =
557554
and_exprt{implies_expr.lhs(), not_exprt{implies_expr.rhs()}};
558-
return property_obligations_rec(and_expr, current, no_timeframes, ns);
555+
return property_obligations_rec(and_expr, current, no_timeframes);
559556
}
560557
else if(op.id() == ID_and)
561558
{
562559
auto operands = op.operands();
563560
for(auto &op : operands)
564561
op = not_exprt{op};
565562
auto or_expr = or_exprt{std::move(operands)};
566-
return property_obligations_rec(or_expr, current, no_timeframes, ns);
563+
return property_obligations_rec(or_expr, current, no_timeframes);
567564
}
568565
else if(op.id() == ID_or)
569566
{
570567
auto operands = op.operands();
571568
for(auto &op : operands)
572569
op = not_exprt{op};
573570
auto and_expr = and_exprt{std::move(operands)};
574-
return property_obligations_rec(and_expr, current, no_timeframes, ns);
571+
return property_obligations_rec(and_expr, current, no_timeframes);
575572
}
576573
else if(op.id() == ID_not)
577574
{
578575
return property_obligations_rec(
579-
to_not_expr(op).op(), current, no_timeframes, ns);
576+
to_not_expr(op).op(), current, no_timeframes);
580577
}
581578
else if(op.id() == ID_sva_until)
582579
{
583580
// ¬(φ W ψ) ≡ (¬φ strongR ¬ψ)
584581
auto &W = to_sva_until_expr(op);
585582
auto strong_R = strong_R_exprt{not_exprt{W.lhs()}, not_exprt{W.rhs()}};
586-
return property_obligations_rec(strong_R, current, no_timeframes, ns);
583+
return property_obligations_rec(strong_R, current, no_timeframes);
587584
}
588585
else if(op.id() == ID_sva_s_until)
589586
{
590587
// ¬(φ U ψ) ≡ (¬φ R ¬ψ)
591588
auto &U = to_sva_s_until_expr(op);
592589
auto R = R_exprt{not_exprt{U.lhs()}, not_exprt{U.rhs()}};
593-
return property_obligations_rec(R, current, no_timeframes, ns);
590+
return property_obligations_rec(R, current, no_timeframes);
594591
}
595592
else if(op.id() == ID_sva_until_with)
596593
{
@@ -599,7 +596,7 @@ static obligationst property_obligations_rec(
599596
auto &until_with = to_sva_until_with_expr(op);
600597
auto R = R_exprt{until_with.rhs(), until_with.lhs()};
601598
auto U = sva_until_exprt{not_exprt{R.lhs()}, not_exprt{R.rhs()}};
602-
return property_obligations_rec(U, current, no_timeframes, ns);
599+
return property_obligations_rec(U, current, no_timeframes);
603600
}
604601
else if(op.id() == ID_sva_s_until_with)
605602
{
@@ -609,7 +606,7 @@ static obligationst property_obligations_rec(
609606
auto strong_R = strong_R_exprt{s_until_with.rhs(), s_until_with.lhs()};
610607
auto W =
611608
weak_U_exprt{not_exprt{strong_R.lhs()}, not_exprt{strong_R.rhs()}};
612-
return property_obligations_rec(W, current, no_timeframes, ns);
609+
return property_obligations_rec(W, current, no_timeframes);
613610
}
614611
else
615612
return obligationst{
@@ -636,10 +633,9 @@ Function: property_obligations
636633

637634
obligationst property_obligations(
638635
const exprt &property_expr,
639-
const mp_integer &no_timeframes,
640-
const namespacet &ns)
636+
const mp_integer &no_timeframes)
641637
{
642-
return property_obligations_rec(property_expr, 0, no_timeframes, ns);
638+
return property_obligations_rec(property_expr, 0, no_timeframes);
643639
}
644640

645641
/*******************************************************************\
@@ -660,12 +656,12 @@ void property(
660656
message_handlert &message_handler,
661657
decision_proceduret &solver,
662658
std::size_t no_timeframes,
663-
const namespacet &ns)
659+
const namespacet &)
664660
{
665661
// The first element of the pair is the length of the
666662
// counterexample, and the second is the condition that
667663
// must be valid for the property to hold.
668-
auto obligations = property_obligations(property_expr, no_timeframes, ns);
664+
auto obligations = property_obligations(property_expr, no_timeframes);
669665

670666
// Map obligations onto timeframes.
671667
prop_handles.resize(no_timeframes, true_exprt());

0 commit comments

Comments
 (0)