Synthesizing Symmetric Lenses

by   Anders Miltner, et al.

Lenses are programs that can be run both "front to back" and "back to front," allowing data and updates to be transformed in two directions. Since their introduction, lenses have been extensively studied and applied. Recent work has also demonstrated how techniques from type-directed program synthesis can be used to efficiently synthesize a very simple class of lenses --- so-called bijective lenses over string data --- given a pair of types (regular expressions) and a small number of examples. We show how to extend this synthesis algorithm to a much wider class of lenses, which we call simple symmetric lenses, including both bijective lenses and the more widely used "asymmetric" lenses, as well as a rich subset of the full-blown "symmetric lenses". Simple symmetric lenses are of independent theoretical interest, being the largest class of symmetric lenses that do not rely on persistent internal state. Synthesizing simple symmetric lenses is substantially more challenging that synthesizing bijective lenses: Since some of the information on each side can be "disconnected" from the other side, there will in general be many lenses that agree with a given example. To guide the search process, we use stochastic regular expressions and ideas from information theory to estimate the amount of information propagated by a candidate lens. 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, Augeus, the bidirectional programming literature, and electronic file format synchronization tasks. After modest tuning, which is encouraged by the interactive nature of the tool, our implementation can synthesize all these lenses in under 30 seconds.


page 1

page 2

page 3

page 4


Synthesizing Bijective Lenses

Bidirectional transformations between different data representations occ...

Synbit: Synthesizing Bidirectional Programs using Unidirectional Sketches

We propose a technique for synthesizing bidirectional programs from the ...

Program Synthesis Using Example Propagation

We present Scrybe, an example-based synthesis tool for a statically-type...

Constraint-Based Type-Directed Program Synthesis

We explore an approach to type-directed program synthesis rooted in cons...

Data Extraction via Semantic Regular Expression Synthesis

Many data extraction tasks of practical relevance require not only synta...

RbSyn: Type- and Effect-Guided Program Synthesis

In recent years, researchers have explored component-based synthesis, wh...

Synthesis of Procedural Models for Deterministic Transition Systems

This paper introduces a general approach for synthesizing procedural mod...

Please sign up or login with your details

Forgot password? Click here to reset