Tutorial # 8
Q1 : Expert systems
Given the Knowledge Base (KB) and the Working Memory (WM) of an expert system as shown
below, we wish to deduce the fact W using Forward Chaining. Show clearly all cycles, and in
each cycle circle the rule that is being executed. Use rule order as implied priority when you
have more than one appropriate rule.
1- IF P and Z Then W
2- IF P Then Q
3- IF Q and P Then R
4- IF R and Q Then T
5- IF Q and T Then Z
6- IF P and R Then Y
Consider the following PROLOG database. For each flight we know duration of flight and
distance between airports. Our data is being stored in predicates flight(StartAirport,
DestinationAirport, Duration, Distance).
a. Define predicate connExists(Start,Destination) that checks whether there is
connection between two airports.
b. Write the query and answer the question: Is there a connection between Singapore (sin)
and Paris CDG (cdg)?
c. Which airports have connections to Singapore?
Given the following PROLOG database:
Write and answer the following queries in PROLOG (in each case indicate the facts and rules
a. Does Tasneem like trains?
b. Does Aisha like Tasneem?
c. Does Said like Aisha?
d. Who likes Hassan?
e. What are Nouf’s hobbies?