-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathTokenChain.prot
More file actions
70 lines (52 loc) · 1.45 KB
/
Copy pathTokenChain.prot
File metadata and controls
70 lines (52 loc) · 1.45 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
65
66
67
68
69
constant N := 3;
constant M := 3;
shadow variable fwd[1] < 2;
shadow variable tok[N] < 2;
puppet variable x[N] < M;
((future & shadow) % puppet)
(unique i < N : tok[i]==1);
process Bot[i < 1]
{
write: x[i];
read: x[i+1];
write: fwd[0], tok[i], tok[i+1];
//(assume & closed) (x[i]!=2);
shadow:
( tok[i]==1 --> fwd[0]:=1; tok[i]:=0; tok[i+1]:=1; );
puppet:
( x[i]!=1 && x[i+1]==2 --> x[i]:=1; fwd[0]:=1; tok[i]:=0; tok[i+1]:=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];
read: fwd[0];
write: tok[i-1], tok[i], tok[i+1];
shadow:
( fwd[0]==1 && tok[i]==1 --> tok[i]:=0; tok[i+1]:=1; )
( fwd[0]==0 && tok[i]==1 --> tok[i-1]:=1; tok[i]:=0; )
;
puppet:
( x[i-1]==1 && x[i]==0 && x[i+1]!=1 --> x[i]:=1; tok[i]:=0; tok[i+1]:=1; )
( x[i-1]==1 && x[i]==2 --> x[i]:=1; tok[i]:=0; tok[i+1]:=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; tok[i-1]:=1; tok[i]:=0; )
;
}
process Top[i <- map tid < 1 : N-1]
{
read: x[i-1];
write: x[i];
write: fwd[0], tok[i-1], tok[i];
//(assume & closed) (x[i]!=0);
shadow:
( tok[i]==1 --> fwd[0]:=0; tok[i-1]:=1; tok[i]:=0; );
puppet:
( x[i-1]==1 && x[i]!=1 --> x[i]:=1; )
( x[i-1]==0 && x[i]!=2 --> x[i]:=2; fwd[0]:=0; tok[i-1]:=1; tok[i]:=0; )
( x[i-1]==2 && x[i]!=2 --> x[i]:=2; )
;
}