paperbot · PL 论文追踪

全部论文 待读 收藏

P2 Truly Functional Solutions to the Longest Uptrend Problem (Functional Pearl)

最长上升趋势问题的真正函数式解法(函数式珍珠)
ICFP 9(ICFP)2025匹配度 1/10 · 该论文属于函数式编程算法设计(用 Huet zipper 优化最长上升子序列),既不涉及静态分析/形式化验证,也不涉及 LLM/Agent 或浮点、贝叶斯程序分析,仅在广义「程序语言」范畴上有微弱关联。引用 0 inbox
Alexander Dinges, Ralf Hinze
crossref: 2026-09-10

AI 速览

一句话:用 Huet zipper 设计纯函数式最长上升趋势算法,兼得渐近最优与实际高效。

最长递增子序列问题通常以命令式方式实现,依赖数组获得常数时间的查找与更新。若直接改用函数式序列,虽可保持相同的渐近运行时间,但实际性能显著变差。本文是一篇函数式珍珠,提出一种纯函数式解法:利用 Huet zipper 显式刻画搜索、查找与更新之间的交互,从而在保持渐近最优性的同时获得良好的实际效率。作者还改进了文献中常见命令式解法的自适应行为。其核心贡献是给出真正函数式、渐近最优且实践高效的最长上升趋势问题实现,说明 zipper 可有效桥接持久化数据结构与数组式原地更新的性能需求。

问题
如何不用命令式数组,为最长递增子序列/最长上升趋势问题构造纯函数式算法,同时保持渐近最优并避免函数式序列的实际性能退化。
方法
以 Huet zipper 显式管理搜索、查找与更新三者的交互,替代数组的常数时间访问和原地更新,并改进常见命令式解法的自适应行为。
评估
通过纯函数式实现评估其渐近复杂度与实际效率,并讨论对自适应行为的改进。
原文摘要(Abstract)

Solutions to the longest increasing subsequence problem are typically implemented imperatively, relying on arrays for constant-time lookups and updates. Replacing these arrays with functional sequences allows a purely functional solution with the same asymptotic running time, but with significantly worse practical performance. In this pearl, we present a purely functional approach that is not only asymptotically optimal, but also efficient in practice. The core idea is to exploit the interplay between search, lookup, and update operations through Huet’s zipper. In addition, we improve the adaptive behaviour of imperative solutions commonly found in the literature.

链接与引用

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

BibTeX
@article{paperbot3053,
  title = {Truly Functional Solutions to the Longest Uptrend Problem (Functional Pearl)},
  author = {Alexander Dinges and Ralf Hinze},
  journal = {Proceedings of the ACM on Programming Languages},
  volume = {9},
  number = {ICFP},
  year = {2025},
  doi = {10.1145/3747520}
}