Skip to main content
Log in

Using the proof assistant Lean in undergraduate mathematics classrooms

  • Original Paper
  • Published:
ZDM – Mathematics Education Aims and scope Submit manuscript

Abstract

In this paper we develop a case for introducing a new teaching tool to undergraduate mathematics. Lean is an interactive theorem prover that instantly checks the correctness of every step and provides immediate feedback. Teaching with Lean might present a challenge, in that students must write their proofs in a formal way using a specific syntax. Accordingly, this paper addresses the issue of formalism from both a theoretical and a practical point of view. First, we examine the nature of proof, referring to historical and contemporary debates on formalization, and then show that in mathematical practice there is a growing rapprochement between strictly formal proof and proofs-in-practice. Next, we look at selections from the mathematics education literature that discuss how and when students advance through higher levels of mathematical maturity to reach a point at which they can cope with the demands of rigorous formalism. To probe the integration of Lean into teaching from an empirical point of view, we conducted an exploratory study that investigated how three undergraduate students approached the proof of double negation with Lean. The findings suggest that the rigorous nature of Lean is not an obstacle for students and does not stifle students’ creativity in writing proofs. On the contrary, proving with Lean offers a great deal of flexibility, allowing students to follow different paths to creating a valid proof.

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

Access this article

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Fig. 1
Fig. 2
Fig. 3
Fig. 4
Fig. 5
Fig. 6
Fig. 7

Similar content being viewed by others

Notes

  1. Grenier & Payan (2006) explore the classroom use of generalisations of the chequerboard problem, namely whether a shape composed of squares of a given size can tile a larger shape composed of squares the same size, under various constraints. One might, for example, ask students to explore whether it’s possible to tile a ziggurat with an L-shape rather than a domino. Where a tiling is provably impossible, will the strategy of the original proof always work? Alekhnovich (2004) discussed the challenge that the chequerboard presents to automated reasoning systems. Tanswell (2015) argues that the various formalizations of the basic chequerboard proof are sufficiently different from each other that we cannot speak of the formalization of an informal proof.

  2. Erdős said that you need not believe in God but, as a mathematician, you should believe in The Book (Aigner and Ziegler 2010, v).

  3. This label is both appropriate (because Leibniz did indeed foresee the potential of formalized mathematics) and misleading (because Leibniz’s philosophy of mathematics was intimately related to his views about logic and metaphysics in ways that are not relevant to the present discussion).

  4. https://leanprover-community.github.io/lean_projects.html

  5. “Die Mathematik ist ein BUNTES Gemisch von Beweistechniken.” (Capitals and italics in original). Hacking discusses the difficulty of translating ‘BUNTES Gemisch’ (Hacking 2014 pp. 57–58). Anscombe’s translation has ‘motley’. A more direct rendering might be a ‘BOUNTEOUS mixture’, that is, a mixture of wildly heterogenous items. A miscellany.

  6. This is due to the Lean Mathematical Library https://leanprover-community.github.io/mathlib-overview.html, a community-driven collective effort to build a unified library of formalized mathematics. Over 300 contributors to the library have formalized more than 73K definitions and 134K theorems across a dozen mathematics topics in undergraduate mathematics, such as linear algebra, group theory, vector space, calculus, real analysis, and complex analysis.

  7. P → (Q \(\to\) P) in Lean is written as P → Q \(\to\) P since implication is right-associative in Lean, meaning P implies that Q implies P.

  8. How to prove it with Lean by Velleman.

  9. The Natural Number Game is available in Lean 3 (https://www.ma.imperial.ac.uk/~buzzard/xena/natural_number_game/index2.html) and Lean 4 (https://adam.math.hhu.de/#/g/leanprover-community/nng4), developed by developed by Kevin Buzzard and Mohammad Pedramfar.

  10. The Set theory Game: https://adam.math.hhu.de/#/g/djvelleman/stg4, developed by Daniel Velleman, Alexander Bentkamp, Jon Eugster, and Patrick Massot.

  11. https://leanprover-community.github.io/

  12. Lean for Teaching on ZulipChat; Formalization and mathematics by Matthew Ballard; Proving equalities in Lean by Heather Macbeth; Introduction aux mathématiques formalisées by Patrick Massot.

References

  • Aigner, M., & Ziegler, G. M. (2010). Proofs from The BOOK (4th ed.). Springer.

  • Alekhnovich, M. (2004). Mutilated chessboard problem is exponentially hard for resolution. Theoretical Computer Science, 310(1–3), 513–525.

    Article  Google Scholar 

  • Avigad, J. (2023). Mathematics and the formal turn. Bulletin (New Series) of the American Mathematical Society. https://arxiv.org/pdf/2311.00007.pdf

  • Balacheff, N., & de la Tour, T. B. (2019). Proof technology and learning in mathematics: Common issues and perspectives. In G. Hanna, D. Reid, & M. de Villiers (Eds.), Proof Technology in Mathematics Research and Teaching (pp. 349–365). Springer.

    Chapter  Google Scholar 

  • Bartzia, E. I., Beffara, E., Meyer, A., & Narboux, J. (2023). Proof assistants for undergraduate mathematics education: Elements of an a priori analysis. https://hal.science/hal-04087080v1/document

  • Buzzard, K. (2020). Proving theorems with computers. Notices of the American Mathematical Society, 67(11), 1791–1799. https://www.ma.imperial.ac.uk/~buzzard/xena/computers2.pdf

  • Castelvecchi, D. (2021). Mathematicians welcome computer-assisted proof in “grand unification” theory. Nature, 595, 18–19.

    Article  Google Scholar 

  • Durand-Guerrier, V. (2003). Which notion of implication is the right one? From logical considerations to a didactic perspective. Educational Studies in Mathematics, 53, 5–34. https://doi.org/10.1023/A:1024661004375

    Article  Google Scholar 

  • Durand-Guerrier, V., Boero, P., Douek, N., Epp, S.S. & Tanguay, D. (2012). Examining the role of logic in teaching proof. In G. Hanna & de Villiers (Eds.), Proof and proving in mathematics education, 369—389. Springer.

  • Epp, S. S. (2003). The role of logic in teaching proof. The American Mathematical Monthly, 110(10), 886–899.

    Article  Google Scholar 

  • Gowers, T., Barrow-Green, J., & Leader, I. (Eds.). (2010). The Princeton companion to mathematics. Princeton University Press.

  • Granville, A. (2023). Accepted proofs: Objective truth, or culturally robust? Annals of Mathematics and Philosophy, 1(2), 25-90.

  • Grenier, D., & Payan, C. (2006). Des «situations recherche» pour l’apprentissage des savoirs transversaux. In L'enseignement des mathématiques face aux défis de l'école et des communautés. Les actes du colloque EMF.

  • Hacking, I. (2014). Why is there philosophy of mathematics at all? Cambridge University Press.

    Book  Google Scholar 

  • Hales, T. C. (2012). Dense sphere packings: A blueprint for formal proofs (Vol. 400). Cambridge University Press.

  • Hamkins, J. D. (2020). Lectures on the philosophy of mathematics. MIT Press.

    Google Scholar 

  • Hanna, G., Larvor, B., & Yan, X. (2023). Human-machine collaboration in the teaching of proof. Journal of Humanistic Mathematics, 13(1), 99-115. https://scholarship.claremont.edu/cgi/viewcontent.cgi?article=1980&context=jhm

  • Hanna, G., & Yan, X. (2021). Opening a discussion on teaching proof with automated theorem provers. For the Learning of Mathematics, 41(3), 42–46.

    Google Scholar 

  • Hardy, G. H. (1929). Mathematical proof. Mind, New Series, 38(149), 1–25.

    Article  Google Scholar 

  • Harel, G. (2007). Students’ proof schemes revisited. In P. Boero (Ed.), Theorems in schools: From history, epistemology and cognition to classroom practice (pp. 65–78). Sense.

    Chapter  Google Scholar 

  • Harel, G., & Sowder, L. (1998). Students’ proof schemes, In E. Dubinsky, A. Schoenfeld & J. Kaput (Eds.), Research on collegiate mathematics education, AMS, vol. Ill, (pp. 234–283).

  • Littlewood, J. E. (1953). A mathematician’s miscellany. Methuen.

    Google Scholar 

  • Pinto, M. M. F. (1998). Students’ understanding of real analysis. Unpublished PhD.

    Google Scholar 

  • Tall, D. (2008). The transition to formal thinking in mathematics. Mathematics Education Research Journal, 20, 5–24. https://doi.org/10.1007/BF03217474

    Article  Google Scholar 

  • Tanswell, F. (2015). A problem with the dependence of informal proofs on formal proofs. Philosophia Mathematica, 23(3), 295–310.

    Article  Google Scholar 

  • Tao, T. (2009). There’s more to mathematics than rigour and proofs. Blog. https://terrytao.wordpress.com/career-advice/theres-more-to-mathematics-than-rigour-and-proofs/

  • Thoma, A., & Iannone, P. (2021). Learning about proof with the theorem prover LEAN: The abundant numbers task. International Journal of Research in Undergraduate Mathematics Education, 8, 64–93. https://doi.org/10.1007/s40753-021-00140-1

    Article  Google Scholar 

  • Voevodsky, V. (2014). The origins and motivations of univalent foundations. IAS, The Institute Letter, 8–9. https://www.ias.edu/sites/default/files/documents/publications/ILsummer14.pdf

  • Weber, K. (2004). Traditional instruction in advanced mathematics courses: A case study of one professor’s lectures and proofs in an introductory real analysis course. Journal of Mathematical Behavior, 23, 115–133.

    Article  Google Scholar 

  • Wittgenstein, L. (1956). Remarks on the foundations of mathematics. Tr. G.E.M. Anscombe. Oxford: Blackwell.

  • Yan, X., & Hanna, G. (2023). Using the Lean interactive theorem prover in undergraduate mathematics. International Journal of Mathematical Education in Science and Technology. https://doi.org/10.1080/0020739X.2023.2227191

    Article  Google Scholar 

Download references

Acknowledgements

We wish to acknowledge the generous support of the Social Sciences and Humanities Research Council of Canada. We also thank the anonymous reviewers for their valuable comments and suggestions.

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Gila Hanna.

Additional information

Publisher's Note

Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Appendix

Appendix

Tactics used and changes in goals in a proof of 0 + n = n

To prove that if n is a natural number, then 0 + n = n.

figure a
  • The “induction” tactic proves the goal by induction on n, with the inductive assumption in the succ case (successor case) being “hd”. Specifically, “induction n with d hd” turns the goal into two goals, a base case with n = 0 and an inductive step where “hd” is a proof of the n = d case.

  • The “norm_num” tactic normalized any numerical expressions.

  • The “rw” (rewrite) tactic: given a hypothesis (h) of the form A = B, “rw h” replaces occurrences of A with B.

Rights and permissions

Springer Nature or its licensor (e.g. a society or other partner) holds exclusive rights to this article under a publishing agreement with the author(s) or other rightsholder(s); author self-archiving of the accepted manuscript version of this article is solely governed by the terms of such publishing agreement and applicable law.

Reprints and permissions

About this article

Check for updates. Verify currency and authenticity via CrossMark

Cite this article

Hanna, G., Larvor, B. & Yan, X.K. Using the proof assistant Lean in undergraduate mathematics classrooms. ZDM Mathematics Education (2024). https://doi.org/10.1007/s11858-024-01577-9

Download citation

  • Accepted:

  • Published:

  • DOI: https://doi.org/10.1007/s11858-024-01577-9

Keywords

Navigation