Paradigm | Functional programming, Imperative programming |
---|---|
Family | Proof assistant |
Developer | Lean FRO |
First appeared | 2013 |
Stable release | 4.11.0 / 1 September 2024 |
Preview release | 4.12.0-rc1 / 2 September 2024 |
Typing discipline | Static, strong, inferred |
Implementation language | Lean, C++ |
OS | Cross-platform |
License | Apache License 2.0 |
Website | lean-lang |
Influenced by | |
ML Coq Haskell |
Lean is a proof assistant and a functional programming language. [1] It is based on the calculus of constructions with inductive types. It is an open-source project hosted on GitHub. It was developed primarily by Leonardo de Moura while employed by Microsoft Research and now Amazon Web Services, and has had significant contributions from other coauthors and collaborators during its history. Development is currently supported by the non-profit Lean Focused Research Organization (FRO).
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 ]
Lean 4 is not backwards-compatible with Lean 3. [4]
In 2023, the Lean FRO was formed, with the goals of improving the language's scalability and usability, and implementing proof automation. [5]
The official lean package includes a standard library batteries, 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]
Lean integrates with: [10]
Interfacing is done via a client-extension and Language Server Protocol server.
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.
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.
inductiveNat:Type|zero:Nat|succ:Nat→Nat
Addition of natural numbers can be defined recursively, using pattern matching.
defNat.add:Nat→Nat→Nat|n,Nat.zero=>n-- n + 0 = n |n,Nat.succm=>Nat.succ(Nat.addnm)-- n + succ(m) = succ(n + m)
This is a simple proof of for two propositions and (where is the conjunction and the implication) in Lean using tactic mode:
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
This same proof in term mode:
theoremand_swap(pq:Prop):p∧q→q∧p:=fun⟨hp,hq⟩=>⟨hq,hp⟩
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]
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]
In mathematics and theoretical computer science, a type theory is the formal presentation of a specific type system. Type theory is the academic study of type systems.
In logic and proof theory, natural deduction is a kind of proof calculus in which logical reasoning is expressed by inference rules closely related to the "natural" way of reasoning. This contrasts with Hilbert-style systems, which instead use axioms as much as possible to express the logical laws of deductive reasoning.
The Isabelle automated theorem prover is a higher-order logic (HOL) theorem prover, written in Standard ML and Scala. As a Logic for Computable Functions (LCF) style theorem prover, it is based on a small logical core (kernel) to increase the trustworthiness of proofs without requiring, yet supporting, explicit proof objects.
In combinatorics, Ramsey's theorem, in one of its graph-theoretic forms, states that one will find monochromatic cliques in any edge labelling (with colours) of a sufficiently large complete graph. To demonstrate the theorem for two colours (say, blue and red), let r and s be any two positive integers. Ramsey's theorem states that there exists a least positive integer R(r, s) for which every blue-red edge colouring of the complete graph on R(r, s) vertices contains a blue clique on r vertices or a red clique on s vertices. (Here R(r, s) signifies an integer that depends on both r and s.)
The QED manifesto was a proposal for a computer-based database of all mathematical knowledge, strictly formalized and with all proofs having been checked automatically.
Sir William Timothy Gowers, is a British mathematician. He is Professeur titulaire of the Combinatorics chair at the Collège de France, and director of research at the University of Cambridge and Fellow of Trinity College, Cambridge. In 1998, he received the Fields Medal for research connecting the fields of functional analysis and combinatorics.
In mathematical logic, a deduction theorem is a metatheorem that justifies doing conditional proofs from a hypothesis in systems that do not explicitly axiomatize that hypothesis, i.e. to prove an implication A → B, it is sufficient to assume A as a hypothesis and then proceed to derive B. Deduction theorems exist for both propositional logic and first-order logic. The deduction theorem is an important tool in Hilbert-style deduction systems because it permits one to write more comprehensible and usually much shorter proofs than would be possible without it. In certain other formal proof systems the same conveniency is provided by an explicit inference rule; for example natural deduction calls it implication introduction.
In computer science and mathematical logic, a proof assistant or interactive theorem prover is a software tool to assist with the development of formal proofs by human–machine collaboration. This involves some sort of interactive proof editor, or other interface, with which a human can guide the search for proofs, the details of which are stored in, and some steps provided by, a computer.
In computing, the modulo operation returns the remainder or signed remainder of a division, after one number is divided by another, called the modulus of the operation.
Twelf is an implementation of the logical framework LF developed by Frank Pfenning and Carsten Schürmann at Carnegie Mellon University. It is used for logic programming and for the formalization of programming language theory.
In additive combinatorics, a discipline within mathematics, Freiman's theorem is a central result which indicates the approximate structure of sets whose sumset is small. It roughly states that if is small, then can be contained in a small generalized arithmetic progression.
A computer-assisted proof is a mathematical proof that has been at least partially generated by computer.
In combinatorial number theory, the Erdős–Graham problem is the problem of proving that, if the set of integers greater than one is partitioned into finitely many subsets, then one of the subsets can be used to form an Egyptian fraction representation of unity. That is, for every , and every -coloring of the integers greater than one, there is a finite monochromatic subset of these integers such that
Peter Benedict Kronheimer is a British mathematician, known for his work on gauge theory and its applications to 3- and 4-dimensional topology. He is William Caspar Graustein Professor of Mathematics at Harvard University and former chair of the mathematics department.
Kevin Mark Buzzard is a British mathematician and currently a professor of pure mathematics at Imperial College London. He specialises in arithmetic geometry and the Langlands program.
The universal parabolic constant is a mathematical constant.
Wiles's proof of Fermat's Last Theorem is a proof by British mathematician Sir Andrew Wiles of a special case of the modularity theorem for elliptic curves. Together with Ribet's theorem, it provides a proof for Fermat's Last Theorem. Both Fermat's Last Theorem and the modularity theorem were believed to be impossible to prove using previous knowledge by almost all living mathematicians at the time.
In category theory, a branch of mathematics, Grothendieck's homotopy hypothesis states that the ∞-groupoids are spaces.
James Alexander Maynard is an English mathematician working in analytic number theory and in particular the theory of prime numbers. In 2017, he was appointed Research Professor at Oxford. Maynard is a fellow of St John's College, Oxford. He was awarded the Fields Medal in 2022 and the New Horizons in Mathematics Prize in 2023.
Condensed mathematics is a theory developed by Dustin Clausen and Peter Scholze which replaces a topological space by a certain sheaf of sets, in order to solve some technical problems of doing homological algebra on topological groups.