research

Order-sorted algebra I: equational deduction for multiple inheritance, overloading, exceptions and partial operations

Abstract

AbstractThis paper generalizes many-sorted algebra (MSA) to order-sorted algebra (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

    Similar works