Formal verification in SPIN

Slides:



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

1 Reasoning with Promela Safety properties bad things do not happen can check by inspecting finite behaviours Liveness properties good things do eventually.
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.
Generating test cases specifications for BPEL compositions of web services using SPIN José García-Fanjul, Javier Tuya, and Claudio de la Riva Pointner.
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.
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:
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.
CIS 725 Guarded Command Notation. Programming language style notation Guarded actions en(a)  a en(a): guard of the action boolean condition or boolean.
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.
1 Spin Model Checker Samaneh Navabpour Electrical and Computer Engineering Department University of Waterloo SE-464 Summer 2011.
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.
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.
CS 330 Programming Languages 09 / 18 / 2007 Instructor: Michael Eckmann.
More on RDT Robert John Walters. RDT – a reprise A Graphically based formal modelling language Models represented as diagrams (not text) Communications.
CS 330 Programming Languages 09 / 16 / 2008 Instructor: Michael Eckmann.
Automating Checking of Models Built Using a Graphically Based Formal Language Robert John Walters.
Automata and Formal Lanugages Büchi Automata and Model Checking Ralf Möller based on slides by Chang-Beom Choi Provable Software Lab, KAIST.
CS 290C: Formal Models for Web Software Lecture 4: Model Checking Navigation Models with Spin Instructor: Tevfik Bultan.
The Model Checker SPIN Written by Gerard J. Holzmann Presented by Chris Jensen.
Cheng/Dillon-Software Engineering: Formal Methods Model Checking.
Verifiable Programming Reason about imperative sequential programs such as Java programs Imperative program –defines state space defined by collection.
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.
Sept COMP60611 Fundamentals of Parallel and Distributed Systems Lecture 15 More Advanced Program Properties: Temporal logic and jSpin John Gurd,
Today’s Agenda  Quiz 4 next Tuesday  Quick Review  Continue on SPIN Overview.
Radu Iosif Introduction to SPIN Radu Iosif
CIS 842: Specification and Verification of Reactive Systems Lecture SPIN-Soldiers: Soldiers Case Study Copyright , Matt Dwyer, John Hatcliff,
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.
CIS 842: Specification and Verification of Reactive Systems Lecture INTRO-Examples: Simple BIR-Lite Examples Copyright 2004, Matt Dwyer, John Hatcliff,
Hwajung Lee. Why do we need these? Don’t we already know a lot about programming? Well, you need to capture the notions of atomicity, non-determinism,
Lecture 4 Introduction to Promela. Promela and Spin Promela - process meta language G. Holzmann, Bell Labs (Lucent) C-like language + concurrency dyamic.
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.
Software Systems Verification and Validation Laboratory Assignment 4 Model checking Assignment date: Lab 4 Delivery date: Lab 4, 5.
CSC3315 (Spring 2009)1 CSC 3315 Languages & Compilers Hamid Harroud School of Science and Engineering, Akhawayn University
Today’s Agenda  Quiz 4  Temporal Logic Formal Methods in Software Engineering1.
6/12/20161 a.a.2015/2016 Prof. Anna Labella Formal Methods in software development.
CIS 540 Principles of Embedded Computation Spring Instructor: Rajeev Alur
Complexity of Compositional Model Checking of Computation Tree Logic on Simple Structures Krishnendu Chatterjee Pallab Dasgupta P.P. Chakrabarti IWDC 2004,
Verification of Data-Dependent Properties of MPI-Based Parallel Scientific Software Anastasia Mironova.
Symbolic model checking with SAT/SMT
Formal methods: Lecture
CIS 842: Specification and Verification of Reactive Systems
CSE 503 – Software Engineering
The Spin Model Checker - Advanced Features
COMP60621 Designing for Parallelism
An explicit state model checker
A Refinement Calculus for Promela
Translating Linear Temporal Logic into Büchi Automata
CSE 555 Protocol Engineering
The Zoo of Software Security Techniques
COMP60621 Designing for Parallelism
Predicate Abstraction
Program correctness Linear Time Temporal Logic
COMP60621 Designing for Parallelism
The Spin Model Checker - Advanced Features
CSE 503 – Software Engineering
Presentation transcript:

Formal verification in SPIN Karthikeyan Bhargavan, Davor Obradovic CIS573, Fall 1999

Formal verification Formal verification means using methods of mathematical argument to determine correctness of systems. Can be applied to hardware, software and other kinds of systems. Bugs are expensive when discovered in a finished product. Idea: use FV to discover bugs during the design phase.

Model checkers Model checkers are among the most widely used FV tools. Human inspection is not effective: Currently designed systems are too large Concurrency, race conditions Big verifications done by paper and pencil are hard to re-construct and re-check Model checkers are good at doing massive (but often simple) case analyses.

The BIG picture Model checker model description property YES NO + counterexample

Spin Developed in Bell Labs, starting in 1980. Designed for verification of distributed systems. Model descriptions need to be given in PROMELA (PROcess MEta LAnguage). Properties are described in LTL (Linear Temporal Logic).

PROMELA overview A PROMELA program describes a set of concurrent processes. Execution is asynchronous (each time only one process does a step), except in special cases (rendezvous message passing). Processes can die or be created dynamically. Processes can communicate through global variables and channels (message passing).

PROMELA example  Each Promela program generates proctype Pr1 (){ do :: x==0 ->y=1; :: x==1 ->y=0; od; } proctype Pr2 (){ :: y==0 ->x=1; :: y==1 ->x=0; init { x=0; y=0; run Pr1(); run Pr2(); X=1 y=0 X=0 y=1  Each Promela program generates a unique state transition system.  Promela “instructions” correspond to state transitions. :: y==0 ->x=1;

PROMELA special features Nondeterministic choice: if if :: g1 -> s1; :: (x>3) -> x--; :: g2 -> s2; :: true -> y=1; . . . :: y -> x=x+y; fi fi; At each step, execute one of the statements whose guard evaluates to true.

PROMELA special features Nondeterministic loop: do do :: g1 -> s1; :: (x>3) -> x--; :: g2 -> s2; :: true -> y=1; . . . :: y -> x=x+y; od od; Repeat, choosing nondeterministically at each step.

PROMELA special features Channel communication: chan c = [2] of {bit}; chan din = [0] of {byte}; chan dout = [1] of {byte}; Send a message m on channel c: c!m Receive a message from channel c: c?x din?v -> dout!(v+v); c?1 -> x++; dout!v -> skip;

Other PROMELA features Labels and goto statement Types: bit, bool, byte, short, int User-defined types . . . More about PROMELA on the course webpage.

LTL overview Expresses properties dependent on time (temporal) LTL formulas are evaluated on sequences of states (linear) Standard predicate logic + temporal operators: [] = always <> = eventually

[]((x<0) ==> <>(y<0)) LTL in practice x is always strictly greater than y: [](x>y) Eventually x becomes equal to 1: <>(x==1) Eventually x becomes equal to 1 and never changes afterwards: <>[](x==1) If at any moment x becomes negative, y will become negative at some later moment: []((x<0) ==> <>(y<0))

LTL, formal definitions F ::= p (a state predicate, like (x>0) or (x!=y)) | F1 && F2 | F1 || F2 | !F | []F | <>F Given a sequence of states s = s(0), s(1), s(2), ...  s(i) satisfies []F if for every j>=i, s(j) satisfies F.  s(i) satisfies <>F if for some j>=i, s(j) satisfies F. The whole sequence s satisfies F if s(0) satisfies F.

LTL examples p !p ... <>(!p) []p []<>p <>[]p + + - - p,!q !p,q ... [](p||q) []<>q <>(p&&q) (<>p)&&(<>q) + + - +

LTL verification in Spin Given a PROMELA program and an LTL formula, Spin checks whether all possible computation paths satisfy the formula. int a,b,d; init { bit ready=0; a=100; proctype Euclid (int x,y){ b=1; do do ::(x>y) -> x=x-y :: (b<a) -> b++ ::(y>x) -> y=y-x :: true -> goto enough :: (x==y)-> goto done od; od; enough: run Euclid(a,b)} done: ready=1; d=x } LTL: <>(ready && (a%d==0))