2/19/20031 Introduction to SMV. 2/19/20032 Useful Links CMU Model checking homepage SMV windows version

Slides:



Advertisements
Similar presentations
Etter/Ingber Engineering Problem Solving with C Fundamental Concepts Chapter 4 Modular Programming with Functions.
Advertisements

Tintu David Joy. Agenda Motivation Better Verification Through Symmetry-basic idea Structural Symmetry and Multiprocessor Systems Mur ϕ verification system.
Introduction to SMV Part 2
Semantics Static semantics Dynamic semantics attribute grammars
Algorithmic Software Verification VII. Computation tree logic and bisimulations.
CS 267: Automated Verification Lecture 8: Automata Theoretic Model Checking Instructor: Tevfik Bultan.
Models of Concurrency Manna, Pnueli.
Automatic Verification Book: Chapter 6. What is verification? Traditionally, verification means proof of correctness automatic: model checking deductive:
An Introduction to the Model Verifier verds Wenhui Zhang September 15 th, 2010.
1 MODULE name (parameters) “Ontology” “Program” “Properties” The NuSMV language A module can contain modules Top level: parameters less module Lower level.
Model Checking I What are LTL and CTL?. and or dreq q0 dack q0bar.
Tutorial 12: Enhancing Excel with Visual Basic for Applications
Chapter 7 User-Defined Methods. Chapter Objectives  Understand how methods are used in Java programming  Learn about standard (predefined) methods and.
Introduction to Unix – CS 21 Lecture 11. Lecture Overview Shell Programming Variable Discussion Command line parameters Arithmetic Discussion Control.
CS 267: Automated Verification Lecture 7: SMV Symbolic Model Checker, Partitioned Transition Systems, Counter-example Generation in Symbolic Model Checking.
Model Checking I What are LTL and CTL?. and or dreq q0 dack q0bar D D.
CIS 540 Principles of Embedded Computation Spring Instructor: Rajeev Alur
Gary MarsdenSlide 1University of Cape Town Statements & Expressions Gary Marsden Semester 2 – 2000.
© 2011 Carnegie Mellon University Introduction to SMV Part 2 Arie Gurfinkel (SEI/CMU) based on material by Prof. Clarke and others.
© 2011 Carnegie Mellon University Introduction to SMV Arie Gurfinkel (SEI/CMU) based on material by Prof. Clarke and others.
FMuOS: Formal verification of critical program parts NuSMV system Prepared by: Alan Jović, Ph.D. Acad. year: 2014/2015.
1 Model Checking, Abstraction- Refinement, and Their Implementation Based on slides by: Orna Grumberg Presented by: Yael Meller June 2008.
Functional Design and Programming Lecture 1: Functional modeling, design and programming.
SMV Examples Bug Catching in 2006 Fall Oct. 24, 2006.
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.
Lecture 4&5: Model Checking: A quick introduction Professor Aditya Ghose Director, Decision Systems Lab School of IT and Computer Science University of.
1 Using Cadence SMV to verify temporal properties of finite-state machines : Intro to Model Checking October 9, 2008.
Review of the automata-theoretic approach to model-checking.
1 Sharing Objects – Ch. 3 Visibility What is the source of the issue? Volatile Dekker’s algorithm Publication and Escape Thread Confinement Immutability.
Javascript II Expressions and Data Types. 2 JavaScript Review programs executed by the web browser programs embedded in a web page using the script element.
2/18/20051 Introduction to SMV. 2/18/20052 Symbolic Model Verifier Ken McMillan, Symbolic Model Checking: An Approach to the State Explosion Problem,
Optimizing Symbolic Model Checking for Constraint-Rich Systems Randal E. Bryant Bwolen Yang, Reid Simmons, David R. O’Hallaron Carnegie Mellon University.
Traffic Light Controller Examples in SMV Himanshu Jain Bug catching (Fall 2007)
Fundamentals of Python: From First Programs Through Data Structures
Cheng/Dillon-Software Engineering: Formal Methods Model Checking.
Fundamentals of Python: First Programs
Introduction to Software Testing Chapter 9.4 Model-Based Grammars Paul Ammann & Jeff Offutt
Fruitful functions. Return values The built-in functions we have used, such as abs, pow, int, max, and range, have produced results. Calling each of these.
1 Introduction to SMV and Model Checking Mostly by: Ken McMillan Cadence Berkeley Labs Small parts by: Brandon Eames ISIS/Vanderbilt.
ECE 2372 Modern Digital System Design
DEPARTMENT OF COMPUTER SCIENCE & TECHNOLOGY FACULTY OF SCIENCE & TECHNOLOGY UNIVERSITY OF UWA WELLASSA 1 CST 221 OBJECT ORIENTED PROGRAMMING(OOP) ( 2 CREDITS.
Correctness requirements. Basic Types of Claims Basic assertions End-state labels Progress-state labels Accept-state labels Never claims Trace assertions.
CS6133 Software Specification and Verification
PAT: Getting started.
Lecture51 Timed Automata II CS 5270 Lecture 5.
Saeed Ghanbartehrani Summer 2015 Lecture Notes #5: Programming Structures IE 212: Computational Methods for Industrial Engineering.
Algorithm Design.
Fall 2004EE 3563 Digital Systems Design EE 3563 VHSIC Hardware Description Language  Required Reading: –These Slides –VHDL Tutorial  Very High Speed.
©Colin Jamison 2004 Shell scripting in Linux Colin Jamison.
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
Loops and Files. 5.1 The Increment and Decrement Operators.
VHDL Discussion Subprograms IAY 0600 Digital Systems Design Alexander Sudnitson Tallinn University of Technology 1.
1 Class 1 Lecture Topic Concepts, Definitions and Examples.
Controlling Program Flow with Decision Structures.
Program Correctness. The designer of a distributed system has the responsibility of certifying the correctness of the system before users start using.
Software Systems Verification and Validation Laboratory Assignment 4 Model checking Assignment date: Lab 4 Delivery date: Lab 4, 5.
Expressions and Data Types Professor Robin Burke.
Semaphores Chapter 6. Semaphores are a simple, but successful and widely used, construct.
An Introduction to Programming with C++ Sixth Edition Chapter 5 The Selection Structure.
CS5270 Lecture 41 Timed Automata I CS 5270 Lecture 4.
What is the SMV (Symbolic Model Verifier) System ?
The Selection Structure
Introduction To Flowcharting
Automatic Verification of Industrial Designs
Semaphores Chapter 6.
Introduction to SMV 2/19/2003.
Lecture 9: SMV: An Introduction
Presentation transcript:

2/19/20031 Introduction to SMV

2/19/20032 Useful Links CMU Model checking homepage SMV windows version SMV man page (must read) SMV manual

2/19/20033 Symbolic Model Verifier Ken McMillan, Symbolic Model Checking: An Approach to the State Explosion Problem, Finite-state Systems described in a specialized language Specifications given as CTL formulas + fairness, safety, liveness, deadlock Internal representation using OBDDs Automatically verifies specification or produces a counterexample

2/19/20034 Language Characteristics Allows description of synchronous and asynchronous systems Modularized and hierarchical descriptions Finite data types: Boolean and enumerated Nondeterminism

2/19/20035 Variable Assignments Assignment to initial state: init(value) := 0; Assignment to next state (transition relation) next(value) := value + carry_in mod 2; Assignment to current state (invariant) carry_out := value & carry_in; Use either init-next or invariant - never both SMV is a parallel assignment language

2/19/20036 A Sample SMV Program MODULE main VAR request: boolean; state: {ready, busy}; ASSIGN init(state) := ready; next(state) := case state=ready & request: busy; 1: {ready, busy}; esac; SPEC AG(request -> AF (state = busy))

2/19/20037 The Case Expression case is an expression, not a statement Guards are evaluated sequentially. The first one that is true determines the resulting value If none of the guards are true, an arbitrary valid value is returned Always use an else guard!

2/19/20038 Nondeterminism Completely unassigned variable can model unconstrained input. {val_1, …, val_n} is an expression taking on any of the given values nondeterministically. Use union when you have expressions rather than values Nondeterministic choice can be used to: Model an implementation that has not been refined yet (e.g., abstract models of complex protocols) Abstract behavior

2/19/20039 Types Boolean 1 is true and 0 is false Enumerated VAR a : {red, blue, green}; b : {1, 2, 3}; c : {1, 5, 7}; ASSIGN next(b) := case b<3 : b+1; 1 : 1; esac; Numerical operations must be properly guarded User can define its own data structures

2/19/ ASSIGN and DEFINE VAR a: boolean; ASSIGN a := b | c; declares a new state variable a becomes part of invariant relation DEFINE d:= b | c; is effectively a macro definition, each occurrence of d is replaced by b | c no extra BDD variable is generated for d the BDD for b | c becomes part of each expression using d not possible to provide non-determinism

2/19/ Next Expressions can refer to the value of a variable in the next state Examples: VAR a,b : boolean; ASSIGN next(b) := !b; a := next(b); ASSIGN next(a) := !next(b) ( a is the negation of b, except for the initial state) Disclaimer: different SMV versions differ on this

2/19/ Assignment Errors Next/current value of a variable is assigned more than once (process) Initial value of a variable is assigned more than once (program) Initial/Current value of a variable are both assigned (program) Current/Next value of a variable are both assigned (program) Circular assignments

2/19/ Circular definitions … are not allowed! This is illegal: a := next(b); next(b) := c; c := a; This is o.k. init(a) := 0; next(a) := !b; init(b) := 1; next(b) := !a; init(c) := 0; next(c) := a & next(b);

2/19/ Modules and Hierarchy Modules can be instantiated many times, each instantiation creates a copy of the local variables Each program has a module main Scoping Variables declared outside a module can be passed as parameters Internal variables of a module can be used in enclosing modules (submodel.varname). Parameters are passed by reference.

2/19/ MODULE main VAR bit0 : counter_cell(1); bit1 : counter_cell(bit0.carry_out); bit2 : counter_cell(bit1.carry_out); SPECAG AF bit2.carry_out MODULE counter_cell(carry_in) VARvalue : boolean; ASSIGN init(value) := 0; next(value) := value + carry_in mod 2; DEFINE carry_out := value & carry_in;

2/19/ Module Composition Synchronous composition All assignments are executed in parallel and synchronously. A single step of the resulting model corresponds to a step in each of the components. Asynchronous composition A step of the composition is a step by exactly one process. Variables, not assigned in that process, are left unchanged.

2/19/ Asynchronous Composition MODULE main VAR gate1: process inverter(gate3.output); gate2: process inverter(gate1.output); gate3: process inverter(gate2.output); SPEC (AG AF gate1.output) SPEC(AG AF !gate1.output) MODULE inverter(input) VAR output: boolean; ASSIGN init(output) := 0; next(output) := !input;

2/19/ Counterexamples -- specification AG AF (!gate1.output) is false -- as demonstrated by the following execution state 2.1: gate1.output = 0 gate2.output = 0 gate3.output = 0 state 2.2: [executing process gate1] -- loop starts here -- state 2.3: gate1.output = 1 [stuttering]

2/19/ Asynchronous Composition (Revisited) MODULE main VAR gate1: process inverter(gate3.output); gate2: process inverter(gate1.output); gate3: process inverter(gate2.output); SPEC (AG AF gate1.output) SPEC(AG AF !gate1.output) MODULE inverter(input) VAR output: boolean; ASSIGN init(output) := 0; next(output) := !input union output;

2/19/ Example: Mutual Exclusion Module main VAR semaphore : boolean; proc1 : process user; proc2 : process user; ASSIGN init(semaphore) := 0; SPEC AG !(proc1.state = critical) SPEC AG !(proc2.state = critical) SPEC AG(proc1.state=entering -> AF proc1.state=critical) Module user VAR state : {idle, entering, critical, exiting}; ASSIGN init(state) := idle next(state) := case state = idle : {idle, entering}; state = entering & ! semaphore : critical; state = critical : {critical, exiting}; state = exiting : idle; 1 : state; esac; next(semaphore) := case state = entering : 1; state = exiting : 0; 1 : semaphore; esac;

2/19/ Output of Semaphore Example

2/19/ Run SMV smv [options] inputfile -c cache-size -k key-table-size -m mini-cache-size -v verbose -r prints out statistics about reachable state space -checktrans checks whether the transition relation is total

2/19/ SMV Options –f computes set of reachable states first Model checking algorithm traverses only the set of reachable states instead of complete state space. useful if reachable state space is a small fraction of total state space

2/19/ Variable Reordering Variable reordering is crucial for small BDD sizes and speed. Generally, variables which are related need to be close in the ordering. –i filename –o filename Input, output BDD variable ordering to given file. -reorder Invokes automatic variable reordering