<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.0 20120330//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink">
  <front>
    <journal-meta />
    <article-meta>
      <title-group>
        <article-title>Symmetric c-Lenses and Symmetric d-Lenses are Not Coextensive</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Michael Johnson</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
          <xref ref-type="aff" rid="aff1">1</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>François Renaud</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
          <xref ref-type="aff" rid="aff1">1</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>Macquarie University Sydney</institution>
        </aff>
        <aff id="aff1">
          <label>1</label>
          <institution>Université Catholique de Louvain</institution>
        </aff>
      </contrib-group>
      <fpage>66</fpage>
      <lpage>70</lpage>
      <abstract>
        <p>This short paper addresses a long standing open question about symmetric lenses, with the result succinctly summarised by the paper's title. It has been clear for some years that symmetric lenses of various kinds can be constructed in a systematic way as equivalence classes of spans of asymmetric lenses of corresponding kinds [4]. For example, given a definition of asymmetric delta lens [1], referred to here and elsewhere as a d-lens [3], one can systematically construct a notion of symmetric d-lens [2, 5], and a category whose morphisms are those symmetric d-lenses. Among the d-lenses there are some particularly useful lenses, called c-lenses [7] (and previously known to the mathematical community as split opfibrations) which have an attractive universal property that in many applications corresponds to least change updating. Naturally there has been interest in symmetric c-lenses, which can again be systematically constructed, and which might be expected to have an attractive universal property which could perhaps in applications capture a new notion of least change symmetric lens updating [6]. However, the effects of the universal properties of the component c-lenses of a span of c-lenses occur mainly in the peak of the span, and that corresponds in applications to hidden data. Indeed, it can be shown that every span of c-lenses, viewed as a symmetric lens, is equivalent to a span of d-lenses in which the component d-lenses are not themselves c-lenses. In other words, the behaviour of a symmetric c-lens can always be obtained from a span of lenses which themselves do not have the c-lens universal property. And that raises the until now open question of whether there are in fact any differences at all between symmetric c-lenses and symmetric d-lenses. In this paper we show that a span of c-lenses does have a weak symmetric lens universal property, and that there are spans of d-lenses that do not exhibit this property, establishing that there are symmetric d-lenses which never arise as symmetric c-lenses. In mathematical terms: We look at spans of functors (G; D) with common domain R, and the induced relation (R; G; D) between the codomain categories. We discuss properties of these relations that are satisfied when the legs of the span are opfibrations. More precisely when the left leg G admits a splitting, the relation admits an induced so called a left-right behaviour . Roughly it associates a related morphism on the right to a given morphism on the left. If the splitting is opfibrant then given a factorization on the left, whose composite is related to a morphism on the right, there is a related factorization on the right built from the left-right behaviour and the universal property of the left leg G. We build a counter-example showing that such a factorization on the right cannot always be obtained from a factorization on the left when G is not opfibrant.</p>
      </abstract>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>Introduction</title>
      <p>Let R and G be categories and R G / G be a functor between them.
2.1</p>
      <sec id="sec-1-1">
        <title>Splittings and Opfibrations</title>
        <p>Definition 2.1. Assuming that all our categories are conveniently small, a splitting P for the functor G is a
family (Px)x2Ob(R) of functions, indexed by the objects x of R, between unions of homsets with fixed domain:
G(G(x); )</p>
        <p>Px / R(x; )
The notation R(x; ) denotes the union Sy2Ob(R) R(x; y), and similarly G(G(x); ) = Sz2Ob(G) G(G(x); z). The
image Px(f ) of a morphism f with domain G(x) is called the lifting of f at x (by P ) and is required to satisfy
G(Px(f )) = f .</p>
        <p>Moreover a splitting is required to satisfy:
1. identities of G are lifted to identities of R;
2. if f and g are composable morphisms in G with liftings Px(f ) with codomain y say, and Py(g), then the
composite of the liftings, Py(g)Px(f ), is equal to the lifting of the composite, Px(gf ).
morphism x</p>
      </sec>
      <sec id="sec-1-2">
        <title>Definition 2.2. A morphism x</title>
        <p>g
morphism y t0 / z in R such that g = t0f and G(t0) = t:</p>
        <p>/ y in R is said to be opcartesian (with respect to G) if for any other
/ z such that there exists a morphism G(y) t / G(z) in G with G(g) = tG(f ), there is a unique
if</p>
        <p>G(x)</p>
        <p>G(z)
6 O</p>
        <p>t
/ G(y)
then
x
g
f
6 zO
/ y
t0</p>
      </sec>
      <sec id="sec-1-3">
        <title>Definition 2.3.</title>
        <p>f
G(x)
/ y in G admits an opcartesian lifting x</p>
        <p>The functor G is said to be an opfibration if for every object x in R, each morphism
f0</p>
        <p>/ y0 (i.e. an opcartesian arrow f 0 such that G(f 0) = f ).</p>
        <p>Moreover a splitting P for an opfibration G is a splitting in the sense of Definition 2.1 such that all liftings
by P are opcartesian.</p>
        <p>The above definitions give precise mathematical representations of d-lenses and c-lenses: d-lenses R G
/ G
are splittings, and c-lenses R G / G are split opfibrations.
2.2</p>
        <p>Spans, Relations, and Left-Right Behaviours
Given again categories R and G and R G / G a functor between them, let D be another category and R D
another functor so that we have the span (R; G; D):
/ D
f
G(g)
G(f)</p>
        <p>R
G</p>
        <p>D
G
z
$</p>
        <p>D
Definition 2.4. We define the relation (R; G; D) between G and D associated to the span (G; D) as follows.</p>
        <p>Two objects x in G and y in D are defined to be related xRy if and only if there is w in R such that G(w) = x
and D(w) = y. We then call w the witness and we sometimes include w in the notation by writing xRwy.</p>
        <p>The relation on morphisms is defined similarly.</p>
        <p>Of course we have that if f Rqg then the domains and codomains of f and g are related by (R; G; D) with
witnesses the domain and codomain of q. Also xRy if and only if idx R idy.</p>
        <p>Definition 2.5. Left-right behaviour of (R; G; D):</p>
        <p>Given an object x in R we have G(x)RxD(x), and then G(x) and D(x) are called synchronized states.</p>
        <p>f
Then consider a morphism G(x)</p>
        <p>/ y , which we may call a change of state in G, from G(x) to y.</p>
        <p>We say that (R; G; D) has a left-right behaviour if for each such choice of x and f , there is a
corresponding synchronisation in D, i.e. there is a given morphism (change of state) (f; x) of D with domain
D(x) and such that f R (f; x).</p>
        <p>One can define a right-left behaviour of a span similarly.</p>
        <p>Suppose that G admits a splitting P . Then there exists an induced left-right behaviour, denoted P ,
defined, for x and f as before, by the lifting of f , x Px(f)/ y0 in R, which yields a common change of state in R.</p>
        <p>It then suffices to take the image by D in order to obtain the synchronisation D(x) P (f;x)..=D(Px(f))/ D(y) .</p>
        <p>When G and D are both d-lenses, the induced left-right behaviour corresponds to the forward propagation of
the corresponding symmetric d-lens, and similarly, the induced right-left behaviour corresponds to the backward
propagation.
2.3</p>
        <p>Weakly Opcartesian Behaviours
We identify now a property of behaviours of (R; G; D) which is not necessarily satisfied in general but which is
always satisfied when G is an opfibration.</p>
        <p>Definition 2.6. Suppose that (R; G; D) has both a given left-right behaviour and a given right-left behaviour
. We define what it means for to be weakly opcartesian with respect to .</p>
        <p>Let G(x)RxD(x) be synchronized states and let G(x)
forward behaviour to D(x)
(f;x)</p>
        <p>/ D(y0) .</p>
        <p>Consider a change of state D(x) k / z in D, which is carried by the backward behaviour to (k; x):
f
/ y be a change of state which is carried by the
Now suppose that there exists a morphism y l / G(z00) such that (k; x) = lf , we then say that is weakly
opcartesian with respect to if and only if for each such x, f , k and l, there is an induced l0 in D such
that lRl0 and k = l0 (f; x):</p>
        <p>G(x)
G(x)
(k;x)</p>
        <p>f
(k;x)
f
6
G(z00)</p>
        <p>/ y
G(z00)
6 O
/ y
l</p>
        <p>D(x)</p>
        <p>k
(f;x)</p>
        <p>5 z
/ D(y0):
D(x)</p>
        <p>k
(f;x)
5 zO</p>
        <p>l0
/ D(y0)
Remark 2.7. One may want to think of Definition 2.6 as a particular instance of the property of (R; G; D)
which we call left-right-compatible with factorizations: if kRk0 and k factorizes as k = lf in G, then there
are l0 and f 0 in D such that lRl0, f Rf 0 and l0f 0 = k0.</p>
        <p>Now symmetric lenses are equivalence classes of spans of asymmetric lenses, and it is important to note
that the induced left right behaviour is an invariant of the equivalence. Indeed, the reason the equivalence was
introduced for symmetric lenses was because differences that aren’t visible in left-right or right-left behaviours
are irrelevant for symmetric lenses.</p>
        <p>Thus, if a span of lenses induces a left-right behaviour which is weakly opcartesian with respect to its
rightleft behaviour , then any equivalent span of lenses also exhibits a left-right behaviour that is weakly opcartesian
with respect to its right-left behaviour. In other words, the left-right behaviour being weakly opcartesian with
respect to the right-left behaviour is an invariant among representatives of the equivalence class.
3</p>
      </sec>
    </sec>
    <sec id="sec-2">
      <title>Observations</title>
      <p>Lemma 3.1. Given (R; G; D), if G is an opfibration and P is a splitting for it in the sense of Definition 2.3,
while D is a functor and S is a splitting for it (so in the sense of Definition 2.1), then the induced left-right
behaviour P , is weakly opcartesian with respect to the induced right-left behaviour S .</p>
      <p>Proof. Given a synchronization G(x)RxD(x) and a morphism k : D(x) ! z in D, if S (k) factorizes as ts in
G, then by the universal property of the opcartesian lifting Px(s) of s, there is an induced t0, as in the diagram
below, such that G(t0) = t. Taking the image by D then concludes the proof:</p>
      <p>G(x)</p>
      <p>S(k;x)
s</p>
      <p>G(y)
6 O
/ z
t
yields
x</p>
      <p>Sx(k)</p>
      <p>Px(s)
7 yO
/ z0
t0
and thus</p>
      <p>D(x)
k
P (s;x)
z = D(y)
5 O</p>
      <p>D(t0)
/ D(z0)
Counter-example 3.2. Consider the categories R, G, D, and the functors G, D illustrated in the diagram
below. ; u</p>
      <p>G(y)</p>
      <p>G(f)=G(l) 5 O G(t)
G(x)</p>
      <p>G(s)
/ G(z)
y
x
G
l
f
s
5 y</p>
      <p>O t
/ z</p>
      <p>D
%</p>
      <p>D(x)</p>
      <p>D(l)</p>
      <p>D(f)
D(s)
:
D(u)
5 D(O yD)(t)
/ D(z)</p>
      <p>We observe that the relation (R; G; D) is not left-right-compatible with factorizations since G(l) admits a
factorization through G(s) but D(l) does not factorize through D(s). Also G and D may be equipped with
splittings, but G cannot be an opfibration since s, the only possible lifting of G(s), is not opcartesian. Under
Definition 2.1 there can in this case be only one choice of a splitting for each functor. The splitting of G, P say,
gives us an induced left-right behaviour P , and the splitting of D, S say, gives us an induced right-left behaviour
S .</p>
      <p>The left-right behaviour P is not weakly opcartesian with respect to S .
4</p>
    </sec>
    <sec id="sec-3">
      <title>Conclusion</title>
      <p>We have just provided a relatively simple counterexample to resolve a longstanding open question. The question
was whether the symmetric lenses obtained as equivalence classes of spans of c-lenses, and those obtained as
equivalence classes of spans of d-lenses were in fact different.</p>
      <p>If the counterexample is so simple, why has it taken so long? It is the theoretical work of this paper that
makes the above span of d-lenses into a counterexample. The difficulty is a common problem: Proving that there
is no span of c-lenses that is equivalent to the span of d-lenses shown above is, a priori, very difficult. What we
have done in this short paper is identify a property of a span of c-lenses that is also present in all equivalent spans
of d-lenses. Since that property is not exhibited by the span of d-lenses above, that span cannot be equivalent
to any span of c-lenses, thus resolving the question and showing that c-lenses and d-lenses are not coextensive.</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          [1]
          <string-name>
            <surname>Diskin</surname>
            ,
            <given-names>Z.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Xiong</surname>
            ,
            <given-names>Y.</given-names>
          </string-name>
          and
          <string-name>
            <surname>Czarnecki</surname>
            ,
            <given-names>K.</given-names>
          </string-name>
          (
          <year>2011</year>
          )
          <article-title>From State- to Delta-Based Bidirectional Model Transformations: the Asymmetric Case</article-title>
          ,
          <source>Journal of Object Technology</source>
          <volume>10</volume>
          ,
          <fpage>1</fpage>
          -
          <lpage>25</lpage>
          . doi:
          <volume>10</volume>
          .5381/jot.
          <year>2011</year>
          .
          <volume>10</volume>
          .1.a6
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          [2]
          <string-name>
            <given-names>Zinovy</given-names>
            <surname>Diskin</surname>
          </string-name>
          , Yingfei Xiong, Krzysztof Czarnecki, Hartmut Ehrig, Frank Hermann and Francesco
          <string-name>
            <surname>Orejas</surname>
          </string-name>
          (
          <year>2011</year>
          ) From State- to
          <source>Delta-Based Bidirectional Model Transformations: the Symmetric Case. Lecture Notes in Computer Science</source>
          <volume>6981</volume>
          ,
          <fpage>304</fpage>
          -
          <lpage>318</lpage>
          . doi:
          <volume>10</volume>
          .1007/978-3-
          <fpage>642</fpage>
          -24485-8-22
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          [3]
          <string-name>
            <surname>Johnson</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          and
          <string-name>
            <surname>Rosebrugh</surname>
            ,
            <given-names>R.</given-names>
          </string-name>
          (
          <year>2013</year>
          )
          <article-title>Delta lenses and opfibrations</article-title>
          .
          <source>Proceedings of the 2nd International Workshop on Bidirectional Transformations, Rome Electronic Communications of the EASST</source>
          <volume>57</volume>
          ,
          <year>18pp</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          [4]
          <string-name>
            <surname>Johnson</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          and
          <string-name>
            <surname>Rosebrugh</surname>
            ,
            <given-names>R.</given-names>
          </string-name>
          (
          <year>2016</year>
          )
          <article-title>Unifying set-based, delta-based and edit-based lenses</article-title>
          .
          <source>Proceedings of the 5th International Workshop on Bidirectional Transformations, Eindhoven CEUR Proceedings 1571</source>
          ,
          <fpage>1</fpage>
          -
          <lpage>13</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          [5]
          <string-name>
            <surname>Johnson</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          and
          <string-name>
            <surname>Rosebrugh</surname>
            ,
            <given-names>R.</given-names>
          </string-name>
          (
          <year>2017</year>
          )
          <article-title>Symmetric delta lenses and spans of asymmetric delta lenses</article-title>
          .
          <source>Journal of Object Technology</source>
          ,
          <volume>16</volume>
          ,
          <issue>2</issue>
          :
          <fpage>1</fpage>
          -
          <lpage>32</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          [6]
          <string-name>
            <surname>Johnson</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          and
          <string-name>
            <surname>Rosebrugh</surname>
            ,
            <given-names>R.</given-names>
          </string-name>
          (
          <year>2017</year>
          )
          <article-title>Universal updates for symmetric lenses</article-title>
          .
          <source>CEUR Proceedings</source>
          <year>1827</year>
          ,
          <fpage>39</fpage>
          -
          <lpage>53</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          [7]
          <string-name>
            <surname>Johnson</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Rosebrugh</surname>
            ,
            <given-names>R.</given-names>
          </string-name>
          and
          <string-name>
            <surname>Wood</surname>
            ,
            <given-names>R. J.</given-names>
          </string-name>
          (
          <year>2012</year>
          )
          <article-title>Lenses, fibrations and universal translations</article-title>
          .
          <source>Mathematical Structures in Computer Science</source>
          <volume>22</volume>
          ,
          <fpage>25</fpage>
          -
          <lpage>42</lpage>
          .
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>