Skip to content

Commit a40a1bf

Browse files
committed
Fix fragment of SVA supported by word-level BMC
1) The simplifier is changed to stay within SVA when simplifying SVA. 2) The logic that recognises supported SVA is adjusted.
1 parent 2c25ba1 commit a40a1bf

File tree

4 files changed

+37
-42
lines changed

4 files changed

+37
-42
lines changed

src/temporal-logic/normalize_property.cpp

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ exprt normalize_pre_implies(implies_exprt expr)
7676
exprt normalize_pre_sva_overlapped_implication(
7777
sva_overlapped_implication_exprt expr)
7878
{
79-
// Same as regular implication if lhs is not a sequence.
79+
// Same as regular implication if the lhs is not a sequence.
8080
if(!is_SVA_sequence(expr.lhs()))
8181
return or_exprt{not_exprt{expr.lhs()}, expr.rhs()};
8282
else
@@ -86,9 +86,13 @@ exprt normalize_pre_sva_overlapped_implication(
8686
exprt normalize_pre_sva_non_overlapped_implication(
8787
sva_non_overlapped_implication_exprt expr)
8888
{
89-
// Same as a->nexttime b if lhs is not a sequence.
89+
// Same as a->always[1:1] b if lhs is not a sequence.
9090
if(!is_SVA_sequence(expr.lhs()))
91-
return or_exprt{not_exprt{expr.lhs()}, sva_nexttime_exprt{expr.rhs()}};
91+
{
92+
auto one = natural_typet{}.one_expr();
93+
return or_exprt{
94+
not_exprt{expr.lhs()}, sva_ranged_always_exprt{one, one, expr.rhs()}};
95+
}
9296
else
9397
return std::move(expr);
9498
}
@@ -178,7 +182,7 @@ exprt normalize_property(exprt expr)
178182
else if(expr.id() == ID_sva_s_nexttime)
179183
{
180184
auto one = natural_typet{}.one_expr();
181-
expr = sva_ranged_always_exprt{one, one, to_sva_s_nexttime_expr(expr).op()};
185+
expr = sva_s_always_exprt{one, one, to_sva_s_nexttime_expr(expr).op()};
182186
}
183187
else if(expr.id() == ID_sva_indexed_nexttime)
184188
{
@@ -193,11 +197,18 @@ exprt normalize_property(exprt expr)
193197
nexttime_expr.index(), nexttime_expr.index(), nexttime_expr.op()};
194198
}
195199
else if(expr.id() == ID_sva_cycle_delay)
200+
{
196201
expr = normalize_pre_sva_cycle_delay(to_sva_cycle_delay_expr(expr));
202+
}
197203
else if(expr.id() == ID_sva_cycle_delay_plus)
198-
expr = F_exprt{X_exprt{to_sva_cycle_delay_plus_expr(expr).op()}};
204+
{
205+
expr = sva_s_eventually_exprt{
206+
sva_s_nexttime_exprt{to_sva_cycle_delay_plus_expr(expr).op()}};
207+
}
199208
else if(expr.id() == ID_sva_cycle_delay_star)
200-
expr = F_exprt{to_sva_cycle_delay_star_expr(expr).op()};
209+
{
210+
expr = sva_s_eventually_exprt{to_sva_cycle_delay_star_expr(expr).op()};
211+
}
201212
else if(expr.id() == ID_sva_sequence_concatenation)
202213
{
203214
auto &sequence_concatenation = to_sva_sequence_concatenation_expr(expr);

src/temporal-logic/normalize_property.h

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,16 @@ Author: Daniel Kroening, [email protected]
2424
/// a sva_iff b --> a <-> b
2525
/// a sva_implies b --> a -> b
2626
/// sva_not a --> ¬a
27-
/// a sva_and b --> a ∧ b if a and b are not SVA sequences
28-
/// a sva_or b --> a ∨ b if a and b are not SVA sequences
29-
/// sva_overlapped_implication --> ¬a ∨ b if a is not an SVA sequence
30-
/// sva_non_overlapped_implication --> ¬a ∨ sva_nexttime b if a is not an SVA sequence
31-
/// sva_nexttime φ -->
27+
/// a sva_and b --> a ∧ b if a and b are not SVA sequences
28+
/// a sva_or b --> a ∨ b if a and b are not SVA sequences
29+
/// sva_overlapped_implication --> ¬a ∨ b if a is not an SVA sequence
30+
/// sva_non_overlapped_implication --> ¬a ∨ always[1:1] b if a is not an SVA sequence
31+
/// sva_nexttime φ --> sva_always[1:1] φ
3232
/// sva_nexttime[i] φ --> sva_always[i:i] φ
33-
/// sva_s_nexttime φ -->
33+
/// sva_s_nexttime φ --> sva_always[1:1] φ
3434
/// sva_s_nexttime[i] φ --> sva_s_always[i:i] φ
35+
/// ##[*] φ --> F φ
36+
/// ##[+] φ --> X F φ
3537
/// sva_if --> ? :
3638
/// ##[0:$] φ --> s_eventually φ
3739
/// ##[i:$] φ --> s_nexttime[i] s_eventually φ

src/temporal-logic/temporal_logic.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ bool is_SVA_sequence(const exprt &);
4545
/// Returns true iff the given expression is an SVA temporal operator
4646
bool is_SVA_operator(const exprt &);
4747

48-
/// Returns true iff the given expression contains an SVA temporal operator
48+
/// Returns true iff the given expression is an SVA expression
4949
bool is_SVA(const exprt &);
5050

5151
#endif

src/trans-word-level/property.cpp

Lines changed: 11 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -145,35 +145,15 @@ Function: bmc_supports_SVA_property
145145

146146
bool bmc_supports_SVA_property(const exprt &expr)
147147
{
148-
if(!is_temporal_operator(expr))
149-
{
150-
if(!has_temporal_operator(expr))
151-
return true; // initial state only
152-
else if(
153-
expr.id() == ID_and || expr.id() == ID_or || expr.id() == ID_implies)
154-
{
155-
for(auto &op : expr.operands())
156-
if(!bmc_supports_property(op))
157-
return false;
158-
return true;
159-
}
160-
else
161-
return false;
162-
}
163-
else if(expr.id() == ID_sva_cycle_delay)
164-
return !has_temporal_operator(to_sva_cycle_delay_expr(expr).op());
165-
else if(expr.id() == ID_sva_nexttime)
166-
return !has_temporal_operator(to_sva_nexttime_expr(expr).op());
167-
else if(expr.id() == ID_sva_s_nexttime)
168-
return !has_temporal_operator(to_sva_s_nexttime_expr(expr).op());
169-
else if(expr.id() == ID_sva_always)
170-
return true;
171-
else if(expr.id() == ID_sva_ranged_always)
172-
return true;
173-
else if(expr.id() == ID_sva_s_eventually)
174-
return true;
175-
else
148+
// sva_nonoverlapped_followed_by is not supported yet
149+
if(has_subexpr(expr, ID_sva_nonoverlapped_followed_by))
150+
return false;
151+
152+
// sva_overlapped_followed_by is not supported yet
153+
if(has_subexpr(expr, ID_sva_overlapped_followed_by))
176154
return false;
155+
156+
return true;
177157
}
178158

179159
/*******************************************************************\
@@ -194,8 +174,10 @@ bool bmc_supports_property(const exprt &expr)
194174
return bmc_supports_LTL_property(expr);
195175
else if(is_CTL(expr))
196176
return bmc_supports_CTL_property(expr);
197-
else
177+
else if(is_SVA(expr))
198178
return bmc_supports_SVA_property(expr);
179+
else
180+
return false; // unknown category
199181
}
200182

201183
/*******************************************************************\

0 commit comments

Comments
 (0)