Verifying the Scientific Drama of AI Claude and Lean

A small step taken by Lean in solving the challenges of AI for Science.
Machine translated. Refer to the original for accuracy.
Author: Xiaojing, Tencent Technology On November 21, Lean and the Mathlib community issued a joint statement announcing the completion of the verification of a formal proof of the Riemann Hypothesis and expressed full confidence in the correctness of the proof. A day earlier, mathematician Levent Alpöge published the proof completed in collaboration with Claude. This problem, which has puzzled the mathematical community for 167 years, has made a significant breakthrough in a rare manner: a formal proof containing 175,187 Lean modules and approximately 17 million lines of code. Such a massive proof poses challenges to being reviewed line by line by mathematicians. However, computers can verify it. Independent verification records released by MIT mathematician Andrew Sutherland showed that all 175,187 modules compiled successfully, with the exported original proof data reaching 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 results. Following the traditional mathematical research approach, proving a major conjecture usually requires several stages: researchers first publicly present the complete argument, and experts in the relevant fields gradually check definitions, premises, and deductions for possible flaws, and attempt independent verification. Only after academic publication, peer review, and continuous examination can the mathematical community gradually form consensus. For the Riemann Hypothesis, there is a clearer formal recognition procedure. In 2000, the Clay Mathematics Institute listed it as one of the seven Millennium Prize Problems, offering a reward of $1 million. According to the rules revised by the institute in 2018, a solution must be published in a qualifying academic publication, be out for at least two years, and receive widespread recognition from the global mathematical community before the institute considers initiating formal evaluation. So, what did Lean accomplish this time? The most important step was to rigorously check the logic of the entire formal proof and confirm through independent verification that it indeed proves the Riemann Hypothesis. This is equivalent to transforming the derivation process, which traditionally requires mathematicians to invest significant effort in checking, into a verification task that computers can repeat. However, the mathematical ideas behind the proof still need human understanding, academic publication, broader peer discussion, and the formal recognition procedure from the Clay Mathematics Institute. As AI is capable of generating 17 million lines of mathematical proofs, the traditional review method relying on experts reading page by page finds it challenging to keep up with such scale. Why was Lean able to accomplish this work? How reliable is its verification result? These questions also become important insights for understanding how to establish credibility in the future of AI research. Image: The Riemann Hypothesis posits that all non-trivial zeros of the Riemann ζ function lie on the critical line where the real part is 1/2. The image indicates the positions of some known zeros; a finite number of zeros satisfying this condition is insufficient to prove that all zeros do. What enables Lean to verify 17 million lines of proof? Lean is not an intelligent agent and does not possess the autonomous exploration capabilities of Claude. It is an open-source programming language and also a formal proof system. One of its main creators, Leonardo de Moura, has long engaged in automated theorem proving research. Image: A screenshot of the actual code from a public talk by Lean's creator. The left side shows the formal proof, which can be checked by Lean once the proof script is run. Source: de Moura's talk "Lean: How AI and Proof Automation Are Changing Mathematics." The technical foundation of Lean relies on type theory and the Curry–Howard correspondence in computer science, which can be simply understood as: mathematical propositions can be represented as types, and mathematical proofs can be represented as objects belonging to these types. For example, to prove "if A is true, then A is true," in Lean, it can be written as a function: accepting a proof that A is true and returning that proof. Complex mathematical derivations follow similar principles. The proof may involve a large number of definitions, lemmas, and intermediate conclusions, but ultimately must form a proof object that complies with logical rules, which is type-checked by Lean's kernel. This also explains the division of labor between Claude and Lean. Claude can continuously try different proof paths, overturn previous derivations, and reorganize mathematical arguments. Lean will check whether the final submitted proof is valid according to predetermined rules. Finding proofs and checking proofs are two different computational tasks. The former may require a vast search space and complex reasoning capabilities; the latter can typically be accomplished by a relatively streamlined program. Lean utilizes this to allow large proofs to be checked reliably. But there is another question: What exactly did the computer check? On November 12, mathematician Kevin Buzzard from Imperial College London published an article discussing what a research claim of having been 'verified by Lean' actually means. He pointed out that formal proofs must first confirm that the mathematical proposition being proven is consistent with the proposition the researchers originally intended to prove. For example, when formalizing Fermat's Last Theorem in a computer, if the correct constraints on the variable ranges are omitted, it may yield a proposition that is not consistent with the original theorem. Even if a formal proof is subsequently submitted, one cannot claim that the original theorem has been validated based on that. Therefore, the Lean community did not stop at achieving successful code compilation. They first examined the formal definition of the Riemann Hypothesis. This definition comes from Mathlib, an open-source mathematical knowledge library maintained for a long time by mathematicians and developers, and has been reviewed by experts in the relevant fields. Subsequently, the community used independent tools to compare the proposition proved by Alpöge with the original definition in Mathlib one by one to ensure both are consistent. Finally, the proof underwent re-examination by several checkers including the official Lean kernel, con-leche, con-ron, etc., and the axioms on which the proof relied were examined. Nevertheless, despite the rigorous verification steps, Lean itself has previously encountered serious vulnerabilities. On July 25 this year, researcher Ramana Kumar publicly released a so-called “refutation” of the Collatz conjecture completed using AI. This code did not use the 'sorry' placeholder in Lean, which indicates that the proof is incomplete, yet successfully exploited a vulnerability in the kernel when handling nested inductive types. Even more surprisingly, at that time an independently implemented Rust checker, nanoda, also accepted this erroneous proof due to another software flaw. Subsequently, OpenAI researcher Daniel Selsam continued testing Lean with an internal AI model, discovering multiple logical kernel and runtime vulnerabilities between July and August. Some of these vulnerabilities allowed the system to wrongly accept a proof of the logical proposition False. Lean creator de Moura publicly reviewed these issues in August and gradually completed the fixes. This indicates that while the logical rules on which formal verification relies can be very strict, the software executing these rules can still make mistakes. Especially when AI can actively search for vulnerabilities, the reliability of the checker itself is also under test. On October 15, de Moura announced that Lean officially provides a new verification mechanism, including multiple independent checkers, as well as a kernel implementation with formal reliability proofs. Among them, the reliability proof of con-leche is established on set theory models. It can provide stronger guarantees against a class of kernel implementation errors but still relies on the consistency of the corresponding mathematical foundations. The verification of the Riemann Hypothesis in November was completed under this continuously improving mechanism. The Lean community extracted the proof as independent data and used checkers from different implementations for verification, trying to avoid the impact of a single software defect on the final conclusion. For a proof involving AI participation and reaching 17 million lines, this independent checking is particularly important. Lean demonstrates a research verification method that is already operational: the system that generates proofs can be very complex, while the program that checks the proofs can be relatively streamlined and can be independently reviewed by others. After 6.3 million lines of proof, who will check the remaining 27,000 lines? Formal verification is not a new technology. For decades, mathematicians and software engineering researchers have been trying to use rigorous mathematical methods to prove that computer programs meet specific requirements. However, this technology has not been widely applied in the ordinary software industry, with a significant reason being cost. Take the famous seL4 microkernel project as an example, where early formal verification took about 20 person-years. Engineers need to describe program behavior in precise mathematical specifications and write a large number of proofs to ensure the program meets these specifications. For aviation, cryptography, and safety-critical systems, such investments may be worthwhile. However, for most commercial software, assembling a dedicated formal verification team is not realistic. AI is beginning to change the most labor-intensive aspects of this process. On November 10, Google DeepMind announced the AlphaProof Code research, which claims to have used AI agents to formally verify critical security properties of the Signal communication protocol reference implementation libsignal. The research delves directly into the compiled AArch64 machine code, covering the specific versions of cryptographic handshakes and key update processes. The team consisted of five researchers, with the main proof work lasting four weeks. The AI Agent generated about 6.3 million lines of Lean proof code, which was ultimately checked by the Lean kernel. The most noteworthy number in this project may be the additional 27,000 lines of code. Image: The verification process of AlphaProof Code. Researchers and AI collaboratively formulate and review Lean specifications, with the AI proof team responsible for generating proofs, and final verification relies on checks by the Lean kernel and independent checkpoints. The verification results still depend on specifications and trusted execution models approved by humans. According to DeepMind's online technical report, the 6.3 million lines of proof rely on about 19,000 lines of formal definitions that need to be trusted, as well as about 8,000 lines of AArch64 machine code semantics. In addition, the research also relies on cryptographic assumptions, specific execution environment models, the reliability of compiled products, and validation tools themselves. The so-called Trusted Computing Base (TCB) refers to the components and assumptions that must be relied upon for the verification conclusions to hold true. AI can automatically generate millions of lines of proof, but what these proofs can ensure ultimately depends on how humans define the verification goals. The DeepMind research team wrote in their report that as proofs become cheaper, the difficult questions shift to what should actually be proved. Most of their efforts are spent on the design and review of formal specifications. This underlying issue can be explained with a simple example. Suppose a financial institution asks AI to prove that a payment system is secure. If the formal specification only requires that account balances cannot be negative, then even if Lean successfully proves this property, it does not rule out duplicate charges, unauthorized transfers, or user information leaks. DeepMind also disclosed a more extreme example. In a previous multi-agent proof task, one Agent redefined a predicate used in a conjecture premise to False. Other Agents subsequently adopted this modification. According to formal logic, if a premise never holds, then implications derived from that premise may be easily proven. The proofs obtained this way can be formally valid but do not solve the original problem. This phenomenon does not necessarily mean that the AI is intentionally deceiving. As long as AI continues to be under pressure to complete tasks, it may lower the difficulty of proofs by adding constraints, narrowing the applicable scope, or altering definitions. To avoid similar problems affecting the Signal project, DeepMind designed independent verification checkpoints. Proof Agents cannot arbitrarily modify already approved specifications, and changes involving trusted assumptions require review. Final proofs must be re-checked in a new environment and cannot rely on the Agent's self-reporting that the task has been successfully completed. The research team also reintroduced two historically fixed vulnerabilities in Signal into the program to test whether the formal specifications can identify these errors. This is different from ordinary software testing. Testing usually checks whether errors occur under selected inputs. Formal verification, on the other hand, attempts to prove that within clear models and assumptions, all relevant behaviors of the program satisfy specified properties. However, the effectiveness of the latter ultimately depends on whether the specifications are sufficiently complete and whether the model accurately describes the program being examined. The involvement of AI has introduced new economic viability to this technology that was previously very costly. However, DeepMind's research is not yet sufficient to prove that formal verification has achieved universal commercial viability. The workload of four weeks has not fully disclosed the costs of model calls, computing power expenditure, and the costs of prior tool building. Proving specific security attributes does not mean that the entire Signal application is guaranteed to be secure in all environments. At least for now, high-reliability software may be the first area to benefit. As Coding Agent enters enterprises, the deliverables of some key software in the future may evolve from code and testing reports to include code, formal specifications, and independently verifiable correctness proofs. The truly difficult work may increasingly focus on how to accurately describe the requirements that the system should meet. Who verifies the real world after validating mathematical logic? Lean provides a rigorous inspection mechanism for AI-generated mathematical proofs, but the validation issues in scientific research are far more complex than mathematical theorems. Mathematical proofs derive conclusions under clear definitions, axioms, and logical rules. Research in physics, chemistry, biology, and other fields must also verify whether the assumptions in the models align with reality and whether theoretical predictions can be confirmed by experiments and observations. A set of mathematical models may be entirely self-consistent but fail to accurately describe the real world. This issue is especially prevalent in simulating complex systems. On October 31 of this year, the Journal of Artificial Societies and Social Simulation published a study attempting to combine the statistical model checking tool MultiVeStA with the multi-agent simulation platform NetLogo to enhance the rigor of simulation result analysis. NetLogo was created in 1999 and is widely used for simulating interactions among large numbers of individuals, such as population migration, ecosystem evolution, and economic activities. Researchers can set different rules of individual behavior, run the system hundreds or even thousands of times, and observe what changes arise in the population as a result. This paper utilized a model simulating the population changes of ancient Anasazi settlements in the southwestern United States, attempting to replicate the population changes from 800 to 1350 AD. The research team tested 1,600 parameter combinations and compared the simulation results with historical data. Using common methods, one could select the parameter set that fits best with the historical population curve as the final result. However, after utilizing MultiVeStA for statistical checks, the researchers found that under the set testing precision, there were 14 parameter combinations whose fitting performances could not be statistically distinguished. This means that even if the best-performing parameters were found, it cannot be concluded that they are the only credible explanation. Another experiment also illustrated the importance of the number of simulations. Previous research used 15 independent simulations to estimate population changes, but during periods of high fluctuation, the confidence intervals obtained were extremely wide, making it easy for researchers to misjudge the model's consistency with historical data. MultiVeStA automatically adjusts the number of simulations based on statistical accuracy requirements. In certain time periods, it needs to run between 100 to 600 times to obtain a more reliable estimate. These results reveal a common risk in simulation science: if the number of experiments is insufficient and parameter selection lacks a statistical basis, researchers may have an overly high confidence in the interpretability of their models. Image: Increasing the number of simulations changes researchers' judgments about the results. Statistical checks on the NetLogo population model showed that conducting only 15 simulations may not allow accurate judgment of discrepancies between the model and historical data during certain periods. MultiVeStA narrows the uncertainty of estimates by adaptively increasing the number of simulations. Lean can rigorously check the logical deductions of formal propositions. NetLogo provides a simulation environment for complex systems, and MultiVeStA can assist researchers in more reliably analyzing simulation outputs under specified statistical conditions. Different aspects of scientific research require different validation methods. For mathematical propositions, researchers can use tools like Lean to check proofs. For software systems, one can verify whether programs meet explicit functional and security specifications. For stochastic simulations, considerations need to include parameter uncertainty, the number of experiments, and statistical errors. For natural science hypotheses, ultimately, real experiments and observations are required to judge whether the theory aligns with reality. These methods can establish varying degrees of reliable basis, but they cannot completely replace each other. This is also a real problem faced by AI for Science. AI has already been able to participate in mathematical proofs, scientific model construction, research hypothesis generation, and experimental design. However, the increasing number of results generated by AI does not mean that each result can be directly verified by formal checkers like mathematical theorems. Some results can be confirmed through strict logical deduction, some require large-scale numerical experiments, and some must be subjected to expensive real-world experiments for validation. Therefore, the future of AI research not only needs stronger models but also requires validation tools that can match different research tasks, as well as traceable definitions, data, code, proofs, and experimental records. Lean has demonstrated an important possibility: as the cost of AI-generated proofs decreases, formal verification work that previously relied heavily on expert labor can be partially automated. However, it also exposes another problem: if AI can generate tens of millions of lines of mathematical proofs in a short time, how much effort do mathematicians need to invest in understanding the ideas behind these proofs? When AI further participates in research in biology, materials, and physics, how many experiments and how much data are needed to determine whether a discovery has true scientific value? How can silicon-based intelligence and carbon-based intelligence properly cooperate to unlock a new frontier of scientific discovery? This is not only a technical issue but also a philosophical proposition.






Details compiled from public sources. Always do your own research.
