LECTURE 6: INTRODUCTION TO FORMAL METHODS. Software Engineering Mike Wooldridge

Similar documents
Intro to semantics; Small-step semantics Lecture 1 Tuesday, January 29, 2013

Formal Foundations of Software Engineering

Introduction to Formal Methods

Chapter 10 Formal Specification

1.1 Software Life Cycle

Q Body of techniques supported by. R precise mathematics. R powerful analysis tools. Q Rigorous, effective mechanisms for system.

A Michael Jackson presentation. CSE503: Software Engineering. The following slides are from his keynote at ICSE 1995

2.4 The Z Notation. [Reference: M. Spivey: The Z Notation, Prentice Hall] Modellbasierte Softwareentwicklung

Topic Formal Methods. ICS 121 Lecture Notes. What are Formal Methods? What are Formal Methods? Formal Specification in Software Development

Techniques for the unambiguous specification of software

Formal Methods in Software Design. Markus Roggenbach

FORMALIZED SOFTWARE DEVELOPMENT IN AN INDUSTRIAL ENVIRONMENT

! Use of formal notations. ! in software system descriptions. ! for a broad range of effects. ! and varying levels of use. !

ΗΜΥ 317 Τεχνολογία Υπολογισμού

CITS5501 Software Testing and Quality Assurance Formal methods

LECTURE 8: SETS. Software Engineering Mike Wooldridge

Formal Methods. CITS5501 Software Testing and Quality Assurance

Requirements Modelling and Software Systems Implementation Using Formal Languages

RAISE in Perspective

Advances in Programming Languages

Comparative Analysis of Formal Specification Languages Z, VDM and B

Formal Specification. Ian Sommerville 2006 Software Engineering, 8th edition. Chapter 10 Slide 1

Theorem proving. PVS theorem prover. Hoare style verification PVS. More on embeddings. What if. Abhik Roychoudhury CS 6214

Hoare Logic. COMP2600 Formal Methods for Software Engineering. Rajeev Goré

Contents. Chapter 1 SPECIFYING SYNTAX 1

Formal Methods for Software Engineers

3.4 Deduction and Evaluation: Tools Conditional-Equational Logic

The semantics of a programming language is concerned with the meaning of programs, that is, how programs behave when executed on computers.

Chapter 3. Semantics. Topics. Introduction. Introduction. Introduction. Introduction

An Annotated Language

An Introduction to ProofPower

Guidelines for Writing Mathematical Proofs

Logic and Computation

Distributed Systems Programming (F21DS1) Formal Verification

Open XML Requirements Specifications, a Xylia based application

Semantics via Syntax. f (4) = if define f (x) =2 x + 55.

Formal Validation of DNA Database Using Theorem Proving Technique

Formal Validation of DNA Database Using Theorem Proving Technique

Computer Science 520/620 Spring 2014 Prof. L. Osterweil" Modeling Data and Types" Software Models and Representations" Part 5"

Chapter 1. Introduction

Computer Science 520/620 Spring 2013 Prof. L. Osterweil" Course Housekeeping" Software Models and Representations" Part 5" Modeling Data and Types"

Computer Science 520/620 Spring 2013 Prof. L. Osterweil" Software Models and Representations" Part 5" Modeling Data and Types" Course Housekeeping"

Methods for requirements engineering

Abstract Specifications: A Review. Algebraic Specification

Engineering and Computer Job Fair

Unit 3: Congruence & Similarity

Fuzzy Concepts and Formal Methods: A Sample Specification for a Fuzzy Expert System

Chapter 27 Formal Specification

Logik für Informatiker Logic for computer scientists

Reasoning About Programs Panagiotis Manolios

Axiomatic Specification. Al-Said, Apcar, Jerejian

Computing Fundamentals 2 Introduction to CafeOBJ

Behavioral Equivalence

Behavioral Equivalence

Z and Hoare Logics. Antoni Diller. Abstract

1 The Axiom of Extensionality

1 Formal Specification of Software: Why and When?

Adventures in Formal Methods at W3C: Using Z Notation to Specify WSDL 2.0

Program Verification & Testing; Review of Propositional Logic

Type Inference Systems. Type Judgments. Deriving a Type Judgment. Deriving a Judgment. Hypothetical Type Judgments CS412/CS413

6.001 Notes: Section 8.1

Proving the Correctness of Distributed Algorithms using TLA

Algebraic Processors

Lectures 20, 21: Axiomatic Semantics

An Evolution of Mathematical Tools

The Formal Semantics of Programming Languages An Introduction. Glynn Winskel. The MIT Press Cambridge, Massachusetts London, England

Introduction to Axiomatic Semantics (1/2)

FUZZY SPECIFICATION IN SOFTWARE ENGINEERING

From Event-B Models to Dafny Code Contracts

7/8/10 KEY CONCEPTS. Problem COMP 10 EXPLORING COMPUTER SCIENCE. Algorithm. Lecture 2 Variables, Types, and Programs. Program PROBLEM SOLVING

Matching Logic A New Program Verification Approach

SMT-LIB for HOL. Daniel Kroening Philipp Rümmer Georg Weissenbacher Oxford University Computing Laboratory. ITP Workshop MSR Cambridge 25 August 2009

Programming Languages Third Edition

Seite 1. "Formal specifications may become for software engineers what, say, differential equations are for engineers of other fields.

Modelling ODP Viewpoints. 1 Introduction. 2 Basic Modelling and Specification Concepts

Lecture 2: Analyzing Algorithms: The 2-d Maxima Problem

Modeling Issues Modeling Enterprises. Modeling

CSC313 High Integrity Systems/CSCM13 Critical Systems. CSC313/CSCM13 Chapter 2 1/ 221

ALGOL 48 AND ALGOL 50 ALGOLIC LANGUAGES IN MATHE- MATICS

AD'-A IS8 1St'~

To prove something about all Boolean expressions, we will need the following induction principle: Axiom 7.1 (Induction over Boolean expressions):

Lecture 1: Overview

The Further Mathematics Support Programme

Handout 9: Imperative Programs and State

To prove something about all Boolean expressions, we will need the following induction principle: Axiom 7.1 (Induction over Boolean expressions):

On the Logical Structure of Mathematical Notation

Bawar Abid Abdalla. Assistant Lecturer Software Engineering Department Koya University

Introduction to Axiomatic Semantics (1/2)

6.001 Notes: Section 6.1

S KN'athteell '\laiy \Valiszewski DEPARTMENT OF THE AIR FORCE AIR UNIVERSITY AIR FORCE INSTITUTE OF TECHNOLOGY. Wright-Patterson Air Force Base, Ohio

Part II. Hoare Logic and Program Verification. Why specify programs? Specification and Verification. Code Verification. Why verify programs?

Semantics of programming languages

Software Engineering: A Practitioner s s Approach, 6/e Roger Pressman. Chapter 28 Formal Methods

Lecture 3: Recursion; Structural Induction

CSE505, Fall 2012, Midterm Examination October 30, 2012

Formal Methods in Software Development

IDP : conga/minisat(id)

6. Hoare Logic and Weakest Preconditions

Lecture 2: Chapter Objectives. Relational Data Structure. Relational Data Model. Introduction to Relational Model & Structured Query Language (SQL)

Java Programming. Zheng-Liang Lu. Java 308 Spring Department of Computer Science & Information Engineering National Taiwan University

Transcription:

LECTURE 6: INTRODUCTION TO FORMAL METHODS Mike Wooldridge

1 What are Formal Methods? Formal methods is that area of computer science that is concerned with the application of mathematical techniques to the design and implementation of computer hardware and (more usually) software. That part of computer science concerned with the application of mathematical methods to the production of computer software. (Jones, 1986) Why bother with formal methods? 1. The correctnesss problem: producing software that is correct is famously difficult; by using rigorous mathematical techniques, it may be possible to make provably correct software. 2. Programs are mathematical objects; they are expressed in a formal language; Mike Wooldridge 1

they have a formal semantics; programs can be treated as mathematical theories. Mike Wooldridge 2

Diller (1988) suggests there are two main parts to formal methods: 1. Formal specification. Using mathematics to specify the desired properties of a computer system. 2. Formal verification. Using mathematics to prove that a computer system satisfies its specification. To which many would add: 3. Automated programming. Automating the process of program generation. Mike Wooldridge 3

Mike Wooldridge 4

ADVANTAGES

Formal methods can eliminate ambiguity. A key problem with informal specifications is the inherent ambiguity of textual descriptions; using mathematics can eliminate such ambiguity. Mathematics is concise. Complex properties can be expressed succinctly. Mathematics offers power. There is little that cannot in some way be described and reasoned about using maths. Mike Wooldridge 6

Maths facilitates proof. The ability to prove properties of a system is potentially very valuable. Formal specifications, etc., can be manipulated by computer. CASE tools; automated specification checkers (e.g., CADIZ); automated programming. Formal methods lead to a deep understanding of systems. The precision and detail required brings a deep understanding of what s going on. Mike Wooldridge 7

Mike Wooldridge 8

OBJECTIONS/MISCONCEPTIONS

Formal methods eliminate the need for testing. People can get get sums wrong! Formal methods eliminate the need for natural language. Ultimately, maths is just symbols: English is needed to relate these symbols to reality. You need a PhD to use formal methods. All maths looks hard until you get used to it... Mike Wooldridge 10

Mike Wooldridge 11

APPROACHES TO FORMAL SPECIFICATION

There are two schools of thought on formal specification: 1. Property based; 2. Model based. Mike Wooldridge 13

Property Based Specification In property based specification, you describe the operations you can perform on a system, and the relationships between operations. A property oriented specification consists of: a signature part which defines the syntax of operations (what parameters they take and return); an equations part, which define the semantics of the operations via a set of equations called axioms. Mike Wooldridge 14

EXAMPLES OF PROPERTY ORIENTED SPECIFICATION TECHNIQUES. algebraic specification of abstract data types (Hoare, 1969). the OBJ language (Futatsugi et al., 1985). Mike Wooldridge 15

Model Based Specification In model based specification, you use the tools of set theory, function theory and logic to build an abstact model of a system. You can then specify the operations that may be performed on your model, either explicitly, or implicitly (in terms of preand post-conditions). The model we construct is: high-level; idealized; free of implementation bias (hopefully!) Mike Wooldridge 16

A model based specification consists of: a definition of the set of states a system may be in; definitions for the legal operations that may be performed on your system, indicating how these change current state. EXAMPLES. the Z specification language (Abrial, 1980; Hayes 1987; Spivey 1988); the VDM (Vienna Development Method) specification language (Jones 1980, 1986). Mike Wooldridge 17

Mike Wooldridge 18

THE Z SPECIFICATION LANGUAGE

The Z specification language is a semi-graphical notation for writing formal specifications. It was developed at Oxford University programming research group in the late 1970s. It has been adopted by IBM as their main formal specification tool (so it s not just an academic toy!) It was used to specify the IBM Customer Information Control System (CICS) a major piece of software. Mike Wooldridge 20

Mike Wooldridge 21

SOFTWARE TOOLS FOR Z

There are at least three software tools for developing Z specifications: FUZZ. Developed at Oxford by Spivey et al, in late 1980s. CADIZ. Developed at York University, also in late 1980s (its what we have here); ZED. Developed at Pennsylvania state University Mike Wooldridge 23

Briefly, CADIZ will: take a Z specification in plain-text (ASCII) form; perform some simple semantic checks on it; typeset ( pretty print ) it, so that the schemas can be printed out; allow simple interactive browsing of specifications. Mike Wooldridge 24