paperbot · PL 论文追踪

全部论文 待读 收藏

P2 Incremental Bidirectional Typing via Order Maintenance

基于序维护的增量双向类型检查
OOPSLA 9(OOPSLA2)2025匹配度 3/10 · 该论文属于静态分析与类型系统方向,具有理论形式化和高效实现,但未涉及用户核心关注的 LLM/Agentic 程序、AI 辅助静态分析/形式化验证、浮点程序分析或贝叶斯程序分析。其增量双向类型检查面向 live programming,与用户研究画像的核心交叉点距离较远。引用 1 inbox
Thomas J. Porter, Marisa Kirisame, Ivan Wei, Pavel Panchekha, Cyrus Omar
crossref: 2026-09-10

AI 速览

一句话:提出用顺序维护数据结构实现增量双向类型检查,细粒度编辑后快速传播类型更新,性能较从头重分析快多个数量级。

实时编程环境需要随用户编辑持续提供类型检查等语义服务,但大程序的反复全量分析开销巨大。本文提出一种可高效增量更新类型信息的系统,更新内容包括类型错误标记以及每个表达式的期望类型与实际类型。系统在类型论层面被刻画为一个小步动态语义,在带标记和注解的程序上传播更新:大部分更新遵循基础双向类型系统,同时维护从绑定变量到其绑定位置的指针,类型更新可直接沿这些指针遍历;系统采用顺序维护数据结构来高效维护指针并确定更新传播的优先级。作者在 Agda 中机器化证明了该系统与朴素重分析等价,并证明其他重要元理论性质。随后给出经过多项优化的 OCaml 实现,并通过大规模压力测试评估,相比从头重分析取得多个数量级加速。

问题
实时编程环境需要在用户进行细粒度编辑后持续更新类型信息,而对大程序从头重分析代价过高。
方法
将系统形式化为在带标记/注解程序上传播类型更新的小步动态语义,基于双向类型系统,并维护绑定指针,用顺序维护数据结构高效管理指针与更新传播顺序;在 Agda 中证明等价性等元理论性质,并实现优化后的 OCaml 原型。
评估
通过大规模压力测试评估 OCaml 实现,与从头重分析进行性能对比,结果显示可获得多个数量级的加速。
原文摘要(Abstract)

Live programming environments provide various semantic services, including type checking and evaluation, continuously as the user is editing the program. The live paradigm promises to improve the developer experience, but liveness is an implementation challenge, particularly when working with large programs. This paper specifies and efficiently implements a system that is able to incrementally update type information for a live program in response to fine-grained program edits. This information includes type error marks and information about the expected and actual type of every expression. The system is specified type-theoretically as a small-step dynamics that propagates updates through the marked and annotated program. Most updates flow according to a base bidirectional type system. Additional pointers are maintained to connect bound variables to their binding locations, with type updates traversing these pointers directly. Order maintenance data structures are employed to efficiently maintain these pointers and to prioritize the order of update propagation. We prove this system is equivalent to naive reanalysis in the Agda theorem prover, along with other important metatheoretic properties. We then provide an efficient OCaml implementation, detailing a number of impactful optimizations. We evaluate this implementation’s performance with a large stress-test and find that it is able to achieve multiple orders of magnitude speed-up compared to from-scratch reanalysis.

链接与引用

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

BibTeX
@article{paperbot2966,
  title = {Incremental Bidirectional Typing via Order Maintenance},
  author = {Thomas J. Porter and Marisa Kirisame and Ivan Wei and Pavel Panchekha and Cyrus Omar},
  journal = {Proceedings of the ACM on Programming Languages},
  volume = {9},
  number = {OOPSLA2},
  year = {2025},
  doi = {10.1145/3763117}
}