Algorithms for CTL
- B. Srivathsan
Chennai Mathematical Institute
Model Checking and Systems Verification January - April 2016
1/22
Algorithms for CTL B. Srivathsan Chennai Mathematical Institute - - PowerPoint PPT Presentation
Algorithms for CTL B. Srivathsan Chennai Mathematical Institute Model Checking and Systems Verification January - April 2016 1 / 22 Module 1: Adequate CTL formulae 2 / 22 Recap of CTL State formulae := true | p i | 1 2 | 1
Model Checking and Systems Verification January - April 2016
1/22
2/22
φ := true | pi | φ1 ∧ φ2 | ¬φ1 | E α | A α pi ∈ AP φ1,φ2 : State formulae α : Path formula
α := X φ1 | φ1 U φ2 | F φ1 | G φ1
3/22
s0 s1 s3 s2 s3 s2 s3 s3 s2 s3 s2 s3
s0 s1 s2 s3 {p1} {p2} {p2} {p1,p3} 4/22
∈
5/22
s0 s1 s2 s3 {p1} {p2} {p2} {p1,p3}
6/22
7/22
8/22
9/22
9/22
non-crit wait crit exiting y>0:y:=y-1 y:=y+1 non-crit wait crit exiting y>0:y:=y-1 y:=y+1
Atomic propositions AP = { p1,p2,p3,p4 } p1: pr1.location=crit p2: pr1.location=wait p3: pr2.location=crit p4: pr2.location=wait Above system satisfies A G ¬ (p1 ∧ p3)
10/22
11/22
11/22
State formulae
φ := true | pi | φ1 ∧ φ2 | ¬φ1 | E α | A α pi ∈ AP φ1,φ2 : State formulae α : Path formula
Path formulae
α := X φ1 | φ1 U φ2 | F φ1 | G φ1
12/22
13/22
13/22
14/22
State formulae
φ := true | pi | φ1 ∧ φ2 | ¬φ1 | E α | A α pi ∈ AP φ1,φ2 : State formulae α : Path formula
Path formulae
α := X φ1 | φ1 U φ2 | F φ1 | G φ1
14/22
State formulae
φ := true | pi | φ1 ∧ φ2 | ¬φ1 | E α | A α pi ∈ AP φ1,φ2 : State formulae α : Path formula
Path formulae
α := X φ1 | φ1 U φ2 | F φ1 | G φ1
14/22
15/22
16/22
16/22
16/22
16/22
16/22
16/22
16/22
17/22
17/22
(Not a CTL formula)
17/22
(Not a CTL formula)
17/22
(Not a CTL formula)
(A CTL formula!)
17/22
18/22
19/22
State formulae
φ := true | pi | φ1 ∧ φ2 | ¬φ1 | E α | A α pi ∈ AP φ1,φ2 : State formulae α : Path formula
Path formulae
α := X φ1 | φ1 U φ2 | F φ1 | G φ1
20/22
State formulae
φ := true | pi | φ1 ∧ φ2 | ¬φ1 | E α | A α pi ∈ AP φ1,φ2 : State formulae α : Path formula
Path formulae
α := X φ1 | φ1 U φ2 | F φ1 | G φ1
20/22
21/22
21/22
21/22
φ := true | pi | φ1 ∧ φ2 | ¬φ | E X φ | E (φ1 U φ2) | E G φ pi ∈ AP φ,φ1,φ2 : State formulae
22/22
φ := true | pi | φ1 ∧ φ2 | ¬φ | E X φ | E (φ1 U φ2) | E G φ pi ∈ AP φ,φ1,φ2 : State formulae
22/22
2/16
3/16
3/16
4/16
s1 s2 s3 s4 s5 { } {p1,p2} {p2} {p1,p2} {p1}
5/16
s1 s2 s3 s4 s5 { } {p1,p2} {p2} {p1,p2} {p1} p1 ∧ p2 p1 ∧ p2
5/16
s1 s2 s3 s4 s5 { } {p1,p2} {p2} {p1,p2} {p1} p1 ∧ p2 p1 ∧ p2 E X (p1 ∧ p2)
5/16
s1 s2 s3 s4 s5 { } {p1,p2} {p2} {p1,p2} {p1} p1 ∧ p2 p1 ∧ p2 E X (p1 ∧ p2) E X (p1 ∧ p2)
5/16
s1 s2 s3 s4 s5 { } {p1,p2} {p2} {p1,p2} {p1} p1 ∧ p2 p1 ∧ p2 E X (p1 ∧ p2) E X (p1 ∧ p2) E X (p1 ∧ p2)
5/16
s1 s2 s3 s4 {} {p2} {p1,p2} {p1}
6/16
s1 s2 s3 s4 {} {p2} {p1,p2} {p1} p1 ∧ ¬p2
6/16
s1 s2 s3 s4 {} {p2} {p1,p2} {p1} p1 ∧ ¬p2 E X (p1 ∧ ¬p2)
6/16
s1 s2 s3 s4 {} {p2} {p1,p2} {p1} p1 ∧ ¬p2 E X (p1 ∧ ¬p2) E X (p1 ∧ ¬p2)
6/16
s1 s2 s3 s4 {} {p2} {p1,p2} {p1} p1 ∧ ¬p2 E X (p1 ∧ ¬p2) E X (p1 ∧ ¬p2) E X (p1 ∧ ¬p2)
6/16
s
7/16
s φ Suppose states satisfying φ have been labelled
7/16
s φ E X φ Suppose states satisfying φ have been labelled State s is labelled with E X φ if there exists a successor which is labelled φ
7/16
8/16
s1 s2 s3 s4 s5 s6 {p1} { } {p1} {p1} {p2} {p1}
9/16
s1 s2 s3 s4 s5 s6 {p1} { } {p1} {p1} {p2} {p1} E p1 U p2
9/16
s1 s2 s3 s4 s5 s6 {p1} { } {p1} {p1} {p2} {p1} E p1 U p2 E p1 U p2 E p1 U p2
9/16
s1 s2 s3 s4 s5 s6 {p1} { } {p1} {p1} {p2} {p1} E p1 U p2 E p1 U p2 E p1 U p2 E p1 U p2
9/16
s1 s2 s3 s4 s5 s6 {p1} { } {p1} {p1} {p2} {p1} E p1 U p2 E p1 U p2 E p1 U p2 E p1 U p2 E p1 U p2
9/16
s1 s2 s3 s4 s5 s6 {p2} {p2} { } {p2} {p1} {p1}
10/16
s1 s2 s3 s4 s5 s6 {p2} {p2} { } {p2} {p1} {p1} ¬p1 ¬p1 ¬p2 ¬p1,¬p2 ¬p2 ¬p1
10/16
s1 s2 s3 s4 s5 s6 {p2} {p2} { } {p2} {p1} {p1} ¬p1 ¬p1 ¬p2 ¬p1,¬p2 ¬p2 ¬p1 E (¬p1 U ¬p2) E (¬p1 U ¬p2) E (¬p1 U ¬p2)
10/16
s1 s2 s3 s4 s5 s6 {p2} {p2} { } {p2} {p1} {p1} ¬p1 ¬p1 ¬p2 ¬p1,¬p2 ¬p2 ¬p1 E (¬p1 U ¬p2) E (¬p1 U ¬p2) E (¬p1 U ¬p2) E (¬p1 U ¬p2) E (¬p1 U ¬p2)
10/16
s1 s2 s3 s4 s5 s6 {p2} {p2} { } {p2} {p1} {p1} ¬p1 ¬p1 ¬p2 ¬p1,¬p2 ¬p2 ¬p1 E (¬p1 U ¬p2) E (¬p1 U ¬p2) E (¬p1 U ¬p2) E (¬p1 U ¬p2) E (¬p1 U ¬p2) E (¬p1 U ¬p2)
10/16
s
… If any state is labelled with φ2, label it with E (φ1 U φ2) … Repeat:
Label any state with E (φ1 U φ2) if it is labelled with φ1 and at least
until no change
11/16
s
E (φ1 U φ2) φ1 … If any state is labelled with φ2, label it with E (φ1 U φ2) … Repeat:
Label any state with E (φ1 U φ2) if it is labelled with φ1 and at least
until no change
11/16
s
E (φ1 U φ2) φ1 E (φ1 U φ2) … If any state is labelled with φ2, label it with E (φ1 U φ2) … Repeat:
Label any state with E (φ1 U φ2) if it is labelled with φ1 and at least
until no change
11/16
12/16
s1 s2 s3 s4 s5 s6 s7 s8 {p1} {p1} {p1} { } {p1} {p1} {p1} { }
13/16
s1 s2 s3 s4 s5 s6 s7 s8 {p1} {p1} {p1} { } {p1} {p1} {p1} { } E G p1 E G p1 E G p1 E G p1 E G p1 E G p1 E G p1 E G p1
13/16
s1 s2 s3 s4 s5 s6 s7 s8 {p1} {p1} {p1} { } {p1} {p1} {p1} { } E G p1 E G p1 E G p1 E G p1 E G p1 E G p1
13/16
s1 s2 s3 s4 s5 s6 s7 s8 {p1} {p1} {p1} { } {p1} {p1} {p1} { } E G p1 E G p1 E G p1 E G p1 E G p1
13/16
s1 s2 s3 s4 s5 s6 s7 s8 {p1} {p1} {p1} { } {p1} {p1} {p1} { } E G p1 E G p1 E G p1
13/16
s1 s2 s3 s4 s5 s6 s7 s8 {p1} {p1} {p1} { } {p1} {p1} {p1} { } E G p1
13/16
s1 s2 s3 s4 s5 s6 s7 s8 {p1} {p1} {p1} { } {p1} {p1} {p1} { }
13/16
s1 s2 s3 s4 s5 s6 s7 s8 {p1} {p1} {p1} { } {p1} {p1} {p1} { } No state of the above transition system satisfies E G p1
13/16
s1 s2 s3 s4 s5 s6 {p1} {p2} {p1} {p1} { } {p1}
14/16
s1 s2 s3 s4 s5 s6 {p1} {p2} {p1} {p1} { } {p1} E G p1 E G p1 E G p1 E G p1 E G p1 E G p1
14/16
s1 s2 s3 s4 s5 s6 {p1} {p2} {p1} {p1} { } {p1} E G p1 E G p1 E G p1 E G p1
14/16
s1 s2 s3 s4 s5 s6 {p1} {p2} {p1} {p1} { } {p1} E G p1 E G p1 E G p1
14/16
15/16
… Label all states with E G φ
15/16
… Label all states with E G φ … If any state is not labelled with φ, delete the label E G φ
15/16
… Label all states with E G φ … If any state is not labelled with φ, delete the label E G φ … Repeat:
Delete the label E G φ from a state if none of its successors is labelled with E G φ until no change
15/16
… Label all states with E G φ … If any state is not labelled with φ, delete the label E G φ
s
E G φ E G φ E G φ E G φ … Repeat:
Delete the label E G φ from a state if none of its successors is labelled with E G φ until no change
15/16
… Label all states with E G φ … If any state is not labelled with φ, delete the label E G φ
s
E G φ … Repeat:
Delete the label E G φ from a state if none of its successors is labelled with E G φ until no change
15/16
… Label all states with E G φ … If any state is not labelled with φ, delete the label E G φ
s
… Repeat:
Delete the label E G φ from a state if none of its successors is labelled with E G φ until no change
15/16
EX, EU, EG
16/16
2/8
3/8
… Module 1: Every CTL formula can be written using EX, EU, EG … Module 2: Labelling algorithms for EX, EU, EG
3/8
φ := true | pi | φ1 ∧ φ2 | ¬φ | E X φ | E (φ1 U φ2) | E G φ pi ∈ AP φ,φ1,φ2 : State formulae
4/8
s0 s1 s2 s3 s4 s5 s6 s7 {p1} {p1,p2} {p1,p2} {p1,p2} {p1,p2} {p2} {p1,p2} {p1,p2}
5/8
s0 s1 s2 s3 s4 s5 s6 s7 {p1} {p1,p2} {p1,p2} {p1,p2} {p1,p2} {p2} {p1,p2} {p1,p2}
p1 ∧ p2 p1 ∧ p2 p1 ∧ p2 p1 ∧ p2 p1 ∧ p2 p1 ∧ p2
5/8
s0 s1 s2 s3 s4 s5 s6 s7 {p1} {p1,p2} {p1,p2} {p1,p2} {p1,p2} {p2} {p1,p2} {p1,p2}
p1 ∧ p2 p1 ∧ p2 p1 ∧ p2 p1 ∧ p2 p1 ∧ p2 p1 ∧ p2 E G (p1 ∧ p2) E G (p1 ∧ p2) E G (p1 ∧ p2) E G (p1 ∧ p2) E G (p1 ∧ p2) E G (p1 ∧ p2) E G (p1 ∧ p2) E G (p1 ∧ p2)
5/8
s0 s1 s2 s3 s4 s5 s6 s7 {p1} {p1,p2} {p1,p2} {p1,p2} {p1,p2} {p2} {p1,p2} {p1,p2}
p1 ∧ p2 p1 ∧ p2 p1 ∧ p2 p1 ∧ p2 p1 ∧ p2 p1 ∧ p2 E G (p1 ∧ p2) E G (p1 ∧ p2) E G (p1 ∧ p2) E G (p1 ∧ p2) E G (p1 ∧ p2) E G (p1 ∧ p2)
5/8
s0 s1 s2 s3 s4 s5 s6 s7 {p1} {p1,p2} {p1,p2} {p1,p2} {p1,p2} {p2} {p1,p2} {p1,p2}
p1 ∧ p2 p1 ∧ p2 p1 ∧ p2 p1 ∧ p2 p1 ∧ p2 p1 ∧ p2 E G (p1 ∧ p2) E G (p1 ∧ p2) E G (p1 ∧ p2) E G (p1 ∧ p2) E G (p1 ∧ p2)
5/8
s0 s1 s2 s3 s4 s5 s6 s7 {p1} {p1,p2} {p1,p2} {p1,p2} {p1,p2} {p2} {p1,p2} {p1,p2}
p1 ∧ p2 p1 ∧ p2 p1 ∧ p2 p1 ∧ p2 p1 ∧ p2 p1 ∧ p2 E G (p1 ∧ p2) E G (p1 ∧ p2) E G (p1 ∧ p2) E G (p1 ∧ p2)
5/8
s0 s1 s2 s3 s4 s5 s6 s7 {p1} {p1,p2} {p1,p2} {p1,p2} {p1,p2} {p2} {p1,p2} {p1,p2}
p1 ∧ p2 p1 ∧ p2 p1 ∧ p2 p1 ∧ p2 p1 ∧ p2 p1 ∧ p2 E G (p1 ∧ p2) E G (p1 ∧ p2) E G (p1 ∧ p2) E G (p1 ∧ p2) E X E G (p1 ∧ p2) E X E G (p1 ∧ p2) E X E G (p1 ∧ p2) E X E G (p1 ∧ p2) E X E G (p1 ∧ p2)
5/8
s1 s2 s3 s4 s5 s6 {p1} {p1} {p1} {p2} {p2} {p2}
6/8
s1 s2 s3 s4 s5 s6 {p1} {p1} {p1} {p2} {p2} {p2}
E G p2 E G p2 E G p2 E G p2 E G p2 E G p2
6/8
s1 s2 s3 s4 s5 s6 {p1} {p1} {p1} {p2} {p2} {p2}
E G p2 E G p2 E G p2
6/8
s1 s2 s3 s4 s5 s6 {p1} {p1} {p1} {p2} {p2} {p2}
E G p2 E G p2
6/8
s1 s2 s3 s4 s5 s6 {p1} {p1} {p1} {p2} {p2} {p2}
E G p2
6/8
s1 s2 s3 s4 s5 s6 {p1} {p1} {p1} {p2} {p2} {p2}
E G p2
E p1 U (E G p2) 6/8
s1 s2 s3 s4 s5 s6 {p1} {p1} {p1} {p2} {p2} {p2}
E G p2
E p1 U (E G p2) E p1 U (E G p2) 6/8
s1 s2 s3 s4 s5 s6 {p1} {p1} {p1} {p2} {p2} {p2}
E G p2
E p1 U (E G p2) E p1 U (E G p2) E p1 U (E G p2) 6/8
s1 s2 s3 s4 s5 s6 {p1} {p1} {p1} {p2} {p2} {p2}
E G p2
E p1 U (E G p2) E p1 U (E G p2) E p1 U (E G p2) E p1 U (E G p2) 6/8
function SAT(φ)
/* Input: Transition system M with state set S, CTL formula φ in ENF */ /* Output: Set of states satisfying φ */
end function
7/8
function SAT(φ)
/* Input: Transition system M with state set S, CTL formula φ in ENF */ /* Output: Set of states satisfying φ */
case end case end function
7/8
function SAT(φ)
/* Input: Transition system M with state set S, CTL formula φ in ENF */ /* Output: Set of states satisfying φ */
case φ is true : return S end case end function
7/8
function SAT(φ)
/* Input: Transition system M with state set S, CTL formula φ in ENF */ /* Output: Set of states satisfying φ */
case φ is true : return S φ is pi : return {states containing pi } end case end function
7/8
function SAT(φ)
/* Input: Transition system M with state set S, CTL formula φ in ENF */ /* Output: Set of states satisfying φ */
case φ is true : return S φ is pi : return {states containing pi } φ is φ1 ∧ φ2 : return SAT(φ1) ∩ SAT(φ2) end case end function
7/8
function SAT(φ)
/* Input: Transition system M with state set S, CTL formula φ in ENF */ /* Output: Set of states satisfying φ */
case φ is true : return S φ is pi : return {states containing pi } φ is ¬φ1 : return S − SAT(φ1) φ is φ1 ∧ φ2 : return SAT(φ1) ∩ SAT(φ2) end case end function
7/8
function SAT(φ)
/* Input: Transition system M with state set S, CTL formula φ in ENF */ /* Output: Set of states satisfying φ */
case φ is true : return S φ is pi : return {states containing pi } φ is ¬φ1 : return S − SAT(φ1) φ is φ1 ∧ φ2 : return SAT(φ1) ∩ SAT(φ2) φ is E X φ1 : return SATEX(φ1) /* procedure seen in Module 2 */ end case end function
7/8
function SAT(φ)
/* Input: Transition system M with state set S, CTL formula φ in ENF */ /* Output: Set of states satisfying φ */
case φ is true : return S φ is pi : return {states containing pi } φ is ¬φ1 : return S − SAT(φ1) φ is φ1 ∧ φ2 : return SAT(φ1) ∩ SAT(φ2) φ is E X φ1 : return SATEX(φ1) /* procedure seen in Module 2 */ φ is E (φ1 U φ2) : return SATEU(φ1,φ2) /* procedure seen in Module 2 */ end case end function
7/8
function SAT(φ)
/* Input: Transition system M with state set S, CTL formula φ in ENF */ /* Output: Set of states satisfying φ */
case φ is true : return S φ is pi : return {states containing pi } φ is ¬φ1 : return S − SAT(φ1) φ is φ1 ∧ φ2 : return SAT(φ1) ∩ SAT(φ2) φ is E X φ1 : return SATEX(φ1) /* procedure seen in Module 2 */ φ is E (φ1 U φ2) : return SATEU(φ1,φ2) /* procedure seen in Module 2 */ φ is E G φ1 : return SATEG(φ1) /* procedure seen in Module 2 */ end case end function
7/8
Reference: Logic in Computer Science, by Huth and Ryan - Section 3.6.1
8/8