Top Banner
Copyright 2001, Matt Dwyer, John Hatcliff, and Radu Iosif. The syllabus and all lectures for this course are copyrighted materials and may not be used in other course settings outside of Kansas State University in their current form or modified form without the express written permission of one of the copyright holders. During this course, students are prohibited from selling notes to or being paid for taking notes by any person or commercial firm without the express written permission of one of the copyright holders. CIS 842: Specification CIS 842: Specification and Verification of and Verification of Reactive Systems Reactive Systems Lecture 3: Temporal Logic Specifications
25

Copyright 2001, Matt Dwyer, John Hatcliff, and Radu Iosif. The syllabus and all lectures for this course are copyrighted materials and may not be used.

Jan 01, 2016

Download

Documents

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Copyright 2001, Matt Dwyer, John Hatcliff, and Radu Iosif. The syllabus and all lectures for this course are copyrighted materials and may not be used.

Copyright 2001, Matt Dwyer, John Hatcliff, and Radu Iosif. The syllabus and all lectures for this course are copyrighted materials and may not be used in other course settings outside of Kansas State University in their current form or modified form without the express written permission of one of the copyright holders. During this course, students are prohibited from selling notes to or being paid for taking notes by any person or commercial firm without the express written permission of one of the copyright holders.

CIS 842: Specification and CIS 842: Specification and Verification of Reactive SystemsVerification of Reactive Systems

Lecture 3: Temporal Logic Specifications

Page 2: Copyright 2001, Matt Dwyer, John Hatcliff, and Radu Iosif. The syllabus and all lectures for this course are copyrighted materials and may not be used.

Reasoning about ExecutionsReasoning about Executions

We want to reason about execution trees– tree node = snap shot of the program’s state

Reasoning consists of two layers– defining predicates on the program states (control points,

variable values)– expressing temporal relationships between those predicates

[L3, (mt3, vr3), ….]

Explored State-Space (computation tree)

Conceptual View

[L1, (mt1, vr1), ….]

[L2, (mt2, vr2), ….]

[L5, (mt5, vr5), ….]

L1 L4

L2

L3

L5

?b1

?err

?b0

?b1 !a1

?a1?b0

?err

!a0

Page 3: Copyright 2001, Matt Dwyer, John Hatcliff, and Radu Iosif. The syllabus and all lectures for this course are copyrighted materials and may not be used.

Computational Tree Logic (CTL)Computational Tree Logic (CTL)

::= P …primitive propositions

| ! | && | || | -> …propositional connectives

| AG | EG | AF | EF …temporal operators | AX | EX | A[ U ] | E[ U ]

Syntax

Semantic Intuition

AG p …along All paths p holds Globally

EG p …there Exists a path where p holds Globally

AF p …along All paths p holds at some state in the Future

EF p …there Exists a path where p holds at some state in the Future

path quantifier

temporal operator

Page 4: Copyright 2001, Matt Dwyer, John Hatcliff, and Radu Iosif. The syllabus and all lectures for this course are copyrighted materials and may not be used.

Computational Tree Logic (CTL)Computational Tree Logic (CTL)

::= P …primitive propositions

| ! | && | || | -> …propositional connectives

| AG | EG | AF | EF …path/temporal operators | AX | EX | A[ U ] | E[ U ]

Syntax

Semantic Intuition

AX p …along All paths, p holds in the neXt state

EX p …there Exists a path where p holds in the neXt state

A[p U q] …along All paths, p holds Until q holds

E[p U q] …there Exists a path where p holds Until q holds

Page 5: Copyright 2001, Matt Dwyer, John Hatcliff, and Radu Iosif. The syllabus and all lectures for this course are copyrighted materials and may not be used.

Computation Tree LogicComputation Tree Logic

p

p

p

p p p

p

p

p

p

p

p p p p

AG p

Page 6: Copyright 2001, Matt Dwyer, John Hatcliff, and Radu Iosif. The syllabus and all lectures for this course are copyrighted materials and may not be used.

Computation Tree LogicComputation Tree Logic

EG p p

p

p

p

Page 7: Copyright 2001, Matt Dwyer, John Hatcliff, and Radu Iosif. The syllabus and all lectures for this course are copyrighted materials and may not be used.

Computation Tree LogicComputation Tree Logic

AF p

p

p p p

p

p

Page 8: Copyright 2001, Matt Dwyer, John Hatcliff, and Radu Iosif. The syllabus and all lectures for this course are copyrighted materials and may not be used.

Computation Tree LogicComputation Tree Logic

EF p

p

Page 9: Copyright 2001, Matt Dwyer, John Hatcliff, and Radu Iosif. The syllabus and all lectures for this course are copyrighted materials and may not be used.

Computation Tree LogicComputation Tree Logic

AX p

p

p p

p

p p

p

p

p

Page 10: Copyright 2001, Matt Dwyer, John Hatcliff, and Radu Iosif. The syllabus and all lectures for this course are copyrighted materials and may not be used.

Computation Tree LogicComputation Tree Logic

EX p

p

p

p

p p p

Page 11: Copyright 2001, Matt Dwyer, John Hatcliff, and Radu Iosif. The syllabus and all lectures for this course are copyrighted materials and may not be used.

Computation Tree LogicComputation Tree Logic

A[p U q]p

p

p

q q p

p

q

q

p

p

Page 12: Copyright 2001, Matt Dwyer, John Hatcliff, and Radu Iosif. The syllabus and all lectures for this course are copyrighted materials and may not be used.

Computation Tree LogicComputation Tree Logic

E[p U q]p

p

q q p

p

q

q

q

Page 13: Copyright 2001, Matt Dwyer, John Hatcliff, and Radu Iosif. The syllabus and all lectures for this course are copyrighted materials and may not be used.

Example CTL SpecificationsExample CTL Specifications

For any state, a request (for some resource) will eventually be acknowledged

AG(requested -> AF acknowledged)

From any state, it is possible to get to a restart state

AG(EF restart)

An upwards travelling elevator at the second floor does not changes its direction when it has passengers waiting to go to the fifth floor

AG((floor=2 && direction=up && button5pressed) -> A[direction=up U floor=5])

Page 14: Copyright 2001, Matt Dwyer, John Hatcliff, and Radu Iosif. The syllabus and all lectures for this course are copyrighted materials and may not be used.

Semantics for CTL (excerpts)Semantics for CTL (excerpts)

For pAP:

s |= p p L(s) s |= p p L(s) s |= f g s |= f and s |= g s |= f g s |= f or s |= g

s |= EXf =s0s1... from s: s1 |= f

s |= E(f U g) =s0s1... from s

j0 [ sj |= g and i : 0 i j [si |= f ] ]

s |= EGf =s0s1... from s i 0: si |= f

Source: Orna GrumbergSource: Orna Grumberg

Page 15: Copyright 2001, Matt Dwyer, John Hatcliff, and Radu Iosif. The syllabus and all lectures for this course are copyrighted materials and may not be used.

CTL NotesCTL Notes

Invented by E. Clarke and E. A. Emerson (early 1980’s)

Specification language for Symbolic Model Verifier (SMV) model-checker

SMV is a symbolic model-checker instead of an explicit-state model-checker

Symbolic model-checking uses Binary Decision Diagrams (BDDs) to represent boolean functions (both transition system and specification

Page 16: Copyright 2001, Matt Dwyer, John Hatcliff, and Radu Iosif. The syllabus and all lectures for this course are copyrighted materials and may not be used.

Linear Temporal LogicLinear Temporal Logic

Restrict path quantification to “ALL” (no “EXISTS”)

Reason in terms of linear traces instead of branching trees

Page 17: Copyright 2001, Matt Dwyer, John Hatcliff, and Radu Iosif. The syllabus and all lectures for this course are copyrighted materials and may not be used.

Linear Temporal Logic (LTL)Linear Temporal Logic (LTL)

Semantic Intuition

[] …always

<> …eventually

U … until

::= P …primitive propositions | ! | && | || | -> …propositional connectives | [] | <> | U X …temporal operators

Syntax

Page 18: Copyright 2001, Matt Dwyer, John Hatcliff, and Radu Iosif. The syllabus and all lectures for this course are copyrighted materials and may not be used.

Linear Time LogicLinear Time Logic

[]<> p

p p p

“Along all paths, it must be the case that globally (I.e., in each state we come to) eventually p will hold”

Expresses a form of fairness– p must occur infinitely often along the path – To check under the assumption of fair traces, check

[]<>p ->

Page 19: Copyright 2001, Matt Dwyer, John Hatcliff, and Radu Iosif. The syllabus and all lectures for this course are copyrighted materials and may not be used.

Linear Time LogicLinear Time Logic

p

<>[] p

p p

“Along all paths, eventually it is the case that p holds globally (I.e., at each state)”

pp p p p

Page 20: Copyright 2001, Matt Dwyer, John Hatcliff, and Radu Iosif. The syllabus and all lectures for this course are copyrighted materials and may not be used.

Semantics for LTLSemantics for LTL

Semantics of LTL is given with respect to a (usually infinite) path or trace– = s1 s2 s3 …

We write i for the suffix starting at si, e.g., 3 = s3 s4 s5 …

A system satisfies an LTL formula f if each path through the system satisfies f.

Page 21: Copyright 2001, Matt Dwyer, John Hatcliff, and Radu Iosif. The syllabus and all lectures for this course are copyrighted materials and may not be used.

Semantics for LTLSemantics for LTL

For pAP:

|= p p L(s1) |= p p L(s1) |= f g |= f and |= g |= f g |= f or |= g |= Xf 2 |= f |= <>f i >= 1. i |= f |= <>f i >= 1. i |= f |= (f U g) i >= 1. i |= g

and j : 1 j i-1. i |= f

Page 22: Copyright 2001, Matt Dwyer, John Hatcliff, and Radu Iosif. The syllabus and all lectures for this course are copyrighted materials and may not be used.

LTL NotesLTL Notes

Invented by Prior (1960’s), and first use to reason about concurrent systems by A. Pnueli, Z. Manna, etc.

LTL model-checkers are usually explicit-state checkers due to connection between LTL and automata theory

Most popular LTL-based checker is Spin (G. Holzman)

Page 23: Copyright 2001, Matt Dwyer, John Hatcliff, and Radu Iosif. The syllabus and all lectures for this course are copyrighted materials and may not be used.

Comparing LTL and CTLComparing LTL and CTL

CTL LTL

CTL*

CTL is not strictly more expression than LTL (and vice versa)CTL* invented by Emerson and Halpern in 1986 to unify CTL and LTLWe believe that almost all properties that one wants to express about software lie in intersection of LTL and CTL

Page 24: Copyright 2001, Matt Dwyer, John Hatcliff, and Radu Iosif. The syllabus and all lectures for this course are copyrighted materials and may not be used.

LTL and Automata TheoryLTL and Automata Theory

Page 25: Copyright 2001, Matt Dwyer, John Hatcliff, and Radu Iosif. The syllabus and all lectures for this course are copyrighted materials and may not be used.

LTL Checking in SpinLTL Checking in Spin