Formal Methods. Introduction Today's software comes with extensive documentation: –user guides, reference, manuals, and design documents. –There are on-line.

Slides:



Advertisements
Similar presentations
(nothing to see here). First thing you need to learn is that sysadmin is about people, not technology If youre a sysadmin so you dont have to deal with.
Advertisements

25 February 2009Instructor: Tasneem Darwish1 University of Palestine Faculty of Applied Engineering and Urban Planning Software Engineering Department.
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.
HCI in the software process Chapter 6
Evaluating Requirements. Outline Brief Review Stakeholder Review Requirements Analysis Summary Activity 1.
S.T.A.I.R.. General problem solving strategy that can be applied to a range problems.
Summaries of brainstorm tutorials lesterk.myweb.port.ac.uk/inse/storms.
CSCU 411 Software Engineering Chapter 2 Introduction to Software Engineering Management.
Philosophy 120 Symbolic Logic I H. Hamner Hill CSTL-CLA.SEMO.EDU/HHILL/PL120.
Introduction to Software Engineering Dr. Basem Alkazemi
Polya’s Four Step Problem Solving Process
Introduction to Software Engineering
CS350/550 Software Engineering Lecture 1. Class Work The main part of the class is a practical software engineering project, in teams of 3-5 people There.
Object-Oriented Analysis and Design Lecture 11 Maintenance (from Schach, “O-O and Classical Software Engineering”)
Describing Syntax and Semantics
School of Computer ScienceG53FSP Formal Specification1 Dr. Rong Qu Introduction to Formal Specification
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 4 Slide 1 Software Processes.
©Ian Sommerville 2000 Software Engineering, 6th edition. Chapter 5 Slide 1 Requirements engineering l The process of establishing the services that the.
Software Documentation Written By: Ian Sommerville Presentation By: Stephen Lopez-Couto.
DCT 1123 PROBLEM SOLVING & ALGORITHMS INTRODUCTION TO PROGRAMMING.
Test Driven Development An approach to writing better code Jimmy Zimmerman Intel Corporation.
Intro to Discrete Structures
Abstraction IS 101Y/CMSC 101 Computational Thinking and Design Tuesday, September 17, 2013 Carolyn Seaman University of Maryland, Baltimore County.
© Janice Regan, CMPT 128, Jan CMPT 128 Introduction to Computing Science for Engineering Students Creating a program.
Testing. Definition From the dictionary- the means by which the presence, quality, or genuineness of anything is determined; a means of trial. For software.
GENERAL CONCEPTS OF OOPS INTRODUCTION With rapidly changing world and highly competitive and versatile nature of industry, the operations are becoming.
Prologue: The Software Process. Main Phases of Software Process 1. Requirements Analysis (answers “WHAT?”) Specifying what the application must do 2.
Chapter 4 – Requirements Engineering
Course: Software Engineering © Alessandra RussoUnit 1 - Introduction, slide Number 1 Unit 1: Introduction Course: C525 Software Engineering Lecturer: Alessandra.
Introduction CS 3358 Data Structures. What is Computer Science? Computer Science is the study of algorithms, including their  Formal and mathematical.
CS 350 – Software Design The Object Paradigm – Chapter 1 If you were tasked to write code to access a description of shapes that were stored in a database.
Getting SQL Right the First Try (Most of the Time!) May, 2008 ©2007 Dan Tow, All rights reserved SingingSQL Presents.
Databases From A to Boyce Codd. What is a database? It depends on your point of view. For Manovich, a database is a means of structuring information in.
Software Life Cycle Requirements and problem analysis. –What exactly is this system supposed to do? Design –How will the system solve the problem? Coding.
Overview of Formal Methods. Topics Introduction and terminology FM and Software Engineering Applications of FM Propositional and Predicate Logic Program.
Symbolic Language and Basic Operators Kareem Khalifa Department of Philosophy Middlebury College.
Dr. Shazzad Hosain Department of EECS North South Universtiy Lecture 04 – Part A Knowledge Representation and Reasoning.
Software Development Process.  You should already know that any computer system is made up of hardware and software.  The term hardware is fairly easy.
Introduction CS 3358 Data Structures. What is Computer Science? Computer Science is the study of algorithms, including their  Formal and mathematical.
Algorithms CS139 – Aug 30, Problem Solving Your roommate, who is taking CS139, is in a panic. He is worried that he might lose his financial aid.
Intermediate 2 Software Development Process. Software You should already know that any computer system is made up of hardware and software. The term hardware.
C++ Basics C++ is a high-level, general purpose, object-oriented programming language.
Software Engineering Principles. SE Principles Principles are statements describing desirable properties of the product and process.
1 Design and Integration: Part 2. 2 Plus Delta Feedback Reading and lecture repeat Ambiguous questions on quizzes Attendance quizzes Boring white lecture.
The Software Development Process
© 2006 Pearson Addison-Wesley. All rights reserved 2-1 Chapter 2 Principles of Programming & Software Engineering.
Informative vs Argumentative. What do you think? What is the root word in informative? What is the root word in argumentative?
Intermediate 2 Computing Unit 2 - Software Development.
Smart Home Technologies
1 Propositional Logic: Fundamental Elements for Computer Scientists 0. Motivation for Computer Scientists 1. Propositions and Propositional Variables 2.
Evaluating Requirements
Algorithms CS280 – 10/20/05. Announcement  Part 1 of project 2 due.  Read chapters 10, 7 for this unit  Tuesday we will also be in the classroom We.
Requirement engineering & Requirement tasks/Management. 1Prepared By:Jay A.Dave.
Why Cryptosystems Fail R. Anderson, Proceedings of the 1st ACM Conference on Computer and Communications Security, 1993 Reviewed by Yunkyu Sung
1 The Software Development Process ► Systems analysis ► Systems design ► Implementation ► Testing ► Documentation ► Evaluation ► Maintenance.
Observing the Current System Benefits Can see how the system actually works in practice Can ask people to explain what they are doing – to gain a clear.
CMSC 2021 Software Development. CMSC 2022 Software Development Life Cycle Five phases: –Analysis –Design –Implementation –Testing –Maintenance.
Lecture 3: Rules of Evaluation CS150: Computer Science
Course: Software Engineering – Design I IntroductionSlide Number 1 What is a specification Description of a (computer) system, which:  is precise;  defines.
Announcements Assignment 2 Out Today Quiz today - so I need to shut up at 4:25 1.
Software Development. The Software Life Cycle Encompasses all activities from initial analysis until obsolescence Analysis of problem or request Analysis.
 System Requirement Specification and System Planning.
Software Engineering Salihu Ibrahim Dasuki (PhD) CSC102 INTRODUCTION TO COMPUTER SCIENCE.
Software Development.
Databases.
Types for Programs and Proofs
Systems Analysis and Design
Algorithm and Ambiguity
Algorithm and Ambiguity
The Software Development Cycle
Presentation transcript:

Formal Methods

Introduction Today's software comes with extensive documentation: –user guides, reference, manuals, and design documents. –There are on-line help systems, interactive tutorials, and user friendly. Yet the behavior of software is often a surprise to users and designers. –Components interact and interfere, undesirable properties emerge, and systems fail to meet their requirements.

Introduction The more spectacular consequences make the headlines: –aircraft crash, trains collide, people receive fatal doses of radiation, and emergency telephone services are withdrawn. The less spectacular we face every day: –time is wasted, effort is expended to no avail, important projects are scrapped, and our health is damaged by sheer frustration.

Introduction There are many explanations for this: –the requirements upon a piece of software are hard to define –the ways in which a system may be used are hard to anticipate –there is always a demand for additional functionality. –Indeed, the fact that many pieces of software actually work, and work well, is some indication of the skill of those whose job it is to develop them.

Introduction One way to improve the quality of software is to change the way in which software is documented: –at the design stage, during development, and after release. Existing methods of documentation offer large amounts of text, pictures, and diagrams, but these are often imprecise and ambiguous. Important information is hidden amongst irrelevant detail, and design flaws are discovered too late, making them expensive or impossible to correct.

Formal Methods Formal methods, based upon elementary mathematics, can be used to produce precise, unambiguous documentation, in which information is structured and presented at an appropriate level of abstraction. This documentation can be used to support the design process, and as a guide to subsequent development, testing, and maintenance.

Formal Methods The mathematical basis is different from that of civil or mechanical engineering, but it has the same purpose: –to add precision, to aid understanding, and to reason about properties of a design. Whatever the discipline, the use of mathematics can be expensive, but it can actually reduce costs.

Formal Methods Existing applications of formal methods include: –the use of probability theory in performance modeling –the use of context-free grammars in compiler design –the use of the relational calculus in database theory The formal method has been used in the specification and design of large software systems.

The course: Z Module Descriptor Formal methods: what they’re used for and why it’s important Two great inventions of the last 4000 years: logic and set theory Basic vocabulary: relations, functions, sequences, bags, schemas Structure of a specification Things to do to your spec: refinement and decomposition Things to get from your spec: prototype implementation from specifications The Z Specification Language

The Z module: learning outcomes Fluently express yourself in Z. Fluently translate conversation into and out of Z. Reason about Z specifications. Look at a Z specification and say ‘yes, that’s right’ or ‘no, that’s wrong

References Material E. Currie “The essence of Z J. Jacky “The way of Z”. D. Lightfoot “Formal Specification Using Z” M. Spivey “Understanding Z”

Software Crisis We don’t know how to write software. Lot’s of really bad software gets written — not all of it by incompetents though they do their fair share. There are many reasons for this. It’s economically advantageous to ship buggy software today rather than flawless software tomorrow. The manager of the software team is a class A idiot. What you’re trying to program is actually impossible. We must conform to poor standards (i.e. bugs in Internet Explorer). We don’t know what we’re writing.

We don’t know what we’re writing?? It’s just hard to specify unambiguously what we want, and even harder to specify how we should make sure it happens.

Example: the flag on the 14th of August Put a flag up outside your home on the 14th August. Looks pretty simple, doesn’t it?

The flag on the 14th of August Does that mean midnight to midnight, or just during the day? Do you mean exactly midnight to midnight, at least midnight to midnight, or at most midnight to midnight — or dawn to dusk — or dawn to dawn? What if you put it up and the flag falls down? Does that count? Are you authorised to put the flag up twice (e.g. if it fell down)?

The flag on the 14th of August What does ‘your home’ mean? What if you have two homes? What if your home is being redecorated and you’re in a hotel? Do you put flags in all your homes, or just your one? Do you have to do it, or can your spouse do it for you?

The flag on the 14th of August Suppose you have a flag up all year. Do you have to take it down so you can put it up?

The flag on the 14th of August What is a flag anyway? What size? What if the colors are faded, or it’s muddy? Does it have to be somewhere people can see it? Does it have to be a Pakistan flag, or will any flag do? An Indonesian Flag? A Russian flag? A flag you made up yourself?

The flag on the 14th of August What if you steal a flag? Does that count? What if you have bought the house but you have not yet signed the completion. Who’s responsible for the flag: the seller or the buyer?

The problem of specification You are a professional programmer instructed to “write a program to put up a flag outside the customer’s house on the 14th of August”. Do you have enough information? You have bought a software library. Documentation states “this procedure puts up a flag outside the customer’s house on the 14th of August”. Can you use this procedure without reading its code? You are managing a software project. Legacy code states “this procedure puts a flag outside the customer’s house on the 14th of August”. You want to update this to account for time zones across the world. Do you have enough information to proceed?

We Need a Solution! Sorry, there is no solution. Z is not the solution, it is an attempt at a partial solution. The Z specification language helps us specify these things exactly. In this course you will learn to write specifications.

What is a specification? For this talk, a specification is a formal statement of something. “You should put a flag up outside your home on the 14th August” is not a formal specification. Different levels of abstraction are possible, obviously. The more detailed they are, the more of the pedantic questions they answer. The most detailed specification is the (arguably) the program itself A formal specification of our problem can be something like: –“Breathe in... breathe out... take the key from near the back door... use it to open the shed in the garden... take the flag from the metal cupboard on the left... etcetera.”

Logic A proposition is a statement to which we can assign truth-value. There are just two truth-values: –true (written T) and –false (written F).

Logic

Example non-propositions Questions: Is it raining? Commands: Breathe in... breathe out! Instructions: x := x + 1. Numbers: 2. Nonsense jumble of letters: All your base are belong to us. Oxford is a worthwhile university.

Combining propositions What if you want to say more than one thing??? For example, suppose that you want a proposition to express: –It’s raining, and –There exists a species of flightless bird.

Propositions

Warning: things get tricky here. Remember that propositions get assigned truth-values. –When is P ^ Q assigned truth-value true? –When is P _ Q assigned truth-value true? –... and so on. The truth-values depend on the truth- values of P and Q:

Truth Tables

Conventions

More Truth Tables

Is (P ^ Q) ^ R the same as P ^ (Q ^ R)?

Some special propositions

Some tautologies