ebook img

Computer Program Synthesis Methodologies: Proceedings of the NATO Advanced Study Institute held at Bonas, France, September 28–October 10, 1981 PDF

378 Pages·1983·18.252 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 Computer Program Synthesis Methodologies: Proceedings of the NATO Advanced Study Institute held at Bonas, France, September 28–October 10, 1981

Computer Program Synthesis Methodologies NATO ADVANCED STUDY INSTITUTES SERIES Proceedings of the Advanced Study Institute Programme, which aims at the dissemination ofa dvanced knowledge and the formation of contacts among scientists [rom different countries The series is published by an international board of publishers in conjunction with NATO Scientific Affairs Division A Life Sciences Plenum Publishing Corporation B Physics London and New York C Mathematical D. Reidel Publishing Company and Physical Dordrecht, Boston and London Sciences D Behavioural and Social Sciences Martinus Nijhoff Publishers E Engineering and The Hague, London and Boston Materials Sciences F Computer and Springer Verlag Systems Sciences Heidelberg G Ecological Sciences Series C - Mathematical and Physical Sciences Volume 95 - Computer Program Synthesis Methodologies Computer Program Synthesis Methodologies Proceedings oft he NATO Advanced Study Institute held at Bonas, France, September 28 -October 10, 1981 edited by ALAN W. BIERMANN Duke University, Department of Computer Science, Durham, NC, U.S.A. and GERARD GUIHO Laboratoire de Recherche en Informatique, Universite de Paris-Sud, Orsay, France D. Reidel Publishing Company Dordrecht: Holland / Boston: U.S.A. / London: England Published in cooperation with NATO Scientific Affairs Division library of Congress cataloging in Publication Data NATO Advanced Study Institute (1981 : Bonas, France) Computer program synthesis methodologies. (NATO advanced study institutes series. Series C, Mathematical and physical sciences; v. 95) "Published in cooperation with NATO Scientific Affairs Division." Includes indexes. 1. Electronic digital computers-Programming-Congresses. I. Biermann, Alan W., 1939- II. Guiho, Gerard, 1945- III. Title. IV. Series. QA76.6.N378 1981 001.64'2 82-16704 ISBN-\3: 978-94-009-7021-2 e-ISBN-\3: 978-94-009-7019-9 DOl: 10.1007/978-94-009-7019-9 Published by D. Reidel Publishing Company P.O. Box 17,3300 AA Dordrecht, Holland Sold and distributed in the U.S.A. and Canada by Kluwer Boston Inc., 190 Old Derby Street, Hingham, MA 02043, U.S.A. In all other countries, sold and distributed by Kluwer Academic Publishers Group, P.O. Box 322,3300 AH Dordrecht, Holland D. Reidel Publishing Company is a member of the Kluwer Group All Rights Reserved Copyright @ 1983 by D. Reidel Publishing Company, Dordrecht, Holland Softcover reprint of the hardcover I st edition 1983 No part of the material protected by this copyright notice may be reproduced or utilized in any form or by any means, electronic or mechanical, including photocopying, recording or by any informational storage and retrieval system, without written permission from the copyright owner TABLE OF CONTENTS Preface vii M. BROY / Program Construction by Transformations: A Family Tree of Sorting Programs M. SINTZOFF / Issues in the Methodical Design of Concurrent Programs 51 R. BACKHOUSE / An Analysis of Choice in Program Design 79 P. C. GOLDBERG / The Design of Very High Level Languages 125 • P. C. GOLDBERG / Implementation Considerations 1n Very High Level Languages 147 H. GALLAIRE / A Study of Prolog 173 J.-P. JOUANNAUD and Y. KODRATOFF / Program Synthesis from Examples of Behavior 213 Z. MANNA and R. WALDINGER / Deductive Synthesis of the Unification Algorithm 251 J. DARLINGTON / The Synthesis of Implementations for Abstract Data Types, A Program Transformation Tactic 309 A. W. BIERMANN / Natural Language Programming 335 AUTHOR INDEX 369 SUBJECT INDEX 373 PRE F ACE Ever since the early days of computing, programmers have been seeking ways to automate portions of the programming task. The first major step was the invention of assemblers which allowed mneumonic operation codes,handled certain addressing tasks and offered other functions. Next came a vast array of compiled and interpreted languages which implemented many data structures, flow-of-control features, and notational conveniences. In an attempt to continue this trend today. a number researchers are developing program synthesis methodologies which aim at making further automation possible. Most of these methodologies fall into one of the categories: a) extensions to traditional programming methods, b) synthesis of programs from examples, c) synthesis from formal input-output specifications, d) program construction from natural language dialogue. These program synthesis methodologies are the subject of this book. The first three chapters examine the program synthesis issue largely without regard to the automation problem. Systematic means are described for constructing programs with emphasis on what is the nature of the synthesis task and how can it be approached. M. BROY describes a transformational technique for deriving programs from their specifications. M. SINTZOFF describes central issues in the design of concurrent programs, and R. BACKHOUSE gives a methodology for decision making in program design that accounts both for correctness and efficiency. The later chapters of the book sequentially address the four approaches to synthesis given above. Extensions to traditional programming methods often involve the construction of very high level languages to deal with larger objects (data structures) than traditional languages with appropriately more vii A. W. Biermann and G. Guiho (eds.). Computer Program Synthesis Methodologies, vii-ix. Copyright © 1983 by D. Reidel Publishing Company. viii PREFACE powerful operations on them. An early step in this direction was the development of APl, and more recent examples have been SETl which enables a user to code in terms of mathematical enti ties such as sets and BDl which allows a user, presumably a businessman, to specify a computation in terms of a series of tabular forms and a series of processing paths through which data flows. The design and implementation of such languages are examined in chapters by P. GOLDBERG. Another extension to traditional methods is made possible by systems designed to automatically handle low level flow-of control decisions. All the above higher level languages do this implicitly with their built in operators. PROLOG is a language which does this with a theorem proving mechanism employing primarily unification and backtracking. The programmer specifies the problem to be solved with a set of formal logic statements including a theorem to be proved. The theorem proving system finds a way to combine the axioms to prove the theorem, and in the process, it completes the desired calculation. H. GAllAIRE has contributed a chapter describing PROLOG giving many examples of its usage. There are many situations in machine programming where it is more natural to give examples of what is wanted than to give programs. As an illustration, the operator of an automatic machine tool would probably prefer to manually direct the device through an example machining sequence and have it self program to do that sequence than to code the sequence using a symbolic language. The machine operator can be sure in the example sequence that all processes occur as desired and will probably produce a more reliable control program than if he or she had written the program directly. As a illustration, a person s~cond formating a piece of text would probably much rather organize the page using a manual graphics device of some kind and then have an automatic editor create the command sequence to actually space out and format the text items correctly. A fascinating domain for these kinds of studies has been in the synthesis of IISP programs from examples of their input-output behaviors. J.P. JOUANNAUD and Y. KODRATOFF have included a chapter describing some of this work. Another way to construct programs automatically is to deduce them from their input-output specifications. The speci fications are given with a formal language but they do not give the method for doing the computation. The automatic system attempts to transform the specifications in a sequence of steps to the target program. The result program is guaranteed to implement the specifications and to terminate on legitimate inputs. Z. MANNA and R. WALDINGER give a deductive method for this type of synthesis where a theorem is proved and the target PREFACE ix program is a by-product of the theorem proving process. The following chapter by J. DARLINGTON describes a transformational approach. One of the ways in which nonprogrammers will be able to interact with computers of the future will be via typed or spoken natural language. While this may seem to be an impractical alter native in the near term, some progress has been made. The final chapter by A. BIERMANN discusses a system for natural language programming that has been developed to the pOint that college students can use it to solve problems typical of a first course in programming. ACKNOWLEDGEMENTS This book is the proceedings of the 1981 NATO Advanced Study Institute on Automatic Program Construction which was held in October 1981. This meeting has been made possible through the financial support and the framework provided by the NATO Scientific Affairs Division. As Directors of the NATO Institute, we would like to thank all the participants for their valuable participation in the dis cussions and panel presentations which finally made a great success of this Institute. We are grateful to our host and hostess at the Chateau Professor and Mrs. J.C. SIMON, animateur of the Centre Culturel de Bonas, for providing a delightful environment for the Institute. We would also like to thank the chapter authors for their careful preparation of the chapters and the secretarial staff at the Laboratoire de Recherche en Informatique d'Orsay for their help in assembling this volume. PROGRAM CONSTRUCTION BY TRANSFORMATIONS A FAMILY TREE OF SORTING PROGRAMS. Manfred BROY Technische Universitat Munchen Institut fur Informatik Postfach 20 24 20 D-8000 MUNCHEN 2 The construction of a program is considered as a process consis ting of a sequence of formal steps. Each step is characterized by a particular transformation rule. In general, the development starts with a formal specification and ends with an efficient program. In the first part of this paper this methodology and its formal foundations are briefly outlined. In the second part a number of sorting programs is developed along these lines leading to a deci sion tree of the program family of different sorting programs. 1. PROGRAM CONSTRUCTION BY TRANSFORMATIONS In order to manage the enormous complexity of the activity of writing a program it seems indispensable to organize the develop ment process in a formal way leading through a series of more and more detailed versions (cf. (4». The switch from one version to the other is called a program transformation, an instruction how to perform this switch is called a transformation rule. The reliability and understandability of the development and thus our confidence in the resulting piece of software obviously can be increased if both the steps and the single versions are repre sented in formal notation, such that all development stages can always be properly verified. A rigorous observation of this pro ceding leads to considering programming as a formal activity (cf. (17». Using formal notations moreover allows conveniently to support the development process by an interactive development sys tem. This wopk was oappied out within the Sondepfopsohungsbepeioh 49 - "Progparroniepteohnik" - Munioh. . A. W. Biermann and G. Guiho (eds.), Computer Program Synthesis Methodologies, 1-49. Copyright © 1983 by D. Reidel Publishing Company. 2 M.BROY A first approach to a system for program development by transfor mations has been undertaken by R.M. Burstall and J. Darlington (see e.g. (28), (23». In the meanwhile related efforts have been made elsewhere (33), (51), (54), (I), (2), (39), for a comprehen sive survey see (46). Of course, the basic motivations of the different groups working in the fiels of program transformations are rather different. First there are groups which are only interested in small local program transformations as part of an optimizing compiler. They only want to liberate the programmer from doing these tricky and burdensone local optimizations by hand. Second there are projects which consider program transformations as a tool in program design and development, i.e. as being part of the discipline of program ming. Third there are people which try to automatize the process of program construction as much as possible leading to program synthesis. Of course, there are no sharp boundaries between these three approaches. In their extreme cases the first approach is not very interesting for program development and the third one may not be very realistic on account of the undecidability results of for mal logics. In this paper we follow the second approach, trying to show the power of program transformations as a design tool in the process of program construction. 1.1. Significance of notation Program development by transformation, of course, is independent from particular notations or programming languages. Both the rules and the program versions may be described informally in natural language. However, in man-machine communication or if a mathema tically proper proof is aimed at, both the programs to be trans formed and the resp. rules have to be represented by a formal lan guage. In principle, any programming language could be used, but not all languages are equally well suited, at least for particu lar problem areas or particular levels of abstraction. To gain optimal freedom, flexibility and formal soundness by allowing smooth transitions between different levels of abstraction a spe cial "Wide Spectrum Language" called CIP-L has been designed within the project CIP (cf (8), (10». This language comprises constructs for problem specification, applicative and procedural programming. Hence the programmer can very flexibly choose the appropriate style for his specific problem. 1.2. Transformation rules Basically, a transformation is the generation of a new piece of program from a given one; it is said to be correct, if both pro-

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.