Lean was launched by Leonardo de Moura at Microsoft Research in 2013.[2] The initial versions of the language, later known as Lean 1 and 2, were experimental and contained features such as support for homotopy type theory – based foundations that were later dropped.
Lean 3 (first released Jan 20, 2017) was the first moderately stable version of Lean. It was implemented primarily in C++ with some features written in Lean itself. After version 3.4.2 Lean 3 was officially end-of-lifed while development of Lean 4 began. In this interim period members of the Lean community developed and released unofficial versions up to 3.51.1.
In 2021, Lean 4 was released, which was a reimplementation of the Lean theorem prover capable of producing C code which is then compiled, enabling the development of efficient domain-specific automation.[3] Lean 4 also contains a macro system and improved type class synthesis and memory management procedures over the previous version. Another benefit compared to Lean 3 is the ability to avoid touching C++ code in order to modify the frontend and other key parts of the core system, as they are now all implemented in Lean and available to the end user to be overridden as needed.[citation needed]
In 2023, the Lean FRO was formed, with the goals of improving the language's scalability and usability, and implementing proof automation.[5]
Overview
Libraries
The official lean package includes a standard librarybatteries, which implements common data structures that may be used for both mathematical research and more conventional software development.[6]
In 2017, a community-maintained project to develop a Lean library mathlib began, with the goal to digitize as much of pure mathematics as possible in one large cohesive library, up to research level mathematics.[7][8] As of September 2024, mathlib had formalised over 165,000 theorems and 85,000 definitions in Lean.[9]
It has native support for Unicode symbols, which can be typed using LaTeX-like sequences, such as "\times" for "×". Lean can also be compiled to JavaScript and accessed in a web browser and has extensive support for meta-programming.
Examples (Lean 4)
The natural numbers can be defined as an inductive type. This definition is based on the Peano axioms and states that every natural number is either zero or the successor of some other natural number.
theoremand_swap(pq:Prop):p∧q→q∧p:=byintroh-- assume p ∧ q with proof h, the goal is q ∧ papplyAnd.intro-- the goal is split into two subgoals, one is q and the other is p·exacth.right-- the first subgoal is exactly the right part of h : p ∧ q·exacth.left-- the second subgoal is exactly the left part of h : p ∧ q
Lean has received attention from mathematicians such as Thomas Hales,[11]Kevin Buzzard,[12] and Heather Macbeth.[13] Hales is using it for his project, Formal Abstracts.[14] Buzzard uses it for the Xena project.[15] One of the Xena Project's goals is to rewrite every theorem and proof in the undergraduate math curriculum of Imperial College London in Lean. Macbeth is using Lean to teach students the fundamentals of mathematical proof with instant feedback.[16]
In 2021, a team of researchers used Lean to verify the correctness of a proof by Peter Scholze in the area of condensed mathematics. The project garnered attention for formalizing a result at the cutting edge of mathematical research.[17] In 2023, Terence Tao used Lean to formalize a proof of the Polynomial Freiman-Ruzsa (PFR) conjecture, a result published by Tao and collaborators in the same year.[18]
Artificial intelligence
In 2022, OpenAI and Meta AI independently created AI models to generate proofs of various high-school-level olympiad problems in Lean.[19] Meta AI's model is available for public use with the Lean environment.[20]
In 2023, Vlad Tenev and Tudor Achim co-founded startup Harmonic, which aims to reduce AI hallucinations by generating and checking Lean code.[21]
In 2024, Google DeepMind created AlphaProof[22] which proves mathematical statements in Lean at the level of a silver medalist at the International Mathematical Olympiad. This was the first AI system that achieved a medal-worthy performance on a math olympiad's problems.[23]