Reasoning about Fluents in Logic Programming - Semantic Scholar

2 downloads 0 Views 331KB Size Report
original chronicle where Law and Scd are merged in a new set of statements called Law Scd]. ... whose result is randomly yielding either a loaded or an unloaded gun (e.g. the ..... Hyp( ) = ff s1; t1]P re1 ) f1 := w1;:::; sn; tn]P ren ) fn := wng j.
Reasoning about Fluents in Logic Programming Vincenzo Pallotta Theoretical Computer Science Laboratory (LITH) Swiss Federal Institute of Technology - Lausanne (EPFL) IN-F Ecublens 1015 Lausanne Tel. +41-21-6935297 Fax. +41-21-6935278 [email protected]

Abstract Fluent Logic Programming (FLP) is an attempt to suitably combine into a simple

language ideas coming from well known temporal reasoning frameworks like Kowalski's Event Calculus and Sandewall's Features and Fluents. In this paper we propose the core syntax of FLP together with two complementary semantics. The rst one is a x-point semantics which declaratively captures the operational notion of Ego-World game originally proposed by Sandewall to characterize intended temporal models of scenario descriptions. The second is based on a meta-logical translation of FLP programs (FLP-chronicles) into normal logic programs and their meta-level execution by means of a multi-theory meta-interpreter.

1 Introduction It is apparent that temporal reasoning plays a central role in the task of qualitative modeling of dynamical systems. Reasoning about the evolution of dynamical system means extracting some relevant information about its state at a certain time point. Qualitative reasoning about dynamical systems has been one of the most important eld in Articial Intelligence research since 1950's. Many dierent approaches have been proposed as partial solutions. Only in recent years there has been a trend to pull together all the results of the distinct research activities in the areas of temporal reasoning, qualitative reasoning, knowledge-based planning and modelbased diagnosis and develop general frameworks in which they can be interpreted. An overview about the general concepts and the historical developments is given in [SS94]. However, in analyzing the literature in the eld of reasoning about action and change (RAC), we found out that there are only few attempts to provide additional constructs for temporal reasoning within a logic programming (LP) setting. Many extensions have been proposed for limiting the validity of clauses to given time periods, like templog and temporal PROLOG. Another example is given by the extension of logic programming proposed in [MRT97] in the style of valid time in temporal databases where temporal information represents the validity period of a fact. We desire, instead, an explicit representation of time and of what happens over the time. In order to perform some ecient automated reasoning, only the strictly necessary information about relevant events causing the system evolution is maintained. We focused in our work on two important frameworks (e.g. Event Calculus (EC) and Features & Fluents (F&F)) for describing and reasoning about action and change which have been conceived bearing in mind the above principle. They may seem to be apparently distant but they can be essentially narrowed into a unique framework. In this paper, we summarize how it is possible to integrate Erik Sandewall's Features & Fluents discrete features logic (DFL) and the Kowalski-Sergot's Event Calculus within a logic programming setting making use of meta-logical techniques. As a result of this attempt we obtain the

denition of an extended LP-based language that we call Fluent Logic Programming (FLP) which roughly combines the DFL syntax with the semantics of EC. The semantics of FLP is formally presented in two complementary ways, namely by means of a x-point semantics and of a meta-logical semantics. The rst one is based on the notion of an immediate consequence operator which is used to compute the least upper bound of a complete partial order over possible interpretations, while the second is based on a multi-theory vanilla meta-interpreter capable of dealing with normal logic programs expressions like those treated in [BCT97] (e.g. using union, intersection, etc.). Within this formal setting we are able to design a proof-system for doing eective non-monotonic temporal reasoning about action and change. FLP can be also considered as a proposal for a general framework for reasoning about scenario descriptions belonging to the K-ReA class in the Sandewall's taxonomy where the time ontology is of continuous type1 . Completeness of FLP semantics with respect to the Sandewall's original underlying semantics for DFL adapted to FLP and extended to the K-ReA class has been only enunciated in this paper and their proof can be found in [Pal97].

1.1 Event Calculus The event calculus (EC) [KS86,SK95] is a logic programming based formalism for representing and reasoning about events occurring at certain time-points and properties of objects which can persist or change over time. In the most common formulation EC is based on the following ontologies or domains:

 T : the temporal domain, that is an algebraic structure with a linear order relation < and

equality,  F : the properties or features domain,  E : the action tokens or events domain.

A scenario description is presented by dening the following predicates:

   

happens : E  T species the occurrence of an event at a certain time-point, initiates : E  F and terminates : E  F species the eects of the successful execution of a certain action, holdsat : F  T species the truth value of a property at a given time-point.

The core inference engine is based on the denition of the following rule and relies on the interpretation of negation as nite failure [Cla78]: holdsat(F; T )

happens(E; T1 ); clipped(T1; F; T2 ) initiates(E; F ); T1 < T; not clipped(T1 ; F; T ):

happens(E; T ); terminates(E;F ); T1  T; T < T2 :

In the above denition some epistemological and ontological assumptions are made. In our opinion the most remarkable are the following: 1

The class K-ReA is the extension to continuous time of the K-IeA class treated in Features & Fluents. All the details of this extension are considered in [Pal97]. The K-RACi class of scenario description (of whom K-ReA is actually a sub-class) has been formally dened by Brandano in [Bra98,Bra99]. He also provides an abductive meta-logical semantics for his own extension of DFL language. Compared to Brandano's work we take a rather minimalist approach in the sense that we take from Features & Fluents only basic ideas and a core syntax for our Horn-like language.

 only instantaneous actions  non-determinism is not treated adequately  no partial knowledge and no temporal post-diction. However there are several successful attempts in order to overcome these problems proving the great exibility of this formalism. Nevertheless EC is one the main reference for the development of our work since it has a simple and powerful proof-theory directly expressible as general logic programs.

1.2 Features & Fluents Features & Fluent is a logical framework proposed by Erik Sandewall in [San94] for doing qualitative temporal reasoning about dynamical systems and it represents a systematic framework in which qualitative scenario descriptions, the so called inhabited dynamic systems (IDS) have been classied into a taxonomy in which epistemological and ontological assumptions are used to asses adequacy of proposed computational reasoning techniques. An inhabited dynamical system (IDS) is formalized by Sandewall as a game between two players: an Ego (e.g. the agent) and a World (e.g. the environment). The syntax of discrete uent logic (DFL) on which FLP is based makes use of the following categories for representing scenario description (e.g. chronicles ):

Features A feature f is a rst order term which denotes a property of a class of objects that constitute an IDS (e.g. color(traffic_light_#1)), that is a function from the object domain O to the set of feature values V . With V (f ) we denote the codomain of f that is the set of all possible values for the feature f (e.g. V (color(X )) = fred; yellow; greeng)2 . Fluents A uent [t]f is a rst order term which represents a function from time-points to corresponding feature values, and it can be thought of as the trace over time of a particular feature. Actions An action occurrence [s; t]a happens over an interval of time [s; t] through the intervention of an agent and the action designators domain is denoted by E .

At the semantic level the models of chronicles are represented by histories , that is a partial function R : T  F ! V where T is the time domain, F is the features domain and V is the feature-values domain. If a specic feature f is chosen, then the resulting function of time R(f ) : T ! V is a uent. Similarly, if a specic time-point t is chosen, then the function obtained R(t) : F ! V is a state. The way the history is gradually extended by the EgoWorld game is specied by a system of rules for the World, coded by a so called underlying encapsulated semantics. The set of possible histories for a chronicle  represents the set of its intended models and it is denoted by K?ReA ( ) if the chronicle  belongs to the K-ReA class in the Sandewall's taxonomy. This concise and informal introduction to Features & Fluents framework aims to give an intuition of its underlying basic ideas. In the rest of the paper we will make use of individuals from the above syntactical and semantical domains without directly referring to their original meaning even if a strong relation may be apparent. 2

In the special case of an implementation in logic programming, features can be considered rst as order terms and feature values as nite sets of ground constants.

2 Fluent Logic Programming Fluent logic programming (FLP) is a slightly modied fragment of Sandewall's DFL. Since we want this language to be eectively implemented, a natural choice is to turn the original full rst order predicate calculus language into a Horn clause-like one. In a constraint logic programming setting [JL87], the time structure T can be considered as the constraint domain over real numbers (CLP(R)).

Denition 1. An FLP-chronicle  is a collection of statements of the following categories:  Law action laws that is statement of either two forms: [S; T ]a V (f = v ; : : : ; fn = vn) ) f := v [S; T ]a V (f = v ; : : : ; fn = vn) ) f := [w ; : : : ; wk ]  Scd action occurrences, that is statements of the form: [s; t]a  Obs observations of the form: [t]f = v 1

1

1

1

1

where a 2 E , f; f1 ; : : : ; fn 2 F , v; v1 ; : : : ; vn ; w1 ; : : : ; wk 2 V , s; t 2 T and S; T are variables ranging on T .

We have used the meta-symbols a for denoting an action instance, f; f1 ; f2 ; : : : for denoting feature names, v; v1 ; : : : ; vm and w1 ; : : : wk for denoting feature values and s; t for temporal constants in the time structure T . Actions, features and feature values are rst order terms while the time structure T is essentially (R+ ; ). As usual capital case is used for logic programming variables. We can partition each FLP-chronicle  into three subsets:  = Law [ Scd [ Obs3 . The intuitive reading is that given an instance of an action [s; t]a in Scd, the action a is performed during the time interval [s; t]. The actions laws in Law represent the pre-conditions and the eects of action occurrence. Pre-conditions are expressed as a conjunction of equalities to be checked at the starting time-point of the action duration interval. Eects are expressed as assignments (e.g. using the symbol  :=) of one or more feature values to a feature4 . If there exists an action law in Law whose head unies (on the left of the symbol  V) with an action occurrence, we can simply replace it with the body of the action law (on the right of the symbol  V), substituting the variables with the terms occurring in the action occurrence. Applying this unfolding step to each action in Scd we obtain an expanded version of the original chronicle where Law and Scd are merged in a new set of statements called Law[Scd]. Each action instance [s; t]a is then rewritten according to the matching action law in the form:

[s; t](f = v ; : : : ; fn = vn) ) f := v 1

1

or in the non-deterministic case:

[s; t](f = v ; : : : ; fn = vn) ) f := [w ; : : : ; wk ]: 1

3 4

1

1

With abuse of notation we denote sets of statements with their corresponding syntactical category. In F&F, DFL statements are fully translated into rst order logical formulae. The expression [;  ]f :=  is translated into 8t 2 (;  ] : Xf ^ [t]f 2  where  is a set of feature values and X is the occlusion operator which is used in the frame axioms to prevent inference about feature's value during its changing period. We will consider the := operator as a syntactic constructor. 0

0

During the the period of time in which the action is executed, the value of the aected feature is undened. The set of observation statements Obs is used to assert constraints to the scenario. It is assumed that the dynamical part of the chronicle (i.e. Law and Scd) must be consistent with the observations (e.g. epistemological designator K in the class K-ReA). Observe that the above notation for FLP-statements is only syntactic sugar and FLPchronicles can be rewritten as sets of multi-sorted rst order predicate logic formulas. For the details of how this applies to DFL see the Sandewall manuscript [San94] where logical intended models are characterized by minimization policies of classical logical models (e.g. using the notion of preferential entailment [Sho89,SS94]). Viewing FLP as logic programming based language we do not assume any additional interpretation of terms in a FLP-chronicle (e.g. actually a rst order theory) which are all members of its corresponding Herbrand Base. For example we can see how the famous Yale Shooting Problem [HM86,HM87] can be coded as a FLP-chronicle. Example 1 (Yale Shooting Problem Chronicle). Y SP = Law [ Scd [ Obs where HBY SP  O [ V [ F [ E and O = fturkey; gung V = ftrue; falseg F = falive(turkey); loaded(gun)g E = fload(gun); fire(gun; turkey)g

Obs = f [0]alive(turkey) = true:

loaded(gun) = false:g

[0]

Scd = f [2; 4]load(gun):

; fire(gun; turkey):g

[10 12]

Law = f [S; T ]load(X ) V loaded(X ) := true:

S; T ]fire(X; Y ) V (loaded(X ) = true) ) alive(Y ) := false: S; T ]fire(X; Y ) V (loaded(X ) = true) ) loaded(X ) := false:g:

[

[

We can also have non-deterministic actions like the one of spinning the chamber of the gun whose result is randomly yielding either a loaded or an unloaded gun (e.g. the Russian Turkey Scenario proposed in [San94]). The corresponding FLP action law is: S; T ]spin(X ) V (loaded(X ) = true) ) loaded(X ) := [true; false]:

[

2.1 Fixpoint Semantics Instead of operationally computing the intended models set of a FLP-chronicle  (e.g. FLP ( )) using the Ego-World game simulation based on the encapsulated semantics, K? ReA we now present an alternative x-point semantics that characterizes those models in a declarative manner. The history set over a chronicle  is dened by H = 2H where H = fhf; v; ti j f 2 F ^ v 2 V (f ) ^ t 2 T g and F is the set of features occurring in the chronicle  . Since the time domain is continuous, we do not generate histories extensionally which have a non-countable number of elements (e.g. time-points), but we provide a calculus to compute the value of a feature at a given time-point. In the development of the x-point model we consider histories as sets and we exploit the fact that a continuous domain can be generated by a countable unions of intervals. We start giving the following denitions in order to systematically complete the chronicle representation.

Denition 2 (Initial Observations Completion). Given a FLP-chronicle 

= Law [ Scd [ Obs let

InitObs = f[0; 0]f := v j [0]f = v 2 Obsg

The theory InitObs is used to transform an initial observation (e.g. observation referring to time point 0) into a dummy instantaneous action executed at time point 0. Such dummy action called initially, has no preconditions so it has a direct eect. A FLP-chronicle is transformed into a new completed theory:

Denition 3 (Deterministic Completion).

Given a FLP-chronicle 

= Law [ Scd [ Obs, then  0 =  [ Law[Scd] [ InitObs:

Example 2 (Deterministic completion of YSP).

Y SP 0 = Law [ Scd [ Obs [ Law[Scd] [ InitObs where additionally: InitObs = f [0; 0]alive(turkey) := true: ; loaded(gun) := false:g

[0 0]

Law[Scd] = f [2; 4]loaded(X ) := true:

loaded(X ) = true) ) alive(Y ) := false: loaded(X ) = true) ) loaded(X ) := false:g:

; ;

[10 12](

[10 12](

The x-point semantics for FLP is based on the chronicle rules and on the denition of a bottom-up inertia immediate consequences operator that is intended to capture the intuition of inertia assumption in real dynamical systems as a generalization of the main event calculus inference rule. Denition 4. Given a chronicle  and its deterministic completion  0, we dene: occluded(; f; ; H )  9s ; t ; v 0

0

0

s ; t ](f1 = v1 ; : : : ; fm  2 (s ; t ] ^

: ([

0

0

0

m

^ 0

clipped(; f; t; ; H )  9s ; t ; v 00

00

i=1

00

0

=

00

0

00

m ^

i=1

00

=

vm ) ) f := v ) 2  ^ 00

00

00



fi ; vi ; s 2 H: 00

change(; f; v; ; H )  9s : ([s;  ](f1 = v1 ; : : : ; fm = vm ) ) f := v) 2  ^ 0

m ^

i=1

0



00

00

0

0

fi ; vi ; s 2 H:

s ; t ](f1 = v1 ; : : : ; fm ts ^t t. S  ; v is a complete partial order (cpo) with the empty set considered as ?. The formal denition of the WFH cpo's is provided in [PT98,Pal97].

Lemma 1 (Continuity of I ).

Given a chronicle  , I is a monotonic operator over the cpo S  ; v . Since I is dened by a nite number of nitary conditions6 (i.e the predicates change, occluded and clipped), so it The term occluded has been introduced by Sandewall in the Features & Fluent terminology meaning that the value of a uent is unknown at a given time-point (i.e. is changing during the execution of an action). 6 Conditions are nitary since actions occurrences are ground.

5

is also a continuous operator. Hence there exists its least x point dened by:

inertia( ) = fix(I ) = I! (;) As an example consider again the Yale Shooting Problem. Example 3. Starting from the empty history we have:

IY SP = IY SP (;) = fhalive; true; ti j t 2 [0; 1)g [ fhloaded; false; ti j t 2 [0; 2]g [ fhloaded; true; ti j t 2 [4; 1)g: The second iteration of the IY SP operator nds the preconditions for the action fire veried and removes the subset fhalive; true; ti j t 2 (10; 1)g from the old history, and adds the set fhalive; false; ti j t 2 [12; 1)g. The history restricted to the feature loaded is updated in a 1

similar way. After the second iteration we get:

IY SP = IY SP (IY SP ) = fhalive; true; ti j t 2 [0; 10]g [ fhalive; false; ti j t 2 [12; 1)g [ fhloaded; false; ti j t 2 [0; 2]g [ fhloaded; true; ti j t 2 [4; 10]g [ fhloaded; false; ti j t 2 [12; 1)g 2

1

The two histories are represented by the following diagram: I1 0

I2 0

loaded=false alive=true load

loaded=true

loaded=false alive=true

loaded=true

111 000 000 111 000 2111 4 111 000 000 111 000 2111 4 load

111 000 000 111 000 10111 12 fire

loaded=false alive=false

undefined

Observe that IY1 SP v IY2 SP since they coincide up to time point 4 and IY2 SP adds more information about the result of action re which occurs at a later period (e.g. [10; 12]fire(gun; turkey)). In our case adding information to the history means changing the features values according to the activated action laws and making uents partial for those time points belonging to corresponding action duration intervals. Furthermore IY2 SP is a xpoint for IY SP since no more information will be added during any further iteration. The above denition for the inertia immediate consequence operator deals only with deterministic action laws. A deterministic chronicle has only one intended model (its complete history).

To extend the x-point semantics to non-deterministic chronicles, we generate a set of deterministic histories and make their union in order to obtain the whole set of possible intended models. These histories are obtained using a set of additional chronicle theories called hypothetical theories set (e.g. Hyp( )) in which we have a deterministic theory for each combination of feature assignments taken from the non-deterministic actions. Partial knowledge about the initial state can be considered as a special case of non-determinism where a dummy instantaneous non-deterministic action with no pre-conditions is executed at time-point 0 assigning all possible values to each feature for which there is no initial knowledge. Hyp( ) is further restricted to those theories consistent with observations, obtaining what we denote by Hyp( )jObs .

Denition 5 (Hypothetical theories set). Given a FLP-chronicle 

= hLaw; Scd; Obsi let

InitScd = f[0; 0]initially(f ) j f 2 F ^ [0]f = v 2= Obsg InitLaw = f[s; t]initially(f ) V f := [w1 ; : : : ; wn ] j

f 2 F ^[0]f = v 2= Obs ^fw1 ; : : : ; wn g = V (f )g

and let the expansion of the statements in InitScd w.r.t. InitLaw be: InitLaw[InitScd] = f[0; 0]f := [w1 ; : : : wn ] j f 2 F ^ ^[0]f = v 2= Obs ^fw1 ; : : : ; wn g = V (f )g: The hypothetical theories set is dened by: Hyp( ) = ff[s1 ; t1 ]Pre1 ) f1 := w1 ; : : : ; [sn ; tn ]Pren ) fn := wn g j 8i = 1; : : : ; n : [si ; ti ]Prei ) fi := [v1 ; : : : ; vki ] 2 Law[Scd] [ InitLaw[InitScd]

^

ki _

j =1

wi = vj g

where Prei denotes an action pre-condition of the form

f1i = v1i ; : : : ; fni i = vni i :

The restriction of hypothetical theories to those which are consistent with the observations made after the initial time-point is dened by removing from Hyp( ) those theories which generate histories not containing all the triples hf; v; ti corresponding to observation [t]f = v in Obs.

Denition 6 (Constrained Hypothetical Theories). Hyp( ) jObs = fhyp 2 Hyp( )j8f; v; t > 0 : ([t]f = v 2 Obs ) hf; v; ti 2 inertia( [ hyp)g

The x-point semantics for FLP is dened as the union of deterministic and non-deterministic models.

Denition 7 (Fix-point semantics).

Given a FLP-chronicle  , then:

Comp( ) = finertia( )g [

[

h2Hyp( )jObs

finertia( [ h)g:

As an example of non-deterministic FLP-chronicle we propose a variation of the Yale Shooting Problem called Hiding Russian Turkey Scenario (HRTS ) belonging to the Sandewall's K ? ReA class. We keep the same objects as in YSP, but we add two new features: hiding and deaf , a new action law spin and we modify the action laws for re. Intuitively we combine incomplete knowledge about the initial state with the random results of the re action. Observing the turkey being still alive after the execution of the action re, we have two possible explanations: 1. the turkey was initially not deaf. Even if after the spin action the gun remained loaded, he heard the noise from the load action, hid himself and thus he avoided of being killed; 2. the turkey was initially deaf but he was lucky since the gun became unloaded when it was spinned. Example 4 (Hiding Russian Turkey Scenario).

Obs = f [0]alive(turkey) = true:

loaded(gun) = false: hiding(turkey) = false: [13]alive(turkey ) = true:g

[0]

[0]

Scd = f [2; 4]load(gun):

; spin(gun): ; fire(gun; turkey):g

[5 6]

[10 12]

Law = f [S; T ]load(X ) V (deaf (Y ) = false) )

hiding(Y ) := true: S; T ]load(X ) V loaded(X ) := true: [S; T ]spin(X ) V loaded(X ) = true ) loaded(X ) := [true; false]: [S; T ]fire(X; Y ) V (loaded(X ) = true; hiding (Y ) = false) ) alive(Y ) := false: [S; T ]fire(X; Y ) V loaded(X ) = true ) loaded(X ) := false:g:

[

Now the result of the action re when aecting the feature alive is conditioned by the value of the feature hiding which is set to true when the gun become loaded at the end of the action load provided that the turkey is not deaf. Observing that the turkey is alive at time 13, we would deduce (actually abduce) that he was initially deaf only in the case where the action spin would cause unloading the gun. Our machinery generates only three constrained hypothetical theories, namely: Hyp(HRTS )jObs = f f[0; 0]deaf (turkey) := false; [5:6]loaded(gun) = true ) loaded(gun) := trueg;

f[0; 0]deaf (turkey) := false; [5; 6]loaded(gun) = true ) loaded(gun) := falseg; f[0; 0]deaf (turkey) := true; [5; 6]loaded(gun) = true ) loaded(gun) := falsegg

It is easy to check that both:

9H 2 Comp(HRTS ) : h0; deaf (turkey); truei 2 H 1

and

1

9H 2 Comp(HRTS ) : h0; deaf (turkey); falsei 2 H 2

2

with H1 6= H2 , meaning that the turkey may be initially either deaf or not deaf. The following theorem claims that the x-point semantics for FLP dened as the x-point of I operator is sound and complete w.r.t. the extension of Sandewall's encapsulated semantics to the K ? ReA class of FLP-chronicles. FLP ( ) the set of Theorem 1. Let  = Law [ Scd [ Obs be a FLP-chronicle and let K? ReA

all possible histories computed as result of all possible Ego-World games corresponding to  , then for each feature f 2 F : FLP ( ) : R(f;  ) = v , 9H 2 Comp( ) : hf; ; vi 2 H: 9R 2 K? ReA

Proof. in [Pal97].

As a concluding remark for the x-point semantics for FLP it is worthwhile to note that we do not need to compute hypotheses for a post-dictive explanation since they are already pre-compiled and put into constrained hypothetical theories. This will cause a sensible speed up in the inference process thus avoiding us of using a computationally expensive abductive inference mechanism.

2.2 Meta-logical Semantics In our investigation developed in [Pal97] and summarized in [PT98] we also provide a metalogical semantics for FLP. FLP-chronicles are transformed into normal logic programs [AB94] The meta-representation of a FLP-chronicle  is denoted by ( ) and is compositionally obtained as the union of meta-representations of each single FLP statement belonging to  . Furthermore we add a set of domain rules D characterizing the feature values domain V , a set of completion rules  and a multi-theory vanilla meta-interpreter  (i.e. the demo predicate) [BK82,HG98] augmented by composition operators for logic program expressions [BT95,BCT97] and negation by failure [Cla78]. In order to illustrate how it is possible to map a FLP-chronicle into a set of normal logic programs we come back to the original version of Russian Turkey Scenario 7 . We add to the YSP the action law for spin and a scheduled occurrence action for it. At the end we observe that the turkey is still alive. 7

General transformation meta-rules are not shown here but they can be found in [Pal97,PT98].

Example 5 (Russian Turkey Scenario). RTS = Y SP [ f[S; T ]spin(X ) V (loaded(X ) = true) ) loaded(X ) := [true; false]; [5; 6]spin(gun); [13]alive(turkey ) = trueg

First we have the following domain rules: DHRTS = ffeature(loaded(gun); [true; false]: feature(alive(turkey); [true; false]):

The meta-representation for RTS is obtained as the union of the transformed components (e.g. (RTS ) = (Obs) [ (Law) [ (Scd)) that is:

(Obs) :

([0]loaded(gun) = false) = initially(loaded(gun); false): ([0]alive(turkey) = true) = initially(alive(turkey); true): ([13]alive(turkey) = true) = observe(alive(turkey);true; 13):

(Law) :

([S; T ]load(X ) V loaded(X ) := true:) = fchange(loaded(X ); true; T ) occurs(S; T; load(X ))g: ([S; T ]fire(X; Y ) V (loaded(X ) = true) ) alive(Y ) := false:) =

fchange(alive(Y ); true; T ) success(alive(Y ); S; T; fire(X; Y ))

occurs(S; T; fire(X; Y )); success(alive(Y ); S; T; fire(X; Y )): holds(loaded(X ); S; true); holds(hiding(Y ); S; false):g

([S; T ]fire(X; Y ) V loaded(X ) := false:) = fchange(loaded(X ); true; T ) occurs(S; T; fire(X; Y )); success(loaded(X ); S; T; fire(X; Y ): success(loaded(X ); S; T; fire(X; Y ) holds(loaded(Y ); S; true):g

For the non-deterministic action law spin we have the denition of the ndchange predicate: ([S; T ]spin(X ) V loaded(X ) = true ) loaded(X ) := [true; false]) =

fndchange(loaded(X ); V; [true; false]) success(loaded(X ); S; T; spin(X ))

occurs(S; T; spin(X )); success(loaded(X ); S; T; spin(X )): holds(loaded(X ); S; true):g

(Scd) :

([2; 4]load(gun)) = foccurs(2; 4; load(gun)):g ([5; 6]spin(gun)) = foccurs(5; 6; spin(gun)):g ([10; 12]fire(gun; turkey)) = foccurs(10; 12; fire(gun; turkey)):g

Models of  are computed as the x-point of the Fitting's immediate consequence operator V where V = D [ ( ) [  [  for which SLDNF resolution has been showed to be sound and complete [Fit85,BCT97,AB94]. The core of the inference engine is the union of the two theories initial and inertia, which can be viewed as an extension of the event calculus inference engine proposed in [SK95], where instantaneous events have been replaced by extended duration actions and properties have been generalized by features8 .

Denition 8 (FLP core inference engine).

 = initial [ inertia where

initial  change(F; V; 0)

initially(F; V ):

inertia  holds(F; V; T ) change(F; V; T ): holds(F; V; T ) not occluded(F; T ); change(F; V; T1 ); T1 < T; not clipped(F; T1 ; T ): occluded(F; Tau) occurs(S; T; A); success(F; S; T; A); S < Tau; Tau  T: clipped(F; S; T ) occurs(S1 ; T1 ; A); success(F; S1 ; T1 ; A) S  S1 ; T1 < T:

As a last step we compose the meta-level representation of the theory  , completed by initial and inertia, with each hypothesis in the meta-representation of the hypothetical theory set and we select only those hypotheses which are consistent with all the observations (i.e. generating the constrained hypothetical theories set).

Denition 9 (Hypothetical theories set).

The meta-representation for the hypothetical theories set is dened by: (Hyp( )) = f fchange(f1 ; v1 ; t1 ) .. .

success(f1 ; s1 ; t1 ; act1 ); .. .

change(fn ; vn ; tn ) success(fn ; sn ; tn ; actn )g 8 Properties can considered as a special case of features: boolean valued features.

j 8i = 1; : : : ; n : 9ki  2 : occurs(si ; ti ; acti ): 2 ( ) ^

ndchange(fi ; [v1 ; : : : ; vki ]; S; T; acti ) occurs(S; T; acti ): 2 ( )g:

and for the constrained hypothetical theories we have: (Hyp( )jObs) = fhyp 2 (Hyp( )) j 8observe(f;v; t)n 2 ( ) : 9n < ! : V j=3 demo(( ) [ inertia [ initial [ hyp; holds(f; v; t))g:

Example 6 (Hypothetical theories set for RTS). The only one constrained hypothetical theory obtained from the RTS chronicle will have the following meta-representation: (Hyp(RTS )jObs) = ffchange(loaded(gun); false; 6)

success(loaded(gun); 5; 6; spin):gg

We nally claim that it is possible to obtain proof-theoretically exactly all the intended models (histories) computed by means of the x-point semantics and hence by the Sandewall's encapsulated semantics as stated in the following theorem:

Theorem 2 (Soundness and completeness). Let  = Law [ Scd [ Obs be a FLP-chronicle, ( ) be its meta-level representation, E =  [ inerzia [ initial and V = D [ ( ) [  [ 9 then 9H 2 Comp( ) : hf; v;  i 2 H , 9n < ! : nV j=3 demo(E; holds(f; v;  )) _ 9hyp 2 (Hyp( )jObs) : 9n < ! : nV hyp j=3 demo(E [ hyp; holds(f; v;  )) , V `SLDNF demo(E; holds(f; v;  )): [

Proof. in [Pal97]. FLP ( ) the set of all Corollary 1. Let  = Law [ Scd [ Obs be a FLP-chronicle and let K? ReA

possible histories computed as result of all possible Ego-World games corresponding to  and let ( ) be its meta-level representation, E =  [ inertia [ initial and V = D [ ( ) [  [  then, then for each feature f 2 F : FLP ( ) : R(f;  ) = v , V ` 9R 2 K? SLDNF demo(E; holds(f; v;  )): ReA

3 Related and future works Among similar attempts to integrate dierent formalisms for qualitative temporal reasoning for dealing with continuous time we cite here the one proposed by Kakas and Miller in [KM97] for extending the Gelfond and Lifschitz's action description language A [GL93] on the basis of 9

Note that in rst order term E the [ operator has a syntactic status whereas in V it represent the actual union of theories.

event calculus. They dene a narrative-based language called E which deals with explicit continuous time but here logic programming is only used as an implementation language. To overcome some limitations of the original formulation of the event calculus, some extensions have been recently proposed by Shanahan [Sha97] for dealing with non-determinism and incomplete knowledge, using techniques based on circumscription[Lif94]. In [Doh94b,Doh94a,Doh96] circumscription based techniques are proposed as the proof-theoretic counterpart of the model minimization techniques (e.g. preferential entailment) proposed by Sandewall's as a modeltheoretic characterization of intended models for DFL chronicles. An interesting framework for doing temporal reasoning by means of constraint logic programming has been proposed by Früwirth in [Fru96]. Although it doesn't account directly to the notion of action and thus to causality, it seems to be a possible candidate as a constraint based meta-logical framework for an ecient and clearer implementation of a FLP proof-system. We envision that reasoning about action and change can be fruitfully applied to other domains other than classic Ariticial Intelligence domains, as for instance temporal modeling of multimedia applications [FM99] and reasoning about properties of logical reactive systems [BES98]. Along these lines we consider further developments of FLP for suitably dealing with these possible applications.

4 Conclusions In this paper we presented two alternative semantics for FLP-chronicles belonging to the Sandewall's class K ? ReA of scenario descriptions. To be more precise, we deal only with ground scenarios (i.e. the Kg ? ReA class), where we do not allow the use of any global variable occurring in a FLP-chronicle. Furthermore, we cannot have partially specied action instances, that is actions with time-point variables. However, in [Pal97] we proposed an abductive semantics that solves scenarios with non-ground temporal components starting from the well known work of Esghi-Kowalski [EK89]. We extended it with a restricted and ad hoc tailored form of constructive negation for CLP languages [Dry95] in order to allow abduction of temporal constraints upon the duration of partially specied action instances. Moreover the meta-logical semantics can been extended to the full class K ? RA10 for dealing with trajectories in a similar way to that proposed by [Sha90]. We leave open the issue of extending in these directions the x-point semantics and assessing completeness results w.r.t. the Sandewall's trajectory semantics. The meta-logical semantics provides the basis for an eective implementation of a proof-system for FLP. This can be viewed from two perspectives. On the one hand we dene a proofprocedure for a subset of discrete uent logic suitable for scenarios in K?ReA ontological class, by means of meta-logic programming [HG98]. On the other hand, it is an attempt to integrate temporal reasoning and logic programming towards an eective knowledge representation language. A prototype of this system has been successfully implemented in CLP(R) and described in [Pal97]. As already remarked, factorizing and selecting models consistent with the observations during the meta-transformation phase increases the overall performance since the 10

the full class K? RA is obtained relaxing the hypothesis that changes of features happens randomly during the duration of the aecting actions. This is denoted by the ontological designator e. In the most general case it is possible to provide a number of functions (e.g. in case of non-deterministic functions), called trajectory, to specify the (possibly continuous) change of feature values during the action duration period. Trajectory semantics for DFL is fully explained in [Bra97,Bra98].

temporal post-diction problem11 is turned into a bounded number of deductions. We consider the results obtained so far quite encouraging and, together with abductive semantics and trajectories, we feel that this method will provide a sound basis for future developments.

Acknowledgments This work is part of the project LEOPARD that was funded by the Swiss National Science Foundation (grants 210045070.95/1 and 200052594.97).

References [AB94] Krzysztof R. Apt and Roland N. Bol. Logic programming and negation: A survey. The Journal of Logic Programming, 19 & 20:972, May 1994. [BCT97] A. Brogi, S. Contiero, and F. Turini. Programming by Combining General Logic Programs. Technical Report 97-02, Department of Computer Science, University of Pisa, 1997. [BES98] J.J. Blanc, Rachid Echahed, and Wendelin Serwe. Towards reactive functional logic programming languages. In Herbert Kuchen, editor, Proc. of 8th Workshop on Functional and Logic Programming, 1998. [BK82] K.A. Bowen and R. Kowalski. Amalgamating language and metalanguage in logic programming. In K.L. Clark and S.A. Tärnlund, editors, Logic Programming, pages 153172. Accademic Press, New York, 1982. [Bra97] Sergio Brandano. Il calcolo dei uenti. Master's thesis, Università degli studi di Pisa, Dip. di Informatica, 1997. [Bra98] Sergio Brandano. A logic-based calculus of uents. Technical Report TR-98-01, Dipartimento di Informatica, January 12 1998. Sun, 25 Jan 1998 18:08:16 GMT. [Bra99] Sergio Brandano. Kraci. In Nonmonotonic Reasoning, Action and Change. Workshop at IJCAI'99, Stockolm Sweden, August 1999. IJCAI'99. [BT95] A. Brogi and F. Turini. Meta-logic for program composition: Semantic issues. In K.R. Apt and F.Turini, editors, Meta-Logics and Logic Programming. The MIT Press, 1995. [Cla78] K. L. Clark. Negation as failure. In H. Gallaire and J. Minker, editors, Logic and Data Bases, pages 293322. Plenum Press, New York, 1978. [Doh94a] Patrick Doherty. Notes on PMON Circumscription. Research Report LiTH-IDA-R-94-43, Department of Computer and Information Science, Linköping University, Sweden, December 1994. [Doh94b] Patrick Doherty. Reasoning about action and change using occlusion. In Proceedings of the 11th European Conference on Articial Intelligence, pages 401405, 1994. [Doh96] Patrick Doherty. pmon+ : A Fluent Logic for Action and Change. Formal Specication, Version 1.0. Research Report LiTH-IDA-R-96-33, Department of Computer and Information Science, Linköping University, Sweden, 1996. [Dry95] K.J. Dryllerakis. Residual SLDNF in CLP languages. Technical report, Logic Programming Group Imperial College, 1995. [EK89] K. Eshghi and R. Kowalski. Abduction compared with negation by failure. In G. Levi and M. Martelli, editors, Proceedings of the 6th International Conference and 5th Symposium on Logic Programming, pages 234254. MIT Press, 1989. [Fit85] Melvin C. Fitting. A Kripke-Kleene semantics for logic programming. Journal of Logic Programming, 4:295312, 1985. [FM99] Nastaran Fatemi and Philippe Mulhem. A conceptual graph approach for video data representation and retrieval. In M. Berthold, editor, Proceedings of third symposium on Intelligent Data Analysis IDA'99. Lecture Notes in Computer Science, 1999. [Fru96] Th. Fruehwirth. Temporal annotated constraint logic programming. In M. Fisher, M. Orgun, and S. Kono, editors, Journal of Symbolic Computation, volume 22 of Special Issue on Executable Temporal Logics. Academic Press, 1996. 11

The temporal post-diction problem consists in inferring pre-conditions of executed actions by the knowledge of their eects.

[GL93] M. Gelfond and Vladimir Lifschitz. Representing action an change by logic programs. Journal of Logic Programming, 17(2,3,4):301323, 1993. [HG98] P. M. Hill and J. Gallagher. Meta-programming in logic progamming. In D. M. Gabbay, C. J. Hogger, and J. A. Robinson, editors, Handbook of Logic in Articial Intelligence and Logic Programming, volume 5, pages 421498. Oxford University Press, 1998. [HM86] Steve Hanks and Drew McDermott. Default Reasoning, Non-monotonic logics, and the Frame Problem. In Proceedings of the Fifth National (U.S.) Conference on Articial Intelligence, pages 328333, Los Altos, CA, 1986. Morgan Kauman. [HM87] Steve Hanks and Drew McDermott. Nonmonotonic logic and temporal projection. Articial Intelligence, (33):379412, 1987. [JL87] Joxan Jaar and Jean-Louis Lassez. Constraint Logic Programming. In Proceedings of the 14th ACM Symposium on Principles of Programming Languages, pages 111119, January 1987. [KM97] A. Kakas and R. Miller. A simple declarative language for describing narratives with actions. The Journal of Logic Programming, 1997. [KS86] R. Kowalski and M. Sergot. A logic based calculus of events. New Generation Computing, 4:6795, 1986. [Lif94] V. Lifschitz. Circumscription. In D.M. Gabbay, C.J. Hooger, and J.A. Robinson, editors, Handbook of Logic in Articial Intelligence and Logic Programming, volume 3: Nonmonotonic Reasoning and Uncertain Reasoning, pages 297352. Oxford University Press, 1994. [MRT97] P. Mancarella, A. Raaetà, and F. Turini. Time in a multi-theory logical framework. In Proc. 4th International Workshop on Temporal Rapresentation and Reasoning, Daytona Beach Florida USA, May 1997. [Pal97] Vincenzo Pallotta. Integrazione della programmazione logica e della logica dei uenti. Master's thesis, Universitá di Pisa, december 1997. [PT98] Vincenzo "Pallotta and Franco" Turini. Towards a uent logic programming. Technical Report TR-98-03, Dipartimento di Informatica, March 9 1998. Wed, 11 Mar 1998 09:26:54 GMT. [San94] E. Sandewall. Features and Fluents. Oxford Press, 1994. [Sha90] M. Shanahan. Representing continuous change in the Event Calculus. In Proceedings of the 9th European Conference on Articial Intelligence, page 598, 1990. [Sha97] M.P. Shanahan. Solving the Frame Problem. MIT Press, 1997. [Sho89] Yoav Shoham. Reasoning about Change  Time and Causation from the Standpoint of Articial Intelligence. MIT Press, 1989. [SK95] Fariba Sadri and Robert A. Kowalski. Variants of the event calculus. In Leon Sterling, editor, Proceedings of the 12th International Conference on Logic Programming, pages 6782, Cambridge, June1318 1995. MIT Press. [SS94] Erik Sandewall and Yoav Shoham. Nonmonotonic temporal reasoning. Technical Report IDA-RKL94-TR11, Department of Computer and Information Science, Linköping University, Sweden, January 1994.