תרגול 9 META LABELS. Basic types of claims State properties.

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

Automatic Verification Book: Chapter 6. How can we check the model? The model is a graph. The specification should refer the the graph representation.
The SPIN System. What is SPIN? Model-checker. Based on automata theory. Allows LTL or automata specification Efficient (on-the-fly model checking, partial.
1 Carnegie Mellon UniversitySPIN ExamplesFlavio Lerda Bug Catching SPIN Examples.
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:
PROTOCOL VERIFICATION & PROTOCOL VALIDATION. Protocol Verification Communication Protocols should be checked for correctness, robustness and performance,
© 2011 Carnegie Mellon University SPIN: Part /614 Bug Catching: Automated Program Verification Sagar Chaki April 21, 2014.
Promela/SPIN Acknowledgements: These notes used some of the material presented by Flavio Lerda as part of Ed Clarke’s model-checking course.
/ 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.
Frederico Araujo CS6362 – Fall 2010 The SPIN Model Checker.
Wishnu Prasetya Model Checking with SPIN Modeling and Verification with SPIN.
CS 267: Automated Verification Lecture 10: Nested Depth First Search, Counter- Example Generation Revisited, Bit-State Hashing, On-The-Fly Model Checking.
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.
1 Spin Model Checker Samaneh Navabpour Electrical and Computer Engineering Department University of Waterloo SE-464 Summer 2011.
Example: Infinite Split and Merge #define N 128 #define size 16 chan in = [size] of {short}; chan large = [size] of {short}; chan small = [size] of {short};
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.
1 Formal Methods in SE Qaisar Javaid Assistant Professor Lecture # 11.
Temporal Logic Model- checking with SPIN COMP6004 Stéphane Lo Presti Part 4: Specifications.
Temporal Logic Model- checking with SPIN COMP6004 Stéphane Lo Presti Part 5: Some PROMELA examples.
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.
1. 2 FUNCTION INLINE FUNCTION DIFFERENCE BETWEEN FUNCTION AND INLINE FUNCTION CONCLUSION 3.
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.
Korea Advanced Institute of Science and Technology The Spin Model Checker - Advanced Features Moonzoo Kim CS Dept. KAIST.
ASP.NET Programming with C# and SQL Server First Edition Chapter 3 Using Functions, Methods, and Control Structures.
1 Rendez-Vous Logical extension of chan buffer = [N] of byte is chan port = [0] of byte Channel port is a rendez-vous port (binary handshake). Two processes,
Specifying and Verifying Event-based Fairness Enhanced Systems 1 ICFEM 2008 Specifying and Verifying Event-based Fairness Enhanced Systems Jun SUN, Yang.
Introduction to Exception Handling and Defensive Programming.
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.
Current Assignments Homework 2 is available and is due in three days (June 19th). Project 1 due in 6 days (June 23 rd ) Write a binomial root solver using.
ICS312 Set 14 MACROS. Macros The program structure is similar to that for procedures. As for procedure names, macro names represent a group of instructions.
Radu Iosif Introduction to SPIN Radu Iosif
Temporal Logic Model-checking with SPIN
CSE 555 Protocol Engineering Dr. Mohammed H. Sqalli Computer Engineering Department King Fahd University of Petroleum & Minerals Credits: Dr. Abdul Waheed.
The Spin Model Checker : Part I Moonzoo Kim KAIST.
Q1:Royal Garden’s Puzzle as a Model Checking Problem Pictures from UbiSoft HW6: Due Dec 4th 23:59.
/ 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.
Alternating Bit Protocol Protocol for simplex data-transfer channel: data flows from sender to receiver control flows in both directions the transfer medium.
Software Systems Verification and Validation Laboratory Assignment 4 Model checking Assignment date: Lab 4 Delivery date: Lab 4, 5.
Today’s Agenda  Quiz 5 (end of the class)  Quick Review  Finish Search Algorithms Formal Methods in Software Engineering1.
While loops. Iteration We’ve seen many places where repetition is necessary in a problem. We’ve been using the for loop for that purpose For loops are.
Wishnu Prasetya Model Checking with SPIN Modeling and Verification with Promela.
Using SPIN. INTRODUCTION To extend the protocol simulator from Chapter 12 with an validator generator, all we have to do is to activate two command line.
Symbolic Model Checking of Software Nishant Sinha with Edmund Clarke, Flavio Lerda, Michael Theobald Carnegie Mellon University.
CSE 555 Protocol Engineering Dr. Mohammed H. Sqalli Computer Engineering Department King Fahd University of Petroleum & Minerals Credits: Dr. Abdul Waheed.
Formal verification in SPIN
CSE 503 – Software Engineering
Automatic Verification
Macro Variable’s scope
The Spin Model Checker - Advanced Features
An explicit state model checker
HW6: Due Dec 14 23:59 To specify a corresponding Promela specification
HW6: Due Nov 26 23:59 To specify a corresponding Promela specification
The Spin Model Checker - Advanced Features
CSE 503 – Software Engineering
HW6: Due Dec 20 23:59 To specify a corresponding Promela specification
Presentation transcript:

תרגול 9 META LABELS

Basic types of claims

State properties

Basic assertions

Path properties

labels Any statement can be preceded by a label. The label can be used as a destination of a goto or can be used in a remote reference. Label names must be unique. Any number of labels can be attached to a single statement. active proctype P() { S0: S1:do :: q!p -> S2: q?v :: true od /* S3 */ }

Remote reference use for testing the local control state of an active process We can check whether two user process are in the critical state && use for testing the value of a local variable in an active process We can refer to the variable count in process Dijkstra Dijkstra : count Normally reserved for use in never claim (see later) mtype {p,v} chan sema = [0] of {mtype} active proctype Dijkstra (){ byte count=1; do :: (count==1)-> sema!p; count=0 :: (count==0)-> sema?v; count=1 od } active [3] proctype user(){ do :: sema?p; critical: skip; sema!v; od }

Meta labels

End States

Example Spin check for valid end state by default. If the user is not interesting in these kind of errors, he can use the run time flag –E. mtype {p,v} chan sema = [0] of {mtype} active proctype Dijkstra (){ byte count=1; end:do :: (count==1)-> sema!p; count=0 :: (count==0)-> sema?v; count=1 od } active [3] proctype user(){ do :: sema?p; critical: skip; sema!v; od }

Progress states Mark statements in the model that accomplish something. require that the progress labels will be visited infinitely often in any infinite system execution. Any violation of this requirement can be reported by the verifier as a non-progress cycle.

Example active proctype Dijkstra (){ byte count=1; end:do :: (count==1)-> progress:sema!p; count=0 :: (count==0)-> sema?v; count=1 od } $ spin –a dijkstra.pml $cc –DNP –o pan pan.c $./pan -l active [3] proctype user(){ do :: sema?p; critical: skip; sema!v; od }

Another example byte x=2; active proctype A (){ do :: x=3-x; progress: skip od } active proctype B (){ do :: x=3-x; od }

The out put pan:1: non-progress cycle (at depth 2) pan: wrote fair.pml.trail (Spin Version March 2013) Warning: Search not completed + Partial Order Reduction Full statespace search for: never claim + (:np_:) assertion violations + (if within scope of claim) non-progress cycles + (fairness disabled) invalid end states - (disabled by never claim) State-vector 36 byte, depth reached 5, errors: 1 3 states, stored 0 states, matched 3 transitions (= stored+matched) 0 atomic steps hash conflicts: 0 (resolved) Stats on memory usage (in Megabytes): equivalent memory usage for states (stored*(State-vector + overhead)) actual memory usage for states memory used for hash table (-w24) memory used for DFS stack (-m10000) total actual memory usage

The out put starting claim 2 spin: couldn't find claim 2 (ignored) using statement merging 2: proc 1 (B) fair.pml:10 (state 1) [x = (3-x)] >>>> 4: proc 1 (B) fair.pml:10 (state 1) [x = (3-x)] 6: proc 1 (B) fair.pml:10 (state 1) [x = (3-x)] spin: trail ends after 6 steps #processes: 2 x = 1 6: proc 1 (B) fair.pml:9 (state 2) 6: proc 0 (A) fair.pml:3 (state 3) 2 processes created

Fair cycles

The out put $ spin –a fair.pml $cc –DNP –o pan pan.c $./pan –l -f

The out put (Spin Version March 2013) + Partial Order Reduction Full statespace search for: never claim + (:np_:) assertion violations + (if within scope of claim) non-progress cycles + (fairness enabled) invalid end states - (disabled by never claim) State-vector 36 byte, depth reached 7, errors: 0 8 states, stored (10 visited) 7 states, matched 17 transitions (= visited+matched) 0 atomic steps hash conflicts: 0 (resolved) Stats on memory usage (in Megabytes): equivalent memory usage for states (stored*(State-vector + overhead)) actual memory usage for states memory used for hash table (-w24) memory used for DFS stack (-m10000) total actual memory usage unreached in proctype A fair.pml:7, state 6, "-end-" (1 of 6 states) unreached in proctype B fair.pml:12, state 5, "-end-" (1 of 5 states)

Accept states $ spin –a fair_accept.pml $cc –o pan pan.c $./pan –a (or $./pan –a –f for fair accepted cycles only)

Inline-חוב מן העבר An inline definition works much like a preprocessor macro An inline definition must appear before its first use, and must always be defined globally. An invocation (an inline call) is performed with a syntax that is similar to a procedure call in C, but it does not define a new variable scope a inline cannot return a value to the caller. An inline definition may itself contain other inline calls, but it may not call itself recursively.

Example mtype = { msg0, msg1, ack0, ack1 }; chan sender = [1] of { mtype }; chan receiver = [1] of { mtype }; inline recv(cur_msg, cur_ack, lst_msg, lst_ack) { do :: receiver?cur_msg -> sender!cur_ack; break /* accept */ :: receiver?lst_msg -> sender!lst_ack od; } inline phase(msg, good_ack, bad_ack) { do :: sender?good_ack -> break :: sender?bad_ack :: timeout -> if :: receiver!msg; :: skip /* lose message */ fi; od } active proctype Sender() { do :: phase(msg1, ack1,ack0); phase(msg0, ack0, ack1) od } active proctype Receiver() { do :: recv(msg1, ack1, msg0, ack0); recv(msg0, ack0, msg1, ack1) od }