Lean
lean-lang.org
- Free plan
- Windows
- macOS
- Linux
- Web
What Lean is
Lean is an open-source programming language and proof assistant for formalizing mathematics, verifying software, and writing general code. Its deductive proof checking uses a minimal trusted kernel, which Lean describes as a basis for correctness in mathematical, software, and hardware verification. Lean 4 is its input language, and Lake, included with Lean, initializes and manages projects. The Grind tool automates some pattern matching, case analysis, and systems of linear inequalities; metaprogramming lets users add specialized notation and proof automation. Mathlib is a community-maintained library with over a million lines covering areas including algebra, analysis, topology, probability, and computer science. Lean can be used on Linux, macOS, Windows, and in a browser through Lean4Web. The recommended editor setup is VS Code with the Lean 4 extension; Neovim with lean.nvim is also well-supported, while VSCodium and Cursor support is unofficial. Lean is free under the Apache 2.0 license. Learning materials include textbooks, tutorials, games, documentation, and an API reference.
Who it suits
Lean suits programmers, mathematicians, and theorem provers working with formal proofs or software verification. Its learning resources are organized for those different audiences.
Good to know, and what to watch
- Open-source and free under Apache 2.0.
- Mathlib contains over a million lines of formalized mathematics.
- Lake is bundled for project management.
- Runs on Linux, macOS, Windows, and in a browser.
- Learning resources include tutorials, games, and documentation.
- VSCodium and Cursor support is unofficial.
- x86-64 macOS and WebAssembly are Tier 2 platforms.
Plans
Every plan and priceLean 4
Open source
Getting started
- Visit the Lean website
- Install Lean on Linux, macOS, or Windows, or use Lean4Web in a browser
- Install VS Code and the Lean 4 extension
- Initialize and manage projects with Lake
- Use the available tutorials, textbooks, or documentation to begin
The Club's review
Lean is a free, open-source language that combines functional programming with machine-checked theorem proving. It suits mathematicians, theorem provers, and programmers who need formal assurance rather than testing alone. The trade-off is a specialist workflow: its guarantees and libraries are substantial, but learning formal proof takes commitment.
Overview
Lean lets one environment express programs, mathematical statements, and proofs. A minimal trusted kernel checks the resulting proof artifacts, supporting deductive verification of mathematics as well as software and hardware. That architecture gives correctness claims a precise foundation, making Lean a strong choice for high-assurance work; it is less suitable when a conventional general-purpose language and test suite are all a project requires.
Leonardo de Moura created Lean in 2013, and the Lean FRO became a nonprofit under Convergent Research in July 2023. Apache 2.0 licensing permits users to use and extend the implementation and its mathematical libraries.
Key features
Mathlib is the standout practical asset: a community-built collection of more than a million lines covering algebra, analysis, topology, probability, and computer science. It can shorten the path to serious formalization by providing established definitions and theorems, although its benefits depend on finding work that matches those domains and learning the library's conventions.
The Grind tool automates difficult pattern matching, case analysis, and systems of linear inequalities. This is useful for reducing routine proof steps, while Lean's metaprogramming facilities let experienced users create domain-specific notation and their own proof automation. Those extension points reward teams willing to invest in the ecosystem rather than users seeking a fixed, turnkey tool.
Lean projects are created and maintained with Lake, the package manager bundled with Lean. The recommended setup is VS Code with the Lean 4 extension, which supplies syntax highlighting and completion. Neovim with lean.nvim is well-supported; VSCodium and Cursor are unofficial, so editor choice affects how much documented support users can expect.
Lean's learning materials include textbooks, tutorials, interactive games, core documentation, and an API reference, with separate starting routes for programmers, theorem provers, and mathematicians. Lean4Web runs Lean code in a browser, providing a low-friction way to explore before installing locally. The Lean Community Zulip is the central place for questions and collaboration, and Lean FRO holds weekly technical office hours.
A published security example shows AWS using Lean to verify the Cedar authorization-policy language, prove security properties, and compare them with production code through differential testing. That illustrates where Lean's formal guarantees can matter in deployed systems, without making it a replacement for every security process.
Pricing
| Plan | Price | Includes |
|---|---|---|
| Lean 4 | Free | Open-source programming language and proof assistant |
Lean is open source and has no paid plans or free trial. The free plan removes licensing cost, making it practical for individual study, academic work, and organizations that can support their own setup. It does not provide a commercial tier with additional service terms, so teams should plan their own engineering and support arrangements.
Platforms
Lean supports Linux, macOS, Windows, and web use through Lean4Web. Linux, Apple Silicon macOS, and x86-64 Windows are Tier 1 platforms. x86-64 macOS and Emscripten WebAssembly are Tier 2, which matters when choosing hardware or a browser-oriented deployment.
Who it's for
Choose Lean if you are formalizing mathematics, building verified software, or teaching and learning theorem proving. Its separate learning paths help different backgrounds, and Mathlib gives sustained projects a broad base. It is a poor fit for developers who need rapid conventional application development without proof obligations, or for teams unwilling to maintain formal specifications and proofs.
Pros and cons
- Pros: a minimal trusted kernel checks proof artifacts for mathematical, software, and hardware claims.
- Pros: Mathlib's million-plus lines cover major mathematical areas, reducing duplicated foundational work.
- Pros: Lake, editor tooling, browser access, and multiple learning resources support different working styles.
- Cons: formal proof is a specialized discipline and adds work beyond ordinary programming and testing.
- Cons: editor support is uneven: VS Code is recommended, Neovim is well-supported, while VSCodium and Cursor are unofficial.
- Cons: Tier 2 platform status for x86-64 macOS and Emscripten WebAssembly may make those setups less predictable.
Alternatives
For a directory of comparable options, see Formal Verification Tools.
- PVS is a free alternative with Linux, macOS, and Windows support; commercial users have custom pricing while noncommercial use is free.
- Boogie is a free MIT-licensed option for users comfortable with .NET and a supported SMT solver.
- Why3 is free under the GNU Lesser General Public License and supports Linux, Windows, web, API, and self-hosted deployments.
- Rocq is a free interactive theorem prover and dependently typed programming language available across desktop, web, and extension environments.
- UPPAAL fits eligible non-commercial academic users who need a free academic license for Linux, macOS, or Windows.
- Alloy Analyzer is a free, open-source, self-contained executable for users wanting a compact analyzer.
- cvc5 is a free open-source solver with broad API, web, and self-hosted availability.
- HOL4 is free software under the Modified BSD license for users seeking that theorem-proving ecosystem.
Verdict
Lean is the right choice for people who need machine-checked mathematics or verification and are prepared to learn formal proof, especially where Mathlib and a trusted kernel can anchor long-lived work. Look elsewhere if your priority is ordinary application development, a less specialized workflow, or uniformly official support across editors and platforms.
The verdict
Lean brings programming and proof checking into one system, with a large community mathematical library and several learning paths. Its editor support varies by editor, so users should account for the distinction between recommended, well-supported, and unofficial options.
Questions people ask
Is Lean free?
Yes. Lean 4 is listed as free, with an open-source pricing note and no paid plans stated.
Which systems does Lean support?
Lean supports Linux, macOS, Windows, and browser use through Lean4Web. Linux, Apple Silicon macOS, and x86-64 Windows are Tier 1; x86-64 macOS and Emscripten WebAssembly are Tier 2.
What editor should I use?
The recommended setup is VS Code with the Lean 4 extension, which provides syntax highlighting and code completion. Neovim with lean.nvim is well-supported, while VSCodium and Cursor support is unofficial.
What is Lean used for?
Lean is used for formalizing mathematics, proving theorems, verifying software and hardware, and general coding.
Does Lean include a mathematical library?
Mathlib is a community-driven library with over a million lines covering areas including algebra, analysis, topology, probability, and computer science.
How are Lean projects managed?
Lake, the package manager bundled with Lean, initializes and manages Lean projects.
What the maker publishes
- Automation
- The site describes the Grind tool as automating complex pattern matching, case analysis, and systems of linear inequalities. source
- Automation
- The site highlights the Grind tactic for handling pattern matching and case analysis and solving systems of linear inequalities. source
- Browser use
- The learning page links to Lean4Web, described as a web-based version that runs Lean code in a browser. source
- Editor integration
- The recommended installation uses VS Code and the Lean 4 extension, which provides syntax highlighting and code completion. source
- Editor integration
- The recommended setup uses VS Code and the official Lean 4 extension, which provides syntax highlighting and code completion. source
- Extensibility
- Lean’s metaprogramming capabilities let users add domain-specific notation and proof automation techniques. source
- Extensibility
- Lean's metaprogramming capabilities let users add domain-specific notation and proof automation. source
- Founded
- 2013 source
- Learning resources
- The learning page links to textbooks, tutorials, interactive games, core documentation, and an API reference. source
- Libraries
- The official site describes Mathlib as a community-driven mathematical library with over a million lines spanning algebra, analysis, topology, probability, and computer science. source
- License
- Lean is released under the Apache 2.0 license, which the documentation describes as allowing others to use and extend the code and mathematical libraries freely. source
- Maker
- Lean was created by Leonardo de Moura in 2013; the Lean FRO formed in July 2023 as a nonprofit under Convergent Research. source
- Maker
- The Lean FRO says Leonardo de Moura created Lean in 2013 and that the FRO formed in July 2023 as a nonprofit under Convergent Research. source
- Math and verification
- Lean is built for formalizing mathematics and formal verification, and is flexible enough for general coding. source
- Mathematical library
- Mathlib is a community-driven library containing over a million lines of formalized mathematics. source
- Other editors
- The manual installation guide says Neovim with lean.nvim is well-supported and describes VSCodium and Cursor support as unofficial. source
- Package manager
- Lean projects are initialized and managed with Lake, the package manager bundled with Lean. source
- Platforms
- The reference lists Linux, macOS, and Windows among Lean’s supported platforms, with Tier 1 binary releases available through elan. source
- Proof checking
- Lean's minimal trusted kernel is described as guaranteeing correctness in mathematical proof, software verification, and hardware verification. source
- Security and trust
- The Lean FRO privacy policy says it collects communication information when users contact it and describes practices for transferring, retaining, and protecting personal information. source
- Security example
- The site says AWS uses Lean to formally verify Cedar, an authorization policy language, by proving security properties and validating them against production code through differential testing. source
- Support
- The Lean Community Zulip is described as the central hub for questions and collaboration, and Lean FRO hosts weekly technical office hours. source
- Supported systems
- Tier 1 platforms include Linux, Apple Silicon macOS, and x86-64 Windows; x86-64 macOS and Emscripten WebAssembly are Tier 2. source
- Trusted kernel
- The official site says Lean’s minimal trusted kernel guarantees correctness in mathematical proof, software verification, and hardware verification. source
Checked against the maker's pages on 9 Oct 2026.