Skip to content

Commit aca4098

Browse files
authored
Merge pull request #683 from diffblue/bmc-supported
tighten test for supported word-level BMC properties
2 parents e546de9 + b4da692 commit aca4098

File tree

3 files changed

+154
-12
lines changed

3 files changed

+154
-12
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
KNOWNBUG
2+
sva_until1.sv
3+
--bound 1
4+
^\[main\.p0\] always (main.a until_with main.b): REFUTED$
5+
^\[main\.p1\] always (main.a until main.b): REFUTED$
6+
^\[main\.p2\] always (main.a s_until main.b): REFUTED$
7+
^EXIT=10$
8+
^SIGNAL=0$
9+
--
10+
^warning: ignoring
11+
--
12+
These properties are not supported by the BMC engine.

regression/verilog/SVA/sva_until1.sv

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
module main(input a, b);
2+
3+
wire a, b;
4+
5+
p0: assert property (a until_with b);
6+
p1: assert property (a until b);
7+
p2: assert property (a s_until b);
8+
9+
endmodule

src/trans-word-level/property.cpp

Lines changed: 133 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ Author: Daniel Kroening, [email protected]
1010

1111
#include <util/arith_tools.h>
1212
#include <util/expr_iterator.h>
13+
#include <util/expr_util.h>
1314
#include <util/namespace.h>
1415
#include <util/std_expr.h>
1516
#include <util/symbol_table.h>
@@ -25,7 +26,7 @@ Author: Daniel Kroening, [email protected]
2526

2627
/*******************************************************************\
2728
28-
Function: bmc_supports_property
29+
Function: bmc_supports_LTL_property
2930
3031
Inputs:
3132
@@ -35,7 +36,115 @@ Function: bmc_supports_property
3536
3637
\*******************************************************************/
3738

38-
bool bmc_supports_property(const exprt &expr)
39+
bool bmc_supports_LTL_property(const exprt &expr)
40+
{
41+
// We support
42+
// * formulas that contain no temporal operator besides X
43+
// * Gφ, where φ contains no temporal operator besides X
44+
// * Fφ, where φ contains no temporal operator besides X
45+
// * GFφ, where φ contains no temporal operator besides X
46+
// * conjunctions of supported LTL properties
47+
auto non_X_LTL_operator = [](const exprt &expr)
48+
{ return is_LTL_operator(expr) && expr.id() != ID_X; };
49+
50+
if(!has_subexpr(expr, non_X_LTL_operator))
51+
{
52+
return true;
53+
}
54+
else if(expr.id() == ID_F)
55+
{
56+
return !has_subexpr(to_F_expr(expr).op(), non_X_LTL_operator);
57+
}
58+
else if(expr.id() == ID_G)
59+
{
60+
auto &op = to_G_expr(expr).op();
61+
if(op.id() == ID_F)
62+
{
63+
return !has_subexpr(to_F_expr(op).op(), non_X_LTL_operator);
64+
}
65+
else
66+
{
67+
return !has_subexpr(op, non_X_LTL_operator);
68+
}
69+
}
70+
else if(expr.id() == ID_and)
71+
{
72+
for(auto &op : expr.operands())
73+
if(!bmc_supports_LTL_property(op))
74+
return false;
75+
return true;
76+
}
77+
else
78+
return false;
79+
}
80+
81+
/*******************************************************************\
82+
83+
Function: bmc_supports_CTL_property
84+
85+
Inputs:
86+
87+
Outputs:
88+
89+
Purpose:
90+
91+
\*******************************************************************/
92+
93+
bool bmc_supports_CTL_property(const exprt &expr)
94+
{
95+
// We support
96+
// * formulas that contain no temporal operator besides AX
97+
// * GFφ, where φ contains no temporal operator besides AX
98+
// * AFφ, where φ contains no temporal operator besides AX
99+
// * AGAFφ, where φ contains no temporal operator besides AX
100+
// * conjunctions of supported CTL properties
101+
auto non_AX_CTL_operator = [](const exprt &expr)
102+
{ return is_CTL_operator(expr) && expr.id() != ID_AX; };
103+
104+
if(!has_subexpr(expr, non_AX_CTL_operator))
105+
{
106+
return true;
107+
}
108+
else if(expr.id() == ID_AF)
109+
{
110+
return !has_subexpr(to_AF_expr(expr).op(), non_AX_CTL_operator);
111+
}
112+
else if(expr.id() == ID_AG)
113+
{
114+
auto &op = to_AG_expr(expr).op();
115+
if(op.id() == ID_AF)
116+
{
117+
return !has_subexpr(to_AF_expr(op).op(), non_AX_CTL_operator);
118+
}
119+
else
120+
{
121+
return !has_subexpr(op, non_AX_CTL_operator);
122+
}
123+
}
124+
else if(expr.id() == ID_and)
125+
{
126+
for(auto &op : expr.operands())
127+
if(!bmc_supports_CTL_property(op))
128+
return false;
129+
return true;
130+
}
131+
else
132+
return false;
133+
}
134+
135+
/*******************************************************************\
136+
137+
Function: bmc_supports_SVA_property
138+
139+
Inputs:
140+
141+
Outputs:
142+
143+
Purpose:
144+
145+
\*******************************************************************/
146+
147+
bool bmc_supports_SVA_property(const exprt &expr)
39148
{
40149
if(!is_temporal_operator(expr))
41150
{
@@ -58,16 +167,6 @@ bool bmc_supports_property(const exprt &expr)
58167
return !has_temporal_operator(to_sva_nexttime_expr(expr).op());
59168
else if(expr.id() == ID_sva_s_nexttime)
60169
return !has_temporal_operator(to_sva_s_nexttime_expr(expr).op());
61-
else if(expr.id() == ID_AG)
62-
return true;
63-
else if(expr.id() == ID_G)
64-
return true;
65-
else if(expr.id() == ID_AF)
66-
return true;
67-
else if(expr.id() == ID_F)
68-
return true;
69-
else if(expr.id() == ID_X)
70-
return bmc_supports_property(to_X_expr(expr).op());
71170
else if(expr.id() == ID_sva_always)
72171
return true;
73172
else if(expr.id() == ID_sva_ranged_always)
@@ -78,6 +177,28 @@ bool bmc_supports_property(const exprt &expr)
78177

79178
/*******************************************************************\
80179
180+
Function: bmc_supports_property
181+
182+
Inputs:
183+
184+
Outputs:
185+
186+
Purpose:
187+
188+
\*******************************************************************/
189+
190+
bool bmc_supports_property(const exprt &expr)
191+
{
192+
if(is_LTL(expr))
193+
return bmc_supports_LTL_property(expr);
194+
else if(is_CTL(expr))
195+
return bmc_supports_CTL_property(expr);
196+
else
197+
return bmc_supports_SVA_property(expr);
198+
}
199+
200+
/*******************************************************************\
201+
81202
Function: property_obligations_rec
82203
83204
Inputs:

0 commit comments

Comments
 (0)