paperbot · PL 论文追踪

全部论文 待读 收藏

P2 Contextual Embeddings: Implementing Bound Variables through Instance Resolution

上下文嵌入:通过实例解析实现绑定变量
PLDI 10(PLDI)2026匹配度 1/10 · 论文聚焦嵌入语言中绑定变量的表示与类型安全转换,属于类型系统和编程语言基础技术,未涉及静态分析、LLM/Agent、浮点程序分析或贝叶斯程序分析等研究画像的核心交叉方向。引用 1 inbox
Samantha Frohlich, Jessica Foster, G. A. Kavvos, Meng Wang
crossref: 2026-09-10

AI 速览

一句话:提出上下文嵌入技术,用实例解析在易用高阶接口与一阶表示间建立类型安全的上下文导向同构。

在嵌入式语言中表示绑定变量长期面临表达力与易用性的权衡:一阶的 de Bruijn 索引性质好但难读难写,高阶表示可复用宿主语言绑定器但各有代价。现有最优方案 unembedding 在高阶与一阶表示间来回翻译,然而其类型安全依赖外部元理论论证,限制了潜力。本文提出一种新的嵌入技术,利用实例解析定义从易用高阶接口到一阶表示的上下文导向同构,从而在语言内部获得类型安全。与以往技术不同,该方法还适用于具有模态与子结构(如线性)类型系统的嵌入式语言,使 unembedding 能服务于现代语言。

问题
嵌入式语言中绑定变量的表示难以兼顾表达力与易用性;现有 unembedding 的类型安全依赖外部元理论,且难以覆盖模态与子结构类型系统。
方法
提出上下文嵌入技术,通过宿主语言的实例解析建立高阶接口与一阶表示之间的上下文导向同构,从而在嵌入语言内部实现类型安全的绑定变量表示。
评估
摘要未报告具体实验评估;作者通过论证该技术对模态与子结构(如线性)类型系统的适用性来展示其相对既有方法的优势。
原文摘要(Abstract)

Representing bound variables in embedded languages is a challenging problem, often requiring painful trade-offs between expressivity and usability. On the one hand, first-order representations using de Bruijn indices have many nice properties, but quickly become difficult to read and write. On the other hand, higher-order representations can piggy-back on the host language's binders to offer a more ergonomic interface, at a variety of costs depending on the technique. The current state-of-the-art is unembedding, i.e. a translation from the higher-order representation to the first-order and back again to get the best of both worlds. Unfortunately, the fact that this translation is type-safe relies on external metatheoretic arguments, holding unembedding back from its true potential. We solve this problem with a new embedding technique that uses instance resolution to define a context-directed isomorphism between an ergonomic higher-order interface and a first-order representation. Unlike previous techniques, this also applies to embedded languages with modal and substructural (e.g. linear) type systems, making unembedding relevant for modern languages.

链接与引用

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

BibTeX
@article{FrohlichFKW26,
  title = {Contextual Embeddings: Implementing Bound Variables through Instance Resolution},
  author = {Samantha Frohlich and Jessica Foster and G. A. Kavvos and Meng Wang},
  journal = {Proceedings of the ACM on Programming Languages},
  volume = {10},
  number = {PLDI},
  year = {2026},
  doi = {10.1145/3808269}
}