1 Model checking. 2 And now... the system How do we model a reactive system with an automaton ? It is convenient to model systems with Transition systems.

Slides:



Advertisements
Similar presentations
1 Verification by Model Checking. 2 Part 1 : Motivation.
Advertisements

Model Checking Lecture 1.
Automated Theorem Proving Lecture 1. Program verification is undecidable! Given program P and specification S, does P satisfy S?
Model Checking Lecture 2. Three important decisions when choosing system properties: 1automata vs. logic 2branching vs. linear time 3safety vs. liveness.
1 Reasoning with Promela Safety properties bad things do not happen can check by inspecting finite behaviours Liveness properties good things do eventually.
Model Checking and Testing combined
Black Box Checking Book: Chapter 9 Model Checking Finite state description of a system B. LTL formula. Translate into an automaton P. Check whether L(B)
Automatic Verification Book: Chapter 6. How can we check the model? The model is a graph. The specification should refer the the graph representation.
Tutorial I – An Introduction to Model Checking Peng WU INRIA Futurs LIX, École Polytechnique.
CS 267: Automated Verification Lecture 2: Linear vs. Branching time. Temporal Logics: CTL, CTL*. CTL model checking algorithm. Counter-example generation.
M ODEL CHECKING -Vasvi Kakkad University of Sydney.
CS 267: Automated Verification Lecture 8: Automata Theoretic Model Checking Instructor: Tevfik Bultan.
Partial Order Reduction: Main Idea
CS 290C: Formal Models for Web Software Lecture 3: Verification of Navigation Models with the Spin Model Checker Instructor: Tevfik Bultan.
Automatic Verification Book: Chapter 6. What is verification? Traditionally, verification means proof of correctness automatic: model checking deductive:
ECE Synthesis & Verification - L271 ECE 697B (667) Spring 2006 Synthesis and Verification of Digital Systems Model Checking basics.
Temporal Logic and the NuSMV Model Checker CS 680 Formal Methods Jeremy Johnson.
1 Partial Order Reduction. 2 Basic idea P1P1 P2P2 P3P3 a1a1 a2a2 a3a3 a1a1 a1a1 a2a2 a2a2 a2a2 a2a2 a3a3 a3a3 a3a3 a3a3 a1a1 a1a1 3 independent processes.
1 Temporal Claims A temporal claim is defined in Promela by the syntax: never { … body … } never is a keyword, like proctype. The body is the same as for.
CIS 540 Principles of Embedded Computation Spring Instructor: Rajeev Alur
1 Formal Methods in SE Qaisar Javaid Assistant Professor Lecture 05.
© 2011 Carnegie Mellon University SPIN: Part Bug Catching: Automated Program Verification and Testing Sagar Chaki November 2, 2011.
1 Formal Methods in SE Qaisar Javaid Assistant Professor Lecture # 11.
CSE 555 Protocol Engineering Dr. Mohammed H. Sqalli Computer Engineering Department King Fahd University of Petroleum & Minerals Credits: Dr. Abdul Waheed.
1 Carnegie Mellon UniversitySPINFlavio Lerda SPIN An explicit state model checker.
Lecture 4&5: Model Checking: A quick introduction Professor Aditya Ghose Director, Decision Systems Lab School of IT and Computer Science University of.
Modeling Software Systems Lecture 2 Book: Chapter 4.
Temporal Logic and Model Checking. Reactive Systems We often classify systems into two types: Transformational: functions from inputs available at the.
Specification Formalisms Book: Chapter 5. Properties of formalisms Formal. Unique interpretation. Intuitive. Simple to understand (visual). Succinct.
Review of the automata-theoretic approach to model-checking.
Automata and Formal Lanugages Büchi Automata and Model Checking Ralf Möller based on slides by Chang-Beom Choi Provable Software Lab, KAIST.
1 Formal Engineering of Reliable Software LASER 2004 school Tutorial, Lecture1 Natasha Sharygina Carnegie Mellon University.
1 Translating from LTL to automata. 2 Why translating? Want to write the specification in some logic. Want to check that an automaton (or a Kripke structure)
Flavio Lerda 1 LTL Model Checking Flavio Lerda. 2 LTL Model Checking LTL –Subset of CTL* of the form: A f where f is a path formula LTL model checking.
1 Carnegie Mellon UniversitySPINFlavio Lerda Bug Catching SPIN An explicit state model checker.
1 CSCI 2400 section 3 Models of Computation Instructor: Costas Busch.
Verification technique on SA applications using Incremental Model Checking 컴퓨터학과 신영주.
15-820A 1 LTL to Büchi Automata Flavio Lerda A 2 LTL to Büchi Automata LTL Formulas Subset of CTL* –Distinct from CTL AFG p  LTL  f  CTL. f.
1 Introduction to SMV and Model Checking Mostly by: Ken McMillan Cadence Berkeley Labs Small parts by: Brandon Eames ISIS/Vanderbilt.
Wishnu Prasetya Model Checking with SPIN A Bit More about SPIN.
Basics of automata theory
10/19/2015COSC , Lecture 171 Real-Time Systems, COSC , Lecture 17 Stefan Andrei.
CS6133 Software Specification and Verification
CIS 842: Specification and Verification of Reactive Systems Lecture Specifications: LTL Model Checking Copyright , Matt Dwyer, John Hatcliff,
CS5270 Lecture 41 Timed Automata I CS 5270 Lecture 4.
Copyright , Doron Peled and Cesare Tinelli. These notes are based on a set of lecture notes originally developed by Doron Peled at the University.
1 CSEP590 – Model Checking and Automated Verification Lecture outline for August 6, 2003.
Recognizing safety and liveness Presented by Qian Huang.
Introduction to Model Checking
LTL Model Checking 张文辉
Constraints Assisted Modeling and Validation Presented in CS294-5 (Spring 2007) Thomas Huining Feng Based on: [1]Constraints Assisted Modeling and Validation.
CIS 540 Principles of Embedded Computation Spring Instructor: Rajeev Alur
1 Temporal logic. 2 Prop. logic: model and reason about static situations. Example: Are there truth values that can be assigned to x,y simultaneously.
Lecture 2 Overview Topics What I forgot from last lecture Proof techniques continued Alphabets, strings, languages Automata June 2, 2015 CSCE 355 Foundations.
Variants of LTL Query Checking Hana ChocklerArie Gurfinkel Ofer Strichman IBM Research SEI Technion Technion - Israel Institute of Technology.
Presented by: Belgi Amir Seminar in Distributed Algorithms Designing correct concurrent algorithms Spring 2013.
Today’s Agenda  Quiz 4  Temporal Logic Formal Methods in Software Engineering1.
CIS 540 Principles of Embedded Computation Spring Instructor: Rajeev Alur
Model Checking Lecture 2. Model-Checking Problem I |= S System modelSystem property.
CS5270 Lecture 41 Timed Automata I CS 5270 Lecture 4.
Complexity Relief Techniques for Model Checking METU, Aug SOFTWARE VERIFICATION WORKSHOP Hüsnü Yenigün Sabanci University Informatics Institute,
Model Checking Lecture 2 Tom Henzinger. Model-Checking Problem I |= S System modelSystem property.
Complexity of Compositional Model Checking of Computation Tree Logic on Simple Structures Krishnendu Chatterjee Pallab Dasgupta P.P. Chakrabarti IWDC 2004,
Basic concepts of Model Checking
Formal methods: Lecture
Automatic Verification
An explicit state model checker
Translating Linear Temporal Logic into Büchi Automata
COMP60621 Designing for Parallelism
CSCE 355 Foundations of Computation
Presentation transcript:

1 Model checking

2 And now... the system How do we model a reactive system with an automaton ? It is convenient to model systems with Transition systems (textutal representation), or, equivalenely, with a Kripke structures (automata representation).

3 Kripke structures A convenient model for describing reactive systems Implicitly all states are accepting. M= h S, , I, L i S: States (finite).  µ S x S is the transition relation. I µ S are the Initial states. L: S ) 2 AP (where AP is a set of atomic propositions) Convention: we will only write the positive literals.

4 A Kripke structure Note: the alphabet is NOT the set AP. Rather it is 2 AP

From a Kripke structure to a Buchi automata Given a Kripke structure M= h S,  , I M, L i......we can build an equivalent Buchi automata B M = h , S, ¢, I, F i where  = 2 Prop S // same states (s, t) 2 ¢ iff (s,t) 2 ¢ M and a = L(s) // transition relation I = I M // same initial state F = S //every state is accepting

Example The system: M = p,q p becomes the Buchi automaton (recall: a transition is labelled with an element of 2 AP ) p,q   p p Recall that this is {  p,  q}

7 Correctness condition An LTL formula  a set of allowed computations ( ‘ models ’ ). A Kripke structure M = a set of computations. Are the computations of M models of 

8 Correctness All sequences Sequences satisfying Spec Program computations

9 Incorrectness All sequences Sequences satisfying Spec Program computations Counter examples

10 Model-Checking: formally Language of a model M: L (M) Language of a specification  : L (  ). We need: L (M)  L (  ). This is called Model-Checking If yes, we write M ²  

11 Model checking – example p q,x p,x p,y M BB M ²  ?  : G (p U q) Let  = s 0,s 1 .  2 L (M) but   L (B  ). Hence L(M) * L (B  ). s0s0 s1s1 s2s2 model spec q

12 How to model-check? Show that L(Model)  L(Spec). Equivalently: Show that L(Model)  L(Spec) = Ø. How? Check that A model £ A : Spec is empty. M S M : S M µ S M Å : S  ;

13 What do we need to know? 1.How to translate from LTL to an automaton ? 2.How to complement an automaton? 3.How to intersect two automata? 4.How to check for emptiness of an automaton ? L(Model)  L(Spec) = Ø.

14 How to complement? Complementation is hard! We know how to translate an LTL formula to a Buchi automaton. So we can: Build an automaton A for , and complement A, or Negate the property, obtaining ¬  (the sequences that should never occur). Build an automaton for ¬ .

15 But... reacall... Theoretically, model checking gives us a proof of correctness Practically, it mainly attempts to increase reliability: Automated systematic debugging VERY good at finding errors! Why ? Possible bugs in the model checker Capacity limitations Wrong or missing properties...

16 From programs to Kripke structures Supposed that we wish to model-check a program / concurrent program – How can we represent it as a Kripke structure ?

17 Kripke structures Kripke structures are suitable for modeling a synchronous system. When we move from state s to state s ’, the values of the atoms in the state are changed synchronously. Is this the case for programs ? How can we describe programs as transition systems?

18 Programs as transition systems Programs we know are sequential. What is the result of this computation :... x = y; y = x; We need to model the location in the program We will use a variable called the program counter (PC)

19 L 0 :While True do nc 0 :wait (Turn=0); cr 0 :Turn=1 T0: (pc 0 =L 0, pc 0 =nc 0 ) T1: (pc 0 =nc 0 Æ Turn=0, pc 0 =cr 0 ) T2: (pc 0 =cr 0, pc 0 = L 0 Æ Turn=1) T3: (pc 1 =L 1, pc 1 =nc 1 ) T4: (pc 1 =nc 1 Æ Turn=1, pc 1 =cr 1 ) T5: (pc 1 =cr 1, pc 1 = L 1 Æ Turn = 0) Initially: pc 0 =L 0 Æ pc 1 =L 1 L 1 :While True do nc 1 :wait (Turn=1); cr 1 :Turn=0 || Possible transitions: Example: A program that maintains mutual exclusion

20 And now as a Kripke structure Turn=0 L 0,L 1 Turn=0 L 0,nc 1 Turn=0 nc 0,L 1 Turn=0 cr 0,nc 1 Turn=0 nc 0,nc 1 Turn=0 cr 0,L 1 Turn=1 L 0,cr 1 Turn=1 nc 0,cr 1 Turn=1 L 0,nc 1 Turn=1 nc 0,nc 1 Turn=1 nc 0,L 1 Turn=1 L 0,L 1 PC 0 = L 0, PC 1 = L 1

21 Turn=0 L 0,L 1 Turn=0 L 0,nc 1 Turn=0 nc 0,L 1 Turn=0 cr 0,nc 1 Turn=0 nc 0,nc 1 Turn=0 cr 0,L 1 Turn=1 L 0,cr 1 Turn=1 nc 0,cr 1 Turn=1 L 0,nc 1 Turn=1 nc 0,nc 1 Turn=1 nc 0,L 1 Turn=1 L 0,L 1 G : (pc 0 =cr 0 Æ pc 1 =cr 1 ) (a safety property)

22 Turn=0 L 0,L 1 Turn=0 L 0,nc 1 Turn=0 nc 0,L 1 Turn=0 cr 0,nc 1 Turn=0 nc 0,nc 1 Turn=0 cr 0,L 1 Turn=1 L 0,cr 1 Turn=1 nc 0,cr 1 Turn=1 L 0,nc 1 Turn=1 nc 0,nc 1 Turn=1 nc 0,L 1 Turn=1 L 0,L 1 G(Turn=0 ! F Turn=1) (a liveness property)

23 What properties can we check? Examples: Invariants: a property that has to hold in each state. Deadlock detection: can we reach a state where the program is blocked? Dead code: does the program have parts that are never executed?

24 If it is so good, is this all we need? Model checking works only for finite state systems. Would not work with Unconstrained integers. Unbounded message queues. General data structures: queues trees stacks Parametric algorithms and systems.

25 The state space explosion problem Need to represent the state space of a program in the computer memory. Each state can be as big as the entire memory! Many states: Each integer variable has 2 32 possibilities. Two such variables have 2 64 possibilities. In concurrent protocols, the number of states usually grows exponentially with the number of processes.

26 If it is so constrained, is it of any use? Many protocols are finite state. Many programs or procedures are finite state in nature. Can use abstraction techniques.

27 If it is so constrained, is it of any use? Sometimes it is possible to decompose a program, and prove part of it by model checking and part by other methods. Many techniques to reduce the state space explosion We will NOT learn about such techniques, but let us mention some names: Data structures such as Binary Decision Diagrams, Reductions, such as Partial Order Reduction.