% mpptest.pl - Test file for MPP

diagnosis(P,Diseases) :-
  bagof((D,Cf),
        (disease(D),
         demo(hasDisease(P,D),Cf)),
        Diseases).

disease(commonCold).
disease(flu).
disease(colic).
disease(plauge).

hasDisease(P,plague) if foaming(P) # 50.

hasDisease(P,commonCold) if 
  symptom(P,fever) and
  symptom(P,congestion) and
  ~(symptom(P,hypocondria)) # 70.

hasDisease(P,flu) if 
  symptom(P,vomiting) and
  symptom(P,fever) # 80.

hasDisease(P,commonCold) if 
  symptom(P,sneezing) # 80.

hasDisease(P,colic) if  
  child(P),
  symptom(P,abdominalPain) and
  ~(symptom(P,vomiting)) # 80.

hasDisease(P,plague) if dimented(P) # 30.

% database about john
symptom(john,headache)#50.
symptom(john,fever)#100.
symptom(john,congestion)#100.
symptom(john,vomiting)#10.
symptom(john,nausea)#0.
symptom(john,paranoia)#90.
symptom(john,hypocondria)#70.
symptom(john,sneezing)#90.
sex(john,male)#100.
weight(john,300)#100.
dimented(john)#100.
foaming(john)#100.

child(P) :- age(P,A), A<3.

