Generic and Indexed Programming pp 1-46

Part of the Lecture Notes in Computer Science book series (LNCS, volume 7470) | Cite as

Three Complementary Approaches to Bidirectional Programming

  • Nate Foster
  • Kazutaka Matsuda
  • Janis Voigtländer

Abstract

This paper surveys three distinct approaches to bidirectional programming. The first approach, syntactic bidirectionalization, takes a program describing the forward transformation as input and calculates a well-behaved reverse transformation. The second approach, semantic bidirectionalization, is similar, but takes the forward transformation itself as input rather than a program describing it. It requires the transformation to be a polymorphic function and uses parametricity and free theorems in the proof of well-behavedness. The third approach, based on bidirectional combinators, focuses on the use of types to ensure well-behavedness and special constructs for dealing with alignment problems. In presenting these approaches, we pay particular attention to use of complements, which are structures that represent the information discarded by the transformation in the forward direction.

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. 1.
    Abbott, M., Altenkirch, T., Ghani, N.: Categories of Containers. In: Gordon, A.D. (ed.) FOSSACS 2003. LNCS, vol. 2620, pp. 23–38. Springer, Heidelberg (2003)CrossRefGoogle Scholar
  2. 2.
    Bancilhon, F., Spyratos, N.: Update semantics of relational views. ACM Transactions on Database Systems 6(4), 557–575 (1981), doi:10.1145/319628.319634MATHCrossRefGoogle Scholar
  3. 3.
    Barbosa, D., Cretin, J., Foster, J.N., Greenberg, M., Pierce, B.: Matching lenses: Alignment and view update. In: Proceedings of International Conference on Functional Programming. SIGPLAN Notices, vol. 45(9), pp. 193–204. ACM (2010), doi:10.1145/1932681.1863572Google Scholar
  4. 4.
    Benton, N.: Embedded interpreters. Journal of Functional Programming 15(4), 503–542 (2005), doi:10.1017/S0956796804005398MathSciNetMATHCrossRefGoogle Scholar
  5. 5.
    Berdaguer, P., Cunha, A., Pacheco, H., Visser, J.: Coupled Schema Transformation and Data Conversion for XML and SQL. In: Hanus, M. (ed.) PADL 2007. LNCS, vol. 4354, pp. 290–304. Springer, Heidelberg (2006)CrossRefGoogle Scholar
  6. 6.
    Bohannon, A., Vaughan, J., Pierce, B.: Relational lenses: A language for updateable views. In: Proceedings of Principles of Database Systems, pp. 338–347. ACM (2006), doi:10.1145/1142351.1142399Google Scholar
  7. 7.
    Bohannon, A., Foster, J., Pierce, B., Pilkiewicz, A., Schmitt, A.: Boomerang: Resourceful lenses for string data. In: Proceedings of Principles of Programming Languages. SIGPLAN Notices, vol. 43(1), pp. 407–419. ACM (2008), doi:10.1145/1328897.1328487Google Scholar
  8. 8.
    Brabrand, C., Møller, A., Schwartzbach, M.: Dual syntax for XML languages. Information Systems 33(4–5), 385–406 (2008), doi:10.1016/j.is.2008.01.006CrossRefGoogle Scholar
  9. 9.
    Comon, H., Dauchet, M., Gilleron, R., Löding, C., Jacquemard, F., Lugiez, D., Tison, S., Tommasi, M.: Tree automata techniques and applications (2007), http://tata.gforge.inria.fr/ (release October 12, 2007)
  10. 10.
    Cosmadakis, S., Papadimitriou, C.: Updates of relational views. Journal of the ACM 31(4), 742–760 (1984), doi:10.1145/1634.1887MathSciNetMATHCrossRefGoogle Scholar
  11. 11.
    Cunha, J., Saraiva, J., Visser, J.: From spreadsheets to relational databases and back. In: Proceedings of Partial Evaluation and Program Manipulation, pp. 179–188. ACM (2009), doi:10.1145/1480945.1480972Google Scholar
  12. 12.
    Czarnecki, K., Foster, J.N., Hu, Z., Lämmel, R., Schürr, A., Terwilliger, J.F.: Bidirectional Transformations: A Cross-Discipline Perspective. In: Paige, R.F. (ed.) ICMT 2009. LNCS, vol. 5563, pp. 260–283. Springer, Heidelberg (2009)CrossRefGoogle Scholar
  13. 13.
    Dayal, U., Bernstein, P.: On the correct translation of update operations on relational views. ACM Transactions on Database Systems 7(3), 381–416 (1982), doi:10.1145/319732.319740MathSciNetMATHCrossRefGoogle Scholar
  14. 14.
    Diskin, Z., Xiong, Y., Czarnecki, K.: From State- to Delta-Based Bidirectional Model Transformations. In: Tratt, L., Gogolla, M. (eds.) ICMT 2010. LNCS, vol. 6142, pp. 61–76. Springer, Heidelberg (2010)CrossRefGoogle Scholar
  15. 15.
    Ennals, R., Gay, D.M.: Multi-language Synchronization. In: De Nicola, R. (ed.) ESOP 2007. LNCS, vol. 4421, pp. 475–489. Springer, Heidelberg (2007)CrossRefGoogle Scholar
  16. 16.
    Fegaras, L.: Propagating updates through XML views using lineage tracing. In: Proceedings of International Conference on Data Engineering, pp. 309–320. IEEE (2010), doi:10.1109/ICDE.2010.5447896Google Scholar
  17. 17.
    Fisher, K., Gruber, R.: PADS: A domain-specific language for processing ad hoc data. In: Proceedings of Programming Language Design and Implementation. SIGPLAN Notices, vol. 40(6), pp. 295–304. ACM (2005), doi:10.1145/1064978.1065046Google Scholar
  18. 18.
    Foster, J., Pierce, B.: Boomerang Programmer’s Manual (2009), http://www.seas.upenn.edu/~harmony/
  19. 19.
    Foster, J., Greenwald, M., Kirkegaard, C., Pierce, B., Schmitt, A.: Exploiting schemas in data synchronization. Journal of Computer and System Sciences 73(4), 669–689 (2007), doi:10.1016/j.jcss.2006.10.024MathSciNetMATHCrossRefGoogle Scholar
  20. 20.
    Foster, J., Greenwald, M., Moore, J., Pierce, B., Schmitt, A.: Combinators for bidirectional tree transformations: A linguistic approach to the view-update problem. ACM Transactions on Programming Languages and Systems 29(3), 17 (2007), doi:10.1145/1232420.1232424CrossRefGoogle Scholar
  21. 21.
    Foster, J., Pilkiewicz, A., Pierce, B.: Quotient lenses. In: Proceedings of International Conference on Functional Programming, vol. 43(9), pp. 383–395. ACM (2008), doi:10.1145/1411203.1411257Google Scholar
  22. 22.
    Foster, J., Pierce, B., Zdancewic, S.: Updatable security views. In: Proceedings of Computer Security Foundations, pp. 60–74. IEEE (2009), doi:10.1109/CSF.2009.25Google Scholar
  23. 23.
    Gibbons, J., Oliveira, B.: The essence of the iterator pattern. Journal of Functional Programming 19(3–4), 377–402 (2009), doi:10.1017/S0956796809007291MathSciNetMATHCrossRefGoogle Scholar
  24. 24.
    Hegner, S.: An order-based theory of updates for closed database views. Annals of Mathematics and Artificial Intelligence 40(1–2), 63–125 (2004), doi:10.1023/A:1026158013113MathSciNetMATHCrossRefGoogle Scholar
  25. 25.
    Hidaka, S., Hu, Z., Inaba, K., Kato, H., Matsuda, K., Nakano, K.: Bidirectionalizing graph transformations. In: Proceedings of International Conference on Functional Programming. SIGPLAN Notices, vol. 45(9), pp. 205–216. ACM (2010), doi:10.1145/1932681.1863573Google Scholar
  26. 26.
    Hofmann, M., Pierce, B., Wagner, D.: Symmetric lenses. In: Proceedings of Principles of Programming Languages. SIGPLAN Notices, vol. 46(1), pp. 371–384. ACM (2011), doi:10.1145/1925844.1926428Google Scholar
  27. 27.
    Hu, Z., Iwasaki, H., Takeichi, M., Takano, A.: Tupling calculation eliminates multiple data traversals. In: Proceedings of International Conference on Functional Programming. SIGPLAN Notices, vol. 32(8), pp. 164–175. ACM (1997), doi:10.1145/258949.258964Google Scholar
  28. 28.
    Hu, Z., Mu, S.-C., Takeichi, M.: A programmable editor for developing structured documents based on bidirectional transformations. Higher-Order and Symbolic Computation 21(1–2), 89–118 (2008), doi:10.1007/s10990-008-9025-5MATHCrossRefGoogle Scholar
  29. 29.
    Jay, C.: A semantics for shape. Science of Computer Programming 25(2–3), 251–283 (1995), doi:10.1016/0167-6423(95)00015-1MathSciNetMATHCrossRefGoogle Scholar
  30. 30.
    Jeuring, J., Leather, S., Pedro Magalhães, J., Rodriguez Yakushev, A.: Libraries for Generic Programming in Haskell. In: Koopman, P., Plasmeijer, R., Swierstra, D. (eds.) AFP 2008. LNCS, vol. 5832, pp. 165–229. Springer, Heidelberg (2009)CrossRefGoogle Scholar
  31. 31.
    Kawanaka, S., Hosoya, H.: biXid: a bidirectional transformation language for XML. In: Proceedings of International Conference on Functional Programming. SIGPLAN Notices, vol. 41(9), pp. 201–214. ACM (2006), doi:10.1145/1160074.1159830Google Scholar
  32. 32.
    Laurent, D., Lechtenbörger, J., Spyratos, N., Vossen, G.: Monotonic complements for independent data warehouses. The VLDB Journal 10(4), 295–315 (2001), doi:10.1007/s007780100055MATHCrossRefGoogle Scholar
  33. 33.
    Lechtenbörger, J., Vossen, G.: On the computation of relational view complements. ACM Transactions on Database Systems 28(2), 175–208 (2003), doi:10.1145/777943.777946CrossRefGoogle Scholar
  34. 34.
    Lutterkort, D.: Augeas—A configuration API. In: Proceedings of Linux Symposium, pp. 47–56 (2008)Google Scholar
  35. 35.
    Matsuda, K., Hu, Z., Nakano, K., Hamana, M., Takeichi, M.: Bidirectionalization transformation based on automatic derivation of view complement functions. In: Proceedings of International Conference on Functional Programming. SIGPLAN Notices, vol. 42(9), pp. 47–58. ACM (2007), doi:10.1145/1291220.1291162Google Scholar
  36. 36.
    Matsuda, K., Hu, Z., Takeichi, M.: Type-based specialization of XML transformations. In: Proceedings of Partial Evaluation and Program Manipulation, pp. 61–72. ACM (2009), doi:10.1145/1480945.1480955Google Scholar
  37. 37.
    Meertens, L.: Designing constraint maintainers for user interaction (1998), Manuscript, ftp://ftp.kestrel.edu/pub/papers/meertens/dcm.ps
  38. 38.
    Miller, R., Hernandez, M., Haas, L., Yan, L., Ho, C., Fagin, R., Popa, L.: The Clio project: Managing heterogeneity. SIGMOD Record 30(1), 78–83 (2001), doi:10.1145/373626.373713CrossRefGoogle Scholar
  39. 39.
    Pacheco, H., Cunha, A.: Generic Point-free Lenses. In: Bolduc, C., Desharnais, J., Ktari, B. (eds.) MPC 2010. LNCS, vol. 6120, pp. 331–352. Springer, Heidelberg (2010)CrossRefGoogle Scholar
  40. 40.
    Pacheco, H., Cunha, A.: Calculating with lenses: Optimising bidirectional transformations. In: Proceedings of Partial Evaluation and Program Manipulation, pp. 91–100. ACM (2011), doi:10.1145/1929501.1929520Google Scholar
  41. 41.
    Perumalla, K., Fujimoto, R.: Source-code transformations for efficient reversibility. Technical Report GIT-CC-99-21, College of Computing, Georgia Tech. (1999)Google Scholar
  42. 42.
    Ramsey, N.: Embedding an interpreted language using higher-order functions and types. In: Proceedings of Interpreters, Virtual Machines and Emulators, pp. 6–14. ACM (2003), doi:10.1145/858570.858571Google Scholar
  43. 43.
    Schürr, A.: Specification of Graph Translators with Triple Graph Grammars. In: Mayr, E.W., Schmidt, G., Tinhofer, G. (eds.) WG 1994. LNCS, vol. 903, pp. 151–163. Springer, Heidelberg (1995)CrossRefGoogle Scholar
  44. 44.
    Stevens, P.: Bidirectional Model Transformations in QVT: Semantic Issues and Open Questions. In: Engels, G., Opdyke, B., Schmidt, D.C., Weil, F. (eds.) MODELS 2007. LNCS, vol. 4735, pp. 1–15. Springer, Heidelberg (2007)CrossRefGoogle Scholar
  45. 45.
    Voigtländer, J.: Bidirectionalization for free! In: Proceedings of Principles of Programming Languages. SIGPLAN Notices, vol. 44(1), pp. 165–176. ACM (2009), doi:10.1145/1594834.1480904Google Scholar
  46. 46.
    Voigtländer, J., Hu, Z., Matsuda, K., Wang, M.: Combining syntactic and semantic bidirectionalization. In: Proceedings of International Conference on Functional Programming. SIGPLAN Notices, vol. 45(9), pp. 181–192. ACM (2010), doi:10.1145/1932681.1863571Google Scholar
  47. 47.
    Wadler, P.: Theorems for free! In: Proceedings of Functional Programming Languages and Computer Architecture, pp. 347–359. ACM (1989), doi:10.1145/99370.99404Google Scholar
  48. 48.
    Wadler, P.: Deforestation: Transforming programs to eliminate trees. Theoretical Computer Science 73(2), 231–248 (1990), doi:10.1016/0304-3975(90)90147-AMathSciNetMATHCrossRefGoogle Scholar
  49. 49.
    Wang, M., Gibbons, J., Matsuda, K., Hu, Z.: Gradual Refinement: Blending Pattern Matching with Data Abstraction. In: Bolduc, C., Desharnais, J., Ktari, B. (eds.) MPC 2010. LNCS, vol. 6120, pp. 397–425. Springer, Heidelberg (2010)CrossRefGoogle Scholar
  50. 50.
    Wang, M., Gibbons, J., Wu, N.: Incremental updates for efficient bidirectional transformations. In: Proceedings of International Conference on Functional Programming. SIGPLAN Notices, vol. 46(9), pp. 392–403. ACM (2011), doi:10.1145/2034574.2034825Google Scholar
  51. 51.
    Xiong, Y., Liu, D., Hu, Z., Zhao, H., Takeichi, M., Mei, H.: Towards automatic model synchronization from model transformations. In: Proceedings of Automated Software Engineering, pp. 164–173. ACM (2007), doi:10.1145/1321631.1321657Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2012

Authors and Affiliations

  • Nate Foster
    • 1
  • Kazutaka Matsuda
    • 2
  • Janis Voigtländer
    • 3
  1. 1.Cornell UniversityUSA
  2. 2.Tohoku UniversityJapan
  3. 3.University of BonnGermany

Personalised recommendations