The Situation Calculus and Golog

Similar documents
14. Actions. KR & R Brachman & Levesque Situation calculus

Situation Calculus. Gerald Steinbauer. Institute for Software Technology. Gerald Steinbauer. Situation Calculus - Introduction

On the Progression of Situation Calculus Basic Action Theories: Resolving a 10-year-old Conjecture

Reconciling Situation Calculus and Fluent Calculus

14. Actions. Situation calculus. Fluents. Preconditions and effects

Non-Markovian Control in the Situation Calculus

Tractable Reasoning with Incomplete First-Order Knowledge in Dynamic Systems with Context-Dependent Actions

On the Role of Possibility in Action Execution and Knowledge in the Situation Calculus

Interpreting Golog Programs in Flux

Progression of Situation Calculus Action Theories with Incomplete Information

Continuing the KRR Journey

Reasoning about Noisy Sensors and Effectors in the Situation Calculus

Situation Calculus and Golog

Knowledge, Belief, and Noisy Sensing in the Situation Calculus. Patricio D. Simari

Lecture 3: High-level Programming in the Situation Calculus: Golog and ConGolog

Gerald Steinbauer Institute for Software Technology

On Ability to Autonomously Execute Agent Programs with Sensing

Planning and search. FOL and situation calculus. FOL and situation calculus 1

On the Decidability of Verifying LTL Properties of GOLOG Programs

Projection using Regression and Sensors

Actions and Change. p. 1/45

LTCS Report. On the Decidability of Verifying LTL Properties of Golog Programs (Extended Version) LTCS-Report 13-10

On the Progression of Knowledge in the Situation Calculus

Belief Revision and Progression of KBs in the Epistemic Situation Calculus

On First-Order Definability and Computability of Progression for Local-Effect Actions and Beyond

On Defaults in Action Theories

Embracing Causality in Specifying the Indirect Effects of Actions*

Cumulative Effects of Concurrent Actions on Numeric-Valued Fluents

A Closed-Form Solution to the Ramification Problem (Sometimes)

DIS La Sapienza PhD Course. Autonomous Agents and Multiagent Systems. Lecture 4: High-Level Programming in the Situation Calculus: Golog and ConGolog

Integrating State Constraints and Obligations in Situation Calculus

Action, Belief Change and the Frame Problem: A Fluent Calculus Approach

Situations, si! Situation terms, no!

Expressing Transactions with Savepoints as Non-Markovian Theories of Actions

Non-Markovian Control in the Situation Calculus

SCOPE: A Situation Calculus Ontology of Petri Nets

MULTI-AGENT ONLY-KNOWING

Introduction on Situational Calculus

ConGolog, a concurrent programming language based on the situation calculus

Reasoning by Regression: Pre- and Postdiction Procedures for Logics of Action and Change with Nondeterminism*

Handling Implication and Universal Quantification Constraints in FLUX

A Semantics for ADL as Progression in the Situation Calculus

From Causal Theories to Successor State Axioms and STRIPS-Like Systems

Towards the Integration of Programming by Demonstration and Programming by Instruction using Golog

cis32-ai lecture # 18 mon-3-apr-2006

Towards an Integration of Golog and Planning

Description Logics. Deduction in Propositional Logic. franconi. Enrico Franconi

Change, Change, Change: three approaches

Multi-agent actions under uncertainty: situation calculus, discrete time, plans and policies

Adding Modal Operators to the Action Language A

Induction in Nonmonotonic Causal Theories for a Domestic Service Robot

Designing and Evaluating Generic Ontologies

Applications of the Situation Calculus To Formalizing. Control and Strategic Information: The Prolog Cut Operator. Fangzhen Lin

On the Semantics of Deliberation in IndiGolog

Decidable Reasoning in a Modified Situation Calculus

Extensions: Concurrency, Interrupts, Sensing

Situation Calculus. Chapter 16. Fangzhen Lin

Iterated Belief Change in the Situation Calculus

Resolving Non-Determinism in Programs for Complex Task Planning with Search Control

Two-Valued Logic Programs

Precondition Control and the Progression Algorithm

Progression and Verification of Situation Calculus Agents with Bounded Beliefs

Peano Arithmetic. CSC 438F/2404F Notes (S. Cook) Fall, Goals Now

Monitoring the Generation and Execution of Optimal Plans. Christian Fritz

Reasoning about State Constraints in the Situation Calculus

Belief Management for High-Level Robot Programs

CS558 Programming Languages

AHoare-Style Proof System for Robot Programs

CS1021. Why logic? Logic about inference or argument. Start from assumptions or axioms. Make deductions according to rules of reasoning.

Intention recognition in the Situation Calculus and Probability Theory frameworks

Lecture 10: Feb. 11, 2015

AN ANALYSIS OF SYSTEMATIC APPROACHES TO REASONING ABOUT ACTIONS AND CHANGE

A Logical Theory of Coordination and Joint Ability

Planning under Uncertainty as GOLOG Programs

Ontologies and Domain Theories

Dynamic Semantics. Dynamic Semantics. Operational Semantics Axiomatic Semantics Denotational Semantic. Operational Semantics

Announcements. Today s Menu

Declarative Strategies for Agents with Incomplete Knowledge

What are the recursion theoretic properties of a set of axioms? Understanding a paper by William Craig Armando B. Matos

COMP219: Artificial Intelligence. Lecture 19: Logic for KR

Decision-Theoretic Planning with Fuzzy Notions in Golog

COMP219: Artificial Intelligence. Lecture 19: Logic for KR

A Note on Backward Dual Resolution and Its Application to Proving Completeness of Rule-Based Systems*

Proofs of Correctness: Introduction to Axiomatic Verification

A description logic based situation calculus

Pairing Transitive Closure and Reduction to Efficiently Reason about Partially Ordered Events

Part of this work we present an extension for Language PP and we show how this

Argumentation with Abduction

Introduction to Logic and Axiomatic Set Theory

Intelligent Agents. Pınar Yolum Utrecht University

demanding computationally in all but simple settings. An alternative approach that is showing promise is that of high-level program execution [20]. Th

First Order Logic: Syntax and Semantics

Introduction to Artificial Intelligence Propositional Logic & SAT Solving. UIUC CS 440 / ECE 448 Professor: Eyal Amir Spring Semester 2010

Example: Robot Tasks. What is planning? Background: Situation Calculus. Issues in Planning I

Knowledge in the Situation Calculus

Deliberative Agents Knowledge Representation I. Deliberative Agents

Propositional Calculus - Soundness & Completeness of H

INF3170 Logikk Spring Homework #8 For Friday, March 18

Introduction to Metalogic

Transcription:

and A Tutorial Gerhard Lakemeyer Dept. of Computer Science RWTH Aachen University Germany 2nd Hybris Workshop, Freiburg, May 27 28, 2013

Outline 1 2 3 May 28, 2013 2 / 34

Knowledge-Based Agents Example: An Office Robot If there are people in the office who want coffee, go to the kitchen, pick up coffee, and serve it to everyone who wants some. Alternatively, choose some room that is not clean and clean it. Alternatively,... Want a high-level representation that accounts for... incomplete knowledge some room is dirty, but do not know which agent gathers new knowledge at runtime (sensing) intelligent decision-making programmer cannot foresee every eventuality agent has to reason about actions (preconditions+effects) May 28, 2013 4 / 34

: Cognitive Robotics Broadly speaking, the newly emerging field of cognitive robotics has, as its long term objectives, the provision of a uniform theoretical and implementation framework for autonomous robotic or software agents that reason, act and perceive in changing, incompletely known, unpredictable environments. [Ray Reiter, Knowledge in Action, 2001] The situation calculus is such a uniform framework. Goes back to John McCarthy (1963). Here: variant developed by Reiter and his colleagues. May 28, 2013 5 / 34

Literature Ray Reiter, Knowledge in Action, MIT Press 2001. Hector J. Levesque and Gerhard Lakemeyer, Cognitive Robotics, In F. van Harmelen, V. Lifschitz, and B. Porter, Eds., Handbook of Knowledge Representation, Elsevier, 2007. May 28, 2013 6 / 34

in a Nutshell do(givecoffee,do(goto(frank),s0) (=s2) Loc(s2)=Frank HasCoffee(Frank,s2) do(goto(frank),s0) (=s1) Loc(s1)=Frank not HasCoffee(Frank,s1) S0 Loc(S0)=Rm6204 not HasCoffee(Frank,S0) Situations are sequences of actions like do(goto(frank), S 0 ). Fluents characterizing situations: HasCoffee(Frank, S 0 ) Axioms about change: HasCoffee(p, do(a, s)) a = givecoffee HasCoffee(p, s) May 28, 2013 8 / 34

The Language (1) The situation calculus is a sorted, second-order language with equality. There are three sorts: situations, actions, and ordinary objects. The logical connectives are,,. (We also use,,, as the usual abbreviations.) There are two function symbols of sort situation: the constant S0 denoting the initial situation the function do(a, s) denoting the situation obtained by doing action a in situation s A special binary predicate s s with the intended interpretation that s is a subsequence of s. May 28, 2013 9 / 34

The Language (2) A special binary predicate Poss(a, s) with the intended interpretation that action a is executable in situation s. Relations and functions whose last argument is a situation are called fluents. E.g., in a world where objects can be painted Color(x, c, s) may mean that x has the color c in situation s. Notation: In the following, free variables are implicitly assumed to be universally quantified, e.g., Poss(drop(r, x), s) Holding(r, x, s) stands for r, s, x.poss(drop(r, x), s) Holding(r, x, s). May 28, 2013 10 / 34

Action Preconditions (Qualifications) Actions have preconditions: A robot r can lift object x in situation s iff r is not holding anything, is located next to x, and x is not too heavy: Poss(pickup(r, x), s) z. Holding(r, z, s) Heavy(x) NextTo(r, x, s). r can repair an object iff the object is broken and he has glue: Poss(repair(r, x), s) HasGlue(r, s) Broken(x, s) Note: Defining Poss this way makes a strong and simplifying assumption, ignoring other possible qualifications such as lifting an object is possible only if it is not glued to the ground, not slippery, etc. This is the qualification problem, which we simply ignore here. May 28, 2013 11 / 34

Effect Axioms Changes in the world are specified by effect axioms which describe how actions change fluents. The effect on Broken when r drops an object: Fragile(x) Broken(x, do(drop(r, x), s)). (positive effect axiom) Repairing an object causes the object not to be broken any more: Broken(x, do(repair(r, x), s)). (negative effect axiom) May 28, 2013 12 / 34

Frame Axioms It takes more than effect axioms to describe a changing world. One needs so-called frame axioms to specify which fluents do not change when an action is executed. Positive frame axioms: e.g. dropping an object does not change its color: Color(x, c, s) Color(x, c, do(drop(r, y), s)). Negative frame axioms: e.g. things do not break if they are not dropped: Broken(x, s) [x y Fragile(x)] Broken(x, do(drop(r, y), s)). May 28, 2013 13 / 34

The Frame Problem There are far too many frame axioms: only very few actions have an effect on any given fluent. All others remain unchanged. The color of an object does not change by lifting objects, opening doors, turning on lights, elect a president, etc. There are about 2 A F frame axioms, where A is the number of actions and F the number of fluents. Why is this a probem? Coding that many frame axioms by hand is awkward and error prone. It is very difficult to deal with that many axioms when reasoning (like planning a sequence of actions). Goal: Find a compact representation of the frame axioms and derive them automatically from the effect axioms. May 28, 2013 14 / 34

Reiter s Solution to the Frame Problem Example: Suppose we have two positive effect axioms for Broken: Fragile(x) Broken(x, do(drop(r, x), s)), NextTo(b, x, s) Broken(x, do(explode(b), s)). Then these can be transformed into an equivalent sentence: [ r.(a = drop(r, x) Fragile(x)) (1) b.(a = explode(b) NextTo(b, x, s))] Broken(x, do(a, s)). Similarly, the negative effect axiom Broken(x, do(repair(r, y), s)) can be rewritten as: r.(a = repair(r, x)) Broken(x, do(a, s)) (2) May 28, 2013 15 / 34

A Completeness Assumption Now we make the following completeness assumption: Axiom (1) characterizes all possible conditions when an action a can break an object x. That means: if Broken(x, s) and Broken(x, do(a, s)) are true, then the truth value of Broken can only have changed because r.(a = drop(r, x) Fragile(x)) or b.(a = explode(b) NextTo(b, x, s)) were true. Similarly, we assume that Axiom (2) characterizes the only possibility when an action a can make an object x whole. May 28, 2013 16 / 34

Successor State Axioms The effect axioms together with the completeness assumption can be combined in a so-called successor state axiom SSA Br for Broken: Broken(x, do(a, s)) r.(a = drop(r, x) Fragile(x)) b.(a = explode(b) NextTo(b, x, s)) (Broken(x, s) ( r.a = repair(r, x))). From the SSA one can deduce all effect axioms and all frame axioms: Examples: SSA Br = Fragile(x) Broken(x, do(drop(r, x), s)) SSA Br UNA = Broken(x, s) Fragile(x) Broken(x, do(drop(r, y), s)), where UNA is drop(r, x) explode(b) May 28, 2013 17 / 34

The General Case The previous example can be generalized. Suppose we have the following normal form for effect axioms: One positive effect axiom for each fluent F: γ F + ( x, a, s) F( x, do(a, s)). One negative effect axiom for each fluent F: γf ( x, a, s) F( x, do(a, s)). Here γ F + ( x, a, s) and γ F ( x, a, s) are wffs whose free variables are x, a, and s. Such a normal form can always be obtained assuming we have unique names axioms for actions. Then the SSA has the following form: F( x, do(a, s)) γ F + ( x, a, s) [F( x, s) γ F ( x, a, s)] May 28, 2013 18 / 34

Solution to the Frame Problem (Summary) Our solution yields the following axioms: For each fluent F there is a single SSA: F( x, do(a, s)) γ F + ( x, a, s) (F( x, s) γ F ( x, a, s)) For each action A there is a single precondition axiom: Poss(A( x), s) Π A ( x, s). Unique names axioms for all actions. Ignoring unique names axioms, we have F +A axioms, compared to 2 F A frame axioms! Note: SSAs are fairly short in real applications. The length of a SSA is roughly proportional to the number of actions which have an effect on the fluent. In practice only very few actions have an effect on a particular fluent. May 28, 2013 19 / 34

Basic Action Theories Action Preconditions: Σ pre Poss(goto(x), s) true Poss(loadCoffee, s) HasCoffee(R, s) Poss(giveCoffee(p), s) HasCoffee(R, s) Successor State Axioms for Fluents: Σ post HasCoffee(p, do(a, s)) [p = R a = loadcoffee] [a = givecoffee(p)] [HasCoffee(p, s) ( p.p = R a = givecoffee(p ))] Loc(do(a, s)) = x [a = goto(x)] [Loc(s) = x ( y.y x a = goto(y))] What is true initially: Σ 0 Loc(S 0 ) = Rm6304, HasCoffee(Frank, S 0 ), HasCoffee(R, S 0 ). Σ = Σ 0 Σ pre Σ post UNA found. axioms Σ = HasCoffee(Frank, do(givecoffee(frank, goto(frank, S 0 )))). May 28, 2013 20 / 34

Foundational Axioms Besides domain dependent axioms to characterize actions, we need a few domain independent axioms which specify, roughly, that situations are all and the only sequences of actions starting at S 0. 1. Situations have unique names: do(a 1, s 1 ) = do(a 2, s 2 ) a 1 = a 2 s 1 = s 2 2. There are no situations other than those reachable from S 0 : P.P(S 0 ) a, s.[p(s) P(do(a, s))] s.p(s) 3. The definition of as subhistory: s S 0 s do(a, s ) s s where s s is an abbreviation for s s s = s. May 28, 2013 21 / 34

Reasoning about Action by Regression Let us consider the subproblem Σ = G(σ), where σ = do([α 1,...,α n ], S 0 ) is the only situation mentioned in G (regressable formula). (do([α 1,α 2 ], s) def = do(α 2, do(α 1, s))) Idea: Replace each fluent F( t,σ) with F( x, do(a, s)) Φ( x, a, s) by Φ( t,α n, do([α 1,...,α n 1 ], S 0 )), and continue until S 0 is the only situation left. Simlarly, replace Poss(A, s) by its definition. Then we only need to reason about the initial situation. May 28, 2013 22 / 34

An Example G = Poss(giveCoffee(F), S 0 ) HasCoffee(F, do(givecoffee(f), S 0 )). Poss(giveCoffee(p), s) HasCoffee(R, s) HasCoffee(p, do(a, s)) [p = R a = loadcoffee] [a = givecoffee(p)] [HasCoffee(p, s) ( p.p = R a = givecoffee(p ))] Let R[G] denote the formula obtained by applying regression. Then R[G] = HasCoffee(R, s) [F = R givecoffee(f) = loadcoffee] [givecoffee(f) = givecoffee(f)] [HasCoffee(F, S 0 ) ( p.f = R givecoffee(f) = givecoffee(p ))] which simplifies to R[G] = HasCoffee(R, S 0 ). Note, in particular, that Σ 0 UNA = R[G]. This is no coincidence! May 28, 2013 23 / 34

Main Result about Regression Let G be a regressable sentence and D a basic action theory. Then 1. R[G] mentions only S 0. 2. Σ = G R[G]. 3. Σ = G iff Σ 0 UNA = R[G]. Note: (3) says that, after applying the regression operator, one only needs to consider Σ 0 and, most importantly, figuring out whether G follows from Σ reduces to ordinary first-order theorem proving! May 28, 2013 24 / 34

Planning in the Situation Let σ = do([a 1,...,a n ], S 0 ) and executable(σ) stand for a formula expressing that each a i is executable. For a given basic action theory Σ and goal G planning means finding a situation σ such that Σ = executable(σ) G(σ). For a particular σ use regression to compute the entailment. May 28, 2013 25 / 34

Planning is too Expensive While basic action theories allow to infer arbitrary plans in principle, this often does not work in practice. Even optimized planners fail in general as this is an inherently hard problem. Perhaps not even needed: Often the user has a good idea of what needs to be done. Idea: Tell the robot what to do if possible. Leave (small) subtasks for planning where needed. Coffee delivery robot Imagine a robot serving coffee to many people. The robot can carry only one cup at a time. May 28, 2013 26 / 34

May 28, 2013 28 / 34 Efficient if the initial state consists of a set of literals. Hybris proc DeliverCoffee while x.wantscoffee(x) do πx.wantscoffee(x); ServeCoffee(x) endwhile goto(home) endproc proc ServeCoffee(x) if HasCoffee(R) then goto(coffeem); loadcoffee endif goto(x); givecoffee(x) endproc Semantics of programs given in the situation calculus: Do(ρ, s, s ): executing program ρ leads from situation s to s. Program execution: Σ = s.do(delivercoffee, S 0, s) (finds as a side effect a sequence of executable actions) Implementation in Prolog.

Complex Actions Programming in the situation calculus is introduced by defining the following complex actions: Sequence: First execute A, then B. Test actions: Is φ true in the current situation? If-then-else, While-loops Nondeterministic actions: Execute A or B. Nondeterministic choice of the argument of an actions: e.g. (πx)pickup(x): pick up an arbitrary object. procedures Names for complex actions, parameters, recursion. May 28, 2013 29 / 34

The Meaning of Complex Actions (1) Do(a, s, s ) stands for: The execution of action a in situation s leads to situation s. Primitive actions: Do(a, s, s ). = Poss(a[s], s) s = do(a[s], s). Sequence: Do([a 1 ; a 2 ], s, s ). = s Do(a 1, s, s ) Do(a 2, s, s ). Nondeterministic actions: Do([a 1 a 2 ], s, s ). = Do(a 1, s, s ) Do(a 2, s, s ) Nondeterministic choice: Do((πx)a(x), s, s ). = x Do(a(x), s, s ) Test actions: Do(φ?, s, s ). = φ[s] s = s May 28, 2013 30 / 34

If-then-else: The Meaning of Complex Actions (2) Do(if(φ, a 1, a 2 ), s, s ). = Do([[φ?; a 1 ] [ φ?; a 2 ]], s, s ) -operator: execute the action n times (n 0): Do(a, s, s ). = P[ s 1 P(s 1, s 1 ) s 1, s 2, s 3 (P(s 1, s 2 ) Do(a, s 2, s 3 ) P(s 1, s 3 ))] P(s, s ) While-loops: Do(while(φ, a), s, s ). = Do(([φ?; a] ; φ?), s, s ) Procedures: definition is second order because of recursion (omitted). Note: The semantics of complex actions is completely described within the situation calculus. May 28, 2013 31 / 34

Example Consider the coffee-delivery program together with the basic action theory as before and the initial state Σ 0 = { x.wantscoffee(x) (x = Frank), HasCoffee(R, S 0 )}. Σ = Do(DeliverCoffee, S 0,σ), where σ = do([goto(coffeem), loadcoffee, goto(frank), givecoffee(frank), goto(home)], S 0 ). May 28, 2013 32 / 34

: algol in LOGic Comparison to conventional imperative programming: Procedures in normal imperative languages are ultimately reduced to machine instructions like assignment statements. Procedures in actions are reduced to primitive actions which refer to actions in the real world, like picking up objects or moving. Instead of machine states we are interested in world states. Executing complex actions requires logical reasoning about what the world is like and how it evolves. For example, in order to execute while [ x.wantscoffee(x)] do... one needs to evaluate the test [ x.wantscoffee(x)] in the current situation. May 28, 2013 33 / 34

Extensions of the Basic Framework Over the past years a number of extensions to have been proposed to make it applicable in realistic domains, especially in robotics. These include concurrent actions time continuous change an explicit notion of knowledge sensing stochastic actions May 28, 2013 34 / 34