Skip to main content

Beautiful Code, Beautiful Proof?

  • Chapter
Book cover The Beauty of Functional Code

Part of the book series: Lecture Notes in Computer Science ((LNPSE,volume 8106))

  • 1194 Accesses

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 61th anniversary of Rinus Plasmeijer, coinciding with the 25th 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.

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 49.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. 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)

    Article  MathSciNet  MATH  Google Scholar 

  2. 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)

    Chapter  Google Scholar 

  3. Bird, R.S., Wadler, P.: Introduction to Functional Programming. Prentice Hall (1988)

    Google Scholar 

  4. 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. 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)

    Chapter  Google Scholar 

  6. Foley, M., Hoare, C.A.R.: Proof of a recursive program: Quicksort. Comput. J. 14(4), 391–395 (1971)

    Article  MathSciNet  MATH  Google Scholar 

  7. Hughes, J.: Why Functional Programming Matters. Computer Journal 32(2), 98–107 (1989)

    Article  MathSciNet  Google Scholar 

  8. 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. Lensink, L., van Eekelen, M.: Induction and co-induction in sparkle. Technical Report NII–R0502, Radboud University Nijmegen (2004)

    Google Scholar 

  10. 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)

    Chapter  Google Scholar 

  11. 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)

    Chapter  Google Scholar 

  12. 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-2

    Google Scholar 

  13. 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. Plasmeijer, R., van Eekelen, M.: Keep it clean: a unique approach to functional programming. ACM Sigplan Notices 34(6), 23–31 (1999)

    Article  Google Scholar 

  15. Plasmeijer, R., van Eekelen, M.: Clean language report version 2.1. Dept. of Software Technology, University of Nijmegen (2002)

    Google Scholar 

  16. 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 1724

    Google Scholar 

  17. The Coq Development Team. The Coq Proof Assistant Reference Manual (version 7.0), Inria (1998), http://pauillac.inria.fr/coq/doc/main.html

  18. 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)

    Chapter  Google Scholar 

  19. 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)

    Chapter  Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2013 Springer-Verlag Berlin Heidelberg

About this chapter

Cite this chapter

de Mol, M., van Eekelen, M. (2013). Beautiful Code, Beautiful Proof?. In: Achten, P., Koopman, P. (eds) The Beauty of Functional Code. Lecture Notes in Computer Science, vol 8106. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-642-40355-2_1

Download citation

  • DOI: https://doi.org/10.1007/978-3-642-40355-2_1

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-642-40354-5

  • Online ISBN: 978-3-642-40355-2

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics