Lean (proof assistant)

Lean is a theorem prover and programming language. It is based on the calculus of constructions with inductive types. It is an open-source project hosted on GitHub. It was made by Microsoft Research.

Lean
ParadigmFunctional programming, Imperative programming
DeveloperLean Focused Research Organization (FRO)
First appeared2013 (2013)
Stable release
4.1.0 / 25 September 2023 (2023-09-25)
Preview release
v4.2.0-rc3 / 16 October 2023 (2023-10-16)
Typing disciplineStatic, strong, inferred
Implementation languageC++, Lean
OSCross-platform
LicenseApache License 2.0
Websitelean-lang.org
Influenced by
ML
Coq
Haskell

History

Initially launched by Leonardo de Moura at Microsoft Research in 2013.[1]

The Lean 3 was implemented as a virtual machine which made it less efficient due to overhead associated with interpretation making it less competitive with other proof assistants such as Coq.

In 2021 the Lean 4 was released with a reimplementation of the Lean theorem prover capable to produces C code which is then compiled, enabling the development of efficient domain-specific automation.[2] Another improvement over previous version was ability to avoid touching C++ code in order to obtain certain features.

Lean 4 is not backwards-compatible with Lean 3.[3]

Overview

Libraries

In 2017 the project adopted a user-maintained library mathlib with the goal to digitize pure mathematics research.[4][5]. The mathlib contains a collection of mathematic theorems that has been formalized in Lean. As of February 2023, mathlib had 100,000 theorems.[6]

Editors integration

Lean integrates with:[7]

Interfacing is done via an 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.

Examples (Lean 3)

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.

inductive nat : Type
| zero : nat
| succ : nat  nat

Addition of natural numbers can be defined recursively, using pattern matching.

definition add : nat  nat  nat
| n zero     := n
| n (succ m) := succ (add n m)

This is a simple proof in lean in term mode.

theorem and_swap : p  q  q  p :=
    assume h1 : p  q,
    h1.right, h1.left

This same proof can be accomplished using tactics.

theorem and_swap (p q : Prop) : p  q  q  p :=
begin
    assume h : (p  q), -- assume p ∧ q is true
    cases h, -- extract the individual propositions from the conjunction
    split, -- split the goal conjunction into two cases: prove p and prove q separately
    repeat { assumption }
end

Usage

Lean has gotten attention from mathematicians Thomas Hales[8] and Kevin Buzzard.[9] Hales is using it for his project, Formal Abstracts.[10] Buzzard uses it for the Xena project.[11] 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.

In 2021, Lean was used to formalize a new proof by Peter Scholze in the area of condensed mathematics, proving that Lean can be useful at the cutting edge of mathematical research.[12]

See also

References

  1. "Lean Prover About Page".
  2. Moura, Leonardo de; Ullrich, Sebastian (2021). Platzer, Andr'e; Sutcliffe, Geoff (eds.). Automated Deduction -- CADE 28. Springer International Publishing. pp. 625–635. ISBN 978-3-030-79876-5. Retrieved 24 March 2023.
  3. "Significant changes from Lean 3". Lean Manual. Retrieved 24 March 2023.
  4. "Building the Mathematical Library of the Future". Quanta Magazine. Archived from the original on 2 Oct 2020.
  5. "Lean community". leanprover-community.github.io. Retrieved 2023-10-24.
  6. "Mathlib statistics". leanprover-community.github.io. Retrieved 2023-02-12.
  7. "Installing Lean 4 on Linux". leanprover-community.github.io. Retrieved 2023-10-24.
  8. Hales, Thomas (September 18, 2018). "A Review of the Lean Theorem Prover". Jigger Wit. Archived from the original on 21 Nov 2020.
  9. Buzzard, Kevin. "The Future of Mathematics?" (PDF). Retrieved 6 October 2020.
  10. "Formal Abstracts". Github.
  11. "What is the Xena project?". Xena. 8 May 2019.
  12. Hartnett, Kevin (July 28, 2021). "Proof Assistant Makes Jump to Big-League Math". Quanta Magazine. Archived from the original on 2 Jan 2022.
This article is issued from Wikipedia. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.