event calculus

{{Short description|Language for reasoning and representing events}}

The event calculus is a logical theory for representing and reasoning about events and about the way in which they change the state of some real or artificial world. It deals both with action events, which are performed by agents, and with external events, which are outside the control of any agent.

The event calculus represents the state of the world at any time by the set of all the facts (called fluents) that hold at the time. Events initiate and terminate fluents:

{{poemquote|1=

A fluent holds at a time

if the fluent is initiated by an event that happens at an earlier time

and the fluent is not terminated by any event that happens in the meantime.{{cn|date=January 2024}}

}}

The event calculus differs from most other approaches for reasoning about change by reifying time, associating events with the time at which they happen, and associating fluents with the times at which they hold.

The original version of the event calculus, introduced by Robert Kowalski and Marek Sergot in 1986,{{Cite journal|last1=Kowalski|first1=Robert|last2=Sergot|first2=Marek|date=1986-03-01|title=A logic-based calculus of events|url=https://doi.org/10.1007/BF03037383|journal=New Generation Computing|language=en|volume=4|issue=1|pages=67–95|doi=10.1007/BF03037383|s2cid=7584513|issn=1882-7055|url-access=subscription}} was formulated as a logic program and developed for representing narratives and database updates.{{Cite journal|last=Kowalski|first=Robert|date=1992-01-01|title=Database updates in the event calculus|journal=The Journal of Logic Programming|language=en|volume=12|issue=1|pages=121–146|doi=10.1016/0743-1066(92)90041-Z|issn=0743-1066|doi-access=free}} Kave Eshghi showed how to use the event calculus for planning,{{Cite journal|last=Eshghi|first=Kave|year=1988|title=Abductive planning with event calculus|url=https://www.researchgate.net/publication/220986211|journal=Iclp/SLP|pages=562–579}} by using abduction to generate hypothetical actions to achieve a desired state of affairs.

It was extended by Murray Shanahan and Rob Miller in the 1990s{{Citation|last1=Miller|first1=Rob|title=Some Alternative Formulations of the Event Calculus|date=2002|url=https://doi.org/10.1007/3-540-45632-5_17|work=Computational Logic: Logic Programming and Beyond: Essays in Honour of Robert A. Kowalski Part II|pages=452–490|editor-last=Kakas|editor-first=Antonis C.|series=Lecture Notes in Computer Science|place=Berlin, Heidelberg|publisher=Springer|language=en|doi=10.1007/3-540-45632-5_17|isbn=978-3-540-45632-2|access-date=2020-10-05|last2=Shanahan|first2=Murray|editor2-last=Sadri|editor2-first=Fariba|url-access=subscription}} and reformulated in first-order logic with circumscription.

These and later extensions have been used to formalize non-deterministic actions, concurrent actions, actions with delayed effects, gradual changes, actions with duration, continuous change, and non-inertial fluents.

Van Lambalgen and Hamm showed how a formulation of the event calculus as a constraint logic program can be used to give an algorithmic semantics to tense and aspect in natural language.{{Cite book|last=Lambalgen, Hamm|url=https://www.worldcat.org/oclc/212129657|title=The proper treatment of events|date=2005|publisher=Blackwell Pub|isbn=978-0-470-75925-7|location=Malden, MA|oclc=212129657}}

Fluents and events

{{unreferenced section|date=January 2024}}

In the event calculus, fluents are reified. This means that fluents are represented by terms. For example, \mathit{holdsAt}(on(green\_block,table),1) expresses that the \mathit{green\_block} is on the \mathit{table} at time 1. Here \mathit{holdsAt} is a predicate, while \mathit{on(green\_block, table)} is a term. In general, the atomic formula

: \mathit{holdsAt}(fluent,time) expresses that the \mathit{fluent} holds at the \mathit{time.}

Events are also reified and represented by terms. For example, \mathit{happensAt}(move(green\_block, red\_block), 3) expresses that the \mathit{green\_block} is moved onto the \mathit{red\_block)} at time 3. In general:

: \mathit{happensAt}(event,time) expresses that the \mathit{event} happens at the \mathit{time.}

The relationships between events and the fluents that they initiate and terminate are also represented by atomic formulae:

: \mathit{initiates}(event,fluent,time) expresses that if the \mathit{event} happens at the \mathit{time} then the \mathit{fluent} becomes true after the \mathit{time}.

: \mathit{terminates}(event,fluent,time) expresses that if the \mathit{event} happens at the \mathit{time} then the \mathit{fluent} ceases to be true after the \mathit{time}.

Domain-independent axiom

The event calculus was developed in part as an alternative to the situation calculus,J. McCarthy and P. Hayes (1969). [http://www-formal.stanford.edu/jmc/mcchay69.html Some philosophical problems from the standpoint of artificial intelligence]. In B. Meltzer and D. Michie, editors, Machine Intelligence, 4:463–502. Edinburgh University Press, 1969.R. Reiter (1991). The frame problem in the situation calculus: a simple solution (sometimes) and a completeness result for goal regression. In Vladimir Lifshitz, editor, Artificial intelligence and mathematical theory of computation: papers in honour of John McCarthy, pages 359–380, San Diego, CA, USA. Academic Press Professional, Inc. 1991. as a solution to the frame problem, of representing and reasoning about the way in which actions and other events change the state of some world.

There are many variants of the event calculus. But the core axiom of one of the simplest and most useful variants can be expressed as a single, domain-independent axiom:

:\mathit{holdsAt}(F,T2) \leftarrow

:[\mathit{happensAt}(E1,T1) \wedge \mathit{initiates}(E1, F, T1) \wedge (T1 < T2) \wedge

:\neg \exists E2, T [\mathit{happensAt}(E2, T) \wedge \mathit{terminates}(E2, F, T) \wedge (T1 \leq T < T2)]

The axiom states that

: a fluent F holds at a time T2 if

: an event E1 happens at a time T1 and

: E1 initiates F at T1 and

: T1 is before T2 and

: it is not the case that there exists an event E2 and a time T such that

:: E2 happens at T and

:: E2 terminates F at T and

:: T1 is before or at the same time as T and

:: T is before T2.

The event calculus solves the frame problem by interpreting this axiom in a non-monotonic logic, such as first-order logic with circumscriptionShanahan, M. (1997) [https://books.google.com/books?id=z8zR3Ds7xKQC Solving the frame problem: A mathematical investigation of the common sense law of inertia]. MIT Press. or, as a logic program, in Horn clause logic with negation as failure. In fact, circumscription is one of the several semantics that can be given to negation as failure,{{cite journal | last1=Gelfond |first1=M. |last2=Przymusinska |first2=H. |last3=Przymusinski |first3=T. |date=1989 |title=On the relationship between circumscription and negation as failure |journal=Artificial Intelligence |volume=38 |issue=1 |pages=75–94|doi=10.1016/0004-3702(89)90068-4 }} and it is closely related to the completion semantics for logic programs{{cite book |last=Clark |first=K.L. |title=Logic and Data Bases |chapter=Negation as Failure |author-link=Keith Clark (computer scientist) |date=1977 |pages=293–322 |doi=10.1007/978-1-4684-3384-5_11 |location=Boston, MA |publisher=Springer US|isbn=978-1-4684-3386-9 }} (which interprets if as if and only if).

The core event calculus axiom defines the holdsAt predicate in terms of the happensAt, initiates, terminates, < and \leq predicates. To apply the event calculus to a particular problem, these other predicates also need to be defined.

The event calculus is compatible with different definitions of the temporal predicates < and \leq . In most applications, times are represented discretely, by the natural numbers, or continuously, by non-negative real numbers. However, times can also be partially ordered.

Domain-dependent axioms

{{unreferenced section|date=January 2024}}

To apply the event calculus in a particular problem domain, it is necessary to define the initiates and terminates predicates for that domain. For example, in the blocks world domain, an event move(Object, Place) of moving an object onto a place intitiates the fluent on(Object, Place), which expresses that the object is on the place and terminates the fluent on(Object, Place1), which expresses that the object is on a different place:

:\mathit{initiates}(move(Object, Place), on(Object, Place), Time).

:\mathit{terminates}(move(Object, Place), on(Object, Place1), Time) \leftarrow different(Place1, Place).

If we want to represent the fact that a Fluent holds in an initial state, say at time 1, then with the simple core axiom above we need an event, say initialise(Fluent), which initiates the Fluent at any time:

:\mathit{initiates}(initialise(Fluent), Fluent, Time).

Problem-dependent axioms

{{unreferenced section|date=January 2024}}

To apply the event calculus, given the definitions of the holdsAt, initiates, terminates, < and \leq predicates, it is necessary to define the happensAt predicates that describe the specific context of the problem.

For example, in the blocks world domain, we might want to describe an initial state in which there are two blocks, a red block on a green block on a table, like a toy traffic light, followed by moving the red block to the table at time 1 and moving the green block onto the red block at time 3, turning the traffic light upside down:

: \mathit{happensAt}(initialise(on(red\_block,green\_block), 0)

: \mathit{happensAt}(initialise(on(green\_block,table), 0)

: \mathit{happensAt}(move(red\_block, table), 1)

: \mathit{happensAt}(move(green\_block, red\_block), 3)

A Prolog implementation

{{unreferenced section|date=January 2024}}

The event calculus has a natural implementation in pure Prolog (without any features that do not have a logical interpretation). For example, the blocks world scenario above can be implemented (with minor modifications) by the program:

holdsAt(Fluent, Time2) :-

before(Time1, Time2),

happensAt(Event, Time1),

initiates(Event, Fluent, Time1),

not(clipped(Fluent, Time1, Time2)).

clipped(Fluent, Time1, Time2) :-

terminates(Event, Fluent, Time),

happensAt(Event, Time),

before(Time1, Time),

before(Time, Time2).

initiates(initialise(Fluent), Fluent, Time).

initiates(move(Object, Place), on(Object, Place), Time).

terminates(move(Object, Place), on(Object, Place1), Time).

happensAt(initialise(on(green_block, table)), 0).

happensAt(initialise(on(red_block, green_block)), 0).

happensAt(move(red_block, table), 1).

happensAt(move(green_block, red_block), 3).

The Prolog program differs from the earlier formalisation in the following ways:

  • The core axiom has been rewritten, using an auxiliary predicate clipped(Fact, Time1, Time2). This rewriting enables the elimination of existential quantifiers, conforming to the Prolog convention that all variables are universally quantified.
  • The order of the conditions in the body of the core axiom(s) has been changed, to generate answers to queries in temporal order.
  • The equality in the condition T1 \leq T has been removed from the corresponding condition before(Time1, Time). This builds in a simplifying assumption that events do not simultaneously initiate and terminate the same fluent. As a consequence, the definition of the terminates predicate has been simplified by eliminating the condition that different(Place1, Place).

Given an appropriate definitionFor example:

before(Time1, Time2) :-

timeline(Eternity),

append(Before, [Time2 | After], Eternity),

member(Time1, Before).

timeline([0, 1, 2, 3, 4, 5]).

of the predicate before(Time1, Time2), the Prolog program generates all answers to the query what holds when? in temporal order:

?- holdsAt(Fluent, Time).

Fluent = on(green_block,table), Time = 1.

Fluent = on(red_block,green_block), Time = 1.

Fluent = on(green_block,table), Time = 2.

Fluent = on(red_block,table), Time = 2.

Fluent = on(green_block,table), Time = 3.

Fluent = on(red_block,table), Time = 3.

Fluent = on(red_block,table), Time = 4.

Fluent = on(green_block,red_block), Time = 4.

Fluent = on(red_block,table), Time = 5.

Fluent = on(green_block,red_block), Time = 5.

The program can also answer negative queries, such as which fluents do not hold at which times? However, to work correctly, all variables in negative conditions must first be instantiated to terms containing no variables. For example:

timePoint(1).

timePoint(2).

timePoint(3).

timePoint(4).

timePoint(5).

fluent(on(red_block, green_block)).

fluent(on(green_block, red_block)).

fluent(on(red_block, table)).

fluent(on(green_block, table)).

?- timePoint(T), fluent(F), not(holdsAt(F, T)).

F = on(green_block,red_block), T = 1.

F = on(red_block,table), T = 1.

F = on(red_block,green_block), T = 2.

F = on(green_block,red_block), T = 2.

F = on(red_block,green_block), T = 3.

F = on(green_block,red_block), T = 3.

F = on(red_block,green_block), T = 4.

F = on(green_block,table), T = 4.

F = on(red_block,green_block), T = 5.

F = on(green_block,table), T = 5.

Reasoning tools

In addition to Prolog and its variants, several other tools for reasoning using the event calculus are also available:

  • [http://www.doc.ic.ac.uk/~mpsha/planners.html Abductive Event Calculus Planners]
  • [http://decreasoner.sourceforge.net/ Discrete Event Calculus Reasoner]
  • [http://reasoning.eas.asu.edu/ecasp/ Event Calculus Answer Set Programming]
  • [https://www.inf.unibz.it/~montali/tools.html Reactive Event Calculus]
  • [https://github.com/aartikis/RTEC Run-Time Event Calculus (RTEC)]
  • [https://www.ucl.ac.uk/infostudies/epec/translator.html Epistemic Probabilistic Event Calculus (EPEC)]{{Cite journal |last=D'Asaro |first=Fabio Aurelio |last2=Bikakis |first2=Antonis |last3=Dickens |first3=Luke |last4=Miller |first4=Rob |date=2024 |title=An answer set programming-based implementation of epistemic probabilistic event calculus |url=https://doi.org/10.1016/j.ijar.2023.109101 |journal=International Journal of Approximate Reasoning |volume=165 |pages=109101 |doi=10.1016/j.ijar.2023.109101 |issn=0888-613X}}

Extensions

Notable extensions of the event calculus include Markov logic networks–based variants{{Cite journal|last1=Skarlatidis|first1=Anastasios|last2=Paliouras|first2=Georgios|last3=Artikis|first3=Alexander|last4=Vouros|first4=George A.|date=2015-02-17|title=Probabilistic Event Calculus for Event Recognition|url=https://doi.org/10.1145/2699916|journal=ACM Transactions on Computational Logic|volume=16|issue=2|pages=11:1–11:37|doi=10.1145/2699916|arxiv=1207.3270|s2cid=6389629|issn=1529-3785}} probabilistic,{{Cite journal|last1=Skarlatidis|first1=Anastasios|last2=Artikis|first2=Alexander|last3=Filippou|first3=Jason|last4=Paliouras|first4=Georgios|date=March 2015|title=A probabilistic logic programming event calculus|journal=Theory and Practice of Logic Programming|language=en|volume=15|issue=2|pages=213–245|doi=10.1017/S1471068413000690|issn=1471-0684|doi-access=free|s2cid=5701272|arxiv=1204.1851}} epistemic{{Cite journal|last1=Ma|first1=Jiefei|last2=Miller|first2=Rob|last3=Morgenstern|first3=Leora|last4=Patkos|first4=Theodore|date=2014-07-28|title=An Epistemic Event Calculus for ASP-based Reasoning About Knowledge of the Past, Present and Future|url=https://easychair.org/publications/paper/sJ7|journal=EPiC Series in Computing|language=en-US|publisher=EasyChair|volume=26|pages=75–87|doi=10.29007/zswj|doi-access=free}} and their combinations.{{Cite journal|last1=D'Asaro|first1=Fabio Aurelio|last2=Bikakis|first2=Antonis|last3=Dickens|first3=Luke|last4=Miller|first4=Rob|date=2020-10-01|title=Probabilistic reasoning about epistemic action narratives|url=https://www.sciencedirect.com/science/article/abs/pii/S0004370219300906|journal=Artificial Intelligence|language=en|volume=287|pages=103352|doi=10.1016/j.artint.2020.103352|s2cid=221521535 |issn=0004-3702}}

See also

References

Further reading

  • Brandano, S. (2001) "[https://ieeexplore.ieee.org/document/930691/;jsessionid=92C510CBBBF85D56E7A5CEC3E91DE78B?isnumber=20130&arnumber=930691&count=35&index=2 The Event Calculus Assessed]," IEEE TIME Symposium: 7-12.
  • R. Kowalski and F. Sadri (1995) "[https://www.researchgate.net/profile/Fariba_Sadri/publication/2519366_Variants_of_the_Event_Calculus/links/5412f8130cf2788c4b358a25.pdf Variants of the Event Calculus]," ICLP: 67-81.
  • Mueller, Erik T. (2015). Commonsense Reasoning: An Event Calculus Based Approach (2nd Ed.). Waltham, MA: Morgan Kaufmann/Elsevier. {{ISBN|978-0128014165}}. (Guide to using the event calculus)
  • Shanahan, M. (1997) [https://books.google.com/books?id=z8zR3Ds7xKQC Solving the frame problem: A mathematical investigation of the common sense law of inertia]. MIT Press.
  • Shanahan, M. (1999) "[https://www.researchgate.net/profile/Murray_Shanahan/publication/2623069_The_Event_Calculus_Explained/links/00463537d038cc9cb7000000/The-Event-Calculus-Explained.pdf The Event Calculus Explained]" Springer Verlag, LNAI (1600): 409-30.

Notes