Formal Specification of Software Systems Lecture Notes Winter Term 2001 / 2002 Heinrich Hußmann Technische Universität Dresden
Formal Specification of Software Systems Summary: Construction of large software systems requires notations and techniques for abstract modelling of software structures. Current development practice mainly relies on diagrammatic, informal notations, but there is a clear long-term trend towards higher formalisation in software specification. This lecture builds a bridge between practically used specification notations from software engineering (like the Unified Modeling Language UML) and pure formal specification approaches based on mathematical logic. This lecture is located right in the middle between the two areas of formal methods and traditional software engineering methods. The lecture deliberately takes a different approach to most textbooks on formal specification. Traditionally, formal methods are presented like a sub-discipline of mathematical logic, with strong emphasis on the mathematical foundations. In this lecture, a pragmatic, application-driven approach to formal concepts is taken. Mathematical definitions and concepts are used only where there is a clear advantage from their usage. Technically, the lecture puts particular emphasis to an algebraic approach for formal system specification, but briefly covers also several other specification formalisms. For the software engineering side, an object-oriented approach based on the UML notation is assumed. The main topics are: general discussion of specification and formality in the software development process introduction into algebraic formal specification languages and related tools using a concrete example language and system (CafeOBJ) very brief introduction into the model-oriented formal specification method "Z" discussion of alternative specification styles in formal specification definition of a formal sub-language of UML and its mathematical semantics introduction into the formal "Object Constraint Language" (OCL) for UML formal methods and quality assurance safety-critical and highly reliable software: standards, certification Page: i
Status of these notes: These notes are supplementary material to lectures hold in winter term 2001/2002 at TU Dresden, based on earlier versions of the lecture held in summer 1999 and summer 2000. These notes cannot replace literature study and lecture attendance. The notes may be subjected to updates announced in the lecture. These notes are for internal use at TU Dresden. It is not allowed to pass on these notes to outside TU Dresden without explicit agreement of the author. Copyright 2001 Heinrich Hußmann, TU Dresden. Literature: B. Meyer, On Formalism in Specifications, IEEE Software, January 1985, pp. 6-26. J. M. Wing, A Specifier s Introduction to Formal Methods, IEEE Computer, September 1990, pp. 8-24. G. Booch, J. Rumbaugh, I. Jacobson, The Unified Modeling Language, A User s Guide, Addison-Wesley 1998. V.S. Alagar, K. Periyasamy, Specification of software systems, Springer 1998. J. Warmer, A. Kleppe, The Object Constraint Language OCL, Addison-Wesley 1999. R. Diaconescu, K. Futatsugi, CafeOBJ Report, World Scientific Publishing 1998. B. Potter, J. Sinclair, D. Till, An Introduction to Formal Specification and Z, 2 nd ed., Prentice Hall 1996. J. B. Wordsworth, Software Development with Z, Addison-Wesley 1992. A. Hall, Seven Myths of Formal Methods, IEEE Software, September 1990, pp. 11-19. Page: ii
Outline: 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 2.1 Large Software Projects 2.2 Models and Modeling from the Software Engineering Point of View 2.3 Application Areas of Specification Languages 3. Algebraic Specification (Abstract Data Types) 3.1 Syntax of Data Types: Signatures 3.2 Algebraic Semantics: Heterogeneous Algebras 3.3 Axiomatic Specification 3.4 Deduction and Evaluation: Tools 3.5 Structured Specifications 3.6 Constructive vs. Observational Specification 4. UML Class Diagrams as a Formal Specification Language 4.1 Object-oriented Specification with the Unified Modeling Language (UML) 4.2 UML Class Diagrams: Formal Syntax and Semantics 4.3 Object-Oriented Specification and Object-Oriented Programs 5. The Object Constraint Language (OCL) for UML 5.1 Object Constraints in OCL: Principles and Syntax 5.2 Formal Semantics of OCL 5.3 Collection Types 5.4 Methodical Use of of OCL 6. Dynamic Models in UML as a Formal Specification Language 6.1 Statecharts 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 Page: iii