• No results found

3.3 A Probabilistic, Epistemic Situation Calculus

4.1.4 The passage of Time

Let us now turn to the issue of modeling the passage of time during a course of actions. As indicated in the introduction of this chapter, motivated by the treatment of time in robot control languages like RPL, RAP, or Colbert, we introduce a new type of primitive action waitFor(τ ). The intuition is as follows: normally, every action happens immediately, that is, the starting time of the situation after doing a in s is the same as the starting time of s. The only exception is waitFor(τ ): whenever this action occurs, the starting time of the resulting situation is advanced to the earliest time in the future when τ becomes true. Note that this has the effect that actions always happen as soon as possible.

One may object that requiring that two actions other than waitFor must happen at the same time is unrealistic. However, in robotics applications, actions often involve little more than sending messages in order to initiate or terminate processes so that the actual duration of such actions is negligible. For example, a procedure like mail delivery essentially consists of startGo and waitFor actions, which cause the robot to start moving towards its destination respectively to wait until it has been reached. In this example, a considerable amount of

4.1. CONTINUOUS CHANGE AND TIME 59 time passes only while the high-level controller is waiting (i.e. the robot is traveling to its destination). Moreover, if two actions cannot happen at the same time, they can always be separated explicitly using waitFor.

The arguments of waitFor are restricted to what we call a t-form, which is a Boolean combination of closed atomic formulas of the form (F op r), where F is a continuous fluent

where now may refer to the actual situation, op∈ {<, =}, and r is a term of type real (not

mentioning val). We freely use≤, ≥, or > as well. An example is τ = (robotLoc1d ≥ 1000).

To evaluate a t-form at a situation s and time t, we write τ [s, t] which results in a formula which is like τ except that every continuous fluent F is replaced by val(F (s), t). For instance,

(robotLoc1d ≥ 1000)[s, t] becomes (val(robotLoc1d(s), t) ≥ 1000). We will not go into the

details of reifying t-forms within the language; a thorough treatment of these issues can be found in Appendix A.1.4.

To see how actions are forced to happen as soon as possible, let ltp(τ, s, t) be an abbrevi- ation for the formula

τ [s, t]∧ t ≥ start(s) ∧ ∀t0.start(s)≤ t0 < t⊃ ¬τ [s, t0],

that is, t in ltp(τ, s, t) is the least time point after the start of s where τ becomes true.1 Then

we require that a waitFor-action is possible if and only if the condition has a least time point. In practice, this means that it is up to the user to ensure that τ has a least time point.

Poss(waitFor(τ ), s)≡ ∃t.ltp(τ, s, t).

Intuitively, thus, a waitFor(τ ) action is not possible in s if there is no least time point after

the start of s where τ becomes true. For example, if robotLoc1d(S0) = linear(0, 1, start(S0)),

then waitFor(robotLoc > 1) is not possible in S0 because there is no least time point t such

that 0 + 1× t > 1. On the other hand, it is straightforward to show that, if ∃t.ltp(τ, s, t) is

satisfied, then t is unique.

Finally, we need to characterize how the fluent start changes its value when an action occurs. The following successor state axiom for start captures the intuition that the starting time of a situation changes only as a result of a waitFor(τ ), in which case it advances to the earliest time in the future when τ holds.

Poss(a, s)⊃ [start(do(a, s)) = t ≡

∃τ.a = waitFor(τ ) ∧ ltp(τ, s, t) ∨ ∀τ.a 6= waitFor(τ ) ∧ t = start(s)]] (4.1)

Let AXcc be the foundational axioms of the situation calculus from Section 3.1 together with

the axioms required for t-form’s, the precondition axiom for waitFor, and the successor state

axiom for start. Then, the following formulas are logical consequences of AXcc.

Proposition 3:

1. Actions happen as soon as possible:

s≺ do(a, s) ⊃ [start(do(a, s)) = start(s)] ∨ [∃τ.a = waitFor(τ ) ∧ ltp(τ, s, start(do(a, s)))]; 2. The starting time of legal action sequences is monotonically nondecreasing:

s≺ s0⊃ start(s) ≤ start(s0).

1This is not unlike Reiter’s definition of a least natural time point in the context of natural actions [Rei96].

Proof: (1) Follows directly from Axiom 4.1 and the fact that a is possible in s.

(2) Follows by induction on n, the number of actions performed to obtain s0 from s. n = 1

follows from (1), and the fact that, by definition, ltp(τ, s, t) ⊃ t ≥ start(s). If n > 1, then

∃a∗, s∗.s0 = do(a∗, s∗)∧ s ≺ s∗∧ Poss(a∗, s∗). By induction hypothesis, start(s) ≤ start(s∗).

From this, together with (1) and ltp(τ, s, t)⊃ t ≥ start(s), we get start(s) ≤ start(s0). 2

To illustrate the approach, let us go back to the 1-dimensional robot example. First, we can formulate a successor state axiom for robotLoc1d:

P oss(a, s)⊃ [robotLoc1d(do(a, s)) = y ≡

∃t0, v, x.t0= start(s)∧ x = val(robotLoc1d(s), t0)∧

[a = startGo(v)∧ y = linear(x, v, t0)∨

a = endGo∧ y = constant(x)]∨

¬∃v.(a = startGo(v) ∨ a = endGo) ∧ y = robotLoc1d(s)]

In other words, when an action is performed, robotLoc1d is assigned either the function

linear(x, v, t0), if the robot starts moving with velocity v and x is the location of the robot at

situation s, or it is assigned constant(x) if the robot stops, or it remains the same as in s. To see that the above successor state axiom is well-defined, let

γf(a, s, y)=. ∃t0, v, x.t0 = start(s)∧ x = val(robotLoc1d(s), t0)∧

[a = startGo(v)∧ y = linear(x, v, t0)∨

a = endGo∧ y = constant(x)].

It is easy to see that

∀a, s.[∃y.γf(a, s, y)≡ ∃v.(a = startGo(v) ∨ a = endGo)].

Furthermore, for every startGo or endGo action the value of y is uniquely determined. Thus, from the unique names axioms for primitive actions, we get:

¬∃a, s, y, y0

f(a, s, y)∧ γf(a, s, y0)∧ y 6= y0

and hence the successor state axiom for robotLoc1d(s) is equivalent to a successor state axiom of the form of Axiom 3.5 on page 41, and is well-defined (cf. Axiom 3.6).

Let Γ be AXcc together with the axioms for val, the successor state axiom for robotLoc1d,

precondition axioms stating that startGo and endGo are always possible, and the facts

robotLoc1d(S0) = constant(0) and start(S0) = 0, that is, the robot initially rests at position 0

and the starting time of the initial situation is 0. Let us assume the robot starts moving at speed 50 (cm/s) and then waits until it reaches location 1000 (cm), at which point it stops.

The resulting situation is S1 = do([startGo(50), waitFor(robotLoc1d = 1000), endGo], S0).

Then:

Γ|= start(S1) = 20∧ robotLoc1d(S1) = constant(1000).

Proof: (Sketch) In situation do(startGo(50), S0), the value of robotLoc1d is linear(0, 50, 0).

val(linear(0, 50, 0), 20) = 1000, and hence the least time point of the t-form robotLoc1d =

1000 in situation do(startGo(50), S0) is 20. Thus, in do([startGo(50), waitFor(robotLoc1d =

1000)], S0) the value of start is 20, and the value of robotLoc1d remains linear(0, 50, 0). Fi-

nally, the execution of endGo leaves start unaffected (i.e. 20), and changes robotLoc1d to

constant(1000) because val(linear(0, 50, 0), 20) = 1000. 2

In other words, the robot moves for 20 seconds and stops at location 1000, as one would expect.

4.1. CONTINUOUS CHANGE AND TIME 61