1 Spin Model Checker Samaneh Navabpour Electrical and Computer Engineering Department University of Waterloo SE-464 Summer 2011.

Slides:



Advertisements
Similar presentations
1 Reasoning with Promela Safety properties bad things do not happen can check by inspecting finite behaviours Liveness properties good things do eventually.
Advertisements

The SPIN System. What is SPIN? Model-checker. Based on automata theory. Allows LTL or automata specification Efficient (on-the-fly model checking, partial.
The SPIN System. What is SPIN? Model-checker. Based on automata theory. Allows LTL or automata specification Efficient (on-the-fly model checking, partial.
Modeling issues Book: chapters 4.12, 5.4, 8.4, 10.1.
CS 267: Automated Verification Lecture 8: Automata Theoretic Model Checking Instructor: Tevfik Bultan.
Formalization of Health Information Portability and Accountability Act (HIPAA) Simon Berring, Navya Rehani, Dina Thomas.
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.
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:
PROTOCOL VERIFICATION & PROTOCOL VALIDATION. Protocol Verification Communication Protocols should be checked for correctness, robustness and performance,
UPPAAL Introduction Chien-Liang Chen.
© 2011 Carnegie Mellon University SPIN: Part /614 Bug Catching: Automated Program Verification Sagar Chaki April 21, 2014.
Formal verification in SPIN Karthikeyan Bhargavan, Davor Obradovic CIS573, Fall 1999.
/ PSWLAB P ROMELA Semantics from “THE SPIN MODEL CHECKER” by G. J. Holzmann Presented by Hong,Shin 5 th Oct :021PROMELA Semantics.
An Overview of PROMELA. A protocol Validation Language –A notation for the specification and verification of procedure rules. –A partial description of.
The model checker SPIN1 The Model Checker SPIN. The model checker SPIN2 SPIN & Promela SPIN(=Simple Promela Interpreter) –tool for analyzing the logical.
תרגול 9 META LABELS. Basic types of claims State properties.
Frederico Araujo CS6362 – Fall 2010 The SPIN Model Checker.
Wishnu Prasetya Model Checking with SPIN Modeling and Verification with SPIN.
© 2011 Carnegie Mellon University SPIN: Part /614 Bug Catching: Automated Program Verification Sagar Chaki April 21, 2014.
PSWLAB S PIN Search Algorithm from “THE SPIN MODEL CHECKER” by G Holzmann Presented by Hong,Shin 9 th Nov SPIN Search Algorithm.
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.
The Spin Model Checker Promela Introduction Nguyen Tuan Duc Shogo Sawai.
Shin Hong, KAIST17 th April,2007 1/33 Provable Software Laboratory, CS KAIST.
Spin Tutorial (some verification options). Assertion is always executable and has no other effect on the state of the system than to change the local.
© 2011 Carnegie Mellon University SPIN: Part Bug Catching: Automated Program Verification and Testing Sagar Chaki November 2, 2011.
© 2011 Carnegie Mellon University SPIN: Part Bug Catching: Automated Program Verification and Testing Sagar Chaki October 31, 2011.
Temporal Logic Model- checking with SPIN COMP6004 Stéphane Lo Presti Part 4: Specifications.
Model Checking. Used in studying behaviors of reactive systems Typically involves three steps: Create a finite state model (FSM) of the system design.
1 Carnegie Mellon UniversitySPINFlavio Lerda SPIN An explicit state model checker.
More on RDT Robert John Walters. RDT – a reprise A Graphically based formal modelling language Models represented as diagrams (not text) Communications.
Automating Checking of Models Built Using a Graphically Based Formal Language Robert John Walters.
CS 290C: Formal Models for Web Software Lecture 4: Model Checking Navigation Models with Spin Instructor: Tevfik Bultan.
Cheng/Dillon-Software Engineering: Formal Methods Model Checking.
Wishnu Prasetya Model Checking with SPIN A Bit More about SPIN.
Correctness requirements. Basic Types of Claims Basic assertions End-state labels Progress-state labels Accept-state labels Never claims Trace assertions.
Scientific Computing By: Fatima Hallak To: Dr. Guy Tel-Zur.
Korea Advanced Institute of Science and Technology The Spin Model Checker - Advanced Features Moonzoo Kim CS Dept. KAIST.
Institute e-Austria in Timisoara 1 Author: prep. eng. Calin Jebelean Verification of Communication Protocols using SDL ( )
Sept COMP60611 Fundamentals of Parallel and Distributed Systems Lecture 15 More Advanced Program Properties: Temporal logic and jSpin John Gurd,
Concurrency. A process is a program executing on a virtual computer Processor speed and multiplexing of shared resources are ignored Order of thread execution.
MODEL CHECKING WITH SPIN MODELING AND VERIFICATION WITH SPIN ANDREA ORLANDINI – ISTC (CNR) TexPoint fonts used in EMF. Read the TexPoint manual before.
Today’s Agenda  Quiz 4 next Tuesday  Quick Review  Continue on SPIN Overview.
Radu Iosif Introduction to SPIN Radu Iosif
1 CSEP590 – Model Checking and Automated Verification Lecture outline for August 6, 2003.
Temporal Logic Model-checking with SPIN
May University of Glasgow Generalising Feature Interactions in Muffy Calder, Alice Miller Dept. of Computing Science University of Glasgow.
The Spin Model Checker : Part I Moonzoo Kim KAIST.
/ PSWLAB S PIN Search Optimization from “THE SPIN MODEL CHECKER” by G. Holzmann Presented by Hong,Shin 23 th Nov SPIN Search.
Lecture 4 Introduction to Promela. Promela and Spin Promela - process meta language G. Holzmann, Bell Labs (Lucent) C-like language + concurrency dyamic.
Software Systems Verification and Validation Laboratory Assignment 4 Model checking Assignment date: Lab 4 Delivery date: Lab 4, 5.
1 Pass the Parcel /* Pass the parcel in Promela */ /* passing is not atomic */ /* communication is asynchronous */ /* Muffy Calder, November 2000 */ mtype.
Today’s Agenda  Quiz 4  Temporal Logic Formal Methods in Software Engineering1.
Sept COMP60611 Fundamentals of Parallel and Distributed Systems Lecture 9 Promela, jSpin and the problem of Interference John Gurd, Graham Riley.
Wishnu Prasetya Model Checking with SPIN Modeling and Verification with Promela.
Agenda  Quick Review  Finish Introduction  Java Threads.
CSE 555 Protocol Engineering Dr. Mohammed H. Sqalli Computer Engineering Department King Fahd University of Petroleum & Minerals Credits: Dr. Abdul Waheed.
Verification of Data-Dependent Properties of MPI-Based Parallel Scientific Software Anastasia Mironova.
Formal verification in SPIN
CSE 503 – Software Engineering
COMP60611 Fundamentals of Parallel and Distributed Systems
Over-Approximating Boolean Programs with Unbounded Thread Creation
The Spin Model Checker - Advanced Features
COMP60621 Designing for Parallelism
An explicit state model checker
A Refinement Calculus for Promela
CSE 555 Protocol Engineering
COMP60621 Designing for Parallelism
The Spin Model Checker - Advanced Features
CSE 503 – Software Engineering
Presentation transcript:

1 Spin Model Checker Samaneh Navabpour Electrical and Computer Engineering Department University of Waterloo SE-464 Summer 2011

2 Common Design Flaws Deadlock Livelock, Starvation Under-specification Over-specification Violation of Constraints Etc. Most of the errors caused by these flaws can be detected by model checking.

3 Model Checking and Spin Model Checking:  Is an automated technique that, given a finite model of a system and a logical property, systematically checks whether this property holds for that model. Spin is a well known classical model checker.  Aims towards concurrent systems  Only checks functional properties  Does not model real-time, but is capable of modeling timeouts. Design Abstract Verification Model Implementation Model Checker abstraction refinement

4 Material which needs to be covered Spin Architecture  We wont cover JSpin  How to install  How to use it Promela  Basic building blocks

5 jSpin Install  Create a directory for mingw, and install mingw in that directory.  Create separate directory for Jspin. Download executable for Jspin in directory, and run executable. Running jSpin  -javaw –jar jSpin.jar (with optional Promela file). Demo jspin

6 jSpin Check  Runs a syntax check. Random  Runs a random simulation. Interactive  Runs an interactive simulation. Guided  Runs a guided simulation using the trail file created by the execution of the analyzer.

Verification with jSpin With LTL formulas:  formula must be converted to an automaton written as a Promela never claim.  Remember to do Translate.  Translated LTL formula's will be saved in a *.ltl file.  Original LTL formulas can be saved in*.prp. 7

Verification with jSpin Without LTL formulas:  Safety Properties Using assertions  Acceptance cycles: Testing for acceptance cycles is generally testing for the absence of unwanted infinite behavior. Acceptance cycle is a cycle that infinitely often visits an acceptance state.  Non-Progress cycles: Progress is the guarantee of wanted infinite behavior. Non-progress cycle is a cycle that does not visit a progress state infinitely often. 8

Promela Promela consists of:  Processes Describes the behavior of the system.  Channels Define the environment in which the processes run.  Variables Define the environment in which the processes run. The scope of a variable is global if it is declared outside all process declarations, and local if it is declared within a process declaration. 9

10 Promela Statements in Promela: Are all conditional: A statement will only be executed if the condition of its execution is satisfied. Hence:  Statement is either Executable or Blocked. Example: (a == b) is similar to While(a != b) { // Skip } Promela cant have unbounded  Data, Channels, Processes, Process Creation.

11 Promela-variables Basic Types:  Bit  Bool  Byte  Short  Int Arrays  Byte test[9] Record  Typedef test {int test1, byte test2}

12 Promela-variables Message type mtype  mtype {int, byte} Channels  chan toR = [6] of {mtype, bit} Global Variables Variables can be given values by: assignment, argument passing and message passing.

13 Promela-processes Processes Can be created by run or active. Can be created at any point. Processes can interact via channels or global variables. The run statement can pass parameter values of all basic data types to the new process. byte state; active [2] proctype P() { (state == 1) -> state = 3 } name numberexecution proctype P() { … } Init{ Int pid2 = run P(); } OR

14 Promela- Advanced Topics atomic:  Statements in atomic are executed as one indivisible unit, non- interleaved with any other processes. d_step:  Similar to atomic  Does not save intermediate states  Can not contain non-determinism or blocking statements proctype P() { atomic { (state==1) -> state = state+1 }

15 Promela-Statements If-statement: If more than one guard is satisfied, we have non- determinism. If all guards are un-executable the process will block until at least one of them can be selected. There is no restriction on the type of statements that can be used as a guard. if :: (a >= b ) -> Stmt1 ; Stmt2 ; … :: (a Stmt3 ; Stmt4 ; … :: (a == b ) -> Stmt5 ; Stmt6 ; … :: else -> Stmt7 fi if :: count = count + 1 :: count = count – 1 fi if :: count = count + 1 :: count = count – 1 fi

16 Promela-Statements Do-statement Same as if-statement, only in a while loop. do :: (a >= b ) -> Stmt1 ; Stmt2 ; … :: (a Stmt3 ; Stmt4 ; … :: (a == b ) -> Stmt5 ; Stmt6 ; … :: else -> Stmt7 od do :: count = count + 1 :: count = count – 1 :: (count == 0) -> break od do :: count = count + 1 :: count = count – 1 :: (count == 0) -> break od

Promela-Communication Processes can communicate in two ways:  Global variables  Channels: chan = [ ] of {,,.., }  Example: chan toR = [2] of {int, int} Asynchronously : dimension > 0 Synchronously : dimension = 0 Actions:  Sending : ch !,..,  Receiving: ch ? var_1,..,var_n If send and receive can not happen, process will block. 17 toR!(1,5) ……. toR?(x1,x2) toR!(1,5) ……. toR?(x1,x2)

18 Promela-Statements Special Statements:  goto  skip: same as 1 or true,  run  assert ( ) check whether certain properties hold. Gives an error if violated.

19 Promela- Advanced Topics Timeout  Promela has no real-time features  The timeout statement can only be executed when no other statement in the system can be executed  Can help get out of deadlock  The timeout models a special condition that allows a process to abort the waiting for a condition that may never become true, e.g. an input from an empty channel.  Example: do :: guard1 -> Stmt1; … :: timeout -> break ;… od

20 Conclusion Spin is suitable for concurrent systems Can not model time JSpin is easy to install and use via the graphical interface Promela is similar to C, therefore easy to cope with. Beware of state explosion Need basic knowledge of LTL.

21 References Spin official page  Spin online tutorials  Jspin  Erigone 