Parts 1 and 2 defined temporal operators as sets of vertices of a graph. This part adds a set of initial vertices, which turns a set of vertices into a property of the system, and gives examples of system properties. The last section describes the temporal logic LTL, for completeness, and compares it with CTL.
Associated with each graph is a nonempty set I of
vertices. We call vertices in I initial vertices.
Paths in the graph start in a set S of vertices,
exactly when:
From here on, AG Z is a formula and ⟦AG Z⟧ is its set; parts 1 and 2 wrote AG Z for this set. A graph with initial vertices I satisfies φ, written I ⊨ φ, when every initial vertex is in ⟦φ⟧. A set Z of vertices is also a formula, with ⟦Z⟧ = Z. In Figure 1, S = ⟦φ⟧.
I (orange outline). Vertices
not in R(I) are faded: they cannot affect the answer.
Choose a property; its set S is shaded blue. Notice that
S does not change when you change I: only
the check I ⊆ S does. When the check fails, the
figure shows why, from an initial vertex that is not in
S. Try AG ¬{i} with
I = {d}, then add c.
Whether a vertex v is in one of these sets depends only on
the paths from v, so only on the vertices in
R({v}) and their edges. So whether
I ⊆ S depends only on the part of the graph
reachable from I, which is R(I). With
I = {d}, R(I) = {b, d, f, g, h}: the
vertices a, c, e, i
and j could be deleted, or their edges changed, and no
answer in the last column would change.
| Property | S | Vertices in S | I = {a} | I = {d} |
|---|---|---|---|---|
some path reaches {g, h} | EF {g, h} |
{a, b, c, d, e, f, g, h} |
yes: a → b → d → f → g |
yes: d → f → g |
every path reaches {g, h} | AF {g, h} |
{f, g, h} |
no: a → b → d → b → … |
no: d → b → d → … |
no path reaches i | AG ¬{i} |
{b, d, f, g, h} |
no: a → c → e → j → i |
yes |
wherever a path goes, {g, h} can still be reached | AG EF {g, h} |
{b, d, f, g, h} |
no: a → c → e → j, and from j no path reaches {g, h} |
yes |
Z is an invariant when every initial vertex is in Z and no edge leaves Z. So every path from an initial vertex stays in Z.
stable(Z) ≡ (Z = ⟦AG Z⟧). So, for any invariant Z, I ⊆ ⟦AG Z⟧, that is, I ⊨ AG Z.
I, and the larger region is
Z, which contains it. Build the wall draws the
boundary of Z and marks every edge that crosses it. Edges
may come into Z from outside (green), but none goes
out: Z is stable. Walk from I starts two walkers
at each initial vertex; at every step each walker follows a random
edge out of its vertex, and its path is traced in blue. However long
they walk, no walker gets out: every path from I stays
in Z. Add an edge leaving Z breaks the wall with
one edge out of Z (red). Z is no longer
stable, and walkers can escape.
Each example below is a CTL formula φ, so it gives a
set ⟦φ⟧ of vertices, and the graph with initial
vertices I has the property when I ⊨ φ,
that is, I ⊆ ⟦φ⟧. Read in English, each one is a
statement about the paths that start in I. All the examples
use the example graph of parts 1 and 2, with I = {a}.
Recall from part 1 that P ⟹ Q
is a predicate whose truth set is ⟦P ⟹ Q⟧ = ¬P ∪ Q.
Take P = {e} and X = {e, f, g, h}. Then
⟦AG X⟧ = {f, g, h}, and the truth set of
P ⟹ AG X is
⟦P ⟹ AG X⟧ = ¬P ∪ ⟦AG X⟧ = {a, b, c, d, f, g, h, i, j}. It contains
a, because a is not in P, so the
graph has the property. But it has it only because the initial vertex
is not in P. P ⟹ AG X
checks only the initial vertices: it says nothing about vertices of
P that a path from I reaches later.
In English: if a path starts in P, then whenever it is in
P, it stays in X from then on. The truth set is
⟦P ⟹ AG (P ⟹ AG X)⟧ = {a, b, c, d, f, g, h, i, j}.
Again a is in it only because a is not in
P: a P ⟹ in
front constrains only the paths that start in P. With
I = {e}, both example 1 and example 2 fail:
e is in P, and the edge
e → j leaves X.
In English: whenever a path from I reaches
P, it stays in X from then on. The truth set
is ⟦AG (P ⟹ AG X)⟧ = {b, d, f, g, h, i, j}, and a is not in it:
the path a → c → e reaches e, and
from e the edge e → j leaves
X. In general, the graph has this property exactly when
R(I) ∩ P ⊆ ⟦AG X⟧.
| # | Formula | On the paths from a | ⟦φ⟧ | a ∈ ⟦φ⟧? |
|---|---|---|---|---|
| 4 | EF {g, h} | some path reaches g or h |
{a, b, c, d, e, f, g, h} | yes: a → b → d → f → g |
| 5 | AF {g, h} | every path reaches g or h |
{f, g, h} | no: a → b → d → b → d → … |
| 6 | AG ¬{i} | no path reaches i |
{b, d, f, g, h} | no: a → c → e → j → i |
| 7 | EG ¬{i} | some infinite path never visits i |
{a, b, c, d, e, f, g, h} | yes: a → b → d → b → d → … |
| 8 | AG EF {g, h} | wherever a path goes, it can still reach g or h |
{b, d, f, g, h} | no: a → c → e → j, and from j no path reaches {g, h} |
| 9 | EF AG {g, h} | some path reaches a vertex from which no path leaves {g, h} |
{a, b, c, d, e, f, g, h} | yes: a → b → d → f → g, and ⟦AG {g, h}⟧ = {g, h} |
| 10 | AF (AG {g, h} ∨ AG {i, j}) | every path ends up trapped in one of the cycles g ↔ h and i ↔ j |
{c, e, f, g, h, i, j} | no: a → b → d → b → … is trapped in neither. With I = {c}, the graph has it. |
| 11 | E[¬{e} U {g, h}] | some path reaches g or h without passing through e |
{a, b, d, f, g, h} | yes: a → b → d → f → g |
| 12 | AG ({e} ⟹ EF {i}) | whenever a path reaches e, it can still reach i |
V | yes: e → j → i |
Compare examples 6 and 7, and 8 and 9: changing an A into an E, or swapping the order of two operators, changes the answer.
The course uses UNITY, with operators defined in terms of CTL. This section describes LTL and compares LTL and CTL.
Parts 1 and 2 defined each operator as a set of vertices. Inside each
definition is a statement about paths. For example,
⟦AF Z⟧ is the set of vertices v such that every
infinite path from v has the property “visits
Z”. This section looks at that property of a single
path on its own. Doing so leads to the temporal logic LTL.
π is an infinite path. Its suffix πi is the path that starts at position i: drop the first i vertices. π0 = π.
A path property holds or fails on each infinite path. We write
π ⊨ φ for “the path property
φ holds on π”. The simplest path
property is a set Z of vertices, which holds on a path
when the path starts in Z:
Each letter makes a new path property from old ones, by looking at the suffixes of the path.
X φ holds on a path when φ holds on the path from its second vertex. For a set Z: π ⊨ X Z ≡ v1 ∈ Z.
F φ holds when φ holds on some suffix. For a set Z: some vertex of the path is in Z.
G φ holds when φ holds on every suffix. For a set Z: every vertex of the path is in Z.
For sets Y and Z: the path reaches Z, and every vertex before that is in Y.
On one path there is no “all paths” or “some
path”: there is only the path. So F and G are duals through plain
negation: a path does not visit Z exactly when it stays in
¬Z.
Because F and G take any path property, they
can be applied to each other:
Z
later. That is, the path visits Z infinitely
often.Z. The path eventually stays in
Z.
A path in a finite graph that we can draw is a lasso: a prefix,
then a cycle repeated forever. On a lasso, every vertex after the
prefix is on the cycle. So G F Z holds exactly when some
vertex of the cycle is in Z, and F G Z exactly
when every vertex of the cycle is.
Z = {d, g, h} has a thick green outline; switch the
clicks to edit it. Choose a path, or build one: click a start vertex,
then each next vertex; clicking a vertex already on the path closes
the cycle. The tape below the graph shows the path position by
position; positions in Z are green, and the bracket marks
the cycle that repeats forever. Choose a formula, and the cursor scans
the tape until it can decide. Compare G F Z and
F G Z on the first two paths.
A path property becomes a set of vertices by asking about all the paths from a vertex, or about some path:
A and E turn a property of paths into a set of vertices.
Every operator of parts 1 and 2 is one letter with A or E in front of it:
These are identities between formulas: each CTL operator is an abbreviation. So their sets are equal.
CTL and LTL
In CTL, every X, F, G and U has an A or an E directly in front
of it, so every step gives a set of vertices. In LTL, the
letters X, F, G and U are combined freely into a path property
φ, and a single A is put in front of the whole
formula: a vertex has the LTL property φ when it is in
⟦A φ⟧.
Initial states play the same part as in section 1. A graph with
initial vertices I has the LTL property
φ when every infinite path from an initial vertex
satisfies φ:
So this says: every infinite path that starts in I has
the property φ. In CTL, the check is
I ⊆ ⟦φ⟧ for a CTL formula φ,
built from A and E operators; in LTL, it is
I ⊆ ⟦A φ⟧, with the A outside.
For G F Z, the LTL property and a CTL formula agree:
A vertex v is not in ⟦A (G F Z)⟧ exactly when
some path from v eventually stays in
¬Z forever: it reaches some vertex
w and then follows an infinite path that avoids
Z. That says w ∉ ⟦AF Z⟧ for some
w reachable from v, which is exactly
v ∉ ⟦AG AF Z⟧.
For F G Z the two logics differ. LTL is a
linear-time logic: it judges one path at a time. CTL is a
branching-time logic: from a vertex the paths branch wherever a
vertex has more than one edge, and its operators can speak of the
branches still open at each step.
Take three vertices a, b, c,
with edges a → a, a → b,
b → c and c → c, and
Z = {a, c}.
a
either stays at a forever or goes
a → … → a → b → c → c → ….
Either way it ends up staying in Z, so
a ∈ ⟦A (F G Z)⟧.⟦AG Z⟧ = {c}, because from
a the edge a → b leaves
Z. The path a → a → a → …
never reaches c, so ⟦AF AG Z⟧ = {b, c}, and
a is not in it.The computation tree from a vertex shows every path from it at once: the root is the vertex, and each node has a child for each edge out of its vertex. Every infinite path from the root is a branch of the tree.
a nodes run down the diagonal: they form the branch
that stays at a forever. Each row is a branch that leaves
a at a different step, goes to b, and then
stays at c. Nodes in
Z = {a, c} have a thick green outline.
LTL walks the branches one at a time: each one, from some step
on, stays in Z. CTL first shades the nodes in
⟦AG Z⟧, the nodes whose whole subtree is in
Z; they are the c nodes. Then it walks the
diagonal branch, which never reaches a shaded node. So a is
not in ⟦AF AG Z⟧.
At every visit to a, the future still branches: the path
could still go to b. AF AG Z asks every path
to reach a vertex from which no branch leaves Z.
A (F G Z) asks only that each path, on its own, stop
leaving Z.
This is more than one candidate failing: no CTL formula has the same set
as A (F G Z) on every graph. So LTL can state properties
that CTL cannot.
In the other direction, AG EF Z (from every reachable
vertex, some path still reaches Z) speaks of
some path in the middle of the formula, which LTL, with its one
A outside, cannot. The logic CTL* allows A and E anywhere, and
contains both CTL and LTL.
Pnueli introduced temporal logic for reasoning about programs in
1977, in its linear-time form. Clarke and Emerson introduced CTL, and
with it model checking, in 1981. Emerson and Halpern defined CTL*.
Fairness in LTL is itself a path property, such as
G F “the path takes an edge of color
c”; in CTL it has to
be added to the logic, as AfF was in part 2.