COMP4600 Advanced algorithms: Algorithms for verification (3 - - PowerPoint PPT Presentation

comp4600 advanced algorithms algorithms for verification
SMART_READER_LITE
LIVE PREVIEW

COMP4600 Advanced algorithms: Algorithms for verification (3 - - PowerPoint PPT Presentation

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking COMP4600 Advanced algorithms: Algorithms for verification (3 lectures) Andreas Bauer NICTA Software Systems Research Group & The


slide-1
SLIDE 1

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

COMP4600 Advanced algorithms: Algorithms for verification (3 lectures)

Andreas Bauer

NICTA Software Systems Research Group & The Australian National University

http://baueran.multics.org/

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 1 / 83

slide-2
SLIDE 2

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

Caveat

Although model checking is my research area... ...this is the first time, I’m giving a comprehensive lecture on model checking. We will look at MC foremost from a technical/algorithmic point of view, not so much from a formal/logical one. However, there will be a wee bit of logic introduced/used that everyone should be able to follow who knows standard propositional logic. Let’s see how we go...

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 2 / 83

slide-3
SLIDE 3

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

What do we mean by verification?

System is modelled as finite state-transition system. Properties are written down in propositional temporal logic. Verification = exhaustive state-space search of system model. Diagnostic counterexample, if any.

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 3 / 83

slide-4
SLIDE 4

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

What do we mean by verification?

System is modelled as finite state-transition system. Properties are written down in propositional temporal logic. Verification = exhaustive state-space search of system model. Diagnostic counterexample, if any.

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 3 / 83

slide-5
SLIDE 5

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

Model checking

Does system model M satisfy temporal logic property ϕ (written M | = ϕ)? Normally, checking of functional correctness (not error-freeness in the intuitive sense). System (model) only as good/reliable as its designers anticipated. Model checking cannot detect implementation errors (e.g., compiler bugs) ⇒ Systems testing.

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 4 / 83

slide-6
SLIDE 6

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

Model checking

Does system model M satisfy temporal logic property ϕ (written M | = ϕ)? Normally, checking of functional correctness (not error-freeness in the intuitive sense). System (model) only as good/reliable as its designers anticipated. Model checking cannot detect implementation errors (e.g., compiler bugs) ⇒ Systems testing. Let’s be more formal! What is M, what is ϕ, what is “satisfy”?

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 4 / 83

slide-7
SLIDE 7

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

By the way. . .

MC “won” Turing award in 2007 (Clarke, Emmerson, Sifakis): Most widely used industrial design verification technique. Focus shifted from verification of simple designs (e.g., communication protocol specifications) to entire software systems (e.g., business information system).

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 5 / 83

slide-8
SLIDE 8

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

By the way. . .

A lot (but not all) of the material in these lectures is based upon (MIT Press, 2003) (Henrik Reif Andersen ’97)

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 6 / 83

slide-9
SLIDE 9

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

Kripke structures

M = (S, R, L) over set of propositions, AP, where S is set of states, R ⊆ S × S a transition relation, L : S → 2AP a labelling function.

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 7 / 83

slide-10
SLIDE 10

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

Kripke structures

M = (S, R, L) over set of propositions, AP, where S is set of states, R ⊆ S × S a transition relation, L : S → 2AP a labelling function. Modelling the behaviour of a microwave oven AP = {Start, Close, Heat, Error} S = {S1, . . . , S7} R = {(S1, S3), (S1, S2), (S3, S1), . . .} L(S1) = ∅, L(S2) = {Start, Error}, . . .

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 7 / 83

slide-11
SLIDE 11

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

Kripke structures

1 Start, Error 2 Close 3 Close, Heat 4 Start, Close, Error 5 Start, Close 6 Start, Close, Heat 7

“start oven” “open door” “reset” “start oven” “warm up” “start cooking” “cook”

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 8 / 83

slide-12
SLIDE 12

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

Kripke structures

1 Start, Error 2 Close 3 Close, Heat 4 Start, Close, Error 5 Start, Close 6 Start, Close, Heat 7

“start oven” “open door” “reset” “start oven” “warm up” “start cooking” “cook”

Possible behaviour of microwave oven Trace/word: {Close}, {Start, Close}, {Start, Close, Heat}, {Close, Heat}, {Close, Heat}, . . . Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 8 / 83

slide-13
SLIDE 13

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

Kripke structures

Behaviour of microwave = all possible traces/words of M. Trace/word = linear Kripke structure. Traces typically infinite due to loops (i.e., reactive system never switched off). Definition Let Σ = 2AP be a finite alphabet. Let Σω denote set of all infinite traces over Σ. Behaviour of M can be given as {w ∈ Σω | for all i ∈ N0 there are m, n ∈ N s.t. (Sm, Sm) ∈ R and w(i) = L(Sm) and w(i + 1) = L(Sn)} (We could also demand that L(S0) = w(0), had we an S0.)

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 9 / 83

slide-14
SLIDE 14

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

Kripke structures—where they come from

If we model a system directly in terms of a Kripke structure, we are, sort of, performing the model checking by hand already. Model generation: Convert abstract system model (e.g., source code) into Kripke structure automatically. Example program: P = m : cobegin P0||P1 coend m′

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 10 / 83

slide-15
SLIDE 15

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

Kripke structures—where they come from

The corresponding Kripke structure

  • cf. Clarke, Grumberg, Peled (2003): “Model Checking”, MIT Press.

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 11 / 83

slide-16
SLIDE 16

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

Linear-time temporal logic

Pnueli, 1977; Turing award 1996. LTL = propositional logic + two temporal operators (X, U). Used as formal specification language for temporal order of events. Propositional logic (recap) ϕ = a ∧ ¬b ∨ c has model {α(a) = 1, α(b) = 0, α(c) = 1} We can write this as singleton “Kripke structure” M = {a, c}. Thus, M | = ϕ (“M satisfies/is a model for ϕ.”)

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 12 / 83

slide-17
SLIDE 17

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

Linear-time temporal logic

LTL syntax Every propositional logic formula is also an LTL formula. If ϕ is an LTL formula, then so are Xϕ and ϕUϕ′. BNF: ϕ ::= p ∈ AP | ¬ϕ | ϕ ∧ ϕ | Xϕ | ϕUϕ.

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 13 / 83

slide-18
SLIDE 18

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

Linear-time temporal logic

LTL syntax Every propositional logic formula is also an LTL formula. If ϕ is an LTL formula, then so are Xϕ and ϕUϕ′. BNF: ϕ ::= p ∈ AP | ¬ϕ | ϕ ∧ ϕ | Xϕ | ϕUϕ. LTL semantics: w series of assignments/worlds, i position in w

w, i | = p iff p ∈ w(i) w, i | = ¬ϕ iff w, i | = ϕ is not true w, i | = ϕ ∧ ψ iff w, i | = ϕ and w, i | = ψ w, i | = Xϕ iff w, i + 1 | = ϕ w, i | = ϕUψ iff there is k ≥ i s.t. w, k | = ψ, and for all i ≤ j < k we have w, j | = ϕ More generally, note how models of ϕ ∈ LTL are elements from Σω (Σ = 2AP is our alphabet). Let L(ϕ) = {w ∈ Σω | w, 0 | = ϕ} be the language of ϕ. Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 13 / 83

slide-19
SLIDE 19

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

Linear-time temporal logic

Some more useful LTL operators and shortcuts (syntactic “sugar”): true = p ∨ ¬p false = ¬true ϕ ∨ ψ = ¬(¬ϕ ∧ ¬ψ) ϕ → ψ = ¬ϕ ∨ ψ ϕ ↔ ψ = (ϕ → ψ) ∧ (ψ → ϕ) Fϕ = trueUϕ (“eventually ϕ”) Gϕ = ¬F¬ϕ (“always ϕ”) ϕRψ = ¬(¬ϕU¬ψ) (“release ψ when ϕ becomes true”)

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 14 / 83

slide-20
SLIDE 20

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

Linear-time temporal logic

Some LTL specifications: Invariants: G¬(crit1 ∧ crit2) (mutual exclusion) G(preset1 ∨ . . . ∨ presetn) (deadlock freedom) Response, recurrence: G(try1 → Fcrit1) (eventual access to critical section) GF¬crit1 (no starvation in critical section) Strong fairness: GF(try1 ∧ ¬crit2) → GFcrit1 (strong fairness)

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 15 / 83

slide-21
SLIDE 21

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

LTL model checking

Is the following decision problem: Input: Kripke structure M, LTL formula ϕ. Question: Does L(M) ⊆ L(ϕ) hold (sometimes written as M | = ϕ)?

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 16 / 83

slide-22
SLIDE 22

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

LTL model checking

Is the following decision problem: Input: Kripke structure M, LTL formula ϕ. Question: Does L(M) ⊆ L(ϕ) hold (sometimes written as M | = ϕ)? Example: Microwave oven L(M) ⊆ L(G(Heat → Close))

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 16 / 83

slide-23
SLIDE 23

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

LTL model checking

Key ideas: L(M) ⊆ L(ϕ) ⇔ L(M) ∩ L(¬ϕ) = ∅ If L(M) ∩ L(¬ϕ) = ∅, we have a counterexample.

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 17 / 83

slide-24
SLIDE 24

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

LTL model checking

Key ideas: L(M) ⊆ L(ϕ) ⇔ L(M) ∩ L(¬ϕ) = ∅ If L(M) ∩ L(¬ϕ) = ∅, we have a counterexample. How do we test if L(M) ∩ L(¬ϕ) = ∅?

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 17 / 83

slide-25
SLIDE 25

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

LTL model checking

Theorem For every ϕ ∈ LTL, there exists an ω-automaton, A, s.t., L(A) = L(ϕ).

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 18 / 83

slide-26
SLIDE 26

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

LTL model checking

Theorem For every ϕ ∈ LTL, there exists an ω-automaton, A, s.t., L(A) = L(ϕ). Corollary We can solve the LTL model checking problem by testing if L(M × A¬ϕ) = ∅.

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 18 / 83

slide-27
SLIDE 27

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

LTL model checking

Theorem For every ϕ ∈ LTL, there exists an ω-automaton, A, s.t., L(A) = L(ϕ). Corollary We can solve the LTL model checking problem by testing if L(M × A¬ϕ) = ∅. Note that, M × A¬ϕ is normally too big to be explicitly computed (but we disregard that fact for now).

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 18 / 83

slide-28
SLIDE 28

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

LTL model checking—ω-automata

Definition An ω-automaton is a five-tuple A = (Σ, Q, Q0, δ, F) where Σ is the input alphabet, Q a finite set of states, Q0 ⊆ Q a distinguished set of initial states, δ : Q → 2Q a transition relation, and F an acceptance condition. A run ρ of A over a word w ∈ Σω is a mapping N0 → Q s.t. ρ(0) ∈ Q0, and ρ(i + 1) ∈ δ(ρ(i), w(i)) for all i ∈ N0.

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 19 / 83

slide-29
SLIDE 29

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

LTL model checking—ω-automata

Generalised B¨ uchi automaton (GBA): F = {F1, . . . , Fn} Fi ⊆ Q is an accepting set. ρ is accepting iff Inf (ρ) ∩ Fi = ∅ for 1 ≤ i ≤ n.

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 20 / 83

slide-30
SLIDE 30

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

LTL model checking—ω-automata

Generalised B¨ uchi automaton (GBA): F = {F1, . . . , Fn} Fi ⊆ Q is an accepting set. ρ is accepting iff Inf (ρ) ∩ Fi = ∅ for 1 ≤ i ≤ n. Definition A word w is accepted by an ω-automaton A iff A has an accepting run over w.

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 20 / 83

slide-31
SLIDE 31

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

LTL model checking—ω-automata

Generalised B¨ uchi automaton (GBA): F = {F1, . . . , Fn} Fi ⊆ Q is an accepting set. ρ is accepting iff Inf (ρ) ∩ Fi = ∅ for 1 ≤ i ≤ n. Definition A word w is accepted by an ω-automaton A iff A has an accepting run over w. B¨ uchi automaton (BA sometimes NBA): F = F. F ⊆ Q is a set of accepting states. ρ is accepting iff Inf (ρ) ∩ F = ∅. Streett automaton: F = {(E1, F1), . . . , (En, Fn)} Ei, Fi ⊆ Q. ρ is accepting iff Inf (ρ) ∩ Fi = ∅ → Inf (ρ) ∩ Ei = ∅ for 1 ≤ i ≤ n.

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 20 / 83

slide-32
SLIDE 32

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

LTL model checking—ω-automata

Recall: An automaton is deterministic iff for all q ∈ Q, and σ ∈ Σ, δ(q, σ) is a singleton; that is, if δ is, in fact, a function.

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 21 / 83

slide-33
SLIDE 33

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

LTL model checking—ω-automata

Recall: An automaton is deterministic iff for all q ∈ Q, and σ ∈ Σ, δ(q, σ) is a singleton; that is, if δ is, in fact, a function. Theorem NBAs are strictly more expressive than DBAs.

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 21 / 83

slide-34
SLIDE 34

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

LTL model checking—ω-automata

Recall: An automaton is deterministic iff for all q ∈ Q, and σ ∈ Σ, δ(q, σ) is a singleton; that is, if δ is, in fact, a function. Theorem NBAs are strictly more expressive than DBAs. Proof. L = L((a + b)∗aω) NBA- but not DBA-definable.

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 21 / 83

slide-35
SLIDE 35

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

LTL model checking—ω-automata

Recall: An automaton is deterministic iff for all q ∈ Q, and σ ∈ Σ, δ(q, σ) is a singleton; that is, if δ is, in fact, a function. Theorem NBAs are strictly more expressive than DBAs. Proof. L = L((a + b)∗aω) NBA- but not DBA-definable. Theorem NBAs can encode every LTL property, but not vice versa.

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 21 / 83

slide-36
SLIDE 36

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

LTL model checking—ω-automata

Recall: An automaton is deterministic iff for all q ∈ Q, and σ ∈ Σ, δ(q, σ) is a singleton; that is, if δ is, in fact, a function. Theorem NBAs are strictly more expressive than DBAs. Proof. L = L((a + b)∗aω) NBA- but not DBA-definable. Theorem NBAs can encode every LTL property, but not vice versa. Proof. “p occurs at least on even positions”

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 21 / 83

slide-37
SLIDE 37

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

LTL-to-automata translation—prerequisites

Definition The syntactic closure of ϕ, cl(ϕ), consists of all subformulas of ψ

  • f ϕ and their negation ¬ψ.

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 22 / 83

slide-38
SLIDE 38

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

LTL-to-automata translation—prerequisites

Definition The syntactic closure of ϕ, cl(ϕ), consists of all subformulas of ψ

  • f ϕ and their negation ¬ψ.

Example: ϕ = aU(¬a ∧ b)

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 22 / 83

slide-39
SLIDE 39

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

LTL-to-automata translation—prerequisites

Definition The syntactic closure of ϕ, cl(ϕ), consists of all subformulas of ψ

  • f ϕ and their negation ¬ψ.

Example: ϕ = aU(¬a ∧ b) cl(ϕ) = {a, b, ¬a, ¬b, ¬a ∧ b, ¬(¬a ∧ b), ϕ, ¬ϕ}

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 22 / 83

slide-40
SLIDE 40

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

LTL-to-automata translation

GBA for ϕ ∈ LTL: Q: elements of cl(ϕ), promised to be true. Q0: states containing ϕ. δ: repr. as graph G = (V , E), where

V all complete subsets of cl(ϕ) (i.e., c ∈ V iff for all ψ ∈ cl(ϕ) either ψ ∈ c or ¬ψ ∈ c, and for all ϕ′ = ψ ∧ ψ′ ∈ cl(ϕ) we have that ϕ′ ∈ c iff ψ ∈ c and ψ′ ∈ c.) (c, d) ∈ E iff

for any ϕ′ = ψUψ′ ∈ cl(ϕ), ϕ′ ∈ c iff either ψ′ ∈ c, or ψ ∈ c and ϕ′ ∈ d; for any ϕ′ = Xψ ∈ cl(ϕ), ϕ′ ∈ c iff ψ ∈ d.

F = {{q ∈ Q | ψUψ′ ∈ q or ψ′ ∈ q} | ψUψ′ ∈ cl(ϕ)}

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 23 / 83

slide-41
SLIDE 41

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

LTL-to-automata translation—complexity considerations

How big is |Q| (resp. Aϕ) at most?

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 24 / 83

slide-42
SLIDE 42

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

LTL-to-automata translation—complexity considerations

How big is |Q| (resp. Aϕ) at most? |cl(ϕ)| = O(|ϕ|).

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 24 / 83

slide-43
SLIDE 43

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

LTL-to-automata translation—complexity considerations

How big is |Q| (resp. Aϕ) at most? |cl(ϕ)| = O(|ϕ|). There are at most 2O(|ϕ|) many possible subsets of cl(ϕ).

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 24 / 83

slide-44
SLIDE 44

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

LTL-to-automata translation—complexity considerations

How big is |Q| (resp. Aϕ) at most? |cl(ϕ)| = O(|ϕ|). There are at most 2O(|ϕ|) many possible subsets of cl(ϕ). That’s why we do LTL model checking as L(M × A¬ϕ) = ∅ rather than L(M) ∩ L(Aϕ) = ∅: Complementation of formula O(1) vs. complementation of automaton ≈ O(2|Q|).

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 24 / 83

slide-45
SLIDE 45

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

LTL-to-automata translation—optimisations

GBA acceptance more difficult to test than NBA acceptance: Turn all states into tuples (q, i), where i is counter. Initially, i = 0; counter counts modulo |F|. i = i + 1 if the ith set Fi of F is reached (i.e., if q not accepting counter doesn’t do anything). Now, we only need to check one accepting set, F0 × {0}.

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 25 / 83

slide-46
SLIDE 46

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

LTL-to-automata translation—optimisations

More formally:

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 26 / 83

slide-47
SLIDE 47

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

LTL-to-automata translation—optimisations

More formally: From GBA A = (Σ, Q, Q0, δ, F = F1, . . . , Fn), we construct NBA B = (Σ, Q′, Q′

0, δ′, F ′):

Q′ = Q × {1, . . . , n} δ′ ⊆ Q′ × Q′, where ((q, i), (s, j)) ∈ δ′ iff (q, s) ∈ δ AND q ∈ Fi and i = j, or q ∈ Fi and j = (i + 1) mod n. Q′

0 = {(q, 0) | q ∈ Q0}

F ′ = {(q, 0) | q ∈ F0}

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 26 / 83

slide-48
SLIDE 48

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

LTL-to-automata translation—optimisations

More formally: From GBA A = (Σ, Q, Q0, δ, F = F1, . . . , Fn), we construct NBA B = (Σ, Q′, Q′

0, δ′, F ′):

Q′ = Q × {1, . . . , n} δ′ ⊆ Q′ × Q′, where ((q, i), (s, j)) ∈ δ′ iff (q, s) ∈ δ AND q ∈ Fi and i = j, or q ∈ Fi and j = (i + 1) mod n. Q′

0 = {(q, 0) | q ∈ Q0}

F ′ = {(q, 0) | q ∈ F0} Edge-labelled vs. state-labelled NBA: Both used; arguably, edge-labelled more common. Easy translation between the two models.

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 26 / 83

slide-49
SLIDE 49

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

LTL-to-automata translation

Some example NBAs: (w/o redundant states) Xa:

true start a true

aUb:

a start a ∧ b start b start true

GFa:

true start a

The temporal formulae inside of states are just used for constructing

  • automata. Later we can merely remember the Boolean formulae that are

satisfied in order to enter a state as above. (You should convince yourself that this is an equivalent representation wrt. the accepted languages!)

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 27 / 83

slide-50
SLIDE 50

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

Important properties of NBAs

Let A be an NBA over Σ. L(A) = / = ∅?

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 28 / 83

slide-51
SLIDE 51

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

Important properties of NBAs

Let A be an NBA over Σ. L(A) = / = ∅? in P (i.e., linear-time algorithm)

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 28 / 83

slide-52
SLIDE 52

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

Important properties of NBAs

Let A be an NBA over Σ. L(A) = / = ∅? in P (i.e., linear-time algorithm) L(A) = / = Σω?

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 28 / 83

slide-53
SLIDE 53

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

Important properties of NBAs

Let A be an NBA over Σ. L(A) = / = ∅? in P (i.e., linear-time algorithm) L(A) = / = Σω? is PSpace-complete

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 28 / 83

slide-54
SLIDE 54

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

Important properties of NBAs

Let A be an NBA over Σ. L(A) = / = ∅? in P (i.e., linear-time algorithm) L(A) = / = Σω? is PSpace-complete L(A) ∩ L(B) NBA representable (closure under intersection)

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 28 / 83

slide-55
SLIDE 55

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

Important properties of NBAs

Let A be an NBA over Σ. L(A) = / = ∅? in P (i.e., linear-time algorithm) L(A) = / = Σω? is PSpace-complete L(A) ∩ L(B) NBA representable (closure under intersection) L(A) NBA representable (closure under complement)

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 28 / 83

slide-56
SLIDE 56

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

Important properties of NBAs

Let A be an NBA over Σ. L(A) = / = ∅? in P (i.e., linear-time algorithm) L(A) = / = Σω? is PSpace-complete L(A) ∩ L(B) NBA representable (closure under intersection) L(A) NBA representable (closure under complement) NBAs are not closed under determinisation, i.e., there exists an NBA, A, for which there is no DBA, B, s.t. L(A) = L(B).

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 28 / 83

slide-57
SLIDE 57

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

Important properties of NBAs

Let A be an NBA over Σ. L(A) = / = ∅? in P (i.e., linear-time algorithm) L(A) = / = Σω? is PSpace-complete L(A) ∩ L(B) NBA representable (closure under intersection) L(A) NBA representable (closure under complement) NBAs are not closed under determinisation, i.e., there exists an NBA, A, for which there is no DBA, B, s.t. L(A) = L(B). Closure under complement and intersection are the prerequisites for what is known as automata-theoretic model checking.

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 28 / 83

slide-58
SLIDE 58

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

Automata theoretic model checking

Given M = (S, s0, R, L) and Aϕ = (Σ, Q, Q0, δ, F), we define the “product automaton” M × Aϕ = (Σ, Q′, Q′

0, δ′, F ′) by

Q′ = {(s, q) ∈ S × Q | L(s) satisfies q} (recall: q contains a Boolean formula!) Q′

0 = {(s0, q) ∈ Q′ | q ∈ Q0}

δ′ = {((s, q), (s′, q′)) ∈ Q′ × Q′ | (s, s′) ∈ R and (q, q′) ∈ δ} F ′ = {(s, q) ∈ Q′ | q ∈ F}

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 29 / 83

slide-59
SLIDE 59

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

Automata theoretic model checking

Given M = (S, s0, R, L) and Aϕ = (Σ, Q, Q0, δ, F), we define the “product automaton” M × Aϕ = (Σ, Q′, Q′

0, δ′, F ′) by

Q′ = {(s, q) ∈ S × Q | L(s) satisfies q} (recall: q contains a Boolean formula!) Q′

0 = {(s0, q) ∈ Q′ | q ∈ Q0}

δ′ = {((s, q), (s′, q′)) ∈ Q′ × Q′ | (s, s′) ∈ R and (q, q′) ∈ δ} F ′ = {(s, q) ∈ Q′ | q ∈ F} What is the accepted language of this automaton?

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 29 / 83

slide-60
SLIDE 60

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

Automata theoretic model checking

Given M = (S, s0, R, L) and Aϕ = (Σ, Q, Q0, δ, F), we define the “product automaton” M × Aϕ = (Σ, Q′, Q′

0, δ′, F ′) by

Q′ = {(s, q) ∈ S × Q | L(s) satisfies q} (recall: q contains a Boolean formula!) Q′

0 = {(s0, q) ∈ Q′ | q ∈ Q0}

δ′ = {((s, q), (s′, q′)) ∈ Q′ × Q′ | (s, s′) ∈ R and (q, q′) ∈ δ} F ′ = {(s, q) ∈ Q′ | q ∈ F} What is the accepted language of this automaton? Lemma L(M × Aϕ) = L(M) ∩ L(Aϕ)

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 29 / 83

slide-61
SLIDE 61

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

Automata theoretic model checking

Recall: we need to test if L(M × Aϕ) = ∅. (How do we do it?)

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 30 / 83

slide-62
SLIDE 62

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

Automata theoretic model checking

Recall: we need to test if L(M × Aϕ) = ∅. (How do we do it?) Theorem L(M × Aϕ) = ∅ ⇔ there is no reachable cycle containing a state from F.

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 30 / 83

slide-63
SLIDE 63

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

Automata theoretic model checking

Recall: we need to test if L(M × Aϕ) = ∅. (How do we do it?) Theorem L(M × Aϕ) = ∅ ⇔ there is no reachable cycle containing a state from F. Polynomial-time algorithm (e.g., Tarjan’s SCC finding alg.) does the job (cf. Knuth Vol. 3)

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 30 / 83

slide-64
SLIDE 64

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

Automata theoretic model checking

Recall: we need to test if L(M × Aϕ) = ∅. (How do we do it?) Theorem L(M × Aϕ) = ∅ ⇔ there is no reachable cycle containing a state from F. Polynomial-time algorithm (e.g., Tarjan’s SCC finding alg.) does the job (cf. Knuth Vol. 3) Corollary LTL model checking is in PTime, if M and Aϕ are given. . . . which is never the case in practice. :-(

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 30 / 83

slide-65
SLIDE 65

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

Detour (I): Tarjan’s algorithm for SCC identification

Idea: Does a forward DFS to visit all nodes once to assign increasing index, and upon returning from the recursive calls, assigns low-indices that point to the node with the smallest index reachable from each respective node. When low-index of a node = index of that node, we have a root of an SCC.

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 31 / 83

slide-66
SLIDE 66

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

Detour (I): Tarjan’s algorithm for SCC identification

Some observations: strongconnect(x) is called

  • nce for every node.

The for-each-loop at most considers each edge twice (to find neighbours of all nodes) (But not all nodes have necessarily an outgoing edge.) That is, runtime of O(|V | + |E|).

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 32 / 83

slide-67
SLIDE 67

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

Detour (II): On-The-Fly Bad-Cycle-Detection

Idea: Often M not given, so one needs to construct M from an abstract model (e.g., code, call it M). Instead of doing it all at once, one can construct M on-the-fly (cf. Vardi et al, CAV’90). Observe, it is easy to obtain initial states (i.e., initial in M and Aϕ) Algorithm proceeds by expanding more states in an “as needed” manner, and looks if a cycle can be found which hosts an accepting state from Aϕ. In practice, there’s a fair chance it will find an accepting cycle before having expanded all nodes of M.

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 33 / 83

slide-68
SLIDE 68

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

Detour (II): On-The-Fly Bad-Cycle-Detection

(Slide shamelessly stolen from Kousha Etessami.)

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 34 / 83

slide-69
SLIDE 69

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

Complexity of LTL model checking

Recall: Input to the LTL model checking problem is a KS, M, and ϕ. The question to be answered is, does L(M) ∩ L(¬ϕ) = ∅ hold? Theorem The LTL model checking problem can be answered in time O(2O(|ϕ|) · |M|) (cf. size of NBA), or in PSpace (but potentially ExpTime; cf. on-the-fly alg.).

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 35 / 83

slide-70
SLIDE 70

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

Complexity of LTL model checking

Recall: Input to the LTL model checking problem is a KS, M, and ϕ. The question to be answered is, does L(M) ∩ L(¬ϕ) = ∅ hold? Theorem The LTL model checking problem can be answered in time O(2O(|ϕ|) · |M|) (cf. size of NBA), or in PSpace (but potentially ExpTime; cf. on-the-fly alg.). The latter explains why model checking works in practice: the NBA can be fixed for most formulae, and the subsequent state-space exploration optimised.

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 35 / 83

slide-71
SLIDE 71

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

Complexity of LTL model checking

Theorem LTL model checking is PSpace-complete. Proof. Hardness: Reduction from LTL satisfiability, which is also PSpace-complete: L(ϕ) = ∅ ⇔ L(ϕ) ∩ Σω = ∅ ⇔ Σω | = ¬ϕ. Membership: Nondeterministic algorithm: Expand NBA

  • n-the-fly (similar to expansion of M earlier) and guess

a path through M, and a state, l, in the NBA which lies on an accepting loop. Each expansion step of the NBA can be done in PTime, and to check whether l is visited again is constant. If guessed path goes through l twice, we know that we have a counterexample.

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 36 / 83

slide-72
SLIDE 72

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

Computation Tree Logic (CTL)

CTL syntax ϕ ::= p ∈ AP | ¬ϕ | ϕ ∧ ϕ | AXϕ | EXϕ | A(ϕUϕ) | E(ϕUϕ)

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 37 / 83

slide-73
SLIDE 73

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

Computation Tree Logic (CTL)

CTL syntax ϕ ::= p ∈ AP | ¬ϕ | ϕ ∧ ϕ | AXϕ | EXϕ | A(ϕUϕ) | E(ϕUϕ) Note, there’s no arbitrary nesting of path quantifiers (cf. CTL∗). For example, you can’t say XAFϕ in CTL. But EFEGϕ is OK.

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 37 / 83

slide-74
SLIDE 74

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

CTL—syntactic sugar and equalities

AXϕ = ¬EX(¬ϕ) EFϕ = E(trueUϕ) AGϕ = ¬EF(¬ϕ) AFϕ = ¬EG(¬ϕ) A(ϕUψ) = ¬E(¬ψU(¬ϕ ∧ ¬ψ)) ∧ ¬EG¬ψ A(ϕRψ) = ¬E(¬ϕU¬ψ) E(ϕRψ) = ¬A(¬ϕU¬ψ)

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 38 / 83

slide-75
SLIDE 75

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

CTL—syntactic sugar and equalities

AXϕ = ¬EX(¬ϕ) EFϕ = E(trueUϕ) AGϕ = ¬EF(¬ϕ) AFϕ = ¬EG(¬ϕ) A(ϕUψ) = ¬E(¬ψU(¬ϕ ∧ ¬ψ)) ∧ ¬EG¬ψ A(ϕRψ) = ¬E(¬ϕU¬ψ) E(ϕRψ) = ¬A(¬ϕU¬ψ) Corollary Any CTL formula can be expressed in terms of ¬, ∨, EX, EU and EG alone.

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 38 / 83

slide-76
SLIDE 76

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

CTL—semantics

CTL semantics: Let M = (S, R, L) be defined as usual; s ∈ S. M, s | = p iff p ∈ L(s) M, s | = ¬ϕ iff M, s | = ϕ is not true M, s | = ϕ ∧ ψ iff M, s | = ϕ and M, s | = ψ M, s | = AXϕ iff for all s → s1, M, s1 | = ϕ M, s | = EXϕ iff there is a s → s1, s.t. M, s1 | = ϕ M, s | = A(ϕUψ) iff for all s1 → s2 → . . . , where s1 = s, there is a sk, s.t. M, sk | = ψ, and M, sj | = ϕ for all sj, where 0 ≤ j < k M, s | = E(ϕUψ) iff there is a . . .

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 39 / 83

slide-77
SLIDE 77

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

CTL—examples

Some CTL specifications: EF(Start ∧ ¬Ready): It is possible to reach a state in which Start but not Ready holds. AG(Req → AFAck): Every req. is eventually answered. AG(AFDeviceEnabled): The device is enabled infinitely often

  • n all paths.

AG(EFRestart): From any state it is possible to reach a state in which Restart holds.

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 40 / 83

slide-78
SLIDE 78

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

CTL model checking—labelling algorithm

“Labelling algorithm”—what it does: Input: A CTL formula, ϕ, and a Kripke structure, M = (S, s0, R, L) over a set AP. Output: A set of formulae, label(s0), that are true in s0 (i.e., M, s0 | = ϕ iff ϕ ∈ label(s)).

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 41 / 83

slide-79
SLIDE 79

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

CTL model checking—labelling algorithm

“Labelling algorithm”—what it does: Input: A CTL formula, ϕ, and a Kripke structure, M = (S, s0, R, L) over a set AP. Output: A set of formulae, label(s0), that are true in s0 (i.e., M, s0 | = ϕ iff ϕ ∈ label(s)). Initially, label(s0) = L(s0); algorithm goes through states, at stage i, CTL subformulae with i − 1 nested temporal

  • perators are processed.

When a formula is processed it is added to the labelling of those states where it is true.

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 41 / 83

slide-80
SLIDE 80

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

CTL model checking—labelling algorithm

By strucutral induction1 (that is, algorithm starts with innermost formulae and works its way “outwards”): Φ = ¬ϕ: label all states with Φ that are not labelled by ϕ. Φ = ϕ ∨ ψ: label all states with Φ that are labelled by either ϕ or ψ. Φ = EXϕ: label all states with Φ that have a successor labelled by ϕ. Φ = E(ϕUψ): find all states labelled by ψ; then work backwards until you hit a state labelled by ϕ; all intermediate states on these paths should be labelled by Φ.

1Only few cases due to earlier corollary! Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 42 / 83

slide-81
SLIDE 81

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

CTL model checking—labelling algorithm

Runs in O(|S| + |R|).

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 43 / 83

slide-82
SLIDE 82

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

CTL model checking—labelling algorithm

Φ = EGϕ slightly more complicated; needs notion of SCC:

First create M′ = (S′, s′

0, R′, L′), where

S′ = {s ∈ S′ | M, s | = ϕ} (i.e., remove all nodes from M, where ϕ does not hold) R′ = R|S′×S′ L′ = L|S′

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 44 / 83

slide-83
SLIDE 83

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

CTL model checking—labelling algorithm

Φ = EGϕ slightly more complicated; needs notion of SCC:

First create M′ = (S′, s′

0, R′, L′), where

S′ = {s ∈ S′ | M, s | = ϕ} (i.e., remove all nodes from M, where ϕ does not hold) R′ = R|S′×S′ L′ = L|S′

Lemma M, s | = EGϕ iff the following two conditions are satisfied:

1 s ∈ S′ 2 There is a path in M′, starting in s, to some node t in some

SCC of graph (S′, R′).

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 44 / 83

slide-84
SLIDE 84

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

CTL model checking—labelling algorithm

Proof.

(⇒) As for 1.: Clearly, s ∈ S′. Now we need to show 2. Let w ′ = uw be a path in M such that ϕ is true in each state. u is the prefix and w the infinite suffix. For w to repeat, it must lie inside a SCC. And since ϕ is true along the path, we have for u and w that they’re both contained in S′ by the construction of M′. (⇐) Every path that in M′ is also a path in M. And if there is a path that loops infinitely through some SCC, and on which ϕ holds, then it is a model for EGϕ. Since the initial state of that path, s ∈ S′ is clearly also in S, the lemma follows.

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 45 / 83

slide-85
SLIDE 85

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

CTL model checking—labelling algorithm

Runs in O(|S′| + |R′|).

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 46 / 83

slide-86
SLIDE 86

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

CTL model checking—labelling algorithm

Since we have at most |ϕ| subformulae, CTL model checking against a Kripke structure takes time O(|ϕ| · (|S| + |R|)). Theorem To decide the CTL model checking problem one only needs an algorithm that runs in PTime.

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 47 / 83

slide-87
SLIDE 87

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

CTL model checking—example

Same Kripke structure we used earlier:

1 Start, Error 2 Close 3 Close, Heat 4 Start, Close, Error 5 Start, Close 6 Start, Close, Heat 7 “start oven” “open door” “reset” “start oven” “warm up” “start cooking” “cook”

, 1 | = AG(Start → AFHeat)? Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 48 / 83

slide-88
SLIDE 88

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

CTL model checking—example

Same Kripke structure we used earlier:

1 Start, Error 2 Close 3 Close, Heat 4 Start, Close, Error 5 Start, Close 6 Start, Close, Heat 7 “start oven” “open door” “reset” “start oven” “warm up” “start cooking” “cook”

, 1 | = AG(Start → AFHeat)?

Observe: AG(Start → AFHeat) equiv. to ¬EF(Start ∧ EG¬Heat) We use EFϕ as shorthand for E(trueUϕ).

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 48 / 83

slide-89
SLIDE 89

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

CTL model checking—example

How the algorithm proceeds:

Let S(ψ) be the set of states in which ψ holds. Initially, S(Start) = {2, 5, 6, 7}, S(¬Heat) = {1, 2, 3, 5, 6}. For S(EG¬Heat) we first find SCCs wrt. ¬Heat.

2not 6, because you can reach 7 from 6, where Heat is true Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 49 / 83

slide-90
SLIDE 90

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

CTL model checking—example

How the algorithm proceeds:

Let S(ψ) be the set of states in which ψ holds. Initially, S(Start) = {2, 5, 6, 7}, S(¬Heat) = {1, 2, 3, 5, 6}. For S(EG¬Heat) we first find SCCs wrt. ¬Heat. I.e., S′ = {1, 2, 3, 5, 6}, and SCC in S′ is {1, 2, 3, 5} = S(EG¬Heat)2

2not 6, because you can reach 7 from 6, where Heat is true Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 49 / 83

slide-91
SLIDE 91

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

CTL model checking—example

How the algorithm proceeds:

Let S(ψ) be the set of states in which ψ holds. Initially, S(Start) = {2, 5, 6, 7}, S(¬Heat) = {1, 2, 3, 5, 6}. For S(EG¬Heat) we first find SCCs wrt. ¬Heat. I.e., S′ = {1, 2, 3, 5, 6}, and SCC in S′ is {1, 2, 3, 5} = S(EG¬Heat)2 S(Start ∧ EG¬Heat)

2not 6, because you can reach 7 from 6, where Heat is true Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 49 / 83

slide-92
SLIDE 92

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

CTL model checking—example

How the algorithm proceeds:

Let S(ψ) be the set of states in which ψ holds. Initially, S(Start) = {2, 5, 6, 7}, S(¬Heat) = {1, 2, 3, 5, 6}. For S(EG¬Heat) we first find SCCs wrt. ¬Heat. I.e., S′ = {1, 2, 3, 5, 6}, and SCC in S′ is {1, 2, 3, 5} = S(EG¬Heat)2 S(Start ∧ EG¬Heat) = {2, 5}. To compute S(EF(Start ∧ EG¬Heat), set T = S(EG¬Heat) and find all states from which states from T can be reached,

2not 6, because you can reach 7 from 6, where Heat is true Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 49 / 83

slide-93
SLIDE 93

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

CTL model checking—example

How the algorithm proceeds:

Let S(ψ) be the set of states in which ψ holds. Initially, S(Start) = {2, 5, 6, 7}, S(¬Heat) = {1, 2, 3, 5, 6}. For S(EG¬Heat) we first find SCCs wrt. ¬Heat. I.e., S′ = {1, 2, 3, 5, 6}, and SCC in S′ is {1, 2, 3, 5} = S(EG¬Heat)2 S(Start ∧ EG¬Heat) = {2, 5}. To compute S(EF(Start ∧ EG¬Heat), set T = S(EG¬Heat) and find all states from which states from T can be reached, i.e., S(EF(Start ∧ EG¬Heat) = S.

2not 6, because you can reach 7 from 6, where Heat is true Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 49 / 83

slide-94
SLIDE 94

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

CTL model checking—example

How the algorithm proceeds:

Let S(ψ) be the set of states in which ψ holds. Initially, S(Start) = {2, 5, 6, 7}, S(¬Heat) = {1, 2, 3, 5, 6}. For S(EG¬Heat) we first find SCCs wrt. ¬Heat. I.e., S′ = {1, 2, 3, 5, 6}, and SCC in S′ is {1, 2, 3, 5} = S(EG¬Heat)2 S(Start ∧ EG¬Heat) = {2, 5}. To compute S(EF(Start ∧ EG¬Heat), set T = S(EG¬Heat) and find all states from which states from T can be reached, i.e., S(EF(Start ∧ EG¬Heat) = S. Finally, S(¬EF(Start ∧ EG¬Heat) = S(EF(Start ∧ EG¬Heat) = ∅.

2not 6, because you can reach 7 from 6, where Heat is true Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 49 / 83

slide-95
SLIDE 95

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

CTL model checking—example

How the algorithm proceeds:

Let S(ψ) be the set of states in which ψ holds. Initially, S(Start) = {2, 5, 6, 7}, S(¬Heat) = {1, 2, 3, 5, 6}. For S(EG¬Heat) we first find SCCs wrt. ¬Heat. I.e., S′ = {1, 2, 3, 5, 6}, and SCC in S′ is {1, 2, 3, 5} = S(EG¬Heat)2 S(Start ∧ EG¬Heat) = {2, 5}. To compute S(EF(Start ∧ EG¬Heat), set T = S(EG¬Heat) and find all states from which states from T can be reached, i.e., S(EF(Start ∧ EG¬Heat) = S. Finally, S(¬EF(Start ∧ EG¬Heat) = S(EF(Start ∧ EG¬Heat) = ∅. Property does not hold. :-(

2not 6, because you can reach 7 from 6, where Heat is true Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 49 / 83

slide-96
SLIDE 96

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

Binary decision diagrams

Popular data structure for compactly and uniquely representing Boolean functions. Efficient algorithms known to manipulate BDDs according to the operations in Boolean logic. Applications: there are many! In our context: to compactly represent Kripke structures.

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 50 / 83

slide-97
SLIDE 97

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

Binary decision diagrams

Let x → y0, y1 be the if-then-else operator defined by x → y0, y1 = (x ∧ y0) ∨ (¬x ∧ y1) All other Boolean operations can be expressed in terms of this

  • perator:

¬x =

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 51 / 83

slide-98
SLIDE 98

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

Binary decision diagrams

Let x → y0, y1 be the if-then-else operator defined by x → y0, y1 = (x ∧ y0) ∨ (¬x ∧ y1) All other Boolean operations can be expressed in terms of this

  • perator:

¬x = (x → 0, 1) x ⇔ y =

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 51 / 83

slide-99
SLIDE 99

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

Binary decision diagrams

Let x → y0, y1 be the if-then-else operator defined by x → y0, y1 = (x ∧ y0) ∨ (¬x ∧ y1) All other Boolean operations can be expressed in terms of this

  • perator:

¬x = (x → 0, 1) x ⇔ y = x → (y → 1, 0), (y → 0, 1) etc.

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 51 / 83

slide-100
SLIDE 100

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

Binary decision diagrams

Let x → y0, y1 be the if-then-else operator defined by x → y0, y1 = (x ∧ y0) ∨ (¬x ∧ y1) All other Boolean operations can be expressed in terms of this

  • perator:

¬x = (x → 0, 1) x ⇔ y = x → (y → 1, 0), (y → 0, 1) etc. Definition The ITE-normal form (INF) is a Boolean expression built entirely from the ITE-operator. (You may have heard of other normal forms.)

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 51 / 83

slide-101
SLIDE 101

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

Binary decision diagrams—how to obtain INF?

Definition Shannon expansion: Given Boolean expression t, t = x → t[1/x], t[0/x] (“Shannon expansion of t wrt. x”). If t contains no variables, it is equivalent to 0 or 1, i.e., in INF. Otherwise, perform Shannon expansion of t wrt. any of its variables x. Since t[0/x] and t[1/x] contain one variable less than t, one can recursively find INFs for both of these new terms; call them t0 and t1. INF for t is thus x → t1, t0.

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 52 / 83

slide-102
SLIDE 102

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

Binary decision diagrams—how to obtain INF?

Theorem Any Boolean expression is equivalent to an expression in INF. Proof. See inductive INF construction.

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 53 / 83

slide-103
SLIDE 103

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

Binary decision diagrams—how to obtain INF?

Example: t = (x1 ⇔ y1) ∧ (x2 ⇔ y2) Perform SE on variables ordered by x1, y1, x2, y2, then t = x1 → t1, t0 t0 = y1 → 0, t00 t1 = y1 → t11, 0 t00 = x2 → t001, t000 t11 = x2 → t111, t110 t000 = y2 → 0, 1 t001 = y2 → 1, 0 t110 = y2 → 0, 1 t111 = y2 → 1, 0

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 54 / 83

slide-104
SLIDE 104

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

Binary decision diagrams—how to obtain BDD?

Example: t = (x1 ⇔ y1) ∧ (x2 ⇔ y2) Corresponding binary decision tree:

(Source: Henrik Reif Andersen’s lecture notes.) Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 55 / 83

slide-105
SLIDE 105

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

Binary decision diagrams—how to obtain BDD?

Consider again: t = x1 → t1, t0 t0 = y1 → 0, t00 t1 = y1 → t11, 0 t00 = x2 → t001, t000 t11 = x2 → t111, t110 t000 = y2 → 0, 1 t001 = y2 → 1, 0 t110 = y2 → 0, 1 t111 = y2 → 1, 0 Note: Instead of t110 we could use t000. Substitute t110 for t000 on RHS of t11.

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 56 / 83

slide-106
SLIDE 106

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

Binary decision diagrams—how to obtain BDD?

t = x1 → t1, t0 t0 = y1 → 0, t00 t1 = y1 → t11, 0 t00 = x2 → t001, t000 t11 = x2 → t111, t000 t000 = y2 → 0, 1 t001 = y2 → 1, 0 t111 = y2 → 1, 0

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 57 / 83

slide-107
SLIDE 107

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

Binary decision diagrams—how to obtain BDD?

t = x1 → t1, t0 t0 = y1 → 0, t00 t1 = y1 → t11, 0 t00 = x2 → t001, t000 t11 = x2 → t001/111, t000 t000 = y2 → 0, 1 t001 = y2 → 1, 0 t111 = y2 → 1, 0

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 58 / 83

slide-108
SLIDE 108

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

Binary decision diagrams—how to obtain BDD?

t = x1 → t1, t0 t0 = y1 → 0, t00 t1 = y1 → t00/11, 0 t00 = x2 → t001, t000 t11 = x2 → t001, t000 t000 = y2 → 0, 1 t001 = y2 → 1, 0

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 59 / 83

slide-109
SLIDE 109

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

Binary decision diagrams—how to obtain BDD?

t = x1 → t1, t0 t0 = y1 → 0, t00 t1 = y1 → t00, 0 t00 = x2 → t001, t000 t000 = y2 → 0, 1 t001 = y2 → 1, 0

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 60 / 83

slide-110
SLIDE 110

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

Binary decision diagrams—how to obtain BDD?

t = x1 → t1, t0 t0 = y1 → 0, t00 t1 = y1 → t00, 0 t00 = x2 → t001, t000 t000 = y2 → 0, 1 t001 = y2 → 1, 0 Let us now view each subexpression as a node of a graph, where 0 and 1 are the

  • nly “terminal” nodes:

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 60 / 83

slide-111
SLIDE 111

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

Binary decision diagrams—how to obtain BDD?

t = x1 → t1, t0 t0 = y1 → 0, t00 t1 = y1 → t00, 0 t00 = x2 → t001, t000 t000 = y2 → 0, 1 t001 = y2 → 1, 0 Let us now view each subexpression as a node of a graph, where 0 and 1 are the

  • nly “terminal” nodes:

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 60 / 83

slide-112
SLIDE 112

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

Binary decision diagrams

Definition A BDD is a rooted, directed acyclic graph (DAG) with

  • ne or two terminal nodes of out-degree zero labeled 0 or 1

and, a set of variable nodes u of out-degree two. The two outgoing edges are given by two functions low(u) and high(u). (In pictures, these are shown as dotted and solid lines, respectively). A variable var(u) is associated with each variable node.

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 61 / 83

slide-113
SLIDE 113

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

Binary decision diagrams

Definition A BDD is ordered (OBDD) if on all paths through the graph the variables respect a given linear order x1 < x2 < . . . < xn. An OBDD is reduced if (uniqueness) no two distinct nodes u and v have the same variable name and low- and high-successor, i.e., var(u) = var(v), low(u) = low(v), high(u) = high(v) ⇒ u = v (no redundancy) no variable node u has identical low- and high-successor, i.e., low(u) = high(u).

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 62 / 83

slide-114
SLIDE 114

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

Binary decision diagrams

Various OBDDs. Which ones are reduced, which ones are not? What Boolean functions are expressed in those?

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 63 / 83

slide-115
SLIDE 115

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

Binary decision diagrams

ROBDDs are canonical.

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 64 / 83

slide-116
SLIDE 116

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

Binary decision diagrams

ROBDDs are canonical. Let f : Bn → B. Nodes u of ROBDD for f inductively define Boolean expressions tu: t0 = 0 t1 = 1 tu = var(u) → thigh(u), tlow(u) Let x1 < . . . < xn be var. ordering, then f u maps (b1, . . . , bn) ∈ Bn to the truth value of tu[b1/x1, . . . , bn/xn].

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 64 / 83

slide-117
SLIDE 117

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

Binary decision diagrams

ROBDDs are canonical. Let f : Bn → B. Nodes u of ROBDD for f inductively define Boolean expressions tu: t0 = 0 t1 = 1 tu = var(u) → thigh(u), tlow(u) Let x1 < . . . < xn be var. ordering, then f u maps (b1, . . . , bn) ∈ Bn to the truth value of tu[b1/x1, . . . , bn/xn]. Theorem For any function f : Bn → B there is exactly one ROBDD u with variable ordering x1 < x2 < . . . < xn s.t. f u = f (x1, . . . , xn).

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 64 / 83

slide-118
SLIDE 118

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

Binary decision diagrams

Proof. By induction (cf. Andersen lecture notes p. 13f.).

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 65 / 83

slide-119
SLIDE 119

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

Binary decision diagrams

What to do with ROBDDs? Let f , g : Bn → B How do you check validity of f if given as ROBDD?

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 66 / 83

slide-120
SLIDE 120

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

Binary decision diagrams

What to do with ROBDDs? Let f , g : Bn → B How do you check validity of f if given as ROBDD? (compare to non-terminal node; O(1) vs coNP for formulae)

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 66 / 83

slide-121
SLIDE 121

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

Binary decision diagrams

What to do with ROBDDs? Let f , g : Bn → B How do you check validity of f if given as ROBDD? (compare to non-terminal node; O(1) vs coNP for formulae) How do you check equivalence of f and g if given as ROBDDs?

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 66 / 83

slide-122
SLIDE 122

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

Binary decision diagrams

What to do with ROBDDs? Let f , g : Bn → B How do you check validity of f if given as ROBDD? (compare to non-terminal node; O(1) vs coNP for formulae) How do you check equivalence of f and g if given as ROBDDs? (compare nodes; O(n) vs coNP for formulae)

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 66 / 83

slide-123
SLIDE 123

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

Binary decision diagrams—variable orderings

Consider ROBDD for (x1 ⇔ y1) ∧ (x2 ⇔ y2) . . . but different var. ordering of x1 < x2 < y1 < y2:

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 67 / 83

slide-124
SLIDE 124

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

Binary decision diagrams—variable orderings

Consider ROBDD for (x1 ⇔ y1) ∧ (x2 ⇔ y2) . . . but different var. ordering of x1 < x2 < y1 < y2: vs

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 67 / 83

slide-125
SLIDE 125

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

ROBDDs—construction

We saw how to construct OBDD, but how to construct ROBBD?

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 68 / 83

slide-126
SLIDE 126

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

ROBDDs—construction

We saw how to construct OBDD, but how to construct ROBBD?

“Construct OBDD and reduce it until you can’t anymore.”

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 68 / 83

slide-127
SLIDE 127

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

ROBDDs—construction

We saw how to construct OBDD, but how to construct ROBBD?

“Construct OBDD and reduce it until you can’t anymore.” Reduce OBDD on-the-fly (i.e., during construction).

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 68 / 83

slide-128
SLIDE 128

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

ROBDDs—construction

Let T : u → (i, l, h) be a table which maps every node to an index, a low- and high-index. Let H : (i, l, h) → u be the inverse of T to look up nodes (i.e., T(u) = (i, l, h) iff H(i, l, h) = u)

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 69 / 83

slide-129
SLIDE 129

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

ROBDDs—construction

Let T : u → (i, l, h) be a table which maps every node to an index, a low- and high-index. Let H : (i, l, h) → u be the inverse of T to look up nodes (i.e., T(u) = (i, l, h) iff H(i, l, h) = u)

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 69 / 83

slide-130
SLIDE 130

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

ROBDDs—construction

Lookup a node i in H and return it, or create new one and return handle to it: (MK[T, H] means that MK uses data structures T and H.)

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 70 / 83

slide-131
SLIDE 131

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

ROBDDs—construction

Lookup a node i in H and return it, or create new one and return handle to it: (MK[T, H] means that MK uses data structures T and H.) What is the running time of MK?

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 70 / 83

slide-132
SLIDE 132

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

ROBDDs—construction

Lookup a node i in H and return it, or create new one and return handle to it: (MK[T, H] means that MK uses data structures T and H.) What is the running time of MK? Can be implemented in O(1) using hash tables.

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 70 / 83

slide-133
SLIDE 133

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

ROBDDs—construction

Input: t be Boolean expression of n var (with fixed var. ordering). Output: ROBBD of t.

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 71 / 83

slide-134
SLIDE 134

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

ROBDDs—construction

Input: t be Boolean expression of n var (with fixed var. ordering). Output: ROBBD of t.

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 71 / 83

slide-135
SLIDE 135

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

ROBDDs—construction

Input: t be Boolean expression of n var (with fixed var. ordering). Output: ROBBD of t. What is the running time of BUILD?

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 71 / 83

slide-136
SLIDE 136

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

ROBDDs—construction

Input: t be Boolean expression of n var (with fixed var. ordering). Output: ROBBD of t. What is the running time of BUILD? It’s bad: O(2n).

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 71 / 83

slide-137
SLIDE 137

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

ROBDDs—construction

Intuitive explanation for bad running time: BUILD callgraph on (x1 ⇔ x2) ∨ x3: Can we do better?

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 72 / 83

slide-138
SLIDE 138

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

ROBDDs—construction

Intuitive explanation for bad running time: BUILD callgraph on (x1 ⇔ x2) ∨ x3: Can we do better? One can optimise using divide & conquer, etc. But worst-case no.

  • f calls unavoidable as validity is O(1), yet in coNP for formulae.

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 72 / 83

slide-139
SLIDE 139

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

ROBDDs—Boolean operations

Uses Shannon expansion: t = x → t[1/x], t[0/x] (x → t1, t2) op (x → t′

1, t′ 2) = x → t1 op t′ 1, t2 op t′ 2

(x → t1, t2) op t3 = x → t1 op t3, t2 op t3 Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 73 / 83

slide-140
SLIDE 140

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

ROBDDs—SatCount

Task: Count satisfying assignments for ROBBD u Idea: Given some node, u . . . determine #sat(low(u)) and #sat(high(u)) first; let there be n ≥ 0 nodes in between u and low(u) (resp. high(u)); these n nodes can be assigned truth values arbitrality, but add 2n more assignments in total, respectively.

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 74 / 83

slide-141
SLIDE 141

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

ROBDDs—SatCount

Task: Count satisfying assignments for ROBBD u Idea: Given some node, u . . . determine #sat(low(u)) and #sat(high(u)) first; let there be n ≥ 0 nodes in between u and low(u) (resp. high(u)); these n nodes can be assigned truth values arbitrality, but add 2n more assignments in total, respectively.

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 74 / 83

slide-142
SLIDE 142

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

ROBDDs—AnySat & AllSat

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 75 / 83

slide-143
SLIDE 143

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

ROBDDs—algorithm running times

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 76 / 83

slide-144
SLIDE 144

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

Symbolic model checking—why?/what?

Typically, one doesn’t directly model system in terms of Kripke structure.

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 77 / 83

slide-145
SLIDE 145

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

Symbolic model checking—why?/what?

Typically, one doesn’t directly model system in terms of Kripke structure. Translation of system model M → M (cf. on-the-fly alg.)

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 77 / 83

slide-146
SLIDE 146

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

Symbolic model checking—why?/what?

Typically, one doesn’t directly model system in terms of Kripke structure. Translation of system model M → M (cf. on-the-fly alg.) However, M can be huge! (State explosion.)

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 77 / 83

slide-147
SLIDE 147

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

Symbolic model checking—why?/what?

Typically, one doesn’t directly model system in terms of Kripke structure. Translation of system model M → M (cf. on-the-fly alg.) However, M can be huge! (State explosion.) Represent states/transition system of M symbolically using ROBDDs (i.e., one ROBDD encodes multiple states/transitions of M).

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 77 / 83

slide-148
SLIDE 148

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

Symbolic model checking—why?/what?

Typically, one doesn’t directly model system in terms of Kripke structure. Translation of system model M → M (cf. on-the-fly alg.) However, M can be huge! (State explosion.) Represent states/transition system of M symbolically using ROBDDs (i.e., one ROBDD encodes multiple states/transitions of M). Expand state space inductively in a stepwise manner using ROBDD operations.

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 77 / 83

slide-149
SLIDE 149

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

Symbolic model checking—basic idea

For example:

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 78 / 83

slide-150
SLIDE 150

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

Symbolic model checking—basic idea

For example: Transition s1 → s2 is a ∧ b ∧ a′ ∧ ¬b′

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 78 / 83

slide-151
SLIDE 151

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

Symbolic model checking—basic idea

For example: Transition s1 → s2 is a ∧ b ∧ a′ ∧ ¬b′ Whole TS: (a ∧ b ∧ a′ ∧ ¬b′) ∨ (a ∧ ¬b ∧ a′ ∧ ¬b′) ∨ (a ∧ ¬b ∧ a′ ∧ b′)

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 78 / 83

slide-152
SLIDE 152

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

Symbolic model checking—example

Milner’s scheduler: ti = 1 iff task i is running hi = 1 iff task i has token ci = 1 iff task i − 1 has released token (and i not picked it up yet) Scheduler job: start at task 1, and schedule all tasks such that all are executed. Tasks can terminate in any order.

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 79 / 83

slide-153
SLIDE 153

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

Symbolic model checking—example

Each task can be described as an individual state-transition system over variables ti, hi, ci, respectively. First, formalise behaviour:

if ci = 1 ∧ ti = 0 then ti, ci, hi := 1, 0, 1 if hi = 1 then c(i

mod N)+1, hi := 1, 0

S subset of unprimed vars. Useful to state something about vars that changed: unchangedS =

  • x∈S

x = x′ (Or, assignedS′ = unchanged

x\S′, i.e., all vars not in S′ are

unchanged.)

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 80 / 83

slide-154
SLIDE 154

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

Symbolic model checking—example

We can now define Pi, the transitions of task i over the vars x, x′ as: Pi = (ci ∧ ¬ti ∧ t′

i ∧ ¬c′ i ∧ h′ i ∧ assigned{ci,ti,hi})

∨(hi ∧ c′

(i mod N)+1 ∧ ¬h′ i ∧ assigned{(ci mod N)+1,hi})

Termination of task: Ei = ti ∧ ¬t′

i ∧ assigned{ti}

All possible transitions: T = P1 ∨ . . . ∨ Pn ∨ E1 ∨ . . . ∨ En Initial state (only c1 has token): I = ¬ t ∧ ¬ h ∧ c1 ∧ ¬c2 ∧ . . . ∧ ¬cN

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 81 / 83

slide-155
SLIDE 155

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

Symbolic model checking—example

We can now start asking questions like Is it the case that all reachable states only ever have one token? Is task ti always scheduled after ti−1? Deadlock: can we reach a state where no more transitions can be taken? . . .

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 82 / 83

slide-156
SLIDE 156

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

Symbolic model checking—example

We can now start asking questions like Is it the case that all reachable states only ever have one token? Is task ti always scheduled after ti−1? Deadlock: can we reach a state where no more transitions can be taken? . . . Need to compute predicate over the unprimed vars, R, characterising exactly the set of states reachable from I.

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 82 / 83

slide-157
SLIDE 157

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

Symbolic model checking—how to compute R

Some observations: R needs to satisfiy I or within finite number of transitions can be reached from I.

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 83 / 83

slide-158
SLIDE 158

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

Symbolic model checking—how to compute R

Some observations: R needs to satisfiy I or within finite number of transitions can be reached from I. Suggests iterative process: R0, R1, . . .

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 83 / 83

slide-159
SLIDE 159

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

Symbolic model checking—how to compute R

Some observations: R needs to satisfiy I or within finite number of transitions can be reached from I. Suggests iterative process: R0, R1, . . . Let R0 = 0 and compute Rk+1 as disjunction of I and the set

  • f states reachable from Rk.

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 83 / 83

slide-160
SLIDE 160

Introduction LTL model checking CTL model checking Binary decision diagrams Symbolic model checking

Symbolic model checking—how to compute R

Some observations: R needs to satisfiy I or within finite number of transitions can be reached from I. Suggests iterative process: R0, R1, . . . Let R0 = 0 and compute Rk+1 as disjunction of I and the set

  • f states reachable from Rk.

Andreas Bauer NICTA & ANU COMP4600 Advanced algorithms: Algorithms for verification 83 / 83