1 MODULE phil(leftfork, rightfork)
3 state: {none, left, both};
12 -- rightfork=inuse: left;
13 rightfork=inuse: {none, left};
14 -- TRUE: {left, both};
15 TRUE: {none, left, both};
23 f: array 0..6 of {free, inuse};
24 ph0: phil(f[6], f[1]);
25 ph1: phil(f[0], f[2]);
26 ph2: phil(f[1], f[3]);
27 ph3: phil(f[2], f[4]);
28 ph4: phil(f[3], f[5]);
29 ph5: phil(f[4], f[6]);
30 ph6: phil(f[5], f[0]);
41 next(ph6.state)=both | next(ph1.state)=left | next(ph0.state)=both: inuse;
45 next(ph0.state)=both | next(ph2.state)=left | next(ph2.state)=both: inuse;
49 next(ph1.state)=both | next(ph3.state)=left | next(ph3.state)=both: inuse;
53 next(ph2.state)=both | next(ph4.state)=left | next(ph4.state)=both: inuse;
57 next(ph3.state)=both | next(ph5.state)=left | next(ph5.state)=both: inuse;
61 next(ph4.state)=both | next(ph6.state)=left | next(ph6.state)=both: inuse;
65 next(ph5.state)=both | next(ph0.state)=left | next(ph0.state)=both: inuse;
68 --This finds a deadlock
80 (EF (ph0.state=both)) &
81 (EF (ph1.state=both)) &
82 (EF (ph2.state=both)) &
83 (EF (ph3.state=both)) &
84 (EF (ph4.state=both)) &
85 (EF (ph5.state=both)) &
86 (EF (ph6.state=both)))