-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathColorTree.prot
More file actions
50 lines (40 loc) · 884 Bytes
/
ColorTree.prot
File metadata and controls
50 lines (40 loc) · 884 Bytes
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
// L = number of levels in the tree.
// By default, use a tree tall enough to contain all three types of processes.
constant L := 3;
variable x[(2^L-1)] < 3;
process Root[i < 1]
{
read: x[1];
read: x[2];
write: x[0];
(future & silent)
(x[0] != x[1] && x[0] != x[2])
;
}
process P[j < (2^(L-1)-2)]
{
let i := j + 1;
let parent_idx := (i-1)/2;
let left_idx := 2*(i+1)-1;
let right_idx := 2*(i+1);
read: x[parent_idx];
read: x[left_idx];
read: x[right_idx];
write: x[i];
(future & silent)
(x[parent_idx] != x[i] && x[i] != x[left_idx] && x[i] != x[right_idx])
;
puppet action:
( x[i]==x[parent_idx] --> x[i]:=x[i]+1; )
;
}
process Leaf[j < (2^(L-1))]
{
let i := j + (2^(L-1)-1);
let parent_idx := (i-1)/2;
read: x[parent_idx];
write: x[i];
puppet action:
( x[i]==x[parent_idx] --> x[i]:=x[i]+1; )
;
}