Presentation is loading. Please wait.

Presentation is loading. Please wait.

Logic-based Artificial Intelligence Lluís Vila Grabulosa Artificial Intelligence PhD programe Dept. LSI.

Similar presentations


Presentation on theme: "Logic-based Artificial Intelligence Lluís Vila Grabulosa Artificial Intelligence PhD programe Dept. LSI."— Presentation transcript:

1 Logic-based Artificial Intelligence Lluís Vila Grabulosa Artificial Intelligence PhD programe Dept. LSI

2 2 vila@lsi.upc.es PhD course: Logic-based AI Context Artificial Intelligence Ai aims at building artifacts capable of perfoming on tasks the require intelligence. AI aims at understanding the nature of intelligent behaviour Intelligent behaviour...... is the result of taking rational decissions... is the result of other things Rational decissions...... can be computed in a (probably very complex) symbol processing system... cannot. Assuming the Symbol-system hypothesis... Rational decissions can be obtained from the combined action of a –correct representation –correct reasoning Assuming, also, the representation & reasoning hypothesis...... logic is the appropriate paradigm for specifing/producing/explainning rational decissions... logic is not an appropriate paradigm for that. Introduction

3 3 vila@lsi.upc.es PhD course: Logic-based AI Goal In the context of AI as the study of rational behaviour using a logic-based representation and reasoning system... the goal here is : Formalizing the changes of events and actions produced in a given domain EXAMPLE: the “blocks world”. Introduction

4 4 vila@lsi.upc.es PhD course: Logic-based AI Means A representation based on a logical language not restricted to First-Order Logic (although this will be our starting point) A reasoning system not constraint to deduction only but open to any inference startegy that comes up with correct conclusions (inferences). A computer language that supports the expression of our logical language plus some additional programming expressions. A computer program capable of : Interpreting expressions written in that language Interpreting our current goals Computing those goals correctly with respect to the reasoning system Presenting everything friendly to the user A computer able to compute that computer program. Introduction

5 5 vila@lsi.upc.es PhD course: Logic-based AI Symbols LOGIC SYMBOLS Relations   ≤ ≥ Connectives: tautology ■ contradiction □ and  or , ex-or  not  If , only if  if and only if  For all  Exists  Punctuation () [ ] [[ ]]   Miscelaneous ☺☹ META-LOGIC SYMBOLS Terms  1  2 Fòrmules   Clause C  Composition  1 ⃘  2 Substitution  1 {t i /x j } Unifiers  Sets:  Interpretation  〚〛 Mapping  Equiv.   def ↝ Satisf. ⊩ ⇢ Entailment ⊨ ⊭ Deduction ⊢ ⊬ Meta-logic ⇒ ⇔ Logic

6 6 vila@lsi.upc.es PhD course: Logic-based AI FOL Syntax Vocabulary Logical terms –Connectives: ■  □ , ,  –Variables: x,y,z, … –Punctuation Symbols: (, ) Non-logical symbols –constants, functions, predicates: strings of alphanumeric characters beginning with an upper-case letter, Terms A constant or a variable is a term If  1 …  n are terms and F is a function symbol then F(  1, …,  n ) is a term. Atom ■  □  are terms If  1 …  n are terms and P is a predicate symbol then P(  1, …,  n ) is an atom. Well-formed formulae (formula) An atom is a formula If  1,  2 are formula, then so are (  1 ), (  1  2 )  (  1  2 )  (  1  2 )  (  1  2 ) If x is a variable and  is a formula, then so are (  x  ), (  x  ) Abreviations First-Order Logic

7 7 vila@lsi.upc.es PhD course: Logic-based AI Example: Formalizing the Blocks World First-Order Logic On(A,Table,S0) On(D,Table,S0) On(C,B,S0) On(B,A,S0) Move(C,D,S0)  x Clear(table,x)  x Clear(x,s0)  x Clear(x,s0)  x  y On(x,y,s0) A block cannot be on two different objects in a situation  xs  yz (x  y  On(x,y,s)  On(x,z,s)) After moving a block on an object, the block is on the object.  xys (Move(x,y,s)  On(x,y,Succ(s))) If a block is not clear then it cannot be moved.  xs (  Clear(x,s)   y  Move(x,y,s)) If a block is not clear then nothing can be moved on it.  xs (  Clear(x,s)   y  Move(y,x,s))... Move S0 Clear(C,S0) Clear(D,S0)  Clear(A,S0)  Clear(B,S0)

8 8 vila@lsi.upc.es PhD course: Logic-based AI FOL Semantics Given a first-order language L... An interpretation of L is a triple    A formula  is satisfied by an interpretation , noted  ⊨  or  [[  ]] = true, iff when  is ■ when  is an atom P (  1, …,  n ) and   [[  1 ]], …,  [[  n ) ]]    [[P]] when  has the form (  1 ) and  [[  ]] = true when  has the form (  1  2 )  and  [[  1 ]] = true and  [[  2 ]] = true when  has the form (  1  2 )  and either  [[  1 ]] = true or  [[  2 ]] = true when  has the form (  1  2 )  and either  [[  1 ]] = false or  [[  2 ]] = true when  has the form (  1  2 )  and either both  [[  1 ]] and  [[  2 ]] are true, or false when  has the form (  x  ) and for all d ,  [[  {d/x}]] = true when  has the form (  x  ) and exists a d , such that  [[  {d/x}]] = true In the rest of the cases,  [[  ]] = false. A number of fomulae  1  n entails a formula  n+1, noted  1  n ⊨  n+1 iff any interpretation  that  [[  1     n ]]=true, it also  [[  n+1 ]]=true First-Order Logic

9 9 vila@lsi.upc.es PhD course: Logic-based AI FOL Automated Reasoning Equivalence Satisfiability Theorem Proving First-Order Logic

10 10 vila@lsi.upc.es PhD course: Logic-based AI FOL Theorem Proving Properties Sound Complete Semi-decidable Theorems Deduction theorem Refutation theorem Applications Proving equivalence Proving non-satisfiability First-Order Logic

11 11 vila@lsi.upc.es PhD course: Logic-based AI FOL Natural Deduction Style: Constructive theorem proving Properties Sound Complete Semi-decidable Components: No preprocessing 9 inference rules FOL axioms Derived inference rules Heuristics Proving an implicative form Proving a negative form Proving a disjunctive form... First-Order Logic

12 12 vila@lsi.upc.es PhD course: Logic-based AI FOL Resolution Style: Refutation Properties: Sound Complete Semi-decidable Components Preprocessing –Clause transformation –Clause simplification Two inference rules –Resolution rule –Factorization rule Strategies –Suport set resolution –Lineal resolution –Clause Ordering –Literal Ordering First-Order Logic

13 13 vila@lsi.upc.es PhD course: Logic-based AI Conjunction, Disjunction, Negation Exclusive-or P  Q  (P  Q)  ¬(P  Q) Double negation ¬¬ P  P De Morgan laws¬(P  Q)  ¬P  ¬Q ¬(P  Q)  ¬P  ¬Q 01 10 P¬P Formalizing knowledge using Logic 0000 0110 1010 1111 P Q PQPQ P  Q

14 14 vila@lsi.upc.es PhD course: Logic-based AI Implication Sufficient Condition  ShootDown  ComputerOff Necessary Condition ¬  ¬ ¬ TurnOn  ¬ ComputerOn  ComputerOn  TurnOn Formalizing knowledge using Logic 001 011 100 111 P Q PQPQ

15 15 vila@lsi.upc.es PhD course: Logic-based AI Double Implication Necessary and Sufficient condition  ComputerOn  TurnOn Definition   xy (Brother(x,y)  z Mother(x,z) ∧ Mother(x,z)) Formalizing knowledge using Logic 001 010 100 111 P Q PQPQ

16 16 vila@lsi.upc.es PhD course: Logic-based AI Universal Quantification Properties on a domain subset:  x ( x  Property x) “All birds fly.” Restricted Universal Quantification  x : x : Property x  def  x ( x  Property x) “All values on array A of dimension n are positive.” Formalizing knowledge using Logic Domain : animalsBx  def x is a bird Fx  def x flies  x (Bx  Fx) Domain : entersV(x)  def value of position x in array A.  x : 1≤x≤n : 0 ≤ V(x)   x (1≤x≤n  0 ≤ V(x) )

17 17 vila@lsi.upc.es PhD course: Logic-based AI Existential Quantification Restricted Existential Quantification  x : x : Property x  def  x ( x ∧ Property x) “There is a positive value in array A of dimension n.” Unic Existential “There is only one positive value in array A of dimension n.” ⇒ Equality is needed. Formalizing knowledge using Logic Domain : entersV(x)  def value of position x in array A.  x : 1≤x≤n : 0 ≤ V(x)   x ( 1≤x≤n ∧ 0≤V(x) )

18 18 vila@lsi.upc.es PhD course: Logic-based AI FOL with Equality Syntax If  1 =  2 are wffs then  1 =  2 is a wff. Semantics ℑ〚  1 =  2 〛 is true if and only if ℑ〚  1 〛 is the same than ℑ〚  2 〛 Equality theory: (congruence axioms) For any terms  i,  ’ i Reflexivity:   1 =  1 Simmetry:  1 =  2   2 =  1 Transitivity:  1 =  2   2 =  3   1 =  3 Function Monotonicity: For any symbol f,  1 =  ’ 1 ...   n =  ’ n  f(  1,...,  n )=f(  ’ 1,...,  ’ n ) Predicate Monotonicity: For any symbol P,  1 =  ’ 1 ...   n =  ’ n  P(  1,...,  n )  P(  ’ 1,...,  ’ n ) Computational aspects More Logic

19 19 vila@lsi.upc.es PhD course: Logic-based AI Equality Unicity: !  !  x Ax  def  x (Ax ∧  y (Ay  x=y) “There is only one positive value in array A of dimension n.” !  x (1<=x<=n ∧ 0<=A(x))  def  def  x (1<=x<=Dim(A) ∧ 0<=A(x) ∧  y (1<=y<=n ∧ 0<=A(y)  x=y)) k Existential  kx Ax  def  x 1 x 2... x n (Ax 1 ∧ Ax 2... ∧ Ax k ∧ x 1  x 2 ...  x k ) “There are only two positive values in array A of dimension n.” !  x ( x  def  x (x x ∧  x x  x)  2x (1<=x<=n ∧ 0<=A(x))  def  def  x 1 x 2 (1<= x 1 <=n ∧ 0<=A(x 1 ) ∧ 1<= x 2 <=n ∧ 0<=A(x 2 ) ∧ x 1  x 2 ) More Logic

20 20 vila@lsi.upc.es PhD course: Logic-based AI Sorting the domain Goal : Often, the domain at hand in naturally organized in various sorts of individuals. Ex: To talk about arrays, we have... a sort for the elements of the array, e.g.: characters. a sort for the index : integers a sort for the arrays Method: For each sort, we introduce a predicate : Ex  def x is an element ; Ix  def x is an index ; Ax  def x is an array of elements For each formula where one or more sorts appear, we introduce a condition forcing each term to be of the appropriate sort. Ex  def x is an element ; Ix  def x is an index ; Ax  def x is an array of elements Domain : animalsBx  def x is a bird Fx  def x flies  x (Bx  Fx) More Logic

21 21 vila@lsi.upc.es PhD course: Logic-based AI Reasoning about Change Context: AI as understanding human intelligence Logic-based Knowledge Representation and Reasoning Goal: Representing change –Describing actions, –Describing the effects of actions and events –Describing the state of the world before and after changing. Reasoning about change –Projection: Inferring the new situation after an action. –Abduction: Inferring that action and the precedent states that lead tot he current situation. –Induction: Identifying/Discovering actions as common situation sequences. –Planning: Finding a sequence of actions that takes from the current situation to a goal. Applications: Databases Robotics: common-sense Cognitive Science Intelligent agents: cooperation, negotiation,... Example: the blocks world The Frame Problem

22 22 vila@lsi.upc.es PhD course: Logic-based AI Introducing the Frame Problem Context: AI as understanding human intelligence Logic-based Knowledge Representation and Reasoning. Representing and reasoning about change: –Describing actions, –Describing the effects of actions and events –Describing the state of the world before and after changing. Informal definition: If we use classical logic, as well as discribing what changes, we have to describe what everything that does not change ! Example: –The blocks that does not move stay at the same place –The blocks do not change color. –... Goal: We’re looking for a formal framework (staying close to classical logic) where we can concentrate on what changes while the rest is automatically inferred. The Frame Problem

23 23 vila@lsi.upc.es PhD course: Logic-based AI Situation Calculus (S.C.) Goal Formalizing a changing environment using classical logic [McCarthy69] Ontology Situations: A situation describes a snapshot of the state of the world. Fluents: A fluent represent a piece of a situation, therefore it can be seen as a relationship that is subject to change and can be true or false at different situations. Actions: An action is something that may or maynot happen in a situation and whose happening may change the truth of some fluents yielding a different situation. Representation Language Classical logic: –Many-sorted First-Order logic –with Equility. Formalization method: Fluent and action reification. Sorts: –Situations, fluents, actions, fluent arguments The Frame Problem

24 24 vila@lsi.upc.es PhD course: Logic-based AI S.C. Formalization Vocabulary Sorts: Situations, Individuals,... Constants Function symbols: –fluents, –actions –Result Predicate symbols –Holds –   ≤ ≥ Fuents holding Holds(, ) Action occurrence Result(, ) Action specification Effect Axioms: describe what changes Frame Axioms: describe what does’nt change Holds(Clear(C),S0) Holds(On(C,B),S0) Holds(On(B,A),S0) Holds(On(A,Table),S0) Holds(On(D,Table),S0) Holds(On(C,D),Result(Move(C,D),S0)) S0 The Frame Problem Move(C,D)

25 25 vila@lsi.upc.es PhD course: Logic-based AI S.C. Effect Axioms Holds(Clear(x),s)  Holds(Clear(y),s)  x  y  x  Table  Holds(On(x,y),Result(Move(x,y),s)) Holds(Clear(x),s)  Holds(Clear(y),s)  Holds(On(x,z),s)  z  y  x  y  Holds(Clear(z),Result(Move(x,y),s)) Specify the pre-conditions and the effects of the execution of an action. S0 Clear(B)  On(C,B) On(B,A) On(A,Table) Clear(D) On(D,Table)  Clear(D) On(C,D) On(D,Table) S1=result(Move(C,D),S0) The Frame Problem Move(C,D) Clear(C) On(C,B) On(B,A) On(A,Table)

26 26 vila@lsi.upc.es PhD course: Logic-based AI S.C. Negative Effect Axioms Holds(Clear(x),s)  Holds(Clear(y),s)  Holds(On(x,z),s) x  y  x  Table  Holds(  On(x,z),Result(Move(x,y),s)) Holds(Clear(x),s)  Holds(Clear(y),s)  Holds(On(x,z),s)  x  y  z  y  Holds(  Clear(z),Result(Move(x,y),s)) Specify the pre-conditions and the effects of the execution of an action. Clear(C) On(C,B) On(B,A) On(A,Table) S0 Clear(B)  On(C,B) On(B,A) On(A,Table) Clear(D) On(D,Table) Clear(C) On(D,Table) On(C,D)  Clear(D) S1=result(Move(C,D),S0) The Frame Problem Move(C,D)

27 27 vila@lsi.upc.es PhD course: Logic-based AI S.C. Frame Axioms Holds(On(x,y),s)  x  z  Holds(On(x,y),Result(Move(z,w),s)) Holds(Clear(x),s)  x  w  Holds(Clear(x),Result(Move(z,w),s)) Specify the persistence of those fluents not affected by the execution of an action. S0S1=result(Move(C,D),S0) The Frame Problem Clear(C) On(C,B) On(B,A) On(A,Table) On(D,Table) Clear(D) Move(C,D) Clear(B)  On(C,B) On(B,A) On(A,Table) Clear(C) On(C,D) On(D,Table)  Clear(D)

28 28 vila@lsi.upc.es PhD course: Logic-based AI The Frame Problem Epistemological Problem: We need to specify |fluents| x |actions| frame axioms. I’d rather specify only those changes on fluents by each action. Computational Problem: We need to manage |fluents| x |actions| frame axioms. It can be heavy for any inference system. The Frame Problem

29 29 vila@lsi.upc.es PhD course: Logic-based AI The Origin of the Frame Problem 1. Theory Taking these effect and frame axioms... instead of... (some other axioms) 2. Formalization: Ontology + Qualification method Using the Situational Calculus... instead of... the Event Calculus or... 3. Logic Staying within classical logic... instead of... moving to some non-monotonic logic or some modal logic or... 4. Formal Language: Using a Logical Language... instead of... a functional language or... 5. Computational approach: Following a Representational approach... instead of a procedural approach or... 6. AI style: Doing Symbolic AI... instead of... Behaviour-based AI or... The Frame Problem

30 30 vila@lsi.upc.es PhD course: Logic-based AI Frame Problem : Criteria for a Solution Representation Parsimony The representation of effects and actions should be compact: the size of the representation should be roughly proportional to the complexity of the domain. Expressive Flexibility: Deal with... Ramifications: Integrity constraints Complex actions: Non-effect actions, Concurrent actions,Non-deterministic actions Continuous change Elaboration Tolerance The effort required to add new info to the representation should be proportional to the complexity of that information Computational Efficiency

31 31 vila@lsi.upc.es PhD course: Logic-based AI Making the Frame Axioms More Compact Idea: Introducing an Affects predicate. Formalization: We add the Universal Frame Axiom Holds(f,s)   Affects(a,f,s)  Holds(f,Result(a,s)) + a negated Affects axiom for each frame axiom x  v   Affects(Move(x,y), On(v,w),s)  Affects(Paint(z,c), On(x,y),s) x  z   Affects(Move(y,z), Clear(x),s)  Affects(Paint(y,c), Clear(x),s)  Affects(Move(y,z), Colour(x,c),s) x  y   Affects(Paint(y,c2),Colour(x,c1),s) Result: More compact and elegant Still require a large bunch of (smaller) axioms Observation: It’s sort of unintuitive to declare what is not affected: I’d rather declare what does change and take what does not for granted. The Frame Problem

32 32 vila@lsi.upc.es PhD course: Logic-based AI Explanation Closure Axioms Idea: “Say only what changes and taking everything else for granted”. Formalization’: We add the Universal Frame Axiom Holds(f,s)   Affects(a,f,s)  Holds(f,Result(a,s)) + an Explanation Closure Axiom for each fluent Affects(a,On(x,z),s)  a=Move(x,y) Affects(a,Clear(x),s)  a=Move(x,y) Affects(a,Colour(x,c2),s)  a=Paint(x,c1) Result: It entails both Affects and  Affects It entails  Affects(a,Colour(x,c),x) for any new action a It does not infer anything about  Holds(...) Is it Elaboration Tolerant ? The Frame Problem

33 33 vila@lsi.upc.es PhD course: Logic-based AI Coping with Negative Information Goal: “To infer negative holding consequences...” Formalization (for example about Colour) : + effect axioms... c1  c2   Holds(Colour(x,c1),Result(Paint(x,c2)) + initial state axioms... c=Red  Holds(Colour(x,c),S0) + more powerful Frame axioms  Affects(a,f,s)  [Holds(f,Result(a,s))  Holds(f,s)] Result: Is not Elaboration Tolerant ! If we add Bleach action Holds(Colour(x,White),Result(Bleach(x),s)) c  White   Holds(Colour(x,c),Result(Bleach(x),s)) then entails both  Affects(Bleach(A),Colour(A,c),S0) and Affects(Bleach(A),Colour(A,White),S0)... therefore some axiom reconstruction is needed: Instead of... Affects(a,Colour(x,c2),s)  a=Paint(x,c1)... we have... Affects(a,Colour(x,c2),s)  [a=Paint(x,c1)  a=Bleach(x)] The Frame Problem

34 34 vila@lsi.upc.es PhD course: Logic-based AI Solving the Frame Problem: Approaches n Monotonic solutions Explanation closure axioms... n Non-monotonic solutions Closed-world assumption Default reasoning Circumscription... n Higher-order solutions The Frame Problem

35 35 vila@lsi.upc.es PhD course: Logic-based AI Negation-as-Failure n Idea Everything that is not provable is false. n Results It works as a database but it is logically insconsistent: we can prove P and  P The Frame Problem

36 36 vila@lsi.upc.es PhD course: Logic-based AI Default Reasoning n Idea Distinguishing between normal conclusions and defeasible conclusions... The Frame Problem

37 37 vila@lsi.upc.es PhD course: Logic-based AI Circumscription n Idea Declaring the predicates whose extension must be minimised. CIRC[ , P] ⊨  P(B) if P(B) does not follow from  The Frame Problem

38 38 vila@lsi.upc.es PhD course: Logic-based AI Many-Sorted Logic Goal : Often, the domain at hand in naturally organized in various sorts of individuals. Ex: To talk about arrays, we have... a sort for the elements of the array, e.g.: characters. a sort for the index : integers a sort for the arrays Method: For each sort, we introduce a predicate : Ex  def x is an element ; Ix  def x is an index ; Ax  def x is an array of elements For each formula where one or more sorts appear, we introduce a condition forcing each term to be of the appropriate sort. Ex  def x is an element ; Ix  def x is an index ; Ax  def x is an array of elements Domain : animalsBx  def x is a bird Fx  def x flies  x (Bx  Fx) More Logic

39 39 vila@lsi.upc.es PhD course: Logic-based AI Logic Programming More Logic

40 40 vila@lsi.upc.es PhD course: Logic-based AI PROLOG More Logic

41 41 vila@lsi.upc.es PhD course: Logic-based AI Logic Programs for Reasoning about Actions A situation calculus program is the conjuntion of, n A finite set of observation sentences Holds(…, S0) n A finite set of effect sentences Holds(f’,Result(a,s))  Holds(f1,s)  …  Holds(fn,s)  … where the antecedent does not mention Affects n A finite set of affect clauses Affects(a,b,s)  Holds(f1,s)  …  Holds(fn,s)  … where the antecedent does not mention Affects n The universal frame axiom Holds(f,Result(a,s))  Holds(f,s)  not Affects(a,f,s) where the antecedent does not mention Affects n A finite set of background sentences not mentioning the predicates Holds or Affects Diff(x,y)  not Eq(x,y) Eq(x,x) More Logic

42 42 vila@lsi.upc.es PhD course: Logic-based AI Reasoning about Narratives A Narrative is n An Initial situation description Holds(f,S0) n A finite set of observation sentences of the form Happens(e,t) A Narrative reasoning system must be able to answer queries about HoldsAt(f,t) at different time points after the time of S0 by using common-sense to fill gaps and assume persistences. More Logic

43 43 vila@lsi.upc.es PhD course: Logic-based AI Event Calculus (E.C.): Formalization Motivation: Temporal database with explicit time Handle incomplete information about event occurrence and fluent holding Incomplete information about the time when events happen and fluents hold Reasoning towards past and future is symmetric Approach: Logic: –Logic Programming as the representation language and negation-by-failure as non- monotonic reasoning component –Using PROLOG as implementation language Ontology: Events, Fluents and time intervals and instants. Temporal Qualification: –A mix of temporal reification and temporal token arguments. –Event descriptions are decomposed into binary relationships Theory: –Not centered around the situation but around the fluent holding throughout time. –Axioms specify the relation between events ocurrence and fluents holding at any time. –A situation arises as we look at the set of fluents holding at a specific time. More Logic

44 44 vila@lsi.upc.es PhD course: Logic-based AI E.C. Predicates Event e denotes an event occurrence (not an event token but an event type) Time(e,t) denotes the time when e occurs Holds(p) expresses that p ’s fluent holds from the start to the end of period p HoldsAt(f,t) expresses that fluent f holds at time t After(e,f) denotes the period started by event e during which fluent f holds. Before(e,f) denotes the period... Initiates(e,f) expresses that event e causes fluent f to hold. Terminates(e,f) expresses that event e causes fluent f to cease holding. More Logic

45 45 vila@lsi.upc.es PhD course: Logic-based AI E.C. Axioms Describing the effects of events... Holds(After(e,f))  Initiates(e,f) Holds(Before(e,f))  Terminates(e,f) Temporal constraints between event times and period times... Start(After(e,f),e) End(Before(e,f),e) Start(Before(e2,f),e1)  Eq(After(e1,f),Before(e2,f)) End(After(e1,f),e2)  Eq(After(e1,f),Before(e2,f)) Definning Equality of two periods... Eq(After(e1,f),Before(e2,f))  Happens(After(e1,f)  Holds(Before(e2,f)  Time(e1,t1)  Time(e2,t2)  t1<t2  not Broken(t1,f,t2) Broken(t1,f1,t3)  Holds(After(e,f2))  Incompatible(f1,f2)  Time(e,t2)  t1<t2  t2<t3 Broken(t1,f1,t3)  Holds(Before(e,f2))  Incompatible(f1,f2)  Time(e,t2)  t1<t2  t2<t3 More Logic

46 46 vila@lsi.upc.es PhD course: Logic-based AI E.C. Axioms (cont.) Holding of fluents at specific time points... HoldsAt(f,t))  Holds(After(e,f)  In(t,After(e,f)) HoldsAt(f,t))  Holds(Before(e,f)  In(t,Before(e,f)) Definning In temporal constraint... In(t,p)  Start(p,e1)  End(p,e2)  Time(e1,t1)  Time(e2,t2)  t1<t  t<t2 In(t,p)  Start(p,e1)  not End(p,e2)  Time(e1,t1)  t1<t In(t,p)  End(p,e1)  not Start(p,e2)  Time(e1,t1)  t<t1 More Logic

47 47 vila@lsi.upc.es PhD course: Logic-based AI E.C. Application Given a description the effects of events (or actions), and a narrative description it answers queries about HoldsAt of fluents at a given time More Logic

48 48 vila@lsi.upc.es PhD course: Logic-based AI E.C. Example Given Effect axioms Initates(e,On(x,y))  Act(e,Move(x,y))  Time(e,t)  HoldsAt(Clear(x),t)  HoldsAt(Clear(y),t)  Diff(x,y)  Diff(x,Table) Terminates(e,On(x,y)) ...... Fluent Incompatibility Axioms Incompatible(On(x,y),On(x,z)))  Diff(y,z)... Narrative description... Act(E1,Move(A,D))... Initial Situation description... Initiates(E0,On(C,Table)) Time(T0,0)... Answer the query...  HoldsAt(On(x,y),7) More Logic

49 49 vila@lsi.upc.es PhD course: Logic-based AI Sharahan’s E.C. : Predicates Initiates(a,f,t) expresses that a fluent f holds after event a at time t. Terminates(a,f,t) expresses that fluent f doesn’t hold after event a at time t. Initially P (f) expresses that fluent f holds from time 0. Initially N (f) expresses that fluent f does not hold from time 0. Happens(a,t1,t2) expresses that event a starts at time t1 and finishes at t2. HoldsAt(f,t) means that the fluent f holds at time t. Clipped(t1,f,t2) expresses that the fluent f is terminated between t1 and t2. Declipped(t1,f,t2) expresses that the fluent f is initiated between t1 and t2. More Logic (M. Sharahan: An Abductive Event Calculus Planner JLP 44, 2000.)

50 50 vila@lsi.upc.es PhD course: Logic-based AI Sharahan’s E.C.: Axioms Fluents hold at a time t when... HoldsAt(f,t)  Initially P (f)   Clipped(0,f,t) HoldsAt(f,t3)  Happens(a,t1,t2)  Initiates(a,f,t1)  t2<t3   Clipped(t1,f,t3) Clipped(t1,f,t4)   a,t2,t3[Happens(a,t2,t3)  t1<t2  t3<t4  Terminates(a,f,t2)] Fluents do not hold at a time t when...  HoldsAt(f,t)  Initially N (f)   Declipped(0,f,t)  HoldsAt(f,t3)  Happens(a,t1,t2)  Initiates(a,f,t1)  t2<t3   Declipped(t1,f,t3) Delipped(t1,f,t4)   a,t2,t3[Happens(a,t2,t3)  t1<t2  t3<t4  Initiates(a,f,t2)] No event takes a negative amount of time: Happens(a,t1,t1)  t1<=t2. More Logic (M. Sharahan: An Abductive Event Calculus Planner JLP 44, 2000.)

51 51 vila@lsi.upc.es PhD course: Logic-based AI Logia Project: Protocol Spec Applying Reasoning about Action to reason about agent protocols: Goal functionallities: –Protocol specification –Protocol checking (for a given scenario) –Protocol planning Protocol Specification paradigm: You decide)... Representational approach: Event Calculus Programming language: PROLOG (prefereably sicstus prolog) Tasks: Part of bilbiographical research (in Multi-Agent Systems area): –Study the techniques for specifying communication between agents –Study the various approaches for formalizing protocols Part of technical development and experimentsh: –Program the Revised Event Calculus –Find an “interesting agent protocol” –Formalize it in logic –Formalize it in Event Calculus –Study/Program protocol checking funcionality: ­Check whether a specific agent communication scenario fulfill the protocol

52 52 vila@lsi.upc.es PhD course: Logic-based AI Protocol Specification Protocol = rep. of the allowed interactions among communicating agents. Protocol specification approaches: Based on directly expressing action sequences: –Petri-nets –Finite-State machines Based on expressing changes on social committments among beween agents

53 53 vila@lsi.upc.es PhD course: Logic-based AI Social Commitments Social commitments among agents: Commitments made from one agent to another to bring about a certain property. Commitments “result from/are changed” by communicative actions Social commitments as Event Calculus properties: Commitments are represented as properties in the event calculus Commitments are associated to communicative acts by associating preconditions to their corresponding properties. Base-level Commitment: C(x,y,p) = agent x commits to agent y for satisfying condition p Cinditional Commitment: CC(x,y,p1,p2) = if condition p1 is brought about then agent x will be committed to agent y for satisfying condition p2

54 54 vila@lsi.upc.es PhD course: Logic-based AI Creating and Manipulating Commitments Create(e(x),C(x,y,p)): Happens(e(x),t)  Initiates(e(x),C(x,y,p),t) Discharge(e(x),C(x,y,p)): Happens(e(x),t)  Initiates(e(x),p,t) Cancel(e(x),C(x,y,p)): Happens(e(x),t)  Terminates(e(x),C(x,y,p),t)  Initiates(e(x),C(x,y,p’),t) Release(e(x),C(x,y,p)): Happens(e(y),t)  Terminates(e(y),C(x,y,p),t) Assign(e(y),z,C(x,y,p)): Happens(e(y),t)  Terminates(e(y),C(x,y,p),t)  Initiates(e(y),C(x,z,p),t) Delegate(e(x),z,C(x,y,p)): Happens(e(x),t)  Terminates(e(x),C(x,y,p),t)  Initiates(e(x),C(z,y,p),t)

55 55 vila@lsi.upc.es PhD course: Logic-based AI Reasoning Rules on Commitments A protocol specification is a set of Initiates and Terminates clauses that define which properties pertaining to the protocol are initiated and terminated by each action A protocol run is a set of Happens clauses along with an ordering of the timepoints referred to in the preduicate.

56 56 vila@lsi.upc.es PhD course: Logic-based AI Specifiying Protocols Commitment Change Axioms capture the operational semantics (we assume uniqueness of names for events and fluents): Terminates(e(x),C(x,y,p),t)  HoldsAt(C(x,y,p),t)  Happens(e(x),t)  Initiates(e(x),p,t) Initiates(e(y),C(x,y,q),t)  Terminates(e(y),CC(x,y,p,q),t)  HoldsAt(CC(x,y,p,q),t)  Happens(e(y),t)  Initiates(e(y),p,t) Terminates(e(x),CC(x,y,p,q),t)  HoldsAt(CC(x,y,p,q),t)  Initiates(e(x),q,t)

57 57 vila@lsi.upc.es PhD course: Logic-based AI The Netbill Example Example from: Flexible protocol Specification and Execution: Applying Event Calculus Planning using Committments. Yolum P., Singh M., AAMAS’02. Roles: MR represents the merchant Ct represents the customer Domain-Specific fluents request(i) : a fluent meaning that the customer has requested a quote for item i. goods(i) : a fluent meaning that the merchant has delivered the goods i. pay(m) : a fluent meaning that the customer has paid the agreed upon amount m. receipt(i) : a fluent meaning that the merchant has delivered the receipt for i. Commitments accept(i,m) : an abbreviation for CC(CT,MR,goods(i),pay(m)) meaning that the customer is willing to pay if he receives the goods. promiseGoods(i,m) : an abbreviation for CC(CT,MR,accept(i),goods(m))... promiseReceipt(i,m) : an abbreviation for CC(MR,CT,pay(m),receipt(i))… offer(i,m) : an abbreviation for promiseGoods(i,m)promiseReceipt(i,m) Events (or Actions) sendRequest(i) sendEPO(i,m)...

58 58 vila@lsi.upc.es PhD course: Logic-based AI The Netbill Example (cont.) Definition of Initiates and Terminates: Initiates(sendRequest(i),request(i),t) … Initiates(sendEPO(i,m),pay(m),t)  HoldsAt(goods(i),t) … Terminates(sendQuote(i,m),request(i),t)  HoldsAt(request(i),t) … It is assumed that initially no commitments or predicates hold.


Download ppt "Logic-based Artificial Intelligence Lluís Vila Grabulosa Artificial Intelligence PhD programe Dept. LSI."

Similar presentations


Ads by Google