28 lines
448 B
Text
28 lines
448 B
Text
|
MODULE main
|
||
|
VAR
|
||
|
turn : {p,q};
|
||
|
procp : process user(turn, p, q);
|
||
|
procq : process user(turn, q, p);
|
||
|
ASSIGN
|
||
|
init(turn) := p;
|
||
|
--SPEC
|
||
|
|
||
|
MODULE user(turn, myid, otherid)
|
||
|
VAR
|
||
|
state : {p1,p2};
|
||
|
ASSIGN
|
||
|
init(state) := p1;
|
||
|
next(state) :=
|
||
|
case
|
||
|
state = p1 & turn = myid : p2;
|
||
|
state = p2 : p1;
|
||
|
TRUE : state;
|
||
|
esac;
|
||
|
next(turn) :=
|
||
|
case
|
||
|
next(state) = p1 : otherid;
|
||
|
TRUE : turn;
|
||
|
esac;
|
||
|
FAIRNESS
|
||
|
running
|
||
|
|