0% found this document useful (0 votes)
32 views

Tut 9

Uploaded by

Djamen
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
32 views

Tut 9

Uploaded by

Djamen
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Artificial Intelligence and Logic Programming - Tutorial 9

1∗ . Let L be a first-order language with constant symbol a, function symbol f /1 and


predicate symbol p/1. Consider the following logic program P .

p(f(f(f(f(X))))) ←p(X)
p(X) ←p(f(f(X)))
p(a)

Write down the Herbrand universe, base and least Herbrand model for this program. How
many Herbrand models does P have? Substantiate your answers.

2∗ . Let L be a first-order language with constant symbol a, function symbol f /1 and


predicate symbols p/1, q/1 and r/1. Write down the Herbrand universe and Herbrand base
for this language. Consider the following logic program P

p(f(x)) ←p(x), q(f(x))


q(f(f(x))) ←q(x), q(f(x))
r(f(f(f(x)))) ←r(x), q(x)
p(a)
q(f(a))
r(f(a))

Write down the least Herbrand model for P . Substantiate you answer.

3∗ . Let P be the logic program

p(a,b) ←
p(c,b) ←
p(X,Z) ←p(X,Y), p(Y,Z)
p(X,Y) ←p(Y,X)

Write down an SLD-refutation for the goal ←p(b, a) and the goal ←p(c, a). Note that
the definition of SLD-refutation is more general than this implemented in Prolog. Follow
exactly the format given in the lecture.

4. Find a program P and the goal G such that every SLD-tree for P ∪ {G} has two success
branches, but such that no depth first-search will ever find both success branches, regardless
of whether select left-atom or select right-atom computation rule is used.

5∗ . For the program in question 3, draw two levels of the SLD-tree for P ∪ {←p(X, c)} using
the right-first computation rule (the root is level 0, so we want two more levels). Follow
exactly the format given in the lecture. Note that the computation rule is here different
from this appearing in most Prolog’s implementations.

Assoc. Prof. R. Kozera

You might also like