We introduce a novel approach to the automated termination analysis of computer programs: we train neural networks to behave as ranking functions. Ranking functions map program states to values that are bounded from below and decrease as the program runs. The existence of a valid ranking function proves that the program terminates. While existing methods usually construct ranking functions from source or machine code using symbolic reasoning, we propose a lightweight method that learns them from executions traces. We train a neural network so that its output decreases along sampled executions as a ranking function would; then, we use symbolic reasoning to verify whether it generalises to all possible executions. We demonstrate that, thanks to the ability of neural networks to generalise well, our method succeeds over a wide variety of programs. This includes programs that use data structures. We have built a prototype analyser for Java bytecode and show the efficacy of our method over a standard dataset of benchmarks.
翻译:我们对计算机程序自动终止分析采用一种新颖的方法: 我们训练神经网络, 以作为排序函数。 排序功能映射程序显示从下到下, 并随着程序运行而减少。 有效的排序功能的存在证明程序终止。 虽然现有方法通常使用象征性推理从源代码或机器代码中构建排序功能, 但我们建议了一种轻量化方法, 从处决痕迹中学习这些功能。 我们训练了一个神经网络, 以便其输出随着抽样处决而减少, 作为排序函数; 然后, 我们用象征性推理来验证它是否概括了所有可能的处决。 我们证明, 由于神经网络有能力进行概括, 我们的方法在广泛的程序上成功。 这包括使用数据结构的程序。 我们为 Java 建立了一种原型分析器, 并展示了我们方法相对于标准数据集的功效 。