forked from cubicle-model-checker/cubicle
-
Notifications
You must be signed in to change notification settings - Fork 0
/
germanish_arith.cub
88 lines (75 loc) · 1.64 KB
/
germanish_arith.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
82
83
84
85
86
87
88
(*
type req = Empty | Reqs | Reqe
type cstate = Invalid | Shared | Exclusive
*)
var Exgntd : bool
var Curcmd : int
var Curptr : proc
array Cache[proc] : int
array Shrset[proc] : bool
init (z) { Cache[z] = 1 && Shrset[z] = False &&
Exgntd = False && Curcmd = 1 }
(* encoding of subranges *)
invariant (z) { Cache[z] < 1 }
invariant (z) { 3 < Cache[z] }
invariant (z) { Curcmd < 1 }
invariant (z) { 3 < Curcmd }
unsafe (z1 z2) { Cache[z1] = 3 && Cache[z2] = 2 }
transition t1 (n)
requires { Curcmd = 1 && Cache[n] = 1 }
{
Curcmd := 2;
Curptr := n
}
transition t2 (n)
requires { Curcmd = 1 && Cache[n] < 3 }
{
Curcmd := 3;
Curptr := n
}
transition t3 (n)
requires { Shrset[n]=True && Curcmd = 3 }
{
Exgntd := False;
Cache[j] := case
| j = n : 1
| _ : Cache[j] ;
Shrset[j] := case
| j= n : False
| _ : Shrset[j]
}
transition t4 (n)
requires { Shrset[n]=True && Curcmd = 2 && Exgntd=True }
{
Exgntd := False;
Cache[j] := case
| j = n : 1
| _ : Cache[j];
Shrset[j] := case
| j= n : False
| _ : Shrset[j]
}
transition t5 (n)
requires { Curptr = n && Curcmd = 2 && Exgntd = False }
{
Curcmd := 1;
Shrset[j] := case
| j = n : True
| _ : Shrset[j];
Cache[j] := case
| j = n : 2
| _ : Cache[j]
}
transition t6 (n)
requires { Shrset[n] = False && Curcmd = 3 && Exgntd = False && Curptr = n &&
forall_other l. Shrset[l] = False }
{
Curcmd := 1;
Exgntd := True;
Shrset[j] := case
| j = n : True
| _ : Shrset[j];
Cache[j] := case
| j = n : 3
| _ : Cache[j]
}