LTL Model Checking
LTL Model Checking
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 /
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 /
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 /
Liveness
Properties
Something desirable will eventually
happen
sooner or later this will happen
Can be refuted by infinite
behaviour
29 /
Liveness
Properties
Something desirable will eventually
happen
sooner or later this will happen
Can be refuted by infinite −p −p −p
−p
behaviour −p
−p −p
−p
29 /
Liveness
Properties
Something desirable will eventually
happen
sooner or later this will happen
Can be refuted by infinite −p −p −p
−p
behaviour −p
−p −p
−p
29 /
Fairness
Properties
Something desirable will happen infinitely often
important subcase of liveness
whenever a subroutine takes control, it will always return it
(sooner or later)
Can be refuted by infinite behaviour
a subroutine takes control and never returns it
p p
p p
p p
p p
32 /
Computation tree vs. computation
paths
Consider the following Kripke
structure:
!done done
32 /
Computation tree vs. computation
paths
Consider the following Kripke
structure:
!done done
.....
!done !done done done
32 /
Computation tree vs. computation
paths
Consider the following Kripke
structure:
!done done
32 / 96
Temporal
Logics
36 /
Linear Temporal Logic (LTL):
Syntax
36 /
Linear Temporal Logic (LTL):
Syntax
36 /
Linear Temporal Logic (LTL):
Syntax
36 /
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 s t '
with t ′ ≥ t “Globally” (or “henceforth”) G: Gϕ is true in st iff ϕ is
true in all s t ' 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 globally
P P
F P G P
next P P until
q
X P P U
q 38 / 96
LTL: Some Noteworthy
Examples
Safety: “it never happens that a train is arriving and the
bar is up”
G(¬ (train_arriving ∧
G(
input → Foutput)
(r
epair_device R
¬working_device)
π, si |= a a ∈ L(si )
iff π, si |= ϕ
π, si |= ¬ϕ π, si |= ϕ and
iff π, si
π, si |= ϕ ∧ ψ
iff for some j ≥ i : π, |=sψj π, si+1
for all j ≥ i : π, sj
π, si |= Xϕ for some j ≥ i : (π, sj |= ϕ
iff for all k s.t. i ≤ k < j : π, sk |= ϕ
π, si |=ϕRψ Fϕ for all j ≥ i : (π, |= ϕ
iff iff sj for some k s.t. i ≤ k < j : π, |= ψ and
π, si |= Gϕ sk |= ϕ)
iff |= ψ
π, si |= ϕUψ or
iff |= ϕ)
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 /
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 /
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 check
LTL model
if π |=checking problem
φ for every M the
path π of φ
|= Kripke structure M (e.g., φ
= Fdone) !done !done
!done !done
.....
!done !done done done
!done done
41 /
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
44 /
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
44 / 96
Example 1: mutual exclusion
(safety)
N = noncritical, T = trying, C = critical N1, N2 User 1 User 2
turn=0
T1, N2 N1, T2
turn=1 turn=2
C1, T2 T1, C2
turn=1 turn=2
M |= G¬ (C1 ∧
C2 ) ?
50 /
Example 1: mutual exclusion
(safety)
N = noncritical, T = trying, C = critical N1, N2 User 1 User 2
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 ) 50 /
Example 2:
liveness
N = noncritical, T = trying, C = critical N1, N2 User 1 User 2
turn=0
T1, N2 N1, T2
turn=1 turn=2
C1, T2 T1, C2
turn=1 turn=2
M |=
FC1 ?
51 /
Example 2:
liveness
N = noncritical, T = trying, C = critical N1, N2 User 1 User 2
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 /
Example 3:
liveness
N = noncritical, T = trying, C = critical N1, N2 User 1 User 2
turn=0
T1, N2 N1, T2
turn=1 turn=2
C1, T2 T1, C2
turn=1 turn=2
M |= G(T1 →
FC1 ) ?
52 /
Example 3:
liveness
N = noncritical, T = trying, C = critical N1, N2 User 1 User 2
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 /
Example 4:
fairness
N = noncritical, T = trying, C = critical N1, N2 User 1 User 2
turn=0
T1, N2 N1, T2
turn=1 turn=2
C1, T2 T1, C2
turn=1 turn=2
M |=
GFC1 ?
53 /
Example 4:
fairness
N = noncritical, T = trying, C = critical N1, N2 User 1 User 2
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 /
Example 5: strong
fairness
N = noncritical, T = trying, C = critical N1, N2 User 1 User 2
turn=0
T1, N2 N1, T2
turn=1 turn=2
C1, T2 T1, C2
turn=1 turn=2
M |= GFT1 →
GFC1 ?
54 /
Example 5: strong
fairness
N = noncritical, T = trying, C = critical N1, N2 User 1 User 2
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 /
Example 6:
blocking
N = noncritical, T = trying, C = critical N1, N2 User 1 User 2
turn=0
T1, N2 N1, T2
turn=1 turn=2
C1, T2 T1, C2
turn=1 turn=2
M |= G(N1 → F
T1 ) ?
55 /
Example 6:
blocking
N = noncritical, T = trying, C = critical N1, N2 User 1 User 2
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 /