Reasoning about Action and Change Using Dijkstra's ... - IJCAI

2 downloads 0 Views 329KB Size Report
Yet, it deals with a broad class of actions, including those with random and indirect effects. Also, both temporal pre- diction and postdiction reasoning tasks can ...
Reasoning about A c t i o n and Change Using Dijkstra's Semantics for P r o g r a m m i n g Languages: Preliminary Report* W i t o l d Lukaszewicz and E w a M a d a l i r i s k a - B u g a j Institute of Informatics, Warsaw University Banacha 2, 02-097 Warsaw, POLAND [email protected], [email protected] Abstract We apply D i j k s t r a ' s semantics for p r o g r a m m i n g languages to f o r m a l i z a t i o n of reasoning about action and change. T h e basic idea is to view actions as f o r m u l a transformers, i.e. functions f r o m f o r m u l a e i n t o formulae. T h e m a j o r advantage of our proposal is t h a t it is very simple and more effective t h a n most of other approaches. Y e t , it deals w i t h a broad class of actions, i n c l u d i n g those w i t h r a n d o m and indirect effects. A l s o , b o t h t e m p o r a l pred i c t i o n and p o s t d i c t i o n reasoning tasks can be solved w i t h o u t restricting i n i t i a l nor final states to completely specified.

1

Introduction

We a p p l y D i j k s t r a ' s semantics for p r o g r a m m i n g languages [ D i j k s t r a , 1976; D i j k s t r a and Scholten, 1990] to f o r m a l i z a t i o n of reasoning about action and change. The basic idea is to specify effects of actions in terms of formula transformers, i.e. functions f r o m formulae i n t o formulae. M o r e specifically, w i t h each action A we associate t w o f o r m u l a transformers, called the strongest postcondition for A and t h e weakest liberal precondition for A. The former, when applied to a f o r m u l a a, returns a formula representing t h e set of all states t h a t can be achieved by s t a r t i n g execution of A in some state satisfying a. The latter, when applied to a f o r m u l a a, returns a formula p r o v i d i n g a description of all states such that whenever execution of A starts in any one of t h e m and terminates, the o u t p u t state satisfies a . 1 T h e idea of e m p l o y i n g f o r m u l a transformers to specify effects of actions is n o t new in the AI literature. W a l d i n g e r [1977], in the context of S T R I P S system [Fikes a n d Nilsson, 1971], introduces a notion of a repression operator w h i c h corresponds closely to the weakest p r e c o n d i t i o n t r a n s f o r m e r . Pednault [1986; 1988; *This research was supported in part by the ESPRIT Basic Research Action No. 6156 - DRUMS II and by KBN grant 3 P406 019 06. 1 We do not use the weakest precondition transformer (wp) which plays a prominent role in reasoning about programs. The reason is that, in general, the wp transformer is slightly too strong for our purposes.

1950

TEMPORAL REASONING

1989] employes regression operators for p l a n synthesis. In [Pednault, 1986] a n o t i o n of progression operator, corresponding to D i j k s t r a ' s strongest p o s t c o n d i t i o n , is introduced and analysed. Formula transformers approach to reasoning about action and change has one m a j o r advantage and one m a j o r weakness when compared to purely logical formalisms such as S i t u a t i o n Calculus [Hayes and M c C a r t h y , 1969; Lifschitz, 1988; Lifschitz and R a b i n o v , 1989; Gelfond et a/., 1991; Baker, 1991] or Features and Fluents [Sandewall, 1994]. On the positive side, describing effects of actions in terms of f o r m u l a transformers decreases comp u t a t i o n a l complexity. T h e price to pay for it is the loss of expressibility. Our proposal combines c o m p u t a t i o n a l effectiveness w i t h expressibility. A l t h o u g h not so expressible as Situation Calculus or Feature and Fluents, the formalism specified here allows to deal w i t h a b r o a d class of actions, including those w i t h r a n d o m and indirect effects. Also, b o t h t e m p o r a l prediction and p o s t d i c t i o n reasoning tasks can be solved w i t h o u t r e s t r i c t i n g i n i t i a l nor final states to completely specified. 2 The paper is organized as follows. Section 2 is a brief i n t r o d u c t i o n to D i j k s t r a ' s semantics for a simple prog r a m m i n g language. In section 3, we o u t l i n e a general procedure to define action languages using D i j k s t r a ' s methodology, illustrate this procedure by specifying a simple " s h o o t i n g " language, and i n t r o d u c e a n o t i o n of an action scenario. Section 4 defines the k i n d of reasoning we shall be interested i n , and provides a simple method of realizing this type of inference. In section 5, we illustrate this m e t h o d by considering a number of examples, well-known f r o m the AI l i t e r a t u r e . Section 6 is devoted to actions w i t h i n d i r e c t effects. F i n a l l y , section 7 contains discussion and ideas for f u t u r e w o r k . For lack of space, we o m i t proofs of the results provided here. T h e f u l l version of the paper is available in p u b / p a p e r s / C R I T / D i j k s t r a / i j c a i 9 5 . p s by anonymous ftp to ftp.mimuw.edu.pl. 2

This paper is part of a general programme of applying Dijkstra's approach to reasoning about action and change. In [Lukaszewicz and Madalinska-Bugaj, 1994], we used this methodology to formalize deterministic actions without indirect effects. In [Lukaszewicz and Madaliriska-Bugaj, 1995], we combined Dijkstra's semantics w i t h Reiter's default logic to deal with actions where abnormal effects are allowed.

2

I n t r o d u c t i o n to Dijkstra's semantics

In [ D i j k s t r a and Scholten, 1990] we are provided w i t h a simple p r o g r a m m i n g language whose semantics is specified in t e r m s of f o r m u l a trasformers. More specifically, w i t h each c o m m a n d 5 there are associated three such transformers, called the weakest precondition, the weakest liberal precondition and the strongest postcondition, denoted by wp.S, wlp.S and sp.S, respectively. Before p r o v i d i n g the m e a n i n g of these transformers, we have to make some r e m a r k s and introduce some terminology. We assume here t h a t the p r o g r a m m i n g language under consideration contains one type of variables only, namely Boolean variables. T h i s assumption may seem overly restrictive, b u t no other variables w i l l be needed for our purpose.

5

The original Dijkstra's language contains abort command and iterative commands as well, but they are not needed for our purpose. 6 In what follows, we do not specify the wp formula tranformers for the considered language, because they will not be needed in the sequel. 7 Note that when more than one of B, is true, the selection of a command to execute is nondeterministic.

LUKASZEWICZ AND MADALINSKA-BUGAJ

1951

3

A c t i o n languages and action scenarios

To define an action language one proceeds in three steps. (1) F i r s t , we choose an assertion language to represent the effect of actions. T h e " s h o o t i n g language" we use in the sequel uses two Boolean variables: a and /, standing for alive and loaded, respectively. To be in accord w i t h the AI terminology, these variables w i l l be referred to as fluents. (2) The next step is to provide action symbols representing the actions under consideration. In the shooting language we have four such symbols: load (a g u n ) , wait, spin (a chamber) and shoot (a t u r k e y ) . T h e i n t e n t i o n is t h a t load makes the g u n loaded, wait does n o t cause any changes in the w o r l d , the effect of spin is t h a t r a n d o m l y the gun is loaded or n o t after the a c t i o n , regardless of whether it was loaded before or n o t , and shoot makes the gun unloaded and the t u r k e y dead, provided t h a t the gun was loaded before.

1952

TEMPORAL REASONING

LUKASZEWICZ AND MADALINSKA-BUGAJ

1953

6

Ramification problem

The ramification problem concerns efficient representa­ tion of the indirect effects of actions. In this paper we limit ourselves to the simplest class of ramifications, namely those introduced by domain constraint axioms. The domain constraint axioms describe general facts that are assumed to hold in any state of the dynami­ cally changing world under consideration. If α is such an axiom, then some fluents occurring in α may change their values even if these fluents are not included in the action's description. Consider, for instance, the Yale Shooting Scenario, augmented with the domain con­ straint axiom where d stands for dead. Given this axiom, the action shoot makes the turkey not only not alive, but also dead (provided, of course, that the gun is loaded). Clearly, when the domain constraint axioms are in­ volved, a scenario should not be regarded as representing the class of computations initially a and finally B under control of A1...; An, but rather as the class initially a, finally (3 and always under control of , where is the conjunction of all domain constraint axioms associated with the scenario. Unfortunately, changing the class of computations only is not always sufficient to properly deal with the domain constraint axioms. To see why, consider an illustrating example. E x a m p l e 4 Consider the shooting language supplied with a new fluent w, standing for walking. Let DC be a domain constraint axiom given by . Let WSS be the scenario . The intended conclusion is that the turkey is not alive and not walking in the final state. We calculate:

The description of the final state is inconsistent. ■ The inconsistency we have arrived at is due to the fact that the fluent w obeys the law of inertia. In our approach, all fluents that are not explicitly affected by an action retain their values when the action is performed. While this is a nice property from the standpoint of the frame problem, it leads to some difficulties when actions with indirect effects are involved. To deal with domain constraint axioms, we need a mechanism which, for a given action A, releases chosen fluents from obeying the law of inertia when the action A is executed. Fortunately, the release mechanism can be easily implemented in our formalism. Suppose that f 1 , . . . , / „ are fluents which are to be released during executing an action A. To achieve the desired effect, A should be replaced by A; releaee(f1);...; release(fn) where release(fi) is the command 14

The release pseudo-command corresponds closely to

1954

TEMPORAL REASONING

[Fikes and Nilsson, 1971] R. E. Fikes and R. E. Nilsson. S T R I P S : A new approach to the a p p l i c a t i o n of theorem p r o v i n g to p r o b l e m s o l v i n g " . Artificial Intelligence, 2 ( 3 - 4 ) : 189-208, 1971. [Gelfond et al., 199l] M. G e l f o n d , V. Lifschitz and A. Rabinov. W h a t are the l i m i t a t i o n s of s i t u a t i o n calculus? In Proc. AAAI Symposium of Logical Formalization of Commonsense Reasoning, Stanford, 55-69, 1991. [Hanks and M c D e r m o t t , 1987] S. Hanks and D. McDerm o t t . Nonmonotonic Logic and T e m p o r a l Project i o n . Artificial Intelligence, 33(3):379-412, 1987.

7

Conclusions

We have applied D i j k s t r a ' s semantics for programming languages to f o r m a l i z a t i o n of reasoning about action and change. We believe t h a t the results reported here are interesting and w o r t h of further investigation. The presented approach can be employed to represent a broad class of action scenarios, i n c l u d i n g those where actions w i t h r a n d o m and indirect effects are p e r m i t t e d . In add i t i o n , b o t h t e m p o r a l prediction and postdiction tasks can be p r o p e r l y dealt w i t h , w i t h o u t requiring i n i t i a l or final s i t u a t i o n s to be completely specified. The major advantage of our proposal is t h a t it is very simple and more effective t h a n many other approaches directed at f o r m a l i z i n g reasoning about action and change. As we r e m a r k e d earlier, recent work of Sandewall [1994] provides a very general framework to study logics of action and change. Obviously, the question of how our proposal fits in this framework should be investigated and w i l l be pursued in the future. It is also interesting to compare our approch w i t h ARo language introduced recently by K a r t h a and Lifschitz [1994]. T h e task of. i m p l e m e n t a t i o n is another point of interest. C a l c u l a t i n g DSk(SC), for a given scenario SC, amounts to simple syntactic manipulations on formulae and can be performed very efficiently. T h e only comput a t i o n a l p r o b l e m is to determine whether a given formula can be derived f r o m the description of the state under consideration. T h i s task can be realized by a theorem prover a p p r o p r i a t e for the logic in which the effects of actions are described.

Acknowledgements W e w o u l d like t o t h a n k W l a d y s i a w M . T u r s k i , Wiodek D r a b e n t and A n d r z e j Szalas for their comments on the previous d r a f t of this paper.

References [Baker, 1991] A. B. Baker. Nonmonotonic reasoning in t h e f r a m e w o r k of the s i t u a t i o n calculus. Artificial Intelligence, 49(5):5-23, 1991. [ D i j k s t r a , 1976] E. W. D i j k s t r a . A gramming, Prentice H a l l , 1976.

Discipline

of Pro-

[ D i j k s t r a and Scholten, 1990] E. W. D i j k s t r a and C. S. Scholten. Predicate Calculus and Program Semantics, Springer-Verlag, 1990.

[Hayes and M c C a r t h y , 1969] J. M c C a r t h y and P. J. Hayes. Some philosophical problems f r o m the standpoint of artificial intelligence. In Machine Intelligence 4. B. Meltzer and D. Michie (eds.), 1969, 463502. [Kartha and Lifschitz, 1994] G. N. K a r t h a and V. Lifschitz. Actions w i t h indirect effects ( p r e l i m i n a r y report). In Proc. KR-94, B o n n , Germany, Morgan K a u f m a n n Publishers, San Francisco, 341-350, 1994. [Lifschitz, 1988] In Readings berg (ed.), A l t o , 35-57,

V. Lifschitz. F o r m a l theories of action. in Nonmonotonic Reasoning, M. GinsMorgan K a u f m a n n Publishers, Palo 1988.

[Lifschitz and Rabinov, 1989] V. Lifschitz and A. R a b i nov. Miracles in formal theories of action. Artificial Intelligence, 38(6):225-237, 1989. [Lukaszewicz and Madaliriska-Bugaj, 1994] W. Lukaszewicz and E. Madaliriska-Bugaj. P r o g r a m verification techniques as a t o o l for reasoning about action and change. In Proc. of German Al Conference (KI-94)- Lecture Notes in A r t i f i c i a l I n t e l l i gence, 8 6 1 , Springer-Verlag, 226-236, 1994. [Lukaszewicz and Madaliriska-Bugaj, 1995] W. Lukaszewicz and E. Madaliriska-Bugaj. Reasoning about action and change: actions w i t h a b n o r m a l effects. Submitted t o German A l Conference, K I - 9 5 . [Pednault, 1986] E. P.D. Pednault. T o w a r d a m a t h e m a t ical theory of plan synthesis. P h . D. Thesis, Dept. of Electrical Engineering , Stanford University, Stanford, 1986. [Pednault, 1988] E. P. D. Pednault. Synthesizing plans t h a t contain actions w i t h contex-dependent effects. Computational Intelligence, 4:356-372, 1988. [Pednault, 1989] E. P. D. Pednault. A D L : E x p l o r i n g the middle ground between S T R I P S and the s i t u a t i o n calculus. In Proc. KR-89, 324-333, 1989. [Sandewall, 1994] E, Sandewall. Features and Fluents: The Representation of Knowledge about Dynamical Systems, O x f o r d Science Publications, Clarendon Press, O x f o r d , 1994. [Waldinger, 1977] R. Waldinger. A c h i e v i n g several goals simultaneusly. In Machine Intelligence 8. E. Ellock and D. Michie (eds.), Ellis H o r w o o d , E d i n b u r g h , 94-136.

LUKASZEWICZ AND MADALINSKA-BUGAJ

1965