Interpreting claims that a theorem is correct because it was checked in Lean
matt_d
294 points
132 comments
November 16, 2026
Related Discussions
Found 5 related stories in 150.4ms across 13,334 title embeddings via pgvector HNSW
- What mathematicians should know about the Lean Theorem Prover: reliability & AI matt_d · 76 pts · October 09, 2026 · 65% similar
- Show HN: Spivak's Calculus formalized in Lean 4 – every theorem, every problem jsLavaGoat · 12 pts · September 26, 2026 · 59% similar
- Fermat's Last Theorem in Lean 4 aaraujo002 · 83 pts · September 04, 2026 · 57% similar
- Lean verification of the Riemann Hypothesis g-b-r · 931 pts · November 21, 2026 · 57% similar
- Are We Stuck with Lean? jjgreen · 135 pts · July 30, 2026 · 56% similar
Discussion Highlights (20 comments)
troupo
(Judging from my very limited experience with Lean, and with Lean written by LLMs) It also doesn't help that LLMs tend to generate a lot of unnecessary Lean code to prove even the simplest statements.
cobychapple
https://xkcd.com/3201/ "Proof Without Content"
wodenokoto
Isn’t “proof is checked in Lean” kinda similar to assuming your code works just because it compiles. Sure, the code works, but does it work at doing what you want? Sure, the proof is valid, but does it prove what you set out to prove?
red_trumpet
> Put another way — given a Challenge.lean file with only trusted code imported and the statement of a theorem, and a Solution.lean file with millions of lines of untrusted code imported and the proof of a theorem which looks identical, how do we know for sure that somewhere in the millions of lines of code there is no hack which changes the meaning of the statement, changes the rules from just the axioms of mathematics. As someone with a PhD in mathematics, but no experience with Lean, I found this pretty surprising. Shouldn't there be some kind of encapsulation, which insulates the statement from the proof?
philipwhiuk
Thanks, this is really interesting and helpful context to us non-mathematicians. > It is probably worth stressing again: do not run random Lean code on your local machine unless you sandbox it first. Lean’s mathematics library is safe to run and build upon because this is human-curated and checked by human experts. I was surprised by this - does Lean need the ability to run arbitrary code? It feels like limiting Lean to not being Turing complete would be an advantage.
DoctorOetker
I have a concise proof of FLT. 96 cores and 500 GB RAM to ... verify FLT? The huge size of the proof is also remarkable, since brute forcing a long sequence of steps is much harder than brute forcing a shorter sequence of steps. I thought the whole "tactics" approach in Lean was supposed to permit shorter proofs? to skip the low level stuff? If I formalize my short proof of FLT in MetaMath , it would just be a small file and any computer would be able to verify it. This reflects so poorly on both OAI as well as the Lean project.
barrenko
..."left as an exercise to the reader".
Oarch
He doesn't tell it to make no mistakes. How can I trust this article!
moi2388
“Beware of bugs in the above code; I have only proved it correct, not tried it." - Donald Knuth
129298467
Both the Lean kernel and the so called independent Con Leche kernel have massive Claude contributions. Asking the same entity to write the proof checkers as well as the proofs is not good practice. I'm very curious why Buzzard omits this fundamental fact. This is just like an auditing company also writing the original financial statements.
mihaic
At this point I've seen so many Lean articles that I have to ask: who check that Lean is actually correct itself?
Legend2440
Worth pointing out that this article is by Kevin Buzzard, one of the biggest advocates for Lean and automated theorem proving. It's refreshing to see intellectual honesty about a tool's limitations, from someone still advocating for its strengths.
tomtomtom777
The sizes of these proofs are mind boggling. This raises the question, is there any value in a proof so complicated that no human could ever understand it? Is there any purpose to mathematical proofs other than to increase our understanding?
seanwilson
> def FermatsLastTheorem : Prop := ∀ a b c n : ℕ, n ≥ 3 → a^n + b^n ≠ c^n > This code imports Lean’s mathematics library Mathlib and then defines a mathematical statement which looks at first glance like it might be Fermat’s Last Theorem, but which actually is a trivially false statement because in Lean ℕ contains 0, so a = b = c = 0 and n = 3 gives a counterexample. ... > The first question which one has to ask when judging a pdf which comes with some Lean code is: “what is the statement of the theorem in the Lean code, and does this correspond to the actual theorem statement in the pdf?” For a human Lean expert, this is typically (but not always) an easy question to answer. For example any Lean-competent human mathematician would be able to read the two lines of code above and observe that this was a mis-statement of Fermat’s Last Theorem. To add to this, if the statement is wrong, the proof steps and other theorem statements that appear in the full proof are going to follow a path that goes with the wrong statement so there's further opportunities to see there's a mistake. Often problems with the statement make it suspiciously easy to prove, the proof takes a path that doesn't make sense with the correct statement in mind, or it makes it impossible to complete the proof. In the above example, you would see from the easy counterexample found in the proof that the statement is wrong. The proofs aren't a black box. And if the proof is taking advantage of a bug in Lean somewhere to prove some faulty intermediate theorem, you can still scrutinise the path that takes the proof, the same as you would to find a problem in a flawed hand-written proof. The flaw would ripple through the rest of the proof. It's like if your high-level requirements for a computer program (the theorem statement) had a mistake and someone implemented it (the proof). The implementation is going to follow a path that implements that mistake. So by looking at individual function definitions that were implemented and what the code is doing, there's opportunities to spot mistakes in the requirements like missing assumptions or parts that don't make sense. This often happens when you're trying to code something based on flawed requirements, where the problem becomes more obvious as you get into the details of the code. It's the same with proofs.
fooker
I am not looking forward to bugs in code becoming bugs in specifications instead. It is far more pleasant to deal with bugs in code. For complex things like compilers, we like to deliberately leave some parts of the spec weak to make the code pragmatic. Welp.
hingler36
> OpenAI never claimed that it did! They just said “here is some Lean code which goes with this paper”. Maybe I'm misunderstanding this, but it feels like TFA is giving OpenAI entirely too much credibility here. If I told you "My grandma makes great chicken enchiladas" and put a plate in front of you containing an enchilada filled with dog crap, you'd be rightfully confused and upset when you bit into it. Sure, I never specified what the enchilada in front of you was filled with, but come on!
xg15
I remember some frustrating math courses back when I was studying CS. The experience was somewhat like this: Imagine you know nothing about vi except that it's a famous command line utility for linux. One day, your supervisor is tasked to give you an introduction to it. However, he doesn't tell you what vi is for or why it exists or how you use it - instead, he just sends you a tarball with the entire source code of it. Then he spends an hour with you going through the main function line by line, stopping whenever he finds a construct particularly clever or elegant. At the end, he runs "make" once to demonstrate that everything compiles. He asks if you have any questions. You have none - you're still far away from being able to formulate meaningful questions. He is satisfied, declares you Knowledgeable in Vi and calls it a day. It feels as if seasoned mathematicians now have a similar experience with AI generated proofs like the one students had in introductory math lectures like this one. I'm hoping a bit that this could motivate people to develop better didactics for math.
adleyjulian
> Question 4: does the code exploit a bug in Lean’s official kernel? My understanding is that this has generally been a non issue as one does not exploit a bug unintentionally (at least it hasn't happened yet), but the Huggingface hack shows agents are willing to go through great lengths to cheat to pass evals. Given an impossible task I could see an agent finding and exploiting a Lean kernel bug and then obfuscating its method. I suspect the easiest solution to this is to have adversarial agents looking for such cheating.
Xcelerate
I'm a little worried that the mountain of disclaimers against Lean proofs is going to slow something many industries desperately need: more formalization. (Buzzard's article is great by the way considering its target audience—my comment is more about the broader tech industry's perception of LLM-generated Lean proofs.) One of the nice things about mathematical theories relevant to the real world (e.g. PA) is that confirming that a proof is correct is a purely mechanical procedure . Now Lean is built on the Calculus of Inductive Constructions (which can indirectly capture PA, but includes a lot more as well), but it's child's play to write a simple PA proof checker. It's probably a few hundred lines of Python, and even for something like a million line proof, confirming or refuting whether a proof is correct will take a few seconds tops (again, pure PA here, not Lean). The caveats in the article are indeed important (e.g., "Did your formal sentence in the language of first-order arithmetic actually capture what you intended ?", "Is there a bug in your proof checker?"), but I'd label these more as human factors than math factors. I'm afraid the general public is starting to get the impression that "Lean-checked" is just another quality improvement, like reviewing your code carefully or adding some unit tests. It's not—it's totally different , and I don't think we should make too many scary disclaimers as to dissuade further progress with formalization.
trehans
One thing I'm surprised to see little mention of here is that if you want to use Lean proofs for your code and really want good correspondence between what is proved in Lean and what your code actually does, you need a mathematical model of your programming language embedded in Lean and a deterministic parser converting your code itself into Lean. Otherwise, yes, an AI actually has no checks against hallucination and while writing Lean proofs probably helps AI identify its mistakes it really isn't an end-to-end proof of your code's functionality. I personally think the future probably involves a combination of unit tests and formal verification to support our confidence in AI-written software, as well as means to align high-level human intent with the low-level intent of individual code pieces, which as this article mentions is the other big piece that can slip with formal proofs: we might not be proving what we think we're proving. For those interested I've written an educational post about this topic here as well: https://kellerai.io/resources/ai-proved-your-code-correct