|
Order-sorted algebra I : equational deduction for
multiple inheritance, overloading, exceptions and partial operations
Joseph Goguen
and Jose Meseguer
December 1989, 49 pages
This paper generalizes many-sorted algebra (hereafter, MSA)
to order-sorted algebra (hereafter, OSA) by alowing 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,
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.
|