Lecture 14 Situation Calculus 13 th February 2020 Outline 2 / 24 - - PowerPoint PPT Presentation

lecture 14 situation calculus
SMART_READER_LITE
LIVE PREVIEW

Lecture 14 Situation Calculus 13 th February 2020 Outline 2 / 24 - - PowerPoint PPT Presentation

Claudia Chirita School of Informatics, University of Edinburgh Based on slides by: Jacques Fleuriot, Michael Rovatsos, Michael Herrmann, Vaishak Belle Informatics 2D Agents and Reasoning 2019/2020 Lecture 14 Situation Calculus 13 th


slide-1
SLIDE 1

Informatics 2D ⋅ Agents and Reasoning ⋅ 2019/2020

Lecture 14 ⋅ Situation Calculus

Claudia Chirita

School of Informatics, University of Edinburgh

13th February 2020

Based on slides by: Jacques Fleuriot, Michael Rovatsos, Michael Herrmann, Vaishak Belle

slide-2
SLIDE 2

Outline

  • Planning
  • Situations
  • Frame problem

2 / 24

slide-3
SLIDE 3

Using Logic to Plan

We need ways of representing

  • the world
  • the goal
  • how actions change the world

We haven’t said much about changing the world. Diffjculty After an action, new things are true, and some previously true facts are no longer true.

3 / 24

slide-4
SLIDE 4

Situations

Situations extend the concept of a state by additional logical terms – consist of initial situation (usually called 𝑇) and all situations generated by applying an action to a situation Providing facts about situations – by relating predicates to situations e.g. instead of saying just 𝑃𝑜(𝐵, 𝐶), say (somehow)

𝑃𝑜(𝐵, 𝐶) in situation 𝑇

Actions are thus – performed in a situation, and – produce new situations with new facts – e.g. Forward and Turn(Right)

4 / 24

slide-5
SLIDE 5

Representing Predicates Relative to a Situation

  • 1. Can add an argument for a situation to each predicate

that can change. – e.g. instead of On(𝐵, 𝐶), write On(𝐵, 𝐶, 𝑇)

  • 2. Alternatively, introduce a predicate Holds

– On etc. become functions – e.g. Holds(On(𝐵, 𝐶), 𝑇) – What do things like On(𝐵, 𝐶) mean now? A set of situations in which 𝐵 is on 𝐶.

5 / 24

slide-6
SLIDE 6

How This Will Work

Before some action, we might have in our KB

  • On(𝐵, 𝐶, 𝑇)
  • On(𝐶, Table, 𝑇)

A B After an action that moves A to the table, say, we add

  • Clear(𝐶, 𝑇)
  • On(𝐵, Table, 𝑇)

A B All these propositions are true. We have dealt with the issue

  • f change, by keeping track of what is true when.

6 / 24

slide-7
SLIDE 7

Same Thing, Slightly Difgerent Notation

Before

  • Holds(On(𝐵, 𝐶), 𝑇)
  • Holds(On(𝐶, Table), 𝑇)

A B After, add

  • Holds(Clear(𝐶), 𝑇)
  • Holds(On(𝐵, Table), 𝑇)

A B

7 / 24

slide-8
SLIDE 8

Representing Actions

We need to represent – results of doing an action – conditions that need to be in place to perform an action For convenience, we will defjne functions to abbreviate actions – e.g. Move(𝐵, 𝐶) denotes the action type of moving 𝐵 onto 𝐶 – these are action types, because actions themselves are specifjc to time, etc. Now, introduce a function Result, designating “the situation resulting from doing an action type in some situation”. – e.g. Result(Move(𝐵, 𝐶), 𝑇) means “the situation resulting from doing an action of type Move(𝐵, 𝐶) in situation 𝑇”.

8 / 24

slide-9
SLIDE 9

How This Works

Keep in mind that things like

Result(Move(𝐵, 𝐶), 𝑇)

are terms and denote situations. They can appear anywhere we would expect a situation. So we can say things like

𝑇 = Result(Move(𝐵, 𝐶), 𝑇) On(𝐵, 𝐶, Result(Move(𝐵, 𝐶), 𝑇)) ≡ On(𝐵, 𝐶, 𝑇)

Alternatively,

Holds(On(𝐵, 𝐶), Result(Move(𝐵, 𝐶), 𝑇))

9 / 24

slide-10
SLIDE 10

Axiomatising Actions

We can describe the results of actions, together with their preconditions. e.g. “If nothing is on 𝑦 and 𝑧, then one can move 𝑦 to on top

  • f 𝑧, in which case 𝑦 will then be on 𝑧.”

∀𝑦, 𝑧, 𝑡.Clear(𝑦, 𝑡) ∧ Clear(𝑧, 𝑡) → On(𝑦, 𝑧, Result(Move(𝑦, 𝑧), 𝑡))

Alternatively,

∀𝑦, 𝑧, 𝑡.Holds(Clear(𝑦), 𝑡) ∧ Holds(Clear(𝑧), 𝑡) → Holds(On(𝑦, 𝑧), Result(Move(𝑦, 𝑧), 𝑡))

This is an efgect axiom. It includes a precondition as well.

10 / 24

slide-11
SLIDE 11

Situation Calculus

This approach is called the situation calculus. We axiomatise all our actions, then use a general theorem prover to prove that a situation exists in which our goal is true. The actions in the proof would comprise our plan.

11 / 24

slide-12
SLIDE 12

Example

KB

On(𝐵, Table, 𝑇) On(𝐶, 𝐷, 𝑇) On(𝐷, Table, 𝑇) Clear(𝐵, 𝑇) Clear(𝐶, 𝑇)

+ axioms about actions Goal

∃𝑡.On(𝐵, 𝐶, 𝑡) 𝑇

B A C Table

12 / 24

slide-13
SLIDE 13

What happens?

  • We want to prove On(𝐵, 𝐶, 𝑡) for some 𝑡.

– Find axiom

∀𝑦, 𝑧, 𝑡.Clear(𝑦, 𝑡) ∧ Clear(𝑧, 𝑡) → On(𝑦, 𝑧, Result(Move(𝑦, 𝑧), 𝑡))

– Goal would be true if we could prove

Clear(𝐵, 𝑡) ∧ Clear(𝐶, 𝑡) by backward chaining.

– But both are true in 𝑇, so we can conclude

On(𝐵, 𝐶, Result(Move(𝐵, 𝐶), 𝑇))

  • We are done!

We look at the proof and see only one action, Move(𝐵, 𝐶), which is executed in situation 𝑇, so this is our plan.

13 / 24

slide-14
SLIDE 14

Example ⋅ Same Situation, Harder Goal1

KB

On(𝐵, Table, 𝑇) On(𝐶, 𝐷, 𝑇) On(𝐷, Table, 𝑇) Clear(𝐵, 𝑇) Clear(𝐶, 𝑇)

+ axioms about actions Goal

∃𝑡.On(𝐵, 𝐶, 𝑡) ∧ On(𝐶, 𝐷, 𝑡) 𝑇

B A C Table

It’s not really harder, is already on , and we just showed how to put on . 14 / 24

slide-15
SLIDE 15

With Goal On(𝐵, 𝐶, 𝑡′) ∧ On(𝐶, 𝐷, 𝑡′)

  • Suppose we try to prove the fjrst subgoal, On(𝐵, 𝐶, 𝑡).

– Use same axiom

∀𝑦, 𝑧, 𝑡.Clear(𝑦, 𝑡) ∧ Clear(𝑧, 𝑡) → On(𝑦, 𝑧, Result(Move(𝑦, 𝑧), 𝑡))

– Again, by chaining, we can conclude

On(𝐵, 𝐶, Result(Move(𝐵, 𝐶), 𝑇))

– Abbreviating Result(Move(𝐵, 𝐶), 𝑇) as 𝑇, we have

On(𝐵, 𝐶, 𝑇).

  • Substituting 𝑇 for 𝑡 in our other subgoal makes that On(𝐶, 𝐷, 𝑇).

If this were true, we are done.

  • But we have no reason to believe this is true!
  • Sure, On(𝐶, 𝐷, 𝑇), but how does the planner know this is still

true, i.e., On(𝐶, 𝐷, 𝑇)?

  • In fact, it doesn’t, so it fails to fjnd an answer!

15 / 24

slide-16
SLIDE 16

The Frame Problem

We have failed to express the fact that everything that isn’t changed by an action should really stay the same. Can fjx by adding frame axioms.

∀𝑦, 𝑡.Clear(𝑦, 𝑡) → Clear(𝑦, Result(Paint(𝑦), 𝑡)) …

There are lots of these! Is this a big problem?

16 / 24

slide-17
SLIDE 17

Better Frame Axioms

  • Can fjx with neater formulation:

∀𝑦, 𝑧, 𝑡, 𝑏.On(𝑦, 𝑧, 𝑡) ∧ (∀𝑨.𝑏 = Move(𝑦, 𝑨) → 𝑧 = 𝑨) → On(𝑦, 𝑧, Result(𝑏, 𝑡))

  • Can combine with efgect axioms to get successor-state axioms:

∀𝑦, 𝑧, 𝑡, 𝑏.On(𝑦, 𝑧, Result(𝑏, 𝑡)) ↔ On(𝑦, 𝑧, 𝑡) ∧ (∀𝑨.𝑏 = Move(𝑦, 𝑨) → 𝑧 = 𝑨) ∨(Clear(𝑦, 𝑡) ∧ Clear(𝑧, 𝑡) ∧ 𝑏 = Move(𝑦, 𝑧))

17 / 24

slide-18
SLIDE 18

How Does This Help Our Example?

  • We want to prove On(𝐶, 𝐷, Result(Move(𝐵, 𝐶), 𝑇)) given that

On(𝐶, 𝐷, 𝑇).

  • Axiom says

∀𝑦, 𝑧, 𝑡, 𝑏.On(𝑦, 𝑧, Result(𝑏, 𝑡)) ↔ On(𝑦, 𝑧, 𝑡) ∧ (∀𝑨.𝑏 = Move(𝑦, 𝑨) → 𝑧 = 𝑨) ∨(Clear(𝑦, 𝑡) ∧ Clear(𝑧, 𝑡) → 𝑏 = Move(𝑦, 𝑧))

  • So we need to show

On(𝐶, 𝐷, 𝑇) ∧ (∀𝑨.Move(𝐵, 𝐶) = Move(𝐶, 𝑨) → 𝐷 = 𝑨) is true: – The fjrst conjunct is in the KB. – The second one is true since actions are the same ifg they have the same name and involve the exact same objects∗:

𝐵(𝑦, … , 𝑦) = 𝐵(𝑧, … , 𝑧) ifg 𝑦 = 𝑧, … , 𝑦 = 𝑧.

So Move(𝐵, 𝐶) = Move(𝐶, 𝑨) is false.

∗Another assumption in KB: (, … , ) (, … , ).

These are known as Unique Action Axioms.

18 / 24

slide-19
SLIDE 19

Refutation Theorem Proving (Dual) Skolemisation

Suppose ∀𝑦.∃𝑧.𝐻(𝑦, 𝑧) is the goal in resolution refutation. We need to negate the goal:

¬∀𝑦.∃𝑧.𝐻(𝑦, 𝑧) ≡ ∃𝑦.∀𝑧.¬𝐻(𝑦, 𝑧)

Then skolemise (i.e drop the existential quantifjer):

¬𝐻(𝑌, 𝑧)

Intuition

𝑧 is to be unifjed to construct witness. 𝑌 must not be instantiated.

19 / 24

slide-20
SLIDE 20

KB and Axioms as Clauses

Variables

𝑏, 𝑦, 𝑧, 𝑨, 𝑡

Constants

𝐵, 𝐶, 𝐷, 𝑇

Initial State

On(𝐵, Table, 𝑇) On(𝐶, 𝐷, 𝑇) On(𝐷, Tabl𝑓, 𝑇) Clear(𝐵, 𝑇) Clear(𝐶, 𝑇)

(neg.) Goal

¬On(𝐵, 𝐶, 𝑡) ∨ ¬On(𝐶, 𝐷, 𝑡)

20 / 24

slide-21
SLIDE 21

KB and Axioms as Clauses

Efgect Axiom

¬Clear(𝑦, 𝑡) ∨ ¬Clear(𝑧, 𝑡) ∨ On(𝑦, 𝑧, Result(Move(𝑦, 𝑧), 𝑡))

Skolem function

Frame Axioms

↙ ¬On(𝑦, 𝑧, 𝑡) ∨ 𝑏 = Move(𝑦, 𝑎(𝑦, 𝑧, 𝑡, 𝑏)) ∨ On(𝑦, 𝑧, Result(𝑏, 𝑡)) ¬On(𝑦, 𝑧, 𝑡) ∨ ¬𝑧 = 𝑎(𝑦, 𝑧, 𝑨, 𝑡, 𝑏) ∨ On(𝑦, 𝑧, Result(𝑏, 𝑡))

Unique Action Axioms

¬Move(𝐵, 𝐶) = Move(𝐶, 𝑨)

Unique Name Axiom

¬𝐷 = 𝐷 for every pair of distinct constants 𝐷 and 𝐷 in KB.

21 / 24

slide-22
SLIDE 22

Resolution Refutation

22 / 24

slide-23
SLIDE 23

Frame problem partially solved

  • This solves the representational part of the frame problem.
  • Still have to compute that everything that was true and

wasn’t changed is still true.

  • Ineffjcient (as is general theorem proving).
  • Solution: Special purpose representations, special purpose

algorithms, called planners.

23 / 24

slide-24
SLIDE 24

Summary

  • Planning
  • Situations
  • Frame problem

24 / 24