Model Checking II Temporal Logic Model Checking



Similar documents
Introduction to Software Verification

logic language, static/dynamic models SAT solvers Verified Software Systems 1 How can we model check of a program or system?

Model Checking: An Introduction

Temporal Logics. Computation Tree Logic

Formal Verification and Linear-time Model Checking

T Reactive Systems: Introduction and Finite State Automata

Software Modeling and Verification

Formal Verification by Model Checking

Software Model Checking: Theory and Practice

Testing LTL Formula Translation into Büchi Automata

Algorithmic Software Verification

On the Modeling and Verification of Security-Aware and Process-Aware Information Systems

Formal Verification of Software

Development of dynamically evolving and self-adaptive software. 1. Background

Software Verification and Testing. Lecture Notes: Temporal Logics

Journal of Mathematics Volume 1, Number 1, Summer 2006 pp

2 Temporal Logic Model Checking

MetaGame: An Animation Tool for Model-Checking Games

Model checking test models. Author: Kevin de Berk Supervisors: Prof. dr. Wan Fokkink, dr. ir. Machiel van der Bijl

Model Checking of Software

Using Patterns and Composite Propositions to Automate the Generation of Complex LTL

Checking. E. M. Clarke O. Grumberg K. L. McMillan X. Zhao

Schedule. Logic (master program) Literature & Online Material. gic. Time and Place. Literature. Exercises & Exam. Online Material

Today s Agenda. Automata and Logic. Quiz 4 Temporal Logic. Introduction Buchi Automata Linear Time Logic Summary

Automata-based Verification - I

Static Program Transformations for Efficient Software Model Checking

From Workflow Design Patterns to Logical Specifications

Feature Specification and Automated Conflict Detection

The Course.

Constructing Automata from Temporal Logic Formulas : A Tutorial

The Model Checker SPIN

A computational model for MapReduce job flow

Model Checking based Software Verification

Validated Templates for Specification of Complex LTL Formulas

Formal Verification Problems in a Bigdata World: Towards a Mighty Synergy

Formal Verification of Computer Systems - (INFO-F-412)

DEGREES OF CATEGORICITY AND THE HYPERARITHMETIC HIERARCHY

Automated Route Planning for Milk-Run Transport Logistics with the NuSMV Model Checker

Fixed-Point Logics and Computation

INF5140: Specification and Verification of Parallel Systems

LTL Model Checking with Logic Based Petri Nets

10.2 Series and Convergence

Model Checking LTL Properties over C Programs with Bounded Traces

Runtime Verification of Concurrent Haskell Programs

INF5140: Specification and Verification of Parallel Systems

Mathematics for Computer Science/Software Engineering. Notes for the course MSM1F3 Dr. R. A. Wilson

Rigorous Software Development CSCI-GA

Software Engineering using Formal Methods

Combining Software and Hardware Verification Techniques

tutorial: hardware and software model checking

Model Based Testing for Security Checking. Wissam Mallouli and Prof. Ana Cavalli National Institute of Telecommunications, France November 21, 2007

CISC422/853: Formal Methods

A Propositional Dynamic Logic for CCS Programs

Automata-Based Verification of Temporal Properties on Running Programs Dimitra Giannakopoulou Klaus Havelund

Introduction to SPIN. Acknowledgments. Parts of the slides are based on an earlier lecture by Radu Iosif, Verimag. Ralf Huuck. Features PROMELA/SPIN

Foundational Proof Certificates

A Classification of Model Checking-based Verification Approaches for Software Models

Finding Liveness Errors with ACO

CHAPTER 7 GENERAL PROOF SYSTEMS

The University of Jordan

Monitoring Metric First-order Temporal Properties

Stylianos Basagiannis

VeriTech - A Framework for Translating among Model Description Notations

Specification and Analysis of Contracts Lecture 1 Introduction

Turing Degrees and Definability of the Jump. Theodore A. Slaman. University of California, Berkeley. CJuly, 2005

Digital Design Verification

TO APPEAR IN: IEEE TRANSACTIONS ON DEPENDABLE AND SECURE COMPUTING 1. Proactive Detection of Computer Worms Using Model Checking

Chapter 4 Lecture Notes

Verifying Real-Time Embedded Software by Means of Automated State-based Online Testing and the SPIN Model Checker Application to RTEdge Models

Runtime Verification - Monitor-oriented Programming - Monitor-based Runtime Reflection

Continued Fractions and the Euclidean Algorithm

Counterexample-guided Design of Property-based Dynamic Software Updates

Semantics and Verification of Software

Formal Verification Coverage: Computing the Coverage Gap between Temporal Specifications

Introducing Formal Methods. Software Engineering and Formal Methods

Software Model Checking. Equivalence Hierarchy

FACTORING POLYNOMIALS IN THE RING OF FORMAL POWER SERIES OVER Z

Program Synthesis is a Game

Path Querying on Graph Databases

Fundamentals of Software Engineering

University of Ostrava. Reasoning in Description Logic with Semantic Tableau Binary Trees

The Goldberg Rao Algorithm for the Maximum Flow Problem

CS Master Level Courses and Areas COURSE DESCRIPTIONS. CSCI 521 Real-Time Systems. CSCI 522 High Performance Computing

Transcription:

1/32 Model Checking II Temporal Logic Model Checking Edmund M Clarke, Jr School of Computer Science Carnegie Mellon University Pittsburgh, PA 15213

2/32 Temporal Logic Model Checking Specification Language: A propositional temporal logic Verification Procedure: Exhaustive search of the state space of the system to determine if the specification is true or not E M Clarke and E A Emerson Synthesis of synchronization skeletons for branching time temporal logic In Logic of programs: workshop, Yorktown Heights, NY, May 1981, volume 131 of Lecture Notes in Computer Science Springer-Verlag, 1981 JP Quielle and J Sifakis Specification and verification of concurrent systems in CESAR In Proceedings of the Fifth International Symposium in Programming, volume 137 of Lecture Notes in Computer Science Springer-Verlag, 1981

3/32 Why Model Checking? Advantages: No proofs! Fast Counter-examples No problem with partial specifications Logics can easily express many concurrency properties Main Disadvantage: State Explosion Problem Too many processes Data Paths Much progress has been made on this problem recently!

4/32 Model of Computation; Microwave Example Finite-state systems are modeled by labeled statetransition graphs, called Kripke Structures

5/32 Model of Computation (Cont) If some state is designated as the initial state, the structure can be unwound into an infinite tree with that state as the root b c a b c State Transition Graph or Kripke Model We will refer to this infinite tree as the computation tree of the system a b Paths in the tree represent possible computations or behaviors of the program a b b c c c c Infinite Computation Tree (Unwind State Graph to obtain Infinite Tree)

6/32 Model of Computation (Cont) Formally, a Kripke structure is a triple M = S,R,L, where S is the set of states, R S S is the transition relation, and L : S P(AP) gives the set of atomic propositions true in each state We assume that every state has at least one possible successor (ie, for all states s S there exists a state s S such that (s,s ) R) A path in M is an infinite sequence of states, π = s 0,s 1, such that for i 0, (s i,s i+1 ) R We write π i to denote the suffix of π starting at s i Unless otherwise stated, we assume finite Kripke structures

7/32 Computation Tree Logics Temporal logics may differ according to how they handle branching in the underlying computation tree In a linear temporal logic, operators are provided for describing events along a single computation path In a branching-time logic the temporal operators quantify over the paths that are possible from a given state

8/32 The Logic CTL The computation tree logic CTL (pronounced CTL star ) combines both branching-time and linear-time operators In this logic a path quantifier can prefix an assertion composed of arbitrary combinations of the usual linear-time operators 1 Path quantifiers: A for every path E there exists a path 2 Linear-time operators: Xp p holds true next time Fp p holds true sometime in the future Gp p holds true globally in the future puq p holds true until q holds true For a path π = (s 0,s 1,), state s 0 is considered to be at the present time

9/32 Path Formulas and State Formulas The syntax of state formulas is given by the following rules: If p is an atomic proposition, then p is a state formula If f and g are state formulas, then f and f g are state formulas If f is a path formula, then E(f) and A(f) are state formulas Two additional rules are needed to specify the syntax of path formulas: If f is a state formula, then f is also a path formula (A state formula f is true for a path π if the f is true in the initial state of the path π) If f and g are path formulas, then f, f g, X f, F f, G f, and f U g are path formulas

10/32 State Formulas (Cont) If f is a state formula, the notation M,s = f means that f holds at state s in the Kripke structure M Assume f 1 and f 2 are state formulas and g is a path formula The relation M,s = f is defined inductively as follows: 1 s = p atomic proposition p is true in s 2 s = f 1 s = f 1 3 s = f 1 f 2 s = f 1 or s = f 2 4 s = E(g) g holds true for some path π starting with s 4 s = A(g) g holds true for every path π starting with s

11/32 Path Formulas (Cont) If f is a path formula, the notation M,π = f means that f holds true for path π in Kripke structure M Assume g 1 and g 2 are path formulas and f is a state formula The relation M,π = f is defined inductively as follows: 1 π = f s is the first state of π and s = f 2 π = g 1 π = g 1 3 π = g 1 g 2 π = g 1 or π = g 2 4 π = X g 1 π 1 = g 1 5 π = F g 1 π k = g 1 for some k 0 6 π = G g 1 π k = g 1 for every k 0 7 π = g 1 U g 2 there exists a k 0 such that π k = g 2 and π j = g 1 for 0 j < k Recall: For π = (s 0,s 1,), we write π i to denote the suffix starting with s i

12/32 Time Notice that Fp, FFp, FFFp, etc, hold true for a path π even if p holds true at only the initial state in the path π In CTL, the future includes the present state (States have temporal duration, so if we re presently in state s at time t, then we ll still be in state s in the future at time t + dt where dt is an infinitesimally small period of time)

13/32 Relationships between operators Note the following: A(f) E( f) Ff (true U f) (Recall: π = g 1 U g 2 there exists a k 0 such that π k = g 2 and π j = g 1 for 0 j < k) G f F f So, given any CTL formula, we can rewrite it without using the operators A, F, or G

14/32 The Logic CTL CTL is a restricted subset of CTL that permits only branching-time operators each of the linear-time operators G, F, X, and U must be immediately preceded by a path quantifier More precisely, CTL is the subset of CTL that is obtained if the following two rules are used to specify the syntax of path formulas If f and g are state formulas, then X f and f U g are path formulas If f is a path formula, then so is f Example: AG(EF p)

15/32 The Logic LTL Linear temporal logic (LTL), on the other hand, consists of formulas that have the form A f where f is a path formula in which the only state subformulas permitted are atomic propositions More precisely, a path formula is either: If p AP, then p is a path formula If f and g are path formulas, then f, f g, X f, and f U g are path formulas Example: A(FG p)

16/32 Expressive Power It can be shown that the three logics discussed in this section have different expressive powers For example, there is no CTL formula that is equivalent to the LTL formula A(FG p) Likewise, there is no LTL formula that is equivalent to the CTL formula AG(EF p) The disjunction A(FG p) AG(EF p) is a CTL formula that is not expressible in either CTL or LTL

17/32 AF(AG(p)) vs A(FG(p)) Consider the following Kripke structure: Are there any paths starting with S 1 for which G p is true? Starting with S 2? Starting with S 3? At which states does AG p hold true? At which states does AFAG p hold true? Does FGp hold true for all paths starting with S 1?

18/32 Basic CTL Operators There are eight basic CTL operators: AX and EX, AG and EG, AF and EF, AU and EU Each of these can be expressed in terms of EX, EG, and EU: AX f = EX( f) AG f = EF( f) AFf = EG( f) EFf = E[true U f] A[f U g] E[ g U f g] EG g

Basic CTL Operators (Cont) The four most widely used CTL operators are illustrated here Each computation tree has the state s 0 as its root g g g g M,s 0 = EF g M,s 0 = AFg g g g g g g g g g g M,s 0 = EGg M,s 0 = AG g 19/32

20/32 Typical CTL formulas EF(Started Ready): It is possible to get to a state where Started holds but Ready does not hold AG(Req AF Ack): If a request occurs, then it will be eventually acknowledged AG(AF DeviceEnabled): The proposition DeviceEnabled holds infinitely often on every computation path AG(EF Restart): From any state it is possible to get to the Restart state A(GF enabled GF executed): if a process is infinitely-often enabled, then it is infinitely-often executed Note that the first four formulas are CTL formulas

21/32 Model Checking Problem Let M be the state transition graph obtained from the concurrent system Let f be the specification expressed in temporal logic Find all states s of M such that M,s = f There exist very efficient model checking algorithms for the logic CTL E M Clarke, E A Emerson, and A P Sistla Automatic verification of finite-state concurrent systems using temporal logic specifications ACM Trans Programming Languages and Systems, 8(2):pages 244 263, 1986

22/32 The EMC Verification System Preprocessor Model Checker (EMC) CTL formulas State Transition Graph 10 4 to 10 5 states True or Counterexample

23/32 Basic Model Checking Algorithm M,s 0 = EG a AFb? M,s 0 = AF a AF b? a ~b ~a b a ~b a b

24/32 Basic Model Checking Algorithm M,s 0 = EG a AFb? M,s 0 = AF a AF b? a ~b ~a b AF b AF ~a a ~b a AF b b

25/32 Basic Model Checking Algorithm M,s 0 = EG a AFb? M,s 0 = AF a AF b? a ~b ~a b AF b AF ~a a ~b AF b a AF b b

26/32 Basic Model Checking Algorithm M,s 0 = EG a AFb? M,s 0 = AF a AF b? a ~b AF b ~a b AF b AF ~a a ~b AF b a AF b b

27/32 Basic Model Checking Algorithm M,s 0 = EG a AFb? M,s 0 = AF a AF b? a ~b AF b ~AF ~a ~a b AF b AF ~a a ~b AF b ~AF ~a a b AF b ~AF ~a

28/32 Mutual Exclusion Example n1 n2 t1 n2 n1 t2 c1 n2 t1 t2 t1 t2 n1 c2 c1 t2 t1 c2

29/32 Mutual Exclusion Example n1 n2 t1 -> AF c1 t1 n2 n1 t2 t1 -> AF c1 c1 n2 AF c1 t1 t2 t1 t2 n1 c2 t1 -> AF c1 c1 AF c1 t2 t1 c2

30/32 Mutual Exclusion Example n1 n2 t1 -> AF c1 t1 n2 n1 t2 t1 -> AF c1 c1 n2 AF c1 t1 -> AF c1 t1 t2 AF c1 t1 t2 n1 c2 t1 -> AF c1 c1 t2 AF c1 t1 -> AF c1 t1 c2

31/32 Mutual Exclusion Example n1 n2 t1 -> AF c1 t1 AF c1 n2 n1 t2 t1 -> AF c1 c1 n2 AF c1 t1 -> AF c1 t1 t2 AF c1 t1 -> AF c1 t1 t2 n1 c2 t1 -> AF c1 c1 t2 AF c1 t1 -> AF c1 t1 c2

32/32 The Kyoto University Verifier Vectorized version of EMC algorithm on Fujitsu FACOM VP400E using an explicit representation of the state transition graph State Machine size: 131,072 states 67,108,864 transitions 512 transitions from each state on the average CTL formula: 113 different subformulas Time for model checking: 225 seconds!!