MCA –Software Engineering Kantipur City College. Topics include  Formal Methods Concept  Formal Specification Language Test plan creation Test-case.

Slides:



Advertisements
Similar presentations
Formal Specifications
Advertisements

Copyright W. Howden1 Programming by Contract CSE 111 6/4/2014.
Verification and Validation
Introducing Formal Methods, Module 1, Version 1.1, Oct., Formal Specification and Analytical Verification L 5.
Software Processes Coherent sets of activities for specifying, designing, implementing and testing software systems.
ISBN Chapter 3 Describing Syntax and Semantics.
CS 355 – Programming Languages
Formal Methods in Software Engineering Credit Hours: 3+0 By: Qaisar Javaid Assistant Professor Formal Methods in Software Engineering1.
Formal Specification - Techniques for the unambiguous specification of software Objectives: To explain why formal specification techniques help discover.
Lecturer: Sebastian Coope Ashton Building, Room G.18 COMP 201 web-page: Lecture.
Software Testing and Quality Assurance
CS 330 Programming Languages 09 / 18 / 2007 Instructor: Michael Eckmann.
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 23 Slide 1 Software testing.
Modified from Sommerville’s originalsSoftware Engineering, 7th edition. Chapter 10 Slide 1 Formal Specification.
©Ian Sommerville 2000Software Engineering, 6/e, Chapter 91 Formal Specification l Techniques for the unambiguous specification of software.
CS 330 Programming Languages 09 / 16 / 2008 Instructor: Michael Eckmann.
Describing Syntax and Semantics
School of Computer ScienceG53FSP Formal Specification1 Dr. Rong Qu Introduction to Formal Specification
© 2006 Pearson Addison-Wesley. All rights reserved2-1 Chapter 2 Principles of Programming & Software Engineering.
©Ian Sommerville 2006Software Engineering, 8th edition. Chapter 10 Slide 1 Formal Specification.
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 10 Slide 1 Critical Systems Specification 3 Formal Specification.
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 10 Slide 1 Formal Specification.
1CMSC 345, Version 4/04 Verification and Validation Reference: Software Engineering, Ian Sommerville, 6th edition, Chapter 19.
Chapter 3 Software Processes.
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 13 Slide 1 Application architectures.
©Ian Sommerville 2000Software Engineering, 6th edition. Chapter 19Slide 1 Verification and Validation l Assuring that a software system meets a user's.
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 22 Slide 1 Verification and Validation.
©Ian Sommerville 2000Software Engineering, 6th edition. Chapter 9 Slide 1 Formal Specification l Techniques for the unambiguous specification of software.
CMSC 345 Fall 2000 Unit Testing. The testing process.
©Ian Sommerville 2000 Software Engineering, 6th edition. Chapter 6 Slide 1 Requirements Engineering Processes l Processes used to discover, analyse and.
Software Models (Cont.) 9/22/2015ICS 413 – Software Engineering1 -Component-based software engineering -Formal Development Model.
©Ian Sommerville 2006Software Engineering, 8th edition. Chapter 22 Slide 1 Verification and Validation Slightly adapted by Anders Børjesson.
©Ian Sommerville 2000Software Engineering, Chapter 10 Slide 1 Chapter 10 Formal Specification.
©Ian Sommerville 2000, Mejia-Alvarez 2009 Slide 1 Software Processes l Coherent sets of activities for specifying, designing, implementing and testing.
Mathematical Modeling and Formal Specification Languages CIS 376 Bruce R. Maxim UM-Dearborn.
©Ian Sommerville 2000 Software Engineering, 6th edition. Chapter 3 Slide 1 Software Processes l Coherent sets of activities for specifying, designing,
1 Program Correctness CIS 375 Bruce R. Maxim UM-Dearborn.
©Ian Sommerville 2000Software Engineering, 6th edition. Chapter 9 Slide 1 Chapter 9 Formal Specifications.
Formal Methods in Software Engineering Credit Hours: 3+0 By: Qaisar Javaid Assistant Professor.
Overview of Formal Methods. Topics Introduction and terminology FM and Software Engineering Applications of FM Propositional and Predicate Logic Program.
WXGE6103 Software Engineering Process and Practice Formal Specification.
Chapter 25 Formal Methods Formal methods Specify program using math Develop program using math Prove program matches specification using.
Unit-1 Introduction Prepared by: Prof. Harish I Rathod
CS Data Structures I Chapter 2 Principles of Programming & Software Engineering.
These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 6/e and are provided with permission by.
ISBN Chapter 3 Describing Semantics.
Chapter 3 Part II Describing Syntax and Semantics.
Formal Methods in Software Engineering Credit Hours: 3+0 By: Qaisar Javaid Assistant Professor.
Software Engineering Chapter 10 Formal Specification Ku-Yaw Chang Assistant Professor Department of Computer Science and Information.
© 2006 Pearson Addison-Wesley. All rights reserved2-1 Chapter 2 Principles of Programming & Software Engineering.
© 2006 Pearson Addison-Wesley. All rights reserved 2-1 Chapter 2 Principles of Programming & Software Engineering.
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 4 Slide 1 Software Processes.
©Ian Sommerville 2006Software Engineering, 8th edition. Chapter 4 Slide 1 Software Processes.
ANALYSIS PHASE OF BUSINESS SYSTEM DEVELOPMENT METHODOLOGY.
©Ian Sommerville 2000Software Engineering, Chapter 10 Slide 1 Chapter 10 Formal Specification.
Software Development Process CS 360 Lecture 3. Software Process The software process is a structured set of activities required to develop a software.
CSC3315 (Spring 2009)1 CSC 3315 Languages & Compilers Hamid Harroud School of Science and Engineering, Akhawayn University
C HAPTER 3 Describing Syntax and Semantics. D YNAMIC S EMANTICS Describing syntax is relatively simple There is no single widely acceptable notation or.
Course: Software Engineering – Design I IntroductionSlide Number 1 What is a specification Description of a (computer) system, which:  is precise;  defines.
ALLOY: A Formal Methods Tool Glenn Gordon Indiana University of Pennsylvania COSC 481- Formal Methods Dr. W. Oblitey 26 April 2005.
Requirement Specification SRS document is a contract between the development team and the customer How do we communicate the Requirements to others? Firm.
 System Requirement Specification and System Planning.
Principles of Programming & Software Engineering
IS301 – Software Engineering V:
Formal Specification.
Formal Methods in Software Engineering 1
Formal Specifications
Test Case Test case Describes an input Description and an expected output Description. Test case ID Section 1: Before execution Section 2: After execution.
Activities of Formal Methods
Presentation transcript:

MCA –Software Engineering Kantipur City College

Topics include  Formal Methods Concept  Formal Specification Language Test plan creation Test-case generation  Executable and non- executable specifications  Pre and Post assertions  Formal verification

Formal methods Concept Formal specification is part of a more general collection of techniques that are known as ‘formal methods’. These are all based on mathematical representation and analysis to produce consistent, complete, and correct specification of software. Formal methods include –Formal specification –Specification analysis and proof –Transformational development –Program verification

Acceptance of Formal methods Formal methods have not become mainstream software development techniques as was once predicted –Other software engineering techniques have been successful at increasing system quality. Hence the need for formal methods has been reduced –Market changes have made time-to-market rather than software with a low error count the key factor. Formal methods do not reduce time to market –The scope of formal methods is limited. They are not well-suited to specifying and analysing user interfaces and user interaction –Formal methods are hard to scale up to large systems

Use of Formal Methods Formal methods have limited practical applicability. Their principal benefits are in reducing the number of errors in systems. Formal specification techniques are most applicable in the development of critical systems and standards. In this area, the use of formal methods is most likely to be cost-effective.

Advantages of Formal Specification It can be studied mathematically. Correctness of modules can be proved Equivalency can be proved. Incomplete definitions and inconsistencies can be detected, and In some cases, it may be produced automatically from requirement statements.

Specification in a Software Process Specification and design are inextricably intermingled. Architectural design is essential to structure a specification. Formal specifications are expressed in a mathematical notation with precisely defined vocabulary, syntax ( Syn) and semantics (sem). The semantics and syntax of a formal specification language are very much like any high level programming language.

Specification and Design

Specification in a Software Process

Use of Formal Specification Formal specification involves investing more effort in the early phases of software development This reduces requirements errors as it forces a detailed analysis of the requirements Incompleteness and inconsistencies can be discovered and resolved Hence, savings as much as the amount of rework due to requirements problems is reduced

Development cost of Formal Specification Formal specification forces an analysis of the system requirements at an early stage. Correcting errors at this stage is cheaper than modifying a delivered system

Specification Techniques Algebraic approach –The system is specified in terms of its operations and their relationships. –Algebraic techniques are suited to interface specification where the interface is defined as a set of object classes. Model-based approach –The system is specified in terms of a state model that is constructed using mathematical constructs such as sets and sequences. Operations are defined by modifications to the system’s state.

Formal Specification Languages A formal Specification Language are based on mathematical logic and provides for automatic logic verification. A formal specification may be checked for inconsistencies and contradictions before being coded in a programming language.

Mathematical Logic SymbolMeaning  For all ( a qualifier)  There exists ( a qualifier) P Ξ QP is logically equivalent to Q ~ pNot p P^qp and q P v qp or q P QIf p then q P QP implies q P QP if and only if q э Such that P QP does not imply q

Examples using Logic Symbols  x,y,z x > y^y >z x>z Description: For all numeric values x,y and z for which x is larger than y and y is larger than z, x is larger than z.

Pre and Post Assertions A set of constraints associated with a formula are called assertions and are used to express preconditions and post-conditions for a given tasks. The preconditions are normally constraints placed on the input to a given formula ( task), and post conditions are constraints placed on the output or results of the formula ( task). The general format for specifying a functional task using formal specification is to define the preconditions, the process and the post conditions within the syntax and semantics of formal language being used.

Example of formal specification Example 1: Suppose M, N and q are integer values. The task is to compute N/M only if N is divisible by M. Definition : {  q э N = q x M } Precondition Program to compute N/M { Output q = N/M } Post-condition Description: These equations mean that if for integer values of N and M there exists an integer value q such that N is equal to q times M; then the output of the program should be the quotient of N divided by M.

Example of formal specification Example 2: The following is a specification for a function that must read two numbers and report the larger of the two numbers. Definition : { True } Precondition Program to read x and y { (Output = x) ^ (x>y) V ( Output = y) ^ (y>x) } Post-condition Description: There is no precondition. That is, the program should work for any pair of ordered values. The post condition defines the output to be x if x > y or to be y if y> x.

Example of formal specification Example 3: The following are the precondition and post- condition for a function that is meat to sort an array of positive integers. Definition : { n>0,  i (0 0 } Precondition Program to soft array a[1,…n] {  I (0<i<n) a[i] ≤ a[i+1] } Post-condition Description: These equations mean that before the task is performed we have an array of positive integers, after the task is performed we have the same array of positive integers, and the content of the array is in ascending order.

Behavioural Specification Algebraic specification can be cumbersome when the object operations are not independent of the object state Model-based specification exposes the system state and defines the operations in terms of changes to that state The Z notation is a mature technique for model- based specification. It combines formal and informal description and uses graphical highlighting when presenting specifications

References  From software engineering, A practitioner’s approach by Roger S. Pressman –Chapter 25: Formal Methods Basic concepts, deficiencies of Less formal approaches, Formal methods concept, Mathematical preliminaries Formal specification languages Summary of Z Notation.  From Software Engineering, Ian Sommerville –Part5: Verification and Validation Chapter 9: Formal Specification Chapter 21: Critical System Validation  From Software Engineering Fundamentals by Ali Behforooz and F.J. Hudson - Chapter 5: Software Specification Tools