# Philosophy, Computing, and Artificial Intelligence

PHI 319

Computational Logic and Human Thinking
Chapter 5 (75-91), Appendix A4 (284-289)

## The Negation-as-Failure Rule

Negation-as-failure (NAF) is not the negation-introduction rule (¬I) of classical logic. NAF says that a failure to prove φ is a proof of ¬φ. The classical rule says if absurdity (⊥) is a consequence of a set of premises and assumption φ, then ¬φ is a consequence of these premises:

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

## Negation-as-Failure in Defeasible Reasoning

It may seem that NAF is used in everyday reasoning. Suppose, for example, I look at a schedule of flights from Phoenix to San Francisco. Suppose that I don't see one listed as leaving at 10:00am. So I 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.

What makes it rational to reason in this way?

"The use of negation as failure to derive a negative conclusion is justified by the closed world assumption that you have complete knowledge about all the conditions under which the positive conclusion holds" (Kowalksi, Computational Logic and Human Thinking, 79). The answer might be what is called the closed world assumption.

If we think we know the complete list of flights from Phoenix to San Francisco, it seems reasonable to conclude that no flight leaves at a certain time if, on the basis of the list, we are unable to prove that there is a flight that leaves at that time.

Given this justification, however, the reasoning looks more like conclusive reasoning than defeasible reasoning. It seems that we would have to give up our belief that we had a complete list of flight times if we were to discover that there is a flight that leaves for San Francisco at 10:00am. In this case, the reasoning is not defeasible. It is conclusive.

Kowalski can seem to say that defeasible and default reasoning are the same thing. (Computational Logic and Human Thinking, 46, 79). His characterization, though, of default reasoning in terms of the agent withdrawing "the conclusion given new information that leads to the contrary of the conclusion" does not allow for undercutting defeaters. A clearer example of a use of NAF is in the kind of defeasible reasoning Kowalski calls "default reasoning, in which an agent jumps to a conclusion, but then withdraws the conclusion given new information that leads to the contrary of the conclusion" (Computational Logic and Human Thinking, 81). Default reasoning does not depend on the closed world assumption.

To understand NAF in default reasoning, consider Kowalski's a slight variation on "innocent unless proven guilty" example (Computational Logic and Human Thinking, 84).

A person is innocent of a crime if the person is accused of the crime and it is not the case that the person committed the crime.
A person committed a crime if another person witnessed the person commit the crime.
Bob is accused of the crime of robbing a bank

Suppose we put to this logic program the query

Bob is innocent of the crime of robbing a bank.

If the negation in the first rule is NAF, then the query will succeed. If, however, we add to the the belief that someone witnessed Bob commit the crime of robbing a bank, the query will fail.

## Negation-as-Failure in Logic Programming

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 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.

Kowalski suggests, reasonably enough, 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, for example, 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, according to Kowalski (Computational Logic and Human Thinking, 86), 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.

To set out this more formally, 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 is

L if E, not-P
E

Relative to this program, the query

?- L

succeeds. This is the outcome the experimenters expect. Here is the computation. L unifies with the head of the rule. The new query list 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.

What happens in the experiment that the experimenters do not expect is that the subjects "suppress" (or retract) this conclusion upon receiving the new information

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

Kowalski takes this suppression to pose a problem. To solve this problem, he thinks that the new information must be incorporated into the logic/programming model in such a way that the query

?- L.

fails. How he thinks the new information is incorporated is not straightforward to understand.

## How to Incorporate the New Information

The new information makes explicit a condition that was implicit in the original information:

She is prevented from studying late in the library if the library is not open.

On one natural way to incorporate this new information, the logic program becomes

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

Relative to this program, the query

?- L

fails. Here is the computation. L unifies with the head of the first rule. The new query list 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. P unifies with the head of the second rule. 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. So given the way the new information is incorporated, L is not a consequence of the program.

The question, however, is whether incorporating the new information this way explains why subjects suppression (or retract) the conclusion L, and the answer seems to be that it does not.

There are lots of possible conditions that would present one from studying in the library

She is prevented from studying late in the library if the library is not open.
She is prevented from studying late in the library if she is unwell.
She is prevented from studying late in the library if she has an important meeting.

and so on. It is not clear why merely becoming aware of any of these conditions makes the subjects in the experiment "suppress" the conclusion they first thought followed from the information.

In addition, it is clear from considering this list of possible conditions that there is no guarantee that the preventing condition will be negative. In fact, it seems that it is a mistake to incorporate the new information in the condition as P if not-O because it seems that the mere awareness of this condition should not "suppress" the conclusion that She will study late in the library.

## Two More Possibilities

One possibility is that the new information changes the logic program so that it becomes

E = She has an essay to write
L = She will study late in the library
O = The library is open

L if E, O
E

Another is that the new information is added to the logic program so that it becomes

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
C = The library is closed

L if E, not-P
E
P if C
C

L is not a consequence of either logic program.

Which of these possibilities is more plausible?

This second possibility can seem to be the more plausible of the two insofar as the new information is added to the logic program. In the first, the new information changes an entry in the program.

The problem, though, is that one of the additions to the logic program in the second possibility is the belief that the library is closed. The justification for this addition is not immediately clear.

Which possibility does Kowalski intend?

His discussion (Computational Logic and Human Thinking, 87) suggests that he thinks that the first possibility is correct. He says that the "higher-level representation"

she will study late in the library if she has an essay to write and it is not the case that she is prevented from studying late in the library.
she is prevented from studying late in the library if the library is not open.
she is prevented from studying late in the library if she is unwell.
she is prevented from studying late in the library if she has a more important meeting.
she is prevented from studying late in the library if she has been distracted.

is "compiled into" the following "lower-level representation":

she will study late in the library
if she has an essay to write
and the library is open and she is not unwell
and she doesn’t have a more important meeting
and she hasn’t been distracted.

Just why he thinks this happens, however, is unclear to me. Further, it is unclear how this counts as solution to the problem the Suppression Task poses to the logic programming/agent model.

## Problems for the Logic Programming/Agent Model

The addition of negation-as-failure improves the logic programming/agent model, but it also highlights certain problems that need solutions if the model is to be adequate.

1. "[T]he human designer, after studying the world, uses the language of a particular logical system to give to our agent an initial set of beliefs Delta_0 about what this world is like. In doing so, the designer works with a formal model of this world, W, and ensures that W ⊨ Delta_0. Following tradition, we refer to Delta_0 as the agent’s (starting) knowledge base. (This terminology, given that we are talking about the agent’s beliefs, is known to be peculiar, but it persists.) Next, the agent ADJUSTS its knowledge base to produce a new one, Delta_1. We say that adjustment is carried out by way of an operation ccA; so A[Delta_0]= Delta_1. How does the adjustment process, ccA, work? ... [The adjustment] can come by way of any mode of reasoning.... The cycle continues when the agent ACTS on the environment, in an attempt to secure its goals. Acting, of course, can cause changes to the environment. At this point, the agent SENSES the environment, and this new information Gamma_1 factors into the process of adjustment, so that ccA[Delta_1 ∪ Gamma_1] = Delta_2. The cycle of SENSESADJUSTSACTS continues to produce the life Delta_0, Delta_1, Delta_2,Delta_3…, … of our agent" (Stanford Encyclopedia of Philosophy, Artificial Intelligence). It seems clear that, as a matter of rational belief, 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 a logic program, they cannot be added to the logic program as new beliefs. The form of beliefs in a logic program is positive condition if positive conditions and negative conditions.

2. Belief revision is also a problem. (This is a problem for the old model too.)

Suppose that an agent notices that a proposition is a logical consequence of what he believes. He is permitted to add the consequence to his beliefs, but he is not, as a matter of rational belief, required he add it. He might instead decide to give up one of his existing beliefs. There is no mechanism for making this decision in logic programming/agent model as it is currently understood.

Suppose an agent reasons that something is red because it looks red and is not a white object with a red light shinning on it. Here is the KB:

R = The object is red.
L = The object looks red.
W = The object is white and has a red light shinning on it.

R if L, not-W.
L.

Since R is a consequence of what the agent believes, he is permitted (but not required) to add R to his beliefs. Suppose that he does. Suppose further that subsequently he comes to believe that W is true. Now he should retract his belief in R. The logic programming/agent model as we are understanding it has no explicit mechanism for belief retraction.

## 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_mac(c).
big_kahuna_burger(b).
whopper(d).

Suppose we ask whether there is something Vincent enjoys:

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 fails. It unifies with the head of nothing in the program.

## What we have Accomplished in this Lecture

We distinguished the negation-as-failure rule (NAF) from the negation-introduction rule of classical logic. We considered how NAF is used in default reasoning. We looked at how to incorporate NAF into logic programming. We looked at Kowalski's use of default reasoning in his solution to the Suppression Task. We considered an example of NAF in Prolog.