Linkoping Electronic Articles in

Computer and Information Science

Vol nr

Foundations for the Situation

Calculus

Hector Levesque Fiora Pirri and Ray Reiter

Linkoping University Electronic Press

Linkoping Sweden

httpwwwepliuseeacis

Published on December by

Linkoping University Electronic Press

Linkoping Sweden

Linkoping Electronic Articles in

Computer and Information Science

ISSN

Series editor Erik Sandewal l

c

Hector Levesque Fiora Pirri and Ray Reiter

a

Typeset by the author using L T X

E

Formatted using etendu style

Recommended citation

Author Title Linkoping Electronic Articles in

Computer and Information Science Vol nr

httpwwwepliuseeacis December

This URL wil l also contain a link to the authors home page

The publishers wil l keep this article online on the Internet

or its possible replacement network in the future

for a period of years from the date of publication

barring exceptional circumstances as described separately

The online availability of the article implies

a permanent permission for anyone to read the article online

to print out single copies of it and to use it unchanged

for any noncommercial research and educational purpose

including making copies for classroom use

This permission can not be revoked by subsequent

transfers of copyright Al l other uses of the article are

conditional on the consent of the copyright owner

The publication of the article on the date stated above

included also the production of a limited number of copies

on paper which were archived in Swedish university libraries

like al l other written works published in Sweden

The publisher has taken technical and administrative measures

to assure that the online version of the article wil l be

permanently accessible using the URL stated above

unchanged and permanently equal to the archived printed copies

at least until the expiration of the publication period

For additional information about the Linkoping University

Electronic Press and its procedures for publication and for

assurance of document integrity please refer to

its WWW home page httpwwwepliuse

or by conventional mail to the address stated above

Abstract

This article gives the logical foundations for the situationsashistories vari

ant of the situation calculus fo cusing on the following items

The language of the situation calculus

Foundational axioms for the domain of situations

Axioms for an underlying domain theory

The syntax and semantics of the programming language GOLOG

Axioms for knowledge and sensing actions

Essential metatheoretic results ab out the situation calculus

Authors addresses

Hector Levesque

Department of Computer Science

University of Toronto

Toronto Canada MS A

hectoraitorontoedu

Fiora Pirri

Dipartimento di Informatica e Sistemistica

Universita degli Studi di Roma La Sapienza

Via Salaria Roma Italy

pirriassidisuniromait

Ray Reiter

Department of Computer Science

University of Toronto

Toronto Canada MS A reiteraitorontoedu

Intro duction

The situation calculus McCarthy has long b een a staple of AI research

but only recently have there b een attempts to carefully axiomatize it The

variant describ ed here has evolved in resp onse to the needs of the Cognitive

Rob otics Pro ject at the University of Toronto and its foundations are now

suciently develop ed to b e gathered in one place That is what this pap er

sets out to do

The principal intuition captured by our axioms is that situations are

histories nite sequences of primitive actions and we provide a binary

constructor doa s denoting the action sequence obtained from the history

s by adding action a to it Other intuitions are certainly p ossible ab out the

nature of situations McCarthy and Hayes saw them as snapshots of a

world For the purp oses of representing narratives McCarthy and Costello

wish to express that any numb er of actions may o ccur b etween a situa

tion and its successor and therefore they do not app eal to a constructor

like do

The axioms and supp orting metatheory presented in this pap er have

provided foundations for a wide range of practical work in mo deling dynami

cal systems including planning Green Levesque control Levesque

et al De Giacomo et al simulation Kelley database up dates

Reiter Bertossi et al diagnosis of dynamical systems McIlraith

and agent programming and rob otics Jenkin et al Lesperance et

al Burgard et al Shapiro et al Reiter

The Language of the Situation Calculus

The following description is taken from Pirri and Reiter L is a

sitcalc

second order language with equality It has three disjoint sorts action for

actions situation for situations and a catchall sort object for everything else

dep ending on the domain of application Apart from the standard alphab et

of logical symb ols we use and with the usual denitions of a full

set of connectives and quantiers L has the following alphab et

sitcalc

Countably innitely many individual variable symb ols of each sort

We shall use s and a with subscripts and sup erscripts for variables

of sort situation and action resp ectively We normally use lower case

roman letters other than a s with subscripts and sup erscripts for

variables of sort object In addition b ecause L is second order

sitcalc

its alphab et includes countably innitely many predicate variables of

all arities

Two function symb ols of sort situation

A constant symb ol S denoting the initial situation

0

A binary function symb ol do action situation situation

The intended interpretation is that doa s denotes the succes

sor situation resulting from p erforming action a in situation s

A binary predicate symb ol < situation situation dening an order

ing relation on situations The intended interpretation of situations

0

is as action histories in which case s < s means that s is a prop er

0

subhistory of s

A binary predicate symb ol P oss action situation The intended

interpretation of P ossa s is that it is p ossible to p erform the action

a in situation s

For each n countably innitely many predicate symb ols with ar

n

ity n and sorts action obj ect These are used to denote situation

indep endent relations like

humanJ ohn pr imeN umber n

mov ing Actionr unper son l oc l oc etc

For each n countably innitely many function symb ols of sort

n

action obj ect obj ect These are used to denote situation inde

p endent functions like

sq r tx heig htM tE v er est ag entr unper son l oc l oc etc

For each n a nite or countably innite numb er of function

n

symb ols of sort action obj ect action These are called action

functions and are used to denote actions like pick upx mov eA B

etc In most applications there will b e just nitely many action

functions but we allow the p ossibility of an innite numb er of them

Notice that we distinguish b etween function symb ols taking values

of sort object and those the action functions taking values of

sort action In what follows the latter will b e distinguished by the

requirement that they b e axiomatized in a particular way by what we

shall call action precondition axioms

For each n a nite or countably innite numb er of predicate

n

symb ols with arity n and sorts action obj ect situation

These predicate symb ols are called relational uents In most ap

plications there will b e just nitely many relational uents but we

do not preclude the p ossibility of an innite numb er of them These

are used to denote situation dep endent relations like ontabl ex s

husbandM ar y J ohn s etc Notice that relational uents take just

one argument of sort situation and this is always its last argument

For each n a nite or countably innite numb er of function

n

symb ols of sort action obj ect situation action obj ect These

function symb ols are called functional uents In most applications

there will b e just nitely many functional uents but we do not

preclude the p ossibility of an innite numb er of them These are

used to denote situation dep endent functions like

ag eM ar y s pr imeM inister I tal y s etc

Notice that functional uents take just one argument of sort situation

and this is always its last argument

Notice that only two function symb ols of L S and do are p ermitted

sitcalc 0

to take values in sort situation

Foundational Axioms for Situations

Here we fo cus on the domain of situations The primary intuition ab out

situations that we wish to capture axiomatically is that they are nite se

quences of actions We want also to b e able to say that a certain sequence of

actions is a subsequence of another To formalize these desiderata we adopt

the following four foundational axioms for the situation calculus taken from

1

doa s doa s a a s s

1 1 2 2 1 2 1 2

P P S a sP s P doa s sP s

0

Axiom is a unique names axiom for situations two situations are

the same i they are the same sequence of actions Two situations S and

1

S may b e dierent yet assign the same truth values to all uents So a

2

situation in the version of the situation calculus presented here must not b e

identied with the set of uents that hold in that situation ie with a state

The prop er way to understand a situation is as a history namely a sequence

of actions two situations are equal i they denote identical histories The

second axiom is second order induction on situations The imp ortance

of induction for the situation calculus is describ ed by Reiter

There are two more axioms

s < S

0

0 0

s < doa s s v s

0 0 0

Here s v s is an abbreviation for s < s s s The relation < provides

0

an ordering relation on situations Intuitively s < s means that the action

0

sequence s can b e obtained from the sequence s by adding one or more

2

actions to the front of s

The ab ove four axioms are domain independent They provide the basic

prop erties of situations in any domain sp ecic axiomatization of particular

3

uents and actions Henceforth we shall call them

Time Pro cesses and Concurrency in the Situation

Calculus

As presented ab ove the foundational axioms for situations provide a purely

qualitative notion of time whose only temp oral concept is sequential action

o ccurrence An action o ccurs before or after another within a situation

There is no way of expressing that an action o ccurs at a particular time or

that two or more actions o ccur concurrently While we do not present them

here it is p ossible to extend these axioms for situations to accommo date

time and concurrency See for example Pinto and Reiter and

for a discussion of how to mo del pro cesses in the situation calculus using

interleaving concurrency see Reiter

1

In what follows lower case Roman characters will denote variables in formulas

Moreover free variables will always b e implicitl y universally prenex quantied

2

Readers familiar with the programming language LISP will have noticed that

in the situation calculus the constant S is just like NIL and do acts like cons

0

Situations are simply lists of primitive actions For example the situation term

doC doB doA S is simply an alternative syntax for the LISP list CBA

0

consC consB consA nil Notice that to obtain the action history cor

resp onding to this term namely the p erformance of action A followed by B

followed by C we read this list from right to left Therefore when one reads

0

situation terms from right to left the relation s < s means that situation s is a

0

prop er subhistory of the situation s The situation calculus induction axiom

is simply the induction principle for lists If the empty list has prop erty P and if

whenever list s has prop erty P so do es consa s then all lists have prop erty P

3

These foundational axioms are simpler than those presented by Reiter and

others These earlier axiomatizations for the situation calculus are all derivable

from the four axioms given here

Domain Axioms and Basic Theories

of Actions

Our concern here is with axiomatizations for actions and their eects that

have a particular syntactic form These are called basic action theories and

we next describ e these

Denition The Uniform Formulas

Let b e a term of sort situation The terms of L uniform in are

sitcalc

the smallest set of terms such that

Any term that do es not mention a term of sort situation is uniform

in

is uniform in

If g is an nary function symb ol other than do and S and t t

0 1 n

are terms uniform in whose sorts are appropriate for g then

g t t is a term uniform in

1 n

The formulas of L uniform in are the smallest set of formulas such

sitcalc

that

If t and t are terms of the same sort object or action and if they

1 2

are b oth uniform in then t t is a formula uniform in

1 2

When P is an nary predicate symb ol of L other than P oss and

sitcalc

< and t t are terms uniform in whose sorts are appropriate

1 n

for P then P t t is a formula uniform in

1 n

Whenever U U are formulas uniform in so are U U U

1 2 1 1 2

and v U provided v is an individual variable and it is not of sort

1

situation

Thus a formula of L is uniform in i it is rst order it do es

sitcalc

not mention the predicates P oss or < it do es not quantify over variables

of sort situation it do es not mention equality on situations and whenever

it mentions a term of sort situation in the situation argument p osition of a

uent then that term is

Denition Action Precondition Axiom

An action precondition axiom of L is a sentence of the form

sitcalc

P ossAx x s x x s

1 n A 1 n

where A is an nary action function symb ol and x x s is a

A 1 n

formula that is uniform in s and whose free variables are among x x s

1 n

For example in a blo cks world we might typically have

P osspick upx s y hol ding y s heav y x s

The uniformity requirement on ensures that the preconditions for

A

the executability of the action Ax x are determined only by the

1 n

current situation s not by any other situation

Denition Successor State Axiom

A successor state axiom for an n ary relational uent F is a

sentence of L of the form

sitcalc

F x x doa s x x a s

1 n F 1 n

where x x a s is a formula uniform in s all of whose free

F 1 n

variables are among a s x x An example of such an axiom

1 n

taken from is

br ok enx doa s

r fa dr opr x f r ag il ex sg bfa expl odeb

nextob x sg

br ok enx s r a r epair r x

This says that x will b e broken in the successor situation doa s i x

was fragile in s and the action taking us to the successor situation was

someone r dropping x or the action was some b omb b explo ding

and b was next to x or x was already broken and the action was not

someone repairing x

As for action precondition axioms the uniformity of guarantees

F

that the truth value of F x x doa s in the successor situa

1 n

tion doa s is determined entirely by the current situation s and not

by any other situation In systems and control theory this is often

called the Markov property

A successor state axiom for an n ary functional uent f is a

sentence of L of the form

sitcalc

f x x doa s y x x y a s

1 n f 1 n

where x x y a s is a formula uniform in s all of whose

f 1 n

free variables are among x x y a s A blo cks world example

1 n

is

heig htx doa s y a mov eT oT abl ex y

z ha mov ex z heig htz s h y h

heig htx s y a mov eT oT abl exz a mov ex z

As for relational uents the uniformity of in the successor state

f

axioms for functional uents guarantees the Markov prop erty The

value of a functional uent in a successor situation is determined en

tirely by prop erties of the current situation and not by any other

situation

Following earlier ideas of Pednault Haas and Schub ert Reiter

4

shows how to solve the for deterministic actions The

resulting solution yields axioms with exactly the syntactic form of successor

state axioms

Basic Action Theories Henceforth we shall consider theories D of

L of the following forms

sitcalc

D D D D D

ss ap una S

0

where

4

This solution do es not take ramication constraints into account but see

for p ossible ways to do this while preserving the successor state

axiom approach

are the foundational axioms for situations

D is a set of successor state axioms for functional and relational

ss

uents one for each such uent of the language L

sitcalc

D is a set of action precondition axioms one for each action function

ap

symb ol of L

sitcalc

D is the set of unique names axioms for all action function symb ols

una

of L

sitcalc

is a set of rst order sentences that are uniform in S Thus no D

0 S

0

quanties over situations or mentions P oss < or the sentence of D

S

0

function symb ol do so that S is the only term of sort situation men

0

will function as the initial theory of tioned by these sentences D

S

0

the world ie the one we start o with b efore any actions have b een

the initial database The initial executed Often we shall call D

S

0

database may and often will contain sentences mentioning no situ

ation term at all for example unique names axioms for individuals

like J ohn M ar y or timeless facts like isM ountainM tE v er est

or dog x mammal x

Denition A basic action theory is any collection of axioms D of the

ab ove form that also satises the following functional uent consistency

property

Whenever f is a functional uent whose successor state axiom in D is

ss

f x doa s y x y a s

f

then

j a sxy x y a s D D

f una S

0

0 0 0

y y x y a s x y a s y y

f f

This consistency prop erty provides a sucient condition for preventing

a source of inconsistency in f s successor state axiom It says that the con

ditions dening f s value in the next situation doa s namely actually

f

dene a value for f and that this value is unique

Metatheory for the Situation Calculus

Here we present some fundamental logical prop erties of basic action theories

These are describ ed more fully with accompanying pro ofs in

Relative Satisability

Basic action theories enjoy an imp ortant relative satisability prop erty

is Theorem A basic action theory D is satisable i D D

una S

0

Reduction

For the purp oses of automating deduction in the situation calculus the

foundational axioms are problematic esp ecially the induction axiom Ac

cordingly it would b e desirable to characterize broad classes of sentences

whose pro ofs need never app eal to induction or even b etter can addition

ally ignore some of the other axioms of or b est of all need never app eal

to any of the foundational axioms The main result along these lines is

the following

Theorem Reduction Theorem

is a basic action theory Suppose that D D D D D

ss ap una S

0

Suppose further that is a rst order sentence of L whose prenex

sitcalc

normal form has the form

Q s Q s s Q n

1 1 2 2 n n

where s s are variables of sort situation is quantier free and

1 n

each Q is a sequence of zero or more quantiers over variables of sort

i

action obj ect Then

D j i D fI nductiong j

Here D fI nductiong is D without the second order induction axiom

If does not mention the predicate symbol <

j D j i D D D D

= ss ap una S

0

Here consists of the foundational axiom together with the

=

fol lowing sentence

S doa s

0

If does not mention the predicate symbol < and it does not mention

an equality atom over terms of sort situation

j D j i D D D D

ss ap una S

0

Regression

Regression is p erhaps the single most imp ortant theoremproving mecha

nism for the situation calculus it provides a sytematic way to establish

that a basic action theory entails a socalled regressable sentence

Denition The Regressable Sentences A regressable sentence of

the situation calculus is a rst order sentence W of L such that W

sitcalc

do es not quantify over situations and such that for every atom of the form

P oss mentioned by W has the form At t for some nary

1 n

action function symb ol A of L

sitcalc

The essence of a regressable sentence is that each of its situation terms is

ro oted at S and therefore one can tell by insp ection of such a term

0

exactly how many actions it involves It is not necessary to b e able to

tell what those actions are just how many there are In addition when a

regressable sentence mentions a P oss atom we can tell by insp ection of

that atom exactly what is the action function symb ol o ccurring in its rst

argument p osition for example that it is a mov e action

The intuition underlying regression is this Supp ose we want to prove

that a regressable sentence W is entailed by some basic action theory Sup

p ose further that W mentions a relational uent atom F t do where

F s successor state axiom is F x doa s x a s Then we can eas

F

0

ily determine a logically equivalent sentence W by substituting t

F

for F t do in W After we do so the uent atom F t do in

volving the complex situation term do has b een eliminated from W

in favour of t and this involves the simpler situation term In

F

0

this sense W is closer to the initial situation S than was W Moreover

0

this op eration can b e rep eated until the resulting goal formula mentions

only the situation term S after which intuitively it should b e sucient to

0

establish this resulting goal using only the sentences of the initial database

Regression is a mechanism that rep eatedly p erforms the ab ove reduction

starting with a goal W ultimately obtaining a logically equivalent goal W

0

whose only situation term is S We have only indicated how regression

0

works by reducing relational uent atoms in W there is an analogous way

of reducing functional uent terms

The full denition of the regression op erator R is rather lengthy mainly

b ecause functional uents intro duce certain complications and we omit it

here See for details The principal result for regression is the following

Theorem Soundness and Completeness of Regression

Suppose W is a regressable sentence of L and D is a basic theory of

sitcalc

actions Then

RW is a sentence uniform in S

0

D j RW D j W i D

una S

0

This result shows how using regression one can reduce the problem

of proving a regressable sentence in a basic action theory to an entailment

problem relative to the initial database and the unique names axioms for

actions The foundational axioms of the situation calculus are not re

quired for establishing this entailment The action precondition and succes

sor state axioms are also not required their eects have b een compiled into

the regressed formula Regression is the central computational mechanism

underlying implementations of the language GOLOG

and we now turn to this

GOLOG

GOLOG is a situation calculusbased logic programming language for im

plementing complex b ehaviours for dynamical systems The language was

rst intro duced in and was describ ed there without pinning down

all its formal details Here we present the syntax and logical foundations

for the language most of which is taken from Pirri and Reiter

The Syntax of GOLOG Programs

For the purp oses of sp ecifying the syntax of the programming language

GOLOG we require a language that is just like L except it suppresses

sitcalc

all references to situations

Denition SituationSuppressed Terms and Formulas

The situationsuppressed terms obtained from L are inductively de

sitcalc

ned by

Any variable of L of sort action or object is a situationsuppressed

sitcalc

term

If f is an n ary functional uent of L and t t are

sitcalc 1 n

situationsuppressed terms of sorts appropriate for the rst n argu

ments of f then f t t is a situationsuppressed term

1 n

If g is an mary nonfunctional uent symb ol of L other than S

sitcalc 0

or do and t t are situationsuppressed terms of sorts appropri

1 m

ate for the arguments of g then g t t is a situationsuppressed

1 m term

The situationsuppressed formulas obtained from L are inductively de

sitcalc

ned by

0

Whenever t and t are situationsuppressed terms of the same sort

0

then t t is a situationsuppressed formula Because situation

suppressed terms are never of sort situation the situationsuppressed

formulas never mention an equality atom b etween terms of sort situ

ation

When t is a situationsuppressed term of sort action then P osst is

a situationsuppressed formula

When F is an n ary relational uent symb ol of L and

sitcalc

t t are situationsuppressed terms of sorts appropriate for the

1 n

rst n arguments of F then F t t is a situationsuppressed

1 n

formula

When P is an mary nonuent predicate symb ol of L other than

sitcalc

< and t t are situationsuppressed terms of sorts appropriate

1 m

for the arguments of P then P t t is a situationsuppressed

1 m

formula

When and are situationsuppressed formulas so are and

When v is a variable of L of sort action or object then v is

sitcalc

a situationsuppressed formula

Therefore situationsuppressed formulas are rst order never quantify over

situations never mention < nor do they ever mention terms of sort situa

tion

We can now describ e the syntax of GOLOG programs

hpr og r ami hpr imitiv e actioni j

htest conditioni j

hpr og r ami hpr og r ami j

hpr og r ami j hpr og r ami j

xhpr og r ami j

hpr ocedur e cal l i j

pro c P v hpr og r ami endPro c

1 1

pro c P v hpr og r ami endPro c

n n

hpr og r ami

Here

hpr imitiv e actioni is a situationsuppressed term of sort action

htest conditioni is a situationsuppressed formula

In xhpr og r ami x must b e a variable of L of sort action or

sitcalc

object

hpr ocedur e cal l i must have the syntactic form P t t where P

1 n

is an n ary predicate variable of L whose rst n arguments

sitcalc

are not of sort situation and whose last two arguments are of sort

situation Moreover t t must b e situationsuppressed terms

1 n

whose sorts are appropriate for the rst n arguments of P

In a pro cedure declaration pro c P v hpr og r ami endPro c P must

b e an n ary predicate variable of L whose rst n arguments

sitcalc

are not of sort situation and whose last two arguments are of sort

situation Moreover v must b e variables of L whose sorts are

sitcalc

appropriate for the rst n arguments of P

Notice that GOLOG provides for arbitrary nesting of blo cks with pro cedure

declarations lo cal to their blo ck Other control structures eg conditionals

and while lo ops can b e dened in terms of the ab ove constructs

def

if htest conditioni then hpr og r ami else hpr og r ami

htest conditioni hpr og r ami j htest conditioni hpr og r ami

To dene while lo ops rst intro duce a nondeterministic iteration op erator

 

where hpr og r ami means do hpr og r ami or more times

def



hpr og r ami pro c P tr ue j hpr og r ami P endPro c P



Then while lo ops can b e dened in terms of the op erator

def

while htest conditioni do hpr og r ami endWhile



htest conditioni hpr og r ami htest conditioni

Just as conventional Algollike programming languages never explicitly

refer to the state of their computation GOLOG programs never explicitly

mention situations hence the emphasis ab ove on situationsuppressed terms

and formulas In dening the semantics of such programs these situations

are taken into account as we now describ e

The Semantics of GOLOG

Denition Restoring Suppressed Situation Arguments

Whenever t is a situationsuppressed term and is a term of L of sort

sitcalc

situation t denotes that term of L obtained by restoring the term

sitcalc

as the situation argument to all of the functional uents terms mentioned by

t In addition whenever is a situationsuppressed formula denotes

that formula of L obtained by restoring the term as the situation

sitcalc

argument to all of the functional uent terms and all of the relational uent

atoms mentioned by

0

Next we dene an abbreviation D o where is a program ex

0 0

pression and and are terms of sort situation D o should b e

viewed as a macro that expands into a second order situation calculus for

0

mula moreover that formula says that situation can be reached from

situation by executing some sequence of actions specied by Note that

our programs may b e nondeterministic that is may have multiple execu

tions terminating in dierent situations

D o is dened inductively on the structure of its rst argument as follows

Primitive actions When is a situationsuppressed term of sort

action

def

0 0

D o P oss do

Test actions When is a situationsuppressed formula

def

0 0

D o

Sequence

def

0 0

D o sD o s D o s

1 2 1 2

Nondeterministic choice of two actions

def

0 0 0

D o j D o D o

1 2 1 2

Nondeterministic choice of action arguments

def

0 0

D o x x D o

Procedure cal ls For any predicate variable P of arity n whose rst

n arguments are not of sort situation and whose last two arguments

are of sort situation

def

0 0

D oP t t P t t

1 n 1 n

Blocks with local procedure declarations

D ofpro c P v endPro c

1 1 1

0

pro c P v endPro c g

n n n 0

n

def

0 0 0

s s v D o s s P v s s P P

i i i i 1 n

i=1

0

D o

0

Notice that in the denition for pro cedure calls the actual parameters t

i

are rst evaluated with resp ect to the current situation t b efore

i

passing them to the pro cedure P so GOLOGs pro cedure invo cation is cal l

by value

Except for pro cedures the ab ove macro approach to dening the seman

tics of GOLOG draws considerably from dynamic logic In eect it reies

as situations in the ob ject language of the situation calculus the p ossible

worlds with which the semantics of dynamic logic is dened The macro de

nition for GOLOG pro cedures corresp onds to the more usual ScottStrachey

least xedpoint denition in standard programming language semantics

0

With the ab ove denition of D o in hand we are in a p osition

to dene what we mean by the evaluation of a GOLOG program

The Evaluation of GOLOG Programs

Denition Prop er GOLOG Program

0

A GOLOG program is prop er i s and s are the only free variables in

0

dividual or predicate mentioned in D o s s In other words for each

individual variable x mentioned in x lies in the scop e of x or x in

a test condition of or x is mentioned in the scop e of a nondeterminis

tic choice op erator x Moreover for every pro cedure call P t t

1 n

mentioned in the second order variable P is b ound in by a pro cedure

declaration for P in some blo ck surrounding the pro cedure call

A prop er GOLOG program is evaluated relative to a background basic

theory of actions sp ecifying a particular application domain Sp ecically if

D is such a basic action theory and is a prop er GOLOG program then

the evaluation of relative to D is dened to b e the task of establishing the

following entailment

D j sD o S s

0

Any binding for the existentially quantied variable s obtained as a side

eect of such a pro of constitutes an execution trace of In this resp ect

the evaluation of a GOLOG program is much like that of a Prolog goal

statement in the sense that b oth are evaluated by a theoremprover for the

purp oses of obtaining bindings to existentially quantied variables of the

theorem Of course in the case of GOLOG this theoremproving task is

much more daunting b ecause in general sD o S s stands for a very

0

complicated second order sentence of L and moreover D includes

sitcalc

a second order induction axiom However GOLOG enjoys a strong

Reduction prop erty that somewhat simplies this task as we now describ e

Elimination for GOLOG

As dened ab ove a GOLOG program is evaluated relative to a basic action

theory D One can prove that for this purp ose the foundational axioms

for situations contained in D are not needed

Theorem Elimination Theorem for GOLOG

is a basic action theory and Suppose that D D D D D

ss ap una S

0

that is a proper GOLOG program Then

j sD o S s D j sD o S s i D D D D

0 0 ss ap una S

0

Sensing and Knowledge

To talk ab out knowledge explicitly in the language of the situation calculus

we follow Mo ore and supp ose that there are situations other than S and

0

its successors that serve as epistemic alternatives to the real situations

A uent is considered to b e known in a situation s if it holds in all the

epistemic alternatives to s To allow knowledge to change as the result of

p erforming actions we imagine that certain actions return sensing results

here taken to b e binary What is known in a situation s will b e fully

determined by what was known initially the actions that led to situation

s and the sensing results of those actions The material in this section is

adapted from Lakemeyer and Levesque

The language of the epistemic situation calculus L is L augmented

e sitcalc

by two new distinguished symb ols K a unary predicate over situations

0

and SF a s a binary predicate over actions and situations Informally

K s holds when s is an epistemic alternative to S and SF a s holds

0 0

when action a returns binary sensing result in situation s

The foundational axioms for L describ e the augmented set of situations

e

First for any situation term let I nit b e the abbreviation

def

I nit s a doa s

where a and s do not app ear in The rst axiom is

doa s doa s a a s s

1 1 2 2 1 2 1 2

just as it was in and

P fsI nits P s s aP s P doa sg sP s

which is similar to its counterpart in stating that all situations are suc

cessors of some initial one Next we need axioms that dene the < relation

0 0

I nits s < s

which is an analogue of the one in and

0 0

s < doa s s v s

which is unchanged Next we need to say that S and K are initial situa

0 0

tions

I nitS sK s I nits

0 0

Finally we need to characterize the set of initial situations To ensure that

nothing need b e known ab out the uents initially we insist that there b e

initial situations to serve as p ossible epistemic alternatives for all combi

nations of uent values To keep things simple here let us assume that there

are only nitely many relational uents F F L and no functional

1 n e

uents We then use the following abbreviation

def

FV P P P P s

1 n n+1 n+2

V

n

x F x s P x

i i i i i

i=1

aP ossa s P a aSF a s P a

n+1 n+2

The next foundational axiom is then

P s I nits FV P s

This is a variant of the existence of situations axiom rst intro duced by

Baker For some applications it will b e desirable to have additional ini

tial situations where actions pro duce arbitrary eects Here we simply

assume that actions satisfy the successor state axioms in all epistemic alter

natives and hence we state that there are no additional initial situations

So the nal foundational axiom is

s s I nits I nits s s

1 2 1 2 1 2

P F V P s FV P s

1 2

We refer to these seven foundational axioms as

e

To characterize what is known we need two new categories of axioms

Denition Sensed Fluent Axiom

A sensed uent axiom of L for an action A is a sentence of the form

e

SF Ax x s x x s

1 n A 1 n

where A is an nary action function symb ol and x x s is a

A 1 n

formula that is uniform in s and whose free variables are among x x s

1 n

These axioms are used to characterize the conditions under which the action

returns the binary value For example in a dimensional rob otics domain

we might have

SF check B umper s x r obotP osx s x

as a way of saying that a bump er sensor on the rob ot returns when the

rob ot gets within units of a wall lo cated at the origin Actions that do

not involve any sensing can b e assumed to always return and hence the

would b e T RU E

Denition Initial Knowledge Axiom

An initial knowledge axiom of L is a sentence of the form

e

K s s

0

where s is a formula that is uniform in s and whose only free variable

is s

Axioms of this typ e are used to characterize the epistemic alternatives to

S For example in the dimensional rob otics world we might have

0

K s x x y r obotP osy s x y

0

as a way of saying that all the rob ot knows initially is that it is no further

than units away from the wall

Given these a know ledgeaction theory D is of the following form

e

D D D D D D D

sf K e e ss ap una S

0 0

where is the new set of foundational axioms D D D and D

e ss ap una S

0

are as b efore D is a set of sensed uent axioms one for each action

sf

is an initial knowledge axiom function symb ol and D

K

0

With such a theory in hand we can now explain what it means to know

a formula in an arbitrary situation by using two abbreviations First we

have

def

K P P

1 2 1 2

where the ellipsis stands for the universal closure of

fI nits K s P s s g

2 0 1 1 2

fP s s P ossa s P ossa s

1 2 1 2

SF a s SF a s P doa s doa s g

1 2 1 2

0 0

The formula K s s can b e read as saying that s is an epistemic alter

native to situation s It is not hard to show that as a binary relation K is

required to b e transitive and Euclidean

Theorem The closure of the fol lowing two formulas is logical ly valid

K s s K s s K s s

2 1 3 2 3 1

K s s K s s K s s

2 1 3 1 3 2

With resp ect to knowledge this means that we are imagining an agent

that has p ositive and negative introsp ection The ab ove denition of

K also inductively sp ecies the epistemic alternatives after p erforming any

sequence of actions

Theorem The closure of the fol lowing two formulas is logical ly valid

0 0

K s S K s

0 0

0 00 0 00 00

K s doa s s s doa s K s s

00 00

P ossa s P ossa s SF a s SF a s

0

So for an initial situation like S s is an epistemic alternative only when

0

0

K s holds for a noninitial situation doa s an epistemic alternative is

0

00 00 00

of the form doa s where s is an alternative to s and where s and s

agree on P oss and SF

If we were to consider the formula K s as a uent we can see that

the second part of the ab ove theorem amounts to a successor state theorem

for K as it shows how to obtain the value of K doa s as a function

of K s and other prop erties of a and s Because we dene knowledge

in terms of K b elow this means we have provided a solution to the frame

problem for knowledge a complete sp ecication of how knowledge changes

as the result of p erforming any action

Finally we have the abbreviation

def

K now s s K s s

where is a situationsuppressed formula and is any term of sort situation

This says that is known in situation if it comes out true at all epistemic

alternatives to Here for simplicity we are requiring to b e situation

suppressed a more elab orate account would allow us to express knowledge

ab out knowledge and other formulas where the mentions situations

To see how this would work in practice imagine that we have an action

theory D for the dimensional rob otics world that includes the two axioms

e

ab ove and

z r obotP osz S z

0

saying that the actual p osition of the rob ot is units away from the wall

as well as a successor state axiom for r obotP os saying that it is only aected

by a mov e action

z r obotP osz domov ex s r obotP osz x s

Then letting W al l C l ose stand for the abbreviation

x x y r obotP osy x y

we get the following as logical consequences of D

e

K now sW al l C l ose S

0

K now sW al l C l ose S

0

K now sW al l C l ose domov e S

0

K now sW al l C l ose domov e S

0

K now sW al l C l ose docheck B umper domov e S

0

K now sW al l C l ose domov e docheck B umper domov e S

0

K now sW al l C l ose domov e docheck B umper domov e S

0

K now sW al l C l ose domov e docheck B umper domov e S

0

Acknowledgments

As describ ed here the formal foundations of the situation calculus have

evolved over a numb er of years and we gratefully acknowledge the con

tributions of the present emeritus and honorary memb ers of the Univer

sity of Toronto Cognitive Rob otics Group Alfredo Gabaldon Giusepp e

De Giacomo To dd Kelley Sam Kaufman Iluju Kiringai Gerhard Lake

meyer Yves Lesperance Fangzhen Lin Je Lloyd Sheila McIlraith Daniel

Marcu Javier Pinto Shane Ruman Richard Scherl Steven Shapiro Misha

Soutchanski and Eugenia Ternovskaia We wish also to thank our research

sp onsors Agenzia Spaziale Italiana the National Science and Engineer

ing Research Council of Canada the Canadian Institute for Rob otics and

Intelligent Systems and the Centre for Information Technology of Ontario

References

A Baker A simple solution to the Yale sho oting problem In R Brach

man HJ Levesque and R Reiter editors Proceedings of the First

International Conference on Principles of Know ledge Representation

and Reasoning KR pages Morgan Kaufmann Publishers

San Francisco CA

L Bertossi M Arenas and C Ferretti SCDBR An automated rea

soner for sp ecications of database up dates Journal of Intel ligent In

formation Systems To app ear

W Burgard AB Cremers D Fox D Hahnel G Lakemeyer

D Schultz W Steiner and S Thrun The interactive museum tour

guide rob ot In Proceedings of the National Conference on Articial

Intel ligence AAAI pages AAAI PressMIT Press

G De Giacomo Y Lesperance and HJ Levesque Reasoning ab out

concurrent execution prioritized interrupts and exogenous actions in

the situation calculus In Proceedings of the Fourteenth International

Joint Conference on Articial Intel ligence pages Nagoya

Japan

R Goldblatt of Time and Computation CSLI Lecture Notes

No Center for the Study of Language and Information Stanford

Univers ity Stanford CA nd edition

CC Green Theorem proving by resolution as a basis for question

answering systems In B Meltzer and D Michie editors Machine

Intel ligence pages American Elsevier New York

A R Haas The case for domainsp ecic frame axioms In F M Brown

editor The frame problem in articial intel ligence Proceedings of the

workshop pages Los Altos California Morgan

Kaufmann Publishers San Francisco CA

JY Halp ern and YO Moses A guide to completeness and complexity

for mo dal logics of knowledge and b elief Articial Intel ligence

M Jenkin Y Lesperance HJ Levesque F Lin J Lloyd D Marcu

R Reiter RB Scherl and K Tam A logical approach to p ortable

highlevel rob ot programming In Proceedings of the Tenth Australian

Joint Conference on Articial Intel ligence AI Perth Australia

Invited pap er

TG Kelley Mo deling complex systems in the situation calculus A

case study using the Dagstuhl steam b oiler problem In LC Aiello

J Doyle and SC Shapiro editors Principles of Know ledge Represen

tation and Reasoning Proceedings of the Fifth International Confer

ence KR pages Morgan Kaufmann Publishers San Fran cisco CA

G Lakemeyer and H Levesque AOL a logic of acting sensing know

ing and only knowing In Proc of KR Sixth International Confer

ence on Principles of Know ledge Representation and Reasoning pages

June

Y Lesperance HJ Levesque F Lin D Marcu R Reiter and

R Scherl A logical approach to highlevel rob ot programming a

progress rep ort In Control of the Physical World by Intel ligent Sys

tems Working Notes of the AAAI Fal l Symp

Y Lesperance HJ Levesque and R Reiter A situation calcu

lus approach to mo deling and programming agents In A Rao and

M Wo oldridge editors Foundations and Theories of Rational Agency

In press

HJ Levesque What is planning in the presence of sensing In Proceed

ings of the National Conference on Articial Intel ligence AAAI

pages

HJ Levesque R Reiter Y Lesperance F Lin and R Scherl

GOLOG a logic programming language for dynamic domains J of

Logic Programming Special Issue on Actions

F Lin and R Reiter State constraints revisited J of Logic and

Computation special issue on actions and processes

J McCarthy Situations actions and causal laws Technical rep ort

Stanford University Reprinted in Semantic Information Pro cess

ing M Minsky ed MIT Press Cambridge Mass pp

J McCarthy and T Costello Combining narratives In AG Cohn and

LK Schub ert editors Principles of Know ledge Representation and

Reasoning Proceedings of the Sixth International Conference KR

pages Morgan Kaufmann Publishers San Francisco CA

J McCarthy and P Hayes Some philosophical problems from the

standp oint of articial intelligence In B Meltzer and D Michie ed

itors Machine Intel ligence pages Edinburgh University

Press Edinburgh Scotland

S A McIlraith Towards a Formal Account of Diagnostic Problem

Solving PhD thesis Department of Computer Science University of

Toronto Toronto Ontario Canada

RC Mo ore A formal theory of knowledge and action In Jerry B

Hobbs and Rob ert C Mo ore editors Formal Theories of the Com

monsense World chapter pages Ablex Publishing Corp

Norwo o d New Jersey

EPD Pednault ADL Exploring the middle ground b etween STRIPS

and the situation calculus In RJ Brachman H Levesque and

R Reiter editors Proceedings of the First International Conference on

Principles of Know ledge Representation and Reasoning KR pages

Morgan Kaufmann Publishers San Francisco CA

JA Pinto Temporal Reasoning in the Situation Calculus PhD thesis

University of Toronto Department of Computer Science

F Pirri and R Reiter Some contributions to the metatheory of the

situation calculus Journal of the ACM To app ear

httpwwwcstorontoeducogrob o

R Reiter The frame problem in the situation calculus a simple

solution sometimes and a completeness result for goal regression

In Vladimir Lifschitz editor Articial Intel ligence and Mathematical

Theory of Computation Papers in Honor of John McCarthy pages

Academic Press San Diego CA

R Reiter Proving prop erties of states in the situation calculus Arti

cial Intel ligence

R Reiter On sp ecifying database up dates Journal of Logic Program

ming

R Reiter Natural actions concurrency and continuous time in the

situation calculus In LC Aiello J Doyle and SC Shapiro editors

Principles of Know ledge Representation and Reasoning Proceedings

of the Fifth International Conference KR pages Morgan

Kaufmann Publishers San Francisco CA

R Reiter Sequential temp oral GOLOG In AG Cohn and LK Schu

b ert editors Principles of Know ledge Representation and Reasoning

Proceedings of the Sixth International Conference KR pages

Morgan Kaufmann Publishers San Francisco CA

LK Schub ert Monotonic solution of the frame problem in the situa

tion calculus an ecient metho d for worlds with fully sp ecied actions

In HE Kyb erg RP Loui and GN Carlson editors Know ledge Rep

resentation and Defeasible Reasoning pages Kluwer Academic

Press

S Shapiro Y Lesperance and HJ Levesque Goals and rational

action in the situation calculus a preliminary rep ort In Working

Notes of the AAAI Fal l Symposium on Rational Agency Concepts

Theories Models and Applications Cambridge MA

JE Stoy Denotational Semantics MIT Press