每日科技文摘Daily Tech Digest

把「验证过了」拆成证据链Treat “verified” as a Chain of Evidence, Not a Stamp

发布于 2026-11-18Published 2026-11-18

今日深读Today's Deep Read

「Lean 验证过了」到底证明了什么What “it's been checked in Lean” actually proves

上个月 OpenAI 一次性放出 722 篇数学论文,其中大约 45% 附带了 Lean 代码,另有三篇没带代码的论文因为一个符号错误被撤稿。于是出现两种口号式的反应:一种是「有 Lean 代码,那肯定是对的」,另一种是「Lean 自己出过 bug,AI 又会钻空子,所以什么都不能信」。Xena Project 这篇文章的价值在于拒绝这两种口号——它把「Lean 验证过」拆成四个可以逐个回答的问题,每个问题都有自己的工具和答案。Last month OpenAI released 722 mathematics papers at once, roughly 45% of them with Lean code attached; three of the non-Leanified papers have since been retracted over a sign error. Two slogan-shaped reactions followed: “it has Lean code, so it must be right,” and “Lean has had soundness bugs and AIs find loopholes, so none of it means anything.” The value of this Xena Project post is refusing both slogans — it breaks “checked in Lean” into four questions that each have a tool and an answer.

第一问:Lean 里的陈述和论文里的定理是同一句话吗?Lean 严格区分「陈述」和「证明」,而人类习惯把两者都叫定理。作者给了一个漂亮的例子:把费马大定理写成「对所有自然数 a、b、c 和 n(n ≥ 3),a 的 n 次方加 b 的 n 次方 ≠ c 的 n 次方」。这段代码可以编译——因为 Lean 的自然数包含 0,取 a=b=c=0 时两边相等,这是一个能编译通过的假定理。真正拦住它的不是陈述而是证明。可编译,从来不等于陈述正确。更麻烦的是陈述可能依赖上万行代码:Hodge 猜想的 Lean 陈述压在一万多行 Mathlib 之上,某家公司宣称形式化验证了有限单群分类,那个陈述文件引入了 25 万行 AI 生成的依赖,其中约 5600 行是关键定义,而没有人逐行读过它们——我们手上最强的证据居然变成「这段代码证明了它自己依赖的陈述」,一个闭环。Question one: is the Lean statement the same sentence as the theorem in the paper? Lean separates statement from proof; humans call both “the theorem.” The author’s example is lovely: write Fermat's Last Theorem as “for all naturals a, b, c, n with n ≥ 3, a^n + b^n ≠ c^n.” This compiles — Lean's naturals include 0, so a = b = c = 0 makes both sides equal. A compilable false theorem. What stops it is the proof, not the statement; compiling has never meant correct. Worse, statements can rest on tens of thousands of lines: the Lean statement of the Hodge conjecture sits on over 10,000 lines of Mathlib, and a company's claim of verifying the classification of finite simple groups imports 250,000 lines of AI-generated dependencies, ~5,600 of which are load-bearing definitions nobody has read line by line — our strongest evidence becomes “the code proves what it depends on.” A closed loop.

第二问:代码能编译吗?这是纯工程问题。那篇 1300 万行的费马大定理形式化,作者放进沙箱后笔记本几乎立刻内存耗尽,最后靠一台 96 核 500G 内存的机器才跑通。顺带一条安全提醒:不要在自己电脑上直接运行来源不明的 Lean 代码,它会执行任意代码。Question two: does it compile? Pure engineering. The 13-million-line formalisation of Fermat's Last Theorem filled a laptop's memory almost immediately in a sandbox; it finally built on a 96-core, 500 GB machine. A side security note: never run unknown Lean code on your own box — it executes arbitrary code.

第三问最尖锐:那上百万行证明文件里,会不会有人偷偷把 x 的 n 次方重新定义成 37,或者塞进一条「本定理为真」的公理?一行命令的答案叫 lake comparator:它检查受信任文件里的陈述和被证明的陈述是否逐字一致,并确认证明只用了数学的标准公理。Question three is the sharpest: among those millions of proof lines, could someone have quietly redefined x^n as 37, or slipped in an axiom saying the theorem is true? One command answers: lake comparator. It checks that the statement in the trusted file and the statement actually proved are identical, and that the proof uses only the standard axioms of mathematics.

第四问:Lean 内核自己会不会有 bug?出过,发现后四小时就修好了。但作者认为这已不构成实质威胁:现在有若干个独立实现的内核,其中至少一个被形式化验证到汇编级别;加上 --paranoid 参数后,同一份证明必须在多个内核下同时通过。想作弊,就得同时攻破若干互不相关的系统。Question four: could Lean's own kernel be buggy? It has been; the bug was fixed within four hours of discovery. The author argues this no longer matters much: several independent kernel implementations now exist, at least one formally verified down to assembly, and --paranoid requires one proof to pass through several of them at once. Cheating would require breaking several unrelated systems simultaneously.

这套流程真正教给我们的是:形式验证不是一个二元状态,而是一条可以被逐段审计的证据链。它也顺带照出了 AI 生成数学的现状——在 290 篇附带 Lean 代码的论文里,约 38 篇的代码根本没有陈述论文的主定理,而发布方从未声称它陈述了。工具已经就位;缺的是我们读到「有验证代码」这几个字时的那一点克制。What the whole procedure teaches: formal verification is not a binary state but a chain of evidence you can audit link by link. It also holds up a mirror to AI-generated mathematics — of the 290 papers shipped with Lean code, about 38 contain code that does not even state the paper's main theorem, and the publishers never claimed it did. The tools are in place; what's missing is a little restraint when we read “with verification code.”

AI 思考AI Thoughts

数学之美The Beauty of Mathematics

程序员随想Notes for Programmers

哲学与生活Philosophy & Life

工具角Tools Corner