Presentation is loading. Please wait.

Presentation is loading. Please wait.

Pervasive Computing Research Group Situation Calculus Χρήστος Αναγνωστόπουλος Αθήνα 2006.

Similar presentations


Presentation on theme: "Pervasive Computing Research Group Situation Calculus Χρήστος Αναγνωστόπουλος Αθήνα 2006."— Presentation transcript:

1 Pervasive Computing Research Group http://p-comp.di.uoa.gr Situation Calculus Χρήστος Αναγνωστόπουλος Αθήνα 2006

2 Pervasive Computing Research Group http://p-comp.di.uoa.gr First-order predicate calculus First-order logic ( FOL ) is a system of mathematical logic, extendingmathematical logic propositional logicpropositional logic (equivalently, sentential logic) and in turn extended bysentential logic second-order logicsecond-order logic. The atomic sentences of first-order predicate logic have the form: P(t 1,t 2,…,t n ), a predicate with one or more "subjects"predicate The new ingredient of FOL not found in propositional logic is quantification:propositional logicquantification  x.φ "for all x, φ“,  x.φ "for some x, φ" where φ is any sentence. We write φ as φ(x) and let φ(a) represent the result of replacing all ( free ) occurrences of x in φ(x) with a Interpretation: It means that φ(a) is true for any value of a and that there is an a such that φ(a)is true.

3 Pervasive Computing Research Group http://p-comp.di.uoa.gr First-order predicate calculus A first-order theory consists of a set of axioms (usually finite or recursivelyfirst-order theoryaxiomsrecursively enumerableenumerable) and the statements deducible from them FOL Vocabulary: Symbols denoting logical operators: ¬ (logical not),  (logical and),  (logical or), → (logical conditional), ↔ (logical biconditional).logical notlogical andlogical orlogical conditionallogical biconditional Symbols denoting quantifiers:  (universal quantification),  (existential quantification).universal quantificationexistential quantification Left and right parenthesis. An identity or equality symbol (=) is sometimes, but not always, included in the vocabulary. (P ↔ Q) is an abbreviation for (P → Q)  (Q → P). Example: Robot(x)  Object(o)  Pickup(x,o)  ¬Heavy(o) {Such expression entails true and does not implies any other expression, e.g., Robot(x)  Object(o)  Pickup(x,o)  Light(o) is not entailed} The usual set theory Zermelo-Fraenkel (1908) ZFC is an example of a first-order theory, and it is generally accepted that all of classical mathematics can be formalized in ZFC.ZFC (Peano arithmetic (1889))Peano arithmetic

4 Pervasive Computing Research Group http://p-comp.di.uoa.gr Second-order Logic In second-order logic (and further systems of higher-order logic), quantifierssecond-order logichigher-order logic over predicate letters are introduced. For example, equality can be defined in second-order logic by: x=y  def  P.(P(x)↔P(y)) Quantification over predicates is not permitted in first-order logic. In mathematical logic, second-order logic is an extension of eithermathematical logic propositional logicpropositional logic or first-order logic. Second-order logic contains variables infirst-order logic predicatepredicate positions (rather than only in term positions, as in first-order logic),term and quantifiers binding them.binding Example:  F. F(Alice)  ¬ F(Alice) which might express the principle of bivalence with respect to Alice: Interpretation: For every property F, either Alice has it or she doesn't.

5 Pervasive Computing Research Group http://p-comp.di.uoa.gr Second-order Logic Example: We can write in first-order logic a sentence like:  x.P(x) Interpretation: There is x that P(x) is true. But we cannot do the same with the predicate. That is, the following expression:  P.P(x) is not a sentence of first-order logic. But this is a legitimate sentence of second order logic. Interpretation: There is property P that x is member of. Second-order logic permits of various interpretations; frequently it is thought of as containing quantification over subsets of a domain, or functions from the domain into itself, rather than only over individual members of the domain. (f(x) = x-1)   x.(f(x)=0) → (x=1)  f.(f(x)  {0,1,2,…}  R) →(f(x)=x-1)

6 Pervasive Computing Research Group http://p-comp.di.uoa.gr Sitcalc::Overview FOL: Static representation of formalism. FOL: Sentences are either true or false in an interpretation and stay that way. FOL: There is seemingly nothing in FOL corresponding to any sort of change. Example: Alice is student. Student(Alice) {Current Belief} 1906:Alice was not a student initially. ¬ Student(Alice) 1925:Alice became student by enrolling at a University. Student(Alice) 1930:Alice later graduated and, hence, ceased to be a student. ¬ Student(Alice) 1937: Τι πιστεύεις; Belief revisions depend on Alice’s actions: {…,was born,…, enrolled at UNI, graduated, …} “In this case, whereas the world you are imagining is certainly changing, the beliefs you have about Alice’s history as a whole (or part) need not change at all”

7 Pervasive Computing Research Group http://p-comp.di.uoa.gr Sitcalc::Overview Sitcalc: Logic formalism designed for representing and reasoning about dynamical domains. John McCarthy and Patrick Hayes (1969), (1986). Ray Reiter (1991). F. Pirri and Reiter (1999). The basic elements of the Sitcalc are: The actions that can be performed in the world The fluents that can describe the state of the world The situations A domain is formalized by a number of formulae: Action pre-condition axioms, one for each action Successor state axioms, one for each fluent Axioms describing the world in various situations The foundational axioms of the sitcalc

8 Pervasive Computing Research Group http://p-comp.di.uoa.gr Sitcalc::Elements World: Robot, located in locations (x,y), moves around the world, picks up and drops items, some items too heavy to pick up, or fragile so that they break when they are dropped. The robot can repair any broken item that is holding. Elements of the World: Actions Fluents = {Predicates or Functions} Situations Objects = World \ {actions or situations} Actions: move(x,y) moving to new location(x,y), pickup(o) picking up an object o Poss(.) special predicate is used to indicating when an action is executable. Poss(a) means possible action whenever preconditions are true, but it does not imply that if we observe the action a it meant that such preconditions were true. MaPaHa 29

9 Pervasive Computing Research Group http://p-comp.di.uoa.gr Sitcalc::Elements Situations : A History of actions occurred. A finite sequence of actions. Period. Does not represent a state. Not a snapshot. Dynamic World : A series of situations. Initial Situation S 0 : The situation before any actions have been performed. Function symbol do(a,s): The new situation resulting from the performance of an action as arguments, and a situation as a result. The latter is a situation that results from performing action a in the given situation s. s=s’  def  do.(do(a,s)↔do(a,s’)) {s and s’ may relate to different states!}

10 Pervasive Computing Research Group http://p-comp.di.uoa.gr Sitcalc::Elements Example: { :S 0. move(2,3) :do(move(2,3), S 0 ) pickup(Ball) :do(pickup(Ball),do(move(2,3), S 0 )) } Describe the sequence of executed actions and not the state that result from execution. Fluents Statements whose truth value may change: relational fluents (final argument is s) Functions which return values: functional fluents (final argument is s) “Properties of the world ” Example:{ is_carrying(o,s) : indicates when robot is carrying an object o in a particular situation s is_carrying(Ball, S 0 ): is false is_carrying(Ball, do(pickup(Ball), S 0 )): is true location ( do(move(2,3), S 0 )) = (2,3) }

11 Pervasive Computing Research Group http://p-comp.di.uoa.gr Sitcalc::Formulae Action Preconditions Some actions may not be executable in a given situation. E.g., it is impossible to put down an object unless one is in fact carrying it. The restriction of the performance of an action modeled through the Poss(a,s). {excitability of actions} Example: Poss(drop(o),s) ↔ is_carrying(o,s) Poss(pickup(o),s) ↔ (  z.¬is_carrying(z,s)  ¬heavy(o)) Action Effects Given a possible action in a situation, one must specify the effects of that action on the fluents. Example: Poss(pickup(o),s) → is_carrying(o,do(pickup(o),s)) Poss(drop(o),s)  fragile(o) → broken(o,do(pickup(o),s)) While those formulae CORRECTLY describe the affect of the actions, it is not sufficient to CORRECTLY describe the action in logic (p, ¬ p: p=effects), because of the frame problem.

12 Pervasive Computing Research Group http://p-comp.di.uoa.gr Sitcalc::Formulae Previous formulae seem suitable to reasoning about the effects of the actions, they have a critical weakness – they cannot be used to derive the non-effects of actions. Actions are typically specified by what they change, with the implicit assumption that everything else (the frame) remain unchanged Example: It is not possible to deduce that after picking up an object, the robot’s location remains unchanged! This requires the so-called frame axiom: Poss(pickup(o),s)  location(s) = (x,y) → location(do(pickup(o),s)) = (x,y) Problem of acclimatizing dynamic worlds. Very large KB of such axioms. Difficult to specify all changes of the world! Solution: Successor state axiom One must enumerate as effect axioms all the ways in which the value of a particular fluent can be changed. The effect axioms affecting the value of fluent F(x,s) can be written in generalized form as positive and a negative effect axiom. Poss(a,s)  γ+ F (x,a,s) → F(x,do(a,s)) Poss(a,s)  γ- F (x,a,s) → ¬F(x,do(a,s))

13 Pervasive Computing Research Group http://p-comp.di.uoa.gr Sitcalc::Formulae 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 (reasoning about the value of the broken fluent) : s=do(pickup(glass),do(move(2,3), S 0 ) Poss(a,s) → [broken(o,do(a,s)) ↔ (a=drop(o)  fragile(o))  (broken(o,s)  a  repair(o,s)))] :-? do(a,s). :- drop( glass ), :- not repair( glass,s ). 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)}

14 Pervasive Computing Research Group http://p-comp.di.uoa.gr Sitcalc::Formulae If a fluent is not affected by an action, there is no way to deduce it did not change. 1. ¬locked(door,s) → open(door,do(opens,s)) 2. ¬locked(door,s) → ¬locked(door,do(opens,s)) It is deduced that: ¬locked(door,do(opens,s)) ? Actions are typically specified by what they change, with the implicit assumption that everything else (the frame) remain unchanged

15 Pervasive Computing Research Group http://p-comp.di.uoa.gr Sitcalc::An example Precondition Axioms Poss(pickup(x),s) ↔  z.¬Holding(z,s) Poss(putonfloor(x),s) ↔ Holding(x,s) Poss(putontable(x),s) ↔ Holding(x,s) Successor State Holding(x,do(a,s)) ↔ a=pickup(x)  Holding(x,s)  a  putonfloor(x)  a  putontable(x) OnTable(x,do(a,s)) ↔ OnTable(x,s)  a  pickup(x)  a = putontable(x) OnFloor(x,do(a,s)) ↔ OnFloor(x,s)  a  pickup(x)  a = putonfloor(x) Initial state ¬Holding(x,S 0 ) OnTable(x, S 0 ) ↔ x=A  x=B Proc: RemoveBlock(x) : pickup(x) ; putonfloor(x) Proc: ClearTable : while  x. OnTable(x) do loop[OnTable(x)?;RemoveBlock(x)] KB |=  s Do(ClearTable, S 0, s). s=do(putonfloor(B),do(pickup(B),do(putonfloor(A),do(pickup(A), S 0 ))))

16 Pervasive Computing Research Group http://p-comp.di.uoa.gr


Download ppt "Pervasive Computing Research Group Situation Calculus Χρήστος Αναγνωστόπουλος Αθήνα 2006."

Similar presentations


Ads by Google