/** Concurrency: State Models and Java Programs
 *             Jeff Magee and Jeff Kramer
 *  
 */

PHIL = (sitdown->right.get->left.get
          ->eat->left.put->right.put
          ->arise->PHIL).

FORK = (get -> put -> FORK).

||DINERS(N=5)= 
   forall [i:0..N-1] 
   (phil[i]:PHIL 
   ||{phil[i].left,phil[((i-1)+N)%N].right}::FORK).

menu RUN = {phil[0..4].{sitdown,eat}}