-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathTokenChainThreeState.prot
More file actions
65 lines (50 loc) · 1.2 KB
/
Copy pathTokenChainThreeState.prot
File metadata and controls
65 lines (50 loc) · 1.2 KB
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
// Token-passing on a chain
// using 3 states per process
constant N := 3;
variable x[N] < 3;
// Values are nondecreasing.
(future & closed)
(forall i < (N-1) : x[i]<=x[i+1]);
// Process has token when it sees one of:
// x[i-1]==1 && x[i]==2
// x[i]==0 && x[i+1]==2
// The Top process also has the token when x[N-1]!=2.
//(future & closed)
// (unique i < N : false
// || i > 0 && x[i-1]==1 && x[i]==2
// || i < N-1 && x[i]==0 && x[i+1]==2
// || i == N-1 && x[i]!=2
// );
// The protocol remains active.
future active shadow;
process Bot[i < 1]
{
write: x[i];
read: x[i+1];
(assume & closed) (x[i]!=2);
action:
( x[i]!=1 && x[i+1]==2 --> x[i]:=1; )
( x[i]!=0 && x[i+1]!=2 --> x[i]:=0; )
;
}
process P[i <- map tid < N-2 : tid+1]
{
read: x[i-1];
write: x[i];
read: x[i+1];
action:
( x[i-1]==1 && x[i]!=1 --> x[i]:=1; )
( x[i-1]==0 && x[i]==1 && x[i+1]==1 --> x[i]:=0; )
( x[i-1]==0 && x[i]==0 && x[i+1]==2 --> x[i]:=2; )
;
}
process Top[i <- map tid < 1 : N-1]
{
read: x[i-1];
write: x[i];
(assume & closed) (x[i]!=0);
action:
( x[i-1]==1 && x[i]!=1 --> x[i]:=1; )
( x[i-1]!=1 && x[i]!=2 --> x[i]:=2; )
;
}