The Frame Problem in the Situation Calculus: A Simple Solution (Sometimes) and a Completeness Result for Goal Regression Raymond Reiter Department of C o m p u t e r Science University of Toronto Toronto, C a n a d a and T h e Canadian Institute for Advanced Research
1
Introduction
Ever since it was first pointed out by M c C a r t h y and Hayes in 1 9 6 9 [5], the frame problem has remained an obstacle to the formalization of dynamically changing worlds. Despite m a n y a t t e m p t s , no completely satisfactory solution has been obtained. W i t h o u t presuming to have solved the frame problem in its full generality, we propose a solution for an interesting special case, and explore some of its consequences. Specifically, we have two objectives in this chapter: 1. To provide an analysis of two recent proposals for dealing with the frame problem in the situation calculus (Pednault [6], Schubert [9]) and to show how they c a n be combined, under a suitable closure assumption t h a t is appropriate in settings when the effects of all actions on all fluents can be specified. 2. To show how the axioms arising from the analysis of 1. provide a systematic t r e a t m e n t of goal regression (Waldinger [10]) for plan synthesis, together with natural conditions under which regression is provably sound and complete. Proofs for all results in this chapter m a y be found in (Reiter [8]). 359
Copyright © 1991 by Academic Press, Inc. All rights of reproduction in any form reserved. ISBN 0-12-450010-2
Reiter
360
2
Axiomatizing Change
In this section, we describe a class of axioms t h a t characterize the effects of actions on fluents. W e follow this by a survey of two different approaches to solving the frame problem, namely, the proposals of Pednault [6] and Schubert [9]. Finally, we provide an axiomatization combining the central ideas of Pednault and Schubert.
2.1
Effect Axioms
Following Pednault [6], we assume t h a t the effects of actions on fluents are
specified by effect axioms of the following forms: P o s i t i v e E f f e c t A x i o m for F l u e n t R w r t A c t i o n a For each action a ( x ) and fluent R, there is one axiom of the form: τ τ α( χ ,
s) Λ e £ ( x , y, s) D R(y, d o ( a ( x ) , s)). 1
Here, the variables x , y, and s are implicitly universally quantified. The variables of χ and y are distinct from one another. T h e metaformula
π α ( χ , s) denotes the action preconditions of the action o ( x ) . These are the prerequisites t h a t must be satisfied in order t h a t action a can be carried out, and they depend only on a, not on R. T h e metaformula ε ^ ( χ , y , s) denotes the fluent preconditions under which action a ( x ) , if performed, leads R to become true for y in the successor s t a t e d o ( a ( x ) , s)). Examples 1. T h e effect on the predicate broken of dropping something:
holding(r, x, s) Λ y = χ Λ fragile(y) Here,
7 γ < / γ ο( γρ,
x, s) is holding(r,x,
object χ in state s. e^roken(r,x,y,s)
D broken(y, do(drop(r, x ) , s)).
s), the precondition for robot r to drop is y = χ Λ fragile(y),
the prerequisite
for y becoming broken in t h a t s t a t e do(drop(r, x), s) resulting from robot r dropping χ in s t a t e s. 2. How picking something up affects the predicate holding:
[(Vz)->holding(r, z, s)] Λ -*heavy(x) Λ nexto(r, x, s) Λ r' = r Λ y = χ D holding(r', y, do(pickup(r, x), s)). 1
I n the subsequent development, lower case Roman letters in formulas will denote variables, and are understood to be implicitly universally quantified whenever no explicit quantifier is indicated.
The Frame
Problem
in the Situation
[(Vz)-iholding(r,
Calculus
z, s)] Λ -^heavy(x)
361
Λ nexto(r,
x, s ) ,
the precondition for robot r to pick up χ in state s. ^^olding(r, r' = r Λ y = x.
x, r', y, θ) is
Negative Effect Axiom for Fluent R wrt Action a For each action a(x) and fluent R, there is one axiom of the form: 7 r a( x , s ) A ^ ( x , y , 5 ) D ->Ä(y,do(a(x),s)). As before, the metaformula π α(χ, s) denotes the action preconditions of the action a. T h e metaformula e^(x,y,s) denotes the fluent preconditions under which action a(x), if performed, leads R to become false for y in the successor s t a t e do(a(x), s)).
Example hasglue(r,
s) Λ broken(x,
s) Λ y = x D ~^broken(y, do(repair(r,
x ) , s)).
Here, 7rrepair(r,x, s) is hasglue(r, s) A broken(x, s), the precondition for robot r t o repair object χ in s t a t e 5 . s~epair(r, x, y, s) is y = χ.
2.2
Frame Axioms
As has been long recognized [5], axioms other t h a n effect axioms are required for formalizing dynamic worlds. These are called frame axioms, and they specify the action invariants of the domain, i.e., those fluents unaffected by the performance of an action.
Examples Dropping things does not affect an object's color: holding(r,
x, s) Λ color(y,
c, s) D color(y,
c, do(drop(r,
x),
s)).
Not breaking things: holding(r,x,
s) Λ -^broken(y, s) Λ [y φ χ V ->fragile(y)] D -*broken(y,do(drop(r,x),s)).
In general, a frame axiom has one of the following syntactic forms:
Positive Frame Axiom for Fluent R wrt Action a π α (χ, s) Λ 0£(x, y, s) Λ R{y, s) D R(y, do(a(x), s)).
Reiter
362 W h e n a's action preconditions are satisfied and the prerequisites
>#(x, y, s)
hold, R remains true for y after a is performed.
Negative Frame Axiom for Fluent R wrt Action a π α (χ, s) Λ 0β(χ, y, s) Λ ->Ä(y, s) D ->Ä(y, do(a(x), s)). W h e n a's action preconditions are satisfied and the prerequisites
>^(x, y, s)
hold, ß remains false for y after a is performed.
2.3
Frame Axioms: Pednault's Proposal
In view of the large expected number of frame axioms, together with the practical problem of having t o think of t h e m all, it is natural t o ask whether there is some systematic way of obtaining t h e m from the effect axioms. Pednault [6] provides just such a method, but with a critical proviso. Consider again the positive and negative effect axioms for a fixed action a and a fixed fluent R:
π α (χ, s) Λ ε£(χ, y, s) D R{y, do(a(x), s)), π α(χ, s) Λ ε^(χ, y, s) D -«Ä(y, do(a(x), s)). Suppose we make the following:
Completeness Assumption for Fluent Preconditions The fluent precondition ej£(x, y, s) specifies all the conditions under which action a, if performed, will lead to the truth of R for y in a's successor state. Similarly, ε^(χ, y, s) specifies all the conditions under which action a, if performed, will lead to the falsity of R for y in a's successor state. Now, by the completeness assumption, we c a n reason as follows: Suppose a's action preconditions 7 Γ α ( χ , s) hold. Suppose further t h a t both R(y,s) and ->Ä(y,do(a(x), s ) ) hold. T h e n R, which was true in state s, was made false by action a. B y the completeness assumption, the only way R could become false is if ε^(χ, y, s) were true. This intuition c a n be expressed axiomatically by:
π α(χ, s) Λ R(y, s) Λ -«Ä(y, do(o(x), s)) D ε^(χ, y, s). This is logically equivalent to:
π α(χ, s) Λ R(y, s) Λ ->ε^(χ, y, s) D R(y, do(a(x), s)). A symmetric argument yields the axiom: 7 Γ α( χ , s) Λ
-rR(y, s) Λ ->ε^(χ, y, s) D
-iÄ(y,
do(a(x),
s)).
The Frame Problem in the Situation Calculus
363
These have precisely the syntactic forms of positive and negative frame axioms and, by virtue of the argument leading t o these, they play exactly the role of frame axioms. W e conclude t h a t , provided the completeness assumption is true, there is a systematic way of obtaining the frame axioms from the effect axioms. Notice t h a t the completeness assumption makes no reference to the action preconditions π α(χ, s) for the action a. These may well fail to characterize all the preconditions of the action a, but this incompleteness would in no way compromise the intuitive correctness of the above systematic transformation of the effect axioms to obtain the frame axioms. T h e plausibility of this transformation relies solely on the assumed completeness of the fluent preconditions. Notice also the intimate connection between the completeness assumption and the so-called qualification problem ( M c C a r t h y [4]). B y assuming complete information about fluent preconditions, we are effectively assuming no qualifications about these preconditions. Equivalently, if there are any unstated qualifications, we are taking t h e m to be false. T h e completeness assumption makes no such claims about possible qualifications for the action preconditions.
Example Consider the positive effect axiom for broken holding(r,
x, s) A y = χ A fragile(y)
wrt drop:
D broken(y,
do(drop(r,
x),
s)).
T h e completeness assumption for this setting is t h a t the only precondition for y being broken as a result of dropping χ is t h a t y be fragile and the same as x . If this assumption is accepted, then the negative frame axiom for the fluent broken wrt the action drop is: holding(r,
x , s) A ~^broken(y, s) A -*[y = χ A fragile(y)] D -^broken(y,do(drop(r,x),s)).
To obtain the frame axioms in this way for all fluent-action pairs requires considering a large number of "vacuous" effect axioms. For example, to obtain a frame a x i o m for the fluent color wrt action drop, consider the positive effect axiom for color wrt drop: holding(r,
x, s) A false
D color(y,
c, do(drop(r,
rr), s)).
F r o m this we obtain the negative frame axiom for color wrt drop: holding(r,
x, s) A -icolor(y,
c, s) D ->color(y, c, do(drop(r,
This illustrates two problems with Pednault's proposal:
x ) , s)).
Reiter
364
• To systematically determine the frame axioms for all fluent-action pairs from their effect axioms, we must enumerate (or at least consciously consider) all these effect axioms, including the "vacuous" ones. In particular, we must enumerate all fluent-action pairs for which the action has no effect on the fluent's t r u t h value, which really amounts to enumerating most of the frame axioms directly. • T h e number of frame axioms so obtained is 2 χ Λ x Τ, where Λ is the number of actions, and Τ the number of fluents. Some of these may be vacuously true (i.e., when the fluent precondition of the corresponding effect axiom is true), but in general, we are faced with the usual difficulty associated with the frame problem—too many frame axioms. Finally, the completeness assumption warrants a bit more when can it fail? T h e answer seems to be, roughly speaking: the effects of an action on a fluent are not completely known. the effect of pulling the trigger of a (possibly loaded) gun on loaded. It is indeterminate whether the gun will be loaded after pulltrigger. Thus, both the positive and negative effect axioms wrt pulltrigger are "vacuous" : false false
D loaded(do(pulltrigger, D ->loaded(do(pulltrigger,
attention: whenever Consider the fluent the action for loaded
s)), s)).
The corresponding frame axioms, obtained from these effect axioms under the completeness assumption, are: loaded(s) -^loaded(s)
D loaded(do(pulltrigger, D -iloaded(do(pulltrigger,
s)), s)).
The first of these is intuitively false. One way out, at least for this example, is to refine the effect axioms to make the effects of pulltrigger on loaded determinate: containsbullets(n, containsbullets(n,s)
s) Λ η > 2 D loaded(do(pulltrigger, An < 1 D
s)),
-iloaded(do(pulltrigger,s)).
It is unlikely t h a t such fixes are possible, in a natural way, for all indeterminate action-fluent pairs.
The Frame Problem in the Situation Calculus
2.4
365
Frame Axioms: Schubert's Proposal
Schubert [9], elaborating on a proposal of Haas [3], argues in favor of what he calls explanation closure axioms for representing the usual frame axioms. We illustrate Schubert's approach with an example. Consider the fluent holding, and suppose t h a t b o t h holding(r,x, s) and -*holding(r, x, do(a, s)) are true. How c a n we explain the fact t h a t holding ceases to be true? If we assume t h a t the only way this c a n happen is if the robot r put down or dropped x, we c a n express this with the explanation closure axiom: holding(r,
x, s) Λ -*holding(r, D a = putdown(r,
x, do(a, s)) χ) V a = drop(r,
x).
As usual, all variables, including the action variable a, are implicitly universally quantified. To see how this functions as a frame axiom, rewrite it in the logically equivalent form: holding(r,
x, s) Λ α φ putdown(r, D hoi ding (r,x,do(a,
χ) Λ α φ drop(r, s)).
χ)
, , ^ '
This says t h a t all actions other t h a n putdown and drop leave holding 2 invariant, which is the standard form of a frame axiom (actually, a set of frame axioms, one for each action distinct from putdown and drop). In general, an explanation closure axiom has one of the two forms: i 2 ( x , s) Λ ->iî(x, do(a, s)) D û;^(x, a, s), -»A(x, s) Λ i î ( x , do(a, s)) D /3ß(x, a, s). In these, the action variable a is universally quantified. These say t h a t if ever the fluent R changes t r u t h value, then α # or ßn provides an exhaustive explanation for t h a t change. As before, to see how explanation closure axioms function like frame axioms, rewrite t h e m in the logically equivalent form: Ä ( x , s) Λ ->c*fl(x, α, s) D i ? ( x , do(a,
s)),
and ->.R(x, s) Λ - Ι / ? Λ ( Χ , α, s) D ->Ä(x, do(a, 2
s)).
3
T o accomplish this, we shall require unique names axioms like pickup(r,x) φ drop(r',χ'). We shall explicitly introduce these later. 3 Schubert [9] omits the action preconditions for a in his examples of explanation closure axioms, as we do here. Nevertheless, they should be present. We shall restore them in the next section.
Reiter
366
These have the same syntactic form as frame axioms with the important difference t h a t action a is universally quantified. Whereas there would be 7 2 χ Ax J frame axioms, there are just 2 χ Τ explanation closure axioms. This parsimonious representation is achieved by quantifying over actions in the explanation closure axioms. Schubert proposes t h a t explanation closure axioms must be provided independently of the effect axioms. Like the effect axioms, these are domaindependent. In particular, Schubert argues t h a t they cannot be obtained from the effect axioms by any kind of systematic transformation. Thus, Schubert and Pednault entertain conflicting intuitions about the origins of frame axioms. As Schubert observes, his appeal to explanation closure as a substitute for frame axioms involves an assumption.
The Explanation Closure Assumption The only way the fluent R 's truth value could have changed from true to false under action a is if ctR were true. This means, in particular, that α # completely characterizes all those actions a that can lead to this change; similarly for PR. We can see clearly the need for this assumption from the example explanation closure axiom ( 1 ) . If, in the intended application, there were an action (say, eat(r,x)) t h a t could lead to r no longer holding x, axiom (1) would be false.
3 3.1
A Simple Solution to the Frame Problem (Sometimes) The Basic Idea: An Example
T h e basic idea is best illustrated with an example. Suppose there are two positive effect axioms for the fluent broken: holding(r,
x, s) A y = χ A fragile(y)
bomb(b) A nexto(b,
D broken(y,
y, s) D broken(y,
do(drop(r,
do(explode(b),
x), s)).
These can be rewritten in the logically equivalent form: {[holding(r, x, s) A a = drop(r, x) A y = χ A fragile(y)) \/[bomb(b) A nexto(b, y, s) A a = explode(b)]} D broken(y, do(a, s)).
s)),
The Frame Problem in the Situation Calculus
367
This can be represented more compactly by introducing the new predicate Poss(a,s), meaning t h a t action a is possible in state s: Poss(a, s) A [(3r, x)a = drop(r, χ) A y = χ A V ( 3 6 ) a = explode(b) A nexto(b, y, s)] D broken(y,do(a,s)), holding(r,
x, s) D Poss(drop(r,
bomb(b) D
fragile(y) (2)
x), s ) ,
Poss(explode(b),s).
Similarly, consider the negative effect axiom for broken: hasglue(r,
s) A broken(x,
s) Ay = χ D -^broken(y,
do(repair(r,
x ) , s)).
In exactly the same way, this c a n be rewritten as: Poss(a, s) A ( 3 r , x)a = repair(r,
x) A y = x D
, .
-ibroken(y,do(a,s)), hasglue(r,
s) A broken(x,
s) D Poss(repair(r,
' x), s).
Notice t h a t , with the exception of the introduction of the predicate Poss, this transformation is similar to the first stage of Clark's [1] predicate completion technique for logic programs. Now we can appeal to the following completeness assumption: Axiom (2) characterizes all the conditions under which action a leads to y being broken. Then if Poss(a, s),-ibroken(y, s),broken(y,do(a, s)) are all true, the t r u t h value of broken must have changed because ( 3 r , x)a = drop(r, x) A y = χ A V(3b)a = explode(b)
fragile(y) A nexto(b, y, s)
was true. This intuition c a n be formalized, after some logical simplification, by the following explanation closure axiom: Poss(a, s) A ->broken(y, s) A broken(y, do(a, s)) D ( 3 r ) a = drop(r, y) A fragile(y) V (3b)a = explode(b) A nexto(b,
y, s).
Similarly, ( 3 ) yields the following explanation closure axiom: Poss(a,
s) A broken(y,
s) A ->broken(y,
do(a, s)) D ( 3 r ) a = repair(r,
y).
Reiter
368
3.2
The General Case
The previous example obviously generalizes.
W e suppose given, for each
fluent R, the following two general effect axioms: General Positive Effect Axiom for Fluent R Poss(a, s) Λ 7 ^ ( Α , s) D R(do(a, s)).
4
(4)
General Negative Effect Axiom for Fluent R Poss(a, s) Λ 7 # ( Α , s) D ->R(do(a, s)).
(5)
These two axioms are systematically obtained from all of the positive (respectively, negative) effect axioms for R by the same process illustrated in the previous examples. T h e predicate Poss must also be defined.
Action Precondition Axioms For each action A, KA(S)
D POSS(A,
S),
where π^(^) is the formula for A's action preconditions. We shall make the following:
Completeness Assumption Axioms (4) and (5), respectively, characterize all the conditions under which action a can lead to R becoming true (respectively, false) in the successor state. Hence, if action a is possible and Ä's t r u t h value changes from false t o true as a result of doing a, then 7 ^ (a, s) must be true; similarly, if Ä's t r u t h value changes from true t o false. This informally s t a t e d assumption can be represented axiomatically by the following:
Explanation Closure Axioms Poss(a, s) Λ R(s) Λ -^R(do(a, s)) D 7^(a, s),
(6)
Poss(a, s) Λ ^R(s) Λ R(do(a, s)) D J^(a, s).
(7)
W e shall sometimes appeal to:
4
Henceforth, in formulas of this kind, we shall suppress all but the action and state arguments.
The Frame Problem in the Situation Calculus
369
Unique Names Axioms for Actions For distinct action names α and α',
a(x) φ a'(y). Identical actions have identical arguments: α ( χ ι , . . . , χ η ) = a ( j / i , . . . , y „ ) D Xi = yiA
... Λ χ η = y n .
Finally, we shall need:
Unique Names Axioms for States So φ
do(a,s),
5
do(a, s) = do(als') D a = a A s = s . f
f
The following slightly generalizes a result of Pednault[6]:
Result 1 Let Τ be a firstr-order theory that entails -i3(Poss(a, s)A^(a, s) Λ 7 ^ ( α , s ) ) , where 3 denotes the existential closure of the formula in its scope. Then Τ entails that the general effect axioms (4) and (5), together with the explanation closure axioms (6) and (7), are logically equivalent to: Poss(a,s)
D [R{do{a,s))
= 7 ^ ( a , s) V R(s)
A - > 7 ^ ( a , s)].
(8)
The requirement t h a t ->3(Poss(a, s) A 7 ^ ( 0 , 5 ) Λ 7 ^ (α, s)) be entailed by the background theory Τ simply guarantees the integrity of the effect axioms (4) and ( 5 ) ; under these circumstances, it will be impossible for both R(do(a,s)) and -iR(do(a,s)) to be simultaneously derived. Notice t h a t by the unique names axioms for actions, this condition is satisfied by the example of Section 3 . 1 .
We call formula ( 8 ) the successor state axiom for fluent R. For the example of Section 3 . 1 , the successor s t a t e axiom for broken is:
Poss(a,s) D [broken(y, do(a, s)) = (3r)a = drop(r,y) A fragile(y) V (3b)a = explode(b) A Vbroken(y, s) A ->(3r)a = repair(r, y)]. 5
nexto(b,y,s)
I n the subsequent development, So will denote the initial state, and will be the only state constant allowed in the theory.
Reiter
370
3.3 Summary Our proposed solution relies on the completeness assumption of the previous section for each fluent R. This yields the following axioms: 1. Successor s t a t e axioms: for each fluent R,
Poss(a, s) D [R(do(a, s)) = 7 # ( α , s) V R(s) Λ ->7β(α, s)]. 2. For each action A, a single action precondition axiom of the form: TTA(S) D POSS(A,
S).
3. Unique names axioms for actions and for states. Ignoring the unique names axioms (whose effects can be compiled), this axiomatization requires T+A axioms in total, compared with the 2 χ A x Τ explicit frame axioms t h a t would otherwise be required. T h e r e is also a significant improvement in space complexity of our axiomatization over one appealing t o explicit frame axioms. More precisely, it is easy t o see t h a t the space complexity is decreased by a factor of A, roughly the same decrease in complexity as is obtained by the simple axiom-counting argument above. The conciseness and perspicuity of this axiomatization relies on two things: quantification over actions via the transformations of Section 3 . 1 , and the Generalized Completeness Assumption.
4
Plan Synthesis
T h e standard formal account of plan synthesis views this as a theoremproving problem. A plan t o achieve a certain goal G(s) is obtained as a side effect of a proof of (3s)G(s) from premises axiomatizing the domain of application and conditions holding in the initial s t a t e So (Green [2]). Any binding for the variable s as a result of such a proof is a successful plan. Here, G(s) is any first-order formula with the single free variable s.
4.1
Executable Plans and Ghost States in the Situation Calculus
The above theorem-proving account of plan synthesis has a flaw; it is possible to obtain non-executable plans this way. To see why, consider an axiomatization of a blocks world domain for which
Τ |= onfloor(B,
do(drop(B)y
So)).
The Frame Problem in the Situation Calculus
371
Then trivially, do(drop(B), So) is a plan to get Β onto the floor; but this plan need not be executable, i.e., the action precondition of drop, namely, holding(B, SO), need not be entailed by T. Under these circumstances,
do(drop(B),So)
is a ghost state of T\ it is not reachable from So by any
executable sequence of actions. Notice t h a t this is a feature of the situation calculus, not of our proposed solution to the frame problem. To circumvent this problem of non-executable plans, we propose to modify the theorem to be proved in the process of plan synthesis. Define a new predicate ex(s) as follows:
ex(s) = s = So V ( 3 a , s')s = do(a, s') A Poss(a, s') A ex(s').
(9)
Intuitively, ex(s) states t h a t s is an executable plan, i.e., it is composed of a sequence of plan steps, each of whose action preconditions is true in the previous state. W e reformulate the problem of synthesizing a plan to achieve a goal G as the task of establishing t h a t
T\=(3s)G(s)Aex(s). Any plan so obtained is guaranteed to be executable.
4.2
Plan Synthesis by Goal Regression
"In solving a problem of this sort, the grand thing is to be able to reason backward."
Sherlock Holmes, A Study in Scarlet This section provides foundations for a systematic, backward-reasoningstyle proof theory for plan synthesis, usually called goal regression (Waldinger [10]). T h e approach substantially generalizes some ideas of Pednault [6], who considers goal regression within the setting defined by his solution to the frame problem. Our objective is a method for establishing t h a t
F\=
(3s)G(s)
Aex(s)
whenever is a suitable axiomatization of a dynamic world. To do so we must be more precise t h a n we have been about the first-order language of our axiomatization. L e t £ be a sorted first-order language with two disjoint sorts for actions and states, and suppose these sorts are disjoint from any other sorts of the language. Assume C has the following vocabulary: • Variables: Infinitely many of each sort.
Reiter
372
• Function symbols of sort state: There are just two of these—the constant So and the binary function symbol do, which takes arguments of sort
action and state, respectively. • Function symbols of sort action: Finitely many. • Other function symbols: Infinitely many of sort other t h a n action and state for each arity, none of which take a n argument of sort state. • P r e d i c a t e symbols: 1. A distinguished binary predicate symbol Poss taking arguments of
sort action and state, respectively. 2. A distinguished unary predicate symbol ex taking argument of sort
state. 3. A distinguished equality symbol = . 4. Finitely many predicate symbols, distinct from t h e predicate symbols Poss and ex, each of which takes, among its arguments, exactly one of sort state; these are the fluents. Notice t h a t the predicates and ex, which do take a n argument of sort state, are not
Poss fluents.
5. Infinitely many predicate symbols of each arity, none of which take arguments of sort state. • Logical constants and punctuation: As usual. Notice t h a t £ does not allow state-dependent
of(x,s), or
functions
like employer-
Canadian-prime-minister(s).
The predicate symbols of C other t h a n Poss and ex are called domain predicate symbols. T h e intention is t h a t these will denote
domain-specific
relations like holding, nexto, e t c . T h e two non-domain predicate symbols Poss and ex are included t o facilitate our axiomatization of change, as in Section 3.2.
Definition: The Simple Formulas Let s be a variable of C of sort state. T h e formulas of C t h a t are simple wrt s are defined t o be the smallest set such t h a t : 6
1. F(t, s) and F(t, So) are simple wrt s when F is a fluent and t are t e r m s . A n equality a t o m mentioning no state variable a t all, or mentioning only the s t a t e variable s, is simple wrt s. Any other a t o m with predicate symbol other t h a n Poss or ex is simple wrt s. 6
F o r notational convenience, we assume that the last argument of a fluent is always the (only) argument of sort state.
The Frame Problem in the Situation Calculus
373
2. If Si and S 2 are simple wrt s, so are ->Si, Si Λ S2, Si V 52, S i D S2, Si = S2. 3. If S is simple wrt s, so are (3x)S and ( V x ) S whenever a; is a variable not
of sort state. In short, t h e simple formulas w r t s are those t h a t mention only domain predicate symbols, whose fluents do not mention the function symbol do, which do not quantify over variables of sort state, and which have a t most one free variable s of sort state. Recall t h a t Poss was a predicate symbol introduced t o provide a uniform representation for successor state axioms, and t h a t the preconditions for specific actions were defined by action precondition axioms (Section 3.2).
Definition: Action Precondition Axiom An action precondition axiom is a formula of the form:
( V x i , - - - , x n , s ) [ r U D Poss(A(xi,--
,xn),s)],
where A is a n n-ary action function of £ , and is a formula of £ t h a t is simple wrt s and whose free variables are among xi, · · ·, xn, s.
Notation Suppose T Ç £ contains a n action precondition axiom for each action function of £ , say, the following η axioms:
(Vx,s)[UAl
D
Poss(Ai(x),s)],
DPoss(An(z),s)].
(V?,s)[UAn Then Vf (a, s) denotes t h e formula:
{3x)a = Ai(x) Λ Π
Λ ι
V · - · V {3z)a =
An{z) Λ Π
.
Λ η
Recall the central role of successor s t a t e axioms in our approach t o the frame problem (Section 3 . 2 ) .
Definition: Successor State Axiom A successor state axiom for a n ( n H- l ) - a r y fluent F of £ is a sentence of C of the form:
(Va, s)(Vxi,...,
xn)Poss(a,
s) D F(xi,...,
xn, do(a, s)) = Φ^,
(10)
Reiter
374
where, for notational convenience, we assume t h a t F ' s last argument is of sort state, and where Φ^ is a simple formula wrt s, all of whose free variables are among a, s, X\,..., xn. Notice t h a t we do not assume t h a t successor s t a t e axioms have the e x a c t syntactic form ( 8 ) of Section 3.2. T h e discussion of Section 3 was meant t o motivate one way t h a t successor s t a t e axioms of t h e form ( 1 0 ) might arise, but nothing in the development t h a t follows depends on the approach of Section 3 . 2 .
Definition: A Regression Operator Let θ Ç £ contain one successor s t a t e axiom for each distinct fluent of the language C. T h e regression operator TZQ when applied t o a formula of C is defined recursively as follows: 1. W h e n A is a non-fluent a t o m , including equality atoms, and atoms with predicate symbol Poss or ex, or when A is a fluent a t o m whose state argument is a s t a t e variable, or t h e s t a t e constant So,
π [Α} = Α. θ
2. W h e n F is a fluent whose successor s t a t e axiom in Θ is
(Va, s)(Vxi,...,
xn)Poss(a,
s) D F(xi,...,
xn, do(a, s)) = Φρ,
then
t n , do(a, σ))) =
ne[F(h,...,
*F\%:;;;f:££.
3. Whenever W is a formula, KEHW] = -IUE[W],
ne[(Vv)W]
=
{VV)KE[W],
UE[(3v)W]
=
(3V)TIQ[W].
4. Whenever W\ and W2 are formulas, TLELW! Λ W2] = NELWX] Λ NE[W! ν W2] = NE[WX] ν D W2] = NS[WX] D KELW!
= W) 2
= nQ[WX}
=
KE[W2],
n [w ], e
2
N&[W2], KE[W2].
TZ@ [G] is simply t h a t formula obtained from G by substituting suitable instances of Φ ρ in F ' s successor axiom for each occurrence in G of a fluent a t o m of the form F(t\,..., tn, do(a, σ ) ) . The idea behind t h e regression operator %® is t o reduce the depth of nesting of the function symbol do in t h e fluents of G by substituting suitable instances of from ( 1 0 ) for each occurrence of a fluent a t o m of G of the form F(t\,..., tn, do(a, σ ) ) . Since Φ^ is simple wrt s, the effect of this
The Frame Problem in the Situation Calculus
375
substitution is to replace each such F by a formula whose fluents mention only the state t e r m σ, and this reduces the depth of nesting by one. We say t h a t a formula of £ is s-universal iff in its prenex normal form every variable of sort state is universally quantified.
Definition: The Formulas Γ»(β) Let G(s) G £ have the s t a t e variable s as its only free variable. Suppose T Ç £ contains a successor s t a t e axiom for each fluent of £ and an action precondition axiom for each action function of £ . Define Γο(*) = G(s),
Ti(s) = (3ai)n^i-i(do{ah
s))} Λ VT[a{,
s) % = 1 , 2 , · · ·
The following is the principal result of this section.
Theorem 6 (Regression Theorem) Suppose T Ç £ contains the executability axiom (9), unique names axioms for states, a successor state axiom for each fluent of C, and an action precondition axiom for each action function of £. Suppose further that the remaining axioms of Τ are s-universal and mention only domain predicate symbols. Finally, suppose that G(s) G £ is simple wrt s, and that the state variable s is the only free variable ofG(s). Then 1. Τ (= (3s)G(s) Λ ex(s) iff for some n, Τ-
Η Γ 0( 5 ο ) V · . · v r n( S 0) ,
where T~ is Τ without the executability axiom. 2. For every η, Γο(5ο) V · · · V Γ η ( 5 ο ) mentions only domain predicate symbols. 3. For every n, So is the only state term mentioned by the fluent atoms of Γ0(5ο) ν · · · v r n ( 5 0 ) .
4.3
Soundness and Completeness of Goal Regression
The motivation underlying the Regression T h e o r e m is t h a t by successively applying the regression operator to the goal statement G(s), we can obtain an equivalent expression, Γ ο ( 5 ο ) ν · · · V T n ( S o ) , t h a t mentions only the initial state instead of the s t a t e variable s, and t h a t this regressed expression will be entailed by those axioms of Τ other t h a n the successor state and action
Reiter
376
precondition axioms. T h e intuition is t h a t the successor s t a t e and action precondition axioms will have done their job through their contribution to the regression; they should have no further role to play in proving the formula Γ ο ( 5 ο ) V · · · V Γ η ( 5 ο ) . Unfortunately, this intuition is false.
Example Suppose Τ contains unique names axioms for states together with the following two successor s t a t e axioms and single action precondition axiom:
Poss(a,s)
D P(do(a,s))
= D(s),
Poss(a,s)
D Q(do(a,s)) = E(s),
true D Poss(A, s). Suppose Τ also contains an initial s t a t e axiom Ε (So), and a general axiom Q(s) D P(s). Consider the goal (3s)P(s) A ex(s). T h e n Γ 0 ( 5 0 ) V Γ ι ( 5 0 ) is (after some slight simplification) P(S0) V D(S0), and T \= P(S0) V D(S0); but
E(50),
Q(s)DP(s)£P(So)VD(So).
So it appears t h a t , even after regressing a goal formula, the successor state and action precondition axioms cannot be discarded. This observation leads to the natural question: under what conditions c a n these axioms be discarded without sacrificing the completeness of goal regression? In other words, under what conditions will
Τ |= (3s)G(s) A ex(s) iff for some η, Γ 0 ( 5 ο ) V · · · V Γ η ( 5 ο ) is entailed by Τ without the successor state and action precondition axioms? T h e rest of this section is devoted to answering this question.
Definition: The s-Admissible Sentences A sentence is s-admissible iff it mentions no s t a t e variable at all, or it is of the form ^fs)W(s) where s is a s t a t e variable, and W(s) is simple wrt s. The s-admissible sentences are meant to define a sizable class of general facts t h a t can serve as domain-specific background knowledge.
Examples Unique names axioms for actions are s-admissible. So are:
holding(R, B, SO), (Vs, r, x)holding(r, x, s) D ^ontable(x, 5 ) ,
The Frame Problem in the Situation Calculus So) Λ color(x, Red, s),
(Vs)(3x)ontable(x, (Vs,
377
a)s φ So Λ s φ do(a, S0)
Λ
P(s) D Q(s),
The following are not s-admissible:
(Vs,x)ontable(x,s)
f
f
(Vs )color(x,Red,s ),
D
(3s)ontable(B,
s),
(Vs)(Vx,r)holding(r,x,do(pickup(r,x),s))
D col or (x, Red, s),
So) Λ (Vs)s φ So D ->ontable(x, s).
(3x)ontable(x,
Definition: Closure under Regression Suppose T Ç C contains a successor s t a t e a x i o m for each fluent of C, and an action precondition a x i o m for each action function of C. Suppose S is
a set of s-admissible sentences of £ . Then S is closed under regression wrt Τ
iff whenever (Vs)W(s)
G S,
S f= ( V « , a ) 2 V ( a , * ) D
TlT{W{do{a,s))).
Theorem 7 (Soundness and Completeness of Regression) Suppose Τ = { ex-ax} U Τ88 U T a v U TUns U ^Ve Ç £ , w/iere ex-ax is the executability axiom, T88 is a set of successor state axioms, one for each fluent of C, Fap is a set of action precondition axioms, one for each action function of C, Tuns is the set of unique names axioms for states, and is a set of s-admissible sentences that is closed under regression wrt Τ. Suppose that G(s) G C has as its only free variable the state variable s, and that G(s) is simple wrt s. Then Τ f= (3s)G(s) Λ ex (s) iff for some η J~uns U ^ V s ( = Γ 0 ( 5 ο ) ν · · · v r n ( 5 0 ) . To see what the requirement t h a t Fy8 be closed under regression means, consider a sentence (Vs)W(s)
G Τ\/8.
Regardless of whether or not Fy8
is
closed under regression wrt T, it is possible t o prove Τ
(= (Vs,
a)VT{a,
s) D 1ljr[W(do(a,
s))].
This new sentence is s-admissible. If T\i8 is indeed closed under regression, it entails this sentence.
In other words, Ty8
completely captures all of
Reiter
378
the s-admissible facts about the domain embodied in the larger theory Τ. This natural requirement is sufficient t o guarantee the completeness of goal regression for plan synthesis. Theorem 7 also provides an important relative consistency result.
Corollary 3 (Consistency) Suppose Τ satisfies the conditions of Theorem 7. Then Τ is satisfiable iff Tun8 U T\is is.
5
Discussion
We have proposed a solution t o the frame problem in the situation calculus for the special case of worlds for which the effects of all actions on all fluents are determined. T h e resulting axiomatization has a very simple form permiting an analysis of goal regression for plan synthesis. For such axiomatizations, we have proved the soundness and completeness of regression, as well as a relative consistency theorem. T h e ideas of this chapter c a n be extended in several ways: 1. Composite actions are sequences of primitive actions. For any such composite action, we wish t o determine the action precondition and successor state axioms for each fluent. It turns out (Reiter [8]) t h a t these axioms can be characterized in terms of the regression operator, which also provides a means for computing them. It is also possible t o prove various properties of composite actions, e.g., equivalence, impossibility, e t c . 2. In the theory of databases, t h e evolution of a database is determined by transactions, whose purpose is t o update t h e database with new information. F o r example, in an educational database, there might be a transaction specifically designed t o change a student's grade. This would normally be a procedure which, when invoked on a specific student and grade, first checks t h a t t h e database satisfies certain preconditions (e.g., that there is a record for the student, and t h a t t h e new grade differs from the old), and if so, records the new grade. Any a t t e m p t t o formalize the effects of transactions immediately encounters the frame problem. Thus, in the example, it would be necessary t o s t a t e t h a t the grade-changing transaction does not affect a teacher's salary. In this setting, the situation calculus provides an ideal vehicle for representing states of the database; transactions then correspond exactly t o actions. Since for databases (unlike the "real" world) the effects of all transactions on all database relations will be known, the assumptions underlying our solution t o the frame problem are justified. It follows t h a t t h e axiomatization of this chapter provides a specification for database updates, and t h a t
The Frame Problem in the Situation Calculus
379
T h e o r e m 2 yields a sound and complete query evaluation mechanism for databases after arbitrary updates. A companion paper (Reiter [7]) will describe in greater detail how the formalism described here characterizes update transactions in databases.
Acknowledgments Many people helped out on this one. My thanks to Leo Bertossi, Charles Elkan, J o e Halpern, Hector Levesque, Vladimir Lifschitz, W i k t o r Marek, Alberto Mendelzon, J o h n Mylopoulos, Javier Pinto, and L e n Schubert for comments and suggestions in connection with these ideas.
Afterword Writing this chapter for J o h n M c C a r t h y ' s festschrift was particularly rewarding for me because its subject draws on some of his earliest and most fundamental research in AI. T h e very idea of using logic as a knowledge representation language, and the situation calculus itself, stem from John's 1959 "Programs with C o m m o n Sense." This was among the first papers in the field, and it remains the most influential of those early papers. T h e frame problem also has a long (for A I ) history. If AI can be said to have a classic problem in the way t h a t , say, Hubert's tenth problem was for mathematics, then the frame problem is it. W e really should be calling it M c C a r t h y ' s (first?) problem, since it is so strongly associated with his name. Like all good open problems, it is subtle, challenging, and it has led to significant new technical and conceptual developments in the field. Indeed, it was one of the most important motivating factors in the development of nonmonotonic reasoning, including John's own circumscription theory. So on this occasion I a m especially gratified t h a t my contribution to John's festschrift can be seen as a continuation of the research tradition that began with his 1 9 5 9 paper, and t h a t it addresses a problem t h a t has informed much of his distinguished career. Someone once asked J o h n — I forget the circumstances—when AI will achieve its goals. His answer was "sometime between four and four hundred years." However a c c u r a t e this prediction might be, one thing is certain: without John's contributions to the field, we would have a much longer wait.
References [1] K . L . Clark. Negation as Failure. In H. Gallaire and J . Minker, editors,
Reiter
380
Logic and Data Bases, pages 2 9 2 - 3 2 2 . Plenum Press, New York, 1 9 7 8 . [2] C. C. Green. T h e o r e m Proving by Resolution as a Basis for QuestionAnswering Systems. In Β . Meitzer and D. Michie, editors, Machine Intelligence 4, pages 1 8 3 - 2 0 5 . American Elsevier, New York, 1 9 6 9 . [3] A. R . Haas. T h e Case for Domain-Specific F r a m e Axioms. In F . M.
Brown, editor, The frame problem in artificial intelligence. Proceedings of the 1987 workshop, pages 3 4 3 - 3 4 8 , L o s Altos, California. Morgan Kaufmann Publishers, Inc., San Mateo, California, 1 9 8 7 . [4] J . McCarthy. Epistemological Problems of Artificial Intelligence.
In
Proceedings of the Fifth International Joint Conference on Artificial Intelligence, pages 1 0 3 8 - 1 0 4 4 , Cambridge, M A , 1 9 7 7 . [5] J . M c C a r t h y and P. Hayes. Some Philosophical Problems from the Standpoint of Artificial Intelligence. In B . Meitzer and D. Michie, editors, Machine Intelligence 4, pages 4 6 3 - 5 0 2 . Edinburgh University Press, Edinburgh, Scotland, 1 9 6 9 . [6] E . P . D . Pednault. A D L : Exploring t h e Middle Ground between S T R I P S a n d the Situation Calculus. In R . J . B r a c h m a n , H. Levesque,
and R . Reiter, editors, Proceedings of the First International Conference on Principles of Knowledge Representation and Reasoning (KR'89), pages 3 2 4 - 3 3 2 . Morgan Kaufmann Publishers, Inc., San Mateo, California, 1 9 8 9 . [7] R . Reiter. On Database Updates. Technical report, Department of Computer Science, University of Toronto, in preparation. [8] R . Reiter. A Simple Solution t o the F r a m e Problem (Sometimes). Technical report, Department of Computer Science, University of Toronto, in preparation. [9] L . K . Schubert. Monotonie Solution of the F r a m e Problem in the Situation Calculus: an Efficient Method for Worlds with Fully Specified Actions. In H . E . Kyberg, R . P . Loui, and G.N. Carlson, editors, Knowl-
edge Representation and Defeasible Reasoning, pages 2 3 - 6 7 . Kluwer Academic Press, Boston, Mass., 1 9 9 0 . [10] R . Waldinger. Achieving Several Goals Simultaneously. In E . Elcock and D. Michie, editors, Machine Intelligence 8, pages 9 4 - 1 3 6 . Ellis Horwood, Edinburgh, Scotland, 1 9 7 7 .