56
Computation Tree Logic and CTL Model Checking Xiaowang Zhang, 2020 College of Intelligence and Computing Chapter 5 Xiaowang Zhang, 2020 (CIC) Computation Tree Logic Chapter 5 1 / 33

Computation Tree Logic and CTL Model Checking

  • Upload
    others

  • View
    4

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Computation Tree Logic and CTL Model Checking

Computation Tree Logic and CTL Model Checking

Xiaowang Zhang, 2020

College of Intelligence and Computing

Chapter 5

Xiaowang Zhang, 2020 (CIC) Computation Tree Logic Chapter 5 1 / 33

Page 2: Computation Tree Logic and CTL Model Checking

Outline

1 Branching Temporal Logic

2 Syntax & Semantics of CTLSyntax of CTLSemantics

3 CTL Model Checking

Xiaowang Zhang, 2020 (CIC) Computation Tree Logic Chapter 5 2 / 33

Page 3: Computation Tree Logic and CTL Model Checking

Linear Vs. Branching Temporal Logic

So far we have been talking about properties of linear behaviors(sequences, traces)But some properties are not linear, e.g.:

Example

It is possible to recover from any fault.

Example

There exists a way to get back to the initial state from any reachable state.

Xiaowang Zhang, 2020 (CIC) Computation Tree Logic Chapter 5 3 / 33

Page 4: Computation Tree Logic and CTL Model Checking

Linear Vs. Branching Temporal Logic

So far we have been talking about properties of linear behaviors(sequences, traces)But some properties are not linear, e.g.:

Example

It is possible to recover from any fault.

Example

There exists a way to get back to the initial state from any reachable state.

Xiaowang Zhang, 2020 (CIC) Computation Tree Logic Chapter 5 3 / 33

Page 5: Computation Tree Logic and CTL Model Checking

Linear Vs. Branching Temporal Logic

Example

It is possible to recover from any fault.

Based on one (linear) behavior alone, we cannot conclude whether oursystem satisfies the property.

Example

The following system satisfies the property, although it contains a behaviorthat stays forever in state s1:

s0 s1

fault

recovery

Xiaowang Zhang, 2020 (CIC) Computation Tree Logic Chapter 5 4 / 33

Page 6: Computation Tree Logic and CTL Model Checking

Linear Vs. Branching Temporal Logic

Example

It is possible to recover from any fault.

Based on one (linear) behavior alone, we cannot conclude whether oursystem satisfies the property.

Example

The following system satisfies the property, although it contains a behaviorthat stays forever in state s1:

s0 s1

fault

recovery

Xiaowang Zhang, 2020 (CIC) Computation Tree Logic Chapter 5 4 / 33

Page 7: Computation Tree Logic and CTL Model Checking

Linear Vs. Branching Temporal Logic

Example

It is possible to recover from any fault.

Based on one (linear) behavior alone, we cannot conclude whether oursystem satisfies the property.

Example

The following system satisfies the property, although it contains a behaviorthat stays forever in state s1:

s0 s1

fault

recovery

Xiaowang Zhang, 2020 (CIC) Computation Tree Logic Chapter 5 4 / 33

Page 8: Computation Tree Logic and CTL Model Checking

List of Branching Temporal Logic

Hennessy-Milner logic

Computation Tree Logic (CTL)

Extended Computation Tree Logic (CTL): combines LTL and CTLinto a single framework

Alternation-free modal µ-calculus

Modal µ-calculus

Propositional dynamic logic

This slide is referring to Fazle Rabbi’s slide as follows:http: // www. uio. no/ studier/ emner/ matnat/ ifi/ INF5140/ v15/

slides/ ctl. pdf

Xiaowang Zhang, 2020 (CIC) Computation Tree Logic Chapter 5 5 / 33

Page 9: Computation Tree Logic and CTL Model Checking

Model of Computation

Finite-state systems are modeled by labeled state transition graphs, calledKripke Model.

Example

a b

b c c

Figure: Kripke Model

Xiaowang Zhang, 2020 (CIC) Computation Tree Logic Chapter 5 6 / 33

Page 10: Computation Tree Logic and CTL Model Checking

Model of Computation

If some state is designated as the initial state, the structure can beunwound into an infinite tree with that states as the root

Example (Unwind transition system to obtain infinite tree)

a b

b c c

a b c c

Figure: Kripke Model

Xiaowang Zhang, 2020 (CIC) Computation Tree Logic Chapter 5 7 / 33

Page 11: Computation Tree Logic and CTL Model Checking

Motivation of CTL

LTL formulae are evaluated on paths.A state of a TS satisfies an LTL formula if all paths from the given statesatisfy it.Thus, LTL implicitly quantifies universally over paths.

Properties which assert the existence of a path cannot be expressed in LTL.

Example

From any state it is possible to get to the Restart state.

Xiaowang Zhang, 2020 (CIC) Computation Tree Logic Chapter 5 8 / 33

Page 12: Computation Tree Logic and CTL Model Checking

Motivation of CTL

LTL formulae are evaluated on paths.A state of a TS satisfies an LTL formula if all paths from the given statesatisfy it.Thus, LTL implicitly quantifies universally over paths.

Properties which assert the existence of a path cannot be expressed in LTL.

Example

From any state it is possible to get to the Restart state.

Xiaowang Zhang, 2020 (CIC) Computation Tree Logic Chapter 5 8 / 33

Page 13: Computation Tree Logic and CTL Model Checking

Motivation of CTL

Computation Tree Logic (CTL) is a branching-time logic, meaning that itsmodel of time is a tree-like structure in which the future is not determinedthere are different paths in the future, any one of which might be theactual path that is realised.In CTL, two new operators are introduced:

Temporal Operators

A: all paths

E: exists some path

CTL Vs. LTL

A↔ ∀: for All execution

E↔ ∃: there Exists an execution

X↔©: neXt

G↔ �: Globally

F↔ ♦: FinallyXiaowang Zhang, 2020 (CIC) Computation Tree Logic Chapter 5 9 / 33

Page 14: Computation Tree Logic and CTL Model Checking

Outline

1 Branching Temporal Logic

2 Syntax & Semantics of CTLSyntax of CTLSemantics

3 CTL Model Checking

Xiaowang Zhang, 2020 (CIC) Computation Tree Logic Chapter 5 10 / 33

Page 15: Computation Tree Logic and CTL Model Checking

Syntax of CTL

Definition (CTL Formulae)

ψ := a (Atomic formula)a ∈ AP| ¬φ (Negation)| φ1 ∧ φ2 (Conjunction)| φ1 ∨ φ2 (Disjunction)| φ1 → φ2 (Implication)| AXφ (All successors)| EXφ (Some successors)| AFφ (Somewhere, along all paths)| EFφ (Somewhere, along some path)| AGφ (Everywhere, along all paths)| EGφ (Everywhere, along some path)| A[φ1Uψ2] (Until, along all paths)| E[φ1Uφ2] (Until, along some path)

Xiaowang Zhang, 2020 (CIC) Computation Tree Logic Chapter 5 11 / 33

Page 16: Computation Tree Logic and CTL Model Checking

LTL Semantics

Let M = (S ,−→, L) be a Kripke model and s ∈ S .

Definition (Satisfaction relation �)

M, s � true

M, s � a iff a ∈ L(s)

M, s � ¬φ iff M, s 6� φM, s � φ1 ∧ φ2 iff M, s � φ1 and M, s � φ2M, s � φ1 ∨ φ2 iff M, s � φ1 or M, s � φ2M, s � φ1 → φ2 iff M, s 6� φ1 or M, s � φ2

Xiaowang Zhang, 2020 (CIC) Computation Tree Logic Chapter 5 12 / 33

Page 17: Computation Tree Logic and CTL Model Checking

LTL Semantics

Let M = (S ,−→, L) be a Kripke model and s ∈ S .

Definition (Satisfaction relation �)

M, s � true

M, s � a iff a ∈ L(s)

M, s � ¬φ iff M, s 6� φM, s � φ1 ∧ φ2 iff M, s � φ1 and M, s � φ2M, s � φ1 ∨ φ2 iff M, s � φ1 or M, s � φ2M, s � φ1 → φ2 iff M, s 6� φ1 or M, s � φ2

Xiaowang Zhang, 2020 (CIC) Computation Tree Logic Chapter 5 12 / 33

Page 18: Computation Tree Logic and CTL Model Checking

LTL Semantics

Let M = (S ,−→, L) be a Kripke model and s ∈ S .

Definition (Satisfaction relation �)

M, s � true

M, s � a iff a ∈ L(s)

M, s � ¬φ iff M, s 6� φ

M, s � φ1 ∧ φ2 iff M, s � φ1 and M, s � φ2M, s � φ1 ∨ φ2 iff M, s � φ1 or M, s � φ2M, s � φ1 → φ2 iff M, s 6� φ1 or M, s � φ2

Xiaowang Zhang, 2020 (CIC) Computation Tree Logic Chapter 5 12 / 33

Page 19: Computation Tree Logic and CTL Model Checking

LTL Semantics

Let M = (S ,−→, L) be a Kripke model and s ∈ S .

Definition (Satisfaction relation �)

M, s � true

M, s � a iff a ∈ L(s)

M, s � ¬φ iff M, s 6� φM, s � φ1 ∧ φ2 iff M, s � φ1 and M, s � φ2

M, s � φ1 ∨ φ2 iff M, s � φ1 or M, s � φ2M, s � φ1 → φ2 iff M, s 6� φ1 or M, s � φ2

Xiaowang Zhang, 2020 (CIC) Computation Tree Logic Chapter 5 12 / 33

Page 20: Computation Tree Logic and CTL Model Checking

LTL Semantics

Let M = (S ,−→, L) be a Kripke model and s ∈ S .

Definition (Satisfaction relation �)

M, s � true

M, s � a iff a ∈ L(s)

M, s � ¬φ iff M, s 6� φM, s � φ1 ∧ φ2 iff M, s � φ1 and M, s � φ2M, s � φ1 ∨ φ2 iff M, s � φ1 or M, s � φ2

M, s � φ1 → φ2 iff M, s 6� φ1 or M, s � φ2

Xiaowang Zhang, 2020 (CIC) Computation Tree Logic Chapter 5 12 / 33

Page 21: Computation Tree Logic and CTL Model Checking

LTL Semantics

Let M = (S ,−→, L) be a Kripke model and s ∈ S .

Definition (Satisfaction relation �)

M, s � true

M, s � a iff a ∈ L(s)

M, s � ¬φ iff M, s 6� φM, s � φ1 ∧ φ2 iff M, s � φ1 and M, s � φ2M, s � φ1 ∨ φ2 iff M, s � φ1 or M, s � φ2M, s � φ1 → φ2 iff M, s 6� φ1 or M, s � φ2

Xiaowang Zhang, 2020 (CIC) Computation Tree Logic Chapter 5 12 / 33

Page 22: Computation Tree Logic and CTL Model Checking

LTL Semantics

Definition (Satisfaction relation �)

M, s � AXφ iff ∀ s1, s → s1 implies M, s1 � φ

M, s � EXφ iff ∃ s1, s → s1 implies M, s1 � φ

M, s � AGφ iff ∀ π = s1s2 . . . (s = s1),∀ si ,M, si � φ

M, s � EGφ iff ∃ π = s1s2 . . . (s = s1),∀ si ,M, si � φ

M, s � AFφ iff ∀ π = s1s2 . . . (s = s1),∃ si ,M, si � φ

M, s � EFφ iff ∃ π = s1s2 . . . (s = s1),∃ si ,M, si � φ

M, s � A[φ1Uφ2] iff ∀ π = s1s2 . . . (s = s1), π � φ1Uφ2

M, s � E[φ1Uφ2] iff ∃ π = s1s2 . . . (s = s1), π � φ1Uφ2

Xiaowang Zhang, 2020 (CIC) Computation Tree Logic Chapter 5 13 / 33

Page 23: Computation Tree Logic and CTL Model Checking

LTL Semantics

Definition (Satisfaction relation �)

M, s � AXφ iff ∀ s1, s → s1 implies M, s1 � φ

M, s � EXφ iff ∃ s1, s → s1 implies M, s1 � φ

M, s � AGφ iff ∀ π = s1s2 . . . (s = s1),∀ si ,M, si � φ

M, s � EGφ iff ∃ π = s1s2 . . . (s = s1),∀ si ,M, si � φ

M, s � AFφ iff ∀ π = s1s2 . . . (s = s1),∃ si ,M, si � φ

M, s � EFφ iff ∃ π = s1s2 . . . (s = s1),∃ si ,M, si � φ

M, s � A[φ1Uφ2] iff ∀ π = s1s2 . . . (s = s1), π � φ1Uφ2

M, s � E[φ1Uφ2] iff ∃ π = s1s2 . . . (s = s1), π � φ1Uφ2

Xiaowang Zhang, 2020 (CIC) Computation Tree Logic Chapter 5 13 / 33

Page 24: Computation Tree Logic and CTL Model Checking

LTL Semantics

Definition (Satisfaction relation �)

M, s � AXφ iff ∀ s1, s → s1 implies M, s1 � φ

M, s � EXφ iff ∃ s1, s → s1 implies M, s1 � φ

M, s � AGφ iff ∀ π = s1s2 . . . (s = s1), ∀ si ,M, si � φ

M, s � EGφ iff ∃ π = s1s2 . . . (s = s1),∀ si ,M, si � φ

M, s � AFφ iff ∀ π = s1s2 . . . (s = s1),∃ si ,M, si � φ

M, s � EFφ iff ∃ π = s1s2 . . . (s = s1),∃ si ,M, si � φ

M, s � A[φ1Uφ2] iff ∀ π = s1s2 . . . (s = s1), π � φ1Uφ2

M, s � E[φ1Uφ2] iff ∃ π = s1s2 . . . (s = s1), π � φ1Uφ2

Xiaowang Zhang, 2020 (CIC) Computation Tree Logic Chapter 5 13 / 33

Page 25: Computation Tree Logic and CTL Model Checking

LTL Semantics

Definition (Satisfaction relation �)

M, s � AXφ iff ∀ s1, s → s1 implies M, s1 � φ

M, s � EXφ iff ∃ s1, s → s1 implies M, s1 � φ

M, s � AGφ iff ∀ π = s1s2 . . . (s = s1), ∀ si ,M, si � φ

M, s � EGφ iff ∃ π = s1s2 . . . (s = s1), ∀ si ,M, si � φ

M, s � AFφ iff ∀ π = s1s2 . . . (s = s1),∃ si ,M, si � φ

M, s � EFφ iff ∃ π = s1s2 . . . (s = s1),∃ si ,M, si � φ

M, s � A[φ1Uφ2] iff ∀ π = s1s2 . . . (s = s1), π � φ1Uφ2

M, s � E[φ1Uφ2] iff ∃ π = s1s2 . . . (s = s1), π � φ1Uφ2

Xiaowang Zhang, 2020 (CIC) Computation Tree Logic Chapter 5 13 / 33

Page 26: Computation Tree Logic and CTL Model Checking

LTL Semantics

Definition (Satisfaction relation �)

M, s � AXφ iff ∀ s1, s → s1 implies M, s1 � φ

M, s � EXφ iff ∃ s1, s → s1 implies M, s1 � φ

M, s � AGφ iff ∀ π = s1s2 . . . (s = s1), ∀ si ,M, si � φ

M, s � EGφ iff ∃ π = s1s2 . . . (s = s1), ∀ si ,M, si � φ

M, s � AFφ iff ∀ π = s1s2 . . . (s = s1), ∃ si ,M, si � φ

M, s � EFφ iff ∃ π = s1s2 . . . (s = s1),∃ si ,M, si � φ

M, s � A[φ1Uφ2] iff ∀ π = s1s2 . . . (s = s1), π � φ1Uφ2

M, s � E[φ1Uφ2] iff ∃ π = s1s2 . . . (s = s1), π � φ1Uφ2

Xiaowang Zhang, 2020 (CIC) Computation Tree Logic Chapter 5 13 / 33

Page 27: Computation Tree Logic and CTL Model Checking

LTL Semantics

Definition (Satisfaction relation �)

M, s � AXφ iff ∀ s1, s → s1 implies M, s1 � φ

M, s � EXφ iff ∃ s1, s → s1 implies M, s1 � φ

M, s � AGφ iff ∀ π = s1s2 . . . (s = s1), ∀ si ,M, si � φ

M, s � EGφ iff ∃ π = s1s2 . . . (s = s1), ∀ si ,M, si � φ

M, s � AFφ iff ∀ π = s1s2 . . . (s = s1), ∃ si ,M, si � φ

M, s � EFφ iff ∃ π = s1s2 . . . (s = s1), ∃ si ,M, si � φ

M, s � A[φ1Uφ2] iff ∀ π = s1s2 . . . (s = s1), π � φ1Uφ2

M, s � E[φ1Uφ2] iff ∃ π = s1s2 . . . (s = s1), π � φ1Uφ2

Xiaowang Zhang, 2020 (CIC) Computation Tree Logic Chapter 5 13 / 33

Page 28: Computation Tree Logic and CTL Model Checking

LTL Semantics

Definition (Satisfaction relation �)

M, s � AXφ iff ∀ s1, s → s1 implies M, s1 � φ

M, s � EXφ iff ∃ s1, s → s1 implies M, s1 � φ

M, s � AGφ iff ∀ π = s1s2 . . . (s = s1), ∀ si ,M, si � φ

M, s � EGφ iff ∃ π = s1s2 . . . (s = s1), ∀ si ,M, si � φ

M, s � AFφ iff ∀ π = s1s2 . . . (s = s1), ∃ si ,M, si � φ

M, s � EFφ iff ∃ π = s1s2 . . . (s = s1), ∃ si ,M, si � φ

M, s � A[φ1Uφ2] iff ∀ π = s1s2 . . . (s = s1), π � φ1Uφ2

M, s � E[φ1Uφ2] iff ∃ π = s1s2 . . . (s = s1), π � φ1Uφ2

Xiaowang Zhang, 2020 (CIC) Computation Tree Logic Chapter 5 13 / 33

Page 29: Computation Tree Logic and CTL Model Checking

LTL Semantics

Definition (Satisfaction relation �)

M, s � AXφ iff ∀ s1, s → s1 implies M, s1 � φ

M, s � EXφ iff ∃ s1, s → s1 implies M, s1 � φ

M, s � AGφ iff ∀ π = s1s2 . . . (s = s1), ∀ si ,M, si � φ

M, s � EGφ iff ∃ π = s1s2 . . . (s = s1), ∀ si ,M, si � φ

M, s � AFφ iff ∀ π = s1s2 . . . (s = s1), ∃ si ,M, si � φ

M, s � EFφ iff ∃ π = s1s2 . . . (s = s1), ∃ si ,M, si � φ

M, s � A[φ1Uφ2] iff ∀ π = s1s2 . . . (s = s1), π � φ1Uφ2

M, s � E[φ1Uφ2] iff ∃ π = s1s2 . . . (s = s1), π � φ1Uφ2

Xiaowang Zhang, 2020 (CIC) Computation Tree Logic Chapter 5 13 / 33

Page 30: Computation Tree Logic and CTL Model Checking

CTL Semantics: Intuitions

Xiaowang Zhang, 2020 (CIC) Computation Tree Logic Chapter 5 14 / 33

Page 31: Computation Tree Logic and CTL Model Checking

Examples of CTL formula

Example

There is a reachable state satisfying a: this is written EFa.

From all reachable states satisfying a, it is possible to maintain acontinuously until reaching a state satisfying b: AG(a→ E(aUb)).

Whenever a state satisfying a is reached, the system can exhibit bcontinuously forevermore: AG(a→ EGb).

There is a reachable state from which all reachable states satisfy a:EF (AGa).

Xiaowang Zhang, 2020 (CIC) Computation Tree Logic Chapter 5 15 / 33

Page 32: Computation Tree Logic and CTL Model Checking

Examples of CTL formula

Example

There is a reachable state satisfying a: this is written EFa.

From all reachable states satisfying a, it is possible to maintain acontinuously until reaching a state satisfying b: AG(a→ E(aUb)).

Whenever a state satisfying a is reached, the system can exhibit bcontinuously forevermore: AG(a→ EGb).

There is a reachable state from which all reachable states satisfy a:EF (AGa).

Xiaowang Zhang, 2020 (CIC) Computation Tree Logic Chapter 5 15 / 33

Page 33: Computation Tree Logic and CTL Model Checking

Examples of CTL formula

Example

There is a reachable state satisfying a: this is written EFa.

From all reachable states satisfying a, it is possible to maintain acontinuously until reaching a state satisfying b: AG(a→ E(aUb)).

Whenever a state satisfying a is reached, the system can exhibit bcontinuously forevermore: AG(a→ EGb).

There is a reachable state from which all reachable states satisfy a:EF (AGa).

Xiaowang Zhang, 2020 (CIC) Computation Tree Logic Chapter 5 15 / 33

Page 34: Computation Tree Logic and CTL Model Checking

Examples of CTL formula

Example

There is a reachable state satisfying a: this is written EFa.

From all reachable states satisfying a, it is possible to maintain acontinuously until reaching a state satisfying b: AG(a→ E(aUb)).

Whenever a state satisfying a is reached, the system can exhibit bcontinuously forevermore: AG(a→ EGb).

There is a reachable state from which all reachable states satisfy a:EF (AGa).

Xiaowang Zhang, 2020 (CIC) Computation Tree Logic Chapter 5 15 / 33

Page 35: Computation Tree Logic and CTL Model Checking

Expressive Power

LTL and CTL have different expressive powers. The choice between LTLand CTL depends on the application and the personal preferences.

For example, there is no CTL formula that is equivalent to the LTLformula ♦�a.

Likewise, there is no LTL formula that is equivalent to the CTLformula AG(EFa).

The disjunction ♦�a ∨ AG(EFa) is a CTL∗ formula that is notexpressible in either CTL or LTL.

Xiaowang Zhang, 2020 (CIC) Computation Tree Logic Chapter 5 16 / 33

Page 36: Computation Tree Logic and CTL Model Checking

Expressive Power

LTL and CTL have different expressive powers. The choice between LTLand CTL depends on the application and the personal preferences.

For example, there is no CTL formula that is equivalent to the LTLformula ♦�a.

Likewise, there is no LTL formula that is equivalent to the CTLformula AG(EFa).

The disjunction ♦�a ∨ AG(EFa) is a CTL∗ formula that is notexpressible in either CTL or LTL.

Xiaowang Zhang, 2020 (CIC) Computation Tree Logic Chapter 5 16 / 33

Page 37: Computation Tree Logic and CTL Model Checking

Expressive Power

LTL and CTL have different expressive powers. The choice between LTLand CTL depends on the application and the personal preferences.

For example, there is no CTL formula that is equivalent to the LTLformula ♦�a.

Likewise, there is no LTL formula that is equivalent to the CTLformula AG(EFa).

The disjunction ♦�a ∨ AG(EFa) is a CTL∗ formula that is notexpressible in either CTL or LTL.

Xiaowang Zhang, 2020 (CIC) Computation Tree Logic Chapter 5 16 / 33

Page 38: Computation Tree Logic and CTL Model Checking

Expressive Power

LTL and CTL have different expressive powers. The choice between LTLand CTL depends on the application and the personal preferences.

For example, there is no CTL formula that is equivalent to the LTLformula ♦�a.

Likewise, there is no LTL formula that is equivalent to the CTLformula AG(EFa).

The disjunction ♦�a ∨ AG(EFa) is a CTL∗ formula that is notexpressible in either CTL or LTL.

Xiaowang Zhang, 2020 (CIC) Computation Tree Logic Chapter 5 16 / 33

Page 39: Computation Tree Logic and CTL Model Checking

Expressive Power

There is no CTL formula that is equivalent to the LTL formula ♦�a.

M, s0 �LTL ♦�a, but M, s0 6�CTL AF(AGa)

Xiaowang Zhang, 2020 (CIC) Computation Tree Logic Chapter 5 17 / 33

Page 40: Computation Tree Logic and CTL Model Checking

Expressive Power

There is no CTL formula that is equivalent to the LTL formula ♦�a.

M, s0 �LTL ♦�a, but M, s0 6�CTL AF(AGa)

Xiaowang Zhang, 2020 (CIC) Computation Tree Logic Chapter 5 17 / 33

Page 41: Computation Tree Logic and CTL Model Checking

Expressive Power

There is no LTL formula that is equivalent to the CTL formula AG(EFa).

This is shown by contradiction: assume ϕ ≡ AG(EFa). let:

M |= AG(EF a), and thus, by assumption, M |= ϕ.

Paths(M ′) ⊆ Paths(M). Thus M ′ |= ϕ.

But M ′ 6|= AG(EFa) as path sw 6|= G(EFa).

Xiaowang Zhang, 2020 (CIC) Computation Tree Logic Chapter 5 18 / 33

Page 42: Computation Tree Logic and CTL Model Checking

Equivalence Between CTL Formula

Definition (Equivalence)

Two CTL formulas φ and ϕ are said to be semantically equivalent if anystate in any model which satisfies one of them also satisfies the other; wedenote this by φ ≡ ϕ.

Example

¬AFφ ≡ EG¬φ;

¬EFφ ≡ AG¬φ;

¬AXφ ≡ EX¬φ;

AFφ ≡ A[trueUφ];

EFφ ≡ E[trueUφ].

Xiaowang Zhang, 2020 (CIC) Computation Tree Logic Chapter 5 19 / 33

Page 43: Computation Tree Logic and CTL Model Checking

Adequate sets of CTL connectives

There are eight basic CTL operators:

AX and EX;

AF and EF;

AG and EG;

AU and EU.

Xiaowang Zhang, 2020 (CIC) Computation Tree Logic Chapter 5 20 / 33

Page 44: Computation Tree Logic and CTL Model Checking

Adequate sets of CTL connectives

Each of ten basic CTL operators can be expressed in terms of threeoperators EX, EG, and EU.

AXφ ≡ ¬EX(¬φ);EFφ ≡ E(trueUφ);

AGφ ≡ ¬EF(¬φ);AFφ ≡ ¬EG(¬φ);A[φUψ] ≡ ¬E[(¬φU(¬φ ∧ ¬ψ)] ∧ ¬EG¬ψ;

A[φWψ] ≡ ¬E(¬φU¬ψ);E[φWψ] ≡ ¬A(¬φU¬ψ).

Xiaowang Zhang, 2020 (CIC) Computation Tree Logic Chapter 5 21 / 33

Page 45: Computation Tree Logic and CTL Model Checking

Outline

1 Branching Temporal Logic

2 Syntax & Semantics of CTLSyntax of CTLSemantics

3 CTL Model Checking

Xiaowang Zhang, 2020 (CIC) Computation Tree Logic Chapter 5 22 / 33

Page 46: Computation Tree Logic and CTL Model Checking

CTL model checking

INPUT: a model M = (S ,−→, L) and a CTL formula φ.OUTPUT: the set of states of M which satisfy φ.

First, we convert φ with the adequate sets of CTL connectives (i.e.,¬, ∨, EX, EU, EG).

Next, label the states of M with the subformulas of φ that aresatisfied there, starting with the smallest subformulas and workingoutwards towards φ.

Suppose ψ is a subformula of φ and states satisfying all theimmediate subformulas of ψ have already been labelled. Wedetermine by a case analysis which states to label with ψ.

Xiaowang Zhang, 2020 (CIC) Computation Tree Logic Chapter 5 23 / 33

Page 47: Computation Tree Logic and CTL Model Checking

CTL model checking

If ψ

false: then no states are labelled with false.

a: then label s with a if a ∈ L(s).

ψ1 ∧ψ2: label s with ψ1 ∧ψ2 if s is already labelled both with ψ1 andwith ψ2.

¬ψ1: label s with ψ1 if s is not already labelled with ψ1.

EXψ1: label any state with EXψ1 if one of its successors is labelledwith ψ1.

Xiaowang Zhang, 2020 (CIC) Computation Tree Logic Chapter 5 24 / 33

Page 48: Computation Tree Logic and CTL Model Checking

CTL model checking

If ψ is E(ψ1Uψ2):

If any state s is labelled with ψ2, label it with E(ψ1Uψ2).

Repeat: label any state with E(ψ1Uψ2) if it is labelled with ψ1 and atleast one of its successors is labelled with E(ψ1Uψ2), until there is nochange. This step is illustrated in the following figure:

Xiaowang Zhang, 2020 (CIC) Computation Tree Logic Chapter 5 25 / 33

Page 49: Computation Tree Logic and CTL Model Checking

CTL model checking

If ψ is EG(ψ1):

Label all the states with EGψ1.

If any state s is not labelled with ψ1, delete the label EGψ1.

Repeat: delete the label EGψ1 from any state if none of its successorsis labelled with EGψ1; until there is no change.

Xiaowang Zhang, 2020 (CIC) Computation Tree Logic Chapter 5 26 / 33

Page 50: Computation Tree Logic and CTL Model Checking

Complexity of CTL Model Checking Algorithm

The complexity of the above mentioned algorithm isO(| f | × | S | ×(| S | × | R |)), where | f | is the number of connectivesin the formula, | S | is the number of states and | R | is the number oftransitions; the algorithm is linear in the size of the formula and quadraticin the size of the model.

Xiaowang Zhang, 2020 (CIC) Computation Tree Logic Chapter 5 27 / 33

Page 51: Computation Tree Logic and CTL Model Checking

A variant which is more efficient

For EX and EU we do as before (but take care to search the model bybackwards breadth-first search, for this ensures that we wont have to passover any node twice). For the EGψ case:

Restrict the graph to states satisfying ψ, i.e., delete all other statesand their transitions;Find the maximal strongly connected components (SCCs); these aremaximal regions of the state space in which every state is linked with(= has a finite path to) every other one in that region.Use backwards breadth-first search on the restricted graph to find anystate that can reach an SCC.

The complexity of this algorithm is O(| f | +(| S | + | R |)), i.e., linearboth in the size of the model and in the size of the formula.

Xiaowang Zhang, 2020 (CIC) Computation Tree Logic Chapter 5 28 / 33

Page 52: Computation Tree Logic and CTL Model Checking

CTL Fairness-Intuition

Consider the dining philosopher problem. It is not very reasonable toassume that “One philosopher keeps eating forever”.

How can we rule out this behavior?

One solution is to use “Fairness Constraints”.

Fairness constraints rule out unrealistic executions

Xiaowang Zhang, 2020 (CIC) Computation Tree Logic Chapter 5 29 / 33

Page 53: Computation Tree Logic and CTL Model Checking

Fairness Constraint

Sets of states (constraint) that must occur infinitely often along acomputation path to be considered

Usually described by a formula of the logic

Fairness constraints restrict the path quantifiers (E and A) to fairpaths

EFφ holds at state s only if there exists a fair path from s along whichφ holds

AGφ holds at s if φ holds in all states reachable from s along fairpaths.

If fairness constraints are interpreted as sets of states, then a fair pathmust contain an element of each fairness constraint infinitely often. Iffairness constraints are interpreted as CTL formulas, then a path is fair ifeach constraint is true infinitely often along the path.

Xiaowang Zhang, 2020 (CIC) Computation Tree Logic Chapter 5 30 / 33

Page 54: Computation Tree Logic and CTL Model Checking

Fairness Constraint

Sets of states (constraint) that must occur infinitely often along acomputation path to be considered

Usually described by a formula of the logic

Fairness constraints restrict the path quantifiers (E and A) to fairpaths

EFφ holds at state s only if there exists a fair path from s along whichφ holds

AGφ holds at s if φ holds in all states reachable from s along fairpaths.

If fairness constraints are interpreted as sets of states, then a fair pathmust contain an element of each fairness constraint infinitely often. Iffairness constraints are interpreted as CTL formulas, then a path is fair ifeach constraint is true infinitely often along the path.

Xiaowang Zhang, 2020 (CIC) Computation Tree Logic Chapter 5 31 / 33

Page 55: Computation Tree Logic and CTL Model Checking

Fairness Constraint in CTL

In CTL fairness constraints cannot be expressed!Solution:

Impose Fairness Constraints on top of the Kripke Model.

We call Fair Computation Paths those paths verifying a fairnessconstraint infinitely often.

We call Fair Kripke Models those models restricted to fair paths.

Definition

Fair Kripke Model Formally, a fair Kripke structure is a 4-tripleM = (S ,R, L,F ), where (S ,R, L) are defined as before and F ⊆ 2S is aset of fairness constraints. Let π = s0s1 . . . be a path in M. Define

inf (π) = {s | s = si for infinitely manyi}.

We say that π is fair if and only if for every P ∈ F , inf (π) ∩ P 6= ∅.

Xiaowang Zhang, 2020 (CIC) Computation Tree Logic Chapter 5 32 / 33

Page 56: Computation Tree Logic and CTL Model Checking

Assignments

Exercise 5.1

Please select at least 1 questions from the following list (see next pages)to answer and send your report to Email: [email protected].

From http://www.win.tue.nl/~andova/education/2IF25/Ex2.pdf

Xiaowang Zhang, 2020 (CIC) Computation Tree Logic Chapter 5 33 / 33