fbpx
Wikipedia

Lean (proof assistant)

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 principally developed 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
ParadigmFunctional programming, Imperative programming
DeveloperLean FRO
First appeared2013; 11 years ago (2013)
Stable release
4.6.1 / 4 March 2024; 58 days ago (2024-03-04)
Preview release
4.7.0-rc2 / 5 March 2024; 57 days ago (2024-03-05)
Typing disciplineStatic, strong, inferred
Implementation languageLean , C++
OSCross-platform
LicenseApache License 2.0
Websitelean-lang.org
Influenced by
ML
Coq
Haskell

History edit

Lean was initially 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]

Overview edit

Libraries edit

The official lean package includes a standard library std4, 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 November 2023, mathlib had formalized over 127,000 theorems and 70,000 definitions in Lean.[9]

Editors integration edit

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.

Examples (Lean 4) edit

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.

def Nat.add : Nat  Nat  Nat | n, Nat.zero => n -- n + 0 = n  | n, Nat.succ m => Nat.succ (Nat.add n m) -- n + succ(m) = succ(n + m) 

This is a simple proof in Lean using tactic mode:

theorem and_swap (p q : Prop) : p  q  q  p := by intro h -- assume p ∧ q with proof h, the goal is q ∧ p apply And.intro -- the goal is split into two subgoals, one is q and the other is p · exact h.right -- the first subgoal is exactly the right part of h : p ∧ q · exact h.left -- the second subgoal is exactly the left part of h : p ∧ q 

This same proof in term mode:

theorem and_swap (p q : Prop) : p  q  q  p := fun hp, hq => hq, hp 

Usage edit

Mathematics edit

Lean has received attention from mathematicians such as Thomas Hales[11] and Kevin Buzzard.[12] Hales is using it for his project, Formal Abstracts.[13] Buzzard uses it for the Xena project.[14] 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, 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 substantial attention for formalizing a result at the cutting edge of mathematical research.[15] 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.[16]

Artificial intelligence edit

In 2022, OpenAI created a neural network-based theorem prover for Lean, which used a language model to generate proofs of various high-school-level olympiad problems.[17]

Later that year, Meta AI created an AI model that has solved 10 International Mathematical Olympiad problems; this model is available for public use with the Lean environment.[18]

See also edit

References edit

  1. ^ https://pp.ipd.kit.edu/uploads/publikationen/demoura21lean4.pdf
  2. ^ "About". Lean Language. Retrieved 2024-03-13.
  3. ^ Moura, Leonardo de; Ullrich, Sebastian (2021). Platzer, Andr'e; Sutcliffe, Geoff (eds.). Automated Deduction -- CADE 28. Springer International Publishing. pp. 625–635. doi:10.1007/978-3-030-79876-5_37. ISBN 978-3-030-79876-5. S2CID 235800962. Retrieved 24 March 2023.
  4. ^ "Significant changes from Lean 3". Lean Manual. Retrieved 24 March 2023.
  5. ^ "Mission". Lean FRO. 2023-07-25. Retrieved 2024-03-14.
  6. ^ "std4". GitHub. Retrieved 2024-03-13.
  7. ^ "Building the Mathematical Library of the Future". Quanta Magazine. Archived from the original on 2 Oct 2020.
  8. ^ "Lean community". leanprover-community.github.io. Retrieved 2023-10-24.
  9. ^ "Mathlib statistics". leanprover-community.github.io. Retrieved 2023-11-01.
  10. ^ "Installing Lean 4 on Linux". leanprover-community.github.io. Retrieved 2023-10-24.
  11. ^ Hales, Thomas (September 18, 2018). "A Review of the Lean Theorem Prover". Jigger Wit. Archived from the original on 21 Nov 2020.
  12. ^ Buzzard, Kevin. "The Future of Mathematics?" (PDF). Retrieved 6 October 2020.
  13. ^ "Formal Abstracts". Github.
  14. ^ "What is the Xena project?". Xena. 8 May 2019.
  15. ^ Hartnett, Kevin (July 28, 2021). "Proof Assistant Makes Jump to Big-League Math". Quanta Magazine. Archived from the original on 2 Jan 2022.
  16. ^ Sloman, Leila (2023-12-06). "'A-Team' of Math Proves a Critical Link Between Addition and Sets". Quanta Magazine. Retrieved 2023-12-07.
  17. ^ "Solving (some) formal math olympiad problems". OpenAI. February 2, 2022. Retrieved March 13, 2024.
  18. ^ "Teaching AI advanced mathematical reasoning". Meta AI. November 3, 2022. Retrieved March 13, 2024.

External links edit

  • Lean Website
  • Lean Community Website
  • Lean FRO
  • The Natural Number Game- An interactive tutorial to learn lean

lean, proof, assistant, lean, proof, assistant, functional, programming, language, based, calculus, constructions, with, inductive, types, open, source, project, hosted, github, principally, developed, leonardo, moura, while, employed, microsoft, research, ama. 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 principally developed 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 LeanParadigmFunctional programming Imperative programmingDeveloperLean FROFirst appeared2013 11 years ago 2013 Stable release4 6 1 4 March 2024 58 days ago 2024 03 04 Preview release4 7 0 rc2 5 March 2024 57 days ago 2024 03 05 Typing disciplineStatic strong inferredImplementation languageLean C OSCross platformLicenseApache License 2 0Websitelean lang wbr orgInfluenced byMLCoqHaskell Contents 1 History 2 Overview 2 1 Libraries 2 2 Editors integration 3 Examples Lean 4 4 Usage 4 1 Mathematics 4 2 Artificial intelligence 5 See also 6 References 7 External linksHistory editLean was initially 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 Overview editLibraries edit The official lean package includes a standard library std4 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 November 2023 mathlib had formalized over 127 000 theorems and 70 000 definitions in Lean 9 Editors integration edit Lean integrates with 10 Visual Studio Code Neovim Emacs 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 Examples Lean 4 editThe 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 def Nat add Nat Nat Nat n Nat zero gt n n 0 n n Nat succ m gt Nat succ Nat add n m n succ m succ n m This is a simple proof in Lean using tactic mode theorem and swap p q Prop p q q p by intro h assume p q with proof h the goal is q p apply And intro the goal is split into two subgoals one is q and the other is p exact h right the first subgoal is exactly the right part of h p q exact h left the second subgoal is exactly the left part of h p q This same proof in term mode theorem and swap p q Prop p q q p fun hp hq gt hq hp Usage editMathematics edit See also Proof assistant Notable formalized proofs Lean has received attention from mathematicians such as Thomas Hales 11 and Kevin Buzzard 12 Hales is using it for his project Formal Abstracts 13 Buzzard uses it for the Xena project 14 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 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 substantial attention for formalizing a result at the cutting edge of mathematical research 15 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 16 Artificial intelligence edit In 2022 OpenAI created a neural network based theorem prover for Lean which used a language model to generate proofs of various high school level olympiad problems 17 Later that year Meta AI created an AI model that has solved 10 International Mathematical Olympiad problems this model is available for public use with the Lean environment 18 See also edit nbsp Mathematics portal nbsp Free and open source software portal Dependent type List of proof assistants mimalloc Type theory Focused Research OrganizationReferences edit https pp ipd kit edu uploads publikationen demoura21lean4 pdf About Lean Language Retrieved 2024 03 13 Moura Leonardo de Ullrich Sebastian 2021 Platzer Andr e Sutcliffe Geoff eds Automated Deduction CADE 28 Springer International Publishing pp 625 635 doi 10 1007 978 3 030 79876 5 37 ISBN 978 3 030 79876 5 S2CID 235800962 Retrieved 24 March 2023 Significant changes from Lean 3 Lean Manual Retrieved 24 March 2023 Mission Lean FRO 2023 07 25 Retrieved 2024 03 14 std4 GitHub Retrieved 2024 03 13 Building the Mathematical Library of the Future Quanta Magazine Archived from the original on 2 Oct 2020 Lean community leanprover community github io Retrieved 2023 10 24 Mathlib statistics leanprover community github io Retrieved 2023 11 01 Installing Lean 4 on Linux leanprover community github io Retrieved 2023 10 24 Hales Thomas September 18 2018 A Review of the Lean Theorem Prover Jigger Wit Archived from the original on 21 Nov 2020 Buzzard Kevin The Future of Mathematics PDF Retrieved 6 October 2020 Formal Abstracts Github What is the Xena project Xena 8 May 2019 Hartnett Kevin July 28 2021 Proof Assistant Makes Jump to Big League Math Quanta Magazine Archived from the original on 2 Jan 2022 Sloman Leila 2023 12 06 A Team of Math Proves a Critical Link Between Addition and Sets Quanta Magazine Retrieved 2023 12 07 Solving some formal math olympiad problems OpenAI February 2 2022 Retrieved March 13 2024 Teaching AI advanced mathematical reasoning Meta AI November 3 2022 Retrieved March 13 2024 External links editLean Website Lean Community Website Lean FRO The Natural Number Game An interactive tutorial to learn lean Retrieved from https en wikipedia org w index php title Lean proof assistant amp oldid 1221489460, wikipedia, wiki, book, books, library,

article

, read, download, free, free download, mp3, video, mp4, 3gp, jpg, jpeg, gif, png, picture, music, song, movie, book, game, games.