Lean (language)
Lean theorem prover and programming language
Lean is a dependently typed functional programming language and interactive theorem prover, developed primarily by Microsoft Research, used both to formalize and verify mathematical proofs and to write efficient, verified programs.
Definition
Lean is a dependently typed functional programming language and interactive theorem prover, developed primarily by Microsoft Research, used both to formalize and verify mathematical proofs and to write efficient, verified programs.
Overview
Lean was created with a dual goal: to serve as a practical proof assistant for formalizing mathematics and as a genuinely usable general-purpose programming language, distinguishing it from proof assistants that are primarily research tools with limited use as programming languages. Lean 4, the current major version, is largely implemented in itself and compiles to efficient native code, making it viable for writing performance-sensitive software in addition to formal proofs. Lean has become especially prominent in the mathematics community through Mathlib, a large, collaboratively built library of formalized mathematics covering areas from basic algebra to advanced topics in analysis and topology, maintained by a global community of mathematicians and computer scientists. High-profile mathematicians have used Lean to formalize significant proofs and to explore whether large swaths of modern mathematics can be made machine-checkable, and Lean has also been paired with AI systems in research aimed at automated theorem proving, where a model proposes proof steps that Lean's kernel verifies. Lean is used primarily in mathematical research and formalization, in AI research on automated and AI-assisted theorem proving, and to a lesser extent in software projects that want dependently typed correctness guarantees with better general-purpose ergonomics than older proof assistants. It sits alongside Coq, Agda, and Idris in the dependently typed language family, with Lean's Mathlib project and stronger emphasis on being a practical, fast programming language as its main differentiators.
Key Features
- Dependently typed language usable both as a proof assistant and general-purpose language
- Lean 4 compiles to efficient native code, unlike many proof assistants
- Mathlib: a large, actively maintained library of formalized mathematics
- Growing use in AI research on automated and AI-assisted theorem proving
- Interactive proof development with tactic-based proof construction
- Self-hosted implementation (Lean 4 is largely written in Lean)