paperbot · PL 论文追踪

全部论文 待读 收藏

P2 Pyrosome: Verified Compilation for Modular Metatheory

Pyrosome:面向模块化元理论的验证编译
OOPSLA 9(OOPSLA2)2025匹配度 3/10 · 论文属于 Coq 中模块化可扩展语义与经验证编译器的形式化验证/PL 基础工作,与用户画像中“AI→PL:利用 LLM/Agent 改进静态分析/形式化验证”的交叉主线没有直接关系,也不涉及浮点、贝叶斯程序分析或 Agentic 程序静态分析;仅在“形式化验证”大类上有边缘关联。引用 0 inbox
Dustin Jamner, Gabriel Kammer, Ritam Nag, Adam Chlipala
crossref: 2026-09-10

AI 速览

一句话:提出 Coq 中可扩展语义与编译的通用框架 Pyrosome,以归纳式等价保持支持语言特性与编译器增量扩展和垂直组合。

现有语义推理技术常与特定语言或编译器结构绑定:上下文等价难以直接使用,逻辑关系和迁移系统方法通常全局固定效应概念;模块化迁移系统适合命令式代码,却不利于函数式代码,限制了语义的扩展与组合。Pyrosome 是 Coq 中面向模块化语言元理论的通用框架,采用可扩展语义与编译,核心是等价保持的归纳式公式,允许向源语言、目标语言和编译器添加新规则;语言被深度嵌入为依赖排序等式理论,因此编译器正确性证明归结为类型检查与等式推理。框架支持特性扩展、任意编译器的垂直组合,并因要求编译器支持开放程序而保证可与适当类型的目标代码链接。作者以 System F 加简单引用、CPS 翻译和闭包转换构建多遍编译器,并展示线性 CPS 与小型命令式语言编译。

问题
现有语义推理与编译器验证技术常与具体语言和编译器结构绑定,模块化迁移系统对函数式代码不理想,导致语义难以扩展与组合。
方法
在 Coq 中提出 Pyrosome,将语言深度嵌入为依赖排序等式理论,并用归纳式等价保持公式支持源语言、目标语言和编译器的可扩展性、垂直组合与开放程序链接。
评估
通过 System F 加简单引用的多遍编译器(含 CPS 翻译与闭包转换)展示增量扩展与定理复用,并以线性 CPS 和小型命令式语言编译验证子结构类型与命令式特性的处理。
原文摘要(Abstract)

We present Pyrosome, a generic framework for modular language metatheory that embodies a novel approach to extensible semantics and compilation, implemented in Coq. Common techniques for semantic reasoning are often tied to the specific structures of the languages and compilers that they support. Contextual equivalence is difficult to work with directly, and both logical relations and transition system-based approaches typically fix a specific notion of effect globally. While modular transition systems have been effective in imperative settings, they are suboptimal for functional code. These limitations restrict the extension and composition of semantics in these systems. In Pyrosome, verified compilers are fully extensible, meaning that to extend a language simply requires defining and verifying the compilation of the new feature, reusing the old correctness theorem for all other cases. The novel enabling idea is an inductive formulation of equivalence preservation that supports the addition of new rules to the source language, target language, and compiler. Pyrosome defines a formal, deeply embedded notion of programming languages with semantics given by dependently sorted equational theories, so all compiler-correctness proofs boil down to type-checking and equational reasoning. We support vertical composition of any compilers expressed in our framework in addition to feature extension. Since our design requires compilers to support open programs, our correctness guarantees support linking with any target code of the appropriate type. As a case study, we present a multipass compiler from System F with simple references, through CPS translation and closure conversion. Specifically, we demonstrate how we can build such a compiler incrementally by starting with a compiler for simply typed lambda-calculus and adding natural numbers, the unit type, recursive functions, and a global heap, then extending judgments with a type environment and adding type abstraction, all while reusing the original theorems. We also present a linear version of the simply typed CPS pass and compile a small imperative language to the simply typed target to show how Pyrosome handles substructural typing and imperative features.

链接与引用

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

BibTeX
@article{paperbot2937,
  title = {Pyrosome: Verified Compilation for Modular Metatheory},
  author = {Dustin Jamner and Gabriel Kammer and Ritam Nag and Adam Chlipala},
  journal = {Proceedings of the ACM on Programming Languages},
  volume = {9},
  number = {OOPSLA2},
  year = {2025},
  doi = {10.1145/3763052}
}