Chapter 1 What to do in an emergency

 

Imagine you are travelling on the London underground and you feel someone else’s hand in your pocket. Fortunately, you see a notice explaining exactly what to do. 

 

 

Emergencies

 

 

 

Press the alarm signal button

 

to alert the driver.

 

 

 

The driver will stop

 

if any part of the train is in a station.

 

 

 

If not, the train will continue to the next station,

 

where help can more easily be given.

 

 

 

There is a 50 pound penalty

 

for improper use.

 

The London Underground Emergency Notice as a program       

 

The purpose of the Emergency Notice is to regulate the behaviour of passengers in an emergency. In this respect, it functions as a program, not to control the behaviour of a computer, but to control the behaviour of people.

 

To fulfill its purpose, the Notice needs to be unambiguous, so there is no misunderstanding about its intended meaning; and it needs to be easy to understand, so that readers can extract that meaning with as little effort as possible. Like a computer program, it should also be efficient, so that it achieves its purpose (to get help) as quickly as possible.

 

The computational nature of the emergency notice is most obvious in the first sentence:

 

Press the alarm signal button

 

to alert the driver.

 

This has the form of a goal-reduction procedure:

 

Reduce the goal of alerting the driver

to the sub-goal of pressing the alarm signal button.

 

In general, much of our human communication can be understood in such computational terms, as one human attempting to program another, to elicit a desired response. In this case, the management of the Underground is attempting to program passengers to behave effectively and efficiently in an emergency.

 

This computational view of human communication may be offensive at first sight, because it suggests the view that people are merely machines. That is not my intention.

 

I intend only to propose that thinking of people as computing agents can sometimes help us to formulate our communications with them in more effective and more efficient terms. More effective, because our “programs” will better accomplish our intentions; and more efficient, because the recipient can compile and execute the programs with less effort.

 

The Logic of the second and third sentences of the Emergency Notice

 

But human communication can also be understood in logical terms. Understood in this logical way, communications are collections of sentences having an underlying logical form, which constitutes their meaning. To understand an input natural language sentence, a reader or listener needs to decipher its surface structure to extract its meaning. She then needs to assimilate that meaning into the web of her beliefs. These beliefs include both general background beliefs and any meanings extracted from earlier sentences in the same communication.

 

After extracting such a collection of meanings, the recipient of the communication can apply these meanings to any relevant problems that might arise in her environment. In this respect, natural language sentences are like a computer program. The process of extracting the logical meanings of the sentences is like compiling a program from external into internal form, and the process of applying these meanings to problems in the environment is like executing the resulting compiled program.

 

In the example of the emergency notice, the relationship between the external form of the English sentences and their internal, logical form is most obvious in the case of the second and third sentences of the Notice, especially with their use of such obviously logical terms as “if”, “any”, and “if not”.

 

It is tempting to argue that the Notice is easy to understand just because the surface structure of its external form is so close to the internal form of its intended meaning. In fact, the second and third sentences are more ambiguous than they may appear at first sight. In particular, the second sentence does not explicitly state what the driver will actually stop doing. It is unlikely, for example, that:

 

The driver will stop causing the emergency

           

if any part of the train is in a station.

 

 

Instead, it is almost certain that:

 

            The driver will stop the train in a station

           

if any part of the train is in the station.

 

 

But even this interpretation does not fully capture the sentence’s intended meaning. Understood in the context of the first sentence, the second sentence has an additional implicit condition, namely that the driver has been alerted to an emergency. Therefore, the intended meaning of the second sentence is:

 

            The driver will stop the train in a station

           

if the driver is alerted to an emergency

and any part of the train is in the station.

 

 

Without the additional condition, the sentence literally means that the driver will stop the train whenever the train is in a station, whether or not there is an emergency. If that were the case, a train would never leave a station once it was there. To understand the sentence, a reader of the Notice needs both general background knowledge about the way train drivers normally behave and specific knowledge of the context of the earlier sentences in the Notice.

 

In the spirit of our interpretation of the second sentence, it is now clear that the intended meaning of the third sentence is:

 

The driver will stop the train at the next station

and help can be given there better than between stations

           

if the driver is alerted to an emergency

and not any part of the train is in a station.

 

In natural language, it is common to leave out such conditions as “any part of the train is in the station”, that are already in the context. In formal logic, however, sentences stand on their own two feet, without relying for support on the context around them.

 

Because sentences in formal logic do not rely on their context, you can take a collection of sentences written in logical form, throw them up in the air, like a pack of cards, and then pick them up in any order. The resulting collection of sentences has the same meaning as the collection you started with.

 

In theory, therefore, if this book were written in purely logical form, you could read it backwards, forwards or in any other order, and it would have the same meaning. In fact, much of the work in writing a book like this is in trying to find an appropriate order for presenting the ideas, so that they are as easy to understand as possible,

 

The first sentence of the Emergency Notice as a Logic Program

 

The first sentence of the Notice is written in the form of a procedure, which hides its underlying logical form. In general, a goal-reduction procedure of the form:

 

Reduce goal to sub-goals

 

hides a logical implication:

 

Goal if sub-goals.

 

The goal-reduction behaviour of the procedure can be obtained from the implication by backward reasoning:

 

To conclude that the goal can be solved,

show that the sub-goals can be solved.

 

 

 

            Thus, the first sentence of the Emergency Notice has the hidden logical form:

 

 

 

 

 

You alert the driver,

if you press the alarm signal button.

 

The use of backward reasoning to turn implications into goal-reduction procedures is called logic programming. The implications themselves are called logic programs. Logic programming became quite popular for a while in the 1980s, and then largely fell into disuse. One of the goals of this book is to show that logic programming can be useful, not only for Computing, but also for Human Reasoning.

 

Backward reasoning contrasts with forward reasoning, which is probably more familiar to most people. Given an implication of the form:

 

            If conditions then conclusion.

 

and a collection of statements that match the conditions, forward reasoning derives the conclusion as a logical consequence of the conditions.

 

Whether to use backward or forward reasoning is one of the main issues investigated in this book.[1]

 

The fourth sentence of the Emergency Notice as a constraint

 

In natural language, implications are often hidden below the surface, sometimes in procedural form, other times in declarative form. For example, the last sentence of the Notice is a declarative sentence, which has the underlying logic form:

 

You may get a 50 pound penalty

if you press the alarm signal button improperly.

 

 

Backwards reasoning turns this implication into a goal-reduction procedure:

 

To get a 50 pound penalty,

press the alarm signal button improperly.

 

It is very unlikely that a passenger would want to get a 50 pound penalty, and very unlikely, therefore, the passenger would use backward reasoning to reduce such an unlikely goal to subgoals. More likely, the passenger would use forward reasoning instead, to derive that using the alarm signal button improperly would have an undesirable consequence. Thus, the sentence acts a constraint on behaviour rather than as a generator.

 

Since goal-reduction procedures restrict implications to backward reasoning, the procedural form of the sentence is not appropriate. This explains why the sentence is written declaratively and not procedurally.

 

In fact, only the first sentence of the Emergency Notice is written in procedural form, and only this one sentence of the Notice functions as a normal program, to evoke the behaviour desired of passengers on the underground. Indeed, the fourth sentence functions as a constraint, to prevent undesired behaviour.

 

The second and third sentences, on the other hand, describe part of a program to be executed by a different agent, namely by the driver of the train. These sentences are written declaratively and not procedurally precisely because they are to be executed by a different agent, and not by the agent observing the emergency.

 

Programs with purpose

 

It is implicit that the purpose[2] (or goal) of the Notice is to explain to passengers how to get help in an emergency. That is why the third sentence includes the phrase

 

            where help can more easily be given.

 

This phrase explains why the driver does not stop the train immediately when it is not in a station.

 

The first sentence of the Notice could be rewritten as three sentences, to make its purpose explicit:

 

            If there is an emergency then get help.

You get help if you alert the driver.

You alert the driver if you press the alarm signal button.

 

Here, for a change, I have written the second and third sentences as logic programs. Used to reason backwards, they behave as procedures:

 

To get help, alert the driver.

To alert the driver, press the alarm signal button.

 

The first sentence also has the form of an implication. But its conclusion is imperative (get help) rather than declarative (you will get help). It is like a condition-action rule, but more general, because its conclusion is a goal, rather than just an action.

 

Implications with imperative conclusions (including condition-action rules) can be used to “reason forward”, like logical implications. However, they do not have all the properties of logical implications with declarative conclusions. Logical implications can be used to reason forwards or backwards, but implications with imperative conclusions can only be used forward. Declarative statements can be true or false. Imperative statements can only be obeyed or disobeyed. We will see in later chapters how imperative statements can be transformed into declarative form, by assigning them the status of goals and distinguishing them from beliefs.

 

Where do we go from here?

 

This chapter has been intended to give an overall impression of the rest of this book. It shows through an example how English sentences can be viewed both in computational and logical terms. It also shows how the two views come together in logic programming, which is a special case of computational logic, which is the topic of this book.

 

Computational logic has been used to develop computer applications, especially in Artificial Intelligence. However, in this book I focus on its potential for use by people to improve their own reasoning and communication skills.

 

Traditional logic was originally developed as a model for human reasoning, but has fallen out a favour in recent years. Other models, such as condition-action rules have mostly taken its place. One of the main purposes of this book, therefore, is to show how condition-action rules and logic can be reconciled and combined.

 

Part of the problem with traditional logic is its lack of concern with a number of important issues that need to be dealt with in human reasoning. These include the need to:

 

  • distinguish between goals and beliefs
  • be open to changes in the world
  • relate thinking about actions with actually performing them
  • relate the use of logic for thinking with the use of probability and utility for deciding what actions to perform.
  • reason by default and with rules and exceptions
  • combine arguments both for and against a given conclusion.

 

We will see how computational logic addresses these issues in the following chapters.

 

In addition, we will compare and attempt to reconcile computational logic with rival views of human reasoning. These include:

 

  • Condition-action rules
  • Search
  • Mental models
  • Object-orientation
  • Schemata and stereotypes
  • Neural networks.

 

Finally, we will investigate the application of computational logic to two main areas:

 

  • Legal reasoning
  • Human communication.

 

The problem we address in this book can be pictured like this:

 

 

                                                         ?                     

 

 

 

 



[1] It is normal in formal logic to write implications in the forward direction: If conditions then conclusion. This is why reasoning from conditions to conclusions is called forward reasoning.

 In fact, logical implications can be used to reason both forwards and backwards, no matter how they are written. However, we write them one way rather than the other when we have one preferred direction of use in mind.

 

 

[2] The terms “goal” and “purpose” are interchangeable. Other terms that sometimes have the same meaning are “motivation”, “reason”, “interest”, “desire”, “objective” “mission”, “target” etc.