Professional Documents
Culture Documents
IAI - Prolog Programming
IAI - Prolog Programming
________________________________________________________________________________________________________
Question 1
A television company is holding auditions for a talent show. The knowledge base below shows some
facts and rules about the competitors.
ii) If a person has an excellent voice with a good dancing skill, he or she will be reserved.
Betty
c) Write a query and its result for the rules a)i) and a)ii).
?-excellent voice, dance (zack)
?-excellent voice, good dancing (Betty)
Question 2
In a school a particular programming language is used to record facts and rules. These include the following:
Version 022021
PROLOG PROGRAMMING AAPP002-4-2-IAI
________________________________________________________________________________________________________
b) Write a rule which will identify which teacher is teaching which students.
Teaches programming (x) :- learn programming (x)
Teaches science (y) :- learn science (y)
Question 3
A logic program is used to represent, as a set of facts and rules, details of parent and child. The set of
facts are shown below:
b) father(X, Y)
father_of(X,Y):- male(X),
parent_of(X,Y).
a) grandfather(X, Y)
grandfather_of(X,Y):- female(X),
parent_of(X,Z),
parent_of(Z,Y).
Version 022021