Finite State Verification for Software Systems Lori A. Clarke University of Massachusetts Laboratory for Advanced Software Engineering Research

Slides:



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

Modeling issues Book: chapters 4.12, 5.4, 8.4, 10.1.
A System to Generate Test Data and Symbolically Execute Programs Lori A. Clarke September 1976.
Introducing Formal Methods, Module 1, Version 1.1, Oct., Formal Specification and Analytical Verification L 5.
Verification of Evolving Software Natasha Sharygina Joint work with Sagar Chaki and Nishant Sinha Carnegie Mellon University.
Automatic Verification Book: Chapter 6. What is verification? Traditionally, verification means proof of correctness automatic: model checking deductive:
Compilation 2011 Static Analysis Johnni Winther Michael I. Schwartzbach Aarhus University.
Abstraction and Modular Reasoning for the Verification of Software Corina Pasareanu NASA Ames Research Center.
SOFTWARE TESTING. INTRODUCTION  Software Testing is the process of executing a program or system with the intent of finding errors.  It involves any.
LIFE CYCLE MODELS FORMAL TRANSFORMATION
Verifying Properties of Process Definitions Jamieson M. Cobleigh, Lori A. Clarke, and Leon J. Osterweil Laboratory for Advanced Software Engineering Research.
Hiding the Formalism in Formal Methods Lori A. Clarke Laboratory for Advanced Software Engineering Research (LASER) University of Massachusetts, Amherst.
LASER From Natural Language Requirements to Rigorous Property Specifications Lori A. Clarke Work done in collaboration with Rachel L. Smith, George S.
A survey of techniques for precise program slicing Komondoor V. Raghavan Indian Institute of Science, Bangalore.
1 Concurrency Specification. 2 Outline 4 Issues in concurrent systems 4 Programming language support for concurrency 4 Concurrency analysis - A specification.
ISBN Chapter 3 Describing Syntax and Semantics.
1 Formal Methods in SE Qaisar Javaid Assistant Professor Lecture 05.
Formal Methods in Software Engineering Credit Hours: 3+0 By: Qaisar Javaid Assistant Professor Formal Methods in Software Engineering1.
Lecture 4&5: Model Checking: A quick introduction Professor Aditya Ghose Director, Decision Systems Lab School of IT and Computer Science University of.
ECE Synthesis & Verification1 ECE 667 Spring 2011 Synthesis and Verification of Digital Systems Verification Introduction.
Describing Syntax and Semantics
School of Computer ScienceG53FSP Formal Specification1 Dr. Rong Qu Introduction to Formal Specification
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.
272: Software Engineering Fall 2012 Instructor: Tevfik Bultan Lecture 4: SMT-based Bounded Model Checking of Concurrent Software.
Formal Techniques for Verification Using SystemC By Nasir Mahmood.
Formal Methods 1. Software Engineering and Formal Methods  Every software engineering methodology is based on a recommended development process  proceeding.
Cheng/Dillon-Software Engineering: Formal Methods Model Checking.
System/Software Testing
Introduction to Software Testing Chapter 9.4 Model-Based Grammars Paul Ammann & Jeff Offutt
Data-Flow Analysis. Approaches Static Analysis Inspections Dependence analysis Symbolic execution Software Verification Data flow analysis Concurrency.
Finite-State Verification. A quick look at three approaches to FSV Model Checking Flow Equations Data Flow Analysis FLAVERS.
1 Software testing. 2 Testing Objectives Testing is a process of executing a program with the intent of finding an error. A good test case is in that.
Overview of Formal Methods. Topics Introduction and terminology FM and Software Engineering Applications of FM Propositional and Predicate Logic Program.
CIS 842: Specification and Verification of Reactive Systems Lecture Specifications: Sequencing Properties Copyright , Matt Dwyer, John Hatcliff,
Software Engineering Research paper presentation Ali Ahmad Formal Approaches to Software Testing Hierarchal GUI Test Case Generation Using Automated Planning.
CS6133 Software Specification and Verification
Dynamic Analysis of Multithreaded Java Programs Dr. Abhik Roychoudhury National University of Singapore.
Inferring Specifications to Detect Errors in Code Mana Taghdiri Presented by: Robert Seater MIT Computer Science & AI Lab.
Type Systems CS Definitions Program analysis Discovering facts about programs. Dynamic analysis Program analysis by using program executions.
ISBN Chapter 3 Describing Semantics -Attribute Grammars -Dynamic Semantics.
1 Compiler Construction (CS-636) Muhammad Bilal Bashir UIIT, Rawalpindi.
CIS 842: Specification and Verification of Reactive Systems Lecture 1: Course Overview Copyright 2001, Matt Dwyer, John Hatcliff, and Radu Iosif. The.
Fall 2004EE 3563 Digital Systems Design EE 3563 VHSIC Hardware Description Language  Required Reading: –These Slides –VHDL Tutorial  Very High Speed.
Xusheng Xiao North Carolina State University CSC 720 Project Presentation 1.
1 CSEP590 – Model Checking and Automated Verification Lecture outline for August 6, 2003.
Formal Methods.
Requirements Engineering-Based Conceptual Modelling From: Requirements Engineering E. Insfran, O. Pastor and R. Wieringa Presented by Chin-Yi Tsai.
Verification & Validation By: Amir Masoud Gharehbaghi
ICFEM 2002, Shanghai Reasoning about Hardware and Software Memory Models Abhik Roychoudhury School of Computing National University of Singapore.
Laboratory for Advanced Software Engineering Research UMASS Lori A. Clarke University of Massachusetts Finite.
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.
Automated Formal Verification of PLC (Programmable Logic Controller) Programs
 Simulation enables the study of complex system.  Simulation is a good approach when analytic study of a system is not possible or very complex.  Informational,
MOPS: an Infrastructure for Examining Security Properties of Software Authors Hao Chen and David Wagner Appears in ACM Conference on Computer and Communications.
Compositional Verification for System-on-Chip Designs SRC Student Symposium Paper 16.5 Nishant Sinha Edmund Clarke Carnegie Mellon University.
Verifying Component Substitutability Nishant Sinha Sagar Chaki Edmund Clarke Natasha Sharygina Carnegie Mellon University.
Agenda  Quick Review  Finish Introduction  Java Threads.
Testing Overview Software Reliability Techniques Testing Concepts CEN 4010 Class 24 – 11/17.
Dillon: CSE470: ANALYSIS1 Requirements l Specify functionality »model objects and resources »model behavior l Specify data interfaces »type, quantity,
SOFTWARE TESTING LECTURE 9. OBSERVATIONS ABOUT TESTING “ Testing is the process of executing a program with the intention of finding errors. ” – Myers.
Formal methods: Lecture
Definition CASE tools are software systems that are intended to provide automated support for routine activities in the software process such as editing.
Types for Programs and Proofs
Over-Approximating Boolean Programs with Unbounded Thread Creation
Chapter 1 Introduction(1.1)
CS310 Software Engineering Lecturer Dr.Doaa Sami
From Use Cases to Implementation
Presentation transcript:

Finite State Verification for Software Systems Lori A. Clarke University of Massachusetts Laboratory for Advanced Software Engineering Research Other contributors: G. Avrunin, J. Cobleigh, M. Dwyer, G. Naumovich, and L. Osterweil

Testing can: Uncover failures Show specifications are not met for specific test cases Be an indication of overall reliability cannot: Prove that a program will/will not behave in a particular way

Distributed Systems Better performance, better flexibilty, but there is a cost distributed systems are more difficult to test than sequential systems number of execution paths can grow exponentially with the number of tasks Testing can not even demonstrate that a system works on the selected/executed test data

Formal Verification: An Alternative to Testing Theorem Proving Prove properties about all possible executions Use mathematical reasoning Difficult and error prone Finite State Verification Prove properties about all possible executions Reason about a finite abstract, model of the system not as powerful as theorem proving Almost a totally automated process

Finite State Verification: State of the Art Reachability Based Approaches Symbolic Model Checking -- SPIN or SMV Exponential worst-case bound Integer Linear Constraints INCA Exponential worst-case bound Data Flow Analysis FLAVERS Polynomial worst-case bound

Property System Property Translator System Translator Reasoning Engine TFG Consistent FSA Ada, Java, C++, Jovial Inconsistent + counter example Event alphabet Architecture of FLAVERS

FLAVERS: Where is the magic? System Model Primarily event-based, not state-based Reason about sequences of events Does not enumerate all reachable states Includes all “relevant” executions Usually over-approximates relevant executable behaviors Model is conservative wrt a property Incrementally refine model as needed add state information that is demonstrated to be needed

T1T ,6 2,6 start... Enumerating the State Space

T1T ,6 2,6 5,9 3, , ,71,8 3,72,8 3,8 e1 e2 e3 e1 e2 e3 Enumerating the event space e1 e2

T1T e1 e2 e3 4 9 T1T e1 e2 e3 FLAVERS model of the system

Modeling the System: FLAVERS Automatically creates the program model from the source code Instead of the state space, explicitly represents interleaved execution via edges Compute MHP Optimize the representation Model only events of interest Conservative with respect to a property

Some comments on the model Works well if the events of interest are relatively sparse in the overall system E.g., method invocations, task interaction Inter-procedural analysis done via in-lining An imprecise, but conservative, representation Too imprecise for deadlock Seems to greatly reduce the analysis cost...

Disclaimer

Property System Property Translator System Translator Reasoning Engine TFG Consistent FSA Ada, Java, C++, Jovial Inconsistent + counter example Event alphabet Architecture of FLAVERS

Example Property FSA The elevator always closes its doors before moving close, open,move 0 1 open close 2 move close move open

Reasoning engine: State Propagation States of the property are propagated through the TFG The property is proved if only accepting (non- accepting) states are contained in the final node of the TFG overall complexity is O(N 2 S) N is the size of the model of the system S is the number of states guaranteed to terminate

Elevator Controller void main() { … 1,2,4:if (elevatorStopped) {... 3:openDoors(); }... 5,6,8:if (elevatorStopped) {... 7:closeDoors(); } 9:moveToNextFloor(); } 1: if 3: open 7: close 5: if 9: move

7,9 Elevator Controller Worklist: 3, 5, 1: if 3: open 7: close 5: if 9: move close 0 1 open close 2 move close move open Property open move

7,9 Elevator Controller void main() { … 1,2,4:if (elevatorStopped) {... 3:openDoors(); }... 5,6,8:if (elevatorStopped) {... 7:closeDoors(); } 9:moveToNextFloor(); } Worklist: 3, 5, 1: if 3: open 7: close 5: if 9: move close 0 1 open close 2 move close move open Property open move <0><0> <1><1>

Conservative Analysis if a property is found to be valid, it is definitely true if a property is found to be invalid An invalid trace may correspond to an error The invalid traces do not correspond to executable behavior

Property System Property/Constraint Translator System Translator Reasoning Engine TFG Consistent FSA Ada, Java, C++, Jovial Inconsistent + counter example Event alphabet Revised Architecture of FLAVERS Constraints

Elevator Controller void main() { … 1,2,4:if (elevatorStopped) {... 3:openDoors(); }... 5,6,8:if (elevatorStopped) {... 7:closeDoors(); } 9:moveToNextFloor(); } 1: if 3: open 7: close 5: if 9: move 6: S==true 8: S==false 4: S==false2: S==true

Example constraint for a boolean variable == is a predicate = is assignment viol S==true S=true S==true S=true S==true S==false S=false S==false S==true S=true S==false S=false S==false S=false S=false S=true truefalse unknown

Example constraint for a boolean variable == is a predicate = is assignment viol S==true S=true S==true S=true S==true S==false S=false S==false S==true S=true S==false S=false S==false S=false S=false S=true truefalse unknown

Worklist: 2, 4,3,6,8,5, State Propagation 1: if 3: open 7: close 5: if 9: move 6: S==true 8: S==false 4: S==false2: S==true, 0 21 viol S==true S==false S==true S==false S==true Constraint close 0 1 open close 2 move close move open Property open move

Worklist: 2, 4,3,6,8,5,7,9 State Propagation 1: if 3: open 7: close 5: if 9: move 6: S==true 8: S==false 4: S==false2: S==true, 0 21 viol S==true S==false S==true S==false S==true Constraint close 0 1 open close 2 move close move open Property open move

Worklist: 2, 4, 3, 5, 6, 8, 7Worklist: 2, 4, 3, 5, 6, 8, 7, 9 State Propagation 1: if 3: open 7: close 5: if 9: move 6: S==true 8: S==false 4: S==false2: S==true,, 0 21 viol S==true S==false S==true S==false S==true Constraint close 0 1 open close 2 move close move open Property open move

Constraints Used to add semantic information Can model many different kinds of information Variables or flow of control Missing components Environment Users Can provide automated assistance

Evaluating FLAVERS Experimental Evaluation Case studies: Communication Protocols: 3-way handshake and alternating bit demonstrated the importance of modeling the environment Architectural Design written in Wright demonstrated importance of doing analysis early Industrial demonstrations: SAIC: ADS Command Instruction Sets, HLA Northrop: B2 Jovial systems MCC: Quest project, C++ systems

Need a paradigm shift! Software systems are increasingly used in critical applications Medicine Transportation Communication Finance Cannot continue to do business as usual Testing as the prime validation technique is costly and ineffective

New life to an old vision Significant validation throughout the software lifecycle: architectural design low level design coding debugging Maintenance Finite state verification is an extremely general approach

Early fault detection Requirement specs ==> properties Design specs ==> properties properties X system representations ==> early feedback

Future Plans Difficult to predict performance For any FSV technique For FLAVERS: Adding constraints increases the worst-case bound, but may (or may not) improve performance Need more automated support Analysis to help select additional information to be modeled Abstraction techniques for modeling

Future Work Explore alternative state propagation algorithms E.g., Initial verification vs re-verification Improve counter-example generation Short paths User guidance Better support for specifying properties Build on property pattern specifications FSA templates combined with Disciplined Natural Language

Action may occur zero times. FSA template: action response action  response DNL template:  response or  (action,response) Multiple occurrences of action eventually result in only one occurrence of response. Response cannot occur before the first action occurs.  (action,response) repetition phrase Action may occur zero times. The Repetition phrase describes whether or not the property is repeatable. This property is repeatable. This property is not repeatable. action repetition phrase  response or  (action,response) This property is repeatable. Response Property

 response or  (action,response)  response response Competed FSA template… completed FSA …and a DNL template. …and its DNL representation of your property. action  response This property is repeatable. Multiple occurrences of action eventually result in only one occurrence of response. Response cannot occur before the first action occurs.  (action,response) Action may occur zero times. action This property is repeatable. Multiple occurrences of action eventually result in only one occurrence of response. Action may occur zero times. Response cannot occur before the first action occurs. This property is repeatable. Instantiated Response Property

Future Work Software composition techniques Contractual composition Integration with testing Better approaches for dealing with dynamism Full lifecycle support Support for Java Experimental Evaluation

Conclusions FLAVERS is effective at verifying a wide range of interesting properties Very general approach that can be applied to any event flow model Much easier to use than theorem proving based techniques Can be mostly automated Hides the “formal” in formal methods Is it easy enough?