Naru News日本語

Home › Glossary › AI

What is Lean (the language in which computers check that math proofs are correct)?

Also called: Lean 4, Lean theorem prover

Term explainer · Checked November 17, 2026 · 13 min read

In one minute

Lean is a programming language in which you write a math proof in a fixed form, and a computer then checks, one step at a time, whether the proof is correct.

Whether a person or an AI wrote the proof, a small part inside Lean called the kernel checks at the end that each step follows the rules, and rejects the proof if even one step doesn’t. Because the kernel is small and simple, there is little in it to doubt, and proofs can be rechecked with checkers that other people built. That is why even proofs tens of thousands of lines long can be trusted without people reading every line.

Leonardo de Moura started Lean in 2013 at Microsoft Research. It has Mathlib, a math library that many people build together, and it is used to check big proofs by mathematicians and proofs written by AI. But Lean does not check whether the problem itself was written correctly in Lean.

A common mix-up

“Lean is an AI that solves math problems by itself.”

Only partly right. Lean does have tools that fill in simple steps automatically (tactics, such as simp, which keeps rewriting an expression using given equations), and short proofs can sometimes be finished inside Lean alone. But Lean itself is not an AI that reads a problem and figures out how to solve it. Lean’s main job is to check whether a proof written by a person or an AI follows the rules step by step. Google DeepMind’s AlphaProof, known as an AI that solves math problems, searches for proof steps in Lean’s language and builds proofs that Lean can check. The AI does the thinking, and Lean does the checking. Proofs that an AI writes in ordinary language can contain plausible-looking mistakes (hallucinations), but if the AI writes them in Lean’s language, Lean catches the wrong steps.

Explained in pictures

A sketch of how Lean checks a proof. Title: “Big tools write; a small kernel checks.” Left panel, “Proof writers,” with three tags: “People,” “AI,” and “Automation (tactics).” Below: “People or AI alike.” An arrow leads to a large pale navy panel in the middle, “Elaborator (preprocessing),” holding ten small squares and the words “Turns short proofs into detailed terms for the kernel” and “Large and complex.” Below it: “Kernel catches its bugs.” An arrow leads to a small navy box, “Kernel (core checker),” marked “Small,” with “Checks each step against the rules” above it. From an orange box below, “Axioms, taken without proof,” an arrow points up into the kernel. Two arrows lead right from the kernel to a solid rounded tag, “✓ Accepted,” and a dotted tag, “✗ Rejected.” Below them, a dotted box: “Separate checkers can recheck it.” Band at the bottom: Whoever writes the proof, the small kernel checks it last.
This sketch shows how Lean checks a proof. The proof can be written by a person, by an AI, or filled in by automatic tools (tactics). The elaborator in the middle is the large, complex part that turns a short proof into the detailed form the kernel reads. Even if it has a bug, the small kernel checks at the end, step by step, that everything follows the rules, so a wrong proof is not accepted. The kernel relies on the axioms below (basic rules of mathematics accepted without proof). Because the kernel is small, the same proof can be rechecked by checkers that other people built (the dotted box at the lower right).
A guide to reading short Lean examples. Title: “Writing a claim and its proof in Lean.” The top panel holds one line of code: “example (a b : Nat) : a + b = b + a := Nat.add_comm a b.” Brackets below it label “example” as “Starts an example,” “(a b : Nat)” as “a and b are whole numbers,” the orange “a + b = b + a” as “What to show,” and the orange “Nat.add_comm a b” as “Proof: uses a built-in theorem: order doesn’t matter in +.” Lower left, a solid box, “✓ Accepted”: example : 2 + 3 = 5 := rfl, “rfl means ‘both sides are the same’,” “Both sides compute to 5.” Lower right, a dotted box, “✗ Rejected”: example : 2 + 3 = 6 := rfl, “The sides compute to 5 and 6, so they don’t match.” Band at the bottom: The kernel checks that the proof fits exactly what is claimed.
This shows how to read short Lean examples. The top line is a proof that “for whole numbers a and b from 0 up, a + b equals b + a.” “example” starts an unnamed example, and “(a b : Nat)” means “a and b are Nat (whole numbers from 0 up).” Between the second “:” and “:=” (in orange) is what to show, and after “:=” (in orange) is the proof, which hands a and b to Nat.add_comm, a theorem built into Lean saying that the order of adding doesn’t matter. The two rfl lines below are proofs meaning “both sides are the same.” 2 + 3 and 5 compute to the same thing, so the first is accepted; 2 + 3 and 6 don’t match, so the second is rejected.
A timeline of key events for Lean. Title: “Lean’s path and the big proofs it checked.” Six points with pictures along an arrow pointing right. 2013, “Lean begins”: a code window. 2017, “Mathlib starts”: a row of books. 2022, “Scholze’s proof checked”: a sheet of paper and a round check mark. 2023, “PFR proof in ~3 weeks”: an hourglass. 2024, “AlphaProof, Olympiad”: a medal with a star. 2026, “Fermat’s Last Theorem (company claim)”: a dotted box holding aⁿ + bⁿ ≠ cⁿ and “n ≥ 3”; only this point has a dotted circle. Band at the bottom: Big proofs by people and proofs by AI are now checked in Lean.
This timeline lines up key events for Lean by year. Leonardo de Moura started Lean in 2013, and Mathlib, a math library built by many people together, began in 2017. In 2022, the proof of a theorem that the mathematician Scholze had asked people to check (the Liquid Tensor Experiment) was fully checked in Lean. In 2023, the proof of the PFR conjecture was checked about three weeks after the project began. In 2024, Google DeepMind’s AlphaProof solved three of the International Mathematical Olympiad problems that people had translated into Lean’s language. The 2026 proof of Fermat’s Last Theorem (no positive whole numbers satisfy aⁿ + bⁿ = cⁿ when n is 3 or more) is an announcement by the AI company Anthropic, so it is set apart with dotted lines.

You’re free to use these figures in lessons, slides and posts if you credit Naru News (naru.news). CC BY 4.0.

Think of it like this

A referee who checks a game record against the rules

Imagine being handed the record of a long chess game, with every move written down in order, and being asked: “Did every move follow the rules, and does the game end in checkmate?” Coming up with which move to play is hard even for strong players. But checking that each move follows the rules for how the pieces move takes no skill at all. You just compare the moves with the rules, one at a time.

Lean’s kernel is that referee. The proof is the game record, and the rules of logic and the axioms are the rules of the game. Whether a person or an AI came up with the moves, the referee only compares them one by one, so as long as the comparing is done right, the result can be trusted. And because the referee’s job is simple, it is easier to check the referee itself for mistakes. But the referee doesn’t look at whether the starting position was really the game you meant to play. Likewise, Lean doesn’t check whether the problem was written down correctly.

The comparison has limits, though. You can learn chess rules just by learning how the pieces move, but Lean’s rules are far more abstract, built so that almost all of mathematics can be written in them. Also, in chess a person writes the record move by move, while in Lean the elaborator turns a short proof that a person wrote into detailed steps and passes them to the kernel together with steps filled in by automatic tools.

Key points

How does Lean check a proof?

In Lean, you write what you want to show (in math, called a proposition) and its proof in a fixed form. For example, the line “example (a b : Nat) : a + b = b + a := Nat.add_comm a b” is a proof that “for whole numbers a and b from 0 up, a + b equals b + a.”

Here’s how to read it. “example” starts an unnamed example. “(a b : Nat)” means “a and b are Nat (whole numbers from 0 up).” Between the second “:” and “:=” is a + b = b + a, the thing to show, and after “:=” comes the proof. Nat.add_comm is a theorem built into Lean saying that the order of adding doesn’t matter, and a and b are handed to it.

Lean treats what you want to show as a type (a kind of value), and a proof as a value of that type. Just as 7 is a value of the kind “whole number,” this proof is a value of the kind “a + b = b + a.” What Lean checks is whether the kind of the proof you wrote fits exactly what you want to show. It finds mistakes in proofs the same way a program flags an error when you put letters where a number should go.

Some proofs are checked by calculation. In “example : 2 + 3 = 5 := rfl,” rfl means “both sides are the same,” and Lean computes both sides, gets 5 for each, and accepts it. If you wrote 2 + 3 = 6 instead, the calculation wouldn’t match, and Lean would reject it.

Long proofs are usually written with tactics (commands that tell Lean how to build the proof). Lean’s elaborator turns short proofs and tactics written by people into the detailed form that the kernel can read. At the end, the kernel checks that form.

Why can we trust Lean’s checking?

The tools for writing proofs can be large and complex. The elaborator and tactics may even contain bugs. Even so, whenever a theorem or definition is added to Lean, the kernel always checks at the end that it follows the rules. The kernel stands guard so that a bug in the elaborator can’t let a wrong proof through.

The kernel is a small program made of only the minimum needed to check the rules. It is kept small so that there is less in it to doubt and its checking can be trusted. In the field of proof assistants, this idea of leaving proofs in a form that a small kernel can check is called the “de Bruijn criterion.”

Because the kernel is small, other people can build their own checkers that follow the same rules. There is a checker called nanoda, built separately from Lean in a different programming language, Rust, and a tool called lean4checker that runs stored proofs through Lean’s kernel again. That way, you don’t have to rely on a single checker being free of mistakes.

Lean also records the axioms (basic rules of mathematics accepted without proof) that a proof relies on. A command, “#print axioms,” lists every axiom a theorem ultimately depends on. The important foundations for doing math in Lean are three axioms: Classical.choice, propext and Quot.sound. If a sorry (a mark meaning “not proved yet,” used in unfinished spots) is left anywhere, it shows up in the list too. A sorry can make anything count as proved, so it isn’t used in finished proofs.

Who made it, and who keeps it growing?

Leonardo de Moura started Lean in 2013 at Microsoft Research in the United States. The first version (0.1) came out in 2014, and Lean 3 in 2017. Work on Lean 4, the version used today, began in 2018, and its official release (4.0) came out in September 2023.

Lean 4 was rebuilt in Lean itself. Lean is both a tool for checking proofs and a functional programming language (a language for building programs by combining functions) that can make fast programs. Many people write their own tools for finding proofs automatically in Lean. It is also used outside math: for example, Amazon Web Services (AWS) uses Lean to formally verify Cedar, a language for writing rules about who may do what.

In July 2023, de Moura and Sebastian Ullrich founded the Lean FRO, a non-profit organization that develops Lean.

Mathlib is a library of formalized mathematics that Lean users build together. It began on Lean 3 in 2017 and finished moving to Lean 4 in July 2023. It now has over a million lines, and the official statistics seen on November 17, 2026 showed 140,046 definitions, 294,155 theorems and 772 contributors. New proofs can use the theorems in it as building blocks.

What have mathematicians used it for?

In December 2020, the mathematician Peter Scholze called for Lean to check what he said might be his most important theorem to date, which he had proved with Dustin Clausen. He wrote that nobody else had gone through the details, that a mistake could remain uncaught if others used the theorem without looking inside, and that for such an important theorem, being 99.9% sure was not enough. The challenge became known as the Liquid Tensor Experiment.

Half a year later, in June 2021, the part Scholze had been unsure about was checked, and he wrote that he had no remaining doubts about the correctness of the main proof. Along the way, a few slight imprecisions were found and fixed, and he said that using Lean deepened his understanding of the proof. The whole project, led by Johan Commelin, was completed on July 14, 2022.

On November 9, 2023, Tim Gowers, Ben Green, Freddie Manners and Terence Tao released a proof of one case of the polynomial Freiman–Ruzsa (PFR) conjecture, a conjecture spanning number theory and combinatorics (the math of counting and arranging). Tao and others soon started a group project to check it in Lean, and on December 5 the proof went through without a single sorry. That was about three weeks after the project began.

Fermat’s Last Theorem (no positive whole numbers a, b and c satisfy aⁿ + bⁿ = cⁿ when n is 3 or more) was proved by Andrew Wiles in 1995. Kevin Buzzard is leading a project at Imperial College London in the UK to check a modern form of this proof in Lean. The route, based on the proof by Wiles and others, was planned by Richard Taylor, and the project is funded by a UK research grant until September 2029.

How is it connected to AI?

Large language models (AI that writes text, like ChatGPT) can now solve math problems too, but they sometimes slip in plausible-looking mistakes (hallucinations). Checking a long proof that an AI wrote in ordinary language by reading every line is hard work for people. If the AI writes the proof in Lean’s language instead, Lean finds any wrong step.

In July 2024, Google DeepMind announced AlphaProof, an AI that searches for proofs in Lean’s language. People translated that year’s six International Mathematical Olympiad problems into a fixed form a computer can work with (Lean’s language, for AlphaProof), and AlphaProof solved two algebra problems and one number theory problem and proved its answers correct. Together with another AI (AlphaGeometry 2) that solved the geometry problem, the company says it scored 28 points, at silver-medal standard. It says one problem was solved within minutes and the others took up to three days.

In September 2026, the AI company Anthropic announced that its AI, Claude, working largely on its own for 11 days, had written a proof of Fermat’s Last Theorem in about 13 million lines of Lean (a company announcement). It says the proof relies only on Lean’s three standard axioms and that a tool also confirmed the proved statement matches the statement of Fermat’s Last Theorem in Mathlib. It describes the work as separate from Buzzard’s project but adapting parts of it, and says Buzzard reviewed the proof and gave comments.

This split, with AI writing proofs and Lean checking them, is spreading to formal verification, which checks that programs are correct (see the “Formal verification” page). There is also research on letting AI translate problems from ordinary language into Lean’s language, which brings the pitfall of mistranslation (see the “Autoformalization” page).

What doesn’t Lean check?

What Lean checks is “whether the statement written in Lean was proved according to the rules.” It does not check whether that statement means the same thing as the problem you really wanted to check. For example, if you write “for whole numbers from 0 up” where you meant “for any integer,” you have proved a different, easier problem, and Lean still accepts it (see the “Autoformalization” page).

Even partway through the Liquid Tensor Experiment, Scholze wrote that checking that all the definitions in the Lean statement of the theorem are exactly right is still a job that a person must do. When you doubt a statement, you need to look carefully at it and at every definition it uses.

Also, the kernel and the axioms are trusted as correct. The kernel is small and can be rechecked by other checkers, but these are all programs, so we can’t say there is no chance of a mistake at all. A proof that relies on axioms can be trusted only as far as those axioms are true and don’t contradict each other.

So when you hear “it was checked in Lean,” it’s important to look at which statement was checked, and on top of which axioms.

Check yourself

  1. Q1Proofs tens of thousands of lines long that have passed in Lean, a programming language for writing out math proofs, are considered trustworthy. What is the main reason?

    Answer and explanation

    Answer: C A small kernel checked it one step at a time

    Whoever wrote the proof, a person or an AI, a small part inside Lean called the kernel checks at the end, step by step, that it follows the rules. Because the kernel is small and simple, there is little in it to doubt, and checkers that other people built can recheck the proof. Even if the tools for writing proofs (the elaborator or automatic tools) have bugs, the kernel’s check stops them. Lean itself is not an AI, and the kernel’s check can be trusted without crowds of people rereading the proof.

    More on this → Key points: Why can we trust Lean’s checking?

  2. Q2How do AlphaProof, an AI for solving math problems announced by Google DeepMind in 2024, and Lean, a programming language for writing out math proofs, divide the work?

    Answer and explanation

    Answer: B AlphaProof searches for proofs, and Lean checks them

    AlphaProof is an AI that searches, step by step, for proofs in Lean’s language, and Lean checks whether those proofs follow the rules. The AI does the thinking, and Lean does the checking. Lean itself is not an AI that reads a problem and figures out how to solve it. Also, the 2024 International Mathematical Olympiad problems given to AlphaProof had been translated into Lean’s language by people. Lean is not a tool for translating proofs into ordinary language, either.

    More on this → Key points: How is it connected to AI?

  3. Q3An AI rewrote a math problem as a statement in Lean, the programming language for checking proofs, proved it, and the proof passed Lean’s check. What should a person still check separately?

    Answer and explanation

    Answer: A Whether the Lean statement means the original problem

    What Lean checks is whether the statement written in Lean was proved according to the rules. Lean does check how the steps of the proof connect and the calculations inside it. But it does not check whether the statement means the same thing as the original problem. For example, rewriting “for any integer” as “for whole numbers from 0 up” proves a different, easier problem, and Lean still accepts it. The mathematician Scholze also wrote that a person must check whether all the definitions in the Lean statement of a theorem are right.

    More on this → Key points: What doesn’t Lean check?

Sources and how we checked

AI wrote this page from the sources above, and a different AI checked it against the text of those sources (November 17, 2026). A person with a master’s degree in science and a Japanese high-school science teaching license also read and checked it before publishing. Numbers are as of that date. If anything was hard to follow, you spot a mistake, or there’s a term you’d like explained, please write to [email protected].

AI terms

All 58 AI terms →