1:- use_module(library(pita)). 2 3 4:- pita. 5 6:- begin_lpad. 7 8a0.5. 9 10b0.5. 11 12p0.3:-a,b. 13 14p0.7:- \+ a,b. 15 16p0.4:- \+ a,\+ b. 17 18p0.6 :- a,\+b. 19 20evidence:-p,b. 21 22a_b:-a,b. 23a_nb:-a,\+b. 24na_b:- \+a,b. 25na_nb:- \+a,\+b. 26 27:- end_lpad.
?-
prob(a,evidence,P)
. ?-prob(a_b,p,P)
. ?-prob(a_nb,p,P)
. ?-prob(na_b,p,P)
. ?-prob(na_nb,p,P)
.*/