skip to main content
research-article
Open Access
Artifacts Available
Artifacts Evaluated & Functional

Synthesizing quotient lenses

Published:30 July 2018Publication History
Skip Abstract Section

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.

Skip Supplemental Material Section

Supplemental Material

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 .Google ScholarGoogle Scholar
  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. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. Claus Brabrand, Anders Møller, and Michael I. Schwartzbach. 2008. Dual Syntax for XML Languages. Inf. Syst. 33, 4-5 (June 2008). Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. James Cheney. 2008. FLUX: functional updates for XML. In ACM Sigplan Notices, Vol. 43. ACM, 3–14. Google ScholarGoogle ScholarDigital LibraryDigital Library
  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. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. Alcino Cunha. 2010. A relational approach to bidirectional transformations. (2010).Google ScholarGoogle Scholar
  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. Google ScholarGoogle ScholarDigital LibraryDigital Library
  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) . Google ScholarGoogle ScholarDigital LibraryDigital Library
  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). Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. J. Nathan Foster, Alexandre Pilkiewicz, and Benjamin C. Pierce. 2008. Quotient Lenses. SIGPLAN Not. 43, 9 (Sept. 2008), 383–396. Google ScholarGoogle ScholarDigital LibraryDigital Library
  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.Google ScholarGoogle Scholar
  12. Sumit Gulwani. 2011. Automating string processing in spreadsheets using input-output examples. In ACM SIGPLAN Notices, Vol. 46. ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library
  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) . Google ScholarGoogle ScholarDigital LibraryDigital Library
  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. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. Martin Hofmann, Benjamin Pierce, and Daniel Wagner. 2011. Symmetric lenses. In ACM SIGPLAN Notices, Vol. 46. ACM, 371–384. Google ScholarGoogle ScholarDigital LibraryDigital Library
  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. Google ScholarGoogle ScholarDigital LibraryDigital Library
  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. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. David Lutterkort. 2008. Augeas–a configuration API. In Linux Symposium, Ottawa, ON. 47–56.Google ScholarGoogle Scholar
  19. Kazutaka Matsuda and Meng Wang. 2013. FliPpr: A prettier invertible printing system. In European Symposium on Programming . Springer, 101–120. Google ScholarGoogle ScholarDigital LibraryDigital Library
  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. Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. Shin-Cheng Mu, Zhenjiang Hu, and Masato Takeichi. 2004. An Algebraic Approach to Bi-directional Updating. Springer Berlin Heidelberg, Berlin, Heidelberg, 2–20.Google ScholarGoogle Scholar
  22. Shin-Cheng MU, Zhenjiang HU, and Masato TAKEICHI. 2006. Bidirectionalizing Tree Transformation Languages: A Case Study. Computer Software 23, 2 (2006), 129–141.Google ScholarGoogle Scholar
  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. Google ScholarGoogle ScholarDigital LibraryDigital Library
  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. Google ScholarGoogle ScholarDigital LibraryDigital Library
  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. Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. Raghu Rajkumar, Nate Foster, Sam Lindley, and James Cheney. 2014. Lenses for web data. Electronic Communications of the EASST 57 (2014).Google ScholarGoogle Scholar
  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) . Google ScholarGoogle ScholarDigital LibraryDigital Library
  28. Seppo Sippu and Eljas Soisalon-Soininen. 1988. Regular Languages. Springer Berlin Heidelberg, Berlin, Heidelberg, 65–114.Google ScholarGoogle Scholar

Index Terms

  1. Synthesizing quotient lenses

      Recommendations

      Comments

      Login options

      Check if you have access through your login credentials or your institution to get full access on this article.

      Sign in

      Full Access

      PDF Format

      View or Download as a PDF file.

      PDF

      eReader

      View online with eReader.

      eReader
      About Cookies On This Site

      We use cookies to ensure that we give you the best experience on our website.

      Learn more

      Got it!