Distributing Commas, and the Monad of Anchored Spans

Spans are pairs of arrows with a common domain. Despite their symmetry, spans are frequently viewed as oriented transitions from one of the codomains to the other codomain. The transition along an oriented span might be thought of as transitioning backwards along the first arrow (sometimes called ‘leftwards’) and then, having reached the common domain, forwards along the second arrow (sometimes called ‘rightwards’). Rightwards transitions and their compositions are wellunderstood. Similarly, leftwards transitions and their compositions can be studied in detail. And then, with a little hand-waving, a span is ‘just’ the composite of two well-understood transitions — the first leftwards, and the second rightwards. In this paper we note that careful treatment of the sources, targets and compositions of leftwards transitions can be usefully captured as a monad L built using a comma category construction. Similarly the sources, targets and compositions of rightwards transitions form a monad R, also built using a comma category construction. Our main result is the development of a distributive law, in the sense of Beck [3] but only up to isomorphism, distributing L over R. Such a distributive law makes RL a monad, the monad of anchored spans, thus removing the hand-waving referred to above, and establishing a precise calculus for span-based transitions. As an illustration of the applicability of this analysis we use the new monad RL to recast and strengthen a result in the study of databases and the use of lenses for view updates.

[1]  Michael Johnson,et al.  Algebras and Update Strategies , 2010, J. Univers. Comput. Sci..

[2]  Stephen J. Hegner,et al.  An Order-Based Theory of Updates for Closed Database Views , 2004, Annals of Mathematics and Artificial Intelligence.

[3]  Michael Johnson,et al.  View Updatability Based on the Models of a Formal Specification , 2001, FME.

[4]  Hartmut Ehrig,et al.  On Propagation-Based Concurrent Model Synchronization , 2013, Electron. Commun. Eur. Assoc. Softw. Sci. Technol..

[5]  Michael Johnson,et al.  Entity-relationship-attribute designs and sketches , 2002 .

[6]  Michael Johnson,et al.  Spans of Delta Lenses , 2015, Bx@STAF.

[7]  Michael Barr,et al.  Category theory for computing science , 1995, Prentice Hall International Series in Computer Science.

[8]  Michael Johnson,et al.  Lenses, fibrations and universal translations† , 2011, Mathematical Structures in Computer Science.

[9]  Michael Johnson,et al.  Delta Lenses and Opfibrations , 2013, Electron. Commun. Eur. Assoc. Softw. Sci. Technol..

[10]  Nicolas Spyratos,et al.  Update semantics of relational views , 1981, TODS.

[11]  R. Rosebrugh,et al.  Lens put-put laws: monotonic and mixed , 2012, Electron. Commun. Eur. Assoc. Softw. Sci. Technol..

[12]  Benjamin C. Pierce,et al.  Basic category theory for computer scientists , 1991, Foundations of computing.

[13]  Krzysztof Czarnecki,et al.  From State- to Delta-Based Bidirectional Model Transformations: the Asymmetric Case , 2011, J. Object Technol..

[14]  Michael Johnson,et al.  Spans of lenses , 2014, EDBT/ICDT Workshops.

[15]  Ross Street,et al.  Fibrations and Yoneda's lemma in a 2-category , 1974 .

[16]  Michael Johnson,et al.  Fibrations and universal view updatability , 2007, Theor. Comput. Sci..

[17]  Michael Johnson,et al.  Lens put-put laws: monotonic and mixed , 2012 .