foundations of computational agents
The third edition of Artificial Intelligence: foundations of computational agents, Cambridge University Press, 2023 is now available (including full text).
The second relational representation for reasoning about actions and change, the event calculus, models how the truth value of relations changes because of events occurring at certain times. Time can be modeled as either continuous or discrete.
Events are modeled as occurring at particular times. Event $E$ occurring at time $T$ is written as $event(E,T)$.
Events make some relations true and some no longer true:
$initiates(E,R,T)$ is true if event $E$ makes primitive relation $R$ true at time $T$
$terminates(E,R,T)$ is true if event $E$ makes primitive relation $R$ no longer true at time $T$.
Time $T$ is a parameter to $initiates$ and $terminates$ because the effect of an event can depend on what else is true at the time. For example, the effect of attempting to unlock a door depends on the position of the robot and whether it is carrying the appropriate key.
Relations are either true or false at any time. In the event calculus, relations are reified, where $holds(R,T)$ means that relation $R$ is true at time $T$. This is analogous to having $T$ as the last argument to $R$ in the situation calculus. The use of the meta-predicate $holds$ allows general rules that are true for all relations.
Derived relations are defined in terms of primitive relations and other derived relations for the same time.
Primitive relation $R$ holds at time $T$ if an event occurred before $T$ that made $R$ true, and there was no intervening event that made $R$ no longer true. This can be specified as follows:
$holds(R,T)\leftarrow $ | ||
$\mathrm{}\mathit{\hspace{1em}\hspace{1em}\u2006}event(E,{T}_{0})\wedge $ | ||
$$ | ||
$\mathrm{}\mathit{\hspace{1em}\hspace{1em}\u2006}initiates(E,R,{T}_{0})\wedge $ | ||
$\mathrm{}\mathit{\hspace{1em}\hspace{1em}\u2006}\sim clipped(R,{T}_{0},T).$ | ||
$clipped(R,{T}_{0},T)\leftarrow $ | ||
$\mathrm{}\mathit{\hspace{1em}\hspace{1em}\u2006}event({E}_{1},{T}_{1})\wedge $ | ||
$\mathrm{}\mathit{\hspace{1em}\hspace{1em}\u2006}terminates({E}_{1},R,{T}_{1})\wedge $ | ||
$$ | ||
$$ |
The atom $clipped(R,{T}_{0},T)$ means there is an event between times ${T}_{0}$ and $T$ that makes $R$ no longer true; $$ is true if time ${T}_{0}$ is before time ${T}_{1}$. Here $\sim $ is negation as failure, and so these clauses mean their completion.
Actions are represented in terms of what properties they initiate and terminate. As in the situation calculus, the preconditions of actions are specified using the $poss$ relation.
The ${p}{\mathit{}}{i}{\mathit{}}{c}{\mathit{}}{k}{\mathit{}}{u}{\mathit{}}{p}$ action initiates a ${c}{\mathit{}}{a}{\mathit{}}{r}{\mathit{}}{r}{\mathit{}}{y}{\mathit{}}{i}{\mathit{}}{n}{\mathit{}}{g}$ relation, and it terminates a ${s}{\mathit{}}{i}{\mathit{}}{t}{\mathit{}}{t}{\mathit{}}{i}{\mathit{}}{n}{\mathit{}}{g}{\mathit{}}{\mathrm{\_}}{\mathit{}}{a}{\mathit{}}{t}$ relation as long as the preconditions for ${p}{\mathit{}}{i}{\mathit{}}{c}{\mathit{}}{k}{\mathit{}}{u}{\mathit{}}{p}$ are true:
${i}{}{n}{}{i}{}{t}{}{i}{}{a}{}{t}{}{e}{}{s}{}{(}{p}{}{i}{}{c}{}{k}{}{u}{}{p}{}{(}{A}{}{g}{,}{O}{}{b}{}{j}{)}{,}{c}{}{a}{}{r}{}{r}{}{y}{}{i}{}{n}{}{g}{}{(}{A}{}{g}{,}{O}{}{b}{}{j}{)}{,}{T}{)}{\leftarrow}$ | ||
${\mathrm{}}{\mathit{\hspace{1em}\hspace{1em}\u2006}}{p}{}{o}{}{s}{}{s}{}{(}{p}{}{i}{}{c}{}{k}{}{u}{}{p}{}{(}{A}{}{g}{,}{O}{}{b}{}{j}{)}{,}{T}{)}{.}$ | ||
${t}{}{e}{}{r}{}{m}{}{i}{}{n}{}{a}{}{t}{}{e}{}{s}{}{(}{p}{}{i}{}{c}{}{k}{}{u}{}{p}{}{(}{A}{}{g}{,}{O}{}{b}{}{j}{)}{,}{s}{}{i}{}{t}{}{t}{}{i}{}{n}{}{g}{}{\mathrm{\_}}{}{a}{}{t}{}{(}{O}{}{b}{}{j}{,}{P}{}{o}{}{s}{)}{,}{T}{)}{\leftarrow}$ | ||
${\mathrm{}}{\mathit{\hspace{1em}\hspace{1em}\u2006}}{p}{}{o}{}{s}{}{s}{}{(}{p}{}{i}{}{c}{}{k}{}{u}{}{p}{}{(}{A}{}{g}{,}{O}{}{b}{}{j}{)}{,}{T}{)}{.}$ | ||
${p}{}{o}{}{s}{}{s}{}{(}{p}{}{i}{}{c}{}{k}{}{u}{}{p}{}{(}{A}{}{g}{,}{O}{}{b}{}{j}{)}{,}{T}{)}{\leftarrow}$ | ||
${\mathrm{}}{\mathit{\hspace{1em}\hspace{1em}\u2006}}{a}{}{u}{}{t}{}{o}{}{n}{}{o}{}{m}{}{o}{}{u}{}{s}{}{(}{A}{}{g}{)}{\wedge}$ | ||
${\mathrm{}}{\mathit{\hspace{1em}\hspace{1em}\u2006}}{A}{}{g}{\ne}{O}{}{b}{}{j}{\wedge}$ | ||
${\mathrm{}}{\mathit{\hspace{1em}\hspace{1em}\u2006}}{h}{}{o}{}{l}{}{d}{}{s}{}{(}{a}{}{t}{}{(}{A}{}{g}{,}{P}{}{o}{}{s}{)}{,}{T}{)}{\wedge}$ | ||
${\mathrm{}}{\mathit{\hspace{1em}\hspace{1em}\u2006}}{h}{}{o}{}{l}{}{d}{}{s}{}{(}{s}{}{i}{}{t}{}{t}{}{i}{}{n}{}{g}{}{\mathrm{\_}}{}{a}{}{t}{}{(}{O}{}{b}{}{j}{,}{P}{}{o}{}{s}{)}{,}{T}{)}{.}$ |
This implies that if a ${p}{\mathit{}}{i}{\mathit{}}{c}{\mathit{}}{k}{\mathit{}}{u}{\mathit{}}{p}$ is attempted when the preconditions do not hold, nothing happens. It is also possible to write clauses that specify what happens under different circumstances, such as when a pickup is attempted for an object that is being held by something else.
Given particular action occurrences, and making the complete knowledge assumption that all intervening events are specified, the top-down proof procedure with negation as failure can be used to prove what is true.
The event calculus is different from the situation calculus in that it is based on a temporal representation rather than a state-based representation; the $T$ argument in the event calculus is a time and not a state or situation. This means that an agent can reason about discrete or continuous time. Multiple agents carrying out actions in time can be modeled by specifying when the various actions by the agents occurred. The situation calculus requires interleaving the actions by different agents. The event calculus also lends itself to the case where events have durations. Given the times that events occurred, the effect can depend on the duration between times. Planning in the situation calculus is done by constructing a proof of the existence of a situation. In the event calculus, planning is done by abduction, which is used to hypothesize the occurrence of events to make a goal true.