# What is Lean: the programming language that checks math proofs

> Lean turns a proof into code that a small trusted kernel checks step by step, which is how a 17-million-line Riemann hypothesis proof could be verified.

URL: https://claudegpt.si/news/lean-programming-language  
Published: 2026-11-22T07:00:57.576Z  
Author: ClaudeGPT Si Newsroom  
Section: Research  
Topics: Lean, Mathlib, Formal verification, Mathematics, Riemann hypothesis  
Publisher: ClaudeGPT Si

## Key takeaways

- Lean is an open-source functional programming language and proof assistant that Leonardo de Moura started at Microsoft Research in 2013 and the Lean FRO now develops.
- Tactics help build a proof, but only Lean's small kernel decides whether it is accepted, so the automation and the author do not need to be trusted.
- Lean proves the statement as written, not the one intended, so a checked proof is only as good as its formal statement.

Lean is an open-source functional programming language that doubles as an interactive theorem prover: a tool in which you write a mathematical proof as code, and the computer checks every step. The [official site](https://lean-lang.org/) describes it as both a programming language and a proof assistant. Leonardo de Moura started it at Microsoft Research in 2013, and it is now developed by the Lean FRO (Focused Research Organization), which he co-founded.

Searches for the Lean programming language jumped this week for one reason. On November 21, 2026, the Lean and Mathlib communities [said in a joint statement](https://leanprover-community.github.io/blog/posts/riemann-hypothesis/) that a Lean formalization of Levent Alpöge's claimed proof of the Riemann hypothesis checks out. That story is covered in [our article on the verification](https://claudegpt.si/news/riemann-hypothesis-lean-proof-verified).

## What the Lean programming language is

As a programming language, it is functional: you write programs mostly as functions, and the compiler produces native code. The [Lean 4 paper](https://www.microsoft.com/en-us/research/publication/the-lean-4-theorem-prover-and-programming-language/) by de Moura and Sebastian Ullrich, presented at the CADE conference in July 2021, describes Lean 4 as a rewrite of the theorem prover in Lean itself. Because Lean is written in Lean, users can extend the parser, the tactics and the code generator from inside the language.

As a proof assistant, Lean lets you state a theorem precisely and then prove it. [Theorem Proving in Lean 4](https://lean-lang.org/theorem_proving_in_lean4/introduction.html), the official tutorial, says Lean is based on a version of the Calculus of Constructions with inductive types. In plain words, it uses dependent type theory, a logic in which a statement is a type and a proof is a term of that type. Checking the proof means checking that the term has the right type.

Lean is released under the Apache 2.0 license. The current major version is Lean 4.

## How Lean checks a proof

Here is a short proof from the official tutorial. It says that if `p` and `q` are both true, then "p and q and p" is true:

```lean
theorem test (p q : Prop) (hp : p) (hq : q) : p ∧ q ∧ p := by
  apply And.intro
  · exact hp
  · apply And.intro
    · exact hq
    · exact hp
```

The lines after `by` are tactics. The tutorial describes tactics as instructions that tell Lean how to build a proof. Some tactics do one small step. Others, like Lean's simplifier, run automation that strings many steps together.

Tactics can have bugs. That doesn't matter for correctness, because they don't get the final say. They produce a proof term, a complete low-level record of the argument, and that term goes to Lean's kernel. The kernel is a small program that checks each step against the rules of the logic. The [Lean site](https://lean-lang.org/about) calls it Lean's "minimal trusted kernel." The [Lean language reference](https://lean-lang.org/doc/reference/latest/ValidatingProofs/) treats a theorem as proved once the kernel has accepted a proof of its statement.

This design is why people trust Lean. You don't have to trust the millions of lines of automation, or the person or AI that wrote the proof. You have to trust the kernel and the logic. Others have written their own checkers too. In the Riemann hypothesis check, the exported proof was run through Lean's kernel and through separate checkers, including ones written in other languages.

Lean also tells you what a proof rests on. The command `#print axioms` lists every axiom a theorem depends on. If it reports `sorryAx`, the reference says, the theorem is incomplete: `sorry` is Lean's placeholder for a step nobody has proved yet.

## What Mathlib is

Mathlib is Lean's shared library of mathematics. The [community site](https://leanprover-community.github.io/) describes it as a community effort to build one unified library of formalized mathematics.

It is large. As of November 22, 2026, [Mathlib's statistics page](https://mathlib.org/mathlib_stats.html) counts 142,131 definitions, 296,355 theorems and 772 contributors. The Lean home page puts it at over a million lines of formalized mathematics.

Formal proofs build on each other, so Mathlib holds the foundations and formal statements of famous open problems. Its [`RiemannHypothesis` definition](https://leanprover-community.github.io/mathlib4_docs/Mathlib/NumberTheory/LSeries/RiemannZeta.html) says that every zero of the Riemann zeta function, other than the trivial zeros at negative even numbers, has real part 1/2. Its docstring jokes that proving it is worth a million dollars. The community statement says Alpöge's roughly 17-million-line library depends directly only on Mathlib, and that this statement is what it proves.

## Who uses Lean

- **Mathematicians.** Mathlib's contributors, and large projects listed on the Lean site such as a formalization of Fermat's Last Theorem that is underway.
- **AI labs.** Google DeepMind's AlphaProof, which [DeepMind described in July 2024](https://deepmind.google/discover/blog/ai-solves-imo-problems-at-silver-medal-level/), trains itself to prove mathematical statements in Lean. The Lean home page also names Anthropic and OpenAI in its news section.
- **Software teams.** AWS used Lean to [verify Cedar](https://lean-lang.org/use-cases/cedar/), its open-source language for authorization policies. AWS keeps Lean models of Cedar next to the production Rust code, proves properties about them, and tests the two against each other on millions of random inputs. The Lean site says no new Cedar version ships unless its model, proofs and tests are current. Another project, Aeneas, uses Lean to verify Rust programs.

The [Lean FRO](https://lean-lang.org/fro/), whose first-year roadmap ran from August 2023, lists de Moura as chief architect and Ullrich as head of engineering. Its backers include the Sloan and Simons foundations and Amazon Automated Reasoning.

## Why Lean matters for AI-written proofs

A 17-million-line proof is far beyond what any referee could check by hand. Lean changes the question from "do we trust whoever wrote this?" to "does the kernel accept it, and is the statement right?"

If an AI writes the proof, humans still have to confirm the theorem says what they meant. Our explainer on [formal verification](https://claudegpt.si/news/what-is-formal-verification) covers the general idea, and [our report on Alpöge's claim](https://claudegpt.si/news/riemann-hypothesis-claude-proof-claim) covers how this particular proof came about.

## The limit: a proof is only as good as its statement

Lean checks that a proof proves the statement you wrote. It cannot check that you wrote the statement you meant. The reference says it plainly: "Lean can establish that a statement has been proven, but not whether it is the intended statement."

The Xena Project blog gave a sharp example in a [November 12, 2026 post](https://xenaproject.wordpress.com/2026/11/12/and-the-proof-is-checked-in-lean/). It wrote out a Lean statement that looks like Fermat's Last Theorem but is false, because in Lean the natural numbers include 0. It still compiles. The post also looked at a batch of 722 mathematics papers OpenAI released in October. Of the 290 theorems in it that came with Lean code, it counted about 38 whose Lean code does not state the paper's main theorem at all. The post adds that OpenAI never claimed it did.

That is why the Riemann hypothesis check had four parts: experts vetted Mathlib's statement, dozens of people compiled the code, two tools confirmed the proved theorem matches that statement, and several independent checkers accepted the proof.

Lean's own logic could in principle be flawed. The community statement answers that two of its checkers come with a formal proof, relative to set theory, that they cannot accept a false proof.

## How to install Lean or try it

The [Lean playground](https://live.lean-lang.org/) runs Lean in a web page without installing anything.

To install it locally, the [official install page](https://lean-lang.org/install/) recommends three steps:

1. Install VS Code.
2. Install the Lean 4 extension, `leanprover.lean4`, from the VS Code marketplace.
3. Follow the extension's setup guide. If it doesn't open, open a new text file, click the ∀ symbol at the top right and pick the setup guide from the Documentation menu.

To learn, the community [learning page](https://leanprover-community.github.io/learn.html) is the starting point, and [Theorem Proving in Lean 4](https://lean-lang.org/theorem_proving_in_lean4/) is the standard tutorial for proofs.

## Frequently asked questions

### What is Mathlib?

Mathlib is Lean's community library of formalized mathematics. As of November 22, 2026 its statistics page lists 142,131 definitions, 296,355 theorems and 772 contributors.

### What is Lean 4?

Lean 4 is the current major version of Lean, a reimplementation of the theorem prover written in Lean itself. De Moura and Sebastian Ullrich described it in a July 2021 paper at the CADE conference.

### Was the Riemann hypothesis proved in Lean?

On November 21, 2026 the Lean and Mathlib communities said a roughly 17-million-line Lean library by Levent Alpöge proves Mathlib's formal statement of the Riemann hypothesis, after checking it with several independent checkers.

### How do I try Lean without installing it?

The Lean playground at live.lean-lang.org runs Lean in the browser. For a local setup, the official install page recommends VS Code with the leanprover.lean4 extension.

## Sources

- [Lean: programming language and theorem prover](https://lean-lang.org/), Lean FRO
- [About Lean](https://lean-lang.org/about), Lean FRO
- [Statement on the Riemann hypothesis formalization](https://leanprover-community.github.io/blog/posts/riemann-hypothesis/), Lean community
- [Theorem Proving in Lean 4: Introduction](https://lean-lang.org/theorem_proving_in_lean4/introduction.html), Lean FRO
- [Theorem Proving in Lean 4: Tactics](https://lean-lang.org/theorem_proving_in_lean4/tactics.html), Lean FRO
- [Validating a Lean proof](https://lean-lang.org/doc/reference/latest/ValidatingProofs/), Lean FRO
- [The Lean 4 theorem prover and programming language](https://www.microsoft.com/en-us/research/publication/the-lean-4-theorem-prover-and-programming-language/), Microsoft Research
- [Mathlib statistics](https://mathlib.org/mathlib_stats.html), Mathlib
- [Mathlib.NumberTheory.LSeries.RiemannZeta](https://leanprover-community.github.io/mathlib4_docs/Mathlib/NumberTheory/LSeries/RiemannZeta.html), Mathlib
- [Lean community home](https://leanprover-community.github.io/), Lean community
- [Lean FRO](https://lean-lang.org/fro/), Lean FRO
- [Lean FRO year 1 roadmap](https://lean-lang.org/fro/roadmap/y1), Lean FRO
- [Lean FRO team](https://lean-lang.org/fro/team/), Lean FRO
- [Cedar use case](https://lean-lang.org/use-cases/cedar/), Lean FRO
- [Install Lean](https://lean-lang.org/install/), Lean FRO
- [AI achieves silver-medal standard solving International Mathematical Olympiad problems](https://deepmind.google/discover/blog/ai-solves-imo-problems-at-silver-medal-level/), Google DeepMind
- [...and the proof is checked in Lean](https://xenaproject.wordpress.com/2026/11/12/and-the-proof-is-checked-in-lean/), Xena Project
