Negation-as-Failure

Closed world reasoning and the suppression task revisited


Computational Logic and Human Thinking, 5, Appendix A4



Negation-as-Failure in Logic Programming

According to the inference rule "negation-as-failure," ¬φ may be asserted if there is no proof of φ in the knowledge base. This is different from the classical rule for negation, according to which ¬φ may be asserted if a contradiction follows from the assumption of φ:


    [A]¹
     .
     .
     .
     ⊥
  ------- ¬I,1
    ¬A


The classical rule is valid. Negation-as-failure is not, but it seems to be employed in many ordinary situations.

For example, suppose that you look at the schedule of flights from Phoenix to San Francisco. Suppose that you don't see one listed as leaving at 10:00am. So you naturally conclude that it is not the case that a flight leaves at that time. This inference seems entirely reasonable, but it is not sanctioned by the classical negation introduction rule.

The negation-as-failure rule is sometimes said to reflect the closed-world assumption: that we have all the positive information there is to be had about the predicate. So if, on the basis of the knowledge base, there is no proof that the predicate is true, then we may conclude that it is false.


Logic programming may be developed so that it allows for negation-as-failure.

Logic programs, as we have defined them, do not contain negations. So the first step is to allow negations to appear in the body of rules. Now a rule may have this form:

positive condition if positive conditions and negative conditions

In addition, the evaluation step must handle negative conditions. Consider the following logic program:

P if Q, not-R
R if S, T
Q
S

Suppose the query is

?-P

This query unifies with the head of the first rule. So the derived query becomes

?- Q, not-R

Q unifies with the head of the first fact. Since it (like all facts) has no body, the derived query is

?- not-R

This query succeeds just in case the following query fails

?- R

Does this query fail? Well, R unifies with the head of the second rule to produce the query

?- S, T

S unifies with the head of the second fact. Since it has no body, the new query is

?- T

This query does not unify with any head in the program. So the query

?- R

fails. Hence, the query

?- not-R

succeeds. And so the original query

?- P

succeeds. Given negation-as-failure, P is a consequence of the program.



A Problem for the Logic Programming/Agent Model

An agent is permitted to believe a given proposition if he notices that it is a consequence of what he believes, but negation-as-failure does not allow for this possibility. Although queries of the form "not-φ" can be consequences of the KB, they cannot be added to the KB as new beliefs. The form of beliefs in the KB is

positive condition if positive conditions and negative conditions.

This is a problem for the logic programming/agent model.



The Suppression Task Revisited

Kowalski suggests that in everyday conversation it is common to state only the most important conditions of a general statement and to leave implicit that other conditions that apply. So, e.g, in the example in the Suppression Task, the general statement is

If she has an essay to write, she will study late in the library.

If the underlying rule were made more explicit, it would look something like this:

If she as an essay to write, and it is not the case that she is prevented from studying late in the library,
then she will study late in the library.

Let the sentences be symbolized as follows:

E = She has an essay to write
L = She will study late in the library
P = She is prevented from studying late in the library

The corresponding logic program in the Suppression Task is

L if E, not-P
E

Relative to this program, the query

?- L

succeeds. Here is the explanation. L unifies with the head of the rule. The new query is

?- E, not-P.

E unifies with the head of the fact. Facts have no tails. So now the query is

?- not-P.

This 'not' is negation-as-failure. So the query succeeds if the query

?- P

fails. This query fails. So L is a consequence of the program given negation-as-failure.



In the experiment, the subjects suppress their prior conclusion upon receiving the new information

If the library is open, she will study late in the library.

The idea, in the logic programming model, is that this new information makes explicit a condition that was implicit:

She is prevented from studying late in the library if the library is not open. (Or: If the library is not open, she is prevented from studying late.)

In this case, the corresponding logic program is

L if E, not-P
E
P if not-O

Relative to this program, the query

?- L

fails. Here is the explanation. L unifies with the head of the first rule. The new query is

?- E, not-P.

E unifies with the head of the first fact. It has no tail. So now the query is

?- not-P.

This 'not' is negation-as-failure. So the query succeeds if the query

?- P

fails. But this query succeeds. P unifies with the head of the second fact. This produces the derived query

?- not-O.

This query succeeds if the query

?-O

fails. This query fails. O does not unify with any head in the program.




A Problem for the Logic Programming/Agent Model

In the first instance of reasoning of the Suppression Task, L is a consequence of the KB. An agent is permitted to believe a proposition if he notices that it is a consequence of what he believes. Suppose, then, that the agent adds L to the KB. Now, in the second episode of reasoning, the query

?- L

will succeed. This is not much of problem in the experiment because the subject is reasoning from premises given by the experimenter, not from beliefs, but the issue does raise a general worry about how to handle the beliefs produced in defeasible reasoning. In the face of new information, it can be rational for the agent to retract (or "suppress") such a belief. In the logic programming/agent model of intelligence, as it is currently set out, there is no mechanism for belief revision. Notice that this is not just a problem for an agent who is able to reason defeasibly. It also a problem for an agent who reasons conclusively. Suppose that an agent discovers that a given proposition is a logical consequence of what he believes. This fact alone does not require that he add the proposition to his KB. Instead, he might decide to give up on his existing beliefs. If the logic programming/agent model is to be a realistic model of intelligence, it needs a mechanism to deal with this issue.




Negation-As-Failure in Prolog

Here is an example prolog program (based on the movie Pulp Fiction) with negation-as-failure. According to the program, Vincent enjoys every kind of burger except a Big Kahuna Burger.


enjoys(vincent,X) :- burger(X), \+ big_kahuna_burger(X).

burger(X) :- big_mac(X).
burger(X) :- big_kahuna_burger(X).
burger(X) :- whopper(X).
 
big_mac(a).
big_kahuna_burger(b).
big_mac(c).
whopper(d).


Suppose we ask whether there is something Vincent enjoys. Here is a screenshot with the query:



Warning: p:/work desktop/negation.pl:10:
        Clauses of big_mac/1 are not together in the source-file
% p:/Work Desktop/negation.pl compiled 0.00 sec, 9 clauses
Welcome to SWI-Prolog (Multi-threaded, 32 bits, Version 6.6.1)
Copyright (c) 1990-2013 University of Amsterdam, VU Amsterdam
SWI-Prolog comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to redistribute it under certain conditions.
Please visit http://www.swi-prolog.org for details.

For help, use ?- help(Topic). or ?- apropos(Word).

1 ?- enjoys(vincent,X).
X = a ;
X = c ;
X = d.

2 ?- 


Here is the first computation. The query unifies with the head of the first rule to produce the derived query list

burger(X), \+ big_kahuna_burger(X)

The first conjunct in this query unifies with the head of first rule in the definition. Now the derived query is

big_mac(X), \+ big_kahuna_burger(X)

The first conjunct of the derived query unifies with the first fact in the program. Now the derived query is

\+ big_kahuna_burger(a)

This succeeds if

big_kahuna_burger(a)

fails. This query does fail because it unifies with the head of nothing in the program.







move on g back