Skip to content

Commit 4daebb2

Browse files
authored
Merge pull request #682 from diffblue/is_SVA
introduce is_SVA_operator and is_SVA
2 parents aca4098 + a132ec1 commit 4daebb2

File tree

2 files changed

+30
-11
lines changed

2 files changed

+30
-11
lines changed

src/temporal-logic/temporal_logic.cpp

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,7 @@ Author: Daniel Kroening, [email protected]
1313
bool is_temporal_operator(const exprt &expr)
1414
{
1515
return is_CTL_operator(expr) || is_LTL_operator(expr) ||
16-
is_SVA_sequence(expr) || expr.id() == ID_A || expr.id() == ID_E ||
17-
expr.id() == ID_sva_disable_iff || expr.id() == ID_sva_accept_on ||
18-
expr.id() == ID_sva_reject_on || expr.id() == ID_sva_sync_accept_on ||
19-
expr.id() == ID_sva_sync_reject_on || expr.id() == ID_sva_always ||
20-
expr.id() == ID_sva_ranged_always || expr.id() == ID_sva_nexttime ||
21-
expr.id() == ID_sva_s_nexttime || expr.id() == ID_sva_until ||
22-
expr.id() == ID_sva_s_until || expr.id() == ID_sva_until_with ||
23-
expr.id() == ID_sva_s_until_with || expr.id() == ID_sva_eventually ||
24-
expr.id() == ID_sva_s_eventually || expr.id() == ID_sva_cycle_delay ||
25-
expr.id() == ID_sva_overlapped_followed_by ||
26-
expr.id() == ID_sva_nonoverlapped_followed_by;
16+
is_SVA_operator(expr) || expr.id() == ID_A || expr.id() == ID_E;
2717
}
2818

2919
bool has_temporal_operator(const exprt &expr)
@@ -81,3 +71,26 @@ bool is_SVA_sequence(const exprt &expr)
8171
id == ID_sva_sequence_intersect || id == ID_sva_sequence_first_match ||
8272
id == ID_sva_sequence_throughout || id == ID_sva_sequence_within;
8373
}
74+
75+
bool is_SVA_operator(const exprt &expr)
76+
{
77+
auto id = expr.id();
78+
return is_SVA_sequence(expr) || id == ID_sva_disable_iff ||
79+
id == ID_sva_accept_on || id == ID_sva_reject_on ||
80+
id == ID_sva_sync_accept_on || id == ID_sva_sync_reject_on ||
81+
id == ID_sva_always || id == ID_sva_ranged_always ||
82+
id == ID_sva_nexttime || id == ID_sva_s_nexttime ||
83+
id == ID_sva_until || id == ID_sva_s_until ||
84+
id == ID_sva_until_with || id == ID_sva_s_until_with ||
85+
id == ID_sva_eventually || id == ID_sva_s_eventually ||
86+
id == ID_sva_cycle_delay || id == ID_sva_overlapped_followed_by ||
87+
id == ID_sva_nonoverlapped_followed_by;
88+
}
89+
90+
bool is_SVA(const exprt &expr)
91+
{
92+
auto non_SVA_operator = [](const exprt &expr)
93+
{ return is_temporal_operator(expr) && !is_SVA_operator(expr); };
94+
95+
return !has_subexpr(expr, non_SVA_operator);
96+
}

src/temporal-logic/temporal_logic.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,10 @@ bool is_LTL_operator(const exprt &);
3939
/// Returns true iff the given expression is an SVA sequence expression
4040
bool is_SVA_sequence(const exprt &);
4141

42+
/// Returns true iff the given expression is an SVA temporal operator
43+
bool is_SVA_operator(const exprt &);
44+
45+
/// Returns true iff the given expression contains an SVA temporal operator
46+
bool is_SVA(const exprt &);
47+
4248
#endif

0 commit comments

Comments
 (0)