mathlib4
A community-maintained library of formalized mathematics, programming infrastructure, and tactics for the Lean 4 theorem prover.
At a Glance
About mathlib4
Mathlib4 is the user-maintained library for the Lean theorem prover, developed by the leanprover-community organization on GitHub. It contains formalized mathematics, programming infrastructure, and tactics that use that infrastructure to develop further mathematics. The repository is released under the Apache License 2.0 and is open source.
What It Is
Mathlib is a community-driven effort to build a unified library of mathematics formalized in the Lean proof assistant. A proof assistant lets users define objects, state properties, and prove them, with the system checking each proof down to its logical foundation. The library also contains definitions useful for programming, alongside the mathematics and the tactics that automate proof steps.
How It Is Used
Users install Lean and mathlib following the community's instructions, or open the project in a GitHub Codespace. Mathlib can also be used as a dependency in other Lean projects. Contributors build with Lake: lake exe cache get downloads precompiled build files, lake build builds the library, and lake test runs the tests.
Documentation and Community
API documentation is generated automatically from the Lean source files using doc-gen4 and published as the mathlib4 docs, covering foundational types, tactics, references, and library modules. The community site provides a library overview, learning resources, and contribution guidelines. Discussion takes place on Zulip and GitHub.
Formalization Projects
The community site lists projects formalized with Lean and mathlib, including the Liquid Tensor Experiment, the Polynomial Freiman-Ruzsa conjecture, and a Cedar policy language specification.
Collections
Popular collections
- See What Your Agent Is Doing
Collection by @evtuff
- Black Friday 2026: AI APIs and Creative Tools
Collection by @priyashah
- Harness Setup
Collection by @joemseifi
- Code Knowledge Graphs
Collection by @evtuff
Add mathlib4 to one of your collections.
Community Discussions
Be the first to start a conversation about mathlib4
Share your experience with mathlib4, ask questions, or help others learn from your insights.
Pricing
Open Source (Apache-2.0)
Mathlib, the community-maintained math library for the Lean 4 theorem prover, is released under the Apache License 2.0 and is free to use, modify and distribute.
- Licensed under Apache License 2.0 (OSI-approved)
- Perpetual, worldwide, no-charge, royalty-free license grant
- Library of formalized mathematics, programming infrastructure and tactics for Lean 4
- API documentation published online
Capabilities
Key Features
- Formalized mathematics library for Lean 4
- Tactics for developing proofs
- Programming infrastructure and definitions
- Automatically generated API documentation
- Precompiled build cache via lake exe cache get
- Usable as a dependency in other Lean projects
- Library overview and theory documentation
