ebook img

A Programming Approach to Computability PDF

258 Pages·1982·5.58 MB·English
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview A Programming Approach to Computability

Texts and Monographs in Computer Science Editor David Gries Advisory Board F. L. Bauer K.S.Fu J. J. Horning R. Reddy D. C. Tsichritzis W. M. Waite The AKM Series in Theoretical Computer Science A Subseries of Texts and Monographs in Computer Science A Basis for Theoretical Computer Science by M. A. Arbib, A. J. Kfoury, and R. N. Moll A Programming Approach to Computability by A. J. Kfoury, R. N. Moll, and M. A. Arbib An Introduction to Formal Language Theory by R. N. Moll, M. A. Arbib, and A. J. Kfoury A Programming Approach to Computability A. J. Kfoury Robert N. Moll Michael A. Arbib I Springer-Verlag New York Heidelberg Berlin A. J. Kfoury Robert N. Moll Department of Mathematics Department of Computer and Boston University Information Science Boston, MA 02215 University of Massachusetts U.S.A. Amherst, MA 01003 U.S.A. Michael A. Arbib Series Editor Department of Computer and Information Science David Gries University of Massachusetts Department of Computer Science Amherst, MA 01003 Cornell University U.S.A. Upson Hall Ithaca, NY 14853 U.S.A. On the front cover is a likeness (based on a postcard kindly supplied by Professor S. C. Kleene) of the ninth century mathematician Abu lafar Muhammad Ibn Musa AI-Khowarizmi. The word "algorithm" is derived from the last part of his name. With 36 Figures Library of Congress Cataloging in Publication Data Kfoury, A. 1. A programming approach to computability. (The AKM series in theoretical computer science) (Texts and monographs in computer science) "February 1982." Bibliography: p. Includes index. I. Computable functions. 2. Programming (Electronic computers) I. Moll, Robert N. II. Arbib, Michael A. III. Title. IV. Series. V. Series: Texts and monographs in computer science. QA9.59.K46 1982 519.4 82-10488 All rights reserved. No part of this book may be translated or reproduced in any form without written permission from Springer-Verlag, 175 Fifth Avenue, New York, New York 10010, U.S.A. © 1982 by Springer-Verlag New York Inc. Softcover reprint of the hardcover 1s t edition 1982 9 8 7 6 5 432 I ISBN-13 :978-1-4612-5751-6 e-ISBN-13:978-1-4612-5749-3 DOl: 10.1007/978-1-4612-5749-3 Preface Computability theory is at the heart of theoretical computer science. Yet, ironically, many of its basic results were discovered by mathematical logicians prior to the development of the first stored-program computer. As a result, many texts on computability theory strike today's computer science students as far removed from their concerns. To remedy this, we base our approach to computability on the language of while-programs, a lean subset of PASCAL, and postpone consideration of such classic models as Turing machines, string-rewriting systems, and p.-recursive functions till the final chapter. Moreover, we balance the presentation of un solvability results such as the unsolvability of the Halting Problem with a presentation of the positive results of modern programming methodology, including the use of proof rules, and the denotational semantics of programs. Computer science seeks to provide a scientific basis for the study of information processing, the solution of problems by algorithms, and the design and programming of computers. The last 40 years have seen increasing sophistication in the science, in the microelectronics which has made machines of staggering complexity economically feasible, in the advances in programming methodology which allow immense programs to be designed with increasing speed and reduced error, and in the develop- ment of mathematical techniques to allow the rigorous specification of program, process, and machine. The present volume is one of a series, the AKM Series in Theoretical Computer Science, designed to make key mathematical developments in computer science readily accessible to un- dergraduate and beginning graduate students. The book is essentially self-contained-what little background is required may be found in the AKM volume A Basis for Theoretical Computer Science. v vi Preface The book is organized as follows. Chapter I provides a preview of the techniques to be used throughout the book in determining whether or not a function is computable by some algorithm. Chapters 2 and 3 establish our framework for the study of computabil- ity, using the lean PASCAL subset we call "while-programs". In these two chapters we take a close look at the intuitive idea of an algorithm as formulated in this simple programming language. We also introduce the idea of a universal program or interpreter which can simulate any program P when given P's data together with an encoding of P as an additional input. In Chapter 4 we develop basic techniques of computability theory, which we then use to examine the computational status of various natural problems. Chapter 5 provides an introduction to program correctness and to alternative theories of semantics of programming languages. In Chapter 6 we consider the role of self-reference in computability theory as embodied in a result known as the Recursion Theorem. We also study conditions under which the theory can be made model independent. In Chapters 7 and 8 our emphasis changes from functions to sets. Recursive sets, whose characteristic functions are computable, are com- pared with recursively enumerable sets whose elements are listable by algorithms. As we shall see, these two concepts do not coincide. Finally, in Chapter 9 we examine alternative formulations of comput- ability theory, and we show how one of these formulations (the Turing machine model) can be used to embed the results of computability theory in a large variety of other symbol-processing systems, including formal languages. More detailed outlines may be found at the beginning of each chapter. In keeping with the style of the AKM series, we have resisted the temptation to include more material than could possibly be covered in a one-semester course. Nevertheless, in moderating the pace for a single term's work, the instructor may find it appropriate to omit material from one or more of Sections 5.3, 6.2, 7.3, 8.2, 9.2, and 9.3 (the starred sections in the table of contents). The book grew out of our teaching classes at the University of Massa- chusetts at Amherst and at Boston University over several years. We owe special thanks to Ernest Manes for letting us use material from the forthcoming text Formal Semantics of Programming Languages by M. A. Arbib and E. Manes in the preparation of Section 5.1. We thank our students for helping us integrate computability theory into the "world view" of modern computer science, and we thank Susan Parker for all her efforts in typing the manuscript. February 1982 A. J. Kfoury R. N. Moll M. A. Arbib Contents CHAPTER 1 Introduction 1.1 Partial Functions and Algorithms I 1.2 An Invitation to Computability Theory 9 1.3 Diagonalization and the Halting Problem 13 CHAPTER 2 The Syntax and Semantics of while-Programs 17 2.1 The Language of while-Programs 17 2.2 Macro Statements 25 2.3 The Computable Functions 34 CHAPTER 3 Enumeration and Universality of the Computable Functions 45 3.1 The Effective Enumeration of while-Programs 45 3.2 Universal Functions and Interpreters 51 3.3 String-Processing Functions 61 3.4 Pairing Functions 67 CHAPTER 4 Techniques of Elementary Computability Theory 75 4.1 Algorithmic Specifications 76 4.2 The s-m-n Theorem 80 4.3 Undecidable Problems 86 vii viii Contents CHAPTER 5 Program Methodology 95 5.1 An Invitation to Denotational Semantics 96 5.2 Recursive Programs 110 5.3* Proof Rules for Program Properties 124 CHAPTER 6 The Recursion Theorem and Properties of Enumerations 138 6.1 The Recursion Theorem 138 6.2* Model-Independent Properties of Enumerations 147 CHAPTER 7 Computable Properties of Sets (Part 1) 152 7.1 Recursive and Recursively Enumerable Sets 153 7.2 Indexing the Recursively Enumerable Sets 163 7.3* G6del's Incompleteness Theorem 170 CHAPTER 8 Computable Properties of Sets (Part 2) 176 8.1 Rice's Theorem and Related Results 177 8.2* A Classification of Sets 184 CHAPTER 9 Alternative Approaches to Computability 196 9.1 The Turing Characterization 196 9.2* The Kleene Characterization 205 9.3* Symbol-Manipulation Systems and Formal Languages 224 References 235 Notation Index 239 Author Index 243 Subject Index 245 *These sections may be omitted with no loss of continuity. CHAPTER 1 Introduction 1.1 Partial Functions and Algorithms 1.2 An Invitation to Computability Theory 1.3 Diagonalization and the Halting Problem Computability theory looks at the functions computed by algorithms, such as computer programs. Since a program may not halt for a given input, the functions so computed will be partial functions. In Section 1.1 we discuss partial functions and their computability by different families of algo- rithms. In Section 1.2 we give an example of an unsolvability or noncom- putability result-showing that no program can compute for an arbitrary number n whether or not the PASCAL program with ASCII code n will halt when also given n as input data. Section 1.3 shows that the method of proof used to show the noncomputability of this halting problem is akin to Cantor's diagonal argument that the real numbers are uncountable. This chapter thus gives the reader a taste for a number of techniques to be used again and again throughout this volume. 1.1 Partial Functions and Algorithms A function is computable if it is determined by some algorithm, that is, by some well-specified program or set of rules. In this section we introduce the notion of a partial function-the proper functional concept for computabil- ity theory-and then look closely at the relationship between algorithms and functions. 1 2 1 Introduction FUNCTIONS We assume that the reader already knows what the word "function" means. (The necessary background for this section is provided in the companion volume, A Basis for Theoretical Computer Science, M. A. Arbib, A. J. Kfoury, and R. N. Moll, Springer-Verlag, New York, 1981, Chapter 1.) Recall that in conventional mathematics, a function f: A ~ B is some rule according to which each element x of A (the domain of arguments) is associated with an element f(x) in another set B (the codomain of values). This rule may be a precise algorithm, or merely a hypothetical rule of correspondence. Most common functions of everyday arithmetic, e.g., the multiplication function g(x, y) = x * y, have familiar algorithmic descrip- tions, and are routinely classified as computable functions. However, the status of a function specified by a hypothetical rule of correspondence may be less clear. As an example, consider the function f given below mapping domain N, the set of non-negative integers, to codomain {O, I}. f(x) = { 1, if Fermat's last theorem 1 is true; 0, if Fermat's last theorem is false. Now mathematicians have not yet established the validity of Fermat's last theorem. So it is not known if f(x) is the constant function identically equal to zero, or the constant function identically equal to 1. In either case, however, f can be calculated by a trivial algorithm-either "output 0 on all arguments," or "output 1 on all arguments." Hence, f is considered to be computable even though the algorithm for calculating its value has not yet been identified. As every programmer knows, a poorly designed but runnable algorithm will often fail to terminate for some input values, and our theory must take this phenomenon into account. Consider, for example, the function com- putable by the algorithm shown in the flow chart of Figure 1, and which is expressed as follows in the computer language PASCAL2: begin while Xmod2 = 0 do X:= X + 2 end I Fermat's last theorem is the as yet unproved assertion that for any n > 2, the equation x' + y' = z· has no integer solutions. 2 Our convention for writing variables throughout the book is this: We use lower case letters, mostly from the end of the Roman alphabet, e.g., XI' x2' y, Y12' z, etc.-except when these variables appear in the text of programs, in which case we use the corresponding upper case letters, e.g., X I, X2, Y, Y 12, Z, etc.

See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.