Successfully reported this slideshow.
Upcoming SlideShare
×

# Seminar@KRDB 2011 - Montali - Runtime Reasoning with the Event Calculus: from Theory to Practice

283 views

Published on

Seminar on "Runtime Reasoning with the Event Calculus: from Theory to Practice" at the KRDB Research Centre for Knowledge and Data, Faculty of Computer Science, Free University of Bozen-Bolzano (Italy), 06/07/2011.

• Full Name
Comment goes here.

Are you sure you want to Yes No
• Be the first to comment

• Be the first to like this

### Seminar@KRDB 2011 - Montali - Runtime Reasoning with the Event Calculus: from Theory to Practice

1. 1. Outline   Event Calculus   Reasoning   Proactive vs reactive   Cached Event Calculus   Implementation   Applications: monitoring of   Business constraints   Commitment-based business interactions
2. 2. The Event Calculus   First formalization: Kowalski and Sergot, 1986   “Simple EC”   Temporal reasoning in classical logic   Deals with atomic events   No frame axioms: time periods, no global state, NAF   Extended versions: (Kowalski and Sadri, 1995) (Shanahan, 1999) (Miller and Shanahan, 2002)   Events with durations, continuous fluents, trajectories, … A logic-based framework for reasoning about events and their effects
3. 3. Time, Events and Traces   Actions executed by agents   The execution of an action is represented by means of events occurring at time points (atomic events)   The time structure is linear and has an initial state   The (finite) set of events occurred during an instance of the system is a narrative or execution trace 0 event event occurrence
4. 4. Fluents and States   Events affect the state of the system through their effects   Making some properties true   Making some properties false   Properties change over time, and are called fluents   Each fluent models a “partial” system’s state 0 fluent
5. 5. Some applications 1/2   Active databases   (Kowalski, 1992) and (Fernandes et al., 1997)   Commonsense reasoning   Book by Mueller (2006)   Contains also a detailed description of the EC and of a SAT-based Discrete EC Reasoner   Cognitive robotics   Shanahan et al.   see the Cognitive Robotics I and II projects: http://www.iis.ee.ic.ac.uk/~m.witkowski/cogrob2/
6. 6. Some applications 2/2   Normative aspects and legal reasoning   Open Multi-Agent Systems   Specification of norms and “social constraints” (Artikis et al., 2009)   Commitment-based interactions (Yolum and Singh, 2002), (Chesani et al, 2009)   Specification of the normative states of contracts (Farrell et al., 2005)   Service Oriented Computing   Formalization of BPEL (Rouached et al., 2008),(Galooul et al. 2010)   WS-Agreement requirements (Mahbub and Spanoudakis, 2007)   Business Process Management   Workflow modeling (Cicekli and Cicekli, 2006)   Monitoring of business constraints (Montali et al, 2011)   Clinical guidelines and BMK (Bottrighi et al, 2011)
7. 7. An example   When a robot moves from room X to room Y, it is no more at X and it is now at Y, provided that the battery is non empty   When a robot executes a move, then the battery level decreases of one unit
8. 8. An example   When a robot moves from room X to room Y, it is no more at X and it is now at Y, provided that the battery is non empty   When a robot executes a move, then the battery level decreases of one unit Event Effect Context
9. 9. Proof Theory and Reasoning Facilities EC Framework Logic-Based Framework Logic-based language Event Calculus Axiomatization EC ontology EC Specification Execution Trace Domain dependent Domain independent
10. 10. The Simple EC Ontology 1 2 3 4 5 6 7 8 9 10 11 12 13 14 initiates(a,f,3) terminates(b,f,12) happens(a,3) holdsat(f,7) declip clip 0 f MVI (3,12] for f a b
11. 11. Simple EC Ontology with MVIs holds_at(f,t) Fluent f holds at time t. !!! f does not hold at the time it is declipped, but holds at the time it is clipped initially(f) Fluent f begins to hold from the initial state happens(e,t) Event e occurs at time t initiates(e,f,t) e has the capability of initiating f at time t. If f does not already hold at t, it is declipped and will start to hold from t+1. terminates(e,f,t) e has the capability of terminating f at time t. If f holds at t, it is clipped and will cease to hold from t+1. mvi(f,ts,te) (ts,te] is a maximal validity interval for f : • f uninterruptedly holds inside (ts,te] • f is clipped at ts • f is declipped at te weak EC Common sense law of inertia
12. 12. Specification of a system 1/2   Description of the initial state of the system   Initiates and terminates axioms relating domain- dependent events with domain-specific fluents   Test of holds_at predicates for context- dependent effects   The specification is given by a set of clauses   The definition can be omitted when true initially(F):- definition. initiates(E,F,T):- definition. terminates(E,F,T):- definition.
13. 13. Specification of a system 1/2   What about the definitions?   We are in a FO setting à variables   Variables are universally quantified with scope the entire close   initiates(a,f,T) states that a can initiate f at any time   The definitions of clauses are a conjunction of literals and may contain   Other predicates taken from the EC ontology   holds_at predicates represent a context   Constructs made available by the underlying logical language à Horn fragment of FOL + NAF
14. 14. An example   When a robot moves from room X to room Y, it is no more at X and it is now at Y, provided that the battery is non empty   When a robot executes a move, then the battery level decreases of one unit   Events: move(R,X,Y)   Fluents: at(R,X) blevel(R,L)
15. 15. An example   When a robot moves from room X to room Y, it is no more at X and it is now at Y, provided that the battery is non empty initiates(move(R,X,Y),at(Y),T):- holds_at(blevel(R,L),T), L > 0. terminates(move(R,X,Y),at(X),T):- holds_at(blevel(R,L),T), L > 0.
16. 16. An example   When a robot executes a move, then the battery level decreases of one unit initiates(move(R,X,Y),blevel(R,New),T):- holds_at(blevel(R,Old),T), Old > 0, New = Old - 1. terminates(move(R,X,Y), blevel(R,Old),T):- holds_at(blevel(R,Old),T), L > 0.
17. 17. Species of Inference   Pierce differentiated the genus of reasoning into three species of inference   Deductive reasoning   Application of a general rule to a particular case, inferring a specific result   Inductive reasoning   Synthesis of a general rule starting from particular cases and results   Abductive reasoning   Synthesis of a case (explanation/case) from a general rule and a particular result (observation)
18. 18. EC Abductive Reasoning   Goal: generate possible execution traces (plans) that lead to a desired state of affairs, according to an EC specification   Example   Which sequence of actions leads the robot to room2, giving an initial situation where it is in room1 with battery=5 ? events' effects [initiates/terminates] validity of ﬂuents [holds_at] EC abductive reasoning initial state [initially] trace [happens]
19. 19. EC Proactive Reasoning   A form of deductive reasoning   Given a narrative, answers queries over the validity of fluents   Example: giving a sequence of wall-e’s movements… ?- holds_at(blevel(wall-e,L),T), L < 5. events' effects [initiates/terminates] EC proactive reasoning initial state [initially] trace [happens] validity of ﬂuents [holds_at]
20. 20. Axiomatization in Prolog   The simple EC can be simply formalized in the Horn fragment of FOL, augmented with negation as failure (Kowalski and Sergot, 1986)   The formalization focuses on fluents’ transitions   it centres around intervals in which   A fluent switches from false to true (is declipped)   A fluent switches from true to false (is clipped)
21. 21. Semantics of holds_at   Fluent F holds at time T if   F has been declipped in the past   At the beginning of the execution (initially)   When an event occurred initiating it   F has not been clipped in between holds_at(F,T):- happens(E,Ts), Ts<T, inititates(E,F,Ts), ¬clipped(Ts,F,T). holds_at(F,T):- initially(F), ¬clipped(0,F,T). T F 0 TTs F E
22. 22. Semantics of clipped   F is clipped inside a time interval [T1, T2) if an event occurs inside the interval and terminates F clipped(T1,F,T2):- happens(E,T), T ≥ T1, T < T2, terminates(E,F,T).
23. 23. Reasoning with Prolog   Given   An EC specification (KBdom)   The axiomatization of holds_at and clipped (KBEC)   An execution trace (T)   A query Q   Verifying whether T leads to Q corresponds to check whether KBdom ∪KBEC ∪T satisfies Q   Which in turn can be verified by means of a Prolog SLDNF derivation   Prolog performs backward, proactive reasoning starting from Q
24. 24. Example   KBdom: initially(f). terminates(a,f,T). initiates(b,f,T).   T: happens(a,2). happens(b,6).   Q: ?-holds_at(f,8) YES! 1 2 3 4 5 6 7 80 f a b
25. 25. Example – SLDNF derivation holds_at(f,8) initially(f) / ¬clipped(0,f,8) ¬clipped(0,f,8) clipped(0,f,8) happens(E,T) / T≥0 / T<8 / terminates(E,f,T) 2≥0 / 2<8 / terminates(a,f,2) terminates(a,f,2) happens(E,T) / T<8 ¬clipped(T,f,8) …E/a,T/2 false true 2<8 ¬clipped(2,f,8) clipped(0,f,8) happens(E,T) / T≥2 / T<8 / terminates(E,f,T) 2≥0 / 2<8 / terminates(a,f,2) terminates(a,f,2) …E/a,T/2 false true E/a,T/2 E/b,T/6 clipped(0,f,8) happens(E,T) / T≥6 / T<8 / terminates(E,f,T) 2≥6 / … E/a,T/2 true false 6<8 ¬clipped(6,f,8) E/b,T/6 6≥6 / 6<8 / terminates(b,f,6) terminates(b,f,6) false
26. 26. EC Reactive Reasoning   Dynamically growing trace à narrative updates   Interest in showing the evolution of all fluents à ?- “extract all the maximal validity intervals of fluents” events' effects [initiates/terminates] EC reactive reasoning initial state [initially] partial trace [happens] evolution of ﬂuents [holds_at]
27. 27. Ongoing/Future Work   Integration between procedural and declarative knowledge in the clinical setting
28. 28. Is Proactive Reactive?   Chittaro and Montanari [1994]: No!   Narrative update is constant, but the query must be executed from scratch   No possibility of reusing the previously inferred results   Idea: Cached Event Calculus
29. 29. Cached Event Calculus Chittaro and Montanari, 1995   Caches the current result for future use   Extends/revises it as new events are acquired   Complexity moved from the query to the narrative update   What is cached? The Maximal Validity Intervals (MVIs)   Reasoning shifts from transitions to levels of fluents   (Simple) query complexity: linear in the size of the cached MVIs holds_at(F,T):- mvi(F,T1,T2), gt(T,T1), le(T,T2).
30. 30. Axiomatizations   Cached Event Calculus (Prolog) [Chittaro and Montanari, 1995]   Prolog-based, with assert/retract   Reactive Event Calculus (SCIFF)   [Chesani et al, 2010] Based on an ALP framework   Declarative semantics à formal properties   Reactive Event Calculus (Prolog): light-weight CEC   Embedded in JAVA à jREC   Naïve management of out-of-order events   “Roll-back and re-execute”
31. 31. REC - Idea   A new event occurrence is acquired: happens(e,t)   Hp: t is greater than the events occurred so far   If not, roll-back + replay   Steps 1.  Assert happens(e,t) 2.  Extract all the effects caused by e at time t declip(F,T):- happens(E,T), initiates(E,F,T), + holds_at(F,T). clip(F,T):- happens(E,T), terminates(E,F,T), holds_at(F,T).
32. 32. REC - Idea 3.  For each fluent f to be declipped a)  Assert MVI for f (t,inf] 4.  For each fluent f to be clipped a)  Retract MVI for f (ts,inf] b)  Assert MVI for f (ts,t] te f te f te f te f
33. 33. jREC jREC TuProlog l-CEC model Set model Evaluate trace U Reset effects minates] EC reactive reasoning state lly] partial trace [happens] evolution of ﬂuents [holds_at]
34. 34. EC in the BPM Setting Action Activity Event Event in the activity lifecycle (start, complete, …) System instance Case Initial state Beginning of the case Event occurrence Audit trail entry Narrative Execution trace Fluent Property characterizing an aspect of the case
35. 35. Operational Decision Support with Wil van der Aalst, Fabrizio Maggi, Federico Chesani, Paola Mello   Runtime support to running processes   Check   Predict   Recommend PAIS OS Service ... ... event log business constraints process models request response
36. 36. Monitoring Business Constraints   Runtime compliance checking of business constraints, reporting their status as events occur   Desiderata   Expressive constraints with metric temporal constraints, data, data-aware conditions   The system cannot be controlled à continuous support   System health metrics à catch and count violations
37. 37. ConDec++   Study of all the ConDec [Pesic and van der Aalst, 2006] constraints extended with metric time constraints   Extension with non-atomic activities and data   Example: The respondent bank must always be added to the black list in case its due diligence evaluation fails ResultBank Result = failed add to.Bank = diligence.Bank, diligence evaluation add to black list Bank add to.O = diligence.O
38. 38. Formalization in the EC   Formalization of the activity lifecycle   Notion of constraint instance   At each time, a constraint instance can be pending, satisfied or violated   Transitions determined by the occurrence of events   Example   Complete evaluation with result = failure generates a new pending instance of the constraint   The instance becomes satisfied if the same responsible successfully adds the involved bank to the black list   The instance becomes violated if the case is completed and it is still pending activeinitial completed canceled ts (start) tc (complete) tx (cancel)
39. 39. Monitoring Outcome ResultBank Result = failed add to.Bank = diligence.Bank, diligence evaluation add to black list Bank add to.O = diligence.O
40. 40. MoBuCon ProM implementation
41. 41. Commitments and Interactions with Federico Chesani, Paola Mello, Paolo Torroni   Social Commitments [Castelfranchi, 1995], [Singh, 1998] for modeling interaction in open systems   MAS, SOA, Business interactions, …   Open systems à interacting entities are   Heterogeneous   Autonomous   Interaction: focus on commitments established by agents   not by fixing specific courses of interaction in advance   C(x,y,p) à debtor agent (x) committed towards a creditor agent (y) to bring about some desired property (p)
42. 42. Commitment Life Cycle   Agents perform actions, traced by means of events   Event occurrences   Have effects (initiate/terminate fluents)   (in)directly trigger operations on commitments   Each operation results in a commitment state change   States of all commitments: normative state of the interaction   When a customer c pays seller s for an order, s becomes committed to deliver that order (make the order delivered) à payment creates C(s,c,orderDelivered)
43. 43. Simplified Life Cycle active violated satisfied create C(s,c,orderDelivered) pay(c,s) sendByAirMail(s,c) orderDelivered
44. 44. Monitoring Commitments   Model business contracts and protocols by means of commitments   Timed extensions to deal with deadlines and properties that must be maintained true   Use the EC formalization of the commitment life cycle   Extension of [Singh and Yolum, 2000]   Track the normative state of contract by monitoring a running interaction with jREC   Demo!
45. 45. Conclusion   EC is an expressive and computational framework for reason about event-based systems   Monitoring with the EC requires suitable reactive reasoners   jREC is a practical solution to tackle this issue   Applications in the BPM context   Monitoring Business Constraints   Tracking Commitment-Based Interactions
46. 46. Ongoing/Future Work   Integration between declarative and procedural knowledge in clinical guidelines   Experimental assessment: first experiments encouraging   Complexity investigation   Starting from Chittaro and Montanari’s work   Focusing on specific classes of EC programs   New application in the context of artifact-centric business processes   Formalization of the GSM paradigm?