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

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.
M ODEL CHECKING -Vasvi Kakkad University of Sydney.
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:
Temporal Logic and the NuSMV Model Checker CS 680 Formal Methods Jeremy Johnson.
Model Checking I What are LTL and CTL?. and or dreq q0 dack q0bar.
UPPAAL Introduction Chien-Liang Chen.
© 2011 Carnegie Mellon University SPIN: Part /614 Bug Catching: Automated Program Verification Sagar Chaki April 21, 2014.
/ 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 Chapter Six Algorithms. 2 Algorithms An algorithm is an abstract strategy for solving a problem and is often expressed in English A function is the.
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.
/ PSWLAB Efficient Decentralized Monitoring of Safety in Distributed System K Sen, A Vardhan, G Agha, G Rosu 20 th July 2007 Presented by.
SPIN Verification System The Model Checker SPIN By Gerard J. Holzmann Comp 587 – 12/2/09 Eduardo Borjas – Omer Azmon ☐ ☐
S. Ramesh Model-Checking Distributed Software S. Ramesh IIT Bombay.
The Spin Model Checker Promela Introduction Nguyen Tuan Duc Shogo Sawai.
CIS 540 Principles of Embedded Computation Spring Instructor: Rajeev Alur
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.
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.
Review of the automata-theoretic approach to model-checking.
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.
1 Temporal Logic-Overview FM Temporal Logic u Classical logic: Good for describing static conditions u Temporal logic: Adds temporal operators Describe.
272: Software Engineering Fall 2012 Instructor: Tevfik Bultan Lecture 4: SMT-based Bounded Model Checking of Concurrent Software.
1 Carnegie Mellon UniversitySPINFlavio Lerda Bug Catching SPIN An explicit state model checker.
Cheng/Dillon-Software Engineering: Formal Methods Model Checking.
Verification by Model Checking1 Formal Methods Laboratory University of Tehran Based on the chapter 3 of “Logic in Computer Science”, Huth & Ryan.
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,
CIS 540 Principles of Embedded Computation Spring Instructor: Rajeev Alur
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.
CIS 540 Principles of Embedded Computation Spring Instructor: Rajeev Alur
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
CIS 842: Specification and Verification of Reactive Systems
Formal verification in SPIN
CSE 503 – Software Engineering
An explicit state model checker
A Refinement Calculus for Promela
Program correctness Linear Time Temporal Logic
COMP60621 Designing for Parallelism
CSE 503 – Software Engineering
Presentation transcript:

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

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

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

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

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

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

PROMELA example proctype Pr1 (){ do :: x==0 ->y=1; :: x==1 ->y=0; od; } proctype Pr2 (){ do :: y==0 ->x=1; :: y==1 ->x=0; od; } init { x=0; y=0; run Pr1(); run Pr2(); } X=1 y=0 X=0 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 o Nondeterministic choice:if :: g1 -> s1;:: (x>3) -> x--; :: g2 -> s2;:: true -> y=1;...:: y -> x=x+y; fifi; At each step, execute one of the statements whose guard evaluates to true.

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

PROMELA special features o Channel communication: chanc = [2] of {bit}; chandin = [0] of {byte}; chandout = [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 o User-defined types o... More about PROMELA on the course webpage.

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

LTL in practice  x is always strictly greater than y: [](x>y)  Eventually x becomes equal to 1: <>(x==1) o Eventually x becomes equal to 1 and never changes afterwards: <>[](x==1) o If at any moment x becomes negative, y will become negative at some later moment: []((x <>(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.  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!pp p... <>(!p) []p []<>p <>[]p p,!q!p,qp,!q!p,qp,!q!p,q... [](p||q) []<>q <>(p&&q) (<>p)&&(<>q)

LTL verification in Spin o 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 ::(x>y) -> x=x-y:: (b b++ ::(y>x) -> y=y-x:: true -> goto enough :: (x==y)-> goto doneod; od;enough: run Euclid(a,b)} done: ready=1; d=x } LTL: <>(ready && (a%d==0))