-
Notifications
You must be signed in to change notification settings - Fork 2
/
dekker++.maude
60 lines (54 loc) · 1.57 KB
/
dekker++.maude
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
load parallel++.maude
mod DEKKER++ is
inc PARALLEL++ .
subsort Int < Pid .
ops crit1 crit2 : -> UserStatement .
ops rem1 rem2 : -> LoopingUserStatement .
ops p1 p2 : -> Program .
op initial : -> MachineState .
var M : Memory .
vars P R : Program .
var S : Soup .
var I : Pid .
eq p1
= repeat
'wants_to_enter[0] := true ;
while 'wants_to_enter[1] = true do
if 'turn != 0 then
'wants_to_enter[0] := false ;
while 'turn != 0 do
skip
od ;
'wants_to_enter[0] := true
else
skip
fi
od ;
crit1 ;
'turn := 1 ;
'wants_to_enter[0] := false ;
rem1
until true != true li .
eq p2
= repeat
'wants_to_enter[1] := true ;
while 'wants_to_enter[0] = true do
if 'turn != 1 then
'wants_to_enter[1] := false ;
while 'turn != 1 do
skip
od ;
'wants_to_enter[1] := true
else
skip
fi
od ;
crit2 ;
'turn := 0 ;
'wants_to_enter[1] := false ;
rem1
until true != true li .
eq initial = { [1, p1] | [2, p2], ['turn, 1]} .
endm
search initial =>* {S | [1, crit1 ; R] | [2, crit2 ; P], M} .
search initial =>! MS:MachineState .