A Brief Introduction to Model Checking

Similar documents
Variations on Itai-Rodeh Leader Election for Anonymous Rings and their Analysis in PRISM

Formal Verification of Mobile Network Protocols

Linear Temporal Logic and Büchi Automata

Model Checking. Boris Feigin March 9, University College London

Model Checking. Temporal Logic. Fifth International Symposium in Programming, volume. of concurrent systems in CESAR. In Proceedings of the

The State Explosion Problem

Double Header. Model Checking. Model Checking. Overarching Plan. Take-Home Message. Spoiler Space. Topic: (Generic) Model Checking

ESE601: Hybrid Systems. Introduction to verification

Formal Verification Techniques. Riccardo Sisto, Politecnico di Torino

Model Checking: An Introduction

Abstractions and Decision Procedures for Effective Software Model Checking

Model Checking with CTL. Presented by Jason Simas

Software Verification using Predicate Abstraction and Iterative Refinement: Part 1

State-Space Exploration. Stavros Tripakis University of California, Berkeley

Chapter 5: Linear Temporal Logic

Distributed Algorithms

Semantic Equivalences and the. Verification of Infinite-State Systems 1 c 2004 Richard Mayr

Symbolic Trajectory Evaluation (STE): Orna Grumberg Technion, Israel

Models for Efficient Timed Verification

A brief history of model checking. Ken McMillan Cadence Berkeley Labs

SFM-11:CONNECT Summer School, Bertinoro, June 2011

MODEL CHECKING. Arie Gurfinkel

Overview. Discrete Event Systems Verification of Finite Automata. What can finite automata be used for? What can finite automata be used for?

CS 267: Automated Verification. Lecture 1: Brief Introduction. Transition Systems. Temporal Logic LTL. Instructor: Tevfik Bultan

Model checking the basic modalities of CTL with Description Logic

Methods for Software Verification. Andrea Corradini Gian Luigi Ferrari. Second Semester 6 CFU

Probabilistic Model Checking Michaelmas Term Dr. Dave Parker. Department of Computer Science University of Oxford

Introduction. Pedro Cabalar. Department of Computer Science University of Corunna, SPAIN 2013/2014

Symmetry Reductions. A. Prasad Sistla University Of Illinois at Chicago

On-the-Fly Model Checking for Extended Action-Based Probabilistic Operators

6.852: Distributed Algorithms Fall, Class 24

Verification Using Temporal Logic

Postprint.

Symmetric Rendezvous in Graphs: Deterministic Approaches

Helsinki University of Technology Laboratory for Theoretical Computer Science Research Reports 66

3-Valued Abstraction-Refinement

Model Checking & Program Analysis

CTL Model checking. 1. finite number of processes, each having a finite number of finite-valued variables. Model-Checking

Introduction to Model Checking. Debdeep Mukhopadhyay IIT Madras

for System Modeling, Analysis, and Optimization

Temporal Logic Model Checking

Binary Decision Diagrams and Symbolic Model Checking

PSPACE-completeness of LTL/CTL model checking

Temporal Logic. Stavros Tripakis University of California, Berkeley. We have designed a system. We want to check that it is correct.

Temporal Formula Specifications of Asynchronous Control Module in Model Checking

Lecture Notes on Emptiness Checking, LTL Büchi Automata

Computation Tree Logic (CTL) & Basic Model Checking Algorithms

Finite-State Model Checking

An Informal introduction to Formal Verification

Guest lecturer: Prof. Mark Reynolds, The University of Western Australia

Recent results on Timed Systems

Algebraic Trace Theory

Automata-Theoretic Model Checking of Reactive Systems

Design and Analysis of Distributed Interacting Systems

Lecture Notes on Model Checking

The Leader Election Protocol (IEEE 1394)

CS357: CTL Model Checking (two lectures worth) David Dill

SMV the Symbolic Model Verifier. Example: the alternating bit protocol. LTL Linear Time temporal Logic

Symmetry Reduction and Compositional Verification of Timed Automata

T Reactive Systems: Temporal Logic LTL

Algebraic Trace Theory

Algorithmic verification

Principles. Model (System Requirements) Answer: Model Checker. Specification (System Property) Yes, if the model satisfies the specification

Chapter 4: Computation tree logic

Predicate Abstraction in Protocol Verification

Automata-based Verification - III

Temporal & Modal Logic. Acronyms. Contents. Temporal Logic Overview Classification PLTL Syntax Semantics Identities. Concurrency Model Checking

PLEASE DO NOT REMOVE THIS PAGE

Automata-based Verification - III

Formal Methods in Software Engineering

Parallel Performance Evaluation through Critical Path Analysis

Formal Specification and Verification of Task Time Constraints for Real-Time Systems

6.852: Distributed Algorithms Fall, Class 10

Unbounded, Fully Symbolic Model Checking of Timed Automata using Boolean Methods

Timo Latvala. February 4, 2004

PRISM An overview. automatic verification of systems with stochastic behaviour e.g. due to unreliability, uncertainty, randomisation,

Partial model checking via abstract interpretation

Introduction. Büchi Automata and Model Checking. Outline. Büchi Automata. The simplest computation model for infinite behaviors is the

Reasoning about Strategies: From module checking to strategy logic

Easy Parameterized Verification of Biphase Mark and 8N1 Protocols

Probabilistic model checking with PRISM

Formal Verification. Lecture 1: Introduction to Model Checking and Temporal Logic¹

Modal and Temporal Logics

An Indian Journal FULL PAPER ABSTRACT KEYWORDS. Trade Science Inc.

An Introduction to Temporal Logics

Verification. Arijit Mondal. Dept. of Computer Science & Engineering Indian Institute of Technology Patna

Synthesis of Designs from Property Specifications

Circular Compositional Reasoning about Liveness

Benefits of Interval Temporal Logic for Specification of Concurrent Systems

Reasoning about Time and Reliability

Network Algorithms and Complexity (NTUA-MPLA) Reliable Broadcast. Aris Pagourtzis, Giorgos Panagiotakos, Dimitris Sakavalas

The Expressivity of Universal Timed CCP: Undecidability of Monadic FLTL and Closure Operators for Security

SBMC : Symmetric Bounded Model Checking

The Underlying Semantics of Transition Systems

From CCS to Hybrid π via baby steps. Bill Rounds CSE, U of Michigan

Component-wise Incremental LTL Model Checking

Computer-Aided Program Design

Interval Temporal Logics over Strongly Discrete Linear Orders: the Complete Picture

Overview. overview / 357

Notes on BAN Logic CSG 399. March 7, 2006

Transcription:

A Brief Introduction to Model Checking Jan. 18, LIX Page 1

Model Checking A technique for verifying finite state concurrent systems; a benefit on this restriction: largely automatic; a problem to fight: state space explosion; A logic pointview: the system as a semantical model M, and a property as a logical formula ϕ; to check whether M ϕ (by exhaustive search); possible approaches: model checking chooses to work on models directly; Reasonable efficiency, giving answers in seconds/minutes; Counter-examples provide insight to understand the failures. Jan. 18, LIX Page 2

Model Checking Pioneers work: West and Zafiropulo (1977, 1978), Clarke and Emerson (1981), and Quielle and Sifakis (1981); Applications: electric circuits, communication protocols, digital controllers, system designs,..., widely accepted in industry; A book: Model Checking, E.M. Clarke, O. Grumberg and D.A. Peled, MIT Press, 2000; Model checkers: FDR, Spin, Morφ, νsmv, CADP, Uppaal, PRISM, HyTech, COSPAN, STeP, Kronos... Jan. 18, LIX Page 3

Model Checking To apply it, we need the follows: Modeling languages: describe the systems, e.g. µcrl; a process algebraic language semantics of the languages, e.g. LTS, Kripke structures, automata; Specification languages: formulate properties, e.g. LTL, CTL, regular alternationfree µ-calculus; safety and liveness properties; [T error] F; [ T send ( receive) ] ( receive) receive T; Algorithms: verify properties. Jan. 18, LIX Page 4

Model Checking The process: Systems =? Desired properties Formal description Semantical model? Logical formulas Model checker no no yes Jan. 18, LIX Page 5

Model Checking Research issues: Approaches to fight state space explosion; Expressiveness of logics; Efficiency of algorithms. Jan. 18, LIX Page 6

Model Checking Partial order reduction: Idea: fix a particular order of interleaving behaviors, while preserving properties of interest; CWI: τ -confluence reduction (preserving branching bisimulation). s 0 τ a s 1 s 2 a τ s 3 Jan. 18, LIX Page 7

Model Checking Symmetry reduction (similar to data independence): Idea: construct a quotient structure, by exploiting automorphisms of the system s state space; CWI: symmetry reduction for LTSs. s(1) t s(3) s(2) τ τ τ r(1) r(2) r(3) Jan. 18, LIX Page 8

Model Checking Abstraction (on data): Idea: replace a semantical model by an abstract (simpler, finite) model, the abstraction needs to be safe; CWI: abstract interpretation for µcrl; patterns for uniform parallel processes, abstraction for liveness properties. b a a a b a a a a b b b b Jan. 18, LIX Page 9

Model Checking On-the-fly: Idea: not generate unnecessary state space, especially when a formula is false; CWI: interface with the model checker CADP. Jan. 18, LIX Page 10

Model Checking Symbolic model checking (OBDDs): Kenneth L. McMillan, PhD Thesis, CMU, 1992; Idea: avoid explicit enumeration of set, by expressing set as a propositional formula; OBDDs as data structures to represent the state space; CWI: a checker for modal formulas for processes with data. S = [0, 2, 4, 5, 6, 7] S = [000, 010, 100, 101, 110, 111] S = {s s 3 = 0 s 1 = 1}, (s = s 1 s 2 s 3 ) Jan. 18, LIX Page 11

Model Checking Distributed and parallel model checking: Problem: the state space does not completely fit into the main memory of a computer; Idea: increase the computational power by building a cluster of stations; CWI: distributed state space generation and reduction w.r.t. strong and branching bisimulation. Jan. 18, LIX Page 12

Model Checking More recent challenging issues: Timed, hybrid, probabilistic, mobile systems, e.g. Uppaal, Kronos, PRISM,?; Software verification, e.g. Spin; Source code verification, e.g. Bandera; Infinite-state systems, e.g. regular model checkers Fast, Trex; Challenging case studies, e.g. NASA Mars exploration rover. Jan. 18, LIX Page 13

Simplifying Itai-Rodeh Leader Election for Anonymous Rings Jan. 18, LIX Page 14

Leader Election p 0 p N p 1 p N 1 p 2 p N 2 p 3 Figure 1: Mutual exclusion: token recovery. Jan. 18, LIX Page 15

Leader Election Many algorithms: Communication mechanism: asynchronous vs. synchronous; Process names: unique identities vs. anonymous; Network topology: ring, tree, complete graph;... Jan. 18, LIX Page 16

Plan of the Talk 1. The Chang-Roberts algorithm and the Itai-Rodeh algorithm; 2. Algorithm A: leader election without round numbers; 3. Algorithm B: leader election without bits; 4. Performance analysis in PRISM; 5. Conclusions and future works. Jan. 18, LIX Page 17

The Chang-Roberts Algorithm Processes have unique identity and send messages with identity; process with maximal identity is elected as the leader. 0 N 1 N 1 2 N 2 3 States of processes: {active, passive, leader} Jan. 18, LIX Page 18

Anonymous Rings Some cases where processes cannot be distinguished by means of unique identities: 1. as the number of processes increases, it is difficult to keep all the identities of processes distinct; 2. identities cannot always be sent around the network, e.g. FireWire, the IEEE 1394 high performance serial bus. Jan. 18, LIX Page 19

The Itai-Rodeh Algorithm Probabilistic method to break symmetry! Assumption: processes have the knowledge of the ring size n. Difficulties: each process selects a random identity from a finite set, so different processes may carry the same identity. Each process needs to recognize the message sent by its own hop counter; realize name clashes bit; and recognize old messages and start a new round round number. Jan. 18, LIX Page 20

The Itai-Rodeh Algorithm Initially, all processes are active, and each process p i randomly selects its identity id i {1,..., k} and sends the message (id i, 1, 1, true). Upon receipt of a message (id, round, hop, bit), a passive process p i (state i = passive) passes on the message, increasing the counter hop by one; an active process p i (state i = active) behaves according to one of the following steps: Jan. 18, LIX Page 21

The Itai-Rodeh Algorithm 1. if hop = n and bit = true, then p i becomes the leader (state i = leader ); 2. if hop = n and bit = false, then p i selects a new random identity id i {1,..., k}, moves to the next round (round i = round i + 1), and sends the message (id i, round i, 1, true); 3. if hop < n and (round, id) = (round i, id i ), then p i passes on the message (id, round, hop + 1, false); 4. if (round, id) > (round i, id i ), then p i becomes passive (state i = passive) and passes on the message (id, round, hop + 1, bit); 5. if (round, id) < (round i, id i ), then p i purges the message. Jan. 18, LIX Page 22

The Itai-Rodeh Algorithm Theorem 1 [Itai and Rodeh 1981] The Itai-Rodeh algorithm terminates with probability one, and upon termination a unique leader has been elected. Jan. 18, LIX Page 23

The Itai-Rodeh Algorithm u (u, 1, 1, true) u (u, 1, 1, true) (v, 1, 1, true) v u > v Figure 2: The Itai-Rodeh Algorithm: an example n = 3 Jan. 18, LIX Page 24

The Itai-Rodeh Algorithm u u (u, 1, 2, false) (u, 1, 2, true) v u > v Figure 3: The Itai-Rodeh Algorithm: an example n = 3 Jan. 18, LIX Page 25

The Itai-Rodeh Algorithm u (u, 1, 3, false) u (u, 1, 3, false) v u > v Figure 4: The Itai-Rodeh Algorithm: an example n = 3 Jan. 18, LIX Page 26

The Itai-Rodeh Algorithm w (w, 2, 1, true) x (x, 2, 1, true) v w > x Figure 5: The Itai-Rodeh Algorithm: an example n = 3 Jan. 18, LIX Page 27

The Itai-Rodeh Algorithm w x (w, 2, 2, true) (x, 2, 2, true) v w > x Figure 6: The Itai-Rodeh Algorithm: an example n = 3 Jan. 18, LIX Page 28

The Itai-Rodeh Algorithm w x (w, 2, 3, true) v w > x Figure 7: The Itai-Rodeh Algorithm: an example n = 3 Jan. 18, LIX Page 29

Round Number are Essential! Observations: Itai-Rodeh leader election has infinite state space, (due to round numbers). Round numbers are essential if channels are not FIFO. (u, 1, true) (w, 1, true) (w, 1, true) u u w x w x (u, 1, true) (x, 1, true) (x, 1, true) (v, 1, true) (v, 1, true) (v, 3, true) v v v u > v v > w, x v > w, x Jan. 18, LIX Page 30

Leader Election without Round Numbers Observations: if channels are FIFO, round numbers are redundant. Proposition 2 Consider the Itai-Rodeh algorithm where all channels are FIFO. When an active process receives a message, then the round numbers of the process and the message are always the same. Jan. 18, LIX Page 31

Leader Election without Round Numbers Algorithm A: messages have the form of (id, hop, bit). Passive processes behave the same as before. 1. if hop = n and bit = true, then p i becomes the leader (state i = leader ); 2. if hop = n and bit = false, then p i selects a new random identity id i {1,..., k} and sends the message (id i, 1, true); 3. if hop < n and id = id i, then p i passes on the message (id, hop + 1, false); 4. if id > id i, then p i becomes passive (state i = passive) and passes on the message (id, hop + 1, bit); 5. if id < id, then p i purges the message. Jan. 18, LIX Page 32

Leader Election without Round Numbers u (u, 1, true) u (u, 1, true) (v, 1, true) v u > v Figure 8: Algorithm A: an example n = 3 (step 1) Jan. 18, LIX Page 33

Leader Election without Round Numbers u u (u, 2, false) (u, 2, true) v u > v Figure 9: Algorithm A: an example n = 3 (step 2) Jan. 18, LIX Page 34

Leader Election without Round Numbers u (u, 3, false) u (u, 3, false) v u > v Figure 10: Algorithm A: an example n = 3 (step 3) Jan. 18, LIX Page 35

Leader Election without Round Numbers w (w, 1, true) x (x, 1, true) v w > x Figure 11: Algorithm A: an example n = 3 (step 4) Jan. 18, LIX Page 36

Leader Election without Round Numbers w x (w, 2, true) (x, 2, true) v w > x Figure 12: Algorithm A: an example n = 3 (step 5) Jan. 18, LIX Page 37

Leader Election without Round Numbers w x (w, 3, true) v w > x Figure 13: Algorithm A: an example n = 3 (step 6) Jan. 18, LIX Page 38

Leader Election without Round Numbers Processes Identities Channel size FIFO States Transitions Ex.1 2 2 2 yes 127 216 Ex.2 3 3 3 yes 5,467 12,360 Ex.3 4 3 4 yes 99,329 283,872 Table 1: Model checking result for Algorithm A with FIFO channels in PRISM Theorem 3 Let channels be FIFO. Then Algorithm A terminates with probability one, and upon termination exactly one leader is elected. Proof. Reuse the proof of Itai and Rodeh and by Proposition 2. Jan. 18, LIX Page 39

Leader Election without Bits Observation: an active process p i detects a name clash, it is not necessary for p i to wait for its own message to return. Algorithm B: messages have the form of (id, hop). 1. if hop = n and id = id i, then p i becomes the leader (state i = leader ); 2. if hop < n and id = id i, then p i selects a new random identity id i {1,..., k} and sends the message (id i, 1); 3. if id > id i, then p i becomes passive (state i = passive) and passes on the message (id, hop + 1 ); 4. if id < id i, then p i purges the message. Jan. 18, LIX Page 40

Leader Election without Bits u (v, 1) (u, 1) v u (u, 1) u > v Figure 14: Algorithm B: an example n = 3 (step 1) Jan. 18, LIX Page 41

Leader Election without Bits u x (u, 2) (x, 1) v Figure 15: Algorithm B: an example n = 3 (step 2) Jan. 18, LIX Page 42

Leader Election without Bits w (w, 1) x (x, 2) v w > x Figure 16: Algorithm B: an example n = 3 (step 3) Jan. 18, LIX Page 43

Leader Election without Bits w x (w, 2) v w > x Figure 17: Algorithm B: an example n = 3 (step 4) Jan. 18, LIX Page 44

Leader Election without Bits w x (w, 3) v w > x Figure 18: Algorithm B: an example n = 3 (step 5) Jan. 18, LIX Page 45

Leader Election without Bits Processes Identities Channel size FIFO States Transitions Ex.1 2 2 2 yes 97 168 Ex.2 3 3 3 yes 6,019 14,115 Ex.3 4 3 4 yes 176,068 521,452 Ex.4 4 4 4 yes 537,467 1,615,408 Ex.5 5 2 5 yes 752,047 2,626,405 Table 2: Model checking result for Algorithm B with FIFO channels Jan. 18, LIX Page 46

Leader Election without Bits Theorem 4 Let channels be FIFO. Then Algorithm B terminates with probability one, and upon termination exactly one leader is elected. Proof is not easy! Jan. 18, LIX Page 47

Performance Analysis in PRISM The probability that Algorithms A and B terminate within a given number of transitions. 1 0.9 2 processes, 2 identities algorithm A algorithm B 0.8 probability of electing a leader 0.7 0.6 0.5 0.4 0.3 0.2 0.1 0 10 20 30 40 50 60 70 80 90 100 number of discrete time steps Figure 19: The probability of electing a leader with deadlines. Jan. 18, LIX Page 48

Performance Analysis in PRISM The probability that Algorithms A and B terminate within a given number of transitions. 1 0.9 3 processes, 3 identities algorithm A algorithm B 0.8 probability of electing a leader 0.7 0.6 0.5 0.4 0.3 0.2 0.1 0 10 20 30 40 50 60 70 80 90 100 number of discrete time steps Figure 20: The probability of electing a leader with deadlines. Jan. 18, LIX Page 49

Performance Analysis in PRISM The expected number of steps before a unique leader is elected for each algorithm. Processes Identities Channel size Steps (A) Steps (B) Ex.1 2 2 2 25.0 19.0 Ex.2 3 3 3 33.6 29.3 Ex.3 4 3 4 52.5 46.0 Jan. 18, LIX Page 50

Conclusions and Future Works We developed two new leader election algorithms for anonymous rings; Model checking and performance analysis of both algorithms in PRISM; We gave a manual correctness proof for each algorithm; When k = 2, both algorithms A and B are correct even if channels are not FIFO; We developed two more probabilistic leader election algorithms, based on the Dolev- Klawe-Rodeh algorithm; We are going to check the proofs in PVS. Jan. 18, LIX Page 51

The Proof of Theorem 4 Definition 5 The processes and messages between a process p and a message m are the ones that are encountered when traveling in the ring from p to m. Lemma 6 Let active process p have identity id p and message m have identity id m. If id p id m, then there is an active process or message between p and m with an identity min{id p, id m }. Proof. We apply induction on execution sequences. Jan. 18, LIX Page 52

The Proof of Theorem 4 Definition 7 An active process p is related to a message m if they have the same identity id, and all active processes and messages between p and m have an identity smaller than id. Lemma 8 Let active process p be related to message m. Let ξ be the maximum of all identities of active processes and messages between p and m (ξ = 0 if there are none). 1. Between p and m, there is an equal number of active processes and of messages with identity ξ; and 2. if p is not the originator of m, then there is an active process or message between p and m. Proof. We apply induction on execution sequences. Jan. 18, LIX Page 53

The Proof of Theorem 4 Definition 9 We say that an active process or message is maximal if its identity is maximal among the active processes or messages in the ring, respectively. In the following proposition we write ξ π and ξ µ for the identity of maximal active processes and messages, respectively. We write # π and # µ for the number of maximal active processes and messages, respectively. Proposition 10 Until a leader is elected, there exist active processes and messages in the ring, and ξ π = ξ µ and # π = # µ. Proof. We apply induction on execution sequences. Finally, by induction on execution sequences, and use Proposition 10, we can prove Theorem 4. Jan. 18, LIX Page 54