Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
skip to main content
research-article
Open access

Synthesizing quotient lenses

Published: 30 July 2018 Publication History

Abstract

Quotient lenses are bidirectional transformations whose correctness laws are “loosened” by specified equivalence relations, allowing inessential details in concrete data formats to be suppressed. For example, a programmer could use a quotient lens to define a transformation that ignores the order of fields in XML data, so that two XML files with the same fields but in different orders would be considered the same, allowing a single, simple program to handle them both. Building on a recently published algorithm for synthesizing plain bijective lenses from high-level specifications, we show how to synthesize bijective quotient lenses in three steps. First, we introduce quotient regular expressions (QREs), annotated regular expressions that conveniently mark inessential aspects of string data formats; each QRE specifies, simulteneously, a regular language and an equivalence relation on it. Second, we introduce QRE lenses, i.e., lenses mapping between QREs. Our key technical result is a proof that every QRE lens can be transformed into a functionally equivalent lens that canonizes source and target data just at the “edges” and that uses a bijective lens to map between the respective canonical elements; no internal canonization occurs in a lens in this normal form. Third, we leverage this normalization theorem to synthesize QRE lenses from a pair of QREs and example input-output pairs, reusing earlier work on synthesizing plain bijective lenses. We have implemented QREs and QRE lens synthesis as an extension to the bidirectional programming language Boomerang. We evaluate the effectiveness of our approach by synthesizing QRE lenses between various real-world data formats in the Optician benchmark suite.

Supplementary Material

WEBM File (a80-maina.webm)

References

[1]
Lennart Augustsson. 2004. {Haskell} Announcing Djinn, version 2004-12-11, a coding wizard. Mailing List. http: //www.haskell.org/pipermail/haskell/2005-December/017055.html .
[2]
Aaron Bohannon, J. Nathan Foster, Benjamin C. Pierce, Alexandre Pilkiewicz, and Alan Schmitt. 2008. Boomerang: Resourceful Lenses for String Data. In Proceedings of the 35th Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL ’08) . ACM.
[3]
Claus Brabrand, Anders Møller, and Michael I. Schwartzbach. 2008. Dual Syntax for XML Languages. Inf. Syst. 33, 4-5 (June 2008).
[4]
James Cheney. 2008. FLUX: functional updates for XML. In ACM Sigplan Notices, Vol. 43. ACM, 3–14.
[5]
Ezra Cooper, Sam Lindley, Philip Wadler, and Jeremy Yallop. 2008. The essence of form abstraction. In Asian Symposium on Programming Languages and Systems . Springer, 205–220.
[6]
Alcino Cunha. 2010. A relational approach to bidirectional transformations. (2010).
[7]
Yu Feng, Ruben Martins, Jacob Van Geffen, Isil Dillig, and Swarat Chaudhuri. 2017. Component-based Synthesis of Table Consolidation and Transformation Tasks from Examples. In Proceedings of the 38th ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI 2017) . ACM.
[8]
John K. Feser, Swarat Chaudhuri, and Isil Dillig. 2015. Synthesizing Data Structure Transformations from Input-output Examples. In Proceedings of the 36th ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI) .
[9]
J. Nathan Foster, Michael B. Greenwald, Jonathan T. Moore, Benjamin C. Pierce, and Alan Schmitt. 2007. Combinators for Bidirectional Tree Transformations: A Linguistic Approach to the View-update Problem. ACM Trans. Program. Lang. Syst. 29, 3, Article 17 (May 2007).
[10]
J. Nathan Foster, Alexandre Pilkiewicz, and Benjamin C. Pierce. 2008. Quotient Lenses. SIGPLAN Not. 43, 9 (Sept. 2008), 383–396.
[11]
Jonathan Frankle, Peter-Michael Osera, David Walker, and Steve Zdancewic. 2015. Example-Directed Synthesis: A TypeTheoretic Interpretation (extended version) . Technical Report MS-CIS-15-12. University of Pennsylvania.
[12]
Sumit Gulwani. 2011. Automating string processing in spreadsheets using input-output examples. In ACM SIGPLAN Notices, Vol. 46. ACM.
[13]
Tihomir Gvero, Viktor Kuncak, Ivan Kuraj, and Ruzica Piskac. 2013. Complete Completion Using Types and Weights. In Proceedings of the 2013 ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI) .
[14]
Frank Hilken, Martin Gogolla, Loli Burgueño, and Antonio Vallecillo. 2016. Testing models and model transformations using classifying terms. Software & Systems Modeling (2016), 1–28.
[15]
Martin Hofmann, Benjamin Pierce, and Daniel Wagner. 2011. Symmetric lenses. In ACM SIGPLAN Notices, Vol. 46. ACM, 371–384.
[16]
Zhenjiang Hu, Shin-Cheng Mu, and Masato Takeichi. 2004. A Programmable Editor for Developing Structured Documents Based on Bidirectional Transformations. In Proceedings of the 2004 ACM SIGPLAN Symposium on Partial Evaluation and Semantics-based Program Manipulation (PEPM ’04) . ACM, New York, NY, USA, 178–189.
[17]
Shinya Kawanaka and Haruo Hosoya. 2006. biXid: A Bidirectional Transformation Language for XML. In Proceedings of the Eleventh ACM SIGPLAN International Conference on Functional Programming (ICFP ’06) . ACM.
[18]
David Lutterkort. 2008. Augeas–a configuration API. In Linux Symposium, Ottawa, ON. 47–56.
[19]
Kazutaka Matsuda and Meng Wang. 2013. FliPpr: A prettier invertible printing system. In European Symposium on Programming . Springer, 101–120.
[20]
Anders Miltner, Kathleen Fisher, Benjamin C Pierce, David Walker, and Steve Zdancewic. 2017. Synthesizing bijective lenses. Proceedings of the ACM on Programming Languages 2, POPL (2017), 1.
[21]
Shin-Cheng Mu, Zhenjiang Hu, and Masato Takeichi. 2004. An Algebraic Approach to Bi-directional Updating. Springer Berlin Heidelberg, Berlin, Heidelberg, 2–20.
[22]
Shin-Cheng MU, Zhenjiang HU, and Masato TAKEICHI. 2006. Bidirectionalizing Tree Transformation Languages: A Case Study. Computer Software 23, 2 (2006), 129–141.
[23]
Peter-Michael Osera and Steve Zdancewic. 2015. Type-and-example-directed program synthesis. In Proceedings of the 36th ACM SIGPLAN Conference on Programming Language Design and Implementation . ACM.
[24]
Hugo Pacheco, Tao Zan, and Zhenjiang Hu. 2014. BiFluX: A bidirectional functional update language for XML. In Proceedings of the 16th International Symposium on Principles and Practice of Declarative Programming . ACM, 147–158.
[25]
Nadia Polikarpova, Ivan Kuraj, and Armando Solar-Lezama. 2016. Program Synthesis from Polymorphic Refinement Types. In Proceedings of the 37th ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI ’16). ACM.
[26]
Raghu Rajkumar, Nate Foster, Sam Lindley, and James Cheney. 2014. Lenses for web data. Electronic Communications of the EASST 57 (2014).
[27]
Gabriel Scherer and Didier Rèmy. 2015. Which simple types have a unique inhabitant?. In Proceedings of the 18th ACM SIGPLAN International Conference on Functional Programming (ICFP) .
[28]
Seppo Sippu and Eljas Soisalon-Soininen. 1988. Regular Languages. Springer Berlin Heidelberg, Berlin, Heidelberg, 65–114.

Cited By

View all
  • (2022)Synbit: synthesizing bidirectional programs using unidirectional sketchesFormal Methods in System Design10.1007/s10703-023-00436-961:2-3(198-247)Online publication date: 1-Dec-2022
  • (2022)Towards Automatic Synthesis of View Update Programs on RelationsSoftware Foundations for Data Interoperability10.1007/978-3-030-93849-9_6(88-95)Online publication date: 19-Jan-2022
  • (2021)Synbit: synthesizing bidirectional programs using unidirectional sketchesProceedings of the ACM on Programming Languages10.1145/34854825:OOPSLA(1-31)Online publication date: 15-Oct-2021
  • Show More Cited By

Recommendations

Comments

Information & Contributors

Information

Published In

cover image Proceedings of the ACM on Programming Languages
Proceedings of the ACM on Programming Languages  Volume 2, Issue ICFP
September 2018
1133 pages
EISSN:2475-1421
DOI:10.1145/3243631
Issue’s Table of Contents
This work is licensed under a Creative Commons Attribution International 4.0 License.

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 30 July 2018
Published in PACMPL Volume 2, Issue ICFP

Permissions

Request permissions for this article.

Check for updates

Badges

Author Tags

  1. Bidirectional Programming
  2. Program Synthesis
  3. Type Systems
  4. Type-Directed Synthesis

Qualifiers

  • Research-article

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)91
  • Downloads (Last 6 weeks)14
Reflects downloads up to 15 Oct 2024

Other Metrics

Citations

Cited By

View all
  • (2022)Synbit: synthesizing bidirectional programs using unidirectional sketchesFormal Methods in System Design10.1007/s10703-023-00436-961:2-3(198-247)Online publication date: 1-Dec-2022
  • (2022)Towards Automatic Synthesis of View Update Programs on RelationsSoftware Foundations for Data Interoperability10.1007/978-3-030-93849-9_6(88-95)Online publication date: 19-Jan-2022
  • (2021)Synbit: synthesizing bidirectional programs using unidirectional sketchesProceedings of the ACM on Programming Languages10.1145/34854825:OOPSLA(1-31)Online publication date: 15-Oct-2021
  • (2020)Analogy-making as a Core primitive in the software engineering toolboxProceedings of the 2020 ACM SIGPLAN International Symposium on New Ideas, New Paradigms, and Reflections on Programming and Software10.1145/3426428.3426918(101-121)Online publication date: 18-Nov-2020
  • (2020)The Geometry of Syntax and Semantics for Directed File Transformations2020 IEEE Security and Privacy Workshops (SPW)10.1109/SPW50608.2020.00062(284-290)Online publication date: May-2020
  • (2019)Visualization by exampleProceedings of the ACM on Programming Languages10.1145/33711174:POPL(1-28)Online publication date: 20-Dec-2019
  • (2019)Synthesizing symmetric lensesProceedings of the ACM on Programming Languages10.1145/33416993:ICFP(1-28)Online publication date: 26-Jul-2019
  • (2018)Bidirectional evaluation with direct manipulationProceedings of the ACM on Programming Languages10.1145/32764972:OOPSLA(1-28)Online publication date: 24-Oct-2018

View Options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Get Access

Login options

Full Access

Media

Figures

Other

Tables

Share

Share

Share this Publication link

Share on social media