#define true 1
#define false 0
bool ain,bin;
bool cA,cB;
int turn;

proctype A()
{
   cA=true;
   turn = 1;

   do
     :: cB && turn != 0 ->
accept: skip;
     :: !cB || turn==0 -> 
progress: break;
   od; 

   ain=true;
   assert(bin==false);
   ain=false;
   turn=1;
   cA=false;
}

proctype B()
{
   cB=true;
   turn = 0;
   do
     ::  cA && turn != 1 ->
accept:  skip;
     ::  !cA || turn == 1 -> 
progress: break; 
   od;

   bin=true;
   assert(ain==false);
   bin=false;
   turn=0;
   cB=false;
}

  

init
{
  cA=false;cB=false;  
  turn=0;
  ain=false;
  bin=false;
  atomic{
    run A(); 
    run B();
  }
}


