arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2403.14064cs.PL
收藏

Lean4Lean:在 Lean 中验证 Lean 的类型检查器

Lean4Lean: Verifying a Typechecker for Lean, in Lean

Mario Carneiro

AI总结:

本文提出了首个用 Lean 自身编写的 Lean 4 外部类型检查器,运行速度慢20%-50%,可验证整个 mathlib 库,并结合形式化验证证明了内核部分正确性,已发现并修复一个健全性漏洞。

摘要:

在本文中,我们提出了一个用 Lean 本身编写的 Lean 定理证明器的新型“外部检查器”。这是除 Lean 自身使用的 C++ 参考实现之外,首个完整的 Lean 4 类型检查器,且我们的新检查器与原版具有竞争力,运行速度慢 20% 到 50%,可用于验证 Lean 的整个 mathlib 库,构成了 Lean 实现完整 elaborator 和编译器自托管目标的额外一步。此外,由于该检查器是用支持形式化验证的语言编写的,因此可以陈述并证明关于内核本身的性质,我们报告了抽象地形式化 Lean 类型理论并证明其相关定理的进展。最后,我们将这些结合起来,获得了内核部分正确性的证明。我们计划利用此项目帮助论证未来对内核和类型理论的任何更改,并确保不健全性不会通过抽象理论或实现漏洞潜入。该验证已见成效,因此项工作已发现并修复了一个健全性漏洞。

英文摘要:

In this paper we present a new "external checker" for the Lean theorem prover, written in Lean itself. This is the first complete typechecker for Lean 4 other than the reference implementation in C++ used by Lean itself, and our new checker is competitive with the original, running between 20% and 50% slower and usable to verify all of Lean's mathlib library, forming an additional step in Lean's aim to self-host the full elaborator and compiler. Moreover, because the checker is written in a language which admits formal verification, it is possible to state and prove properties about the kernel itself, and we report on progress to formalize the Lean type theory abstractly and prove some theorems about it. Finally, we combine these to get a proof of correctness of parts of the kernel. We plan to use this project to help justify any future changes to the kernel and type theory and ensure unsoundness does not sneak in through either the abstract theory or implementation bugs. The verification is already paying off, as one soundness bug has been spotted and fixed as a result of this work.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑