<!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>Di erential Logical Relations?</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Part II: Increments</string-name>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Derivatives</string-name>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Ugo Dal Lago</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>Francesco Gavazzo</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>INRIA Sophia Antipolis</institution>
          ,
          <country country="FR">France</country>
        </aff>
        <aff id="aff1">
          <label>1</label>
          <institution>University of Bologna</institution>
          ,
          <country country="IT">Italy</country>
        </aff>
      </contrib-group>
      <abstract>
        <p>We study the deep relations existing between di erential logical relations and incremental computing, by showing how self-di erences in the former precisely correspond to derivatives in the latter. We also show how di erential logical relations can be seen as a powerful metatheoretical tool in the analysis of incremental computations, enabling an easy proof of soundness of di erentiation.</p>
      </abstract>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>Introduction</title>
      <p>
        One of the major challenges programming language theory is facing these days
is the development of adequate abstractions to deal with the (highly)
increasing complexity and heterogeneity of modern software systems. Indeed, since the
very birth of the discipline, researchers have been focused on the design of
compositional techniques for software analysis, whereby one can study the overall
behavior of a system by inspecting its constituent parts in isolation. A prime
example of the successfulness of such an analysis is given by the theory of
program equivalence. Notwithstanding its successful history, program equivalence
is revealing some weaknesses when applied to nowadays software, where exact
reasoning about components is, either because of the very nature of the
software involved or because of the cost of such an analysis, oftentimes not feasible.
Examples witnessing such weaknesses are given by the elds of probabilistic
computing, where small perturbations in probabilities break equivalence, numerical
computing, where program implementing numerical functions can be optimized
at the price of introducing an acceptable error in the output, and, more generally,
approximate computing [
        <xref ref-type="bibr" rid="ref24">24</xref>
        ] where accuracy of the result is partially sacri ced
to gain e ciency.
      </p>
      <p>
        The common pattern behind all the aforementioned examples is the shift from
an exact analysis of software, whereby equivalent pieces of software are
interchangeable within any system, to an approximate analysis of software, whereby
non-equivalent pieces of software are replaced within a system at the price of
producing an acceptable error, and thus an approximately correct result. Moving
from an exact to an approximate analysis of programs poses several challenges
? Copyright c 2020 for this paper by its authors. Use permitted under Creative
Commons License Attribution 4.0 International (CC BY 4.0).
to programming language semantics, the main one arguably concerning
compositionality. In fact, once we replace a program P with a non-equivalent one Q
in a system C[ ], then C[ ] may amplify the error introduced by the
replacement of P with Q, this way invalidating compositionality of the analysis. This
point becomes evident when studying (higher-order) program metric or program
distance [
        <xref ref-type="bibr" rid="ref10 ref14 ref27 ref9">27, 9, 14, 10</xref>
        ]: if the distance between P and Q is upper bounded by a
number " &gt; 0, then it may not be so for C[P ] and C[Q].
      </p>
      <p>Motivated by these general observations, researchers are showing an
increasing interest in quantitative analysis of programs, with a special focus on di
erential properties of programs. Although the expression di erential has no precise
meaning in this context, we may identify it with the collection of properties
relating local and global changes in software. Thus, for instance, we can think
of the (error produced by the) replacement of P with Q as a local change, and
investigate its relationship with the global change we observe between C[P ] and
C[Q].</p>
      <p>The study of such di erential properties has led, oftentimes abusing
terminology, to the development of several notions of a program derivative. Among those,
some of the main ones one encounters when looking at the relevant literature
are the following.</p>
      <p>
        Those coming from the eld of automatic di erentiation [
        <xref ref-type="bibr" rid="ref4">4</xref>
        ], which aim to
extend the notion of a derivative one nds in mathematical analysis [
        <xref ref-type="bibr" rid="ref30">30</xref>
        ] to
arbitrary programs. Examples are given by [
        <xref ref-type="bibr" rid="ref1 ref29 ref6">6, 1, 29</xref>
        ] (as well as by references
therein).
      </p>
      <p>
        Those coming from the di erential -calculus [
        <xref ref-type="bibr" rid="ref13">13</xref>
        ], whose original motivations
rely on quantitative semantics [
        <xref ref-type="bibr" rid="ref19">19</xref>
        ] and linear logic [
        <xref ref-type="bibr" rid="ref18">18</xref>
        ].
      </p>
      <p>
        Those coming from incremental computing [
        <xref ref-type="bibr" rid="ref25 ref26">26, 25</xref>
        ], which aim to nd ways
to incrementally compute outputs as inputs changes.
      </p>
      <p>
        Those coming from di erential logical relations [
        <xref ref-type="bibr" rid="ref21">21</xref>
        ] via the notion of a
selfdi erence, which aim to provide context-sensitive compositional distances
between programs.
      </p>
      <p>
        It is thus natural to ask whether there are connections between such notions.
Although for some of the aforementioned cases the answer seems to be negative
(for instance, the derivatives one nds in incremental computing are
generalizations of nite di erences [
        <xref ref-type="bibr" rid="ref28">28</xref>
        ], whereas the ones found in calculi for automatic
di erentiation are actual derivatives), others have conceptual similarities. This
is the case for di erential logical relations and incremental computing, as both
study the relationship between input and output changes.
      </p>
      <p>In this paper we study such similarities and establish a formal connection
between di erential logical relations and incremental computing, by showing how
self-di erences in the former precisely correspond to derivatives in the latter. In
fact, as we will see, the derivative of a program P can be seen as a way to
quantify how much changes in the input of P in uence changes in its output,
this way acting as a self-di erence for P .</p>
      <p>
        Besides its conceptual implications, the advantages of such a correspondence
are twofold. On the one hand, di erential logical relations qualify as a lightweight
operational technique for incremental computing: we witness that by giving a
proof of soundness of di erentiation for the incremental -calculus of Cai et al.
[
        <xref ref-type="bibr" rid="ref7">7</xref>
        ]. On the other hand, we can use results coming from incremental computing
to go beyond the current theory of di erential logical relations. For instance, it is
possible to read the work by Giarrusso, Regis-Gianas, and Schuster [
        <xref ref-type="bibr" rid="ref17">17</xref>
        ], where
step-indexed logical relations are introduced for proving correctness of untyped
program derivatives, to de ne a form of step-indexed di erential logical relations,
this way giving di erential semantics to calculi with full recursion (something
not possible in the original formulation of di erential logical relations [
        <xref ref-type="bibr" rid="ref21">21</xref>
        ]).
Structure of the Paper Section 2 introduces the target calculus of this work,
as well as di erential logical relations and the incremental -calculus. In
Section 3, we establish a formal connection between di erential logical relations
and the incremental -calculus by showing that program derivatives (in the
sense of incremental computing) are self-distances (in the sense of di erential
logical relations). Additionally, we give a di erential logical relation-based proof
of soundness of di erentiation, the main result in the theory of incremental
computing.
2
      </p>
    </sec>
    <sec id="sec-2">
      <title>Preliminaries: Di erential Logical Relations and the</title>
    </sec>
    <sec id="sec-3">
      <title>Incremental -calculus</title>
      <p>
        In this section we shortly review the main ideas behind di erential logical
relations (DLRs) and the incremental -calculus. In order to do so, we introduce the
vehicle calculus of (the rst part) of this work, namely a call-by-value simply
typed -calculus with a primitive type for real numbers, which we denote by
STR. The calculus is standard and it is essentially the same calculus used in [
        <xref ref-type="bibr" rid="ref21">21</xref>
        ].
We summarize the syntax and static semantics of STR in Figure 1, where we
assume to have constants ' for any function3 ' : Rn ! R and primitives r for
any real number r.
      </p>
      <p>
        We use letters t; s; : : : to range over terms, and v; w; : : : to range over values.
Additionally, we follow standard syntactic conventions as in, e.g., [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ]. In
particular, we work with terms modulo renaming of bound variables, and denote by
t[v=x] the capture-avoiding substitution of v for x in t. Finally, we introduce the
following notation and refer to terms in as closed terms or programs.
Similarly, we refer to values in V as closed values, and we use notations such as
and V with their natural meanings.
      </p>
      <p>The dynamics of STR is given by a standard call-by-value operational
semantics, de ned in Figure 2, where for a function ' : Rn ! R and a number r 2 R
we write 'r : Rn 1 ! R for the mapping (r1; : : : ; rn 1) 7! '(r; r1; : : : ; rn 1).
Notice, in particular, that ' r1 rn eventually reduces to '(r1; : : : ; rn).</p>
      <p>
        Since STR is simply-typed, standard reducibility [
        <xref ref-type="bibr" rid="ref20">20</xref>
        ] su ces to show that
STR is strongly normalizing. In particular, any program t evaluates to a (unique)
3 When dealing with standard arithmetic operator, such as +, we will overload the
notation and write + in place of +.
; ::= R j
j
      </p>
      <p>!
; x :</p>
      <p>` x :
t; s ::= x j r j ' j ht; si j x:t j out1 t j out2 t j ts
v; w ::= x j r j ' j hv; wi j x:t
` r : R
` ' : R !
|
{z
n
! R ! R</p>
      <p>}
` t : 1 2
` out1 t : 1
` t :
!
` ts :
` t : 1 2
` out2 t : 2
` s :
closed value v|that we indicate as nf(t)|in a nite number of !-steps (notation
t + v). We write t +n v, for n 2 N, to state that t evaluates to v in n number to
!-steps and ! for the re exive and transitive closure of !.</p>
      <p>( x:t)v ! t[v=x]
' r ! 'r
outi hv1; v2i ! vi
t ! t0
ts ! t0s
s ! s0
vs ! vs0
t ! t0
ht; si ! ht0; si</p>
      <p>s ! s0
hv; si ! hv; s0i</p>
      <p>t ! t0
outi t ! outi t0
Despite its simplicity, STR allows us to justify the shift from program
equivalence|that is the family of notions concerning equality between programs|to
program distance, in general, and to di erential logical relations, in particular.</p>
      <p>
        First, let us de ne a suitable notion of program equivalence for STR programs.
Due to its simple nature, STR allows us to choose among a large family of
notions of program equivalence, ranging from denotationally-based equivalences to
operationally-based ones. Here we choose extensional or applicative equivalence4.
4 This is nothing but a simpli cation of Abramsky's applicative bisimilarity [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ] relying
on strong normalization of STR and its simple type system.
      </p>
      <p>De nition 1. De ne the type-indexed family of relations (=
V V ) as follows (where i 2 f1; 2g):
; =V
hv1; v2i =V1 2 hw1; w2i () 8i: vi =Vi wi
t = t0 () nf(t) =V nf(t0)
r =RV r0 () r = r0
v =V</p>
      <p>! v0 () 8w 2 V : vw = v0w</p>
      <p>It is well-known that extensional equivalence is a congruence relation, this
way enabling compositional reasoning about program behaviors: s = s0 entails
t[s=x] = t[s0=x] for any term x : ` t : . Unfortunately, one soon realizes
that due to the presence of (constants for) real-numbers, program equivalence
is a too coarse notion for reasoning about STR programs. For it is desirable to
regard two programs of type R whose outputs are " apart to be themselves "
apart, rather than just state that the two are not equivalent.5</p>
      <p>
        The natural way to overcome this problem is to re ne = into a map :
! R following Lawvere's correspondence between ordered sets and
(generalized) metric spaces [
        <xref ref-type="bibr" rid="ref22">22</xref>
        ]. Accordingly, we obtain the following maps:
RV (r; r0) , r0
      </p>
      <p>r
(t; t0) , V (nf(t); nf(t0))</p>
      <p>V1 2 (hv1; v2i; hw1; w2i) ,
max
i2f1;2g
V! (v; v0) , sup
w2V</p>
      <p>
        Vi (vi; wi)
(vw; v0w)
which can be easily proved to be generalized metrics6 [
        <xref ref-type="bibr" rid="ref22">22</xref>
        ]. Of course, in order for
to serve its purpose, we also need it to support the (quantitative re nement of
the) compositionality principle ensured by =. As compositionality of = took the
form of a congruence property, it is easy to realize to that compositionality of
takes the form of non-expansiveness : for all terms s; s0 2 and x : ` t :
we must have (s; s0) (t[s=x]; t[s0=x]). That is, contexts cannot amplify
distances.
      </p>
      <p>
        Unfortunately, we immediately see that fails to be non-expansive, and thus
compositional. Even worse, any reasonable non-expansive metric-like map is
bound to trivialize, meaning that it collapses to a congruence relation. Roughly,
given two terms s; s0 which are " 6= 0 apart, for any positive real number c it is
always possible to nd an open term x : ` t : such that t[s] and t[s0] are c
apart. For it is su cient to take a term t using its input x enough times: once
the terms t[s] and t[s0] are evaluated, any time t uses x the distance between s
5 A similar argument can be formulated for any language/calculus exhibiting, either in
its syntax or in its semantics, some quantitative behavior. Typical examples of such
behaviors are given by types for quantitative objects, such as numeric types, but
also by probabilistic primitives, the latter making relevant semantic notions, such as
termination, quantitative [8, 10{12, 15, 27, 5].
6 Additionally, by replacing r0 r and supr1;:::;rn (r1; : : : ; rn) '(r1; : : : ; rn) with
jr0 rj and supr1;:::;rn j (r1; : : : ; rn) '(r1; : : : ; rn)j, respectively, becomes a
pseudometric [
        <xref ref-type="bibr" rid="ref31">31</xref>
        ].
and s0 is detected and added to the one previously measured. Remarkably, this
holds even if any ' is non-expansive (i.e. 1-Lipschitz).
2.2
      </p>
      <p>
        Di erential Logical Relations
The failure of non-expansiveness of quantitative re nements of notions of
program equivalence has led researchers to propose several notions of program
distance [
        <xref ref-type="bibr" rid="ref14 ref27 ref9">9, 27, 14</xref>
        ] in recent years, all aimed to restore compositionality. All the
notions proposed share a common feature: they all impose calculi linearity
constraints, this way providing static information on the number of times a program
can use its input (and thus on how much the program can ampli es distances).
The notions of program distance thus obtained are indeed compositional, but
still have two major drawbacks. First, they are tailored for linear calculi and are
not very informative when applied to non-linear calculi (relying, e.g., on
standard translations [
        <xref ref-type="bibr" rid="ref18">18</xref>
        ]). Second, and most important, they do not account for
the role of the environment in determining distances.
      </p>
      <p>Let us expand on this last point by means of an example. Consider the
(linear) programs t , x:x and s , x:sin x for the identity and sine function,
respectively. It is easy to see that measuring the distance between t and s as
we did when de ning , we are forced to conclude such a distance to be 1. In
fact, for r ! 1 we have jr sin(r)j ! 1. This is rather unsatisfactory, as such
distance does not take into account which input the environment will actually
pass to t and s. For instance, if the environment feeds t and s with an input v
close to zero, then the distance between tv and sv should be close to 0 too, and
thus we would like to conclude that in all such cases the distance between t and
s is itself close to zero.</p>
      <p>
        Summing up, ordinary notions of program distance are not sensitive to the
context in which programs are used. This ultimately relies on the fact that
measuring the distance between two programs (regarded as functions) as just one
single number there is no way to give information on how such programs interact
with the environments in which they are used. Di erential logical relations have
been introduced in [
        <xref ref-type="bibr" rid="ref21">21</xref>
        ] as a way to de ne a context-sensitive notion of program
distance on non-linear calculi. The main novelty of di erential logical relations
(which was previously theorized by Westbrook and Chaudhuri [
        <xref ref-type="bibr" rid="ref32">32</xref>
        ] in the
setting of approximate program transformations [
        <xref ref-type="bibr" rid="ref23">23</xref>
        ]) is to consider richer notions
of distance (also called di erences) between programs, whereby the di erence
between two programs is, in general, not a number, but a function describing
how di erences between inputs turn into di erences between outputs.
      </p>
      <p>
        Di erential logical relations take the form of (type-indexed) ternary relations
D relating pairs of programs together with di erences between them. When
dealing with programs of type ! , di erences take the form of functions
mapping input programs of type and di erences for such programs to di
erences for programs of type . This is why here we consider a
computationallyoriented notion of di erence whereby di erences between programs are de ned
as programs themselves (cf. [
        <xref ref-type="bibr" rid="ref32">32</xref>
        ]) rather than as semantical objects.
      </p>
      <p>We formalize these ideas by assigning to each type a type
habitants are terms acting as di erences between terms of type .
whose
in</p>
      <sec id="sec-3-1">
        <title>De nition 2. For any type , we de ne the type of -di erences as follows:</title>
        <p>R , R;
(
) ,
;
( ! ) ,
!
!
:</p>
        <p>Notice, in particular, that a di erence between two programs of type !
is a program taking an input of type and a -di erence, and returning a
-di erence.</p>
        <p>Obviously, given two programs t; t0 of type , not all programs of type
can act as (meaningful) di erences between t and t0. Di erential logical relations
(DLRs for short) are ternary relations speci cally designed to isolate meaningful
di erences between programs. More precisely, a DLR is a type-indexed family
of ternary relations D , (D ; DV ) , where D and DV
V V V , such that D (dt; t; t0) holds if and only if dt is a di erence7
between t and t0 (and similarly for values).</p>
        <p>De nition 3 (Asymmetric DLRs). A di erential logical relation is a
typeindexed family of ternary relations (D ; DV V V V )
such that:</p>
        <p>DRV (dr; r; r0) () r0</p>
        <p>r = dr
DV1 2 (dv; v; v0) () 8i 2 f1; 2g: DVi (outi dv; outi v; outi v0)
DV! (dv; v; v0) () 8dw; w; w0: DV (dw; w; w0) =)
D (dv w dw; vw; v0w0)
D (dt; t; t0) ()</p>
        <p>
          DV (dv; v; v0) where dt + dv; t + v; t0 + v0:
Remark 1. Contrary to the original formulation of DLRs [
          <xref ref-type="bibr" rid="ref21">21</xref>
          ], here we work with
asymmetric DLRs: if dt is a di erence between t and t0, then dt may not be a
di erence between t0 and t. For instance, 3 is a di erence between 2 and 5, as
by adding 3 to 2 we reach 5. Yet, according to such a reading, it is not true that
3 is a di erence between 5 and 2 (the desired di erence being, in fact, 3).
Example 1 ([
          <xref ref-type="bibr" rid="ref21">21</xref>
          ]). Let t , x:sin x and t0 , x:x. Then dt , x: dx:x + dx
sin x is a di erence between t and t0. For, proving DV
R!R(dt; t; t0) requires to prove
that for all dr; r; r0 such that DRV (dr; r; r0) (meaning that r + dr = r0), we have
DRV (r + dr sin r; sin r; r0), i.e. r + dr sin r + sin r = r0, which is indeed the
case. Observe how dt x " evaluates to a real number which is indeed small when
the two arguments are themselves close to 0.
        </p>
        <p>
          As already remarked, DLRs have been introduced with the goal of developing
a compositional theory of program distance. This goal is achieved by the so-called
Fundamental Lemma [
          <xref ref-type="bibr" rid="ref21">21</xref>
          ].
        </p>
        <p>
          Lemma 1 (Fundamental Lemma, Version 1). For any program t 2
there exists a self-di erence dt for it. That is, D (dt; t; t).
7 Following conventions in, e.g., [
          <xref ref-type="bibr" rid="ref7">7</xref>
          ], we use the notation dt; ds; : : : for term di erences|
i.e. terms of type .
        </p>
        <p>Lemma 1 enables compositional reasoning on program di erences. Informally,
by regarding a context x : ` t : as a term x:t we are guaranteed a
selfdi erence dt for t to exist, so that given two programs s; s0 of type with
di erence ds between them, one can compute the di erence between t[s=x] and
t[s0=x] starting from s, ds, and dt alone.
2.3</p>
        <p>The Incremental -calculus and Program Derivatives
Albeit enabling compositional reasoning on program di erences, Lemma 1 has
the major drawback of guaranteeing the existence of self-distances without giving
any explicit information on how to construct them. As we will see in the next
section, the self-distances of Lemma 1 are precisely the program derivatives used
in the incremental -calculus.</p>
        <p>
          The incremental -calculus is a formalism introduced by Cai et al. [
          <xref ref-type="bibr" rid="ref7">7</xref>
          ] as a
foundational calculus for incremental computation [
          <xref ref-type="bibr" rid="ref25 ref26">26, 25</xref>
          ]. Roughly, suppose we
are given a program f regarded as a function, and an input a (think, for instance,
of a as a database). Let us now suppose to compute f (a) and then to modify the
input a by a change da, this way obtaining a new input a da (for instance, we
may add a new entry to the database a). Incremental computing seeks for ways to
obtain the result of f (a da) without computing f on the new input a da from
scratch. In fact, sometimes it is indeed possible to obtain such a result in terms
of f (a) and f 0(a; da), for a suitable function8 f 0. For instance, let f (x) , x2 and
suppose we have computed f (a), for some a. Let us now change a to a+da. When
asked to compute f (a + da) we can take advantage of having already computed
f (a) = a2 by observing that f (a + da) = a2 + 2ada + da2 = f (a) + f 0(a; da),
where f 0(x; dx) , 2xdx + dx2.
        </p>
        <p>
          In order to provide a formal foundation for higher-order incremental
computation, Cai et al. [
          <xref ref-type="bibr" rid="ref7">7</xref>
          ] studied incrementalization of a simply-typed -calculus
similar to the one introduced in the previous section. More precisely, for any
type a type of -changes coinciding with is introduced, as well as an
operator (called change update) building an expression t dt 2 from an
expression t 2 and a change dt 2 . In order to account for
incrementalization, they also introduced the so-called derivative9 Dt 2 of an expression
t 2 , and showed that for all terms t 2 ! , s 2 , and -change ds, one
has: t (s ds) (ts) (Dt s ds), where stands for denotational equality. All
the aforementioned results are proved by means of denotational semantics,
although some operationally-based proofs employing techniques resembling DLRs
are given in Giarrusso's PhD thesis [
          <xref ref-type="bibr" rid="ref16">16</xref>
          ].
        </p>
        <p>
          In the next section, we will show how we can easily prove such results using
DLRs, and, dually, how by identifying di erences with changes we can improve
8 Obviously, to be practically useful, the map f 0 should be such that computing
f 0(a; da) is cheaper than computing f (a da).
9 The terminology is misleading. For instance, we should not think of the derivative
D' of a term ' : R ! R as the syntactic counterpart of the derivative of ' : R ! R.
Rather, D' represents the nite di erence [
          <xref ref-type="bibr" rid="ref28">28</xref>
          ] of ', i.e. the map ' : R R ! R
de ned by '(x; dx) , '(x + dx) '(x).
on the current theory of program di erences. In order to do so, however, we rst
need to formally introduce the update operator and the notion of a program
derivative. We begin recalling a couple of basic de nitions from nite di erence
calculus.
        </p>
        <p>De nition 4. Given functions ' : Rn ! R and d' : (R
maps ' d' : Rn ! R and ' : (R R)n ! R by:
R)n ! R, de ne the
('</p>
        <p>d')(x1; : : : ; xn) , '(x1; : : : ; xn) + d'((x1; 0); : : : ; (xn; 0));
'((x1; dx1); : : : ; (xn; dxn)) , '(x1 + dx1; : : : ; xn + dxn)
'(x1; : : : ; xn):
The map
' is known as the nite di erence of '. Notice that '
' = '.</p>
        <p>De nition 5. De ne the partial operator
:
(outi t)
( x:t)
!
!</p>
        <p>as follows:
(outi dt) , outi (t</p>
        <p>dt);
( x: dx:dt) ,
x:(t</p>
        <p>dt);
(ts)
(dt s ds) , (t
dt) (s
ds):
x
r
'
dx , x;
dr , r + dr;
d' , '
d';
dt; s
ht; si
hdt; dsi , ht</p>
        <p>dsi;</p>
        <p>The de nition of t dt may appear weird at rst, but it will become clear
once the notion of a derivative is introduced. Intuitively, given a term t and a
change dt, we can see t dt as the term obtained by changing t according to
dt. Clearly, this is possible only if dt has the `right' structure (for instance, it
would be meaningless to do something like changing a function according to a
number). We immediately notice that if v is a value and v dv is de ned, then
dv and v dv are values too. Moreover, the following typing rule is admissible,
whenever t dt is de ned:
` t :</p>
        <p>d ;
` t</p>
        <p>` dt :
dt :
where for = x1 : 1; : : : ; xn : n, we have d , dx1 :</p>
        <p>Next, we de ne the notion of a derivative of a term.
1; : : : ; dxn :</p>
        <p>De nition 6. The derivative Dt of a term t is thus de ned:</p>
        <p>Dx , dx;
D' ,
';</p>
        <p>Dr , 0;</p>
        <p>Dht; si , hDt; Dsi;
D(outi t) = outi Dt;</p>
        <p>D( x:t) ,
x: dx:Dt;</p>
        <p>D(ts) , Dt s Ds:</p>
        <p>Observe that we can indeed think of Dt as the generalization of nite
differences to arbitrary programs. Moreover, we easily see that if ` t : , then
; d ` Dt : and that t Dt is de ned and equal to t itself.</p>
      </sec>
    </sec>
    <sec id="sec-4">
      <title>Bridging the Gap</title>
      <p>
        In this section we relate DLRs with the incremental -calculus we introduced in
the previous section. We do so acting on two orthogonal axes. On the one hand,
we show that derivatives are precisely the self-distances of Lemma 1. That is, for
any program t, Dt is a self-distance for t. This result allows us to strength the
fundamental lemma of DLRs (Lemma 1), as now self-di erences can be e ectively
computed. On the other hand, we prove by means of DLRs a major result on
the incremental -calculus, namely soundness of di erentiation [
        <xref ref-type="bibr" rid="ref7">7</xref>
        ]. To the best
of the authors' knowledge, all proofs of such a result rely on either denotational
semantics or logical relations tailored for such purpose (see Remark 2).
      </p>
      <p>
        Let us begin proving that derivatives are actually self-di erences. In order
to achieve such a result, we have to rst extend the notion of a DLR to open
terms [
        <xref ref-type="bibr" rid="ref21">21</xref>
        ]. Given an environment , we denote by S( ) the collection of
substitutions, i.e. the collection of maps mapping variables (x : ) 2 to closed
values (x) 2 V . In particular, we use the notation d to denote substitutions
in S(d ).
      </p>
      <p>De nition 7. We extend the notion of a DLR to substitutions over an
environment as follows: D (d ; ; 0) () 8(x : ) 2 : DV (d (dx); (x); 0(x)),
where ; 0 2 S( ) and d 2 S(d ).</p>
      <p>As it is customary, we write t[ ] for the application of the substitution to
the term t, and [x 7! v] for the substitution mapping x to v and behaving as
otherwise. Before proving our re nement of Lemma 1, let us observe that DLRs
are closed under reduction, in the following sense.</p>
      <sec id="sec-4-1">
        <title>Lemma 2. The following holds for all closed terms:</title>
        <p>D (dt; t; t0) ^ t !
D (dt; s; s0) ^ s !
s ^ t0 !
t ^ s0 !
s0 =)
t0 =)</p>
        <p>D (dt; s; s0);
D (dt; t; t0):</p>
        <p>We are now ready to prove our new version of the Fundamental Lemma.
Lemma 3 (Fundamental Lemma, Version 2). For any program t 2
have D (Dt; t; t).
we
Proof (sketch). The thesis follows from the stronger statement: for any term
` t : and value ` v : we have:
8d ; ; 0: D (d ; ; 0) =)</p>
        <p>DV (Dv[ ; d ]; v[ ]; v[ 0]) ^ D (Dt[ ; d ]; t[ ]; t[ 0]):
The proof of the latter is a routine induction on t and v.
tu</p>
        <p>Notice how Lemma 3 improves the compositionality principle of DLRs. Given
a term x : ` t : and two values ` v; v0 : such that DV (dv; v; v0) the impact
of replacing v with v0 in t can be computed as Dt[v=x; dv=dx]. Next, we show
how the incremental -calculus can bene t from DLRs by showing how the latter
support an easy proof of soundness of di erentiation.</p>
        <p>
          Theorem 1 (Soundness of Di erentiation [
          <xref ref-type="bibr" rid="ref17 ref7">7, 17</xref>
          ]). For all t 2
values v; v0; dv such that DV(dv; v; v0), we have: tv0 = (tv) (Dt v dv).
! and
        </p>
        <p>Our proof of Theorem 1 is based on the following result which states that
changes indeed behave as such. Recall that = extends to open terms by
stipulating that for ` t; t0 : we have t = t0 i t[ ] = t0[ ], for any substitution
2 S( ) (and similarly for values).</p>
        <p>Proposition 1. The following holds for all (possibly open) terms t; t0; dt and
values v; v0; dv such that t dt and v dv is de ned.</p>
        <p>D (dt; t; t0) =) t0 = t dt;</p>
        <p>DV(dv; v; v0) =) v0 = v
dv:
Proof (sketch). The proof is by induction on , the relevant case being the one of
values. We show how to handle the case for arrow types. Assume ` t; t0 : ! .
We have to show that for any 2 S( ), t0[ ] = (t dt)[ ]. First, observe that
we have the following general result (by induction on t), where (D )(dx) ,
D (x): (t dt)[ ] = t[ ] dt[ ; D ]. By Lemma 3, we have D (D ; ; ), hence
DV! (dt[ ; D ]; t[ ]; t0[ ]). In particular, we must have t[ ] = x:s, t0[ ] = x:s0,
and dt[ ; D ] = x: dx:ds, for some s; s0, and ds. Since ( x:s) ( x: dx:ds) =
x:(s ds) (notice that this term is indeed de ned, as it is obtained from t dt,
which is de ned by hypothesis, replacing variables y; dy with closed values v,
Dv), in order to prove the thesis we have to show s0[v=x] = (s ds)[v=x] for any
closed value v of type . Since (s ds)[v=x] = s[v=x] ds[v=x; Dv=dx] we obtain
the thesis from DV! (dt[ ; D ]; t[ ]; t0[ ]) and DV(Dv; v; v), the latter being a
consequence of Lemma 3.</p>
        <p>We can nally prove soundness of di erentiation.</p>
        <p>Proof (Theorem 1). Assume DV(dv; v; v0). By Lemma 3 we have D ! (Dt; t; t),
and thus D (Dt s ds; ts; ts0), by Lemma 2. We conclude that tv0 = (tv) (Dt v dv)
from Proposition 1.</p>
        <p>
          Remark 2. To the best of the authors' knowledge, all proofs of Theorem 1 in
the literature are based on either denotational semantics or on logical relations
resembling DLRs, but speci cally extended with a clause requiring t dt = t0
for all related terms dt; t; t0, at any type [
          <xref ref-type="bibr" rid="ref16 ref17">17, 16</xref>
          ]. Notice the use of syntactic
equality: the reason behind such a choice is that the logical relation obtained
is meant to relate only programs with their derivative (in which case we indeed
have t Dt = t), rather than as a tool to reason about program di erences.
tu
tu
4
        </p>
      </sec>
    </sec>
    <sec id="sec-5">
      <title>Related Work</title>
      <p>
        Di erential logical relations have been introduced by the authors and Yoshimizu
[
        <xref ref-type="bibr" rid="ref21">21</xref>
        ], building over intuitions by Westbrook and Chaudhuri [
        <xref ref-type="bibr" rid="ref32">32</xref>
        ] and are
currently under investigation. Di erently from the ones considered in this work,
the rst formulation of di erential logical relations [
        <xref ref-type="bibr" rid="ref21">21</xref>
        ] is symmetric and
considers semantical di erence spaces, so that di erences between programs are
semantical objects (such as numbers and functions), rather than programs
themselves. Whereas we have found that working with asymmetric DLRs makes proofs
clearer (besides, asymmetry is in line with Lawvere's analysis of the notion of a
distance [
        <xref ref-type="bibr" rid="ref22">22</xref>
        ]), working with syntactic di erence spaces does not really a ect our
results. In fact, we could consider semantic-based di erence spaces and show that
the denotation of a derivative of a program is a self-di erence for the program.
      </p>
      <p>
        The incremental -calculus has been introduced by Cai et al. [
        <xref ref-type="bibr" rid="ref7">7</xref>
        ] as a
simplytyped calculus, and by Giarrusso et al. [
        <xref ref-type="bibr" rid="ref17">17</xref>
        ] as an untyped calculus. The former
work introduces the notions of a program derivative and change update, and
gives a denotational proof of soundness of di erentiation. Operationally-based
proofs of the same result are given in Giarrusso PhD's thesis [
        <xref ref-type="bibr" rid="ref16 ref17">17, 16</xref>
        ] by means
of logical relations (see Remark 2). Remarkably, both Giarrusso's thesis [
        <xref ref-type="bibr" rid="ref16">16</xref>
        ] and
the work by Giarrusso et al. [
        <xref ref-type="bibr" rid="ref17">17</xref>
        ] use ternary logical relations nearly identical
to di erential logical relations to relate programs with changes between them.
Moreover, the logical relations introduced in the aforementioned papers have
been mechanized in CoQ. The authors believe it is important to stress how
essentially the same technique has independently emerged in di erent elds (and
with di erent purposes) to prove two di erent kinds of di erential properties of
programs.
5
      </p>
    </sec>
    <sec id="sec-6">
      <title>Conclusion</title>
      <p>
        In this work we have established a formal connection between di erential
logical relations and the incremental -calculus of Cai et al. [
        <xref ref-type="bibr" rid="ref7">7</xref>
        ], whereby the
selfdi erences of the former are identi ed with the program derivatives of the
latter. Albeit the results proved here are not technically involved, by establishing a
formal connection between two di erent elds they improve the current
understanding of di erential properties of programs, such an understanding being still
in its infancy. The fact that essentially the same technique has been
independently developed in di erent elds, one looking at software optimization and the
other studying semantical notions of distance between programs, witnesses that,
at least in the authors' opinion, the technique deserves to be further investigated.
      </p>
      <p>
        In addition to its conceptual relevance, the connection established in the
present work also allows us to obtain technical improvements both on the
theory of incremental -calculus and on the one of di erential logical relations.
Concerning the former, we have showed how di erential logical relations
constitute a lightweight operational technique for incremental computing, and we have
witnessed that by giving a new, relatively easy proof of soundness of di
erentiation. Concerning the latter, we have strengthened the fundamental lemma of
DLRs [
        <xref ref-type="bibr" rid="ref21">21</xref>
        ] by showing how program derivatives constitute self-di erences, this
way reaching an higher level of compositionality. A further consequence of such
a connection is the extension of DLRs to calculi with full recursion by means of
the step-indexed logical relations of Giarrusso, Regis-Gianas, and Schuster [
        <xref ref-type="bibr" rid="ref17">17</xref>
        ].
Acknowledgment The authors are supported by the ERC Consolidator Grant
DLV-818616 DIAPASoN as well as by the ANR project 16CE250011 REPAS.
      </p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          1.
          <string-name>
            <surname>Mart</surname>
            n Abadi and
            <given-names>Gordon D.</given-names>
          </string-name>
          <string-name>
            <surname>Plotkin</surname>
          </string-name>
          .
          <article-title>A simple di erentiable programming language</article-title>
          .
          <source>PACMPL</source>
          ,
          <volume>4</volume>
          (POPL):
          <volume>38</volume>
          :1{
          <fpage>38</fpage>
          :
          <fpage>28</fpage>
          ,
          <year>2020</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          2.
          <string-name>
            <given-names>Samson</given-names>
            <surname>Abramsky</surname>
          </string-name>
          .
          <article-title>The lazy lambda calculus</article-title>
          . In D. Turner, editor,
          <source>Research Topics in Functional Programming</source>
          , pages
          <volume>65</volume>
          {
          <fpage>117</fpage>
          .
          <string-name>
            <surname>Addison</surname>
            <given-names>Wesley</given-names>
          </string-name>
          ,
          <year>1990</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          3.
          <string-name>
            <given-names>Hendrik</given-names>
            <surname>Pieter</surname>
          </string-name>
          <article-title>Barendregt. The lambda calculus - its syntax and semantics</article-title>
          , volume
          <volume>103</volume>
          of
          <article-title>Studies in logic and the foundations of mathematics</article-title>
          . North-Holland,
          <year>1985</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          4.
          <string-name>
            <given-names>Michael</given-names>
            <surname>Bartholomew-Biggs</surname>
          </string-name>
          , Steven Brown, Bruce Christianson, and
          <string-name>
            <given-names>Laurence</given-names>
            <surname>Dixon</surname>
          </string-name>
          .
          <article-title>Automatic di erentiation of algorithms</article-title>
          .
          <source>Journal of Computational and Applied Mathematics</source>
          ,
          <volume>124</volume>
          (
          <issue>1</issue>
          ):
          <volume>171</volume>
          {
          <fpage>190</fpage>
          ,
          <year>2000</year>
          .
          <article-title>Numerical Analysis 2000</article-title>
          . Vol.
          <article-title>IV: Optimization</article-title>
          and
          <string-name>
            <given-names>Nonlinear</given-names>
            <surname>Equations</surname>
          </string-name>
          .
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          5. Frank Van Breugel and
          <string-name>
            <given-names>James</given-names>
            <surname>Worrell</surname>
          </string-name>
          .
          <article-title>A behavioural pseudometric for probabilistic transition systems</article-title>
          .
          <source>Theoretical Computer Science</source>
          ,
          <volume>331</volume>
          (
          <issue>1</issue>
          ):
          <volume>115</volume>
          {
          <fpage>142</fpage>
          ,
          <year>2005</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          6. Alos Brunel, Damiano Mazza, and
          <string-name>
            <given-names>Michele</given-names>
            <surname>Pagani</surname>
          </string-name>
          .
          <article-title>Backpropagation in the simply typed lambda-calculus with linear negation</article-title>
          .
          <source>PACMPL</source>
          ,
          <volume>4</volume>
          (POPL):
          <volume>64</volume>
          :1{
          <fpage>64</fpage>
          :
          <fpage>27</fpage>
          ,
          <year>2020</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          7.
          <string-name>
            <given-names>Yufei</given-names>
            <surname>Cai</surname>
          </string-name>
          , Paolo G. Giarrusso, Tillmann Rendel, and
          <string-name>
            <given-names>Klaus</given-names>
            <surname>Ostermann</surname>
          </string-name>
          .
          <article-title>A theory of changes for higher-order languages: incrementalizing -calculi by static di erentiation</article-title>
          .
          <source>In Proc. of PLDI</source>
          <year>2014</year>
          , pages
          <fpage>145</fpage>
          {
          <fpage>155</fpage>
          ,
          <year>2014</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          8.
          <string-name>
            <surname>Konstantinos</surname>
            <given-names>Chatzikokolakis</given-names>
          </string-name>
          , Daniel Gebler, Catuscia Palamidessi, and
          <string-name>
            <given-names>Lili</given-names>
            <surname>Xu</surname>
          </string-name>
          .
          <article-title>Generalized bisimulation metrics</article-title>
          .
          <source>In Proc. of CONCUR</source>
          <year>2014</year>
          , pages
          <fpage>32</fpage>
          {
          <fpage>46</fpage>
          ,
          <year>2014</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          9.
          <string-name>
            <surname>Rapha</surname>
          </string-name>
          <article-title>elle Crubille and Ugo Dal Lago</article-title>
          .
          <article-title>Metric reasoning about -terms: The general case</article-title>
          .
          <source>In Proc. of ESOP</source>
          <year>2017</year>
          , pages
          <fpage>341</fpage>
          {
          <fpage>367</fpage>
          ,
          <year>2017</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          10. Arthur Azevedo de Amorim, Marco Gaboardi, Justin Hsu, Shin-yaKatsumata, and
          <string-name>
            <given-names>Ikram</given-names>
            <surname>Cherigui</surname>
          </string-name>
          .
          <article-title>A semantic account of metric preservation</article-title>
          .
          <source>In Proc. of POPL</source>
          <year>2017</year>
          , pages
          <fpage>545</fpage>
          {
          <fpage>556</fpage>
          ,
          <year>2017</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref11">
        <mixed-citation>
          11.
          <string-name>
            <surname>Josee</surname>
            <given-names>Desharnais</given-names>
          </string-name>
          , Vineet Gupta, Radha Jagadeesan, and
          <string-name>
            <given-names>Prakash</given-names>
            <surname>Panangaden</surname>
          </string-name>
          .
          <article-title>Metrics for labelled markov processes</article-title>
          .
          <source>Theoretical Computer Science</source>
          ,
          <volume>318</volume>
          (
          <issue>3</issue>
          ):
          <volume>323</volume>
          {
          <fpage>354</fpage>
          ,
          <year>2004</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref12">
        <mixed-citation>
          12.
          <string-name>
            <surname>Wenjie</surname>
            <given-names>Du</given-names>
          </string-name>
          , Yuxin Deng, and Daniel Gebler.
          <article-title>Behavioural pseudometrics for nondeterministic probabilistic systems</article-title>
          .
          <source>In Proc. of SETTA</source>
          <year>2016</year>
          , pages
          <fpage>67</fpage>
          {
          <fpage>84</fpage>
          ,
          <year>2016</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref13">
        <mixed-citation>
          13. Thomas Ehrhard and
          <string-name>
            <given-names>Laurent</given-names>
            <surname>Regnier</surname>
          </string-name>
          .
          <article-title>The di erential lambda-calculus</article-title>
          .
          <source>Theoretical Computer Science</source>
          ,
          <volume>309</volume>
          (
          <issue>1-3</issue>
          ):1{
          <fpage>41</fpage>
          ,
          <year>2003</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref14">
        <mixed-citation>
          14.
          <string-name>
            <given-names>Francesco</given-names>
            <surname>Gavazzo</surname>
          </string-name>
          .
          <article-title>Quantitative behavioural reasoning for higher-order e ectful programs: Applicative distances</article-title>
          .
          <source>In Proc. of LICS</source>
          <year>2018</year>
          , pages
          <fpage>452</fpage>
          {
          <fpage>461</fpage>
          ,
          <year>2018</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref15">
        <mixed-citation>
          15. Daniel Gebler, Kim G. Larsen, and
          <string-name>
            <given-names>Simone</given-names>
            <surname>Tini</surname>
          </string-name>
          .
          <article-title>Compositional bisimulation metric reasoning with probabilistic process calculi</article-title>
          .
          <source>Logical Methods in Computer Science</source>
          ,
          <volume>12</volume>
          (
          <issue>4</issue>
          ),
          <year>2016</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref16">
        <mixed-citation>
          16.
          <string-name>
            <surname>Paolo</surname>
            <given-names>G.</given-names>
          </string-name>
          <string-name>
            <surname>Giarrusso</surname>
          </string-name>
          .
          <article-title>Optimizing and incrementalizing higher-order collection queries by AST transformation</article-title>
          .
          <source>PhD thesis</source>
          , University of Tbingen,
          <year>2018</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref17">
        <mixed-citation>
          17.
          <string-name>
            <surname>Paolo</surname>
            <given-names>G</given-names>
          </string-name>
          .
          <article-title>Giarrusso, Yann Regis-Gianas, and Philipp Schuster. Incremental lambda-calculus in cache-transfer style - static memoization by program transformation</article-title>
          .
          <source>In Proc. of ESOP</source>
          <year>2019</year>
          , pages
          <fpage>553</fpage>
          {
          <fpage>580</fpage>
          ,
          <year>2019</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref18">
        <mixed-citation>
          18.
          <string-name>
            <surname>Jean-Yves Girard</surname>
          </string-name>
          .
          <article-title>Linear logic</article-title>
          .
          <source>Theoretical Computer Science</source>
          ,
          <volume>50</volume>
          :1{
          <fpage>102</fpage>
          ,
          <year>1987</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref19">
        <mixed-citation>
          19.
          <string-name>
            <surname>Jean-Yves Girard</surname>
          </string-name>
          .
          <article-title>Normal functors, power series and -calculus</article-title>
          .
          <source>Annals of Pure and Applied Logic</source>
          ,
          <volume>37</volume>
          (
          <issue>2</issue>
          ):
          <volume>129</volume>
          {
          <fpage>177</fpage>
          ,
          <year>1988</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref20">
        <mixed-citation>
          20.
          <string-name>
            <surname>Jean-Yves</surname>
            <given-names>Girard</given-names>
          </string-name>
          , Yves Lafont, and
          <string-name>
            <given-names>Paul</given-names>
            <surname>Taylor</surname>
          </string-name>
          . Proofs and Types. Cambridge Tracts in Theoretical Computer Science. Cambridge University Press,
          <year>1989</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref21">
        <mixed-citation>
          21. Ugo Dal Lago, Francesco Gavazzo, and
          <string-name>
            <given-names>Akira</given-names>
            <surname>Yoshimizu</surname>
          </string-name>
          .
          <article-title>Di erential logical relations, part I: the simply-typed case</article-title>
          .
          <source>In Proc. of ICALP</source>
          <year>2019</year>
          , pages
          <issue>111:1</issue>
          {
          <fpage>111</fpage>
          :
          <fpage>14</fpage>
          ,
          <year>2019</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref22">
        <mixed-citation>
          22.
          <string-name>
            <given-names>F. William</given-names>
            <surname>Lawvere</surname>
          </string-name>
          .
          <article-title>Metric spaces, generalized logic, and closed categories</article-title>
          .
          <source>Rendiconti del Seminario Matematico e Fisico di Milano</source>
          ,
          <volume>43</volume>
          :
          <fpage>135</fpage>
          {
          <fpage>166</fpage>
          ,
          <year>1973</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref23">
        <mixed-citation>
          23.
          <string-name>
            <surname>Sasa</surname>
            <given-names>Misailovic</given-names>
          </string-name>
          , Daniel M. Roy, and
          <string-name>
            <surname>Martin</surname>
            <given-names>C.</given-names>
          </string-name>
          <string-name>
            <surname>Rinard</surname>
          </string-name>
          .
          <article-title>Probabilistically accurate program transformations</article-title>
          .
          <source>In In Proc. of SAS</source>
          <year>2011</year>
          , pages
          <fpage>316</fpage>
          {
          <fpage>333</fpage>
          ,
          <year>2011</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref24">
        <mixed-citation>
          24.
          <string-name>
            <given-names>Sparsh</given-names>
            <surname>Mittal</surname>
          </string-name>
          .
          <article-title>A survey of techniques for approximate computing</article-title>
          .
          <source>ACM Computing Surveys</source>
          ,
          <volume>48</volume>
          (
          <issue>4</issue>
          ):
          <volume>62</volume>
          :1{
          <fpage>62</fpage>
          :
          <fpage>33</fpage>
          ,
          <year>2016</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref25">
        <mixed-citation>
          25.
          <string-name>
            <given-names>Robert</given-names>
            <surname>Paige</surname>
          </string-name>
          and
          <string-name>
            <given-names>Shaye</given-names>
            <surname>Koenig</surname>
          </string-name>
          .
          <article-title>Finite di erencing of computable expressions</article-title>
          .
          <source>ACM Trans. Program. Lang. Syst.</source>
          ,
          <volume>4</volume>
          (
          <issue>3</issue>
          ):
          <volume>402</volume>
          {
          <fpage>454</fpage>
          ,
          <year>1982</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref26">
        <mixed-citation>
          26. Ganesan Ramalingam and
          <string-name>
            <given-names>Thomas W.</given-names>
            <surname>Reps</surname>
          </string-name>
          .
          <article-title>A categorized bibliography on incremental computation</article-title>
          .
          <source>In Proc. of POPL</source>
          <year>1993</year>
          , pages
          <fpage>502</fpage>
          {
          <fpage>510</fpage>
          ,
          <year>1993</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref27">
        <mixed-citation>
          27.
          <string-name>
            <given-names>Jason</given-names>
            <surname>Reed</surname>
          </string-name>
          and
          <string-name>
            <given-names>Benjamin C.</given-names>
            <surname>Pierce</surname>
          </string-name>
          .
          <article-title>Distance makes the types grow stronger: a calculus for di erential privacy</article-title>
          .
          <source>In Proc. of ICFP</source>
          <year>2010</year>
          , pages
          <fpage>157</fpage>
          {
          <fpage>168</fpage>
          ,
          <year>2010</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref28">
        <mixed-citation>
          28.
          <string-name>
            <surname>Clarence Hudson Richardson</surname>
          </string-name>
          .
          <article-title>An Introduction to the Calculus of Finite Di erences</article-title>
          . New York,
          <year>1954</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref29">
        <mixed-citation>
          29.
          <string-name>
            <surname>Amir</surname>
            <given-names>Shaikhha</given-names>
          </string-name>
          , Andrew Fitzgibbon, Dimitrios Vytiniotis, and Simon Peyton Jones.
          <article-title>E cient di erentiable programming in a functional array-processing language</article-title>
          .
          <source>PACMPL</source>
          ,
          <volume>3</volume>
          (ICFP):
          <volume>97</volume>
          :1{
          <fpage>97</fpage>
          :
          <fpage>30</fpage>
          ,
          <year>2019</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref30">
        <mixed-citation>
          30.
          <string-name>
            <given-names>Michael</given-names>
            <surname>Spivak</surname>
          </string-name>
          . Calculus On Manifolds:
          <article-title>A Modern Approach To Classical Theorems Of Advanced Calculus</article-title>
          .
          <source>Avalon Publishing</source>
          ,
          <year>1971</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref31">
        <mixed-citation>
          31.
          <string-name>
            <surname>Lynn</surname>
          </string-name>
          <article-title>Arthur Steen and Jr</article-title>
          .
          <source>J. Arthur Seebach. Counterexamples in Topology. Dover books on mathematics. Dover Publications</source>
          ,
          <year>1995</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref32">
        <mixed-citation>
          32.
          <string-name>
            <surname>Edwin</surname>
            <given-names>M.</given-names>
          </string-name>
          <string-name>
            <surname>Westbrook</surname>
            and
            <given-names>Swarat</given-names>
          </string-name>
          <string-name>
            <surname>Chaudhuri</surname>
          </string-name>
          .
          <article-title>A semantics for approximate program transformations</article-title>
          .
          <source>CoRR, abs/1304.5531</source>
          ,
          <year>2013</year>
          . URL: http://arxiv.org/ abs/1304.5531.
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>