CTL Temporal Logic
Computational Tree Logic (CTL)
1. Temporal Logic and Model-Based Truth
Temporal logic extends ordinary propositional logic with temporal operators. These operators allow reasoning about how system properties behave over time.
Examples of temporal questions include:
Whether a property is true in the next state.
Whether a property will become true at some point in the future.
Whether a property remains true globally or at all future points.
Whether one property remains true until another property becomes true.
A temporal formula does not have a meaningful truth value independently of a system model. Its truth is evaluated with respect to:
A model of the system.
A particular state or execution path in that model.
The temporal formula being checked.
The notation
means that formula φ is true in state s of model M.
State Formulas and Path Formulas
Temporal reasoning distinguishes between two types of formulas:
State formula: A formula whose truth value is evaluated at a particular state of a model.
Path formula: A formula whose truth value is evaluated along a particular execution path.
A path represents one possible sequence of states through which the system may execute. A state may have several possible successors, and therefore several possible paths may begin from that state.
CTL combines path quantifiers with temporal operators so that its formulas are ultimately evaluated at states.
2. Computational Tree Logic
Computational Tree Logic, abbreviated CTL, is a form of branching-time temporal logic.
Linear-Time and Branching-Time Logic
There are two major ways to reason about time in a transition system:
Linear-time logic: Considers one execution trace at a time. Time progresses along a single sequence of states.
Branching-time logic: Considers all possible execution traces that can branch from a state.
CTL is branching-time logic because it can express statements such as:
A property holds on all possible execution paths.
A property holds on at least one possible execution path.
Computational Trees
A state-transition system can be unfolded into a tree of possible executions.
For example, suppose a system contains the following transitions:
From s0, the system can move to s1 or s2.
From s1, the system can remain in s1.
From s2, the system can move to s0 or s1.
The state s0 may appear again later in the unfolded tree because there is a path from s2 back to s0. Although the repeated occurrence of s0 has the same state behavior and labeling, it represents the system at a different time step.
If the initial occurrence of s0 is at time t0, then:
Its immediate successors occur at time t0+1.
States reached after two transitions occur at time t0+2.
The repeated s0 at time t0+2 has the same state properties as the original s0, but it occurs at a different point in the execution.
A computational tree is obtained by expanding a transition system into all possible executions from a state. CTL expresses properties over this branching structure.
3. CTL Path Quantifiers
CTL uses two path quantifiers.
Universal Path Quantifier: A
The quantifier A means for all paths.
A formula beginning with A must hold on every possible execution path beginning at the current state.
Examples:
AXφ: On every possible path, φ is true in the next state.
AFφ: On every possible path, φ eventually becomes true.
AGφ: On every possible path, φ remains true globally.
Existential Path Quantifier: E
The quantifier E means there exists a path.
A formula beginning with E is true if at least one possible execution path satisfies the associated temporal condition.
Examples:
EXφ: There is at least one next state in which φ is true.
EFφ: There is at least one path along which φ eventually becomes true.
EGφ: There is at least one path along which φ remains true globally.
The difference between A and E is essential:
A requires a property on every possible behavior.
E requires a property on at least one possible behavior.
4. Temporal Operators
The basic temporal operators introduced are:
Next: X
The operator X refers to the next state.
Xφ means that φ is true in the next state of a path.
Since the next state may not be unique in a branching system, X is generally combined with a path quantifier:
AXφ
EXφ
Future: F
The operator F means eventually in the future.
Fφ means that φ is true at some state in the future, possibly the current state depending on the formal convention.
In CTL, it appears with a path quantifier:
AFφ: φ eventually becomes true on every path.
EFφ: φ eventually becomes true on at least one path.
Globally: G
The operator G means globally or always.
Gφ means that φ remains true at every state along a path.
In CTL:
AGφ: φ is true at every state on every path.
EGφ: There is a path on which φ is true at every state.
Until: U
The operator U is a binary temporal operator. It requires two formulas.
means that:
φ1 remains true until φ2 becomes true.
φ2 must eventually become true.
Before the state where φ2 first becomes true, φ1 must hold at all preceding states.
CTL forms include:
A[φ1Uφ2]: On every path, φ1 remains true until φ2 becomes true.
E[φ1Uφ2]: There exists a path on which φ1 remains true until φ2 becomes true.
The brackets are often used to make the scope of the until operator clear.
5. Syntax of CTL
CTL formulas are constructed recursively from constants, atomic propositions, logical operators, path quantifiers, and temporal operators.
Basic CTL Formulas
The following are CTL formulas:
⊤, representing true.
⊥, representing false.
Any atomic proposition, such as p, q, or r.
If p is true in a state, then p is true at that state. If it is not true in that state, then p is false there.
Boolean Connectives
If φ, φ1, and φ2 are CTL formulas, then the following are also CTL formulas:
¬φ
φ1∧φ2
φ1∨φ2
φ1⇒φ2
Other Boolean operators, such as NAND and NOR, can also be expressed or used if included in the logical language.
Temporal CTL Formulas
A temporal operator must be combined with a path quantifier. The standard CTL operators are:
AXφ
EXφ
AFφ
EFφ
AGφ
EGφ
A[φ1Uφ2]
E[φ1Uφ2]
The path quantifier is what makes the formula a state formula.
Important Syntactic Restriction
In CTL, every temporal operator must be immediately preceded by a path quantifier, either A or E.
For example:
AGp is a valid CTL formula.
EFq is a valid CTL formula.
A[pUq] is a valid CTL formula.
Fp is not a valid CTL formula by itself.
E[pUq] is valid, but pUq alone is not a complete CTL formula.
A formula may be a valid temporal formula without being a valid CTL formula. CTL imposes the additional requirement that temporal operators be paired with path quantifiers.
6. CTL Subformulas and Construction
A complex CTL formula is built from smaller formulas called subformulas.
Consider:
This formula can be constructed in stages:
p is an atomic proposition and therefore a CTL formula.
q is an atomic proposition and therefore a CTL formula.
¬q is a CTL formula.
EG(¬q) is a CTL formula.
¬EG(¬q) is a CTL formula.
p⇒¬EG(¬q) is a CTL formula.
AG(p⇒¬EG(¬q)) is a CTL formula.
The subformulas include:
p
q
¬q
EG(¬q)
¬EG(¬q)
p⇒¬EG(¬q)
AG(p⇒¬EG(¬q))
The truth value of the complete formula can be evaluated only after the truth values of its subformulas have been determined.
Invalid Temporal-Operator Combinations
Consider:
This is a temporal expression, but it is not a valid CTL formula because neither F nor U has the required CTL path quantifier.
A properly quantified version could be:
Here:
E[rUq] is valid because U is preceded by E.
AF(E[rUq]) is valid because F is preceded by A.
Thus, nested temporal operators are allowed, provided each temporal operator is correctly preceded by a path quantifier.
7. Meaning of the Main CTL Operators
7.1 Next-State Operators
AXφ
if and only if φ holds in every immediate successor of s.
In other words, every possible next state must satisfy φ.
EXφ
if and only if at least one immediate successor of s satisfies φ.
Thus:
AXφ requires all next states to satisfy φ.
EXφ requires only one next state to satisfy φ.
Suppose state s0 has three successors, s1, s2, and s3:
If φ is true in all three states, both AXφ and EXφ are true at s0.
If φ is true only in s1, then EXφ is true but AXφ is false.
If φ is false in all three states, both formulas are false.
7.2 Globally Operators
AGφ
if and only if φ is true:
In the current state s.
In every state reachable along every path beginning at s.
Therefore, a single reachable state in which φ is false is sufficient to make AGφ false.
EGφ
if and only if there exists at least one path beginning at s such that φ is true in every state on that path.
The distinction is:
AGφ: Every possible path always satisfies φ.
EGφ: At least one possible path always satisfies φ.
A formula may satisfy EGφ but not AGφ when one path preserves φ but another path reaches a state where φ is false.
7.3 Eventually Operators
AFφ
if and only if every path beginning at s eventually reaches a state where φ is true.
This expresses a universal liveness property: no matter how the system proceeds, φ must eventually occur.
EFφ
if and only if there exists at least one path beginning at s that eventually reaches a state where φ is true.
This expresses the possibility of eventually reaching a state satisfying φ.
The distinction is:
AFφ: φ is unavoidable in the future.
EFφ: φ is possible in the future.
7.4 Until Operators
A[φ1Uφ2]
if and only if, on every path beginning at s, there exists a position i such that:
φ2 holds at position i.
φ1 holds at every earlier position j where j<i.
Formally:
This means that every possible execution must eventually reach a φ2 state, while satisfying φ1 beforehand.
E[φ1Uφ2]
if and only if at least one path beginning at s contains a state satisfying φ2, with φ1 true at every preceding state.
Formally:
For example, E[pUq] is true at s0 if there is at least one path such as:
where:
p is true at s0.
p is true at s1.
q is true at s4.
If another path reaches a state where p is false before reaching a q-state, that does not invalidate E[pUq], because only one satisfying path is required. However, it does invalidate A[pUq], because the universal version requires every path to satisfy the condition.
8. Kripke Structures
The semantics of CTL is defined over a particular type of transition system called a Kripke structure.
A Kripke structure is commonly represented as:
where:
S is a finite set of states.
R is the transition relation.
L is the labeling function.
State Set: S
The set S contains all states of the system.
The state set is finite in the model being considered.
Transition Relation: R
The transition relation describes which states can directly follow other states.
If (s,s′)∈R, then the system can transition from state s to state s′.
A crucial condition is that the transition relation is total or complete:
This means that every state must have at least one outgoing transition. A state with no successor is not permitted in the Kripke structures used here.
Self-loops are allowed. For example:
means that the system can remain in s1.
Labeling Function: L
The labeling function identifies which atomic propositions are true in each state.
If V is the set of atomic propositions, then:
The notation 2V denotes the power set of V, meaning the set of all subsets of V.
If:
then p and q are true in s0, while any proposition in V that is not listed is false in s0.
A Kripke structure resembles a finite-state machine, but it additionally includes a labeling function and requires every state to have at least one outgoing transition.
9. Example Kripke Structure
Consider a system with states:
and atomic propositions:
Suppose the labeling function is:
L(s0)={a,b}
L(s1)={c}
L(s2)={b,c}
This means:
At s0, a and b are true.
At s1, only c is true.
At s2, b and c are true.
Suppose the transitions are:
s0 has two outgoing transitions.
s1 has a transition to itself.
s2 has two outgoing transitions.
Because every state has an outgoing transition, this is a valid Kripke structure.
A system with a state s6 that has no outgoing transition is not a valid Kripke structure under the required completeness condition. Adding a transition from s6 to another state makes the transition relation complete and restores validity.
10. A Larger Kripke-Structure Example
Consider four states:
with atomic propositions:
Possible transitions include:
s0→s1
s1→s2
s1→s3
s2→s3
s3→s2
s3→s3
Thus, the transition relation contains six transitions.
The labeling function is:
L(s0)={p,q,r}
L(s1)={p,q}
L(s2)={r}
L(s3)={q,r}
For example:
M,s0⊨p because p∈L(s0).
M,s2⊨p because p∈/L(s2).
M,s3⊨q∧r because both q and r belong to L(s3).
M,s2⊨p∧q because neither p nor q is true there.
11. Formal Semantics of CTL
The semantics of CTL defines when a formula is true in a state.
The basic notation is:
which means that φ holds in state s of model M.
The semantics is defined by structural induction. Each complex formula is evaluated from the truth values of its component subformulas.
Constants
For every state s:
and:
Therefore:
⊤ is true in every state.
⊥ is false in every state.
Atomic Propositions
For an atomic proposition p:
If p∈/L(s), then:
Negation
Thus, ¬φ is true exactly when φ is false in the same state.
Conjunction
if and only if:
Both formulas must hold in the state.
Disjunction
if and only if at least one of the following is true:
or:
Implication
if and only if:
This follows the equivalence:
12. Formal Semantics of Temporal Operators
Next-State Semantics
For the universal next operator:
if and only if:
Every immediate successor of s must satisfy φ.
For the existential next operator:
if and only if:
At least one immediate successor must satisfy φ.
Globally Semantics
Let π=s0s1s2… be a path beginning at s, where s0=s.
For the universal globally operator:
if and only if every path π beginning at s satisfies:
For the existential globally operator:
if and only if there exists at least one path π beginning at s such that:
Eventually Semantics
For the universal eventually operator:
if and only if every path π=s0s1s2… beginning at s contains some position i satisfying:
For the existential eventually operator:
if and only if at least one path beginning at s contains some position i satisfying:
Until Semantics
For the universal until operator:
if and only if every path π=s0s1s2… beginning at s contains an index i such that:
and:
For the existential until operator:
if and only if there exists at least one path beginning at s containing an index i such that:
and:
The universal version fails if even one path violates the required condition. The existential version succeeds as soon as one satisfying path is found.
13. State-Specific Truth Values
A CTL formula can be true in one state and false in another state of the same model.
For example, suppose s1 has only one possible execution path and q remains true on every state of that path. Then:
If the system begins at s0 and one of its possible paths eventually reaches a state where q is false, then:
This does not contradict the fact that AGq may be true at s1. The formula is evaluated relative to the set of paths reachable from the particular state being examined.
Similarly:
EGφ may be true at a state if one path preserves φ forever.
AGφ may be false at the same state if another path reaches a state where φ is false.
AFφ may be false if one path avoids φ forever.
EFφ may still be true if another path eventually reaches φ.
14. Atomic Propositions and the State Space
The set of atomic propositions can be used to describe possible system states.
Suppose:
The power set of X is:
There are eight subsets because:
Each subset represents one possible combination of truth values:
∅: none of p, q, or r is true.
{p}: only p is true.
{q}: only q is true.
{r}: only r is true.
{p,q}: p and q are true.
{p,r}: p and r are true.
{q,r}: q and r are true.
{p,q,r}: all three are true.
For n atomic propositions, the total number of possible truth-value combinations is:
In a digital system, each atomic proposition can represent a binary system variable:
True may represent 1, on, or active.
False may represent 0, off, or inactive.
Therefore, n binary state variables can describe at most 2n possible configurations.
Reachable States
Not every theoretically possible configuration must be reachable in an actual system.
The set of reachable states is a subset of the total state space:
Consequently:
Some configurations may be impossible because of:
Design constraints.
Mutually exclusive conditions.
Hardware restrictions.
Protocol rules.
Invalid combinations of control signals.
For example, although three binary variables yield eight possible combinations, the system may permit only five of them. CTL model checking generally focuses on the states and transitions that are actually represented in the system model.
15. Expressing System Properties in CTL
CTL provides a formal way to specify requirements for embedded and digital systems.
Possibility of Reaching a Started-but-Not-Ready State
Suppose:
startedmeans that the system has started.readymeans that the system is ready for operation.
The property “it is possible to reach a state where the system has started but is not ready” can be expressed as:
Interpretation:
There exists at least one execution path.
At some future state on that path,
startedis true.At that same state,
readyis false.
This can represent situations such as a printer that has been switched on but is not yet ready because initialization or another operation is incomplete.
Every Request Is Eventually Acknowledged
Suppose:
requestmeans that a resource has been requested.acknowledgedmeans that the system has acknowledged the request.
The requirement “whenever a request occurs, it is eventually acknowledged on every possible future execution” can be written as:
Interpretation:
AG requires the condition to hold at every reachable state on every path.
If
requestis true at any state, then:AF(acknowledged) requires every continuation from that state to eventually reach a state where
acknowledgedis true.
This is a universal response or liveness property. It rules out executions in which a request is made but never acknowledged.
Other Common Interpretations
CTL can express requirements involving:
Safety: Something bad never happens.
Liveness: Something good eventually happens.
Possibility: A desired situation can occur on at least one path.
Necessity: A required situation occurs on all paths.
Persistence: A condition remains true indefinitely.
Response: One event eventually follows another.
For example:
AG¬error means that an error state is never reached.
EFsuccess means that success is reachable on at least one path.
AFcompleted means that completion is unavoidable.
EGoperational means that there is an execution that remains operational forever.
16. Role of CTL in Embedded-System Verification
An embedded-system design can be represented by a finite transition model:
States represent configurations of the system.
Transitions represent possible state changes.
Labels represent the propositions true in each state.
System requirements are then written as CTL formulas. Verification checks whether the model satisfies those formulas.
The general process is:
Construct a finite-state model of the embedded system.
Label each state with the atomic propositions that hold there.
Define the possible transitions between states.
Write system requirements as CTL formulas.
Evaluate each formula in the model.
Investigate any state or path that violates a requirement.
Thus, CTL connects informal requirements with formal verification. It allows a designer to ask whether required behaviors occur on all executions, whether permitted behaviors are possible, and whether undesirable states can be reached.

Ask anything
We've read this whole study set, so questions about it get the best answers.