forked from cubicle-model-checker/cubicle
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bakery_na.cub
81 lines (62 loc) · 1.43 KB
/
bakery_na.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
type t = Idle | Wait | Crit | Linf | Lsup
array A[proc] : t
array Cpt[proc,proc] : bool
init (z y) { A[z] = Idle && Cpt[z, y] = False }
unsafe (x y) { A[x] = Crit && A[y] = Crit }
transition t1 (z)
requires { A[z] = Idle }
{
A[z] := Lsup;
}
transition sup_exit (z)
requires { A[z] = Lsup && forall_other j. Cpt[z,j] = True }
{
Cpt[x,y] := case | x = z : False | _ : Cpt[x,y];
A[z] := Wait;
}
transition sup_incr1 (z j)
requires { A[z] = Lsup && j < z && Cpt[z,j] = False }
{
Cpt[z,j] := True;
}
transition sup_incr2 (z j)
requires { A[z] = Lsup && z < j && A[j] = Idle && Cpt[z,j] = False }
{
Cpt[z,j] := True;
}
transition sup_abort (z j)
requires { A[z] = Lsup && z < j && A[j] <> Idle && Cpt[z,j] = False }
{
Cpt[x,y] := case | x = z : False | _ : Cpt[x,y];
}
transition t2 (z)
requires { A[z] = Wait }
{
A[z] := Linf
}
transition inf_exit (z)
requires { A[z] = Linf && forall_other j. Cpt[z,j] = True }
{
Cpt[x,y] := case | x = z : False | _ : Cpt[x,y];
A[z] := Crit;
}
transition inf_incr1 (z j)
requires { A[z] = Linf && z < j && Cpt[z,j] = False }
{
Cpt[z,j] := True;
}
transition inf_incr2 (z j)
requires { A[z] = Linf && j < z && A[j] = Idle && Cpt[z,j] = False }
{
Cpt[z,j] := True;
}
transition inf_abort (z j)
requires { A[z] = Linf && j < z && A[j] <> Idle && Cpt[z,j] = False }
{
Cpt[x,y] := case | x = z : False | _ : Cpt[x,y];
}
transition tr3 (z)
requires { A[z] = Crit }
{
A[z] := Idle
}