We introduce a novel approach to the automated termination analysis of computer programs: we use neural networks to represent ranking functions. Ranking functions map program states to values that are bounded from below and decrease as a program runs; the existence of a ranking function proves that the program terminates. We train a neural network from sampled execution traces of a program so that the network's output decreases along the traces; then, we use symbolic reasoning to formally verify that it generalises to all possible executions. Upon the affirmative answer we obtain a formal certificate of termination for the program, which we call a neural ranking function. We demonstrate that thanks to the ability of neural networks to represent nonlinear functions our method succeeds over programs that are beyond the reach of state-of-the-art tools. This includes programs that use disjunctions in their loop conditions and programs that include nonlinear expressions.
翻译:我们引入了计算机程序自动终止分析的新办法: 我们使用神经网络来代表排序功能。 排序函数映射程序显示来自下方的值, 并随着程序运行而减少; 排名函数的存在证明程序终止。 我们从一个程序的样本执行轨迹中培训一个神经网络, 这样网络的输出会随轨下降; 然后, 我们使用象征性推理来正式核实它是否概括了所有可能的处决。 在肯定的回答中, 我们获得一个程序的正式终止证书, 我们称之为神经排序函数。 我们证明,由于神经网络能够代表非线性功能, 我们的方法能够成功完成超出最先进工具范围的程序。 这包括在其循环条件和包括非线性表达的程序中使用脱钩的程序 。