From [1]:
the Monty Hall puzzle ... gets its name from the TV game show hosted by Monty Hall... A player is given the opportunity to select one of three closed doors, behind one of which there is a prize. Behind the other two doors are empty rooms. Once the player has made a selection, Monty is obligated to open one of the remaining closed doors which does not contain the prize, showing that the room behind it is empty. He then asks the player if he would like to switch his selection to the other unopened door, or stay with his original choice. Here is the problem: Does it matter if he switches?
We use the predicates:
prize(A)
: the prize is behind door A
,
with A
in {1,2,3}
selected(A)
: the player selects door A
open_door(A)
: Monty opens door A
win_keep
: the player wins in case he keeps his selection
win_switch
: the player wins in case he switches door
This is generalized version of monty.swinb because the player can here select any door.
What is the probability that the player wins if he keeps his choice?
What is the probability that the player wins if he switches door?
The probability if the player switches grows from 1/3 to 2/3.
Note that if you change the probability distribution of Monty selecting a door to open when the prize is behind the door selected by the player, then the probability of winning by switching remains the same. You can try it by modifying the third clause and rerunning the queries.
You can also visualize these values with:
[1] Chitta Baral, Michael Gelfond, and Nelson Rushton. "Probabilistic reasoning with answer sets." Theory and Practice of Logic Programming 9.01 (2009): 57-144. http://www.public.asu.edu/~cbaral/papers/plogJune20-08.pdf