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.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Preview
Unable to display preview. Download preview PDF.
References
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.
Roland Backhouse. Galois connections and fixed point calculus, 2001. Lecture Notes.
Richard Bird. Introduction to Functional Programming using Haskell. Prentice Hall Europe, London, 2nd edition, 1998.
Richard Bird and Oege de Moor. Algebra of Programming. Prentice Hall Europe, London, 1997.
Richard S. Bird. Lectures on constructive functional programming. In Manfred Broy, editor, Constructive Methods in Computer Science. Springer-Verlag, 1988.
R. Burstall and J. Darlington. A tranformation system for developing recursive programs. Journal of the ACM, 24(1):44–67, 1977.
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.
R.W. Floyd. Syntactic analysis and operator precedence. Journal of the ACM, 10(3):316–333, 1963.
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.
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.
Michael Hanus, editor. Curry—An Integrated Functional Logic Language (Version 0.7.1), June 2000.
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.
Ralf Hinze and Ross Paterson. Derivation of a typed functional LR parser, 2002. in preparation.
B. Knaster. Un théorème sur les fonctions d’ensembles. Annales de la Societé Polonaise de Mathematique, 6:133–134, 1928.
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.
Eugenio Moggi. An abstract view of programming languages. Technical Report ECS-LFCS-90-113, Department of Computer Science, Edinburgh University, 1990.
Eugenio Moggi. Notions of computation and monads. Information and Computation, 93(1):55–92, 1991.
Helmut A. Partsch. Specification and Transformation of Programs—A Formal Approach to Software Development. Texts and Monographs in Computer Science. Springer-Verlag, Berlin, 1990.
Simon Peyton Jones and John Hughes, editors. Haskell 98—A Non-strict, Purely Functional Language, February 1999. Available from http://www.haskell.org/definition/.
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.
Michael Sperber and Peter Thiemann. Generation of LR parsers by partial evaluation. ACM Transactions on Programming Languages and Systems, 22(3):224–264, 2000.
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.
H. Tamaki and T. Sato. Unfold/fold transformations of logic programs. In Second International Conference on Logic Programming, pages 127–138, 1984.
A. Tarski. A lattice-theoretic fixpoint theorem and its applications. Pacific Journal of Mathematics, 5:285–309, 1955.
Paul Taylor. Practical Foundations of Mathematics. Number 59 in Cambridge Studies in Advanced Mathematics. Cambridge University Press, 1999.
Jean Vuillemin. A unifying look at data structures. Communications of the ACM, 23:229–239, 1980.
Philip Wadler. Comprehending monads. In Proceedings of the 1990 ACM Conference on LISP and Functional Programming, Nice, pages 61–78. ACM-Press, June 1990.
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights 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