1/* 2Example showing the effect of noisy or. From 3J. Vennekens, Marc Denecker, and Maurice Bruynooghe. CP-logic: A language of 4causal probabilistic events and its relation to logic programming. 5Theory Pract. Log. Program., 9(3):245-308, 2009. 6*/ 7:- use_module(library(pita)). 8 9:- if(current_predicate(use_rendering/1)). 10:- use_rendering(c3). 11:- endif. 12 13:- pita. 14 15:- begin_lpad. 16 17% Russian roulette with two guns, left_gun and right_gun 18 19death 1/6 :- pull_trigger(left_gun). 20% if you pull the trigger of the left gun, you are dead with probability 1/6 21 22death 1/6 :- pull_trigger(right_gun). 23% if you pull the trigger of the right gun, you are dead with probability 1/6 24 25pull_trigger(left_gun). 26% you surely pull the trigger of the left gun 27pull_trigger(right_gun). 28% you surely pull the trigger of the right gun 29 30:- end_lpad.
?-
prob(death,Prob)
. % what is the probability that you are dead? % expected result 0.3055555555555556 ?-prob(death,Prob)
,bar(Prob,C)
. % what is the probability that you are dead? % expected result 0.3055555555555556 */