r/PhilosophyofMath • u/dan-the-raccoon • 2d ago
Why do we keep accepting Lean code as proofs?
Sorry if this is a dumb question but lately huge ai companies been churning out proofs left and right and I couldn’t find an answer to this.
From my understanding even if we assume the lean code is proving what it claims to prove and we assume Lean kernel is bug free (which is already a lot!) I haven’t found any source that proves that Lean representations are sound, so how can we trust them? I fear that even tho a proof compiles and is derivable in Lean that doesn’t mean it is automagically true? Or am I missing something? Would love to hear your opinion if you are or aren’t convinced by a bundle of code some LLM produced
4
u/Normal-Avocado-8349 2d ago
Why would you accept language as proof? Which do you think is more reliable?
8
u/zzmej1987 2d ago
Lean is just a way to write math and logic, that computers understand better. It is similar to functional programming languages like Haskell.
There are two separate concerns here. Correct proof written in Lean is no different from correct proof written in standard mathematical notation. However, checker saying that Lean proof is correct does not grantee, that it actually is. That happened to one proposed proof of Collatz conjecture.
1
u/bigfatfurrytexan 2d ago
I’m not a mathematician and I have nothing to add but that I’ve been wondering the same things. I’m very interested in the subject but don’t work in outside of accounting
1
u/EmuRommel 2d ago
LEAN code might not be definitive proof but it's really strong evidence, proof-pending. It's a bit like getting a physics paper "proving" something with p<0.001. It might be the case something went wrong, but you shouldn't bet on it.
1
u/aardaar 2d ago
Since Lean proves things like the law of excluded middle, I don't accept Lean code as proofs.
2
u/Violet_L0tus 2d ago
You’re right that derivability and truth are different questions. And since you’ve already granted a faithful formalization and a correctly implemented kernel, answering “the kernel checks it” doesn’t address your remaining concern. A program could perfectly implement unsound inference rules.
The missing bridge is a soundness argument: give the formal expressions a mathematical interpretation, then show that the inference rules preserve truth under that interpretation. That argument itself uses mathematical assumptions. It doesn’t establish truth independently of every possible foundation.
There are concrete sources here. Lean’s current documentation on external kernels describes con-leche, a checker with a machine-checked proof that accepted declarations have a set-theoretic model. Its README explains both the model theorem and the consequence that it cannot accept a proof of False. It also states the background set-theoretic assumptions, including a hierarchy of universes. That is a result about this particular checker under specified assumptions, rather than a blanket certification of every Lean implementation.
Proving that result in Lean doesn’t remove the foundational question either. The result is conditional on its assumptions, and confidence in its machine verification still involves confidence in the checking machinery. The value is that the assumptions and argument become explicit and inspectable. Ordinary handwritten mathematics also relies on logical and mathematical commitments; writing the argument in prose doesn’t discharge those.
Separately, “the file compiles” is too weak an acceptance criterion. A development can contain unfinished proofs or added axioms. Lean’s proof-validation guide explains checking dependencies with #print axioms and using external checkers.
So yes, I can be convinced by an LLM-produced proof once the statement, assumptions and proof artifact survive appropriate checking. The author’s identity adds no logical force to the derivation. What earns acceptance is an inspectable argument within foundations we have reason to accept, with the remaining dependencies acknowledged.
2
u/CantBeChangedSo 2d ago edited 2d ago
We don't just accept. We accept compilable Lean code as likely proof of the hypothesis typed into Lean. We scrutinise with our brains whether the formalised hypothesis represents the intended hypothesis in human language
Lots of mathematics cannot be converted into Lean code, since it is just one particular representation of mathematical logic: dependent type theory + countable universe hierarchy. But lots of mathematics fits this too.
Mathematics already has branches that admit proofs that we don't understand, but which are computer generated. i would call this mathematical slop. the proof almost certainly isnt wrong, but we dont learn from it. it is the problem of all LLMs: we dont know why it says what it says.
The bigger problem for me with ai generated proofs is a corollary to this: the engine cannot tell you which source material it used. Every hypothesis whose world satisfies the constraints of Lean is now a candidate for proof from first principles, but LLMs absorb others' work to nudge them in the direction of the answer. This is not the art of mathematics, which is a bunch of people making isolated useful results that are applied to making more isolated useful results in a massive web.
2
u/Elegant-Regret-7393 2d ago
Because it's more reliable than a long paper
1
u/thesnootbooper9000 2d ago
There's a slightly awkward problem here: many of the other theorem proving systems that aren't Lean have a tiny trust base that has been extremely rigourously checked. Lean was designed for verifying computer programs rather than maths, so it puts far less emphasis on tricky questions like "how do I know the compiler is sound and that my hardware does what it says". Due to some annoying and inconvenient coincidences, the mathematics community accidentally committed heavily to Lean rather than one of the more rigorous alternatives.
However, the bright side of this is the Lean is now so popular that sooner or later someone is going to put in the effort to verify the Lean kernel in a better proof checker, so this issue will go away.
1
u/Ancient_Ship_7765 2d ago edited 2d ago
Lean code is not a prof, by definitiopn of proof, yes. A mathematical proof of a statement is an argument that explains why the statement is true. An argument that establishes the truth of a statement is not necessarily a proof. Establishing truth is a necessary condition, but not a sufficient one. For obvious reasons, Lean code explains nothing, so, it's not a proof.
1
u/tango_telephone 2d ago edited 2d ago
The question is kind of like asking, "Why do we keep trusting a hammer to hit nails into boards?"
We designed LEAN specifically for automated theorem proving. The program is based off sound, sophisticated, and very beautiful mathematics that links proof by construction to computer programs. The core underlying mathematical theory that makes everything work is something called dependent type theory.
If you really want to go through the rigor to understand how a system like LEAN can be built and why and when it can be trusted, there is a great book on the theoretical foundations named *Type Theory and Formal Proof* by Rob Nederpelt.
In broad brush strokes though, the foundations of math are rooted in logical reasoning, and the foundations of computing are captured very well in a system known as the lambda calculus. Adding typing to the lambda calculus places limitations on it that make it really good for representing structures in programming languages. Since math is based on logic, we can represent mathematical logic formally. Since dependent type theory is an abstract formal system that captures computing using logic, we can encode mathematical logic into computing using dependent type theory. With all of those correspondences rigorously in place, you can build a cathedral where we can soundly construct mathematical statements that depend on each other.
And as far as it being automatically true, it is not. Only the logical reasoning steps are automatically true. Whether the original problem was properly encoded in the system and whether or not the conclusion maps to the actual problem need to be verified.
1
u/tzaeru 2d ago
If the problem statement is correct in Lean, and there's no surprising bugs in the kernel, then the proof is valid. Lean builds on top of a small set of basic axioms, definitions and computational facts and chains these higher and higher until you arrive to the real proof you wanted to do.
Lean is generally taken to be fairly mature and battle-tested. There have been bugs found now and then, but they've gotten increasingly rare in frequency.
The Riemann hypothesis proof provided was based on the standard axioms and on mathlib's definition of the problem and its dependencies, and these have been looked at by quite a lot of people, and we might assume that they encode the Riemann hypothesis correctly.
1
u/Expert147 2d ago edited 2d ago
I have to trust someone because I don't understand myself. For me, Prof Lean has higher authority than Prof Tao.
1
u/SpiritedRemove 20h ago
What a great question, inquiring into the inner workings of modern mathematics !
And what great insight some commenters have provided as a result !
Thank You! 👏
I am angry at the censoring of this justified curiosity by dubiously motivated downvotes 😡
1
u/lifeistrulyawesome 2d ago
Nobody 100% accepts really long proofs in mathematics whether they are generated by LLMs, computer assisted, or generated by humans.
A famous example is the proof of the classification theorem for finite groups. The entire proof is tens of thousands of pages long and nobody understands the whole thing. But lots of people have been looking for errors or holes and nobody has found one, so mathematicians tend to agree that it is probably correct
Lean can make errors, but is much less likely than a human to make errors. So most mathematicians don’t think that a lean verification is definitive proof. But we agree that it is very likely to be correct
0
u/nextnode 2d ago
If a lean proof passes it is essentially guaranteed to be valid and it is the most reliable means we have. Even more reliable than three reviewers or your own understanding. The things you want to challenge in a lean proof is the formalization of the claim and any added assumptions - that is minimal and syntactic. If you accept them, soundness is established.