Exercise 12.14 Consider the following logic program: ap(emp, L, L). ap(c(H, T), L, c(H, R)) ap(T,
Question:
Exercise 12.14 Consider the following logic program:
ap(emp, L, L).
ap(c(H, T), L, c(H, R)) ←
ap(T, L, R).
adj(A, B, L) ←
ap(F, c(A, c(B, E)), L).
(a) Give a top-down derivation (including all substitutions) for one answer to the query ask adj
(b, Y, c
(a, c
(b, c
(b, c
(a, emp))))).
(b) Are there any other answers? If so, explain where a different choice could be made in the derivation in the previous answer, and continue the derivation, showing another answer. If there are no other answers, explain why not.
[You are meant to do this exercise as would a computer, without knowing what the symbols mean. If you want to give a meaning to this program, you could read ap as append, c as cons, emp as empty, and adj as adjacent.]
Step by Step Answer:
Artificial Intelligence Foundations Of Computational Agents
ISBN: 9780521519007
1st Edition
Authors: David L. Poole, Alan K. Mackworth