In this work we target the problem of provably computing the equivalence between two programs represented as dataflow graphs. To this end, we formalize the problem of equivalence between two programs as finding a set of semantics-preserving rewrite rules from one into the other, such that after the rewrite the two programs are structurally identical, and therefore trivially equivalent. We then develop the first graph-to-sequence neural network system for program equivalence, trained to produce such rewrite sequences from a carefully crafted automatic example generation algorithm. We extensively evaluate our system on a rich multi-type linear algebra expression language, using arbitrary combinations of 100+ graph-rewriting axioms of equivalence. Our system outputs via inference a correct rewrite sequence for 96% of the 10,000 program pairs isolated for testing, using 30-term programs. And in all cases, the validity of the sequence produced and therefore the provable assertion of program equivalence is computable, in negligible time.
翻译:在这项工作中,我们针对以数据流图表示的两个程序之间的等同计算问题。 为此,我们将两个程序之间的等同问题正式化,从一个方案到另一个方案,找到一套语义保留重写规则,这样,在两个程序重写后,这两个程序在结构上是相同的,因此是微不足道的等同的。然后我们开发第一个程序等同的图图到序列神经网络系统,经过培训,从精心设计的自动生成示例算法中生成这样的重写序列。我们用100+图形重写等同的任意组合,广泛评价了我们关于富含多型线性代数表达语言的系统。我们通过推断10 000对单立的程序对96%的正确重写顺序,使用30年期程序进行测试。而在所有情况下,所制作的序列的正确性以及因此可验证的方案等同性主张都是可比较的,时间微不足道。