A High-Level Programming Language with Memory of the Execution History

A High-Level Programming Language with Memory of the Execution History

ElGolog: A High-Level Programming Language with Memory of the Execution History Giuseppe De Giacomo Yves Lesperance´ Eugenia Ternovska Sapienza Universita` di Roma York University Simon Fraser University Roma, Italy Toronto, Canada Burnaby, BC Canada [email protected] [email protected] [email protected] Abstract may not support these fluents. All it is likely to say is that immediately after delivering an item to a location, the item Most programming languages only support tests that refer ex- will be at this location. To be able to write the above pro- clusively to the current state. This applies even to high-level programming languages based on the situation calculus such gram, the programmer would first need to extend the action as Golog. The result is that additional variables/fluents/data theory/world model with these additional task-specific flu- structures must be introduced to track conditions that the pro- ents. Such an extension might be needed for every new task. gram uses in tests to make decisions. In this paper, draw- More generally, most programming languages only sup- ing inspiration from McCarthy’s Elephant 2000, we pro- port queries about the current state of the system. This is pose an extended version of Golog, called ElGolog, that sup- the so-called Markov property: the executability of an action ports rich tests about the execution history, where tests are and its effects are entirely determined by the current state or expressed in a first-order variant of two-way linear dynamic situation. This assumption is commonly made in formalisms logic that uses ElGolog programs with converse. We show for reasoning about action, such as the situation calculus that in spite of rich tests, ElGolog shares key features with Golog, including a sematics based on macroexpansion into (McCarthy and Hayes 1969; Reiter 2001). It is also made situation calculus formulas, upon which regression can still in the high-level programming languages Golog (Levesque be applied. We also show that like Golog, our extended lan- et al. 1997) and ConGolog (De Giacomo, Lesperance,´ and guage can easily be implemented in Prolog. Levesque 2000) based on it (as well as in any standard pro- gramming language such as C, Java, etc.), where tests may only query the current situation/state. If one wants to query Introduction some historical information, one has to introduce some data Suppose that we want to give the following instructions to a structures or fluents to remember what happened in the past. robot assistant: In contrast, in natural language instructions, one simply You have already delivered coffee to some offices. Now, refers to past states and events. go back and deliver milk as well. It should be clear that referring to the past to specify a task is useful in many applications, for instance, in robotics. We If we want to write a high-level program to represent these might want to order the robot to “go back to all rooms where instructions, we might write the following: you saw discarded pop cans and bring them to the recycling bin”. Note that bringing milk to people to whom one has while 9o:(DeliveredCoffee(o) ^ :DeliveredMilk(o)) already delivered coffee is not necessarily just a “fix” to the do πo:[(DeliveredCoffee(o) ^ :DeliveredMilk(o))?; earlier behavior, as the milk may only have been ordered goto(o); deliverMilk(o)] later, or it might not have been possible to deliver both at the same time (perhaps the milk is stored in a fridge far from the i.e., while there is an office where coffee has been delivered coffee machine). but not milk, (nondeterministically) pick such an office and In this paper, we show that we can conveniently extend a go there and deliver milk. This program is written in Golog programming language to support queries about the past. In (Levesque et al. 1997), but there is nothing essential about particular, we define ElGolog, which extends Golog with the this; any language where one can iterate over items that sat- possibility of using (converse) programs in tests, as some- isfy a condition would do. times allowed in Dynamic Logic (Harel, Kozen, and Tiuryn Notice that the program relies on fluents (essentially, 2000). However we interpret such tests on the current his- boolean functions that change value over time) such as tory, or log, which is provided by the current situation. So in DeliveredCoffee(o) and DeliveredMilk(o) that memorize a sense we are equipping Golog with a sort of two-way ver- historical information. The model of the world that captures sion of Linear Dynamic Logic operators (De Giacomo and the dynamics of the domain (i.e., the action theory in Golog) Vardi 2013). Copyright c 2020, Association for the Advancement of Artificial With this addition, we can write programs that capture Intelligence (www.aaai.org). All rights reserved. more directly the natural language instructions. For exam- ple, we would write: state axioms encode the causal laws of the world being mod- eled; they take the place of the so-called effect axioms and while 9o:h(deliverCoffee(o); any∗)−i ∗ provide a solution to the frame problem. (:hany ; deliverMilk(o)iT rue) A key feature of BATs is the existence of a sound and do πo:[h(deliverCoffee(o); any∗)−i ∗ complete regression mechanism for answering queries about (:hany ; deliverMilk(o)iT rue)?; situations resulting from performing a sequence of actions goto(o); deliverMilk(o)] (Pirri and Reiter 1999; Reiter 2001). In a nutshell, the re- gression operator R∗ reduces a formula φ about a partic- The test in this example means that there is an office location ∗ o such that there is a state in the past where deliverCoffee ular future situation to an equivalent formula R [φ] about has occurred for that o, and, in the future of that state, there is the initial situation S0, essentially by substituting fluent re- no deliverMilk for o. Here, any means any atomic action, lations with the right-hand side formula of their successor state axioms. A formula φ is regressable if and only if (i) which can be defined as (π~x:A1(~x)) j ::: j (π~x:Ak(~x)), 1 all situation terms in it are of the form do([a ; : : : ; a ];S ), assuming that A1;:::;Ak are all the action types/functions. 1 n 0 John McCarthy made a similar point to motivate his pro- (ii) in every atom of the form P oss(a; σ), the action func- posal for a programming language Elephant 2000, which, tion is specified, i.e., a is of the form A(t1; : : : ; tn), (iii) it among other features, “does not forget” (McCarthy 1992; does not quantify over situations, and (iv) it does not contain 2007). ElGolog is named after this. We go over other related @ or equality over situation terms. Thus in essence, a for- work in the discussion section. mula is regressable if it does not contain situation variables. Another key result about BATs is the relative satisfiability Preliminaries theorem (Pirri and Reiter 1999; Reiter 2001): D is satisfi- able if and only if DS0 [Duna is satisfiable (the latter being Situation Calculus. The situation calculus is a well known a purely first-order theory). This implies that we can check predicate logic language for representing and reasoning if a regressable formula φ is entailed by D, by checking if ∗ about dynamically changing worlds (McCarthy and Hayes its regression R [φ] is entailed by DS [Duna only. 1969; Reiter 2001). All changes to the world are the re- 0 sult of actions, which are terms in the language. A pos- sible world history is represented by a term called a situ- Golog. To represent and reason about complex actions or ation. The constant S0 is used to denote the initial situa- processes obtained by suitably executing atomic actions, tion where no actions have yet been performed. Sequences various so-called high-level programming languages have of actions are built using the function symbol do, such that been defined such as Golog (Levesque et al. 1997; Reiter do(a; s) denotes the successor situation resulting from per- 2001), which includes the usual procedural programming forming action a in situation s. Predicates and functions constructs and constructs for nondeterministic choices.2 whose value varies from situation to situation are called flu- The syntax of Golog programs is as follows: ents, and are denoted by symbols taking a situation term 0 δ ::= a j (δ ; δ ) j (δ jδ ) j πz.δ j δ∗ j '? as their last argument (e.g., Holding(x; s)). s @ s means 1 2 1 2 that s is a predecessor situation to s0, and s v s0 stands for ' ::= P (~x) j :' j '1 ^ '2 j 9x:' s s0 _ s = s0. The abbreviation do([a ; : : : ; a ]; s) stands @ 1 n a for do(a ; do(a ; : : : do(a ; s) :::)). In the above, is an action term, possibly with parameters, n n−1 1 ' Within the language, one can formulate action theories and is situation-suppressed formula, i.e., a formula with that describe how the world changes as a result of the avail- all situation arguments in fluents suppressed. Atomic pro- a a '? able actions. A basic action theory (BAT) D (Pirri and Reiter gram executes the action , while a test confirms that ' δ 1999; Reiter 2001) is the union of the following disjoint sets: holds. The sequence of program 1 followed by program δ δ ; δ δ jδ the foundational, domain independent, axioms of the situa- 2 is denoted by 1 2. Program 1 2 allows for the nonde- δ δ πx.δ tion calculus (Σ), which include a second order axiom char- terministic branch between programs 1 and 2, while δ some acterizing the situation domain; precondition axioms stat- executes program for nondeterministic choice of a x ing when actions can be legally performed (D ); suc- binding for object variable (observe that such a choice is, poss δ∗ δ cessor state axioms describing how fluents change between in general, unbounded).

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    8 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us