Formal Methods. Objectives To introduce formal methods including multiple logic based approaches for software modelling and reasoning 2.

Slides:



Advertisements
Similar presentations
Automated Theorem Proving Lecture 1. Program verification is undecidable! Given program P and specification S, does P satisfy S?
Advertisements

Rigorous Software Development CSCI-GA Instructor: Thomas Wies Spring 2012 Lecture 1.
Hong Zhu Department of Computing and Communication Technologies Oxford Brookes University, Oxford OX33 1HX, UK COMPSAC 2012 PANEL.
Lecture 8: Testing, Verification and Validation
Functional Verification III Prepared by Stephen M. Thebaut, Ph.D. University of Florida Software Testing and Verification Lecture Notes 23.
Introducing Formal Methods, Module 1, Version 1.1, Oct., Formal Specification and Analytical Verification L 5.
Hoare’s Correctness Triplets Dijkstra’s Predicate Transformers
Lecture 1 Introduction CS6133 Software Specification and Verification.
Annoucements  Next labs 9 and 10 are paired for everyone. So don’t miss the lab.  There is a review session for the quiz on Monday, November 4, at 8:00.
Proofs, Recursion and Analysis of Algorithms Mathematical Structures for Computer Science Chapter 2 Copyright © 2006 W.H. Freeman & Co.MSCS SlidesProofs,
1 Chapter Six Algorithms. 2 Algorithms An algorithm is an abstract strategy for solving a problem and is often expressed in English A function is the.
Software Failure: Reasons Incorrect, missing, impossible requirements * Requirement validation. Incorrect specification * Specification verification. Faulty.
Software Reliability Engineering
Axiomatic Verification I Prepared by Stephen M. Thebaut, Ph.D. University of Florida Software Testing and Verification Lecture 17.
ISBN Chapter 3 Describing Syntax and Semantics.
1/22 Programs : Semantics and Verification Charngki PSWLAB Programs: Semantics and Verification Mordechai Ben-Ari Mathematical Logic for Computer.
Weakest pre-conditions and towards machine consistency Saima Zareen.
15 November Essay 1  Methodologies Points on the spectrum All can adapt to changes Required vs. permitted  Releases vs. iterations  Spool’s.
Informatics 43 – April 28, Fun with Models Fashion Student Model = Ideal.
Lecture 9 Recursive and r.e. language classes
Software Testing and Quality Assurance
Copyright © 2006 The McGraw-Hill Companies, Inc. Programming Languages 2nd edition Tucker and Noonan Chapter 18 Program Correctness To treat programming.
Describing Syntax and Semantics
School of Computer ScienceG53FSP Formal Specification1 Dr. Rong Qu Introduction to Formal Specification
ECI 2007: Specification and Verification of Object- Oriented Programs Lecture 0.
Chapter 2: Algorithm Discovery and Design
Software Integration and Documenting
Chapter 1: Introduction to Software Testing Software Testing
Chapter 5: Control Structures II (Repetition)
Course: Software Engineering © Alessandra RussoUnit 1 - Introduction, slide Number 1 Unit 1: Introduction Course: C525 Software Engineering Lecturer: Alessandra.
Testing CSE 140 University of Washington 1. Testing Programming to analyze data is powerful It’s useless if the results are not correct Correctness is.
CSE 311 Foundations of Computing I Lecture 30 Computability: Other Undecidable Problems Autumn 2012 CSE 3111.
Dr. Naveed Riaz Design and Analysis of Algorithms 1 1 Formal Methods in Software Engineering Lecture # 24.
1 Inference Rules and Proofs (Z); Program Specification and Verification Inference Rules and Proofs (Z); Program Specification and Verification.
Overview of Formal Methods. Topics Introduction and terminology FM and Software Engineering Applications of FM Propositional and Predicate Logic Program.
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Chapter 2 Chapter 2 - Introduction to C Programming.
First Order Logic Lecture 2: Sep 9. This Lecture Last time we talked about propositional logic, a logic on simple statements. This time we will talk about.
Chapter 5: Control Structures II (Repetition). Objectives In this chapter, you will: – Learn about repetition (looping) control structures – Learn how.
Introduction to Mathematical techniques Formal Methods Limits of Formal Methods.
CS Data Structures I Chapter 2 Principles of Programming & Software Engineering.
Software Testing and Quality Assurance Software Quality Assurance 1.
Propositional Calculus CS 270: Mathematical Foundations of Computer Science Jeremy Johnson.
Chapter 5: Sequences, Mathematical Induction, and Recursion 5.5 Application: Correctness of Algorithms 1 [P]rogramming reliability – must be an activity.
What is Testing? Testing is the process of finding errors in the system implementation. –The intent of testing is to find problems with the system.
Chapter 3 Part II Describing Syntax and Semantics.
More on Correctness. Prime Factorization Problem: Write a program that computes all the prime factors of a given number Solution (Idea): Factors are less.
An Axiomatic Basis for Computer Programming Robert Stewart.
1 These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 5/e and are provided with permission by.
Function Definition by Cases and Recursion Lecture 2, Programmeringsteknik del A.
Testing CSE 160 University of Washington 1. Testing Programming to analyze data is powerful It’s useless (or worse!) if the results are not correct Correctness.
Software Testing Mehwish Shafiq. Testing Testing is carried out to validate and verify the piece developed in order to give user a confidence to use reliable.
29 March Software Quality and Testing. Why do we care? Therac-25 (1985) Multiple space fiascos (1990s) Ariane V exploded after 40 seconds (conversion)
Dr. Naveed Riaz Design and Analysis of Algorithms 1 1 Formal Methods in Software Engineering Lecture # 26.
CSC3315 (Spring 2009)1 CSC 3315 Languages & Compilers Hamid Harroud School of Science and Engineering, Akhawayn University
Agenda  Quick Review  Finish Introduction  Java Threads.
Verification vs. Validation Verification: "Are we building the product right?" The software should conform to its specification.The software should conform.
1 Lecture 2 - Introduction to C Programming Outline 2.1Introduction 2.2A Simple C Program: Printing a Line of Text 2.3Another Simple C Program: Adding.
COSC 5V90 Functional Programming and Interactive Theorem Proving
Handouts Software Testing and Quality Assurance Theory and Practice Chapter 2 Theory of Program Testing
About the Presentations
Copyright © Cengage Learning. All rights reserved.
Programming Languages 2nd edition Tucker and Noonan
Chapter 28 Formal Modeling and Verification
Software Verification and Validation
Software Verification and Validation
The Zoo of Software Security Techniques
Software Verification and Validation
CSE 1020:Software Development
Notorious Bugs – BYTE, September byte
Programming Languages 2nd edition Tucker and Noonan
Presentation transcript:

Formal Methods

Objectives To introduce formal methods including multiple logic based approaches for software modelling and reasoning 2

Course Contents Introduction to Formal Methods Propositional Logic First Order Predicate Logic Z-Notation Pi-Calculus Advanced Topics 3

Books Logic in Computer Science by Michael Huth and Mark Ryan, Second Edition Using Z: Specification, Refinement, and Proof, Oxford university Press by Woodcock, J.C.P. and Davies, J. A Calculus of Mobile Processes by Robin Milner 4

Grading Assignments – 10% Quizzes – 10% OHTs– 15% + 15% Final Exam – 50% 5

CLOs CLO1: To highlight the role of formal methods within the software life cycle by focusing on core concepts. CLO2: To understand process of software modeling and verification. CLO3: To learn and practice state of the art technologies in formal methods. 6

Formal means? Orderly Definite Methodical 7

Formal Methods Formal methods used in developing computer systems are : mathematically based techniques for describing system properties. Such formal methods provide frameworks within which people can: specify, develop and verify systems in a systematic, rather than ad hoc manner 8

Formal methods are meant for Formal proof can replace (infinitely) many test cases Formal methods guarantee specific properties of system model 9

Use of Formal methods There is an increasing interest about formal methods and their applications. Formal methods have the potential to provide increased confidence in a system by satisfying the standards set by regulatory bodies. 10

Formal methods Formal methods used in developing computer systems are : mathematically based techniques for describing system properties. Such formal methods provide frameworks within which people can: specify, develop, and verify systems in a systematic, rather than ad hoc manner 11

Why Formal Methods are required? History of software Software encountered notorious bugs that were the cause of financial lose and deaths of many people. Famous bugs are…… 12

Therac-25 Computerized radiation therapy machine called the Therac- 25. Killed many people, controller could not stop radiation due to software bug, later on the problem was fixed, after killing many people life. 13

AT & T AT & T long distance breakdown bug 1990 ill placed break statement in the code caused the 1/3rd of entire American network to go down for 9 hours. Loses to banks, for ATM and transactions 14

Patriot Missile Failure Gulf war This missile hit the own American troops a software defect in Killing 28 people and many injured 15

Pentium bug Software error in microcode of Pentium microprocessor, which resulted in error of floating point calculations problems. Intel had to take back all the Pentiums, and it caused huge loss of dollars. 16

Importance of Software Software is present everywhere microwave oven, cars and software use is expanded. That means a small software error can cause your microwave oven to explode, where system failure can cause losses more than the system itself. A software problem can cause life loses. We have to be careful for the use of such systems, where loss of life is a bigger loss. 17

Importance of formal methods in Software This is what we are going to study in formal methods. Methods to ensure that software is Correct and Reliable 18

Importance of formal methods in Software contd.. These two attributes deal with the software quality. To achieve software quality, we apply different techniques. Testing, Verification, Validation 19

Reliability Obviously there is no guarantee in life but every one wants to have reliable software A report was presented to President Bill Clinton in 1996 by committee of IT, in which they stated, “we know to write a software that works 95% of the time, but do not know how to write software that works for 100 % of the time, it is used.” 20

Testing Black box testing Test input versus output Input - Two numbers Output - average White box testing Test the structure of program. For loops testing, condition testing 21

Can we test every system? 22

"Testing can show the presence of errors, but not their absence." - Edsger Dijkstra 23

In testing we develop test cases and define scenarios, it is not possible to have all scenarios. 24

Theorem All numbers are less than

Two strings are equal Test cases isEqual(“cat”, “Dog”); Expected outcome False isEqual(“testing”, “testing”); Expected outcome true isEqual(“house”, “home”); Expected outcome False 26

Equal = strlen(string1) == strlen(string2) If(equal) for(i = 0; i<strlen(string1); i++) equal = string1[i] == string2[i]; return equal 27

Structures of a program 28

29

How Formal Methods are applied? We develop models of system. With the help of models we will argue and prove correctness of models. 30

Dijkstra’s Game 31

Dijkstra’s game contd.. Consider the following game to be played by a single person with an jar and as many w white balls and b black balls as he needs. To begin with, an arbitrary positive number of balls is put into the jar and as long as the jar contains two or more balls, the player repeats the following moves: he shakes the jar and, without looking, he takes two balls from the jar; 32

Dijkstra’s game contd.. Rule 1 : if those two balls have the same color, he throws one black ball into the jar. Rule 2 : otherwise he returns one white ball into the jar. Because each move decreases the total number of balls into the jar by 1, the game is guaranteed to terminate after a finite number of moves and it is not difficult to see that the game ends with exactly 1 ball in the jar. 33

The question is What can we say about the color of the final ball when we are given the initial contents of the jar? Difficult to answer. Lets play the same game with different number of balls. 34

Summary Formal methods are used to ensure correctness and reliability of software systems Formal methods are based on mathematical models. Formal methods are difficult to apply but results are fruitful. Formal methods does not mean we are programming a part of the system. We are verifying the system correctness using formal methods. 35