Lean 4 is an open-source, statically typed functional programming language and interactive theorem prover developed at Microsoft Research and now maintained by the Lean FRO. It unifies the worlds of software engineering and formal mathematics: the same language you use to write executable programs is the language you use to state and prove theorems about those programs. By reading this page you will understand what makes Lean 4 unique, its key features, and where to go next.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/leanprover/lean4/llms.txt
Use this file to discover all available pages before exploring further.
What is Lean 4?
Lean 4 is built on a small, well-understood kernel of dependent type theory called the Calculus of Constructions. Every expression has a type, and types themselves are first-class values. This means you can write a function whose return type depends on the value of its argument — so a list’s length can be part of the list’s type — and the compiler will enforce those invariants at compile time. Lean 4 is also a metaprogramming platform: its tactic framework, macro system, and elaborator are all written in Lean itself, making the language highly extensible.Dependent Types
Express rich invariants in the type system. Values can appear inside types, enabling precise specifications such as
Vector α n — a list of exactly n elements.Tactic Proofs
Prove theorems interactively using a powerful tactic language. Tactics like
simp, omega, decide, rfl, and induction automate most routine steps.Metaprogramming
Extend Lean itself. Macros, custom tactics, and elaboration extensions are written in Lean and run at compile time, giving you a full macro system and DSL toolkit.
Lake Build System
Lake is Lean 4’s integrated build system and package manager. It handles dependencies, compilation, and running executables with a
lakefile.toml (or lakefile.lean) configuration.Language Server (LSP)
First-class editor support via the Language Server Protocol. VS Code, Emacs, and Neovim all offer real-time error reporting, go-to-definition, and goal state displays.
FFI & C Interop
Call into C libraries directly with
@[extern] declarations. Lean manages its own memory with a reference-counting GC that integrates cleanly with C.Lean 4 as a Programming Language
Lean 4 is a pure functional language with a strict (call-by-value) evaluation strategy. It supports the features you expect from a modern functional language:- Algebraic data types defined with
inductive - Pattern matching with
match - Type classes for ad-hoc polymorphism (
Add,Monad,Repr, …) - Monadic
do-notation for IO, state, exceptions, and more - Efficient compilation to native code via LLVM or to C
Lean 4 as a Theorem Prover
A proposition in Lean is just a type inProp. A proof of that proposition is a term that inhabits the type. This is the Curry–Howard correspondence: programs and proofs are the same thing, and the type checker verifies both.
Lean’s kernel is a small, independently verifiable trust anchor. All proofs are checked by the kernel regardless of which tactics were used to build them.
Brief History
| Version | Milestone |
|---|---|
| Lean 1–3 | Developed 2013–2019 at Microsoft Research by Leonardo de Moura. Established Lean as a serious ITP. |
| Lean 4 | Complete rewrite announced 2018, stable release 2023. The compiler, tactics, and standard library are all written in Lean itself. |
| Lean FRO | The Lean Focused Research Organization (non-profit) was founded in 2023 to support long-term development. |
Community and Resources
Official Website
Homepage with news, examples, and the documentation overview.
Theorem Proving in Lean 4
The definitive free book for learning Lean as a proof assistant.
Functional Programming in Lean
A free book teaching Lean 4 as a functional programming language.
Zulip Chat
The main community hub for questions, announcements, and discussion.