Lecture 3 of 2
Lecture 3 of 2
Lecture 3
Expert Systems (ES)
● Expert systems are knowledge based programs which
provide expert quality solutions to the problems in
specific domain of applications.
● The core components of expert system are
− knowledge base and
− navigational capability (inference engine)
● Generally its knowledge is extracted from human
experts in the domain of application by knowledge
Engineer.
− Often based on useful thumb rules and experience rather
than absolute certainties.
● A process of gathering knowledge from domain expert
and codifying it according to the formalism is called
knowledge engineering.
Expert System Architecture
Expert System
Inference Engine
Special Interfaces
Inference & Control
Static database
User User Interface
Dynamic database
(working memory)
Explanation Module
symptom(running_nose):- --------.
symptom(body_ache) :- --------.
Cont…
positive_ symp(_, X) :- positive(X), !.
positive_ symp(Q, X) :- not(negative(X)),
query(Q, X, R), R = ‘y’.
query(Q, X, R) :- writeln(Q), readln(R),
store(X, R).
store(X, ‘y’) :- asserta(positive(X)).
store(X, ‘n’) :- asserta(negative(X)).
clear_consult_facts :- retractall(positive(_)).
clear_consult_facts :- retractall(negative(_)).
Forward Chaining
● Prolog uses backward chaining as a control strategy,
but forward chaining can be implemented in Prolog.
● In forward chaining, the facts from static and dynamic
knowledge bases are taken and are used to test the
rules through the process of unification.
● The rule is said to be fired and the conclusion (head of
the rule) is added to the dynamic database when a
rule succeeds.
● Prolog rules are coded as facts with two arguments,
first argument be left side of rule and second is the list
of sub goals in the right side of the rule.
Cont…
● Represent prolog rule as a fact by rule_fact
predicate and simple facts by fact predicate.
● Consider the following Prolog rules and facts with
their corresponding new fact representations.
a :- b. ⇒ rule_fact(a, [b]).
c :- b, e, f. ⇒ rule_fact(c, [b, e, f]).
b. ⇒ fact(b).
e. ⇒ fact(e).
f. ⇒ fact(f).