Event calculus: Difference between revisions
mNo edit summary |
Replaced detailed explanation of the circumscriptive event calculus with the simpler logic programming version. |
||
Line 10: | Line 10: | ||
The event calculus differs from most other approaches for reasoning about change by [[Reification (knowledge representation)|reifying]] time, associating events with the time at which they happen, and associating fluents with the times at which they hold. |
The event calculus differs from most other approaches for reasoning about change by [[Reification (knowledge representation)|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,<ref>{{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}}</ref> was formulated as a [[logic programming|logic program]] and developed for representing narratives and database updates.<ref>{{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}}</ref> Kave Eshghi showed how to use the event calculus for planning,<ref>{{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}}</ref> by using [[Abductive Logic Programming|abduction]] to generate hypothetical actions to achieve a desired state of affairs. |
The original version of the event calculus, introduced by [[Robert Kowalski]] and Marek Sergot in 1986,<ref name="EC">{{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}}</ref> was formulated as a [[logic programming|logic program]] and developed for representing narratives and database updates.<ref>{{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}}</ref> Kave Eshghi showed how to use the event calculus for planning,<ref>{{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}}</ref> by using [[Abductive Logic Programming|abduction]] to generate hypothetical actions to achieve a desired state of affairs. |
||
It was extended by [[Murray Shanahan]] and Rob Miller in the 1990s<ref>{{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}}</ref> and reformulated in [[Circumscription (logic)| first-order logic with circumscription]]. |
It was extended by [[Murray Shanahan]] and Rob Miller in the 1990s<ref>{{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}}</ref> and reformulated in [[Circumscription (logic)| first-order logic with circumscription]]. |
||
Line 19: | Line 19: | ||
==Fluents and events== |
==Fluents and events== |
||
In the event calculus, fluents are [[Reification (knowledge representation)|reified]]. This means that |
In the event calculus, fluents are [[Reification (knowledge representation)|reified]]. This means that fluents are represented by [[Term algebra|terms]]. For example, <math>\mathit{holdsAt}(on(green\_block,table),1)</math> expresses that the <math>\mathit{green\_block}</math> is on the <math>\mathit{table}</math> at time <math>1</math>. Here <math>\mathit{holdsAt}</math> is a predicate, while <math>\mathit{on(green\_block, table)}</math> is a term. In general, the atomic formula |
||
: <math>\mathit{holdsAt}(fluent,time)</math> expresses that the <math>\mathit{fluent}</math> holds at the <math>\mathit{time.}</math> |
|||
Events are also represented |
Events are also reified and represented by terms. For example, <math>\mathit{happensAt}(move(green\_block, red\_block), 3)</math> expresses that the <math>\mathit{green\_block}</math> is moved onto the <math>\mathit{red\_block)}</math> at time <math>3</math>. In general: |
||
: <math>\mathit{happensAt}(event,time)</math> expresses that the <math>\mathit{event}</math> happens at the <math>\mathit{time.}</math> |
|||
if the event represented by the term {{mvar|e}} is executed at time {{mvar|t}}, |
|||
then the fluent {{mvar|f}} will be true after {{mvar|t}}. |
|||
The {{mvar|Terminates}} predicate has a similar meaning, with the only difference |
|||
being that {{mvar|f}} will be false after {{mvar|t}}. |
|||
The relationships between events and the fluents that they initiate and terminate are also represented by atomic formulae: |
|||
==Domain-independent axioms== |
|||
Like other languages for representing actions, the event calculus formalizes the correct evolution of the fluent via formulae telling the value of each fluent after an arbitrary action has been performed. The event calculus solves the [[frame problem]] in a way that is similar to the [[successor state axiom]]s of the [[situation calculus]]: a fluent is true at time {{mvar|t}} if and only if it has been made true in the past and has not been made false in the meantime. |
|||
: <math>\mathit{initiates}(event,fluent,time)</math> expresses that if the <math>\mathit{event}</math> happens at the <math>\mathit{time}</math> then the <math>\mathit{fluent}</math> becomes true after the <math>\mathit{time}</math>. |
|||
:<math>\mathit{HoldsAt}(f,t) \leftarrow |
|||
[\mathit{Happens}(e,t_1) \wedge \mathit{Initiates}(e,f,t_1) |
|||
\wedge (t_1<t) \wedge \neg \mathit{Clipped}(t_1,f,t)]</math> |
|||
: <math>\mathit{terminates}(event,fluent,time)</math> expresses that if the <math>\mathit{event}</math> happens at the <math>\mathit{time}</math> then the <math>\mathit{fluent}</math> ceases to be true after the <math>\mathit{time}</math>. |
|||
This formula means that the fluent represented by the term {{mvar|f}} is true at time {{mvar|t}} if: |
|||
==Domain-independent axiom== |
|||
# an event {{mvar|e}} has taken place: <math>\mathit{Happens}(e,t_1)</math>; |
|||
# this took place in the past: <math>\mathit{t}_1<t</math>; |
|||
# this event has the fluent {{mvar|f}} as an effect: <math>\mathit{Initiates}(e,f,t_1)</math>; |
|||
# the fluent has not been made false in the meantime: <math>\mathit{Clipped}(t_1,f,t)</math> |
|||
The event calculus was developed in part as an alternative to the [[situation calculus]],<ref>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.</ref><ref>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.</ref> 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. |
|||
A similar formula is used to formalize the opposite case in which a fluent is false at a given time. Other formulae are also needed for correctly formalizing fluents before they have been effects of an event. These formulae are similar to the above, but <math>\mathit{Happens}(e,t_1) \wedge \mathit{Initiates}(e,f,t_1)</math> is replaced by <math>\mathit{HoldsAt}(f,t_1)</math>. |
|||
There are many variants of the event calculus. But the core axiom of one of the simplest and most useful variants can be stated as a single, domain-independent axiom: |
|||
The {{mvar|Clipped}} predicate, stating that a fluent has been made false during an interval, can be axiomatized, or simply taken as a shorthand, as follows: |
|||
:<math>\mathit{ |
:<math>\mathit{holdsAt}(F,T2) \leftarrow</math> |
||
:<math>[\mathit{happensAt}(E1,T1) \wedge \mathit{initiates}(E1, F, T1) \wedge (T1 < T2) \wedge </math> |
|||
\exists e,t |
|||
[\mathit{ |
:<math>\neg \exists E2, T [\mathit{happensAt}(E2, T) \wedge \mathit{terminates}(E2, F, T) \wedge (T1 \leq T < T2)] </math> |
||
The axiom states that |
|||
: a fluent <math>F</math> holds at a time <math>T2</math> '''if''' |
|||
: an event <math>E1</math> happens at a time <math>T1</math> '''and''' |
|||
: <math>E1</math> initiates <math>F</math> at <math>T1</math> '''and''' |
|||
: <math>T1</math> is before <math>T2</math> '''and''' |
|||
: '''it is not the case that''' there exists an event <math>E2</math> and a time <math>T</math> such that |
|||
:: <math>E2</math> happens at <math>T</math> '''and''' |
|||
:: <math>E2</math> terminates <math>F</math> at <math>T</math> '''and''' |
|||
:: <math>T1</math> is before or at the same time as <math>T</math> '''and''' |
|||
:: <math>T</math> is before <math>T2</math>. |
|||
The event calculus solves the frame problem by interpreting this axiom in a [[non-monotonic logic]], such as first-order logic with [[Circumscription (logic)|circumscription]] <ref>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.</ref> or, as a [[logic programming|logic program]], in [[Horn clause]] logic with [[negation as failure]].<ref name="EC"/> In fact, circumscription is one of the several semantics that can be given to negation as failure,<ref>{{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 (journal)|Artificial Intelligence]] |volume=38 |issue=1 |pages=75–94|doi=10.1016/0004-3702(89)90068-4 }}</ref> and it is closely related to the completion semantics for logic programs<ref>{{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 }}</ref> (which interprets '''if''' as '''if and only if'''). |
|||
The core event calculus axiom defines the <math>holdsAt</math> predicate in terms of the <math>happensAt</math>, <math>initiates</math>, <math>terminates</math>, <math><</math> and <math>\leq </math> 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 <math><</math> and <math>\leq </math>. 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== |
==Domain-dependent axioms== |
||
To apply the event calculus in a particular problem domain, it is necessary to define the <math>initiates</math> and <math>terminates</math> predicates for that domain. For example, in the [[blocks world]] domain, an event <math>move(Object, Place)</math> of moving an object onto a place intitiates the fluent <math>on(Object, Place)</math> that expresses that the object is on the place and terminates the fluent <math>on(Object, Place1)</math> that expresses that the object is on a different place: |
|||
The axioms above relate the value of the predicates {{mvar|HoldsAt}}, {{mvar|Initiates}} and {{mvar|Terminates}}, but do not specify which fluents are known to be true and which events actually make fluents true or false. This is done by using a set of domain-dependent axioms. The known values of fluents are stated as simple literals <math>\mathit{HoldsAt}(f,t)</math>. The effects of events are stated by formulae relating the effects of events with their preconditions. For example, if the event {{mvar|open}} makes the fluent {{mvar|isopen}} true, but only if {{mvar|haskey}} is currently true, the corresponding formula in the event calculus is: |
|||
:<math>\mathit{ |
:<math>\mathit{initiates}(move(Object, Place), on(Object, Place), Time). </math> |
||
:<math>\mathit{terminates}(move(Object, Place), on(Object, Place1), Time) \leftarrow different(Place1, Place). </math> |
|||
[ e=open \wedge f=isopen \wedge \mathit{HoldsAt}(haskey, t)] \vee \cdots |
|||
</math> |
|||
If we want to represent the fact that a <math>Fluent</math> holds in an initial state, say at time 1, then with the simple core axiom above we need an event, say <math>initialise(Fluent)</math>, which initiates the <math>Fluent</math> at any time: |
|||
The right-hand expression of this equivalence is composed of a disjunction: for each event and fluent that can be made true by the event, there is a disjunct saying that {{mvar|e}} is actually that event, that {{mvar|f}} is actually that fluent, and that the precondition of the event is met. |
|||
:<math>\mathit{initiates}(initialise(Fluent), Fluent, Time). </math> |
|||
The formula above specifies the [[truth value]] of <math>\mathit{Initiates}(e,f,t)</math> for every possible event and fluent. As a result, all effects of all events have to be combined in a single formulae. This is a problem, because the addition of a new event requires modifying an existing formula rather than adding new ones. This problem can be solved by the application of [[Circumscription (logic)|circumscription]] to a set of formulae each specifying one effect of one event: |
|||
==Problem-dependent axioms== |
|||
: <math>\mathit{Initiates}(open, isopen, t) \leftarrow \mathit{HoldsAt}(haskey, t)</math> |
|||
: <math>\mathit{Initiates}(break, isopen, t) \leftarrow \mathit{HoldsAt}(hashammer, t)</math> |
|||
: <math>\mathit{Initiates}(break, broken, t) \leftarrow \mathit{HoldsAt}(hashammer, t)</math> |
|||
To apply the event calculus, given the definitions of the <math>holdsAt</math>, <math>initiates</math>, <math>terminates</math>, <math><</math> and <math>\leq </math> predicates, it is necessary to define the <math>happensAt</math> predicates that describe the specific context of the problem. |
|||
These formulae are simpler than the formula above, because each effect of each event can be specified separately. The single formula telling which events {{mvar|e}} and fluents {{mvar|f}} make <math>\mathit{Initiates}(e,f,t)</math> true has been replaced by a set of smaller formulae, each one telling the effect of an event on a fluent. |
|||
However, these formulae are not equivalent to the formula above. Indeed, they only specify sufficient conditions for <math>\mathit{Initiates}(e,f,t)</math> to be true, which should be completed by the fact that {{mvar|Initiates}} is false in all other cases. This fact can be formalized by simply circumscribing the predicate {{mvar|Initiates}} in the formula above. It is important to note that this circumscription is done only on the formulae specifying {{mvar|Initiates}} and not on the domain-independent axioms. The predicate {{mvar|Terminates}} can be specified in the same way {{mvar|Initiates}} is. |
|||
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: |
|||
A similar approach can be taken for the {{mvar|Happens}} predicate. The evaluation of this predicate can be enforced by formulae specifying not only when it is true and when it is false: |
|||
:<math>\mathit{ |
: <math>\mathit{happensAt}(initialise(on(red\_block,green\_block), 0)</math> |
||
: <math>\mathit{happensAt}(initialise(on(green\_block,table), 0)</math> |
|||
(e=open \wedge t=0) \vee (e=exit \wedge t=1) \vee \cdots</math> |
|||
: <math>\mathit{happensAt}(move(red\_block, table), 1)</math> |
|||
Circumscription can simplify this specification, as only necessary conditions can be specified: |
|||
: <math>\mathit{happensAt}(move(green\_block, red\_block), 3)</math> |
|||
==A Prolog implementation== |
|||
:<math>\mathit{Happens}(open, 0)</math> |
|||
:<math>\mathit{Happens}(exit, 1)</math> |
|||
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: |
|||
Circumscribing the predicate {{mvar|Happens}}, this predicate will be false at all points in which it is not explicitly specified to be true. This circumscription has to be done separately from the circumscription of the other formulae. In other words, if {{mvar|F}} is the set of formulae of the kind <math>\mathit{Initiates}(e,f,t) \leftarrow \cdots</math>, {{mvar|G}} is the set of formulae <math>\mathit{Happens}(e, t)</math>, and {{mvar|H}} are the domain independent axioms, the correct formulation of the domain is: |
|||
<syntaxhighlight lang="prolog"> |
|||
:<math>\mathit{Circ}(F; \mathit{Initiates}, \mathit{Terminates}) \wedge |
|||
holdsAt(Fluent, Time2) :- |
|||
Circ(G; Happens) \wedge H</math> |
|||
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). |
|||
==The event calculus as a logic program== |
|||
initiates(move(Object, Place), on(Object, Place), Time). |
|||
terminates(move(Object, Place), on(Object, Place1), Time). |
|||
happensAt(initialise(on(green_block, table)), 0). |
|||
The event calculus was originally formulated as a set of [[Horn clauses]] augmented with [[negation as failure]] and could be run as a [[Prolog]] program. |
|||
happensAt(initialise(on(red_block, green_block)), 0). |
|||
In fact, circumscription is one of the several semantics that can be given to negation as failure, and is closely related to the completion semantics (in which "if" is interpreted as "if and only if" — see [[logic programming]]). |
|||
happensAt(move(red_block, table), 1). |
|||
happensAt(move(green_block, red_block), 3). |
|||
</syntaxhighlight> |
|||
The Prolog program differs from the earlier formalisation in the following ways: |
|||
==Extensions== |
|||
* The core axiom has been rewritten, using an auxilary predicate <syntaxhighlight inline lang="prolog">clipped(Fact, Time1, Time2).</syntaxhighlight> This rewriting enables the elimination of existential quantifiers, conforming to the Prolog convention that all variables are universally quantified. |
|||
Notable extensions of the Event Calculus include Markov Logic Networks-based,<ref>{{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}}</ref> [[Probability|probabilistic]],<ref>{{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}}</ref> epistemic<ref>{{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}}</ref> variants and their combinations.<ref>{{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 (journal)|Artificial Intelligence]]|language=en|volume=287|pages=103352|doi=10.1016/j.artint.2020.103352|s2cid=221521535 |issn=0004-3702}}</ref> |
|||
* 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 <math>T1 \leq T </math> has been removed from the corresponding condition <syntaxhighlight inline lang="prolog">before(Time1, Time).</syntaxhighlight> This builds in a simplifying assumption that events do not simultaneously initiate and terminate the same fluent. As a consequence, the definition of the <math>terminates</math> predicate has been simplified by eliminating the condition that <math>different(Place1, Place)</math>. |
|||
Given an appropriate definition<ref group=note> For example: |
|||
<syntaxhighlight lang="prolog"> |
|||
before(Time1, Time2) :- |
|||
timeline(Eternity), |
|||
append(Before, [Time2 | After], Eternity), |
|||
member(Time1, Before). |
|||
timeline([0, 1, 2, 3, 4, 5]). |
|||
</syntaxhighlight> |
|||
</ref> of the predicate <syntaxhighlight inline lang="prolog">before(Time1, Time2),</syntaxhighlight> the Prolog program generates all answers to the query ''what holds when?'' in temporal order: |
|||
<syntaxhighlight lang="prolog"> |
|||
?- 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. |
|||
</syntaxhighlight> |
|||
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: |
|||
<syntaxhighlight lang="prolog"> |
|||
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. |
|||
</syntaxhighlight> |
|||
==Reasoning tools== |
==Reasoning tools== |
||
Line 102: | Line 174: | ||
* [https://www.inf.unibz.it/~montali/tools.html Reactive Event Calculus] |
* [https://www.inf.unibz.it/~montali/tools.html Reactive Event Calculus] |
||
* [https://github.com/aartikis/RTEC Run-Time Event Calculus (RTEC)] |
* [https://github.com/aartikis/RTEC Run-Time Event Calculus (RTEC)] |
||
==Extensions== |
|||
Notable extensions of the Event Calculus include Markov Logic Networks-based,<ref>{{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}}</ref> [[Probability|probabilistic]],<ref>{{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}}</ref> epistemic<ref>{{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}}</ref> variants and their combinations.<ref>{{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 (journal)|Artificial Intelligence]]|language=en|volume=287|pages=103352|doi=10.1016/j.artint.2020.103352|s2cid=221521535 |issn=0004-3702}}</ref> |
|||
==See also== |
==See also== |
||
Line 119: | Line 195: | ||
* 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. (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. |
* 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== |
|||
{{reflist|group=note}} |
|||
[[Category:1986 introductions]] |
[[Category:1986 introductions]] |
Revision as of 21:46, 1 January 2024
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:
- 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 another event that happens in the meantime.
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,[1] was formulated as a logic program and developed for representing narratives and database updates.[2] Kave Eshghi showed how to use the event calculus for planning,[3] 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[4] 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 the 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.[5]
Fluents and events
In the event calculus, fluents are reified. This means that fluents are represented by terms. For example, expresses that the is on the at time . Here is a predicate, while is a term. In general, the atomic formula
- expresses that the holds at the
Events are also reified and represented by terms. For example, expresses that the is moved onto the at time . In general:
- expresses that the happens at the
The relationships between events and the fluents that they initiate and terminate are also represented by atomic formulae:
- expresses that if the happens at the then the becomes true after the .
- expresses that if the happens at the then the ceases to be true after the .
Domain-independent axiom
The event calculus was developed in part as an alternative to the situation calculus,[6][7] 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 stated as a single, domain-independent axiom:
The axiom states that
- a fluent holds at a time if
- an event happens at a time and
- initiates at and
- is before and
- it is not the case that there exists an event and a time such that
- happens at and
- terminates at and
- is before or at the same time as and
- is before .
The event calculus solves the frame problem by interpreting this axiom in a non-monotonic logic, such as first-order logic with circumscription [8] or, as a logic program, in Horn clause logic with negation as failure.[1] In fact, circumscription is one of the several semantics that can be given to negation as failure,[9] and it is closely related to the completion semantics for logic programs[10] (which interprets if as if and only if).
The core event calculus axiom defines the predicate in terms of the , , , and 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 . 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
To apply the event calculus in a particular problem domain, it is necessary to define the and predicates for that domain. For example, in the blocks world domain, an event of moving an object onto a place intitiates the fluent that expresses that the object is on the place and terminates the fluent that expresses that the object is on a different place:
If we want to represent the fact that a holds in an initial state, say at time 1, then with the simple core axiom above we need an event, say , which initiates the at any time:
Problem-dependent axioms
To apply the event calculus, given the definitions of the , , , and predicates, it is necessary to define the 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:
A Prolog implementation
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 auxilary 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 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 predicate has been simplified by eliminating the condition that .
Given an appropriate definition[note 1] 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:
- Abductive Event Calculus Planners
- Discrete Event Calculus Reasoner
- Event Calculus Answer Set Programming
- Reactive Event Calculus
- Run-Time Event Calculus (RTEC)
Extensions
Notable extensions of the Event Calculus include Markov Logic Networks-based,[11] probabilistic,[12] epistemic[13] variants and their combinations.[14]
See also
References
- ^ a b Kowalski, Robert; Sergot, Marek (1986-03-01). "A logic-based calculus of events". New Generation Computing. 4 (1): 67–95. doi:10.1007/BF03037383. ISSN 1882-7055. S2CID 7584513.
- ^ Kowalski, Robert (1992-01-01). "Database updates in the event calculus". The Journal of Logic Programming. 12 (1): 121–146. doi:10.1016/0743-1066(92)90041-Z. ISSN 0743-1066.
- ^ Eshghi, Kave (1988). "Abductive planning with event calculus". Iclp/SLP: 562–579.
- ^ Miller, Rob; Shanahan, Murray (2002), Kakas, Antonis C.; Sadri, Fariba (eds.), "Some Alternative Formulations of the Event Calculus", Computational Logic: Logic Programming and Beyond: Essays in Honour of Robert A. Kowalski Part II, Lecture Notes in Computer Science, Berlin, Heidelberg: Springer, pp. 452–490, doi:10.1007/3-540-45632-5_17, ISBN 978-3-540-45632-2, retrieved 2020-10-05
- ^ Lambalgen, Hamm (2005). The proper treatment of events. Malden, MA: Blackwell Pub. ISBN 978-0-470-75925-7. OCLC 212129657.
- ^ J. McCarthy and P. Hayes (1969). 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.
- ^ Shanahan, M. (1997) Solving the frame problem: A mathematical investigation of the common sense law of inertia. MIT Press.
- ^ Gelfond, M.; Przymusinska, H.; Przymusinski, T. (1989). "On the relationship between circumscription and negation as failure". Artificial Intelligence. 38 (1): 75–94. doi:10.1016/0004-3702(89)90068-4.
- ^ Clark, K.L. (1977). "Negation as Failure". Logic and Data Bases. Boston, MA: Springer US. pp. 293–322. doi:10.1007/978-1-4684-3384-5_11. ISBN 978-1-4684-3386-9.
- ^ Skarlatidis, Anastasios; Paliouras, Georgios; Artikis, Alexander; Vouros, George A. (2015-02-17). "Probabilistic Event Calculus for Event Recognition". ACM Transactions on Computational Logic. 16 (2): 11:1–11:37. arXiv:1207.3270. doi:10.1145/2699916. ISSN 1529-3785. S2CID 6389629.
- ^ Skarlatidis, Anastasios; Artikis, Alexander; Filippou, Jason; Paliouras, Georgios (March 2015). "A probabilistic logic programming event calculus". Theory and Practice of Logic Programming. 15 (2): 213–245. doi:10.1017/S1471068413000690. ISSN 1471-0684. S2CID 5701272.
- ^ Ma, Jiefei; Miller, Rob; Morgenstern, Leora; Patkos, Theodore (2014-07-28). "An Epistemic Event Calculus for ASP-based Reasoning About Knowledge of the Past, Present and Future". EPiC Series in Computing. 26. EasyChair: 75–87. doi:10.29007/zswj.
- ^ D'Asaro, Fabio Aurelio; Bikakis, Antonis; Dickens, Luke; Miller, Rob (2020-10-01). "Probabilistic reasoning about epistemic action narratives". Artificial Intelligence. 287: 103352. doi:10.1016/j.artint.2020.103352. ISSN 0004-3702. S2CID 221521535.
Further reading
- Brandano, S. (2001) "The Event Calculus Assessed," IEEE TIME Symposium: 7-12.
- R. Kowalski and F. Sadri (1995) "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) Solving the frame problem: A mathematical investigation of the common sense law of inertia. MIT Press.
- Shanahan, M. (1999) "The Event Calculus Explained" Springer Verlag, LNAI (1600): 409-30.
Notes
- ^ For example:
before(Time1, Time2) :- timeline(Eternity), append(Before, [Time2 | After], Eternity), member(Time1, Before). timeline([0, 1, 2, 3, 4, 5]).