Formal Methods for Software Engineering



Similar documents
Advanced Software Engineering ( -Formal specification, verification, transformation, and application-

Formal Engineering for Industrial Software Development

Software Engineering

The CVS-Server Case Study: A Formalized Security Architecture

Introducing Formal Methods. Software Engineering and Formal Methods

Introduction to Formal Methods. Các Phương Pháp Hình Thức Cho Phát Triển Phần Mềm

VDM vs. Programming Language Extensions or their Integration

Computer Science Information Sheet for entry in What is Computer Science?

27 Formal Specification

Formalization of Functional Requirements and Their Traceability in UML Diagrams A Z Notation Based Approach

PROPERTECHNIQUEOFSOFTWARE INSPECTIONUSING GUARDED COMMANDLANGUAGE

The ProB Animator and Model Checker for B

Object-Oriented Software Specification in Programming Language Design and Implementation

VDM++ as a Basis of Scalable Agile Formal Software Development

CS4507 Advanced Software Engineering

Generating Enterprise Applications from Models

Case Study: Design and Implementation of an Ordering system using UML, Formal specification and Java Builder

3 Extending the Refinement Calculus

Specification and Analysis of Contracts Lecture 1 Introduction

Verifying Specifications with Proof Scores in CafeOBJ

A Framework for the Semantics of Behavioral Contracts

3. Relational Model and Relational Algebra

DEVELOPING REQUIREMENTS FOR DATA WAREHOUSE SYSTEMS WITH USE CASES

Challenges and Opportunities for formal specifications in Service Oriented Architectures

Structured Testing in VDM

Abstract Data Types in Event-B An Application of Generic Instantiation

Software Modeling and Verification

UML TUTORIALS THE USE CASE MODEL

Summit Public Schools Summit, New Jersey Grade Level / Content Area: Mathematics Length of Course: 1 Academic Year Curriculum: AP Computer Science A

Overview Motivating Examples Interleaving Model Semantics of Correctness Testing, Debugging, and Verification

Checking Accounts. Open, Manage, and Reconcile

FORMAL SPECIFICATION OF SOFTWARE DEVELOPMENT USING BUSINESS RULES APPROACH

Introduction and Overview

Software Engineering. Software Development Process Models. Lecturer: Giuseppe Santucci

Rigorous Software Development An introduction

Software Component Specification Using Design by Contract

How To Write A Program Verification And Programming Book

Quality Management. Lecture 12 Software quality management

Dr. Jana Koehler IBM Zurich Research Laboratory

Module 10. Coding and Testing. Version 2 CSE IIT, Kharagpur

Formally speaking: How to apply OCL

Rigorous Software Engineering Hoare Logic and Design by Contracts

Module 1. Introduction to Software Engineering. Version 2 CSE IIT, Kharagpur

Rigorous Methods for Software Engineering (F21RS1) High Integrity Software Development

Software Process Models. Xin Feng

Thomas Jefferson High School for Science and Technology Program of Studies Foundations of Computer Science. Unit of Study / Textbook Correlation

Introduction. Getting started with software engineering. Ian Sommerville 2000 Software Engineering, 6th edition. Chapter 1 Slide 1

And the Models Are System/Software Development Life Cycle. Why Life Cycle Approach for Software?

payment statistics half of year

Writing in the Computer Science Major

CSE4213 Lecture Notes

Take Charge of Your Own Checking Account ASSESSMENT ONE: Assessment #1

Software Testing. Quality & Testing. Software Testing

Systems Engineering. Aim. Dr Peter Jones. Degree Course Leader

In this Lecture you will Learn: Systems Development Methodologies. Why Methodology? Why Methodology?

SECURITY METRICS: MEASUREMENTS TO SUPPORT THE CONTINUED DEVELOPMENT OF INFORMATION SECURITY TECHNOLOGY

This account features unlimited check writing, no monthly service fee and no minimum balance. $50 minimum deposit to open.

Databases. DSIC. Academic Year

Declaration for Trust Accounts / Accounts of Societies / Associations

A UML 2 Profile for Business Process Modelling *

Surveying and evaluating tools for managing processes for software intensive systems

Introduction to Software Paradigms & Procedural Programming Paradigm

CS Master Level Courses and Areas COURSE DESCRIPTIONS. CSCI 521 Real-Time Systems. CSCI 522 High Performance Computing

Scenario-based Requirements Engineering and User-Interface Design

Acknowledgement. Software Engineering. CS 3141: Team Software Project Introduction

Software Engineering Tools and Methods

Chapter 3 Chapter 3 Service-Oriented Computing and SOA Lecture Note

Classification of Fuzzy Data in Database Management System

Verifying Semantic of System Composition for an Aspect-Oriented Approach

A Design Technique: Data Integration Modeling

DBMS Questions. 3.) For which two constraints are indexes created when the constraint is added?

Lecture Notes on Linear Search

Moving from CS 61A Scheme to CS 61B Java

Introduction to Automated Testing

BANK B-I-N-G-O. service charge. credit card. pen. line nickel interest cash bank. ATM dollar check signature. debit card.

APPLICATION TO OPEN AN ACCOUNT WITH BANK OF INDIA UK BRANCHES

Programming by Contract. Programming by Contract: Motivation. Programming by Contract: Preconditions and Postconditions

50 Computer Science MI-SG-FLD050-02

The Data Quality Continuum*

What's Wrong With Formal Programming Methods? Eric C.R. Hehner

E-COCOMO: The Extended COst Constructive MOdel for Cleanroom Software Engineering

ISA-99 Industrial Automation & Control Systems Security

VHDL Test Bench Tutorial

Introductions. Student Introductions. Purpose. Objectives (Continued) Objectives

Transcription:

Formal Methods for Software Engineering Virendra Singh Computer Design and Test Lab Indian Institute of Science Bangalore Email: virendra@computer.org

Introduction Problems in software development Formal methods for the problems Challenges to formal methods Formal engineering methods for the challenges 2

Formal Definite Orderly Methodical Some thing which is methodical and done with discipline 3

Famous Bugs History of software is full of notorious bugs Long list 1. 1987: Therac-25 2. 1990: AT&T long distance breakdown Break statement 1. 1991: Patriot Missile 28 People killed Pentium Bug 4

Program Testing Bug Bug Bug Bug Bug Initial State Bug 5

Software Testing vs Formal Verification Program testing can be used to show the presence of the bugs, but never to show the absence! (E.W. Dijkstra) 6

Program Testing Program: Check the equality isequal ( House, Mouse ) Is Equal ( Testing, Testing ) isequal( house, home 7

Program Testing Program: Check the equality equal = strlen(string1) == strlen (String2); If (equal) for (i=0; i < strlen(string1); i++) Equal = string1[i] == string 2[i]; Return equal; 8

Sorted = false / /1 While (!sorted){ //2 Sorted = true; Program Testing For (int i = 0; i < SIZE-1; i++){ //3 if (a[i] > a[i+1]{ //4 Swap (a[i], a[i+1]) //5 Sorted = false; } //6 } //7 } //8 9

Problems in software development Specification S Construct Program P What to do How to do it How to ensure that S is not ambiguous so that it can be correctly understood by all the people involved? How can S be effectively used for inspecting and testing P? How can software tools effectively support the analysis of S, transformation from S to P, and verification of P against S? 10

An example of informal specification: A software system for an Automated Teller Machine (ATM) needs to provide services on various accounts. The services include operations on current account, operations on savings account, transferring money between accounts, managing foreign currency account, and change password. The operations on a current or savings account include deposit, withdraw, show balance, and print out transaction records. 11

A better way to write the same specification: A software system for an automated teller machine (ATM) needs to provide services on various accounts. The services include a. operations on current account b. operations on savings account c. transferring money between accounts d. managing foreign currency account, e. change password. The operations on a current or savings account include a. deposit b. withdraw c. show balance d. print out transaction records. 12

The major problems with informal specifications: Informal specifications are likely to be ambiguous, which is likely to cause misinterpretations. Informal specifications are difficult to be used for inspection and testing of programs because of the big gap between the functional descriptions in the specifications and the program structures. Informal specifications are difficult to be analyzed for their consistency and validity. Information specifications are difficult to be supported by software tools in their analysis, transformation, and management (e.g., search, change, reuse). 13

A possible solution to these problems: Formal Methods!!! 14

Formal methods for the problems What is formal methods? Formal methods = Formal Specification + Refinement + Formal Verification Set theory, logics, algebra, etc. 15

Formal methods can also be understood as the following three components: Formal notation (or language) for writing specifications. Logical calculus for formal verification (or proof) Method for developing software systems. 16

From the abstract to the concrete Refinement Specification What to do Implementation How to do it Verification Check the correctness 17

Validation Requirements analysis Formal Specification Verification Design Verification Coding Testing 18

The question of our interest is: How to write a formal specification? Many formal notations have been developed for writing formal specifications and the most commonly used ones include VDM, Z, and B. 19

The most commonly used formal methods (1) VDM-SL (Vienna Development Method Specification Language), IBM Research Laboratory in Vienna References: (1) Systematic Software Development Using VDM, by Cliff B. Jones, 2nd edition, Prentice Hall,1990. (2) Modelling Systems, by John Fitzgerald and Peter Gorm Larsen, Cambridge University Press,1998. 20

Operation specification OperationName(input)output ext State variables pre preconiditon post postcondition Example: Add(x : nat) y : nat ext rd z : nat /*z is an external variable */ pre true post y > x + z 21

Operations are organized into modules: module A local variables declarations invariant declarations operation specification1; operation specification2; operation specificationn; end 22

(2) Z, PRG (Programming Research Group), the University of Oxford, UK References: (1) The Z Notation, by J.M. Spivey, Prentice Hall, 1989. (2) Using Z: Specification, Refinement, and Proof, by Jim Woodcock and Jim Davies, Prentice Hall, 1996. 23

A Z specification is composed of a set of schemas and possibly their sequential compositions. A schema can be used to define global variables, state variables, and operations. Axiomatic schema for defining global variables: age: N age > 0 declaration predicate 24

A schema for defining state variables: Known: P NAME BirthdayBook birthday: NAME DATE known = dom birthday 25

A schema for defining an operation: BirthdayBook name?: NAME date?: DATE AddBirthday name? known birthday = birthday {name? date?} 26

(3) B-Method, Jean-Raymond Abrial, France References: (1) The B-Book: Assigning Programs to Meanings, by J-R Abrial, Cambridge University Press,1996, A B specification is composed of a set of related abstract machines. Each abstract machine is a module that contains a set of operation definitions. Each operation is defined using pre- and postconditions. 27

1.3 Challenges to formal methods Formal specifications of large-scale and complex software systems can be difficult to write, to read, and to understand for many engineers in industry. Communications between clients and developers via formal specifications can be difficult. Modifications of formal specifications for consistency during a project can be time-consuming and costly. Formal verification is difficult to perform and is not cost-effective for the assurance of program correctness. The tool support does not necessarily reduce the 28 difficulty of using formal methods.

Formal engineering methods for the challenges Formal Engineering Methods (FEM) provide a way to integrate Formal Methods into the entire software development process to achieve rigor (methodology), comprehensibility (human), and tool supportability (tool) of software process. 29

Formal Methods Formal Engineering Methods Application of Formal Methods in Software Engineering 30

The difference between FM and FM answers the question: what should we do and why? FEM answers the question: what can we do and how? FEM 31

Component Architecture 32