Model Checking Lecture #14: Fairness [Baier & Katoen, Chapter - - PowerPoint PPT Presentation

model checking
SMART_READER_LITE
LIVE PREVIEW

Model Checking Lecture #14: Fairness [Baier & Katoen, Chapter - - PowerPoint PPT Presentation

Model Checking Lecture #14: Fairness [Baier & Katoen, Chapter 3.5, 5.1.6, 6.5] Joost-Pieter Katoen Software Modeling and Verification Group Model Checking Course, RWTH Aachen, WiSe 2019/2020 Joost-Pieter Katoen Lecture#14 1/62 Overview


slide-1
SLIDE 1

Model Checking

Lecture #14: Fairness [Baier & Katoen, Chapter 3.5, 5.1.6, 6.5] Joost-Pieter Katoen

Software Modeling and Verification Group

Model Checking Course, RWTH Aachen, WiSe 2019/2020

Joost-Pieter Katoen Lecture#14 1/62

slide-2
SLIDE 2

Overview

1

The Relevance of Fairness

2

Fairness Assumptions

3

Fairness and Safety Properties

4

LTL Model Checking Under Fairness

5

CTL Fairness Assumptions

6

CTL Model Checking Under Fairness

7

Summary

Joost-Pieter Katoen Lecture#14 2/62

slide-3
SLIDE 3

The Relevance of Fairness

Overview

1

The Relevance of Fairness

2

Fairness Assumptions

3

Fairness and Safety Properties

4

LTL Model Checking Under Fairness

5

CTL Fairness Assumptions

6

CTL Model Checking Under Fairness

7

Summary

Joost-Pieter Katoen Lecture#14 3/62

slide-4
SLIDE 4

The Relevance of Fairness

Does This Multi-Threaded Program Terminate?

Inc ∣∣∣ Reset where thread Inc = while ⟨ x ≥ 0 do x ∶= x + 1 ⟩ od thread Reset = x ∶= −1 x is a shared integer variable that initially has value 0

Joost-Pieter Katoen Lecture#14 4/62

slide-5
SLIDE 5

The Relevance of Fairness

Is It Possible To Starve?

Joost-Pieter Katoen Lecture#14 5/62

slide-6
SLIDE 6

The Relevance of Fairness

Thread Two Starves

Is it fair that thread two never gets access to the critical section despite infinitely often having the possibility to do so?

Joost-Pieter Katoen Lecture#14 6/62

slide-7
SLIDE 7

The Relevance of Fairness

Fairness

▶ Starvation freedom is often considered under thread fairness

⇒ there is a fair scheduling of the execution of threads

Joost-Pieter Katoen Lecture#14 7/62

slide-8
SLIDE 8

The Relevance of Fairness

Fairness

▶ Starvation freedom is often considered under thread fairness

⇒ there is a fair scheduling of the execution of threads

▶ Fairness is concerned with a fair resolution of non-determinism

▶ such that it is not biased to consistently ignore a possible option

Joost-Pieter Katoen Lecture#14 7/62

slide-9
SLIDE 9

The Relevance of Fairness

Fairness

▶ Starvation freedom is often considered under thread fairness

⇒ there is a fair scheduling of the execution of threads

▶ Fairness is concerned with a fair resolution of non-determinism

▶ such that it is not biased to consistently ignore a possible option

▶ Fairness is typically needed to prove a liveness property

▶ to prove some form of progress, progress needs to be possible ▶ fairness does not affect safety properties

Joost-Pieter Katoen Lecture#14 7/62

slide-10
SLIDE 10

The Relevance of Fairness

Fairness

▶ Starvation freedom is often considered under thread fairness

⇒ there is a fair scheduling of the execution of threads

▶ Fairness is concerned with a fair resolution of non-determinism

▶ such that it is not biased to consistently ignore a possible option

▶ Fairness is typically needed to prove a liveness property

▶ to prove some form of progress, progress needs to be possible ▶ fairness does not affect safety properties

▶ Problem: liveness properties constrain infinite behaviours

▶ but some traces—that are unfair—refute the liveness property

Joost-Pieter Katoen Lecture#14 7/62

slide-11
SLIDE 11

The Relevance of Fairness

Fairness Constraints

▶ What is wrong with our examples? Nothing!

▶ interleaving: not realistic as no processor is ∞ faster than another ▶ semaphore-based mutual exclusion: level of abstraction

Joost-Pieter Katoen Lecture#14 8/62

slide-12
SLIDE 12

The Relevance of Fairness

Fairness Constraints

▶ What is wrong with our examples? Nothing!

▶ interleaving: not realistic as no processor is ∞ faster than another ▶ semaphore-based mutual exclusion: level of abstraction

▶ Rule out “unrealistic” exectuions by imposing fairness constraints

▶ what to rule out? ⇒ different kinds of fairness constraints

Joost-Pieter Katoen Lecture#14 8/62

slide-13
SLIDE 13

The Relevance of Fairness

Fairness Constraints

▶ What is wrong with our examples? Nothing!

▶ interleaving: not realistic as no processor is ∞ faster than another ▶ semaphore-based mutual exclusion: level of abstraction

▶ Rule out “unrealistic” exectuions by imposing fairness constraints

▶ what to rule out? ⇒ different kinds of fairness constraints

▶ “A thread gets its turn infinitely often”

▶ always unconditional fairness ▶ if it is enabled infinitely often strong fairness ▶ if it is continuously enabled from some point on weak fairness

Joost-Pieter Katoen Lecture#14 8/62

slide-14
SLIDE 14

The Relevance of Fairness

Fairness

This program terminates assuming unconditional (thread) fairness: thread Inc = while ⟨ x ≥ 0 do x ∶= x + 1 ⟩ od thread Reset = x ∶= −1 as thread Reset eventually will set x to −1 x is a shared integer variable that initially has value 0

Joost-Pieter Katoen Lecture#14 9/62

slide-15
SLIDE 15

The Relevance of Fairness

Avoiding Starvation by Fairness

If the infinitely often enabled enter2 action is not ignored infinitely often, thread two does not starve.

Joost-Pieter Katoen Lecture#14 10/62

slide-16
SLIDE 16

The Relevance of Fairness

Avoiding Starvation by Fairness

Note that enter2 is not enabled continuously during the run. Weak fairness this does not suffice.

Joost-Pieter Katoen Lecture#14 10/62

slide-17
SLIDE 17

Fairness Assumptions

Overview

1

The Relevance of Fairness

2

Fairness Assumptions

3

Fairness and Safety Properties

4

LTL Model Checking Under Fairness

5

CTL Fairness Assumptions

6

CTL Model Checking Under Fairness

7

Summary

Joost-Pieter Katoen Lecture#14 11/62

slide-18
SLIDE 18

Fairness Assumptions

LTL Fairness Constraints

Definition: LTL fairness constraints Let Φ and Ψ be propositional logic formulas over AP.

  • 1. An unconditional LTL fairness constraint is of the form:

ufair = □◇ Ψ

  • 2. A strong LTL fairness condition is of the form:

sfair = □◇ Φ ⟶ □◇ Ψ

  • 3. A weak LTL fairness constraint is of the form:

wfair = ◇□ Φ ⟶ □◇ Ψ Φ stands for “. . . is enabled”; Ψ for “. . . is taken”

Joost-Pieter Katoen Lecture#14 12/62

slide-19
SLIDE 19

Fairness Assumptions

Relating Fairness Constraints

unconditional fair ⇒ strong fair ⇒ weak fair.

Joost-Pieter Katoen Lecture#14 13/62

slide-20
SLIDE 20

Fairness Assumptions

Fairness Assumptions

Definition: fairness assumption An LTL fairness assumption is a conjunction of LTL fairness constraints. The general format of fairness assumption fair is fair = ufair ∧ sfair ∧ wfair .

Joost-Pieter Katoen Lecture#14 14/62

slide-21
SLIDE 21

Fairness Assumptions

Fair Traces and Fair Satisfaction

Definition: fair paths and fair traces For state s in transition system TS (over AP) and LTL fairness assumption fair, let FairPathsfair(s) = { π ∈ Paths(s) ∣ π ⊧ fair } FairTracesfair(s) = { trace(π) ∣ π ∈ FairPathsfair(s) }.

Joost-Pieter Katoen Lecture#14 15/62

slide-22
SLIDE 22

Fairness Assumptions

Fair Traces and Fair Satisfaction

Definition: fair paths and fair traces For state s in transition system TS (over AP) and LTL fairness assumption fair, let FairPathsfair(s) = { π ∈ Paths(s) ∣ π ⊧ fair } FairTracesfair(s) = { trace(π) ∣ π ∈ FairPathsfair(s) }. Definition: fair satisfaction relation For LTL-formula ϕ, and LTL fairness assumption fair: s ⊧fair ϕ if and only if ∀π ∈ FairPathsfair(s). π ⊧ ϕ TS ⊧fair ϕ if and only if ∀s0 ∈ I. s0 ⊧fair ϕ. The relation ⊧fair is the fair satisfaction relation for LTL.

Joost-Pieter Katoen Lecture#14 15/62

slide-23
SLIDE 23

Fairness Assumptions

Example: Fair Runs and Fair Traces

Joost-Pieter Katoen Lecture#14 16/62

slide-24
SLIDE 24

Fairness Assumptions

Example: Fair Runs and Fair Traces

▶ Let Φ = “action enter2 is enabled” and Ψ = “action enter2 is taken”

Joost-Pieter Katoen Lecture#14 16/62

slide-25
SLIDE 25

Fairness Assumptions

Example: Fair Runs and Fair Traces

▶ Let Φ = “action enter2 is enabled” and Ψ = “action enter2 is taken” ▶ Run ⟨n1, n2, 1⟩ req1

− − − − − → ⟨w1, n2, 1⟩ enter1 − − − − − − − → ⟨c1, n2, 0⟩ rel − − − − → ⟨n1, n2, 1⟩ req1 − − − − − → . . .

▶ . . . is not unconditionally fair ▶ . . . but strongly fair, as action enter2 is never enabled along the run

Joost-Pieter Katoen Lecture#14 16/62

slide-26
SLIDE 26

Fairness Assumptions

Example: Fair Runs and Fair Traces

▶ Let Φ = “action enter2 is enabled” and Ψ = “action enter2 is taken” ▶ Run ⟨n1, n2, 1⟩ req1

− − − − − → ⟨w1, n2, 1⟩ enter1 − − − − − − − → ⟨c1, n2, 0⟩ rel − − − − → ⟨n1, n2, 1⟩ req1 − − − − − → . . .

▶ . . . is not unconditionally fair ▶ . . . but strongly fair, as action enter2 is never enabled along the run

▶ Run ⟨n1, n2, 1⟩ req2

− − − − − → ⟨n1, w2, 1⟩ req1 − − − − − → ⟨w1, w2, 1⟩ enter1 − − − − − − − → ⟨c1, w2, 0⟩ rel − − − − → . . .

▶ . . . is not strongly fair as enter2 is ∞ often enabled but never taken ▶ . . . but weakly fair for as enter2 is not always enabled along the run

Joost-Pieter Katoen Lecture#14 16/62

slide-27
SLIDE 27

Fairness Assumptions

Example: An Arbiter for Mutual Exclusion

TS1 ∥ Arbiter ∥ TS2 / ⊧ □◇ crit1 But: TS1 ∥ Arbiter ∥ TS2 ⊧fair □◇ crit1 ∧ □◇ crit2 with fair = □◇ head ∧ □◇ tail

Joost-Pieter Katoen Lecture#14 17/62

slide-28
SLIDE 28

Fairness and Safety Properties

Overview

1

The Relevance of Fairness

2

Fairness Assumptions

3

Fairness and Safety Properties

4

LTL Model Checking Under Fairness

5

CTL Fairness Assumptions

6

CTL Model Checking Under Fairness

7

Summary

Joost-Pieter Katoen Lecture#14 18/62

slide-29
SLIDE 29

Fairness and Safety Properties

Realisable Fairness

Definition: realisable fairness Fairness assumption fair is realisable for transition system TS if for any reachable state s: FairPathsfair(s) ≠ ∅. A fairness assumption is realisable for TS if every initial finite path fragment of TS can be completed to a fair run.

Joost-Pieter Katoen Lecture#14 19/62

slide-30
SLIDE 30

Fairness and Safety Properties

The Fairness Suffix Property

For any (infinite) fair path π, it holds

  • 1. all suffixes of π are fair too.
  • 2. any finite path extended by π is fair.

Proof. Rather straightforward.

Joost-Pieter Katoen Lecture#14 20/62

slide-31
SLIDE 31

Fairness and Safety Properties

Realisable Fairness and Safety

Safety properties are preserved under realisable fairness For transition system TS and safety property Esafe (both over AP) and fair a realisable fairness assumption for TS: TS ⊧ Esafe if and only if TS ⊧fair Esafe. Proof.

Joost-Pieter Katoen Lecture#14 21/62

slide-32
SLIDE 32

Fairness and Safety Properties

Realisable Fairness and Safety

Safety properties are preserved under realisable fairness For transition system TS and safety property Esafe (both over AP) and fair a realisable fairness assumption for TS: TS ⊧ Esafe if and only if TS ⊧fair Esafe. Proof. Non-realisable fairness may harm safety properties. Shown by example.

Joost-Pieter Katoen Lecture#14 21/62

slide-33
SLIDE 33

LTL Model Checking Under Fairness

Overview

1

The Relevance of Fairness

2

Fairness Assumptions

3

Fairness and Safety Properties

4

LTL Model Checking Under Fairness

5

CTL Fairness Assumptions

6

CTL Model Checking Under Fairness

7

Summary

Joost-Pieter Katoen Lecture#14 22/62

slide-34
SLIDE 34

LTL Model Checking Under Fairness

The Fair LTL Model-Checking Problem

Given:

  • 1. a finite transition system TS
  • 2. an LTL formula ϕ, and
  • 3. an LTL fairness assumption fair

Question: does TS ⊧fair ϕ?

Joost-Pieter Katoen Lecture#14 23/62

slide-35
SLIDE 35

LTL Model Checking Under Fairness

Fair LTL Model Checking

For transition system TS, LTL formula ϕ and LTL fairness assumption fair: TS ⊧fair ϕ

  • fair LTL model checking

if and only if TS ⊧ ( fair → ϕ )

  • LTL model checking

Joost-Pieter Katoen Lecture#14 24/62

slide-36
SLIDE 36

LTL Model Checking Under Fairness

Fair LTL Model Checking

For transition system TS, LTL formula ϕ and LTL fairness assumption fair: TS ⊧fair ϕ

  • fair LTL model checking

if and only if TS ⊧ ( fair → ϕ )

  • LTL model checking

The fair LTL model-checking problem for ϕ under fairness assumption fair can be reduced to the LTL model-checking problem for fair → ϕ.

Joost-Pieter Katoen Lecture#14 24/62

slide-37
SLIDE 37

LTL Model Checking Under Fairness

Fair LTL Model Checking

For transition system TS, LTL formula ϕ and LTL fairness assumption fair: TS ⊧fair ϕ

  • fair LTL model checking

if and only if TS ⊧ ( fair → ϕ )

  • LTL model checking

The fair LTL model-checking problem for ϕ under fairness assumption fair can be reduced to the LTL model-checking problem for fair → ϕ. This approach is not applicable to CTL (as we will discuss)

Joost-Pieter Katoen Lecture#14 24/62

slide-38
SLIDE 38

LTL Model Checking Under Fairness

Which Fairness Notion?

▶ Fairness constraints aim to rule out “unreasonable” runs

Joost-Pieter Katoen Lecture#14 25/62

slide-39
SLIDE 39

LTL Model Checking Under Fairness

Which Fairness Notion?

▶ Fairness constraints aim to rule out “unreasonable” runs ▶ Too strong? ⇒ reasonable runs ruled out. Verification result:

▶ “false”: error found ▶ “true”: don’t know as some relevant execution may refute it

Joost-Pieter Katoen Lecture#14 25/62

slide-40
SLIDE 40

LTL Model Checking Under Fairness

Which Fairness Notion?

▶ Fairness constraints aim to rule out “unreasonable” runs ▶ Too strong? ⇒ reasonable runs ruled out. Verification result:

▶ “false”: error found ▶ “true”: don’t know as some relevant execution may refute it

▶ Too weak? ⇒ too many runs considered. Verification result:

▶ “true”: formula holds ▶ “false”: don’t know, as refutation maybe due to an unreasonable run

Joost-Pieter Katoen Lecture#14 25/62

slide-41
SLIDE 41

LTL Model Checking Under Fairness

Which Fairness Notion?

▶ Fairness constraints aim to rule out “unreasonable” runs ▶ Too strong? ⇒ reasonable runs ruled out. Verification result:

▶ “false”: error found ▶ “true”: don’t know as some relevant execution may refute it

▶ Too weak? ⇒ too many runs considered. Verification result:

▶ “true”: formula holds ▶ “false”: don’t know, as refutation maybe due to an unreasonable run

Rules of thumb: ▶ strong (or unconditional) fairness is useful for solving contentions ▶ weak fairness is useful to resolve unfair scheduling of threads

Joost-Pieter Katoen Lecture#14 25/62

slide-42
SLIDE 42

CTL Fairness Assumptions

Overview

1

The Relevance of Fairness

2

Fairness Assumptions

3

Fairness and Safety Properties

4

LTL Model Checking Under Fairness

5

CTL Fairness Assumptions

6

CTL Model Checking Under Fairness

7

Summary

Joost-Pieter Katoen Lecture#14 26/62

slide-43
SLIDE 43

CTL Fairness Assumptions

Fairness Constraints in CTL

▶ For LTL it holds: TS ⊧fair ϕ if and only if TS ⊧ (fair → ϕ)

Joost-Pieter Katoen Lecture#14 27/62

slide-44
SLIDE 44

CTL Fairness Assumptions

Fairness Constraints in CTL

▶ For LTL it holds: TS ⊧fair ϕ if and only if TS ⊧ (fair → ϕ) ▶ An analogous approach for CTL is not possible

Joost-Pieter Katoen Lecture#14 27/62

slide-45
SLIDE 45

CTL Fairness Assumptions

Fairness Constraints in CTL

▶ For LTL it holds: TS ⊧fair ϕ if and only if TS ⊧ (fair → ϕ) ▶ An analogous approach for CTL is not possible ▶ Formulas form ∀(fair → ϕ) and ∃(fair ∧ ϕ) needed

Joost-Pieter Katoen Lecture#14 27/62

slide-46
SLIDE 46

CTL Fairness Assumptions

Fairness Constraints in CTL

▶ For LTL it holds: TS ⊧fair ϕ if and only if TS ⊧ (fair → ϕ) ▶ An analogous approach for CTL is not possible ▶ Formulas form ∀(fair → ϕ) and ∃(fair ∧ ϕ) needed ▶ But: boolean combinations of path formulae are not allowed in CTL

Joost-Pieter Katoen Lecture#14 27/62

slide-47
SLIDE 47

CTL Fairness Assumptions

Fairness Constraints in CTL

▶ For LTL it holds: TS ⊧fair ϕ if and only if TS ⊧ (fair → ϕ) ▶ An analogous approach for CTL is not possible ▶ Formulas form ∀(fair → ϕ) and ∃(fair ∧ ϕ) needed ▶ But: boolean combinations of path formulae are not allowed in CTL ▶ and: strong fairness constraint □◇ b → □◇ c, i.e., ◇□ ¬b ∨ ◇ □ c

cannot be expressed in CTL as persistence properties are not in CTL

Joost-Pieter Katoen Lecture#14 27/62

slide-48
SLIDE 48

CTL Fairness Assumptions

Fairness Constraints in CTL

▶ For LTL it holds: TS ⊧fair ϕ if and only if TS ⊧ (fair → ϕ) ▶ An analogous approach for CTL is not possible ▶ Formulas form ∀(fair → ϕ) and ∃(fair ∧ ϕ) needed ▶ But: boolean combinations of path formulae are not allowed in CTL ▶ and: strong fairness constraint □◇ b → □◇ c, i.e., ◇□ ¬b ∨ ◇ □ c

cannot be expressed in CTL as persistence properties are not in CTL

▶ Solution: change the semantics of CTL by ignoring unfair paths

Joost-Pieter Katoen Lecture#14 27/62

slide-49
SLIDE 49

CTL Fairness Assumptions

CTL Fairness Constraints

Definition: CTL fairness constraints A strong CTL fairness constraint is a formula of the form: sfair = ⋀

0<i≤k

(□◇ Φi → □◇ Ψi) where Φi and Ψi (for 0 < i ≤ k) are CTL state-formulas over AP.

Joost-Pieter Katoen Lecture#14 28/62

slide-50
SLIDE 50

CTL Fairness Assumptions

CTL Fairness Constraints

Definition: CTL fairness constraints A strong CTL fairness constraint is a formula of the form: sfair = ⋀

0<i≤k

(□◇ Φi → □◇ Ψi) where Φi and Ψi (for 0 < i ≤ k) are CTL state-formulas over AP. Weak and unconditional CTL fairness constraints are defined similarly, e.g.: ufair = ⋀

0<i≤k

□◇ Ψi

and wfair = ⋀

0<i≤k

(◇□ Φi → □◇ Ψi).

Joost-Pieter Katoen Lecture#14 28/62

slide-51
SLIDE 51

CTL Fairness Assumptions

CTL Fairness Constraints

Definition: CTL fairness constraints A strong CTL fairness constraint is a formula of the form: sfair = ⋀

0<i≤k

(□◇ Φi → □◇ Ψi) where Φi and Ψi (for 0 < i ≤ k) are CTL state-formulas over AP. Weak and unconditional CTL fairness constraints are defined similarly, e.g.: ufair = ⋀

0<i≤k

□◇ Ψi

and wfair = ⋀

0<i≤k

(◇□ Φi → □◇ Ψi). Definition: CTL fairness assumption A CTL fairness assumption is a conjunction of ufair, sfair and wfair.

Joost-Pieter Katoen Lecture#14 28/62

slide-52
SLIDE 52

CTL Fairness Assumptions

CTL Fairness Constraints

Definition: CTL fairness constraints A strong CTL fairness constraint is a formula of the form: sfair = ⋀

0<i≤k

(□◇ Φi → □◇ Ψi) where Φi and Ψi (for 0 < i ≤ k) are CTL state-formulas over AP. Weak and unconditional CTL fairness constraints are defined similarly, e.g.: ufair = ⋀

0<i≤k

□◇ Ψi

and wfair = ⋀

0<i≤k

(◇□ Φi → □◇ Ψi). Definition: CTL fairness assumption A CTL fairness assumption is a conjunction of ufair, sfair and wfair. A CTL fairness constraint is an LTL formula over CTL state formulas. Φi and Ψi are interpreted by the standard (unfair) CTL semantics

Joost-Pieter Katoen Lecture#14 28/62

slide-53
SLIDE 53

CTL Fairness Assumptions

Semantics of Fair CTL

For CTL fairness assumption fair, relation ⊧fair is defined by: s ⊧fair a iff a ∈ L(s) s ⊧fair ¬ Φ iff ¬ (s ⊧fair Φ) s ⊧fair Φ ∨ Ψ iff (s ⊧fair Φ) ∨ (s ⊧fair Ψ) s ⊧fair ∃ϕ iff π ⊧fair ϕ for some fair path π that starts in s s ⊧fair ∀ϕ iff π ⊧fair ϕ for all fair paths π that start in s π ⊧fair ◯ Φ iff π[1] ⊧fair Φ π ⊧fair Φ U Ψ iff (∃ j ≥ 0. π[j] ⊧fair Ψ and (∀ 0 ≤ i < j. π[i] ⊧fair Φ))

π is a fair path iff π ⊧LTL fair for CTL fairness assumption fair

Joost-Pieter Katoen Lecture#14 29/62

slide-54
SLIDE 54

CTL Fairness Assumptions

Transition System Semantics

▶ For CTL-state-formula Φ, and fairness assumption fair, the satisfaction set Satfair(Φ) is defined by: Satfair(Φ) = { s ∈ S ∣ s ⊧fair Φ } ▶ TS satisfies CTL-formula Φ iff Φ holds in all its initial states: TS ⊧fair Φ if and only if ∀s0 ∈ I. s0 ⊧fair Φ ▶ This is equivalent to I ⊆ Satfair(Φ)

Joost-Pieter Katoen Lecture#14 30/62

slide-55
SLIDE 55

CTL Fairness Assumptions

Example: An Arbiter for Mutual Exclusion

TS1 ∥ Arbiter ∥ TS2 / ⊧ (∀□∀◇ crit1) ∧ (∀□∀◇ crit2) But: TS1 ∥ Arbiter ∥ TS2 ⊧fair ∀□∀◇ crit1 ∧ ∀□∀◇ crit2 with fair = □◇ head ∧ □◇ tail

Joost-Pieter Katoen Lecture#14 31/62

slide-56
SLIDE 56

CTL Fairness Assumptions

Example

Joost-Pieter Katoen Lecture#14 32/62

slide-57
SLIDE 57

CTL Fairness Assumptions

Example

Joost-Pieter Katoen Lecture#14 33/62

slide-58
SLIDE 58

CTL Model Checking Under Fairness

Overview

1

The Relevance of Fairness

2

Fairness Assumptions

3

Fairness and Safety Properties

4

LTL Model Checking Under Fairness

5

CTL Fairness Assumptions

6

CTL Model Checking Under Fairness

7

Summary

Joost-Pieter Katoen Lecture#14 34/62

slide-59
SLIDE 59

CTL Model Checking Under Fairness

The Fair CTL Model-Checking Problem

Given:

  • 1. a finite transition system TS
  • 2. an CTL state-formula1 Φ, and
  • 3. a CTL fairness assumption fair

Question: does TS ⊧fair Φ?

1Assumed to be in existential normal form. Joost-Pieter Katoen Lecture#14 35/62

slide-60
SLIDE 60

CTL Model Checking Under Fairness

The Fair CTL Model-Checking Problem

Given:

  • 1. a finite transition system TS
  • 2. an CTL state-formula1 Φ, and
  • 3. a CTL fairness assumption fair

Question: does TS ⊧fair Φ? use recursive descent à la CTL to determine Satfair(Φ) using as much as possible standard CTL model-checking algorithms

1Assumed to be in existential normal form. Joost-Pieter Katoen Lecture#14 35/62

slide-61
SLIDE 61

CTL Model Checking Under Fairness

Treating Strong CTL Fairness Constraints

▶ Let strong CTL fairness constraint: sfair = ⋀

0<i≤k

(□◇ Φi → □◇ Ψi)

where Φi and Ψi (for 0 < i ≤ k) are CTLstate-formulas over AP

Joost-Pieter Katoen Lecture#14 36/62

slide-62
SLIDE 62

CTL Model Checking Under Fairness

Treating Strong CTL Fairness Constraints

▶ Let strong CTL fairness constraint: sfair = ⋀

0<i≤k

(□◇ Φi → □◇ Ψi)

where Φi and Ψi (for 0 < i ≤ k) are CTLstate-formulas over AP

▶ Replace the CTL state-formulas in sfair by fresh atomic propositions: sfair ∶= ⋀

0<i≤k

(□◇ ai → □◇ bi)

▶ where ai ∈ L(s) if and only if s ∈ Sat(Φi) (not Satfair(Φi)) ▶ . . . bi ∈ L(s) if and only if s ∈ Sat(Ψi) (not Satfair(Ψi))

Joost-Pieter Katoen Lecture#14 36/62

slide-63
SLIDE 63

CTL Model Checking Under Fairness

Treating Strong CTL Fairness Constraints

▶ Let strong CTL fairness constraint: sfair = ⋀

0<i≤k

(□◇ Φi → □◇ Ψi)

where Φi and Ψi (for 0 < i ≤ k) are CTLstate-formulas over AP

▶ Replace the CTL state-formulas in sfair by fresh atomic propositions: sfair ∶= ⋀

0<i≤k

(□◇ ai → □◇ bi)

▶ where ai ∈ L(s) if and only if s ∈ Sat(Φi) (not Satfair(Φi)) ▶ . . . bi ∈ L(s) if and only if s ∈ Sat(Ψi) (not Satfair(Ψi))

▶ For unconditional and weak fairness this goes similarly

Joost-Pieter Katoen Lecture#14 36/62

slide-64
SLIDE 64

CTL Model Checking Under Fairness

Treating Strong CTL Fairness Constraints

▶ Let strong CTL fairness constraint: sfair = ⋀

0<i≤k

(□◇ Φi → □◇ Ψi)

where Φi and Ψi (for 0 < i ≤ k) are CTLstate-formulas over AP

▶ Replace the CTL state-formulas in sfair by fresh atomic propositions: sfair ∶= ⋀

0<i≤k

(□◇ ai → □◇ bi)

▶ where ai ∈ L(s) if and only if s ∈ Sat(Φi) (not Satfair(Φi)) ▶ . . . bi ∈ L(s) if and only if s ∈ Sat(Ψi) (not Satfair(Ψi))

▶ For unconditional and weak fairness this goes similarly ▶ Note: π ⊧ fair iff π[j..] ⊧ fair for some j ≥ 0 iff π[j..] ⊧ fair for all j ≥ 0

Joost-Pieter Katoen Lecture#14 36/62

slide-65
SLIDE 65

CTL Model Checking Under Fairness

Some Useful Results

For CTL fairness assumption fair and a, a′ ∈ AP it holds:

  • 1. s ⊧fair ∃◯ a iff ∃s′ ∈ Post(s) with s′ ⊧ a and FairPathsfair(s′) /

= ∅

  • 2. s ⊧fair ∃(a U a′) if and only if there exists a finite path fragment

s0 s1 s2 . . . sn−1 sn ∈ Paths∗(s) with n ≥ 0 such that si ⊧ a for 0 ≤ i < n, sn ⊧ a′, and FairPathsfair(sn) / = ∅. Proof. On the black board.

Joost-Pieter Katoen Lecture#14 37/62

slide-66
SLIDE 66

CTL Model Checking Under Fairness

Example

Joost-Pieter Katoen Lecture#14 38/62

slide-67
SLIDE 67

CTL Model Checking Under Fairness

Fair Path Existence

FairPathsfair(s) / = ∅ if and only if s ⊧fair ∃□true.

Joost-Pieter Katoen Lecture#14 39/62

slide-68
SLIDE 68

CTL Model Checking Under Fairness

Fair Path Existence

FairPathsfair(s) / = ∅ if and only if s ⊧fair ∃□true. Example

Joost-Pieter Katoen Lecture#14 39/62

slide-69
SLIDE 69

CTL Model Checking Under Fairness

Basic Model-Checking Algorithm for Fair CTL

▶ Determine Satfair(∃□true) = { s ∈ S ∣ FairPathsfair(s) / = ∅ }

Joost-Pieter Katoen Lecture#14 40/62

slide-70
SLIDE 70

CTL Model Checking Under Fairness

Basic Model-Checking Algorithm for Fair CTL

▶ Determine Satfair(∃□true) = { s ∈ S ∣ FairPathsfair(s) / = ∅ } ▶ Introduce an atomic proposition afair and adjust labeling where:

▶ afair ∈ L(s) if and only if s ∈ Satfair(∃□true)

Joost-Pieter Katoen Lecture#14 40/62

slide-71
SLIDE 71

CTL Model Checking Under Fairness

Basic Model-Checking Algorithm for Fair CTL

▶ Determine Satfair(∃□true) = { s ∈ S ∣ FairPathsfair(s) / = ∅ } ▶ Introduce an atomic proposition afair and adjust labeling where:

▶ afair ∈ L(s) if and only if s ∈ Satfair(∃□true)

▶ Compute the sets Satfair(Ψ) for all sub-formulas Ψ of Φ (in ENF) by:

Satfair(a) = { s ∈ S ∣ a ∈ L(s) } Satfair(¬a) = S \ Satfair(a) Satfair(a ∧ a′) = Satfair(a) ∩ Satfair(a′) Satfair(∃◯ a) = Sat (∃◯ (a ∧ afair)) Satfair(∃(a U a′)) = Sat (∃(a U (a′ ∧ afair))) Satfair(∃□a) = . . . . . .

Joost-Pieter Katoen Lecture#14 40/62

slide-72
SLIDE 72

CTL Model Checking Under Fairness

Basic Model-Checking Algorithm for Fair CTL

▶ Determine Satfair(∃□true) = { s ∈ S ∣ FairPathsfair(s) / = ∅ } ▶ Introduce an atomic proposition afair and adjust labeling where:

▶ afair ∈ L(s) if and only if s ∈ Satfair(∃□true)

▶ Compute the sets Satfair(Ψ) for all sub-formulas Ψ of Φ (in ENF) by:

Satfair(a) = { s ∈ S ∣ a ∈ L(s) } Satfair(¬a) = S \ Satfair(a) Satfair(a ∧ a′) = Satfair(a) ∩ Satfair(a′) Satfair(∃◯ a) = Sat (∃◯ (a ∧ afair)) Satfair(∃(a U a′)) = Sat (∃(a U (a′ ∧ afair))) Satfair(∃□a) = . . . . . .

▶ Thus: model checking CTL under fairness constraints is

▶ CTL model checking + algorithm for computing Satfair(∃□a)

Joost-Pieter Katoen Lecture#14 40/62

slide-73
SLIDE 73

CTL Model Checking Under Fairness

Model Checking CTL with Fairness

Model checking CTL with fairness can be done by combining ▶ the model-checking algorithm for CTL (without fairness), and ▶ an algorithm for computing Satfair(∃□a) for a ∈ AP.

Joost-Pieter Katoen Lecture#14 41/62

slide-74
SLIDE 74

CTL Model Checking Under Fairness

Model Checking CTL with Fairness

Model checking CTL with fairness can be done by combining ▶ the model-checking algorithm for CTL (without fairness), and ▶ an algorithm for computing Satfair(∃□a) for a ∈ AP. As ∃□true is a special case of ∃□a, an algorithm for Satfair(∃□a) can be used for Satfair(∃□true)

Joost-Pieter Katoen Lecture#14 41/62

slide-75
SLIDE 75

CTL Model Checking Under Fairness

Basic Fair CTL Algorithm

Joost-Pieter Katoen Lecture#14 42/62

slide-76
SLIDE 76

CTL Model Checking Under Fairness

Characterising Satfair(∃□a)

s ⊧sfair ∃□a where sfair = ⋀

0<i≤k

(□◇ ai → □◇ bi) iff there exists a finite path fragment s0 . . . sn and a cycle s′

0 . . . s′ r with:

  • 1. s0 = s

and sn = s′

0 = s′ r

  • 2. si ⊧ a, for any 0 ≤ i ≤ n, and s′

j ⊧ a, for any 0 ≤ j ≤ r, and

  • 3. Sat(ai) ∩ { s′

1, . . . , s′ r } = ∅ or Sat(bi) ∩ { s′ 1, . . . , s′ r } /

= ∅ for 0 < i ≤ k Proof. Next slide.

Joost-Pieter Katoen Lecture#14 43/62

slide-77
SLIDE 77

CTL Model Checking Under Fairness

Proof

Joost-Pieter Katoen Lecture#14 44/62

slide-78
SLIDE 78

CTL Model Checking Under Fairness

Computing Satfair(∃□a)

▶ Consider only state s if s ⊧ a, otherwise eliminate s

▶ consider TS[a] = (S′, Act, →′, I′, AP, L′) with S′ = Sat(a), ▶ →′ = → ∩ (S′ × Act × S′), I′ = I ∩ S′, and L′(s) = L(s) for s ∈ S′ ⇒ each infinite path fragment in TS[a] satisfies □ a

2This is not necessarily an SCC (a maximal strongly-connected set). Joost-Pieter Katoen Lecture#14 45/62

slide-79
SLIDE 79

CTL Model Checking Under Fairness

Computing Satfair(∃□a)

▶ Consider only state s if s ⊧ a, otherwise eliminate s

▶ consider TS[a] = (S′, Act, →′, I′, AP, L′) with S′ = Sat(a), ▶ →′ = → ∩ (S′ × Act × S′), I′ = I ∩ S′, and L′(s) = L(s) for s ∈ S′ ⇒ each infinite path fragment in TS[a] satisfies □ a

▶ Let fair = ⋀

0<i≤k

(□◇ ai → □◇ bi)

2This is not necessarily an SCC (a maximal strongly-connected set). Joost-Pieter Katoen Lecture#14 45/62

slide-80
SLIDE 80

CTL Model Checking Under Fairness

Computing Satfair(∃□a)

▶ Consider only state s if s ⊧ a, otherwise eliminate s

▶ consider TS[a] = (S′, Act, →′, I′, AP, L′) with S′ = Sat(a), ▶ →′ = → ∩ (S′ × Act × S′), I′ = I ∩ S′, and L′(s) = L(s) for s ∈ S′ ⇒ each infinite path fragment in TS[a] satisfies □ a

▶ Let fair = ⋀

0<i≤k

(□◇ ai → □◇ bi) ▶ s ⊧fair ∃□a iff s can reach a strongly connected node-set2 D in TS[a] with:

D ∩ Sat(ai) = ∅

  • r

D ∩ Sat(bi) / = ∅ for 0 < i ≤ k (*)

▶ Satfair(∃□a) = { s ∈ S ∣ ReachTS[a](s) ∩ T / = ∅ }

▶ T is the union of all SCCs C that contain D satisfying (*)

2This is not necessarily an SCC (a maximal strongly-connected set). Joost-Pieter Katoen Lecture#14 45/62

slide-81
SLIDE 81

CTL Model Checking Under Fairness

Example

Computing Satfair(∃□a) by analysing the digraph Ga of TS[a]

Joost-Pieter Katoen Lecture#14 46/62

slide-82
SLIDE 82

CTL Model Checking Under Fairness

Example

Joost-Pieter Katoen Lecture#14 47/62

slide-83
SLIDE 83

CTL Model Checking Under Fairness

∃□a under Unconditional Fairness

Let ufair = ⋀

0<i≤k

□◇ bi

Let T be the set union of all non-trivial SCCs C of TS[a] satisfying C ∩ Sat(bi) / = ∅ for all 0 < i ≤ k

Joost-Pieter Katoen Lecture#14 48/62

slide-84
SLIDE 84

CTL Model Checking Under Fairness

∃□a under Unconditional Fairness

Let ufair = ⋀

0<i≤k

□◇ bi

Let T be the set union of all non-trivial SCCs C of TS[a] satisfying C ∩ Sat(bi) / = ∅ for all 0 < i ≤ k It now follows: s ⊧ufair ∃□a if and only if ReachTS[a](s) ∩ T / = ∅ ⇒ T can be determined by a depth-first search procedure

Joost-Pieter Katoen Lecture#14 48/62

slide-85
SLIDE 85

CTL Model Checking Under Fairness

Example

Joost-Pieter Katoen Lecture#14 49/62

slide-86
SLIDE 86

CTL Model Checking Under Fairness

∃□a Under One Strong Fairness Constraint

▶ sfair = □◇ a1 → □◇ b1, i.e., k=1

Joost-Pieter Katoen Lecture#14 50/62

slide-87
SLIDE 87

CTL Model Checking Under Fairness

∃□a Under One Strong Fairness Constraint

▶ sfair = □◇ a1 → □◇ b1, i.e., k=1 ▶ s ⊧sfair ∃ □ a iff C is a non-trivial SCC in TS[a] reachable from s with:

  • 1. C ∩ Sat(b1) /

= ∅, or

  • 2. D ∩ Sat(a1) = ∅, for some non-trivial SCC D in C

Joost-Pieter Katoen Lecture#14 50/62

slide-88
SLIDE 88

CTL Model Checking Under Fairness

∃□a Under One Strong Fairness Constraint

▶ sfair = □◇ a1 → □◇ b1, i.e., k=1 ▶ s ⊧sfair ∃ □ a iff C is a non-trivial SCC in TS[a] reachable from s with:

  • 1. C ∩ Sat(b1) /

= ∅, or

  • 2. D ∩ Sat(a1) = ∅, for some non-trivial SCC D in C

▶ D is a non-trivial SCC in the graph that is obtained from C[¬a1]

Joost-Pieter Katoen Lecture#14 50/62

slide-89
SLIDE 89

CTL Model Checking Under Fairness

∃□a Under One Strong Fairness Constraint

▶ sfair = □◇ a1 → □◇ b1, i.e., k=1 ▶ s ⊧sfair ∃ □ a iff C is a non-trivial SCC in TS[a] reachable from s with:

  • 1. C ∩ Sat(b1) /

= ∅, or

  • 2. D ∩ Sat(a1) = ∅, for some non-trivial SCC D in C

▶ D is a non-trivial SCC in the graph that is obtained from C[¬a1] ▶ For T the union of non-trivial SCCs in satisfying (1) and (2): s ⊧sfair ∃□a if and only if ReachTS[a](s) ∩ T / = ∅

Joost-Pieter Katoen Lecture#14 50/62

slide-90
SLIDE 90

CTL Model Checking Under Fairness

∃□a Under One Strong Fairness Constraint

▶ sfair = □◇ a1 → □◇ b1, i.e., k=1 ▶ s ⊧sfair ∃ □ a iff C is a non-trivial SCC in TS[a] reachable from s with:

  • 1. C ∩ Sat(b1) /

= ∅, or

  • 2. D ∩ Sat(a1) = ∅, for some non-trivial SCC D in C

▶ D is a non-trivial SCC in the graph that is obtained from C[¬a1] ▶ For T the union of non-trivial SCCs in satisfying (1) and (2): s ⊧sfair ∃□a if and only if ReachTS[a](s) ∩ T / = ∅ For several strong fairness constraints (k > 1), this is applied recursively T is determined by standard graph analysis (DFS)

Joost-Pieter Katoen Lecture#14 50/62

slide-91
SLIDE 91

CTL Model Checking Under Fairness

Example: One Strong Fairness Constraint

Joost-Pieter Katoen Lecture#14 51/62

slide-92
SLIDE 92

CTL Model Checking Under Fairness

Example: One Strong Fairness Constraint

Joost-Pieter Katoen Lecture#14 52/62

slide-93
SLIDE 93

CTL Model Checking Under Fairness

Example: One Strong Fairness Constraint

Joost-Pieter Katoen Lecture#14 53/62

slide-94
SLIDE 94

CTL Model Checking Under Fairness

Example: Two Strong Fairness Constraints

Joost-Pieter Katoen Lecture#14 54/62

slide-95
SLIDE 95

CTL Model Checking Under Fairness

Example: Two Strong Fairness Constraints

Joost-Pieter Katoen Lecture#14 55/62

slide-96
SLIDE 96

CTL Model Checking Under Fairness

Algorithm

CheckFair is a recursive procedure over the k strong fairness constraints Basically an SCC analysis per fairness constraint. Time complexity: O(∣TS∣⋅∣fair∣).

Joost-Pieter Katoen Lecture#14 56/62

slide-97
SLIDE 97

CTL Model Checking Under Fairness

CheckFair Algorithm (for completeness)

Joost-Pieter Katoen Lecture#14 57/62

slide-98
SLIDE 98

CTL Model Checking Under Fairness

Time complexity

The CTL model-checking problem under fairness assumption fair can be solved in O(∣Φ∣ ⋅ ∣TS∣ ⋅ ∣fair∣). Proof. Follows from the complexity O(∣Φ∣⋅∣TS∣) of CTL model checking

Joost-Pieter Katoen Lecture#14 58/62

slide-99
SLIDE 99

Summary

Overview

1

The Relevance of Fairness

2

Fairness Assumptions

3

Fairness and Safety Properties

4

LTL Model Checking Under Fairness

5

CTL Fairness Assumptions

6

CTL Model Checking Under Fairness

7

Summary

Joost-Pieter Katoen Lecture#14 59/62

slide-100
SLIDE 100

Summary

Model Checking Complexity

CTL LTL CTL∗ model PTIME PSPACE PSPACE checking algorithmic ∣TS∣ ⋅ ∣Φ∣ ∣TS∣ ⋅ exp(∣ϕ∣) ∣TS∣ ⋅ exp(∣Φ∣) complexity with ∣TS∣ ⋅ ∣Φ∣ ⋅ ∣fair∣ ∣TS∣ ⋅ exp(∣ϕ∣+∣fair∣) ∣TS∣ ⋅ exp(∣Φ∣+∣fair∣) fairness

All theoretical complexity indications are complete.

Joost-Pieter Katoen Lecture#14 60/62

slide-101
SLIDE 101

Summary

Summary

▶ Fairness constraints rule out “unreasonable” computations ▶ Fairness assumptions are conjunctions of fairness constraints ▶ Fair LTL model checking is reduced to standard LTL model checking ▶ CTL fairness constraints are fair “LTL”-formulas over CTL state-formulas ▶ Fair CTL model checking is standard CTL model checking . . . ▶ . . . plus a dedicated procedure for ∃□a ▶ Complexity of fair CTL model checking is O(∣TS∣⋅∣Φ∣⋅∣fair∣)

Joost-Pieter Katoen Lecture#14 61/62

slide-102
SLIDE 102

Summary

Next Lecture

Thursday December 12, 10:30

No Lecture on Friday December 6

Joost-Pieter Katoen Lecture#14 62/62