HomeArticle

Verifying AI: The "Grand Scientific Research Drama" Between Claude and Lean

36氪的朋友们2026-11-23 10:55
Lean can only take a small step towards solving the challenges of AI for Science.

On November 21, the Lean and Mathlib communities released a joint statement, announcing the completion of the formal proof verification of the Riemann Hypothesis and expressing full confidence in the correctness of the proof.

A day earlier, mathematician Levent Alpöge published a proof completed in collaboration with Claude. This 167-year-old unsolved puzzle in the mathematics community has achieved a major breakthrough in a rare form: a formal proof containing 1,751,875 Lean modules with approximately 17 million lines of code.

Such a huge proof is too large for mathematicians to review line by line manually. But computers can handle the checking work.

Independent verification records published by MIT mathematician Andrew Sutherland show that all 175,187 modules were compiled successfully, and the exported raw proof data reached 61.6GB. Among them, an independent checker named nanoda ran on 80 threads for 27 minutes and 42 seconds and accepted the complete proof. Other independent checkers also obtained the same result.

In the traditional way of mathematical research, the proof of a major conjecture usually goes through several stages: First, the researcher publishes the complete argument, and experts in relevant fields gradually check the definitions, premises and derivations, look for possible loopholes, and attempt independent re-verification. After academic publication, peer review and continuous testing, the mathematics community will gradually reach a consensus.

For the Riemann Hypothesis, there is a more explicit formal recognition procedure.

In 2000, the Clay Mathematics Institute listed it as one of the seven Millennium Prize Problems, with a $1 million reward. According to the rules revised by the institute in 2018, a solution must be published in a qualified academic publication, and at least two years must pass after publication to gain widespread recognition from the global mathematics community before the institute will consider launching a formal assessment.

So what did Lean achieve this time?

The most critical step is to conduct strict logical checks on the entire formal proof, and confirm through independent verification that what it proves is indeed the Riemann Hypothesis.

This is equivalent to converting the derivation process that traditionally requires a lot of effort from mathematicians to check into a verification task that can be executed repeatedly by computers. But the mathematical ideas behind the proof still need to be understood by humans, followed by academic publication, broader peer discussion, and the formal recognition procedure of the Clay Mathematics Institute.

When AI can generate 17 million lines of mathematical proofs, the traditional review method that relies on experts to read page by page can hardly keep up with such a scale.

Why was Lean able to complete this work? How reliable are its verification results? These questions have also become an important entry point for understanding how to build credibility for the future of AI scientific research.

Figure: The Riemann Hypothesis states that all non-trivial zeros of the Riemann zeta function lie on the critical line where the real part is 1/2. The figure marks the positions of some known zeros. The fact that a finite number of zeros satisfy this rule is not sufficient to prove that all zeros satisfy it.

Why is Lean capable of verifying 17 million lines of proof?

Lean is not an intelligent agent, nor does it have the autonomous exploration capability like Claude.

It is an open-source programming language and also a formal proof system. One of its main creators, Leonardo de Moura, has long been engaged in automated theorem proving research.

Figure: Screenshot of real code from a public speech by Lean's creator. The left side shows the formal proof, which can be checked by Lean after the proof script runs. Source: de Moura's speech Lean: How AI and Proof Automation Are Changing Mathematics.

The technical foundation of Lean is dependent type theory and the Curry–Howard correspondence in computer science, which can be simply understood as: mathematical propositions can be represented as a type, and mathematical proofs can be represented as objects belonging to this type.

For example, to prove "if A holds, then A holds", in Lean, it can be written as a function: it accepts a proof that A holds, and then returns this proof.

Complex mathematical derivations follow similar principles.

The proof may involve a large number of definitions, lemmas and intermediate conclusions, but it must eventually form a proof object that conforms to the rules of logic, which is checked by Lean's kernel for type correctness.

This also explains the division of labor between Claude and Lean.

Claude can continuously try different proof paths, overthrow previous derivations, and reorganize mathematical arguments. Lean will check whether the final submitted proof is valid according to pre-determined rules.

Finding a proof and checking a proof are two different computational tasks. The former may require a huge search space and complex reasoning capabilities; the latter can usually be completed by a relatively streamlined program.

Lean leverages this feature to enable repeatable checking of huge proofs.

But there is still a question here: what exactly did the computer check?

On November 12, mathematician Kevin Buzzard from Imperial College London published a special article discussing what it means for a study to claim that it has been "Lean-verified".

He pointed out that after a formal proof passes the check, the first step is to confirm that the proven mathematical proposition is consistent with the proposition that the researcher originally intended to prove.

For example, when formalizing Fermat's Last Theorem in a computer, if the correct constraints on the value range of variables are omitted, a proposition that is inconsistent with the original theorem may be obtained. Even if a formal proof is submitted subsequently, it cannot be claimed that the original theorem has been verified.

Therefore, the Lean community did not stop at the level of successful code compilation this time.

They first checked the formal definition of the Riemann Hypothesis. This definition comes from Mathlib, an open-source mathematical knowledge base maintained by mathematicians and developers for a long time, which has been reviewed by experts in relevant fields.

Subsequently, the community used independent tools to compare the proposition actually proved by Alpöge with the original definition in Mathlib one by one, confirming that the two are consistent.

Finally, the proof object was rechecked by multiple checkers including Lean's official kernel, con-leche, and con-ron, while the axioms that the proof depends on were also reviewed.

However, even with such strict verification steps, Lean itself has had serious vulnerabilities before.

On July 25 this year, researcher Ramana Kumar publicly released a so-called "disproof" of the Collatz conjecture completed with the help of AI. This code did not use the "sorry" placeholder in Lean that indicates the proof is not completed, but successfully exploited a vulnerability in the kernel's handling of nested inductive types.

Even more surprisingly, nanoda, an independently implemented Rust checker at that time, also accepted this wrong proof due to another software defect.

Subsequently, OpenAI researcher Daniel Selsam used an internal AI model to continue testing Lean, and discovered multiple logical kernel and runtime vulnerabilities between July and August. Some of these vulnerabilities could allow the system to incorrectly accept proofs of the logical proposition False. Lean's creator de Moura publicly reviewed these issues in August and completed fixes one after another.

This shows that the logical rules relied on by formal verification can be very strict, but the software that executes these rules can still make mistakes. Especially when AI can actively look for vulnerabilities, the reliability of the checkers themselves is also facing tests.

On October 15, de Moura announced that Lean officially provides a new verification mechanism, including multiple independent checkers and a kernel implementation with a formal proof of reliability.

Among them, the reliability argument of con-leche is built on the set theory model. It can provide stronger guarantees for a class of kernel implementation errors, but it still depends on the consistency of the corresponding mathematical foundation.

The November verification of the Riemann Hypothesis was completed under this continuously improving mechanism. The Lean community exported the proof as independent data, and then used checkers with different implementations for re-verification, trying to avoid the impact of a single software defect on the final conclusion as much as possible.

For a proof completed with AI participation and reaching a scale of 17 million lines, this independent check is particularly important.

Lean demonstrates a practically operable scientific research verification method: the system that generates proofs can be very complex, but the program that checks proofs can be relatively streamlined, and can be independently re-verified by others.

After 6.3 million lines of proof, who will check the remaining 27,000 lines?

Formal verification is not a new technology. Over the past decades, mathematicians and software engineering researchers have been trying to use strict mathematical methods to prove that computer programs meet specific requirements.

But this technology has never been widely applied in the ordinary software industry, and one important reason is the high cost.

Taking the famous seL4 microkernel project as an example, the early formal verification investment was about 20 person-years. Engineers need to describe the program behavior as precise mathematical specifications, and then write a large number of proofs to ensure that the program meets these specifications.

For aviation, cryptography and safety-critical systems, such investment may be worthwhile. But for most commercial software, it is not realistic to set up a dedicated formal verification team.

AI is starting to change the most labor-intensive part of this process. On November 10, Google DeepMind announced the AlphaProof Code research, announcing that it used AI agents to formally verify the key security properties of libsignal, the reference implementation of the Signal communication protocol.

The research directly delves into the compiled AArch64 machine code, covering the encryption handshake and key update process of a specific version.

The team consisted of five researchers, and the main proof work lasted for four weeks. The AI Agent generated approximately 6.3 million lines of Lean proof code, which was finally checked by the Lean kernel.

The most noteworthy number in this project may be the other 27,000 lines of code.

Figure: The verification process of AlphaProof Code. Researchers and AI jointly formulate and review Lean specifications, the AI proof team is responsible for generating proofs, and the final check is performed by the Lean kernel and independent checkpoints. The verification results still depend on human-approved specifications and a trusted execution model.

According to DeepMind's online technical report, the 6.3 million lines of proof rely on approximately 19,000 lines of trusted formal definitions and approximately 8,000 lines of AArch64 machine code semantics.

In addition, the research also relies on cryptographic assumptions, a specific execution environment model, and the reliability of the compilation products and verification tools themselves. The so-called Trusted Computing Base (TCB) refers exactly to those components and assumptions that must be relied on for the verification conclusion to hold.

AI can automatically generate millions of lines of proofs, but what exactly these proofs can guarantee still depends on how humans define the verification goals.

The DeepMind research team wrote in the report that when proof becomes cheap, the difficult problem shifts to what exactly should be proved.

Most of their energy was spent on the design and review of formal specifications.

The problem behind this can be explained with a simple example. Suppose a financial institution asks AI to prove that the payment system is secure.

If the formal specification only requires that the account balance cannot be negative, then even if Lean successfully proves this property, it cannot rule out duplicate deductions, unauthorized transfers or user information leaks.

DeepMind also disclosed a more extreme example. In a previous multi-agent proof task, one Agent redefined the predicate used in the premise of a certain conjecture as False. Other Agents then followed this modification.

According to formal logic, if the premise is never true, the implication proposition starting from this premise can be proved very easily.

The proof obtained in this way can be formally valid, but it does not solve the original problem.

This phenomenon does not necessarily mean that AI is deliberately deceiving. As long as AI is continuously under pressure to complete tasks, it may reduce the difficulty of proof by adding restrictive conditions, narrowing the scope of application, or changing definitions.

To avoid similar problems affecting the Signal project, DeepMind designed independent verification checkpoints.

Proof Agents cannot arbitrarily modify approved specifications, and modifications involving trusted assumptions require review. The final proof must be rechecked in a new environment, and cannot rely on the Agent's own report that the task has been successfully completed.

The research team also reintroduced two historically fixed Signal vulnerabilities into the program to test whether the formal specifications can identify these errors.

This is different from ordinary software testing. Testing usually checks whether the program has errors under selected inputs. Formal verification attempts to prove that within a clear model and assumptions, all relevant behaviors of the program meet the specified properties.

But the effectiveness of the latter ultimately depends on whether the specifications are sufficiently complete and whether the model accurately describes the program being checked.

The participation of AI has brought new economic viability to this technology, which used to be extremely costly.

However, DeepMind's research is not sufficient to prove that formal verification already has universal commercial feasibility. The four-week workload did not fully disclose the cost of model calls, computing power expenses and previous tool construction. Proving specific security properties does not mean that the entire Signal application is guaranteed to be secure in all environments.

At least for now, high-reliability software is likely to be the first field to benefit.

As Coding Agents enter enterprises, future deliverables of some key software may expand from code and test reports to code, formal specifications, and correctness proofs that can be checked independently.

The really difficult work may increasingly focus on how to accurately describe the requirements that the system should meet.

Mathematical logic is verified, but who will verify the real world?

Lean provides a strict checking mechanism for AI-generated mathematical proofs, but the verification problem of scientific research is far more complex than mathematical theorems.

Mathematical proofs derive conclusions under clear definitions, axioms and logical rules. Research in physics, chemistry, biology and other disciplines must also verify whether the assumptions in the model are consistent with reality, and whether theoretical predictions can be confirmed by experiments and observations.

A set of mathematical models may be completely self-consistent, but cannot accurately describe the real world. Complex system simulations are particularly prone to this problem.

On October 31 this year, Journal of Artificial Societies and Social Simulation published a study that attempted to combine the statistical model checking tool MultiVeStA with the multi-agent simulation platform NetLogo to improve the rigor of simulation result analysis.

NetLogo was born in 19