We introduce a method for proving almost sure termination in the context of lambda calculus with continuous random sampling and explicit recursion, based on ranking supermartingales. This result is extended in three ways. Antitone ranking functions have weaker restrictions on how fast they must decrease, and are applicable to a wider range of programs. Sparse ranking functions take values only at a subset of the program's reachable states, so they are simpler to define and more flexible. Ranking functions with respect to alternative reduction strategies give yet more flexibility, and significantly increase the applicability of the ranking supermartingale approach to proving almost sure termination, thanks to a novel (restricted) confluence result which is of independent interest. The notion of antitone ranking function was inspired by similar work by McIver, Morgan, Kaminski and Katoen in the setting of a first-order imperative language, but adapted to a higher-order functional language. The sparse ranking function and confluent semantics extensions are unique to the higher-order setting. Our methods can be used to prove almost sure termination of programs that are beyond the reach of methods in the literature, including higher-order and non-affine recursion.
翻译:我们引入了一种方法,以连续随机抽样和直线重现的方式,证明在羊羔微积分中几乎可以确定终止的情况,其结果以三种方式延伸。 反排排排排排排位函数对于它们必须减少的速度有较弱的限制,并且适用于更广泛的程序。 偏差的排位函数只在方案可触及的状态的一个子组中取值, 因而它们更便于定义和更灵活。 替代削减战略的排位函数的排位功能具有更大的灵活性, 并大大增加了排位超配法方法对证明几乎确定终止的可适用性, 这要归功于一种具有独立兴趣的新颖( 限制的) 组合结果。 反排排排排位函数的概念是由McIver、 Morgan、 Kaminski 和 Katoen 在设置一阶必用语言时的类似工作启发的, 但它适应了更高级的功能语言。 稀疏的排位函数和condulent 语系扩展是更高顺序设置所独有的。 我们的方法可以用来证明几乎肯定地终止超出文献中方法范围以外的程序,, 包括更高顺序和非再置。