arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2102.13183cs.PL
收藏

RbSyn:类型引导的程序合成

RbSyn: Type- and Effect-Guided Program Synthesis

Sankha Narayan Guria, Jeffrey S. Foster, David Van Horn

摘要:

近年来,研究人员已经探索了基于组件的合成,其目的是通过组合对现有API的调用来自动构建程序。然而,先前的工作没有考虑具有副作用的方法的有效合成,例如,更新数据库的Web应用程序方法。在本文中,我们介绍了RbSyn,一种新的类型和效果指导的Ruby合成工具。RbSyn合成目标被指定为目标方法的类型和它必须通过的一系列测试用例。RbSyn的工作原理是递归地生成良好类型的候选方法体,其写效果与测试用例断言的读效果相匹配。在找到一组分别满足每个测试的候选代码后,RbSyn合成一个解决方案,该解决方案在适当的条件下分支执行正确的候选代码。我们正式的核心,面向对象的语言$λ_{syn}$的RbSyn和描述如何在我们的Ruby实现的模型的关键思想是按比例放大。我们在19个基准测试中评估了RbSyn,其中12个来自流行的开源Ruby应用程序。我们发现RbSyn为所有基准测试合成正确的解决方案,其中15个基准测试在9秒内合成,而最慢的基准测试需要83秒。使用观察到的读取来指导合成是有效的:单独使用类型指导在12个应用程序基准测试中有10个超时。我们还发现,使用不太精确的效果注释会导致合成性能变差。总之,我们相信类型和效果引导的合成是从测试用例合成有效方法的重要一步。

英文摘要:

In recent years, researchers have explored component-based synthesis, which aims to automatically construct programs that operate by composing calls to existing APIs. However, prior work has not considered efficient synthesis of methods with side effects, e.g., web app methods that update a database. In this paper, we introduce RbSyn, a novel type- and effect-guided synthesis tool for Ruby. An RbSyn synthesis goal is specified as the type for the target method and a series of test cases it must pass. RbSyn works by recursively generating well-typed candidate method bodies whose write effects match the read effects of the test case assertions. After finding a set of candidates that separately satisfy each test, RbSyn synthesizes a solution that branches to execute the correct candidate code under the appropriate conditions. We formalize RbSyn on a core, object-oriented language $λ_{syn}$ and describe how the key ideas of the model are scaled-up in our implementation for Ruby. We evaluated RbSyn on 19 benchmarks, 12 of which come from popular, open-source Ruby apps. We found that RbSyn synthesizes correct solutions for all benchmarks, with 15 benchmarks synthesizing in under 9 seconds, while the slowest benchmark takes 83 seconds. Using observed reads to guide synthesize is effective: using type-guidance alone times out on 10 of 12 app benchmarks. We also found that using less precise effect annotations leads to worse synthesis performance. In summary, we believe type- and effect-guided synthesis is an important step forward in synthesis of effectful methods from test cases.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑