Reasoning about Actions and Causality Θεωρίες Δράσης και Αιτιότητας...

51
Reasoning about Actions and Causality Θεωρίες Δράσης και Αιτιότητας Θοδωρής Πάτκος Αναπαράσταση και Επεξεργασία Γνώσης ΗΥ- 467 2009

Transcript of Reasoning about Actions and Causality Θεωρίες Δράσης και Αιτιότητας...

Reasoning about Actions and CausalityΘεωρίες Δράσης και Αιτιότητας

Θοδωρής Πάτκος

Αναπαράσταση και Επεξεργασία Γνώσης ΗΥ-467

2009

Outline

• Introduction to Action Theories• Basic Issues using the Event Calculus

– Frame Problem– Ramification Problem– Qualification Problem

• Familiarization with the Situation Calculus• Comparison of Action Theories• Golog & Planning• Knowledge

Commonsense Reasoning

• The process of inferring aspects of our world based on our current information and commonsense knowledge.

• Related issues– Representation– Effects of Events– Indirect Effects of Events– Context-dependent Effects– Non-deterministic Effects– Concurrent Events– Preconditions– Inertia– Actions with duration– Delayed Effects and Continuous Change– Default Reasoning– …

Cognitive Robotics

• Agent = Action Theory + High-Level Program

Action Theories

• Action Theories are formal tools used to automate the process of commonsense reasoning in dynamically-changing worlds, such as– predicting the outcome of a given action sequence– explaining observations– finding a situation in which certain goal conditions are met

• Informal definitionAn action theory consists of a formal language that allows adequate specifications of

action domains and scenarios, and it tells us precisely what conclusions can be drawn from these specifications.

Michael Thielscher – 2000

• The objective is to express the dynamics of the world, therefore always include a more or less implicit general notions of time, change and causality.

Action Theories and Logic

• Action theories have much in common with general purpose logics.

• They are based on a formal language and they include an entailment relation to determine the way conclusions are drawn from specifications.

• Yet entailment is somewhat different, because it reflects the special notions of change and causality inherent in action theories.

• Automated reasoning using action theories exploits the naturalness of the latter when it comes to formalizing domains and scenarios, but also the progress in automated deduction (in FOL for instance).

Formalisms for Reasoning about Action

• Situation Calculus

• Fluent Calculus

• Event Calculus

• Action Languages

• Other similar approaches– STRIPS - PDDL– Temporal Action Logic– Dynamic Logic

Outline

• Introduction to Action Theories• Basic Issues using the Event Calculus

– Frame Problem– Ramification Problem– Qualification Problem

• Familiarization with the Situation Calculus• Comparison of Action Theories• Golog & Planning• Knowledge

Event Calculus – A Multi-sorted FOL

• The EC distinguishes three kinds of objects – events, fluents and timepoints. To do this, it appeals to a sorted first-order language.

• Fluents are relations, whose truth value may vary from timepoint to timepoint.

• Semantically, the universe is partitioned into disjoint sub-universes, one for each sort. A variable will range over its own sub-universe, and a term will denote an element in its corresponding sub-universe.

• Still, multi-sorted logics are no more powerful than ordinary unsorted FOL.

Event Calculus – Basic Notions

• There are many different dialects; we will use the Discrete Event Calculus

• Commonsense Law of Inertia: things tend to persist unless affected by some event.

• Circumscription: The Event Calculus assumes by default that no unexpected events occur and there are no unexpected effects of events.

Fluent Predicates• HoldsAt(f,t)• ReleasedAt(f,t)• Happens(e,t)

• Initiates(e,f,t)• Terminates(e,f,t)• Releases(e,f,t)

Fluent Predicates• HoldsAt(f,t)• ReleasedAt(f,t)• Happens(e,t)

• Initiates(e,f,t)• Terminates(e,f,t)• Releases(e,f,t)

Event Calculus – Simple Example

• Initiates(WakeUp(a), Awake(a), t) (1.1)

• Terminates(Sleep(a), Awake(a), t) (1.2)

• HoldsAt(Awake(Nathan),0) (1.3)ReleasedAt(Awake(Nathan),0) (1.4)

• Happens(WakeUp(Nathan),0) (1.5)

• We have a domain axiomatization, observations and narrative of actions.• We can prove that Nathan will be awake at timepoint 3 (or at any t>0).• Why?? We need an Event Calculus Axiomatization (domain independent

axioms)

Event Calculus – Axiomatization

Fluent Predicates• HoldsAt(f,t)• ReleasedAt(f,t)• Happens(e,t)

• Initiates(e,f,t)• Terminates(e,f,t)• Releases(e,f,t)

Fluent Predicates• HoldsAt(f,t)• ReleasedAt(f,t)• Happens(e,t)

• Initiates(e,f,t)• Terminates(e,f,t)• Releases(e,f,t)

Event Calculus – Fluent and Action Preconditions

• HoldsAt(On(o),t) Initiates(Flip(o), On(o), t) (2.1)

HoldsAt(On(o),t) Terminates(Flip(o), On(o), t) (2.2)

• If the preconditions do not hold the action may still occur, but will not have the intended effect.

• Happens(WalkThroughDoor(a,d),t) HoldsAt(Near(a,d),t) (3.1)

• If the preconditions do not hold the action cannot occur (otherwise we get inconsistency)

Outline

• Introduction to Action Theories• Basic Issues using the Event Calculus

– Frame Problem– Ramification Problem– Qualification Problem

• Familiarization with the Situation Calculus• Comparison of Action Theories• Golog & Planning• Knowledge

Frame Problem• Happens(TurnOn(l),t) HoldsAt(On(l),t+1) (4.1)

• HoldsAt(On(Light1),0) (4.2)• HoldsAt(On(Light2),0) (4.3)• Happens(TurnOn(Light2),0) (4.4)

• Ok about Light2, but what can we say about Light1??

• The problem of representing which fluents do not change when an event occurs is known as the frame problem.

Frame Problem• The frame problem is understood as finding a way to succinctly specify the

effects and noneffects of actions, given the situations in which they are performed. Javier Pinto 1999

• A straightforward solution is to add frame axioms to specify when fluents remain unchanged.

• The problem arises because the number of these axioms in the general case is 2xAxF (where A – number of actions, F – number of fluents)

• The solution within Event Calculus: inertia + circumscription

• We will see other solutions later on.

Outline

• Introduction to Action Theories• Basic Issues using the Event Calculus

– Frame Problem– Ramification Problem– Qualification Problem

• Familiarization with the Situation Calculus• Comparison of Action Theories• Golog & Planning• Knowledge

Ramification Problem

• The problem of representing and reasoning about the indirect effects of events is known as the ramification problem.

• Consider for example an agent moving around while carrying an object; the object’s location changes due to the agent’s movement.

• The simplest solution is to divide fluents into primitive and derived and apply state constraints.

• Better, we can use context-dependent inertia with state constraints, i.e., HoldsAt(Holding(a,o),t) HoldsAt(InRoom(a,r),t)

HoldsAt(InRoom(o,r),t) (5.1)

Ramification Problem

• A multitude of benchmark problems have been proposed to reveal weaknesses and counterintuitive inferences, such as the Yale shooting scenario, Thielscher’s circuit etc

• A multitude of solutions have been proposed, but still this is an open and very interesting issue.

Ramification Problem – Shanahan’s circuit with vicious cycles

Close(S1)L

R

S3

S1

S2

L

R

S3

S1S2

Start(L)Activate(R)

L

R

S3

S1S2

L

R

S3

S1 S2

L

R

S3

S1 S2

Open(S2)

Stop(L)Deactivate(R)

Close(S2)

L S1 S2 Start(L)

R S1 S2 S3 Activate(R)

S2 R Open(S2)

L (S1 S2) Stop(L)

R (S1 S2 S3) Deactivate(R)

S2 R Close(S2)

Outline

• Introduction to Action Theories• Basic Issues using the Event Calculus

– Frame Problem– Ramification Problem– Qualification Problem

• Familiarization with the Situation Calculus• Comparison of Action Theories• Golog & Planning• Knowledge

Qualification Problem

• Whenever we intend to execute some plan we know that many things may go wrong, i.e., in order to drive to the university the car must have gas, its engine must not be broken, the tires must … … … …

• Still, if we lack any evidence to the contrary, commonsense instructs to proceed assuming that none of them holds.

• If, on the other hand, we obtain information that some of the abnormal situations is actually the case, then we must react appropriately and reconsider our plan.

• It is impossible to list all contingencies! This is the so-called qualification problem.

Qualification Problem• We must find a way to represent qualifications without exploding the domain

axiomatization with vast number of axioms.

• Not only this solution does not scale well, but also any change in our axiomatization will require tremendous effort.

• The Event Calculus assumes by default that no unexpected events occur and there are no unexpected effects of events.

• It uses a technique introduced by J. McCarthy called circumscription to minimize the extension of the language’s predicates.

• Circumscription allows us to perform default (nonmonotonic) reasoning.

Qualification Problem – Example• Apples are usually red:

Apple(x) Ab(x) Red(x)

• If we writeAb(x) GrannySmith(x) Rotten(x)and wish to add other conditions, we have to modify the formula.

• Alternatively, we can use a more elaboration tolerant approach:GrannySmith(x) Ab(x)Rotten(x) Ab(x)If we circumscribe Ab in these formulas, we get a formula equivalent to the one above.

• Circumscription provides the necessary and sufficient conditions given the specifications.

Other Issues – that we will not see

• Non-deterministic effects

• Continuous change

• Concurrent actions with cumulative/canceling effects

• Triggered actions

• Non-atomic actions (duration)

Outline

• Introduction to Action Theories• Basic Issues using the Event Calculus

– Frame Problem– Ramification Problem– Qualification Problem

• Familiarization with the Situation Calculus• Comparison of Action Theories• Golog & Planning• Knowledge

Situation Calculus

Situation Calculus – Fluents

Situation Calculus – Preconditions and Effects

Situation Calculus – Limitations

Situation Calculus – The Projection Problem

Situation Calculus – The Legality Task

Situation Calculus – The Frame Problem

Situation Calculus – The Frame Problem

Situation Calculus – Successor State Axioms

Situation Calculus – Successor State Axioms

Situation Calculus – Axiomatization

• A domain theory for the Situation Calculus consists of

– Successor state axioms for each relational and functional fluent. They provide solution to the frame problem

– Actions precondition axioms for each action. They characterize the conditions required for the action to be applied in a particular situation.

– Unique names axioms for actions

– A set of initial situation axioms. The initial values of fluents

– Foundational axioms for situations. They are domain independent

• Instead of the principle of inertia, Situation Calculus adopts Reiter’s “causal completeness assumption”.

Outline

• Introduction to Action Theories• Basic Issues using the Event Calculus

– Frame Problem– Ramification Problem– Qualification Problem

• Familiarization with the Situation Calculus• Comparison of Action Theories• Golog & Planning• Knowledge

Comparing Action Theories

Comparing Action Theories

Comparing Action Theories

Comparing Action Theories

Outline

• Introduction to Action Theories• Basic Issues using the Event Calculus

– Frame Problem– Ramification Problem– Qualification Problem

• Familiarization with the Situation Calculus• Comparison of Action Theories• Golog & Planning• Knowledge

Golog

Golog

Planning – Using the Situation Calculus

Outline

• Introduction to Action Theories• Basic Issues using the Event Calculus

– Frame Problem– Ramification Problem– Qualification Problem

• Familiarization with the Situation Calculus• Comparison of Action Theories• Golog & Planning• Knowledge

Knowledge

• As we saw, causality plays an essential role in commonsense reasoning.

• In real-world implementations, software agents or robots acquire information about their environment and extend their knowledge as they operate.

• A good plan for such agents is one that not only achieves the goal, but is also executable.

• Even if it can be shown that a plan must achieve the goal (and terminate), the agent may not have enough knowledge to execute it.

GATE 1

GATE 2

GATE 3

Knowledge – Example

GATE 1

GATE 2

GATE 3

??

??

????

The agent must be endowed with information about the world it inhabits and the ability to reason with and about this information.

Knowledge – Related Aspects

The end