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

Similar documents
1 Formal Specification of Software: Why and When?

Formal Specification of Software Systems

Recall from previous lecture

Formal Methods in Software Design. Markus Roggenbach

CHAPTER 1. Topic: UML Overview. CHAPTER 1: Topic 1. Topic: UML Overview

Introduction to Formal Methods

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

Ingegneria del Software Corso di Laurea in Informatica per il Management. Introduction to UML

Lecture #2 on Object-Oriented Modeling

Model Driven Development Unified Modeling Language (UML)

3.4 Deduction and Evaluation: Tools Conditional-Equational Logic

3.0 Object-Oriented Modeling Using UML

Formal Foundations of Software Engineering

Requirements Modelling and Software Systems Implementation Using Formal Languages

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

CISC 322 Software Architecture

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

Combining UML and Z in a Software Process

02291: System Integration

Techniques for the unambiguous specification of software

Unified Modeling Language (UML)

Software Engineering from a

Software Development Methodologies

Course "Softwaretechnik" Book Chapter 2 Modeling with UML

Modeling Issues Modeling Enterprises. Modeling

Lecture 05 ( ) High-Level Design with SysML. Systeme hoher Qualität und Sicherheit Universität Bremen WS 2015/2016

Computing Fundamentals 2 Introduction to CafeOBJ

CSE 308. UML Overview Use Case Diagrams. Reference. Class diagrams. Session 6 UML Intro/Use cases. Robert Kelly, B. Bruegge,

Introduction to Software Engineering. 5. Modeling Objects and Classes

UML big picture. Perdita Stevens. School of Informatics University of Edinburgh

CSC Advanced Object Oriented Programming, Spring Overview

i219 Software Design Methodology 1. Overview of software design methodology Kazuhiro Ogata (JAIST) Outline of lecture

An Annotated Language

Advances in Programming Languages

Lecture 02: Semantical Model

Representing System Architecture

Model Driven Engineering (MDE)

Software Design, Modelling and Analysis in UML

CSE 308. UML Overview Use Case Diagrams. Reference. en.wikipedia.org/wiki/class_diagram. Robert Kelly, B. Bruegge,

Course 3 7 March

Object Oriented Modelling And Design With Uml Solution

Introduction to Axiomatic Semantics

OO Analysis and Design with UML 2 and UP

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

UML Modeling I. Instructor: Yongjie Zheng September 3, CS 490MT/5555 Software Methods and Tools

Object-Oriented Software Engineering Practical Software Development using UML and Java

Lecture 2: Software Engineering (a review)

Formal Methods. CITS5501 Software Testing and Quality Assurance

For 100% Result Oriented IGNOU Coaching and Project Training Call CPD: ,

LESSON PLAN SUB NAME : OBJECT ORIENTED ANALYSIS AND DESIGN UNIT SYLLABUS

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

Outline. Program development cycle. Algorithms development and representation. Examples.

CITS5501 Software Testing and Quality Assurance Formal methods

KINGS COLLEGE OF ENGINEERING

Chapter 10 Formal Specification

Chapter 3. Describing Syntax and Semantics ISBN

UML 2.0 State Machines

Lectures 20, 21: Axiomatic Semantics

Principles of Program Analysis. Lecture 1 Harry Xu Spring 2013

Chapter 3. Describing Syntax and Semantics

Requirements Checking for Object-Oriented Software Design with different Unified Modelling Language (UML) notations

The University of Iowa. 22c181: Formal Methods in Software Engineering. Spring Course Overview

Object-Oriented Analysis and Design. Pre-UML Situation. The Unified Modeling Language. Unification Efforts

System Analysis and Design

Contents. Chapter 1 SPECIFYING SYNTAX 1

Software Development. Modular Design and Algorithm Analysis

Eight units must be completed and passed to be awarded the Diploma.

UNIT II. Syllabus. a. An Overview of the UML: Visualizing, Specifying, Constructing, Documenting

Security Protocols and Infrastructures

The Unified Modelling Language. Example Diagrams. Notation vs. Methodology. UML and Meta Modelling

Improving System Usability Through the Automation of User's Routine Intentions: an Image Edition Tool Case Study

Object-Oriented Analysis Techniques Coad s OOA Technique Short History Terminological Comparison Postscript and Remarks

UML Primer. -Elango Sundaram

Semantics of programming languages

CS 242. Fundamentals. Reading: See last slide

A UML 2 Profile for Variability Models and their Dependency to Business Processes

Introductory logic and sets for Computer scientists

C++ Programming Language Lecture 2 Problem Analysis and Solution Representation

Introduction. Chapter 1. What Is Visual Modeling? The Triangle for Success. The Role of Notation. History of the UML. The Role of Process

Flight Systems are Cyber-Physical Systems

Chapter 3 (part 3) Describing Syntax and Semantics

UMLEmb: UML for Embedded Systems. I. Introduction. Ludovic Apvrille Eurecom, office 470

Informal Semantics of Data. semantic specification names (identifiers) attributes binding declarations scope rules visibility

Introduction to Software Engineering. 5. Modeling Objects and Classes

Matching Logic A New Program Verification Approach

A Hoare Logic Contract Theory: An Exercise in Denotational Semantics

Lesson 10. Student Outcomes. Lesson Notes

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

Unified Modelling Language

Conceptual Database Modeling

1.1 Software Life Cycle

Software Engineering Lab Manual

Objectives. UML Extension Mechanisms. What is UML? Is the UML enough? UML Extension Mechanisms. Specifications. By Jasmine Farhad

Formal Methods for Software Engineers

Theory of Computer Science

Specification with OCL

Semantics. There is no single widely acceptable notation or formalism for describing semantics Operational Semantics

UML part I. UML part I 1/41

Hoare logic. A proof system for separation logic. Introduction. Separation logic

Semantics of programming languages

Transcription:

Formal Specification of Software Systems Heinrich Hußmann TU Dresden A Comparison "Formal specifications may become for software engineers what, say, differential equations are for engineers of other fields." Bertrand Meyer Organisational Issues Two-fold lecture For Computational Logic:» broaden ing the area towards software engin eering For Vertiefungsrichtun g Softwaretechn ologie» lecture on specialised topic in software engineering» Germans: please ask for help when required! Exercises: A few theoretical exercises A lot of project work in the lab (details announced later) Computational logic students: examination through lab project Supporting material on the web: http://www-st.inf.tu-dresden.de/fs» Slides in PDF format» Lecture n otes in PDF format Sorry, no lecture on December 4. Seite 1

Outline (1) 1. Formal Specification of Software: Why and When? 1.1 Purpose of Specifications 1.2 Specification Examples 1.3 Formality 1.4 Overview of Formal Specification Languages 1.5 Reminder on Mathematical Notation 2. Software Models in Software Engineering (mainly for CL!) 2.1 Large Software Projects 2.2 Models and Modeling form the Software Engineering Point of View 2.3 Application Areas of Specification Languages 3. Algebraic Specification (Abstract Data Types) 3.1 Syn tax of Data Types: Signatures 3.2 Algebraic Seman tics: Heterogeneous Algebras 3.3 Axiomatic Specification 3.4 Deduction and Evaluation: Tools 3.5 Structu red Specifications 3.6 Constructive vs. Observational Specification Outline (2) 4. UML Class Diagrams as a Formal Specification Language 5.1 Object-oriented Specification with the Unified Modelin g Language (mainly for CL!) 5.2 UML Class Diagrams: Formal Syntax and Semantics 5.3 Object-oriented Specification and Object-oriented Programs 5. The Object Constraint Language (OCL) for UML 5.1 Object Constraints i n OCL: Princiuples and Syntax 5.2 Formal Semantics of OCL 5.3 Collection Types 5.4 Meth odical Use of of OCL 6. Dynamic Models in UML as a Formal Specification Language 6.1 Statech arts in UML: Sketch of Formal Semantics 6.2 State Models and OCL 6.3 Sequence Diagrams in UML: Sketch of Formal Semantics 7. Outlook 7.1 Overview of the Formal Specification Language Z 7.2 IT Security and Formal Specification 7.3 Practical Usability of Formal Methods Waterfall Model (and Effort Distribution) Analysis 10 % Design 20 % Implementation 20 % 50 % Test, Integration Maintenance Seite 2

Why do we need specifications? High level management of projects Development contracts rely on specifications. Procurement decisions rely on specifications. Detailed management of projects: Resource planning is in trinsically related to specifications. The same hold for time planning, of course. Specifications are key to software documentation, software u nderstanding, software adaptation. Languages for Specification Practice: natural language & graphical notations functional aspect: global functional aspects: data flow diagrams, use case diagrams local functional aspects: "pseu do-code" structural aspect: class diagrams, entity-relationship diagrams, block diagrams, physical deployment diagrams dynamic aspect: state machines (with in/output) behavioural aspect: interface definition languages, sequence diagrams, process descriptions non-functional aspect: tables with measurable values development process aspect: workflow description formalisms Unified Modeling Language UML OOD Booch OOSE Jacobson OMT Rumbaugh et al. 1995: Booch / Rumbaugh / Jacobson 1997: UML 1.1 1999: UML 1.3 2001: UML 1.4 2002: UML 2.0 UML is a 2nd generation language for object-oriented modelling UML is industry standard of OMG (Object Management Group) Originally developed by the company "Rational" Seite 3

Specification from the "formal" viewpoint B.Meyer, On Formalism in Specifications: "Specification is the software lifecycle phase concerned with precise definition of the tasks to be performed by the system." For most of this lecture: specification =» problem, design or module/class usage» functional aspect There are other variants of specifications which can be treated formally as well. The Seven Sins of the Specifier Noise (dt. Rauschen) Remorse (dt. Reue bzw. Nachtrag) Silence (dt. Schweigen bzw. Auslassung) Contradiction (dt. Widerspruch) Overspecification (dt. Überspezifikation) Ambiguity (dt. Mehrdeutigkeit) Forward reference (dt. Vorwärtsverweis) Wishful thinking (dt. Wunschdenken) Example Specification (1) The program s input is a stream of characters whose end is signaled with a special end-of-text character, ET. There is exactly one ET character in each input stream. Characters are classified as: break characters BL (blank) or NL (new line); nonbreak characters all others except ET; the end-of-text indicator ET. A word is a nonempty sequence of nonbreak characters. A break is a sequence of one or more break characters. Thus, the input can be viewed as a sequence of words separated by breaks, with possibly leading and trailing breaks, and ending with ET. Seite 4

Example Specification (2) The program s output should be the same sequence of words as in the input, with the exception that an oversize word (i.e. a word containing more than MAXPOS characters, where MAXPOS is a positive integer) should cause an error exit from the program (i.e. a variable, Alarm, should have the value TRUE). Up to the point of an error, the program s output should have the following properties: 1. A new line should start only between words and at the beginning of the output text, if any. 2. A break in the input is reduced to a single break character in the output. 3. As many words as possible should be placed on each line (i. e. between successive NL characters). 4. No line may contain more than MAXPOS characters (words and BLs). Meyer's mathematical specification (excerpt) Short breaks. Let a be a sequence of characters. We define SINGLE_BREAKS(a) as the set of subsequences of a such that no two consecutive characters are break characters. SINGLE_BREAKS(a) = def {s SUBSEQUENCE(a) i 2..length(s) s(i 1) BREAK_CHAR s(i) BREAK_CHAR} Next, we define COMPACTED(a) as the subset of SINGLE_BREAKS(a) containing those sequences of maximum length: COMPACTED(a) = def MAX_SET(SINGLE_BREAKS(a), length) UML Use Case Diagram format text <<include> <<include> break lines fill lines reduce breaks <<include> Seite 5

Motivation for Formal Specification Formal specification languages intend to achieve the same level of precision as a purely mathematical approach apply structuring concepts known from programming languages make specifications machine-processable keep the specifications as readable as possible. In general, special education will always be required to deal with high-precision specifications. Formality Definition: A language is called formal if it has a precisely defined semantics that relates the syntactical form of a specification in the language with a precisely defined semantic domain. A language is informal if it is not formal, i.e. if its semantics rely on human interpretation of the specifications, in particular on the chosen identifiers. A language is semi-formal if it contains formal as well as informal sublanguages or language layers. Warning: The above definition is the theoretician s view. For most practicians, however, everything is formal which puts some restriction onto the form of the text/diagram being written! Formal Specification Language Definition A formal specification language is a triple <Syn, Sem, Sat> where Syn and Sem are sets and Sat Syn Sem is a relation between them. Syn is called the syntactic domain of the language, Sem is called its semantic domain and Sat is called its satisfaction relation. Seite 6

Application Areas for Formal Specification Highly reliable systems for safety-critical applications Small but extremely important area Definition of standards Local enhancements of semi-formal specifications The best of both worlds. Contract-proof definition of black box software (componentware) Increasing importance as software becomes the subject of lawsuits Semantics definition for semi-formal specification languages History of Formal Specification Languages 1970 1980 1990 Hoare logic Dijkstra calculus Abstract data types Clear VDM Larch OBJ Z B CafeOBJ Maude CASL Seite 7