From Wikipedia:
Three prisoners, A, B and C, are in separate cells and sentenced to death. The governor has selected one of them at random to be pardoned. The warden knows which one is pardoned, but is not allowed to tell. Prisoner A begs the warden to let him know the identity of one of the others who is going to be executed. "If B is to be pardoned, give me C's name. If C is to be pardoned, give me B's name. And if I'm to be pardoned, flip a coin to decide whether to name B or C."
The warden tells A that B is to be executed. Prisoner A is pleased because he believes that his probability of surviving has gone up from 1/3 to 1/2, as it is now between him and C. Prisoner A secretly tells C the news, who is also pleased, because he reasons that A still has a chance of 1/3 to be the pardoned one, but his chance has gone up to 2/3. What is the correct answer?
We use the predicates safe/1
and tell_executed/1
:
safe(i)
means that prisoner i
is not going to be executed, with i
in {a,b,c}
.
tell_executed(i)
means that the warden tells A that i
is going to be executed, with i
in {b,c}
.
What is the probability that A is not executed before the warden has spoken?
What is the probability that A is not executed after the warden has spoken?
As you can see, the probability of A being safe is the same before and after the warden communication.
What is the probability that C is not executed before the warden and A have spoken?
What is the probability that C is not executed after the warden has said B to A?
As you can see, the probability of C being safe increases from 1/2 to 2/3.
Note that if you change the probability distribution of selecting B or C when A is safe, the probability of A being safe after the communication does not change, while the one of C being safe changes. You can try it by modifying the second clause and rerunning the queries.
You can also visualize these values with: