Logic based Artificial Intelligence Llus Vila Grabulosa Artificial
Logic based Artificial Intelligence Lluís Vila Grabulosa Artificial Intelligence Ph. D 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. . . • • 2 . . . logic is the appropriate paradigm for specifing/producing/explainning rational decissions. . . logic is not an appropriate paradigm for that. Ph. D course: Logic-based AI 2
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 Ph. D course: Logic-based AI 3
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 Ph. D course: Logic-based AI 4
Logic Symbols LOGIC SYMBOLS META-LOGIC SYMBOLS Relations ≤ ≥ Terms 1 2 Connectives: Fòrmules tautology ■ Clause C contradiction □ Composition and or , ex-or Substitution not Unifiers If , only if Sets: if and only if Interpretation 〚〛 Mapping For all Exists Equiv. def ↝ 1� 2 1{ti/xj} Punctuation () [ ] [[ ]] Satisf. ⊩ ⇢ Miscelaneous ☺☹ Entailment ⊨ ⊭ Deduction ⊢ ⊬ Meta-logic ⇒ ⇔ 5 Ph. D course: Logic-based AI 5
First Order Logic 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) If x is a variable and is a formula, then so are ( x ), ( x ) Abreviations 6 Ph. D course: Logic-based AI 6
First Order Logic Example: Formalizing the Blocks World Move A block cannot be on two different objects in a situation xs yz (x y On(x, y, s) On(x, z, s)) S 0 On(A, Table, S 0) On(D, Table, S 0) On(C, B, S 0) On(B, A, S 0) Clear(C, S 0) Clear(D, S 0) Clear(A, S 0) Clear(B, S 0) Move(C, D, S 0) x Clear(table, x) x Clear(x, s 0) x y On(x, y, s 0) 7 Ph. D course: Logic-based AI 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)). . . 7
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 when when is ■ is an atom P( 1, …, n) and [[ 1 ]], …, [[ n) ]] [[P]] has the form ( 1) and [[ ]] = true has the form ( 1 2), and [[ 1]] = true and [[ 2 ]] = true has the form ( 1 2), and either [[ 1]] = true or [[ 2 ]] = true has the form ( 1 2), and either [[ 1]] = false or [[ 2 ]] = true has the form ( 1 2), and either both [[ 1]] and [[ 2 ]] are true, or false has the form ( x ) and for all d D, [[ {d/x}]] = true has the form ( x ) and exists a d 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 8 Ph. D course: Logic-based AI 8
First Order Logic FOL Automated Reasoning Equivalence Satisfiability Theorem Proving 9 Ph. D course: Logic-based AI 9
First Order Logic FOL Theorem Proving Properties • • • Sound Complete Semi decidable Theorems • • Deduction theorem Refutation theorem Applications • • Proving equivalence Proving non satisfiability 10 Ph. D course: Logic-based AI 10
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 • • 11 Proving an implicative form Proving a negative form Proving a disjunctive form. . . Ph. D course: Logic-based AI 11
First Order Logic FOL Resolution Style: Refutation Properties: • • • Sound Complete Semi decidable Components • Preprocessing – – • Two inference rules – – • Resolution rule Factorization rule Strategies – – 12 Clause transformation Clause simplification Suport set resolution Lineal resolution Clause Ordering Literal Ordering Ph. D course: Logic-based AI 12
Formalizing knowledge using Logic Conjunction, Disjunction, Negation • Exclusive or • Double negation • De Morgan laws P Q (P Q) ¬(P Q) ¬P 0 1 1 0 ¬¬P P ¬(P Q) ¬P ¬Q 13 P Ph. D course: Logic-based AI P Q P Q 0 0 0 1 1 0 1 0 1 1 13
Formalizing knowledge using Logic Implication P Q 0 0 1 <condition> <conditionned> 0 1 1 Shoot. Down Computer. Off 1 0 0 1 1 1 Sufficient Condition Necessary Condition ¬ <condition> ¬ <conditionned> ¬Turn. On ¬Computer. On <conditionned> <condition> Computer. On Turn. On 14 Ph. D course: Logic-based AI 14
Formalizing knowledge using Logic Double Implication Q 0 0 1 <condition> <conditionned> 0 1 0 Computer. On Turn. On 1 0 0 1 1 1 Necessary and Sufficient condition Definition <defined concept> <definition> xy (Brother(x, y) z Mother(x, z)∧Mother(x, z)) 15 P Q P Ph. D course: Logic-based AI 15
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 Ph. D course: Logic-based AI 16
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 Ph. D course: Logic-based AI 17
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 Ph. D course: Logic-based AI 18
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 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. . . xn (Ax 1 ∧ Ax 2. . . ∧ Axk ∧ x 1 x 2 . . . 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) 2 x (1<=x<=n ∧ 0<=A(x)) 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) 19 Ph. D course: Logic-based AI 19
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 Ph. D course: Logic-based AI 20
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 Ph. D course: Logic-based AI 21
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 Ph. D course: Logic-based AI 22
The Frame Problem Situation Calculus (S. C. ) Goal • Formalizing a changing environment using classical logic [Mc. Carthy 69] 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: – – • • Formalization method: Fluent and action reification. Sorts: – 23 Many-sorted First-Order logic with Equility. Situations, fluents, actions, fluent arguments Ph. D course: Logic-based AI 23
The Frame Problem S. C. Formalization Vocabulary • • • Sorts: Situations, Individuals, . . . Constants Function symbols: – – • fluents, actions – Result Predicate symbols – Holds – ≤≥ Fuents holding Holds(<fluent>, <situation>) Action occurrence Result(<action>, <situation>) Action specification Effect Axioms: describe what changes Frame Axioms: describe what does’nt change 24 Move(C, D) Ph. D course: Logic-based AI S 0 Holds(Clear(C), S 0) Holds(On(C, B), S 0) Holds(On(B, A), S 0) Holds(On(A, Table), S 0) Holds(On(D, Table), S 0) Holds(On(C, D), Result(Move(C, D), S 0)) 24
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) 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)) Move(C, D) S 0 Clear(C) On(C, B) On(B, A) On(A, Table) 25 S 1=result(Move(C, D), S 0) Clear(D) On(D, Table) Ph. D course: Logic-based AI Clear(B) On(C, B) On(B, A) On(A, Table) Clear(D) On(C, D) On(D, Table) 25
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) 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)) Move(C, D) S 0 Clear(C) On(C, B) On(B, A) On(A, Table) 26 S 1=result(Move(C, D), S 0) Clear(D) On(D, Table) Ph. D course: Logic-based AI Clear(B) On(C, B) On(B, A) On(A, Table) Clear(C) On(D, Table) On(C, D) Clear(D) 26
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) 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)) Move(C, D) S 0 Clear(C) On(C, B) On(B, A) On(A, Table) 27 S 1=result(Move(C, D), S 0) On(D, Table) Clear(D) Ph. D course: Logic-based AI Clear(B) On(C, B) On(B, A) On(A, Table) Clear(C) On(C, D) On(D, Table) Clear(D) 27
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 Ph. D course: Logic-based AI 28
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 Ph. D course: Logic-based AI 29
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 Ph. D course: Logic-based AI 30
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 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, c 2), Colour(x, c 1), s) Result: • • More compact and elegant Still require a large bunch of (smaller) axioms Observation: • 31 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. Ph. D course: Logic-based AI 31
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, c 2), s) a=Paint(x, c 1) Result: • • 32 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 ? Ph. D course: Logic-based AI 32
The Frame Problem Coping with Negative Information Goal: “To infer negative holding consequences. . . ” Formalization (for example about Colour) : • + effect axioms. . . c 1 c 2 Holds(Colour(x, c 1), Result(Paint(x, c 2)) • + initial state axioms. . . c=Red Holds(Colour(x, c), S 0) • + 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), S 0) • and Affects(Bleach(A), Colour(A, White), S 0) • . . . therefore some axiom reconstruction is needed: Instead of. . . Affects(a, Colour(x, c 2), s) a=Paint(x, c 1). . . we have. . . Affects(a, Colour(x, c 2), s) [a=Paint(x, c 1) a=Bleach(x)] 33 Ph. D course: Logic-based AI 33
The Frame Problem Solving the Frame Problem: Approaches n Monotonic solutions • • n Non monotonic solutions • • n Explanation closure axioms. . . Closed world assumption Default reasoning Circumscription. . . Higher order solutions 34 Ph. D course: Logic-based AI 34
The Frame Problem Negation as Failure n Idea • n Everything that is not provable is false. Results • 35 It works as a database but it is logically insconsistent: we can prove P and P Ph. D course: Logic-based AI 35
The Frame Problem Default Reasoning n Idea • • 36 Distinguishing between normal conclusions and defeasible conclusions. . . Ph. D course: Logic-based AI 36
The Frame Problem Circumscription n Idea • • 37 Declaring the predicates whose extension must be minimised. CIRC[ , P] ⊨ P(B) if P(B) does not follow from Ph. D course: Logic-based AI 37
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 Ph. D course: Logic-based AI 38
More Logic Programming 39 Ph. D course: Logic-based AI 39
More Logic PROLOG 40 Ph. D course: Logic-based AI 40
More Logic Programs for Reasoning about Actions A situation calculus program is the conjuntion of, n A finite set of observation sentences Holds(…, S 0) n A finite set of effect sentences Holds(f’, Result(a, s)) Holds(f 1, s) … Holds(fn, s) … where the antecedent does not mention Affects n A finite set of affect clauses Affects(a, b, s) Holds(f 1, 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) 41 Ph. D course: Logic-based AI 41
More Logic Reasoning about Narratives A Narrative is n An Initial situation description Holds(f, S 0) n A finite set of observation sentences of the form Happens(e, t) A Narrative reasoning system must be able to answer queries about Holds. At(f, t) at different time points after the time of S 0 by using common sense to fill gaps and assume persistences. 42 Ph. D course: Logic-based AI 42
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: – – • • 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: – – – 43 Logic Programming as the representation language and negation-by-failure as nonmonotonic reasoning component Using PROLOG as implementation language 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. Ph. D course: Logic-based AI 43
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 Holds. At(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 Ph. D course: Logic-based AI 44
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(e 2, f), e 1) Eq(After(e 1, f), Before(e 2, f)) End(After(e 1, f), e 2) Eq(After(e 1, f), Before(e 2, f)) Definning Equality of two periods. . . Eq(After(e 1, f), Before(e 2, f)) Happens(After(e 1, f) Holds(Before(e 2, f) Time(e 1, t 1) Time(e 2, t 2) t 1<t 2 not Broken(t 1, f, t 2) Broken(t 1, f 1, t 3) Holds(After(e, f 2)) Incompatible(f 1, f 2) Time(e, t 2) t 1<t 2 t 2<t 3 Broken(t 1, f 1, t 3) Holds(Before(e, f 2)) Incompatible(f 1, f 2) Time(e, t 2) t 1<t 2 t 2<t 3 45 Ph. D course: Logic-based AI 45
More Logic E. C. Axioms (cont. ) 1. Holding of fluents at specific time points. . . Holds. At(f, t)) Holds(After(e, f) In(t, After(e, f)) Holds. At(f, t)) Holds(Before(e, f) In(t, Before(e, f)) Definning In temporal constraint. . . In(t, p) t 1<t In(t, p) 46 Start(p, e 1) End(p, e 2) Time(e 1, t 1) Time(e 2, t 2) t<t 2 Start(p, e 1) not End(p, e 2) Time(e 1, t 1) t 1<t End(p, e 1) not Start(p, e 2) Time(e 1, t 1) t<t 1 Ph. D course: Logic-based AI 46
More Logic E. C. Application Given • • a description the effects of events (or actions), and a narrative description it answers queries about • 47 Holds. At of fluents at a given time Ph. D course: Logic-based AI 47
More Logic E. C. Example 1. Given • Effect axioms Initates(e, On(x, y)) Act(e, Move(x, y)) Time(e, t) Holds. At(Clear(x), t) Holds. At(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(E 1, Move(A, D)). . . • Initial Situation description. . . Initiates(E 0, On(C, Table)) Time(T 0, 0). . . Answer the query. . . Holds. At(On(x, y), 7) 48 Ph. D course: Logic-based AI 48
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. 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, t 1, t 2) expresses that event a starts at time t 1 and finishes at t 2. Holds. At(f, t) means that the fluent f holds at time t. Clipped(t 1, f, t 2) expresses that the fluent f is terminated between t 1 and t 2. Declipped(t 1, f, t 2) expresses that the fluent f is initiated between t 1 and t 2. 49 Ph. D course: Logic-based AI 49
More Logic Sharahan’s E. C. : Axioms (M. Sharahan: An Abductive Event Calculus Planner JLP 44, 2000. ) Fluents hold at a time t when. . . Holds. At(f, t) Initially. P(f) Clipped(0, f, t) Holds. At(f, t 3) Happens(a, t 1, t 2) Initiates(a, f, t 1) t 2<t 3 Clipped(t 1, f, t 3) Clipped(t 1, f, t 4) a, t 2, t 3[Happens(a, t 2, t 3) t 1<t 2 t 3<t 4 Terminates(a, f, t 2)] Fluents do not hold at a time t when. . . Holds. At(f, t) Initially. N(f) Declipped(0, f, t) Holds. At(f, t 3) Happens(a, t 1, t 2) Initiates(a, f, t 1) t 2<t 3 Declipped(t 1, f, t 3) Delipped(t 1, f, t 4) a, t 2, t 3[Happens(a, t 2, t 3) t 1<t 2 t 3<t 4 Initiates(a, f, t 2)] No event takes a negative amount of time: Happens(a, t 1) t 1<=t 2. 50 Ph. D course: Logic-based AI 50
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): – – • Part of technical development and experimentsh: – – – 51 Study the techniques for specifying communication between agents Study the various approaches formalizing protocols 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 Ph. D course: Logic-based AI 51
Protocol Specification Protocol = rep. of the allowed interactions among communicating agents. Protocol specification approaches: • Based on directly expressing action sequences: – – • 52 Petri-nets Finite-State machines Based on expressing changes on social committments among beween agents Ph. D course: Logic-based AI 52
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, p 1, p 2) = if condition p 1 is brought about then agent x will be committed to agent y for satisfying condition p 2 53 Ph. D course: Logic-based AI 53
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 Ph. D course: Logic-based AI 54
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 Ph. D course: Logic-based AI 55
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) Holds. At(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) Holds. At(CC(x, y, p, q), t) Happens(e(y), t) Initiates(e(y), p, t) Terminates(e(x), CC(x, y, p, q), t) Holds. At(CC(x, y, p, q), t) Initiates(e(x), q, t) 56 Ph. D course: Logic-based AI 56
The Netbill 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. • promise. Goods(i, m): an abbreviation for CC(CT, MR, accept(i), goods(m)). . . • promise. Receipt(i, m): an abbreviation for CC(MR, CT, pay(m), receipt(i))… • offer(i, m): an abbreviation for promise. Goods(i, m)promise. Receipt(i, m) Events (or Actions) • send. Request(i) • send. EPO(i, m). . . 57 Ph. D course: Logic-based AI 57
The Netbill Example (cont. ) Definition of Initiates and Terminates: Initiates(send. Request(i), request(i), t) … Initiates(send. EPO(i, m), pay(m), t) Holds. At(goods(i), t) … Terminates(send. Quote(i, m), request(i), t) Holds. At(request(i), t) … It is assumed that initially no commitments or predicates hold. 58 Ph. D course: Logic-based AI 58
- Slides: 58