Skip to main content

Constructing Tournament Representations: An Exercise in Pointwise Relational Programming

  • Conference paper
  • First Online:
Mathematics of Program Construction (MPC 2002)

Part of the book series: Lecture Notes in Computer Science ((LNCS,volume 2386))

Included in the following conference series:

Abstract

List or set comprehensions are a wonderful means to define nondeterministic or relational programs. Despite their beauty, comprehensions are somewhat underused in program calculation. The purpose of this paper is to remind the program-calculation community that comprehensions provide a convenient language for specifying and deriving nondeterministic programs in a pointwise manner. We illustrate the style of reasoning by re-solving the well-known problem of constructing tournament representations: Given a sequence x of integers, construct a heap whose inorder traversal is x itself.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 39.99
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. Lex Augusteijn. An alternative derivation of a binary heap construction function. In R.S. Bird, C.C. Morgan, and J.C.P Woodcock, editors, Second International Conference on the Mathematics of Program Construction, Oxford, volume 669 of Lecture Notes in Computer Science, pages 368–374. Springer, 1992.

    Google Scholar 

  2. Roland Backhouse. Galois connections and fixed point calculus, 2001. Lecture Notes.

    Google Scholar 

  3. Richard Bird. Introduction to Functional Programming using Haskell. Prentice Hall Europe, London, 2nd edition, 1998.

    Google Scholar 

  4. Richard Bird and Oege de Moor. Algebra of Programming. Prentice Hall Europe, London, 1997.

    MATH  Google Scholar 

  5. Richard S. Bird. Lectures on constructive functional programming. In Manfred Broy, editor, Constructive Methods in Computer Science. Springer-Verlag, 1988.

    Google Scholar 

  6. R. Burstall and J. Darlington. A tranformation system for developing recursive programs. Journal of the ACM, 24(1):44–67, 1977.

    Article  MATH  MathSciNet  Google Scholar 

  7. Oege de Moor and Jeremy Gibbons. Pointwise relational programming. In T. Rus, editor, Proceedings of Algebraic Methodology and Software Technology (AMAST 2000), Iowa, volume 1816 of Lecture Notes in Computer Science, pages 371–390. Springer-Verlag, May 2000.

    Chapter  Google Scholar 

  8. R.W. Floyd. Syntactic analysis and operator precedence. Journal of the ACM, 10(3):316–333, 1963.

    Article  MATH  Google Scholar 

  9. H.N. Gabow, J.L. Bentley, and R.E. Tarjan. Scaling and related techniques for geometry problems. In Proceedings of the 16th Annual ACM Symposium on Theory of Computing, pages 135–143, 1984.

    Google Scholar 

  10. Cordelia V. Hall, Kevin Hammond, Simon L. Peyton Jones, and Philip L. Wadler. Type classes in Haskell. ACM Transactions on Programming Languages and Systems, 18(2):109–138, March 1996.

    Google Scholar 

  11. Michael Hanus, editor. Curry—An Integrated Functional Logic Language (Version 0.7.1), June 2000.

    Google Scholar 

  12. Ralf Hinze. Prolog’s control constructs in a functional setting — Axioms and implementation. International Journal of Foundations of Computer Science, 12(2):125–170, 2001.

    Article  Google Scholar 

  13. Ralf Hinze and Ross Paterson. Derivation of a typed functional LR parser, 2002. in preparation.

    Google Scholar 

  14. B. Knaster. Un théorème sur les fonctions d’ensembles. Annales de la Societé Polonaise de Mathematique, 6:133–134, 1928.

    Google Scholar 

  15. Christos Levcopoulos and Ola Petersson. Heapsort—adapted for presorted files. In F. Dehne, J.-R. Sack, and N. Santoro, editors, Algorithms and Data Structures, volume 382 of Lecture Notes in Computer Science, pages 499–509. Springer, 1989.

    Google Scholar 

  16. Eugenio Moggi. An abstract view of programming languages. Technical Report ECS-LFCS-90-113, Department of Computer Science, Edinburgh University, 1990.

    Google Scholar 

  17. Eugenio Moggi. Notions of computation and monads. Information and Computation, 93(1):55–92, 1991.

    Article  MATH  MathSciNet  Google Scholar 

  18. Helmut A. Partsch. Specification and Transformation of Programs—A Formal Approach to Software Development. Texts and Monographs in Computer Science. Springer-Verlag, Berlin, 1990.

    MATH  Google Scholar 

  19. Simon Peyton Jones and John Hughes, editors. Haskell 98—A Non-strict, Purely Functional Language, February 1999. Available from http://www.haskell.org/definition/.

  20. Berry Schoenmakers. Inorder traversal of a binary heap and its inversion in optimal time and space. In R.S. Bird, C.C. Morgan, and J.C.P Woodcock, editors, Second International Conference on the Mathematics of Program Construction, Oxford, volume 669 of Lecture Notes in Computer Science, pages 291–301. Springer, 1992.

    Google Scholar 

  21. Michael Sperber and Peter Thiemann. Generation of LR parsers by partial evaluation. ACM Transactions on Programming Languages and Systems, 22(3):224–264, 2000.

    Article  Google Scholar 

  22. J.M. Spivey and S. Seres. Embedding Prolog in Haskell. In Erik Meijer, editor, Proceedings of the 3rd Haskell Workshop, Paris, France, September 1999. The proceedings appeared as a technical report of Universiteit Utrecht, UU-CS-1999-28.

    Google Scholar 

  23. H. Tamaki and T. Sato. Unfold/fold transformations of logic programs. In Second International Conference on Logic Programming, pages 127–138, 1984.

    Google Scholar 

  24. A. Tarski. A lattice-theoretic fixpoint theorem and its applications. Pacific Journal of Mathematics, 5:285–309, 1955.

    MATH  MathSciNet  Google Scholar 

  25. Paul Taylor. Practical Foundations of Mathematics. Number 59 in Cambridge Studies in Advanced Mathematics. Cambridge University Press, 1999.

    Google Scholar 

  26. Jean Vuillemin. A unifying look at data structures. Communications of the ACM, 23:229–239, 1980.

    Article  MATH  MathSciNet  Google Scholar 

  27. Philip Wadler. Comprehending monads. In Proceedings of the 1990 ACM Conference on LISP and Functional Programming, Nice, pages 61–78. ACM-Press, June 1990.

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2002 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Hinze, R. (2002). Constructing Tournament Representations: An Exercise in Pointwise Relational Programming. In: Boiten, E.A., Möller, B. (eds) Mathematics of Program Construction. MPC 2002. Lecture Notes in Computer Science, vol 2386. Springer, Berlin, Heidelberg. https://doi.org/10.1007/3-540-45442-X_9

Download citation

  • DOI: https://doi.org/10.1007/3-540-45442-X_9

  • Published:

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-540-43857-1

  • Online ISBN: 978-3-540-45442-7

  • eBook Packages: Springer Book Archive

Publish with us

Policies and ethics