通过重写规则自监督学习证明直线程序之间的等价性
Self-Supervised Learning to Prove Equivalence Between Straight-Line Programs via Rewrite Rules
AI总结:
本文提出基于transformer的S4Eq系统,通过自监督样本选择增量训练生成重写规则序列,自动证明直线程序对的语义等价性,在10,000对程序上达到97%证明成功率。
摘要:
我们针对自动合成两个由语句序列组成的程序之间语义等价性证明的问题。我们使用抽象语法树(AST)表示程序,其中一组给定的语义保持重写规则可以应用于特定的AST模式,以生成一个变换后的且语义等价的程序。在我们的系统中,如果存在这些重写规则的一系列应用,使得一个程序被重写为另一个程序,则两个程序是等价的。我们提出了一种基于transformer模型的神经网络架构,用于生成程序对之间的等价性证明。系统输出一个重写序列,该序列的有效性只需通过验证其是否可应用来检查。如果神经网络没有产生有效序列,系统将报告这些程序不等价,从而通过设计确保不会有程序被错误地报告为等价。我们的系统针对一种单一文法完全实现,该文法可以表示带有函数调用和多种类型的直线程序。为了高效地训练系统生成此类序列,我们开发了一种原创的增量训练技术,称为自监督样本选择。我们在复杂度和长度不断增加证明上广泛研究了这种新颖训练方法的有效性。我们的系统S4Eq在包含10,000对等价程序的精选数据集上实现了97%的证明成功率。
英文摘要:
We target the problem of automatically synthesizing proofs of semantic equivalence between two programs made of sequences of statements. We represent programs using abstract syntax trees (AST), where a given set of semantics-preserving rewrite rules can be applied on a specific AST pattern to generate a transformed and semantically equivalent program. In our system, two programs are equivalent if there exists a sequence of application of these rewrite rules that leads to rewriting one program into the other. We propose a neural network architecture based on a transformer model to generate proofs of equivalence between program pairs. The system outputs a sequence of rewrites, and the validity of the sequence is simply checked by verifying it can be applied. If no valid sequence is produced by the neural network, the system reports the programs as non-equivalent, ensuring by design no programs may be incorrectly reported as equivalent. Our system is fully implemented for one single grammar which can represent straight-line programs with function calls and multiple types. To efficiently train the system to generate such sequences, we develop an original incremental training technique, named self-supervised sample selection. We extensively study the effectiveness of this novel training approach on proofs of increasing complexity and length. Our system, S4Eq, achieves 97% proof success on a curated dataset of 10,000 pairs of equivalent programs.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。