paperbot · PL 论文追踪

全部论文 待读 收藏

P2 Ready, set, verify! applying hs-to-coq to real-world Haskell code (experience report)

预备,开始,验证!将 hs-to-coq 应用于真实 Haskell 代码(经验报告)
ICFP 2(ICFP)2018匹配度 3/10 · 该论文属于程序验证与定理证明工程,将 Haskell 库翻译到 Coq 并验证,与形式化验证方向有间接关联;但未涉及 LLM/Agent、静态分析用于 ML/Agentic 程序、浮点或贝叶斯程序分析,与画像核心交叉点不匹配。引用 23 inbox
Joachim Breitner, Antal Spector-Zabusky, Yao Li, Christine Rizkallah, John Wiegley, Stephanie Weirich
crossref: 2026-09-10

AI 速览

一句话:将 Haskell containers 库翻译到 Coq 并验证,证明可验证成熟、未修改的函数式代码。

本文是一篇经验报告,探讨能否对主流函数式语言编写的成熟代码进行机械验证。作者使用 hs-to-coq 将 Haskell 的 containers 库中相当一部分代码翻译到 Coq,并依据来自类型类定律、库测试套件以及 Coq 标准库接口等多种来源的规约进行验证。结果表明,验证成熟、广泛使用、高度优化且未经修改的 Haskell 代码是可行的。作者还深化了对权重平衡树理论的理解,扩展 hs-to-coq 以处理 partiality,并且由于未发现 bug,侧面印证了经过充分测试的函数式代码具有极高质量。

问题
研究问题是:能否对主流函数式语言中成熟、广泛使用且高度优化的真实代码进行机械验证,以及如何将 Haskell 代码可靠地翻译到交互式证明器中。
方法
使用 hs-to-coq 将 Haskell containers 库的相关部分翻译到 Coq,从类型类定律、测试套件和 Coq 标准库接口提取规约,并在 Coq 中完成验证;同时扩展该工具以支持 partiality。
评估
通过对 containers 库的大规模案例研究进行评估,验证了方法的可行性,未发现 bug,并总结了权重平衡树理论及工具扩展方面的经验。
原文摘要(Abstract)

Good tools can bring mechanical verification to programs written in mainstream functional languages. We use <pre>hs-to-coq</pre> to translate significant portions of Haskell’s <pre>containers</pre> library into Coq, and verify it against specifications that we derive from a variety of sources including type class laws, the library’s test suite, and interfaces from Coq’s standard library. Our work shows that it is feasible to verify mature, widely-used, highly optimized, and unmodified Haskell code. We also learn more about the theory of weight-balanced trees, extend <pre>hs-to-coq</pre> to handle partiality, and – since we found no bugs – attest to the superb quality of well-tested functional code.

链接与引用

DOI 原文 · PDF(开放获取) ·

BibTeX
@article{paperbot294,
  title = {Ready, set, verify! applying hs-to-coq to real-world Haskell code (experience report)},
  author = {Joachim Breitner and Antal Spector-Zabusky and Yao Li and Christine Rizkallah and John Wiegley and Stephanie Weirich},
  journal = {Proceedings of the ACM on Programming Languages},
  volume = {2},
  number = {ICFP},
  year = {2018},
  doi = {10.1145/3236784}
}