[go: up one dir, main page]
More Web Proxy on the site http://driver.im/ skip to main content
10.1145/1411204.1411257acmconferencesArticle/Chapter ViewAbstractPublication PagesicfpConference Proceedingsconference-collections
research-article

Quotient lenses

Published: 20 September 2008 Publication History

Abstract

There are now a number of BIDIRECTIONAL PROGRAMMING LANGUAGES, where every program can be read both as a forward transformation mapping one data structure to another and as a reverse transformation mapping an edited output back to a correspondingly edited input. Besides parsimony - the two related transformations are described by just one expression - such languages are attractive because they promise strong behavioral laws about how the two transformations fit together - e.g., their composition is the identity function. It has repeatedly been observed, however, that such laws are actually a bit too strong: in practice, we do not want them "on the nose," but only up to some equivalence, allowing inessential details, such as whitespace, to be modified after a round trip. Some bidirectional languages loosen their laws in this way, but only for specific, baked-in equivalences.
In this work, we propose a general theory of QUOTIENT LENSES - bidirectional transformations that are well behaved modulo equivalence relations controlled by the programmer. Semantically, quotient lenses are a natural refinement of LENSES, which we have studied in previous work. At the level of syntax, we present a rich set of constructs for programming with CANONIZERS and for quotienting lenses by canonizers. We track equivalences explicitly, with the type of every quotient lens specifying the equivalences it respects.
We have implemented quotient lenses as a refinement of the bidirectional string processing language Boomerang. We present a number of useful primitive canonizers for strings, and give a simple extension of Boomerang's regular-expression-based type system to statically typecheck quotient lenses. The resulting language is an expressive tool for transforming real-world, ad-hoc data formats. We demonstrate the power of our notation by developing an extended example based on the UniProt genome database format and illustrate the generality of our approach by showing how uses of quotienting in other bidirectional languages can be translated into our notation.

Supplementary Material

JPG File (1411257.jpg)
index.html (index.html)
Slides from the presentation
ZIP File (p383-slides.zip)
Supplemental material for: Quotient lenses
Audio only (1411257.mp3)
Video (1411257.mp4)

References

[1]
Artem Alimarine, Sjaak Smetsers, Arjen van Weelden, Marko van Eekelen, and Rinus Plasmeijer. There and back again: Arrows for invertible programming. In ACM SIGPLAN Workshop on Haskell, pages 86--97, 2005.
[2]
Amos Bairoch, Rolf Apweiler, Cathy H. Wu, Winona C. Barker, Brigitte Boeckmann, Serenella Ferro, Elisabeth Gasteiger, Hongzhan Huang, Rodrigo Lopez, Michele Magrane, Maria J. Martin, Darren A. Natale, Claire O'Donovan, Nicole Redaschi, and Lai. The Universal Protein Resource (UniProt). Nucleic Acids Research, 33 (Database issue):D154--9, January 2005.
[3]
François Bancilhon and Nicolas Spyratos. Update semantics of relational views. ACM Transactions on Database Systems, 6(4):557--575, December 1981.
[4]
Nick Benton. Embedded interpreters. Journal of Functional Programming, 15(4):503--542, 2005.
[5]
Pablo Berdaguer, Alcino Cunha, Hugo Pacheco, and Joost Visser. Coupled schema transformation and data conversion for XML and SQL. In International Symposium on Practical Aspects of Declarative Languages (PADL), Nice France, volume 4354, pages 290--304, 2007.
[6]
Meera Blattner. Single-valued a-transducers. Journal of Computer and System Sciences, 15(3):310--327, 1977.
[7]
Aaron Bohannon, Jeffrey A. Vaughan, and Benjamin C. Pierce. Relational lenses: A language for updateable views. In Principles of Database Systems (PODS), 2006. Extended version available as University of Pennsylvania technical report MS-CIS-05-27.
[8]
Aaron Bohannon, J. Nathan Foster, Benjamin C. Pierce, Alexandre Pilkiewicz, and Alan Schmitt. Boomerang: Resourceful lenses for string data. In ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL), San Francisco, California, January 2008.
[9]
Claus Brabrand, Anders Møller, and Michael I. Schwartzbach. Dual syntax for XML languages. Information Systems, 2007. To appear. Extended abstract in Database Programming Languages (DBPL) 2005.
[10]
A. Cunha, J. N. Oliveira, and J. Visser. Type-safe two-level data transformation. European Symposium on Formal Methods, 4085:284--299.
[11]
Umeshwar Dayal and Philip A. Bernstein. On the correct translation of update operations on relational views. TODS, 7(3):381--416, September 1982.
[12]
David T. Eger. Bit level types, 2005. Manuscript. Available from http://www.yak.net/random/blt/blt-drafts/03/blt.pdf.
[13]
Sander Evers, Peter Achten, and Rinus Plasmeijer. Disjoint forms in graphical user interfaces. In Trends in Functional Programming, volume 5, pages 113--128. Intellect, 2006. ISBN 1-84150-144-1.
[14]
Kathleen Fisher and Robert Gruber. PADS: a domain-specific language for processing ad hoc data. In ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI), Chicago, IL, pages 295--304, 2005.
[15]
J. Nathan Foster, Michael B. Greenwald, Christian Kirkegaard, Benjamin C. Pierce, and Alan Schmitt. Exploiting schemas in data synchronization. Journal of Computer and System Sciences, 73(4):669--689, June 2007a. Extended abstract in Database Programming Languages (DBPL) 2005.
[16]
J. Nathan Foster, Michael B. Greenwald, Jonathan T. Moore, Benjamin C. Pierce, and Alan Schmitt. Combinators for bi-directional tree transformations: A linguistic approach to the view update problem. ACM Transactions on Programming Languages and Systems, 29(3):17, May 2007b. Extended abstract in Principles of Programming Languages (POPL), 2005.
[17]
J. Nathan Foster, Benjamin C. Pierce, and Alexandre Pilkiewicz. Quotient lenses. Technical Report MS-CIS-08-08, Dept. of CIS University of Pennsylvania, 2008.
[18]
Michael Greenberg and Shriram Krishnamurthi. Declarative Composable Views, 2007. Undergraduate Honors Thesis. Department of Computer Science, Brown University.
[19]
Stephen J. Hegner. Foundations of canonical update support for closed database views. In International Conference on Database Theory (ICDT), Paris, France, pages 422--436, New York, NY, USA, 1990. Springer-Verlag New York, Inc. ISBN 0-387-53507-1. URL http://www.cs.umu.se/hegner/Publications/PDF/icdt90.pdf.
[20]
Zhenjiang Hu, Shin-Cheng Mu, and Masato Takeichi. A programmable editor for developing structured documents based on bi-directional transformations. In Partial Evaluation and Program Manipulation (PEPM), pages 178--189, 2004. Extended version to appear in Higher Order and Symbolic Computation, 2008.
[21]
Shinya Kawanaka and Haruo Hosoya. bixid: a bidirectional transformation language for XML. In ACM SIGPLAN International Conference on Functional Programming (ICFP), Portland, Oregon, pages 201--214, 2006.
[22]
Andrew J. Kennedy. Functional pearl: Pickler combinators. Journal of Functional Programming, 14(6):727--739, 2004.
[23]
Dongxi Liu, Zhenjiang Hu, and Masato Takeichi. Bidirectional interpretation of xquery. In ACM SIGPLAN Symposium on Partial Evaluation and Semantics-based Program Manipulation (PEPM), Nice, France, pages 21--30, New York, NY, USA, 2007.
[24]
David Lutterkort. Augeas: A Linux configuration API, February 2007. Available from http://augeas.net/.
[25]
K. Matsuda, Z. Hu, K. Nakano, M. Hamana, and M. Takeichi. Bidirectionalization transformation based on automatic derivation of view complement functions. In ACM SIGPLAN International Conference on Functional Programming (ICFP), volume 42, pages 47--58. ACM Press New York, NY, USA, 2007.
[26]
Lambert Meertens. Designing constraint maintainers for user interaction, 1998. Manuscript.
[27]
Renée J. Miller, Mauricio, A. Hernandez, Laura M. Haas, Lingling Yan, C. T. Howard Ho, Ronald Fagin, and Lucian Popa. The clio project: Managing heterogeneity. 30(1):78--83, March 2001. URL citeseer.nj.nec.com/miller01clio.html.
[28]
Shin-Cheng Mu, Zhenjiang Hu, and Masato Takeichi. An algebraic approach to bi-directional updating. In ASIAN Symposium on Programming Languages and Systems (APLAS), pages 2--20, November 2004.
[29]
Shin-Cheng Mu, Zhenjiang Hu, and Masato Takeichi. Bidirectionalizing tree transformation languages: A case study. JSSST Computer Software, 23(2): 129--141, 2006.
[30]
Norman Ramsey. Embedding an interpreted language using higher-order functions and types. In ACM SIGPLAN Workshop on Interpreters, Virtual Machines and Emulators (IVME), San Diego, CA, pages 6--14, 2003.
[31]
Perdita Stevens. Bidirectional model transformations in QVT: Semantic issues and open questions. In International Conference on Model Driven Engineering Languages and Systems (MoDELS), Nashville, TN, volume 4735 of Lecture Notes in Computer Science, pages 1--15. Springer-Verlag, 2007. ISBN 978-3-540-75208-0.
[32]
Yingfei Xiong, Dongxi Liu, Zhenjiang Hu, Haiyan Zhao, Masato Takeichi, and Hong Mei. Towards automatic model synchronization from model transformations. In IEEE/ACM International Conference on Automated Software Engineering (ASE), Atlanta, Georgia, pages 164--173, 2007.

Cited By

View all

Recommendations

Comments

Please enable JavaScript to view thecomments powered by Disqus.

Information & Contributors

Information

Published In

cover image ACM Conferences
ICFP '08: Proceedings of the 13th ACM SIGPLAN international conference on Functional programming
September 2008
422 pages
ISBN:9781595939197
DOI:10.1145/1411204
  • cover image ACM SIGPLAN Notices
    ACM SIGPLAN Notices  Volume 43, Issue 9
    ICFP '08
    September 2008
    399 pages
    ISSN:0362-1340
    EISSN:1558-1160
    DOI:10.1145/1411203
    Issue’s Table of Contents
Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

Sponsors

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 20 September 2008

Permissions

Request permissions for this article.

Check for updates

Author Tags

  1. bidirectional languages
  2. bijective languages
  3. boomerang
  4. canonizers
  5. equivalences
  6. lenses
  7. regular string transducers
  8. regular types
  9. view update problem

Qualifiers

  • Research-article

Conference

ICFP08
Sponsor:

Acceptance Rates

Overall Acceptance Rate 333 of 1,064 submissions, 31%

Upcoming Conference

ICFP '25
ACM SIGPLAN International Conference on Functional Programming
October 12 - 18, 2025
Singapore , Singapore

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)17
  • Downloads (Last 6 weeks)0
Reflects downloads up to 22 Dec 2024

Other Metrics

Citations

Cited By

View all
  • (2024)Lens Laws ZooBidirectional Collaborative Data Management10.1007/978-981-97-6429-7_3(37-59)Online publication date: 12-Dec-2024
  • (2023)Contract lenses: Reasoning about bidirectional programs via calculationJournal of Functional Programming10.1017/S095679682300005933Online publication date: 6-Nov-2023
  • (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
  • (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
  • (2021)Where-Provenance for Bidirectional Editing in Spreadsheets2021 IEEE Symposium on Visual Languages and Human-Centric Computing (VL/HCC)10.1109/VL/HCC51201.2021.9576272(1-10)Online publication date: 10-Oct-2021
  • (2021)A Tangled Web of 12 Lens LawsReversible Computation10.1007/978-3-030-79837-6_11(185-203)Online publication date: 23-Jun-2021
  • (2020)Applying Bidirectional Transformations to the Design of Interoperable EMR SystemsJournal of Healthcare Informatics Research10.1007/s41666-019-00065-0Online publication date: 22-Jan-2020
  • (2020)Automated Algebraic Reasoning for Collections and Local Variables with LensesRelational and Algebraic Methods in Computer Science10.1007/978-3-030-43520-2_7(100-116)Online publication date: 1-Apr-2020
  • (2019)Narcissus: correct-by-construction derivation of decoders and encoders from binary formatsProceedings of the ACM on Programming Languages10.1145/33416863:ICFP(1-29)Online publication date: 26-Jul-2019
  • (2018)Applicative bidirectional programmingJournal of Functional Programming10.1017/S095679681800009628Online publication date: 21-Jun-2018
  • Show More Cited By

View Options

Login options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Media

Figures

Other

Tables

Share

Share

Share this Publication link

Share on social media