paperbot · PL 论文追踪

全部论文 待读 收藏

P2 Intrinsically typed compilation with nameless labels

使用无名标签的内在类型化编译
POPL 5(POPL)2021匹配度 2/10 · 论文属于PL/形式化验证与编译器正确性方向,使用Agda、线性类型和分离逻辑实现按构造类型正确的编译器;但未涉及LLM/Agent、机器学习系统静态分析、浮点程序分析或贝叶斯程序分析,与用户核心研究方向交叉点很少。引用 5 inbox
Arjen Rouvoet, Robbert Krebbers, Eelco Visser
crossref: 2026-09-10

AI 速览

一句话:提出无名共上下文的全局标签表示,借助线性类型在 Agda 中实现按构造类型正确的编译器。

本文研究编译器的类型正确性:用 Agda 将编译器写成内在类型化函数,直接操作良类型源/目标程序,从而按构造保证若源程序良类型则目标代码良类型。难点是字节码标签的全局绑定使类型性成为非组合的全程序性质,单个编译操作难以保持。论文提出无名、共上下文的类型化全局标签表示,借助线性确保标签恰好定义一次,并在 Agda 中基于分离逻辑实现线性依赖类型的浅嵌入语言,以简洁描述内在类型化字节码操作。最终为带结构化控制流的语言实现了内在类型化编译器。

问题
如何验证编译器类型正确,即给定良类型源程序时,编译输出始终良类型;字节码标签的全局绑定使该性质非组合,难以在每个编译操作中保持。
方法
在 Agda 中提出无名、共上下文的类型化全局标签绑定表示,利用线性类型保证标签恰好定义一次,并基于分离逻辑实现线性依赖类型的浅嵌入语言来编写内在类型化字节码操作。
评估
以带结构化控制流的语言为对象,实现完整的内在类型化编译器,展示该表示与嵌入式语言可简洁书写和验证字节码编译操作。
原文摘要(Abstract)

To avoid compilation errors it is desirable to verify that a compiler is type correct —i.e., given well-typed source code, it always outputs well-typed target code. This can be done intrinsically by implementing it as a function in a dependently typed programming language, such as Agda. This function manipulates data types of well-typed source and target programs, and is therefore type correct by construction. A key challenge in implementing an intrinsically typed compiler is the representation of labels in bytecode. Because label names are global, bytecode typing appears to be inherently a non-compositional, whole-program property. The individual operations of the compiler do not preserve this property, which requires the programmer to reason about labels, which spoils the compiler definition with proof terms. In this paper, we address this problem using a new nameless and co-contextual representation of typed global label binding, which is compositional. Our key idea is to use linearity to ensure that all labels are defined exactly once. To write concise compilers that manipulate programs in our representation, we develop a linear, dependently typed, shallowly embedded language in Agda, based on separation logic. We show that this language enables the concise specification and implementation of intrinsically typed operations on bytecode, culminating in an intrinsically typed compiler for a language with structured control-flow.

链接与引用

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

BibTeX
@article{paperbot1196,
  title = {Intrinsically typed compilation with nameless labels},
  author = {Arjen Rouvoet and Robbert Krebbers and Eelco Visser},
  journal = {Proceedings of the ACM on Programming Languages},
  volume = {5},
  number = {POPL},
  year = {2021},
  doi = {10.1145/3434303}
}