VIEWS: 7 PAGES: 58 CATEGORY: Education POSTED ON: 4/2/2010
Logic-based Artificial Intelligence Lluís Vila Grabulosa Artificial Intelligence PhD programe Dept. LSI Introduction 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. 2 PhD course: Logic-based AI vila@lsi.upc.es Introduction 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”. 3 PhD course: Logic-based AI vila@lsi.upc.es Introduction 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. 4 PhD course: Logic-based AI vila@lsi.upc.es Logic Symbols LOGIC SYMBOLS META-LOGIC SYMBOLS Relations ≤ ≥ Terms 1 2 Connectives: Fòrmules tautology ■ Clause C contradiction □ Composition 1⃘2 and or , ex-or Substitution 1{ti/xj} not Unifiers If , only if Sets: if and only if Interpretation 〚〛 Mapping For all Exists Equiv. def ↝ Punctuation () [ ] [[ ]] Satisf. ⊩ ⇢ Miscelaneous ☺☹ Entailment ⊨ ⊭ Deduction ⊢ ⊬ Meta-logic ⇒ ⇔ 5 PhD course: Logic-based AI vila@lsi.upc.es First-Order Logic Vocabulary FOL Syntax • 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), (12), (12), (12), (12) • If x is a variable and is a formula, then so are (x ), (x ) Abreviations 6 PhD course: Logic-based AI vila@lsi.upc.es First-Order Logic Example: Formalizing the Blocks World Move A block cannot be on two different objects in a situation xs yz (xy On(x,y,s)On(x,z,s)) After moving a block on an object, the block is on the object. S0 xys (Move(x,y,s)On(x,y,Succ(s))) On(A,Table,S0) Clear(C,S0) If a block is not clear then it cannot be moved. On(D,Table,S0) Clear(D,S0) xs (Clear(x,s) y Move(x,y,s)) On(C,B,S0) Clear(A,S0) On(B,A,S0) Clear(B,S0) If a block is not clear then nothing can be moved on it. xs (Clear(x,s) y Move(y,x,s)) Move(C,D,S0) ... x Clear(table,x) x Clear(x,s0) x Clear(x,s0) xy On(x,y,s0) 7 PhD course: Logic-based AI vila@lsi.upc.es First-Order Logic FOL Semantics Given a first-order language L ... An interpretation of L is a triple D, F, P 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 (12), and [[1]] = true and [[2 ]] = true • when has the form (12), and either [[1]] = true or [[2 ]] = true • when has the form (12), and either [[1]] = false or [[2 ]] = true • when has the form (12), and either both [[1]] and [[2 ]] are true, or false • when has the form (x ) and for all dD, [[ {d/x}]] = true • when has the form (x ) and exists a dD, 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 8 PhD course: Logic-based AI vila@lsi.upc.es First-Order Logic FOL Automated Reasoning Equivalence Satisfiability Theorem Proving 9 PhD course: Logic-based AI vila@lsi.upc.es First-Order Logic FOL Theorem Proving Properties • Sound • Complete • Semi-decidable Theorems • Deduction theorem • Refutation theorem Applications • Proving equivalence • Proving non-satisfiability 10 PhD course: Logic-based AI vila@lsi.upc.es First-Order Logic 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 • ... 11 PhD course: Logic-based AI vila@lsi.upc.es First-Order Logic 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 12 PhD course: Logic-based AI vila@lsi.upc.es Formalizing knowledge using Logic Conjunction, Disjunction, Negation P ¬P • Exclusive-or P Q (P Q) ¬(P Q) 0 1 1 0 • Double negation ¬¬P P • De Morgan laws ¬(P Q) ¬P ¬Q P Q PQ P Q ¬(P Q) ¬P ¬Q 0 0 0 0 0 1 1 0 1 0 1 0 1 1 1 1 13 PhD course: Logic-based AI vila@lsi.upc.es Formalizing knowledge using Logic Implication P Q PQ Sufficient Condition 0 0 1 <condition> <conditionned> 0 1 1 ShootDown ComputerOff 1 0 0 1 1 1 Necessary Condition ¬ <condition> ¬ <conditionned> ¬TurnOn ¬ComputerOn <conditionned> <condition> ComputerOn TurnOn 14 PhD course: Logic-based AI vila@lsi.upc.es Formalizing knowledge using Logic Double Implication P Q PQ Necessary and Sufficient condition 0 0 1 <condition> <conditionned> 0 1 0 ComputerOn TurnOn 1 0 0 1 1 1 Definition <defined concept> <definition> xy (Brother(x,y)z Mother(x,z)∧Mother(x,z)) 15 PhD course: Logic-based AI vila@lsi.upc.es Formalizing knowledge using Logic Universal Quantification Properties on a domain subset: x (<subset member condition>x Property x) “All birds fly.” Domain : animals Bx def x is a bird Fx def x flies x (Bx Fx) Restricted Universal Quantification x : <range>x : Property x def x (<range>x Property x) “All values on array A of dimension n are positive.” Domain : enters V(x) def value of position x in array A. x : 1≤x≤n : 0 ≤ V(x) x (1≤x≤n 0 ≤ V(x) ) 16 PhD course: Logic-based AI vila@lsi.upc.es Formalizing knowledge using Logic Existential Quantification Restricted Existential Quantification x : <range>x : Property x def x (<range>x ∧ Property x) “There is a positive value in array A of dimension n.” Domain : enters V(x) def value of position x in array A. x : 1≤x≤n : 0 ≤ V(x) x ( 1≤x≤n ∧ 0≤V(x) ) Unic Existential “There is only one positive value in array A of dimension n.” ⇒ Equality is needed. 17 PhD course: Logic-based AI vila@lsi.upc.es More Logic 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 18 PhD course: Logic-based AI vila@lsi.upc.es More Logic 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 x1x2 ...xn (Ax1 ∧ Ax2 ... ∧ Axk ∧ x1 x2 ... xk ) “There are only two positive values in array A of dimension n.” !x ( <property> x def x (x <range>x ∧ x <property> x x) 2x (1<=x<=n ∧ 0<=A(x)) def def x1x2 (1<= x1<=n ∧ 0<=A(x1) ∧ 1<= x2<=n ∧ 0<=A(x2) ∧ x1 x2) 19 PhD course: Logic-based AI vila@lsi.upc.es More Logic 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 : animals Bx def x is a bird Fx def x flies x (Bx Fx) 20 PhD course: Logic-based AI vila@lsi.upc.es The Frame Problem 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 21 PhD course: Logic-based AI vila@lsi.upc.es The Frame Problem 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. 22 PhD course: Logic-based AI vila@lsi.upc.es The Frame Problem 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 23 PhD course: Logic-based AI vila@lsi.upc.es The Frame Problem S.C. Formalization Vocabulary • Sorts: Situations, Individuals, ... • Constants Move(C,D) • Function symbols: – fluents, – actions – Result • Predicate symbols – Holds – ≤≥ Fuents holding S0 Holds(<fluent>,<situation>) Holds(Clear(C),S0) Holds(On(C,B),S0) Action occurrence Holds(On(B,A),S0) Result(<action>,<situation>) Holds(On(A,Table),S0) Holds(On(D,Table),S0) Action specification Effect Axioms: describe what changes Holds(On(C,D),Result(Move(C,D),S0)) Frame Axioms: describe what does’nt change 24 PhD course: Logic-based AI vila@lsi.upc.es The Frame Problem S.C. Effect Axioms Specify the pre-conditions and the effects of the execution of an action. Holds(Clear(x),s) Holds(Clear(y),s) xy xTable Holds(On(x,y),Result(Move(x,y),s)) Holds(Clear(x),s) Holds(Clear(y),s) Holds(On(x,z),s) zy xy Holds(Clear(z),Result(Move(x,y),s)) Move(C,D) S0 S1=result(Move(C,D),S0) Clear(C) Clear(D) Clear(B) Clear(D) On(C,B) On(D,Table) On(C,B) On(C,D) On(B,A) On(B,A) On(D,Table) On(A,Table) On(A,Table) 25 PhD course: Logic-based AI vila@lsi.upc.es The Frame Problem S.C. Negative Effect Axioms Specify the pre-conditions and the effects of the execution of an action. Holds(Clear(x),s) Holds(Clear(y),s) Holds(On(x,z),s) xy xTable Holds(On(x,z),Result(Move(x,y),s)) Holds(Clear(x),s) Holds(Clear(y),s) Holds(On(x,z),s) xy zy Holds(Clear(z),Result(Move(x,y),s)) Move(C,D) S0 S1=result(Move(C,D),S0) Clear(C) Clear(D) Clear(B) Clear(C) On(C,B) On(D,Table) On(C,B) On(D,Table) On(B,A) On(B,A) On(C,D) On(A,Table) On(A,Table) Clear(D) 26 PhD course: Logic-based AI vila@lsi.upc.es The Frame Problem S.C. Frame Axioms Specify the persistence of those fluents not affected by the execution of an action. Holds(On(x,y),s) xz Holds(On(x,y),Result(Move(z,w),s)) Holds(Clear(x),s) xw Holds(Clear(x),Result(Move(z,w),s)) Move(C,D) S0 S1=result(Move(C,D),S0) Clear(C) On(D,Table) Clear(B) Clear(C) On(C,B) Clear(D) On(C,B) On(C,D) On(B,A) On(B,A) On(D,Table) On(A,Table) On(A,Table) Clear(D) 27 PhD course: Logic-based AI vila@lsi.upc.es The Frame Problem 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. 28 PhD course: Logic-based AI vila@lsi.upc.es The Frame Problem 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 ... 29 PhD course: Logic-based AI vila@lsi.upc.es 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 30 PhD course: Logic-based AI vila@lsi.upc.es The Frame Problem 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 xv Affects(Move(x,y), On(v,w),s) Affects(Paint(z,c), On(x,y),s) xz Affects(Move(y,z), Clear(x),s) Affects(Paint(y,c), Clear(x),s) Affects(Move(y,z), Colour(x,c),s) xy 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. 31 PhD course: Logic-based AI vila@lsi.upc.es The Frame Problem 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 ? 32 PhD course: Logic-based AI vila@lsi.upc.es The Frame Problem Coping with Negative Information Goal: “To infer negative holding consequences ...” Formalization (for example about Colour) : • + effect axioms ... c1c2 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)) cWhite 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)] 33 PhD course: Logic-based AI vila@lsi.upc.es The Frame Problem Solving the Frame Problem: Approaches Monotonic solutions • Explanation closure axioms • ... Non-monotonic solutions • Closed-world assumption • Default reasoning • Circumscription • ... Higher-order solutions 34 PhD course: Logic-based AI vila@lsi.upc.es The Frame Problem Negation-as-Failure Idea • Everything that is not provable is false. Results • It works as a database but it is logically insconsistent: we can prove P and P 35 PhD course: Logic-based AI vila@lsi.upc.es The Frame Problem Default Reasoning Idea • Distinguishing between normal conclusions and defeasible conclusions • ... 36 PhD course: Logic-based AI vila@lsi.upc.es The Frame Problem Circumscription Idea • Declaring the predicates whose extension must be minimised. • CIRC[ , P] ⊨ P(B) if P(B) does not follow from 37 PhD course: Logic-based AI vila@lsi.upc.es More Logic 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 : animals Bx def x is a bird Fx def x flies x (Bx Fx) 38 PhD course: Logic-based AI vila@lsi.upc.es More Logic Logic Programming 39 PhD course: Logic-based AI vila@lsi.upc.es More Logic PROLOG 40 PhD course: Logic-based AI vila@lsi.upc.es More Logic Logic Programs for Reasoning about Actions A situation calculus program is the conjuntion of, A finite set of observation sentences Holds(…, S0) A finite set of effect sentences Holds(f’,Result(a,s)) Holds(f1,s) … Holds(fn,s) … where the antecedent does not mention Affects A finite set of affect clauses Affects(a,b,s) Holds(f1,s) … Holds(fn,s) … where the antecedent does not mention Affects The universal frame axiom Holds(f,Result(a,s)) Holds(f,s) not Affects(a,f,s) where the antecedent does not mention Affects A finite set of background sentences not mentioning the predicates Holds or Affects Diff(x,y) not Eq(x,y) Eq(x,x) 41 PhD course: Logic-based AI vila@lsi.upc.es More Logic Reasoning about Narratives A Narrative is An Initial situation description Holds(f,S0) 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. 42 PhD course: Logic-based AI vila@lsi.upc.es More Logic 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. 43 PhD course: Logic-based AI vila@lsi.upc.es More Logic 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. 44 PhD course: Logic-based AI vila@lsi.upc.es More Logic 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 45 PhD course: Logic-based AI vila@lsi.upc.es More Logic 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 46 PhD course: Logic-based AI vila@lsi.upc.es More Logic 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 47 PhD course: Logic-based AI vila@lsi.upc.es More Logic 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) 48 PhD course: Logic-based AI vila@lsi.upc.es More Logic Sharahan’s E.C. : Predicates (M. Sharahan: An Abductive Event Calculus Planner JLP 44, 2000.) 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. InitiallyP(f) expresses that fluent f holds from time 0. InitiallyN(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. 49 PhD course: Logic-based AI vila@lsi.upc.es More Logic Sharahan’s E.C.: Axioms (M. Sharahan: An Abductive Event Calculus Planner JLP 44, 2000.) Fluents hold at a time t when ... HoldsAt(f,t) InitiallyP(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) InitiallyN(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. 50 PhD course: Logic-based AI vila@lsi.upc.es 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 51 PhD course: Logic-based AI vila@lsi.upc.es 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 52 PhD course: Logic-based AI vila@lsi.upc.es 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 53 PhD course: Logic-based AI vila@lsi.upc.es 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) 54 PhD course: Logic-based AI vila@lsi.upc.es 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. 55 PhD course: Logic-based AI vila@lsi.upc.es 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) 56 PhD course: Logic-based AI vila@lsi.upc.es 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) ... 57 PhD course: Logic-based AI vila@lsi.upc.es 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. 58 PhD course: Logic-based AI vila@lsi.upc.es