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

基于类型引导的抽象求精的程序合成

Program Synthesis by Type-Guided Abstraction Refinement

Zheng Guo, Michael James, David Justo, Jiaxiao Zhou, Ziteng Wang, Ranjit Jhala, Nadia Polikarpova

摘要:

我们考虑的问题,类型导向组件的合成,给定一组(类型化)组件和查询类型,目标是合成一个长期居住的查询。基于直觉逻辑中的证明搜索的经典方法不能扩展到现代语言的标准库,后者跨越数百或数千个组件。最近为Java等语言提出的基于图可达性的方法确实可以扩展,但仅适用于单态数据和函数的组件:多态数据和函数无限地扩展了必须搜索的图的大小,使得合成变得难以处理。我们介绍了类型引导抽象细化(TYGAR),一种新的方法,可扩展的类型导向合成多态数据库和组件。我们的关键见解是,我们可以通过在抽象类型上构建一个图来克服爆炸,该抽象类型表示一组潜在的无界具体类型。我们展示了如何使用图的可达性来搜索抽象类型上的候选项,并介绍了一种新的算法,该算法使用病态类型候选项的不可类型性证明来迭代地细化抽象,直到找到一个良好类型的结果。我们已经在H+中实现了TYGAR,H+是一个以一组Haskell库和一个查询类型作为输入的工具,并返回一个Haskell术语,该术语使用所提供的库中的函数来实现查询类型。我们使用一组流行的Haskell库(共有291个组件)对一组44个查询进行了H+评估。我们的研究结果表明,H+返回一个有趣的解决方案的前五个结果中的33个44查询。此外,TYGAR允许H+快速返回类型良好的术语,第一个解决方案的平均时间仅为1.4秒。

英文摘要:

We consider the problem of type-directed component based synthesis where, given a set of (typed) components and a query type, the goal is to synthesize a term that inhabits the query. Classical approaches based on proof search in intuitionistic logics do not scale up to the standard libraries of modern languages, which span hundreds or thousands of components. Recent graph reachability based methods proposed for languages like Java do scale, but only apply to components over monomorphic data and functions: polymorphic data and functions infinitely explode the size of the graph that must be searched, rendering synthesis intractable. We introduce type-guided abstraction refinement (TYGAR), a new approach for scalable type-directed synthesis over polymorphic datatypes and components. Our key insight is that we can overcome the explosion by building a graph over abstract types which represent a potentially unbounded set of concrete types. We show how to use graph reachability to search for candidate terms over abstract types, and introduce a new algorithm that uses proofs of untypeability of ill-typed candidates to iteratively refine the abstraction until a well-typed result is found. We have implemented TYGAR in H+, a tool that takes as input a set of Haskell libraries and a query type, and returns a Haskell term that uses functions from the provided libraries to implement the query type. We have evaluated H+ on a set of 44 queries using a set of popular Haskell libraries with a total of 291 components. Our results demonstrate that H+ returns an interesting solution within the first five results for 33 out of 44 queries. Moreover, TYGAR allows H+ to rapidly return well-typed terms, with the median time to first solution of just 1.4 seconds.

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

↑