arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 1810.11527cs.PL
收藏

合成对称透镜

Synthesizing Symmetric Lenses

Anders Miltner, Solomon Maina, Kathleen Fisher, Benjamin C. Pierce, David Walker, Steve Zdancewic

摘要:

镜头是可以“前到后”和“后到前”运行的程序,允许在两个方向上传输对源数据或目标数据的更新。透镜已被广泛研究、推广和应用。最近的工作已经证明了如何从类型导向的程序合成技术可以用来有效地合成一个简单的类的镜头-双射镜头字符串数据-给定一对类型(正则表达式)和例子。我们将这种合成算法扩展到更广泛的一类透镜,称为简单对称透镜,包括所有双射透镜,所有流行的“不对称”透镜类别,以及霍夫曼等人提出的“对称透镜”的一个子集。直观地说,简单对称透镜允许一些信息存在于一侧,但不是另一侧,反之亦然。它们具有独立的理论兴趣,是不使用持久内部状态的最大类对称透镜。合成简单的对称透镜比合成双射透镜更具挑战性:由于每一侧的一些信息可以与另一侧“断开”,因此通常会有许多透镜与给定的示例一致。为了指导搜索过程,我们使用随机正则表达式和信息论来估计候选镜头传播的信息量,优选传播更多信息的镜头,以及将源和目标格式的部分标记为不相关或必要的用户注释。我们描述了一个简单的对称透镜和我们的合成过程的扩展回飞棒语言的实现。我们评估其性能的48个基准测试的例子,从Flash填充,Augeas,和双向编程文献。我们的实现可以在30秒内合成每个镜头。

英文摘要:

Lenses are programs that can be run both "front to back" and "back to front," allowing updates to either their source or their target data to be transferred in both directions. Lenses have been extensively studied, extended, and applied. Recent work has demonstrated how techniques from type-directed program synthesis can be used to efficiently synthesize a simple class of lenses---bijective lenses over string data---given a pair of types (regular expressions) and examples. We extend this synthesis algorithm to a broader class of lenses, called simple symmetric lenses, including all bijective lenses, all of the popular category of "asymmetric" lenses, and a subset of the "symmetric lenses" proposed by Hofmann et al. Intuitively, simple symmetric lenses allow some information to be present on one side but not the other and vice versa. They are of independent theoretical interest, being the largest class of symmetric lenses that do not use persistent internal state. Synthesizing simple symmetric lenses is more challenging than synthesizing bijective lenses: Since some of the information on each side can be "disconnected" from the other side, there will typically be many lenses that agree with a given example. To guide the search process, we use stochastic regular expressions and information theory to estimate the amount of information propagated by a candidate lens, preferring lenses that propagate more information, as well as user annotations marking parts of the source and target formats as either irrelevant or essential. We describe an implementation of simple symmetric lenses and our synthesis procedure as extensions to the Boomerang language. We evaluate its performance on 48 benchmark examples drawn from Flash Fill, Augeas, and the bidirectional programming literature. Our implementation can synthesize each of these lenses in under 30 seconds.

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

↑