% Nicos, 2003. % These are predicate definitions for the Monty Hall problem. % For reletated publications see http://stoics.org.uk/~nicos/pbs % eg. http://stoics.org.uk/~nicos/pbs/Ismis03.ps.gz % http://stoics.org.uk/~nicos/pbs/Qapl01.ps.gz % to use: % ?- use_module( library(pfd)). % ?- pfd_demo. % ?- [pack(pfd_demo/examples/curtains)]. % ?- curtains( Strategy, Probability ). % % Probability=1/3, % Strategy=alpha ? % % % Probability=2/3, % Strategy=beta ? % % nope % % Here alpha is the =, ie dont switch, strategy and beta is the #, strategy. % % curtains( alpha, Pr ) :- curtains( alpha, Pr ) :- Gift ~ uniform([1,2,3]), First ~ uniform([1,2,3]), Reveal ~ uniform([1,2,3]), Reveal \# Gift, Reveal \# First, Second = First, Pr is p(Second=Gift). curtains( beta, Pr ) :- Gift ~ uniform([1,2,3]), First ~ uniform([1,2,3]), Reveal ~ uniform([1,2,3]), Reveal \# Gift, Reveal \# First, Second ~ uniform([1,2,3]), Second \# Reveal, % Second \# 1 :: First, % alternatively Second \# First, Pr is p(Second=Gift).