arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2509.22982cs.PL
收藏

使用线性映射的高效成本界

Efficient Cost Bounds with Linear Maps

Carnegie Mellon University(卡内基梅隆大学);University of Wisconsin(威斯康星大学)

David M Kahn, Jan Hoffmann, Thomas Reps, Jessie Grosen

AI总结:

本文针对 AARA 中无成本类型推断代价高且仅支持多项式界的问题,提出用可表示无穷多无成本类型的线性映射和矩阵不等式进行推理,从而借助线性规划工具实现高效检查与推断。

摘要:

Automatic Amortized Resource Analysis(AARA,自动摊还资源分析)利用类型推导程序执行成本界。为此,AARA 经常使用无成本类型,这对于类型和成本界的组合至关重要。然而,使用当前最先进算法推断无成本类型代价高昂,原因是其对额外无成本类型存在递归依赖。此外,该算法使用一种仅适用于多项式成本界的启发式方法,而不适用于例如指数界等情况。本文通过以一种新方式表示函数的无成本类型,提出了解决这些问题的新方法:使用可以表示无穷多个无成本类型的线性映射。此类映射通过矩阵不等式实现了具有代数风格的成本界(包括非多项式界)推理。对于许多程序,这些不等式可以使用现成的线性规划工具求解,因此类型始终可以被高效检查,并且通常可以被高效推断。一项基于原型实现的实验评估表明,在适用情况下,线性映射的推断比最先进算法指数级地更高效。

英文摘要:

The Automatic Amortized Resource Analysis (AARA) derives program-execution cost bounds using types. To do so, AARA often makes use of cost-free types, which are critical for the composition of types and cost bounds. However, inferring cost-free types using the current state-of-the-art algorithm is expensive due to recursive dependence on additional cost-free types. Furthermore, that algorithm uses a heuristic only applicable to polynomial cost bounds, and not, e.g., exponential bounds. This paper presents a new approach to these problems by representing the cost-free types of a function in a new way: with a linear map, which can stand for infinitely many cost-free types. Such maps enable an algebraic flavor of reasoning about cost bounds (including non-polynomial bounds) via matrix inequalities. These inequalities can be solved with off-the-shelf linear-programming tools for many programs, so that types can always be efficiently checked and often be efficiently inferred. An experimental evaluation with a prototype implementation shows that-when it is applicable-the inference of linear maps is exponentially more efficient than the state-of-the-art algorithm.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑