forked from cubicle-model-checker/cubicle
-
Notifications
You must be signed in to change notification settings - Fork 0
/
german_undip.cub
325 lines (280 loc) · 7.69 KB
/
german_undip.cub
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
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
type state = Invalid | Shared | Exclusive
type msg = Empty | Reqs | Reqe | Inv | Invack | Gnts | Gnte
var Exgntd : bool
var Curcmd : msg
array Chan1[proc] : msg
array Chan2[proc] : msg
array Chan3[proc] : msg
array PC[proc] : state
array Invset[proc] : bool
array Shrset[proc] : bool
array Curclient[proc] : bool
init (z) {
Chan1[z] = Empty &&
Chan2[z] = Empty &&
Chan3[z] = Empty &&
PC[z] = Invalid &&
Invset[z] = False &&
Shrset[z] = False &&
Curcmd = Empty &&
Exgntd = False &&
Curclient[z] = False
}
unsafe (z1 z2) { PC[z1] = Exclusive && PC[z2] = Exclusive }
(* #home0
#r1
LC currentcommand=requestshared & exclusivegranted=false
& channeltwo=empty & currentclient=true
& currentcommand'=empty & sharedlist'=true
& channeltwo'=grantshared
*)
transition home0(n)
requires { Curcmd = Reqs && Exgntd = False && Chan2[n] = Empty &&
Curclient[n] = True }
{ Curcmd := Empty;
Shrset[j] := case | j = n : True | _ : Shrset[j] ;
Chan2[j] := case | j = n : Gnts | _ : Chan2[j] ;
}
(*
#home1
#r2
BDP currentcommand=requestexclusive & channeltwo=empty
# & sharedlist=false
& currentclient=true
& currentcommand'=empty & sharedlist'=true
& exclusivegranted'=true & channeltwo'=grantexclusive
& [LR: p.sharedlist=false]
*)
transition home1(n)
requires { Curcmd = Reqe && Chan2[n] = Empty &&
Curclient[n] = True && Shrset[n] = False &&
forall_other i. Shrset[i] = False }
{
Curcmd := Empty; Exgntd := True;
Shrset[j] := case | j = n : True | _ : Shrset[j] ;
Chan2[j] := case | j = n : Gnte | _ : Chan2[j] ;
}
(*
#home2: channelone=requestshared, sharedlist=false
#r3
BDP currentcommand=empty & channelone=requestshared
& currentcommand'=requestshared & channelone'=empty
& invalidatelist'=false & currentclient'=true
& [LR: p.invalidatelist'=true & p.sharedlist=true
& p.currentclient'=false]
& [LR: p.invalidatelist'=false & p.sharedlist=false
& p.currentclient'=false]
*)
transition home2r3(n)
requires { Curcmd = Empty && Chan1[n] = Reqs (* && Shrset[n] = False *)}
{
Curcmd := Reqs;
Chan1[j] := case | j = n : Empty | _ : Chan1[j] ;
Invset[j] := case | j = n : False | _ : Shrset[j] ;
Curclient[j] := case | j = n : True | _ : False
}
(*
#home2: channelone=requestexclusive, sharedlist=false
#r4
BDP currentcommand=empty & channelone=requestexclusive
& currentcommand'=requestexclusive & channelone'=empty
& invalidatelist'=false & currentclient'=true
& [LR: p.invalidatelist'=true & p.sharedlist=true
& p.currentclient'=false]
& [LR: p.invalidatelist'=false & p.sharedlist=false
& p.currentclient'=false]
*)
transition home2r4(n)
requires { Curcmd = Empty && Chan1[n] = Reqe (* && Shrset[n] = False *)}
{
Curcmd := Reqe;
Chan1[j] := case | j = n : Empty | _ : Chan1[j] ;
Invset[j] := case | j = n : False | _ : Shrset[j] ;
Curclient[j] := case | j = n : True | _ : False
}
(*
#home2: channelone=requestshared, sharedlist=true
#r5
BDP currentcommand=empty & channelone=requestshared
& currentcommand'=requestshared & channelone'=empty
& invalidatelist'=true & currentclient'=true
& [LR: p.invalidatelist'=true & p.sharedlist=true
& p.currentclient'=false]
& [LR: p.invalidatelist'=false & p.sharedlist=false
& p.currentclient'=false]
*)
transition home2r5(n)
requires { Curcmd = Empty && Chan1[n] = Reqs (* && Shrset[n] = True *)}
{
Curcmd := Reqs;
Chan1[j] := case | j = n : Empty | _ : Chan1[j] ;
Invset[j] := case | j = n : True | _ : Shrset[j] ;
Curclient[j] := case | j = n : True | _ : False
}
(*
#home2: channelone=requestexclusive, sharedlist=true
#r6
BDP currentcommand=empty & channelone=requestexclusive
& currentcommand'=requestexclusive & channelone'=empty
& invalidatelist'=true & currentclient'=true
& [LR: p.invalidatelist'=true & p.sharedlist=true
& p.currentclient'=false]
& [LR: p.invalidatelist'=false & p.sharedlist=false
& p.currentclient'=false]
*)
transition home2r6(n)
requires { Curcmd = Empty && Chan1[n] = Reqe (* && Shrset[n] = True *)}
{
Curcmd := Reqe;
Chan1[j] := case | j = n : Empty | _ : Chan1[j] ;
Invset[j] := case | j = n : True | _ : Shrset[j] ;
Curclient[j] := case | j = n : True | _ : False
}
(*
#home3
#r7
LC currentcommand=requestshared & exclusivegranted=true
& invalidatelist=true & channeltwo=empty
& invalidatelist'=false & channeltwo'=invalidate
*)
transition home3(n)
requires { Curcmd = Reqs && Exgntd = True && Chan2[n] = Empty &&
Invset[n] = True }
{
Invset[j] := case | j = n : False | _ : Invset[j] ;
Chan2[j] := case | j = n : Inv | _ : Chan2[j] ;
}
(*
#home4
#r8
LC currentcommand=requestexclusive
& invalidatelist=true & channeltwo=empty
& invalidatelist'=false & channeltwo'=invalidate
*)
transition home4(n)
requires { Curcmd = Reqe && Chan2[n] = Empty && Invset[n] = True }
{
Invset[j] := case | j = n : False | _ : Invset[j] ;
Chan2[j] := case | j = n : Inv | _ : Chan2[j] ;
}
(*
#home5 grantshared,grantexclusive, invalidate
#LC currentcommand not empty & channelthree=invalidatevack
# & sharedlist'=false & exclusivegranted'=false
# & channelythree'=empty
*)
(*
transition home5(n)
requires { Curcmd <> Empty && Chan3[n] = Invack }
{
Exgntd := False;
Shrset[j] := case | j = n : False | _ : Shrset[j] ;
Chan3[j] := case | j = n : Empty | _ : Chan3[j] ;
}
*)
(*
#home5 grantshared
#r9
LC currentcommand=grantshared
& channelthree=invalidateack
& sharedlist'=false & exclusivegranted'=false
& channelthree'=empty
*)
transition home5r9(n)
requires { Curcmd = Gnts && Chan3[n] = Invack }
{
Exgntd := False;
Shrset[j] := case | j = n : False | _ : Shrset[j] ;
Chan3[j] := case | j = n : Empty | _ : Chan3[j] ;
}
(*
#home5 grantexclusive
#r10
LC currentcommand=grantexclusive
& channelthree=invalidateack
& sharedlist'=false & exclusivegranted'=false
& channelthree'=empty
*)
transition home5r10(n)
requires { Curcmd = Gnte && Chan3[n] = Invack }
{
Exgntd := False;
Shrset[j] := case | j = n : False | _ : Shrset[j] ;
Chan3[j] := case | j = n : Empty | _ : Chan3[j] ;
}
(*
#client1
#r11
LC pc=invalid
& channelone=empty
& channelone'=requestshared
*)
transition client1(n)
requires { PC[n] = Invalid && Chan1[n] = Empty }
{
Chan1[j] := case | j = n : Reqs | _ : Chan1[j] ;
}
(*
#client 2
#r12
LC pc=invalid
& channelone=empty
& channelone'=requestexclusive
*)
transition client2(n)
requires { PC[n] = Invalid && Chan1[n] = Empty }
{
Chan1[j] := case | j = n : Reqe | _ : Chan1[j] ;
}
(*
#client3
#r13
LC pc=shared
& channelone=empty
& channelone'=requestexclusive
*)
transition client3(n)
requires { PC[n] = Shared && Chan1[n] = Empty }
{
Chan1[j] := case | j = n : Reqe | _ : Chan1[j] ;
}
(*
#client4
#r14
LC pc'=invalid
& channeltwo=invalidate & channelthree=empty
& channeltwo'=empty & channelthree'=invalidateack
*)
transition client4(n)
requires { Chan2[n] = Inv && Chan3[n] = Empty }
{
PC[j] := case | j = n : Invalid | _ : PC[j] ;
Chan2[j] := case | j = n : Empty | _ : Chan2[j] ;
Chan3[j] := case | j = n : Invack | _ : Chan3[j] ;
}
(*
#client5
#r15
LC pc'=shared
& channeltwo=grantshared
& channeltwo'=empty
*)
transition client5(n)
requires { Chan2[n] = Gnts }
{
PC[j] := case | j = n : Shared | _ : PC[j] ;
Chan2[j] := case | j = n : Empty | _ : Chan2[j] ;
}
(*
#client6
#r16
LC pc'=exclusive
& channeltwo=grantexclusive
& channeltwo'=empty
*)
transition client6(n)
requires { Chan2[n] = Gnte }
{
PC[j] := case | j = n : Exclusive | _ : PC[j] ;
Chan2[j] := case | j = n : Empty | _ : Chan2[j] ;
}