A Programming Language
by Kenneth E. Iverson
published by John Wiley and Sons, Inc., 1962-05
Preface
Applied mathematics is largely concerned with the design and analysis of explicit procedures for calculating the exact or approximate values of various functions. Such explicit procedures are called algorithms or programs. Because an effective notation for the description of programs exhibits considerable syntactic structure, it is called a programming language.
Much of applied mathematics, particularly the more recent computer-related areas which cut across the older disciplines, suffer from the lack of an adequate programming language. It is the central thesis of this book that the descriptive and analytic power of an adequate programming language amply repays the considerable effort required for its mastery. This thesis is developed by first presenting the entire language and then applying it in later chapters to several major topics.
The areas of application are chosen primarily for their intrinsic interest and lack of previous treatment, but they are also designed to illustrate the universality and other facets of the language. For example, the microprogramming of Chapter 2 illustrates the divisibility of the language, i.e., the ability to treat a restricted area using only a small portion of the complete language. Chapter 6 (Sorting) shows its capacity to compass a relative complex and detailed topic in a short space. Chapter 7 (The Logical Calculus) emphasizes the formal manipulability of the language and its utility in theoretical work.
The material was developed largely in a graduate course given for several years at Harvard and in a later course presented repeatedly at the IBM System Research Institute in New York. It should prove suitable for a two-semester course at the senior or graduate level. Although for certain audiences an initial presentation of the entire language may be appropriate, I have found it helpful to motivate the development by presenting the minimum notation required for a given topic, proceeding to its treatment (e.g. microprogramming), and then returning to further notation. The 130-odd problems not only provide the necessary finger exercises but also develop results of general interest.
Chapter 1 or some part of it is prerequisite to each of the remaining "applications" chapters, but the applications chapters are virtually independent of one another. A complete appreciation of search techniques (Chapter 4) does, however, require a knowledge of methods of representation (Chapter 3). The cross references which do occur in the applications chapters are either nonessential or are specific to a given figure, table, or program. The entire language presented in Chapter 1 is summarized for reference at the end of the book.
In any work spanning several years it is impossible to acknowledge adequately the many contributions made by others. Two major acknowledgments are in order: the first to Professor Howard Aiken, Director Emeritus of the Harvard Computation Laboratory, and the second to Dr. F.P. Brooks, Jr. now of IBM.
It was Professor Aiken who first guided me into this work and who provided support and encouragement in the early years when it mattered. The unusually large contributions by Dr. Brooks arose as follows. Several chapters of the present work were originally prepared for inclusion in a joint work which eventually passed the bounds of a single book and evolved into our joint Automatic Data Processing and the present volume. Before the split, several drafts of these chapters had received careful review at the hands of Dr. Brooks, review which contributed many valuable ideas on organization, presentation, and direction of investigation, as well as numerous specific suggestions.
The contributions of the 200-odd students who suffered through the development of the material must perforce be acknowledged collectively, as must the contributions of many of my colleagues at the Harvard Computation Laboratory. To Professor G.A. Salton and Dr. W.L. Eastman, I am indebted for careful reading of drafts of various sections and for comments arising from their use of some of the material in courses. Dr. Eastman, in particular, exorcised many subtle errors from the sorting programs of Chapter 6. To Professor A.G. Oettinger and his students I am indebted for many helpful discussions arising out of his early use of the notation. My debt to Professor R.L. Ashenhurst, now of the University of Chicago, is apparent from the references to his early (and unfortunately unpublished) work in sorting.
Of my colleagues at the IBM Research Center, Messrs. L.R. Johnson and A.D. Falkoff, and Dr. H. Hellerman have, through their own use of the notation, contributed many helpful suggestions. I am particularly indebted to L.R. Johnson for many fruitful discussions on the applications of trees, and for his unfailing support.
On the technical side, I have enjoyed the assistance of unusually competent typists and draughtsmen, chief among them being Mrs. Arthur Aulenback, Mrs. Philip J. Seaward, Jr., Mrs. Paul Bushek, Miss J.L. Hegeman, and Messrs. William Minty and Robert Burns. Miss Jacquelin Sanborn provided much early and continuing guidance in matters of style, format, and typography. I am indebt to my wife for assistance in preparing the final draft.
May, 1962 Kenneth E. Iverson
Mount Kisco, New York
Contents
Chapter 1 The Language
- 1.1 Introduction
- 1.2 Programs
- 1.3 Structure of the language
- Conventions
- Literals and variables
- Domain and range
- 1.4 Elementary operations
- Arithmetic operations
- Logical operations
- Residues and congruence
- 1.5 Structured operands
- Elementary operations
- Matrices
- Index systems
- 1.6 Rotation
- 1.7 Special vectors
- 1.8 Reduction
- 1.9 Selection
- Compression
- Mesh, mask, and expansion
- 1.10 Selection vectors
- 1.11 The generalized matrix product
- 1.12 Transpositions
- 1.13 Special logical matrices
- 1.14 Polynomials and positional number systems
- 1.15 Set operations
- 1.16 Ranking
- 1.17 Mapping and permutation
- Reordering operations
- Permutations
- Function mapping
- Ordering vector
- 1.18 Maximization
- 1.19 Inverse functions
- 1.20 Levels of structure
- 1.21 Subroutines
- 1.22 Files
- 1.23 Ordered trees
- Directed graphs
- Ordered trees
- Right and left list matrices
- Well formation
- The index matrix as a function of the degree vector
- Tree, path, and level compression
- Extension of other operations to trees
- Homogeneous trees
- References
- Exercises
Chapter 2 Microprogramming
- 2.1 Instruction preparation
- Additive indexing
- Indirect addressing
- Dynamic relocation
- Branching, interruption, and trapping
- Complete instruction fetch
- 2.2 Instruction execution
- Load and store
- Branch instructions
- Logical instructions
- Arithmetic instructions
- Shift instructions
- Convert instructions
- Input-output instructions
- 2.3 Detailed logical design
- References
- Exercises
Chapter 3 Representation of Variables
- 3.1 Allocation and encoding
- 3.2 Representation of structured operands
- The grid matrix
- Linear representations
- Nonlinear representations
- Chained representations
- Partitions
- Pools
- Summary
- 3.3 Representation of matrices
- 3.4 Representation of trees
- Simplified list matrices
- The use of left lists
- Chain list matrices
- References
- Exercises
Chapter 4 Search Techniques
- 4.1 Scanning methods for ranking
- Directed scan
- Controlled scan
- 4.2 Key transformations
- Nonunique key transformations
- 4.3 Multiple keys
- References
- Exercises
Chapter 5 Metaprograms
- 5.1 Compound statements
- 5.2 Lukasiewicz notation
5.3 The minimax form of an L-formula
- 5.4 Translation from complete parenthesis to Lukasiewicz notation
- 5.5 Translation from Lukasiewicz to complete parenthesis notation
- References
- Exercises
Chapter 6 Sorting
- 6.1 Serial sorting methods
- Copy operations
- Simple classification and merge
- Classification and simple merge
- Partial pass methods
- 6.2 Evaluation of serial sorting methods
- Simple classification and merge
- Classification and simple merge
- Partial pass methods
- 6.3 Aids to serial sorting processes
- 6.4 Internal sorting methods
- Simple classification and merge
- Classification and simple merge
- Special internal sorting methods
- 6.5 Evaluation of internal sorting methods
- Expected number of transpositions
- Bubble sort
- Ranking sort
- Odd-even transposition sort
- Repeated selection sort
- Sorting with replacement
- Comparison of internal sorting methods
- Appendix to Chapter 6
- References
- Exercises
Chapter 7 The Logical Calculus
- 7.1 Elementary identities
- 7.2 Canonical forms
- Intrinsic vector
- Characteristic vectors
- 7.3 Decomposition
- Disjunctive canonical form
- Other canonical forms
- References
- Exercises
Summary of Notation
Index
