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

节省空间的舱单合同

Space-Efficient Manifest Contracts

Michael Greenberg

摘要:

高阶契约检验的标准算法可能导致无限的空间消耗,并可能破坏尾递归,改变程序的渐近空间复杂度。虽然渐变类型的空间效率--调解非类型化和类型化代码的契约--已经得到了很好的研究,但显式契约的合理空间效率--检查比简单类型更强的属性的契约,例如,“是自然数”而不是“是整数”-仍然是一个悬而未决的问题。我们展示了如何实现良好的空间效率的显式合同与强谓词合同。最基本的技巧是将合同检查分解为检查子:结构化的、带有错误注释的检查列表。通过小心地防止重复的随机子出现,我们可以恢复空间效率,同时保持相同的可观察行为。在此过程中,我们定义了一个空间效率的框架,使用三种不同的空间效率显式演算遍历设计空间。我们研究了不同的正确性标准合同语义,我们得出结论,一个基于criminon的语言,其合同享有(银河)有界的,健全的空间消费-他们是观察等同于标准的,空间效率低下的语义。

英文摘要:

The standard algorithm for higher-order contract checking can lead to unbounded space consumption and can destroy tail recursion, altering a program's asymptotic space complexity. While space efficiency for gradual types---contracts mediating untyped and typed code---is well studied, sound space efficiency for manifest contracts---contracts that check stronger properties than simple types, e.g., "is a natural" instead of "is an integer"---remains an open problem. We show how to achieve sound space efficiency for manifest contracts with strong predicate contracts. The essential trick is breaking the contract checking down into coercions: structured, blame-annotated lists of checks. By carefully preventing duplicate coercions from appearing, we can restore space efficiency while keeping the same observable behavior. Along the way, we define a framework for space efficiency, traversing the design space with three different space-efficient manifest calculi. We examine the diverse correctness criteria for contract semantics; we conclude with a coercion-based language whose contracts enjoy (galactically) bounded, sound space consumption---they are observationally equivalent to the standard, space-inefficient semantics.

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

↑