Abstract
We describe an extension of Martin-Löf's type theory with dependent record types and subtyping and use it for obtaining a formal definition of a general structure of the algorithms of sorting by insertion. We start by giving a general formulation of the sorting problem according to which the most general sorting algorithms are those that can be used for ordering lists over any set, along any total relation on the set. In particular, the best known members of the family of algorithms of sorting by insertion, namely straight insertion sort and tree sort, are of this kind. The proposed structure of the algorithms of sorting by insertion is based upon a specification of an abstract data type, which we call of insertion structures. The general method of sorting by insertion is then written as a program depending on unspecified implementation of insertion structures. We therefore call it abstract insertion sort. The concrete algorithms of sorting by insertion correspond to particular implementations of insertion structures. We discuss how it is possible to peecify the operations on insertion structures so as to accurately describe the intended family of algorithms. We also derive axioms for the insertion structures so as to obtain a natural decomposition into lemmas of the proofs of correctness of the algorithms of the family.
The whole work serves to illustrate how abstract data types and their implementations can be formally treated in the considered extension of type theory. All the definitions are presented here in ordinary mathematical language using the concepts and some of the notation of the formal theory. They have also been totally formalized and verified using a type checker for the extended theory that has been implemented.
Preview
Unable to display preview. Download preview PDF.
References
Betarte G., Tasistro A. Extension of Martin-Löf's type theory with record types and subtyping. In Proceedings of the Conference “25 Years of Constructive Type Theory”, Oxford University Press, 1997.
Coquand, Th., Nordström B., Smith J. M., von Sydow B. Type theory and programming. EATCS 52, 1994.
Knuth D. The art of computer programming. Vol. 3: Sorting and searching. Addison Wesley, 1973.
Martin-Löf P. Philosophical implications of type theory. Lectures given at the Facoltá de Lettere e Filosofia, Universitá degli Studi di Firenze, Florence, March 15th.–May 15th., 1987. Privately circulated notes.
Nordström B., Petersson K., Smith J. M. Programming in Martin-Löf's type theory. An introduction. Oxford Science Publications, 1990.
Author information
Authors and Affiliations
Corresponding author
Editor information
Rights and permissions
Copyright information
© 1998 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Tasistro, A. (1998). Abstract insertion sort in an extension of type theory with record types and subtyping. In: Giménez, E., Paulin-Mohring, C. (eds) Types for Proofs and Programs. TYPES 1996. Lecture Notes in Computer Science, vol 1512. Springer, Berlin, Heidelberg. https://doi.org/10.1007/BFb0097801
Download citation
DOI: https://doi.org/10.1007/BFb0097801
Published:
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-65137-6
Online ISBN: 978-3-540-49562-8
eBook Packages: Springer Book Archive