Skip to content

Commit 8b6c449

Browse files
authored
Merge pull request #1225 from diffblue/tautology-checker
EBMC: tautology checker
2 parents 867bb66 + b5fe0b2 commit 8b6c449

File tree

12 files changed

+174
-13
lines changed

12 files changed

+174
-13
lines changed

regression/ebmc-spot/sva-buechi/sequence5.desc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
CORE
22
../../verilog/SVA/sequence5.sv
33
--buechi
4-
^\[main\.p0\] 1: PROVED up to bound \d+$
4+
^\[main\.p0\] 1: PROVED \(tautology\)$
55
^\[main\.p1\] 0: REFUTED$
66
^\[main\.p2\] 1'bx: REFUTED$
77
^\[main\.p3\] 1'bz: REFUTED$

regression/ebmc-spot/sva-buechi/sva_and1.desc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
CORE
22
../../verilog/SVA/sva_and1.sv
33
--buechi
4-
^\[main\.p0\] always \(1 and 1\): PROVED up to bound \d+$
4+
^\[main\.p0\] always \(1 and 1\): PROVED \(tautology\)$
55
^\[main\.p1\] always \(1 and 0\): REFUTED$
66
^\[main\.p2\] always \(1 and 32'b0000000000000000000000000000000x\): REFUTED$
77
^EXIT=10$

regression/ebmc-spot/sva-buechi/sva_iff1.desc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
CORE
22
../../verilog/SVA/sva_iff1.sv
33
--buechi
4-
^\[main\.p0\] always \(1 iff 1\): PROVED up to bound \d+$
4+
^\[main\.p0\] always \(1 iff 1\): PROVED \(tautology\)$
55
^\[main\.p1\] always \(1 iff 0\): REFUTED$
66
^\[main\.p2\] always \(1 iff 32'b0000000000000000000000000000000x\): REFUTED$
77
^EXIT=10$

regression/ebmc-spot/sva-buechi/sva_implies1.desc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
CORE
22
../../verilog/SVA/sva_implies1.sv
33
--buechi
4-
^\[main\.p0\] always \(1 implies 1\): PROVED up to bound \d+$
4+
^\[main\.p0\] always \(1 implies 1\): PROVED \(tautology\)$
55
^\[main\.p1\] always \(1 implies 0\): REFUTED$
66
^\[main\.p2\] always \(1 implies 32'b0000000000000000000000000000000x\): REFUTED$
77
^EXIT=10$

regression/ebmc-spot/sva-buechi/sva_not1.desc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
CORE
22
../../verilog/SVA/sva_not1.sv
33
--buechi
4-
^\[main\.p0] always not 0: PROVED up to bound \d+$
4+
^\[main\.p0] always not 0: PROVED \(tautology\)$
55
^\[main\.p1] always not 1: REFUTED$
66
^EXIT=10$
77
^SIGNAL=0$
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
CORE
2+
tautology1.smv
3+
4+
^\[.*\] 2 > 1: PROVED \(tautology\)$
5+
^\[.*\] G 2 > 1: PROVED \(tautology\)$
6+
^\[.*\] X 2 > 1: PROVED \(tautology\)$
7+
^\[.*\] F 2 > 1: PROVED \(tautology\)$
8+
^\[.*\] 2 > 1: PROVED \(tautology\)$
9+
^\[.*\] AG 2 > 1: PROVED \(tautology\)$
10+
^\[.*\] AX 2 > 1: PROVED \(tautology\)$
11+
^\[.*\] AF 2 > 1: PROVED \(tautology\)$
12+
^EXIT=0$
13+
^SIGNAL=0$
14+
--
15+
^warning: ignoring
16+
--
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
MODULE main
2+
3+
LTLSPEC 2>1
4+
LTLSPEC G 2>1
5+
LTLSPEC X 2>1
6+
LTLSPEC F 2>1
7+
CTLSPEC 2>1
8+
CTLSPEC AG 2>1
9+
CTLSPEC AX 2>1
10+
CTLSPEC AF 2>1

src/ebmc/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ SRC = \
3636
show_formula_solver.cpp \
3737
show_properties.cpp \
3838
show_trans.cpp \
39+
tautology_check.cpp \
3940
transition_system.cpp \
4041
waveform.cpp \
4142
#empty line

src/ebmc/instrument_buechi.cpp

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -64,15 +64,24 @@ void instrument_buechi(
6464
transition_system.trans_expr.trans() =
6565
and_exprt{transition_system.trans_expr.trans(), buechi.trans};
6666

67-
// Replace the normalized property expression.
68-
// Note that we have negated the property,
69-
// so this is the negation of the Buechi acceptance condition.
70-
property.normalized_expr =
71-
F_exprt{G_exprt{not_exprt{buechi.liveness_signal}}};
67+
// Replace the normalized property expression
68+
// by the Buechi acceptance condition.
69+
exprt::operandst property_conjuncts;
70+
71+
if(!buechi.liveness_signal.is_false())
72+
{
73+
// Note that we have negated the property,
74+
// so this is the negation of the Buechi acceptance condition.
75+
property_conjuncts.push_back(
76+
F_exprt{G_exprt{not_exprt{buechi.liveness_signal}}});
77+
}
7278

7379
if(!buechi.error_signal.is_true())
74-
property.normalized_expr = and_exprt{
75-
property.normalized_expr, G_exprt{not_exprt{buechi.error_signal}}};
80+
{
81+
property_conjuncts.push_back(G_exprt{not_exprt{buechi.error_signal}});
82+
}
83+
84+
property.normalized_expr = conjunction(property_conjuncts);
7685

7786
message.debug() << "New property: " << format(property.normalized_expr)
7887
<< messaget::eom;

src/ebmc/property_checker.cpp

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ Author: Daniel Kroening, dkr@amazon.com
2525
#include "netlist.h"
2626
#include "output_file.h"
2727
#include "report_results.h"
28+
#include "tautology_check.h"
2829

2930
#include <chrono>
3031
#include <iostream>
@@ -382,7 +383,22 @@ property_checker_resultt engine_heuristic(
382383
message.status() << "No engine given, attempting heuristic engine selection"
383384
<< messaget::eom;
384385

385-
// First check whether we have a low completenes threshold
386+
// First check if we can tell that the property is a tautology
387+
message.status() << "Tautology check" << messaget::eom;
388+
389+
auto tautology_check_result =
390+
tautology_check(cmdline, properties, solver_factory, message_handler);
391+
392+
properties.properties = tautology_check_result.properties;
393+
394+
if(!properties.has_unfinished_property())
395+
return tautology_check_result; // done
396+
397+
properties.reset_failure();
398+
properties.reset_inconclusive();
399+
properties.reset_unsupported();
400+
401+
// Check whether we have a low completenes threshold
386402
message.status() << "Attempting completeness threshold" << messaget::eom;
387403

388404
auto completeness_threshold_result = completeness_threshold(

0 commit comments

Comments
 (0)