What Is Mathlib? The Open Library That Checked the AI Riemann Proof

A library checkout station checks one glowing proof manuscript while a vast archive of carefully indexed theorem cards opens behind it.

Quick answer: Mathlib is the free, community-built mathematics library for the Lean proof assistant. It contains hundreds of thousands of formal definitions and theorems, with theorem proofs checked by Lean against its logical foundations. In November 2026 it served as the trusted reference when the Lean FRO and Mathlib Initiative certified Levent Alpöge's Claude-assisted proof of the Riemann hypothesis.

What Is Mathlib? A Plain-English Answer

A computer just signed off on a proof of the most famous open problem in mathematics, and the thing it checked the proof against was a free, volunteer-built library most people had never heard of. That library is called Mathlib.

Mathlib is the main mathematics library for Lean, a programming language that doubles as a proof checker. The Lean community describes it as a community-driven effort to build a unified library of mathematics formalized in the Lean proof assistant. In plain terms, it is a giant shared notebook in which mathematicians have written definitions and theorems in a form a computer can check line by line.

Think of it like a dictionary plus a textbook that a machine can read. The dictionary part holds definitions: what a prime number is, what a complex number is, what the Riemann zeta function is. The textbook part holds theorems with complete proofs, all checked by Lean. When someone writes a new proof in Lean, they can reuse everything already in Mathlib instead of starting from scratch.

If you have never seen Lean before, our guide Lean theorem prover explained covers the basics. Here we focus on the library itself and why it suddenly matters so much.

Why Mathlib is in the news

On November 20, 2026, Anthropic mathematician Levent Alpöge released a claimed proof of the Riemann hypothesis, written as a Lean library of about 17 million lines and developed with help from Anthropic’s AI model Claude. One day later, the Lean Focused Research Organization (Lean FRO) and the Mathlib Initiative published a joint statement saying they have full confidence the proof is correct. According to that statement, the proof’s code depends directly only on Mathlib, and the official target it proves is Mathlib’s own definition of the Riemann hypothesis.

How Mathlib Works: Lean, Definitions and Community Review

To see why Mathlib can act as a referee, it helps to know how three pieces fit together.

  1. Lean, the checker. Lean reads a proof one logical step at a time. If a single step does not follow from earlier ones, Lean refuses to accept the file. It does not care how clever or famous the author is.
  2. Mathlib, the shared library. Mathlib supplies the definitions and the already-proved results. A new proof can use Mathlib’s existing definition of the Riemann zeta function rather than creating a separate one, and for the Alpöge proof independent checks confirmed that the theorem matches Mathlib’s vetted Riemann hypothesis statement.
  3. People, the reviewers. Humans propose additions, and other humans review them before they join the library. Computers check that proofs are valid, but people decide whether a definition really captures the idea mathematicians mean.

Here is a tiny example of what a Lean theorem looks like:

theorem two_add_two : 2 + 2 = 4 := by norm_num

The line gives the theorem a name, states the claim, and then uses a Mathlib tactic called norm_num to prove it (the file needs a Mathlib import such as import Mathlib.Tactic). Lean runs the tactic, checks the result, and accepts the theorem. Real Mathlib files work the same way, only with far harder statements and much longer proofs.

Why definitions matter so much

A proof checker confirms that a formal proof establishes its stated theorem from the system’s foundations, but it cannot tell whether the statement says what its author intended. If the statement is written wrongly, a perfect proof of the wrong thing still compiles. The Lean community’s own checklist, Did you prove it?, warns about exactly this: giving a random formula a misleading name such as TheRiemannHypothesis, or quietly redefining basic ideas like the natural numbers so a familiar-looking statement means something else. Mathlib guards against that by having experts vet its famous statements in advance. That is a big part of why the library carries so much weight.

Mathlib Key Terms

Tap a card to reveal the answer.

Watch: Two Videos Worth Your Time

Prefer to watch? These videos add another angle on the topic.

Kevin Buzzard: "What is the point of Lean's maths library?" (Topos Institute). Kevin Buzzard, one of the best-known voices in Lean, explains in his own words why a shared library of checked mathematics like Mathlib is worth building.
"Lean" & Automating Mathematical Proofs – Computerphile (Computerphile). A beginner-friendly look at how Lean checks proofs, which makes the Mathlib story much easier to follow.

Mathlib by the Numbers: How Big Is the Library?

Mathlib has grown from a hobby project into one of the largest bodies of computer-checked mathematics in the world. Its official statistics page lists the following totals:

What is countedTotal listedWhat it means
Definitions142,131Precise meanings for objects such as groups, integrals and the zeta function
Theorems296,355Results with complete, machine-checked proofs
Contributors772People who have had work accepted into the library

These numbers keep rising, so treat them as a snapshot. The Lean community’s home page notes that the library has grown by more than an order of magnitude since its design was first described in a 2020 article.

Who pays for it?

For most of its life, Mathlib ran on volunteer time. That changed in July 2025, when Renaissance Philanthropy announced that Alex Gerko, founder of the trading firm XTX Markets, was giving $10 million split evenly between Lean FRO and Mathlib. The announcement said a new Mathlib Initiative would be incubated at Renaissance Philanthropy, which also runs an AI for Math Fund, and that the money would help expand the breadth and depth of mathematics formalized in Lean.

The link to AI turned out to be timely. A library full of checked mathematics is exactly what an AI-assisted proof needs if its output is going to be trusted.

Where Mathlib Fits in the AI Riemann Hypothesis Proof

The Riemann hypothesis, first proposed by Bernhard Riemann in 1859, says that all the nontrivial zeros of the Riemann zeta function lie on a single vertical line in the complex plane. It is tied to how prime numbers are spread out, and it is one of the Clay Mathematics Institute’s Millennium Prize Problems with a $1 million award. Our Riemann hypothesis explainer walks through the idea with pictures and examples.

Before anyone could prove the hypothesis in Lean, someone had to state it in Lean. Mathematicians David Loeffler and Michael Stoll described a project to formalize zeta and L-functions in Mathlib, and their paper notes that the work includes a formal statement of the Riemann hypothesis. That statement sat in Mathlib, unproved, waiting for someone to fill it in.

Alpöge’s release claims to fill it in. According to Euronews, the published proof spans 17,374,215 lines of Lean code across 175,187 files. Alpöge credited Claude heavily, writing, as quoted by Al Jazeera, that Claude far outpaced me near the finish line. Al Jazeera also reports that the claim covers the generalized Riemann hypothesis, a broader version of the problem.

Mathlib plays two roles here. First, it supplies vetted definitions and a formal statement of the Riemann hypothesis, and independent comparisons confirmed that Alpöge’s theorem matches that statement. Second, it supplies the building blocks: complex analysis, number theory and much more that the new proof could reuse instead of rebuilding.

How the Lean Community Checked the Riemann Proof

The Lean FRO and Mathlib Initiative statement explains that four criteria had to be met before they would certify the proof. In simplified form:

  1. The right statement. The target had to be Mathlib’s existing Riemann hypothesis definition, which experts had already vetted.
  2. It compiles. Dozens of people reportedly compiled the code on their own machines and got the same raw proof export, with no errors.
  3. It proves what it says. A separate file that imports only Mathlib isolates the statement. Comparison tools then confirmed that the theorem proved in the giant library is exactly that statement, not a look-alike.
  4. The proof is valid. The exported proof was run through several independent checkers, including Lean’s official kernel and checkers written in other programming languages.

The independent proof checkers examined an inert export of the proof, a frozen copy of the logic, rather than running the original source code, which guards against any hidden malicious code in the source files. The statement ends with a plain sentence: We have full confidence that Alpöge’s proof of the Riemann Hypothesis is correct.

Why several checkers?

If one program has a bug, a second program written by different people in a different language is unlikely to have the same bug. Agreement between independent checkers is the software version of asking several referees to read the same paper. For a deeper look at this idea, see formal verification in math explained.

What Mathlib Verification Proves and What It Does Not

A machine check is powerful, but it answers one specific question: does this chain of logic really prove this exact statement from these exact starting assumptions? It does not answer every question people care about.

QuestionDoes the Lean check answer it?
Is every step logically valid?Yes, that is what the checkers confirm
Is the statement the real Riemann hypothesis?Yes, if you trust Mathlib’s vetted definition, which experts reviewed
Why is the hypothesis true? What is the key idea?No. Humans still have to read and explain the argument
Does it win the $1 million Clay prize?Not automatically. Clay requires publication in a qualifying outlet, at least two years since publication, and general acceptance by the mathematical community before considering a solution

The Lean FRO and Mathlib Initiative’s joint statement says they look forward to the mathematical community explaining the new ideas in the proof. Kevin Buzzard of Imperial College London, a leading figure in Lean, told Al Jazeera that at that point nobody even knew why the theorem is true. Based on past experience with large Lean projects, he expected that to change within a matter of weeks as experts worked through the code.

Buzzard also compared AI to a telescope: a tool that lets people see further, not a replacement for the person looking through it. As he put it, the AI doesn’t have taste, not yet anyway. If you want to think through the trust question in more depth, our post Can we trust AI math proofs? is a good next read.

Checked or Not Yet? You Decide

Pick the best response to each situation.

A friend says a Lean file proving TheRiemannHypothesis compiled, so the problem is solved.

A news headline says the AI proof means humans now fully understand the Riemann hypothesis.

A proof file passes Lean but #print axioms lists an axiom the author added called magic.

Your class wants to know why several different checkers were used on the Riemann proof.

What Mathlib Means for Students, Teachers and Curious Learners

You do not need a PhD to take something useful from this story. Here is what it means in practice.

For students

  • Definitions are not busywork. The whole Riemann check depended on a carefully written definition. When your teacher insists on precise definitions of slope, function or prime, this is why.
  • Every step must follow. Lean rejects a proof with one missing step. Showing your work on an algebra problem is the same habit at a smaller scale.
  • You can try Lean for free. Lean and Mathlib are open source. The Lean community site links to beginner tutorials and learning resources.

For teachers and parents

  • Use the story to open a conversation about what a proof is and who checks it. Ask: if a computer accepts a proof nobody understands yet, is the math finished?
  • Point out the teamwork. Hundreds of contributors built the library that made the check possible. Big results rest on shared, careful groundwork.
  • Keep the hype in check. A verified proof is a major event, but understanding it, explaining it and building on it is human work that is only beginning.

A simple takeaway

Mathlib is a big part of why a 17-million-line proof could be checked within about a day of its release, rather than waiting years for human referees. It shows that careful definitions, small checked steps and open collaboration scale all the way up to the hardest problems in mathematics. Those are the same habits that make everyday math class go well.

Quick Quiz: What Is Mathlib?

Test what you learned about Mathlib and the Riemann proof check.

Answer each question and press Submit to see your result right away.

1. What is Mathlib?
Found a bug? Let us know!
2. According to Mathlib's statistics page, roughly how many theorems does the library contain?
Found a bug? Let us know!
3. Which two groups jointly certified Alpöge's Riemann proof on November 21, 2026?
Found a bug? Let us know!
4. What does the claimed Riemann proof's code depend on directly, according to the joint statement?
Found a bug? Let us know!
5. Why is it risky to trust a Lean file just because it compiles?
Found a bug? Let us know!
6. Which of these is a standard axiom that a valid Mathlib proof may use?
Found a bug? Let us know!
7. What did Kevin Buzzard say was still missing after the proof checked out?
Found a bug? Let us know!
8. How much did Alex Gerko give in 2025 to support Lean FRO and Mathlib?
Found a bug? Let us know!

Answer each question and press Submit to see your result right away.

Frequently Asked Questions

Tap a question to see the answer.

Is Mathlib free to use?

Yes. Lean and Mathlib are free, open-source projects. Anyone can download them, read the source code, and use the library in their own projects or classes.

Is Mathlib the same thing as Lean?

No. Lean is the programming language and proof checker, while Mathlib is a library written in Lean. A good comparison is a programming language versus a large package of ready-made code built for it.

How do I start a project that uses Mathlib?

The Lean community's checklist suggests creating a new project with the command lake new my_project math, which sets up a project that depends on Mathlib. From there, lake build compiles it. Working through a beginner tutorial first makes the setup much easier to follow.

Who decides what goes into Mathlib?

Contributors submit additions as pull requests on GitHub, and experienced community members review them before they are merged. Discussion happens in public, largely on the Lean Zulip chat. The Mathlib Initiative now provides paid support alongside volunteers.

Is the AI Riemann proof now part of Mathlib?

As reported, the proof was released as a separate Lean library that builds on Mathlib, not as part of Mathlib itself. It uses Mathlib's definition of the Riemann hypothesis as its target. Whether any of its pieces are later added to Mathlib would go through the library's normal review process.

Can Mathlib contain mistakes?

Lean's kernel checks formal proofs against its logical rules, so ordinary logical errors are very unlikely. Still, a theorem can depend on extra axioms or a statement can differ from its intended meaning, which is why axioms and definitions are reviewed too. The bigger risk is a definition that does not match what mathematicians intend. That is why famous statements are vetted by experts and why independent checkers were used for the Riemann proof.

What math topics does Mathlib cover?

The Lean community lists areas such as natural numbers, sets, linear algebra, topology, category theory and a broad range of undergraduate mathematics. It also includes research-level number theory and analysis, including the zeta function. Coverage keeps growing as contributors add new material.

Do I need to be a professional mathematician to contribute to Mathlib?

No formal credentials are required. Mathlib is open source, so anyone can propose a change on GitHub, and reviewers judge the work itself. Small additions, such as clearer documentation or simple lemmas, are a natural way to start.

Why is Mathlib important for AI?

AI systems can produce convincing but wrong math, so a reliable checker is valuable. Mathlib gives AI-generated proofs a trusted vocabulary and a large base of checked results, and Lean then confirms or rejects each step. That is why AI researchers and funders, including the backers of the 2025 Mathlib donation, see the library as key infrastructure for AI in mathematics.

Sources and Further Reading

Related to This Article

What people say about "What Is Mathlib? Lean's Math Library Explained"?

No one replied yet.

Leave a Reply