# mathlib4

> A community-maintained library of formalized mathematics, programming infrastructure, and tactics for the Lean 4 theorem prover.

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.

## 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

## Integrations
Lean 4, Lake, Aesop, Batteries, GitHub Codespaces, Zulip

## Platforms
WINDOWS, MACOS, LINUX, API, DEVELOPER_SDK, CLI

## Pricing
Open Source

## Version
v4.36.0

## Links
- Website: https://leanprover-community.github.io/mathlib4_docs
- Documentation: https://leanprover-community.github.io/mathlib4_docs/index.html
- Repository: https://github.com/leanprover-community/mathlib4
- EveryDev.ai: https://www.everydev.ai/tools/mathlib4
