-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathTokenRingDijkstra.prot
More file actions
43 lines (33 loc) · 1.06 KB
/
Copy pathTokenRingDijkstra.prot
File metadata and controls
43 lines (33 loc) · 1.06 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
// This is a clever way to specify the problem of synthesizing
// Dijkstra's token ring without shadow/puppet variables.
// Usually we are not so clever and would use the
// approach given in examplespec/TokenRing.prot.
constant N := 5;
constant M := N;
variable x[N] < M;
// Eventually one token will exist and the protocol will remain live.
// A token here is deviates from Dijkstra's definition in that
// a P[i] process only has a token when (x[i-1]==(x[i]+1)%M)
// rather than the more relaxed version (x[i-1]!=x[i]).
(future & active shadow)
(exists j < N :
forall i < N : false
|| i==0 && i==j && x[i-1]==x[i]
|| i==0 && i!=j && x[i-1]!=x[i]
|| i!=0 && i==j && x[i-1]==(x[i]+1)%M
|| i!=0 && i!=j && x[i-1]==x[i]
);
process Bot[i < 1]
{
read: x[i-1];
write: x[i];
// Actions in the legitimate states:
shadow action: ( x[i-1] == x[i] --> x[i] := x[i] + 1; );
}
process P[i <- map tid < N-1 : tid+1]
{
read: x[i-1];
write: x[i];
// Actions in the legitimate states:
shadow action: ( x[i-1] == (x[i] + 1) % M --> x[i] := x[i] + 1; );
}