83% found this document useful (6 votes)
9K views6 pages

Prolog Program 1

This document describes two experiments of a simulated medical diagnostic system for childhood diseases. The first experiment tests the system using predefined symptoms for a patient named Charlie. The system correctly diagnoses the patient with German measles. The second experiment revises the system to prompt the user for a patient's name and symptoms and then displays the diagnosis. In a sample run, the system diagnoses a patient named Kakoly with measles based on entered symptoms.

Uploaded by

Mehedi Hasan
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
83% found this document useful (6 votes)
9K views6 pages

Prolog Program 1

This document describes two experiments of a simulated medical diagnostic system for childhood diseases. The first experiment tests the system using predefined symptoms for a patient named Charlie. The system correctly diagnoses the patient with German measles. The second experiment revises the system to prompt the user for a patient's name and symptoms and then displays the diagnosis. In a sample run, the system diagnoses a patient named Kakoly with measles based on entered symptoms.

Uploaded by

Mehedi Hasan
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 6

DATE OF EXPERIMENT: DATE OF SUBMISSION:

10-06-2008 10-07-2008

SIGNATURE OF THE COURSE TEACHER:

EXPERIMENT NO: 01

NAME OF THE EXPERIMENT: A SIMULATED MEDICAL DIAGNOSTIC


SYSTEM FOR CHILDHOOD DISEASES.

SOURCE CODE:

domains

disease,indication,name=symbol

predicates

hypothesis(name,disease)
symptom(name,indication)

clauses

symptom(charlie,fever).
symptom(charlie,rash).
symptom(charlie,headache).
symptom(charlie,runny_nose).

hypothesis(Patient,measles):-

clearwindow,
symptom(Patient,fever),
symptom(Patient,cough),
symptom(Patient,conjunctivities),
symptom(Patient,runny_nose),
symptom(Patient,rash).

hypothesis(Patient,german_measles):-

symptom(Patient,fever),
symptom(Patient,headache),
symptom(Patient,runny_nose),
symptom(Patient,rash).
hypothesis(Patient,flu):-

symptom(Patient,fever),
symptom(Patient,headache),
symptom(Patient,body_ache),
symptom(Patient,conjunctivities),
symptom(Patient,chills),
symptom(Patient,sore_throat),
symptom(Patient,cough),
symptom(Patient,runny_nose).

hypothesis(Patient,common_cold):-

symptom(Patient,headache),
symptom(Patient,sneezing),
symptom(Patient,sore_throat),
symptom(Patient,chills),
symptom(Patient,runny_nose).

hypothesis(Patient,mumps):-

symptom(Patient,fever),
symptom(Patient,swollen_glands).

hypothesis(Patient,chicken_pox):-

symptom(Patient,fever),
symptom(Patient,rash),
symptom(Patient,body_ache),
symptom(Patient,chills).

hypothesis(Patient,whooping_cough):-

symptom(Patient,cough),
symptom(Patient,sneezing),
symptom(Patient,runny_nose).

OUTPUT IN DIALOG BOX:

Goal: hypothesis(Patient,Disease)
Patient=charlie, Disease=german_measles
1 Solution
DATE OF EXPERIMENT: DATE OF SUBMISSION:
10-06-2008 10-07-2008

SIGNATURE OF THE COURSE TEACHER:

EXPERIMENT NO: 02

NAME OF THE EXPERIMENT: THE REVISED MEDICAL DIAGNOSIS


PROBLEM.

SOURCE CODE:

domains
disease,indication=symbol
patient=string

predicates
hypothesis(patient,disease)
symptom(patient,indication)
response(char)
go

clauses
go:-
write("What is the patient's name?"),nl,
readln(Patient),
hypothesis(Patient,Disease),
write(Patient," probably has ",Disease,"."),nl.

go:-
write("Sorry,I don't seen to be able to "),nl,
write("diagnose the disease."),nl.

symptom(Patient,fever):-
write("Does ",Patient," have a fever (y/n)?"),
response(Reply),
Reply='y'.

symptom(Patient,rash):-
write("Dose ",Patient," have a rash (y/n)?"),
response(Reply),
Reply='y'.
symptom(Patient,headache):-
write("Dose ",Patient," have a headache (y/n)?"),
response(Reply),
Reply='y'.
symptom(Patient,runny_nose):-
write("Dose ",Patient," have a runny nose (y/n)?"),
response(Reply),
Reply='y'.

symptom(Patient,conjunctivities):-
write("Dose ",Patient," have conjunctivities (y/n)?"),
response(Reply),
Reply='y'.

symptom(Patient,cough):-
write("Dose ",Patient," have a cough (y/n)?"),
response(Reply),
Reply='y'.

symptom(Patient,body_ache):-
write("Dose ",Patient," have a body ache (y/n)?"),
response(Reply),
Reply='y'.

symptom(Patient,chills):-
write("Dose ",Patient," have chills (y/n)?"),
response(Reply),
Reply='y'.

symptom(Patient,sore_throat):-
write("Dose ",Patient," have a sore throat (y/n)?"),
response(Reply),
Reply='y'.

symptom(Patient,sneezing):-
write("Is ",Patient," sneezing (y/n)?"),
response(Reply),
Reply='y'.

symptom(Patient,swollen_glands):-
write("Dose ",Patient," have swollen glands (y/n)?"),
response(Reply),
Reply='y'.
hypothesis(Patient,measles):-
symptom(Patient,fever),
symptom(Patient,cough),
symptom(Patient,conjunctivities),
symptom(Patient,runny_nose),
symptom(Patient,rash).

hypothesis(Patient,german_measles):-
symptom(Patient,fever),
symptom(Patient,headache),
symptom(Patient,runny_nose),
symptom(Patient,rash).

hypothesis(Patient,flu):-
symptom(Patient,fever),
symptom(Patient,headache),
symptom(Patient,body_ache),
symptom(Patient,conjunctivities),
symptom(Patient,chills),
symptom(Patient,sore_throat),
symptom(Patient,cough),
symptom(Patient,runny_nose).

hypothesis(Patient,common_cold):-
symptom(Patient,headache),
symptom(Patient,sneezing),
symptom(Patient,sore_throat),
symptom(Patient,chills),
symptom(Patient,runny_nose).

hypothesis(Patient,mumps):-
symptom(Patient,fever),
symptom(Patient,swollen_glands).

hypothesis(Patient,chicken_pox):-
symptom(Patient,fever),
symptom(Patient,rash),
symptom(Patient,body_ache),
symptom(Patient,chills).

hypothesis(Patient,whooping_cough):-
symptom(Patient,cough),
symptom(Patient,sneezing),
symptom(Patient,runny_nose).

response(Reply):-
readchar(Reply),
write(Reply),nl.

OUTPUT IN DIALOG BOX:

Goal: go

What is the Patient’s Name?


Kakoly

Does Kakoly Have a fever (y/n)? y


Does Kakoly Have a cough (y/n)? y
Does Kakoly Have conjunctivities (y/n)? y
Does Kakoly Have a rash (y/n)? y
Does Kakoly Have a runny nose (y/n)? y

Kakoly probably has measles.


yes

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy