Advertisement

Beautiful Code, Beautiful Proof?

  • Maarten de Mol
  • Marko van Eekelen
Part of the Lecture Notes in Computer Science book series (LNCS, volume 8106)

Abstract

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.

Keywords

Formal Proof Functional Programming Proof Assistant Output List Functional Programming Language 
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.

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. [AvdP13]
    Achten, P., van Eekelen, M., de Mol, M., Plasmeijer, R.: EditorArrow: An Arrow-based Model for Editor-Based Programming. Journal of Functional Programming 23, 185–224 (2013)MathSciNetCrossRefMATHGoogle Scholar
  2. [BS01]
    Butterfield, A., Strong, G.: Proving Correctness of Programs with I/O - a paradigm comparison. In: Arts, T., Mohnen, M. (eds.) IFL 2002. LNCS, vol. 2312, pp. 72–88. Springer, Heidelberg (2002)CrossRefGoogle Scholar
  3. [BW88]
    Bird, R.S., Wadler, P.: Introduction to Functional Programming. Prentice Hall (1988)Google Scholar
  4. [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
  5. [DBE04]
    Dowse, M., Butterfield, A., van Eekelen, M.: Reasoning About Deterministic Concurrent Functional I/O. In: Grelck, C., Huch, F., Michaelson, G.J., Trinder, P. (eds.) IFL 2004. LNCS, vol. 3474, pp. 177–194. Springer, Heidelberg (2005)CrossRefGoogle Scholar
  6. [FH71]
    Foley, M., Hoare, C.A.R.: Proof of a recursive program: Quicksort. Comput. J. 14(4), 391–395 (1971)MathSciNetCrossRefMATHGoogle Scholar
  7. [Hug89]
    Hughes, J.: Why Functional Programming Matters. Computer Journal 32(2), 98–107 (1989)MathSciNetCrossRefGoogle Scholar
  8. [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
  9. [LvE04]
    Lensink, L., van Eekelen, M.: Induction and co-induction in sparkle. Technical Report NII–R0502, Radboud University Nijmegen (2004)Google Scholar
  10. [MEP02]
    de Mol, M., van Eekelen, M., Plasmeijer, R.: Theorem Proving for Functional Programmers. In: Arts, T., Mohnen, M. (eds.) IFL 2001. LNCS, vol. 2312, pp. 55–72. Springer, Heidelberg (2002)CrossRefGoogle Scholar
  11. [MEP08]
    de Mol, M., van Eekelen, M., Plasmeijer, R.: Proving properties of lazy functional programs with Sparkle. In: Horváth, Z., Plasmeijer, R., Soós, A., Zsók, V. (eds.) CEFP 2007. LNCS, vol. 5161, pp. 41–86. Springer, Heidelberg (2008)CrossRefGoogle Scholar
  12. [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
  13. [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
  14. [PE99]
    Plasmeijer, R., van Eekelen, M.: Keep it clean: a unique approach to functional programming. ACM Sigplan Notices 34(6), 23–31 (1999)CrossRefGoogle Scholar
  15. [PE02]
    Plasmeijer, R., van Eekelen, M.: Clean language report version 2.1. Dept. of Software Technology, University of Nijmegen (2002)Google Scholar
  16. [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
  17. [Tea98]
    The Coq Development Team. The Coq Proof Assistant Reference Manual (version 7.0), Inria (1998), http://pauillac.inria.fr/coq/doc/main.html
  18. [vEdM05]
    van Eekelen, M., de Mol, M.: Proof tool support for explicit strictness. In: Butterfield, A., Grelck, C., Huch, F. (eds.) IFL 2005. LNCS, vol. 4015, pp. 37–54. Springer, Heidelberg (2006)CrossRefGoogle Scholar
  19. [vESP97]
    van Eekelen, M., Smetsers, S., Plasmeijer, R.: Graph rewriting semantics for functional programming languages. In: van Dalen, D., Bezem, M. (eds.) CSL 1996. LNCS, vol. 1258, pp. 106–128. Springer, Heidelberg (1997)CrossRefGoogle Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2013

Authors and Affiliations

  • Maarten de Mol
    • 1
  • Marko van Eekelen
    • 2
    • 3
  1. 1.AiA Software B.V.NijmegenThe Netherlands
  2. 2.Institute for Computing and Information SciencesRadboud University NijmegenThe Netherlands
  3. 3.School of Computer ScienceOpen University of the NetherlandsThe Netherlands

Personalised recommendations