
What is Lean? A guide to the software verifying AI’s mathematical advances

Artificial intelligence tools are dramatically accelerating the speed at which mathematicians can solve problems. But the resulting evidence is so massive that it is difficult for humans to verify.Credit: Hill Street Studios/Getty
For more than a decade, a small group of mathematicians worked behind the scenes to create tools to automatically verify mathematical proofs. Now, because artificial intelligence models have solved some of the most difficult mathematical problems, their little-known project – called Lean – has been launched into the public sphere as a reliable mathematical proof checker.
“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 verify AI-written proofs of centuries-old problems.
Last month, mathematician Levent Alpöge published 17 million lines of Lean code that prove the Riemann Hypothesis, a notoriously unsolved problem. Mathematicians have scrambled to understand the proof, even using AI tools to generate a human-readable article explaining it. Still, Lean’s seal 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. “If this evidence had been written on paper, there would be absolutely no way that people would be able to immediately assess with a high degree of confidence that this is correct evidence.”
“If I had said, ‘One day the Riemann hypothesis will be verified and proven through Lean and AI,’ people would have said I was crazy,” says de Moura.
What is Lean?
Lean is a proof assistant and programming language capable of formally verifying mathematical proofs. When mathematicians write statements and proofs in Lean, the system verifies that each step is logically sound according to the rules of mathematical systems.

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

Lean, a programming language designed to help verify mathematical proofs, confirmed that the Riemann Hypothesis had been proven.Credit: Michael Szebor/Nature
Although the software is known for ensuring accuracy, Lean remains vulnerable to bugs and glitches that could produce imperfect evidence, Buzzard says. Therefore, Lean code must go through several additional verification steps before a proof is declared true.
How has Lean changed mathematics?
Gn bussni