Algebraic implementation of abstract data types

H. Ehrig, H.-J. Kreowski, B. Mahr, P. Padawitz
1982 Theoretical Computer Science  
Starting with a review of the theory of algebraic specifications in the sense of the ADJ-group a new theory for algebraic implementations of abstract data types is presented. While main concepts of this new theory were given already at several conferences this paper provides the full theory of algebraic implementations developed in Berlin except of complexity considerations which are given in a separate paper. The new concept of algebraic implementations includes implementations for algorithms
more » ... n specific programming languages and on the other hand it meets also the requirements for stepwise refinement of structured programs and software systems as introduced by Dijkstra and Wirth. On the syntactical level an algebraic implementation corresponds to a system of recursive programs while the semantical level is defined by algebraic constructions, called SYNTHESIS, RESTRICTION and IDENTIFICATION. Moreover the concept allows composition of implementations and a rigorous study of correctness. The main results of the paper are different kinds of correctness criteria which are applied to a number of illustrating examples including the implementation of sets by hash-tables. Algebraic implementations of larger systems like a histogram or a parts system are given in separate case studies which, however, are not included in this paper. * This paper is a revised and extended version of our ICALP-paper [18J combined with our MFCS-paper [14]. 0304-3975/82/0000-0000/$02.75 © 1982 North-Holland S of sorts, a family I = (IW.S)WES*.SES of operation (symbol)s and a family E = (ES)SES of equations. The sorts s E S denote data domains. The operations 0-E I w ." also written (T: ws E I, are declarations with name (T, domain w = s 1 ... sn (si E S, i = 1, ... , n) and range s E S. In the special case w = A (empty word) 0-is called O-ary or constant. The equations e = (L, R) E E" more intuitively written L = R, are pairs of I -terms of sort s with variables. I-terms of sort s with variables of a given family X = (X s )SES are sets TI(X), which (simultaneously for all s E S) are recursively defined by (i) (T E TI(X), for all 0-E I A ", (ii) x E TI(X)s for all x EX" (iii) 0-((1, ... , tn) E TI(X)s for all (T E Isl... sn ", ti E TI(X)si, i = 1, ... , n. In the denotation of examples specifications are in bold italics and sorts in normal italics, operations and equations are not presented as sets but they are listed behind the corresponding key words "sorts", "opns", and "eqns" respectively. The key words are omitted if the corresponding sets are empty. 2.1. Examples. (1) The basic specification of natural numbers is given by nat sorts: nat opns: 0:~nat SUCC: nat~nat All nat-terms (without variables) are of the form SUCC n (0) for n~O. This basic specification can be used to specify additional operations like ADD, MULT : nal nat~nat (see [1] or [15]) or the Ackermann function ackermann = nat + opns: A: nat nat~nat
doi:10.1016/s0304-3975(82)80001-7 fatcat:sjife7d2urcf5cp3xvfvnc322i