You are on page 1of 21

APPLICATION OF THEOREM PROVING TO PROBLEM SOLVING*

C o r d e l l Green
Stanford Research I n s t i t u t e
Menlo Park, C a l i f o r n i a
Abstract

twofold:
(1) to explore the q u e s t i o n of p r e d i cate c a l c u l u s r e p r e s e n t a t i o n f o r s t a t e t r a n s f o r m a t i o n problems in g e n e r a l , and (2) to
e l a b o r a t e upon robot and p r o g r a m - w r i t i n g a p p l i cations of t h i s approach and the mechanisms
u n d e r l y i n g them.

This paper shows how an extension of the


r e s o l u t i o n proof procedure can be used to cons t r u c t problem s o l u t i o n s . The extended proof
procedure can solve problems i n v o l v i n g s t a t e
t r a n s f o r m a t i o n s . The paper explores several
a l t e r n a t e problem r e p r e s e n t a t i o n s and provides
a d i s c u s s i o n of s o l u t i o n s to sample problems
i n c l u d i n g the "Monkey and Bananas" puzzle and
the 'Tower of Hanoi" p u z z l e . The paper e x h i b i t s
s o l u t i o n s to these problems obtained by QA3, a
computer program bused on these theorem-proving
methods. In a d d i t i o n , the paper shows how QA3
can w r i t e simple computer programs and can solve
p r a c t i c a l problems f o r a simple r o b o t .
Key Words:

Exactly how one can use l o g i c and theorem


proving f o r problem s o l v i n g r e q u i r e s c a r e f u l
thought on the p a r t of the user. .Judging from my
experience, and t h a t of others using QA2 and QA3,
one o f the f i r s t d i f f i c u l t i e s encountered i s the
r e p r e s e n t a t i o n o f problems, e s p e c i a l l y s t a t e t r a n s f o r m a t i o n problems, by statements in formal
l o g i c . I n t e r e s t has been shown in seeing several
d e t a i l e d examples t h a t i l l u s t r a t e a l t e r n a t e methods of a x i o m a t i z i n g such p r o b l e m s i . e . , t e c h niques f o r "programming" i n f i r s t - o r d e r l o g i c .
This paper provides d e t a i l e d examples of various
methods of r e p r e s e n t a t i o n . A f t e r presenting
methods in Sees. I and I I , a s o l u t i o n to the
c l a s s i c "Monkey and Bananas" problem is provided
i n Sec. I I I . Next, Sec. I V compares several a l t e r n a t e r e p r e s e n t a t i o n s f o r the "Tower of Hanoi
p u z z l e . Two a p p l i c a t i o n s , robot problem s o l v i n g
and automatic programming, are discussed in Sees.
V and V I , r e s p e c t i v e l y .

Theorem p r o v i n g , r e s o l u t i o n , problem
s o l v i n g , automatic programming, p r o gram w r i t i n g , r o b o t s , s t a t e t r a n s f o r m a t i o n s , question answering.

Automatic theorem proving by the r e s o l u t i o n


proof procedure represents perhaps the most
powerful known method f o r a u t o m a t i c a l l y d e t e r m i n i n g the v a l i d i t y of a statement of f i r s t - o r d e r
l o g i c . In an e a r l i e r paper Green and Raphael"
i l l u s t r a t e d how an extended r e s o l u t i o n procedure
can be used as a question answerere.g., if the
statement (3x)P(x) can be shown to f o l l o w from a
set of axioms by the r e s o l u t i o n proof procedure,
then the extended proof procedure w i l l f i n d or
c o n s t r u c t an x t h a t s a t i s f i e s P ( x ) . This e a r l i e r
paper (1) showed how one can axiomatize simple
question-answering s u b j e c t s , (2) described a
question-answering program c a l l e d QA2 based on
t h i s procedure, and (3) presented examples of
simple question-answering dialogues w i t h QA2 .
In a more recent paper" the author (1) presents
the answer c o n s t r u c t i o n method in d e t a i l and
proves i t s c o r r e c t n e s s , (2) describes the l a t e s t
v e r s i o n of the program, QA3, and (3) introduces
s t a t e - t r a n s f o r m a t i o n methods i n t o the c o n s t r u c t i v e proof f o r m a l i s m .
I n a d d i t i o n t o the
question-answering a p p l i c a t i o n s i l l u s t r a t e d i n
these e a r l i e r papers, QA3 has been used as an
SRI robot 4 problem s o l v e r and as an automatic
program w r i t e r . The purpose of t h i s paper is

1. An I n t r o d u c t i o n to
S t a t e - T r a n s f o r m a t i o n Methods
The concepts of s t a t e s and s t a t e transformat i o n s have of course been in existence f o r a long
t i m e , and the usefulness of these concepts f o r
problem s o l v i n g is w e l l known. The purpose of
t h i s paper is not to discuss s t a t e s and s t a t e
t r a n s f o r m a t i o n s as such, but instead to show how
these concepts can be used by an automatic r e s o l u t i o n theorem p r o v e r .
In p r a c t i c e , the employment
of these methods has g r e a t l y extended the problems o l v i n g c a p a c i t y of QA2 and QA3. McCarthy and
Hayes present a r e l e v a n t discussion of p h i l o s o p h i c a l problems i n v o l v e d in attempting such f o r m a l i zations .
F i r s t we w i l l present a simple example. We
begin by c o n s i d e r i n g how a p a r t i c u l a r universe of
discourse might be described in l o g i c .
Facts d e s c r i b i n g t h e universe of discourse
are expressed in the form of statements of mathem a t i c a l l o g i c . Questions or problems are stated
as conjectures to be proved.
If a theorem is
proved, then the nature of our extended theorem
prover is such t h a t the proof is " c o n s t r u c t i v e "
i . e . , if the theorem asserts the existence of an
o b j e c t then the proof f i n d s or c o n s t r u c t s
such an o b j e c t .

This research is a p a r t of P r o j e c t Defender and


was supported by the Advanced Research P r o j e c t s
Agency of the Department of Defense and was
monitored by Rome A i r Development Center under
Contracts AF 30(602)-4147 and F30602-69-C-0056.
This p r e p r i n t is a p r e l i m i n a r y version and is
subject t o m o d i f i c a t i o n p r i o r t o p u b l i c a t i o n .
References are l i s t e d at the end of t h i s paper.

At any given moment the universe under cons i d e r a t i o n may be said to be in a given s t a t e .

-219-

We w i l l represent a p a r t i c u l a r s t a t e by a
s u b s c r i p t e d s e . g . , s l 7 . The l e t t e r s , w i t h n o
s u b s c r i p t , w i l l be a v a r i a b l e , ranging over
s t a t e s . A s t a t e is described by means of p r e d i cates.
For example, i f the p r e d i c a t e
A T ( o b j e c t x , b , s 1 ) i s t r u e , then i n s t a t e s 1 the
object, object!, is at position b.
Let t h i s
p r e d i c a t e be axiom A l :
Al.

Together, these t h r e e axioms imply t h a t s t a r t i n g


in s t a t e s 1 , object 1 can be pushed from b to c
and then from c to d. This sequence of a c t i o n s
(a program f o r our robot) can be expressed by
the composition of the two push f u n c t i o n s ,
push(object1,c,d,push(object1,b,c,s1)).
The
normal order of f u n c t i o n e v a l u a t i o n , from the
innermost f u n c t i o n to the outermost, gives the
c o r r e c t sequence in which to perform the a c t i o n s .

AT ( o b j e c t ! b,s 1 ) .

To f i n d t h i s s o l u t i o n to the problem of g e t t i n g object 1 t o p o s i t i o n d , the f o l l o w i n g conj e c t u r e is posed to the theorem p r o v e r :


"Does
t h e r e e x i s t a s t a t e such t h a t object 1 i s a t p o s i t i o n d ? " o r , s t a t e d i n l o g i c
(3s)AT(object 1 , d , s ) . The answer r e t u r n e d is
"yes, s = p u s h ( o b j e c t 1 , c , d , p u s h ( o b j e c t 1 , b , c , S ! ) ) . "

The question "where i s o b j e c t ! i n s t a t e S!?" can


be expressed in l o g i c as the theorem
( r 5x)AT(object 1 x,s 1 ) . The answer found by using
system QA3 to prove t h i s theorem is "yes, x = b.
Changes in s t a t e s are brought about by performing a c t i o n s and sequences of a c t i o n s . An
a c t i o n can be represented by an a c t i o n f u n c t i o n
t h a t maps s t a t e s i n t o new s t a t e s (achieved by
executing the a c t i o n ) . An axiom d e s c r i b i n g the
e f f e c t of an a c t i o n is t y p i c a l l y of the form

The proof by r e s o l u t i o n , given below, demons t r a t e s how the d e s i r e d answer is formed as a


composition of a c t i o n f u n c t i o n s , thus d e s c r i b i n g
a sequence of necessary a c t i o n s . The mechanism
f o r f i n d i n g t h i s answer i s a s p e c i a l l i t e r a l , *
the "answer l i t e r a l . " This method of f i n d i n g an
answer is explained in d e t a i l in Ref. 3. For our
purposes here, we w i l l j u s t show how it works by
example.
In t h e proof below, each answer l i t e r a l
i s d i s p l a y e d beneath the clause c o n t a i n i n g i t .
At each step in the proof the answer l i t e r a l w i l l
c o n t a i n t h e c u r r e n t value of the o b j e c t being
constructed by the theorem p r o v e r . In t h i s examp l e the o b j e c t being c o n s t r u c t e d is the sequence
of a c t i o n s s.
So i n i t i a l l y the answer l i t e r a l
ANSWER(s) is added to the clause r e p r e s e n t i n g
the negation of the q u e s t i o n .
(One can i n t e r p r e t
t h i s c l a u s e , Clause 1 , a s " e i t h e r o b j e c t 1 i s not
at d in s t a t e s, or s is an answer.") The s t a t e
v a r i a b l e s , i n s i d e the answer l i t e r a l , i s the
"place h o l d e r " where the s o l u t i o n sequence is
c o n s t r u c t e d . The c o n s t r u c t i o n process i n t h i s
proof c o n s i s t s of successive i n s t a n t i a t i o n s of
s. An i n s t a n t i a t i o n of s can occur whenever a
l i t e r a l c o n t a i n i n g s i s i n s t a n t i a t e d i n the
c r e a t i o n of a r e s o l v e n t . Each i n s t a n t i a t i o n * of
s f i l l s in a new a c t i o n or an argument of an
action function.
In general, a particular i n f e r ence step in the proof ( e i t h e r by f a c t o r i n g * or
r e s o l v i n g * ) need not n e c e s s a r i l y f u r t h e r i n s t a n t i a t e s. For example, the step might be an
i n f e r e n c e t h a t v e r i f i e s t h a t some p a r t i c u l a r
p r o p e r t y holds f o r the c u r r e n t answer at t h a t
step i n the p r o o f .
The f i n a l step i n the proof
y i e l d s Clause 7, "an answer is
push(object , c , d , p u s h ( o b j e c t , b , c , s ) ) , " which
terminates the p r o o f .

(Vs)[P(s) 3 Q(f ( s ) ) ]
where s is a s t a t e v a r i a b l e
P is a p r e d i c a t e d e s c r i b i n g a s t a t e
f is an a c t i o n f u n c t i o n (corresponding to
some a c t i o n ) t h a t maps a s t a t e i n t o a
new s t a t e (achieved by executing the
action)
Q is a p r e d i c a t e d e s c r i b i n g the new s t a t e .
( E n t i t i e s such as P and f are termed " s i t u a t i o n a l
f l u e n t s " by McCarthy.)
As an example, consider an axiom d e s c r i b i n g
the f a c t t h a t object 1 can be pushed from p o i n t b
to p o i n t c. The axiom is
A2.

(Vs)[AT(object1b,s)

AT(object!,c,push(object!,b,c,s))].
The f u n c t i o n p u s h ( o b j e c t ! , b , c , s ) corresponds to
the a c t i o n o f pushing o b j e c t ! f r o m b t o c .
(Assume, f o r example, t h a t a robot is the
executor of these a c t i o n s . )
Now consider the q u e s t i o n , "Does t h e r e e x i s t
a sequence of a c t i o n s such t h a t o b j e c t 1 is at
p o i n t c ? " E q u i v a l e n t l y , one may ask, 'Does t h e r e
e x i s t a s t a t e , p o s s i b l y r e s u l t i n g from a p p l y i n g
a c t i o n f u n c t i o n s to an i n i t i a l s t a t e s1, such
t h a t o b j e c t 1 i s a t p o i n t c ? " This q u e s t i o n , i n
l o g i c , is (3s)AT(object 1 , c , s ) , and the answer,
provided by the theorem-proving program a p p l i e d
to axioms Al and A2, is " y e s ,
s = push(object , b f c , s ) . "

Suppose a t h i r d axiom i n d i c a t e s t h a t objec 1


can be pushed from c to d:
A3.

( V s ) [ A T ( o b j e c t ! , c , s ) =>
ATCobject1

jdjpushfobject

,c,d,s))l.

-220-

We assume the reader is f a m i l i a r w i t h the


vocabulary o f t h e f i e l d o f theorem p r o v i n g
by r e s o l u t i o n as described in R e f s . 1, 7, and 8.

Proof

and a s t a t e and whose v a l u e i s t h e new s t a t e


obtained by applying the action to the s t a t e .
L e t [ a 1 ] b e t h e a c t i o n s , and n i l b e t h e n u l l
action.
L e t g b e a f u n c t i o n t h a t maps t w o a c t i o n s
i n t o a s i n g l e c o m p o s i t e a c t i o n whose e f f e c t i s
t h e same a s t h a t o f t h e argument a c t i o n s a p p l i e d
sequentially.
For example, axioms o f t h e f o l l o w i n g form would p a r t i a l l y d e f i n e the s t a t e t r a n s formation function f:

1.

2.

3.

4.

Axiom A 2

5.

Resolve

6.

Axiom A l

7.

Contradiction

Resolve

5,6

B2.

(Vs)[f (nil,s)

B3.

(Vs,a1,aj)[f(aj,f(a1,s))

= si
= f ( g ^ ,a ) ,s) ] .

T h i s r e p r e s e n t a t i o n i s more c o m p l e x , b u t has
t h e advantage over t h e p r e v i o u s r e p r e s e n t a t i o n
that both the s t a r t i n g state of a transformation
and t h e s e q u e n c e o f a c t i o n s a r e e x p l i c i t l y g i v e n
as t h e arguments of t h e s t a t e - t r a n s f o r m a t i o n
function.
T h u s , one can q u a n t i f y o v e r , o r s p e c i f y
in p a r t i c u l a r , e i t h e r the s t a r t i n g state or the
sequence, or b o t h .

R e f i n e m e n t s o f t h e Method

N e x t w e s h a l l show how o t h e r c o n s i d e r a t i o n s
can b e b r o u g h t i n t o a s t a t e - t r a n s f o r m a t i o n f o r m a l ism.
B o t h t h e o r i g i n a l f o r m u l a t i o n ( I ) and t h e
a l t e r n a t e ( I I ) w i l l b e used a s n e e d e d .

The p u r p o s e o f t h i s s e c t i o n i s t o d i s c u s s
v a r i a t i o n s of the f o r m u l a t i o n presented in the
p r e v i o u s s e c t i o n and t o show how o t h e r c o n s i d e r a t i o n s s u c h a s t i m e and c o n d i t i o n a l o p e r a t i o n s c a n
be brought i n t o the formalism.
The r e a d e r who i s
i n t e r e s t e d i n a p p l i c a t i o n s r a t h e r than a d d i t i o n a l
m a t e r i a l o n r e p r e s e n t a t i o n may o m i t S e e s . I I , I I I ,
and I V , and r e a d S e e s . V and V I .
A.

(Vs)[P(s) => Q(f ( a i , s ) ) l

The p r e d i c a t e s P and Q r e p r e s e n t d e s c r i p t o r s
of s t a t e s .
Axiom B l d e s c r i b e s t h e r e s u l t o f a n
a c t i o n ax applied to the class of states t h a t are
e q u i v a l e n t i n t h a t t h e y a l l have t h e p r o p e r t y
P(s) .
The r e s u l t i n g s t a t e s a r e t h u s e q u i v a l e n t
i n t h a t t h e y have p r o p e r t y Q ( s ) .
Axiom B 2 i n d i c a t e s t h a t t h e n u l l a c t i o n has n o e f f e c t .
The
e q u a t i o n i n B 3 says t h a t t h e e f f e c t o f t h e comp o s i t e a c t i o n sequence g ( a , a 1 . ) i s t h e same a s
t h a t o f a c t i o n s a 1 and a j a p p l i e d s e q u e n t i a l l y .
The q u e s t i o n posed i n t h i s f o r m u l a t i o n c a n
include an i n i t i a l s t a t e e . g . , a question might
be
, m e a n i n g "Does t h e r e e x i s t a
s e q u e n c e of a c t i o n s x t h a t maps s t a t e Sy i n t o a
s t a t e s a t i s f y i n g t h e p r e d i c a t e Q?"
Observe t h a t
we are not i n s i s t i n g on f i n d i n g a p a r t i c u l a r
sequence o f a c t i o n s , b u t any sequence t h a t l e a d s
us to a s a t i s f a c t o r y s t a t e w i t h i n the target
class of states.

3,4

For the p a r t i c u l a r proof e x h i b i t e d h e r e , the


o r d e r o f g e n e r a t i n g t h e s o l u t i o n sequence d u r i n g
t h e s e a r c h f o r t h e p r o o f happens t o b e t h e same
order in which the p r i n t o u t of the proof i n d i c a t e s
s is i n s t a n t i a t e d .
This order consists of working
backward from the g o a l b y f i l l i n g i n t h e l a s t
a c t i o n i t h e n the n e x t - t o - l a s t a c t i o n , e t c .
In
g e n e r a l , t h e o r d e r i n w h i c h t h e s o l u t i o n sequence
i s g e n e r a t e d depends upon t h e p r o o f s t r a t e g y ,
since t h e proof s t r a t e g y determines the order
in which clauses are resolved or f a c t o r e d .
The
p r o o f t h a t t h i s method a l w a y s p r o d u c e s c o r r e c t
a n s w e r s , g i v e n i n R e f . 4 , shows t h a t t h e answers
are c o r r e c t regardless of the proof strategy used.
I I .

Bl.

B.

N o Change o f S t a t e

This kind of statement represents an i m p l i c a t i o n t h a t holds f o r a f i x e d s t a t e .


A n axiom
t y p i c a l o f t h i s class might describe the r e l a t i o n s h i p between movable o b j e c t s ; e . g . , i f x i s t o t h e
l e f t o f y and y i s t o t h e l e f t o f z , t h e n x i s t o
the l e f t of z.

An A l t e r n a t e Formulation

The f i r s t s u b j e c t w e s h a l l d i s c u s s i s a n
a l t e r n a t e to the previously given f o r m u l a t i o n .
We s h a l l r e f e r to the o r i g i n a l , presented in
S e c . I , a s f o r m u l a t i o n I , and t h i s a l t e r n a t e a s
formulation I I .
Formulation I I corresponds t o a
system-theoretic notion of state transformations.
The s t a t e t r a n s f o r m a t i o n f u n c t i o n f o r a s y s t e m
g i v e s t h e m a p p i n g o f a n a c t i o n and a s t a t e i n t o
a new s t a t e .
Let f represent the s t a t e t r a n s f o r m a t i o n f u n c t i o n , whose a r g u m e n t s a r e a n a c t i o n

C.

Time

Time c a n b e a f u n c t i o n o f a s t a t e , t o e x p r e s s
t h e t i m i n g o f a c t i o n s and s t a t e s .
For example, i f
the f u n c t i o n time(s) gives the time of an

-221-

The above f i g u r e shows t h a t a c t i o n i leads to


e i t h e r b or c from a. The f u n c t i o n f is s i n g l e valued but we d o n ' t know i t s v a l u e . The goal d
can be reached from b by a c t i o n j, or from c by
action k.
I n the f o r m a l i z a t i o n given below i t
i s p o s s i b l e t o prove t h a t t h e goal i s reachable
although a c o r r e c t sequence of a c t i o n s necessary
-222-

t h a t a c o n d i t i o n a l o p e r a t i o n is needed to c r e a t e
a s i n g l e c o n d i t i o n a l answer. This i n f o r m a t i o n p r o vides a u s e f u l h e u r i s t i c f o r the p r o g r a m - w r i t i n g
a p p l i c a t i o n s of QA3: When a clause having two
answer l i t e r a l s is about to be generated, l e t the
proof s t r a t e g y c a l l f o r the axioms t h a t describe
the c o n d i t i o n a l o p e r a t i o n (such as M5 and M6).
These axioms are then a p p l i e d to create a s i n g l e
c o n d i t i o n a l answer.
Waldinger and Lee have implemented a programw r i t i n g program PROW t h a t also uses a r e s o l u t i o n
theorem prover to c r e a t e c o n s t r u c t i v e p r o o f s , but
by a d i f f e r e n t method than t h a t of QA3.
(The
second method f o r c r e a t i n g c o n d i t i o n a l s by combini n g two answers is c l o s e l y r e l a t e d to a technique
used in PROW.)
I n f o r m a t i o n about (1) the t a r g e t
program o p e r a t i o n s , (2) the general r e l a t i o n s h i p
of the problem statement and axioms to the allowed
t a r g e t program o p e r a t i o n s i n c l u d i n g the t e s t cond i t i o n s , and (3) the syntax of the t a r g e t language,
is embedded in the PROW program. In QA3 t h i s
i n f o r m a t i o n is a l l in the axiomssuch as axioms
M5, M6, and M7.
H.

A c q u i s i t i o n of I n f o r m a t i o n

Another s i t u a t i o n t h a t a r i s e s i n problem
s o l v i n g is one in which at the time the problem
is s t a t e d and a s o l u t i o n is to be produced, t h e r e
i s i n s u f f i c i e n t i n f o r m a t i o n t o completely s p e c i f y
a s o l u t i o n . More p r e c i s e l y , the s o l u t i o n cannot
name every a c t i o n and t e s t c o n d i t i o n in advance.
As an example, consider a robot t h a t is to move
from a to c. The a c t i o n i leads from a to b but
no path to c is known, as i l l u s t r a t e d below.

where PATH(a,b,i) means t h a t i is a path from a


t o b . The q u e s t i o n (3s)AT(c,s) r e s u l t s i n the
solution,

Axiom N3 i l l u s t r a t e s an important aspect of


t h i s formalism f o r problem s o l v i n g :
If a condition
(such as the r o b o t ' s ) is made s t a t e dependent,
then we must s p e c i f y how t h i s c o n d i t i o n changes
when the s t a t e is changed. Thus in axiom N3 we
must i n d i c a t e t h a t the r o b o t ' s l o c a t i o n i s not
changed by asking f o r a p a t h . In a pure theoremproving f o r m a l i s m , t h i s means t h a t if we want to
know any c o n d i t i o n in a given s t a t e , we must prove
what t h a t c o n d i t i o n i s .
If a l a r g e number of
state-dependent c o n d i t i o n s need to be known at each
s t a t e in a s o l u t i o n , then the theorem prover must
prove what each c o n d i t i o n is at each s t a t e in a
c o n j e c t u r e d s o l u t i o n . In such a case the theorem
prover w i l l take a long time t o f i n d t h e s o l u t i o n .
McCarthy r e f e r s to t h i s problem as the frame
problem, where the word "frame" r e f e r s to the
frame of r e f e r e n c e or the set of r e l e v a n t conditions.
Discussion of a method f o r easing t h i s
problem is presented in Sec. V.
1.

Assignment Operations

An assignment o p e r a t i o n is one t h a t assigns


a value to a v a r i a b l e . An example of an a s s i g n ment is the statement a - h(a) , meaning t h a t the
value of a is to be changed to the value of the
f u n c t i o n h ( a ) . In our r e p r e s e n t a t i o n , we s h a l l
use an assignment f u n c t i o n i . e . , a s s i g n ( a , h ( a ) ) .
Using Formulation I I t h i s f u n c t i o n i s described
by the axiom

I I I . A n Example:
The Monkey and The Bananas

However, once p o i n t b is reached, more i n f o r m a t i o n


can be a c q u i r e d f o r example, a guide to the area
l i v e s at b and w i l l provide a path to p o i n t c if
asked. Or perhaps once p o i n t b is reached, the
robot might use i t s sensors to observe or discover
paths t o c .

To i l l u s t r a t e the methods described e a r l i e r ,


we present an a x i o m a t i z a t i o n of McCarthy's "Monkey
and Bananas" problem.
The monkey is faced w i t h the problem of g e t t i n g a bunch of bananas hanging from the c e i l i n g
j u s t beyond h i s r e a c h . To solve the problem, the
monkey must push a box to an empty place under
the bananas, c l i m b on t o p of t h e box, and then
reach them.

To f o r m a l i z e t h i s , assume t h a t the a c t i o n
a s k - p a t h ( b , c ) w i l l r e s u l t i n a proper path t o c ,
when taken at b. For s i m p l i c i t y , assume t h a t the
name of the path is equal to the s t a t e r e s u l t i n g
from asking t h e q u e s t i o n . Using f o r m u l a t i o n I I ,
one s u i t a b l e set of axioms i s :

224-

The c o n s t a n t s a r e monkey, b o x , b a n a n a s , and


under-bananas.
The f u n c t i o n s a r e r e a c h , c l i m b , and
move, m e a n i n g t h e f o l l o w i n g :
reach(m,z,s)

The s t a t e r e s u l t i n g f r o m t h e
action of m reaching z, s t a r t ing from s t a t e s

climb(m,b,s)

The s t a t e r e s u l t i n g f r o m t h e
a c t i o n of m climbing b, s t a r t ing from s t a t e s

move(m,b,u,s)

The p r e d i c a t e s

MB8.

The question is "Does there e x i s t a s t a t e s


(sequence of actions) in which the monkey has the
bananas?"
QUESTION:
The answer is yes,

The s t a t e r e s u l t i n g f r o m t h e
a c t i o n of m moving b to p l a c e
u , s t a r t i n g from s t a t e s .

s = reach(monkeyibananas,climb(monkey,
box,move(monkey,box,under-bananas
By executing t h i s f u n c t i o n , the monkey gets
the bananas. The monkey must, of course, execute
the f u n c t i o n s i n the usual o r d e r , s t a r t i n g w i t h
the innermost and working outward. Thus he f i r s t
moves the box under the bananas, then climbs on
the box, and then reaches the bananas.

are:

MOVABLE(b)

,b is

movable

AT(m,u,s)

m is at p l a c e u in s t a t e s

ON(m,b,s)

m is on b in s t a t e s

HAS(m,z,s)

m has z in s t a t e s

The p r i n t o u t of the proof is given in the


appendix.
IV.
Formalizations f o r
the Tower of Hanoi Puzzle

CLIMBABLE(m,b,s) m c a n c l i m b b in s t a t e s
REACHABLE(m,b,s) m can r e a c h b i n s t a t e s .
The a x i o m s

The f i r s t a p p l i c a t i o n s of our q u e s t i o n answering programs were to "question-answering"


examples. Commonly used question-answering examples have short p r o o f s , and u s u a l l y there are a
lew obvious f o r m u l a t i o n s f o r a given subject
area.
(The major d i f f i c u l t y in question-answering
problems u s u a l l y is searching a l a r g e data base,
r a t h e r than f i n d i n g a long and d i f f i c u l t p r o o f . )
T y p i c a l l y any reasonable f o r m u l a t i o n works w e l l .
As one goes on to problems l i k e the Tower of Hanoi
p u z z l e , more e f f o r t is r e q u i r e d to f i n d a r e p r e s e n t a t i o n t h a t i s s u i t a b l e f o r e f f i c i e n t problem
solving.

are:

M B 1 . MOVABLE(box)

This puzzle has proved to bo an i n t e r e s t i n g


study of r e p r e s e n t a t i o n . Several people using
QA3 have set up axiom systems f o r the p u z z l e .
Apparently, a "good" a x i o m a t i z a t i o n - - o n e leading
t o quick s o l u t i o n s - - i s not e n t i r e l y obvious,
since many a x i o m a t i z a t i o n s d i d not r e s u l t in
solutions.
In t h i s s e c t i o n we w i l l present and
compare several a l t e r n a t e r e p r e s e n t a t i o n s , i n c l u d ing ones t h a t lead to a s o l u t i o n .
There are three pegspeg x , peg 2 , and p e g 3 .
There are a number of discs each of whose diameter
i s d i f f e r e n t from t h a t o f a l l the other d i s c s .
I n i t i a l l y a l l d i s c s are stacked o n peg x , i n order
of descending s i z e . The t h r e e - d i s c version is
i l l u s t r a t e d below.

* The a s t u t e r e a d e r w i l l n o t i c e t h a t t h e axioms
l e a v e much t o b e d e s i r e d .
In keeping w i t h the
"toy problem" t r a d i t i o n we present an u n r e a l i s t i c axiomatization o f t h i s u n r e a l i s t i c problem.
The p r o b l e m ' s v a l u e l i e s i n t h e f a c t t h a t i t i s
a r e a s o n a b l y i n t e r e s t i n g p r o b l e m t h a t may be
f a m i l i a r to the reader.

-225-

( V s , x , y , z , p 1 p j . , P k , d ) [ O N ( L ( d , x ) . p i , s ) A ON(y,p,,s)

The o b j e c t of the puzzle is to f i n d a sequence of


moves t h a t w i l l t r a n s f e r a l l the d i s c s from peg1
to peg3. The allowed moves c o n s i s t of t a k i n g the
top d i s c from any peg and p l a c i n g it on another
peg, but a d i s c can never be placed on top of a
smaller d i s c .

A ON(z,p k ,s) 3 O N ( x , p i , m o v e ( d , p i , p 1 , , s ) ) A 0N(L


( d , y ) , p . move(d,p1,p.,s)) A ON(z,pk,move(d,pi,pj,

I n order t o c o r r e c t l y s p e c i f y the problem,


any f o r m a l i z a t i o n must:
(1) s p e c i f y the p o s i t i o n s
of the d i s c s f o r each s t a t e ; (2) s p e c i f y how act i o n s change the p o s i t i o n of the d i s c s ; and (3)
s p e c i f y the r u l e s o f the game, i . e . , what i s l e g a l .
Let the p r e d i c a t e ON s p e c i f y d i s c p o s i t i o n s .
In the s i m p l e s t r e p r e s e n t a t i o n the p r e d i c a t e ON
s p e c i f i e s the p o s i t i o n o f one d i s c e . g . ,
ON(disc,peg_ ,s) says t h a t in s t a t e s d i s c 1 is
on p e g 1 . This r e p r e s e n t a t i o n r e q u i r e s one p r e d i cate to s p e c i f y the p o s i t i o n of each d i s c . The
r e l a t i v e p o s i t i o n of each d i s c e i t h e r must be
s p e c i f i e d by another statement, or else if two
d i s c s are on the same peg it must be i m p l i c i t l y
understood t h a t they are i n the proper o r d e r .
Perhaps t h e s i m p l e s t extension is to a l l o w the
p r e d i c a t e another argument t h a t s p e c i f i e s the
p o s i t i o n o f the d i s c i . e . ,
ON(disc 1 ,peg , p o s i t i o n g , s ) . A g a i n , t h i s r e q u i r e s
many statements to s p e c i f y a complete c o n f i g u r a tion.
Since v a r i o u s moves are c o n s t r u c t i n g stacks
of d i s c s , and since stacks can be represented
as l i s t s , consider as an a l t e r n a t i v e r e p r e s e n t a t i o n a l i s t to represent a stack of d i s c s . Let
the f u n c t i o n l ( x , y ) represent the l i s t t h a t has
x as i t s f i r s t element ( r e p r e s e n t i n g the top d i s c
in t h e stack) and y as the r e s t of t h e l i s t
( r e p r e s e n t i n g the r e s t o f the d i s c s i n the s t a c k ) .
This f u n c t i o n i corresponds to the "cons" f u n c t i o n
i n LISP. Let n i l b e the empty l i s t . The s t a t e ment ON(i ( d i s c 1 ^ ( d i s c 2 , n i l ) ) ,peg x ,s) asserts t h a t
the stack having top d i s c , d i s c x , and second d i s c ,
discg , is on peg-1 . This r e p r e s e n t a t i o n i l l u s t r a t e s
a u s e f u l technique in l o g i c n a m e l y , the use of
f u n c t i o n s as the c o n s t r u c t i o n (and s e l e c t i o n )
o p e r a t o r s . This n o t i o n i s c o n s i s t e n t w i t h the
use of a c t i o n f u n c t i o n s as c o n s t r u c t o r s of
sequences.
Next, consider how to express p o s s i b l e
changes in s t a t e s . Perhaps the s i m p l e s t idea is
to say t h a t a given s t a t e i m p l i e s t h a t c e r t a i n
moves are l e g a l . One must then have o t h e r s t a t e ments i n d i c a t i n g t h e r e s u l t of each move. This
method i s a b i t l e n g t h y .
I t i s e a s i e r t o express
in one statement the f a c t t h a t given some s t a t e ,
a new s t a t e is t h e r e s u l t of a move. Thus one
such move to a new s t a t e is described by (Vs)[ON
( K d i s c 1 n i l ) j p e g 1 s ) A ON(nil.pegg,s) A O N ( l ( d i s c 2 ,
j(disc 3 , n i l ) ) ,peg 3 ,s) 3 O N ( n i l , p e g 1 ,move(disc 1 ,
peg1 ,peg a , s ) ) A O N ^ d i s ^ i n i l ) ,peg 2 ,move(disc 1 ,
peg 1 pegg , s ) ) A 0 N ( l ( d i s c 2 , j e ( d i s c 3 , n i l ) ) , p e g 3 ,
move(disc 1 ,peg 1 , p e g g , s ) ) ] .
With t h i s method i t i s p o s s i b l e t o enumerate
a l l p o s s i b l e moves and c o n f i g u r a t i o n combinations.
However, i t i s s t i l l e a s i e r t o use v a r i a b l e s t o
represent whole classes of s t a t e s and moves. Thus

s ) ) ] s p e c i f i e s a whole c l a s s of moves. The problem


here is t h a t a d d i t i o n a l r e s t r i c t i o n s must be added
so t h a t i l l e g a l s t a t e s cannot be p a r t of a s o l u t i o n ,
In the previous f o r m a l i s m , one could l e t the axioms
enumerate j u s t the l e g a l moves and s t a t e s , thus
preventing incorrect s o l u t i o n s .
The f i r s t method f o r adding r e s t r i c t i o n s i s
to have a p r e d i c a t e t h a t r e s t r i c t s moves to j u s t
the l e g i t i m a t e s t a t e s .
Since the s t a r t i n g s t a t e
i s l e g a l , one might t h i n k t h a t o n l y l e g a l s t a t e s
can be reached. However, the r e s o l u t i o n process
( s e t - o f - s u p p o r t s t r a t e g y ) t y p i c a l l y works backward from the goal s t a t e toward s t a t e s t h a t can
reach the goal statesuch s t a t e s are sometimes
c a l l e d " f o r c i n g s t a t e s . " Thus i l l e g a l but f o r c i n g
s t a t e s can be reached by working backward from
the goal s t a t e . This does not allow f o r i n c o r r e c t
s o l u t i o n s , since the only f o r c i n g s t a t e s t h a t can
appear in the s o l u t i o n must be those reached from
the s t a r t i n g s t a t e (which is a l e g a l s t a t e ) . The
r e s t r i c t i o n of moving only to new l e g a l s t a t e s
thus prevents an e r r o r . But the search is unn e c e s s a r i l y l a r g e , since the theorem prover is
c o n s i d e r i n g i l l e g a l s t a t e s t h a t cannot lead to a
s o l u t i o n . So a b e t t e r s o l u t i o n is to e l i m i n a t e
these i l l e g a l f o r c i n g s t a t e s by a l l o w i n g moves
only from l e g a l s t a t e s to_ l e g a l s t a t e s . This is
perhaps the best s p e c i f i c a t i o n , in a sense. Such
an axiom is ( V s , x , y , z , p i , p . , p k , d ) [ 0 N ( 4 ( d , x ) , p i ,
s) A O N ( y , P j , s ) A O N ( z , p k , s ) A L E G A L ( L ( d , x ) ) A
LEGAL(X(d,y))
move(d,p

,p

A DISTINCT(p.,p
1

,s))

,p ) 3 0 N ( x , p
J

A ON(4(d,y),p.,move(d,pi,p

,
P,s)

A ON(z,p ,move(d,p ,p , s ) ) ] . The p r e d i c a t e


LEGAL(x) i s t r u e i f and only i f the d i s c s are
l i s t e d in order of i n c r e a s i n g s i z e .
(One can
" c h e a t " and have a simpler axiom by o m i t t i n g the
p r e d i c a t e t h a t r e q u i r e s t h a t the s t a t e r e s u l t i n g
from a move have a l e g a l stack of d i s c s . Since
the s e t - o f - s u p p o r t s t r a t e g y f o r c e s the theorem
prover to work backward s t a r t i n g from a l e g a l
f i n a l s t a t e , i t w i l l only consider l e g a l s t a t e s .
However, one is then using an a x i o m a t i z a t i o n t h a t ,
by i t s e l f , is i n c o r r e c t . )
The a d d i t i o n a l LEGAL
p r e d i c a t e is a t y p i c a l example of how a d d i t i o n a l
i n f o r m a t i o n i n the axioms r e s u l t s i n a q u i c k e r
s o l u t i o n . The p r e d i c a t e DISTINCT(p.,p.,p k )
means no two pegs are e q u a l .
The clauses generated d u r i n g the search t h a t
are concerned w i t h i l l e g a l s t a t e s are subsumea
by ~LEGAL p r e d i c a t e s such as (Vs)~LEGAL((disc 2 ,
( d i s c 1 , x ) ) ) . The stacks are formed by p l a c i n g
one new d i s c on top of a l e g a l s t a c k .
If the new
top d i s c i s s m a l l e r than the o l d t o p d i s c then i t
is of course smaller than a l l the others on the
s t a c k . Thus the l e g a l stack axioms need only to
s p e c i f y t h a t t h e top d i s c i s smaller than the
second d i s c f o r a stack to be l e g a l . This blocks
the c o n s t r u c t i o n o f i n c o r r e c t s t a c k s .

-226-

One complete a x i o m a t i z a t i o n is as f o l l o w s :

25, 12 were not in the p r o o f . The s o l u t i o n


e n t a i l s seven moves, thus passing through e i g h t
s t a t e s (counting the i n i t i a l and f i n a l s t a t e s ) .
The 12 clauses not in the proof correspond to
searching through 5 s t a t e s t h a t are not used in
the s o l u t i o n . Thus the s o l u t i o n is found r a t h e r
e a s i l y . Of course, if a s u f f i c i e n t l y poor
a x i o m a t i z a t i o n is chosenone r e q u i r i n g an enumerat i o n of enough c o r r e c t and i n c o r r e c t d i s c p o s i t i o n s
the system becomes saturated and f a i l s to o b t a i n a
s o l u t i o n w i t h i n time and space c o n s t r a i n t s . An
important f a c t o r i n the proof search i s the
e l i m i n a t i o n of e x t r a clauses corresponding to
a l t e r n a t e paths t h a t reach a given s t a t e .
In
the above problem it happens t h a t the subsumption
h e u r i s t i c e l i m i n a t e s 73 of these redundant
c l a u s e s . However, t h i s p a r t i c u l a r use of subsumption is problem dependent, thus one must
examine any given problem f o r m u l a t i o n to d e t e r mine whether or not subsumption w i l l e l i m i n a t e
a l t e r n a t e paths t o e q u i v a l e n t s t a t e s .

Instead of naming each d i s c , the d i s c number


n is an argument of the f u n c t i o n d(n) t h a t r e p r e sents t h e n t h d i s c . This r e p r e s e n t a t i o n i l l u s t r a t e s how the proof procedure can be shortened
by s o l v i n g frequent decidable subproblems w i t h
s p e c i a l a v a i l a b l e toolsnamely, the LISP p r o gramming language. The theorem prover uses LISP
(the " l e s s p " f u n c t i o n ) to evaluate the LESS(n,m)
p r e d i c a t e a very quick s t e p . This mechanism has
the e f f e c t of g e n e r a t i n g , wherever needed, such
axioms as ~LESS(3,2) or LESS(2,3) to resolve
against or subsume l i t e r a l s in generated c l a u s e s .
S i m i l a r l y , LISP evaluates the DISTINCT p r e d i c a t e .

The f o u r - d i s c v e r s i o n of the puzzle can be


much more d i f f i c u l t than the t h r e e - d i s c puzzle
in terms of search. At about t h i s l e v e l of
d i f f i c u l t y one must be somewhat more c a r e f u l to
o b t a i n a low-cost s o l u t i o n .

Note t h a t the move axiom, AX1, breaks up i n t o


t h r e e c l a u s e s , each clause s p e c i f y i n g the change
in the task f o r one p a r t i c u l a r peg. The process
of making one move r e q u i r e s nine binary r e s o l u t i o n s ,
and two binary f a c t o r i n g s of c l a u s e s .
S t i l l other s o l u t i o n s are p o s s i b l e by using
s p e c i a l term-matching c a p a b i l i t i e s in QA3 t h a t
extend the u n i f i c a t i o n and subsumption algorithms
t o i n c l u d e l i s t terms, set terms, and c e r t a i n
types of symmetries.

Ernst f o r m a l i z e s the n o t i o n of " d i f f e r e n c e "


used by GPS and shows what p r o p e r t i e s these d i f f e r ences must possess f o r GPS to succeed on a problem.
He then presents a "good" set of d i f f e r e n c e s f o r
the Tower of Hanoi problem. U t i l i z i n g t h i s i n f o r mation, GPS solves the problem f o r f o u r d i s c s ,
c o n s i d e r i n g n o i n c o r r e c t s t a t e s i n i t s search.
Thus Ernst has chosen a set of d i f f e r e n c e s t h a t
guide GPS d i r e c t l y to the s o l u t i o n .
Another method of s o l u t i o n is p o s s i b l e .
F i r s t , solve the t h r e e - d i s c p u z z l e .
Save the
s o l u t i o n t o the t h r e e - d i s c puzzle (using the
answer statement ). Then ask f o r a s o l u t i o n to
the f o u r - d i s c p u z z l e . The s o l u t i o n then i s :
Move the top t h r e e d i s c s from peg1 to peg 2 , m o v e
disc 4 from peg1 to peg 3 ; move the t h r e e discs on
peg2 to peg3 . This method produces a much easier
s o l u t i o n . But t h i s can be considered as c h e a t i n g ,
since the machine is " g u i d e d " to a s o l u t i o n by
being t o l d which subproblem to f i r s t solve and
s t o r e away. The use of the d i f f e r e n c e s by GPS
s i m i l a r l y l e t s the problem s o l v e r be " g u i d e d "
toward a s o l u t i o n .

In another a x i o m a t i z a t i o n , the complete conf i g u r a t i o n of the puzzle in a given s t a t e is


s p e c i f i e d by the p r e d i c a t e ON. ON'
means
t h a t in s t a t e s, stack x in on peg 1 , stack y is
on p e g 2 , and stack z is on p e g 3 . Thus if the
predicate
h o l d s , the s t a c k " d 1 - d 3 is on pegx and d 3 is on
p e g 3 . The p r e d i c a t e LEGAL again i n d i c a t e s t h a t
a given stack of discs is a l l o w e d .

There is another p o s s i b l y more d e s i r a b l e


s o l u t i o n . The f o u r - d i s c puzzle can be posed as
the problem, w i t h n o t h r e e - d i s c s o l u t i o n . I f the
s o l u t i o n of the t h r e e - d i s c puzzle occurs during
the search f o r a s o l u t i o n to the f o u r - d i s c puzzle,
and if it is a u t o m a t i c a l l y recognized and saved
as a lemma, then the f o u r - d i s c s o l u t i o n should
follow easily.

I n t h i s last-mentioned f o r m a l i z a t i o n , using
13 axioms to s p e c i f y the problem, QA3 e a s i l y solved
t h i s problem f o r the t h r e e - d i s c p u z z l e .
During
the search f o r a p r o o f , 98 clauses were generated
buy only 25 of the clauses were accepted. Of the
-227-

F i n a l l y , i f a n i n d u c t i o n axiom i s p r o v i d e d ,
the axioms imply a s o l u t i o n in the form of a
r e c u r s i v e program t h a t solves the puzzle f o r an
a r b i t r a r y number of d i s c s . Aiko Hormann
discusses the r e l a t e d s o l u t i o n s of the f o u r - d i s c
problem by the program GAKU (not an automatic

theorem-proving program). The s o l u t i o n s by lemma


f i n d i n g , i n d u c t i o n , and search guided by d i f f e r e n c e s
have not been r u n on QA3.
V.
A.

A p p l i c a t i o n s to the Robot P r o j e c t

of

The f i r s t
the r o b o t :

axiom d e s c r i b e s

t h e move r o u t i n e s

Rl.

I n t r o d u c t i o n to Robot Problem S o l v i n g

In t h i s s e c t i o n we discuss how theorem-proving


methods are being t e s t e d f o r s e v e r a l a p p l i c a t i o n s
i n the Stanford Research I n s t i t u t e A r t i f i c i a l
I n t e l l i g e n c e Group's Automaton ( r o b o t ) . We emphas i z e t h a t t h i s s e c t i o n describes work t h a t is now
i n p r o g r e s s , r a t h e r t h a n work t h a t i s completed.
These methods represent e x p l o r a t i o n s in problem
s o l v i n g , r a t h e r than f i n a l d e c i s i o n s about how
the r o b o t is to do problem s o l v i n g . An overview
of the c u r r e n t s t a t u s of the e n t i r e SRI robot
p r o j e c t is p r o v i d e d by N i l s s o n . Coles
has d e veloped a n E n g l i s h - t o - l o g i c t r a n s l a t o r t h a t i s
p a r t o f the r o b o t .
We use theorem-proving methods f o r t h r e e
purposes, t h e s i m p l e s t being t h e use of QA3 as
a c e n t r a l i n f o r m a t i o n storage and r e t r i e v a l system
t h a t i s a c c e s s i b l e t o v a r i o u s p a r t s o f t h e system
as w e l l as the human u s e r s . The data base of QA3
i s thus one o f the r o b o t ' s models o f i t s w o r l d ,
including i t s e l f .
A second use is as an experimental t o o l to
t e s t out a p a r t i c u l a r problem f o r m u l a t i o n . When a
s u i t a b l e f o r m u l a t i o n is f o u n d , it may then be
d e s i r a b l e t o w r i t e a f a s t e r o r more e f f i c i e n t
s p e c i f i c program t h a t implements t h i s f o r m u l a t i o n ,
perhaps i n v o l v i n g l i t t l e o r n o s e a r c h .
I f the
s p e c i a l program is not as general as t h e axiom
system i s , s o t h a t the s p e c i a l program f a i l s i n
c e r t a i n cases, the axioms can be r e t a i n e d to be
used in t h e troublesome cases. Both s o l u t i o n s can
be made a v a i l a b l e by s t o r i n g , as the f i r s t axiom
to be t r i e d , a s p e c i a l axiom t h a t describes t h e
s p e c i a l s o l u t i o n . The p r e d i c a t e - e v a l u a t i o n mechanism can then c a l l LISP to r u n the s p e c i a l
solution.
I f i t f a i l s , t h e o t h e r axioms w i l l then
be used.

T h i s axiom says t h a t i f t h e r o b o t i s a t
and
there is a path to p2, the robot w i l l be at p2
a f t e r moving along t h e p a t h .
The p r e d i c a t e PATH
indicates there exists a robot-path, p a t h l 2 ,
f r o m p l a c e p1 to p l a c e
.
A r o b o t - p a t h is a
p a t h adequate f o r t h e r o b o t ' s movement.
The
terms
a n d d e s c r i b e the p o s i t i o n of the
robot.
I n g e n e r a l , i t may b e v e r y i n e f f i c i e n t t o
use t h e t h e o r e m p r o v e r t o f i n d t h e p a t h 1 2 s u c h
t h a t PATH(p , p , p a t h l 2 ) i s t r u e .
Several e x i s t i n g FORTRAN s u b r o u t i n e s , h a v i n g s o p h i s t i c a t e d
p r o b l e m - s o l v i n g c a p a b i l i t i e s o f t h e i r o w n , may
b e u s e d t o d e t e r m i n e a good p a t h t h r o u g h o b s t a c l e s
on l e v e l g r o u n d .
W e w i l l show l a t e r a c a s e w h e r e
t h e t h e o r e m p r o v e r may b e used t o f i n d a more
obscure k i n d of p a t h .
For the less obscure p a t h s ,
t h e axiom R l i s m e r e l y a d e s c r i p t i o n o f t h e
s e m a n t i c s o f t h e s e FORTRAN p r o g r a m s , s o t h a t new
and m e a n i n g f u l p r o g r a m s c a n be g e n e r a t e d by QA3
b y u s i n g t h e e f f i c i e n t p a t h - g e n e r a t i n g programs
as subprograms.
The " p r e d i c a t e - e v a l u a t i o n "
mechanism i s u s e d t o c a l l t h e FORTRAN p a t h finding routines.
The e f f e c t o f t h i s e v a l u a t i o n
mechanism i s t h e same a s i f t h e f a m i l y o f a x i o m s
o f t h e f o r m PATH
f o r a l l p 1 and
P 2 such t h a t p a t h l 2 e x i s t s , were a l l s t o r e d i n
memory and a v a i l a b l e t o t h e t h e o r e m p r o v e r .
The s e c o n d a x i o m i s a p u s h a x i o m t h a t d e scribes the e f f e c t of pushing an o b j e c t .
The
r o b o t has n o arm o r g r a s p e r s , j u s t a b u m p e r .
Its
w o r l d c o n s i s t s o f l a r g e o b j e c t s such a s boxes,
wedges, c u b e s , e t c .
These o b j e c t s a r e r o u g h l y
t h e same s i z e a s t h e r o b o t i t s e l f .

The t h i r d use is as a r e a l - t i m e problem s o l v e r .


In the implementation we are now u s i n g , statements
o f l o g i c c l a u s e s a r e the basic u n i t s o f i n f o r m a t i o n . Statements are d e r i v e d from s e v e r a l sources:
t e l e t y p e e n t r i e s , axioms s t o r e d in memory, clauses
or statements generated by t h e theorem p r o v e r ,
and statements evaluated by programssubroutines
in LISP, FORTRAN, or machine language. These
programs can use robot sensors and sensory data
t o v e r i f y , d i s p r o v e , o r generate statements o f
logic.
The SRI r o b o t is a c a r t on wheels, having a TV
camera and a r a n g e - f i n d e r mounted on the c a r t .
There are bumpers on t h e c a r t , but no arms or g r a s p i n g a g e n t s , so the only way the r o b o t can manipulate
i t s environment i s b y simple pushing a c t i o n s .
Given t h i s r a t h e r severe r e s t r i c t i o n o f n o g r a s p i n g ,
the r o b o t must be c l e v e r to e f f e c t i v e l y s o l v e p r o b lems i n v o l v i n g m o d i f y i n g i t s w o r l d . We present
below some axioms f o r r o b o t problem s o l v i n g .
-228-

The b a s i c p r e d i c a t e t h a t
p o s i t i o n o f a n o b j e c t i s ATO,
The p r e d i c a t e

specifies the
meaning a t - o b j e c t .

i n d i c a t e s that o b j e c t 1 , having s t r u c t u r a l d e s c r i p tion "description", is in position "position1',


in state
'.
At the time of t h i s w r i t i n g , a
p a r t i c u l a r set of "standard" s t r u c t u r e d e s c r i p t i o n s has n o t y e t been s e l e c t e d .
So f a r several
have been u s e d .
The s i m p l e s t d e s c r i p t i o n i s a
p o i n t whose p o s i t i o n i s a t t h e e s t i m a t e d c e n t e r
of gravity of the object.
This description is
used f o r t h e FORTRAN " p u s h i n a s t r a i g h t l i n e "
routine.
Since a l l the o b j e c t s i n the r o b o t ' s
w o r l d are polyhedrons, reasonably simple complete
s t r u c t u r a l descriptions are p o s s i b l e .
For example,
one s t r u c t u r a l d e s c r i p t i o n c o n s i s t s o f t h e s e t o f
polygons t h a t form the surface of the polyhedron.
In turn the s t r u c t u r e of the polygons is given by
the set o f v e r t i c e s i n i t s boundary.
Connectivity
o f s t r u c t u r e s can b e s t a t e d e x p l i c i t l y o r e l s e

i m p l i e d by common boundaries. The p o s i t i o n of an


o b j e c t is given by a mapping of the t o p o l o g i c a l l y described s t r u c t u r e i n t o the r o b o t ' s coordinate
system. Such s t r u c t u r a l d e s c r i p t i o n s may be given
as axioms or supplied by the scene-analysis p r o grams used by the r o b o t .
A basic axiom d e s c r i b i n g the r o b o t ' s manipulat i o n of an o b j e c t is
R2.

This axiom says t h a t i f o b j e c t 1 , described


by d e s c r i p t i o n 1, is at p o s i t i o n 1, and o b j e c t 1
is movable, and o b j e c t 1 can be t h e o r e t i c a l l y
r o t a t e d and t r a n s l a t e d to the new p o s i t i o n 2, and
t h e r e is an o b j e c t - p a t h from 1 to 2, then object 1
w i l l be at p o s i t i o n 2 as a r e s u l t of pushing it
along the p a t h . The p r e d i c a t e
ROTATE-TRANSLATABLE (desc1 pos1 pos 2 ) checks the
necessary c o n d i t i o n t h a t the object can be t h e o r e t i c a l l y r o t a t e d and t r a n s l a t e d i n t o the new
p o s i t i o n . The p r e d i c a t e
OBJECT-PATH(desc 1 ,pos 1 ,pos 2 ,path 12 ) means t h a t
pos2 is the estimated new p o s i t i o n r e s u l t i n g from
pushing along push-path,
Let us now r e t u r n to the frame problem. More
s p e c i f i c a l l y , in a s t a t e r e s u l t i n g from pushing an
o b j e c t , how can we i n d i c a t e the l o c a t i o n of objects
which were not pushed? One such axiom is
R3.

This axiom says t h a t a l l objects t h a t are not the


same as the pushed o b j e c t are unmoved. The p r e d i cate e v a l u a t i o n mechanism is used to evaluate SAME
and speed up the p r o o f . One can use t h i s p r e d i cate e v a l u a t i o n mechanism, and perhaps other f a s t
methods f o r handling classes of deductions (such
as s p e c i a l r e p r e s e n t a t i o n s of state-dependent
i n f o r m a t i o n and s p e c i a l programs f o r updating t h i s
i n f o r m a t i o n w h i c h is done in the robot) , but
another problem remains. Observe t h a t axiom R3
assumes t h a t only the o b j e c t s d i r e c t l y pushed by
t h e robot move. This is not always the case,
since an o b j e c t being pushed might a c c i d e n t a l l y
s t r i k e another o b j e c t and move i t . This leads
t o the q u e s t i o n o f d e a l i n g w i t h the r e a l world
and using axioms to approximate the r e a l w o r l d .
B.

Real-World Problem S o l v i n g :

Feedback

Our d e s c r i p t i o n s o f the r e a l w o r l d , a x i o matic or o t h e r w i s e , are at best o n l y approximat i o n s . For example, the new p o s i t i o n of an
o b j e c t moved by the robot w i l l not n e c e s s a r i l y be
-229-

a c c u r a t e l y p r e d i c t e d , even if one goes to great


extremes to c a l c u l a t e a p r e d i c t e d new p o s i t i o n .
The robot does not have a grasp on the o b j e c t so
t h a t some slippage may occur. The f l o o r surface
is not uniform and smooth. The weight d i s t r i b u t i o n o f o b j e c t s i s not known. There i s only r u d i mentary k i n e s t h e t i c sensing feedbacknamely,
whether o r not the bumper i s s t i l l i n contact
w i t h the o b j e c t . Thus it appears t h a t a l a r g e
feedback loop i t e r a t i n g toward a s o l u t i o n , is
necessary: Form a plan f o r pushing the o b j e c t
(possibly using the push axiom), push according
to the p l a n , back up, take a l o o k , see where the
object i s , compare the p o s i t i o n to the desired
p o s i t i o n , s t a r t over again. The new p o s i t i o n ( t o
some l e v e l of accuracy) is provided by the sensors
of the r o b o t . This new p o s i t i o n is compared to
the p o s i t i o n p r e d i c t e d by the axiom.
If the move
is not s u c c e s s f u l , the p r e d i c a t e (provided by
sensors in the new s t a t e ) t h a t reasonably accur a t e l y gives the o b j e c t ' s p o s i t i o n in the new
s t a t e must be used as the d e s c r i p t i o n of the
i n i t i a l s t a t e f o r the next attempt.
This feedback method can be extended to
sequences of a c t i o n s . Consider the problem:
Find Sf such t h a t
is t r u e . Suppose the
s t a r t i n g s t a t e i s SQ, w i t h property
Suppose the axioms are as f o l l o w s :

The sequence of a c t i o n s
transforms s t a t e SO w i t h p r o p e r t y PO(SO) i n t o s t a t e
having property

Corresponding to each " t h e o r e t i c a l " p r e d i c a t e


is a corresponding " r e a l - w o r d " p r e d i c a t e
The t r u t h value of
is determined by
sensors and t h e r o b o t ' s i n t e r n a l model of the
world.
It has b u i l t - i n bounds on how close i t s
measurements must be to the c o r r e c t values in
order t o assert t h a t i t i s t r u e . *
The proof
i m p l i e s the f o l l o w i n g d e s c r i p t i o n o f the r e s u l t
a f t e r each step of execution of

At t h i s t i m e , a many-valued l o g i c having
degrees o f t r u t h i s not used, although t h i s
is an interesting p o s s i b i l i t y .

To measure progress a f t e r , say, the itjh s t e p , one


checks t h a t
is t r u e .
I f n o t , then some
other c o n d i t i o n P\(si) holds and a new problem is
generated, g i v e n
a s the s t a r t i n g p o i n t .
If
new i n f o r m a t i o n is p r e s e n t , such as is the case
when the r o b o t h i t s a n o b s t a c l e t h a t i s not i n i t s
model, the model is updated before a new s o l u t i o n
is a t t e m p t e d . The p o s i t i o n of t h i s new o b j e c t of
course i n v a l i d a t e s the previous p l a n i . e . , had
the new o b j e c t ' s p o s i t i o n been known, the previous
p l a n would not have been generated.
The new s o l u t i o n may s t i l l be able to use
t h a t p a r t o f the o l d s o l u t i o n t h a t i s not i n v a l i dated by any new i n f o r m a t i o n . For example, if
P"1
h o l d s , i t may s t i l l b e p o s s i b l e t o reach
the jth i n t e r m e d i a t e s t a t e and then continue t h e
planned sequence of a c t i o n s from the jth s t a t e .
However, the o b j e c t - p u s h i n g axiom is an example
o f a n axiom t h a t probably w i l l i n c o r r e c t l y p r e d i c t r e s u l t s and y e t n o f u r t h e r i n f o r m a t i o n ,
except f o r t h e new p o s i t i o n , w i l l be a v a i l a b l e .
For t h i s case, the best approach is probably to
i t e r a t e toward the t a r g e t s t a t e by repeated use
of t h e push axiom to generate a new p l a n . Hopef u l l y , t h e process converges.
For a g i v e n a x i o m a t i z a t i o n feedback does not
n e c e s s a r i l y make it any e a s i e r to f i n d a p r o o f .
However, knowing t h a t the system uses feedback
allows us to choose a simpler and less accurate
axiom system. Simple axiom systems can then
lead t o s h o r t e r p r o o f s .
One can e n v i s i o n f o r m a l i z i n g t h i s e n t i r e
p r o b l e m - s o l v i n g process, i n c l u d i n g the n o t i o n o f
feedback, v e r i f y i n g whether or not a g i v e n cond i t i o n i s met, updating the model, r e c u r s i v e l y
c a l l i n g the theorem p r o v e r , e t c . The author has
not attempted such a f o r m a l i z a t i o n , although he
has w r i t t e n a f i r s t - o r d e r f o r m a l i z a t i o n of the
theorem p r o v e r ' s own p r o b l e m - s o l v i n g s t r a t e g y .
This r a i s e s t h e very i n t e r e s t i n g p o s s i b i l i t y o f
s e l f - m o d i f i c a t i o n o f s t r a t e g y ; however, i n p r a c t i c e such problems l i e w e l l beyond the c u r r e n t
theorem-proving capacity of the program.
C.

A Simple Robot Problem

Now l e t us consider a problem r e q u i r i n g the


use of a ramp to r o l l onto a p l a t f o r m , as i l l u s t r a t e d below.

The goal is to push the box b 1 from p o s i t i o n


to x 2 . To get onto the p l a t f o r m , the robot
must push the ramp
to t h e p l a t f o r m , and then
r o l l up the ramp onto the p l a t f o r m .
A simple problem f o r m u l a t i o n can use a
s p e c i a l ramp-using axiom such as

R4.

w i t h the obvious meaning. Such a s o l u t i o n is


q u i c k but leaves much to be d e s i r e d in terms of
generality.
A more general problem statement is one in
which the r o b o t has a d e s c r i p t i o n of i t s own
c a p a b i l i t i e s , and a t r a n s l a t i o n of t h i s statement
o f i t s a b i l i t i e s i n t o the basic terms t h a t des c r i b e i t s sensory and human-given model of the
world.
It then learns from a fundamental l e v e l
to deal w i t h the w o r l d . Such a knowledge d o e s n ' t
make f o r the q u i c k e s t s o l u t i o n to a f r e q u e n t l y encountered problem, but c e r t a i n l y does lend
i t s e l f t o l e a r n i n g , g r e a t e r degrees o f problems o l v i n g , and s e l f - r e l i a n c e in a new problem
situation.
Closer t o t h i s extreme o f g r e a t e s t g e n e r a l i t y
i s the f o l l o w i n g a x i o m a t i z a t i o n .

R5.

This axiom says t h a t r describes


i n g ends x 1 a n d T h e maximum
than a constant
the w i d t h
the r o b o t ' s w i d t h w 0 , the space
r o b o t ' s height hQ is c l e a r , and
has a s o l i d s u r f a c e .

a r e c t a n g l e havslope i s l e s s
r is g r e a t e r than
above r to the
the rectangle r

Two paths can be j o i n e d as f o l l o w s :

-230-

R6.

From these two axioms (R5 and R6) , the push


axiom (R2), and a r e c o g n i t i o n of a s o l i d o b j e c t
t h a t can be used as a ramp, a s o l u t i o n can be
obtained i n terms o f c l i m b , push, j o i n , e t c . This
more general method of s o l u t i o n would of course be
slower than using the s p e c i a l ramp axiom. On the
o t h e r hand, the more general method w i l l probably
be more u s e f u l if the robot w i l l be r e q u i r e d to
c o n s t r u c t a ramp, or recognize and push over a
p o t e n t i a l ramp t h a t is standing on i t s wide end.
The danger in t r y i n g the more general methods
is t h a t one may be asking the theorem prover to r e d e r i v e some s i g n i f i c a n t p o r t i o n of math or p h y s i c s ,
in order to solve some simple problem.
VI.
A.

Automatic Programming

Introduction

The automatic w r i t i n g , checking, and debugging of computer programs are problems of great
i n t e r e s t both f o r t h e i r independent importance and
as u s e f u l t o o l s f o r i n t e l l i g e n t machines. This
s e c t i o n shows how a theorem prover can be used to
solve c e r t a i n automatic programming problems. The
f o r m a l i z a t i o n given here w i l l be used to p r e c i s e l y
s t a t e and solve the problem of automatic generation
of programs, i n c l u d i n g r e c u r s i v e programs, along
w i t h concurrent generation of proofs of the c o r r e c t ness of these programs. Thus any programs autom a t i c a l l y w r i t t e n by t h i s method have no e r r o r s .

f o r m a l i z a t i o n a s f u n c t i o n s having e i t h e r the
value NIL ( f a l s e ) or e l s e a value not equal to
NIL ( t r u e ) . The semantics are given by axioms
r e l a t i n g LISP f u n c t i o n s t o l i s t s t r u c t u r e s , e . g . ,
( V x , y ) c a r ( c o n s ( x , y ) ) = x, where cons(x,y) is the
l i s t whose f i r s t element is x and whose remainder
is y.
In our f o r m u l a t i o n of programming problems,
we emphasize the d i s t i n c t i o n between the program
(represented as a f u n c t i o n in LISP), t h a t solves
a problem and a t e s t f o r the v a l i d i t y of a s o l u t i o n to a problem (represented as a p r e d i c a t e in
logic).
I t i s o f t e n much easier t o c o n s t r u c t the
p r e d i c a t e than i t i s t o c o n s t r u c t the f u n c t i o n .
Indeed, one may say t h a t a problem is not w e l l
defined u n t i l a n e f f e c t i v e t e s t f o r i t s s o l u t i o n
is provided.
For example, suppose we wish to w r i t e a p r o gram t h a t s o r t s a l i s t . This problem is not
f u l l y s p e c i f i e d u n t i l the meaning o f " s o r t " i s
e x p l a i n e d ; and the method of e x p l a n a t i o n we choose
i s t o provide a p r e d i c a t e R(x,y) t h a t i s t r u e i f
l i s t y is a sorted v e r s i o n of l i s t x and f a l s e
otherwise.
(The p r e c i s e method of d e f i n i n g t h i s
r e l a t i o n R w i l l b e given l a t e r . )
In g e n e r a l , our approach to using a theorem
prover to solve programming problems in LISP r e q u i r e s t h a t we give the theorem prover two sets of
i n i t i a l axioms :
(1) Axioms d e f i n i n g the f u n c t i o n s and cons t r u c t s of the subset of LISP to be used
(2) Axioms d e f i n i n g an i n p u t - o u t p u t r e l a t i o n
such as the r e l a t i o n R ( x , y ) , which is to be t r u e
if and only if x is any i n p u t of the appropriate
form f o r some LISP program and y is the c o r r e sponding output to be produced by such a program.

We s h a l l take LISP "'


as our example of a
programming language. In the LISP language, a
f u n c t i o n is described by two e n t i t i e s :
(1) i t s
v a l u e , and (2) i t s side e f f e c t . Side e f f e c t s can
be described in terms of t h e i r e f f e c t upon the
s t a t e of the program. Methods f o r d e s c r i b i n g
s t a t e - t r a n s f o r m a t i o n o p e r a t i o n s , as w e l l as methods f o r the automatic w r i t i n g of programs in a
s t a t e - t r a n s f o r m a t i o n language, were presented in
Secs. I and I I . For s i m p l i c i t y , i n t h i s s e c t i o n
we s h a l l discuss " p u r e " LISP, in which a LISP
f u n c t i o n corresponds to the standard n o t i o n of a
f u n c t i o n i . e . , it has a value but no side e f f e c t .

Given t h i s r e l a t i o n R, and the LISP axioms,


by having the theorem prover prove (or disprove)
the a p p r o p r i a t e q u e s t i o n we can formulate the
f o l l o w i n g f o u r kinds of programming problems:
checking, s i m u l a t i o n , v e r i f y i n g (debugging), and
program w r i t i n g . These problems may be explained
using the s o r t program as an example as f o l l o w s :

Thus we s h a l l use pure LISP 1.5 without the


program f e a t u r e , which is e s s e n t i a l l y the lambda
c a l c u l u s . In t h i s r e s t r i c t e d system, a LISP p r o gram is merely a f u n c t i o n . For example, the LISP
f u n c t i o n car applied t o a l i s t r e t u r n s the f i r s t
element of the l i s t . Thus if the v a r i a b l e x has
as value the l i s t (a b c ) , then car(x) = a. The
LISP f u n c t i o n cdr y i e l d s the remainder of the l i s t ,
thus CDR(x) = ( b e ) , and c a r ( c d r ( x ) ) = b. There
are several approaches one may take in f o r m a l i z ing LISP; the one given here is a simple mapping
from LISP's lambda c a l c u l u s to the p r e d i c a t e c a l c u l u s . LISP programs are represented by f u n c t i o n s .
The syntax of pure LISP 1.5, is normal f u n c t i o n
c o m p o s i t i o n , and the corresponding syntax f o r the
f o r m a l i z a t i o n i s also f u n c t i o n c o m p o s i t i o n . LISP
" p r e d i c a t e s " are represented i n LISPand i n t h i s

-231-

(1) Checking: The form of the question is


R(a,b) where a and b are two given l i s t s . By
proving R(a,b) t r u e or f a l s e ,
is checked to be
e i t h e r a sorted v e r s i o n of a_ or n o t . The desired
answer is a c c o r d i n g l y e i t h e r yes or no.
(2) S i m u l a t i o n : The form of the question is
( 3 x ) R ( a , x ) , where a i s a given input l i s t .
If
the q u e s t i o n
is answered yes, then a
sorted v e r s i o n of x e x i s t s and a sorted version
is c o n s t r u c t e d by the theorem p r o v e r . Thus the
theorem prover acts as a s o r t program. If the
answer is no, then it has proved t h a t a sorted
v e r s i o n of x does not e x i s t (an impossible answer
if a is a proper l i s t ) .
<

The form of the question is


vhere g(x) is a program w r i t t e n

by the user.
T h i s mode i s known a s v e r i f y i n g , d e b u g g i n g , p r o v i n g a program c o r r e c t , or p r o v i n g a
program i n c o r r e c t .
I f t h e answer t o ( V x ) R ( x , g ( x ) )
i s y e s , t h e n g ( x ) s o r t s e v e r y p r o p e r i n p u t l i s t and
the program is c o r r e c t .
I f t h e answer i s n o , a
counterexample l i s t c , t h a t t h e program w i l l not
s o r t , must b e c o n s t r u c t e d b y t h e t h e o r e m p r o v e r .
T h i s mode r e q u i r e s i n d u c t i o n a x i o m s t o p r o v e t h a t
l o o p i n g o r r e c u r s i v e programs c o n v e r g e .
(4) Program W r i t i n g :
The f o r m o f t h e q u e s t i o n i s
(Vx)(ey)R(x,y).
I n t h i s s y n t h e s i s mode t h e p r o g r a m
i s t o b e c o n s t r u c t e d o r e l s e proved i m p o s s i b l e t o
construct.
I f t h e answer i s y e s , t h e n a p r o g r a m ,
say f ( x ) , must b e c o n s t r u c t e d t h a t w i l l s o r t a l l
proper input l i s t s .
I f t h e answer i s n o , a n u n s o r t a b l e l i s t ( i m p o s s i b l e , i n t h i s case) must b e p r o duced.
T h i s mode a l s o r e q u i r e s i n d u c t i o n a x i o m s .
The f o r m o f t h e p r o b l e m s t a t e m e n t shown h e r e i s
o v e r s i m p l i f i e d f o r t h e sake o f c l a r i t y .
The e x a c t
f o r m w i l l b e shown l a t e r .
I n a d d i t i o n t o t h e p o s s i b i l i t y o f " y e s " answer
and t h e " n o " a n s w e r , t h e r e i s a l w a y s t h e p o s s i b i l i t y o f a " n o p r o o f f o u n d " answer i f t h e s e a r c h i s
h a l t e d b y some t i m e o r s p a c e b o u n d .
The e l i m i n a t i o n o f d i s j u n c t i v e a n s w e r s , w h i c h i s assumed i n
t h i s s e c t i o n , was e x p l a i n e d i n S e c . B .

d e r i v a b l e from o t h e r s , but are included f o r c l a r ity.


The v a r i a b l e s x , y , and z a r e bound b y
u n i v e r s a l q u a n t i f i e r s , but t h e q u a n t i f i e r s are
o m i t t e d f o r t h e sake o f r e a d a b i l i t y wherever
possible.
The f o r m u l a t i o n i s g i v e n b e l o w :
Predicates

Meaning

NULL(x)

x =

LIST(x)

ATOM(x)

x is

an atom

x = y

equal

Functions

Meaning

(1)

Checking

(2)

Simulation

(3)

Verifying

(4)

Program
Writing

Form o f
Question
R(a,b)
(ex)R(a,x)
(Vx)R(x,g(x))
(Vx)

Ey)R(x,y)

Desired
Answer
yes o r n o
yes, x = b
o r no
yes
or no,

list

to y

The

first

cdr(x)

The

rest

cons(x,y)

If y is a l i s t then the value of


c o n s ( x , y ) i s a new l i s t t h a t has
x a s i t s f i r s t e l e m e n t and y a s
the rest of the l i s t , e . g . ,
c o n s ( l , ( 2 3)) = ( 1 2 3 ) .
If y is
a n atom i n s t e a d o f a l i s t ,
c o n s ( x , y ) has a s v a l u e a " d o t t e d
p a i r , " e.g., cons(l,2) = (1-2).

cond(x,y,z)

The c o n d i t i o n a l s t a t e m e n t , i f x =
n i l then y else z.
Note t h a t the
syntax o f t h i s f u n c t i o n i s s l i g h t l y
d i f f e r e n t t h a n t h e u s u a l LISP s y n t a x

nil

The n u l l ( e m p t y )
elements.

equal(x,y)

E q u a l i t y t e s t , whose v a l u e
i f x does n o t e q u a l y .

atom(x)

Atom t e s t , whose v a l u e i s
x is n o t an a t o m .

" n i l " if

null(x)

Null

test,

" n i l " if

not

x = c

yes, y - f ( x )
or n o , x = c

is

car(x)

These m e t h o d s a r e summarized i n t h e f o l l o w i n g
table.
The r e a d e r may v i e w R ( x , y ) a s r e p r e s e n t i n g
some g e n e r a l d e s i r e d i n p u t - o u t p u t r e l a t i o n s h i p .
Programming
Problem

is

nil

is

element
of

the

of

list

the l i s t

l i s t containing no

whose v a l u e

equal

is

x = car(cons(x,y))

L2:

y = cdr(cons(x,y))

B.

L3 :

~ATOM(x) => x = c o n s ( c a r ( x ) , c d r ( x ) )

L4:

~ATOM(cons(x,y))

L5:

ATOM(nil)

L6:

x = n i l 3 cond(x,y,z)

= z

L7:

x f

L8:

x = y = equal(x,y) # n i l

L9:

ATOM(x)

The v e r s i o n o f LISP d e s c r i b e d h e r e d o e s n o t
d i s t i n g u i s h b e t w e e n a n S - e x p r e s s i o n and a copy o f
that S-expression.
T h e r e i s some r e d u n d a n c y i n
the f o l l o w i n g formulation, in that c e r t a i n funct i o n s and p r e d i c a t e s c o u l d h a v e b e e n d e f i n e d i n
terms of o t h e r s ; however, t h e redundancy a l l o w s us
t o s t a t e t h e p r o b l e m more c o n c i s e l y .
A l s o , some
a x i o m s c o u l d h a v e been e l i m i n a t e d s i n c e t h e v a r e

"nil"

Axioms
LI:

A l l L I S P f u n c t i o n s and p r e d i c a t e s w i l l b e
w r i t t e n in small l e t t e r s .
The f u n c t i o n s
" e q u a l ( x , y ) , " " a t ( x ) , " and " n u l l ( x ) " e v a l u a t e t o
" n i l " i f f a l s e and s o m e t h i n g n o t e q u a l t o " n i l , "
say " T , " i f t r u e .
The p r e d i c a t e s o f f i r s t - o r d e r
l o g i c t h a t a r e used t o d e s c r i b e LISP a r e w r i t t e n
in capital l e t t e r s .
These, o f c o u r s e , have t r u t h
values.

is

to n i l .

W e now p r e s e n t a n a x i o m a t i z a t i o n o f L I S P f o l lowed by two a x i o m a t i z a t i o n s of t h e s o r t r e l a t i o n R


( o n e f o r a s p e c i a l c a s e and one more g e n e r a l ) .
A x i o m a t i z a t i o n of a Subset of LISP

x.

x.

n i l 3 cond(x,y,z)

L 1 0 : NULL(x)
C.

= atom(x) # n i l
-

null(x)

nil

A S i m p l i f i e d Sort Problem

B e f o r e e x a m i n i n g a more g e n e r a l s o r t p r o b l e m ,
consider the f o l l o w i n g very simple special case.

-232-

sort(x)

A LISP s o r t f u n c t i o n ( t o be cons t r u c t e d ) g i v i n g as i t s value a


sorted v e r s i o n o f x .

merge(x,u)

A LISP merge f u n c t i o n merging x


i n t o the s o r t e d l i s t u , such t h a t
the l i s t r e t u r n e d contains the
elements of u and also c o n t a i n s
x , and t h i s l i s t i s s o r t e d .

P(x,u,y)

into

name of the f u n c t i o n to be w r i t t e n . We w i l l now


g i v e t h e problem statement f o r the s o r t program,
introducing appropriate induction information
where necessary.
F.

The Sort Problem

Examples i l l u s t r a t i n g the f o u r kipds o f p r o b lems are shown below.

A p r e d i c a t e s t a t i n g t h a t y is the
r e s u l t of merging x i n t o the s o r t e d
l i s t u.

(1) Checking:

A:

We d e f i n e P ( x , u , y ) , t h a t y is u w i t h x merged
it:

yes

(2) S i m u l a t i o n :

S4.
Thus P ( x , u , y ) holds i f and o n l y i f the f a c t t h a t u
i s s o r t e d i m p l i e s t h a t y contains x i n a d d i t i o n t o
the elements of u, and y is s o r t e d . One such merge
f u n c t i o n is merge(x,u) = c o n d ( n u l l ( u ) , c o n s ( x , u ) ,
cond(lessp(x,car(u))(cons(x,u),cons(car(u),merge(x,
cdr(u))))).

(3) V e r i f y i n g : Now consider the v e r i f y i n g or d e bugging problem. Suppose we are given a proposed
d e f i n i t i o n of a s o r t f u n c t i o n and we want to know
if it is correct.
Suppose the proposed d e f i n i t i o n
is
S6.

The axiom r e q u i r e d to describe the merge f u n c t i o n is :


S5.

Thus s o r t is d e f i n e d in terms of c a r , c d r , cond,


n u l l , merge, and s o r t . Each of these f u n c t i o n s
except s o r t is already described by p r e v i o u s l y
given axioms. We also need the a p p r o p r i a t e i n d u c t i o n axiom in terms of s o r t . Of course, the p a r t i c u l a r i n d u c t i o n axiom needed depends on the
d e f i n i t i o n o f the p a r t i c u l a r s o r t f u n c t i o n g i v e n .
For t h i s s o r t f u n c t i o n the p a r t i c u l a r i n d u c t i o n
axiom needed is

This completes a d e s c r i p t i o n of the p r e d i c a t e s


ON, SD, R, and P. Together, these s p e c i f y the
i n p u t - o u t p u t r e l a t i o n f o r a s o r t f u n c t i o n and a
merge f u n c t i o n . Before posing t h e problems to the
theorem p r o v e r , we need to i n t r o d u c e axioms t h a t
d e s c r i b e the convergence of r e c u r s i v e f u n c t i o n s .
E.

I n d u c t i o n Axioms

In order to prove t h a t a r e c u r s i v e f u n c t i o n
converges to the proper v a l u e , the theorem prover
r e q u i r e s an i n d u c t i o n axiom. An example of an
i n d u c t i o n p r i n c i p l e i s t h a t i f one keeps t a k i n g
" c d r " o f a f i n i t e l i s t , one w i l l reach the end o f
the l i s t i n a f i n i t e number o f s t e p s . This i s
analogous to an i n d u c t i o n p r i n c i p l e on the nonnegative i n t e g e r s , i . e . , l e t " p " b e a p r e d i c a t e ,
and " h " a f u n c t i o n . Then f o r f i n i t e l i s t s ,

S7.

The f o l l o w i n g c o n j e c t u r e can then be posed to the


theorem p r o v e r :

A:

i s analogous t o

f o r nonnegative i n t e g e r s .
There are o t h e r kinds o f i n d u c t i o n c r i t e r i a
besides the one g i v e n above. U n f o r t u n a t e l y , f o r
each r e c u r s i v e f u n c t i o n t h a t is to be shown to
converge, the a p p r o p r i a t e i n d u c t i o n axiom must be
c a r e f u l l y f o r m u l a t e d by the u s e r . The i n d u c t i o n
axiom also serves t h e purpose of i n t r o d u c i n g the

yes

(4) Program w r i t i n g : The next problem is t h a t of


s y n t h e s i z i n g or w r i t i n g a s o r t f u n c t i o n . We assume,
of course, t h a t no d e f i n i t i o n such as S6 is p r o v i d e d . C e r t a i n i n f o r m a t i o n needed f o r t h i s p a r t i c u l a r problem might be considered to be a p a r t of
t h i s p a r t i c u l a r problem statement r a t h e r than a
p a r t of the data base. We s h a l l phrase the q u e s t i o n
s o t h a t i n a d d i t i o n t o i t s primary purpose o f aski n g f o r a s o l u t i o n , the question provides t h r e e more
pieces of i n f o r m a t i o n :
(a) The q u e s t i o n assigns a
name to the f u n c t i o n t h a t is to be c o n s t r u c t e d . A
r e c u r s i v e f u n c t i o n i s d e f i n e d i n terms o f i t s e l f ,
so to c o n s t r u c t t h i s d e f i n i t i o n the name of the
f u n c t i o n must be known (or e l s e created i n t e r n a l l y ) .
(b) The q u e s t i o n s p e c i f i e s the number of arguments
o f the f u n c t i o n t h a t i s t o b e c o n s i d e r e d .
-234-

(c) The question ( r a t h e r than an i n d u c t i o n axiom)


gives t h e p a r t i c u l a r i n d u c t i v e hypothesis to be
used i n c o n s t r u c t i n g the f u n c t i o n .

These kinds of i n f o r m a t i o n are n o t , of course,


mutually e x c l u s i v e .

In t h i s formi the question and answer are

Thus the question names the f u n c t i o n to be " s o r t "


and s p e c i f i e s t h a t it is a f u n c t i o n of one argument . The question gives the i n d u c t i v e hypothesis
t h a t the f u n c t i o n s o r t s cdr(x)and then asks f o r
a f u n c t i o n t h a t s o r t s x. When the answer y is
found y is labeled to be the f u n c t i o n s o r t ( x ) .
Using t h i s f o r m u l a t i o n QA3 was unable to w r i t e
the s o r t program in a reasonable amount of t i m e ,
although the author d i d f i n d a c o r r e c t proof w i t h i n
the r e s o l u t i o n f o r m a l i s m * . The c r e a t i o n of the
merge f u n c t i o n can also be posed to the theorem
prover by the same methods.
G.

Discussion of Automatic Programming Problems

The axioms and conjectures given here i l l u s t r a t e the fundamental ideas of automatic programming. However, t h i s work as w e l l as e a r l i e r work
and others p r o vides merely a small part of what needs to be done.
Below we present discussion of issues t h a t might
p r o f i t from f r u t h e r i n v e s t i g a t i o n .

In the axiom systems presented, no d i s t i n c t i o n


is made between such classes of i n f o r m a t i o n . Consequently, during the search f o r a proof the theorem
prover might attempt to use axioms of type 1 f o r purposes where it needs i n f o r m a t i o n of type 2.
Such
attempts lead nowhere and generate useless clauses.
However, as discussed in S e c . I I - G , we can place in
the proof strategy our knowledge of when such i n f o r mation is to be used, thus leading to more e f f i c i e n t
p r o o f s . One such methodcalling f o r the c o n d i t i o n a l
axioms at the r i g h t t i m e , as discussed in Sec. I I - G
has been implemented in QA3.
The PROW program of Waldinger and Lee6 provides
a very promising method of separating the problem
of proof c o n s t r u c t i o n from the problem of program
c o n s t r u c t i o n . In t h e i r system, the only axioms
used are those t h a t describe the s u b j e c t i . e . ,
s t a t e the problem. Their proof t h a t a s o l u t i o n
e x i s t s does not d i r e c t l y construct the program.
I n s t e a d , i n f o r m a t i o n about the t a r g e t programming
language, as w e l l as i n f o r m a t i o n about the r e l a t i o n ship of the target-programming language to the
problem-statement language, is in another part of
the PROW programthe " p o s t - p r o c e s s o r . " The p o s t processor then uses t h i s i n f o r m a t i o n to convert
the completed proof i n t o a program. The postprocessor also converts r e c u r s i o n i n t o loops and
allows several t a r g e t programming languages.
If our goal is to do automatic programming
i n v o l v i n g complex programs, we w i l l probably wish
to do some o p t i m i z a t i o n or problem s o l v i n g on the
t a r g e t language i t s e l f . For t h i s reason we might
want to have axioms t h a t give the semantics of the
t a r g e t language, and also allow the intercommunicat i o n o f i n f o r m a t i o n i n the problem-statement l a n guage w i t h i n f o r m a t i o n in the t a r g e t language.
Two p o s s i b i l i t i e s f o r how to do t h i s e f f i c i e n t l y
suggest themselves:
(a) Use the methods presented
here i n which a l l i n f o r m a t i o n i s i n f i r s t - o r d e r
l o g i c . To gain e f f i c i e n c y , use s p e c i a l problems o l v i n g s t r a t e g i e s t h a t minimize unnecessary i n t e r a c t i o n ; (b) Use a h i g h e r - o r d e r l o g i c system, in
which the program c o n s t r u c t i o n is separated from
the proof c o n s t r u c t i o n , p o s s i b l y by being at
another l e v e l . The program c o n s t r u c t i o n process
might then be described in terms of the f i r s t order existence p r o o f .

Loops. One obvious extension of t h i s method


is to create programs t h a t have loops r a t h e r than
r e c u r s i o n . A simple technique e x i s t s f o r c a r r y i n g
out t h i s o p e r a t i o n . F i r s t , one w r i t e s j u s t r e c u r s i v e f u n c t i o n s . Many r e c u r s i v e f u n c t i o n s can then
be converted i n t o i t e r a t i o n i . e . , f a s t e r - r u n n i n g
loops t h a t do not use a s t a c k . McCarthy30 gives
c r i t e r i a t h a t determine how to convert recursion to
i t e r a t i o n . An a l g o r i t h m f o r determining cases in
which r e c u r s i o n can be converted to i t e r a t i o n , and
then performing the conversion process is embedded
in modern LISP c o m p i l e r s . This a l g o r i t h m could be
a p p l i e d to r e c u r s i v e f u n c t i o n s w r i t t e n by the
theorem-proving program.
Separation of Aspects of Problem S o l v i n g . Let
us d i v i d e i n f o r m a t i o n i n t o three t y p e s :
(1) I n f o r mation concerning the problem d e s c r i p t i o n and
semantics. An example of such i n f o r m a t i o n is given
in the axiom
or axiom SI t h a t defines a
sorted l i s t . (2) I n f o r m a t i o n concerning the t a r g e t
programming language, such as the axiom
c o n d ( x , y , z ) = z ] . (3) I n f o r m a t i o n concerning the
i n t e r r e l a t i o n of the problem and the t a r g e t l a n guage, such as [LESS(x,y) = l e s s p ( x , y )

Problem F o r m u l a t i o n . The a x i o m a t i z a t i o n given


here has considerable room f o r improvement: Missing
p o r t i o n s of LISP i n c l u d e t h e program features and
the use of lambda to bind v a r i a b l e s . The f u n c t i o n s
to be w r i t t e n must be named by the user, and the
number of arguments must also be s p e c i f i e d by the
user.

A f t e r t h i s paper was w r i t t e n the problem was r e formulated using a d i f f e r e n t set of axioms.


In
the new f o r m u l a t i o n QA3 created the s o r t program
"sort(x) = cond(x,merge(car(x),sort(cdr(x))),nil).

H e u r i s t i c s f o r Program-Writing Problems. Two


h e u r i s t i c s have been considered so f a r . The f i r s t
c o n s i s t s of examining the program as it is cons t r u c t e d (by l o o k i n g i n s i d e the answer l i t e r a l ) .
Even though the syntax is guaranteed c o r r e c t , the
answer l i t e r a l may contain various nonsense or
undefined c o n s t r u c t i o n s (such as c a r ( n i l ) ) . Any

-23b-

clause c o n t a i n i n g such c o n s t r u c t e d answers should


b e e l i m i n a t e d . Another h e u r i s t i c i s t o a c t u a l l y
r u n the p a r t i a l program by a pseudo-LISP i n t e r p r e t e r on a sample problem. The theorem prover
knows the c o r r e c t performance on these sample
problems because they have e i t h e r been s o l u t i o n s
or e l s e counterexamples to program-simulation
questions t h a t were s t o r e d in memory, or e l s e they
have been provided by t h e u s e r .
If the pseudoLISP i n t e r p r e t e r can produce a p a r t i a l output t h a t
is i n c o r r e c t , the p a r t i a l program can be e l i m i n a t e d .
If done p r o p e r l y , such a method might be v a l u a b l e ,
but i n our l i m i t e d experience, i t s usefulness i s
not yet c l e a r .
Higher-Level Programming Concepts. A
necessary requirement f o r p r a c t i c a l program w r i t ing is t h e development of h i g h e r - l e v e l concepts
(such as the LISP "map" f u n c t i o n ) t h a t describe
the use of f r e q u e n t l y employed c o n s t r u c t s ( f u n c tions) or p a r t i a l constructs.
I n d u c t i o n . The v a r i o u s methods of proof by
i n d u c t i o n should be s t u d i e d f u r t h e r and r e l a t e d
to t h e kinds of problems in which they are u s e f u l .
The automatic s e l e c t i o n or g e n e r a t i o n of approp r i a t e i n d u c t i o n axioms would be most h e l p f u l .
Program Segmentation. Another i n t e r e s t i n g
problem i s t h a t o f a u t o m a t i c a l l y g e n e r a t i n g the
s p e c i f i c a t i o n s f o r t h e subfunctions t o b e c a l l e d
before w r i t i n g these f u n c t i o n s . For example,
in our system, the s o r t problem was d i v i d e d i n t o
two problems: F i r s t , s p e c i f y and c r e a t e a merge
f u n c t i o n , next s p e c i f y a s o r t f u n c t i o n and then
c o n s t r u c t t h i s f u n c t i o n i n terms o f the merge
f u n c t i o n . The segmentation i n t o two problems and
the s p e c i f i c a t i o n of each problem was provided by
the u s e r .
VII .

Discussion

The theorem prover may be considered an


" i n t e r p r e t e r " f o r a high-level assertional or
d e c l a r a t i v e l a n g u a g e l o g i c . As in the case w i t h
most h i g h - l e v e l programming languages the user may
be somewhat d i s t a n t from the e f f i c i e n c y of " l o g i c "
programs unless he knows something about the
s t r a t e g i e s of the system.
The f i r s t a p p l i c a t i o n s of QA2 and QA3 were
to "question answering." Typical questionanswering a p p l i c a t i o n s are u s u a l l y easy f o r a
r e s o l u t i o n - t y p e theorem p r o v e r . Examples of
such easy problem sets given QA3 i n c l u d e the
questions done by Raphael's SIR21 S l a g l e ' s
DEDUCOMV and Cooper's chemistry q u e s t i o n answering program.
Usually t h e r e are a few
obvious f o r m u l a t i o n s f o r some subject area, and
any reasonable f o r m u l a t i o n works w e l l . As one
goes to harder problems l i k e the Tower of Hanoi
p u z z l e , and p r o g r a m - w r i t i n g problems, good and
reasonably w e l l - t h o u g h t - o u t r e p r e s e n t a t i o n s are
necessary f o r e f f i c i e n t problem s o l v i n g .

a given problem and r e p r e s e n t a t i o n , or even change


the r e p r e s e n t a t i o n .
I d o n ' t b e l i e v e these goals
are i m p o s s i b l e , but a t present i t i s not done.
However, a l i b r a r y of s t r a t e g y programs and a
s t r a t e g y language is slowly e v o l v i n g in QA3. To
change s t r a t e g i e s in the present v e r s i o n the user
must know about s e t - o f - s u p p o r t and o t h e r program
parameters such as l e v e l bound and term-depth
bound. To r a d i c a l l y change the s t r a t e g y , the user
p r e s e n t l y has to know the LISP language and must
be able to modify c e r t a i n s t r a t e g y s e c t i o n s of
the program.
I n p r a c t i c e , several i n d i v i d u a l s
who have used t h e system have m o d i f i e d the search
s t r a t e g i e s to s u i t t h e i r needs. To add and debug
a new h e u r i s t i c or to modify a search s t r a t e g y
where reprogramming is r e q u i r e d seems to take from
a few minutes to several days, perhaps averaging
one day.
U l t i m a t e l y i t i s intended t h a t the system
w i l l b e able t o w r i t e simple s t r a t e g y programs
i t s e l f , and "understand" the semantics o f i t s
strategies.
Experience w i t h the robot a p p l i c a t i o n s and
the automatic programming a p p l i c a t i o n s emphasize
the need f o r a very v e r s a t i l e l o g i c a l system. A
s u i t a b l e h i g h e r - o r d e r l o g i c system seems to be one
of the best c a n d i d a t e s . Several recent papers are
relevant to t h i s t o p i c .
A promising higher order
system has been proposed by Robinson.
Banerji
discusses a higher order language. One c r u c i a l
f a c t o r in an i n f e r e n c e system is a s u i t a b l e method
f o r the treatment o f the e q u a l i t y r e l a t i o n .
Discussion of methods f o r the treatment of e q u a l i t y
is provided by Wos and Robinson, and Robinson
and Wos,
and K o w a l s k i .
McCarthy and Hayes
i n c l u d e a d i s c u s s i o n of modal l o g i c s .
The theorem-proving program can be used as an
experimental t o o l i n the t e s t i n g o f problem formulations.
I n e x p l o r i n g d i f f i c u l t problems i t can
be u s e f u l to w r i t e a computer program to t e s t a
problem f o r m u l a t i o n and s o l u t i o n t e c h n i q u e , since
the machine tends to sharpen one's understanding
of the problem.
I b e l i e v e t h a t in some problems o l v i n g a p p l i c a t i o n s the " h i g h - l e v e l language" o f
l o g i c along w i t h a theorem-proving program can be
a quick programming method f o r t e s t i n g i d e a s . One
reason is t h a t a r e p r e s e n t a t i o n in the form of an
axiom system can correspond q u i t e c l o s e l y to one's
c o n c e p t u a l i z a t i o n of a problem. Another reason is
t h a t i t i s sometimes e a s i e r t o r e f o r m u l a t e a n
axiom system r a t h e r than to r e w r i t e a problems o l v i n g program, and t h i s ease of r e f o r m u l a t i o n
facilitates exploration.
R e s o l u t i o n theorem-proving methods are shown
in t h i s paper to have the p o t e n t i a l to serve as
a general p r o b l e m - s o l v i n g system. A modified theoremp r o v i n g program can w r i t e simple robot problems, and
solve simple p u z z l e s . Much work remains to be done
b e f o r e such a system is capable of s o l v i n g problems
t h a t are d i f f i c u l t by human standards.
Acknowledgment
I would l i k e to acknowledge v a l u a b l e d i s cussions w i t h D r . Bertram Raphael and Mr. Robert
Yates.

Some r e p r e s e n t a t i o n s are b e t t e r than others


only because of the p a r t i c u l a r s t r a t e g y used to
search f o r a p r o o f .
I t would b e d e s i r a b l e i f the
theorem prover could adopt the best s t r a t e g y f o r
-236

REFERENCES

1.

J. A. Robinson, "The Present State of Mechani c a l Theorem P r o v i n g , " a paper presented at


the Fourth Systems Symposium, Cleveland, Ohio,
November 19-20, 1968 (proceedings to be published).

12.

John McCarthy, Paul W. Abrahams, Daniel J.


Edwards, Timothy P. H a r t , and Michael I.
L e v i n , LISP 1.5 Programmer's Manual (The MIT
Press, Cambridge, Mass., 1962).

13.

C. Weissman, LISP 1.5 Primer (Dickenson Publ i s h i n g Company, I n c . , Belmont, C a l i f . , 1967).

2.

C. Green and B. Raphael, "The Use of TheoremProving Techniques in Question-Answering


Systems," Proc. 23rd N a t ' l . Conf. ACM,
(Thompson Book Company, Washington, D.C.,
1968).

14.

Lawrence Wos and George Robinson, "Paramodul a t i o n and Set of S u p p o r t , " summary of paper
presented at the IRIA Symposium on Automatic
Demonstration at V e r s a i l l e s , France, December
1 6 - 2 1 , 1968 (proceedings to be p u b l i s h e d ) .

3.

C. Green, "Theorem Proving by Resolution as a


Basis f o r Question-Answering Systems,"
Machine I n t e l l i g e n c e 4, D. Michie and B.
M e l t z e r , Eds. (Edinburgh U n i v e r s i t y Press,
Edinburgh, Scotland, 1969).

15.

G. Robinson and L. Wos, "Paramodulation and


Theorem-Proving i n F i r s t - O r d e r Theories w i t h
E q u a l i t y , " Machine I n t e l l i g e n c e 4, B. Meltzer
and D. M i c h i e , Eds. (Edinburgh U n i v e r s i t y
Press, Edinburgh, Scotland, 1969).

4.

N. J. N i l s s o n , "A Mobile Automaton: An A p p l i c a t i o n o f A r t i f i c i a l I n t e l l i g e n c e Techniques,"


a paper presented at the I n t e r n a t i o n a l J o i n t
Conference o n A r t i f i c i a l I n t e l l i g e n c e ,
Washington, D.C., May 7-9, 1969 (proceedings
to be p u b l i s h e d ) .

16.

H. Simon, "Experiments w i t h a H e u r i s t i c Comp i l e r , " J.ACM, V o l . 10, pp. 493-506 (October


1963).

17.

J. R. S l a g l e , "Experiments w i t h a Deductive,
Question-Answering Program," Comm. ACM,
V o l . 8, pp. 792-798 (December 1965).

18.

R. W. F l o y d , "The V e r i f y i n g Compiler,"
Computer Science Research Review, Carnegie
Mellon U n i v e r s i t y (December 1967).

19.

z. Manna, "The Correctness of Programs,"


J. Computer and Systems Sciences, V o l . 3
(1969).

20.

J. McCarthy, "Towards a Mathematical Science


of Computation," Proceedings ICIP (North
Holland P u b l i s h i n g Company, Amsterdam,
1962).

21.

B. Raphael, "A Computer Program Which 'Unders t a n d s ' , " Proc. FJCC, pp. 577-589 (1964).

22.

W. S. Cooper, "Fact R e t r i e v a l and Deductive


Question Answering I n f o r m a t i o n R e t r i e v a l
Systems," J.ACM, V o l . 1 1 , pp. 117-137 ( A p r i l
1964).

5.

6.

7.

J. McCarthy and P. Hayes, "Some P h i l o s o p h i c a l


Problems from the Standpoint of A r t i f i c i a l
I n t e l l i g e n c e , " Machine I n t e l l i g e n c e 4, D.
Michie and B. M e l t z e r , Eds. (Edinburgh U n i v e r s i t y Press, Edinburgh, Scotland, 1969).
R. J. Waldinger and R. C. T. Lee, "PROW: A
Step Toward Automatic Program W r i t i n g , " a
paper presented at the I n t e r n a t i o n a l J o i n t
Conference on A r t i f i c i a l I n t e l l i g e n c e , Washi n g t o n , D.C., May 7-9, 1969 (proceedings to
be p u b l i s h e d ) .
L. Wos, G. A. Robinson, and D. F. Carson,
" E f f i c i e n c y and Completeness of the Set of
Support Strategy in Theorem P r o v i n g , " J.ACM,
V o l . 12, No. 4, pp. 536-541 (October 1965).

8.

J. A. Robinson, "A Machine-Oriented Logic


Based on the Resolution P r i n c i p l e , " J.ACM,
V o l . 12, No. 1, pp. 23-41 (January 1965).

9.

George E r n s t , " S u f f i c i e n t Conditions f o r the


Success of GPS," Report No. SRC-68-17, Systems
Research Center, Case Western Reserve U n i v e r s i t y , Celveland, Ohio ( J u l y 1968).

23.

J. A. Robinson, "Mechanizing Higher Order


L o g i c , " Machine I n t e l l i g e n c e 4, D. Michie and
B. M e l t z e r , Eds. (Edinburgh U n i v e r s i t y Press,
Edinburgh, S c o t l a n d , 1969).

10.

A. Hormann, "How a Computer System Can L e a r n , "


IEEE Spectrum ( J u l y 1964).

24.

11.

L. S. Coles, " T a l k i n g With a Robot in E n g l i s h , "


paper submitted at the I n t e r n a t i o n a l J o i n t
Conference on A r t i f i c i a l I n t e l l i g e n c e , Washi n g t o n , D.C., May 7-9, 1969 (proceedings to be
published).

R. B. B a n e r j i , "A Language f o r P a t t e r n Recogn i t i o n , " P a t t e r n R e c o g n i t i o n , V o l . 1 , No. 1 ,


pp. 63-74 (1968).

25.

R. Kowalski, "The Case f o r Using E q u a l i t y


Axioms in Automatic Demonstration," paper
presented at the IRIA Symposium on Automatic
Demonstration at V e r s a i l l e s , France, December
1 6 - 2 1 , 1968 (proceedings to be published) .

-237-

APPENDIX
The a x i o m s f o r t h e Monkey and Bananas p r o b l e m
SK24(S,P2,P1,B) t h a t f i r s t appears in clause 16 of
e l i m i n a t i o n o f ( V x ) i n t h e c o n v e r s i o n o f a x i o m MB4
it as the o b j e c t t h a t is not at place P2 in s t a t e

are l i s t e d below, f o l l o w e d by the p r o o f .


The t e r m
t h e p r o o f i s a Skolem f u n c t i o n g e n e r a t e d b y t h e
to q u a n t i f i e r - f r e e clause form.
(One may t h i n k o f
S.)

L I S T MONKEY
MB1

(MOVABLE BOX)
( F A ( X ) ( N O T ( A T X UNDER-BANANAS S 0 ) ) )
(AT BOX PLACEB 3 0 )
( F A ( B PI P2 S ) ( I F ( A N D ( A T B PI S) (MOVABLE B) ( F A ( X ) (NOT(AT X P2 S ) ) ) ) ( A N D ( A T MONKEY P2
(MOVE(MONKEY B P2 S ) ) ( A T B P2(MOVE MONKEY B
(FA(S)(CLIMBABLE MONKEY BOX S ) )
(FA(M P B S ) ( I F ( A N D ( A T B P S)(CLIMBABLE M B S ) ) ( A N D ( A T B P(CLIMB M B S ) ) ( O N M B
(CLIN M B
( F A ( S ) ( I F ( A N D ( A T BOX UNDER-BANANAS S)(ON MONKEY BOX S))(REACHABLE MONKEY BANANAS
(FA(M B S)(IF(REACHABLE M B S)(HAS M B(REACH M B

( E X ( S ) ( H A S MONKEY BANANAS S ) )
YES,

S = REACH(MONKEY,BANANAS,CLIMB(MONKEY,BOX,MOVE(MONKEY,BOX,UNDER-BANANAS,S0)))

PROOF
1

-AT(X,UNDER-BANANAS,S0)

AT(BOX,PLACEB,S0)

CLIMBABLE(MONKEY,BOX,S)

-HAS(MONKEY,BANANAS,S)

HAS(M,B,REACH(M,B,S))

-REACHABLE(MONKEY,BANANAS,S)

REACHABLE(MONKEY,BANANAS,S)

-AT(BOX,UNDER-BANANAS,S)

ON(M,B,CLIMB(M,B,S))

ANSWER(S)
-REACHABLE(M,B,S)

ANSWER(REACH(MONKEY,BANANAS,S))
-AT(BOX,UNDER-BANANAS,S)

-ON(MONKEY,BOX,S)

-ON(MONKEY,BOX,S)

ANSWER(REACH(MONKEY,BANANAS,S))
-AT(B,P,S)

-CLIMBABLE(M,B,S)

10

-AT(BOX,UNDER-BANANAS,CLIMB(MONKEY,BOX,S))

11

-AT(BOX,UNDER-BANANAS,CLIMB(MONKEY,BOX,S))

-AT(BOX,P,S)

-CLIMBABLE(MONKEY,BOX,S)

ANSWER(REACH(MONKEY,BANANAS,CLIMB(MONKEY,BOX,S)))
-AT(BOX,P,S)

ANSWER(REACH(MONKEY,BANANAS,CLIMB(MONKEY,BOX,S)))
12

AT(B,P,CLIMB(M,B,S))

13

-AT(BOX,XXI,S)

-AT(B,P,S)

-CLIMBABLE(M,B,S)

-AT(BOX,UNDER-BANANAS,S)

-CLIMBABLE(MONKEY,BOX,S)

ANSWER(REACH(MONKEY,BANANAS,CLIMB(MONKEY,BOX,S)))
14

-AT(BOX,XXI,S)

-AT(BOX,UNDER-BANANAS,S)

ANSWER(REACH(MONKEY,BANANAS,CLIMB(MONKEY,BOX,S)))
15

-AT(BOX,UNDER-BANANAS,X)

16

AT(B,P2,MOVE(MONKEY,B,P2,S))

ANSWER(REACH(MONKEY,BANANAS,CLIMB(MONKEY,BOX,S)))
-MOVABLE(B)

-AT(B,P1,S)

-238-

AT(SK24(S,P2,P1,B),P2,S)

17

-MOVABLE(BOX)

18

-MOVABLE(BOX)

-AT(BOX,Pl,S)

AT(SK24(S,UNDER-BANANAS,PI,BOX),UNDER-BANANAS,S)

FROM 1 5 , 1 6

ANSWER (REACH (MONKEY, BANANAS ,CLIMB (MONKEY, BOX, MOVE (MONKEY, BOX , UNDER-BANANAS , S) )) )
AT (SK2 4 ( S 0 , UNDER-BANANAS ,PLACEB, BOX) , UNDER-BANANAS ,S0)

ANSWER(REACH(MONKEY,BANANAS,CLIMB(MONKEY,BOX,MOVE(MONKEY,BOX,UNDER-BANANAS,S0)
19

FROM 2 , 1 7
)))

-MOVABLE(BOX)

FROM 1,18

ANSWER (REACH (MONKEY, BANANAS ,CLIMB (MONKEY, BOX, MOVE (MONKEY, BOX , UNDER-BANANAS , S0) ) ) )
20

MOVABLE(BOX)

AXIOM

21

CONTRADICTION

FROM 1 9 , 2 0

ANSWER (REACH (MONKEY, BANANAS , CLIMB (MONKEY, BOX, MOVE (MONKEY, BOX , UNDER-BANANAS, S0) )) )
11 CLAUSES LEFT
28 CLAUSES GENERATED
22 CLAUSES ENTERED

-239-