Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 4

EX.

NO: 1b STUDY OF PROLOG – MEDICAL EXPERT SYSTEM


25.07.2021

NAME: RENUGA DEVI V


ROLL NO: 19EUCS115

AIM:
To study prolog using SWI-Prolog software and implement a prolog program for
medical expert system.

DESCRIPTION:

 Prolog or PROgramming in LOGics is a logical and declarative


programming language.
 Prolog is one major example of the fourth generation language
that supports the declarative programming paradigm.
 Prolog is particularly suitable for programs that involve symbolic or
non-numeric computation.
 This is the main reason to use Prolog as the programming language
in Artificial Intelligence, where symbol manipulation
and inference manipulation are the fundamental tasks.
 In Prolog, we need not mention the way how one problem can be
solved, we just need to mention what the problem is, so that
Prolog automatically solves it. However, in Prolog we are supposed
to give clues as the solution method.
NAME: RENUGA DEVI V
ROLL NO: 19EUCS115
Prolog language basically has three different elements −
• Facts − The fact is predicate that is true, for example, if we say, “Tom is
the son of Jack”, then this is a fact.
• Rules − Rules are extinctions of facts that contain conditional clauses.

To satisfy a rule these conditions should be met. For example, if we


define a rule as −
grandfather(X, Y) :- father(X, Z), parent(Z, Y)
This implies that for X to be the grandfather of Y, Z should be a parent of Y and
X should be father of Z.
• Questions − To run a prolog program, we need some questions, and
those questions can be answered by the given facts and rules.

PROGRAM:
help:-print('Analyse the upcoming diseases:'),nl,
print('skin.'),nl,print('dental.'),nl,print('respiratory.').

skin:-print('Does any itches occur?:'),'say yes', print('Apply


the creme preferred by pharmacetecian.').
skin:-print('Did any patches form?:'),'say yes', print('consult
the dermatologist.').
skin:-print('Do you have rashes?:'),'say yes', print('consult
the dermatologist.').
skin:-print('Do you have a blister?:'),'say yes', print('consult
the dermatologist.'). skin:-print('Do you suffer from
hairfall?:'),'say yes', print('consult the dermatologist.').
NAME: RENUGA DEVI V
ROLL NO: 19EUCS115

dental:-print('Do you suffer from tooth ache?:'),'say yes', print('consult


the dentist.').
dental:-print('Do you have stained teeth?:'),'say yes', print('change
to a whitening toothpaste.').
dental:-print('Do you have cavities?:'),'say yes',

print('Avoid chocolates and consider brushing teeth twice a day.').


dental:-print('Are your teeth sensitive to cold?:'),'say yes', print('consult
the dentist.').
dental:-print('Having a crooked teeth?:'),'say yes', print('consult
the dentist.').

respiratory:-print('Do you suffer from severe cough?:'),'say yes', print('May


be asthma,consult a pulmonologist.').
respiratory:-print('Do you have difficulty in breathing?:'),'say yes', print('May
be tuberculosis,consult a pulmonologist.').
respiratory:-print('Do you suffer from chest pain?:'),'say yes', print('consult
a pulmonologist.').
respiratory:-print('Do you suffer from chronic mucus?:'),'say yes', print('consult
a pulmonologist.').
respiratory:-print('Do you cough out blood?:'),'say yes', print('consult a
pulmonologit.').

'say yes':-read(Ans),yes(Ans),nl. yes(yes). yes(yea). yes(y). yes(yup).


NAME: RENUGA DEVI V
ROLL NO: 19EUCS115

OUTPUT:

RESULT:
Thus a prolog program for medical expert system was implemented in
SWI-Prolog and the output was verified

You might also like