paperbot · PL 论文追踪

全部论文 待读 收藏

P2 A dependently typed calculus with pattern matching and erasure inference

一个带模式匹配与擦除推断的依赖类型演算
ICFP 4(ICFP)2020匹配度 2/10 · 该论文属于纯依赖类型论与编译期擦除推断,虽与程序分析和形式化方法相关,但不涉及 LLM/Agent、浮点程序分析或贝叶斯程序分析等用户核心方向。引用 9 inbox
Matúš Tejiščák
dblp: 2026-09-10crossref: 2026-09-10

AI 速览

一句话:提出带模式匹配与擦除标注的依赖类型演算,并给出健全、完全且最优的擦除推断算法。

依赖类型程序中作为类型正确性证据的项在检查后对执行无用,却可能比运行时有用计算渐近地大得多,使线性程序退化为指数时间。现有系统通过类型宇宙或 irrelevance 间接建模擦除,受其限制,部分无用计算无法擦除,惯用程序仍渐近次优。本文提出带模式匹配和擦除标注的依赖类型演算,直接建模擦除,并说明擦除不同于 irrelevance。作者证明良类型程序的擦除与归约可交换,且在 Church-Rosser 性质下保持可转换性;给出针对未标注或部分标注程序的擦除推断算法,证明其相对类型规则健全、完全且最优。该方法还能在编译后恢复预期渐近复杂度并缩短编译时间。

问题
依赖类型程序中用于证明类型正确的部分在检查后无需执行,却可能带来渐近级甚至指数级运行时开销;现有基于类型宇宙或 irrelevance 的擦除方案不够充分。
方法
提出一个带模式匹配与擦除标注的依赖类型演算,直接建模擦除,并给出适用于未标注或部分标注程序的擦除推断算法。
评估
在理论上证明擦除与归约可交换、在 Church-Rosser 下保持可转换性,并证明推断算法健全、完全且最优;同时说明在编译程序中可恢复预期渐近复杂度并缩短编译时间。
原文摘要(Abstract)

Some parts of dependently typed programs constitute evidence of their type-correctness and, once checked, are unnecessary for execution. These parts can easily become asymptotically larger than the remaining runtime-useful computation, which can cause normally linear-time programs run in exponential time, or worse. We should not make programs run slower by just describing them more precisely. Current dependently typed systems do not erase such computation satisfactorily. By modelling erasure indirectly through type universes or irrelevance, they impose the limitations of these means to erasure. Some useless computation then cannot be erased and idiomatic programs remain asymptotically sub-optimal. In this paper, we explain why we need erasure, that it is different from other concepts like irrelevance, and propose a dependently typed calculus with pattern matching with erasure annotations to model it. We show that erasure in well-typed programs is sound in that it commutes with reduction. Assuming the Church-Rosser property, erasure furthermore preserves convertibility in general. We also give an erasure inference algorithm for erasure-unannotated or partially annotated programs and prove it sound, complete, and optimal with respect to the typing rules of the calculus. Finally, we show that this erasure method is effective in that it can not only recover the expected asymptotic complexity in compiled programs at run time, but it can also shorten compilation times.

链接与引用

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

BibTeX
@article{Tejiscak20,
  title = {A dependently typed calculus with pattern matching and erasure inference},
  author = {Matúš Tejiščák},
  journal = {Proceedings of the ACM on Programming Languages},
  volume = {4},
  number = {ICFP},
  year = {2020},
  doi = {10.1145/3408973}
}