Table Of ContentEATCS
Monographs on Theoretical Computer Science
Volume 21
Editors: W Brauer G. Rozenberg A. Salomaa
Advisory Board: G. Ausiello M. Bray S. Even
1. Hartmanis N. Jones T. Leighton M. Nivat
C. Papadimitriou D. Scott
Hartmut Ehrig Bernd Mahr
Fundamentals of
Algebraic Specification 2
Module Specifications and Constraints
Springer-Verlag Berlin Heidelberg NewY ork
London Paris Tokyo Hong Kong
Authors
Prof. Dr. Hartmut Ehrig
Prof. Dr. Bernd Mahr
Technische Universitat Berlin
FB 20 (lnformatik)
Franklinstrasse 28129,0-1000 Berlin 10, Germany
Editors
Prof. Dr. Wilfried Brauer
Institut fUr Informatik, Technische Universitat Munchen
Arcisstr. 21,0-8000 Munchen 2, FRG
Prof. Dr. Grzegorz Rozenberg
Institute of Applied Mathematics and Computer Science
University of Leiden, Niels-Bohr-Weg 1, P.O. Box 9512
NL-2300 RA Leiden, The Netherlands
Prof. Dr. Arto Salomaa
Department of Mathematics, University ofTurku
SF-20500 Turku 50, Finland
ISBN-13:978-3-642-64776-5 e-ISBN-13:978-3-642-61284-8
DOr: 10.1007/978-3-642-61284-8
Library of Congress Cataloging-in-Publication Data
(Revised for volume 2)
Ehrig, Hartmut.
Fundamentals of algebraic specitication.
(EATCS monographs on theoretical computer science; v. 6, 21)
Includes bibliographies and indexes.
Contents: I. Equations and initial semantics --2. Module specifications and constraints.
I. Data structures (Computer science) 2. Algebra.
I. Mahr, B. (Bernd) II. Algebraic specification.
I II. Title. IV. Series. V. Series: EATCS monographs on theoretical computer science;
v. 6, etc.
QA76.9.D35E37 1985 005.7'3'01512 85-4784
IS B N-13:978-3-642-64776-5
This work ist subject to copyright. All rights are reserved, whether the whole or part of the
material is concerned, specifically the rights oft ranslation, reprinting, re-use of illustrations,
recitation, broadcasting, reproduction on microfilms or in other ways, and storage in data
banks. Duplication of this publication or parts thereof is only permitted under the pro
visions of the German Copyright Law of September9, 1965, in its version of June 24, 1985,
and a copyright fee must always be paid. Violations fall under the prosecution act of
the German Copyright Law.
© Springer-Verlag Berlin Heidelberg 1990
Softcover reprint of the hardcover 1st edition 1990
The use of registered names, trademarks, etc. in this publication does not imply, even in the
absence of a specific statement, that such names are exempt from the relevant protective
laws and regulations and therefore free for general use.
2145/3020-543210 -Printed on acid-free paper
PREFACE
Since the early seventies concepts of specification have become central in
the whole area of computer science. Especially algebraic specification
techniques for abstract data types and software systems have gained
considerable importance in recent years. They have not only played a
central role in the theory of data type specification, but meanwhile have
had a remarkable influence on programming language design, system
architectures, arid software tools and environments.
The fundamentals of algebraic specification lay a basis for teaching,
research, and development in all those fields of computer science where
algebraic techniques are the subject or are used with advantage on a
conceptual level. Such a basis, however, we do not regard to be a synopsis
of all the different approaches and achievements but rather a consistently
developed theory. Such a theory should mainly emphasize elaboration of
basic concepts from one point of view and, in a rigorous way, reach the
state of the art in the field. We understand fundamentals in this context as:
1. Fundamentals in the sense of a carefully motivated introduction to
algebraic specification, which is understandable for computer scientists and
mathematicians.
2. Fundamentals in the sense of mathematical theories which are the basis
for precise definitions, constructions, results, and correctness proofs.
3. Fundamentals in the sense of concepts from computer science, which are
introduced on a conceptual level and formalized in mathematical terms.
The worldwide activities in the field of algebraic specification and the fact
that work in this field has been done for more than 15 years now have led
to a large body of knowledge and techniques which, despite restriction to
just one view, cannot be presented in a single volume. Even to elaborate
rather than merely to sketch the fundamentals requires more space for
presentation than is available in a single volume. We have therefore
organized the material in three volumes with the following subtitles:
VI Preface
Volume 1: Equations and Initial Semantics
Volume 2: Module Specifications and Constraints
Volume 3: First Order Axioms and Specification Logics
Volume 1, which appeared in 1985 as No.6 of this series of EATCS
Monographs on Theoretical Computer Science, is devoted to the basics of
algebraic specifications in the nonparameterized and the parameterized case
with emphasis on initial semantics.
Volume 2, the present one, studies module specifications and their
interconnections as a means for the algebraic specification of modular
systems and their structuring. Constraints are the other topic of this
volume; their study is motivated from their need in module specifications.
Volume 3, which is in preparation and planned to appear within the next
few years, will be devoted to generalizations of the equational approach
and will study general first order specifications and their semantics, the
specification of partial structures and specifications with nontrivial sort
disciplines such as order sorted specifications. Also institutions and
abstract specification logics will be studied.
Let us mention here that a particular formulation in the bibliographic notes
of our first volume gave rise to a long lasting dispute between the authors
and J.A. Goguen and J. Meseguer. A clarification of the standpoints is
published in the EATCS Bulletin No. 30 dated October 1986. Here we
want to repeat that we regret that our formulations were considered
offensive; that was never our intention. We understand the work of all of
us as directed to a common goal and have no reason at all to detract from
the merits of each others' contributions.
Like Volume 1, this Volume 2 is divided into 8 chapters in its main part
and 2 further chapters in its appendix. Chapters are numbered using
arabic numerals, while the sections of a chapter are subindexed by capital
letters. As in Volume 1, concepts, definitions, facts, theorems, and
examples are numbered consecutively in each chapter by subindexing with
arabic numerals. Some chapters have an annex for bibliographic notes. A
final bibliography and a subject index conclude the volume. Chapter 1
serves as an informal introduction and may be read to see the basic motives
for the algebraic treatment of module specifications. Chapters 2, 3, 5, 7
and 8 contain the main technical parts of the book, while in Chapters 4 and
6 guidelines for a more abstract categorical theory are presented together
with further applications which are given in less detail. Chapter 9 in the
appendix introduces abstract versions of the languages ACT ONE and ACT
TWO, while Chapter 10 collects basic notions from Volume 1 and from
category theory as a help for reading the technical parts.
Preface VII
Part of the material of this book has been used in courses at the computer
science department of the Technical University Berlin. The major body of
the material was developed in close cooperation with other researchers (see
introduction below) and was supported by the DFG (Deutsche
Forschungsgemeinschaft) and the cooperation agreement between USC
(University of Southern California, U.S.A.) and the Technical University
Berlin.
Weare most grateful to many colleagues for common research and
stimulating discussions on the subject of this book. We are indebted to G.
Rozenberg for his engaged editorial guidance and his insistence on a
nonstarving and fair refereeing process. In this regard we want to express
our gratitude to the unknown referees for their most valuable comments
which, as in the ftrst volume, led to significant changes and a considerably
improved final version of this book. We also thank Springer-Verlag for
the support of our plans.
The manuscript of this volume was typed by Helga Barnewitz whose
excellent work we admire and to whom we are most grateful. Proof
reading was done by Ingo ClaBen, Cristian Dimitrovici, Werner Fey,
Martin GroBe-Rhode, Horst Hansen, Dorothea Helms, Michael Lowe, Fritz
Niirnberg and Francesco Parisi-Presicce. As members or cooperators of
our groups they contributed in various most valuable ways to this book.
Many thanks to all of them.
Berlin, September 1989 Hartmut Ehrig
Bernd Mahr
CONTENTS
Introduction. ..•.•.• ..•... •••.....••• ••.••••.•.••.••... ..... •••.••.. .... 1
1 Informal Introduction to Abstract Modules ......................... 9
lA: Towards Modularization in Software Development .......... ..... 11
IB: Modules and Modularization in Programming and
Specification Languages ..................................................... 16
lC: Concepts for Abstract Modules and Modular Systems ............ 23
ID: Informal Introduction to Algebraic Specification of
Modules and Modular Systems ........................................... 29
IE: Abstract Data Types and Abstract Modules ........................... 41
IF: Bibliographic Notes ................ ...................................... ..... 49
2 Module Specifications ........................................................... 51
2A: Syntax of Module Specifications ......................................... 52
2B: Restriction Construction and Conservative Functors.............. 59
2C: Semantics and Correctness of Module Specifications ....... ...... 66
2D: Modular Specification of an Airport Schedule: Part 1 ...... ...... 77
3 Basic Operations on Module Specifications .......•............ 91
3A: Composition ...................................................................... 93
3B: Union ............................................................................... 105
3C: Actualization ..................................................................... 119
3D: Distributive Laws .............................................................. 126
3E: Modular Specification of an Airport Schedule System: Part 2 137
X Contents
4 General Operations on Module Specifications ................. 143
4A: General Notion of Operations ............................................. 144
4B: Clean Operations ............................................................... 153
4C: Renaming, Partial Composition and Recursion ..................... 157
4D: Product and Iteration ......................................................... 166
4E: Bibliographic Notes for Chapters 2, 3, and 4 ........................ 174
5 Refinement, Interface Specifications, and Realizations ..... 177
5A: Refinement ....................................................................... 179
5B: Interface Specifications ...................................................... 193
5C: Realization ........................................................................ 202
5D: Modular Specification of an Airport Schedule System: Part 3 217
6 Development Categories, Simulation, and Transformation .. 223
6A: Development Categories ..................................................... 225
6B: Compatibility of Operations with Development Steps ............ 235
6C: Simulation ........................................................................ 251
6D: Transformations ................................................................ 257
6E: Bibliographic Notes for Chapters 5 and 6 ............................. 262
7 Constraints ............................................................ 263
7 A: Concepts of Constraints ...................................................... 265
7B: Logic of Constraints .......................................................... 275
7C: Specifications with Constraints ............................................ 282
7D: Parameterized Specifications with Constraints ....................... 292
8 Module Specifications and Operations with Constraints .... 303
8A: Module Specifications with Constraints ................................ 305
8B: Composition with Constraints ............................................. 313
8C: Union with Constraints ...................................................... 325
8D: Actualization with Constraints ............................................. 330
8E: Modular Specification of an Airport Schedule System: Part 4 337
8F: Discussion and Bibliographic Notes for Chapters 7 and 8 ....... 345
Contents XI
Appendix ................................................................... 349
9 Abstract ACT ONE and ACT TWO .............................. 351
9A: Abstract Specifications with Constraints ............................... 352
9B: Abstract ACT ONE ........................................................... 363
9C: Abstract ACT TWO ........................................................... 372
9D: Modular Specification of an Airport Schedule System: Part 5 380
9E: Bibliographic Notes for Chapter 9 ....................................... 382
10 Summary of Basic Notions ........................................ 385
lOA: Summary of Equational Specifications ................................. 386
lOB: Summary of Parameterized Specifications ............................ 389
lOC: Basic Concepts from Category Theory ................................. 393
Bibliography ............................................................... 403
Subject Index .............................................................. 423
INTRODUCTION
In this second volume on fundamentals of algebraic specification we introduce two
important new concepts: module specifications and constraints. These concepts are
motivated by problems in practical software development and are studied here from
a theoretical point of view.
Modularization is one of the main structuring principles in software development.
Modules and module specifications can be seen as the basic building blocks which are
used in modularization of software systems and software system specification
respectively.
Constraints, on the other hand, are introduced to increase the expressive power of
algebraic specifications in order to be more useful for practical applications.
The concept of module specifications in this volume was mainly influenced by
contributions of Parnas [Par 72] and [Par 72a] to data types and modules. Our notion
of module specifications extends that of usual and parameterized algebraic
specifications studied in volume 1 by adding explicit import and export interface
specifications. These additional specifications are again algebraic specifications
consisting of sorts, operation symbols and equations. The semantics of these
interface specifications, however, is not initial but classical, or also called loose.
Initial semantics means that only the initial algebra and hence a unique algebra up to
isomorphism is considered as semantics while classical or loose semantics denotes the
class of all algebras satisfying the given specification.
Equational specifications with loose semantics, however, are of limited use for the
specification of data types and software systems. In order to increase their
expressive power we introduce in addition to equations another logical component,
called constraints, for algebraic specifications.
The concept of constraints is extremely general and allows us to express all kinds of
logical formalisms as well as algebraic conditions concerning the construction of
domains for data types and software systems. The corresponding notion of algebraic
specifications with constraints includes usual algebraic specifications with initial
semantics and also those with loose semantics as special cases.