pomdp
observables
coin1, coin3, m, s1, s2, s3, guess, correct, agree1, agree2, agree3
endobservables
const int p1=1;
const int p2=2;
const int p3=3;
module master
m : [0..1];
pay : [1..3];
[] m=0 -> 1/2 : (m'=1) & (pay'=1) + 1/2 : (m'=1) & (pay'=2);
endmodule
module crypt1
coin1 : [0..2];
s1 : [0..1];
agree1 : [0..1];
[flip] m=1 & coin1=0 -> 0.5 : (coin1'=1) + 0.5 : (coin1'=2);
[choose1] s1=0 & coin1>0 & coin2>0 & coin1=coin2 & (pay!=p1) -> (s1'=1) & (agree1'=1);
[choose1] s1=0 & coin1>0 & coin2>0 & !(coin1=coin2) & (pay!=p1) -> (s1'=1);
[choose1] s1=0 & coin1>0 & coin2>0 & coin1=coin2 & (pay=p1) -> (s1'=1);
[choose1] s1=0 & coin1>0 & coin2>0 & !(coin1=coin2) & (pay=p1) -> (s1'=1) & (agree1'=1);
[done] s1=1 -> true;
endmodule
module crypt2 =crypt1[coin1=coin2, s1=s2, p1=p2, agree1=agree2, coin2=coin3, choose1=choose2 ] endmodule
module crypt3
coin3 : [0..2];
s3 : [0..2];
agree3 : [0..1];
guess : [0..3];
correct : [0..1];
[flip] m=1 & coin3=0 -> 0.5 : (coin3'=1) + 0.5 : (coin3'=2);
[choose3] s3=0 & coin3>0 & coin1>0 & coin3=coin1 -> (s3'=1) & (agree3'=1);
[choose3] s3=0 & coin3>0 & coin1>0 & !(coin3=coin1) -> (s3'=1);
[choose3] s3=0 & coin3>0 & coin1>0 & coin3=coin1 & (pay=p3) -> (s3'=1);
[choose3] s3=0 & coin3>0 & coin1>0 & !(coin3=coin1) & (pay=p3) -> (s3'=1) & (agree3'=1);
[done] s3=1 -> (s3'=2);
[guess1] s3=2 & guess=0 -> (guess'=1);
[guess2] s3=2 & guess=0 -> (guess'=2);
[check] s3=2 & guess>0 & guess=pay -> (correct'=1);
[check] s3=2 & guess>0 & !(guess=pay) -> true;
endmodule