dtmc
const N=4;
const K=8;
module counter
c : [1..N-1];
[read] c<N-1 -> (c'=c+1);
[read] c=N-1 -> (c'=c);
[done] u1 | u2 | u3 | u4 -> (c'=c);
[retry] !(u1 | u2 | u3 | u4) -> (c'=1);
[loop] s1=3 -> (c'=c);
endmodule
module process1
s1 : [0..3];
u1 : bool;
v1 : [0..K-1];
p1 : [0..K-1];
[pick] s1=0 -> 1/K : (s1'=1) & (p1'=0) & (v1'=0) & (u1'=true)
+ 1/K : (s1'=1) & (p1'=1) & (v1'=1) & (u1'=true)
+ 1/K : (s1'=1) & (p1'=2) & (v1'=2) & (u1'=true)
+ 1/K : (s1'=1) & (p1'=3) & (v1'=3) & (u1'=true)
+ 1/K : (s1'=1) & (p1'=4) & (v1'=4) & (u1'=true)
+ 1/K : (s1'=1) & (p1'=5) & (v1'=5) & (u1'=true)
+ 1/K : (s1'=1) & (p1'=6) & (v1'=6) & (u1'=true)
+ 1/K : (s1'=1) & (p1'=7) & (v1'=7) & (u1'=true);
[read] s1=1 & u1 & !p1=v2 & c<N-1 -> (u1'=true) & (v1'=v2);
[read] s1=1 & u1 & p1=v2 & c<N-1 -> (u1'=false) & (v1'=v2) & (p1'=0);
[read] s1=1 & !u1 & c<N-1 -> (u1'=false) & (v1'=v2);
[read] s1=1 & u1 & !p1=v2 & c=N-1 -> (s1'=2) & (u1'=true) & (v1'=0) & (p1'=0);
[read] s1=1 & u1 & p1=v2 & c=N-1 -> (s1'=2) & (u1'=false) & (v1'=0) & (p1'=0);
[read] s1=1 & !u1 & c=N-1 -> (s1'=2) & (u1'=false) & (v1'=0);
[done] s1=2 -> (s1'=3) & (u1'=false) & (v1'=0) & (p1'=0);
[retry] s1=2 -> (s1'=0) & (u1'=false) & (v1'=0) & (p1'=0);
[loop] s1=3 -> (s1'=3);
endmodule
module process2=process1[s1=s2,p1=p2,v1=v2,u1=u2,v2=v3] endmodule
module process3=process1[s1=s3,p1=p3,v1=v3,u1=u3,v2=v4] endmodule
module process4=process1[s1=s4,p1=p4,v1=v4,u1=u4,v2=v1] endmodule
rewards "rounds"
[pick] true : 1;
endrewards