CSC2108: Automated Verification or Everything you Wanted to Know about Model-Checking Ü Instructor: Marsha Chechik Ü

Slides:



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

Copyright 2000 Cadence Design Systems. Permission is granted to reproduce without modification. Introduction An overview of formal methods for hardware.
Tutorial I – An Introduction to Model Checking Peng WU INRIA Futurs LIX, École Polytechnique.
Metodi formali dello sviluppo software a.a.2013/2014 Prof.Anna Labella.
CS 267: Automated Verification Lecture 2: Linear vs. Branching time. Temporal Logics: CTL, CTL*. CTL model checking algorithm. Counter-example generation.
M ODEL CHECKING -Vasvi Kakkad University of Sydney.
Algorithmic Software Verification VII. Computation tree logic and bisimulations.
Partial Order Reduction: Main Idea
Introducing Formal Methods, Module 1, Version 1.1, Oct., Formal Specification and Analytical Verification L 5.
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.
Planning based on Model Checking Dept. of Information Systems and Applied CS Bamberg University Seminar Paper Svetlana Balinova.
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.
ECE Synthesis & Verification - L271 ECE 697B (667) Spring 2006 Synthesis and Verification of Digital Systems Model Checking basics.
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.
CS6133 Software Specification and Verification
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.
SYMBOLIC MODEL CHECKING: STATES AND BEYOND J.R. Burch E.M. Clarke K.L. McMillan D. L. Dill L. J. Hwang Presented by Rehana Begam.
Model Checking I What are LTL and CTL?. and or dreq q0 dack q0bar D D.
Review of topics Final exam : -May 2nd to May 7 th - Projects due on May 7th.
SAT and Model Checking. Bounded Model Checking (BMC) A.I. Planning problems: can we reach a desired state in k steps? Verification of safety properties:
Demonstration Of SPIN By Mitra Purandare
1 Temporal Logic u Classical logic:  Good for describing static conditions u Temporal logic:  Adds temporal operators  Describe how static conditions.
CSEP590 – Model Checking and Software Verification University of Washington Department of Computer Science and Engineering Summer 2003.
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.
© Betty HC Cheng. This presentation is available free for non-commercial use with attribution under a creative commons license. Acknowledge: S.
1 CTL Model Checking David L. Dill. 2 CTL syntax: AP -- atomic propositions p  AP is a formula f  g is a formula, if f and g are ¬f is a formula AX.
Review of the automata-theoretic approach to model-checking.
University of Toronto Department of Computer Science © Steve Easterbrook. This presentation is available free for non-commercial use with attribution.
ESE601: Hybrid Systems Introduction to verification Spring 2006.
Witness and Counterexample Li Tan Oct. 15, 2002.
1 Formal Engineering of Reliable Software LASER 2004 school Tutorial, Lecture1 Natasha Sharygina Carnegie Mellon University.
Formal verification Marco A. Peña Universitat Politècnica de Catalunya.
A Simple Model Checker for CTL. The problem n We need efficient algorithms to solve the problems [1]M,s  [2]M,s  where M should have finitely many states,
MCAI 2.0 Model Checking in Ten Minutes Edmund Clarke School of Computer Science Carnegie Mellon University.
1 Introduction to SMV and Model Checking Mostly by: Ken McMillan Cadence Berkeley Labs Small parts by: Brandon Eames ISIS/Vanderbilt.
2.2 Software Myths 2.2 Software Myths Myth 1. The cost of computers is lower than that of analog or electromechanical devices. –Hardware is cheap compared.
Benjamin Gamble. What is Time?  Can mean many different things to a computer Dynamic Equation Variable System State 2.
Copyright 2001, Matt Dwyer, John Hatcliff, and Radu Iosif. The syllabus and all lectures for this course are copyrighted materials and may not be used.
10/19/2015COSC , Lecture 171 Real-Time Systems, COSC , Lecture 17 Stefan Andrei.
CS6133 Software Specification and Verification
Automatic Verification of Finite-State Concurrent Systems Using Temporal Logic Specifications 1.
On Reducing the Global State Graph for Verification of Distributed Computations Vijay K. Garg, Arindam Chakraborty Parallel and Distributed Systems Laboratory.
Lecture 81 Optimizing CTL Model checking + Model checking TCTL CS 5270 Lecture 9.
- 1 -  P. Marwedel, Univ. Dortmund, Informatik 12, 05/06 Universität Dortmund Validation - Formal verification -
Lecture 5 1 CSP tools for verification of Sec Prot Overview of the lecture The Casper interface Refinement checking and FDR Model checking Theorem proving.
Verification & Validation By: Amir Masoud Gharehbaghi
1 CSEP590 – Model Checking and Automated Verification Lecture outline for July 9, 2003.
From Natural Language to LTL: Difficulties Capturing Natural Language Specification in Formal Languages for Automatic Analysis Elsa L Gunter NJIT.
3-Valued Abstraction and 3-Valued Model-Checking.
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.
29/06/2016Verification Synchronous Languages Verification.
Complexity of Compositional Model Checking of Computation Tree Logic on Simple Structures Krishnendu Chatterjee Pallab Dasgupta P.P. Chakrabarti IWDC 2004,
Basic concepts of Model Checking
SS 2017 Software Verification Timed Automata
CIS 842: Specification and Verification of Reactive Systems
CSCI1600: Embedded and Real Time Software
CSEP590 – Model Checking and Automated Verification
Automatic Verification of Industrial Designs
Formal Methods in software development
CSCI1600: Embedded and Real Time Software
CSCI1600: Embedded and Real Time Software
Introduction to verification
Formal Methods in software development
Program correctness Model-checking CTL
Model Checking Graph Grammars
Presentation transcript:

CSC2108: Automated Verification or Everything you Wanted to Know about Model-Checking Ü Instructor: Marsha Chechik Ü Bahen 3248, Ü TA: Shiva Nejati Ü Web page:

Software Engineering and Formal Methods

Motivation “To err is human but to really foul things up requires a computer” Farmer’s Almanac for 1978 “Capsules of Wisdom” “ 60% of all major industrial disasters from 1921 to 1989 occurred after 1975” Nancy Leveson “Safeware: Computers and Technology”

Example: auto-pilot Problem: “Design a part in auto-pilot that avoids collision with other planes.” Solution: “When distance is 1km, give warning to other plane and notify pilot. When distance is 300m, and no changes in the course of other plane were noticed, go up to avoid collision”

Problem with solution Ü Both planes have the same software. Both go up...

This happens in real software! Ü Some famous bugs  NASA Space Rover, Intel floating point processor, etc. Ü Hard to predict all behaviours!  US aircraft went to southern hemisphere and … flipped when crossing the equator  Air traffic controller: US to Britain.  It never dealt with problem of 0 degrees longitude.  Result: software “folded” Britain along Greenwich Meridian  Software written for US F-16  accidents when reused in Israeli aircraft flown over the Dear Sea (altitude < sea level)  Year 2000 problem

Yet more such examples Ü NASA Space Shuttle software (in use since 1980)  16 severity-level 1 software errors  8 remained in code that was used in flights  none encountered during flights  total size - only 400,000 words

So, why not test? Testing only shows presence of bugs not their absence!

Formal Methods Mathematically-based techniques for describing properties of systems Ü Provide framework for  Specifying systems (and thus notion of correctness)  Developing systems  Verifying correctness  Of implementation w.r.t. the specification  Equivalence of different implementations Ü Reasoning is based on logic  Amenable to machine analysis and manipulation  In principle, can verify everything that is true in the system!  Given enough time, skill and patience

Why aren’t FMs used more? “Formal methods can revolutionize development!” “Formal methods are difficult, expensive, not widely useful and for safety-critical systems only”

… and one more problem Ü Need to know what to build (specification) before you start building System engineering Analysis Design Coding Testing Maintenance “water-fall” model Ü Unrealistic!  May need to discover what to build iteratively  Software changes all the time

Formal Methods “Light” Ü Partial application of formal methods  only parts of systems are specified Ü Emphasis on analysis of some properties  security, fairness, deadlock freedom, rather than complete verification Ü Debugging rather than assurance Ü Automation Most successful lightweight technique: Model-Checking

Overview of Automated Verification Answer + Counter-example Answer + Counter-example SW/HW artifact SW/HW artifact Correctness properties Correctness properties Temporal logic Temporal logic Model of System Model of System Model Extraction Model Extraction Translation Checker Engine Checker Engine abstraction Correct?

CTL Model-Checking Ü CTL: Branching-time propositional temporal logic Ü Model - a tree of computation paths Ü Example: Kripke Structure Tree of computation S1 S2 S3 S2 S1 S3 S1 S3 S2 S1 S3 S1 S3

p qrp qr  p q r pq rpq r s0s0 s2s2 s1s1 Models: Kripke Structures Ü Conventional state machines  M =  S is a (finite) set of states  A is a (finite) set of propositional variables  s 0 is a unique initial state (s 0  S)  I: S  2 A is a labeling function that maps each state to the set of propositional variables that hold in it  R  S  S is a (total) transition relation

Propositional Variables  Fixed set of atomic propositions {p, q, r}  Atomic descriptions of a system  “Printer is busy”  “There are currently no requested jobs for the printer”  “Conveyer belt is stopped”  How to choose them?  Should not involve time!

CTL: Computation Tree Logic propositional temporal logic. allows explicit quantification over possible futures Ü Syntax: True (  ) and False (  ) are CTL formulae; propositional variables are CTL formulae; if  and  are CTL formulae, then so are:  ,   ,    EX  ---  holds in some next states; EF  --- along some path,  is true in a future state; E[  U  ] --- along some path,  holds until  holds; EG  --- along some path,  holds in every state  Universal quantification: AX , AF , A[  U  ], AG 

Examples  EX (exists next)  AX (all next)      EG (exists global)           AG (all global) 

Examples, Cont’d  EF (exists future)    AF (all future)     EU (exists until)      AU (all until) 

CTL (Cont’d) Ü Examples:  Properties that hold:  (EX p)(s 0 )  (A[p U q])(s 0 )  ( EX AF p )(s 0 )  Properties that fail:  (A[  p U q])(s 0 ) p qrp qr  p q r pq rpq r s0s0 s2s2 s1s1

Some Statements To Express  It is possible to get to a state where started holds, but ready does not hold  EF (started   ready)  When a request occurs, it will eventually be acknowledged  AG (request  AF acknowledge)

CTL Model-Checking Ü Receive:  Kripke structure K  Temporal logic formula  Ü Assumptions:  Finite number of processes  Each having a finite number of finite-valued variables  Finite length of a CTL formula Ü Algorithm:  Label states of K with subformulas of that  are satisfied there and working outwards towards .  Output states labeled with  Example: EX AG (p  E[p U q])

CTL Model-Checking (Cont’d) EX   Label any state with EX  if any of its successors are labeled with  AF   If any state s is labeled with , label it with AF   Repeat: label any state with AF  if all of its successors are labeled with AF  until there is no change  EX     , AF  , AF  , AF  , AF  , AF  , AF 

Counterexamples Ü Explain:  Why the property fails to hold  to disprove that  holds on all elements of S, produce a single element s  S s.t.  holds on s.  counterexamples restricted to universally-quantified formulas  counterexamples are paths (trees) from initial state illustrating the failure of property pqrpqr  p q r p qrp qr s0s0 s2s2 s1s1  AG p pqrpqr s0s0  p q r s1s1  AX p  AX q pqrpqr s0s0 p qrp qr s2s2  p q r s1s1

Ü Idea of model-checking  recursively go through the structure of the CTL property…  associating each subformula with a set of states where each subproperty is true Ü Symbolic model-checking  effective cure for state explosion problem  use symbolic representation for sets of states  use symbolic representation for transition relation  use binary decision diagrams (BDDs) to encode these Ü Example:  x  y in classical logic Symbolic model-checking x y FT F T T F

Questions: Ü Where does the Kripke structure come from?  Computing it from several concurrent processes  Models of concurrency: maximum parallelism, interleaving  What happens if Kripke structure is infinite?  Abstraction!  How to represent large Kripke structures?  Abstraction!  Symbolic encoding of transition relation  SAT-based encoding (BMC)  Symmetry (not part of the course)  Compositional verification Ü What other methods are there?

2108: Automated Verification A course on model-checking technology Ü Theory:  Different temporal logics (CTL, LTL, mu-calculus)  Foundations:  Automata theory (automata on infinite strings, tree automata, alternating tree automata), lattice theory, fixpoint computations  Introduced as needed!  Different model-checking approaches:  Explicit-state, Symbolic, Bounded (BMC)  Game-theoretic  Automata-theoretic Ü Tools:  SMV, SPIN, Concurrency workbench

Automated Verification (Cont’d) Ü Making this work:  Decision diagrams, SAT solvers  Compositional verification  Partial order reduction  Abstraction and refinement Ü Some applications  Debugging  Requirements monitoring  Test case generation Ü Extensions  Query-checking  Model-checking over partial and inconsistent systems  Etc.

2108: Pragmatics Ü Time: Wednesdays, 2-5 p.m. Ü Readings:  Book:  Clarke, Grumberg, Peled. Model-Checking. MIT Press, 1999  Many research papers Ü Course work:  2-3 small modeling exercises  Regular (small) paper-and-pencil homeworks  Research project  Possibly presentation of a topic related to model-checking Ü Prerequisites:  Discrete mathematics, general inclination towards theory  Prior experience with concurrent systems a plus

Pros and Cons of Model-Checking Ü Often cannot express full requirements  Instead check several smaller properties Ü Few systems can be checked directly  Must generally abstract Ü Work better for certain types of problems  Very useful for control-centered concurrent systems  Avionics software  Hardware  Communication protocols  Not very good at data-centered systems  User interfaces, databases

Pros and Cons, Cont’d Ü Largely automatic and fast Ü Better use for debugging  … rather than assurance Ü Testing vs model-checking  Usually, find more problems by exploring all behaviours of a downscaled system than by testing some behaviours of the full system

Readings Ü List of readings on the web site  Chapter 1 of the textbook  Several papers on formal methods in general. Links from the reading list on the course web page Ü For next week:  Chapter 3 of the textbook