paperbot · PL 论文追踪

全部论文 待读 收藏

P2 A simple blame calculus for explicit nulls

一个用于显式空值的简单 blame 演算
JFP vol.342024匹配度 2/10 · 该论文属于渐变类型与 blame 演算的形式化理论,虽与形式化验证/Coq 证明工程相关,但未涉及用户核心的 LLM/Agent、静态分析、浮点程序分析或贝叶斯程序分析,也没有工业落地或 benchmark 驱动内容。引用 0 inbox
ONDŘEJ LHOTÁK, PHILIP WADLER
crossref: 2026-09-10

AI 速览

一句话:提出更简单正交的显式空值 blame 演算,用标准方式证明 blame 定理并支持开放项互嵌。

渐进类型刻画精度不同的语言如何交互,cast 负责转换类型并在值不匹配时分配 blame,blame 定理保证责任落在精度较低一侧。针对 Java 等允许任意类型取 null、而 Scala/Kotlin 等显式标记可空类型的场景,Nieto 等人 2020 年提出相应演算,但它需要三种函数类型构造子、非标准 blame 定理证明,且只能在项封闭时嵌入遗留语言与新型语言。本文给出更简单、更正交的演算:仅一个函数类型构造子和一个可空类型构造子,采用完全标准的 blame 定理证明,并允许开放项双向嵌入。所有结果已在 Coq 中机械化。

问题
如何为显式空值设计渐进类型演算,使遗留语言与新型语言的类型交互可由 cast 和 blame 机制安全处理。
方法
定义更简单正交的演算,仅含一个函数类型构造子和一个可空类型构造子,并用标准方式证明 blame 定理,支持开放项双向嵌入。
评估
在 Coq 中机械化验证论文所有结果,并与 Nieto 等人 2020 年演算在构造子和嵌入能力上对比。
原文摘要(Abstract)

Abstract Gradual typing provides a model for when a legacy language with less precise types interacts with a newer language with more precise types. Casts mediate between types of different precision, allocating blame when a value fails to conform to a type. The blame theorem asserts that blame always falls on the less-precisely typed side of a cast. One instance of interest is when a legacy language (such as Java) permits null values at every type, while a newer language (such as Scala or Kotlin) explicitly indicates which types permit null values. Nieto et al. in 2020 introduced a gradually typed calculus for just this purpose. The calculus requires three distinct constructors for function types and a non-standard proof of the blame theorem; it can embed terms from the legacy language into the newer language (or vice versa) only when they are closed. Here, we define a simpler calculus that is more orthogonal, with one constructor for function types and one for possibly nullable types, and with an entirely standard proof of the blame theorem; it can embed terms from the legacy language into the newer language (and vice versa) even if they are open. All results in the paper have been mechanized in Coq.

链接与引用

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

BibTeX
@article{paperbot2681,
  title = {A simple blame calculus for explicit nulls},
  author = {ONDŘEJ LHOTÁK and PHILIP WADLER},
  journal = {Journal of Functional Programming},
  volume = {34},
  year = {2024},
  doi = {10.1017/s0956796824000121}
}