
98
Now we can give the completeness result for hierarchical programs. Versions
of
this result are due to Clark [15], Shepherdson [97], and Lloyd and Topor [63],
Theorem
16
..
3 (Completeness
of
SLDNF-Resolution for Hierarchical Programs)
Let P be a hierarchical normal program, G a normal goal, and R a safe
computation rule. Suppose that P
u
{G}
is allowed. Then the following
properties hold.
(a)
The SLDNF-tree for P U
{G}
via R exists and is finite.
(b)
If
eis a correct answer for comp(p) u
{G}
and eis a ground substitution for
all variables in G, then
eis an R-computed answer for P u
{G}.
Definition Let P be a normal program, G a normal goal, and R a safe
computation rule.
An
SWNF
-derivation
of
P u
{G}
via R is an SLDNF-derivation
of
P u
{G}
in which the computation rule R is used to select literals.
An
SWNF-tree
for P U
{G}
via R is an SLDNF-tree for P u
{G}
in which
the computation rule R is used to select literals.
An
SWNF
-refutation
of
P u
{G}
via R is an SLDNF-refutation
of
P u
{G}
in which the computation rule R is used to select literals.
An
R-computed answer for P U
{G}
is a computed answer for P u
{G}
which
has come from an
SLDNF~refutation
of
P u
{G}
via R
Proof
(a) By proposition 15.1(a), the computation
of
P u
{G}
via R does not
flounder.
To show that there are no infinite derivations, we use multisets.
If
M and
M'
are finite multisets
of
non-negative integers, then we define M' < M
if
M' can
be
obtained from M by replacing one
or
more elements in M by any finite number of
non-negative integers, each
of
which is smaller than one
of
the replaced elements,
It is shown in [28] that the set
of
all finite multisets
of
non-negative integers under
< is a well-founded set. Now consider the multiset
of
levels
of
the predicate
symbols in the literals
of
the body
of
a goal G' in an SLDNF-derivation via R
Since P is hierarchical, the child
of
the goal G' has a smaller multiset than G',
Hence there are no infinite derivations.
Moreover, an induction argument on the levels
of
predicate symbols shows that
the SLDNF-tree for P
u
{G}
via R does indeed exist.
(b) Note that, by corollary 14.8, comp(P) is consistent because P is
99
ground negative literal, called the selected literal, in that goal.
§16. Completeness of SLDNF-Resolution
Example Consider the normal program P
r+-p
r
+--p
P+-p
Then th
'd'
"
e
1 entlty
subStItUtlon
E is a correct answer for comp(P) u {+-r} but E
cannot be computed. (See problem 21.) ,
These examples show that to obtain a completeness result it
wI'll
be
t ' , necessary
o
Im:os
e
rather strong restrictions. We now show that for hierarchical programs
~ere
IS
,such
a completeness result. Sadly, this result is not very useful because
th~
hIerarchIcal condition ban .
, s any
recursIOn.
For the statement
of
this result, we need
to generalIse the concept
of
a computation rule.
Chapter 3. Normal Programs
Next, we turn to the question
of
completeness
of
SLDNF-resolution.
Example Consider the
program
p(x)
+-
q(a) +-
r(b) +-
and the goal +-p(x),-q(x). Clearly, x/b is a correct answer H th'
can never be . owever,
IS
answer
computed, nor can any more general version
of
it.
This simple example clearly illustrates one
of
the p"oblems
1
• in obtaining a
comp eteness result for SLDNF-resolution SLD-
l'
. reso utIon returns most general
answers. In the above exam
pI
.
'II
e,
It
WI
return the identity substimtion
".co
th
subgoal
()
Wh
'"
1
1
r e
, . p x . at we would like is for the negation
as
failure rule to further
mstantIate x by the binding
x/b and
th
,
us
compute the correct answer. However
n:~::~
as, failure is
o~y
a test and cannot make any bindings. Unless it
i~
P .
WIth
a goal whIch already is the root
of
a finitely failed SLD-tree it has
no machmery for
further'
t " ,
bo ms
antlatIng the goal so as to obtain such a tree
In
the
a ve example,
+-q(x) is not the root
of
a finitely failed SLD tree d
'.
fail h - an negatlon
as
ure as no way to find the appropriate binding x/b.
The next example illustrates another problem
I'n
obtaining a completeness
result for SLDNF-resolution.
Definition A
Sofie
co t
t'
I'
,
mpu a
Lon
ru e
IS
a
functIOn
from a set
of
normal g
al
none
of
which consists entirely
of
non-ground negative literals, to a set
of
lit:r:~
such that the value
of
the function for such a goal is either a positive literal or a