Chapter 2 The Fox and the Crow

Some people are proactive. They like to plan ahead, foresee obstacles, and lead an orderly life. Other people are reactive. They like to be open to what is happening around them, take advantage of new opportunities, and be spontaneous. Most people are both proactive and reactive, at different times and to varying degrees.

In this chapter, we will see how proactive thinking can be modeled by the use of logic to reason about the world and to reduce goals to sub-goals. In the next chapter, how reactive thinking can be modeled by condition-action rules. And in the following chapter, how the two kinds of thinking can be combined by reformulating condition-action rules in logical form.

The fox and the crow

Probably everyone knows the ancient Greek fable, attributed to Aesop, about how a proactive fox outwits a reactive crow. It starts, harmlessly enough, with the crow sitting in a tree with some cheese in its mouth. Then along comes the fox, who wants to have the cheese.

In this version of the story, we look at the story from the fox’s point of view. To model her proactive way of thinking, we represent her goal and beliefs in logical form:

Goal                I have the cheese.

Beliefs             The crow has the cheese.

## An animal has an object

if the animal is near the object

and the animal picks up the object.

I am near the cheese

if the crow has the cheese

and the crow sings.

The crow sings if I praise the crow.

As you can see, the fox is not only a logician, but also a physicist. In particular, her belief about being near the cheese if the crow sings combines in a single statement knowledge of her location with knowledge of the laws of gravity. Reasoning informally:

The fox knows that if the crow sings, then the crow will open its beak and the             cheese will fall to the ground under the tree. The fox also knows that, because the             fox is under the tree, the fox will then be near the cheese.

Therefore, the fox knows that she will be near the cheese if the crow sings.

The fox is also a behavioural psychologist. Being a behaviourist, she is interested only in the crow’s external, input-output behaviour, and not in any internal mechanisms that might generate that behaviour. In particular, although she represents her own beliefs about the crow in logical terms, she does not assume that the crow also uses logic to represent any beliefs about the world. As far the fox is concerned, the crow’s behaviour might be generated by means of condition-action rules without logical form. Or it might be “hardwired” directly into his body, without even entering into his brain.

Like the fox’s belief about being near the cheese if the crow sings, the fox’s belief about the crow’s behaviour might be derived from other, separate beliefs – perhaps from more general beliefs about the way some naive, reactive agents respond to being praised, without thinking about the possible consequences of their actions.

The fox also has ordinary common sense. It knows that an animal will have an object if it is near the object and picks it up. It knows this as a general law, which applies universally to any animal and to any object (although it doesn’t seem to know that the law also applies to robots, unless it views robots as a species of animal). It also knows enough logic to be able to instantiate the general law and to apply it to the special case where the fox is the animal and the cheese is the object.

The fox’s beliefs as a Logic Program

The fox’s beliefs have not only logical form, but they also have the form of a logic program. As we have already seen, a logic program is a collection of implications of the form:

Conclusion if Conditions.

Both the conclusion and the conditions are written in declarative form.

The implications are written backwards, conclusion first, to indicate that they can be used to reason backwards, from conclusions to conditions. As a consequence of backward reasoning, each such implication behaves as a goal-reduction procedure[1]:

To derive the Conclusion, derive the Conditions.

Even “facts”, which record observations, like the belief that the crow has the cheese, can be viewed as implications that have a conclusion, but no conditions:

Conclusion if nothing.

Such facts also behave as procedures:

To derive the Conclusion, do nothing.

Therefore, the fox’s beliefs can be used as a collection of procedures:

To have an object,

be near the object

and pick up the object.

To be near the cheese,

check that the crow has the cheese

and make the crow sing.

To make the crow sing,

praise the crow.

To check that the crow has the cheese,

do nothing.

These procedures can be applied, one after the other, to reduce the top-level goal:

I have the cheese.

to the two action sub-goals:

I praise the crow and I pick up the cheese.

Together, these two actions constitute a plan for achieving the original goal.

Goal-reduction graphs

The fox’s reduction of her original goal to the two action sub-goals can be visualized as a graph, in which implications of the form:

Conclusion if Condition1 and Condition2

are represented by sub-graphs of the form:

Conclusion

Condition1                                                     Condition2

The graph has the form of an upside-down tree with the top-level goal at the top of the upside-down tree:

I have the cheese.

I am near the cheese.

I pick up the cheese.

The crow has the cheese.

The crow sings.

Do nothing.                                      I praise the crow.

For the fox to solve the top-level goal, it suffices for her to grow the tree, starting from the top down, reducing goals to sub-goals, terminating when no further reduction is possible. If all the sub-goals at the “leaves” of the tree are irreducible action sub-goals, then these actions constitute a plan for solving the top-level goal.

###### Backward reasoning

The operation of reducing a goal to sub-goals can also be viewed in logical terms, as reasoning backwards with an implication, matching the goal with the conclusion of the implication and deriving the conditions of the implication as sub-goals.

For example, the top-level goal:

I have the cheese.

matches the conclusion of the general implication:

## An animal has an object

if the animal is near the object

and the animal picks up the object.

Backward reasoning derives the two sub-goals:

I am near the cheese and I pick up the cheese.

by substituting the specific terms “I” and “the cheese” for the general terms “the animal” and “the object” respectively.

The second of these two sub-goals is an action, which matches the conclusion of no implication. It can be solved only by performing it successfully. However, the first sub-goal can be reduced to other sub-goals by three further steps of backwards reasoning.

The final result of this chain of backward reasoning is a logical proof that the fox has the cheese if she praises the crow and picks up the cheese. The proof has the same tree-like structure as the goal-reduction graph we saw before.

In traditional logic, it is more common to present proofs in the forward direction. In this case, a traditional  proof would look more like this:

I praise the crow.

Therefore                               The crow sings.

The crow has the cheese.

Therefore                               I am near the cheese.

I pick up the cheese.

Therefore                               I have the cheese.

The end of story?

For a Logic Extremist, this would be the end of the story. There is no difference between the fox’s world and the fox’s beliefs about the world, and no difference between the fox’s plan for getting the cheese and the fox’s actually having it.

However, Common Sense tells us that there is more to life than just thinking – and perhaps even more to thinking than just logic alone. In addition to thinking, an intelligent agent needs to observe changes in the world and to perform actions to change the world in return. And there might be other ways of thinking - ways that do not use Logic and perhaps even ways that do not use any mental representation of the world at all.

We will come back to the story and address these issues in the next few chapters. But first:

What is the moral of the story?

Presumably Aesop’s fable had a purpose – a lesson that it is not safe to take another agent’s words and actions at face value, without trying to understand the agent’s underlying goals and intentions. Or, even more simply, that before you do anything you should think about its possible consequences.

The crow in our story responds to the fox’s praise spontaneously - without thinking, you could say. A more intelligent crow would monitor his intended actions, before they are performed, to determine whether they might have any unintended and undesirable consequences.

If only the crow knew what the fox knows, the crow would be able to reason as follows:

I want to sing.

But if I sing, then the fox will be near the cheese.

If the fox is near the cheese and picks up the cheese,

then the fox will have the cheese.

Perhaps the fox wants to have the cheese and therefore will pick it up.

But if the fox picks up the cheese, then I will not have the cheese.

Since I want to have the cheese, I will not sing.

Notice that this line of reasoning uses some of the same beliefs as those used by the fox, but it uses them forwards rather than backwards. We will investigate this dual use of beliefs for both backward and forward reasoning in the chapter after next.

In the meanwhile, we note that, although using logic might not always be the most natural way of thinking, it can sometimes help us (and the crow) to think and behave more effectively.

###### Summary

The view of computational logic in the mind of an intelligent agent, as seen so far in this chapter, looks something like this:

Goals

Backward reasoning

Intermediate level sub-goals

Backward reasoning

Actions

?

This picture will be elaborated considerably in the following chapters.

[1] Grammatically speaking, the goal of the procedure is expressed in the subjunctive mood and the sub-goals are expressed in the imperative mood. Implications in logic, on the other hand, are expressed purely in declarative form.