-
Notifications
You must be signed in to change notification settings - Fork 0
/
PLTL+RV_2_Lustre.lus
228 lines (173 loc) · 5.47 KB
/
PLTL+RV_2_Lustre.lus
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
-- Runtime Monitoring Operators (Start, End, Interval, First, Last)
-- Start(\phi) := \phi is true in the current state and false in the previous state
node Start(i: bool) returns (o:bool);
let
o = i and (not Y(i));
tel
--node Start(i: bool) returns (o:bool);
--let
-- o = i and (not (false -> pre(i)));
--tel
-- End \phi is false in the current state and true in the previous state
node End(i: bool) returns (o:bool);
let
o = not i and Y(i);
tel
--node End(i: bool) returns (o:bool);
--let
-- o = not i and Y(i);
--tel
-- Interval [\phi,\psi) := \psi was never true since last time \phi was true, include the state when \phi was true.
node Interval(i, j: bool) returns (o:bool);
let
o = (not j) and S (Y(not j), i);
tel
--node Interval(i, j: bool) returns (o:bool);
--let
-- o = (not j) and S (false -> pre (not j), i);
--tel
-- Intervalw [\phi,\psi) := weak internal
node Intervalw(i, j: bool) returns (o:bool);
let
o = (not j) and S (Z(not j), i);
tel
-- First
node First(i: bool) returns (o:bool);
let
o = i and Sofar(Z(not i));
tel
--node First( i : bool ) returns ( o : bool );
--let
-- o = i and Sofar(true -> pre(not i));
--tel
-- Last
node Last(i: bool) returns (o:bool);
let
o = First(not i);
tel
-- Past Time LTL Temporal Operators (Y, Z, O, H, S, T) in Lustre.
-- [Reference for Past Time LTL:]
-- Cimatti, Alessandro, Marco Roveri, and Daniel Sheridan. "Bounded verification of past LTL."
-- In International Conference on Formal Methods in Computer-Aided Design,
-- pp. 245-259. Springer, Berlin, Heidelberg, 2004.
-- Yesterday := Y(\phi) is true iff \phi holds at the previous time instant while it is always false at time point zero.
node Y(i: bool) returns (o:bool);
let
o = false -> (pre i);
tel
-- Weak Yesterday := Z(\phi) is true iff \phi holds at the previous time instant while it is always true at time point zero.
node Z(i: bool) returns (o:bool);
let
o = true -> (pre i);
tel
-- Usage: not(Y(i)) = Z (not(i))
-- Once := O(\phi) was true iff \phi is true at some past time instance including the present time point.
node O(i: bool) returns (o:bool);
let
o = i or Y(o);
tel
-- alternative definition
--node O(i: bool) returns (o:bool);
--let
-- o = i or (false -> pre o);
--tel
-- -- Sofar(\phi) is true at any point iff \phi has been true from the beginning until that point
node Sofar( i : bool ) returns ( o : bool );
let
o = i -> (i and (pre o));
tel
-- Historically := H(\phi) is true if and only if \phi is always true in the past including the present time.
node H(i: bool) returns (o:bool);
let
o = i and Z(o);
tel
--node H(i: bool) returns (o:bool);
--let
-- o = i and (true -> pre o);
--tel
-- X Since Y
-- \phi Since \psi is true if and only if \psi is true in the past and \phi is true from then up to now.
node S(i, j: bool) returns (o:bool);
let
o = j or (i and Y(o));
tel
--node S(i, j: bool) returns (o:bool);
--let
-- o = j or (i and (false ->(o)));
--tel
node Sw(i, j: bool) returns (o:bool);
let
o = j or (i and Z(o));
tel
--node Sw(i, j: bool) returns (o:bool);
--let
-- o = j or (i and (true -> pre o));
--tel
-- Since X Y.
-- Since(\phi,\psi) is true precisely when \phi has been true at some point and \psi has been continuously true afterwards.
-- node Since( X, Y : bool ) returns ( Z : bool );
-- let
-- Z = X or (Y and (false -> pre Z));
--tel
-- T (Trigger)
-- Usage: \phi T \psi = \not (\not\phi S \not\psi)
-- \phi T \psi is true if and only if \psi continuously holds in the past or \psi holds until \phi holds
node T(i: bool; j:bool) returns (o:bool);
let
o = j and (i or Z(o));
tel
--node T(i: bool; j:bool) returns (o:bool);
--let
-- o = j and (i or (true -> o));
--tel
node EQ_PLTL(phi:bool; psi:bool) returns (o:bool);
var p1: bool;
var p2: bool;
var p3: bool;
var p4: bool;
var p5: bool;
var p6: bool;
var p7: bool;
var p8: bool;
var p9: bool;
var p10: bool;
var p11: bool;
var p12: bool;
var p13: bool;
var p14: bool;
var p15: bool;
let
p1 = Y(phi) = (false -> pre(phi));
--%PROPERTY "Y(\phi) = false -> pre(\phi)" p1;
p2 = Z(not phi) = not Y(phi) ;
--%PROPERTY "Z(not \phi) = not Y(\phi)" p2;
p3 = O(not phi) = not H(phi);
--%PROPERTY "O(not \phi) = not H(\phi)" p3;
p4 = H(not phi) = not O(phi);
--%PROPERTY "H(not \phi) = not O(\phi)" p4;
p5 = T(not phi, not psi) = not S(phi, psi) ;
--%PROPERTY "T(not \phi, not \psi) = not S(\phi,\psi)" p5;
p6 = Sofar(phi) = H(phi);
--%PROPERTY "Sofar(\phi) = H(\phi)" p6;
---------------------------------------------------------------
-- Proposition1 Ref[]
p7 = O(phi) = S(true, phi);
--%PROPERTY "O(\phi) = S(true, \phi)" p7;
p8 = H(phi) = not O(not phi);
--%PROPERTY "H(\phi) = not O(not \phi)" p8;
p9 = H(phi) = Sw(phi, false);
--%PROPERTY "H(phi) = S(phi, false)" p9;
p10 = Sw(phi, psi) = (H(phi) or S(phi, psi));
--%PROPERTY "Sw(\phi, \psi) = H(\phi) or S(\phi, \psi)" p10;
p11 = S(phi, psi) = (O(psi) and Sw(phi, psi));
--%PROPERTY "S(\phi, \psi) = O(\psi) and Sw(\phi, \psi)" p11;
---------------------------------------------------------------
p12 = Start(phi) = (phi and not Y(phi));
--%PROPERTY p12;
p13 = End(phi) = (not phi and Y(phi));
--%PROPERTY p13;
p14 = Interval(phi, psi) = (not psi and S(Y(not psi), phi));
--%PROPERTY p14;
p15 = Intervalw(phi, psi) = (not psi and Sw(Y(not psi), phi));
---------------------------------------------------------------
tel