<!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>
      <journal-title-group>
        <journal-title>Uppsala, Sweden, April</journal-title>
      </journal-title-group>
    </journal-meta>
    <article-meta>
      <contrib-group>
        <aff id="aff0">
          <label>0</label>
          <institution>Danel Ahman Laboratory for Foundations of Computer Science, University of Edinburgh 10 Crichton Street, Edinburgh EH8 9LE, United Kingdom Tarmo Uustalu Dept. of Software Science, Tallinn University of Technology Akadeemia tee 21B</institution>
          ,
          <addr-line>12168 Tallinn</addr-line>
          ,
          <country country="EE">Estonia</country>
        </aff>
      </contrib-group>
      <pub-date>
        <year>2017</year>
      </pub-date>
      <volume>29</volume>
      <issue>2017</issue>
      <abstract>
        <p>We show how \taking updates seriously" leads from state-based lenses to update lenses and further; we witness a little hierarchy of types of lens that arises in a systematic way. Lenses of each type are characterized either as coalgebras of certain types of comonads or morphisms between certain types of comonads. In each case, a lens is simulation between two transition systems for suitable notions of transition system and simulation.</p>
      </abstract>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>Introduction</title>
      <p>a dependently-typed coupdate comonad. We introduce dependently-typed update lenses as coalgebras of such
comonads. In Section 5, we introduce a further generalization, called update-update lenses, where source states
have their own enabled updates, and applying a view update to a source state goes via
rst translating it into
a source update and then applying that. We show that update-update lenses are morphisms between coupdate
comonads. In Section 6, we compare update-update lenses to delta lenses and categorical lenses. Finally, in
Section 7, we brie y describe the related work, to conclude in Section 8.</p>
      <p>Some additional material appears in appendices. In Appendix A, we brie y review comonads, comonad
coalgebras and comonad morphisms. In Appendix B, we prove the bijection between coalgebras of a given
comonad and morphisms from costate comonads to this comonad.</p>
      <sec id="sec-1-1">
        <title>Finally, in Appendix C, we de ne and</title>
        <p>compare cofunctors and op brations.</p>
        <p>In the main part of the paper, we assume the reader to know basic category theory. While this includes the
basics of comonads, we still give the main de nitions in Appendix A for reference. We assume no knowledge
about containers or directed containers, introducing them in Section 4, where they are rst needed. We provide
no proofs in the main part of the paper, but prove the central proposition in Appendix B.
2</p>
      </sec>
    </sec>
    <sec id="sec-2">
      <title>State-Based Lenses</title>
      <p>We will consider three types of asymmetric lens in this paper: state-based lenses, update lenses, and
updateupdate lenses (the latter being an original contribution of this paper). They have a lot in common.</p>
      <p>Any type of asymmetric lens is about two evolving databases, the source database and view (target) database.
At any moment, both databases are in some state and the two states must be consistent, i.e., be in a certain
relation. If the view state is changed, it must be possible to change also the source state in such a way that
consistency is re-established. Reasonably, this notion of simulation of the view database by the source database
should be compositional in the sense that i) no view change should induce no source change and ii) the composition
of two view changes should induce the composition of the two induced source changes. In the types of lens that
we consider, the two databases operate generally on two di erent sets of states, and the consistency relation is
functional, in other words, the graph of a function extracting a view state from a source state.</p>
      <p>The simplest type of lens we consider is state-based lenses in the sense of the very well-behaved lenses of</p>
      <sec id="sec-2-1">
        <title>Foster et al. [F+07].</title>
        <p>The distinctive feature of state-based lenses is that the view state can be changed to any other view state and,
moreover, the only thing identifying a view change (besides the current view state) is the new view state: view
changes are unconstrained and, we might say, extensional. The same is true about source changes|they are
likewise unconstrained and extensional|but of course a source change simulating a view change must re-establish
consistency.</p>
      </sec>
      <sec id="sec-2-2">
        <title>The o cial de nition of state-based lenses is as follows.</title>
        <p>Let S0 and S be two sets (of source resp. view states). A (very well-behaved) state-based lens from S0 to S is
given by two maps get : S0 ! S and put : S0</p>
        <sec id="sec-2-2-1">
          <title>S ! S0 such that</title>
          <p>get (put (s0; s0)) = s0
s0 = put (s0; get s0)
put (put (s0; s0); s00) = put (s0; s00)
The map get is there to determine the view state corresponding to the current source state (de nes the consistency
relation between source and view states). The map put takes the current source state, the next view state and
returns the next source state (de nes simulation of view changes). The 1st equation asserts that consistency is
restored in simulation. The 2nd and 3rd equations establish that simulation is compositional.</p>
          <p>Pictorially, consistency and simulation are illustrated by the following diagram.</p>
          <p>s0
get
put
.&amp; s
Simulation means that, given a source state s0 and a view state s that are consistent (get s0 = s), any change of the
view state, i.e., a new view state s0, induces a change of the source state, i.e., a new source state s00 =df put (s0; s0),
so that consistency is re-established (we have get s00 = get (put (s0; s0)) = s0).</p>
          <p>As an example, consider two versions of a simple bookshop database. The sets of source and view states are
S0 =df book ) N</p>
          <p>N</p>
          <p>S =df book ) N
The idea is that a source state is an association to every book (from some xed list) of a price and a quantity
(stock level); and a view state is an association to every book of just a price. The get operation corresponds to
discarding the quantity of each book; the put operation changes the prices of all books leaving the quantities
unchanged:
get s0 =df b: fst (s0 b)</p>
          <p>put (s0; s) =df b: (s b; snd (s0 b))</p>
          <p>State-based lenses can be characterized in two ways in terms of costate comonads (a.k.a. array comonads),
using comonad coalgebras or comonad morphisms. The coalgebraic characterization is due to Power and
Shkaravska [PS04] and O'Connor [OCo11].</p>
          <p>The costate comonad for a set S (of states) is the comonad de ned by</p>
          <p>DX =df S
(S ) X)
"X (s; v) =df v s</p>
          <p>X (s; v) =df (s; s0: (s0; s00: v s00))</p>
          <p>First, there is a bijection between state-based lenses between S0 and S, and coalgebras of the costate monad
for S with S0 as the carrier, i.e., a maps
: S0 ! S
(S ) S0)
satisfying some equations.</p>
          <p>On the level of data, this bijection is only about straightforward packing of the data of a lens into one datum
with currying and pairing. Given a coalgebra structure , we obtain the lens data by taking
get s0 =df fst ( s0)</p>
          <p>put (s0; s0) =df snd ( s0) s0
Conversely, given a state-based lens (get; put), the coalgebra structure datum is</p>
          <p>s0 =df (get s0; s0: put (s0; s0))
But the lens equations also imply the coalgebra equations and vice versa.</p>
          <p>Second, there is also a bijection between state-based lenses between S0 and S, and comonad morphisms
between the costate comonads for S0 and S, i.e., natural transformations with components
X : S0
(S0 ) X) ! S
(S ) X)
satisfying some equations.</p>
          <p>The second characterization follows from the rst thanks to a general fact that we also use later. For any
comonad D, there is a bijection between coalgebras of the comonad D with set S0 as the carrier, and comonad
morphisms between the costate comonad for S0 and the comonad D. Given a coalgebra structure : S0 ! D S0,
the corresponding comonad morphism is given by X (s0; v) =df D v ( s0). Given a comonad morphism ,
the corresponding coalgebra structure is s0 =df S0 (s0; idS0 ). We provide a full proof of this proposition in
Appendix B.
3</p>
        </sec>
      </sec>
    </sec>
    <sec id="sec-3">
      <title>Simply-Typed Update Lenses</title>
      <p>We proceed to update lenses, as de ned by Ahman and Uustalu [AU14a]. We rst consider a simpler special
case of the concept and then, in the next section, the fully general version.</p>
      <p>As we saw, in a state-based lens, a view change is a just a move to a freely chosen next state. In an update
lens, we are in a richer situation. There is a dedicated set of view updates; any view update is applicable to
the current view state and gives the next view state. There is a distinguished trivial view update (which incurs
no update on the current view state) and any two view updates can be composed into a single view update (so
that applying the composite view update to the current state has the same e ect as applying
rst the
rst view
update to the current state and then the second view update to the next state). Not every view state needs to be
accessible from the current one by applying a view update and some view states may be accessed by several view
updates. In other words, in contrast to state-based lenses, changes of view states are generally constrained and
intensional. A move to a new view state must be simulatable by a move to a new source state so that consistency
is restored. However, there is no separate set of source updates; one could say that view updates also double as
source updates.</p>
      <sec id="sec-3-1">
        <title>Update lenses are mathematically de ned as follows. We recall that a monoid is a set P with an element o : P and a map : P</title>
        <sec id="sec-3-1-1">
          <title>P ! P such that</title>
          <p>that
state.</p>
          <p>Recall also that a right action of a monoid (P; o; ) on a set S is a map # : S</p>
        </sec>
        <sec id="sec-3-1-2">
          <title>P ! S satisfying</title>
          <p>Now, let S0 be a set (of source states). Moreover, let S be another set (of view states), (P; o; ) be a monoid
typed) update lens between S0 and (S; P; #; o; ) is given by two maps get : S0 ! S and pput : S0
(of view updates), and # a right action of (P; o; ) on S (application of a view update to a view state). A
(simplyP ! S0 such
p
o
o = p
p = p
(p
p0)
p00 = p
(p0</p>
          <p>p00)
s # o = s
s0 =df s # p). The move from s to s0 is simulated by a move from s0 to s00 where s00 is de ned by the map pput
(i.e., s00 =df pput (s0; p)). Again the role of the 1st equation is to assert that consistency is restored in simulation,
and the 2nd and 3rd equations stipulate compositionality of simulation.
as in the previous section. As the monoid of view updates we use the free monoid on the set book
We can modify the bookshop example to obtain an update lens. Let S0 =df book ) N
N and S =df book ) N</p>
          <p>Z, i.e.,
P =df (book</p>
          <p>Z)
o =df []
=df ++
so a view update is a sequence of price changes to books.
de ned as follows.</p>
          <p>The get operation is de ned as before. Application of view updates to view states and to source states is
s # []
s # ((b; c) :: p)
pput (s0; [])
pput (s0; (b; c) :: p)
=df
=df
=df
v
v
=df ( b0: if b0 = b then max (0; s b0 + c) else s b0) # p</p>
          <p>pput ( b0: if b0 = b then (max (0; fst (s0 b0) + c); snd (s0 b0)) else s0 b0; p)</p>
          <p>One might complain that the concept of update lens is a bit of an exaggeration, since, by the de nition we
have given, an update lens for (S; P; #; o; ) is nothing but a (P; o; )-set (S0; pput) (i.e., a set S0 and a right
action pput of (P; o; ) on S0; this is stated by the 2nd and 3rd equations) together with a (P; o; )-set morphism
get between (S0; pput) and (S; #) (stated by the 1st equation). Yet, we claim that update lenses make enough
practical sense and have enough theoretical signi cance to deserve attention, both in the special form we are
discussing here as well as in the general form that we will consider in the next section.</p>
          <p>One argument in defense of update lenses for theory is that, similarly to state-based lenses, update lenses are
characterizable as comonad coalgebras and as comonad morphisms. The coalgebraic characterization is due to
Ahman and Uustalu [AU14a].</p>
          <p>Both characterizations use coupdate comonads. Any set S (of states), monoid (P; o; ) (of updates) and right
action # of (P; o; ) on S (application of an update to a state), de ne a comonad, which we call the coupdate
comonad for (S; P; #; o; ), by</p>
          <p>D X =df S
(P ) X)
"X (s; v) =df v o</p>
          <p>X (s; v) =df (s; p: (s # p; p0: v (p
p0)))</p>
          <p>We have: First, update lenses between S0 and (S; P; #; o; ) are in a bijection with coalgebras of the update
comonad for (S; P; #; o; ) with S0 as the carrier.</p>
          <p>Second, they are also in a bijection with comonad morphisms between the costate comonad for S0 and the
coupdate comonad for (S; P; #; o; ). This an immediate consequence of the rst characterization thanks to the
same bijection between coalgebras of a given comonad and morphisms from costate comonads to this comonad
that we exploited in the previous section.</p>
          <p>A big di erence of coupdate comonads from costate comonads is that coupdate comonads are compatible
compositions of simpler comonads. Costate comonads admit no similar decomposition.</p>
          <p>Given a set S, we have the coreader comonad de ned by</p>
          <p>D0 X =df S</p>
          <p>X
"0X (s; x) =df x</p>
          <p>X0 (s; x) =df (s; (s; x))
Given a monoid (P; o; ), we have the cowriter comonad de ned by</p>
          <p>D1 X =df P ) X
"1X v =df v o</p>
          <p>X1 v =df p: p0: v (p
p0)
Right actions of (P; o; ) on S are in a bijective correspondence with distributive laws of the comonad D0 over
the comonad D1. As a consequence, coupdate comonads for (S; P; #; o; ) are in a bijection with compatible
compositions of the comonads D0 and D1.</p>
          <p>This composite nature of coupdate comonads leads to a number of further characterizations of update lenses,
e.g., as pairs of comonad coalgebras, comonad-monad bialgebras (pairs of a comonad coalgebra and a monad
algebra) etc. Those are beyond the scope of this paper; we refer the interested reader to [AU14a] for a detailed
account of them.
4</p>
        </sec>
      </sec>
    </sec>
    <sec id="sec-4">
      <title>Dependently-Typed Update Lenses</title>
      <p>In the type of update lenses that we considered in the previous section, view updates were always applicable
and always composable. This may be unrealistic and is an unnecessary restriction. A generalization of update
lenses from the previous section xes this issue. Instead of a set, monoid and right action, we need to describe
the view database in terms of a directed container.</p>
      <p>Containers were introduced by Abbott et al. [AAG05] as a representation for a wide class of set functors
(datatypes) in terms of sets and positions. Directed containers [ACU14] are containers with additional structure.
They characterize those containers whose interpretation as a set functor carries a comonad structure.</p>
      <p>A container is a set S (of shapes / or, in our application, states) and, for any s : S, a set P s (of positions in
the shape s / updates applicable to the state s)1. A directed container is a container (S; P ) equipped with maps
# : ( s : S: P s) ! S (the subshape corresponding to a position in a shape / application of an update to a
state),
1We originally adopted the letters S and P as mnemonics for shapes and positions, but coincidentally they also work perfectly
for states and 'pdates.</p>
      <p>o : s:S : P s (the root position / the trivial update), and</p>
      <p>: s:S : ( p : P s: P (s # p)) ! P s (translation of a position in a position's subshape / composition of two
updates)
We notice that the data and equations of a directed container are like those of a set, monoid and a right action,
modulo the presence of the \minor" (subscripted) arguments and the dependent typing. In particular, if P s, os,
and p s p0 do not actually depend on s, then we indeed have a set, monoid and right action.</p>
      <p>A container (S; P ) de nes a set functor JS; P Kc =df D, called its interpretation, by</p>
      <p>D X =df s : S: P s ) X
Given a directed container structure (#; o; ) on the container, this functor obtains a comonad structure de ned
by
"X (s; v) =df v os</p>
      <p>X (s; v) =df (s; p: (s # p; p0: v (p
s p0)))
We call the comonad JS; P; #; o; Kdc =df (D; "; ) the interpretation of (S; P; #; o; ). We could also call it the
(dependently-typed) coupdate comonad for (S; P; #; o; ). Not unexpectedly, the dependently-typed concept is
de ned in exactly the same way as its simply-typed counterpart from the previous section, modulo the presence
of the minor arguments and dependent typing.</p>
      <p>Any comonad structure ("; ) on a set functor D that is the interpretation of some container (S; P ) (i.e.,
D X = s : S: P s ) X) arises from a directed container structure (#; o; ) on (S; P ). In fact, directed container
structures on (S; P ) and comonad structures on D are in a bijection. Given a comonad structure ("; ), the
corresponding directed container structure is de ned by
os =df "P s (s; id)
s # p =df fst (snd ( P s (s; id)) p)
p
s p0 =df snd (snd ( P s (s; id)) p) p0</p>
      <p>Directed containers are in a bijection up to isomorphism with small categories. Given a directed container
(S; P; #; o; ), the corresponding small category is obtained as follows. The set of objects is S. The set of maps
with domain s : S is P s, which means that the total set of maps is P =df s : S: P s and the domain of a map
(s; p) : P is src p =df s. The codomain of a map (s; p) : P is tgt p =df s # p. The identity map on an object s is
ids =df (s; os) and the 1st directed container equation ensures that its codomain is s, as required. A map (s; p) can
only be composed with a map (s0; p0), if s # p = s0, in which case the composition is (s; p); (s0; p0) =df (s; p s p0).
By the 2nd directed container equation the codomain of this map is (s # p) # p0 = s0 # p0, as required. The 3rd
to the 5th equations ensure that composition is unital and associative.</p>
      <sec id="sec-4-1">
        <title>We are ready to de ne dependently-typed update lenses.</title>
        <p>Let S0 be a set (of source states). Let (S; P; #; o; ) be a directed container (of view states and view updates,
together with view update application). A (dependently-typed) update lens between S0 and (S; P; #; o; ) is given
by two maps get : S0 ! S and pput : ( s0 : S0: P (get s0)) ! S0 satisfying</p>
        <p>s0 = pput (s0; oget s0 )
pput (pput (s0; p); p0) = pput (s0; p
Again the only di erence from the simply-typed concept of the previous section is the presence of minor arguments
and dependent typing.</p>
        <p>But exactly this di erence makes the idea of updates enabled in a state work. Consider again the picture
from the previous section. It is still valid.</p>
        <p>s0</p>
        <p>Given a consistent pair of a current source state s0 and view state s (i.e., s = get s0), view updates applicable to
s come from the set P s = P (get s0). The operation pput, which is supplied the current source state s0 and an
applicable view update p, must pick the next source state s00 consistently with the next view state s0 # p. The</p>
        <p>We can modify the bookshop example from the previous section as follows to obtain a dependently-typed
update lens. We de ne P as an inductive family by the rules</p>
        <p>remain de ned essentially as before. Also # and pput can be de ned like before, but
comparison with 0 is no longer necessary. A view update is only applicable to a view state, if the aggregate price
change to each book is not too negative.</p>
        <p>Not surprisingly, it remains true in the dependently-typed case that update lenses between S0 and (S; P; #; o; )
are in a bijection with coalgebras of the coupdate comonad for (S; P; #; o; ) with S0 as the carrier. And likewise
they are in a bijection with comonad morphisms between the costate comonad for S0 and the coupdate comonad
for (S; P; #; o; ) with S0.
container S =df (S; P; #; o; ) by choosing</p>
        <p>Let us now compare state-based and update lenses. Any set S can be canonically extended into a directed
P s =df S
s # s0 =df s0
os =df s
s0
s s00 =df s00
In the directed container S , updates are just states and applying an update (state) to the current state means
moving to that state. Viewed as small category, S</p>
        <p>is the codiscrete category with S as the set of objects, i.e.,
the category with exactly one map (s; s0) between any two objects s and s0. In the next section, we shall see
that S</p>
        <p>has a simple universal property.</p>
        <p>It is easy to verify that the costate comonad for S is equal to the coupdate comonad for S .</p>
        <p>As a result, coalgebras for the two comonads are on the nose the same thing, which in turn means that
state-based lenses between S0 and S, and update lenses between S0 and S
are essentially the same thing.</p>
        <p>In other words, costate comonads are a special case of (dependently typed) coupdate comonads and state-based
lenses are a special case of (dependently-typed) update lenses.</p>
        <p>We note that this is not achievable with simply-typed coupdate comonads: there is no way to see the costate
comonad for S as a simply-typed coupdate comonad, unless the set of view states S is a singleton. If S has
multiple elements, we would need a di erent os = s for every s : S, and we are not allowed this in the simply-typed
format.</p>
        <p>But in one respect, we should point out, simply-typed coupdate comonads are more well-behaved than
dependently-typed coupdate comonads: the former are compatible compositions of simpler comonads, but the
latter are generally not. A decomposition is possible in terms of two relative comonads though.
5</p>
      </sec>
    </sec>
    <sec id="sec-5">
      <title>Update-Update Lenses</title>
      <sec id="sec-5-1">
        <title>In update lenses, we have rst-class view updates, but no dedicated source updates. Instead, view updates double as source updates. This restriction can be lifted. We now proceed to the third type of lens of this paper, that we call update-update lenses. In an update-update lens, we have both view updates and source updates.</title>
        <p>Simulation means nding, given a view update applicable to the current view state, a source update applicable
to the current source state so that the next source state will be consistent with the next view state.</p>
        <p>We will see that an update-update lens is exactly a morphism between directed containers.
We therefore begin by de ning morphisms of containers and morphisms of directed containers.</p>
        <p>A container morphism between two containers (S0; P0) and (S; P ) is given by maps t : S0 ! S (the shape
map) and q : s0:S0 : P (t s0) ! P0 s0 (the position map). A directed container morphism between two directed
containers (S0; P0; #0; o0; 0) and (S; P; #; o; ) is a morphism (t; q) between the underlying containers satisfying
t (s0 #0 qs0 p)) = t s0 # p
If (t; q) is a morphism between directed containers (S0; P0; #0; o0; 0) and (S; P; #; o; ), then is a comonad
morphism between JS0; P0; #0; o0; 0Kdc =df (D0; "0; 0) and JS; P; #; o; Kdc =df (D; "; ); we de ne Jt; qKdc =df .</p>
        <p>Any natural transformation between the interpretations D0 and D of two containers (S0; P0) and (S; P ) is
an interpretation of a unique container morphism, namely (t; q) where
t s0 =df fst ( P s0 (s0; p0: p0))
qs0 p =df snd ( P s0 (s0; p0: p0)) p
If is a comonad morphism between the interpretations (D0; "0; 0) and (D; "; ) of two directed containers
(S0; P0; #0; o0; 0) and (S; P; #; o; ), then (t; q) is a directed container morphism interpreting to .</p>
        <p>Containers and containers morphisms form a monoidal category Cont, interpretation of containers is a
fully faithful monoidal functor from Cont to [Set; Set]. Directed containers and directed container
morphisms form a category DCont, interpretation of directed containers is fully faithful functor from DCont
to Comonad(Set). In fact, DCont is isomorphic to the category Comonoid(Cont) and is the pullback in
CAT of U : Comonad(Set) ! [Set; Set] along J Kc : Cont ! [Set; Set].</p>
        <p>While directed containers are in a bijection up to isomorphism with small categories, the category of directed
containers is not equivalent to the category of small categories. Directed container morphism are not at all like
functors between small categories, they are quite di erent. They turn out to map to what Aguiar [Agu97] termed
cofunctors, but with the source and target categories switched. We give the de nition.</p>
        <p>A cofunctor between small categories (S; P ; src; tgt; id; ;) and (S0; P0; src0; tgt0; id0; ;0) is given by two maps
t : S0 ! S (the object map) and q : ( s0 : S0: p : P : t s0 = src p) ! P0 (the morphism map) satisfying
src0 (q (s0; p)) = s0 and
t (tgt0 (q (s0; p))) = tgt p</p>
        <p>id0s0 = q (s0; idt s0 )
q (s0; p) ;0 q (tgt0 (q (s0; p)); p0) = q (s0; p ; p0)
While a functor maps objects and maps of the source category to those in the target category, a cofunctor's
object map is from the target category to the source category, but the morphism map is still from the source to
the target category. A cofunctor looks a bit like an opcleavage, but it is not one. We will comment on the exact
di erences in the next section.</p>
        <p>The category DCont of directed containers is equivalent to the opposite category of the category Cat of
small categories and cofunctors. Given a directed container morphism (t; q), the corresponding cofunctor is (t; q)
where q is de ned by q (s0; (t s0; p)) =df (s0; qs0 p).</p>
        <p>In the previous section, we discussed the construction of the directed container S0 from a set S0. The
corresponding small category was the codiscrete category on S0. Now that we have xed what we want to
consider as morphisms between directed containers, we can say that this directed container is the free directed
container on S0, or, as a small category, the free object in (Cat)op on S0. It is also at the same time the cofree
small category (in the sense of being the cofree object in Cat) on S0. (Note that in the rst case, we consider
small categories and cofunctors, in the second case, small categories and functors.)</p>
      </sec>
      <sec id="sec-5-2">
        <title>We are all set to de ne update-update lenses.</title>
        <p>An update-update lens between two directed containers (S0; P0; #0; o0; 0) and (S; P; #; o; ) (for source states,
updates and update application resp. view states, updates and update application) is given by two maps
get : S0 ! S and pbwd : s0:S0 : P (get s0) ! P0 s0 such that
get (s0 #0 pbwds0 p)) = get s0 # p
In other words, an update-update lens is just a directed container morphism, we only renamed t to get and q to
pbwd. Or, we could also say, it is a cofunctor.</p>
        <p>Consistency and simulation in an update-update lens are illustrated in this picture.</p>
        <p>s0
p0 rz
source state s00 =df s0 #0 p0 and this is stipulated by the 1st equation.</p>
        <p>If the current source and view state are s0 and s =df get s0, then a view update p applicable to s is simulated by
an update p0 =df pbwds0 p applicable to s0. The next view state s0 =df s # p must be consistent with the next</p>
        <p>There are a many ways to modify the bookshop example to yield an update-update lens. Recall that in the
book a price and quantity, and a view state only a price. Here are some possibilities.
previous sections we had S0 =df book ) N</p>
        <p>N and S =df book ) N, with a source state associating to every
(i) Take P s =df (book</p>
        <p>Z) with the intent that a view update is an (unsafe) sequence of book and price
change pairs, and take P0 s0 =df (book
(Z + Z))</p>
        <p>with the intent that a source update is an association of
an (unsafe) price or quantity change for every book. The function pbwd would be the obvious embedding of
P (get s0) in P0 s0.</p>
        <p>pbwd []</p>
        <p>=df []
pbwd ((b; c) :: p)</p>
        <p>=df ((b; inl c) :: pbwd p
(ii) Let P remain as in (i), but take P0 s0 =df book ) Z</p>
        <p>Z, with the idea that a source update is an association
of a price change and quantity change to every book. The function pbwd should then aggregate the price changes
for every book by summing them up; the quantity change of every book should be 0.</p>
        <p>pbwd []
pbwd ((b; c) :: p)
=df
=df
b0: (0; 0)
b0: (if b0 = b then fst (pbwd p b0) + c else fst (pbwd p b0); 0)
(iii) Let P0 remain as in (i), but take P s =df (book</p>
      </sec>
      <sec id="sec-5-3">
        <title>Z&lt;0) , so a view update is a sequence of book and</title>
        <p>negative price change pairs. pbwd remains essentially as in (i).
are in a bijection with the comonad morphisms between the corresponding two coupdate comonads.</p>
        <p>Directed container theory tells us that update-update lenses between (S0; P0; #0; o0; 0) and (S; P; #; o; )</p>
      </sec>
      <sec id="sec-5-4">
        <title>There no characterization of update-update lenses with comonad coalgebras similar to those of state-based lenses or update lenses, because the rst comonad is a coupdate comonad and not a costate comonad.</title>
        <p>(S; P; #; o;</p>
        <p>). In this way, update lenses are a special case of update-update lenses.</p>
        <p>Because the costate comonad for a set S0 equals the coupdate comonad for the free directed container
S0 , update lenses between S0 and (S; P; #; o; ) are the same thing as update-update lenses between S
0 and</p>
        <p>Update lenses can be seen as a special case of update-update lenses also in another way. Given an update
lens (get; pput) between S0 and (S; P; #; o; ), we can equip S0 with a directed container structure by
P s0 =df P (get s0)
s0 #0 p0 =df pput (s0; p0)
o0s0 =df oget s0
p0 0s0 p00 =df p0 get s0 p0o
intuition that, in an update lens, view updates double as source updates.</p>
        <p>We then have the update-update lens (get; pbwd) where pbwds0 p =df p. This construction substantiates the</p>
      </sec>
    </sec>
    <sec id="sec-6">
      <title>Comparison to Delta Lenses and Category Lenses</title>
      <p>Let us compare very brie y the update-update lenses introduced in the previous section to Diskin et al.'s delta
lenses [DXC11] and Johnson et al.'s category lenses [JRW12].</p>
      <p>Common to all three is that there are not only view updates, but also source updates. A big di erence is
that update-update lenses have only backward-pushing of updates (view updates are mapped to source updates,
depending on the current source state). In delta and category lenses, updates can also be pushed forward; there
is a map sending source updates to view updates.</p>
      <p>For the sake of comparison, we present the de nitions of delta and category lenses in terms of directed
containers.</p>
      <p>Given two directed containers (S0; P0; #0; o0; 0) and (S; P; #; o; ) (for source states, updates and update
application, resp. view states, updates and update application). A delta lens is given by maps get : S0 ! S,
pfwd : s0:S0 : P0 s0 ! P (get s0), and pbwd : s0:S0 : P (get s0) ! P0 s0 satisfying
get s0 # pfwds0 p0 = get (s0 #0 p0)</p>
      <p>oget s0 = pfwds0 o0s0
pfwds0 p0 get s0 pfwds0#0p0 p00 = pfwds0 (p0 0s0 p00)
get (s0 #0 pbwds0 p) = get s0 # p</p>
      <p>o0s0 = pbwds0 oget s0
(The 2nd and 4th equation here are in fact derivable from the others.) It is immediate from this de nition, that a
delta lens is an update-update lens with additional structure. pfwd simulates a source update by a view update.
The 7th equation says that simulation of a view update p by a source update p0 by pbwd must be \correct" in
the sense that pfwd must simulate p0 by the same view update p.</p>
      <p>In terms of small categories, we do not only have a cofunctor (get; pbwd) from the target category to the source
category in a delta lens, but also a functor (get; pfwd) from the source category to the target category, with the
same object mapping get. Composition of pfwd after pbwd must be identity. A structure like this could be
called a splitting pre-opcleavage (where we say `pre-' to express that have waived the standard opCartesianness
requirement on the lifts pbwds0 p).</p>
      <p>A category lens is a delta lens with an additional map
ll : s0:S0 :
p:P (get s0): ( p0 : P0 s0: p0 : P (get s0 # p): pfwds0 p0 = p
get s0 p0) ! P0 (s0 #0 pbwds0 p)
satisfying
Intuitively, in a category lens, simulation of a view update by a source update causes least change to the source
state. Suppose we are simulating a view update p : P (get s0) consistent with some source state s0 : S0. The
simulating source update is pbwds0 p : P0 s0. Suppose we have some other source update p0 : P0 s0 for the same
source state s0 whose view simulation pfwds0 p0 : P (get s0) factors through p, i.e., pfwds0 p0 = p p0 for some
p0. Then, on the source side, p0 factors through pbwds0 p, as we have pbwds0 p 0 lls0;p (p0; p0) = p0, moreover
this is the unique such factoring of p0.</p>
      <p>In terms of small categories, a category lens is a splitting opcleavage. The additional data and equations
assure that the lifts pbwds0 p are opCartesian.</p>
      <p>We would like to argue that although pfwd can serve as a kind of quality yardstick of pbwd, it can often be
unnatural from the applications viewpoint to require the map pfwd. It is easy to construct meaningful
updateupdate lenses that are not delta lenses. The presence of an operation pfwd forces that all source updates, even
those not in the range of pbwd, must be simulable as view updates, which makes it impossible to accommodate
example (iii) from the previous section: the equation get s0 # pfwds0 p0 = get (s0 #0 p0) cannot be met. The
equation pfwds0 (pbwds0 p) = p can only hold when pbwd is injective, which rules out example (ii) from the
previous section.</p>
      <p>But any update lens can be considered as a delta lens, by using its view updates also as source updates (i.e.,
P0 s0 =df P (get s0), pbwds0 p =df p, and s0 #0 p =df pput (s0; p)). It is then also a category lens.</p>
      <p>In contrast, when we consider the source states of an update lens as its source updates (i.e., P0 s0 =df S0,
pbwds0 p =df pput (s0; p), and s0 #0 s00 =df s00), then the update lens is generally not a delta lens. Indeed, since,
for any s0, s0 , we have s0 #0 s00 = s0 , we must also have get s0 # pfwds0 s00 = get s00. But there may well exist
0 0
source states s0, s00 for which there is no view update p : P (get s0) satisfying get s0 # p = get s00.</p>
      <p>On the theoretical side, state-based lenses, update lenses, and update-update lenses admit concise
characterizations as comonad morphisms. We do not know whether something similar is also achievable for delta or
category lenses.
7</p>
    </sec>
    <sec id="sec-7">
      <title>Related Work</title>
      <p>The literature on lenses has grown quite large. As this paper is on notions of asymmetric lens, where one
distinguishes between a source database and a view (target) database, we only discuss works on those, to explain
how the di erent strands of study developed and cross-fertilized.</p>
      <p>State-based lenses were introduced by Foster et al. [F+07]. Two ner concepts of lens relying on rst-class
state changes or deltas, namely, delta lenses and categorical lenses, were introduced independently by Diskin et
al. [DXC11] and Johnson et al. [JRW12]. Johnson and Rosebrugh [JR13] worked out the interrelationship of
these two concepts. To be able to compare the di erent types of asymmetric lens to Hofmann et al.'s [HPW12]
on (symmetric) edit lenses, Johnson and Rosebrugh [JR16] introduced a yet di erent variation, asymmetric edit
lenses.</p>
      <p>Power and Shkaravska [PS04] and O'Connor [OCo11] were probably the rst to notice that state-based lenses
are the same as coalgebras of costate comonads. Johnson et al. [JRW10] at the same time promoted an algebraic
characterization of state-based lenses. Gibbons and Johnson [GJ12] explained why both are possible by showing
that they are directly interderivable.</p>
      <p>Containers as a useful \syntax" for a wide class of set functors were introduced by Abbott et al. [AAG05].
Directed containers as characterization of those containers whose endofunctor interpretation carries a comonad
structure were introduced by Ahman et al. [ACU14]. In a later work [AU16], they noticed that directed containers
are the same as categories whereas morphisms between them are not functors, but particular \relative splitting
pre- opcleavages". Now they know that this concept of map between two categories is 20 years old and was
introduced under the name of cofunctor by Aguiar [Agu97]. Ahman and Uustalu [AU14b] noticed that, in
addition to the interpretation as comonads, directed containers can also be interpreted (\cointerpreted") as
monads of a particular type, which they called update monads, generalizing state monads. Only subsequently
[AU14a], they noticed that coalgebras of coupdate comonads (comonads denoted by a directed container) make
a useful notion of lens, which they termed update lenses. They also showed that, similarly to state-based lenses,
update lenses admit multiple characterizations, among them characterizations as algebras.
8</p>
    </sec>
    <sec id="sec-8">
      <title>Conclusion</title>
      <p>We hope to have demonstrated in this paper that both update lenses and update-update lenses are natural
concepts. Both are t for their application purpose and well-motivated theoretically, which is witnessed in
particular by the fact that they can be characterized in several canonical ways. The leading intuition should in
both cases be that a lens is a simulation between two transition systems, the di erence being between whether
the simulating system must use the same alphabet of transition labels as the simulated system or can have its
own. Update lenses are the same as coalgebras of a comonad whose underlying endofunctor is the interpretation
of a container, update-update lenses are morphisms between two such comonads.</p>
      <p>We compared update-update lenses to delta and categorical lenses, singled out the di erences, and argued
that update-update lenses have both practical and theoretical advantages.</p>
      <p>Acknowledgements
Tarmo Uustalu is grateful to Michael Johnson and Paul-Andre Mellies for discussions.</p>
      <p>This research was supported by the Estonian Ministry of Education and Research institutional research grant
No. IUT33-13.
[JR13]</p>
      <p>M. Johnson, R. Rosebrugh. Delta lenses and op brations. In P. Stevens, J. F. Terwilliger, eds., Proc.
of 2nd Int. Wksh. on Bidirectional Transformations, BX 2013 (Rome, March 2013), v. 57 of Electron.
Commun. of EASST, 18 pp., 2013. doi: 10.14279/tuj.eceasst.57.875
M. Johnson, R. Rosebrugh. Unifying set-based, delta-based and edit-based lenses. In A. Anjorin, J.
Gibbons, eds., Proc. of 5th Int. Wksh. on Bidirectional Transformations, BX 2016 (Eindhoven, April 2016),
v. 1571 of CEUR Wksh. Proc., pp. 1{13, 2016. http://ceur-ws.org/Vol-1571/paper_13.pdf</p>
      <p>D D</p>
      <p>D F</p>
      <p>FFFF</p>
      <p>FFFF
FFFF</p>
      <p>FFFF</p>
      <p>F
/ D
D "</p>
      <p>D F</p>
      <p>FFFF</p>
      <p>FFFF
FFFF</p>
      <p>FFFF</p>
      <p>F
/ D D</p>
      <p>" D
D
/ D D</p>
      <p>D
/ D D D
commute.</p>
      <p>A coalgebra of a comonad (D; "; ) is a an object C together with a map : C ! D C such that the diagrams
commute.</p>
      <p>A morphism between two comonads (D; "; ) and (D0; "0; 0) on the same category C is a natural transformation
: D ! D0 such that the diagrams
A</p>
    </sec>
    <sec id="sec-9">
      <title>Comonads, coalgebras of comonads, comonad morphisms</title>
      <p>For reference only, we recapitulate the de nitions of comonads, coalgebras of comonads, comonad morphisms.</p>
      <p>A comonad on a category C is given by a functor D : C ! C together with natural transformations " : D ! Id
and : D ! C C such that the diagrams</p>
      <p>is natural: for f : X ! Y , we have
commute.
by
B</p>
    </sec>
    <sec id="sec-10">
      <title>Coalgebras of a comonad vs morphisms from costate comonads</title>
      <p>We prove the following proposition for Set, but in fact this proof scales to any monoidal closed category.
Proposition 1 Given a comonad D, for any set S0, there is a bijection between coalgebras of D with S0 as the
carrier and morphisms from the costate comonad DS0 to the comonad D.</p>
      <p>Proof. Given a comonad coalgebra structure : S0 ! D S0, we de ne a family of maps
with components</p>
      <p>C
D C</p>
      <p>D
D D</p>
      <p>D
D D</p>
      <p>D</p>
      <p>C
/ D C
D
/ D (D C)
/ D0</p>
      <p>0
/ D0 D0
C D</p>
      <p>DDDD</p>
      <p>DD
DD
DD
DDDD</p>
      <p>D
/ D C</p>
      <p>"C</p>
      <p>C
D
"
Id
/ D0</p>
      <p>"0
Id</p>
      <p>X : DS0 X ! D X</p>
      <p>X (s0; v) =df D v ( s0)
D f ( X (s0; v))
=
=
=
=</p>
      <p>D f (D v ( s0))
D (f v) ( s0)</p>
      <p>Y (s0; f v)</p>
      <p>Y (DS0 f (s0; v))
is a comonad morphism, because
satis es the laws of a comonad coalgebra structure:</p>
      <sec id="sec-10-1">
        <title>Given a comonad morphism , we de ne a map</title>
        <p>is a comonad coalgebra structure, because
satis es the comonad morphism laws:
S0 ( s0)
= S0 ( S0 (s0; idS0 ))
= D S0 ( DS0 S0 ( SS00 (s0; idS0 )))
= D S0 ( DS0 S0 (s0; s00: (s00; idS0 )))
= D S0 ( DS0 S0 (DS0 ( s00: (s00 idS0 )) (s0; idS0 )))
= D S0 (D ( s00: (s00 idS0 )) ( S0 (s0; idS0 )))
= D ( s00: S0 (s00; idS0 )) ( S0 (s0; idS0 ))
= D ( S0 (s0; idS0 ))
= D ( s0)
( ) is a bijection, as demonstrated by the following calculations.</p>
      </sec>
    </sec>
    <sec id="sec-11">
      <title>Cofunctors and op brations</title>
      <p>We recapitulate the de nitions of a cofunctor in the sense of Aguiar [Agu97] and an op bration (to be precise,
an op bration with chosen lifts, also called an opcleavage) and compare.</p>
      <p>A cofunctor from a category D to a category C is given by an object mapping F : jCj ! jDj, and an operation
taking any object X of C and any map f : F X ! W of D into a map fX : X ! Y of C (the lift of f ) such that
F Y = W . It is required that (idF X )X = idX and gY fX = (g f )X .</p>
      <p>Given a functor F : C ! D, a map k : X ! Y of C is said to be opCartesian wrt. F , if, for any map
k0 : X ! Y 0 of C and any map g : F Y ! F Y 0 of D such that F k0 = g F k, there exists a unique map
` : Y ! Y 0 such that k0 = ` k and F ` = g.</p>
      <p>An opcleavage of a category C over a category D is given by a functor F : C ! D, and an operation taking
any object X of C and any map f : F X ! W of D into an opCartesian map fX : X ! Y of C (the lift of f )
such that F fX = f (so also F Y = W ). An opcleavage is said to be splitting, if additionally (idF X )X = idX and
gY fX = (g f )X .</p>
      <p>Notice that in the de nition of a cofunctor, F is just an object mapping. In the de nition of an opcleavage,
F is a functor. Notice also that lifts in an opcleavage are required to be opCartesian.</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          <string-name>
            <surname>[AAG05] M. Abbott</surname>
            ,
            <given-names>T.</given-names>
          </string-name>
          <string-name>
            <surname>Altenkirch</surname>
            ,
            <given-names>N.</given-names>
          </string-name>
          <string-name>
            <surname>Ghani</surname>
          </string-name>
          .
          <article-title>Containers: constructing strictly positive types</article-title>
          .
          <source>Theor. Comput. Sci.,</source>
          v.
          <volume>342</volume>
          , n. 1, pp.
          <volume>3</volume>
          {
          <issue>27</issue>
          ,
          <year>2005</year>
          . doi:
          <volume>10</volume>
          .1016/j.tcs.
          <year>2005</year>
          .
          <volume>06</volume>
          .002
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          [Agu97]
          <string-name>
            <given-names>M.</given-names>
            <surname>Aguiar</surname>
          </string-name>
          . Internal Categories and
          <string-name>
            <given-names>Quantum</given-names>
            <surname>Groups</surname>
          </string-name>
          . Cornell University,
          <year>1997</year>
          . http://www.math. cornell.edu/~maguiar/thesis2.pdf
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          [ACU14]
          <string-name>
            <given-names>D.</given-names>
            <surname>Ahman</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Chapman</surname>
          </string-name>
          ,
          <string-name>
            <given-names>T.</given-names>
            <surname>Uustalu</surname>
          </string-name>
          .
          <article-title>When is a container a comonad? Log. Methods in Comput</article-title>
          . Sci., v.
          <volume>10</volume>
          , n. 3,
          <string-name>
            <surname>article</surname>
            <given-names>14</given-names>
          </string-name>
          ,
          <year>2014</year>
          . doi:
          <volume>10</volume>
          .2168/lmcs-
          <volume>10</volume>
          (
          <issue>3</issue>
          :14)
          <fpage>2014</fpage>
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          [AU14a]
          <string-name>
            <given-names>D.</given-names>
            <surname>Ahman</surname>
          </string-name>
          ,
          <string-name>
            <given-names>T.</given-names>
            <surname>Uustalu</surname>
          </string-name>
          .
          <article-title>Coalgebraic update lenses</article-title>
          . In B.
          <string-name>
            <surname>Jacobs</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          <string-name>
            <surname>Silva</surname>
          </string-name>
          , S. Staton, eds.,
          <source>Proc. of 30th Conf. on Mathematical Foundations of Programming Semantics</source>
          ,
          <string-name>
            <surname>MFPS XXX</surname>
          </string-name>
          (
          <article-title>Ithaca</article-title>
          ,
          <string-name>
            <surname>NY</surname>
          </string-name>
          ,
          <year>June 2014</year>
          ), v. 308 of Electron. Notes in Theor.
          <source>Comput. Sci.</source>
          , pp.
          <volume>25</volume>
          {
          <fpage>48</fpage>
          .
          <string-name>
            <surname>Elsevier</surname>
          </string-name>
          ,
          <year>2014</year>
          . doi:
          <volume>10</volume>
          .1016/j.entcs.
          <year>2014</year>
          .
          <volume>10</volume>
          .003
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          [AU14b]
          <string-name>
            <given-names>D.</given-names>
            <surname>Ahman</surname>
          </string-name>
          ,
          <string-name>
            <given-names>T.</given-names>
            <surname>Uustalu</surname>
          </string-name>
          .
          <article-title>Update monads: cointerpreting directed containers</article-title>
          . In R. Matthes,
          <string-name>
            <surname>A</surname>
          </string-name>
          . Schubert, eds.,
          <source>Proc. of 19th Conf. on Types for Proofs and Programs</source>
          ,
          <string-name>
            <surname>TYPES</surname>
          </string-name>
          <year>2013</year>
          (Toulouse, Apr.
          <year>2013</year>
          ), v. 26
          <source>of Leibniz Int. Proc. in Inform.</source>
          , pp.
          <volume>1</volume>
          {
          <fpage>23</fpage>
          .
          <string-name>
            <surname>Dagstuhl</surname>
            <given-names>Publishing</given-names>
          </string-name>
          ,
          <year>2014</year>
          . doi:
          <volume>10</volume>
          .4230/lipics.types.
          <year>2013</year>
          .1
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          [AU16]
          <string-name>
            <given-names>D.</given-names>
            <surname>Ahman</surname>
          </string-name>
          ,
          <string-name>
            <given-names>T.</given-names>
            <surname>Uustalu</surname>
          </string-name>
          .
          <article-title>Directed containers as categories</article-title>
          . In R. Atkey, N. Krishnaswami, eds.,
          <source>Proc. of 6th Wksh. on Mathematically Structured Functional Programming</source>
          ,
          <article-title>MSFP 2016 (Eindhoven</article-title>
          ,
          <year>April 2016</year>
          ), v. 207
          <source>of Electron. Proc. in Theor. Comput. Sci.</source>
          , pp.
          <volume>89</volume>
          {
          <fpage>98</fpage>
          . Open Publishing Assoc.,
          <year>2016</year>
          . doi:
          <volume>10</volume>
          .4204/eptcs.207.5
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          [DXC11]
          <string-name>
            <given-names>Z.</given-names>
            <surname>Diskin</surname>
          </string-name>
          ,
          <string-name>
            <given-names>Y.</given-names>
            <surname>Xiong</surname>
          </string-name>
          ,
          <string-name>
            <given-names>K.</given-names>
            <surname>Czarnecki. From</surname>
          </string-name>
          state
          <article-title>- to delta-based bidirectional model transformations: the asymmetric ase</article-title>
          .
          <source>J. of Object Technol</source>
          ., v.
          <volume>10</volume>
          , article 6,
          <year>2011</year>
          . doi:
          <volume>10</volume>
          .5381/jot.
          <year>2011</year>
          .
          <volume>10</volume>
          .1.a6
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          [F+07]
          <string-name>
            <given-names>J. N.</given-names>
            <surname>Foster</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M. B.</given-names>
            <surname>Greenwald</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J. T.</given-names>
            <surname>Moore</surname>
          </string-name>
          ,
          <string-name>
            <given-names>B. C.</given-names>
            <surname>Pierce</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Schmitt</surname>
          </string-name>
          .
          <article-title>Combinators for bidirectional tree transformations: a linguistic approach to the view-update problem</article-title>
          .
          <source>ACM Trans. on Program. Lang. and Syst</source>
          ., v.
          <volume>29</volume>
          , n. 3,
          <string-name>
            <surname>article</surname>
            <given-names>17</given-names>
          </string-name>
          ,
          <year>2007</year>
          . doi:
          <volume>10</volume>
          .1145/1232420.1232424
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          [GJ12]
          <string-name>
            <given-names>J.</given-names>
            <surname>Gibbons</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Johnson</surname>
          </string-name>
          .
          <article-title>Relating algebraic and coalgebraic descriptions of lenses</article-title>
          . In F. Hermann, J. Voigtlander, eds.,
          <source>Proc. of 1st Int. Wksh. on Bidirectional Transformations</source>
          ,
          <string-name>
            <surname>BX</surname>
          </string-name>
          <year>2012</year>
          (Tallinn,
          <year>March 2012</year>
          ), v. 49 of Electron.
          <source>Commun. of EASST</source>
          , 16 pp.
          <year>2012</year>
          . doi:
          <volume>10</volume>
          .14279/tuj.eceasst.
          <volume>49</volume>
          .726
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          <string-name>
            <surname>[HPW12] M. Hofmann</surname>
            ,
            <given-names>B. C.</given-names>
          </string-name>
          <string-name>
            <surname>Pierce</surname>
            ,
            <given-names>D.</given-names>
          </string-name>
          <string-name>
            <surname>Wagner</surname>
          </string-name>
          .
          <article-title>Edit lenses</article-title>
          .
          <source>In Proc. of 39th ACM SIGPLAN-SIGACT Symp. on Principles of Programming Languages, POPL '12</source>
          (Philadelphia, PA, Jan.
          <year>2012</year>
          ), pp.
          <volume>495</volume>
          {
          <fpage>508</fpage>
          . ACM,
          <year>2012</year>
          . doi:
          <volume>10</volume>
          .1145/2103621.2103715
        </mixed-citation>
      </ref>
      <ref id="ref11">
        <mixed-citation>
          <string-name>
            <surname>[JRW10] M. Johnson</surname>
            , R. Rosebrugh,
            <given-names>R. J.</given-names>
          </string-name>
          <string-name>
            <surname>Wood</surname>
          </string-name>
          .
          <article-title>Algebras and update strategies</article-title>
          .
          <source>J. of Univ. Comput. Sci.,</source>
          v.
          <volume>16</volume>
          , n. 5, pp.
          <volume>729</volume>
          {
          <fpage>748</fpage>
          . doi:
          <volume>10</volume>
          .3217/jucs-016
          <source>-05-0729</source>
        </mixed-citation>
      </ref>
      <ref id="ref12">
        <mixed-citation>
          <string-name>
            <surname>[JRW12] M. Johnson</surname>
            , R. Rosebrugh,
            <given-names>R. J.</given-names>
          </string-name>
          <string-name>
            <surname>Wood</surname>
          </string-name>
          .
          <article-title>Lenses, brations and universal translation</article-title>
          .
          <source>Math. Struct. in Comput. Sci.,</source>
          v.
          <volume>22</volume>
          , n. 1, pp.
          <volume>25</volume>
          {
          <issue>42</issue>
          ,
          <year>2012</year>
          . doi:
          <volume>10</volume>
          .1017/s0960129511000442
        </mixed-citation>
      </ref>
      <ref id="ref13">
        <mixed-citation>
          [McK16]
          <string-name>
            <given-names>J.</given-names>
            <surname>McKinna</surname>
          </string-name>
          .
          <article-title>Bidirectional transformations are proof-relevant bisimulations. Extended abstract presented at 2016 ACM SIGPLAN Wksh</article-title>
          . on
          <string-name>
            <surname>Type-Driven</surname>
            <given-names>Development</given-names>
          </string-name>
          , TyDe '
          <volume>16</volume>
          (
          <issue>Nara</issue>
          ,
          <year>Japan 2016</year>
          ).
        </mixed-citation>
      </ref>
      <ref id="ref14">
        <mixed-citation>
          <string-name>
            <surname>eds.</surname>
          </string-name>
          ,
          <source>Proc. of 7th Int. Wksh. on Coalgebraic Methods in Computer Science</source>
          , CMCS '
          <volume>04</volume>
          (Barcelona,
        </mixed-citation>
      </ref>
      <ref id="ref15">
        <mixed-citation>
          <source>March</source>
          <year>2004</year>
          ), v. 106 of Electron. Notes in Theor.
          <source>Comput. Sci.</source>
          , pp.
          <volume>297</volume>
          {
          <fpage>314</fpage>
          .
          <string-name>
            <surname>Elsevier</surname>
          </string-name>
          ,
          <year>2004</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref16">
        <mixed-citation>
          <source>doi: 10</source>
          .1016/j.entcs.
          <year>2004</year>
          .
          <volume>02</volume>
          .041
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>