Formalising Bitonic Sort in Type Theory

  • Ana Bove
  • Thierry Coquand
Part of the Lecture Notes in Computer Science book series (LNCS, volume 3839)


We discuss two complete formalisations of bitonic sort in constructive type theory. Bitonic sort is one of the fastest sorting algorithms where the sequence of comparisons is not data-dependent. In addition, it is a general recursive algorithm. In the formalisation we face two main problems: only structural recursion is allowed in type theory, and a formal proof of the correctness of the algorithm needs to consider quite a number of cases. In our first formalisation we define bitonic sort over dependently-typed binary trees with information in the leaves and we make use of the 0-1-principle to prove that the algorithm sorts inputs of arbitrary types. In our second formalisation we use notions from linear orders, lattice theory and monoids. The correctness proof is directly performed for any ordered set and not only for Boolean values.


Distributive Lattice Linear Order Binary Tree Type Theory Algorithm Sort 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
  2. 2.
  3. 3.
    Batcher, K.E.: Sorting networks and their applications. In: Spring Joint Computer Conference, AFIPS Proc., vol. 32, pp. 307–314 (1968)Google Scholar
  4. 4.
    Birkhoff, G.: Lattice theory. Amer. Math. Soc., Providence (1967)zbMATHGoogle Scholar
  5. 5.
    Bove, A.: Formalising bitonic sort using dependent types. Technical Report, Chalmers University of Technology (October 2004), Available on the WWW:
  6. 6.
    Coquand, T., Huet, G.: The Calculus of Constructions. Information and Computation 76, 95–120 (1988)zbMATHCrossRefMathSciNetGoogle Scholar
  7. 7.
    Couturier, R.: Formal engenieering of the bitonic sort using pvs. In: 2nd. Irish Workshop on Formal Method, Cork, Ireland (1998)Google Scholar
  8. 8.
    Day, N.A., Launchbury, J., Lewis, J.: Logical abstractions in haskell. In: Proceedings of the 1999 Haskell Workshop, Technical Report UU-CS-1999-28 (October 1999)Google Scholar
  9. 9.
  10. 10.
    Haiyan, Q.: Testing and Proving in Dependent Type Theory. PhD thesis, Department of Computing Science, Chalmers University of Technology (2003)Google Scholar
  11. 11.
    Horn, A., Tarski, A.: Measures in Boolean algebras. Trans. Amer. Math. Soc. (64), 467–497 (1948)Google Scholar
  12. 12.
    Peyton Jones, S. (ed.): Haskell 1998 Language and Libraries The Revised Report. Cambridge University Press, Cambridge (2003)Google Scholar
  13. 13.
    Knuth, D.E.: The Art of Computer Programming: Sorting and Searching. Addison-Wesley, Reading (1973)Google Scholar
  14. 14.
    Martin-Löf, P.: Intuitionistic Type Theory. Bibliopolis, Napoli (1984)zbMATHGoogle Scholar
  15. 15.
    Reynolds, J.C.: Types, abstraction and parametric polymorphism. In: Mason, R.E.A. (ed.) Information Processing 1983, Proceedings of the 9th IFIP World Computer Congress, Paris, France, pp. 513–523. North-Holland, Amsterdam (1983)Google Scholar
  16. 16.
    Rota, G.: The valuation ring of a distributive lattice. In: Proceedings of the University of Houston Lattice Theory Conference, Houston, Tex., pp. 574–628 (1973)Google Scholar
  17. 17.
    Rushby, J.: The pvs verification system (1998),

Copyright information

© Springer-Verlag Berlin Heidelberg 2006

Authors and Affiliations

  • Ana Bove
    • 1
  • Thierry Coquand
    • 1
  1. 1.Department of Computer Science and EngineeringChalmers University of TechnologyGöteborgSweden

Personalised recommendations