Table Of ContentEATCS
Monographs on Theoretical Computer Science
Volume 6
Editors: W. Brauer G. Rozenberg A. Salomaa
Advisory Board: G. Ausiello S. Even M. Nivat
Chr. Papadimitriou A. L. Rosenberg D. Scott
H. Ehrig B. Mahr
Fundamentals of
Algebraic Specification 1
Equations and Initial Semantics
Springer-Verlag
Berlin Heidelberg New York Tokyo
Authors
Professor Dr. Hartmut Ehrig
Priv. Doz. Dr. Bernd Mahr
Technische UniversiHit Berlin
FB 20, Informatik, Sekr. FR 6-1
Franklinstrasse 28/29, 1000 Berlin 10, Germany
Editors
Professor Dr. Wilfried Brauer
FB Informatik der Universitat Hamburg
Rothenbaum-Chaussee 67-69, 2000 Hamburg 13, Germany
Professor Dr. Grzegorz Rozenberg
Institut of Applied Mathematics and Computer Science
University of Leiden, Wassenaarseweg 80, P.O. Box 9512
2300 RA Leiden, The Netherlands
Professor Dr. Arto Salomaa
Department of Mathematics, University of Turku
20500 Turku 50, Finland
ISBN-13: 978-3-642-69964-1 e-ISBN-13: 978-3-642-69962-7
DOl: 10.1007/978-3-642-69962-7
This work is subject to copyright. All rights are reserved, whether the whole or part of
material is concerned, specifically those of translation, reprinting, re·use of illustrations,
broadcasting, reproduction by photocopying machine or similar means, and storage in data
banks. Under § 54 of the German Copyright Law where copies are made for other than
private use a fee is payable to "Verwertungsgesellschaft Wort", Munich.
© Springer-Verlag Berlin Heidelberg 1985
Softcover reprint of the hardcover 1st edition 1985
The use of registered names, trademarks, etc. in the 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/3140-543210
Preface
Since the early seventies concepts of specification became 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, and are now playing a
central role in the theory of data type specification.
The aim of this book is to present fundamentals of algebraic specifica
tion for teaching, research, and development with respect to the
following three aspects:
1. Fundamentals in the sense of a carefully motivated introduction to
algebraic specifications, which is easy to understand 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.
We have organized the material in two volumes:
Volume 1: Equations and Initial Semantics
Volume 2: Formal Requirements and Modules
Volume 1 includes equational specifications, algebras, specifications
of abstract data types with initial semantics, characterization of
equational classes, the equational calculus, term rewriting, correct
ness and extension of specifications, parameterized specifications,
functors, parameter passing, and in an appendix concepts, syntax and
semantics of an algebraic specification language.
Volume 2 will include first order logical-especially Universal Horn
specifications, institutions, behavioral abstraction, algebraic con-
VI Preface
straints, and specification of modules and modular systems.
These two volumes are concerning formal specification techniques
from logical requirements to algebraic design specifications. It is
planned that a third volume on algebraic specifications is published in
this EATCS-monograph series by another author, where the connec
tions between specifications, interpretations, implementations, and
programs in programming languages are studied.
Volume 1 is organized in a main part of eight chapters and an
appendix of two chapters. The chapters are numbered using arabic
numerals. Each chapter consists of several sections which are not
numbered because concepts, definitions, facts, theorems and exam
ples within one chapter are numbered consecutively. Each of the
chapters of the main part and the appendix contains a separate section
with bibliographical notes where also further extensions of the theory
are mentioned.
Chapters 1 and 2 are intended to serve as an introduction to algebraic
specifications with equational axioms in general and to the specifica
tion of abstract data types with initial semantics in particular. A more
concrete level of presentation is intentionally chosen to avoid abstract
notions and universal constructions in the beginning. The correspond
ing abstract concepts "initiality" and "freeness" are introduced and
studied in Chapter 3 and they are frequently used in the remaining
chapters. Chapters 4 and 5 are not prerequisite for the following ones
but they can be considered as interfaces of equational algebraic
specifications to universal algebra and logic (including term rewriting)
respectively. Chapter 6 continues a discussion on correctness proofs in
Chapter 2. Though it uses results from Chapters 3 and 5, main parts
can be read, immediately after 2. Chapters 7 and 8 are introducing and
using concepts from category theory in order to state the semantical
aspects and to prove the results of parameterized specifications, and
parameter passing properly. The corresponding syntactical aspects
are given in the first section of Chapter 7 and the first two sections of
Chapter 8. These sections together with Chapters 1 and 2 are
sufficient to understand main parts of the appendix.
The first two chapters may serve as a textbook for undergraduate
teaching, while the other ones are providing more advanced and
abstract material for graduate level courses and further research and
development. A partial overlap in contents between chapters present
ing the theory on different levels of abstraction is intended to improve
reading of later chapters without too much prerequisites of earlier
ones.
This volume is based on lectures of both authors at the computer
science department of the Technical University in Berlin. It also
presents main results of the DFG project ACT (Algebraic Specifica
tion Techniques for Correct and Trusty Software Systems) and of
common research projects with J. Thatcher, E. Wagner and J.
Wright, IBM Yorktown Heights, and especially with H.-J. Kreowski
now at the University of Bremen.
Preface VII
We are most grateful to these and several other colleagues for
common research and stimulating discussions on the subject of this
book. We are also indepted to G. Rozenberg because of his very
engaged editorial guidance. The special attention given to the referee
ing process for publications in the EAT CS-monograph series has
definitely shown its merits.
In this regard we want to express our gratitude to the referee for
carefully studying our handwritten draft version and for most valuable
comments leading to a considerably improved final version.
The manuscript was excellently typed in world record time by H.
Barnewitz. She did a fantastic job. Proof reading was done by P.
Boehm, W. Fey, U. Grude, H. Hansen, K. P. Hasler, U. Hummert,
R. Kutsche, A. Langen, F. Niirnberg, and K. J. Werner. As members
resp. cooperators of the ACT group they are also involved in
teaching, research, and development of algebraic specification techni
ques and languages in Berlin. Many thanks to all of them and also to
our families for great patience during the preparation of the book.
Berlin, March 1985 Hartmut Ehrig
Bernd Mahr
Contents
Introduction 1
Historical Remarks 1
The Chapters of this Volume 4
Further Topics 8
1 Equational Specifications and Algebras . 9
Basic Examples . . . . . . . . . . . . . . 10
Signatures, Terms, and Algebras ..... 14
Equational Specifications and Derivations 24
Bibliographic Notes for Chapter 1 31
2 Specifications of Abstract Data Types . 32
Abstract Data Types 33
Quotient Term Algebras 36
Semantics and Correctness of Specifications 46
Bibliographic Notes for Chapter 2 . 61
3 Initial Semantics of Specifications . 62
Facts about Homomorphisms . . . . 63
Term Algebras, Initial and Free Algebras 67
Congruences and Quotients . . . . 76
Initial and Free SPEC-Algebras .. 81
Bibliographic Notes for Chapter 3 88
X Contents
4 Specifiability and Characterization of Equational Classes 89
Equational Theory and Equational Classes 90
Subalgebras . . . . . . 92
Products ....... 95
Homomorphic Images . 97
Birkhoff-Characterizations of Equational Classes 101
Bibliographic Notes for Chapter 4 ....... 107
5 Equational Calculus and Term Rewriting 108
Formal Proofs by Equations . . . . . . . . 109
Correctness and Completeness of the Equational Calculus 115
Term Rewriting with Equations . . . . . . . . . . . . . . 124
Equivalence of Proofs and Term Rewriting with Equations 130
Bibliographic Notes for Chapter 5 ............ 137
6 Correctness and Extension of Specifications 138
Initial Correctness of Specifications . . . . . . 139
Correctness of Specifications with Hidden Functions 145
Stepwise Specification by Extensions . 151
Correctness of Example Specifications 158
Bibliographic Notes for Chapter 6 167
7 Parameterized Specifications and Functors 168
Parameterized Specifications . . . . 171
Categories and Functors . . . . . . . 176
Free Constructions and Free Functors 181
Semantics and Correctness of Parameterized Specifications 191
Bibliographic Notes for Chapter 7 ............ 199
8 Parameter Passing .. 201
Specification Morphisms 202
Standard Parameter Passing and Pushouts . 206
Amalgamation .............. 215
Persistency and Extension of Functors . . . 220
Correctness of Standard Parameter Passing 226
Parameterized Parameter Passing . 231
Iterated Parameter Passing . . . . 238
Bibliographic Notes for Chapter 8 242
Contents XI
Appendix . ............. . 244
9 Concepts of a Specification Language 245
Basic Specifications 246
Combination 250
Renaming . . . 256
Actualization . 258
Modularization 263
Syntax of the Specification Language ACT ONE 268
10 Semantics ofthe Specification Language ACT ONE 273
First Level of Semantics . . . . . . . . . . . . 275
Second Level of Semantics .......... 282
Semantical Properties and Context-Conditions 290
Initial Algebra Semantics . . . . . . 298
Bibliographic Notes for the Appendix 305
Bibliography 307
SubjectIndex 316
Introduction
The theory of algebraic specifications has its origins in the mid seventies and
evolved from different sources and work independently done by different authors.
Conceptually it is based on notions and ideas of classical and universal algebra in
pure mathematics, and on concepts of abstract data types and software system speci
fication in computer science.
The rapidly growing interest in algebraic specifications has led to a well-developed
theory and a great variety of problem areas presently being explored by different
groups of researchers. The theory of algebraic specifications, which grew out from
research in program and software development methodology, has now come to a state
which is that of a well-established field equally interesting for theoreticians and
practitioners in computer science and software development.
Historical Remarks
The concept of abstract data types was developed about 15 years ago starting with
the debacles of large software systems in the late 60's. Since that time a large
number of papers on algebraic specification techniques have appeared studying speci
fication problems from the theoretical and the applications point of view. Algebraic
specification techniques and languages have been successfully applied in research and
development for the specification of systems ranging from basic data types up to
highly sophisticated software systems. The basic data types are including numeral
types like natural numbers, integers, rationals, and boolean values and abstract
data types like stacks, queues, strings, sets, arrays, trees, and graphs, for example.
Basic data types have been combined to construct larger data types like symbol tables,