一句话:提出超限步进索引的逻辑关系,首次证明含高阶共享可变状态的良类型程序终止。
步进索引逻辑关系是构建操作语义模型与程序逻辑的有力技术,适合建模高阶状态等特性;但传统观点认为它只能处理有限计算轨迹,因而仅适用于“良类型程序不出错”等安全性质,难以证明终止等活性性质。本文表明,只要类型系统强制规范使用状态,步进索引仍能证明良类型程序终止,即使存在动态分配、共享、可变的高阶状态。作者研究一个受 JavaScript promise 启发的异步通道语言,其中高阶状态实现通信、线性保证终止;核心方法是将自然数步进索引推广为超限步进索引,以组合方式计算表达式的终止界。此前虽有超限步进索引的提议,本文首次将其用于含高阶状态的终止性推理。
Step-indexed logical relations are an extremely useful technique for building operational-semantics-based models and program logics for realistic, richly-typed programming languages. They have proven to be indispensable for modeling features like higher-order state , which many languages support but which were difficult to accommodate using traditional denotational models. However, the conventional wisdom is that, because they only support reasoning about finite traces of computation, (unary) step-indexed models are only good for proving safety properties like “well-typed programs don’t go wrong”. There has consequently been very little work on using step-indexing to establish liveness properties, in particular termination. In this paper, we show that step-indexing can in fact be used to prove termination of well-typed programs—even in the presence of dynamically-allocated, shared, mutable, higher-order state—so long as one’s type system enforces disciplined use of such state. Specifically, we consider a language with asynchronous channels, inspired by promises in JavaScript, in which higher-order state is used to implement communication, and linearity is used to ensure termination. The key to our approach is to generalize from natural number step-indexing to transfinite step-indexing , which enables us to compute termination bounds for program expressions in a compositional way. Although transfinite step-indexing has been proposed previously, we are the first to apply this technique to reasoning about termination in the presence of higher-order state.
@article{paperbot1152,
title = {Transfinite step-indexing for termination},
author = {Simon Spies and Neel Krishnaswami and Derek Dreyer},
journal = {Proceedings of the ACM on Programming Languages},
volume = {5},
number = {POPL},
year = {2021},
doi = {10.1145/3434294}
}