
For more than a decade, a small cadre of mathematicians have worked out of the spotlight to build tools that enable mathematical proofs to be machine-verified. Now, because artificial-intelligence models have been toppling some of the toughest problems in mathematics, their little-known project — called Lean — has been thrown into the public sphere as a trusted verifier of mathematical proofs.
“None of us could have predicted, at the beginning, what would happen” with Lean, says Leonardo de Moura, a computer scientist at Amazon Web Services in Redmond, Washington, and creator of the Lean system. Indeed, many mathematicians have come to depend on the technology to check AI-written proofs of centuries-old problems.
Last month, mathematician Levent Alpöge posted 17 million lines of Lean code that proved the Riemann hypothesis, a notorious unsolved problem. Mathematicians scrambled to understand the proof, even using AI tools to generate a human-readable paper explaining it. Nevertheless, Lean’s stamp of approval was enough for the community to trust the result, says Emily Riehl, a mathematician at Johns Hopkins University in Baltimore, Maryland, and a member of the Mathlib Initiative, which oversees a digital library of Lean statements. “Had that proof been written on paper, there was absolutely no way that people would immediately be able to assess with a high degree of confidence that it’s a correct proof.”
“If I said, ‘One day, the Riemann hypothesis will be verified and proved using Lean and AI’, people would have said I was insane,” de Moura says.
What is Lean?
Lean is a proof assistant and programming language that can formally verify mathematical proofs. When mathematicians write statements and proofs in Lean, the system checks that every step is logically sound according to the rules of mathematical systems.

AI is ‘the end of mathematics as we know it’ — where does the field go next?
Mathematical proofs are typically constructed by combining previously established results. To prove that the square of every even number is even, for example, a mathematician draws on definitions that have already been established. Before Lean, mathematicians verified each other’s proofs manually, reading relevant papers and references to rebuild each step of the arguments in their own heads. This process could take years for complex problems, but Lean can verify massive proofs in hours.
Many mathematical building blocks have now been translated into Lean and added to Mathlib, an open-source, community-maintained library of Lean statements. Researchers can use the tool to build proofs on top of mathematics that has already been formalized.
Mathlib was created in 2017 and now contains more than two million lines of Lean code, thanks to a team composed primarily of volunteers who have reviewed and approved every submission. Their work has given formal mathematical proofs a common language — a feat that has garnered “very little academic recognition” for the reviewers, says Kevin Buzzard, a mathematician at Imperial College London who helps to maintain Mathlib.

Although the software is heralded for ensuring correctness, Lean is still vulnerable to bugs and glitches that could produce imperfect proofs, says Buzzard. Therefore, Lean code needs to go through several extra verification steps before a proof is declared true.
How has Lean changed mathematics?
Enjoying our latest content?
Log in or create an account to continue
- Access the most recent journalism from Nature's award-winning team
- Explore the latest features & opinion covering groundbreaking research