10
10
11
11
#include < util/arith_tools.h>
12
12
#include < util/expr_iterator.h>
13
+ #include < util/expr_util.h>
13
14
#include < util/namespace.h>
14
15
#include < util/std_expr.h>
15
16
#include < util/symbol_table.h>
25
26
26
27
/* ******************************************************************\
27
28
28
- Function: bmc_supports_property
29
+ Function: bmc_supports_LTL_property
29
30
30
31
Inputs:
31
32
@@ -35,7 +36,115 @@ Function: bmc_supports_property
35
36
36
37
\*******************************************************************/
37
38
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)
39
148
{
40
149
if (!is_temporal_operator (expr))
41
150
{
@@ -58,16 +167,6 @@ bool bmc_supports_property(const exprt &expr)
58
167
return !has_temporal_operator (to_sva_nexttime_expr (expr).op ());
59
168
else if (expr.id () == ID_sva_s_nexttime)
60
169
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 ());
71
170
else if (expr.id () == ID_sva_always)
72
171
return true ;
73
172
else if (expr.id () == ID_sva_ranged_always)
@@ -78,6 +177,28 @@ bool bmc_supports_property(const exprt &expr)
78
177
79
178
/* ******************************************************************\
80
179
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
+
81
202
Function: property_obligations_rec
82
203
83
204
Inputs:
0 commit comments