In September, OpenAI announced a proof that a fluid starting at rest and pushed by a smooth force can reach infinite speed in finite time. This settles the Navier–Stokes equations, a Millennium Prize Problem open since 1934.In October, OpenAI and Anthropic independently released algorithms that decide propositional satisfiability in less than exponential time, refuting the Exponential Time Hypothesis, on which more than 800 papers rest.Last week, Levent Alpöge of Anthropic announced a proof of the Riemann Hypothesis, found with Claude. This conjecture about prime numbers, open since 1859, is also a Millennium Prize Problem.Each proof was checked using the Lean proof assistant. Human review of all three is in progress.This raises a natural question: how can AI tools, known to hallucinate and make errors, solve problems that have resisted the best mathematicians for decades? The answer, we argue, lies in three technologies: large language models pre-trained on human writing, proof assistants that check every step, and reinforcement learning, which improves the model by trial and error against the checker.Learning from readingThe systems behind ChatGPT, Claude, and Gemini are large language models (LLMs). These are essentially mathematical functions with billions of adjustable numbers called parameters.Story continues below this adTheir first phase of training, pre-training, is essentially learning from reading. The model reads tens of trillions of words or word fragments called tokens from the internet, books, code, and papers. Shown a passage, the model predicts the next token, and its parameters are nudged so that the actual next token becomes more likely. Each prediction draws on everything written before through a mechanism called attention.To write, the model predicts a token, appends it, and predicts the next one from the longer text. This is the defining idea behind LLMs.Also Read | Navier-Stokes problem: The questions raised by OpenAI’s latest maths ‘breakthrough’Nobody teaches the model any grammar, facts, or logic. Mathematics is a language with its own vocabulary (integer, prime, continuous), its own grammar (let, suppose, for every … there exists, therefore), and its own structure: definitions, lemmas, theorems, and proofs. LLMs learn whatever language they read enough of, be it English, Hindi, Python, or mathematics, enabling them to write proofs at all.But just as a grammatical sentence can be false, a fluent proof can hide a fatal gap.Story continues below this adMathematical writing does offer some help. Nearly every line of a published proof follows from the ones before it, so to predict proofs it has never seen, a model cannot merely memorise; it must pick up the underlying patterns of inference. Pre-training thus gives the model a sense of mathematical reasoning, much as a student absorbs a subject from worked examples. Like a student, the model can be confidently wrong, and it is least reliable where a problem departs from familiar patterns.In the end, a language model is trained to be coherent, to produce arguments that sound right. It is not trained to be correct. It will write “hence proved” whether or not it has got the mathematics right.Proofs you can Lean onThis is where Lean comes into play. Lean 4 is a programming language in which mathematical statements and proofs are written step by step.At its heart is a small, carefully audited program called the kernel, which accepts a proof only if every step follows from the rules of logic. Everything else, including the AI that wrote the proof, can remain untrusted, because nothing gets past the kernel. New proofs can draw on Mathlib, a library of nearly 300,000 theorems built by over 700 contributors.Story continues below this adImportantly, Lean is not AI. It rests on decades of research in logic and programming languages. It involves no learning and no probabilities, and it always returns the same verdict on the same proof.As a checker for AI, Lean has three virtues. It is so fast, candidate proofs can be checked by the million. It is reliable, so a proof that passes really is a proof. And when a proof fails, Lean says where and why.Also Read | ‘Like a conversation with a fellow mathematician over coffee’: How AI is reshaping maths research, careersLean’s blind spot, however, is that it certifies only the statement as written. If the formal statement does not capture the intended theorem, the certificate proves the wrong thing. Human scrutiny of the statement is therefore indispensable. Fortunately, a statement is short even when its proof is not. The formal statement of the Riemann Hypothesis takes a few lines; its proof runs to 17 million lines. Experts need only check that the statement means what it should.Learning from practiceThe final ingredient is practice. The model attempts a problem many times, Lean marks each attempt as a success or failure, and the model is nudged towards the reasoning found in successful attempts. Because the reward comes from a checker rather than a person, this is called reinforcement learning with verifiable rewards.Story continues below this adIs this not too crude? An attempt that reasons well for ninety-nine steps and slips at the last is still marked a failure. But sound reasoning succeeds more often than not, so over millions of attempts it is reinforced. Across a broad range of problems, valid reasoning is more or less the only strategy that keeps succeeding, so the process selects for something that behaves like logic.Together, the three ingredients form a loop: the model generates coherent candidates in bulk, Lean checks them quickly and reliably, and every verdict improves the model.AI theorem proving is thus a partnership. The AI proposes, Lean judges, and humans supply the statements and the judgement of what matters. The logic, and the trust, need not reside in the AI at all.However, there are two caveats.First, verification is not understanding. This system can result in correct proofs that we do not understand. Mathematicians reviewing the Navier–Stokes proof say it has so far taught them little.Story continues below this adSecond, trial and error makes an AI as good as its checker, and no better. If a checker can be fooled in some systematic way, practice will find the weakness and exploit it.NewsletterFollow our daily newsletter so you never miss anything important. On Wednesday, we answer readers' questions.SubscribeMathematics is fortunate in having a checker that is hard to fool. Most domains are not. In medical diagnosis, for example, confirmation may come weeks later or never, and the “correct” label is often just another doctor’s opinion. Where checkers are weak, an AI may get very good at pleasing the checker without getting good at the task, and only independent evaluation in the real world can tell the two apart. As AI moves into medicine, law, and public services, we must not lose sight of this distinction.Aalok Thakkar is Assistant Professor of Computer Science, and Subhashis Banerjee is Professor of Computer Science at Ashoka University.