



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




Today ...
A proof tree is a way to view query evaluation (Prolog computation)
The KB:
The KB:
?- p(X).
The proof tree:
The KB:
?- p(X).
Q: See a potential problem?
The proof tree:
solve [p(X)]
solve [p(X),q(X)] nothing (^) solve []
solve [p(X),q(X),q(X)] nothing solve [q(a)]
… nothing solve [] nothing
Prolog evaluates depth- first, left-to-right …!
So this branch will be followed infinitely, without any proofs
More examples:
r(a,b). s(b,c). q(X,Z) :- r(X,Y), s(Y,Z). ?- q(a,Y).
e(a,b). e(b,c). tc(X,Y) :- e(X,Y). tc(X,Y) :- e(X,Z), tc(Z,Y). ?- tc(a,Y). % what is reachable from a?
Notes: