# Medical symptoms The program shown below models the effect of flu and hay fever on the sneezing symptom. ### Full program with the Prolog editor The first rule states that if somebody has flu, there is 30% probability that he has strong sneezing, 50% probability that he has moderate sneezing and 20% probability that he has no sneezing. The second rule affirms that if somebody has hay fever, there is 20% probability that he has strong sneezing, 60% probability that she has moderate sneezing and 20% probability that he has no sneezing at all. The next two facts are certain and they states that Bob has the flu and hay fever.
% load the 'pita' library to perform inference :- use_module(library(pita)). % allows to create graphical results :- if(current_predicate(use_rendering/1)). :- use_rendering(c3). :- endif. :- pita. % to be written before the program :- begin_lpad. % Rules strong_sneezing(X) : 0.3 ; moderate_sneezing(X) : 0.5 :- flu(X). strong_sneezing(X) : 0.2 ; moderate_sneezing(X) : 0.6 :- hay_fever(X). % Facts flu(bob). hay_fever(bob). % to be written after the program :- end_lpad.
What is the probability that Bob has strong sneezing?
prob(strong_sneezing(bob), P).
Let us see the histogram
prob_bar(strong_sneezing(bob), P).
-- Complete example: [sneezing.pl](example/inference/sneezing.pl) -- This is again an example of a noisy or combining rule between the conclusions of two different clauses. Complete example with the LPAD editor: [sneezing.cpl](example/inference/sneezing.cpl) -- - Reference: F. Riguzzi and T. Swift. _The PITA system: Tabling and answer subsumption for reasoning under uncertainty_. Theory and Practice of Logic Programming, 27th International Conference on Logic Programming (ICLP'11) Special Issue, 11(4-5), pages 433-449, 2011.
-- [Back to Tutorial](tutorial/tutorial.swinb)