Formal Methods:
Module I: Automated Reasoning
Ch. 05: Automata-Theoretic LTL Reasoning
Roberto Sebastiani and Stefano Tonetta
DISI, Università di Trento, Italy – roberto.sebastiani@unitn.it URL: http://disi.unitn.it/rseba/DIDATTICA/fm2021/
Teaching assistant:Giuseppe Spallitta– giuseppe.spallitta@unitn.it
M.S. in Computer Science, Mathematics, & Artificial Intelligence Systems Academic year 2020-2021
last update: Tuesday 20thApril, 2021, 12:49
Copyright notice: some material (text, figures) displayed in these slides is courtesy of R. Alur, M. Benerecetti, A. Cimatti, M. Di Natale, P. Pandya, M. Pistore, M. Roveri, C. Tinelli, and S.Tonetta, who detain its copyright. Some exampes displayed in these slides are taken from [Clarke, Grunberg & Peled, “Model Checking”, MIT Press], and their copyright is
detained by the authors. All the other material is copyrighted by Roberto Sebastiani. Every commercial use of this material is strictly forbidden by the copyright laws without the authorization of the authors. No copy of these slides can be
displayed in public without containing this copyright notice.
1 / 69
Outline
1
Büchi Automata
2
The Automata-Theoretic Approach to LTL Reasoning General Ideas
Language-Emptiness Checking of Büchi Automata From Kripke Models to Büchi Automata
From LTL Formulas to Büchi Automata Complexity
3
Exercises
Outline
1
Büchi Automata
2
The Automata-Theoretic Approach to LTL Reasoning General Ideas
Language-Emptiness Checking of Büchi Automata From Kripke Models to Büchi Automata
From LTL Formulas to Büchi Automata Complexity
3
Exercises
3 / 69
Infinite Word Languages
Modeling infinite computations of reactive systems Given an Alphabet Σ (e.g. Σ
def= {a, b})
An ω-word α over Σ is an infinite sequence a
0, a
1, a
2. . ..
Formally, α : N → Σ.
The set of all infinite words is denoted by Σ
ω.
A ω-language L is collection of ω-words, i.e. L ⊆ Σ
ω. Example: All words over {a, b} with infinitely many a’s.
Notation:
omega words α, β, γ ∈ Σ
ω.
omega-languages L, L
1⊆ Σ
ωFor u ∈ Σ
+, let u
ω= u.u.u . . .
Omega-Automata
We consider automaton running over infinite words.
Let α = aabbbb . . ..
There are several (infinite) possible runs.
Run ρ
1= s
1, s
1, s
1, s
1, s
2, s
2. . . Run ρ
2= s
1, s
1, s
1, s
1, s
1, s
1. . .
Acceptance Conditions: Büchi (Muller, Rabin, Street):
Acceptance is based on states occurring infinitely often Notation Let ρ ∈ Q
ω. Then,
Inf (ρ) = {s ∈ Q | ∃
∞i ∈ N. ρ(i) = s}.
(The set of states occurring infinitely many times in ρ.)
5 / 69
Büchi Automata
Nondeterministic Büchi Automaton
A Nondeterministic Büchi Automaton (NBA) is (Q, Σ, δ, I, F ) s.t.
Q Finite set of states.
Σis a finite alphabet I ⊆ Q set of initial states.
F ⊆ Q set of accepting states.
δ ⊆Q × Σ × Q transition relation (edges).
A Deterministic Büchi Automaton (DBA) is an NBA s.t. the transition relation is functional: δ : Q × Σ 7−→ Q
Runs and Language of NBAs
A run ρ of A on ω-word α = a
0, a
1, a
2, ... is an infinite sequence ρ = q
o, q
1, q
2, . . . s.t. q
0∈ I and q
i−→ q
ai i+1for 0 ≤ i.
The run ρ is accepting if Inf (ρ) ∩ F 6= ∅.
The language accepted by A
L(A) = {α ∈ Σ
ω| A has an accepting run on α}
Büchi Automaton: Example
Let Σ = {a, b}.
Let a Deterministic Büchi Automaton (DBA) A
1be
With F = {s
1} the automaton recognizes words with infinitely many a’s.
With F = {s
2} the automaton recognizes words with infinitely many b’s.
7 / 69
Büchi Automaton: Example (2)
Let a Nondeterministic Büchi Automaton (NBA) A
2be
With F = {s
2}, the automaton A
2recognizes words with finitely
many a. Thus, L(A
2) = L(A
1).
Deterministic vs. Nondeterministic Büchi Automata
Theorem
DBAs are strictly less powerful than NBAs.
The subset construction does not work!
Let DA
2be
DA
2is not equivalent to A
2(e.g., it recognizes (b.a)
ω)
There is no DBA equivalent to A
29 / 69
Closure Properties
Theorem (union, intersection)
For the NBAs A
1, A
2we can construct
the NBA A s.t. L(A) = L(A
1) ∪ L(A
2). |A| = |A
1| + |A
2|
the NBA A s.t. L(A) = L(A
1) ∩ L(A
2). |A| ≤ |A
1| · |A
2| · 2.
Union of two NBAs
Definition: union of NBAs
Let A
1= (Q
1, Σ
1, δ
1, I
1, F
1), A
2= (Q
2, Σ
2, δ
2, I
2, F
2).
Then A = A
1∪ A
2= (Q, Σ, δ, I, F ) is defined as follows Q := Q
1∪ Q
2, I := I
1∪ I
2, F := F
1∪ F
2R(s, s
0) :=
R
1(s, s
0) if s ∈ Q
1R
2(s, s
0) if s ∈ Q
2Theorem
L(A) = L(A
1) ∪ L(A
2)
|A |= |A
1| + |A
2|
Note
A is an automaton which just runs nondeterministically either A
1or A
2(same construction as with ordinary automata)
11 / 69
Synchronous Product of NBAs
Definition: synchronous product of NBAs
Let A
1= (Q
1, Σ, δ
1, I
1, F
1) and A
2= (Q
2, Σ, δ
2, I
2, F
2).
Then, A
1× A
2= (Q, Σ, δ, I, F ), where Q = Q
1× Q
2× {1, 2}.
I = I
1× I
2× {1}.
F = F
1× Q
2× {1}.
hp, q, 1i −→ hp
a 0, q
0, 1i iff p −→ p
a 0and q −→ q
a 0and p 6∈ F
1. hp, q, 1i −→ hp
a 0, q
0, 2i iff p −→ p
a 0and q −→ q
a 0and p ∈ F
1. hp, q, 2i −→ hp
a 0, q
0, 2i iff p −→ p
a 0and q −→ q
a 0and q 6∈ F
2. hp, q, 2i −→ hp
a 0, q
0, 1i iff p −→ p
a 0and q −→ q
a 0and q ∈ F
2.
Theorem
L(A
1× A
2) = L(A
1) ∩ L(A
2).
|A
1× A
2| ≤ 2 · |A
1| · |A
2|.
Synchronous Product of NBAs: Intuition
The automaton remembers two tracks, one for each source NBA, and it points to one of the two tracks
As soon as it goes through an accepting state of the current track, it switches to the other track
=⇒ in order to visit infinitely often a state in F (i.e., F
1), it must visit infinitely often some state also in F
2Important subcase: If F
2= Q
2, then Q = Q
1× Q
2.
I = I
1× I
2. F = F
1× Q
2.
13 / 69
Synchronous Product of NBAs: Example
Closure Properties (2)
Theorem (complementation) [Safra, MacNaughten]
For the NBA A
1we can construct an NBA A
2such that L(A
2) = L(A
1).
|A
2| = O(2
|A1|·log(|A1|)).
Method: (hint)
(i) convert a Büchi automaton into a Non-Deterministic Rabin automaton
(ii) determinize and Complement the Rabin automaton (iii) convert the Rabin automaton into a Büchi automaton.
15 / 69
Generalized Büchi Automaton
Definition
A Generalized Büchi Automaton is a tuple A := (Q, Σ, δ, I, FT ) where FT = hF
1, F
2, . . . , F
ki with F
i⊆ Q.
A run ρ of A is accepting if Inf (ρ) ∩ F
i6= ∅ for each 1 ≤ i ≤ k .
Theorem
For every Generalized Büchi Automaton we can construct a language equivalent plain Büchi Automaton.
Intuition
Let Q
0= Q × {1, . . . , K }.
The automaton remains in phase i till it visits a state in F
i. Then, it
moves to (i mod K ) + 1 mode.
De-generalization of a generalized NBA
Definition: De-generalization of a generalized NBA
Let A
def= (Q, Σ, δ, I, FT ) a generalized BA s.f. FT
def= {F
1, ..., F
K}.
Then a language-equivalent BA A
0def= (Q
0, Σ, δ
0, I
0, F
0) is built as follows
Q
0= Q
1× {1, ..., K }.
I
0= I × {1}.
F
0= F
1× {1}.
δ
0is s.t., for every i ∈ [1, ..., K ]:
hp, ii −→ hq, ii
aiff p −→ q ∈ δ and p 6∈ F
a i. hp, ii −→ hq, (i mod K ) + 1i iff p
a−→ q ∈ δ and p ∈ F
a i.
Theorem
L(A
0) = L(A).
|A
0| ≤ K · |A|.
17 / 69
Degeneralizing a Büchi automaton: Example
Omega-regular Expressions
Definition
A language is called ω-regular if it has the form ∪
ni=1U
i.(V
i)
ωwhere U
i, V
iare regular languages.
Theorem
A language L is ω-regular iff it is NBA-recognizable.
19 / 69
Outline
1
Büchi Automata
2
The Automata-Theoretic Approach to LTL Reasoning General Ideas
Language-Emptiness Checking of Büchi Automata From Kripke Models to Büchi Automata
From LTL Formulas to Büchi Automata Complexity
3
Exercises
Outline
1
Büchi Automata
2
The Automata-Theoretic Approach to LTL Reasoning General Ideas
Language-Emptiness Checking of Büchi Automata From Kripke Models to Büchi Automata
From LTL Formulas to Büchi Automata Complexity
3
Exercises
21 / 69
Automata-Theoretic LTL Satisfiability and Entailment
LTL Validity/Satisfiability Let ψ be an LTL formula
|= ψ (LTL)
⇐⇒ ¬ψ unsat
⇐⇒ L(A¬ψ) = ∅
A
¬ψis a Büchi Automaton which represents all and only the paths that satisfy ¬ψ (do not satisfy ψ)
LTL Entailment
Let ϕ, ψ be an LTL formula
ϕ |= ψ (LTL)|= ϕ → ψ (LTL)
⇐⇒ ϕ ∧ ¬ψunsat
⇐⇒ L(Aϕ∧¬ψ) = ∅
A
ϕ∧¬ψis a Büchi Automaton which represents all and only the
paths that satisfy ϕ ∧ ¬ψ (satisfy ϕ and do not satisfy ψ)
Automata-Theoretic LTL Model Checking
LTL Model Checking
Let M be a Kripke model and ψ be an LTL formula
M |= ψ (LTL)⇐⇒ L(M) ⊆ L(ψ)
⇐⇒ L(M) ∩ L(ψ) = ∅
⇐⇒ L(M) ∩ L(¬ψ) = ∅
⇐⇒ L(AM) ∩ L(A¬ψ) = ∅
⇐⇒ L(AM× A¬ψ) = ∅
A
Mis a Büchi Automaton equivalent to M (which represents all and only the executions of M)
A
¬ψis a Büchi Automaton which represents all and only the paths that satisfy ¬ψ (do not satisfy ψ)
=⇒ A
M× A
¬ψrepresents all and only the paths appearing in M and not in ψ.
23 / 69
Automata-Theoretic LTL Model Checking
Four steps Let ϕ
def= ¬ψ:
(i) Compute A
M(ii) Compute A
ϕ(iii) Compute the product A
M× A
ϕ(iv) Check the emptiness of L(A
M× A
ϕ)
Outline
1
Büchi Automata
2
The Automata-Theoretic Approach to LTL Reasoning General Ideas
Language-Emptiness Checking of Büchi Automata From Kripke Models to Büchi Automata
From LTL Formulas to Büchi Automata Complexity
3
Exercises
25 / 69
NBA emptiness checking
Find an accepting cycle reachable from an initial state.
A naive algorithm:
(i) a DFS finds the final states f reachable from an initial state;
(ii) for each f , a second DFS finds if it can reach f (i.e., if there exists a loop)
Complexity: O(n
2) SCC-based algorithm:
(i) Tarjan’s algorithm uses a DFS to find the SCCs in linear time;
(ii) drop all SCCs which do not have at least one arc, and which do not contain at least one accepting state f
(iii) another DFS finds if the union of non-trivial SCCs is reachable from an initial state.
Complexity: O(n)
Drawbacks: it stores too much information and does not find
directly a counterexample.
Double Nested DFS algorithm
Double Nested DFS Two nested DFSs
DFS1finds the final states f reachable from an initial state for each f, DFS2 finds if it can reach f (i.e., if there exists a loop)
Two Hash tables:
T1: reachable states
T2: states reachable from a reachable final state
Two stacks:
S1: current branch of states reachable
S2: current branch of states reachable from final state f
It stops as soon as it finds a counterexample.
The counterexample is given by
the stack of DFS2 (an accepting, preceded by cycle) the stack of DFS1 (a path from an initial state to the cycle)
DFS1 invokes DFS2 on each f
ionly after popping it (postorder) T2 passed by reference, is not reset at each call of DFS2 !
27 / 69
Double Nested DFS - First DFS
// returns True if empty language, false otherwise Bool DFS1(NBA A) {
stack S1=I; stack S2=∅;
Hashtable T1=I; Hashtable T2=∅;
while S1!=∅ { v=top(S1);
if ∃w s.t. w∈ δ(v) && T1(w)==0 { hash(w,T1);
push(w,S1);
} else { pop(S1);
if (v∈F && !DFS2(v,S2,T2,A)) return False;
} }
return True;
}
Double Nested DFS - Second DFS
Bool DFS2(state f, stack & S, Hashtable & T, NBA A) { hash(f,T);
S = {f}
while S!=∅ { v=top(S);
if f∈ δ(v) return False;
if ∃w s.t. w∈ δ(v) && T(w)==0 { hash(w);
push(w);
} else pop(S);
}
return True;
}
Remark: T passed by reference, is not reset at each call of DFS2 !
29 / 69
Double nested DFS: intuition
DFS1 invokes DFS2 on each f
1, ..., f
nonly after popping it (postorder):
suppose DFS2 is invoked on f
jbefore than on f
i=⇒ f
inot reachable from (any state s which is reachable from) f
jIf during DFS2(f
i, ...) it is encountered a state S which has already been explored by DFS2(f
j, ...) for some f
j,
can we reach fi from S?
No, because fi is not reachable from fj!
=⇒ it is safe to backtrack.
Double nested DFS: intuition
DFS1 invokes DFS2 on each f
1, ..., f
nonly after popping it (postorder):
suppose DFS2 is invoked on f
jbefore than on f
i=⇒ f
inot reachable from (any state s which is reachable from) f
jIf during DFS2(f
i, ...) it is encountered a state S which has already been explored by DFS2(f
j, ...) for some f
j,
can we reach fi from S?
No, because fi is not reachable from fj!
=⇒ it is safe to backtrack. f
jf
iS
30 / 69
Double nested DFS: intuition
DFS1 invokes DFS2 on each f
1, ..., f
nonly after popping it (postorder):
suppose DFS2 is invoked on f
jbefore than on f
i=⇒ f
inot reachable from (any state s which is reachable from) f
jIf during DFS2(f
i, ...) it is encountered a state S which has already been explored by DFS2(f
j, ...) for some f
j,
can we reach fi from S?
No, because fi is not reachable from fj!
=⇒ it is safe to backtrack. f
jf
iS
Double nested DFS: intuition
DFS1 invokes DFS2 on each f
1, ..., f
nonly after popping it (postorder):
suppose DFS2 is invoked on f
jbefore than on f
i=⇒ f
inot reachable from (any state s which is reachable from) f
jIf during DFS2(f
i, ...) it is encountered a state S which has already been explored by DFS2(f
j, ...) for some f
j,
can we reach fi from S?
No, because fi is not reachable from fj!
=⇒ it is safe to backtrack. f
jf
iS
30 / 69
Double nested DFS: intuition
DFS1 invokes DFS2 on each f
1, ..., f
nonly after popping it (postorder):
suppose DFS2 is invoked on f
jbefore than on f
i=⇒ f
inot reachable from (any state s which is reachable from) f
jIf during DFS2(f
i, ...) it is encountered a state S which has already been explored by DFS2(f
j, ...) for some f
j,
can we reach fi from S?
No, because fi is not reachable from fj!
=⇒ it is safe to backtrack. f
jf
iS
???
Double nested DFS: intuition
DFS1 invokes DFS2 on each f
1, ..., f
nonly after popping it (postorder):
suppose DFS2 is invoked on f
jbefore than on f
i=⇒ f
inot reachable from (any state s which is reachable from) f
jIf during DFS2(f
i, ...) it is encountered a state S which has already been explored by DFS2(f
j, ...) for some f
j,
can we reach fi from S?
No, because fi is not reachable from fj!
=⇒ it is safe to backtrack. f
jf
iS
30 / 69
Double nested DFS: intuition
DFS1 invokes DFS2 on each f
1, ..., f
nonly after popping it (postorder):
suppose DFS2 is invoked on f
jbefore than on f
i=⇒ f
inot reachable from (any state s which is reachable from) f
jIf during DFS2(f
i, ...) it is encountered a state S which has already been explored by DFS2(f
j, ...) for some f
j,
can we reach fi from S?
No, because fi is not reachable from fj!
=⇒ it is safe to backtrack. f
jf
iS
Double Nested DFS: example
T1
S2 S1
3
4 2
1 6
5 T2
31 / 69
Double Nested DFS: example
1
0 1
1 T1
S2 S1
3
4 2
1 6
5
T2
Double Nested DFS: example
2
0 1
2 1
0 1
1 T1
S2 S1
3
4 2
1 6
5 T2
31 / 69
Double Nested DFS: example
3
00 11
3 2
0 1
2 1
0 1
1 T1
S2 S1
3
4 2
1 6
5
T2
Double Nested DFS: example
4
0 1
4 3
00 11
3 2
0 1
2 1
0 1
1 T1
S2 S1
3
4 2
1 6
5 T2
31 / 69
Double Nested DFS: example
0 1
4 3
00 11
3 2
0 1
2 1
0 1
1 T1
S2 S1
3
4 2
1 6
5
T2
Double Nested DFS: example
0 1
4
00 11
3 2
0 1
2 1
0 1
1 T1
S2 S1
3
4 2
1 6
5 T2
31 / 69
Double Nested DFS: example
3
0 1
3
0 1
4
00 11
3 2
0 1
2 1
0 1
1 T1
S2 S1
3
4 2
1 6
5
T2
Double Nested DFS: example
4
0 1
4 3
0 1
3
0 1
4
00 11
3 2
0 1
2 1
0 1
1 T1
S2 S1
3
4 2
1 6
5 T2
31 / 69
Double Nested DFS: example
0 1
4 3
0 1
3
0 1
4
00 11
3 2
0 1
2 1
0 1
1 T1
S2 S1
3
4 2
1 6
5
T2
Double Nested DFS: example
0 1
4
0 1
3
0 1
4
00 11
3 2
0 1
2 1
0 1
1 T1
S2 S1
3
4 2
1 6
5 T2
31 / 69
Double Nested DFS: example
0 1
4
0 1
3
0 1
4
00 11
3
0 1
2 1
0 1
1 T1
S2 S1
3
4 2
1 6
5
T2
Double Nested DFS: example
5
00 11
5
0 1
4
0 1
3
0 1
4
00 11
3
0 1
2 1
0 1
1 T1
S2 S1
3
4 2
1 6
5 T2
31 / 69
Double Nested DFS: example
6
00 11
6 5
00 11
5
0 1
4
0 1
3
0 1
4
00 11
3
0 1
2 1
0 1
1 T1
S2 S1
3
4 2
1 6
5
T2
Double Nested DFS: example
00 11
6 5
00 11
5
0 1
4
0 1
3
0 1
4
00 11
3
0 1
2 1
0 1
1 T1
S2 S1
3
4 2
1 6
5 T2
31 / 69
Double Nested DFS: example
00 11
6
00 11
5
0 1
4
0 1
3
0 1
4
00 11
3
0 1
2 1
0 1
1 T1
S2 S1
3
4 2
1 6
5
T2
Double Nested DFS: example
5
0 1
5
00 11
6
00 11
5
0 1
4
0 1
3
0 1
4
00 11
3
0 1
2 1
0 1
1 T1
S2 S1
3
4 2
1 6
5 T2
31 / 69
Double Nested DFS: example
2
0 1
2 5
0 1
5
00 11
6
00 11
5
0 1
4
0 1
3
0 1
4
00 11
3
0 1
2 1
0 1
1 T1
S2 S1
3
4 2
1 6
5
T2
Double Nested DFS: example
0 1
2 5
0 1
5
00 11
6
00 11
5
0 1
4
0 1
3
0 1
4
00 11
3
0 1
2 1
0 1
1 T1
S2 S1
3
4 2
1 6
5 T2
31 / 69
Double Nested DFS: example
6
0 1
6
0 1
2 5
0 1
5
00 11
6
00 11
5
0 1
4
0 1
3
0 1
4
00 11
3
0 1
2 1
0 1
1 T1
S2 S1
3
4 2
1 6
5
T2
Double Nested DFS: example
1
0 1
1 6
0 1
6
0 1
2 5
0 1
5
00 11
6
00 11
5
0 1
4
0 1
3
0 1
4
00 11
3
0 1
2 1
0 1
1 T1
S2 S1
3
4 2
1 6
5 T2
31 / 69
Outline
1
Büchi Automata
2
The Automata-Theoretic Approach to LTL Reasoning General Ideas
Language-Emptiness Checking of Büchi Automata From Kripke Models to Büchi Automata
From LTL Formulas to Büchi Automata Complexity
3
Exercises
Computing an NBA A
Mfrom a Kripke Structure M
Transform a Kripke model M = hS, S
0, R, L, APi into an NBA A
M= hQ, Σ, δ, I, F i s.t.:
States:Q := S ∪ {init}, init being a new initial state Alphabet:Σ :=2AP
Initial State:I := {init}
Accepting States:F := Q = S ∪ {init}
Transitions:
δ : q−→ qa 0iff (q, q0) ∈R and L(q0) =a init−→ q iff q ∈ Sa 0and L(q) = a
L(A
M) = L(M)
|A
M| = |M| + 1
33 / 69
Computing a NBA A
Mfrom a Kripke Structure M:
Example
{p,q}
{p,q}
{p,q}
Kripke Structure Buechi Automaton
{p,q} {p}
{q}
{p,−q}
{p,−q}
{−p,q}
=⇒ Substantially, add one initial state, move labels from states to
incoming edges, set all states as accepting states
Labels on Kripke Structures and BA’s - Remark
Note that the labels of a Büchi Automaton are different from the labels of a Kripke Structure. Also graphically, they are interpreted differently:
p
in a Kripke Structure, it means that p is true and all other propositions are false;
in a Büchi Automaton, it means that p is true and all other propositions are irrelevant (“don’t care”), i.e. they can be either true or false.
35 / 69
Outline
1
Büchi Automata
2
The Automata-Theoretic Approach to LTL Reasoning General Ideas
Language-Emptiness Checking of Büchi Automata From Kripke Models to Büchi Automata
From LTL Formulas to Büchi Automata Complexity
3
Exercises
Translation problem
Problem
Given an LTL formula φ, find a Büchi Automaton that accepts the same language of φ.
It is a fundamental problem in LTL model checking (in other words, every model checking algorithm that verifies the correctness of an LTL formula translates it in some sort of finite-state machine).
We will translate an LTL formula into a Generalized Büchi Automata (GBA).
37 / 69
LTL Negative Normal Form (NNF)
Every LTL formula ϕ can be written into an equivalent formula ϕ
0using only the operators ∧, ∨, X, U, R on propositional literals.
Done by pushing negations down to literal level:
¬(ϕ
1∨ ϕ
2) =⇒ (¬ϕ
1∧ ¬ϕ
2)
¬(ϕ
1∧ ϕ
2) =⇒ (¬ϕ
1∨ ¬ϕ
2)
¬Xϕ
1=⇒ X¬ϕ
1¬(ϕ
1Uϕ
2) =⇒ (¬ϕ
1R¬ϕ
2)
¬(φ
1Rφ
2) =⇒ (¬φ
1U¬φ
2)
=⇒ the resulting formula is expressed in terms of ∨, ∧, X , U, R and literals (Negative Normal Form, NNF).
encoding linear if a DAG representation is used
In the construction of A
ϕwe now assume that ϕ is in NNF.
For convenience, we still use F’s and G’s as shortcuts:
Fϕ for >Uϕ and Gϕ for ⊥Rϕ
On-the-fly Construction of A
ϕ(Intuition)
Apply recursively the following steps:
Step 1: Apply the tableau expansion rules to ϕ
ψ
1Uψ
2=⇒ ψ
2∨ (ψ
1∧ X(ψ
1Uψ
2)) [and Fψ =⇒ ψ ∨ XFψ]
ψ
1Rψ
2=⇒ ψ
2∧ (ψ
1∨ X(ψ
1Rψ
2)) [and Gψ =⇒ ψ ∧ XGψ]
until we get a Boolean combination of elementary subformulas of ϕ (An elementary formula is a proposition or a X-formula.)
39 / 69
Tableaux Rules: a Quote
“After all... tomorrow is another day."
[Scarlett O’Hara, “Gone with the Wind”]
On-the-fly Construction of A
ϕ(Intuition) [cont.]
Step 2: Convert all formulas into Disjunctive Normal Form, and then push the conjunctions inside the next:
ϕ =⇒ _
i
( ^
j
l
ij∧ ^
k
Xψ
ik) =⇒ _
i
( ^
j
l
ij∧ X ^
k
ψ
ik).
Each disjunct (
labels
z }| {
^
j
l
ij∧
next part
z }| {
X ^
k
ψ
ik) represents a state:
the conjunction of literalsV
jlij representsa set of labels in Σ (e.g., if Vars(ϕ) = {p, q, r }, p ∧ ¬q represents the two labels {p, ¬q, r } and {p, ¬q, ¬r } )
XV
kψikrepresents thenext partof the state (obbligations for the successors)
N.B., if no next part occurs, X> is implicitly assumed
41 / 69
On-the-fly Construction of A
ϕ(Intuition) [cont.]
Step 3: For every state S
irepresented by ( V
j
l
ij∧ X
ϕi
z }| {
^
k
ψ
ik) label the incoming edges of S
iwith V
j
l
ijmark that the state S
isatisfies ϕ
apply recursively steps 1-2-3 to ϕ
i def= V
k
ψ
ik,
rewrite ϕi intoWi0(V
jli00j∧ XV
kψi00k) from each disjunct(V
jli00j ∧ XV
kψi00k)generate a new state Sii0 (if not already present) and label it as satisfying ϕi def=V
kψik
draw an edge from S
ito all states S
ii0which satisfy V
k
ψ
ik(if no next part occurs, X> is implicitly assumed, so that an edge
to a “true” node is drawn)
On-the-fly Construction of A
ϕ(Intuition) [cont.]
ϕ??
43 / 69
On-the-fly Construction of A
ϕ(Intuition) [cont.]
W
i(V
jlij∧ XV
kψik)!
On-the-fly Construction of A
ϕ(Intuition) [cont.]
(V
jl1j∧ XV
kψ1k)
(V
jl2j∧ XV
kψ2k)
(V
jlij∧ XV
kψik)
...
W
i(V
jlij∧ XV
kψik)!
43 / 69
On-the-fly Construction of A
ϕ(Intuition) [cont.]
V
jl1j [V
kψ1k]
[V
kψ2k] V
jl2j
[V
kψik] V
jlij
(V
jl1j∧ XV
kψ1k)
(V
jl2j∧ XV
kψ2k)
(V
jlij∧ XV
kψik)
...
W
i(V
jlij∧ XV
kψik)!
On-the-fly Construction of A
ϕ(Intuition) [cont.]
...
V
kψik ?
43 / 69
On-the-fly Construction of A
ϕ(Intuition) [cont.]
...
W
i(V
jlij∧ XV
kψik)!
V
jl100j
V
jl200j
V
jli00j [V
kψ0ik] [V
kψ02k] [V
kψ01k] W
i0 (V
jli00j∧ XV
kψ0i0k)
....
On-the-fly Construction of A
ϕ(Intuition) [cont.]
V
jl1j
V
jl2j
V
jlij
...
W
i(V
jlij∧ XV
kψik)!
V
jl100j
V
jl200j
V
jli00j [V
kψ0ik] [V
kψ02k] [V
kψ01k]
....
43 / 69
On-the-fly Construction of A
ϕ(Intuition) [cont.]
When the recursive applications of steps 1-3 has terminated and the automata graph has been built, then apply the following:
Step 4: For every ψ
iUϕ
i, for every state q
j, mark q
jwith F
iiff (ψ
iUϕ
i) / ∈ q
jor ϕ
i∈ q
j(If there is no U-subformulas, then mark all states with F
1—i.e., FT
def= {Q}).
Remark
The fact that we initially converted the formula into NNF guarantees
that only positive U/F-subformulas and negative R-/G-subformulas
are considered here
Dealing with U-subformulas: Intuition
Tableaux rules: ϕ
1Uϕ
2⇐⇒ (ϕ
2∨ (ϕ
1∧ Xϕ
1Uϕ
2)) are a property, not a definition of U:
=⇒ they implicitly admit a “weaker” semantics of ϕ
1Uϕ
2, in which ϕ
1Uϕ
2always holds and ϕ
2never holds
It cannot happen that we get into a state s
0from which we can enter a path π
0in which ϕ
1Uϕ
2holds forever and ϕ
2never holds.
ϕ1Uϕ2 ϕ1Uϕ2
−ϕ2
ϕ1Uϕ2 ϕ1Uϕ2
−ϕ2 . . . .
−ϕ2 −ϕ2
=⇒ every legal path must touch infinitely often a state where
¬(ϕ
1Uϕ
2) ∨ ϕ
2) holds
In LTL: GF(¬(ϕ
1Uϕ
2) ∨ ϕ
2) (“avoid bad loop”)
45 / 69
On-the-fly Construction of A
φ- State
Henceforth, a state is represented by a tuple s := hλ, χ, σi where:
λis the set of labels
χis the next part, i.e. the set of X -formulas satisfied by s σis the set of the subformulas of φ satisfied by s (necessary for the fairness definition)
Given a set of LTL formulas Ψ
def= {ψ
1, ..., ψ
k}, we define
Cover (Ψ)
def= Expand (Ψ, h∅, ∅, ∅i) to be the set of initial states of the Buchi automaton representing V
j
ψ
j.
Combines steps 1. and 2. of previous slides Expand() defined recursively as followsOn-the-fly Construction of A
φ- Expand
Given a set of formulas Φ to expand and a state s, we define the set of states Expand (Φ, s) recursively as follows:
if Φ = ∅, Expand (Φ, s) = {s}
if ⊥ ∈ Φ, Expand (Φ, s) = ∅ if > ∈ Φ and s = hλ, χ, σi,
Expand (Φ, s) = Expand (Φ\{>}, hλ, χ, σ ∪ {>}i) if l ∈ Φ and s = hλ, χ, σi, l propositional literal Expand (Φ, s) = Expand (Φ\{l}, hλ ∪ {l}, χ, σ ∪ {l}i) (add l to the labels of s and to set of satisfied formulas) if Xψ ∈ Φ and s = hλ, χ, σi,
Expand (Φ, s) = Expand (Φ\{X ψ}, hλ, χ ∪ {ψ}, σ ∪ {Xψ}i) (add ψ to the next part of s and Xψ to set of satisfied formulas) if ψ
1∧ ψ
2∈ Φ and s = hλ, χ, σi,
Expand (Φ, s) =
Expand (Φ ∪ {ψ
1, ψ
2}\{ψ
1∧ ψ
2}, hλ, χ, σ ∪ {ψ
1∧ ψ
2}i) (process both ψ
1and ψ
2and add ψ
1∧ ψ
2to σ)
...
47 / 69
On-the-fly Construction of A
φ- Expand
if ψ
1∨ ψ
2∈ Φ and s = hλ, χ, σi,
Expand (Φ, s) =Expand (Φ ∪ {ψ
1}\{ψ
1∨ ψ
2}, hλ, χ, σ ∪ {ψ
1∨ ψ
2}i)
∪Expand (Φ ∪ {ψ
2}\{ψ
1∨ ψ
2}, hλ, χ, σ ∪ {ψ
1∨ ψ
2}i) (split s in two copies, process ψ
2on the first, ψ
1on the second, add ψ
1∨ ψ
2to σ)
if ψ
1Uψ
2∈ Φ and s = hλ, χ, σi,
Expand (Φ, s) =Expand (Φ ∪ {ψ1}\{ψ1Uψ2}, hλ, χ ∪ {ψ1Uψ2}, σ ∪ {ψ1Uψ2}i)
∪Expand (Φ ∪ {ψ2}\{ψ1Uψ2}, hλ, χ, σ ∪ {ψ1Uψ2}i)
(split s in two copies and process ψ
1on the first, ψ
2on the second, add ψ
1Uψ
2to σ)
if ψ
1Rψ
2∈ Φ and s = hλ, χ, σi,
Expand (Φ, s) =Expand (Φ ∪ {ψ2}\{ψ1Rψ2}, hλ, χ ∪ {ψ1Rψ2}, σ ∪ {ψ1Rψ2}i)
∪Expand (Φ ∪ {ψ1, ψ2}\{ψ1Rψ2}, hλ, χ, σ ∪ {ψ1Rψ2}i)
(split s in two copies and process ψ
1on the first, ψ
2on the
second, add ψ
1Rψ
2to σ)
On-the-fly Construction of A
φ- Expand
Two relevant subcases: Fψ
def= >Uψ and Gψ
def= ⊥Rψ if Fψ ∈ Φ and s = hλ, χ, σi,
Expand (Φ, s) =Expand (Φ\{Fψ}, hλ, χ ∪ {Fψ}, σ ∪ {Fψ}i)
∪Expand (Φ ∪ {ψ}\{Fψ}, hλ, χ, σ ∪ {Fψ}i)
if Gψ ∈ Φ and s = hλ, χ, σi,
Expand (Φ, s) =Expand (Φ ∪ {ψ}\{Gψ}, hλ, χ ∪ {Gψ}, σ ∪ {Gψ}i) Note: Expand (Φ ∪ {⊥, ψ}\{Gψ}, ...) = ∅
49 / 69
Definition of A
φGiven a set of LTL formulas Ψ, we define Cover (Ψ)
def= Expand (Ψ, h∅, ∅, ∅i).
For an LTL formula φ, we construct a Generalized NBA A
φ= (Q, Σ, δ, I, FT ) as follows:
Σ = 3
vars(φ)(v ∈ {>, ⊥, ∗}) Q is the smallest set such that
Cover ({φ}) ⊆ Q
ifhλ, χ, σi ∈ Q, thenCover (χ) ∈ Q
Q
0= Cover ({φ}).
s
λ0
−→ s
0∈ δ iff, s = hλ, χ, σi, s
0= hλ
0, χ
0, σ
0i and s
0∈ Cover (χ) FT = hF
1, F
2, ..., F
ki where, for all (ψ
iUφ
i) occurring positively in φ, F
i= {hλ, χ, σi ∈ Q | (ψ
iUφ
i) / ∈ σ or φ
i∈ σ}.
(If there is no U-subformulas, then FT
def= {Q}).
Example: φ = FGp
Cover ({FGp})
= Expand ({FGp}, h∅, ∅, ∅i)
= Expand (∅, h∅, {FGp}, {FGp}i) ∪ Expand ({Gp}, h∅, ∅, {FGp}i)
= {h∅, {FGp}, {FGp}i} ∪ Expand ({p}, h∅, {Gp}, {FGp, Gp}i)
= {h∅, {FGp}, {FGp}i} ∪ Expand (∅, h{p}, {Gp}, {FGp, Gp, p}i)
= {h∅, {FGp}, {FGp}i, h{p}, {Gp}, {FGp, Gp, p}i}
Cover ({Gp}) = Expand ({Gp}, h∅, ∅, ∅i)
= Expand ({p}, h∅, {Gp}, {Gp}i)
= Expand (∅, h{p}, {Gp}, {Gp, p}i)
= {h{p}, {Gp}, {Gp, p}i}
Optimization:
merge h{p}, {Gp}, {FGp, Gp, p}i and h{p}, {Gp}, {Gp, p}i
51 / 69
Example: φ = FGp
Call s
1= h∅, {FGp}, {FGp}i, s
2= h{p}, {Gp}, {FGp, Gp, p}i Q = {s
1, s
2}
Q
0= {s
1, s
2}.
T : s
1→ {s
1, s
2}, s
2→ {s
2}
FT = hF
1i where F
1= {s
2}.
[ XGp ]
p
[ XFGp ]p
p
Example: φ = pUq
Cover ({pUq})
= Expand ({pUq}, h∅, ∅, ∅i)
= Expand ({p}, h∅, {pUq}, {pUq}i) ∪ Expand ({q}, h∅, ∅, {pUq}i)
= Expand (∅, h{p}, {pUq}, {pUq, p}i) ∪ Expand (∅, h{q}, ∅, {pUq, q}i)
= {h{p}, {pUq}, {pUq, p}i} ∪ {h{q}, {>}, {pUq, q}i}
Cover ({>}) = {h∅, {>}, {>}i}
53 / 69
Example: φ = pUq
Let s
1=
defh{p}, {pUq}, {pUq, p}i, s
2=
defh{q}, {>}, {pUq, q}i, s
3=
defh∅, {>}, {>}i.
Q = {s
1, s
2, s
3}, Q
0= {s
1, s
2},
T : s
1→ {s
1, s
2}, s
2→ {s
3} s
3→ {s
3}
FT = hF
1i where F
1= {s
2, s
3}.
[ XT ]
q
q p
p
Example: φ = GFp
Cover ({GFp})
= E ({GFp}, h∅, ∅, ∅i)
= E ({Fp}, h∅, {GFp}, {GFp}i)
= E ({}, h∅, {GFp, Fp}, {GFp, Fp}i) ∪ E ({p}, h{}, {GFp}, {GFp, Fp}i)
= E ({}, h∅, {GFp, Fp}, {GFp, Fp}i) ∪ E ({}, h{p}, {GFp}, {GFp, Fp, p}i)
= {h∅, {GFp, Fp}, {GFp, Fp}i} ∪ {h{p}, {GFp}, {GFp, Fp, p}i}
Note: GFp ∧ Fp ⇐⇒ GFp, s.t. Cover (GFp ∧ Fp) = Cover (GFp)
55 / 69
Example: GFp
Let s
1=
defh{p}, {GFp}, {GFp, Fp, p}i, s
2=
defh∅, {GFp, Fp}, {GFp, Fp}i, Q = {s
1, s
2},
Q
0= {s
1, s
2}, T : s
1→ {s
1, s
2},
s
2→ {s
1, s
2}
FT = hF
1i where F
1= {s
1}.
[ XGFp ] [ XGFp ]
p
p
p
NBAs of disjunctions of formulas
Remark
If ϕ
def= (ϕ
1∨ ϕ
2) and A
ϕ1, A
ϕ2are NBAs encoding ϕ
1and ϕ
2resp., then L(ϕ) = L(ϕ
1) ∪ L(ϕ
2), so that A
ϕ def= A
ϕ1∪ A
ϕ2is an NBA encoding ϕ
A
ϕnon necessarily the smallest/best NBA encoding ϕ Example
Let ϕ
def= (GFp → GFq), i.e., ϕ ≡ (FG¬p ∨ GFq).
Then A
FG¬p∪ A
GFqencodes ϕ:
¬p
¬p q
q q
¬p
57 / 69
Suggested Exercises:
Find an NBA encoding:
p
(p ∧ q) ∨ (¬p ∧ ¬q) Fp
Gp pRq
(GFp ∧ GFq) → Gr
Outline
1
Büchi Automata
2
The Automata-Theoretic Approach to LTL Reasoning General Ideas
Language-Emptiness Checking of Büchi Automata From Kripke Models to Büchi Automata
From LTL Formulas to Büchi Automata Complexity
3
Exercises
59 / 69
Automata-Theoretic LTL Model Checking: Complexity
Four steps:
(i) Compute A
M:
|A
M| = O(|M|) (ii) Compute A
ϕ:
|A
ϕ| = O(2
|ϕ|)
(iii) Compute the product A
M× A
ϕ:
|A
M× A
ϕ| = |A
M| · |A
ϕ| = O(|M| · 2
|ϕ|) (iv) Check the emptiness of L(A
M× A
ϕ):
O(|A
M× A
ϕ|) = O(|M| · 2
|ϕ|)
=⇒ The complexity of LTL M.C. grows linearly wrt. the size of the
model M and exponentially wrt. the size of the property ϕ
Final Remarks
Büchi automata are in general more expressive than LTL!
=⇒ some tools (e.g., Spin) allow specifications to be expressed directly as NBAs
=⇒ complementation of NBA important!
For every LTL formula, there are many possible equivalent NBAs
=⇒ lots of research for finding “the best” conversion algorithm Performing the product and checking emptiness very relevant
=⇒ lots of techniques developed (e.g., partial order reduction)
=⇒ lots on ongoing research
61 / 69