paperbot · PL 论文追踪

全部论文 待读 收藏

P2 A Verified Foreign Function Interface between Coq and C

Coq 与 C 之间经过验证的外部函数接口
POPL 9(POPL)2025匹配度 2/10 · 该论文属于 Coq/C 互操作的形式化验证与证明工程,虽与“形式化验证”有领域重叠,但完全未涉及 LLM/Agent、静态分析、浮点程序分析或贝叶斯程序分析等用户核心方向,因此与当前研究画像关系较弱。引用 8 inbox
Joomy Korkut, Kathrin Stark, Andrew W. Appel
crossref: 2026-09-10

AI 速览

一句话:提出 VeriFFI,在 Coq 与 C 之间建立可验证的 FFI,保证组合程序的类型安全与正确性。

在 Coq 中可以编写依赖类型函数程序并证明其正确性,在 C 中可以编写底层程序并用 C 验证工具证明其正确性;问题是如何将两者组合并交互证明。本文提出 VeriFFI,一个经过验证的外部函数接口:它把 Coq 的函数类型、构造子类型以及函数模型翻译为 VST 函数规约;若用户能在 VST 中证明 C 函数满足这些规约,则 C 函数的行为符合用户指定的函数模型,即使其实现可能完全不同。这样,调用 C 代码的 Coq 函数证明便可依赖该行为。实现该翻译的关键是一种新颖的 Coq 依赖类型混合深/浅描述。VeriFFI 保证组合程序类型安全与正确性。

问题
如何将部分用 Coq、部分用 C 编写的程序组合起来,并使两边各自的正确性证明互操作,从而保证组合程序的类型安全与正确性。
方法
VeriFFI 将 Coq 函数类型、构造子类型和函数模型翻译为 VST 函数规约;用户在 VST 中证明 C 函数满足规约后,Coq 调用方可依赖 C 函数符合给定函数模型。关键技术是 Coq 依赖类型的混合深/浅描述。
评估
论文演示了如何编写并接口 Coq 与 C 程序及其证明;评估以 VST 中 C 函数是否满足由 Coq 模型翻译出的规约为准,并据此保证组合程序正确。
原文摘要(Abstract)

One can write dependently typed functional programs in Coq, and prove them correct in Coq; one can write low-level programs in C, and prove them correct with a C verification tool. We demonstrate how to write programs partly in Coq and partly in C, and interface the proofs together. The Verified Foreign Function Interface (VeriFFI) guarantees type safety and correctness of the combined program. It works by translating Coq function types (and constructor types) along with Coq functional models into VST function-specifications; if the user can prove in VST that the C functions satisfy those specs, then the C functions behave according to the user-specified functional models (even though the C implementation might be very different) and the proofs of Coq functions that call the C code can rely on that behavior. To achieve this translation, we employ a novel, hybrid deep/shallow description of Coq dependent types.

链接与引用

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

BibTeX
@article{KorkutSA25,
  title = {A Verified Foreign Function Interface between Coq and C},
  author = {Joomy Korkut and Kathrin Stark and Andrew W. Appel},
  journal = {Proceedings of the ACM on Programming Languages},
  volume = {9},
  number = {POPL},
  year = {2025},
  doi = {10.1145/3704860}
}