Synthesizing Bijective Lenses

by   Anders Miltner, et al.

Bidirectional transformations between different data representations occur frequently in modern software systems. They appear as serializers and deserializers, as database views and view updaters, and more. Manually building bidirectional transformations---by writing two separate functions that are intended to be inverses---is tedious and error prone. A better approach is to use a domain-specific language in which both directions can be written as a single expression. However, these domain-specific languages can be difficult to program in, requiring programmers to manage fiddly details while working in a complex type system. To solve this, we present Optician, a tool for type-directed synthesis of bijective string transformers. The inputs to Optician are two ordinary regular expressions representing two data formats and a few concrete examples for disambiguation. The output is a well-typed program in Boomerang (a bidirectional language based on the theory of lenses). The main technical challenge involves navigating the vast program search space efficiently enough. Unlike most prior work on type-directed synthesis, our system operates in the context of a language with a rich equivalence relation on types (the theory of regular expressions). We synthesize terms of a equivalent language and convert those generated terms into our lens language. We prove the correctness of our synthesis algorithm. We also demonstrate empirically that our new language changes the synthesis problem from one that admits intractable solutions to one that admits highly efficient solutions. We evaluate Optician on a benchmark suite of 39 examples including both microbenchmarks and realistic examples derived from other data management systems including Flash Fill, a tool for synthesizing string transformations in spreadsheets, and Augeas, a tool for bidirectional processing of Linux system configuration files.


page 1

page 2

page 3

page 4


Synthesizing Symmetric Lenses

Lenses are programs that can be run both "front to back" and "back to fr...

Retentive Lenses

Based on Foster et al.'s lenses, various bidirectional programming langu...

Constraint-Based Type-Directed Program Synthesis

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

Synbit: Synthesizing Bidirectional Programs using Unidirectional Sketches

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

Bidirectional Typing

Bidirectional typing combines two modes of typing: type checking, which ...

CHAMELEON: OutSystems Live Bidirectional Transformations

In model-driven engineering, the bidirectional transformation of models ...

Program Synthesis Using Example Propagation

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

Please sign up or login with your details

Forgot password? Click here to reset