.a.gT~CtAL m'rELUGeNCE
129
A Logical Theory of Robot Problem Solving Olga;tplnkov Institute of Computation Techniques, Technical University of Prague, Prague, Czechoslovakia
Ivan M. Havel Institute of lnformation Theory and Automation, Czechoslovak Academy of Sciences, Prague, Czechoslovakia Recommended by Bernard Meltzer and Pat Hayes
ABSTRACT The concept of an image space, motivated by the STRIPS system, Is Introducedas a formal Inglcalcounterpart to the state-spaceproblem salvlng In robotics. The main resultsare two correspondence theorems estabflsldnga relatlonshlpbetween solutlonsof problems formalized
in the imagespaceandformalproofs of certainformulas in the associatedsituation calculus. The concept of a solution, as used in the second correspondence theorem, hay a rather general form allowing for conditional branching. BesideJ giving a deeper insight into the logic of problem solving the results suggest a possibility of using the advantages of the intage-space representation in the situation calculus and conversely. The image space approach is further extended to cope with the frame problem in a similar way as S T ~ P S . Any STRIPS problem domain can be associated with an appropriate image space with frames of the same salving power.
1. Introduction The challenging task of constructing an intelligent robot capab,'e of autonomous reasoning and planning its own behaviour in a reasonably complex environment can be approached in various different ways. The current methods are more or less guided by concrete pragmatic considerations and a general unifying framework is yet to be developed. Such a "metatheory of artificial intelligence" would, among others, enable to compare various methods in their intrit~ic expressive power and problem solving ability. The purpose of the present paper :s to formalize and compare two specific approaches to world representation and goal-oriented problem solving, based Arttftcial Intelligence 7 (1976), 129-161
Copyright C) !976 by North-Holland Publishing Company
130
o. ~Tl~.~m~ov~ AND t. M. V,A~
on the first-order predicate calculus. One of the approaches uses an underlying structure, called the inure space, based on ideas similar to those of the wellknown SRI robot planning system STRIPS (Fikes and Nilsson [2]); the other approach uses the situation calculus as discussed by McCarthy and Hayes [9] and Hayes [6], implemented by Green [3, 4], and used in the first version of the SRI robot (Nilsson [10]). Apart from 'their formal differences the two approaches differ also operationally: the former allows to employ GPS-like heuristic strategies for searching through the space, while the latter uniformly reduces all the problem-solving mechanisms to formal theorem proving. The study of the exact relationship between them might thus also have a significance both for state-space search methods and for mechanization of predicate logic. (Regarding this point see Sections 7.6 and 7.7 of Hilsson's book [11], especially his remark on pp. 211-212.) After the formal presentation of both the image space and the associated situation calculus (Section 2) we shall establish the first correspondence theorem (Section 3), according to which a sequence of operators in animage space is ~ solution to a given problem if and only if a formula describing the problem is provable in the associated situation calculus. A much deeper question of the existence of a solution to a given problem compels us to generalize substantially the concept of a solution (Section 4). The generalized solution to a given problem (one may call it the plan) is a set of sequences of operators rather than a single sequence, and captures the idea of branching or conditional plans. Our main result, the second correspondence theorem (Section 5) relates the existence of a generalized solution in an image space (or in STRIPS) to provability of certain existential formula in the corresponding situation calculas. Th*. second correspondence theorem is proved syntactically (Section 6) as a coasequence of the special form of axioms of the situation calculus. Formulas q~ecifying the problem to be solved admit a special normal form of proof, matching the structure of a generalized solution to the same problem in the image space (Section 6 may be omitted on the fn~t reading). In the last section we introduce an exteaded form of the image space, which incorporates, as a special case, the well-known "deletion' idea of STRIPS overcoming the frame problem. We generalize the upper results to this extended case. •We give a formal mathematical treatment to our results, always attempting for a comprehensible proof. We assume a certain amount of maturity in mathematical logic, corresponding roughly to the first four chapters of Shoenfield's Mathematical Looic [12]. Unless explicitly stated, we follow Shoenfield's terminology and (to a certain extent) even the notation. Afirst-order theory T is specified by its Artifwlal latdllgo~ 7 (1976), 129-161
A I.,OGICAI,, THEORY OF ROBOT PROBLEM SOLVING
131
language L ffi L(T) and by its (nonlogical) axioms. (The logical axioms and inference rules are fixed; unlike Shoenfield we do not assume, in general, theories with equality.) We occasionally pass from L to some other language L' having all the symbols of L plus some additional ones. In such cases we use the notation L' ~_ L. We use symbols T I- and ~ i: with the usual meaning (provability in T and validity in model 9,t, sesp.). If T is a theory and A a formula (not necessarily in L(T)), T[A] denotes the extension of T obtained by adding A as a new axiom and extending the language by the new symbols from A. Similarly we define T [ d ] for a set ~ ' of formulas. Note. A preliminary version of this paper appeared in the form of a technical report [14] and some of the early results were presented at the Symposium on Mathematical Foundations of Computer Science, the High Tatras, September 1973 (see [15]). 2. Image Space and the Associated Situation Calculus informally, an image comprises some, in general incomplete, knowledge about a possible state ofthe world, as conceived by the robot. Since the robot is capable of changing states of the wodd it may reason about its actions in terms of operators transforming one image into another. This reasoning can be done in advance in the stage of planning. To formalize this idea one may identify images with formal theories in the first-order logic with certain common features. In the following, L will be an arbitrary but fixed first-order language. DEFINITION 1. An image space I - ( T l, O) over L is specified by means of a first-order theory 7", over L (the core theory of I), and a set • of operator schemes, each ~ 6 ¢~ being a pair ~ - ( C , , R t ) of formulas of L (the condition and the result of ~, respectively). The idea behind this definition is the following. The core theory Ti specifies all the general laws, i.e., the assertions valid in all possible states of the world under consideration (fox instance "Monkey likes bananas"). There are other assertions reflecting the particular properties of different states and more or less distinguishing one state from another ("The banana is on the table"). If A is such an assertion (or a conjunction of such assertions) then the extension TI[A] of 7', is an image corresponding to a given state (of course, the correspondence is ambiguous in both directions). [Using the term "image" instead of "world model" as in STRIPS we avoid possible confusion with a model as a semantical structure.] Now let us describe the dynamics of the image space. Let ¢p ffi
132
o. ~'~a'~tNKOV.4AND ]. ~ ~ v ~
Let a be a sequence of variable-free terms of L and assume that a has the same length as £,÷. We define an operator in I as a pair =
where C#[~] and R#[Q] are two sentences of L obtained by substituting ~ for £,# in both C÷ and R÷. The operator ~[~] represents a partial function from the set of images of I to itself: it transforms an image T~[A] meeting the condition C÷[a] (i.e., Ti[A] F C,[~D to the image Tl[R÷[~]]. We denote by the set of all operators in I. Remark. The main difference comparing to STRIPS is in omitting the "delete lists" in operator descriptions (as if we would consider each delete list to be the set of all formulas but the axioms of T~), and thus sacrificing the convenient wa~ in which STRIPS treats the frame problem. The reason is that the simplification will help to develop some teols for comparing the image-space-like structures with the situation ea!culus. A very natural generalization of these tools is used in Section 7 for a study of relations between STP.JPS-like structures and situation calculus. DmNmoN 2. A problem On I) is a pair is solved On I) by 7 (? is a solution (in I) to ) iff either (i)? = A and TI[X] I- Y, or (ii) 7 =
for some ~[~] ¢ I: and ?t ¢ ~:,, where 71 is a solution in I to the problem . In other words, a solution toga problem determines a path through the image space, corresponding to the subsequent changes of the world and resulting in the goal state. We give now a simple but illustrative example of the concepts introduced above. ~LE 1 (The Robot in the Maze). The robot's world is a maze consisting of rooms some of them connected by a door. Let us consider a submaze of A f f ~ d InteH/genc¢7 (1976),,129--161
133
A LOGICAL THEORY OF ROBOT PROBLEM SOLVING
nine rooms (a, b , . . . , i) as in Fig. 1. Initially the robot is in room " a " ; his goal is to visit room 'T'. N
w
•i
I
I
~d,
,.',:_.~..~ J H
o I ~1
'/
e
~J
S FIG. 1' The "Robot in the Maze" problem.
We formalize the problem using a sorted language: variables x, x~, x z , . . • of sort room; of sort direction; Y, Yl, Y2, • • " constants a, b, c , . . . , i of sort room; N, W , S , E of sort direction (north, west, south, east); function next of sort (room, direction; room); predicates IN of sort room; •DOOR o f sort (room, room); (the equality). The term next(x,y) denotes the room which is adjacent to the room x in the direction y. IN(x) holds iff the lobot is in the room x. DOOR(x~,xz) holds iff rooms xi and x~ are connected by a door. There is only one operator scheme "move" with parameters ~'mo~ = (x,y). The condition C.~o,®is IN(x) & DOOR(x,next(x,y))~ and the result Rmove is IN(next(x,y)). Thus, e.g., move[b,N] is the operator which consists in the robot's moving from room b in the north direction. The core theory T~ contains, besides the axioms for equality, various general laws, for instance, Vx,¥xz,(IN(.,q) & IN(xz) -+ xt ffi x2), Vxl,Vx2,(DOOR(xt,x2) ~ D O O R ( x 2 , x t ) ) , Vx,(x - next(next(x,E),W)), etc., as well as facts about positions of rooms and doors, e.g. Artificial Intelligence 7 (1976), 129-161
10
134
o. ~t'~A~ov.~ AND L M. ~VZ~L
DOOR(a,b) & -IDOOR(a,d) & . . . . b - next(a,E) & d --- next(a,N) & . . . . Now it can be easily seen that the operator sequence ? -- move[a,E] move[b,N] move[e,W]move[d,N] move[g,E] move[h,E] (cf. the dotted line in Fig. 1) is one of possible solutions to the problem
. Our definition of an image space permits some cases which are certainly not desirable. Let I be an image space such that Tt is inconsistent. Then every problem in I has a trivial solution A. Similarly, if there is an operator ~[~] with the result R÷[fi] inconsistent with Tt then any problem in I of the form (C÷[~], Y) has a solution ~[a]. To avoid these uninteresting cases we shall mostly restrict ourselves to an image space satisfying certain natural consistency requirements. D m m ~ o N 4. An image space I over L is consistent iff T~ is consistent and for any operator ~[~], if TI[C~[~]] is consistent then also Ti[R,[~]] is consistent. Intuitively, the condition of each operator is Strong enough to guarantee the realizability of the operator (the soundness of its result). To be able to prove consistency of the theory g'~ introduced in the following section we shall need somewhat stronger consistency requirements on I . Let T~ be the conservative extension of Tt to a Henldn theory." Let I' - (T;,O) be the image space over L(T0 with the same set • of operator schemes as I. Dmm~ON 5. We say that I is strongly consistent iff I' is consistent. Solving problems in an image space is based on searching through the space for a proper operator sequence. Formal theorem proving is used only when the condition of some operator is verified. Can a single "global" first-order theory be associated with a given image space ? A theory which would enable to express facts about different state~ as well as about their changes and in which one could use purely logical tools to solve problems. To answer this question we use the concept of the situation calculus and associate with each image space I a special sorted first-order theory Kt. The main idea is that each formula of the language of the image space is supplied with a new situation parameter indicating the situation (state or image) to which the formula relates. A transition from one situation to another is a A theory Tis a Henkin theory iff for each dosed formula 3x~4 of T there is a constant such that T F 3xrd ~ Axial. There is a standard procedure extending a given theory to a Henkin theory (unique up to renaming) by adding new special constants and axioms
(of. Shoenfieldit2, p. 46D. ,4nt~dat t~et/t~a~ 7 (1~6), 129-161
A LOGICALTHEORY OF ROBOT PROBLEM"SOLViNG
135
expressed by application of a special function symbol to the situation parameter. We shall use the following notation when describing a sorted language L. Assume there are n sorts in L and let d L be the set of names of these sorts. For any finite k and any i, i l , . . . , it E dL we denote Var~ ), Const~ ), Fcn~, .....ik:o and Pred,' .....ik) the mutually disjoint sets of all variables of sort i, constants of sort/, k-ary function symbols with value of soy. i and arguments of sorts i , , . . . , it, and k-ary predicates with arguments of sorts i t , . . . , it, respectively. (In the case of ordinary one-sorted language we denote the corresponding sets VarL, Constz~ Fcn~ Pred,.) Let L be language of an image space I; we assume, without loss of generality that L is not sorted. 3 The language L(Kt) of the theory Kt under construction is a two-sorted language derived from L as follows: Jrz~K,; Va "~°bj) t~gs)
= {obj,sit} ("objects" and "situations"), = VarL, V a r ~ , ) = {s,st,s2, },
Const~,),
- ConstL, Const~?,)= {so},
•
Fcn~(~J,,);°b,) = FcnL
.
.
Fcn~(~]'l'#o = {4)°: ¢ E 4 ) , , has I parameters},
Pred~:;,l,) = {pO: p E Predl}
(k >t l,I ~> 0).
(All other sets of symbols are empty.) We use the words "object" and "situation" also as adjectives to indicate for variables and constants their sort, for functions the sort of their value, and for terms the sort of the value of the leftmost function symbol. EXAMPLE2. For the case of our robot in the maze we obtain a new language in which we have, among others, a binary predicate IN ° with the arguments of sorts room, sit and the function move ° of sort sit with arguments of sorts room, direction, sit. Thus we may have, for instance, a formula IN°(a,so) - . IN°(b,move°(a,E~o)) with the meaning "If the robot is in the room a at the situation So then it is in the room b at the s~tuation obtained from so by the robot's moving from a in the direction E". ;
Remark. By intention we have not extended the object functions (and constants) of L by the situation argument. Otherwise we would run into difficulties in translating formulas like p°(f°(a, tt),t2) where pO e .i)rpd(obJ,siO . . L(K,) l:?,~n(ob|.sit.-ob|) back into the image space. (Example: let p(x) be the and f ° e . ""L(X,) ' property of a person x to be more than ten years old and let f ( y ) be the youngest son ofy. About whom would the following utterance in the image space, as introduced here, be made: "The boy who was in 1968 the youngest a This assumption does not apply to our examples.
Artificial Intelligence 7 (1976), 129-161
136
o. ~rgt,~g~ov,( AND I. M. trAVeL
son of M r a , was more than ten years old in 1974" if we. do not know that his name is John 7) Therefore we stipulate that the formalization of the problem domain allows to describe all properties subject to a change in the form of predicates. NorA~ON. Let A be a formula ofLand t a situation term of L(KO. We denote by AO[t] the formula of L(KI) obtained from A by replacing each atomic subformula p(a-) of A by p°(~,t). De~m~oN 6. Let I -- be an image space over L. The situation calculus K, associated with I is a first-order sorted theory with the language L(Kt) defined above and with .two kinds of nonlogical axioms: (i) Let A be an axiom of Tt. Then AO[s] is a core axiom of K,. (ii) Let ~ - ~C4.Rcb) ¢ • be an operator scheme with parameters ~,÷.Then is an operator axiom of Ki. We note th~.t passing from 7", to K~ resembles a kinematic extension of a statio theory as defined by Hayes [6]. ExAm,t~ 3. The reader will easily construct the situation calculus Kt associated with our running example of the robot in the maze. Let us only show the single operator axiom of Kt: INOi'x,s) & DOORO(x, next(x,y),s) --, INO(next(x,y),moveO(x,y,s)). The meaning of this axiom is obvious.
: Remark. Except for verY restricted problem domains (as, e.g., the robot in the maze) we cannot assume that the set • of operator schemes, and thus also the set of axioms of g,, :3 small or even finite. This is, e.g., the case of treating the frame problem by adding a new operator scheme for everY world-state and thus obtaining a number of operator schemes of the form ~C÷ & .4, R~ & A~, However~ for the time being we are not worried about finiteness or simplicity of our axiomatic systems and we postpone this issue to the more realistically oriented Section 7. :
i
Several of our forthcoming results will be proved semantically on the basis of the completeness theorem (cf. Shoenfield [12, p. 43]), There is no need to define formally a model of a situation calculus since it is a straightforward generalization o f a model of a first order theory without sons. The only difference is that the corresponding structure has more than one universe (in our case at !east two: the universe of obje~s and the universe of situations); the functions and predicates are interpreted in agreement with their sorts. ArtificialIntelligence7 (1976), 129-161
A LOGICAL THEORY OF ROBOT PROBLEM SOLVING
137
We shall need, however, a way of associating an appropriate structure with a given image space I. The idea is to construct a family of models of various extensions of T~ with a common universe and common i~terpretation of functions. The common universe and interpretation can be provided, e.g., by using canonical structures as the models. . A canonical structure for T is a restriction of a structure 9~ for a complete Henkin extension T' of the theory T, constructed as follows. The domain of' 9~ is constituted by the set of all variable-free terms of L(T') (this set is sometimes called the Herbrand universe): Any constant of L(T') is interpreted in P~ by itself (as a member b f the domain). A function f(predicate p) of L(T') is interpreted by the function f a (relation p~) such that for an appropriately long sequence ~ of elements of the domain • fe(~) - f(5) (P~(~) iff T' I- p(~)) such a structure 9~ is a model of T', thus its restriction is a model of T. DEFINITION7. Let I be an image space, T~'a conservative extension of T~ to a Henkin theory. Denote ~ 1 the set of all operators ~[~] (~ ~ ~, and ~ an appropriately long sequence ofterms of L(T~)) such that T([R~[~]]is consistent. Let ~ be a mapping associating with each ¢ ¢ S"1 a canonical structure for TI'[R~[~], let ~(A) be a canonical structure for Tl'. The 9.bcomposite structure associated with I, denoted ~ , is a structure for L(KO with the following interpretation of its symbols: (i) The object universe of ~I is the set 0 of all variable-free object terms of T~, the situation universe is ,9' = ~ I u {A}; (ii) let c ¢ Const~,)~, then c~s -- c ( - c~¢,~ for any ¢ ¢ 0); (iii) let f ¢ Fcn~xo~obj~),then fe - fi(^) ( = f~(,~ for any ~ ¢ ~ ) ; (iv)
= A;
(v) let 0 ° ¢ I~t'n(°bjk*sit;slt) . . . . L(x,) , U ~ ~,~O and ~ ¢ d~t then f o i l ] if T|[Ro[8]] is consistent, otherwise; (vi) for each po¢ T)rorl(objk.s|l) . . . . ~x,) , ¢ ¢ Y', and ~ ¢ 0 k,
FACT. If I has a consistent core theory Tb then the mapping ~ from the above definition exists (the completeness theorem). THEOREM 1. The situation calculus K, associated with a strongly consistent image space I is consistent: In particular, any ~l.composite structure associated with such I is a model of KI. Artificial Intelligence 7 (1976), 129-161
138
o. ~TI~,O~'KOV~AND L M. t~AV~
Proof It is enough to prove the second statement of the theorem. It can be easily shown by induction on the complexity of formulas that for any formula A of L(TI') and any situation term t of L(Kt), Thus all core axioms are satisfied in ~I because for an) axiom A of T~ and any ¢ E g ,
To prove that the operator axiom C;[s] --, 1~[~°(£,#, s)] is satisfied in ~I it must be shown that for any sequence ~ of elements of ~ of the same length as £~ and any o ¢ 9',
~ (c,[~Do[¢] -~ (R,[~Do[~o(~,~)].
(2)
(When interpreting a formula or a term of L in a model by substituting elements of the domain for free variables, we use, without danger of confusion, the same notation as when substituting terms of L.) We distinguish two cases. Case 1: ~HI~(C~])°[~r]. Then T{[C¢[~]] is consistent since, by (1), it has a mode;, namely ~J(o). By the strong consistency of I then also TI[R,[~]] is consistent. Now ~[~] e 9'1 and by definition ~(~,¢) = ~[~]. Thus by (1), hence (2). Case 2: ~[ ~ (C~[ff])°[¢]. Because the formula in question
~t ~ -~¢c,[a])°[¢], hence (2) holds again. Thus ~ is a model of K~. The concept of a composite structure enables to prove various specific results. The following corollary and lemma will be needed later. C O R O L ~ Y . L e t I be a stronglyconsistentimage space over L, h[~] an operator in I and A, B two closedformulas of L such that 7",[,4]and T,[R,[~] & B] are consistent.Then
K, tA°[,o], V,,(R,t~J ~ B)°[÷°[~]]] is consistent.
~
Proof. W e can choose the mapping ~ such that ~ (A) is a canonical structure for T,[A] and ~(h[a])is a canonical structure for Tt[R÷[a] & B]. Let 2[ be the corresponding ~-composite structure. Clearly
~ V,,(R,[a] & B)°[~°[a,,]] & ~°[so]. LEMMA 1. Let A be a formula of a strongly consistent image space I. Then
T,~a ~ g,~vs, ao[s] ~ g,~aO[so]. ArtOgclalIntelligence7 (1976),129-.161
A LOGICAL THEORY OF ROBOT PROBLEM SOLVING
l~9
Proof. Assume T~ t- A. Let us replace every formula B occurring in the formal proof of A in 7'1 by B°[s]. We obtain a proof of A°[s] in Kl. Thus Kl F Vs, A°[s], and obviously also KI I- A°~so]. Now assume K'l ~ A°[so]. To prove that 7', I- A let us assume the converse, TI ~ ,4. Then TI["IA] is consistent. By the above corollary, K,[("lA)°~So]] is consistent. This is a contradiction because (-IA)°[So] is equivalent to "~A°[,o]). 3. The First Correspondeaee Theorem We shall now concern ourselves with the correspondence between solutions in an image space I and formal proofs in the associated situation calculus K~. The first step is to relate operator sequences in I and expressions of L(K~). Let us define inductively a mapping ~ from the set Y* of all operator sequences to the set of all variable-free situation terms of K~: (i)
= so;
(ii) x(y~[~]) = ~b°(~,~(7)) for all ~ ¢ I; ~"and ~[~] e I;. Thus, e.g., ~(~[a,]~,.[~z]) ffi ~b~(az,~(a,,So)). Given a language L' =_ L(K~) we define a rel~.don < ~ on the set of its
situation terms: t < 1 t' iff t' is ~b(~,t) for some situation function ~band some sequence ~ of object terms of L'. Let ~< be the partial ordering obtained as a reflexive and transitive closure of < 1. The function x is clearly an isomorphism between Y* (ordered by the natural prefix relation) and the set of variable-free situation terms of L(Km) ordered by ~< (we shall use the same Symbol ..< for both orderings). Let t be a veriable-free situation term of L' =_ L(KO. The sit, lotion depth of t, denoted sd(t), is defined as the largest number n, such that So --- to ~< t l ~ < . . . ~< t, - t for some distinct situation terms t o , . . . , t~. Note that sd(:(T)) equals the length of T. We have indicated a close structural relationship between situation terms of Kj and operator sequences in I. The following theorem characterizes syntactically those terms which correspond to solutions in I.
T H ~ m ~ M 2 (The First Correspondence Theorem). Let I be a strongly consiswnt bnage space, IC~the associated aituation theory, (X, Y> a consistent problem in I, and 7 e E* on operator aequence in I. Then ,. xO ,o] ... iff either 7 is a s:lution to (X, Y> or y - 7oYxfor some 7o, Yt e Z* such that ~o ~ A an:l Yt is a solution to 4 (true, Y}. The proof of the theorem rests on the following lemma. * "true" represents any tautology, i.e., the problem (true, ~ ~ has no specific initial situation. Artificial Intelligence 7 (1976), 129-161
140
o. ~r~,~tN~ov/~ AND I. M. tU,V~
L ~ / I s 2. Let X and Y be two closed fo,mmlas of L such that Tt[X] is consistent. Let O°(a,t) be a variable-free situation term of L(Kt). Then
K, ~ x*[so] -, Y°[~,°(~,t)] iff either
T|F Y, 01"
....
Xt F XO[so] --, (C÷[a])o[t]
and T, F Rtti=j --, Y.
P,~ of. The 4= direction is obvious. The other direction Will be proved by contradiction. Let
~, ~ x°[,o] -. Y°[¢(a,0]
(3)
but T I~- Y and either K, 14- X°~'so] ~ (C+[a])°[t]
(4)
T, t/-R~[a]--, Y.
(5)
or
If (5) is the case then TliR~[~] & "i Y] is consistent and by the corollary to Theorem 1,
X, lXO[.o], Vs,(R+[a] & -1 Y ) ° [ ¢ ( ~ ) ~ ] is consistent. A t~ontradiction to the assumption (3). Assume (4)and T~ 14- Y. We shall construct a model ~B of K, such ~nat
~ r [ s o ] & -1 r°[÷°(~,t)].
(6)
Again a contradiction to (3). Intuitively, the model • will be constructed as a "disjoint union" of a canonical structure s ~B= for Kt[X"~so] & "l(C~(a-'))°[t]] and a canonical structure ~z for K=["I Y°[so]] with reinterpreted situation functions. We can presume the object and situation universes of ~ coincide with the respective universes o f ~ 2 (they are formed by closed terms of KI extended to a Henkin theory). Define the object universe of ~B as while the situation universe of ~ is the disjunctive union
~'. = (~'., x (l}) u ( ~ . , x {2}~ We preserve the interpretation of the object constants and functions for ~= and ~B,. Each predicate p ¢ Pred~'~,~,,m will be, interpreted in ~ by the relation ps --. 0~ x 5°s, where if i l, (a,
~'
s The c,oncept of a ¢anonica! ~ 8eneralization of the one-sorted case. Arti/~al Intelli~n~ 7 (1976), 129~.161
for a many-sorted theory is a straightforward
A LOGICAL THEORY OF ROBOT PROBLEM SOLVING
141
/<(So)e~,2)
if ~ = ~, B -- a, o = tw, and i - 1, ~b~($,
Proof of Theorem 2. We shall prove only the hard ~ direction of the theorem, using induction on the s~tuation depth of z(?). Bas/s: sd(z(7)) = 0, i.e., z(y) = So. Then i.e., K! I- (A ~ Y)°[So]. By Lemma 1, Tl i- X - , Y and y - A is a solution to
O, i.e.,~ --~'4',[a,] and ~(7) - 4~(~,,~(/))for some ~,~x, 7' < 7- By Lemma 2, either 7'1 I- Y or X, ,'- X~[~o] -* (C.,[a,])°[~(/)]] (7) and T, t- R~,[n,] -~ Y. (8) If T~ I- Y then A is a solution to and, due to (8), 7"~ x[aa] = 7 is a soluuon to . Again (8) yields that 7t~q[~t] is a solution to (true, Y> (notice that 7 o 7 ~ [ ~ ] -- 7). 4. The Generalized Solution in the Image Space The first correspondence theorem provides a deeper insight into the relationship between the dynamics of the image space and the syntax of the situation calculus, and specifically, it suggests using theorem-proving techniques for verifying the correctness of a given solution. On the other hand, it gives little assistance in searching for an unknown solution. In this and the next sections we shall g ursue the question whether the situation calculus can actually help in finding a solution. The following fact is an immediate consequence of the first correspondence theorem. FACT. If a problem ,~X, Y> has a solution in I, then x, t- xO[so] .-,
(9)
Is the reverse also true, i.e., does (9) imply the existence of a solution? One of the reasons why the answer is negative is that very often no single term of L(K~) corresponds to the existentially bound variable in (9), i.e., for each variable-free situation term t of L(K,), KI 14- X°[so] --, Y°[t]. Artifwial Intelligence 7 (1976), 129-161
142
o. ~t~P.~NKOV.,tAND I. M. HAYEr.
EXAUPte 4. Consider another version ofthe "Robot in the M ~ " problem according to Fig. 2. Properties of the maze are as before except the arrahgemerit of the doors and a special double-position turning door in room 'W' described by the axiom DOOR(e,h) v DOOR(e,f). We assume Tt ~ DOOR(e,h) and Ti I~ DOOR(e,f) to avoid a trivial case. (This corresponds to a certain lack of knowledge about the environment: the robot does not know in advance the actual position of the turning door.) N
g
h
li
f,--~GOAL
-
W
d
e:
[
/
I ,: START.
- -.,"
a I
b
:c
Fro. 2. Branchin~ solution in the maze.
It can be easily seen that the problem (IN(a),IN(i)) has no solution in the sense of Definition 3. In particular, neither of the two dotted fines from • to i in Fig. 2 is alone a solution to a subproblem (IN(e),lN(i)~. Yet, in the associated situation calculus, Kt I- IN°(e,so) --, IN°(i,move°(h,I.,move°Ce, N, so))) v IN°(i,move°(f,N~we°(e,E,so))), and therefore Ks F IN°(e,So) --, 3s,IN°(e,s). Intuitively, we should admit whole set of operator sequences as a solution in the image space, in our case (to move from 'W" to ' T ' ) the pair r' = {move[e,N] move[h,E],move[e,E] move[f,N]}. Accordingly, the robot stagdng in room "a" most first physically move into room "e" before it can decide which way to proceed further. Thus the lack of knowledge about the environment forces to postpone certain decisions to the execution phase, that means, to consider plans that branch,. (There may be other sources of branching in plans, viz. an uncertainty about the action results, or about the problem itself.) This exa~nple suggests a generalization of the concept of a solution capturing the possibility of branching. Art/fte/a//nte/~Setw.e 7 (1976), 129-161
X LOGICAL THEORY OF ROBOT PROBLEM SOLVING
143
NOTATION. Let 1" ~_ ~* be a set of operator sequences. We define
Pref(F) -- {y: 7 ~
~
and
..
~Ka] • Fst(rj
(ii) for each 7 = Y,~118,] ¢ Pref(l'), T[[R÷,[~t]] [V
4~a] e Fst(e~,r)
C~[~] v ~.
Formally, the generalized solution is just a set (of sequences) satisfying certain properties. To explain the intuitive idea behind the above definition let us consider an intermediate step of the planning process. Assume that we have already constructed aa initial segment y of a possible path through the image space from the initial to a current image. Now if in the current image the goal formula Y can be proved in disjunction with conditions of certain operators we include y i t , l l into the solution F (which means that the execution of y may already yield the goal), and consider all continuations of by operators corresponding to the condi0ons in the disjunction (the execution may continue using one of these operators). I r a disjunction consisting entirely of operator conditions (the case Yy ffi false) can be proved, we consider the corresponding continuation, but do not irxlude ~, into the solution F. It is sometimes more intuitive to treat a generalized solution as a tree structure constructed on Pref(r). Let us note that our approach to branching solutions slightly differs from the approach mentioned by Fikes et al. [l] who suggest multiple-outcome operators and consider also probabilities and the possibility of a failure. An automata-theoretic treatment of our generafizafion of solutions is given by Havel [5] who studies certain algebraic and language-theoretic properties of the family of all generalized solutions to a given problem, considering also infinite cases.
Remark. There is an equivalent inductive definition of a generalized solution resembling the definition of the simple solution (Definition 3): A finite nonempty set r ~_ ~* is a generalized solution to (X, Y> iff (i) T,[X] I- V C÷[a] v YA, 4Kd] • F.~(F)
ArtificialIntelligence7 (1976),129--161
144
o, ~IP.(NKOV.~ AND L M. HAVEL
and (ii) for any ~[fi] e Fst(l'), 0~qeI" is a generalized solution to (R,[fi], Y>. Obviously, 7 ~ ~* is a solution to a problem iff {T} is a generalized solution to the same problem. To illustrate that the generalized solution corresponds to a brand-;ng plan for a robot's behaviour we show a typiC! execution-stage control procedure of a robot.
Procedure. (l'he inputs to-the procedure are the goal formula Y, a generalized solution F, and the current actual state ofthe environment as perceived by the robot). 1. Initialize PLAN : - F, OP : - empty. 2. If A E PLAN go to step 3; otherwise go to step 4. 3. If the current environment meets the goal condition Y exit with SUCCESS. Otherwise go to step 4. 4. Find an operator ~[fi] e Fst(PLAN) such that the current environment meets the condition C÷[~]. If it exists set OP :ffi ~[~] and go to step 5. Otherwise exit with FAILURE. 5. Execute OP. 6. Set PLAN :ffi ~oP PLAN and go to step 2. If r' is a generalized solution to the problem ¢~X,Y~ in the image space I the above procedure always terminates (since r' is finite) and never exits with FAILURE unless the environment is inadequately represented in L 5. The Second Correspondmee Theorem Let us rephrase the question from the beginning of the last section: Assuming that xO[ o] - . is a theorem of Kt, has the problem ¢~X,Y) a generalized solution in I ? In this form the question has still a negative answer as we can see from the following example. EXAMPLE5. Consider anothe r variant of the "Robot in the Maze" problem, where the core theory Tt has no axioms about the robot's position and about the number of rooms in the maze. Instead of that there is an additional operator scheme jump -
IN(xl),IN(x
))
with two parameters xl and x2. Consider the problem ~3x, IN(x),lN(i)). It has no generalized solution because for no constant k we have T~['dx,IN(x)] F IN(k).
Artificial Intelligence
7 (!976), 129-161
A LOGICAL THEORY OF ROBOT PROBLEM SOLVING
145
Yet the fo;mula
3x, IN°(x,so) .-, 3s,IN°(i,s) is a theorem of/C~. Herbrand's theorem (see Section 6) yields the answer IN°(i,jump°(q,i,so)) where q is a new constant introduced ~y skolemization of the formula :lx,IN°(x, so). This observation is interesting from the point of view of the relevance of predicate logic to artificial intelligence: the frequently used technique of eliminating existential quantifiers by introducing Skolem functions (cf. [12, Section 4.5] for details) has no immediate counterpart in the framework of the image-space problem solving. Research topic. How the new function symbols and constants introduced into the situation calculus by skolemization should be interpreted in the image space ? Should all formulas potentially causing an occurrence of new symbols in the answer (e.g., the existential axioms) be avoided ? Or should the robot be designed with the ability of detecting, at any intermediate step, all specimens whose existence was established by the axioms ? It appears that the behaviour of Skolem functions gives reasonable grounds for the latter approach (cf. ~t~p~nkovl [16]). In the present paper we introduce a slightly modified version of the situation calculus where the problem of interpreting the Skolem functions does not arise. Let L be a language and let "object" be one of its sorts. An objective L-instance of a formula A (of L) is a result of a substitution of variable-free object terms of L for all free object variables of A. DmNrnON 9. Let I be an image space and K~ the associated situation calculus. The instantiated situation calculus associated with I, denoted lns(Kt), is obtained from K~ by replacing each operator axiom by all its objective L(Kl)-instances. We keep, in the obvious way, the notions of core and operator axioms for the case of Ins(K0.
Remark 1. Observe that L(Kn) = L(lns(Kv)). Clearly Ins(Kv) is a weaker theory then K~, i.e., if Ins(Kn) I- A then KmI- A for any formula A of L(Kv). On the other hand, as a consequence of Lemma 1, if Kt i- A ~So] then also Ins(Kn) t- Also]. Indeed, let At be a formula of L(T0 such that A~[So] is Also]. If Kt l- Ay[so], then by Lemma 1, Tn I- At. The theory Ins(Kt) has the same core axioms as Kt, ~hus Ins(Kt) t- AI[so], i.e., Ins(Kj) I- A[s]. Artlfa~ial Intelligence 7
(1976), 129-161
146
o. b~lh,ANKovh AND t. M. HAV~
Obviously, if I is strongly consistent image space then Ins(KO is consistent (as well as Kt). In fact, for the consistency of Ins(KO it is enough only to assume that I is consistent (the proof is analogous to that of Theorem 1). Remark 2. We should note that lns(Kt) is almost always infinitely axiomatized (a presence of one object constant and one object function symbol in L(KO is ~fficienO. Fortunately this infinity does not seem to be too dangerous even from the point of view of effectiveness (at least relatively to K0. The set of all axioms of Ins(K~) belongs to the same recursive type as the union of the axioms of Ki and the set of all variable-free object terms of L(KO. f f the sets Consz~g,), F c n ~ , and the set of axioms of Kt are primitive recursive then the set of operator axioms of lns(KO is again primitive recursive. Any operat 'r axiom of El can be understood as an axiom schema for Ins(K0. The decision whether a formula A of L(Kt) is an operator axiom of Ins(KO consists in the search for replacements of some variable-free terms in A by variables which would convert A into in axiom of Kt (cf. also the Remark after Definition 6). Research topic. Can the axiom schemes of the above type be replaced by a convenient special inference rule without weakening the theory?
Now we shall state our main result. T n e o ~ 3. (The Second Correspondence Theorem). ~I,et I be a consistent image ~pace and ( X, Y> a consistent problem in L The following three statements are equivalent: (i) There exists a generalized solution to ( X, Y> in i;
¢ii) I s x0
r so] -.
r[a];
(iii) Thee is a finite set 5" of variable-free situation terms o f K~ such that I='~(KI) ~" X°[so]--, V Y°[t] tel
and x- t (5r) is a generalized solution to ( X, Y> in L Proof(Outline). The impfication (i) = (iii) is a straight.forward consequence of the defin/tion of a generalized solution (cf. Definition 8) and of the form of axioms of Ins(K) (cf. Definitions 6 and 9). The reverse implication (iii) =~ (i) is a triviality. The implication (iii)~(ii) is also immediate since for a consistent problem 5" ~ ~. The hardest is the implication ( i i ) ~ (iii). A syntactical proof of this implication, omitting some less interesting details, is given in the next section. Here we sketch only the rough idea of the proof. By Herbrand's theorem the formula X°[so] ~ 3s, Y°[s] is provable in Artifie3al Intelligence 7 (1976), 129-161
A LOGICAL THEORY OF ROBOT PROBLEM SOLVING
147
Ins(KL) iff there is a finite set ~r" of variable free situation terms of an extension of L(KL) by Skolem functions such that t¢$"
First we prove that such a set ~" can be modified to contain only terms of L(Kt) (cf. Theorem 4). Then we establish a certain normal form of proofs in the situation calculus (called the tree proofs) of formulas of the form geS"
(cf. Theorem 5). In a tree proof instances of operator axioms occur in a specific manner matching the way in which the corresponding operators are used in the image-space solution. The structu-al correspondence between the tree proofs in Kt and the generalized solutions in the image space will help us to show that ~x(~-) is a generalized solution to the problem . We note that our syntactical proof has the advantage of offering an effective construction. On the other hand, a semantical (model-theoretical) argument might result in a shorter and more elegant proof. What is the significance of the second correspondence theorem for artificial intelligence? According to this theorem there is a close relationship between image-space problem solving and theorem proving in the situation calculus. Specifically, both methods are essentially equal in their power of generating a solution to a given problem (we lay aside the problem of Skolem functions discussed above). Of course, this does not concern the question of efficiency (which is indeed one of the most important issues in current artificial intelligence research). Since the second correspondence theorem essentially talks about normal forms of proofs of some formulas in the situation calculus, it is natural to ask what are its consequences for automatic theorem proving.
Research topic. Investigate the relationship of various search methods in the image space to formal theorem-proving in the situation calculus. In particular, does Theorem 3 give a hint for utilizing various heuristics from the image space (such as the GPS method) for improving some of the theorem-proving strategies ? Let us conclude this section by a comment on possible generalizations of solutions. One can further extend the concept of a solution to infinite sets of finite operator sequences (just omitting the finiteness requirement from Definition 8; cf. [SDor to consider partial solutions [I ] in which not necessarily all sequences reach the goal. They may arrive at a failure node (and they may also be infinite). Another interesting possibility is to study the concept of ArtOk'ial Intelligau~ 7 (1976), 129--161
148
o. ~rI~P£NKOV.~AND L M. HAVI~
a problem itself, for instance the possit>ility of "composing" problems (in series or in parallel) of including "negative" goals (forbidden states), etc. One of the most impo.qant generalizations seems to ,us the utilization of frame information during the search through the image space. We return to this problem in Secdon 7. 6. Some Resalts ,at Situatiea Cakalm The main objective of this section is to give a formal syntactical proof of the second correspondence theorem. The proof rests on two auxiliary theorems which are interesting on their own. Let us call a situation/anguage any many-sorted first-order language with a distinguished sort called "situation". We shall specify two particular types of formulas in a situation language corresponding to two characteristic ways in which the situation terms appear in the axioms of a situation calculus. ~ o N 10. A formula A of a situation language L is said to be un/form with respect to tiff t is a situation term of L and every maximal occurrence of a term in A is either an occurrence of t or of a term which is not a situation term. A is said to be un/.form iff it is uniform with respect to some t. To indicate the uniformity of A with respect to t we occasionally write A[t]; this is completely in agreement with the notation from Section 2 since B°[t] is indeed uniform with respect to t, for any B of Tl. D~oN 11. A formula A of a situation language L is said to be a transit;on formula with respect to a situation term.f (5,t) (wherefis a situation function, t a si" ration term, and ~ a sequence of other than situation terms) iff A is of the form
where t A and 2A are two (uniform) formulas of L. A is a transition formula iff A is a transition formula with respect to some t. We shall use the left supersct/pts to denote the two uniform parts of a transition formula, e.g.A. --- ~A --, "A. Typical examples ofuniform formulas in the situation calculus are the core axioms and their imtances, examples of transition formulas are the operator axioms and their instances. The following results of predicate logic (Shoenfield [12]), easily extended to many-sorted case, will be .used, I-IU~T-A~KEI~N'S T~.OI~M. An open theory T is inconsistentiffthere
a tautology which is a disjunctionof negations of instancesof axioms of T. SKOL~'S ~ X ~ M .
Every theory has an open conservativeextension.
This extension is obtained by-replacing all axioms by their Skolem variants. ArtO~al I s ~ / / ~ 7-(1976), 129-161
A 'LOGICA[~ ~.'[TIEOR.Y OF ROBOT PROBLEM SOLVING
149
A Skolem variant of a formula A is the matrix of a formula obtained from (the closure of) A by eliminating all existential quantifiers by the use of Skolem functions (of. Shoenfield [12, Section 4.5]). Dually, the matrix of a formula obtained from (the closure of) A by eliminating all universal quantifiers is a Herbrand variant of A (denoted Anb). We use Herbrand's theorem ([12, Section 4.4]) in the following form. HERBRAND'STHEOREM. Let T be an open theory, A a formula of T and AHb its Herbrand variant. Let T' be obtained from T by adding the new function symbols of AHb. Then T F A iff there is a finite disjunction of L(T')-instances of AHb which is a tautological consequence of L(T~-instances of a~ioms of T'.
Proof T t- A iff T' I- A iff there is a finite set { B I , . . . , B,} of universal closures of axioms of T' such that A Bj--, A is a theorem of predicate calculus. By the standard form of Herbrand's theorem, I- A B~ ~ A iff there is a finite disjunction of L(T') instances of (A Bl -'* A)l/b which is a tautology. Since all Bi are without existential q~ntifie~ (A Bt -* .~)H~ is equivalent to A B~ --, AHb (when transforming iA Bt --, A to a prenex form transfer first
lea
the prefix of A and then prefixes of B t j ~ n). A finite disjunction of ins~m-'.es of (A B~--, Am) is a tautology iff there is a finite disjunction of instances l~, of Allb which is a tautological consequence of a set of instances of B~,i <~n. The following notation will be convenient. NOTATION. Let u be an expression (term or formula), tj and t2 two terms of the same sort. We denote by R e ~ u the expression obtained from u by replacing all occurrences of tl in u by t2. Similarly for a set ~ of expressions Re~. 0~ _- { R e ~ u: u e ~}. •
.
It can be easily verified that for any quantifier-free formula A and any pair of terms ti anti t2, A is a tautology iff Rel~,~ A is a tautology. We shall need the following consequence of Herbrand's theorem.
L~MMX 3. Let T be an open theory, ~x,A a closed formula of T and B a Herbrand variant of 3x, A. Let T" be the extension of T by the new function symbols of B. Let a l , . . . , an be variable free terms of L(T). If there is a disjunction of L(T')-instances of formulas B~[a~](i <<.n) which is a tautological consequence of instances of axiom., ofT', then n
T
V A [aa].
Ill
'J~tific[aiIntelligence7 (1976), i29-161 11
150
o. J~J,.~m~ovA AND L t~. ~t~V~
The proof of this resul~ (~t~p~akov~l [16]) is a modification of the standard proof of Herbrand's theorem (Shoentield [12]). T m ~ o m ~ 4. Let I be a consistentimage space and ~,X, Y~ a problem 'inI.Then Ins(g,) ~ r[So] --+3s, ~ s ]
iff there is a finite set ~r of mriable-free situation terms of L(Kl) such that
r [ , o ] - , v yo[,]. tg.~
A set ~" from the theorem is called an answer set to the problem (X, Y'?. The crucial point of the theorem is rite claim that .9" consists entirely of terms of L(£0, i.e., free of Skolem functions. This theorem is related to a similar result of Luckham and Nilsson [8] concerning resolution proofs. Differing from the result in [8] our Theorem 4 is concerned with eliminating even those inconvenient Skolem functions introduced in axioms.
Proof. The ~= direction is immediate. For the other dLrecfion assume that X, Y) is a consistent problem (the theorem is trivial o~erwise). Denote Z the Herbrand variant of 3s, Y°[s]. Let 5'~ be the Open conservative extension of the t~eory l n~(Kt)[X°[so]] and L' the language obtained from L(S~ by adding the new function symbols of Z. By Skolem's theorem Ins(/~l) F X°[so] --+ 3s, Y°[s] iff $~ I-~s, Y°[s], i.e., by Herbrand's theorem, iff there is a finite set R' of U-instances of Z such that V ~ (the disjunction of all formulas in ~ is a tautological consequence of L'-instances of the axioms Of Sf. Let us construct a procedure ¢ transforming the set ~' to a set o(.~') of instances of Z in which each formula is uniform with respect to some situation term of L(£O: 1. Initialize n :ffi 0, .oO'o:ffi .~. 2. Denote by ~ the set of all situation terms t not in L(Kt) and such that .~, contains a fqrmula uniform with respect to t. If ~ = ~ go to step 5, else go to step 3. 3. Choose a maximal term to in ~ (with resp. to ordering ~<). Let t~ and t2 be such that (i) to -- Re~z t l; (ii) t l is a term of L(Kt); (iii) t2 is of the form O°(~,t') where at least one of the object terms in 5 is not in L(Kt). 4. Define ~ + t :ffi ReprO,~ , n :ffi n+ 1. Go to step 2. 5. Define ¢(~') : - ~ , . We shall show that there is a finite set ,f" of variable-free situation terms Artift~ai Intdligencc 7 (1~76); 1.29--161
A LOGICAL THEORY OF ROBOT PROBLEM SOLVING
151
of L(Kt) such that V o(.~') is equivalent to a disjunction of instances of V~ Z which is then a tautological consequence of L'-instances of axioms
fear"
of
The procedure ~rterminates when there is no formula in ~ , umform with respect to some term not in L(KO. Now we prove that if V .~, in the procedure is a tautological consequence of L'-instances of axioms of S~, then the same holds for V -~,w+~where -~'s+~ is obtained by applying steps 3 and 4 of the procedure. Thus it holds also for V o(.~). We have ~ + 1 = Rel~, .~,. Let ~ be the finite set of instances of axioms of Ssx such that V ~n is its tautological consequence. Obviously V -~'n+l is a tautological consequence of the set Rel~,~8 . We prove that Rel~ ,~ is again a set of U-instances of axioms of $1x. Clearly, if A is an instance of a uniform axiom of Ssz then Rel~,~ is an instance of the same axiom. Let B--- 1Bit] --, 2B~O°(l;,t)] be an instance of a transition axiom of S x. By definition of Ins(Ki), ~; is a sequence of variable-free terms of L(K0' thus t2 4: ~°(~;,t). Hence either tz ~< t or tz occurs in B as a subterm of some object term or it does not occur in B at all. In any case R e l ~ B and B are instance ~ of the same transition axiom of Stx. Denote ~" the set of all situation terms t such that a ( ~ ) contains a formula uniform with respect to t. Thus ~(.~) is a set of closed instances of formulas R e ~ Z (t ¢ ~ and using Lemma 3 we obtain Ins(KO ~ X°~so]--, V
Y°[t].
Let A be a uniform formula of L(KI). A reduction of A, denoted by ~, is a formula of L(T~) obtained from A by deleting all situation arguments from atomic subformulas of A. (Thus, e.g., if A is B°[t] then ~ is B.) Our next objective will be to establish a special normal form of proofs in the situation calculus. Let us begin with an example. EXAm'Le 6. Let I and Ks be as in Example 4; in particular, DOOR(e,h) v DOOR(e,f) is an axiom of T! and O O O C~.v,[s ] --, Rmev®[move (x,y,s)],
or, explicitely
IN°(x,s) & DOOR°(x,next(x,y),s) ~ IN°(next(x,y),move°(x,yrs)), is the only operator axiom of K~. Consider the formula IN°(e,so) ~ IN°(h,move°(e,N,so)) v
IN°(h,move°(i,W,move°(f,N,move°(e,E~o)))).
(lO)
We prove (10) using the guidance of the following tree obtained from the set of situation terms occurring in (10)" Artificial Intelligence 7 (1976), 129-.161
152
o. ~qPXNXOVh Am> I. M. ~L~VL~
So
//\, move° (e,N,so)
move° (e,E,s o) move°(f,N,mJve¢(e,E,so))
move°O,W,move°(f,N,move °'~.,E,so))) The arrows in the tree correspond to the appropriate operators in I. This can be "tramlated" to the image space language by associating the reduction of the antecendent of (10) wi,.h the root of the tree and the reductions of the consequents of (10) with the corresponding leaves: IN(e)
move(e,
ove(e,E)
IN(h)
move(f,N) move(i,W)
I~(h) Before proving (10) we point out the p~vability in Ts of formulas describing the levels of the above tree. Let us staR at the root. The following implicat tions are provable in T,: IN(e) --, C.o~,[e,N] v Cj.[e,E],
--,IN(h),
Rmo~e[eqe] --*C=o~,[f,N], RmM[f,N] -~ C=o~,[i,W],
rN(h). Using I.~mma I we see that also the following formulas am provable in Ks: IN°(e,so)--, C~(e,N,so) v C ~ e , E , s o ) , R~o**(e,N,move°(e,N, So)) .-, IN(h,move°(e,N,so)), Ro~e,E,move°(e,N, so)) -, Co,/,o~(f,N,move°(e,N, so)), R o~(f,N,move°(f,N,move°(e,N,so))) .-, C~jo~e(i,W,move°(f,N,move°(e,N,so))), R~o~,(i,W,move°(i,W,move°(f,N,move°(e,N, so)))) .., IN(h,move°(i,W,move°(f,N,move°(e,N,so)))). Thus (10) is provable in K~.
This idea is formalized in the following definition. Artificial Intelll#ence 7 (1976)) 129-161
A LOGICAL THEORY .OF ROBOT PROBLEM SOLVING
,~53
DEFINITION 12. Let ~" be a finite nonempty set of viriable-free situation terms in L(Kj). Let X and .Yt (for all t v Jr) be closed formulas of L(TO. Denote CI(Y') - {t: t ~< t' for some t' ~ Y'} and for t ~ CI(Y') define ~__
Y, if t~ ~', Ise if t ¢.~'.
We say that the formula tear
hj~sa treeproof in £1 (or in Ins(Ki))
iff
O) z,
x-..
v
v
and (ii) for each t = 4~(~l,t~) ¢ Cl(~'), T, I- R÷,[a,] --, V
I7,o,
C~[a] v ~,.
,b°(4,t ) a el(Y)
Let K' be an extension of Kn or lns(Kt) by some transition axioms. The property of having a tree proof in a theory K' (this generalization will be useful in Section 7) can be defined also inductively: Define a complexity c(Y') of a set ~ of variable-free situation terms as the sum of depths of all terms in Y', i.e., c(.~") = E sd(t). te.f"
The following definition of a tree proof uses induction on complexity of ~'. DL~FtNmON 12(a). Let Y',X, Y, (t ~ ~') be as in Definition 12. The formulu has a tree proof in K' iff either (i) c(~') -- 0 (i.e., S" -- { s o } ) a n d TI J" X ~ Y,o, or (ii) c(.q') > 0 and for some term to =, O°(~,tl)maximal in ~" there are finite sets ~ 1 , . . . ,t~t (k >t 1) of transition axioms of K' of the form B = IB[tt] -, ZB[to] such that A 2B y,o 0=J,...,k) IBe ~j
and the formula v
-.
tE (~-(to}) Ult~)
z [t]
02)
has a tree proof when Z, - Y, for t # t~ and {V ~ A Z,,-' ";" i~k
~B 'B v
ift~ ~ ' ,
Y,,[t,]
iftz E~'.
B~ h i
Artiftcial Intelligence 7 (1976), 129--161
1.54
O. ~tl'~P./tlqKOV.~ AND I. M. HAVEL
Note that the notion of a tree proof has a meaning only for formulas of a particular syntactical form (11). The auxiliary notation Z, in (12) serves just for this purpose. The equivalence of Definitions 12 and 12(a) for the case when K' is KI (or Ins(Kt)) can be proved by the induction on c(~#') and the fact that for each variable-free situation term ~(~1,tl) of KI there is a unique transition axiom of Kx with respect to ~;(al,tl). Tl~oP.~ 5. Let K',~',X, Y,(t 6 :g) be as in Definition 12(a). Then g'~ tirol-V r:[t] te.~"
iff either (i) for some. :~r' ~ 2~" the formula X"[So]--* V Y:[t] teY"
has a tree proof in K', or (ii) there exists a situation subterm to of some term in :~"such that the formula t, ue--.
v t ll .f', to ~ t
has a tree proof in K'. Proof. The easier 4= direction is a consequence of Definition 10 and the following observation: If a formula A has a tree proofin K' then K' F RePOtA for any situation term t (one may verify this by a straightforward induction on the complexity of the set of situation terms occurring in A). We shall prove the opposite direction by indt:ction on the complexity of 5". Bas/s: 5" -- {So}. Similarly ss for £1 in Lemma 1 (Section 2), we have for the case of K', for any A in L(TI). Hence, in ~rUcular, Induction step. Assume the theorem holds for any $" with c~$') ~ n. Now let
v y,o[t]
le.9"
03)
with c(3~) ffi n+ 1. When (13) holds also for some proper subset of $" the result follows from the induction hypothesis. If this is not the case we proceed as follows. According to (13) the theory
{-i r.o[t]}...] is inconsistent and the same holds for its open conservative extension K'. By Hilbert-Ackermann's theorem there are sets ~ ' , 8 , •, where af is a set ArtificialIntelli~ence7 (1976), 129-161
A LOGICAL THEORY OF ROBOT.PROBLEM SOLVING
15~
of instances of Skotem variants of uniform axioms of K' or of X°~so], 8 is a set of instances of Skolem variants of transition axioms of K' and 3r is a set of instances of negations of Skolem variants of formulas -'! Y~[t] (t ~ ~7), such that V 3¢ (the disjunction of all formulas in 30 is a tautological consequence of formulas in ,~ and 8 . For notational convenience let us define a mapping u from uniform formulas of K" into situation terms so that u(A) - t i f f A is uniform with respect to t. We introduce an ordering ~< of uniform (in particular atomic) formulas so that A t ~< A2 iff u(A ~) <~ u(A 2) (similarly for <). Let us treat formulas in ,~', 8 and ~ as formulas of a pcopositional calculus, the atomic formulas of K" playing the role of propositional variables. The fact that for each formula ~B -~ 2B in 8 , xB < 2B yields the following two observations. Observation 1. There are sets a~" ~_ .~' and 8 ' c_ 8 such that V 3¢ is a tautological consequence of :r" and 8 ' and for each A ~ a~' and B e 8 ' there is Z E ~/such that A ~< Z and 2B ~< Z. (Take a ~ ' - {A c ~ " A ~< Z for some Z a ~}, 8 ' -- {B E 8 : 2B ~< Z for some Z ~ if}.) Observation 2. Let to be a maximal term in ~" and denote 3~to - {Z ~ ~ u(Z) = to}. Then (a) the disjunction V 3fro is a tautological consequence of d~o -- {/I ~ ~ " u(.4) =
to}, o r
•
(b) there is a nonempty family . ~ of subsets of the set 8,' o - {B ¢ 8 ' : A I B is a tauto-
u(aB)- to} such that the disjunction V (3r-3rto) v V
~fs.~ Bs~r
logical consequence of ' ~ " - ~ ' o and 8 - - 8 ~ o . Moreover, for any ~f ~ . ~ the disjunction V 3~to is a tautological consequence of .~'~o and {2B. B ~ ~f}. The sets d ' and 8 ' consist of L(K')-instances of Skolem variants of uniform and transition axioms of K', respectively, and the set a ~ - 3~to contains only instances of the Herbrand variants of Y?[t]. Analyzing these formulas and reinterpreting the above observations we obtain t
t
Ad (a) Tt F Yto; Ad (b) For any r~ e .~, let ~fo be t~e set of transition axioms of K', the instances of Skolem variants of which occur in ~'. Then by HilbertAckermann's theorem for any ~ ~ .~, Tll- A 2B--, Y,o He,to
and g'i-
v t e f-{to}
Note that u( V
A
v
^
,B.
~ G . a BG~o
~B) < to and therefore we can use the induction
hypothesis on the last implication.
Arti~cial Int¢lllsenee 7
(1976), 129-161
156
o, ~rf~,Ocgov.~ AND I. M. HAWJ.
On the basis of the above results we can now complete the proof of the second c o ~ n d e n c e theorem. Proof o f Theorem 3. We need to show that the second statement of the theorem implies the third. Let
In ¢ O x°[So], 3s yo[d. Then by Theorem 4, there is f such that Ins(Ki) F X°[so] -* •
V Y°[t]
teY
and ,~ is a finite set of variable-free situation terms of Kt. Since(X, Y) is consistent, ~" ~ O. Now using Theorem 5 with g ' - Ins(g~ and ] r t - - Y for t ¢ Y" we arrive a t t w o cases. Case 1: The formula
X°[~o] -,
V Y°[t]
¢e$"
has a tree proof in lns(KO for some ~ " ~ ~', Y" ~ O. We shall show that F - ~-s(~-,) is a generali'zed solution to the problem (X, Y) in L For this it is enough to observe that the definition of a tree proof according to Definition 12 completely matches the definition of a generalized solution (Definition 8). The result follows from the properties of the isomorphism z which imply that ~ - ~',(7)and .~[~] e Fst(a,l') iff ~[~] e Pref(0,1"3 iff ?~[~] e Pref(I') iff $°(~,,(y)) ¢ CI(,(I')) = C!(.f") ffi {t:t <~ t' for some t' ¢ Y"}. Case 2: There is some to G CI(Y') for whicl~ the formula 0 true --, V Y o [RelY~ t] t G .~to
has a tree proof in Ins(Kt), where ~',o - { t ¢ ~ : to ~ t }. Let us rewrite this formula in the following form true --, V Y°[t] and define F - ~-t(Reff~ ~':o)" Exactly the same observation as in Case 1 leads to the conclusion that I" is a generalized solution to (true, ¥ ) and therefore also to (X, Y). To complete the proof it is now enough to set f --~(I') in (iii) of Theorem 3. Even if in this section we have restricted our arguments to the case of a situation calculus K! (resp. Ins(Kt)) associated to a given image space I, the reader may have noticed that our results, being dependent primarily on the uniform and transition structure of the axioms, could be interpreted in a Artifldal Intelligence 7 (1976). 129-161
A. LOGICAL THEORY OF ROBOT PROBLEM SOLVING
157
more general framework. Let us call an arbitrary theory K in a situation language a transition theoryiff each its axiom is either a uniform or a transition formula (ft. ~t~p~inkov~l[13]). It is our belief that the transition theories are a promising fundamental tool for investigating the logical background underlying various specific approaches to mechanized reasoning (STRIPS, PLANNER, etc.) 7. The Frame Problem and STRIPS-fike Systems
As the reader may have noticed, the particular form of the image space introduced above suffers from one serious drawback for practical applications. Each operator O[fi] was interpreted in such a way that the image resulting from its application was always Tt[Ro[fi]], independently on the previous image. All facts uninfluenced by the operator that may be needed at a later stage of solving a problem, must therefore appear explicitly in Ct[fi] and Rt[fi]. This problem in general is known it, the literature as the frame problem (McCarthy and Hayes [9], Hayes [7]). In this section we suggest an extended form of the image space which is specifically designed to cope with the frame problem. The well-known "deletion" idea of STRIPS appears to be a particular case of our approach. • An imp ~rtant prerequisite for the extension (as well as• probably for any other approach to the frame problem) is the ability to distinguish the facts which are not influenced by a particular operator from those which may be, perhaps indirectly, influenced. This may be a quite difficult problem, especially in a nat-ral robot's environment, and practical answer usually results in a compromise between ivconsistency and impotency. It is not our •intention to discuss this question more and we shall therefore assume that in every particular problem domain there is a reasonable way of associating with each operator O[fi] a set ~'~ ~ of closed formulas interpreted as those facts that are not changed by executing ~[~]. •
•
,
.
DEFINn1ON t3. An image space with frames is a pair ¢~I,$t'~ where I = (ll,~) is a n ordinary image space over L and ~" is a mapping associating with each O[a] ¢ ~ a set ,~t[~] of closed formulas of L such that true ¢ ~[~o" , ~ ' ~ is called the frame of O[fi]. The main idea of our approach rests in the following extended defi~ition of a (generalized) solution, allowing to transfer, from one image to another, certain statements not mentioned explicitly m C , or R e (We use the notation from Definition 8.) D~FINITION 14. A finite nonempty set F ~_ ~* is a generalized ~-solutlon to a problem (X, Y) in (I,$ r ) iff for each ~ ~ Pref(V) and each ~[~] ¢ Fst(OTF) there is a formula A ~ ¢ ~ such that Artificial Intelligence 7 (1976), 129-161
158
o. ~ d ~ ' ~ o w t ~
L M. RAVEL
(i)
T [X]
~d3 • Fst(n
and (ii) for each y -- ytC~t[at] e Pref(r),
T,[R,,[a,]
&
V
~d3 ,; F.t(~Tr)
(C,[a] &
v Y,.
Note that a generalized solution in I On the sense of Definition 8) is a generalized oW-solution in ¢~1,,~'). We shall describe how a STRIPS-like approach can be interpreted as a special cast of the above definitions. An operator in STRIPS (of. Fikes and Hilsson [2] for details) is specified by three items: the precondition (identical with our formula C÷), the delete list (the clauses~ that might no longer be true after the application of the operator), and the add l/st (the clauses that might not have been true before the application but are true after it--our formula R÷). In general we introduce a set 8 of "'basic formulas"---for instance all claus~ ~:o that the delete and add lists are subsets of 8. A finite set of basic formulas is called a world description. We shall use the following notation: If .~' is a finite set of formulas, ^ .~' = A A. Conversely, given a conjunction A of basic tam
formulas we defir.¢ 1,41 -~ ¢ such that A [AI -- `4 (we use the equal sign between formulas for graphical identity modulo the assomativity and commutativity of V and &). How for each operator O[a] let C~t~ be the precondition, Delc~a3c_ 8 the delete list, and Addend3_~ 8 the ~c]d list (we could start with operator schema but this is not important for our purposes). Let R÷[a] = A Add 83" We define $ r as the set of all conjunctions of formulas m 8 - D e l ¢ ~ . Moreover, let lnit ~_ 8 be the initial World des,~ption and Y the goal formula. Define X -- A Init. In this way we can easily transform a typical STRIPS problem space into an appropriate image spa~ with frames O,.~'), together With a problem X, Y). What is more important is to notice that a problem has a solution in STRIPS iff it has an ,~'-solution in the corresponding image space with frames and to study their correlations. First let us ~ote that STRIPS in its original form takes into account only nonbranching solutions. Since this is not ~a fundamental restriction of STRIPS we shall consider generalized solutions as we did in Definition 14. The idea of STRIPS is to keep in the current~wodd description each formula from Init as well as fi'om all add lists encountered during the solution, as long as some delete list does not force its deletion (~. also [13]). Every STRIPS so!ufion is a solution in the s~n_se of Definition 14; the .
. .
• A clause is a disjunction on literals; a literal is either a a atomk: formula or its negation.
Arti~ial Intelligence7 (197.6), 129-161
A ].,(~lC.kJ[, THEORY OF ROBOT PROBLEM SOLVING
159
formulas A~ sj should be constructed as follows: (D A~t~ - A ([nit- D e l ~ ) for all ¢ Fst(r3; (tO = A ((iAf,t ,ll u Add~,zad)-Del÷2ta21) for all 7~l[al]~2[al] ¢ Pref(r). An ,¢t'-solution is a STRIPS solution, because the "world models" obtained in .p'-solution are of the form IA, I u a] & R÷[a]I thus they are subsets of the "world models" of the appropriate nodes generated during the STRIPS solution. Let (I,3r> be an image space with frames and (X, Y> a problem in (I,~t'> both together corresponding in ~ e above way to a STRIPS-like problem space. It was shown that any F ~ Y~* is a (generalized) ~-solution in the sense of Definition 14 iff it is a (generalized) solution in the sense of STRIPS (i.e., with formulas A ~ satisfying (I) and (II) above). Consequently the STRIPS-like case characterized by (I) and (II) is equally powerful as the general case from Definition 14. The latter, however, suggests a possibility of saving some memory space during the search by omitting formulas which d¢ not seem to be promising for a later use. -
--
Research topic. In what manner can this possibility be exploited for the purposes of heuristic problem solving ? We shall return to the general case and associate a situation calculus with the image space with frames. D~NmON 15. Let ( I , P ) be an image space with frames. The situation calculus KO~> associated with (I,,f') is obtained from KI be adding new transition axtoms, cal~d the frame axioms (to distinguish them from the operator axioms), of the form for each 0[a] ¢ • and each A ¢ J ~ . We define Insf£oj>) similarly as in Definition 9 . We can obtain an analogy of the second correspondence theorem for the Case of the image with frames, (I,,.~>. However, we have to require the consistency of KO;~> which is by no means an obvious property.
Research topic. What conditions have to be satisfied by to ensure consistency of K(~.~>?, Ttw.ogl~ 6. vet be an image space with frames with a consistent associated aituation calculus KO,~>.Le~ be a consistent problem in I. The following three statements are equivalent. A r t i ~ i Intelligence 7 (1976), 129-161
o. [TL~)[NKOV.~[ A N D I. M. HAVEL
160
O) there exists a generalized ~-solution to /n ; (ii) Ins(Ko~ >) I- X°[so] --+ 3s, Y°[s]; (iii) there is a finite set ~" o f variable-free situation terms o f 1(i such that
r[,o]
v
f e..Iv
r°[,]
and z - z(L~r) is a generalized ~r-solution to < X, Y> in . Proof (Outline). This theorem can be proved similarly as suggests the outline of the proof of Theorem 3 in Section 5. In the detailed proof some care must be given to frame axioms and the formulas transferred by them from one situation to another. The frame axioms are transitior formulas, thus InsK). ACKNOWLEDOMENT We would like to thank Dr. Petr H/tjek and all participants of his seminar in applied logic for providing a collaborative and stimulating forum for discussions related to this work. We are also grateful to Dr. Petr ~t~ly~nek and others who read earlier versions of the manuscript for their assistance and many helpful suggestions. Last but not least, we acknowiedge the intellectual stimulation provided by works in the area of AI, especially by those listed in the references. REFERENCF~ 1. Fikes, R. E., Hart, P. E. and Nilsson, N. J. Some aew directions in robot problem solving. Machine Intelligence7, B. Meltzer and D. Michie, eds., Edinburgh Univ. Press, Edinburgh (1972), 405-430. 2. Fikes, R. E. and Nilsson, N. J. STRIPS: A new approach to the application of theorem proving to problem solving. Artiftctal Intelligence 2 (1971)~ 189;-208. 3. Green, C. Theorem-proving by resolution as a basis for qttestion, answer~"g systen~, Machine Intelligence .4, B. Meltzer and D . Michie, eds., Edinburgh Univ. Press, Edinburgh (1969), 183-,205. ' 4. Green, C. Application of theorem proying to problem solving. Proc. IntemL Joint Conf. on Arttfloial IntelHge~e, Washington, D.C. (May .1969). 5. Havel, I. M. Finite branching automata. Kybernet'/ka (Prague)!0 (1974), 281-302. 6. l-Iaycs, P. J. A logic of actions. MacMne Intelligence 6, B. Meltzm"and D. Michio, eds., Edinburgh Univ. Press, Edinburgh (1971), 495-.$20. , 7. Hayes, P. J. The frame problem and related problems in artificial inteili~.-nce. Artifw.la! and Human TMnking, A. Elithom and D. Jones, ods., E!se~ier, Amsterdam (1973), 14.5_59"
8. Luckham, D. and Hi,con, N. J. Extracting information fzom resolution proof trees. Artificial Intelligence 2 (1971), 2%54. 9. McCm~y, J. and I/ayes, P. J. Some philosophical woblems from the standpoint of artificial intelligence. Machlnelntelligenee 4, B. Meltzer and D. Miehie, eds., EdMburgh Univ. Press, Edinburgh (1969), 465.-502. = Artiftcial Intelligence 7 (I 976), 129-161
A LOGICALTHEORY OF ROBOT PROBLEM SOLVING
161
10. Nilsson, N. J. A mobile automaton: An application of artificial intelligence techniques. Proc. First lnternl. Joint Conf. on Artificial Inteli~ence, Washington, D.C. (May 1969), 509-520. 11. Nilsson, H. J. Problem-Solving Methods in Artificial Intelligence. McGraw-Hill, New York (1971). 12. Shoenfield, J. R. Mathematical Logic. Addison-Wesley, Reading, Mass. (1967). 13. ~t~h~kov~, O. and Havel, I. M. Incidental and state-dependent phenomena in robot problem solving. In preparation. 14. [~t~tnkovk, O. and Havel, I. M. Image space and its relationship to situation calculus. Research Report No. 9/73 Inst. Computation Tech., Technical Unive~ity of Prague (August 1973). 15. ~t~tp~mkovA,O. and Havel, I. M. Some results concerning the situation calculus. Proc. MFCS'73 Syrup., High Tatras (September 1973), 321-326. 16. ~t~tlgtnkov~O. Skolem functions and the planning in the situation calculus. A collection of papers, Inst. of Computation Techniques, Technical University of Prague (1975).
Received October 1973; revised version received March 1975
~'llf~lalInlellll~ 7 (1976),12°-161