Advertisement

Quicksort Revisited

Verifying Alternative Versions of Quicksort
  • Razvan Certezeanu
  • Sophia Drossopoulou
  • Benjamin Egelund-Muller
  • K. Rustan M. Leino
  • Sinduran Sivarajan
  • Mark WheelhouseEmail author
Chapter
Part of the Lecture Notes in Computer Science book series (LNCS, volume 9660)

Abstract

We verify the correctness of a recursive version of Tony Hoare’s \(\texttt {quicksort}\) algorithm using the Hoare-logic based verification tool Dafny. We then develop a non-standard, iterative version which is based on a stack of pivot-locations rather than the standard stack of ranges. We outline an incomplete Dafny proof for the latter.

Keywords

Automated verification Algorithms Quicksort Program transformation 

Notes

Acknowledgments

We thank Krysia Broda for showing us the recursive, non-standard version of quicksort, and the anonymous reviewers of this volume for valuable suggestions and pointers.

Razvan Certezeanu, Benjamin Egelund-Muller and Sinduran Sivarajan thank the Department of Computing at Imperial College for funding their Undergraduate Research Opportunities Programme (UROP) Placements, undertaken under Mark Wheelhouse’s supervision, which they spent working on Apollo, and this paper.

Sophia Drossopoulou thanks Microsoft Research and Judith Bishop for a research gift and her very warm hospitality at Microsoft Research, and the EU project Upscale, FP7-612985, for supporting part of this work, and for the opportunity to collaborate with Frank S. de Boer, the recipient of this Festschrift.

References

  1. 1.
    Apt, K., Boer, F., Olderog, E.: Verification of Sequential and Concurrent Programs. Springer, Dordrecht (2009)CrossRefzbMATHGoogle Scholar
  2. 2.
    Beckert, B., Hähnle, R., Schmitt, P.H. (eds.): Verification of Object-Oriented Software. The KeY Approach. LNCS (LNAI), vol. 4334. Springer, Heidelberg (2007)Google Scholar
  3. 3.
    Certezeanu, R., Drossopoulou, S., Egelund-Muller, B., Sivarajan, S., Wheelhouse, M., Leino, K.: Dafny Code for Variations on Quicksort. http://www.doc.ic.ac.uk/~mjw03/research/quicksort.html
  4. 4.
    Certezeanu, R., Drossopoulou, S., Egelund-Muller, B., Sivarajan, S., Wheelhouse, M., Leino, K.:Apollo: An interactive Program and Proof development tool for Java and Haskell, based on Dafny (to appear)Google Scholar
  5. 5.
    Foley, M., Hoare, C.: Proof of a recursive program: quicksort. Comput. J. 14, 391–395 (1971)MathSciNetCrossRefzbMATHGoogle Scholar
  6. 6.
    de Gouw, S., Rot, J., de Boer, F.S., Bubel, R., Hähnle, R.: OpenJDK’s Java.utils.Collection.sort() is broken: the good, the bad and the worst case. In: Kroening, D., Păsăreanu, C.S. (eds.) CAV 2015. LNCS, vol. 9206, pp. 273–289. Springer, Heidelberg (2015)CrossRefGoogle Scholar
  7. 7.
    Hoare, C.: Algorithm 64: quicksort. Commun. ACM 4, 321 (1961)CrossRefGoogle Scholar
  8. 8.
    Hoare, C.: An axiomatic basis for computer programming. Commun. ACM 12, 576–580 (1969)CrossRefzbMATHGoogle Scholar
  9. 9.
    Lamort, L.:Thinking Above the Code. https://www.youtube.com/watch?v=-4Yp3j_jk8Q
  10. 10.
    Leino, K.R.M.: Dafny: an automatic program verifier for functional correctness. In: Clarke, E.M., Voronkov, A. (eds.) LPAR-16 2010. LNCS, vol. 6355, pp. 348–370. Springer, Heidelberg (2010)CrossRefGoogle Scholar
  11. 11.
    Leino, K.: Dafny: An Automatic Program Verifier for Functional Correctness. http://dafny.codeplex.com
  12. 12.
    Manna, Z.: Mathematical Theory of Computation. McGraw-Hill, New York (1974)zbMATHGoogle Scholar
  13. 13.
    Oracle Documentation: Arrays (Java Platform SE 7). http://docs.oracle.com/javase/7/docs/api/java/util/Arrays.html
  14. 14.
    The Verification Corner - Microsoft Research. http://research.microsoft.com/en-us/projects/verificationcorner
  15. 15.
  16. 16.
    YouTube: Quick-sort with Hungarian (Kkllmenti legnyes) folk dance. https://www.youtube.com/watch?v=ywWBy6J5gz8

Copyright information

© Springer International Publishing Switzerland 2016

Authors and Affiliations

  • Razvan Certezeanu
    • 1
  • Sophia Drossopoulou
    • 1
  • Benjamin Egelund-Muller
    • 1
  • K. Rustan M. Leino
    • 1
    • 2
  • Sinduran Sivarajan
    • 1
  • Mark Wheelhouse
    • 1
    Email author
  1. 1.Department of ComputingImperial College LondonLondonUK
  2. 2.Microsoft Research RedmondRedmondUSA

Personalised recommendations