This module introduces the temporal logic concept of leads-to and its basic properties.
A message at the head of a channel from an agent \(A\) to an agent \(B\) is eventually delivered to \(B\). The message does not remain in the channel forever. The message at the head of the channel may be delayed for an arbitrary finite time, but is not delayed for infinite time. The concept of leads to captures the idea of a predicate holding "eventually."Let \(P\) and \(Q\) be predicates. \(P \leadsto Q\) is a property of a system: a property is a boolean which either holds for the system or does not hold for the system. \(P \leadsto Q\) is read as \(P\) leads to \(Q\).
A trajectory is an infinite path through the state space which satisfies the condition that every message at the head of a channel is delivered eventually.
The property \(P \leadsto Q\) holds for a system exactly when any trajectory that visits a state in which \(P\) holds is at, or later visits, a state in which \(Q\) holds.
For example, consider a trajectory, which is an infinite sequence of states, \(S_{0}, S_{1}, S_{2}, \ldots\). If \(P\) holds in \(S_{i}\) and \(P \leadsto Q\) then there exists some \(j \geq i\) such that \(Q\) holds in \(S_{j}\). (Note that \(j\) could be equal to \(i\).)
x = 0 while true: x = x + 1For this program, for all \(i, j\) where \(j \geq i\): \((x = i) \leadsto (x = j)\)
Agent \(z\) has a variable \(v\) which is initially 0. If \(z\) receives a message from \(x\) before receiving a message from \(y\) it sets \(v\) to 1. If \(z\) receives a message from \(y\) before receiving a message from \(x\) it sets \(v\) to 2. The initial state init of the system has one message on each channel from \(x\) to \(z\) and from \(y\) to \(z\).
Is the following true: \(init \; \leadsto \; (v = 1)\)?
No, because the message from \(y\) may arrive before the message from \(x\).
Is the following true: \(init \; \leadsto \; (v \leq 2)\)?
Yes, because messages from \(x\) and \(y\) will arrive eventually.
x = 0 while true: x = x + 2Does the following progress property hold for the system?
\( (0 \leq x \leq 1) \quad \leadsto \quad (x = 3) \)
No, because if \(x = 0\) then \(x\) never becomes \(3\). The definition of \(P \leadsto Q\) is that ALL paths from ALL states in which \(P\) holds eventually visit states in which \(Q\) holds.
Example
Does the following progress property hold for the system?\( (0 \leq x \leq 1) \quad \leadsto \quad (2 \leq x \leq 3) \)
Yes. All paths from all states in which \(0 \leq x \leq 1\) eventually visit states in which \(2 \leq x \leq 3\).
Example
Does the following progress property hold for the system?\( (0 \leq x \leq 1) \quad \leadsto \quad (2 \leq x) \)
Yes. All paths from all states in which \(0 \leq x \leq 1\) eventually visit states in which \(2 \leq x\).
Example
Does the following progress property hold for the system?\( (0 \leq x \leq 1) \quad \leadsto \quad (0 \leq x \leq 1) \)
Yes. Any trajectory that visits a state in which \(0 \leq x \leq 1\) at a point \(T\) eventually visit states in which \(0 \leq x \leq 1\), because "eventually" includes the possibility of immediacy.
xcount = (xcount + 1) mod 10and when \(z\) receives a message from \(y\) it executes:
ycount = (ycount + 1) mod 5
In the initial state \(xcount, ycount\) are both 0. Agents \(x\) and \(y\) send messages to \(z\) forever.
Is the following true: \(init \; \leadsto \; (xcount = 9)\)?
Yes
Is the following true: \(init \; \leadsto \; (ycount = 4)\)?
Yes.
Is the following true: \(init \; \leadsto \; (xcount = 9) \wedge (ycount = 4)\)?
No. The state in which \((xcount = 9) \wedge (ycount = 4)\) may never occur in a transaction.
if xcount < 10: xcount = xcount + 1and when \(z\) receives a message from \(y\) it executes:
if ycount < 5: ycount = ycount + 1
In the initial state \(xcount, ycount\) are both 0. Agents \(x\) and \(y\) send messages to \(z\) forever.
Is the following true?
\(init \leadsto (xcount = 10)\)
Yes. Is the following true?
\(init \leadsto always(xcount = 10)\)
Yes. Is the following true?
\(init \leadsto always(ycount = 5)\)
Yes. Is the following true?
\(init \leadsto always((xcount = 10) \wedge (ycount = 5))\)
Yes because eventually every trajectory that starts from \(init\) visits and forever thereafter remains in a state in which \((xcount = 10) \wedge (ycount = 5)\).
A state \(s\) is in \(E(P)\) if and only if all trajectories that visit \(s\) visit a state in \(P\) at or after it visits \(s\).
Therefore a state \(s\) is in \(E(A(Q))\) if and only if all trajectories that visit \(s\) eventually visit and remain forever in states that satisfy \(Q\).
\( E(A(P)) \wedge E(A(Q)) \; \equiv \; E(A(P \wedge Q)) \)
A state \(s\) is in \(E(A(P)) \wedge E(A(Q))\) if and only if all trajectories that visit \(s\) eventually visit and remain forever in states that satisfy \(P\) and in states that satisfy \(Q\). Therefore if a state \(s\) is in \(E(A(P)) \wedge E(A(Q))\) then it is also in \(E(A(P \wedge Q))\) i.e.,
\( E(A(P)) \wedge E(A(Q)) \; \Rightarrow \; E(A(P \wedge Q)) \)
The converse,
\(
E(A(P \wedge Q)) \; \Rightarrow \; E(A(P)) \wedge E(A(Q))
\)
is also true because \(E\) and \(A\) are monotonic functions,
i.e. for any predicates \(R, R'\):
\( [R \Rightarrow R'] \wedge E(R) \quad \Rightarrow \quad E(R') \)
\( [R \Rightarrow R'] \wedge A(R) \quad \Rightarrow \quad A(R') \)
\( P \leadsto \neg P \)
which says that predicate \(P\) does not hold forever.
An example of such a formula is that a message \(M\) is at the head of a channel; that condition does not persist forever because the message will be delivered eventually.
One way of proving that \(P \leadsto \neg P\) is to identify an action
\(a\) such that if \(a\) is executed in any state in that
satisfies \(P\) then the state when \(a\) terminates satisfies \(\neg P\).
\( (P \leadsto Q) \wedge (Q \leadsto R) \; \Rightarrow \; (P \leadsto R) \)
If any trajectory that visits a state in which \(P\) holds, later visits a state in which \(Q\) holds in a finite number of steps, and any trajectory that visits a state in which \(Q\) holds, later visits a state in which \(R\) holds in a finite number of steps, then any trajectory that visits a state in which \(P\) holds, later visits a state in which \(R\) holds in a finite number of steps.
\( (P \leadsto R) \wedge (Q \leadsto R) \; \Rightarrow \; ((P \vee Q) \leadsto R) \)
The proof is straightforward.\( (R \; \rightarrow \; (R \cup Q)) \wedge (R \; \leadsto \; \neg R) \quad \Rightarrow \quad (P \leadsto Q) \)
Proof outline: \(R \; \rightarrow \; (R \cup Q) \) implies that every trajectory from a vertex in \(R\) either (1) remains in \(R\) forever or (2) visits a vertex in \(Q\). But, \(R \leadsto \neg R\) implies that the first case is not possible. So, every trajectory from a vertex in \(R\) visits a vertex in \(Q\)
Trajectories from \(P \wedge Q\) are already in \(Q\), and therefore
every trajectory from a vertex in \(P \wedge Q\) visits a vertex in
\(Q\).
The theorem follows from \(P = (R \vee (P \wedge Q) \)
We call this property the basic property because it is the property on which most proofs of progress are based.
The left-hand side of \(\leadsto\) in the Basic Property has two parts:
Let \(f\) be a variant function. So \(f\) is a function from states of the system to a well-founded set. The following theorem is an extension of the basic property. Let \(P\) and \(Q\) be predicates
Variant Function Theorem
\(\forall K: \quad
P \wedge (f = K) \; \leadsto \; (P \wedge (f < K))
\vee Q\)
\(\Rightarrow\)
\(P \leadsto Q\)
Proof
The left-hand side of the implication is the following leads-to formula: If \(P \wedge \neg Q\) holds and the value of the variant function is \(K\) in a state \(s\) then all trajectories from \(s\) enter a state in which: (1) \(P\) holds and the variant function value decreases or (2) \(Q\) holds.Since the value of the variant function can decrease only a finite number of times it follows that
\( P \wedge (f = K) \quad \leadsto \quad Q \)
Take the disjunction of the left-hand side of the \(\leadsto\) over all \(K\) in the above equation to get: \(P \leadsto Q\).
This formula says that if \(P \wedge \neg Q\) holds in a state where the value of the variant function is \(K\) then in the next state either (1) \(P \wedge \neg Q\) continues to hold with the same or lower value of the variant function or (2) \(Q\) holds.
\(R \leadsto \neg R\)
This formula says that \(R\) does not hold forever.
The variant function theorem follows from the two parts.
So \(E(Q)\) is the weakest predicate \(P\) such that \(P \leadsto Q\). Therefore
\( E(Q) \leadsto Q \)
and
\( (P \leadsto Q) \; \equiv \; [P \; \Rightarrow \; E(Q)] \)
The definition of Eventually in terms of CTL is \(E = AF\) where \(A\) stands for all trajectories from a state and \(F\) stands for a future point in the trajectory.
K. Mani Chandy, Emeritus Simon Ramo Professor, California Institute of Technology