ch6-computation tree logic.ppt - sharif university of...

114
Chapter 6: Computation Tree Logic Prof. Ali Movaghar Verification of Reactive Systems Spring 2012

Upload: others

Post on 19-Jun-2020

7 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Ch6-Computation Tree Logic.ppt - Sharif University of ...ce.sharif.edu/courses/90-91/2/ce665-1/resources/root/Lecture Notes/… · Chapter 6: Computation Tree Logic Prof. Ali Movaghar

Chapter 6:Computation Tree Logic

Prof. Ali MovagharVerification of Reactive Systems

Spring 2012

Page 2: Ch6-Computation Tree Logic.ppt - Sharif University of ...ce.sharif.edu/courses/90-91/2/ce665-1/resources/root/Lecture Notes/… · Chapter 6: Computation Tree Logic Prof. Ali Movaghar

Outline

� We introduce Computation Tree Logic (CTL), a branching temporal logic for specifying system properties.

A comparison to LTL based on expressiveness

2

� A comparison to LTL based on expressiveness is provided.

� The chapter concludes with an extension called CTL* which subsumes both CTL and LTL.

Page 3: Ch6-Computation Tree Logic.ppt - Sharif University of ...ce.sharif.edu/courses/90-91/2/ce665-1/resources/root/Lecture Notes/… · Chapter 6: Computation Tree Logic Prof. Ali Movaghar

Branching Time vs. Linear Time

� In Linear time at each moment of time there is only one possible successor state and thus each time moment has a unique and thus each time moment has a unique possible future

� We can state properties over all possible computations that start in a state,

� but not easily about some of such computations

3

Page 4: Ch6-Computation Tree Logic.ppt - Sharif University of ...ce.sharif.edu/courses/90-91/2/ce665-1/resources/root/Lecture Notes/… · Chapter 6: Computation Tree Logic Prof. Ali Movaghar

Branching Time vs. Linear Time (cont.)

� Sometimes we can overcome these problems:

� To check whether there exists some ϕ

∀ ϕ

� To check whether there exists some computation starting in s that satisfies ϕwe may check whether s |= ∀¬ϕ

4

Page 5: Ch6-Computation Tree Logic.ppt - Sharif University of ...ce.sharif.edu/courses/90-91/2/ce665-1/resources/root/Lecture Notes/… · Chapter 6: Computation Tree Logic Prof. Ali Movaghar

Branching Time vs. Linear Time (cont.)

� But sometimes we cannot:

� The property “for every computation it is always possible to return to the initial always possible to return to the initial state” cannot be stated or checked by LTL.

� Although it can be checked by a stronger property

� We may require a computation to alwaysreturn to the initial state: s |= ∀□◊start

5

Page 6: Ch6-Computation Tree Logic.ppt - Sharif University of ...ce.sharif.edu/courses/90-91/2/ce665-1/resources/root/Lecture Notes/… · Chapter 6: Computation Tree Logic Prof. Ali Movaghar

Branching Time vs. Linear Time (cont.)

� We could solve this Problem if we could write the property:

� ∀□∃◊ start: in any state (□) of any possible ∀ ∃

� ∀□∃◊ start: in any state (□) of any possible computation (∀), there is a possibility (∃) to eventually return to the start state (◊start)(This is actually a CTL property)

� But this not a valid nesting of an LTL property

6

Page 7: Ch6-Computation Tree Logic.ppt - Sharif University of ...ce.sharif.edu/courses/90-91/2/ce665-1/resources/root/Lecture Notes/… · Chapter 6: Computation Tree Logic Prof. Ali Movaghar

Branching Time vs. Linear Time (cont.)

� Branching time refers to the fact that at each moment there may be several different possible futures.different possible futures.

� Instead of a sequence of states(A path) what we have here is a Tree of states.

� The tree rooted at state s represents all possible infinite computations in the transition system that start in s.

7

Page 8: Ch6-Computation Tree Logic.ppt - Sharif University of ...ce.sharif.edu/courses/90-91/2/ce665-1/resources/root/Lecture Notes/… · Chapter 6: Computation Tree Logic Prof. Ali Movaghar

Computation Tree Logic: Syntax (State formulae)

� CTL has a two-stage syntax:

� CTL state formulae

� are formed over the set AP of atomic � are formed over the set AP of atomic proposition according to the following grammar:

Φ ::= true | a | Φ1∧Φ2 | ¬Φ | ∃ϕ | ∀ϕ

where a ∈ AP and ϕ is a path formula

� Note how every path formula is preceded by a quantifier

8

Page 9: Ch6-Computation Tree Logic.ppt - Sharif University of ...ce.sharif.edu/courses/90-91/2/ce665-1/resources/root/Lecture Notes/… · Chapter 6: Computation Tree Logic Prof. Ali Movaghar

Computation Tree Logic: Syntax (Path formulae)

� CTL path formulae

� are formed according to the following grammar:

ϕ ::= Φ | Φ UΦϕ ::= Φ | Φ1UΦ2

where Φ, Φ1 and Φ2 are state formulae

(From now on, capital greek letters denote state

formulae, and the small ones denote path formulae)

� Path formulae are as in LTL built by the next-step and until operators, but they must not be combined with Boolean connectives 9

Page 10: Ch6-Computation Tree Logic.ppt - Sharif University of ...ce.sharif.edu/courses/90-91/2/ce665-1/resources/root/Lecture Notes/… · Chapter 6: Computation Tree Logic Prof. Ali Movaghar

Computation Tree Logic: Deriving the Temporal Modalities

� eventually:

� ∃◊Φ = ∃(true U Φ) “Φ holds potentially”

� ∀◊Φ = ∀(true U Φ) “Φ is inevitable”

∃ ∃

� ∀◊Φ = ∀(true U Φ) “Φ is inevitable”

� always:

� ∃□Φ = ¬∀◊¬Φ “potentially always Φ”

� ∀□Φ = ¬∃◊¬Φ “invariantly Φ”

10

Page 11: Ch6-Computation Tree Logic.ppt - Sharif University of ...ce.sharif.edu/courses/90-91/2/ce665-1/resources/root/Lecture Notes/… · Chapter 6: Computation Tree Logic Prof. Ali Movaghar

Computation Tree Logic: Deriving the Temporal Modalities (Cont.)

� “always” Φ cannot be obtained from the equation □Φ = ¬◊¬Φ as in LTL, since

propositional logic operators cannot be propositional logic operators cannot be applied to path formulae.

� We should exploit the duality of existential and universal quantification:

� ∃□Φ is not defined as ∃¬◊¬Φ, but rather as ¬∀◊¬Φ

11

Page 12: Ch6-Computation Tree Logic.ppt - Sharif University of ...ce.sharif.edu/courses/90-91/2/ce665-1/resources/root/Lecture Notes/… · Chapter 6: Computation Tree Logic Prof. Ali Movaghar

Computation Tree Logic: Syntax

� Example 6.3.:

� The mutual exclusion property is described in CTL by the formula:

∀ ∨

∀ ∀

described in CTL by the formula:

∀□(¬crit1 ∨ ¬crit2)

� CTL formulae of the form ∀□∀◊Φ

expresses that Φ is infinitely often true on all paths thus the CTL formula (∀□∀◊crit1) ∧ (∀□∀◊crit2) specifies the

Liveness property12

Page 13: Ch6-Computation Tree Logic.ppt - Sharif University of ...ce.sharif.edu/courses/90-91/2/ce665-1/resources/root/Lecture Notes/… · Chapter 6: Computation Tree Logic Prof. Ali Movaghar

Computation Tree Logic: Syntax (Cont.)

� Example 6.3.

� “∀□∃◊ start” expresses that in every

reachable system state it is possible to

∀ ∃

reachable system state it is possible to return to the starting state(s).

13

Page 14: Ch6-Computation Tree Logic.ppt - Sharif University of ...ce.sharif.edu/courses/90-91/2/ce665-1/resources/root/Lecture Notes/… · Chapter 6: Computation Tree Logic Prof. Ali Movaghar

CTL Semantics: Satisfaction Relation

� Given a transition system TS = (S, Act,→, I,AP, L), the semantics of CTL

formulae is defined by two satisfaction formulae is defined by two satisfaction relations (both denoted by |=TS , or briefly |=): one for the state formulae and one for the path formulae.

14

Page 15: Ch6-Computation Tree Logic.ppt - Sharif University of ...ce.sharif.edu/courses/90-91/2/ce665-1/resources/root/Lecture Notes/… · Chapter 6: Computation Tree Logic Prof. Ali Movaghar

CTL Semantics: Satisfaction Relation

� The satisfaction relation |= is defined for state formulae by:

15

Page 16: Ch6-Computation Tree Logic.ppt - Sharif University of ...ce.sharif.edu/courses/90-91/2/ce665-1/resources/root/Lecture Notes/… · Chapter 6: Computation Tree Logic Prof. Ali Movaghar

CTL Semantics: Satisfaction Relation

� For path π, the satisfaction relation |= for path formulae is defined by:

16

Page 17: Ch6-Computation Tree Logic.ppt - Sharif University of ...ce.sharif.edu/courses/90-91/2/ce665-1/resources/root/Lecture Notes/… · Chapter 6: Computation Tree Logic Prof. Ali Movaghar

CTL Semantics: Semantics for Transition Systems

� Given a transition system TS, the satisfaction set SatTS(Φ), or briefly Sat(Φ), for CTL-state formula Φ is defined by:for CTL-state formula Φ is defined by:

� Sat(Φ) = {s ∈ S| s Φ}

� The transition system TS satisfies CTL formula Φ if and only if Φ holds in all initial states of TS:

� TS |= Φ if and only if ∀s0 ∈ I. s0 |= Φ.

� This is equivalent to I ⊆ Sat(Φ)17

Page 18: Ch6-Computation Tree Logic.ppt - Sharif University of ...ce.sharif.edu/courses/90-91/2/ce665-1/resources/root/Lecture Notes/… · Chapter 6: Computation Tree Logic Prof. Ali Movaghar

CTL Semantics: Semantics derivation

� For path fragment π = s0 s1 s2 … , The semantics of the derived path operator “eventually” is:

∃ ∀

“eventually” is:

� π |= ◊Φ iff sj |= Φ for some j ≥ 0

� As we know, ∃□Φ = ¬∀◊(¬Φ), from which

we can derive:

� s |= ¬∀◊(¬Φ) iff ¬(∀ π ∈ Paths(s). π |= ◊(¬Φ)), so:

� s |= ∃□Φ iff ∃π ∈ Paths(s). π[j] |= Φ for all j>=0 18

Page 19: Ch6-Computation Tree Logic.ppt - Sharif University of ...ce.sharif.edu/courses/90-91/2/ce665-1/resources/root/Lecture Notes/… · Chapter 6: Computation Tree Logic Prof. Ali Movaghar

CTL Semantics: Semantics derivation (Cont.)

� Therefore, Φ can be understood as a CTL path formula with the semantics:

� π = s0 s1 s2 … |= □Φ if and only if sj |= Φ � π = s0 s1 s2 … |= □Φ if and only if sj |= Φ

for all j ≥ 0

� Read Example 6.6

19

Page 20: Ch6-Computation Tree Logic.ppt - Sharif University of ...ce.sharif.edu/courses/90-91/2/ce665-1/resources/root/Lecture Notes/… · Chapter 6: Computation Tree Logic Prof. Ali Movaghar

Computation Tree Logic: Semantics

� Example 6.7.: Consider the LTS below with the set of propositions AP={a,b}

� TS |= ∃◊(∃□a)

� TS |= ∃(aU(¬a ∧ ∀(¬aUb)))

(The little graphs show states where the leading formulae hold) 20

Page 21: Ch6-Computation Tree Logic.ppt - Sharif University of ...ce.sharif.edu/courses/90-91/2/ce665-1/resources/root/Lecture Notes/… · Chapter 6: Computation Tree Logic Prof. Ali Movaghar

Computation Tree Logic: Semantics

� Infinitely Often: We are going to prove the following:

� if s |= ∀□∀◊a then ∀π ∈ Paths(s).π[i] |= a � if s |= ∀□∀◊a then ∀π ∈ Paths(s).π[i] |= a

for infinitely many i� The reverse of this Property is also true, as proved

in Remark 6.8.

� Let s be a state, such that s |= ∀□∀◊a

� We show that every infinite path fragment πstarting in s passes through an a-state infinitely often

21

Page 22: Ch6-Computation Tree Logic.ppt - Sharif University of ...ce.sharif.edu/courses/90-91/2/ce665-1/resources/root/Lecture Notes/… · Chapter 6: Computation Tree Logic Prof. Ali Movaghar

Computation Tree Logic: Semantics (Cont.)

� From s |= ∀□∀◊a we have π |= □∀◊a

� Let π = s0 s1 s2 . . . ∈ Paths(s) and j ≥ 0. We

demonstrate that there exists an index i ≥ j with

s |= a

si |= a

� So, for sj we have sj |= ∀◊a

� π[j …] = sj sj+1 … ∈ Paths(sj)

Hence for all j we have:

sj sj+1 sj+2 … |= ◊a

Which means there exists an i for which si |= a holds

� We can conclude that path π visits an a-state infinitely often. 22

Page 23: Ch6-Computation Tree Logic.ppt - Sharif University of ...ce.sharif.edu/courses/90-91/2/ce665-1/resources/root/Lecture Notes/… · Chapter 6: Computation Tree Logic Prof. Ali Movaghar

Computation Tree Logic: Semantics (Weak Until)

� The weak-until operator in CTL cannot be defined directly starting from the LTL definition ϕWψ = (ϕUψ) ∨ (□ϕ)LTL definition ϕWψ = (ϕUψ) ∨ (□ϕ)

since it does not yield a syntactically correct CTL formula.

� It should be defined using the LTL equivalence law

ϕWψ = ¬((ϕ∧¬ψ)U (¬ϕ∧¬ψ))23

Page 24: Ch6-Computation Tree Logic.ppt - Sharif University of ...ce.sharif.edu/courses/90-91/2/ce665-1/resources/root/Lecture Notes/… · Chapter 6: Computation Tree Logic Prof. Ali Movaghar

W Computation Tree Logic: Semantics (Weak Until Cont.)

� The weak-until operator can be defined in CTL by:

� ∃(ΦWΨ) = ¬∀((Φ∧¬Ψ)U(¬Φ∧¬Ψ))

∀ ∃ ∧ ∧

� ∃(ΦWΨ) = ¬∀((Φ∧¬Ψ)U(¬Φ∧¬Ψ))

� ∀(ΦWΨ) = ¬∃((Φ∧¬Ψ)U(¬Φ∧¬Ψ))

� So, for ∃(ΦWΨ) we can say that:

� π |= ΦWΨ iff π |= ΦUΨ or π |= □(Φ∧¬Ψ),

� Or π |= ΦWΨ iff π |= ΦUΨ or π |= □Φ.

� Which yields: ∃(ΦWΨ) = ∃(ΦUΨ) ∨ ∃□Φ24

Page 25: Ch6-Computation Tree Logic.ppt - Sharif University of ...ce.sharif.edu/courses/90-91/2/ce665-1/resources/root/Lecture Notes/… · Chapter 6: Computation Tree Logic Prof. Ali Movaghar

Computation Tree Logic: Semantics (Negation)

� It is possible that the statements TS|=Φ and TS |= ¬Φ both hold

� Because of the fact that initial states are

∃ϕ ∃ ∈ ϕ

� Because of the fact that initial states are not necessarily unique

� TS |≠ ¬∃ϕ iff ∃π ∈ Paths(TS).(π |= ϕ)

� Thus the statement TS |≠¬∃ϕ holds if

and only if there exists an initial state s0∈ I with s0 |≠ ¬∃ϕ, (i.e. s0 |= ∃ϕ)

25

Page 26: Ch6-Computation Tree Logic.ppt - Sharif University of ...ce.sharif.edu/courses/90-91/2/ce665-1/resources/root/Lecture Notes/… · Chapter 6: Computation Tree Logic Prof. Ali Movaghar

Computation Tree Logic: Semantics (Negation Cont.)

� On the other hand, TS |= ∃ϕ requires that s0 |= ∃ϕ for all s0 ∈ I∃ϕ ∈

� In the above figure we have that both TS |≠¬∃□a and TS |≠ ∃□a hold

26

Page 27: Ch6-Computation Tree Logic.ppt - Sharif University of ...ce.sharif.edu/courses/90-91/2/ce665-1/resources/root/Lecture Notes/… · Chapter 6: Computation Tree Logic Prof. Ali Movaghar

CTL Semantics: Transition Systems with Terminal States

� For a finite maximal path fragment π = s0 s1 s2

… sn of length n, sn is a terminal state:

� s |= ∀false iff s is a terminal state. Furthermore:

27

Page 28: Ch6-Computation Tree Logic.ppt - Sharif University of ...ce.sharif.edu/courses/90-91/2/ce665-1/resources/root/Lecture Notes/… · Chapter 6: Computation Tree Logic Prof. Ali Movaghar

Computation Tree Logic: Equivalence of CTL Formulae

� CTL formulae Φ and Ψ are called equivalent whenever for any state s it holds that s |= Φ if and only if s |= Ψholds that s |= Φ if and only if s |= Ψ

� Definition: CTL formulae Φ and Ψ (over AP) are called equivalent, denoted Φ ≡ Ψ, if Sat(Φ) = Sat(Ψ) for all

transition systems TS over AP.

Recall that the notion of CTL Formula is used for a CTL state formula 28

Page 29: Ch6-Computation Tree Logic.ppt - Sharif University of ...ce.sharif.edu/courses/90-91/2/ce665-1/resources/root/Lecture Notes/… · Chapter 6: Computation Tree Logic Prof. Ali Movaghar

Computation Tree Logic: Equivalence of CTL Formulae

� Useful equivalency Rules:� Dulaity laws:

29

Page 30: Ch6-Computation Tree Logic.ppt - Sharif University of ...ce.sharif.edu/courses/90-91/2/ce665-1/resources/root/Lecture Notes/… · Chapter 6: Computation Tree Logic Prof. Ali Movaghar

Equivalence of CTL Formulae (Cont.)� Expansion Laws:

� ∃(ϕUψ) is equivalent to the fact that the current state either satisfies ψ, or it satisfies ϕ, and for some direct successor state, ∃(ϕUψ) holds

30

Page 31: Ch6-Computation Tree Logic.ppt - Sharif University of ...ce.sharif.edu/courses/90-91/2/ce665-1/resources/root/Lecture Notes/… · Chapter 6: Computation Tree Logic Prof. Ali Movaghar

Equivalence of CTL Formulae (Cont.)

� Distributive Laws:

31

Page 32: Ch6-Computation Tree Logic.ppt - Sharif University of ...ce.sharif.edu/courses/90-91/2/ce665-1/resources/root/Lecture Notes/… · Chapter 6: Computation Tree Logic Prof. Ali Movaghar

Computation Tree Logic: Normal Forms

� The basic operators ∃, ∃U, and ∀U

would have been sufficient to define the syntax of CTL. Although by the

∃ ∃ ∀

syntax of CTL. Although by the following definition we could omit all the universal quantifiers as well.

32

Page 33: Ch6-Computation Tree Logic.ppt - Sharif University of ...ce.sharif.edu/courses/90-91/2/ce665-1/resources/root/Lecture Notes/… · Chapter 6: Computation Tree Logic Prof. Ali Movaghar

CTL Normal Forms: Existential Normal Form

� Defintion: For a ∈ AP, the set of CTL

state formulae in existential normal form (ENF, for short) is given by:

∧ ∃ ∃

form (ENF, for short) is given by:� Φ ::= true | a | Φ1 ∧Φ2 | ¬Φ | ∃Φ | ∃(Φ1 UΦ2) |

∃□Φ.

� Theorem 6.14: For each CTL formula there exists an equivalent CTL formula in ENF

33

Page 34: Ch6-Computation Tree Logic.ppt - Sharif University of ...ce.sharif.edu/courses/90-91/2/ce665-1/resources/root/Lecture Notes/… · Chapter 6: Computation Tree Logic Prof. Ali Movaghar

CTL Normal Forms: Positive Normal Form

� Definition: The set of CTL state formulae in positive normal form (PNF, for short) is given by:

∧ ∨

∃ϕ ∀ϕ

given by:

� Φ ::= true | false | a | ¬a | Φ1∧Φ2 | Φ1 ∨

Φ2 | ∃ϕ | ∀ϕ

� where a ∈ AP and the path formulae are

given by

� ϕ ::= Φ | Φ1UΦ2 | Φ1WΦ2 .

� Theorem 6.16: For each CTL formula there exists an equivalent CTL formula in PNF. 34

Page 35: Ch6-Computation Tree Logic.ppt - Sharif University of ...ce.sharif.edu/courses/90-91/2/ce665-1/resources/root/Lecture Notes/… · Chapter 6: Computation Tree Logic Prof. Ali Movaghar

CTL Normal Forms: Release Operator

� In the rules for ∀U and ∃U the number of

occurrences of Ψ (and Φ) is doubled, the length of an equivalent CTL formula may be exponentially longer than the original CTL exponentially longer than the original CTL formula.

� This exponential blowup can be avoided by using the release operator, which in CTL can be defined by:

� ∃(Φ R Ψ) = ¬∀((¬Φ)U(¬Ψ))

� ∀(Φ R Ψ) = ¬∃((¬Φ)U(¬Ψ))35

Page 36: Ch6-Computation Tree Logic.ppt - Sharif University of ...ce.sharif.edu/courses/90-91/2/ce665-1/resources/root/Lecture Notes/… · Chapter 6: Computation Tree Logic Prof. Ali Movaghar

Expressiveness of CTL vs. LTL

� There are properties that one can express in CTL, but that cannot be expressed in LTL, and vice versa

� Hence, the logics CTL and LTL are � Hence, the logics CTL and LTL are incomparable according to their expressiveness.

� Definition: CTL formula Φ and LTL formula ϕ(both over AP) are equivalent, denoted Φ ≡ ϕ,

if for any transition system TS over AP:

� TS |= Φ if and only if TS |= ϕ36

Page 37: Ch6-Computation Tree Logic.ppt - Sharif University of ...ce.sharif.edu/courses/90-91/2/ce665-1/resources/root/Lecture Notes/… · Chapter 6: Computation Tree Logic Prof. Ali Movaghar

Expressiveness of CTL vs. LTL (Cont.)

� Dropping all (universal and existential) quantifiers is a safe way to generate an equivalent LTL formula, provided there equivalent LTL formula, provided there are equivalent LTL formulae:

� As an example, the LTL formula ◊a is equivalent to the CTL formula ∀◊a

� However, ∀◊∀□a and ◊□a are not

equivalent.

37

Page 38: Ch6-Computation Tree Logic.ppt - Sharif University of ...ce.sharif.edu/courses/90-91/2/ce665-1/resources/root/Lecture Notes/… · Chapter 6: Computation Tree Logic Prof. Ali Movaghar

Expressiveness of CTL vs. LTL (Cont.)

� Theorem 6.18: Let Φ be a CTL formula, and ϕ the LTL formula that is

obtained by eliminating all path

ϕ

ϕ

obtained by eliminating all path quantifiers in Φ. Then:

� Φ ≡ ϕ

or

� There does not exist any LTL formula that is equivalent to Φ.

38

Page 39: Ch6-Computation Tree Logic.ppt - Sharif University of ...ce.sharif.edu/courses/90-91/2/ce665-1/resources/root/Lecture Notes/… · Chapter 6: Computation Tree Logic Prof. Ali Movaghar

Expressiveness of CTL vs. LTL (Cont.)

� Lemma 6.19. (Persistence): The CTL formula ∀◊∀□a and the LTL formula ◊□a

are not equivalent.

∀ ∀

are not equivalent.

� By theorem 6.18 it can be asserted that there is no LTL expression whatsoever which can describe the property ∀◊∀□a

39

Page 40: Ch6-Computation Tree Logic.ppt - Sharif University of ...ce.sharif.edu/courses/90-91/2/ce665-1/resources/root/Lecture Notes/… · Chapter 6: Computation Tree Logic Prof. Ali Movaghar

Expressiveness of CTL vs. LTL (Cont.)

� Lemma 6.20. (Eventually an a-State with only direct a-Successors):

� The CTL formula ∀◊(a ∧ ∀a) and the LTL ∧

� The CTL formula ∀◊(a ∧ ∀a) and the LTL formula ◊(a ∧ a) are not equivalent.

� In addition to CTL formulas inexpressible in LTL, there are also LTL formulas which cannot be expressed in CTL.

40

Page 41: Ch6-Computation Tree Logic.ppt - Sharif University of ...ce.sharif.edu/courses/90-91/2/ce665-1/resources/root/Lecture Notes/… · Chapter 6: Computation Tree Logic Prof. Ali Movaghar

Expressiveness of CTL vs. LTL (Cont.)

� Theorem 6.21. (Incomparable Expressiveness of CTL and LTL):

a) There exist LTL formulae for which no equivalent CTL formula exists. This holds equivalent CTL formula exists. This holds for, for instance:

� ◊□a and ◊(a∧ a).

b) There exist CTL formulae for which no equivalent LTL formula exists. This holds for, for instance:

� ∀◊∀□a and ∀◊(a∧∀a) and ∀□∃◊a.41

Page 42: Ch6-Computation Tree Logic.ppt - Sharif University of ...ce.sharif.edu/courses/90-91/2/ce665-1/resources/root/Lecture Notes/… · Chapter 6: Computation Tree Logic Prof. Ali Movaghar

CTL Model Checking

� CTL model checker:

� A decision algorithm that Checks whether TS |= Φ for a given transition system TS TS |= Φ for a given transition system TS and a CTL formula Φ

� Throughout this section, it is assumed that TS is finite, and has no terminal states

� CTL model checking can be performed by a recursive procedure that calculates the satisfaction set for all subformulae of Φ

42

Page 43: Ch6-Computation Tree Logic.ppt - Sharif University of ...ce.sharif.edu/courses/90-91/2/ce665-1/resources/root/Lecture Notes/… · Chapter 6: Computation Tree Logic Prof. Ali Movaghar

CTL Model Checking (Cont.)

� We consider CTL formulae in ENF (CTL formulae built by the basic modalities ∃, ∃U, and ∃□.)

∃ ∃ ∃

∃, ∃U, and ∃□.)

� This requires algorithms that generate Sat(∃Φ), Sat(∃(ΦUΨ)), and Sat(∃□Φ)

when Sat(Φ) and Sat(Ψ) are given

43

Page 44: Ch6-Computation Tree Logic.ppt - Sharif University of ...ce.sharif.edu/courses/90-91/2/ce665-1/resources/root/Lecture Notes/… · Chapter 6: Computation Tree Logic Prof. Ali Movaghar

CTL Model Checking: Global Model-checking Procedure

� The basic procedure for CTL model checking is:

� The set Sat(Φ) of all states satisfying Φ is

� The set Sat(Φ) of all states satisfying Φ is computed recursively

� It follows that TS |= Φ if and only if I ⊆

Sat(Φ), where I is the set of initial states of TS

� It is called global because satisfaction of all other states is verified besides the initial states.

44

Page 45: Ch6-Computation Tree Logic.ppt - Sharif University of ...ce.sharif.edu/courses/90-91/2/ce665-1/resources/root/Lecture Notes/… · Chapter 6: Computation Tree Logic Prof. Ali Movaghar

CTL Model Checking: Global Model-checking Procedure (Cont.)

� Sat(Φ) is computed in a bottom-up traversal of the parse tree of the CTL state formula Φ:formula Φ:

� The nodes of the parse tree represent the subformulae of Φ.

� The leaves stand for the constant true or an atomic proposition a ∈ AP.

� All inner nodes are labeled with an operator. For ENF formulae the labels of the inner nodes are

¬, ∧, ∃, ∃U, or ∃□.45

Page 46: Ch6-Computation Tree Logic.ppt - Sharif University of ...ce.sharif.edu/courses/90-91/2/ce665-1/resources/root/Lecture Notes/… · Chapter 6: Computation Tree Logic Prof. Ali Movaghar

CTL Model Checking: Global Model-checking Procedure (Cont.)

� The children of a node v stand for the maximal genuine subformulae of the formula Ψv that is represented by v.formula Ψv that is represented by v.

� The Operator labeling a node says how to combine its maximal genuine subformulae.

46

Page 47: Ch6-Computation Tree Logic.ppt - Sharif University of ...ce.sharif.edu/courses/90-91/2/ce665-1/resources/root/Lecture Notes/… · Chapter 6: Computation Tree Logic Prof. Ali Movaghar

CTL Model Checking: Global Model-checking Procedure (Cont.)

� As soon as a certain subformula Ψ is computed, aΨ is added to L(s) for every s ∈ Sat(Ψ) rather as an atomic s ∈ Sat(Ψ) rather as an atomic

proposition satisfied by s.

47

Page 48: Ch6-Computation Tree Logic.ppt - Sharif University of ...ce.sharif.edu/courses/90-91/2/ce665-1/resources/root/Lecture Notes/… · Chapter 6: Computation Tree Logic Prof. Ali Movaghar

CTL Model Checking: Global Model-checking Procedure (Cont.)

� Example 6.22:

� Φ = ∃a ∧ ∃(b U ∃□¬c)

48

Page 49: Ch6-Computation Tree Logic.ppt - Sharif University of ...ce.sharif.edu/courses/90-91/2/ce665-1/resources/root/Lecture Notes/… · Chapter 6: Computation Tree Logic Prof. Ali Movaghar

CTL Model Checking: Global Model-checking Procedure (Cont.)

� Once the subformulae Ψ and Ψ’ are treated, they can be replaced by the new atomic propositions a1, a2

The formula that is to be treated for the ∧

� The formula that is to be treated for the root node simply thus is: Φ = a1 ∧ a2.

� Sat(Φ) results from intersecting

Sat(a1) = Sat(Ψ) and Sat(a2) = Sat(Ψ’)

49

Page 50: Ch6-Computation Tree Logic.ppt - Sharif University of ...ce.sharif.edu/courses/90-91/2/ce665-1/resources/root/Lecture Notes/… · Chapter 6: Computation Tree Logic Prof. Ali Movaghar

CTL Model Checking: Global Model-checking Procedure (Cont.)

� Theorem 6.23: For all CTL formulae Φ, Ψ over AP it holds that:

50

Page 51: Ch6-Computation Tree Logic.ppt - Sharif University of ...ce.sharif.edu/courses/90-91/2/ce665-1/resources/root/Lecture Notes/… · Chapter 6: Computation Tree Logic Prof. Ali Movaghar

CTL Model Checking: Global Model-checking Procedure (Cont.)

� These two last characterizations are based upon equation induced by the expansion laws for ∃(ΦUΨ) and ∃□Φ

respectively51

Page 52: Ch6-Computation Tree Logic.ppt - Sharif University of ...ce.sharif.edu/courses/90-91/2/ce665-1/resources/root/Lecture Notes/… · Chapter 6: Computation Tree Logic Prof. Ali Movaghar

Fixpoint Representation

� Let TS = (S, Act,→, I,AP, L) be an arbitrary finite

Transition System with no terminal state. The set P(S) of all subsets of S form a lattice under the set inclusion ordering.

52

inclusion ordering.

� Based on first order logic, a subset S’ can be viewed as a predicate which is true for every si which is a member of S’.

� Each element S’ of the lattice is a predicate on S.

� A function that maps P(S) to P(S) is called a Predicate Transformer.

Page 53: Ch6-Computation Tree Logic.ppt - Sharif University of ...ce.sharif.edu/courses/90-91/2/ce665-1/resources/root/Lecture Notes/… · Chapter 6: Computation Tree Logic Prof. Ali Movaghar

Fixpoint theory

Let τ : P(S) → P(S) be a predicate

transformer, then:

� τ is Monotonic provided that P Q τ τ

τ

τ

� τ is Monotonic provided that P Q implies τ(P) τ(Q);

� τ is U-continuous provided that

P1 P2 … implies τ(Ui Pi) = Ui τ(Pi);

� τ is ∩-continuous provided that

P1 P2 … implies τ(∩i Pi) = ∩i τ(Pi).53

⊆ ⊆

Page 54: Ch6-Computation Tree Logic.ppt - Sharif University of ...ce.sharif.edu/courses/90-91/2/ce665-1/resources/root/Lecture Notes/… · Chapter 6: Computation Tree Logic Prof. Ali Movaghar

Fixpoint Theory: Predicate Transformer Properties

� Lemma 1: If S is finite and τ is monotonic, then τ is also U-continuous and ∩-continuous .

� Lemma 2: If τ is monotonic, then for every i,

τ τ τ τ

τ

τ

τ

τi(False) τi+1(False) and τi(True) τi+1(True).

� Lemma 3: If τ is monotonic and S is finite,

then there is an integer i0 such that for every j ≥ i0, τ

j (False) = τi0(False). Similarly, there is

some j0 such that for every j ≥ j0, τj (True) =

τj0(True).

54

⊆ ⊇

Page 55: Ch6-Computation Tree Logic.ppt - Sharif University of ...ce.sharif.edu/courses/90-91/2/ce665-1/resources/root/Lecture Notes/… · Chapter 6: Computation Tree Logic Prof. Ali Movaghar

Fixpoint Theory: Predicate Transformer Properties (Cont.)

� Lemma 4: If τ is monotonic and S is finite, then there is an integer i0 such that µZ . τ(Z) = τi0(False). Similarly, there is

τ τ

µZ . τ(Z) = τ (False). Similarly, there is some j0 such that νZ . τ(Z) = τj0(True).

55

Page 56: Ch6-Computation Tree Logic.ppt - Sharif University of ...ce.sharif.edu/courses/90-91/2/ce665-1/resources/root/Lecture Notes/… · Chapter 6: Computation Tree Logic Prof. Ali Movaghar

Fixpoint theory: Greatest and Least Fixpoints

� Let τi (Z) denote i applications of τ to Z.

� According to Tarski, any monotonic predicate transformer τ on P(S) always has a least fixpoint Z . τ(Z), and a greatest fixpoint Z . τ

τ

fixpoint µZ . τ(Z), and a greatest fixpoint νZ . τ(Z) where

µZ . τ(Z)= ∩{Z | τ(Z) Z} and

νZ . τ(Z)= U{Z | τ(Z) Z}.

� Additionally, if τ is U-continuous µZ . τ(Z) = Ui τi

(False) and if τ is ∩-continuous νZ . τ(Z) = ∩i τi

(True). 56

Page 57: Ch6-Computation Tree Logic.ppt - Sharif University of ...ce.sharif.edu/courses/90-91/2/ce665-1/resources/root/Lecture Notes/… · Chapter 6: Computation Tree Logic Prof. Ali Movaghar

CTL operators as greatest or least fixpoints

� If we identify each CTL formula f with the predicate {s | M, s |= f }, then each of the basic CTL operators may be characterized as a least or greatest fixpoint of an appropriate predicate transformer as follows:

∀ ∀

appropriate predicate transformer as follows:

� ∀◊ f1 = µZ . f1 ∨ ∀ Z

� ∃◊ f1 = µZ . f1 ∨ ∃ Z

� ∀□ f1 = νZ . f1 ∧ ∀ Z

� ∃□ f1 = νZ . f1 ∧ ∃ Z

� ∀[f1 U f2] = µZ . f2 ∨ (f1 ∧ ∀ Z)

� ∃[f1 U f2] = µZ . f2 ∨ (f1 ∧ ∃ Z)57

Page 58: Ch6-Computation Tree Logic.ppt - Sharif University of ...ce.sharif.edu/courses/90-91/2/ce665-1/resources/root/Lecture Notes/… · Chapter 6: Computation Tree Logic Prof. Ali Movaghar

Procedure for computing least fixpoint

� function Lfp(Tau : PredicateTransformer) : Predicate

Q := False;

Q’ := Tau(Q);

while (Q ≠ Q’) do

Q := Q’;

Q’ := Tau(Q’);

end while;

return(Q);

end function

58

Page 59: Ch6-Computation Tree Logic.ppt - Sharif University of ...ce.sharif.edu/courses/90-91/2/ce665-1/resources/root/Lecture Notes/… · Chapter 6: Computation Tree Logic Prof. Ali Movaghar

Procedure for computing greatest fixpoint

� function Gfp(Tau : PredicateTransformer) : Predicate

Q := True;

Q’ := Tau(Q);

while (Q ≠ Q’) do

Q := Q’;

Q’ := Tau(Q’);

end while;

return(Q);

end function

59

Page 60: Ch6-Computation Tree Logic.ppt - Sharif University of ...ce.sharif.edu/courses/90-91/2/ce665-1/resources/root/Lecture Notes/… · Chapter 6: Computation Tree Logic Prof. Ali Movaghar

Fixpoint Theory: Sequence of Approximations

p

p q

p

p q

s0

s0

60

p

q

p

qpp

s0 s0

Original Transition Systemτ 1 (False)

τ 2 (False) τ 3 (False)

Page 61: Ch6-Computation Tree Logic.ppt - Sharif University of ...ce.sharif.edu/courses/90-91/2/ce665-1/resources/root/Lecture Notes/… · Chapter 6: Computation Tree Logic Prof. Ali Movaghar

CTL Model Checking: Fixed-point Equations

� Consider the case of ∃(ΦUΨ):

� ∃(ΦUΨ) ≡ Ψ ∨ (Φ ∧ ∃∃(ΦUΨ))

� We can describe the CTL formula ∃

∃ ∨ ∧ ∃ ∃

� We can describe the CTL formula ∃(ΦUΨ) as a fixed-point of the logical

equation

� F ≡ Ψ ∨ (Φ ∧ ∃F)

� A fixed-point is simply a solution of the above equation

61

Page 62: Ch6-Computation Tree Logic.ppt - Sharif University of ...ce.sharif.edu/courses/90-91/2/ce665-1/resources/root/Lecture Notes/… · Chapter 6: Computation Tree Logic Prof. Ali Movaghar

CTL Model Checking: Fixed-point Equations (Cont.)

� There are other solutions too: ∃(ΦWΨ)

� But ∃(ΦUΨ) is the least solution to the

former equation

former equation

� Whereas ∃(ΦWΨ) is the largest solution

� In a similar way, ∃□Φ can be

considered as the greatest fixed point of the logical equation

� F = Φ ∧ ∃F

62

Page 63: Ch6-Computation Tree Logic.ppt - Sharif University of ...ce.sharif.edu/courses/90-91/2/ce665-1/resources/root/Lecture Notes/… · Chapter 6: Computation Tree Logic Prof. Ali Movaghar

CTL Model Checking: Fixed-point computation

� As an example, the algorithm to compute ∃(Φ1UΦ2) is given below:

� ∃(Φ1UΦ2) :

∈ ∅ ∅

∃� ∃(Φ1UΦ2) :

T := Sat(Φ2); (* compute the smallest fixed point *)

while { s ∈ Sat(Φ1) \ T | Post(s) ∩ T ≠ ∅} ≠ ∅ do

let s ∈ {s ∈ Sat(Φ1) \ T | Post(s) ∩ T ≠ ∅};

T := T ∪ {s};

od;

return T;

S \ T: all members of S which are not a member of T63

Page 64: Ch6-Computation Tree Logic.ppt - Sharif University of ...ce.sharif.edu/courses/90-91/2/ce665-1/resources/root/Lecture Notes/… · Chapter 6: Computation Tree Logic Prof. Ali Movaghar

Computation of the Satisfaction Sets

64

Page 65: Ch6-Computation Tree Logic.ppt - Sharif University of ...ce.sharif.edu/courses/90-91/2/ce665-1/resources/root/Lecture Notes/… · Chapter 6: Computation Tree Logic Prof. Ali Movaghar

CTL Model Checking: Fixed-point computation (Cont.)

� Example 6.26. Checking the formula ∃◊Φ with Φ = ((a = c)∧ (a ≠ b)) in the

following transition system:

∃ ∧

following transition system:

65

Page 66: Ch6-Computation Tree Logic.ppt - Sharif University of ...ce.sharif.edu/courses/90-91/2/ce665-1/resources/root/Lecture Notes/… · Chapter 6: Computation Tree Logic Prof. Ali Movaghar

CTL Model Checking: Fixed-point computation (Cont.)

� As we know, ∃◊Φ = ∃(true U Φ)

� Invoking the former algorithm given, Sat(true) and Sat((a = c)∧ (a ≠ b)) are

∃ ∃

Sat(true) and Sat((a = c)∧ (a ≠ b)) are

recursively computed. The states of set T are:

66

Page 67: Ch6-Computation Tree Logic.ppt - Sharif University of ...ce.sharif.edu/courses/90-91/2/ce665-1/resources/root/Lecture Notes/… · Chapter 6: Computation Tree Logic Prof. Ali Movaghar

CTL Model Checking: Fixed-point computation (Cont.)

� In the next two steps, s6 and s7 are added respectively, finally yielding the satisfaction set:satisfaction set:

67

s6 s7

Page 68: Ch6-Computation Tree Logic.ppt - Sharif University of ...ce.sharif.edu/courses/90-91/2/ce665-1/resources/root/Lecture Notes/… · Chapter 6: Computation Tree Logic Prof. Ali Movaghar

CTL Model Checking: Alternative Algorithms

� A possibility to compute Sat(∃□Φ) is to

only consider the Φ-states of a transition system TS and ignore all ¬Φ-states:

system TS and ignore all ¬Φ-states:

� from the TS given in example 6.26, consider the example with Φ = b:

68

Page 69: Ch6-Computation Tree Logic.ppt - Sharif University of ...ce.sharif.edu/courses/90-91/2/ce665-1/resources/root/Lecture Notes/… · Chapter 6: Computation Tree Logic Prof. Ali Movaghar

CTL Model Checking: Alternative Algorithms (Cont.)

� In the next step, all nontrivial strongly connected components (SCCs) in the state graph induced by TS[Φ] are state graph induced by TS[Φ] are computed:

� Nontrivial SCC: A SCC containing at least one transition 69

Page 70: Ch6-Computation Tree Logic.ppt - Sharif University of ...ce.sharif.edu/courses/90-91/2/ce665-1/resources/root/Lecture Notes/… · Chapter 6: Computation Tree Logic Prof. Ali Movaghar

CTL Model Checking: Alternative Algorithms (Cont.)

� Finally, all states which satisfy Φ and can reach a state in the strongly connected components are added:

� Theorem 6.29. s |= ∃□Φ iff s |= Φ and

there is a nontrivial SCC in TS[Φ] reachable from s. 70

Page 71: Ch6-Computation Tree Logic.ppt - Sharif University of ...ce.sharif.edu/courses/90-91/2/ce665-1/resources/root/Lecture Notes/… · Chapter 6: Computation Tree Logic Prof. Ali Movaghar

CTL Model Checking: Alternative Algorithms

71

Page 72: Ch6-Computation Tree Logic.ppt - Sharif University of ...ce.sharif.edu/courses/90-91/2/ce665-1/resources/root/Lecture Notes/… · Chapter 6: Computation Tree Logic Prof. Ali Movaghar

CTL Model Checking: Alternative Algorithms

72

Page 73: Ch6-Computation Tree Logic.ppt - Sharif University of ...ce.sharif.edu/courses/90-91/2/ce665-1/resources/root/Lecture Notes/… · Chapter 6: Computation Tree Logic Prof. Ali Movaghar

CTL Model Checking: Time and Space Complexity

� Let TS be a finite transition system with N states and K transitions

� The time complexity of Algorithm 14 (see � The time complexity of Algorithm 14 (see page 348, partly described in slide 54) is in:

� O((N+K) � |Φ|)

73

Page 74: Ch6-Computation Tree Logic.ppt - Sharif University of ...ce.sharif.edu/courses/90-91/2/ce665-1/resources/root/Lecture Notes/… · Chapter 6: Computation Tree Logic Prof. Ali Movaghar

CTL Model Checking: Time and Space Complexity (Cont.)

� Theorem 6.30. For transition system TS with N states and K transitions, and CTL formula Φ, the CTL model-checking problem TS |= Φ can be determined in problem TS |= Φ can be determined in time

O ((N+K) � |Φ|)

� CTL Model-checking is Linear in contrast to the exponential time Model-checking algorithm given for LTL

74

Page 75: Ch6-Computation Tree Logic.ppt - Sharif University of ...ce.sharif.edu/courses/90-91/2/ce665-1/resources/root/Lecture Notes/… · Chapter 6: Computation Tree Logic Prof. Ali Movaghar

CTL Model Checking: Time and Space Complexity (Cont.)

� But this should not be interpreted as “CTL model checking is more efficient than LTL model checking”.than LTL model checking”.

� LTL formulae may be exponentially shorter than any of their equivalent formulation in CTL.

75

Page 76: Ch6-Computation Tree Logic.ppt - Sharif University of ...ce.sharif.edu/courses/90-91/2/ce665-1/resources/root/Lecture Notes/… · Chapter 6: Computation Tree Logic Prof. Ali Movaghar

CTL Model Checking: Time and Space Complexity (Cont.)

� Example 6.31. The Hamiltonian Path Problem:

� From Lemma 5.45, it follows that the � From Lemma 5.45, it follows that the Hamiltonian path problem for digraphs with n nodes can be encoded in LTL formula ϕn whose length is polynomial

in the number of nodes, n.

76

Page 77: Ch6-Computation Tree Logic.ppt - Sharif University of ...ce.sharif.edu/courses/90-91/2/ce665-1/resources/root/Lecture Notes/… · Chapter 6: Computation Tree Logic Prof. Ali Movaghar

CTL Model Checking: Time and Space Complexity (Cont.)

� We want to find a Hamiltonian path in a directed graph G = (V,E) with V = {v1, … , vn }… , vn }

� We want to define a Φn such that:

G contains a Hamiltonian path if and only if TS |≠ ¬Φn

77

Page 78: Ch6-Computation Tree Logic.ppt - Sharif University of ...ce.sharif.edu/courses/90-91/2/ce665-1/resources/root/Lecture Notes/… · Chapter 6: Computation Tree Logic Prof. Ali Movaghar

CTL Model Checking: Time and Space Complexity (Cont.)

� Define TS = (V ∪ {b}, {τ},→, V, V, L): The labels

correspond to graph nodes, and the transitions are the same as edges, except that there is a transition to b added to every node.

� In this example, (a) is the original graph:

78

Page 79: Ch6-Computation Tree Logic.ppt - Sharif University of ...ce.sharif.edu/courses/90-91/2/ce665-1/resources/root/Lecture Notes/… · Chapter 6: Computation Tree Logic Prof. Ali Movaghar

CTL Model Checking: Time and Space Complexity (Cont.)

� Let Φn be defined as follows:

� Such that Ψ(vi1, . . . , vin) is a CTL formula that is satisfied if and only if vi1, vi2 , … , vin is a Hamiltonian path in G.

79

Page 80: Ch6-Computation Tree Logic.ppt - Sharif University of ...ce.sharif.edu/courses/90-91/2/ce665-1/resources/root/Lecture Notes/… · Chapter 6: Computation Tree Logic Prof. Ali Movaghar

CTL Model Checking: Time and Space Complexity (Cont.)

� The formulae Ψ(vi1, . . . , vin) are inductively defined as follows:

1. Ψ(vi) = vi

Ψ(v , v , … , v ) = v ∧ ∃ Ψ( , … , v ) if 2. Ψ(vi1, vi2, … , vin) = vin ∧ ∃Ψ(vi1, … , vin) if

n > 1

� Stated in words, Ψ(vi1, vi2, … , vin) holds if there exists a path on which vi1, vi2, … successively hold.

80

Page 81: Ch6-Computation Tree Logic.ppt - Sharif University of ...ce.sharif.edu/courses/90-91/2/ce665-1/resources/root/Lecture Notes/… · Chapter 6: Computation Tree Logic Prof. Ali Movaghar

CTL Model Checking: Time and Space Complexity (Cont.)

� According to this definition, it is easy to infer that:

Sat(Ψ(vi1, vi2, … , vin) ) =

i1 i2 in

� {vi1} if vi1, vi2, … , vin is a Hamiltonian path in G

� ∅ otherwize

� Thus, TS |≠ ¬Φn iff there is an initial state s of TS for which s |= Φ, which is, there exists a v in G and a permutation i1, … , in of 1, … , n such that v = vi and vi1, … , vin is a Hamiltonian path in G

81

Page 82: Ch6-Computation Tree Logic.ppt - Sharif University of ...ce.sharif.edu/courses/90-91/2/ce665-1/resources/root/Lecture Notes/… · Chapter 6: Computation Tree Logic Prof. Ali Movaghar

CTL Model Checking: Time and Space Complexity (Cont.)

� By the enumeration of all possible permutations we obtain a formula with a length exponential in the number of length exponential in the number of vertices in the graph.

� And we do not expect a smaller formulae, as we know the Hamiltonian path problem is not yet solved polynomially.

82

Page 83: Ch6-Computation Tree Logic.ppt - Sharif University of ...ce.sharif.edu/courses/90-91/2/ce665-1/resources/root/Lecture Notes/… · Chapter 6: Computation Tree Logic Prof. Ali Movaghar

Fairness in CTL

� Fairness assumptions can be added as premise to the LTL formula to be verified.

� TS |=fair ϕ if and only if TS |= (fair → ϕ)fair ϕ ϕ

� Fairness constraints operate on the path level and replace the standard meaning “for all/some paths” of quantification with “for all/some fair paths”

83

Page 84: Ch6-Computation Tree Logic.ppt - Sharif University of ...ce.sharif.edu/courses/90-91/2/ce665-1/resources/root/Lecture Notes/… · Chapter 6: Computation Tree Logic Prof. Ali Movaghar

Fairness in CTL (Cont.)

� If “fair” expresses the fairness condition on the path level, then CTL formulae that encode the intuitive meaning of ∀(fair → ϕ) and ∃(fair ∧ϕ)

would be needed. However, these are not legal

∀ ϕ ∃ ∧ϕ

would be needed. However, these are not legal CTL formulas.

� Moreover, this approach is not possible for CTL, based on the fact that most fairness constraints cannot be encoded into a CTL formula:

� Persistence property ◊□a

84

Page 85: Ch6-Computation Tree Logic.ppt - Sharif University of ...ce.sharif.edu/courses/90-91/2/ce665-1/resources/root/Lecture Notes/… · Chapter 6: Computation Tree Logic Prof. Ali Movaghar

Fairness in CTL (Cont.)

� Therefore, In order to deal with fairness constraints in CTL, the semantics of CTL is slightly modified such that the state formulae ∀ϕ and ∃ϕ are interpreted over slightly modified such that the state formulae ∀ϕ and ∃ϕ are interpreted over

all fair paths rather than over all possible paths.

� It is assumed that the given fixed fairness constraint is described by a formula as in LTL.

85

Page 86: Ch6-Computation Tree Logic.ppt - Sharif University of ...ce.sharif.edu/courses/90-91/2/ce665-1/resources/root/Lecture Notes/… · Chapter 6: Computation Tree Logic Prof. Ali Movaghar

Fairness in CTL : CTL Fairness Assumptions

� Definition 6.32. A strong CTL fairness constraint(over AP) is a term of the form:

� where Φi and Ψi are CTL formulae over AP

� Weak and unconditional CTL fairness constraints are defined analogously by conjunctions of terms of

the form (◊□Φi → □◊Ψi) and □◊Ψi, respectively.

86

Page 87: Ch6-Computation Tree Logic.ppt - Sharif University of ...ce.sharif.edu/courses/90-91/2/ce665-1/resources/root/Lecture Notes/… · Chapter 6: Computation Tree Logic Prof. Ali Movaghar

Fairness in CTL: CTL Fairness Assumptions (Cont.)

� A CTL Fairness Assumption is a conjunction of strong, weak, and unconditional CTL fairness constraints.unconditional CTL fairness constraints.

� Note that CTL fairness assumptions are not CTL path formulae, but they can be viewed as “LTL formulae using CTL state formulae instead of atomic propositions”.

87

Page 88: Ch6-Computation Tree Logic.ppt - Sharif University of ...ce.sharif.edu/courses/90-91/2/ce665-1/resources/root/Lecture Notes/… · Chapter 6: Computation Tree Logic Prof. Ali Movaghar

Fairness in CTL: CTL Fairness Assumptions (Cont.)

� Let TS = (S, Act,→, I,AP, L) be a

transition system without terminal states, π be an infinite path fragment in TS, and π be an infinite path fragment in TS, and

fair a fixed CTL fairness assumption.

� π |= fair denotes that π satisfies the

formula fair, where |= should be read as the LTL semantics.

88

Page 89: Ch6-Computation Tree Logic.ppt - Sharif University of ...ce.sharif.edu/courses/90-91/2/ce665-1/resources/root/Lecture Notes/… · Chapter 6: Computation Tree Logic Prof. Ali Movaghar

Fairness in CTL: CTL Fairness Assumptions (Cont.)

� The semantics of CTL under fairness assumption fair is identical to the semantics given earlier, except, the path quantifications range over all fair paths rather than over all range over all fair paths rather than over all paths:

FairPaths(s) = {π ∈ Paths(s) | π |= fair}

� And for the transition system TS:

89

Page 90: Ch6-Computation Tree Logic.ppt - Sharif University of ...ce.sharif.edu/courses/90-91/2/ce665-1/resources/root/Lecture Notes/… · Chapter 6: Computation Tree Logic Prof. Ali Movaghar

Fairness in CTL: CTL Fairness Assumptions (Cont.)

� Definition 6.33. For state formulae, The satisfaction relation |=fair for CTL fairness assumption fair is defined as:assumption fair is defined as:

90

Page 91: Ch6-Computation Tree Logic.ppt - Sharif University of ...ce.sharif.edu/courses/90-91/2/ce665-1/resources/root/Lecture Notes/… · Chapter 6: Computation Tree Logic Prof. Ali Movaghar

Fairness in CTL: CTL Fairness Assumptions (Cont.)

� For a path π and path formulae the

satisfaction relation |=fair for CTL fairness assumption fair is defined as: assumption fair is defined as:

where for path π = s0 s1 s2 … and integer i ≥ 0, π[i] denotes the (i+1)-th state of π, si

91

Page 92: Ch6-Computation Tree Logic.ppt - Sharif University of ...ce.sharif.edu/courses/90-91/2/ce665-1/resources/root/Lecture Notes/… · Chapter 6: Computation Tree Logic Prof. Ali Movaghar

Fairness in CTL: CTL Fairness Assumptions (Cont.)

� For CTL-state formula Φ, and CTL fairness assumption fair, the satisfaction set Satfair(Φ) is defined by:

Sat (Φ) = { s ∈ S | s |=fair Φ}.Satfair(Φ) = { s ∈ S | s |=fair Φ}.

� The transition system TS satisfies CTL formula Φ under fairness assumption fair if and only if Φ holds in all initial states of TS:

TS |=fair Φ if and only if ∀s0 ∈ I. s0 |=fair Φ.

92

Page 93: Ch6-Computation Tree Logic.ppt - Sharif University of ...ce.sharif.edu/courses/90-91/2/ce665-1/resources/root/Lecture Notes/… · Chapter 6: Computation Tree Logic Prof. Ali Movaghar

CTL Model Checking with Fairness (Basic Idea)

93

Page 94: Ch6-Computation Tree Logic.ppt - Sharif University of ...ce.sharif.edu/courses/90-91/2/ce665-1/resources/root/Lecture Notes/… · Chapter 6: Computation Tree Logic Prof. Ali Movaghar

Model Checking CTL with Fairness

94

Page 95: Ch6-Computation Tree Logic.ppt - Sharif University of ...ce.sharif.edu/courses/90-91/2/ce665-1/resources/root/Lecture Notes/… · Chapter 6: Computation Tree Logic Prof. Ali Movaghar

Computation of Satsfair( □a)

95

Page 96: Ch6-Computation Tree Logic.ppt - Sharif University of ...ce.sharif.edu/courses/90-91/2/ce665-1/resources/root/Lecture Notes/… · Chapter 6: Computation Tree Logic Prof. Ali Movaghar

96

Page 97: Ch6-Computation Tree Logic.ppt - Sharif University of ...ce.sharif.edu/courses/90-91/2/ce665-1/resources/root/Lecture Notes/… · Chapter 6: Computation Tree Logic Prof. Ali Movaghar

Time Complexity of Verifying □ under Fairness

97

Page 98: Ch6-Computation Tree Logic.ppt - Sharif University of ...ce.sharif.edu/courses/90-91/2/ce665-1/resources/root/Lecture Notes/… · Chapter 6: Computation Tree Logic Prof. Ali Movaghar

Time Complexity of CTL Model Checking with Fairness

98

Page 99: Ch6-Computation Tree Logic.ppt - Sharif University of ...ce.sharif.edu/courses/90-91/2/ce665-1/resources/root/Lecture Notes/… · Chapter 6: Computation Tree Logic Prof. Ali Movaghar

Fairness in CTL: CTL Fairness Assumption (Cont.)

� Read Example 6.35.

� Example 6.36. Mutual Exclusion:

� Consider the semaphore-based solution to � Consider the semaphore-based solution to the two-process mutual exclusion problem. The transition system of this concurrent program is denoted TSsem.

99

Page 100: Ch6-Computation Tree Logic.ppt - Sharif University of ...ce.sharif.edu/courses/90-91/2/ce665-1/resources/root/Lecture Notes/… · Chapter 6: Computation Tree Logic Prof. Ali Movaghar

Fairness in CTL: CTL Fairness Assumption (Cont.)

� The CTL formula:

Φ = (∀□∀◊ crit1) ∧ (∀□∀◊ crit2)

Describes the liveness property that both

∀ ∀ ∧ ∀ ∀

Describes the liveness property that both processes infinitely often have access to the critical section.

� It follows that TSsem |≠ Φ (The semaphore solution does not fulfill the liveness property)

100

Page 101: Ch6-Computation Tree Logic.ppt - Sharif University of ...ce.sharif.edu/courses/90-91/2/ce665-1/resources/root/Lecture Notes/… · Chapter 6: Computation Tree Logic Prof. Ali Movaghar

Fairness in CTL: CTL Fairness Assumption (Cont.)

� Again, consider the arbiter-based solution to the mutual exclusion problem.

� The decision as to which process will acquire access to the critical section is determined by a coin flipped by the critical section is determined by a coin flipped by the arbiter.

� Consider the unconditional fairness assumption:

ufair = □◊head ∧ □◊tail

Which requires that the events “heads” and “tails” occur infinitely often with probability 1

� it follows that:

TS1 ∥ Arbiter ∥ TS2 |≠ Φ, and TS1 ∥ Arbiter ∥ TS2 |≠ufair Φ

101

Page 102: Ch6-Computation Tree Logic.ppt - Sharif University of ...ce.sharif.edu/courses/90-91/2/ce665-1/resources/root/Lecture Notes/… · Chapter 6: Computation Tree Logic Prof. Ali Movaghar

Syntax of CTL*� CTL* state formulae over the set AP of

atomic proposition, briefly called CTL* formulae, are formed according to the following grammar:

∧ ∃ϕ

∈ ϕ

following grammar:

Φ ::= true | a | Φ1∧Φ2 | ¬Φ | ∃ϕ

� where a ∈ AP and ϕ is a path formula. The

CTL* path formulae is given by the following grammar:

ϕ ::= Φ | ϕ1∧ϕ2 | ¬ϕ |ϕ | ϕ1Uϕ2 where Φ is a state formula, ϕ, ϕ1, and ϕ2 are path

formulae 102

Page 103: Ch6-Computation Tree Logic.ppt - Sharif University of ...ce.sharif.edu/courses/90-91/2/ce665-1/resources/root/Lecture Notes/… · Chapter 6: Computation Tree Logic Prof. Ali Movaghar

Satisfaction Relation for CTL*

103

Page 104: Ch6-Computation Tree Logic.ppt - Sharif University of ...ce.sharif.edu/courses/90-91/2/ce665-1/resources/root/Lecture Notes/… · Chapter 6: Computation Tree Logic Prof. Ali Movaghar

CTL* Semantics for Tranition Systems

104

Page 105: Ch6-Computation Tree Logic.ppt - Sharif University of ...ce.sharif.edu/courses/90-91/2/ce665-1/resources/root/Lecture Notes/… · Chapter 6: Computation Tree Logic Prof. Ali Movaghar

Embedding of LTL in CTL*

105

Page 106: Ch6-Computation Tree Logic.ppt - Sharif University of ...ce.sharif.edu/courses/90-91/2/ce665-1/resources/root/Lecture Notes/… · Chapter 6: Computation Tree Logic Prof. Ali Movaghar

CTL* Expressiveness

106

Page 107: Ch6-Computation Tree Logic.ppt - Sharif University of ...ce.sharif.edu/courses/90-91/2/ce665-1/resources/root/Lecture Notes/… · Chapter 6: Computation Tree Logic Prof. Ali Movaghar

Relationship between LTL, CTL, and CTL*

107

Page 108: Ch6-Computation Tree Logic.ppt - Sharif University of ...ce.sharif.edu/courses/90-91/2/ce665-1/resources/root/Lecture Notes/… · Chapter 6: Computation Tree Logic Prof. Ali Movaghar

Some Equivalence Laws for CTL*

108

Page 109: Ch6-Computation Tree Logic.ppt - Sharif University of ...ce.sharif.edu/courses/90-91/2/ce665-1/resources/root/Lecture Notes/… · Chapter 6: Computation Tree Logic Prof. Ali Movaghar

Maximal Proper State Subformula

109

Page 110: Ch6-Computation Tree Logic.ppt - Sharif University of ...ce.sharif.edu/courses/90-91/2/ce665-1/resources/root/Lecture Notes/… · Chapter 6: Computation Tree Logic Prof. Ali Movaghar

Example of CTL* Model Checking

110

Page 111: Ch6-Computation Tree Logic.ppt - Sharif University of ...ce.sharif.edu/courses/90-91/2/ce665-1/resources/root/Lecture Notes/… · Chapter 6: Computation Tree Logic Prof. Ali Movaghar

CTL* Model Checking Algorithm

111

Page 112: Ch6-Computation Tree Logic.ppt - Sharif University of ...ce.sharif.edu/courses/90-91/2/ce665-1/resources/root/Lecture Notes/… · Chapter 6: Computation Tree Logic Prof. Ali Movaghar

Time Complexity of CTL*

112

Page 113: Ch6-Computation Tree Logic.ppt - Sharif University of ...ce.sharif.edu/courses/90-91/2/ce665-1/resources/root/Lecture Notes/… · Chapter 6: Computation Tree Logic Prof. Ali Movaghar

Complexity of the Model Checking and Algorithms and Satisfiability Checking

113

Page 114: Ch6-Computation Tree Logic.ppt - Sharif University of ...ce.sharif.edu/courses/90-91/2/ce665-1/resources/root/Lecture Notes/… · Chapter 6: Computation Tree Logic Prof. Ali Movaghar

Branching Time vs. Linear Time (in a Nutshell)

114