Tecniche di Specifica e di Verifica. Automata-based LTL Model-Checking

Similar documents
Tecniche di Specifica e di Verifica. Automata-based LTL Model-Checking

Lecture Notes on Emptiness Checking, LTL Büchi Automata

Temporal logics and explicit-state model checking. Pierre Wolper Université de Liège

Automata-based Verification - III

Linear Temporal Logic and Büchi Automata

Sanjit A. Seshia EECS, UC Berkeley

Automata-Theoretic LTL Model-Checking

Automata-based Verification - III

From Liveness to Promptness

automata-theoretic model checking

CS256/Spring 2008 Lecture #11 Zohar Manna. Beyond Temporal Logics

Introduction. Büchi Automata and Model Checking. Outline. Büchi Automata. The simplest computation model for infinite behaviors is the

Automata on Infinite words and LTL Model Checking

LTL Model Checking. Wishnu Prasetya.

Lecture 23 : Nondeterministic Finite Automata DRAFT Connection between Regular Expressions and Finite Automata

Automata, Logic and Games: Theory and Application

Logic Model Checking

Chapter 3: Linear temporal logic

Computer-Aided Program Design

Helsinki University of Technology Laboratory for Theoretical Computer Science Research Reports 66

Automata-Theoretic Verification

Timo Latvala. March 7, 2004

Computation Tree Logic (CTL) & Basic Model Checking Algorithms

Timo Latvala. February 4, 2004

T Reactive Systems: Temporal Logic LTL

LTL is Closed Under Topological Closure

Automata theory. An algorithmic approach. Lecture Notes. Javier Esparza

Temporal Logic Model Checking

Computational Models - Lecture 4

Partially Ordered Two-way Büchi Automata

Failure Diagnosis of Discrete Event Systems With Linear-Time Temporal Logic Specifications

Theory of Computation

Model Checking Algorithms

3-Valued Abstraction-Refinement

Büchi Automata and Linear Temporal Logic

CTL Model checking. 1. finite number of processes, each having a finite number of finite-valued variables. Model-Checking

Model Checking & Program Analysis

Alan Bundy. Automated Reasoning LTL Model Checking

First-order resolution for CTL

Helsinki University of Technology Laboratory for Theoretical Computer Science Research Reports 83

An On-the-fly Tableau Construction for a Real-Time Temporal Logic

Chapter 5: Linear Temporal Logic

Representing Temporal System Properties Specified with CCTL formulas using Finite Automaton

Büchi Automata and Their Determinization

Finite-State Model Checking

Before we show how languages can be proven not regular, first, how would we show a language is regular?

PSPACE-completeness of LTL/CTL model checking

Model Checking of Safety Properties

Chapter 4: Computation tree logic

Introduction to Temporal Logic. The purpose of temporal logics is to specify properties of dynamic systems. These can be either

Weak Alternating Automata Are Not That Weak

ω-automata Automata that accept (or reject) words of infinite length. Languages of infinite words appear:

Definition of Büchi Automata

Algorithms for Model Checking (2IW55)

Computation Tree Logic

Probabilistic Model Checking Michaelmas Term Dr. Dave Parker. Department of Computer Science University of Oxford

CPSC 421: Tutorial #1

The Pumping Lemma. for all n 0, u 1 v n u 2 L (i.e. u 1 u 2 L, u 1 vu 2 L [but we knew that anyway], u 1 vvu 2 L, u 1 vvvu 2 L, etc.

PSL Model Checking and Run-time Verification via Testers

Advanced Automata Theory 7 Automatic Functions

Monadic Second Order Logic and Automata on Infinite Words: Büchi s Theorem

Reduced Ordered Binary Decision Diagrams

Syntax and Semantics of Propositional Linear Temporal Logic

Automata and Reactive Systems

Temporal Logic. M φ. Outline. Why not standard logic? What is temporal logic? LTL CTL* CTL Fairness. Ralf Huuck. Kripke Structure

On the Succinctness of Nondeterminizm

The State Explosion Problem

Lattice Automata. Orna Kupferman and Yoad Lustig

Impartial Anticipation in Runtime-Verification

Efficient Model Checking of Safety Properties

KE/Tableaux. What is it for?

Formal Verification Techniques. Riccardo Sisto, Politecnico di Torino

Closure Properties of Regular Languages. Union, Intersection, Difference, Concatenation, Kleene Closure, Reversal, Homomorphism, Inverse Homomorphism

Properties of Regular Languages. BBM Automata Theory and Formal Languages 1

CS357: CTL Model Checking (two lectures worth) David Dill

Linear-time Temporal Logic

CDS 270 (Fall 09) - Lecture Notes for Assignment 8.

UNIT-II. NONDETERMINISTIC FINITE AUTOMATA WITH ε TRANSITIONS: SIGNIFICANCE. Use of ε-transitions. s t a r t. ε r. e g u l a r

arxiv: v1 [cs.lo] 17 Jun 2014

Nondeterministic Finite Automata

Theory of computation: initial remarks (Chapter 11)

Lecture Notes On THEORY OF COMPUTATION MODULE -1 UNIT - 2

CMPSCI 250: Introduction to Computation. Lecture #22: From λ-nfa s to NFA s to DFA s David Mix Barrington 22 April 2013

Automata Theory and Model Checking

T (s, xa) = T (T (s, x), a). The language recognized by M, denoted L(M), is the set of strings accepted by M. That is,

Temporal Logic. Stavros Tripakis University of California, Berkeley. We have designed a system. We want to check that it is correct.

Chapter 6: Computation Tree Logic

CHAPTER 10. Gentzen Style Proof Systems for Classical Logic

CISC 4090: Theory of Computation Chapter 1 Regular Languages. Section 1.1: Finite Automata. What is a computer? Finite automata

Sri vidya college of engineering and technology

Languages, logics and automata

A 3 Valued Contraction Model Checking Game: Deciding on the World of Partial Information

Topics in Verification AZADEH FARZAN FALL 2017

Theoretical Foundations of the UML

2. Elements of the Theory of Computation, Lewis and Papadimitrou,

Modal logics and their semantics

1 More finite deterministic automata

Automata & languages. A primer on the Theory of Computation. Laurent Vanbever. ETH Zürich (D-ITET) September,

A Symbolic Approach to Safety LTL Synthesis

From Liveness to Promptness

Transcription:

Tecniche di Specifica e di Verifica Automata-based LTL Model-Checking

Finite state automata A finite state automaton is a tuple A = (Σ,S,S 0,R,F) Σ: set of input symbols S: set of states -- S 0 : set of initial states ( S 0 S ) R:S Σ 2 S : the transition relation. F: set of accepting states ( F S ) A run r on w=a 1,,a n is a sequence s 0,,s n such that s 0 S 0 and s i+1 R(s i,a i ) for 0 i n. A run r is accepting if s n F, while a word w is accepted by A if there is an accepting run of A on w. The language L(A) accepted by A is the set of finite words accepted by A. 2

Finite state automata: union Given automata A 1 and A 2, there is an automaton A accepting L(A) = L(A 1 ) L(A 2 ) A = (Σ,S,S 0,R,F) is an automaton which just runs nondeterministically either A 1 or A 2 on the input word. S = S 1 S 2 F = F 1 F 2 S 0 = S 01 S 02 { R2 R(s,a) = R 1(s,a) if s S 1 (s,a) if s S 2 3

Finite state automata: union b A 1 a 0 b 1 A 2 a 2 b 3 a L(A 1 )=b * (ab) * a L(A 2 )=a(a*ba) * b a 0 1 b A 1 A 2 L(A)=L(A 1 ) L(A 2 ) a 2 3 a b 4

Finite state automata: intersection Given automata A 1 and A 2, there is an automaton A accepting L(A) = L(A 1 ) L(A 2 ) A = (Σ,S,S 0,R,F) runs simultaneously both automata A 1 and A 2 on the input word. S = S 1 S 2 F = F 1 F 2 S 0 = S 01 S 02 R((s,t),a) = R 1 (s,a) R 2 (t,a) 5

Finite state automata: intersection b A 1 a 0 b 1 A 2 a 2 b 3 a L(A 1 )=b * (ab) * a L(A 2 )=a(a*ba) * b 0,2 a 0,3 a b 1,2 1,3 A 1 A 2 L(A)=L(A 1 ) L(A 2 ) 6

Finite state automata: complementation If the automaton is deterministic, then it just suffices to set F c = S \ F. This doesn t work, though, for non-deterministic automata. Solution: 1. Determinize the automaton using the subset construction. 2. Complement the resulting deterministic automaton The complexity of this process is exponential in the size of the original automaton. The number of states of the final automaton is 2 S, in the worst case. 7

Finite state automata: complementation a A a s b L(A)=(a + b) * a t 1 2 b {s} Ø a,b A D a b b a L(A D )= (a + b) * a {s,t} {t} a a a A c b {s} Ø a,b b b a {s,t} {t} L(A c )=L(A) 8

Büchi automata (BA) A Büchi automaton is a tuple A = (Σ,S,S 0,R,F) Σ: set of input symbols S: set of states -- S 0 : set of initial states ( S 0 S ) R:S Σ 2 S : the transition relation. F: set of accepting states ( F S ) A run r on w=a 1,a 2, is an infinite sequence s 0,s 1, such that s 0 S 0 and s i+1 R(s i,a i ) for i 0. A run r is accepting if some accepting state in F occurs in r infinitely often. A word w is accepted by A if there is an accepting run of A on w, and the language L ω (A) accepted by A is the set of (infinite) ω-words accepted by A. 9

Büchi automata (BA) A Büchi automaton is a tuple A = (Σ,S,S 0,R,F) A run r on w=a 1,a 2, is an infinite sequence s 0,s 1, such that s 0 S 0 and s i+1 R(s i,a i ) for i 0. Let Lim(r) = { s s = s i for infinitely many i } A run r is accepting if Lim(r) F A word w is accepted by A if there is an accepting run of A on w. The language L ω (A) accepted by A is the set of (infinite) ω-words accepted by A. 10

Büchi automata: union Given Büchi automata A 1 and A 2, there is an Büchi automaton A accepting L ω (A) = L ω (A 1 ) L ω (A 2 ). The construction is the same as for ordinary automata. A = (Σ,S,S 0,R,F) is an automaton which just runs nondeterministically either A 1 or A 2 on the input word. S = S 1 S 2 F = F 1 F 2 S 0 = S 01 S 02 { R2 R(s,a) = R 1(s,a) if s S 1 (s,a) if s S 2 11

Büchi automata: intersection The intersection construction for automata does not work for Büchi automata. Instead, the intersection for Büchi automata can be defined as follows: A=(Σ,S,S 0,R,F) intuitively runs simultaneously both automata A 1 =(Σ,S 1,S 01,R 1,F 1 ) and A 2 =(Σ,S 2,S 02,R 2,F 2 ) on the input word. S = S1 S 2 {1,2} F = F 1 S 2 {1} S 0 = S 01 S 02 {1} (s,t,2) if s R 1 (s,a), t R 2 (t,a), s F 1 and i=1 R((s,t,i),a) = (s,t,1) if s R 1 (s,a), t R 2 (s,a), t F 2 and i=2 {(s,t,i) if s R 1 (s,a), t R 1 (t,a) 12

Büchi automata: intersection A = (Σ,S,S 0,R,F) runs simultaneously both automata A 1 and A 2 on the input word. S = S 1 S 2 {1,2} F = F 1 S 2 {1} S 0 = S 01 S 02 {1} (s,t,2) if s R 1 (s,a), t R 2 (t,a), s F 1 and i=1 R((s,t,i),a) = (s,t,1) if s R 1 (s,a), t R 2 (t,a), t F 2 and i=2 {(s,t,i) if s R 1 (s,a), t R 1 (t,a) The automaton remembers 2 tracks, one for each automaton, and points to one of the tracks. As soon as it goes through an accepting state on the current track, it changes track. The accepting condition and the transition relation ensure that this change of track must happens infinitely often. 13

Büchi automata: intersection A = (Σ,S,S 0,R,F) runs simultaneously both automata A 1 and A 2 on the input word. S = S 1 S 2 {1,2} F = F 1 S 2 {1} S 0 = S 01 S 02 {1} (s,t,2) if s R 1 (s,a), t R 2 (t,a), s F 1 and i=1 R((s,t,i),a) = (s,t,1) if s R 1 (s,a), t R 2 (t,a), t F 2 and i=2 {(s,t,i) if s R 1 (s,a), t R 1 (t,a) As soon as it visits an accepting state in track 1, it switches to track 2 and then to track 1 again but only after visiting an accepting state in the track 2. Therefore, to visit infinitely often a state in F (F 1 ), the automaton must also visit infinitely often some state of F 2. 14

Büchi automata: complementation It s a complicated construction -- the standard subset construction for determinizing automata doesn t work as non-deterministic automata are more powerful than deterministic ones (e.g. L ω =(0+1)* 1 ω ) 1,0 Solution (resorts to another kind of automaton): Transform the (non-deterministic) Büchi automaton into a (non-deterministic) Rabin automaton (a more general kind of ω-automaton). Determinize and then complement the Rabin automaton. Transform the Rabin automaton into a Büchi automaton. Therefore, also Büchi automata are closed under complementation. 1 1 15

Rabin automata A Rabin automaton is like a Büchi automaton, except that the accepting condition is defined differently. A = (Σ,S,S 0,R,F), where F=((G 1,B 1 ),,(G m,b m )). and the acceptance condition for a run r = s 0,s 1, is as follows: for some i Lim(r) G i and Lim(r) B i = in other words, there is a pair (G i,b i ) such that the good set (G i ) is visited infinitely often, while the bad set (B i ) is visited only finitely often. 16

Rabin versus Büchi automata 1,0 s 1 t 1 The Büchi automaton fot L ω = (0+1)* 1 ω 0 1 The Rabin automaton 1 s t fot L = ω (0+1)* 1 ω 0 The Rabin automaton has F=(({t},{s})) Note that the Rabin automaton is deterministic. 17

Language emptiness for Büchi automata The emptiness problem for Büchi automata is the problem of deciding whether the language accepted by a Büchi automaton A is empty, i.e. if L(A)=. Theorem: The emptiness problem for Büchi automata is decidable in linear time, i.e. in time O( A ). Fact: L(A) = iff in the Büchi automaton there is no reachable cycle A containing a state in F. 18

Language emptiness for Büchi automata In other words, L(A) iff there is a cycle containing an accepting state, which is also reachable from some initial state of the automaton. We need to find whether there is such a reachable cycle We could simply compute the SCCs of A using the standard DFS algorithm, and check if there exists a reachable (nontrivial) SCC containing a state in F. But this is usually too inefficient in practice. We will therefore use a more efficient nested DFS (more efficient in the average-case). 19

Efficient language emptiness for BA Input: A Initialize: Stack 1 :=, Stack 2 := Table 1 :=, Table 2 := Algorithm Main() foreach s Init if s Table 1 then DFS1(s); output( empty ); return; Algorithm DFS1(s) push(s,stack 1 ); hash(s,table 1 ); foreach t Succ(s) if t Table 1 then DFS1(t); if s F then DFS2(s); pop(stack 1 ); Algorithm DFS2(s) push(s,stack 2 ); hash(s,table 2 ) ; foreach t Succ (s) do if t Table 2 then DFS2(t) else if t is on Stack 1 output( not empty ); output(stack 1,Stack 2,t); return; pop(stack 2 ); Note: upon finding a bad cycle, Stack 1 +Stack 2 +t, determines a counterexample: a bad cycle reached from an init state. 20

Generalized Büchi automata (GBA) Generalized Büchi automaton: A = (Σ,S,S 0,R,(F 0,...,F m-1 )) A run r on w=a 1,a 2, is an infinite sequence s 0,s 1, such that s 0 S 0 and s j+1 R(s j,a j ) for j 0. Let Lim(r) = { s s = s k for infinitely many k } A run r is accepting if for each 0 i < m Lim(r) F i Any Generalized Büchi automaton can be easily transformed into a Büchi automaton as follows: L(A) = L(<Σ,S,S 0,R,F i >) i {0,,m-1} This transformation is not very efficient, though. 21

From GBA to BA efficiently Generalized Büchi automaton: A = (Σ,S,S 0,R,(F 0,...,F m-1 )) A Generalized Büchi automaton A can be efficiently transformed into a Büchi automaton A = (Σ, S,S 0, R, F ) as follows: S = S {0,,m-1} F = F i {i} for some 0 i < m S 0 = S 0 {i} for some 0 i < m {(s, (i+1 mod m)) if s R(s,a) and s F i R ((s,i),a) = (s,i) if s R (s,a) and s F i Notice that the transformation above expands the automaton size by a factor of m (compare with Büchi Intersection). 22

LTL and Büchi automata: example The following Büchi automaton recognizes the models of the LTL formula p U q Indeed, all these models have the form: p * q AP ω where by AP ω we mean any infinite sequence of atomic propositions in AP. s 0 q p s 1 AP 23

LTL and Büchi automata: example The following Büchi automaton recognizes the models of the LTL formula p U q Indeed, all these models have the form: p * q AP ω where by AP ω we mean any infinite sequence of atomic propositions in AP. s 0,p s 1,q Notice that for convenience, we shall associate symbols to states instead of arcs (the general mapping between the two versions of Büchi automata can be easily defined). s 1,AP 24

LTL-semantics and Büchi automata A formula ψ expresses a property of ω-words, i.e., an ω-language L(ψ) Σ AP ω. For ω-word σ = σ 0, σ 1, σ 2,.. Σ AP ω, let σ i = σ i, σ i+1, σ i+2. be the suffix of σ starting at position i. We defined the satisfies relation,, inductively: σ i p j iff p j σ i (for p j AP). σ i ψ iff not σ i ψ. σ i ψ 1 ψ 2 iff σ i ψ 1 or σ i ψ 2. σ i Xψ iff σ i+1 ψ. σ i ψ 1 U ψ 2 iff k i. (σ k ψ 2 and 0 j< k. σ j ψ 1 ) σ i ψ 1 R ψ 2 iff k i. (σ k ψ 2 or 0 j< k. σ j ψ 1 ) We can then define the language L(ψ) = { σ σ 0 ψ }. 25

Relation with Kripke structures We extend our definition of satisfies to transition systems, or Kripke structures, as follows: given a run π = s 0 s 1... s k... of K AP, let L(π) = L(s 0 ) L(s 1 )... L(s k )... notice that L(π) Σ AP ω Then K AP ψ iff for all computations (runs) π of K AP, L(π) ψ. In other words: settingl(k AP ) = {L(π) π is an infinite path in K AP } K AP ψ L(K AP ) L(ψ). 26

LTL Model Checking: explanation K AP ψ L(K AP ) L(ψ) L(K AP ) (Σ ω AP \L(ψ)) = L(K AP ) L( ψ) = L(K AP ) L(A ) = ψ 27

Relation with Kripke structures We can transform any Kripke structure into a Büchi automaton as follows: A K K AP {p,q} init {p} {p,q} s 0 {p} s 1 {q} s 2 {p} s 0 {p,q} s 1 {p,q} s 2 {q} where every state is accepting! 28

LTL Model Checking System Model K LTL property ψ Model Checker Check that K ψ by checking that L(K) L(A ψ ) = Convert ψ to a Büchi automaton, so that A ψ L( ψ) = L(A ψ ) Yes! No! + counterexample 29

The algorithmic tasks to perform We have reduced LTL model checking to two tasks: 1 Convert an LTL formula ϕ (i.e. ψ) into a Büchi automaton A ϕ, such that L(ϕ) = L(A ϕ ). Can we do this in general?. Yes!!! 2 Check whether K AP ψ, by checking whether the intersection of languages L(K AP ) L(A ψ) is empty. It is actually unwise to first construct all of K AP, because K AP can be far too big (state explosion). Instead, it is possible perform the check by constructing states of K AP only as needed. 30

LTL to BA translation First, let s put LTL formulas ϕ in normal form where: s have been pushed in, applying only to propositions. the only propositional operators are,,. the only temporal operators are X, U and its dual R. We can use the following rules: p q p q (definition); (p q) p q (De Morgan s low); (p q) p q (De Morgan s low); p p (double negation low); (p U q) ( p) R ( q) ; (p R q) ( p) U ( q) ; F p T U p ; G p R p ; X p X p (linearity) 31

LTL to BA translation First, let s put LTL formulas ϕ in normal form s have been pushed in, applying only to propositions. We use the following rules: p q p q ; (p q) p q ; (p q) p q ; p p ; (p U q) ( p) R ( q) ; (p R q) ( p) U ( q) F p T U p ; G p R p ; X p X p ; Examples: ((p U q) F r) (p U q) F r (p U q) (T U r) ( p R q) (T U r) GF p F r ( R (Fp)) (T U p) ( R (T U p)) (T U r) ( R (T U p)) (T U r) (T U (T U p)) (T U r) (T U ( R p)) (T U r) 32

LTL to BA translation: intuition States of A ϕ will be sets of subformulas of ϕ, thus if ϕ = p 1 U p 2, a state is given by Γ {p 1,p 2, p 2, p 1 U p 2 }. Consider a word σ = σ 0, σ 1, σ 2, Σ AP ω such that σ ϕ, where, e.g., ϕ = ψ 1 U ψ 2. Mark each position i with the set of subformulas Γ i of ϕ that hold true there: Γ 0 Γ 1 Γ 2 σ 0 σ 1 σ 2 Clearly, ϕ Γ 0. But then, by consistency, either: ψ 1 Γ 0 and ϕ Γ 1, or ψ 2 Γ 0. The consistency rules dictate our states and transitions. 33

LTL to BA translation Let sub(ϕ) denote the set of subformulas of ϕ. We define A ϕ = (Q, Σ, R, L, Init, F) as follows. First, the state set: Q = {Γ sub(ϕ) s.t. Γ is locally consistent }. For Γ to be locally consistent we should have: Γ if ψ γ Γ, then ψ Γ or γ Γ. if ψ γ Γ, then ψ Γ and γ Γ. if p i Γ then p i Γ, and if p i Γ then p i Γ. if ψ U γ Γ, then (ψ Γ or γ Γ). if ψ R γ Γ, then γ Γ. 34

LTL to BA translation Now, labeling the states of A ϕ : The labeling L: Q a Σ is L(Γ) = {l sub(ϕ) Σ l Γ}. Now, a word σ = σ 0 σ 1 (Σ AP ) ω is inl(a ϕ ) iff there is a run π = Γ 0 Γ 1 Γ 2 of A ϕ, s.t., i Õ, we have that σ i satisfies L(Γ i ), i.e., σ i is a satisfying assignment for L(Γ i ). This constitutes a slight redefinition of Büchi automata, where labeling is on the states instead of on the edges. This facilitates a much more compact A ϕ. 35

LTL to BA translation Now, the transition relation, and the rest of A ϕ. Based on the following LTL rules: (ψ U γ) γ ( ψ X (ψ U γ) ) (ψ R γ) γ (ψ X (ψ R γ)) ( γ ψ) (γ X(ψ R γ)) and on the semantics of X, we define: R Q Q, where (Γ,Γ ) R iff: if (ψ U γ) Γ then γ Γ, or (ψ Γ and (ψ U γ) Γ ). if (ψ R γ) Γ then γ Γ, and (ψ Γ or (ψ R γ) Γ ). if X ψ Γ, then ψ Γ. 36

LTL to BA translation: example T U p T U p p p Consider the following formula: F p T U p sub(t U p) ={T U p, p} Init = {Γ sub(t U p) T U p Γ} 37

LTL to BA translation: example T U p T U p p p Consider the following formula: T U p (T U p) p X (T U p) 38

LTL to BA translation: example T U p T U p p p Consider the following formula: T U p (T U p) p X (T U p) 39

LTL to BA translation: example T U p T U p p p Consider the following formula: T U p (T U p) p X (T U p) 40

LTL to BA translation: example T U p T U p p p Consider the following formula: T U p (T U p) p X (T U p) 41

LTL to BA translation: example T U p T U p p p In this automaton are runs, e.g. [T U p] ω, where p never occurs. These run must not be accepting! 42

LTL to BA translation Init = {Γ Q ϕ Γ}. For each (ψ U γ) that: γ) sub(ϕ), there is a set F i F, such F i = {Γ Q (ψ U γ) Γ or γ Γ} (or equivalently F i = {Γ Q if (ψ U γ) Γ, then γ Γ}) (notice that if there are no (ψ U γ) sub(ϕ), then the acceptance condition is the trivial one: all states are accepting) Lemma: L(ϕ) = L(A ϕ ). But A ϕ is now a generalized Büchi automaton 43

LTL to BA translation: example T U p T U p p p Consider the following formula: T U p sub(t U p) ={T U p, p} F = {F T Up } = {Γ sub(t U p) (T U p) Γ or p Γ} 44

LTL to BA translation: example R p R p p p Consider the following formula: G p R p sub( R p) ={ R p, p} Init = {Γ sub( R p) R p Γ} 45

LTL to BA translation: example R p R p p p Consider the following formula: G p R p sub( R p) ={ R p, p} ( R p) p X ( R p) 46

LTL to BA translation: example R p R p p The trivial acceptance condition p Consider the following formula: G p R p sub( R p) ={ R p, p} There are no eventualities, hence F = { Q } 47

LTL to BA translation: example p U q q p U q p,q p U q p p U q p,q q p Consider the following formula: p U q sub(p U q) ={p U q, p, q} Init = {Γ sub(p U p) p U q Γ} 48

LTL to BA translation: example p U q q p U q p,q p U q p p U q p,q q p Consider the following formula: p U q sub(p U q) ={p U q, p, q} Init = {Γ sub(p U p) p U q Γ} 49

LTL to BA translation: example p U q q p U q p,q p U q p p U q p,q q p Consider the following formula: p U q sub(p U q) ={p U q, p, q} (p U q) q (p X (p U q)) 50

LTL to BA translation: example p U q q p U q p,q p U q p p U q p,q q p Consider the following formula: p U q sub(p U q) ={p U q, p, q} F = { F puq } = {Γ sub(p U q) (p U q) Γ or q Γ} 51

On-the-fly translation algorithm There is another more efficient way to build the Büchi automaton corresponding to a LTL formula. The algorithm proposed by Vardi and his colleagues, is based on the idea of refining states only as needed. It only record the necessary information (what must hold) at a state, instead of recording the complete information about each state (both what must hold and what might or might-not hold). In a way what might or might-not hold is treated as don t care information (which can be filled in, but whose value has no relevant effect). 52

Algorithm data structure: node Name: A string identifying the current node. Father: The name of the father node of current node. Incoming: List of fully expanded nodes with edges to the current node. Old: A set of temporal formulae which must hold and in the current node have been processed already. New: A set of temporal formulae which must hold but in the current node have not been processed yet. Next: A set of temporal formulae which should hold in the next node (immediate successor) of the current node. Fully Expanded nodes (i.e. States of the Automaton) are those nodes having the New field empty. 53

NODE Name: Node1 Father: Node1 Incoming: Init New: {p U q} Next: {} Old: {} Fully Expanded Name: Node2 Father: Node1 Incoming: Init New: {p} Next: {p U q} Old: {p U q} Name: Node3 Father: Node1 Incoming: Init New: {} Next: {} Old: {q, p U q} 54

Algorithm to build set of fully expanded nodes function create graph(φ) return(expand([name Father new_name(), Incoming {Init}, New {φ}, Old, Next ], ) Fully Expanded Nodes function expand (Node, Nodes_Set) if New(Node)= then if ND Nodes_Set with Old(ND)=Old(Node) and and Next(ND) = Next(Node) then Incoming(ND) := Incoming(ND) Incoming(Node); return(nodes_set); else return(expand([name Father new_name(), Incoming {Name(Node)}, New Next(Node), Old, Next ], Nodes_Set {Node}); else. 55

Example: case of a fully expanded node Nodes_Set Init 4 R p ; p Name: Node8 Father: Node6 Incoming: 4 New: {} Next: { R p} Old: { R p ; p} 56

Example: case of a fully expanded node Init Nodes_Set 4 p U q ; p 9 p U q ; q Name: Node9 Father: Node7 Incoming: 4 New: {} Next: {} Old: {p U q ; q} 57

function expand (Node, Nodes_Set) if New(Node)= then{preceding block} else Expansion for literals let η New; Contradiction found New(Node) := New(Node) \ {η}; case η of η = p i or p i or T or : if η = or Neg(η) Old(Node) then return(nodes_set) ; /* Discard current node */ else Old(Node) := Old(Node) {η}; return(expand(node, Nodes Set)); η = µ U ψ or µ R ψ or µ ψ :. 58

Splitting a node for Disjunction Name: Node1 Father: Node1 Incoming: Init New: {p q} Next: {} Old: {} Name: Node2 Father: Node1 Incoming: Init New: {p} Next: {} Old: {p q} split Name: Node3 Father: Node1 Incoming: Init New: {q} Next: {} Old: {p q} 59

Splitting a node for Until op. Name: Node1 Father: Node1 Incoming: Init New: {p U q} Next: {} Old: {} Name: Node2 Father: Node1 Incoming: Init New: {p} Next: {p U q} Old: {p U q} split Name: Node3 Father: Node1 Incoming: Init New: {q} Next: {} Old: {p U q} 60

Splitting a node for Release op. Name: Node1 Father: Node1 Incoming: Init New: {p R q} Next: {} Old: {} Name: Node2 Father: Node1 Incoming: Init New: {q} Next: {p R q} Old: {p R q} split Name: Node3 Father: Node1 Incoming: Init New: {p,q} Next: {} Old: {p R q} 61

Additional functions The function Neg() is applied only to literals: Neg(p i ) = p i Neg(T) = Neg( p i ) = p i Neg( ) = T The functions New1(), New2() and Next1(), used for splitting nodes, are applied to temporal formulae and defined as follows: η New1(η) Next1(η) New2(η) µ U ψ {µ} {µ U ψ} {ψ} µ R ψ {ψ} {µ R ψ} {µ,ψ} µ ψ {µ} {ψ} 62

function expand (Node, Nodes_Set) if New(Node)= then {preceding block} else let η New; New(Node) := New(Node) \ {η}; Splitting the node case η of η = p i or p i or T or : {preceding block} η = µ U ψ or µ R ψ or µ ψ : Node1:=[Name new_name(), Father Name(Node), Incoming Incoming(Node), New New(Node) ({New1(η)} \ Old(Node)), splitting Old Old(Node) {η}, Next Next(Node) {Next1(η)}]; Node2:=[Name new_name(), Father Name(Node), Incoming Incoming(Node), New New(Node) ({New2(η)} \ Old(Node)), Old Old(Node) {η}, Next Next(Node)]; return(expand(node2, expand(node1, Nodes_Set))); η = µ ψ :. 63

function expand (Node, Nodes_Set) if New(Node)= then {preceding block} else let η New; New(Node):=New(Node) \ {η}; case η of η = p i or p i or T or : {preceding block} η = µ U ψ or µ R ψ or µ ψ : {preceding block} η = µ ψ : return(expand([name Name(Node), Father Father(Node), Incoming Incoming(Node), New (New(Node) {µ,ψ } \ Old(Node)), Old Old(Node) {η}, Next = Next(Node)], Nodes_Set); η = X ψ :. Expansion for conjunction 64

Expanding a node Name: Node1 Father: Node1 Incoming: Init New: {p q, } Next: {...} Old: {...} expand Name: Node2 Father: Node1 Incoming: Init New: {p,q, } Next: {...} Old: {,p q} 65

function expand (Node, Nodes_Set) if New(Node)= then {preceding block} else let η New; New(Node):=New(Node) \ {η}; Expansion for Next operator case η of η = p i or p i or T or : {preceding block} η = µ U ψ or µ R ψ or µ ψ : {preceding block} η = µ ψ : {preceding block} η = X ψ : return(expand( [Name Name(Node),Father Father(Node), Incoming Incoming(Node), New New(Node), Old Old(Node) {η}, Next = Next(Node) {ψ}], Nodes_Set); esac; end expand; 66

Expanding a node Name: Node1 Father: Node1 Incoming: Init New: {X p, } Next: {...} Old: {...} expand Name: Node1 Father: Node1 Incoming: Init New: { } Next: {,p} Old: {, X p} 67

The need for accepting conditions IMPORTANT: Remember that not every maximal path π = s 0 s 1 s 2 in the graph determines a model of the formula: the construction above allows some node to contain µ U ψ while none of the successor nodes contain ψ. This is solved again by imposing the generalized Büchi acceptance conditions : for each subformula of φ of the form µ U ψ, there is a set F φ F, including the nodes s Q, such that either µ U ψ Old(s), or ψ Old(s). 68

Complexity of the construction THEOREM: For any LTL formula φ a Büchi automaton A φ can be constructed which accepts all an only the ω sequences satisfying φ. THEOREM: Given a LTL formula φ, the Büchi automaton for φ whose states are O(2 φ ) (in the worst-case). [ φ is the number of subformulae of φ]. THEOREM: Given a LTL formula φ and a Kripke structure K sys the, the LTL model checking problem can be solved in time O( K sys 2 φ ). [actually it is PSPACE-complete]. 69

LTL to BA: example Consider the following formula: G p where p is an atomic formula. Its negation-normal form is R p 70

LTL to BA: example Init Current node is Node 1 Incoming = [Init] Old = [] New = [ R p] Next = [] ( R p) (p ) (p X( R p)) New(node) not empty, removing η = R p, node split into 2, 3, about to expand them 71

LTL to BA: example Init Current node is Node 2 Incoming = [Init] Old = [ R p] New = [p] Next = [ R p] New(node) not empty, removing η = p, node replaced by 4 about to expand them 72

LTL to BA: example Init Current node is Node 4 Incoming = [Init] Old = [ R p ; p] New = [] Next = [ R p] New(node) empty, no equivalent nodes. About to add, timeshift and expand. 73

LTL to BA: example Init 4 R p ; p Current node is Node 5 Incoming = [4] Old = [] New = [ R p] Next = [] ( R p) (p ) (p X( R p)) New(node) not empty, removing η = R p, node split into 6, 7 about to expand them 74

LTL to BA: example Init Current node is Node 6 Incoming = [4] Old = [ R p] New = [p] Next = [ R p] 4 R p ; p New(node) not empty, removing η = p, node replaced by 8, about to expand it 75

LTL to BA: example Init Current node is Node 8 Incoming = [4] Old = [ R p ; p] New = [] Next = [ R p] 4 R p ; p New(node) empty, found equivalent old node in Node_Set (4). Returning it instead. 76

LTL to BA: example From the split of Node 5 Init Current node is Node 7 Incoming = [4] Old = [ R p] New = [ ; p] Next = [] 4 R p ; p New(node) not empty, removing η =, inconsistent node deleted - dead end!. 77

LTL to BA: example From the split of Node 1 Init 4 R p ; p Current node is Node 3 Incoming = [Init] Old = [ R p] New = [ ; p] Next = [] New(node) not empty, removing η =, inconsistent node deleted - dead end!. 78

LTL to BA: example Init 4 R p ; p Final graph for G p R p R p p 79

LTL to BA: example 2 Consider the following formula: p U q where p and q are atomic formulae. 80

LTL to BA: example 2 Init Current node is Node 1 Incoming = [Init] Old = [] New = [p U q] Next = [] (p U q) q (p X(p U q)) New(node) not empty, removing η = p U q node split into 3, 2, about to expand them 81

LTL to BA: example 2 Init Current node is Node 2 Incoming = [Init] Old = [p U q] New = [p] Next = [p U q] New(node) not empty, removing η = p node replaced by 4, about to expand them 82

LTL to BA: example 2 Init Current node is Node 4 Incoming = [Init] Old = [p U q ; p] New = [] Next = [p U q] New(node) empty, no equivalent nodes. Add, timeshift and expand. 83

LTL to BA: example 2 Init 4 p U q ; p Current node is Node 5 Incoming = [4] Old = [] New = [p U q] Next = [] (p U q) q (p X(p U q)) New(node) not empty, removing η = p U q, node split into 6, 7, about to expand. 84

LTL to BA: example 2 Init Current node is Node 6 Incoming = [4] Old = [p U q] New = [p] Next = [p U q] 4 p U q ; p New(node) not empty, removing η = p, node replaced by 8, about to expand it 85

LTL to BA: example 2 Init 4 p U q ; p Current node is Node 8 Incoming = [4] Old = [p U q ; p] New = [] Next = [p U q] New(node) empty. Found equivalent old note (4) in Node_Set. Returning it instead. 86

LTL to BA: example 2 From the split of Node 5 Init Current node is Node 7 Incoming = [4] Old = [p U q] New = [q] Next = [] 4 p U q ; p New(node) not empty, removing η = q, node replaced by 9, about to expand it 87

LTL to BA: example 2 Init 4 p U q ; p Current node is Node 9 Incoming = [4] Old = [p U q ; q] New = [] Next = [] New(node) empty, no equivalent node found. Add timeshift and expand 88

LTL to BA: example 2 Init Current node is Node 10 Incoming = [9] Old = [] New = [] Next = [] 4 p U q ; p 9 p U q ; q New(node) empty, no equivalent node found. Add timeshift and expand 89

LTL to BA: example 2 Init Current node is Node 11 Incoming = [10] Old = [] New = [] Next = [] 4 p U q ; p 9 p U q ; q 10 New(node) empty. Found equivalent old node in Node_Set (10). Returning it instead. 90

LTL to BA: example 2 From the split of Node 1 Init Current node is Node 3 Incoming = [Init] Old = [p U q] New = [q] Next = [] 4 p U q ; p 9 p U q ; q New(node) not empty, node replaced by 12, about to expand. 10 91

LTL to BA: example 2 Init Current node is Node 12 Incoming = [Init] Old = [p U q ; q] New = [] Next = [] 4 p U q ; p 9 p U q ; q 10 New(node) empty. Found equivalent old node (4) in Node_Set. Returning it instead. 92

LTL to BA: example 2 Init 4 p U q ; p 9 p U q ; q 10 Final graph for p U q 93

Comparison of the two algorithms p U q q p U q p,q p U q p p U q p p U q q p,q q p The graphs for p U q obtained from the two algorithms 94

Notes on the algorithm Notice that nodes do not necessarily assign truth value to all atomic propositions (in AP)! Indeed the labeling to be associated to a node can be any element of 2 AP which agrees with the literals (AP or negations of AP) in Old(Node). Let Pos(q) = Old(q) AP Let Neg(q) = {η AP η Old(q)} L(q) = { X AP X Pos(q) (X Neg(q)) = } 95

Notes on the algorithm p U q p L(q) = {{p},{p,q}} }} p U q q L(q) = {{q},{p,q}} }} p U q q p U q p,q p U q p L(q) = {{},{p},{q},{p,q}} }} p,q q p 96

Composing A sys and A φ In general what we need to do is to compute the intersection of the languages recognized by the two automata A sys and A φ and check for emptiness. We have already seen (slide 12) how this can be done. When the System needs not satisfy FAIRNESS conditions (or in general A sys have the trivial acceptance condition, i.e. all the states are accepting) there is a more efficient construction... 97

Efficient composition of A sys and A φ When A sys have the trivial acceptance condition, i.e. all the states are accepting there is a more efficient construction. In this case we can just compute: A sys A φ = < Σ, S sys S φ, R, S 0sys S 0φ, S sys F φ > where (<s,t>,a,<s,t >) R iff (s,a,s ) R sys and (t,a,t ) R φ 98

Efficient composition of A sys and A φ Notice that in our case both automata have labels in the states (instead of on the transitions). This can be dealt with by simply restricting the set of states of the intersection automaton to those which agree on the labeling on both automata. Therefore we define A sys A φ = < Σ, S, R, (S 0sys S 0φ ) S, S sys F φ > where S = {(s,t) S sys S φ L sys (s) AP(φ) =L φ (t)} and φ) (<s,t>,<s,t >) R iff (s,s ) R sys and (t,t ) R φ 99