Interpreting Claims That a Theorem Is Correct Because It Was Checked in Lean
Claims that a theorem is correct because it was checked in Lean require careful interpretation, particularly when the code is AI-generated. While Lean verification offers a rigorous path to correctness, it is not a black-box guarantee; it requires systematic validation of the theorem's statement, the compilation process, and the underlying proof logic.
1. Verify the Formal Statement
The most critical step is ensuring the Lean code actually states the intended theorem. Lean distinguishes between the statement of a theorem and its proof. A piece of code can compile successfully while defining a mathematically trivial or incorrect statement.
For complex theorems, the statement may rely on thousands of lines of custom definitions that are not part of the trusted Mathlib library. Without human review of these definitions, one cannot be certain that the formalization accurately reflects the informal mathematical statement. In many cases, AI-generated repositories may only state and prove intermediate results rather than the headline theorem of the associated paper.
2. Compile the Code
Compilation is a necessary, though not sufficient, condition for a valid proof. For large AI-generated codebases, this can be computationally expensive, requiring significant memory and processing power.
Users should treat AI-generated Lean code with the same caution as any untrusted software. Because Lean is a powerful language, it is recommended to run compilation in a sandboxed environment to prevent potential malicious behavior or resource exhaustion.
3. Validate the Proof Logic
Even if a theorem statement is correct and the code compiles, there is a risk that the proof contains "hacks"—such as redefining terms or adding unauthorized axioms—that lead to a technically valid but logically unsound result.
To mitigate this, tools like lake comparator are essential. These tools verify that the theorem stated in a trusted file matches the one proved via untrusted imports and ensure that the proof relies solely on the standard axioms of mathematics. This process separates the trusted statement from the millions of lines of potentially untrusted proof code.
4. Address Kernel Soundness
While Lean’s official kernel has had past soundness bugs, these are generally discovered and patched quickly. To achieve the highest level of confidence, one can use lake comparator --paranoid, which checks the proof against multiple independent, formally verified kernels. This approach ensures that a proof is not reliant on a single, potentially flawed implementation of the kernel.
Insights on AI and Formalization
Community discussion highlights that while formalization is a vital tool, it is not a substitute for human understanding.
- The Translation Gap: There is a known risk of divergence between the informal proof in a PDF and the formal proof in Lean. Some researchers are now using AI to "informalize" Lean proofs back into English to verify the logic.
- Human Factors: Critics note that if the requirements (the theorem statement) are flawed, the proof will simply implement that flaw. As one commenter noted, "Sure, the proof is valid, but does it prove what you set out to prove?"
- The Role of AI: While frontier models can perform the necessary validation steps, the community emphasizes that "Lean-checked" should not be viewed as a simple quality badge. It is a rigorous, mechanical process that requires verification of the setup, not just the final output.
Sources
Related
- Dispatch
- Project
- Dispatch
- Project
- Project