Вы находитесь на странице: 1из 4

Negative Knowledge

Definite programs express only positive


knowledge (rules and facts)

N g ti iin L
Negation Logic
gi PProgramming
g i g Example:
E l
An object is above a second object if it is
either
ith on ttop off it or on ttop off a thi
third
d
object which is above the second object.
The object c
c is on top of b
b which is on
top of a

1 2

Finitely failed SLD tree of ABOVE(b, c):


SLD-tree
Define
ABOVE(x, y): object x is above object y
ON(x, y): object x is on top of y

Definite program:
ABOVE(x,( , y) ON(x,
( , y)
ABOVE(x, y) ON(x, z), ABOVE(z, y)
ON(c,
( , b))
ON(b, a)

ABOVE(b c)) iis not d


ABOVE(b, derivable
i bl ffrom above
b program
3 4
Negation as (finite) failure (NAF) rule Note:
~A
A is derivable from a definite program P if ~ABOVE(b,
( , c)) is not a logical
g consequence
q
the goal A has a finitely failed SLD-tree of the program NAF rule is unsound
with respect to P.
Remark:
Example
E l (previous):
( i ) A prooff system
Any t th
thatt permits
it iinferring
f i a
~ABOVE(b, c) is derivable from NAF rule negative literal from a definite program
i unsound
is d

5 6

SLDNF-resolution for Definite Programs Definition:


Combination of SLD-resolution (to resolve A generall goall iis a goall off the
h fform
positive literals) and NAF (to resolve
L1, , Lm (m 0)
negative literals)
where each Li is a positive or a negative
Goal can include both p
positive and literal
negative literals

7 8
Definition (SLDNF-resolution for definite programs)
Let P be a definite program,
program G0 a general goal,
goal R a
computation rule. An SLDNF-derivation of G0 (using P
Note:
N t
and R) is a finite or infinite sequence of general goals Each step of an SLDNF-derivation produces
G0
C0
G1
C1
G 2 G n 1 C

n 1
Gn a substitution an mgu in case of (i) and
empty substitution in case of (ii)
where
h Gi
Ci
Gi 1 if either
ih
(i) R-selected literal in Gi is positive and Gi+1 is
Negative literal ~A succeeds if A has
d i d ffrom Gi and
derived d Ci by
b one step
t off SLD
SLD- a finitely failed SLD-tree.
SLD tree
resolution
~A finitelyy fails if A succeeds
(ii) R-selected
R l t d lit literall iin Gi is
i off the
th form
f A goall A
~A, A
has a finitely failed SLD-tree and Gi+1 is obtained
from Gi by removing ~A (in which case Ci is a
speciall marker
k FF)
9 10

A derivation is said to be (finitely) failed if Example:


(1) selected literal is positive and does not Consider following program describing a
unify with head of any clause or world where block c is piled on top of
(2) selected literal is negative and finitely b which is on top of a
failed
ON(c, b)
ON(c
A derivation is said to be stuck if selected ON(b, a)
subgoal is of the form ~A and A is
infinitely failed (infinite SLD-tree)

11 12
Theorem:
SLDNF d i i off ON(x,
SLDNF-derivation ON( y),
) ~ON(z,
ON( x))
SLDNF-resolution is sound, but not
complete
Example (Previous):
Are there any blocks x and y such that x
is not on top of y?
~ ON(x, y)
Note that a is not on top of any block
ON(x, y), ~ON(z, x) has an SLDNF-refutation
Computed
p answer substitution = {{c/x,, b/y}
y} SLDNF derivation of ~ON(x,
SLDNF-derivation ON(x, y) fails
13
since ON(x, y) succeeds 14

Вам также может понравиться