#import "PAT.Lib.Prob";

#define targetStep 30; //the step you want to check

#define num_of_action 2;

#define num_of_agent 4;

var ActionHolder[num_of_action + 1] = [0, 4, 0];

var ActionChooser[num_of_action + 1];

var SequentialNumber[num_of_action + 1];

var step = 0;//////////////////////////////used to record the round number

 

PlayerChooseAction(i, stepBound) =

                [step < targetStep]ifa(SequentialNumber[i] < stepBound && ActionHolder[i] > call(numOfPlayerfloor, num_of_agent, num_of_action)){

                               pcase{   

                                        //method defined in external library is used to assign the transition probability

                                          call(probability_1, ActionHolder, 1, i,num_of_agent,num_of_action) :{ActionChooser[1]++; SequentialNumber[i]++}->PlayerChooseAction(i, stepBound)

                                          call(probability_1, ActionHolder, 2, i,num_of_agent,num_of_action) :{ActionChooser[2]++; SequentialNumber[i]++}->PlayerChooseAction(i, stepBound)

                                    }

                     }

                           else ifa(SequentialNumber[i] == stepBound)

                         {

                              Skip

                        }

                           else

                           {

                                {ActionChooser[i]++; SequentialNumber[i]++} -> PlayerChooseAction(i, stepBound)

                           };

 

RoundFinish = {

                           step++;

                           ActionHolder[1] = ActionChooser[1];

                           ActionHolder[2] = ActionChooser[2];

                           ActionChooser[1] = 0;

                           ActionChooser[2] = 0;

                           SequentialNumber[1] = 0;

                           SequentialNumber[2] = 0;

                       }->Skip;

 

 

System(a1, a2) = PlayerChooseAction(1, a1);PlayerChooseAction(2, a2)

;RoundFinish;System(ActionHolder[1], ActionHolder[2]);

 

aSystem = System(ActionHolder[1], ActionHolder[2]);

 

////////////////////////////////////////property to be checked//////////////////////////////

#define MDO call(isMDO, ActionHolder, num_of_action, num_of_agent) && step <= targetStep;

 

#assert aSystem() reaches MDO with prob;////////////////////used to check convergence rate