Synthesizing Symmetric Lenses

10/26/2018
by   Anders Miltner, et al.
0

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.

READ FULL TEXT

page 1

page 2

page 3

page 4

research
10/09/2017

Synthesizing Bijective Lenses

Bidirectional transformations between different data representations occ...
research
08/31/2021

Synbit: Synthesizing Bidirectional Programs using Unidirectional Sketches

We propose a technique for synthesizing bidirectional programs from the ...
research
10/25/2022

Program Synthesis Using Example Propagation

We present Scrybe, an example-based synthesis tool for a statically-type...
research
07/06/2019

Constraint-Based Type-Directed Program Synthesis

We explore an approach to type-directed program synthesis rooted in cons...
research
05/17/2023

Data Extraction via Semantic Regular Expression Synthesis

Many data extraction tasks of practical relevance require not only synta...
research
02/25/2021

RbSyn: Type- and Effect-Guided Program Synthesis

In recent years, researchers have explored component-based synthesis, wh...
research
07/25/2023

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