Beautiful Code, Beautiful Proof?
Functional programming languages are often praised for creating the capability of writing beautiful code. Furthermore, an often mentioned advantage is that it is easy to reason about properties of functional programs. Such reasoning can be either formal or informal. This might lead to the assumption that really beautiful code is also really easy to prove. One might even say that beautiful code can only be classified as really beautiful if the code also has a beautiful proof. This essay explores whether beautiful code written in a functional programming language also has a beautiful proof. Two small case studies discuss both the beauty of an informal mathematical proof and the beauty of a formal proof created in a dedicated theorem prover. General lessons are drawn from these studies and directions for future research directions are given.
This essay is written on the occasion of the celebration of the 61 th anniversary of Rinus Plasmeijer, coinciding with the 25 th IFL conference, held in Nijmegen. Rinus was one of the supervisors of both the Ph.D. Thesis of Marko van Eekelen and the Thesis of Maarten de Mol. The authors of this essay co-authored many functional programming papers with him both on the design and application of the functional programming language Clean and on its dedicated theorem prover Sparkle.
We are most grateful for his enthusiastic guidance and for the many hours of warm, creative and productive collaboration.
KeywordsFormal Proof Functional Programming Proof Assistant Output List Functional Programming Language
Unable to display preview. Download preview PDF.
- [BW88]Bird, R.S., Wadler, P.: Introduction to Functional Programming. Prentice Hall (1988)Google Scholar
- [DB06]Dowse, M., Butterfield, A.: Modelling deterministic concurrent I/O. In: Reppy, J.H., Lawall, J.L. (eds.) ICFP, pp. 148–159. ACM (2006)Google Scholar
- [KEM04]van Kesteren, R., van Eekelen, M., de Mol, M.: Proof support for general type classes. In: Loidl, H.-W. (ed.) Trends in Functional Programming 5: Selected papers from the 5th Int. Symposium on Trends in Functional Programming, TFP 2004, pp. 1–16. Intellect (2004)Google Scholar
- [LvE04]Lensink, L., van Eekelen, M.: Induction and co-induction in sparkle. Technical Report NII–R0502, Radboud University Nijmegen (2004)Google Scholar
- [Mol09]de Mol, M.: Reasoning About Functional Programs - Sparkle: a proof assistant for Clean. PhD thesis, University of Nijmegen, The Netherlands (March 4, 2009) ISBN 978-90-9023885-2Google Scholar
- [ORS92]Owre, S., Rushby, J.M., Shankar, N.: PVS: A prototype verification system. In: Kapur, D. (ed.) CADE 1992. LNCS, vol. 607, pp. 748–752. Springer, Heidelberg (1992)Google Scholar
- [PE02]Plasmeijer, R., van Eekelen, M.: Clean language report version 2.1. Dept. of Software Technology, University of Nijmegen (2002)Google Scholar
- [Pey01]Peyton Jones, S.: Tackling the Awkward Squad: monadic input/output, concurrency, exceptions, and foreign-language calls in Haskell. In: Hoare, T., Broy, M., Steinbruggen, R. (eds.) Engineering Theories of Software Construction, pp. 47–96. IOS Press (2001) ISBN 1 58603 1724Google Scholar
- [Tea98]The Coq Development Team. The Coq Proof Assistant Reference Manual (version 7.0), Inria (1998), http://pauillac.inria.fr/coq/doc/main.html