Situation Calculus Vassilis Papataxiarhis Foundations of Databases June, 2006 June, 2006.

Slides:



Advertisements
Similar presentations
Artificial Intelligence
Advertisements

Predicate Logic Colin Campbell. A Formal Language Predicate Logic provides a way to formalize natural language so that ambiguity is removed. Mathematical.
First-Order Logic: Better choice for Wumpus World Propositional logic represents facts First-order logic gives us Objects Relations: how objects relate.
The Logic of Quantified Statements
Situation Calculus for Action Descriptions We talked about STRIPS representations for actions. Another common representation is called the Situation Calculus.
Artificial Intelligence Chapter 21 The Situation Calculus Biointelligence Lab School of Computer Sci. & Eng. Seoul National University.
© by Kenneth H. Rosen, Discrete Mathematics & its Applications, Sixth Edition, Mc Graw-Hill, 2007 Chapter 1: (Part 2): The Foundations: Logic and Proofs.
Basic Structures: Sets, Functions, Sequences, Sums, and Matrices
L41 Lecture 2: Predicates and Quantifiers.. L42 Agenda Predicates and Quantifiers –Existential Quantifier  –Universal Quantifier 
Knowledge Representation Methods
1 Predicate Logic Rosen 6 th ed., § Predicate Logic Predicate logic is an extension of propositional logic that permits concisely reasoning.
Propositional Calculus A propositional calculus formula is composed of atomic propositions, which area simply statements that are either true or false.
Pervasive Computing Research Group Situation Calculus Χρήστος Αναγνωστόπουλος Αθήνα 2006.
Knowledge Representation using First-Order Logic (Part II) Reading: Chapter 8, First lecture slides read: Second lecture slides read:
Knowledge Evolution Up to now we have not considered evolution of the knowledge In real situations knowledge evolves by: –completing it with new information.
Predicate Calculus.
First Order Logic. This Lecture Last time we talked about propositional logic, a logic on simple statements. This time we will talk about first order.
Predicates and Quantifiers
Section 1.3: Predicates and Quantifiers
Discrete Mathematics Goals of a Discrete Mathematics Learn how to think mathematically 1. Mathematical Reasoning Foundation for discussions of methods.
The Foundations: Logic and Proofs
A Logic for Decidable Reasoning about Services Yilan Gu Dept. of Computer Science University of Toronto Mikhail Soutchanski Dept. of Computer Science Ryerson.
 Predicate: A sentence that contains a finite number of variables and becomes a statement when values are substituted for the variables. ◦ Domain: the.
The Relational Model: Relational Calculus
1st-order Predicate Logic (FOL)
Theory and Applications
First Order Predicate Calculus Chapter 7. Propositional logic v. FOPC §Propositional calculus deals only with facts l P : I-love-all-dogs l facts are.
Chapter 1, Part II: Predicate Logic With Question/Answer Animations.
CMPF144 FUNDAMENTALS OF COMPUTING THEORY Module 5: Classical Logic.
Pattern-directed inference systems
1 Logical Agents CS 171/271 (Chapter 7) Some text and images in these slides were drawn from Russel & Norvig’s published material.
First Order Logic Lecture 2: Sep 9. This Lecture Last time we talked about propositional logic, a logic on simple statements. This time we will talk about.
Course Overview and Road Map Computability and Logic.
Chapter 1, Part II: Predicate Logic With Question/Answer Animations.
Copyright © Curt Hill Quantifiers. Copyright © Curt Hill Introduction What we have seen is called propositional logic It includes.
PHIL012 Class Notes 1/15/2001. Outline Announcements, web page Review Homework Problems (1-7) Set Theory Review & Problem 8 (if time) Assignment for Wednesday.
(CSC 102) Lecture 8 Discrete Structures. Previous Lectures Summary Predicates Set Notation Universal and Existential Statement Translating between formal.
Section 2.1. Section Summary Definition of sets Describing Sets Roster Method Set-Builder Notation Some Important Sets in Mathematics Empty Set and Universal.
1 Introduction to Abstract Mathematics Chapter 2: The Logic of Quantified Statements. Predicate Calculus Instructor: Hayk Melikya 2.3.
Chapter 2 Logic 2.1 Statements 2.2 The Negation of a Statement 2.3 The Disjunction and Conjunction of Statements 2.4 The Implication 2.5 More on Implications.
Word Problem Consider the following problem: To register, you will need either a yellow card or a note from the Dean. To obtain a note from the Dean you.
1 Introduction to Abstract Mathematics Predicate Logic Instructor: Hayk Melikya Purpose of Section: To introduce predicate logic (or.
Artificial Intelligence First-Order Logic (FOL). Outline of this Chapter The need for FOL? What is a FOL? Syntax and semantics of FOL Using FOL.
For Wednesday Read chapter 9, sections 1-3 Homework: –Chapter 7, exercises 8 and 9.
Fall 2008/2009 I. Arwa Linjawi & I. Asma’a Ashenkity 1 The Foundations: Logic and Proofs Predicates and Quantifiers.
CS 285- Discrete Mathematics Lecture 4. Section 1.3 Predicate logic Predicate logic is an extension of propositional logic that permits concisely reasoning.
LDK R Logics for Data and Knowledge Representation First Order Logics (FOL) Originally by Alessandro Agostini and Fausto Giunchiglia Modified by Fausto.
First Order Logic Lecture 3: Sep 13 (chapter 2 of the book)
Semantics of Predicate Calculus For the propositional calculus, an interpretation was simply an assignment of truth values to the proposition letters of.
Predicate Logic One step stronger than propositional logic Copyright © Curt Hill.
Albert Gatt LIN3021 Formal Semantics Lecture 3. Aims This lecture is divided into two parts: 1. We make our first attempts at formalising the notion of.
ARTIFICIAL INTELLIGENCE [INTELLIGENT AGENTS PARADIGM] Professor Janis Grundspenkis Riga Technical University Faculty of Computer Science and Information.
First-Order Logic Semantics Reading: Chapter 8, , FOL Syntax and Semantics read: FOL Knowledge Engineering read: FOL.
Artificial Intelligence 2004 Planning: Situation Calculus Review STRIPS POP Hierarchical Planning Situation Calculus (John McCarthy) situations.
Lecture 041 Predicate Calculus Learning outcomes Students are able to: 1. Evaluate predicate 2. Translate predicate into human language and vice versa.
Section 1.4. Propositional Functions Propositional functions become propositions (and have truth values) when their variables are each replaced by a value.
Discrete Mathematical Structures: Theory and Applications 1 Logic: Learning Objectives  Learn about statements (propositions)  Learn how to use logical.
1 Section 7.1 First-Order Predicate Calculus Predicate calculus studies the internal structure of sentences where subjects are applied to predicates existentially.
Chapter 2 1. Chapter Summary Sets (This Slide) The Language of Sets - Sec 2.1 – Lecture 8 Set Operations and Set Identities - Sec 2.2 – Lecture 9 Functions.
F oundations for the Situation Calculus ● Paper by: Hector Levesque, Fiora Pirri, and Ray Reiter ● Year of Publication: 1998 Presented on 5 th Nov
3. The Logic of Quantified Statements Summary
Knowledge Representation using First-Order Logic
Chapter 3 The Logic of Quantified Statements
1st-order Predicate Logic (FOL)
MA/CSSE 474 More Math Review Theory of Computation
Artificial Intelligence Chapter 21. The Situation Calculus
Predicates and Quantifiers
Representations & Reasoning Systems (RRS) (2.2)
1st-order Predicate Logic (FOL)
Presentation transcript:

Situation Calculus Vassilis Papataxiarhis Foundations of Databases June, 2006 June, 2006

First-Order Logic (FOL) (1/4) First-Order Logic is a system of mathematical logic. First-Order Logic is a system of mathematical logic. FOL is extending Propositional Logic FOL is extending Propositional Logic Variables represent objects of a “universe of discourse” Variables represent objects of a “universe of discourse” Quantification over variables Quantification over variables

First-Order Logic (FOL) (2/4) FOL Vocabulary FOL Vocabulary Set of constants which represents objects of a “universe of discourse”, e.g. Socrates, 20, 40 … Set of constants which represents objects of a “universe of discourse”, e.g. Socrates, 20, 40 … Set of function symbols with arity 1, Set of function symbols with arity 1, e.g. father_of (Socrates), average( average (20, 40), 40), … Set of predicates with arity 1, e.g. father (Socrates), … Set of predicates with arity 1, e.g. father (Socrates), … Infinite set of variables, e.g. x, y, z … Infinite set of variables, e.g. x, y, z …

First-Order Logic (FOL) (3/4) FOL Vocabulary (cont.) FOL Vocabulary (cont.) Logical operators: ¬ (not),  (and),  (or), →(conditional), ↔(biconditional) Logical operators: ¬ (not),  (and),  (or), →(conditional), ↔(biconditional) Left and right parenthesis: “ ( “, “ ) ” Left and right parenthesis: “ ( “, “ ) ” Quantifiers:  (existential),  (universal) Quantifiers:  (existential),  (universal) Equality symbol “=“ is sometimes included, not always. Equality symbol “=“ is sometimes included, not always. Unlike predicates, fuction symbols are not true or false, but represent objects of the “universe”. Unlike predicates, fuction symbols are not true or false, but represent objects of the “universe”.

First-Order Logic (FOL) (4/4) Examples: Examples:  x P(x), “for at least one object a, P(a) is true”  x P(x), “for at least one object a, P(a) is true”  x P(x), “for any object a, P(a) is true”  x P(x), “for any object a, P(a) is true”  x (P(x)   y (P(y) → x=y)), “P(x) holds for exactly one object”  x (P(x)   y (P(y) → x=y)), “P(x) holds for exactly one object”

Second-Order Logic (SOL) (1/3) In FOL we quantify over individuals, but not over properties. In FOL we quantify over individuals, but not over properties. In FOL we can find the individuals of a property, but how can we find the properties of an individual? In FOL we can find the individuals of a property, but how can we find the properties of an individual? E.g. Suppose a simple knowledge base (KB): father(John). E.g. Suppose a simple knowledge base (KB): father(John). :-? father (x). KB|=x=John But we can’t ask :-? X (John). KB|=X=father

Second-Order Logic (SOL) (2/3) SOL is extending FOL SOL is extending FOL Variables in predicate positions (rather than only in individual positions in FOL) Variables in predicate positions (rather than only in individual positions in FOL) Quantification over predicates Quantification over predicates As a result, SOL has more “expressive power” than FOL does. As a result, SOL has more “expressive power” than FOL does. E.g. In FOL there is no way to say explicitly that individuals a and b have at least a same property in common, but in SOL we can say: E.g. In FOL there is no way to say explicitly that individuals a and b have at least a same property in common, but in SOL we can say:  P ( P(a)  P(b) )

Second-Order Logic (SOL) (3/3) Examples:  P P(John), “There is a property P that John is member of”  P P(John), “There is a property P that John is member of”  F F(John)  ¬F(John) (principle of bivalence)  F F(John)  ¬F(John) (principle of bivalence) “For every property, either John has it or he doesn’t.” “For every property, either John has it or he doesn’t.” Equality in SOL can be defined by: Equality in SOL can be defined by: x=y  P (P(x)↔P(y)) x=y  P (P(x)↔P(y))

Situation Calculus : Overview The Situation Calculus is a logic formalism designed for representing and reasoning about dynamical domains. The Situation Calculus is a logic formalism designed for representing and reasoning about dynamical domains. McCarthy, Hayes 1969 McCarthy, Hayes 1969 Reiter 1991 Reiter 1991 In First-Order Logic, sentences are either true or false and stay that way. Nothing is corresponding to any sort of change. In First-Order Logic, sentences are either true or false and stay that way. Nothing is corresponding to any sort of change. SitCalc represents changing scenarios as a set of SOL formulae. SitCalc represents changing scenarios as a set of SOL formulae.

Situation Calculus : Basic Elements Actions that can be performed in the world Actions that can be performed in the world Actions can be quantified Actions can be quantified Fluents that describe the state of the world Fluents that describe the state of the world Situations represent a history of action occurrences Situations represent a history of action occurrences A dynamic world is modeled as progressing through a series of situations as a result of various actions being performed within the world A dynamic world is modeled as progressing through a series of situations as a result of various actions being performed within the world A finite sequence of actions A finite sequence of actions A situation is not a state, but a history A situation is not a state, but a history

Situation Calculus : Formulae A domain is encoded in SOL by three kind of formulae A domain is encoded in SOL by three kind of formulae Action precondition axioms and action effects axioms Action precondition axioms and action effects axioms Successor state axioms, one for each fluent Successor state axioms, one for each fluent The foundational axioms of the situation calculus The foundational axioms of the situation calculus

Situation Calculus : An Example (1/10) World: World: robot robot items items locations (x,y) locations (x,y) moves around the world moves around the world picks up or drops items picks up or drops items some items are too heavy for the robot to pick up some items are too heavy for the robot to pick up some items are fragile so that they break when they are dropped some items are fragile so that they break when they are dropped robot can repair any broken item that it is holding robot can repair any broken item that it is holding

Situation Calculus : An Example (2/10) Actions Actions move(x, y): robot is moving to a new location (x, y) move(x, y): robot is moving to a new location (x, y) pickup(o): robot picks up an object o pickup(o): robot picks up an object o drop(o): robot drops the object o that holds drop(o): robot drops the object o that holds

Situation Calculus : An Example (3/10) Situations Situations Initial situation S 0 : no actions have yet occurred Initial situation S 0 : no actions have yet occurred A new situation, resulting from the performance of an action a in current situation s, is denoted using the function symbol do(a, s). A new situation, resulting from the performance of an action a in current situation s, is denoted using the function symbol do(a, s). do(move(2, 3), S 0 ): denotes the new situation after the performance of action move(2, 3) in initial situation S 0. do(move(2, 3), S 0 ): denotes the new situation after the performance of action move(2, 3) in initial situation S 0. do(pickup(Ball ), do(move(2, 3), S 0 )) do(pickup(Ball ), do(move(2, 3), S 0 )) do(a,s) is equal to do(a’,s’) s=s’ and a=a’ do(a,s) is equal to do(a’,s’) s=s’ and a=a’

Situation Calculus : An Example (4/10) Fluents: “properties of the world” Fluents: “properties of the world” Relational fluents Relational fluents Statements whose truth value may change Statements whose truth value may change They take a situation as a final argument They take a situation as a final argument is_carrying(o, s): robot is carrying object o in situation s is_carrying(o, s): robot is carrying object o in situation s E.g. Suppose that the robot initially carries nothing is_carrying(Ball, S 0 ) : FALSE is_carrying(Ball, do(pickup(Ball ), S 0 )) : TRUE

Situation Calculus : An Example (5/10) Fluents (cont.) Fluents (cont.) Functional fluents Functional fluents Functions that return a situation-dependent value Functions that return a situation-dependent value They take a situation as a final argument They take a situation as a final argument location(s): returns the location (x, y) of the robot in situation s location(s): returns the location (x, y) of the robot in situation s

Situation Calculus : An Example (6/10) Action Preconditions Axioms Action Preconditions Axioms Some actions may not be executable in a given situation Some actions may not be executable in a given situation Poss(a,s): special binary predicate Poss(a,s): special binary predicate denotes the executability of action a in situation s denotes the executability of action a in situation s Examples: Examples: Poss(drop(o),s) ↔ is_carrying(o,s) Poss(pickup(o),s) ↔ (  z ¬is_carrying(z,s)  ¬heavy(o)) Poss(pickup(o),s) ↔ (  z ¬is_carrying(z,s)  ¬heavy(o))

Situation Calculus : An Example (7/10) Action Effects Axioms Action Effects Axioms Specify the effects of an action on the fluents Specify the effects of an action on the fluents Examples: Examples: Poss(pickup(o),s) → is_carrying(o,do(pickup(o),s)) Poss(pickup(o),s) → is_carrying(o,do(pickup(o),s)) Poss(drop(o),s)  fragile(o) → broken(o,do( drop(o),s)) Poss(drop(o),s)  fragile(o) → broken(o,do( drop(o),s)) Is that enough? No, because of the frame problem Is that enough? No, because of the frame problem

Situation Calculus : An Example (8/10) The frame problem The frame problem How can we derive the non-effects of axioms? How can we derive the non-effects of axioms? E.g. How can we derive that after picking up an object, the robot’s location remains unchanged? E.g. How can we derive that after picking up an object, the robot’s location remains unchanged? This requires a formulae like This requires a formulae like Poss(pickup(o),s)  location(s) = (x,y) → location(do(pickup(o),s)) = (x,y) Problem: too many of such axioms, difficult to specify all Problem: too many of such axioms, difficult to specify all

Situation Calculus : An Example (9/10) The solution: Successor state axioms The solution: Successor state axioms Specify all the ways the value of a particular fluent can be changed Specify all the ways the value of a particular fluent can be changed Poss(a,s)  γ + F (x,a,s) → F(x,do(a,s)) Poss(a,s)  γ + F (x,a,s) → F(x,do(a,s)) Poss(a,s)  γ - F (x,a,s) → ¬F(x,do(a,s)) Poss(a,s)  γ - F (x,a,s) → ¬F(x,do(a,s)) γ + F describes the conditions under which action a in situation s makes the fluent F become true in the successor situation do(a,s). γ + F describes the conditions under which action a in situation s makes the fluent F become true in the successor situation do(a,s). γ - F describes the conditions under which performing action a in situation s makes fluent F false in the successor situation. γ - F describes the conditions under which performing action a in situation s makes fluent F false in the successor situation.

Situation Calculus : An Example (10/10) Successor state axioms (cont.) Successor state axioms (cont.) Poss(a,s) → [F(x,do(a,s)) ↔ γ + F (x,a,s)  (F(x,s)  ¬γ - F (x,a,s))] Poss(a,s) → [F(x,do(a,s)) ↔ γ + F (x,a,s)  (F(x,s)  ¬γ - F (x,a,s))] “Given that it is possible to perform a in s, the fluent F would be true in the resulting situation do(a,s) iff performing a in s would make it true, or it is true in s and performing a in s would not make it false. ” Example: Example: Poss(a,s) → [broken(o,do(a,s)) ↔ (a=drop(o)  fragile(o)) Poss(a,s) → [broken(o,do(a,s)) ↔ (a=drop(o)  fragile(o))  (broken(o,s)  a  repair(o,s))]  (broken(o,s)  a  repair(o,s))]

Situation Calculus : A Complete Example Precondition Axioms Precondition Axioms Poss(pickup(o),s) ↔  z ¬is_carrying(z,s)  ¬heavy(o) Poss(putonfloor(o),s) ↔ is_carrying(o,s) Poss(putontable(o),s) ↔ is_carrying(o,s) Successor State Axioms Successor State Axioms is_carrying(o,do(a,s)) ↔ a=pickup(o)  (is_carrying(o,s)  a  putontable(o)  a  putonfloor(o) ) OnTable(o,do(a,s)) ↔ (OnTable(o,s)  a  pickup(o))  a = putontable(o) OnFloor(o,do(a,s)) ↔ (OnFloor(o,s)  a  pickup(o))  a = putonfloor(o) Initial state Initial state ¬is_carrying(o,S 0 ) OnTable(o, S 0 ) ↔ o=A  o=B proc: RemoveBlock(o) : pickup(o) ; putonfloor(o) endProc; proc: ClearTable : while  o OnTable(o) do RemoveBlock(o) endWhile endProc; KB |=  s Do(ClearTable, S 0, s). s=do(putonfloor(B),do(pickup(B),do(putonfloor(A),do(pickup(A), S 0 ))))

Situation Calculus : DB-Updates Overview We can formalize the evolution of a DB during a sequence of transactions We can formalize the evolution of a DB during a sequence of transactions Transactions are same as actions Transactions are same as actions During the evolution, a DB pass through different states During the evolution, a DB pass through different states Updatable DB-relations Updatable DB-relations Once again: The frame problem Once again: The frame problem

Situation Calculus : DB-Updates An Example (1/7) Suppose that DB involves 3 relations: Suppose that DB involves 3 relations: 1. enrolled (st, course, s): student st is enrolled in course course when DB is in state s 2. grade (st, course, grade, s): The grade of student st in course course is grade when the DB is in state s 3. prerequ (pre, course): pre is a prerequisite course for course course (Notice that last relation is state independent so is not expected to change during the evolution of the database.)

Situation Calculus : DB-Updates An Example (2/7) Three transactions: Three transactions: 1. register (st, course): Register student st in course course 1. register (st, course): Register student st in course course 2. change (st, course, grade): Change the current grade of student st in course course to grade 2. change (st, course, grade): Change the current grade of student st in course course to grade 3. drop (st, course): Student st drops course course 3. drop (st, course): Student st drops course course

Situation Calculus : DB-Updates An Example (3/7) Initial DB state Initial DB state First-order specification of what is true in S 0 First-order specification of what is true in S 0 E.g. E.g. S 0 enrolled (Mary, C100, S 0 ) grade (Bill, M200, 70, S 0 )  p¬prerequ (p, C100) (  p) ¬prerequ (p, C100)

Situation Calculus : DB-Updates An Example (4/7) Transaction Preconditions Transaction Preconditions Transactions have preconditions which must be satisfied by the current DB state Transactions have preconditions which must be satisfied by the current DB state E.g. E.g. 1. Poss(register (st,c),s) ↔  pprerequ (p,c) → 1. Poss(register (st,c),s) ↔ [(  p) prerequ (p,c) → (  g) grade(st,p,g,s) (  g) grade(st,p,g,s)  g>=50] Poss(change (st,c,g),s) ↔ (  g’) grade(st,c,g’,s) 2. Poss(change (st,c,g),s) ↔ (  g’) grade(st,c,g’,s)  g’  g ↔ enrolled(st,c,s) 3. Poss(drop(st,c),s) ↔ enrolled(st,c,s)

Situation Calculus : DB-Updates An Example (5/7) Update Specifications Update Specifications Specify the effects of all transactions on all updatable DB relations Specify the effects of all transactions on all updatable DB relations E.g. E.g. Poss(a,s) → [enrolled(st,c,do(a,s)) ↔ a=register(st,c) Poss(a,s) → [enrolled(st,c,do(a,s)) ↔ a=register(st,c)  enrolled(st,c,s)  a  drop(st,c)]

Situation Calculus : DB-Updates An Example (6/7) Update Specifications(cont.) Update Specifications(cont.) It is the update specification axioms which “solve” the frame problem It is the update specification axioms which “solve” the frame problem E.g. E.g. Poss(a,s)  a  register(st,c)  a  drop(st,c) → (enrolled(st,c,do(a,s)) ↔ enrolled(st,c,s)) register() and drop() are the only transactions that can affect the truth value of enrolled() register() and drop() are the only transactions that can affect the truth value of enrolled()

Situation Calculus : DB-Updates An Example (7/7) Querying a Database Querying a Database All updates are virtual, DB is never physically changed All updates are virtual, DB is never physically changed To query a DB, resulting from a sequence of transactions, we must refer to this sequence in the query To query a DB, resulting from a sequence of transactions, we must refer to this sequence in the query E.g. E.g. To determine if John is enrolled in any courses after the transaction sequence drop (John, C100), register (Mary, C100) has been “executed”, we must determine whether DB|=  c enrolled(John, c, do(register (Mary, C100), do(drop (John, C100), S 0 ))).

References J.McCarthy and P.J.Hayes, Some Philosophical Problems from the Standpoint of Artificial Intelligence, in Machine Intelligence 4, ed D.Michie and B.Meltzer, Edinburgh University Press (1969) R. Reiter, On Specifying Database Updates, Journal of Logic Programming, 25(1):53–91, 1995.

ANY QUESTIONS?