paperbot · PL 论文追踪

全部论文 待读 收藏

P2 Sealing pointer-based optimizations behind pure functions

将基于指针的优化封装在纯函数之后
ICFP 4(ICFP)2020匹配度 3/10 · 论文关注依赖类型与函数式语言中通过封装指针操作提升 Lean/Coq 等定理证明器的图级遍历性能,与形式化验证基础设施有间接关联;但用户核心方向是 LLM/Agent 与静态分析、浮点程序分析、贝叶斯程序分析的交叉,本文不涉及 LLM、静态分析、浮点或贝叶斯方法,因此匹配度较低。引用 4 inbox
Daniel Selsam, Simon Hudon, Leonardo de Moura
dblp: 2026-09-10crossref: 2026-09-10arxiv: 2026-09-10

AI 速览

一句话:利用依赖类型将指针地址操作封装为纯接口,使函数式程序保持引用透明并获得图级遍历性能。

纯函数式语言适合构建自动推理系统,但项遍历耗时按语法树大小而非共享图大小增长;在 Lean、Coq 等交互式定理证明器的自动化中,这种指数级膨胀尤为严重。要恢复最优复杂度,只需对项的内存地址做简单操作,但直接暴露这些操作会破坏引用透明。本文提出用依赖类型将指针地址操作封装在纯函数接口之后,仅在信任上付出可忽略的代价。作者在 Lean v4 中实现了该方案,并指出其他基于依赖类型理论的语言也可采用。

问题
纯函数式语言中项遍历按语法树大小而非共享图大小耗时,导致 Lean/Coq 等定理证明器自动化出现指数级膨胀。
方法
用依赖类型把必要的内存地址操作封装在纯函数接口之后,以极小的额外信任代价保持引用透明并恢复图级共享。
评估
在 Lean v4 中实现并集成该机制,说明其可在实际语言中采用且只需可忽略的额外信任。
原文摘要(Abstract)

Functional programming languages are particularly well-suited for building automated reasoning systems, since (among other reasons) a logical term is well modeled by an inductive type, traversing a term can be implemented generically as a higher-order combinator, and backtracking search is dramatically simplified by persistent datastructures. However, existing pure functional programming languages all suffer a major limitation in these domains: traversing a term requires time proportional to the tree size of the term as opposed to its graph size. This limitation would be particularly devastating when building automation for interactive theorem provers such as Lean and Coq, for which the exponential blowup of term-tree sizes has proved to be both common and difficult to prevent. All that is needed to recover the optimal scaling is the ability to perform simple operations on the memory addresses of terms, and yet allowing these operations to be used freely would clearly violate the basic premise of referential transparency. We show how to use dependent types to seal the necessary pointer-address manipulations behind pure functional interfaces while requiring only a negligible amount of additional trust. We have implemented our approach for the upcoming version (v4) of Lean, and our approach could be adopted by other languages based on dependent type theory as well.

链接与引用

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

BibTeX
@article{abs-2003-01685,
  title = {Sealing pointer-based optimizations behind pure functions},
  author = {Daniel Selsam and Simon Hudon and Leonardo de Moura},
  journal = {Proceedings of the ACM on Programming Languages},
  volume = {4},
  number = {ICFP},
  year = {2020},
  doi = {10.1145/3408997}
}