We consider the problem of automatically proving resource bounds. That is, we study how to prove that an integer-valued resource variable is bounded by a given program expression. Automatic resource-bound analysis has recently received significant attention because of a number of important applications (e.g., detecting performance bugs, preventing algorithmic-complexity attacks, identifying side-channel vulnerabilities), where the focus has often been on developing precise amortized reasoning techniques to infer the most exact resource usage. While such innovations remain critical, we observe that fully precise amortization is not always necessary to prove a bound of interest. And in fact, by amortizing selectively, the needed supporting invariants can be simpler, making the invariant inference task more feasible and predictable. We present a framework for selectively-amortized analysis that mixes worst-case and amortized reasoning via a property decomposition and a program transformation. We show that proving bounds in any such decomposition yields a sound resource bound in the original program, and we give an algorithm for selecting a reasonable decomposition.
翻译:我们考虑的是自动验证资源界限的问题。 也就是说, 我们研究如何证明一个总价值的资源变量受特定程序表达式的约束。 最近,由于许多重要的应用( 例如, 检测性能错误、 防止算法复杂攻击、 辨别侧道弱点), 自动资源约束分析受到极大关注, 这些应用的焦点往往是开发精确的摊销推理技术, 以推断最精确的资源使用量。 虽然这些创新仍然至关重要, 但是我们发现, 完全精确的摊销并非总是证明利益约束所必须的。 事实上, 通过选择性摊销, 所需的支持性变量可以更简单一些, 使得变异推论任务更加可行和可预测。 我们提出了一个有选择的摊销分析框架, 将最坏的情况和摊销推理方法混在一起, 通过财产分解和程序转换。 我们证明, 任何这种分解的界限都会产生原始程序的合理资源约束。 我们给出了选择合理分解的算法。