Abstract
The bidirectional transformation has played beneficial roles in broad areas, database management, programming languages and model-driven development after Foster et al. revisited view updating problems introduced by Bancilhon and Spyratos. They introduced the concept of the (asymmetric) lens as a pair of a forward get and a backward put functions to synchronize source data and its view consistently. The consistency of the get and put functions is specified by several lens laws such as the (StrongGetPut), (GetPut), (PutGet) and (PutPut) laws. By combining some of these lens laws, we can represent how consistent a lens is. This chapter introduces 15 lens laws proposed in the literature, with their definitions, motivations and examples. In addition, their precise relationship will be given, such as the fact that one law implies another and that combining two laws is equivalent to combining three others. All implication relations are shown by a diagram, which is complete: every implication among lens laws is derivable by taking their transitive closure; the others have a counterexample. The results can be used to verify the law of desirable lenses quickly.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Similar content being viewed by others
Notes
- 1.
In [3], a lens is said to be undoable when not only (Undoability) but also (PutGet) hold in our terminology.
- 2.
We prefer a shorter name, though it might be called the StrongGetPut family.
References
Bancilhon, F., & Spyratos, N. (1981). Update semantics of relational views. ACM Transactions on Database Systems, 6(4), 557–575. https://doi.org/10.1145/319628.319634
Diskin, Z. (2008). Algebraic models for bidirectional model synchronization. Lecture Notes in Computer ScienceIn K. Czarnecki, I. Ober, J. Bruel, A. Uhl, & M. Völter (Eds.), Model driven engineering languages and systems, 11th international conference, models 2008, Proceedings (Vol. 5301, pp. 21–36). https://doi.org/10.1007/978-3-540-87875-9_2
Maibaum, T., Wassyng, A., Wynn-Williams, S., & Lawford, M. (2018). Assurance via model transformations and their hierarchical refinement. In A. Wasowski & R. F. Paige (Eds.), Proceedings of the 21th ACM/IEEE international conference on model driven engineering languages and systems, models (pp. 426–436). ACM. https://doi.org/10.1145/3239372.3239413
Fischer, S., Hu, Z., & Pacheco, H. (2015a). A clear picture of lens laws - functional pearl. Lecture Notes in Computer Science. In R. Hinze, J. Voigtländer (Eds.), Mathematics of program construction—12th international conference, MPC 2015, proceedings (Vol. 9129, pp. 215–223). https://doi.org/10.1007/978-3-319-19797-5_10
Fischer, S., Hu, Z., & Pacheco, H. (2015b). The essence of bidirectional programming. Science China Information Sciences, 58(5), 1. https://doi.org/10.1007/S11432-015-5316-8
Foster, J. N. (2009). Bidirectional programming languages. Ph.D. thesis, University of Pennsylvania
Foster, J. N., Greenwald, M. B., Moore, J. T., Pierce, B. C., & Schmitt, A. (2007). Combinators for bidirectional tree transformations: A linguistic approach to the view-update problem. ACM Transactions on Programming Languages and Systems, 29(3), 17.
Foster, J. N., Pilkiewicz, A., & Pierce, B. C. (2008). Quotient lenses. In J. Hook & P. Thiemann (Eds.), Proceeding of the 13th ACM SIGPLAN international conference on functional programming, ICFP 2008 (pp. 339–383). ACM. https://doi.org/10.1145/1411204.1411257
Foster, N., Matsuda, K., & Voigtländer, J. (2010). Three complementary approaches to bidirectional programming. Lecture Notes in Computer Science. In J. Gibbons (Ed.), Generic and indexed programming—international spring school, SSGIP 2010 (Vol. 7470, pp. 1–4). https://doi.org/10.1007/978-3-642-32202-0_1
Hashiba, K. (2024). Relations among lens laws for bidirectional transformations consisting of partial functions. Bachelor’s thesis, Tohoku University.
He, X., & Hu, Z. (2018). Putback-based bidirectional model transformations. In G. T. Leavens, A. Garcia, & C. S. Pasareanu (Eds.), Proceedings of the 2018 ACM joint meeting on european software engineering conference and symposium on the foundations of software engineering, ESEC/SIGSOFT FSE 2018 (pp. 434–444). ACM. https://doi.org/10.1145/3236024.3236070
Hidaka, S., Hu, Z., Inaba, K., Kato, H., Matsuda, K., & Nakano, K. (2010). Bidirectionalizing graph transformations. In P. Hudak & S. Weirich (Eds.), Proceeding of the 15th ACM SIGPLAN international conference on Functional programming, ICFP 2010 (pp. 205–216). ACM. https://doi.org/10.1145/1863543.1863573
Hidaka, S., Hu, Z., Inaba, K., Kato, H., & Nakano, K. (2013). GRoundTram: An integrated framework for developing well-behaved bidirectional model transformations. Progress in Informatics, 10, 131–14. https://doi.org/10.2201/NiiPi.2013.10.7, https://www.nii.ac.jp/pi/n10/10_131.html
Hidaka, S., Tisi, M., Cabot, J., & Hu, Z. (2016). Feature-based classification of bidirectional transformation approaches. Software System and Its Models, 15(3), 907–928. https://doi.org/10.1145/1863543.1863573
Hu Z, Ko H (2016) Principles and practice of bidirectional programming in bigul. In: Gibbons J, Stevens P (eds) Bidirectional Transformations - International Summer School, Oxford, UK, July 25-29, 2016, Tutorial Lectures, Springer, Lecture Notes in Computer Science, vol 9715, pp 100–150,https://doi.org/10.1007/978-3-319-79108-1_4
Hu, Z., Mu, S., & Takeichi, M. (2004). A programmable editor for developing structured documents based on bidirectional transformations. In N. Heintze & P. Sestoft (Eds.), Proceedings of the 2004 ACM SIGPLAN workshop on partial evaluation and semantics-based program manipulation, 2004 (pp. 1–178). ACM. https://doi.org/10.1145/1014007.1014025
Ko, H., Zan, T., & Hu, Z. (2016). Bigul: a formally verified core language for putback-based bidirectional programming. In M. Erwig & T. Rompf (Eds.), Proceedings of the 2016 ACM SIGPLAN workshop on partial evaluation and program manipulation, PEPM 2016 (pp. 61–67). ACM. https://doi.org/10.1145/2847538.2847544
Nakano, K. (2021). A tangled web of 12 lens laws. Lecture Notes in Computer ScienceIn S. Yamashita & T. Yokoyama (Eds.), Reversible computation—13th international conference, RC 2021, virtual event, proceedings (Vol. 12805, pp. 185–220). Springer. https://doi.org/10.1007/978-3-030-79837-6_11
Pacheco, H., Zan, T., & Hu, Z. (2014). BiFluX: A bidirectional functional update language for XML. In O. Chitil, A. King, & O. Danvy (Eds.), Proceedings of the 16th international symposium on principles and practice of declarative programming (pp. 1–147). ACM. https://doi.org/10.1145/2643135.2643141
Acknowledgements
The author would like to thank the anonymous reviewers for their valuable comments. This work was supported by JSPS KAKENHI Grant Number JP21K11744.
Author information
Authors and Affiliations
Corresponding author
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2025 The Author(s), under exclusive license to Springer Nature Singapore Pte Ltd.
About this chapter
Cite this chapter
Nakano, K. (2025). Lens Laws Zoo. In: Hu, Z., Onizuka, M., Yoshikawa, M. (eds) Bidirectional Collaborative Data Management. Springer, Singapore. https://doi.org/10.1007/978-981-97-6429-7_3
Download citation
DOI: https://doi.org/10.1007/978-981-97-6429-7_3
Published:
Publisher Name: Springer, Singapore
Print ISBN: 978-981-97-6428-0
Online ISBN: 978-981-97-6429-7
eBook Packages: Computer ScienceComputer Science (R0)