Can Open-Weight LLMs Produce Kernel-Verified Coq Proofs? A Pilot Study
开权重 LLM 单次写 Coq 证明,内核只通过 3.5%:如果你准备把 LLM 生成的 Coq 证明接进工程流程,先看内核是否接受,而不是看文本像不像证明。这个试点把六个开权重模型放到 CoqStoq 的 100 条真实项目定理上,每定理只试一次,由 Coq 内核在原始项目环境中逐步判定;600 次尝试只有 21 次通过,总成功率 3.5%。
过去缺少系统证据说明通用开权重 LLM 能否在真实 Coq 项目定理上产出内核接受的证明,所以该试点用六个模型各做一次单次尝试,并把 Coq 内核设为唯一判定。结果是 600 次尝试 21 次通过,成功率 3.5%;成功只落在短或中等参考证明长度上,长参考证明定理零通过。
在真实 Coq 项目定理上,当前开权重 LLM 单次尝试的内核验证成功率只有 3.5%(600 次中 21 次);通过集中在短或中等参考证明长度,判定依据是 Coq 内核在原始项目环境中逐步接受。
1. 旧误区:把文本相似或读起来合理当成证明正确;无内核验证时,无效语法、假策略、假引理、错假设、漏步骤、库版本差异都看不见。 2. 方法与受控检查:CoqStoq 100 条真实项目定理;六模型每定理一次、温度 0;原始项目环境中由 Coq 内核逐步判定,并对照标准 Coq 策略基线。 3. 结果与动作:600 次通过 21 次,成功率 3.5%,覆盖 15 个定理;只做短中证明的有限辅助,别把短证明成功率外推到长证明。
评测规模为六模型 × 100 定理 = 600 次尝试。成功标准不是生成文本相似,而是 Coq 内核在原始项目环境中接受。分项结果:Gemma 4 为 12/100,Llama 3.3 为 8/100,DeepSeek Coder V2 Lite 为 1/100,Qwen 3.5、Mistral Small 3.1、GPT-OSS 为 0/100。21 次成功覆盖 15 个不同定理,其中 11 个未被标准策略基线解决。按参考证明长度分层看,短、中有成功,长为零成功;该分层是探索性分析,未建立因果。资源只统计三个有成功模型:每次验证 741–36,193 token,14.9–178.0 秒,0.0167–0.2000 GPU 小时;零成功模型未计算。模型间差异未做统计显著性检验,因此不形成普适排名。
- 它要解决什么
- 通用开权重 LLM 能否在真实 Coq 项目定理上生成被内核接受的形式证明?单次尝试下,成功率、能覆盖的定理,以及 token、时间和 GPU 消耗各是多少?
- 研究路径
- 每个 LLM 在温度 0 下只根据定理陈述生成一次证明文本。随后系统把该文本放回定理原来的 Coq 项目环境运行;Coq 内核基于归纳构造演算逐步检查每个策略变换是否合法,任何一步违反规则就拒绝整个证明。只有全部步骤都被内核接受,才记为成功;输出 token、挂钟秒数和 GPU 小时同步记录。
- 这对工程意味着什么
- 第一步动作:把评测脚本改成只在原始 Coq 项目环境中以内核逐步接受计通过,并同步记录 token、秒数和 GPU 小时。要避开的捷径:不要用文本流畅度、相似度或短证明成功率,去推断长参考证明定理也能过;本数据中长证明是零通过。
- 证据定位
- Gemma 4 通过 12/100,Llama 3.3 通过 8/100,DeepSeek Coder V2 Lite 通过 1/100,其余三个模型为 0/100。合计 600 次尝试通过 21 次,即 3.5%;这 21 次覆盖 15 个不同定理,其中 11 个标准 Coq 策略基线未解。所有成功定理的参考证明都是短或中等长度;长参考证明定理没有任何模型通过。(筛选维度:形式化验证、可复核评测)
- 适用边界
- 每条定理只试一次且温度为 0,不能代表多次采样或迭代修订场景。样本只有 100 条定理,模型间差异没有统计显著性检验。参考证明长度与成功率的关系是探索性分析,未建立因果。六个模型也不覆盖全部开权重模型。
方法与英文摘要
评测取 CoqStoq 中 100 条来自真实 Coq 项目的定理。模型为 Gemma 4、Llama 3.3、DeepSeek Coder V2 Lite、Qwen 3.5、Mistral Small 3.1、GPT-OSS。每个模型对每条定理只生成一次,温度设为 0。生成文本回到该定理原始 Coq 项目环境中,由内核逐步检查;任一步失败,整个证明拒绝。对照是标准 Coq 策略自动化;同时记录输出 token 数、挂钟时间和 GPU 小时。
Large language models (LLMs) can generate text that resembles a mathematical proof, but resemblance does not establish correctness. A formal proof checker verifies whether each proof step follows established logical rules. Coq bases its rules on the Calculus of Inductive Constructions, a logical framework that defines which proof steps the system may accept. This pilot study evaluated six open-weight LLMs on the same 100 theorems from CoqStoq, a benchmark derived from real Coq projects. Each LLM received one attempt per theorem with the temperature set to 0, and Coq checked every proposed proof in the theorem's original project environment. We counted a proof as successful only if the Coq kernel accepted it. Gemma 4 verified 12 of 100 theorems, Llama 3.3 verified 8, and DeepSeek Coder V2 Lite verified 1. Qwen 3.5, Mistral Small 3.1, and GPT-OSS verified none. The 21 successful model-theorem results covered 15 distinct theorems, 11 of which were not solved by a baseline of standard Coq tactics. All verified theorems had short or medium human-written reference proofs; no model verified a theorem with a long reference proof. Because the proof-length analysis was exploratory, this pattern does not establish that proof length caused the difference. For the three models with at least one success, the total generation cost per verified proof ranged from 741 to 36,193 output tokens, 14.9 to 178.0 seconds, and 0.0167 to 0.2000 aggregate GPU hours. We could not calculate these ratios for models with no verified proofs. Across 600 attempts, the models produced 21 kernel-verified proofs, giving an overall success rate of 3.5%. The study reports descriptive differences among the models but does not statistically test whether one model outperforms another. Therefore, the results do not establish a universal ranking of the six models.