Situation Calculus
Total Page:16
File Type:pdf, Size:1020Kb
Institute for Software Technology Situation Calculus Gerald Steinbauer Institute for Software Technology Gerald Steinbauer Situation Calculus - Introduction 1 Institute for Software Technology Organizational Issues • Dates – 05.10.2017 8:45-11:00 (HS i12) lecture and first assignment – 12.10.2017 8:45-11:00 (HS i12) lecture and programming assignment – 11.10.2017 18:00-18:45 (HS i11) practice – 18.10.2017 18:00-18:45 (HS i11) practice and solution for first assignment – 16.10.2017 12:00 (office IST) submission first assignment – 09.11.2016 23:59 (group SVN) submission programming assignment Gerald Steinbauer Situation Calculus - Introduction 2 Institute for Software Technology Agenda • Organizational Issues • Motivation • Introduction – Brief Recap of First Order Logic (if needed) • Situation Calculus (today) – Introduction – Formal Definition – Usage • Programming with Situation Calculus (next week) – Implementation – Domain Modeling Gerald Steinbauer Situation Calculus - Introduction 3 Institute for Software Technology Literature “Knowledge in Action” “Artificial Intelligence: A by Raymond Reiter Modern Approach” MIT Press by Stuart Russel amd Peter Norvig Prentice Hall Gerald Steinbauer Situation Calculus - Introduction 4 Institute for Software Technology Motivation What is Situation Calculus good for? Gerald Steinbauer Situation Calculus - Introduction 5 Institute for Software Technology There is nothing permanent except change. Heraclitus of Ephesus, 535–c. 475 BC Gerald Steinbauer Situation Calculus - Introduction 6 Institute for Software Technology Perception-Decision-Execution Gerald Steinbauer Situation Calculus - Introduction 7 Institute for Software Technology Dealing with Multiple Worlds Gerald Steinbauer Situation Calculus - Introduction 8 Institute for Software Technology Belief Management Gerald Steinbauer Situation Calculus - Introduction 9 Institute for Software Technology Brief Recap First Order Logic Gerald Steinbauer Situation Calculus - Introduction 10 Institute for Software Technology The Situation Calculus • is a methodology to reason about actions and change • it allows deductive reasoning on • how to behave • what are the consequences • proposed by John McCarthy (1963) • further developed by Raymond Reiter and others • originally used for database transactions (1995) • uses second-order logic (Reiter 2001) • modeling of dynamic systems (e.g., robots, plants, …) • basis for several (action) programming languages (e.g. Golog, Yagi) Gerald Steinbauer Situation Calculus - Introduction 11 Institute for Software Technology Properties of the Situation Calculus • Advantages • allows for reasoning about actions and change • uses the foundations of logic • allows for testing and proving of properties • is a solution to some fundamental problems of AI (e.g. frame problem) • Drawbacks • based on second-order logic • domain modeling is complex and error prune • real implementations are somehow fuzzy • computational expensive (in particular if you do it wrong) Gerald Steinbauer Situation Calculus - Introduction 12 Institute for Software Technology Building Blocks Domain Dependent Fluents Objects Situations Actions The green building blocks are different sorts in the second order logic. The blue building block is used to retrieve properties about the world. Gerald Steinbauer Situation Calculus - Introduction 13 Institute for Software Technology States • abstraction of the world (temporal, situation) • Electrical Engineering or Computer Science • several applications of states • Deterministic Finite Automaton • protocols, parser • model checking, testing submission signup pass A Q,, ,q0, F q0 q1 q2 q30 no submission not pass Gerald Steinbauer Situation Calculus - Introduction 14 Institute for Software Technology Situations • inductively defined as term • a constant symbol S0 denotes the initial situation (nothing happened so far) • a binary function symbol do:actionssitationssituations • situations can be interpreted as sequences of actions • do(a,s) performs action a in situation s • do(a,s) adds action a to sequence represented by s • binary predicate symbol :situationsituation ss’ denotes that s is a proper subsequence of s’ Gerald Steinbauer Situation Calculus - Introduction 15 Institute for Software Technology Sates versus Situations • situations are different to states • they contain a history of what happened so far • snapshots of properties of the world are retrieved by fluents, i.e. which predicates hold in a situation • two situations are different if their sequence is different • the “state” of fluents may be the same Gerald Steinbauer Situation Calculus - Introduction 16 Institute for Software Technology Situation Tree an do(an,S0) a3 a2 an a1 S0 a3 a2 do(an,do(a1,S0)) a1 an a3 a do(a1,S0) 2 a1 Gerald Steinbauer Situation Calculus - Introduction 17 Institute for Software Technology Example – Dress Up Gerald Steinbauer Situation Calculus - Introduction 18 Institute for Software Technology Actions • actions are the only entities which change something (i.e., situations or truth values of fluents) • actions are represented as function symbols (can be used as terms) • actions have a unique name, if the names are different the actions perform different things • actions can have parameters of arity n, e.g. moveto(object, room) or sleep() • an action a is executed in a situation s by the function s’=do(a,s) leading to a new situation s’ • an action has a precondition – in which situation an action is possible to be executed Gerald Steinbauer Situation Calculus - Introduction 19 Institute for Software Technology Action Precondition Axioms • take care if an action a is executable • we introduce a binary predicate symbol Poss:actionsituation • is a sentence in the form Poss(A(x1,…,xn),s)A(x1,…,xn,s) • A is a formula with free variables x1,…,xn and s • e.g. • axioms have to be defined for all actions Gerald Steinbauer Situation Calculus - Introduction 20 Institute for Software Technology Fluents • used to catch the dynamic world • fluents are related to states • represent relations that change from situation to situation • we call them relational fluents Gerald Steinbauer Situation Calculus - Introduction 21 Institute for Software Technology Relational Fluents • represents a relation (or properties) of objects in a situation s • it is represented by a predicate symbol with arity n+1 in the form F(x1,…,xn,s) • F:(objectsactions)nsituation→{T,F} • it represents the truth value of a relation or property in a certain situation • examples: at(x,y,s) or broken(x,s) Gerald Steinbauer Situation Calculus - Introduction 22 Institute for Software Technology Frame Problem • a important (fundamental) problem of AI • formulated by John McCarhty and Patrick Hayes • related to the abstract modeling of dynamic domains • how to efficiently specify what is changed by an action and what remains the same • sloppy justification: logic has no memory • we need frame axioms • example: the color of an object does not change if it is lifted, color(x,c,s)→color(x,c,do(lift(x),s)) Gerald Steinbauer Situation Calculus - Introduction 23 Institute for Software Technology Successor State Axioms (1) • are a solution to the Frame Problem • naively we have to specify all effect axioms (because of the frame problem) + a. φF (x1,…,xn, y1,…,ym,s)→F(x1,…,xn,do(A(y1,…,ym),s)) - b. φF (x1,…,xn, y1,…,ym,s)→¬F(x1,…,xn,do(A(y1,…,ym),s)) + - • φF and φF formulas with free variables x1,…,xn; y1,…,ym and s • example: fragile(x,s)→broken(x,do(drop(x),s)) • we use the Causal Completeness Assumption • a and b specify all casual laws related to A and F • we are looking for a more compact representation relating situations Gerald Steinbauer Situation Calculus - Introduction 24 Institute for Software Technology Successor State Axioms (2) • we start with a reasonable assumption - • F(x1,…,xn,s)˄¬F(x1,…,xn,do(A(y1,…,ym),s))→φF (x1,…,xn,y1,…,ym,s) - • F(x1,…,xn,s)˄¬φF (x1,…,xn,y1,…,ym,s)→F(x1,…,xn,do(A(y1,…,ym),s)) [PFA] + • ¬F(x1,…,xn,s)˄F(x1,…,xn,do(A(y1,…,ym),s))→φF (x1,…,xn,y1,…,ym,s) + • ¬F(x1,…,xn,s)˄¬φF (x1,…,xn,y1,…,ym,s)→¬F(x1,…,xn,do(A(y1,…,ym),s)) [NFA] • lead to 2 x #actions x #fluents frame axioms • fragile(x,s)→broken(x,do(drop(x),s)) [PEA] • ¬broken(x,s)˄¬fragile(x,s)→¬broken(x,do(drop(x),s)) [NFA] Gerald Steinbauer Situation Calculus - Introduction 25 Institute for Software Technology Successor State Axioms (3) • the general solution • positive and negative normal form effect axioms + • → F(t1,…,tn,do(α,s)) + • (y1,…,ym)[a=α˄x=t ˄ ] → F(x1,…,xn,do(a,s)) + • → F(x1,…,xn,do(a,s)) +(1) +(k) • ( ˅…˅ ) → F(x1,…,xn,do(a,s)) + • (x1,…,xn,a,s) → F(x1,…,xn,do(a,s)) [PNF] - • (x1,…,xn,a,s) → ¬F(x1,…,xn,do(a,s)) [NNF] • unique name axiom for actions • A(x)B(y) and A(x1,…,xn)=A(y1,…,yn) → x1=y1˄…˄ xn=yn • if T entails ¬(x,a,s). +(x,a,s)˄ -(x,a,s) F(x,do(a,s)) +(x,a,s)˅F(x,s)˄¬ -(x,a,s) [SSA-RF] Gerald Steinbauer Situation Calculus - Introduction 26 Institute for Software Technology Successor State Axioms (4) • now we need only #actions + #fluents axioms Gerald Steinbauer Situation Calculus - Introduction 27 Institute for Software Technology Summary Successor State Axioms • provides a solution to the Frame Problem • yields simple compact axioms • does not solve the qualification and ramification problem • length of successor state axioms ~ #actions change a fluent • assumption: only a few actions change a fluent Gerald Steinbauer Situation Calculus - Introduction 28 Institute for Software Technology Initial Situation • S0 is a special constant of sort situation • it represents the initial situation • DS0 is the initial database • it comprises sentences describing the initial theory of the world, i.e. fluents that hold in S0 • S0 is the only situation mentioned • DS0 must not mention Poss, do or • it may comprise non-situation terms • examples: location(robot,office1,S0 ), mountain(MtEverest) Gerald Steinbauer Situation Calculus - Introduction 29 Institute for Software Technology Foundational Axioms for Situations • ensure some properties of situations • situations are understood as sequence of actions • abbreviation: do(an,(…do(a1,S0)) = do([a1,an],S0) • s’ s denotes that s’ is a subsequence of s 1.