## Order-Sorted Algebra I: Equational Deduction for Multiple Inheritance, Overloading, Exceptions and Partial Operations (1992)

Venue: | Theoretical Computer Science |

Citations: | 208 - 33 self |

### BibTeX

@ARTICLE{Goguen92order-sortedalgebra,

author = {Joseph A. Goguen},

title = {Order-Sorted Algebra I: Equational Deduction for Multiple Inheritance, Overloading, Exceptions and Partial Operations},

journal = {Theoretical Computer Science},

year = {1992},

volume = {105},

pages = {217--273}

}

### Years of Citing Articles

### OpenURL

### Abstract

This paper generalizes many-sorted algebra (hereafter, MSA) to order-sorted algebra (hereafter, OSA) by allowing a partial ordering relation on the set of sorts. This supports abstract data types with multiple inheritance (in roughly the sense of object-oriented programming), several forms of polymorphism and overloading, partial operations (as total on equationally defined subsorts), exception handling, and an operational semantics based on term rewriting. We give the basic algebraic constructions for OSA, including quotient, image, product and term algebra, and we prove their basic properties, including Quotient, Homomorphism, and Initiality Theorems. The paper's major mathematical results include a notion of OSA deduction, a Completeness Theorem for it, and an OSA Birkhoff Variety Theorem. We also develop conditional OSA, including Initiality, Completeness, and McKinsey-Malcev Quasivariety Theorems, and we reduce OSA to (conditional) MSA, which allows lifting many known MSA results to OSA. Retracts, which intuitively are left inverses to subsort inclusions, provide relatively inexpensive run-time error handling. We show that it is safe to add retracts to any OSA signature, in the sense that it gives rise to a conservative extension. A final section compares and contrasts many different approaches to OSA. This paper also includes several examples demonstrating the flexibility and applicability of OSA, including some standard benchmarks like STACK and LIST, as well as a much more substantial example, the number hierarchy from the naturals up to the quaternions.

### Citations

1855 |
Foundations of Logic Programming
- Lloyd
- 1987
(Show Context)
Citation Context ...ed upon higher order equational logic. ffl relational (i.e., predicate, or Horn clause, or "logic") programming, where the logic is first order Horn clause logic (without equality), as in pu=-=re Prolog [52]-=-. ffl multiparadigm programming, by combining the underlying logical systems, for example, to get combined relational and functional programming from Horn clause logic with equality as in Eqlog [26], ... |

1361 | An axiomatic basis for computer programming
- Hoare
- 1969
(Show Context)
Citation Context ...ical programming language "wears its semantics on its sleeve" and does not need the complex machinery of Scott-Strachey-style "denotational" semantics [70, 74] or of Hoare-style &q=-=uot;axiomatic" semantics [43]-=-. In fact, we would claim that a language that can only be given a semantics in one of these styles, and 2 The basic intuitions for this view were expressed in [26] and formalized using institutions i... |

1267 |
Smalltalk-80: the language and its implementation
- Goldberg, Robson
- 1983
(Show Context)
Citation Context ...vast amount of related work that we can hardly do more than cite examples almost at random, including the following: 1. Implementations of inheritance in Simula [12] as further developed in Smalltalk =-=[37]-=- and other object-oriented languages. 2. Overloading and subtypes in Ada [13]. 3. The theory of (higher order) polymorphism as developed in [58], [68], [8] and [55], among many others. 4. There has be... |

936 | A theory of type polymorphism in progra.mming - Milner - 1978 |

921 |
Categories for the working mathematician
- Lane
- 1998
(Show Context)
Citation Context ... ;J there are isomorphisms A ' A #ffl and B ' B ffl# that are natural 12 in A and B, respectively. 12 The condition for an isomorphism to be natural is spelled out in the body of this proof; see also =-=[50]-=-, Theorem IV.4. 27 Proof: Given B in Alg \Sigma # ;J we define B ffl as follows: First, notice that, for each connected component C of S, the sets fB s j s 2 Cg together with their c s;s 0 form a filt... |

758 | On understanding types, data abstraction, and polymorphism
- Cardelli, Wegner
- 1985
(Show Context)
Citation Context ...mula [12] as further developed in Smalltalk [37] and other object-oriented languages. 2. Overloading and subtypes in Ada [13]. 3. The theory of (higher order) polymorphism as developed in [58], [68], =-=[8] and [55], among man-=-y others. 4. There has been recent work on adding subtypes to higher order calculi [7, 2]. 37 5. Work on "classified algebras" [78] and on "multi-target operation" algebra [39]. 6.... |

620 |
The Art of Prolog
- Sterling, Shapiro
- 1986
(Show Context)
Citation Context ...l Semantics The original vision of "logic programming" called for using pure first order predicate calculus directly as a programming language [49]. As has been well argued by Prolog advocat=-=es (e.g., [73]-=-), this confers some important benefits, including: program simplicity and clarity (which can greatly ease program understanding, reusability, debugging and maintenance); separation of logic and contr... |

536 |
The Implementation of Functional Programming Languages
- Jones
- 1987
(Show Context)
Citation Context ...te Rule Machine Project at SRI is developing a parallel architecture on which term rewriting promises to be much more efficient than conventional languages on conventional machines [51, 31]; see also =-=[46] for -=-a survey of efficient implemention techniques for higher order functional programming. Term rewriting provides a complete deductive system for equality, and any expression reduces to a unique "ca... |

486 | A semantics of Multiple Inheritance
- Cardelli
- 1984
(Show Context)
Citation Context ... and [41], which uses partial algebras to give a semantics for subscripted variables. 7. There is some explicit theory of multiple inheritance in the context of object-oriented programming, including =-=[6]-=- and [76], and we have ourselves applied order-sorted algebra to this problem [30]. 8. There is also some work giving operational semantics for subsorts by rewriting, e.g., [11] and [80]; [23] and [48... |

476 |
Institutions: Abstract model theory for specication and programming
- Goguen, Burstall
- 1992
(Show Context)
Citation Context ...OOPS [30], and all three paradigms together from a reflective Horn clause logic with equality as in FOOPlog [30]. Logical programming can be given a precise grounding using the notions of institution =-=[22] and -=-logical system [54], and this is in part responsible for the cleanliness and simplicity of the various languages that we have designed. A logical programming language "wears its semantics on its ... |

368 |
Logic for problem solving
- Kowalski
- 1979
(Show Context)
Citation Context ...ted in Part III of this paper. 1.2 Logical and Operational Semantics The original vision of "logic programming" called for using pure first order predicate calculus directly as a programming=-= language [49]-=-. As has been well argued by Prolog advocates (e.g., [73]), this confers some important benefits, including: program simplicity and clarity (which can greatly ease program understanding, reusability, ... |

364 |
Towards a theory of type structure
- Reynolds
- 1974
(Show Context)
Citation Context ... in Simula [12] as further developed in Smalltalk [37] and other object-oriented languages. 2. Overloading and subtypes in Ada [13]. 3. The theory of (higher order) polymorphism as developed in [58], =-=[68], [8] and [55], amon-=-g many others. 4. There has been recent work on adding subtypes to higher order calculi [7, 2]. 37 5. Work on "classified algebras" [78] and on "multi-target operation" algebra [39... |

273 |
An Initial Algebra Approach to the Specification, Correctness and Implementation of Abstract Data Types
- Goguen, Thatcher, et al.
- 1978
(Show Context)
Citation Context ...rroneous and meaningless expressions, such as the top of an empty stack or division by zero. This has been an important problem from the earliest days of the algebraic approach to abstract data types =-=[35]-=-. Error algebra was a first try at a more elegant solution [17], but unfortunately error algebra specifications do not always have initial algebras [65]. OSA, which originated in [18], provides what n... |

175 |
On the structure of abstract algebras
- Birkhoff
- 1935
(Show Context)
Citation Context ...ee [38] 63.3, where the statement is one-sorted; note that our formulation considers limits and colimits up to isomorphism, so we do not need closure under isomorphisms). The Birkhoff Variety Theorem =-=[1]-=- characterizes classes of algebras definable by unconditional equations as those classes closed under products, subalgebras, and homomorphic images (Birkhoff's original formulation was one-sorted; see... |

174 |
The Mathematics of Inheritance Systems
- Touretzky
- 1986
(Show Context)
Citation Context ...], which uses partial algebras to give a semantics for subscripted variables. 7. There is some explicit theory of multiple inheritance in the context of object-oriented programming, including [6] and =-=[76]-=-, and we have ourselves applied order-sorted algebra to this problem [30]. 8. There is also some work giving operational semantics for subsorts by rewriting, e.g., [11] and [80]; [23] and [48] give de... |

168 |
General logics
- Meseguer
- 1989
(Show Context)
Citation Context ... paradigms together from a reflective Horn clause logic with equality as in FOOPlog [30]. Logical programming can be given a precise grounding using the notions of institution [22] and logical system =-=[54], and this-=- is in part responsible for the cleanliness and simplicity of the various languages that we have designed. A logical programming language "wears its semantics on its sleeve" and does not nee... |

161 |
The semantics of Clear, a specification language
- Burstall, Goguen
- 1980
(Show Context)
Citation Context ...ional logic. Part III will give an algebraic semantics for parameterized order-sorted abstract data types with the related concepts of theory, view and module expression, as in OBJ [14, 15] and Clear =-=[3, 4]. This sup-=-ports the effective integration of the programming and assertional aspects of OBJ, which make it a "wide spectrum" language. 1.7 Acknowledgements We thank Prof. Jean-Pierre Jouannaud for hel... |

160 |
A non-strict functional language with polymorphic types
- Miranda
- 1985
(Show Context)
Citation Context ..., integer, and rational numbers. ffl parametric polymorphism, as in Strachey's Map function; this is implemented in higher order functional programming languages such as Hope [5], ML [40] and Miranda =-=[77]-=-. OSA distinguishes and supports all four styles of polymorphism. Ad hoc polymorphism is supported by signatures in which the same symbol is used for sorts that are unrelated in the inheritance hierar... |

156 |
Fundamental concepts in programming languages
- Strachey
- 1967
(Show Context)
Citation Context ...xpress the use of a single operation symbol with different meanings in a programming language. He distinguished two main forms of polymorphism, which he called ad hoc and parametric. In his own words =-=[75]-=-: In ad hoc polymorphism there is no simple systematic way of determining the type of the result from the type of the arguments. There may be several rules of limited extent which reduce the number of... |

144 |
Putting Theories Together to Make Specifications
- Burstall, Goguen
- 1977
(Show Context)
Citation Context ...ional logic. Part III will give an algebraic semantics for parameterized order-sorted abstract data types with the related concepts of theory, view and module expression, as in OBJ [14, 15] and Clear =-=[3, 4]. This sup-=-ports the effective integration of the programming and assertional aspects of OBJ, which make it a "wide spectrum" language. 1.7 Acknowledgements We thank Prof. Jean-Pierre Jouannaud for hel... |

134 |
Formal Philosophy: Selected Papers of Richard Montague
- Montague
- 1974
(Show Context)
Citation Context ... 37 5. Work on "classified algebras" [78] and on "multi-target operation" algebra [39]. 6. Work on the semantics of natural and artificial languages, including: [45], which shows h=-=ow Montague grammar [59]-=- (a formal system for natural language semantics) can be treated with a version of initial algebra semantics with subsorts; [33], which uses error algebras to define programming languages (and thus co... |

130 |
Toward a mathematical semantics for computer languages
- Scott, Strachey
- 1971
(Show Context)
Citation Context ...he various languages that we have designed. A logical programming language "wears its semantics on its sleeve" and does not need the complex machinery of Scott-Strachey-style "denotatio=-=nal" semantics [70, 74] or of Hoa-=-re-style "axiomatic" semantics [43]. In fact, we would claim that a language that can only be given a semantics in one of these styles, and 2 The basic intuitions for this view were expresse... |

118 |
Parameterized Programming
- Goguen
- 1984
(Show Context)
Citation Context ...ese features. The research reported here supports OBJ, a programming language with mathematical semantics given by order-sorted algebra, and operational semantics given by order-sorted term rewriting =-=[19, 14, 15, 23]-=-. Our experience with OBJ shows that subsorts are enormously helpful in practice, since they can greatly improve both expressivity and readability. 1.1 Type Disciplines A type discipline for a program... |

118 |
Report on the functional programming language Haskell (v1.1
- Hudak, Wadler
- 1991
(Show Context)
Citation Context ...e cannot know in advance whether or not some proposed feature might work. Discussions about overloading are difficult, and sometimes even acrimonious, for languages as diverse as Ada [13] and Haskell =-=[44]-=-, precisely because of the lack of an underlying semantic basis for these discussions. We also wish to mention that requiring signatures to be coherent allows a very simple and flexible treatment of e... |

106 |
Introducing OBJ3
- Goguen, Winkler
- 1988
(Show Context)
Citation Context ...Stack . op top : NeStack -? Int . op pop : NeStack -? Stack . var E : Int . var S : Stack . eq top(push(E,S)) = E . eq pop(push(E,S)) = S . endo 2 The above examples are actually executable OBJ3 code =-=[36]-=-. Of course, our development of OSA is fully general and considers arbitrary models for sets of equations over an ordersorted signature. OBJ uses this `loose' or `theory' semantics to describe require... |

100 |
EQLOG: equality, types and generic modules for logic programming
- Goguen, Meseguer
(Show Context)
Citation Context ...g [52]. ffl multiparadigm programming, by combining the underlying logical systems, for example, to get combined relational and functional programming from Horn clause logic with equality as in Eqlog =-=[26]-=-, combined functional and object-oriented programming from reflective equational logic as in FOOPS [30], and all three paradigms together from a reflective Horn clause logic with equality as in FOOPlo... |

99 |
Unifying functional, object-oriented and relational programming with logical semantics
- Goguen, Meseguer
- 1987
(Show Context)
Citation Context ... combined relational and functional programming from Horn clause logic with equality as in Eqlog [26], combined functional and object-oriented programming from reflective equational logic as in FOOPS =-=[30]-=-, and all three paradigms together from a reflective Horn clause logic with equality as in FOOPlog [30]. Logical programming can be given a precise grounding using the notions of institution [22] and ... |

98 |
Universal Algebra
- Grätzer
- 1979
(Show Context)
Citation Context ...The MSA McKinsey-Malcev Theorem states that a class of many-sorted algebras is definable by conditional equations iff it is closed under products, subalgebras, and filtered colimits (for example, see =-=[38]-=- 63.3, where the statement is one-sorted; note that our formulation considers limits and colimits up to isomorphism, so we do not need closure under isomorphisms). The Birkhoff Variety Theorem [1] cha... |

81 |
Initiality, Induction and Computability
- Meseguer, Goguen
- 1985
(Show Context)
Citation Context ...hat the standard MSA term algebra construction gives an initial order-sorted algebra. We first review the inductive construction of the many-sorted term algebra T \Sigma using the same notation as in =-=[57]-=-, except that we will be more pedantic, using ( and ) to denote parentheses used as formal syntactic symbols; however, this pedantry is only temporary. If \Sigma is a many-sorted signature with sort s... |

80 |
Equational Logic as a Programming Language
- O’Donnell
- 1985
(Show Context)
Citation Context ...eoretic semantics 5 . Although equational deduction by undirected replacement of equals by equals can be very inefficient, directed replacement (i.e., term rewriting) can be much faster. For example, =-=[62]-=- claims speeds comparable to compiled Lisp on sequential machines for a (restricted) class of equations, and the Rewrite Rule Machine Project at SRI is developing a parallel architecture on which term... |

66 |
Universal realization, persistent interconnection and implementation of abstract modules
- Goguen, Meseguer
- 1982
(Show Context)
Citation Context ...etermined by the context in which you want to use it. OSA again saves the day, although some concepts not discussed in this paper are needed: the notion of behavioral equivalence of abstract machines =-=[24, 57]-=- can be slightly generalized to consider only certain designated subsorts, e.g., those that exclude the error messages; behavior outside these subsorts is not specified, and thus need not be verified.... |

61 |
an experimental applicative language
- Hope
- 1980
(Show Context)
Citation Context ...ed, as with + for natural, integer, and rational numbers. ffl parametric polymorphism, as in Strachey's Map function; this is implemented in higher order functional programming languages such as Hope =-=[5]-=-, ML [40] and Miranda [77]. OSA distinguishes and supports all four styles of polymorphism. Ad hoc polymorphism is supported by signatures in which the same symbol is used for sorts that are unrelated... |

61 |
Completeness of many-sorted equational logic
- Goguen, Meseguer
- 1985
(Show Context)
Citation Context ...ies this injectivity condition. Although they are pathological, unfaithful presentations do exist, and for them the extension with retracts is not conservative, as shown by the following example from =-=[25]-=-: Example 3.4 Let \Sigma have sorts a; b; u with a; bsu, have an operation f : a ! b, have no constants of sort a, have constants 0; 1 of sort b, plus +; & binary infix and : unary prefix of sort b. L... |

58 | Structural subtyping and the notion of power type
- Cardelli
- 1988
(Show Context)
Citation Context ...ubtypes in Ada [13]. 3. The theory of (higher order) polymorphism as developed in [58], [68], [8] and [55], among many others. 4. There has been recent work on adding subtypes to higher order calculi =-=[7, 2]. 37 5. Work on &quo-=-t;classified algebras" [78] and on "multi-target operation" algebra [39]. 6. Work on the semantics of natural and artificial languages, including: [45], which shows how Montague grammar... |

52 |
The Simula 67 Common Base Language
- Dahl, Myhrhaung, et al.
- 1968
(Show Context)
Citation Context ... both limitations by combining two key ideas: inheritance and subsort polymorphism. 1.1.1 Inheritance and Polymorphism Inheritance as a programming language feature developed from the Simula language =-=[12]-=-, and intuitively corresponds to inclusion of concepts, as found in natural language. For example, we say that every hound is a dog and that every dog is a mammal, because our concept of mammal includ... |

51 |
Using category theory to design implicit conversions and generic operators
- Reynolds
- 1980
(Show Context)
Citation Context ...and w 0sw and sss 0 , then oe: w 0 ! s 0 is in \Sigma. Our weaker notion of regular signature is intended to capture ad hoc polymorphism. Reynolds has subsequently abandoned the algebraic approach of =-=[69]-=-, since (he says) it fails to handle the higher-order case. However, higher-order abstract data types have been treated by [64], even with a notion of subsort; see [66] for some corrections to [64]. I... |

51 |
A many-sorted calculus based on resolution and paramodulation
- Walther
- 1987
(Show Context)
Citation Context ...l algebra and the explicit error sort approaches. There is also now much interesting work on unification for order-sorted algebra, including [11] and [80], who discuss algorithms for unification, and =-=[79]-=-, who argues for the utility of subsorts in connection with resolution and paramodulation. [18] gives a systematic treatment of order sorted unification that is consistent with the present paper, and ... |

50 |
Order-sorted equational computation
- Smolka, Nutt, et al.
- 1989
(Show Context)
Citation Context ...per. 5.2.1 Summary We may summarize the above discussion with the following points: ffl There is basic agreement among all authors about the concept of order-sorted signature; also, the approaches in =-=[16, 67, 71, 72]-=- are all equivalent (except perhaps for an inessential restriction in [16]). ffl Our approach is more general in the sense that, for each signature, the algebras and homomorphism of the alternative ap... |

49 |
Unified algebras and institutions
- Mosses
- 1989
(Show Context)
Citation Context ...[23] and [48] give details of two different operational semantics that implement precisely the framework given in this paper. 9. Peter Mosses has generalized order-sorted algebra to "unified alge=-=bra" [61], which tr-=-eats elements and subsorts in a uniform way, and thus can handle non-determinism in an algebraic setting. Mosses developed this formalism to support his "action semantics, " an algebraic app... |

43 |
Order-Sorted Algebra Solves the Constructor-Selector, Multiple Representation and
- Goguen, Meseguer
- 1987
(Show Context)
Citation Context ...r signatures (Definition 2.3 below), any expression involving subsort polymorphism has a smallest sort. OSA also nicely accomodates coercions and multiple representation polymorphism, as discussed in =-=[29]-=- and briefly reviewed in Section 1.5 below, while parametric polymorphism is provided by parameterized ordered-sorted algebras such as LIST[X] that provide higher-order capabilities in a first-order s... |

42 |
Models and equality for logical programming
- Goguen, Meseguer
- 1987
(Show Context)
Citation Context ...s that we feel should be expected for equational deduction. Of course, there are many possible variations on this rule set; for example, see [72]. Also, order-sorted Horn clause logic is discussed in =-=[28]-=-, and [27] gives an overview of the equational case. 3.2 Completeness and Initiality Theorems We now show that the above rules are sound and complete for deriving all the unconditional equations that ... |

39 |
Order sorted algebra
- Goguen
- 1978
(Show Context)
Citation Context ...tract data types [35]. Error algebra was a first try at a more elegant solution [17], but unfortunately error algebra specifications do not always have initial algebras [65]. OSA, which originated in =-=[18]-=-, provides what now seems a fully satisfactory and very flexible approach that provides: 1. Several forms of polymorphism and overloading; 2. Error definition, detection and recovery; 3. Multiple inhe... |

35 |
Foundations and Applications of Montague Grammar
- Janssen
- 1983
(Show Context)
Citation Context ...ubtypes to higher order calculi [7, 2]. 37 5. Work on "classified algebras" [78] and on "multi-target operation" algebra [39]. 6. Work on the semantics of natural and artificial la=-=nguages, including: [45]-=-, which shows how Montague grammar [59] (a formal system for natural language semantics) can be treated with a version of initial algebra semantics with subsorts; [33], which uses error algebras to de... |

34 |
Operational semantics for order-sorted algebra
- Goguen, Jouannaud, et al.
(Show Context)
Citation Context ...ese features. The research reported here supports OBJ, a programming language with mathematical semantics given by order-sorted algebra, and operational semantics given by order-sorted term rewriting =-=[19, 14, 15, 23]-=-. Our experience with OBJ shows that subsorts are enormously helpful in practice, since they can greatly improve both expressivity and readability. 1.1 Type Disciplines A type discipline for a program... |

29 |
Higher-order functions considered unnecessary for higher-order programming
- Goguen
- 1990
(Show Context)
Citation Context ...iefly reviewed in Section 1.5 below, while parametric polymorphism is provided by parameterized ordered-sorted algebras such as LIST[X] that provide higher-order capabilities in a first-order setting =-=[21]. The-=-se are called parameterized objects in the OBJ language [14, 15, 19], and their semantics will be treated in Part III of this paper. 1.2 Logical and Operational Semantics The original vision of "... |

29 |
Operational semantics of OBJ3
- Kirchner, Kirchner, et al.
- 1988
(Show Context)
Citation Context ...2 [23] reduces order-sorted rewriting to many-sorted rewriting using results in Section 4 and [23]. ffl OBJ3 uses a more efficient operational semantics that does order-sorted term rewriting directly =-=[48]-=-. 1.3 Retracts In a strongly typed programming language, certain expressions may fail strong type checking, even though intuitively they have a meaningful value. For example, if the factorial function... |

26 |
Abstract semantic algebras
- Mosses
- 1983
(Show Context)
Citation Context ...orts in a uniform way, and thus can handle non-determinism in an algebraic setting. Mosses developed this formalism to support his "action semantics, " an algebraic approach to denotational =-=semantics [60]. There ar-=-e many interesting relationships among these papers: for example, [16] follows [18] in using signatures \Sigma that are "fully overloaded" in the sense that if oe: w ! s is in \Sigma and w 0... |

23 | Abstract Errors for Abstract Data Types - Goguen - 1979 |

21 |
An introduction to OBJ: A language for writing and testing software
- Goguen, Tardo
- 1979
(Show Context)
Citation Context ...sgi, who worked out much of the OBJ2 implementation [14, 15], Prof. David Plaisted, who worked out much of the OBJ1 implementation [32], and Dr. Joseph Tardo, who did the original OBJT implementation =-=[34]-=-. Drs. Christoph Walther, Gert Smolka and Harald Ganzinger deserve thanks for pointing out a bug in the definition of direct deduction in an earlier draft, and Smolka has also made many other useful s... |

16 |
Algebras with a scheme of operators
- Higgins
- 1963
(Show Context)
Citation Context ...characterizes classes of algebras definable by unconditional equations as those classes closed under products, subalgebras, and homomorphic images (Birkhoff's original formulation was one-sorted; see =-=[42]-=- for the first many-sorted formulation, and [25] for a corrected statement regarding quantification of variables and a discussion of infinitely many sorts). Our aim is to use the equivalence of catego... |