LTL Model Checking
LTL Model Checking
28 / 96
Safety Properties
Bad events never happen
deadlock: two processes waiting for input from each other,
the system is unable to perform a transition.
no reachable state satisfies a “bad” condition,
e.g. never two processes in critical section at the same time
Can be refuted by a finite behaviour
Ex.: it is never the case that p.
28 / 96
Safety Properties
Bad events never happen
deadlock: two processes waiting for input from each other,
the system is unable to perform a transition.
no reachable state satisfies a “bad” condition,
e.g. never two processes in critical section at the same time
Can be refuted by a finite behaviour
Ex.: it is never the case that p.
28 / 96
Liveness Properties
29 / 96
Liveness Properties
29 / 96
Liveness Properties
29 / 96
Fairness Properties
30 / 96
Fairness Properties
p p
p p
p p
p p
30 / 96
Computation tree vs. computation paths
!done done
32 / 96
Computation tree vs. computation paths
!done done
32 / 96
Computation tree vs. computation paths
!done done
.....
!done !done done done
32 / 96
Computation tree vs. computation paths
!done done
.....
!done !done done done !done done done
32 / 96
Temporal Logics
33 / 96
Temporal Logics
33 / 96
Temporal Logics
33 / 96
Linear Temporal Logic (LTL): Syntax
36 / 96
Linear Temporal Logic (LTL): Syntax
36 / 96
Linear Temporal Logic (LTL): Syntax
36 / 96
Linear Temporal Logic (LTL): Syntax
36 / 96
LTL semantics: intuitions
LTL is given by the standard boolean logic enhanced with the following temporal operators,
which operate through paths ⟨s0, s1, ..., sk , ...⟩:
“Next” X: Xϕ is true in st iff ϕ is true in st +1
“Finally” (or “eventually”) F: Fϕ is true in st iff ϕ is true in some st' with t ′ ≥ t
“Globally” (or “henceforth”) G: Gϕ is true in st iff ϕ is true in all st' with t ′ ≥ t
“Until” U: ϕUψ is true in st iff, for some state s t ' s.t t ′ ≥ t:
ψ is true in s t ' and
ϕ is true in all states st ' ' s.t. t ≤ t ′ ′ < t ′
“Releases” R: ϕRψ is true in st iff, for all states s t ' s.t. t ′ ≥ t:
ψ is true or
ϕ is true in some states st ' ' with t ≤ t ′ ′ < t ′
“ψ can become false only if ϕ becomes true first"
37 / 96
LTL semantics: intuitions
finally P globally P
FP GP
next P P until q
XP PUq
38 / 96
LTL: Some Noteworthy Examples
Safety: “it never happens that a train is arriving and the bar is up”
G(¬(train_arriving ∧ bar_up))
G(input → Foutput)
Releases: “the device is not working if you don’t first repair it”
(repair_device R ¬working_device)
GFsend → GFrecv
39 / 96
LTL Formal Semantics
π, si |= a iff a ∈ L(si )
π, si |= ¬ϕ iff π, si |= ϕ
π, si |= ϕ ∧ ψ iff π, si |= ϕ and
π, si |= ψ
π, si |= Xϕ iff π, si+1 |= ϕ
π, si |= Fϕ iff for some j ≥ i : π, sj |= ϕ
π, si |= Gϕ iff for all j ≥ i : π, sj |= ϕ
π, si |= ϕUψ iff for some j ≥ i : (π, sj |= ψ and
for all k s.t. i ≤ k < j : π, sk |= ϕ)
π, si |= ϕRψ iff for all j ≥ i : (π, sj |= ψ or
for some k s.t. i ≤ k < j : π, sk |= ϕ)
40 / 96
LTL Formal Semantics (cont.)
LTL properties are evaluated over paths, i.e., over infinite, linear sequences of states:
π = s0 → s1 → · · · → st → st +1 → · · ·
Given an infinite sequence π = s0 , s1 , s2 , . . .
π, si |= φ if φ is true in state si of π.
π |= φ if φ is true in the initial state s0 of π.
The LTL model checking problem M |= φ
check if π |= φ for every path π of the Kripke structure M (e.g., φ = Fdone)
41 / 96
LTL Formal Semantics (cont.)
LTL properties are evaluated over paths, i.e., over infinite, linear sequences of states:
π = s0 → s1 → · · · → st → st +1 → · · ·
Given an infinite sequence π = s0 , s1 , s2 , . . .
π, si |= φ if φ is true in state si of π.
π |= φ if φ is true in the initial state s0 of π.
The LTL model checking problem M |= φ
check if π |= φ for every path π of the Kripke structure M (e.g., φ = Fdone)
41 / 96
LTL Formal Semantics (cont.)
LTL properties are evaluated over paths, i.e., over infinite, linear sequences of states:
π = s0 → s1 → · · · → st → st +1 → · · ·
Given an infinite sequence π = s0 , s1 , s2 , . . .
π, si |= φ if φ is true in state si of π.
π |= φ if φ is true in the initial state s0 of π.
The LTL model checking problem M |= φ
check if π |= φ for every path π of the Kripke structure M (e.g., φ = Fdone)
!done !done !done !done
.....
!done !done done done
!done done
41 / 96
Syntactic properties of LTL operators
ϕ1 ∨ ϕ2 ⇐⇒ ¬(¬ϕ 1 ∧ ¬ϕ 2 )
...
F ϕ1 ⇐⇒ TUϕ 1
G ϕ1 ⇐⇒ ⊥Rϕ1
Fϕ1 ⇐⇒ ¬G¬ϕ 1
Gϕ1 ⇐⇒ ¬F¬ϕ 1
¬Xϕ1 ⇐⇒ X¬ϕ1
ϕ1Rϕ2 ⇐⇒ ¬(¬ϕ 1 U¬ϕ 2 )
ϕ1Uϕ2 ⇐⇒ ¬(¬ϕ 1 R¬ϕ 2 )
Note
LTL can be defined in terms of ∧, ¬, X, U only
Exercise
Prove that ϕ1Rϕ2 ⇐⇒ Gϕ2 ∨ ϕ2U(ϕ1 ∧ ϕ2)
44 / 96
Syntactic properties of LTL operators
ϕ1 ∨ ϕ2 ⇐⇒ ¬(¬ϕ 1 ∧ ¬ϕ 2 )
...
F ϕ1 ⇐⇒ TUϕ 1
G ϕ1 ⇐⇒ ⊥Rϕ1
Fϕ1 ⇐⇒ ¬G¬ϕ 1
Gϕ1 ⇐⇒ ¬F¬ϕ 1
¬Xϕ1 ⇐⇒ X¬ϕ1
ϕ1Rϕ2 ⇐⇒ ¬(¬ϕ 1 U¬ϕ 2 )
ϕ1Uϕ2 ⇐⇒ ¬(¬ϕ 1 R¬ϕ 2 )
Note
LTL can be defined in terms of ∧, ¬, X, U only
Exercise
Prove that ϕ1Rϕ2 ⇐⇒ Gϕ2 ∨ ϕ2U(ϕ1 ∧ ϕ2)
44 / 96
Example 1: mutual exclusion (safety)
turn=0
T1, N2 N1, T2
turn=1 turn=2
C1, T2 T1, C2
turn=1 turn=2
M |= G¬(C1 ∧ C2 ) ?
50 / 96
Example 1: mutual exclusion (safety)
turn=0
T1, N2 N1, T2
turn=1 turn=2
C1, T2 T1, C2
turn=1 turn=2
M |= G¬(C1 ∧ C2 ) ?
YES: There is no reachable state in which (C1 ∧ C2) holds!
50 / 96
Example 2: liveness
turn=0
T1, N2 N1, T2
turn=1 turn=2
C1, T2 T1, C2
turn=1 turn=2
M |= FC1 ?
51 / 96
Example 2: liveness
turn=0
T1, N2 N1, T2
turn=1 turn=2
C1, T2 T1, C2
turn=1 turn=2
M |= FC1 ?
NO: there is an infinite cyclic solution in which C1 never holds!
51 / 96
Example 3: liveness
turn=0
T1, N2 N1, T2
turn=1 turn=2
C1, T2 T1, C2
turn=1 turn=2
M |= G(T1 → FC1 ) ?
52 / 96
Example 3: liveness
turn=0
T1, N2 N1, T2
turn=1 turn=2
C1, T2 T1, C2
turn=1 turn=2
M |= G(T1 → FC1 ) ?
YES: every path starting from each state where T1 holds passes through a state where C1 holds.
52 / 96
Example 4: fairness
turn=0
T1, N2 N1, T2
turn=1 turn=2
C1, T2 T1, C2
turn=1 turn=2
M |= GFC1 ?
53 / 96
Example 4: fairness
turn=0
T1, N2 N1, T2
turn=1 turn=2
C1, T2 T1, C2
turn=1 turn=2
M |= GFC1 ?
NO: e.g., in the initial state, there is an infinite cyclic solution in which C1 never holds!
53 / 96
Example 5: strong fairness
turn=0
T1, N2 N1, T2
turn=1 turn=2
C1, T2 T1, C2
turn=1 turn=2
M |= GFT1 → GFC1 ?
54 / 96
Example 5: strong fairness
turn=0
T1, N2 N1, T2
turn=1 turn=2
C1, T2 T1, C2
turn=1 turn=2
M |= GFT1 → GFC1 ?
YES: every path which visits T1 infinitely often also visits C1 infinitely often
(see liveness property of previous example).
54 / 96
Example 6: blocking
turn=0
T1, N2 N1, T2
turn=1 turn=2
C1, T2 T1, C2
turn=1 turn=2
M |= G(N1 → F T1 ) ?
55 / 96
Example 6: blocking
turn=0
T1, N2 N1, T2
turn=1 turn=2
C1, T2 T1, C2
turn=1 turn=2
M |= G(N1 → F T1 ) ?
NO: e.g., in the initial state, there is an infinite cyclic solution in which N1 holds and T1 never
holds!
55 / 96