oOo Consider a Prolog programming:
p(a).
/*#1*/
p(X) :- q(X), r(X).
/*#2*/
p(X) :- u(X).
/*#3*/
q(X) :- s(X).
/*#4*/
r(a).
/*#5*/
r(b).
/*#6*/
s(a).
/*#7*/
s(b).
/*#8*/
s(c).
/*#9*/
u(d).
/*#10*/
i). What is the result of the following command ?-p(X).
ii). Draw the corresponding derivation tree of the destination ?-p(X).
Consider a Prolog programming:
girl(lili).
/*#1*/
girl(mia).
/*#2*/
small(lili).
/*#3*/
big(mia).
/*#4*/
tall(shopia).
/*#5*/
short(lili).
/*#6*/
beautiful (Z) :- small(Z).
/*#7*/
beautiful (Z) :- tall(Z).
/*#8*/
What is the result of the following command ?- beautiful(X), girl(X). Draw
the corresponding derivation tree to explain the result.
Consider a Prolog programming:
love("Tuan",b).
/*#1*/
love(b, c).
/*#2*/
love(X, Y) :- love(X,Z), love (Z,Y).
/*#3*/
Draw the corresponding derivation tree of the destination ?-love("Tuan", Who).
Derivation tree, cut in Prolog
Assignment 1:
Assignment 2:
Assignment 3:
1