Initiality, Induction, and Computability

Initiality, Induction, and Computability

~ Algebraic methods in semantics• Edited by' MAURICE NIVAT Pro!enor o!I'1!ornuJllon Science, Unl~rslty of ParlJ Y11 JOHN C. REYNOLDS 1 I I Pro/,uor 0/ Computtr and ''lformtJllon Scltnce Syracuse Unlutrsi,y, Ntw York 1 j I i 1 I ......."''-''''''',,,C'.... ..........".., ".. , -~., ,...-.._..,.....", .. "H,,-.,1 ./ .~---­....,... CAMBRIDGE UNIVERSITY PRESS Calnbridge Londolt New York New Rochelle MelbourlJe Sydney 14 Initiality, induction, and contputabilityt JOS~ MESEGUER. JOSEPII A. GOGUEN I Introduction .60 1 Abstract data 'ypes and pro&rammlol methodoloa1 4&60 2.1 What is data abstraction? 461 2.2 Abstract machines 461 2.3 What good is algebra? 462 J ,Many-Iorted algebr. .64 3.1 Quotients 467 4 Abstract dati types -.70 4.1 Dala types without equations 471 4.2 Data types with equations 475 4.3 Equutional deduction 417 4.3.1 An unsound deduction 417 4.3.2 The rules of deduction 418 4.3.3 Soundncss, complcteness, and initiality theorems 479 4.4 Equivalentl of iniliality 482 5 Abstract marhlnn 485 6 InillaUty and computability 490 6.1 Recursivc sets and recursive functions 491 6.2 Recursive algebras 495 6.3 Computable algebras 500 6.4 The power of specification techniques: initial algcbra semantica SOl 6.S Rewrite rules S01 6.6 The power of specification techniques: final algebra semantics .s 16 6.1 Equality enrichments, computability and inductionleu induction 524 6.8 Concludina remarks on abstract data type computability 532 6.8.1 The chassies 532 6.8.2 Further wor~ by Dergstra, Tucker ~t 01. 53) 6.8.3 Computability of partial abslract dota typea with equationally defined domnins Sl3 Appendix: Proors of soundness and completcness 53J Referfl'Cn 536 t Rc~carch sUJlportcd in pilrt by Office or Naval RC5Cnrch Contractl NOOOI4·80­ O?()t,'ancl NOOOI4·M7·,·O'". nnet National Sci~ncc Fnuncla.'nn' (irrtnt 1";1 ;ality, i"duct ;0/1. and co"rputabUil y 461 does not use the phrase 'data abstraction'), and is discussed more formally by Gutiag [38], Liskov & Zilles [62], Goguen, Thatcher. Wagner & Wright [37] and many others. The basic idea seems to have first surfaced in the 'class' concept of the Simula programming language of Dahl, Myhrhaug & Nygaard [21]. Similar constructs appear in many later lan­ guages with names like 'form', 'module', 'cluster', 'object·, 'capsule', 'donlain', 'package'. 'type', 'bundle'. and even 'category'. (The names of the languages involved are left as an exercise to the interested reader.) This paper favors the more generic term nlodule. 2.1 ~VlJat is data abstraction? 1 Introduction The methodological use of ADTs in programming is to suggest (or better, to require) grouping together in one module all the basic This paper surveys, unifies, and extends a number of results on induction functions that manipulate one (or more) sort of data, and then ·hiding' the and computability in the context of an algebraic approach to the representation, in the sense that only the functions defined in that module semantics of programming. The close relationship between computability, can actually see the representation. Thus, any agent wishing to manipulate induction, and initiality is emphasized. this data can only do so by calling the functions provided by the module. Highlights of this paper include: a software engineering motivation for l~his techniquc is called data ellcapsulation, and such a module is often the initial algebra approach to data abstraction; a review of many-sorted called a data abstractioll; the advantage is to localize the effects ofchanging general algebra, including rules for equational deduction that arc sound representation in .an especially clear and sirnple way. It is often claimed and complete; simple 'inductive' characterizations of initiality (including (and we also ~clicvc) that this approach facilitates reading, writing. generalized Peano axioms); constructions for both initial and final (Le" specifying, designing, modifying, maintaining, and reasoning about minimal) algebra realizations of abstract software modules; Hnd a detailed progranlS. t introduction to computable algebras and their relationship to initiality. finality. and rewrite rules, showing in particuhlr how Gullel nUlnbcrings arise from initiality, and how equationally defined equality relates to both 2.2 Al,strClct "Iaclri/lcs theorem proving by 'inductionless induction' and cOlnputability. Pfhe latter permits us to give a purely algebraic characterization of coruput­ Much confusion can be avoided by distinguishing sharply able algebras: an algebra is computable iff it is a reduct of an initial nlodel betwecn (concrete or abstract) data types that are just algebras, and of a finite equational equaiity ·presentation. (concrete or abstract) IIlac/litleS that in addition may have internal ~~ales.t A typical data type'is thal of the ;,i;egers; there' are certain values, namely integers, and certain operotions upon them. While it is possible and 2 Abstract data types and programming methodology fruitful to investigate abstract machines with the techniques of abstract data types, quite different concepts and techniques are also important. Data abstraction enjoys considerable popularity. It is widely such us reachability. observability, and minimality. Abstract data types are recognized as an important technique for structuring programs, perhaps even more useful than structuring programs by flow of control as in t This distinction is lon,ctinlcs indicatcd with the words 'immutablc' and 'nllilabic'. indicnting lhut duta items (such as the integer J) are idcal and traditional now charts or more modern data now dingralns. Data '.irnelcss'. while lhc behavior of a machine can vary with time; see [33] for a abstraction has been advocated, for cXillnplc, by Jackson [48] (though hc formal treatment. 462 J. Meseguer. J. A. Goguen lllitiality. induction. and con,plltability 463 useful for understanding the type systems of programming languages, able algebra can be specified as an initial algebra for a jillite number of especially when they permit user-defined types as in ALGOL 68 [87]. and equations (ufter adding perhaps a finite number of auxiliary functions); for deciding the correctness of data representations. Abstract machines nre this shows the general applicability of finitary algebraic specifications in useful for understanding the specification and implementation of software computer science. modules, in roughly the sense of Parnlls [74], and us used in the IIDM Three dilTerent algebraic approaches to ADTs emerged i~ 1975: Zillcs methodology [61] and in CLU [63]. The fact that many camlnon [91] gave an abstract of somc results to appear in his Ph.D. thesis; Guttag examples can be viewed from either perspective contributes to the [38] completed his dissertation; and ADJ (Goguen, Thatcher, Wagner & potential confusion. Wright [37]) sketched their initial algebra approach. Zilles [92] suggested There is, for instance, the rather pointless controversy about whether final a new kind of alg~.bra, called 'data algebra', based on the notation of Cohn or initial algebra semantics is 'best'. For abstract machines, it is behaviour [20]; Zilles' use of free algebras essentially corresponds to ADJ'. use of that matters. Machines that represent and manipulate their internal states initiulity. OutlaS's work introduced the important ideas of 'consistency' dilTerently (i.e., are nonisomorphie as data types) can still have the same and 'sufficient completeness'later formalized by others, and opened up the behavior [26]. A software module can usually be realized in many different study of modules with states, i.e., abstract machines. ADJ. using initiality ways; among these. the final one uses as little storage as possible for and the algebraic notation of Goguen [29], were able to formalize the internal states. while the ilJitial one has no sharing at all for storage of ADT concepts entirely rigorously within standard many-sorted general states [33]. Because the space efficiency of the final realiu1tion can greatly algebra. Strangely enough, Zilles' work, though motivated by CLU reduce its time efficiency, there are many cases where the pragrnatically 'clusters', actually treated ADTs rather than abstract machines. Each of correct choice of data representation is neither initial nor final, but rather these three' approaches has subsequently been follow'ed up by its" something between. A good example is the list structure of_LtSP, which is originators, as well as by many o4hors, and toooy there is a vast literature often implemented by giving ~ unique cell to ~ach atom, but not to each on the subject. Parnas [74], Milner [71] and Hoare [41] were important list structure. QLISP can be seen as an experiment with the 'hashcons' early theoretical innuences in this development. All three approaches final realization of list structure; it was found to run too slowly for nlany recognize that a concrete data type is a many-sorted algebra.t The applications. Abstract Prolog machines also now tend to replicate algebraic approach to abstract data types (any of the three versions) goes information rather than to share it, and are therefore closer to an initial beyond this in lIUlt one gives sOlne equations that the functions ought to realization than to a final realization [90]. In summary, initial realizations salisry, and then restricts attention to models where they do. The initial are appropriate in case all behavior is visible behavior; final rcaliz.ltions algebra approach produces a 'standard' model that is defined uniquely up may be appropriate in case

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    43 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us