//-------- DECLARE VARIBLES ----------// var b_Doctor : int , b_Receptionist : int , b_target : int , b_SUPER_ROLE : int , d_Doctor : int , d_Receptionist : int , d_target : int , d_SUPER_ROLE : int , n_Receptionist_Doctor : int , n_SUPER_ROLE : int , n_0Doctor : int , n_0Receptionist : int , n_target : int ; //-------------- BEGIN Program --------------------// begin //-------------- Init VARS ------------------------// b_Doctor = 0; b_Receptionist = 0; b_target = 0; b_SUPER_ROLE = 0; d_Doctor = 0; d_Receptionist = 0; d_target = 0; d_SUPER_ROLE = 0; n_Receptionist_Doctor = 0; n_SUPER_ROLE = 0; n_0Doctor = 0; n_0Receptionist = 0; n_target = 0; // Initialize track variables in the system n_SUPER_ROLE = n_SUPER_ROLE + 1; n_0Doctor = n_0Doctor + 5; n_0Receptionist = n_0Receptionist + 5; while ( true ) do //----- Non-deterministic assignment ------// b_Doctor = random; assume b_Doctor >= 0 and b_Doctor <= 1; b_Receptionist = random; assume b_Receptionist >= 0 and b_Receptionist <= 1; b_target = random; assume b_target >= 0 and b_target <= 1; b_SUPER_ROLE = random; assume b_SUPER_ROLE >= 0 and b_SUPER_ROLE <= 1; d_Doctor = random; assume d_Doctor >= 0 and d_Doctor <= 1; d_Receptionist = random; assume d_Receptionist >= 0 and d_Receptionist <= 1; d_target = random; assume d_target >= 0 and d_target <= 1; d_SUPER_ROLE = random; assume d_SUPER_ROLE >= 0 and d_SUPER_ROLE <= 1; //-------------- Simulation -------------------// //------------------ CAN_ASSIGN RULE NUMBER 0 ----------------- // //------------------------------------------------------------------ if(brandom and d_SUPER_ROLE==1 and n_SUPER_ROLE>0 and b_Receptionist==1 and b_Doctor==1 and n_Receptionist_Doctor>0) then if(true) then n_target = n_target+1; endif; endif; //------------------ CAN_ASSIGN RULE NUMBER 1 ----------------- // //------------------------------------------------------------------ if(brandom and d_SUPER_ROLE==1 and n_SUPER_ROLE>0 and b_Doctor==0 and n_0Doctor>0) then if(b_Doctor==1) then n_Receptionist_Doctor = n_Receptionist_Doctor+1; endif; if(b_Receptionist==0 and n_0Receptionist>0) then n_0Receptionist = n_0Receptionist-1; endif; endif; //------------------ CAN_ASSIGN RULE NUMBER 2 ----------------- // //------------------------------------------------------------------ if(brandom and d_SUPER_ROLE==1 and n_SUPER_ROLE>0 and b_Receptionist==0 and n_0Receptionist>0) then if(b_Receptionist==1) then n_Receptionist_Doctor = n_Receptionist_Doctor+1; endif; if(b_Doctor==0 and n_0Doctor>0) then n_0Doctor = n_0Doctor-1; endif; endif; //------------------- CAN_REVOKE RULE NUMBER 0 --------------------- // //------------------------------------------------------------------ if(brandom and d_SUPER_ROLE==1 and n_SUPER_ROLE>0 and b_Receptionist==1) then if(b_Receptionist==1 and b_Doctor==1 and n_Receptionist_Doctor>0) then n_Receptionist_Doctor = n_Receptionist_Doctor-1; endif; if(true) then n_0Receptionist = n_0Receptionist+1; endif; endif; //------------------- CAN_REVOKE RULE NUMBER 1 --------------------- // //------------------------------------------------------------------ if(brandom and d_SUPER_ROLE==1 and n_SUPER_ROLE>0 and b_Doctor==1) then if(b_Receptionist==1 and b_Doctor==1 and n_Receptionist_Doctor>0) then n_Receptionist_Doctor = n_Receptionist_Doctor-1; endif; if(true) then n_0Doctor = n_0Doctor+1; endif; endif; //------------ ERROR Query ---------------// if (n_target>0) then skip; endif; done; //End while loop end //End main