paperbot · PL 论文追踪

全部论文 待读 收藏

P2 Graduality from embedding-projection pairs

从嵌入-投影对看 Graduality
ICFP 2(ICFP)2018匹配度 1/10 · 该论文属于纯 PL/类型系统形式语义,研究 gradual typing 的语义重构、逻辑关系与嵌入-投影对,与用户关注的 AI/LLM 与程序分析交叉、Agentic 程序静态分析、浮点程序分析或贝叶斯程序分析均无直接关联。引用 30 inbox
Max S. New, Amal Ahmed
crossref: 2026-09-10

AI 速览

一句话:将渐进保证重构为 Graduality,并用嵌入-投影对与逻辑关系证明它,类比参数性。

渐进类型语言允许静态与动态类型代码交互,其核心推理原则是渐进保证:给程序组件更精确的类型只会增加运行时类型检查,不改变其他行为。本文给出该保证的语义重构,称为 Graduality,类比参数性之于多态。作者提出局部到全局、语法到语义的观测近似原则,并开发新的逻辑关系来证明 Graduality。关键观察是,当两个类型中一个“更动态”(更不精确)时,它们之间的 cast 必然构成嵌入-投影对;从 ep-pair 性质可干净证明 cast 的 Graduality 情形。为构造 ep pairs,作者分析类型动态性关系(类型精度/朴素子类型),将其规则解释为 ep pairs 的复合构造,类似子类型的 coercion 解释。该工作为渐进类型提供了统一的语义推理框架。

问题
如何为渐进类型语言的渐进保证提供语义化、可组合的推理原则,以刻画混合类型程序中类型精度变化的行为。
方法
将 gradual guarantee 重构为 Graduality,采用逻辑关系与嵌入-投影对,把类型动态性/精度规则解释为 ep pairs 的构造,并从 ep-pair 性质证明 cast 情形。
评估
论文以理论证明为主,通过逻辑关系与 ep-pair 分析论证该框架能简洁处理 cast 的 graduality,未报告实现或实证评估。
原文摘要(Abstract)

Gradually typed languages allow statically typed and dynamically typed code to interact while maintaining benefits of both styles. The key to reasoning about these mixed programs is Siek-Vitousek-Cimini-Boyland’s (dynamic) gradual guarantee, which says that giving components of a program more precise types only adds runtime type checking, and does not otherwise change behavior. In this paper, we give a semantic reformulation of the gradual guarantee called graduality . We change the name to promote the analogy that graduality is to gradual typing what parametricity is to polymorphism. Each gives a local-to-global, syntactic-to-semantic reasoning principle that is formulated in terms of a kind of observational approximation. Utilizing the analogy, we develop a novel logical relation for proving graduality. We show that embedding-projection pairs (ep pairs) are to graduality what relations are to parametricity. We argue that casts between two types where one is “more dynamic” (less precise) than the other necessarily form an ep pair, and we use this to cleanly prove the graduality cases for casts from the ep-pair property. To construct ep pairs, we give an analysis of the type dynamism relation—also known as type precision or naïve subtyping—that interprets the rules for type dynamism as compositional constructions on ep pairs, analogous to the coercion interpretation of subtyping.

链接与引用

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

BibTeX
@article{paperbot274,
  title = {Graduality from embedding-projection pairs},
  author = {Max S. New and Amal Ahmed},
  journal = {Proceedings of the ACM on Programming Languages},
  volume = {2},
  number = {ICFP},
  year = {2018},
  doi = {10.1145/3236768}
}