# An Ultrametric for Cartesian Differential Categories
for Taylor Series Convergence

Jean-Simon Pacaud Lemay111Thank you to the organizers of QUALOG2023 for
inviting me to give a talk on this research, and to the audience of QUALOG2023
for listening to the talk and their questions. The author is financially
supported by an ARC DECRA (DE230100303) and an AFOSR Research Grant
(FA9550-24-1-0008).

###### Abstract

Cartesian differential categories provide a categorical framework for
multivariable differential calculus and also the categorical semantics of the
differential $\lambda$-calculus. Taylor series expansion is an important
concept for both differential calculus and the differential
$\lambda$-calculus. In differential calculus, a function is equal to its
Taylor series if its sequence of Taylor polynomials converges to the function
in the analytic sense. On the other hand, for the differential
$\lambda$-calculus, one works in a setting with an appropriate notion of
algebraic infinite sums to formalize Taylor series expansion. In this paper,
we provide a formal theory of Taylor series in an arbitrary Cartesian
differential category without the need for converging limits or infinite sums.
We begin by developing the notion of Taylor polynomials of maps in a Cartesian
differential category and then show how comparing Taylor polynomials of maps
induces an ultrapseudometric on the homsets. We say that a Cartesian
differential category is Taylor if maps are entirely determined by their
Taylor polynomials. The main results of this paper are that in a Taylor
Cartesian differential category, the induced ultrapseudometrics are
ultrametrics and that for every map $f$, its Taylor series converges to $f$
with respect to this ultrametric. This framework recaptures both Taylor series
expansion in differential calculus via analytic methods and in categorical
models of the differential $\lambda$-calculus (or Differential Linear Logic)
via infinite sums.

###### Contents

  1. 1 Introduction
  2. 2 Cartesian Differential Categories
  3. 3 Differential Polynomials
  4. 4 Taylor Differentials Polynomials
  5. 5 Ultrametric for Taylor Series Convergence
  6. 6 Infinite Sums and Modelling Taylor Expansion

##  1 Introduction

Cartesian differential categories [3] provide the categorical foundations of
multivariable differential calculus. The key feature of a Cartesian
differential category is that it comes equipped with a _differential
combinator_ $\mathsf{D}$, which for every map
$f:A\allowbreak\mathrel{\mathop{\hbox to11.99998pt{\rightarrowfill}}\limits}B$
produces its derivative $\mathsf{D}[f]:A\times
A\allowbreak\mathrel{\mathop{\hbox to11.99998pt{\rightarrowfill}}\limits}B$,
generalizing the concept of the total derivative from differential calculus.
Cartesian _closed_ differential categories provide the categorical semantics
of the differential $\lambda$-calculus and the resource calculus [5, 8, 14,
26, 9]. Cartesian differential categories are also closely related to
differential categories [2, 1], which provide the categorical semantics of
_Differential Linear Logic_ [16, 13]. Explicitly, the coKleisli category of a
differential category is a Cartesian differential category [3, 19]. Cartesian
differential categories have also been successful in formalizing various
important concepts in differential calculus, such as solving differential
equations and exponential functions [22], Jacobians and gradients [23], de
Rham cohomology [11], linearization [6], etc. Cartesian (closed) differential
categories have also been quite popular in computer science, in particular
since they provide categorical frameworks for differential programming
languages [10] and automatic differentiation [12].

An all-important concept in differential calculus is the notion of _Taylor
series_. Recall that for a smooth function
$f:\mathbb{R}\allowbreak\mathrel{\mathop{\hbox
to11.99998pt{\rightarrowfill}}\limits}\mathbb{R}$, its Taylor series at $0$
(sometimes also called its Maclaurin series) is the power series:

$\mathcal{T}(f)(x)=\sum^{\infty}_{k=0}\frac{1}{k!}\cdot f^{(k)}(0)x^{k}$

where $f^{(k)}$ is the $k$-th derivative of $f$. Famously, Taylor series are
very useful, and a lot of information about a function can be gained from
studying its Taylor series. It is often highly desirable for Taylor series to
converge (in the usual real analytical sense) and also for functions to equal
their Taylor series.

The concept of Taylor series expansion is also important for both the
differential $\lambda$-calculus and the resource calculus [17, 4, 15, 25]. In
the presence of countable infinite sums, one can give full Taylor expansions
of $\lambda$-terms. In particular, Taylor expansion provides a linear
approximation of ordinary application, so:

$MN=\sum^{\infty}_{n=0}\frac{1}{n!}(\mathsf{D}^{n}M\cdot N^{n})0$

where $\mathsf{D}^{n}M\cdot N^{n}$ denotes the $n$-th derivative of $M$
applied $n$ times to $N$. In [26], Manzonetto provides the categorical
interpretation of this version of Taylor expansion in a Cartesian closed
differential category with infinite sums.

Taylor series expansion is also considered in Differential Linear Logic [27,
4, 17]. In [13], Ehrhard provides the categorical versions of these ideas in
differential categories with countable sums. Ehrhard’s approach to Taylor
expansion in a differential category and Manzonetto’s approach to Taylor
expansion in a Cartesian closed differential category are the same when we
consider the Taylor expansion of coKleisli maps (which is expected since
recall that the coKleisli category of a differential category is a Cartesian
differential category). Moreover, Taylor series expansion of coKleisli maps in
a differential category played a fundamental role in developing _codigging_
for differential categories and Differential Linear Logic [21]. Taylor series
expansion was also considered in the coherent differentiation setting in [18]
(though this framework, while possibly related, is quite different from
Cartesian differential categories and the story of this paper).

While the notion of Taylor series for the differential $\lambda$-calculus and
Differential Linear Logic is fundamentally the same as the notion of Taylor
series in classical differential calculus, there is a crucial difference.
Indeed, to define Taylor series expansion for the differential
$\lambda$-calculus or Differential Linear Logic, one first assumes that we are
in a setting with countable infinite sums in the algebraic sense. While this
is a perfectly fine thing to do in models coming from computer science, having
infinite sums clashes with models coming from the analysis side of things.
There are many important examples of Cartesian differential categories that do
not have infinite sums and yet still have a well-defined notion of Taylor
series, such as real smooth/entire functions, polynomials, etc. The objective
of this paper is to provide a formal theory of Taylor series in an arbitrary
Cartesian differential category in such a way that it also gives a unified
story recapturing Taylor series expansion in differential calculus via
convergence and for the differential $\lambda$-calculus via algebraic infinite
sums.

The key operation for developing Taylor series in Cartesian differential
categories is the notion of _higher-order derivatives_ , which we review in
Sec 2. Then, in a setting where we can scalar multiply by positive rationals,
we use higher-order derivatives to define the _Taylor monomials_ of maps in a
Cartesian differential category. The sum of these Taylor monomials gives the
_Taylor polynomials_ of maps. In Sec 4, we develop the theory of Taylor
polynomials in a Cartesian differential category and show that the Taylor
polynomials form a sub-Cartesian differential category. In Sec 3, we also
discuss the intermediate notion of _differential polynomials_ , which are the
maps in a Cartesian differential category whose higher-order derivative is
eventual zero. We will see that every Taylor polynomial is a differential
polynomial, but also explain why the converse is not necessarily true.

In Sec 5, we define an ultrapseudometric on the homsets of a Cartesian
differential category where the distance between two maps is given by
comparing their Taylor monomials. This ultrapseudometric is an analogue of the
metric for power series that makes the formal infinite sum of a power series
converge. However, in an arbitrary Cartesian differential category, two maps
can have the same Taylor monomials but not be equal. We say that a Cartesian
differential category is _Taylor_ if maps are completely determined by their
Taylor monomials. The main result is that in a Taylor Cartesian differential
category, the ultrapseudometric is an ultrametric, which then implies that the
sequence of Taylor polynomials of any map converges to said map. In other
words, in a Taylor Cartesian differential category, every map is equal to its
Taylor series. We also explain how we obtain a Taylor Cartesian differential
category from a Cartesian differential category by taking equivalence classes
on maps with the same Taylor monomials. As running examples throughout the
paper, we consider polynomials over a commutative semiring, real smooth
functions, and the coKleisli category of a differential category. In
particular, we will also see how for the coKleisli category of a differential
category, this story of ultrametrics and Taylor series from the Cartesian
differential category point of view corresponds precisely to the same named
notions used in [21] to construct codigging and exponential functions in
differential categories.

We also explain why if maps were equal to their Taylor series via some other
notion of convergence or algebraic infinite sums, then the Cartesian
differential category is indeed Taylor. In particular, in Sec 6, we show how
being Taylor recaptures precisely Manzonetto’s notion of modelling Taylor
expansion in a Cartesian closed differential category from [26].

##  2 Cartesian Differential Categories

In this background section, we review the basics of Cartesian differential
categories, primarily to set up terminology and notation. We refer the reader
to [3, 6, 19] for a more in-depth introduction to Cartesian differential
categories.

In an arbitrary category $\mathbb{X}$, objects will be denoted by capital
letters $A,B,X,Y$, etc. and maps by minuscule letters $f,g,h$, etc. We denote
homsets by $\mathbb{X}(A,B)$, maps as arrows
$f:A\allowbreak\mathrel{\mathop{\hbox
to11.99998pt{\rightarrowfill}}\limits}B$, identity maps as
$1_{A}:A\allowbreak\mathrel{\mathop{\hbox
to11.99998pt{\rightarrowfill}}\limits}A$, and we use the classical notation
for composition, $\circ$, as opposed to diagrammatic order which was used in
other papers on Cartesian (reverse) differential categories, such as in [3].
For a category with finite products, we denote the product by $\times$, the
projection maps by ${\pi_{j}:A_{0}\times\ldots\times
A_{n}\allowbreak\mathrel{\mathop{\hbox
to11.99998pt{\rightarrowfill}}\limits}A_{j}}$, and the pairing operation as
$\langle-,\ldots,-\rangle$.

In this paper, we will work with Cartesian differential categories relative to
a fixed commutative semiring $k$, as was done in [19]. As such, in this
relative setting, the underlying structure of a Cartesian differential
category is that of a _Cartesian left $k$-linear category_ [19, Sec 2.1],
which can be described as a category with finite products which is _skew_
-enriched over the category of $k$-modules and $k$-linear maps between them
[19]. Essentially, this means that each homset is a $k$-module, so we have
zero maps, can take the sum of maps and also scalar multiply maps by elements
of $k$, but also allow for maps which do not preserve this $k$-module
structure. Maps which do are called _$k$ -linear maps_. Explicitly, a left
$k$-linear category is a category $\mathbb{X}$ such that each homset
$\mathbb{X}(A,B)$ is a $k$-module with scalar multiplication
$\cdot:k\times\mathbb{X}(A,B)\allowbreak\mathrel{\mathop{\hbox
to11.99998pt{\rightarrowfill}}\limits}\mathbb{X}(A,B)$, addition
${+:\mathbb{X}(A,B)\times\mathbb{X}(A,B)\allowbreak\mathrel{\mathop{\hbox
to11.99998pt{\rightarrowfill}}\limits}\mathbb{X}(A,B)}$, and zero
$0\in\mathbb{X}(A,B)$; and such that pre-composition preserves the $k$-linear
structure: $(r\cdot f+s\cdot g)\circ x=r\cdot(f\circ x)+s\cdot(g\circ x)$. A
map $f:A\allowbreak\mathrel{\mathop{\hbox
to11.99998pt{\rightarrowfill}}\limits}B$ is said to be $k$-linear if post-
composition by $f$ preserves the $k$-linear structure: $f\circ(r\cdot x+s\cdot
y)=r\cdot(f\circ x)+s\cdot(f\circ y)$. Then a Cartesian left $k$-linear
category is a left $k$-linear category $\mathbb{X}$ such that $\mathbb{X}$ has
finite products and all projection maps $\pi_{j}$ are $k$-linear. We note that
when taking $k=\mathbb{N}$, the semiring of natural numbers, (Cartesian) left
$\mathbb{N}$-linear categories and their $\mathbb{N}$-linear maps are the same
thing as (Cartesian) left additive categories and their additive maps from [3,
Def 1.1.1 & 1.2.1].

A Cartesian differential category is a Cartesian $k$-linear category that
comes equipped with a _differential combinator_ , an operator that sends maps
to their derivative. When taking $k=\mathbb{N}$, a Cartesian
$\mathbb{N}$-differential category is precisely the same thing as the original
definition from [3, Def 2.1.1]. It is important to note that in this paper, we
follow the now more widely used convention for Cartesian differential
categories, which flips the convention used in early works such as in [3, 26],
so that the linear argument of the derivative is in the second argument rather
than in the first.

###### Definition 2.1

A Cartesian $k$-differential category [19, Sec 2.2] is a Cartesian left
$k$-linear category $\mathbb{X}$ equipped with a differential combinator
$\mathsf{D}$, which is a family of functions (indexed by pairs of objects of
$\mathbb{X}$) $\mathsf{D}:\mathbb{X}(A,B)\allowbreak\mathrel{\mathop{\hbox
to11.99998pt{\rightarrowfill}}\limits}\mathbb{X}(A\times A,B)$ such that the
seven axioms [CD.1] to [CD.7] described below hold. For a map
$f:A\allowbreak\mathrel{\mathop{\hbox
to11.99998pt{\rightarrowfill}}\limits}B$, the map $\mathsf{D}[f]:A\times
A\allowbreak\mathrel{\mathop{\hbox to11.99998pt{\rightarrowfill}}\limits}B$ is
called the derivative of $f$.

The seven axioms of a differential combinator are analogues of the basic
properties of the total derivative from multivariable differential calculus.
They are that: [CD.1] the differential combinator is a $k$-linear morphism,
[CD.2] derivatives are $k$-linear in their second argument, [CD.3] identity
maps and projections are _differential_ linear, [CD.4] the derivative of a
pairing is the pairing of the derivatives, [CD.5] the chain rule for the
derivative of a composition, [CD.6] derivatives are _differential_ linear in
their second argument, and lastly [CD.7] the symmetry of the mixed _partial_
derivatives. Cartesian differential categories have a very practical term
calculus [3, Sec 4], which is highly useful for writing definitions and
proofs. So, we write the derivative as follows:

$\mathsf{D}[f](a,b):=\dfrac{\mathsf{d}f(x)}{\mathsf{d}x}(a)\cdot b$

Then the axioms of the differential combinator are that:

  1. [CD.1]

$\dfrac{\mathsf{d}r\cdot f(x)+s\cdot g(x)}{\mathsf{d}x}(a)\cdot
b=r\cdot\dfrac{\mathsf{d}f(x)}{\mathsf{d}x}(a)\cdot
b+s\cdot\dfrac{\mathsf{d}g(x)}{\mathsf{d}x}(a)\cdot b$;

  2. [CD.2]

$\dfrac{\mathsf{d}f(x)}{\mathsf{d}x}(a)\cdot(r\cdot b+s\cdot
c)=r\cdot\dfrac{\mathsf{d}f(x)}{\mathsf{d}x}(a)\cdot
b+s\cdot\dfrac{\mathsf{d}f(x)}{\mathsf{d}x}(a)\cdot b$

  3. [CD.3]

$\dfrac{\mathsf{d}x_{j}}{\mathsf{d}x_{j}}(a_{0},\ldots,a_{n})\cdot(b_{0},\ldots,b_{n})=b_{j}$
and
$\dfrac{\mathsf{d}x_{j}}{\mathsf{d}x_{i}}(a_{0},\ldots,a_{n})\cdot(b_{0},\ldots,b_{n})=0$
if $i\neq j$

  4. [CD.4]

$\dfrac{\mathsf{d}\left\langle
f_{0}(x),\ldots,f_{n}(x)\right\rangle}{\mathsf{d}x}(a)\cdot
b=\left\langle\dfrac{\mathsf{d}f_{1}(x)}{\mathsf{d}x}(a)\cdot
b,\ldots,\dfrac{\mathsf{d}f_{n}(x)}{\mathsf{d}x}(a)\cdot b\right\rangle$

  5. [CD.5]

$\dfrac{\mathsf{d}g\left(f(x)\right)}{\mathsf{d}x}(a)\cdot
b=\dfrac{\mathsf{d}g(y)}{\mathsf{d}y}(f(a))\cdot\left(\dfrac{\mathsf{d}f(x)}{\mathsf{d}x}(a)\cdot
b\right)$

  6. [CD.6]

$\dfrac{\mathsf{d}\dfrac{\mathsf{d}f(x)}{\mathsf{d}x}(y)\cdot
z}{\mathsf{d}(y,z)}(a,0)\cdot(0,b)=\dfrac{\mathsf{d}f(x)}{\mathsf{d}x}(a)\cdot
b$

  7. [CD.7]

$\dfrac{\mathsf{d}\dfrac{\mathsf{d}f(x)}{\mathsf{d}x}(y)\cdot
z}{\mathsf{d}(y,z)}(a,b)\cdot(c,d)=\dfrac{\mathsf{d}\dfrac{\mathsf{d}f(x)}{\mathsf{d}x}(y)\cdot
z}{\mathsf{d}(y,z)}(a,c)\cdot(b,d)$

###### Example 2.2

Here are some well-known examples of Cartesian differential categories:

  1. (i)

Let $k\text{-}\mathsf{POLY}$ be the category whose objects are
$n\in\mathbb{N}$ and where a map ${P:n\allowbreak\mathrel{\mathop{\hbox
to11.99998pt{\rightarrowfill}}\limits}m}$ is an $m$-tuple of polynomials in
$n$ variables, that is, $P=\langle
p_{1}(\vec{x}),\ldots,p_{m}(\vec{x})\rangle$ with $p_{i}(\vec{x})\in
k[x_{1},\ldots,x_{n}]$. Then $k\text{-}\mathsf{POLY}$ is a Cartesian
$k$-differential category where the differential combinator is given by the
standard differentiation of polynomials. So for $P=\langle
p_{1}(\vec{x}),\ldots,p_{m}(\vec{x})\rangle:n\allowbreak\mathrel{\mathop{\hbox
to11.99998pt{\rightarrowfill}}\limits}m$, its derivative
$\mathsf{D}[P]:n\times n\allowbreak\mathrel{\mathop{\hbox
to11.99998pt{\rightarrowfill}}\limits}m$ is defined as the tuple of
polynomials
$\mathsf{D}[P]=\left(\mathsf{D}[p_{1}](\vec{x},\vec{y}),\ldots,\mathsf{D}[p_{m}](\vec{x},\vec{y})\right)$
where $\mathsf{D}[p_{j}](\vec{x},\vec{y})$ is the sum of the partial
derivatives of $p_{j}(\vec{x})$, that is,
$\mathsf{D}[p_{j}](\vec{x},\vec{y})=\sum^{n}_{i=1}\frac{\partial
p_{j}}{\partial x_{i}}(\vec{x})y_{i}\in
k[x_{1},\ldots,x_{n},y_{1},\ldots,y_{n}]$.

  2. (ii)

Let $\mathbb{R}$ be the set of real numbers. Define $\mathsf{SMOOTH}$ as the
category whose objects are the Euclidean spaces $\mathbb{R}^{n}$ and whose
maps are smooth functions between them. $\mathsf{SMOOTH}$ is a Cartesian
$\mathbb{R}$-differential category where the differential combinator is
defined as the total derivative of a smooth function. For a smooth function
${F:\mathbb{R}^{n}\allowbreak\mathrel{\mathop{\hbox
to11.99998pt{\rightarrowfill}}\limits}\mathbb{R}^{m}}$, which is in fact an
$m$-tuple $F=\langle f_{1},\ldots,f_{m}\rangle$ of smooth functions
$f_{i}:\mathbb{R}^{n}\allowbreak\mathrel{\mathop{\hbox
to11.99998pt{\rightarrowfill}}\limits}\mathbb{R}$, its derivative
${\mathsf{D}[F]:\mathbb{R}^{n}\times\mathbb{R}^{n}\allowbreak\mathrel{\mathop{\hbox
to11.99998pt{\rightarrowfill}}\limits}\mathbb{R}^{m}}$ is defined as
$\mathsf{D}[F]=\left(\mathsf{D}[f_{1}](\vec{x},\vec{y}),\ldots,\mathsf{D}[f_{m}](\vec{x},\vec{y})\right)$
where
$\mathsf{D}[f_{j}]:\mathbb{R}^{n}\times\mathbb{R}^{n}\allowbreak\mathrel{\mathop{\hbox
to11.99998pt{\rightarrowfill}}\limits}\mathbb{R}$ is defined as the sum of
partial derivatives of $f_{j}$, so
$\mathsf{D}[f_{j}](\vec{x},\vec{y})=\sum^{n}_{i=1}\frac{\partial
f_{1}}{\partial x_{i}}(\vec{x})y_{i}$. Note that
$\mathbb{R}\text{-}\mathsf{POLY}$ is a sub-Cartesian differential category of
$\mathsf{SMOOTH}$.

  3. (iii)

Important examples of Cartesian differential categories are the coKleisli
categories of differential categories [2, 1]. Briefly, a differential category
is, amongst other things, a symmetric monoidal category $\mathbb{X}$ with a
comonad $\oc$ which comes equipped with a natural transformation
$\partial_{A}:\oc A\otimes A\allowbreak\mathrel{\mathop{\hbox
to11.99998pt{\rightarrowfill}}\limits}\oc A$, called the deriving
transformation [1, Def 7], that satisfies analogues of the basic rules of
differentiation such as the chain rule and the product rule. CoKleisli maps
$f:\oc A\allowbreak\mathrel{\mathop{\hbox
to11.99998pt{\rightarrowfill}}\limits}B$ are interpreted as smooth maps from
$A$ to $B$, where the derivative of $f$ is given by pre-composing with the
deriving transformation, $f\circ\partial_{A}:\oc A\otimes
A\allowbreak\mathrel{\mathop{\hbox to11.99998pt{\rightarrowfill}}\limits}B$
[1, Def 2.3]. This can be made precise by saying that for a differential
category $\mathbb{X}$ with finite products, its coKleisli category
$\mathbb{X}_{\oc}$ is a Cartesian differential category where the differential
combinator $\mathsf{D}$ is defined using the deriving transformation
$\partial$ [3, Prop 3.2.1]. For more details on differential categories, we
invite the reader to see [2, 1, 13, 19, 21].

See [6, 19] for lists of more examples of Cartesian differential categories.

There are two important classes of maps in a Cartesian differential category
that are worth mentioning: _differential_ linear maps [3, Definition 2.2.1]
and _differential_ constant maps [24, Sec 6]. Differential constants are maps
whose derivative is zero, while differential linear maps are maps whose
derivatives are themselves.

###### Definition 2.3

In a Cartesian $k$-differential category, a map
$f:A\allowbreak\mathrel{\mathop{\hbox to11.99998pt{\rightarrowfill}}\limits}B$
is:

  1. (i)

a $\mathsf{D}$-constant [24, Def 6.1] if
$\dfrac{\mathsf{d}f(x)}{\mathsf{d}x}(a)\cdot b=0$

  2. (ii)

$\mathsf{D}$-linear [19, Def 2.7] if
$\dfrac{\mathsf{d}f(x)}{\mathsf{d}x}(a)\cdot b=f(b)$.

Properties of differential constants can be found in [24, Sec 6], while
properties of differential linear maps can be found in [6, Lemma 2.6].

Two essential operations which can be derived from the total derivative are
_partial_ derivatives and _higher-order_ derivatives. Starting with partial
derivative, given a map of, say, type $f:C_{1}\times A\times
C_{2}\allowbreak\mathrel{\mathop{\hbox
to11.99998pt{\rightarrowfill}}\limits}B$, we’d like to take the derivative of
$f$ with respect to $A$ while keeping the others constant. In classical
differential calculus, partial derivatives are obtained by inserting zeroes in
the appropriate vector argument of the total derivative. The same idea is true
in Cartesian differential categories, where we obtain partial derivatives by
inserting zeroes into the total derivative [3, Sec 4.5].

###### Definition 2.4

In a Cartesian $k$-differential category, for a map $f:C_{1}\times A\times
C_{2}\allowbreak\mathrel{\mathop{\hbox
to11.99998pt{\rightarrowfill}}\limits}B$, its partial derivative [19, Def 2.7]
in $A$ is the map $\mathsf{D}^{C_{1}\times\\_\times C_{2}}[f]:C_{1}\times
A\times C_{2}\times A\allowbreak\mathrel{\mathop{\hbox
to11.99998pt{\rightarrowfill}}\limits}B$, which in term calculus is written
as:

$\mathsf{D}^{C_{1}\times\\_\times
C_{2}}[f](c_{1},a_{1},c_{2},a_{2})=\dfrac{\mathsf{d}f(c_{1},x,c_{2})}{\mathsf{d}x}(a_{1})\cdot
a_{2}$

and is defined as follows:

$\dfrac{\mathsf{d}f(c_{1},x,c_{2})}{\mathsf{d}x}(a_{1})\cdot
a_{2}=\dfrac{\mathsf{d}f(v,x,u)}{\mathsf{d}(v,x,u)}(c_{1},a_{1},c_{2})\cdot(0,a_{2},0)$

Moreover, we say that $f:C_{1}\times A\times
C_{2}\allowbreak\mathrel{\mathop{\hbox
to11.99998pt{\rightarrowfill}}\limits}B$ is:

  1. (i)

$\mathsf{D}$-constant in $A$ if
$\dfrac{\mathsf{d}f(c_{1},x,c_{2})}{\mathsf{d}x}(a_{1})\cdot a_{2}=0$

  2. (ii)

$\mathsf{D}$-linear in $A$ if
$\dfrac{\mathsf{d}f(c_{1},x,c_{2})}{\mathsf{d}x}(a_{1})\cdot
a_{2}=f(c_{1},a_{2},c_{2})$.

Let’s now discuss _higher-order derivatives_ , which will play a central role
in the story of this paper. For $n\in\mathbb{N}$, denote $A^{\times^{n}}$ as a
shorthand for the product of $n$-copies of $A$, with the convention that
$A^{\times^{0}}=\ast$ and $A^{\times^{1}}=A$. Now for a map
$f:A\allowbreak\mathrel{\mathop{\hbox
to11.99998pt{\rightarrowfill}}\limits}B$, applying the differential combinator
$n$-times results in a map of type
$\mathsf{D}^{n}[f]:A^{\times^{2^{n}}}\allowbreak\mathrel{\mathop{\hbox
to11.99998pt{\rightarrowfill}}\limits}B$ called the $n$-th total derivative of
$f$. However, as explained in [19, Sec 3.1], due to the fact that total
derivatives are equal to the sum of the partial derivatives [3, Lemma 4.5.1]
and also [CD.6], there is a lot of extra redundant information in
$\mathsf{D}^{n}[f]$. For example, the second total derivative can be worked
out to be:

$\mathsf{D}^{2}[f](a,b,c,d)=\dfrac{\mathsf{d}\dfrac{\mathsf{d}f(x)}{\mathsf{d}x}(y)\cdot
b}{\mathsf{d}y}(a)\cdot c+\dfrac{\mathsf{d}f(x)}{\mathsf{d}x}(a)\cdot d$

So we see that $\mathsf{D}^{2}[f]$ has a $\mathsf{D}[f]$ summand – which does
not tell us any new information about $f$. Instead, all the new information
comes from differentiating the first argument repeatedly.

###### Definition 2.5

In a Cartesian $k$-differential category, for a map
$f:A\allowbreak\mathrel{\mathop{\hbox to11.99998pt{\rightarrowfill}}\limits}B$
and every $n\in\mathbb{N}$, the $n$-th derivative [19, Def 3.1] of $f$ is the
map $\partial^{(n)}[f]:A\times A^{\times^{n}}\allowbreak\mathrel{\mathop{\hbox
to11.99998pt{\rightarrowfill}}\limits}B$, which is written in the term
calculus as:

$\partial^{(n)}[f](a_{0},a_{1},\ldots,a_{n}):=\dfrac{\mathsf{d}^{(n)}f(x)}{\mathsf{d}f(x)}(a_{0})\cdot
a_{1}\cdot\ldots\cdot a_{n}$

and is defined inductively as:

$\displaystyle\dfrac{\mathsf{d}^{(0)}f(x)}{\mathsf{d}f(x)}(a_{0})=f(a_{0})\qquad\dfrac{\mathsf{d}^{(n+1)}f(x)}{\mathsf{d}f(x)}(a_{0})\cdot
a_{1}\cdot\ldots\cdot a_{n}\cdot
a_{n+1}=\dfrac{\mathsf{d}\dfrac{\mathsf{d}^{(n)}f(x)}{\mathsf{d}f(x)}(y)\cdot
a_{1}\cdot\ldots\cdot a_{n}}{\mathsf{d}y}(a_{0})\cdot a_{n+1}$

Here are now some of the main identities for higher-order derivatives, where
in particular, we highlight that [HD.1] to [HD.7] are the higher-order
versions of [CD.1] to [CD.7]. As such, [HD.5] is Faà di Bruno’s Formula, which
expresses the higher-order chain rule. Let’s introduce some notation to help
write down Faà di Bruno’s Formula. For every $n\in\mathbb{N}$, let
$[0]=\emptyset$ and let $[n+1]=\\{1<\ldots<n+1\\}$. Now for every subset
$I=\\{i_{1}<\ldots<i_{m}\\}\subseteq[n+1]$, for a vector
$\vec{x}=(x_{1},\ldots,x_{n+1})$, define
$\vec{x}|_{I}=(x_{i_{1}},\ldots,x_{i_{m}})$. Lastly, we denote a _non-empty_
partition of $[n+1]$ as $[n+1]=A_{1}|\ldots|A_{k}$, and let $|A_{j}|$ be the
cardinality of $A_{j}$. Then Faà di Bruno’s Formula [19, Lemma 3.14] for the
$n+1$-th derivative is given as a sum over the non-empty partitions of
$[n+1]$.

###### Lemma 2.6

[19, Sec 3] In a Cartesian $k$-differential category:

  1. [HD.0]

If $f$ is a $\mathsf{D}$-constant then $\partial^{n+1}[f]=0$ for all
$n\in\mathbb{N}$;

  2. [HD.1]

$\partial^{n}[r\cdot f+s\cdot g]=r\cdot\partial^{n}[f]+s\cdot\partial^{n}[g]$
for all $r,s\in k$

  3. [HD.2]

$\partial^{n}[f]$ is $k$-linear in its last $n$-arguments;

  4. [HD.3]

If $f$ is $\mathsf{D}$-linear then $\partial^{n+2}[f]=0$ for all
$n\in\mathbb{N}$;

  5. [HD.4]

$\partial^{n}[\left\langle
f_{0},\ldots,f_{n}\right\rangle]=\left\langle\partial^{n}[f_{0}],\ldots,\partial^{n}[f_{n}]\right\rangle$;

  6. [HD.5]

The following equality holds:

$\displaystyle\dfrac{\mathsf{d}^{(n)}g(f(x))}{\mathsf{d}x}(a_{0})\cdot
a_{1}\cdot\ldots\cdot a_{n}$
$\displaystyle=\sum\limits_{[n]=A_{1}|\ldots|A_{k}}\dfrac{\mathsf{d}^{(k)}g(z)}{\mathsf{d}z}(a_{0})\cdot\left(\dfrac{\mathsf{d}^{\left(|A_{1}|\right)}f(x)}{\mathsf{d}x}(a_{0})\cdot\vec{a}|_{A_{1}}\right)\cdot\ldots\cdot\left(\dfrac{\mathsf{d}^{\left(|A_{k}|\right)}f(x)}{\mathsf{d}x}(a_{0})\cdot\vec{a}|_{A_{k}}\right)$

  7. [HD.6]

$\partial^{n}[f]$ is $\mathsf{D}$-linear in its last $n$-arguments;

  8. [HD.7]

$\partial^{n}[f]$ is symmetric in its last $n$-arguments;

  9. [HD.8]

The following equalities hold:

$\displaystyle\dfrac{\mathsf{d}\dfrac{\mathsf{d}^{(n)}f(u)}{\mathsf{d}u}(x_{0})\cdot
x_{1}\cdot\ldots\cdot
x_{n}}{\mathsf{d}(x_{0},x_{1},\ldots,x_{n})}(a_{0},a_{1},\ldots,a_{n})\cdot(b_{0},b_{1},\ldots,b_{n})$
$\displaystyle=\dfrac{\mathsf{d}^{(n)}\dfrac{\mathsf{d}f(u)}{\mathsf{d}u}(x)\cdot
y}{\mathsf{d}(x,y)}(a_{0},b_{0})\cdot(a_{1},b_{1})\cdot\ldots\cdot(a_{n},b_{n})$
$\displaystyle=\dfrac{\mathsf{d}^{(n+1)}f(x)}{\mathsf{d}f(x)}(a_{0})\cdot
a_{1}\cdot\ldots\cdot a_{n}\cdot
b_{0}+\sum\limits^{n}_{i=1}\dfrac{\mathsf{d}^{(n)}f(x)}{\mathsf{d}f(x)}(a_{0})\cdot
a_{1}\cdot\ldots a_{i-1}\cdot b_{i}\cdot a_{i+1}\cdot\ldots\cdot a_{n}$

##  3 Differential Polynomials

In this section, we introduce the concept of _differential polynomials_ in a
Cartesian differential category, which will be a useful intermediate concept
for the story of Taylor series. Classically, polynomials are defined, of
course, using multiplication, sums, and scalar multiplication. However, while
a Cartesian differential category has access to sums and scalar
multiplication, an arbitrary Cartesian differential category may not have a
proper notion of multiplication of maps. Instead, another way of
characterizing polynomials amongst the smooth functions is that they are
smooth functions whose $n$th derivative is zero. This definition of
polynomials can be easily given in a Cartesian differential category.

###### Definition 3.1

In a Cartesian $k$-differential category, a $\mathsf{D}$-polynomial is a map
$p:A\allowbreak\mathrel{\mathop{\hbox to11.99998pt{\rightarrowfill}}\limits}B$
such that there is a $n\in\mathbb{N}$ such that $\partial^{(n+1)}[p]=0$. For a
$\mathsf{D}$-polynomial $p$, the smallest $n\in\mathbb{N}$ such that
$\partial^{(n+1)}[p]=0$ is called the $\mathsf{D}$-degree of $p$, which we
denote as $\mathsf{deg}(p)$.

Differential polynomials are closed under all the basic operations of a
Cartesian differential category. As such, the differential polynomials of a
Cartesian differential category form a Cartesian differential category.

###### Lemma 3.2

In a Cartesian $k$-differential category,

  1. (i)

$\mathsf{D}$-constants are $\mathsf{D}$-polynomials of $\mathsf{D}$-degree
$0$;

  2. (ii)

$\mathsf{D}$-linear maps are $\mathsf{D}$-polynomials of degree $1$;

  3. (iii)

Identity maps and projections maps are $\mathsf{D}$-polynomials of
$\mathsf{D}$-degree $1$;

  4. (iv)

If $p:A\allowbreak\mathrel{\mathop{\hbox
to11.99998pt{\rightarrowfill}}\limits}B$ and
$q:A\allowbreak\mathrel{\mathop{\hbox to11.99998pt{\rightarrowfill}}\limits}B$
are $\mathsf{D}$-polynomials, then $r\cdot p+s\cdot q$ is a
$\mathsf{D}$-polynomial whose $\mathsf{deg}(r\cdot p+s\cdot
q)\leq\mathsf{max}\\{\mathsf{deg}(p),\mathsf{deg}(q)\\}$;

  5. (v)

If $p_{j}:A\allowbreak\mathrel{\mathop{\hbox
to11.99998pt{\rightarrowfill}}\limits}B_{j}$ are $\mathsf{D}$-polynomials,
then $\langle p_{0},\ldots,p_{n}\rangle:A\allowbreak\mathrel{\mathop{\hbox
to11.99998pt{\rightarrowfill}}\limits}B_{0}\times\ldots\times B_{n}$ is a
$\mathsf{D}$-polynomial where $\mathsf{deg}(\langle
p_{0},\ldots,p_{n}\rangle)=\mathsf{max}\\{\mathsf{deg}(p_{j})\\}$;

  6. (vi)

If $p:A\allowbreak\mathrel{\mathop{\hbox
to11.99998pt{\rightarrowfill}}\limits}B$ and
$q:B\allowbreak\mathrel{\mathop{\hbox to11.99998pt{\rightarrowfill}}\limits}C$
are $\mathsf{D}$-polynomials, then $q\circ p$ is a $\mathsf{D}$-polynomial
where $\mathsf{deg}(p\circ q)\leq\mathsf{deg}(p)\mathsf{deg}(q)$;

  7. (vii)

If $p:A\allowbreak\mathrel{\mathop{\hbox
to11.99998pt{\rightarrowfill}}\limits}B$ is a $\mathsf{D}$-polynomial, then
$\mathsf{D}[p]:A\times A\allowbreak\mathrel{\mathop{\hbox
to11.99998pt{\rightarrowfill}}\limits}B$ is a $\mathsf{D}$-polynomial where
$\mathsf{deg}\left(\mathsf{D}[p]\right)=\mathsf{deg}(p)$.

Proof: These follow mostly from Lemma 2.6. So (i) and (ii) are immediate from
[HD.0] and [HD.3] respectively, and since [CD.3] tells us that identity maps
and projections are $\mathsf{D}$-linear, (iii) follows from (ii). Both (iv)
and (v) are straightforward to check using [HD.1] and [HD.4] respectively. The
remaining two require a bit more explanation. So for (vi), let
$\mathsf{deg}(p)=n$ and $\mathsf{deg}(q)=m$. Consider
$\partial^{(mn+1)}[q\circ p]$. Faà di Bruno’s Formula [HD.5] tells us that
$\partial^{(mn+1)}[q\circ p]$ is a sum indexed by non-empty partitions of
$[mn+1]=A_{1}|\ldots|A_{k}$, so we have that $1\leq k\leq mn+1$. If $m<k$,
then $\partial^{(k)}[q]=0$, so all the summands of partitions of size $m<k$
are zero. If $k\leq m$, then $n\leq\frac{mn+1}{k}$, which means that in the
partition, there is some $A_{j}$ with $n<|A_{j}|$. So
$\partial^{|A_{j}|}[p]=0$, and since by [HD.2] $\partial^{(k)}[q]$ is
$k$-linear in its last $k$-arguments means that we will get zero for the
summand of the partition. So we conclude that $\partial^{(mn+1)}[q\circ p]=0$,
and thus $q\circ p$ is a $\mathsf{D}$-polynomial. Lastly for (vii), suppose
that $\mathsf{deg}(p)=n$. Now [HD.8] essentially tells us that $\mathsf{D}$
and $\partial^{(-)}$ commute, up to permutation. So since
$\partial^{(n+1)}[p]=0$, we get that $\partial^{(n+1)}[\mathsf{D}[p]]=0$ and
so $\mathsf{D}[p]$ is a $\mathsf{D}$-polynomial with at least
$\mathsf{deg}\left(\mathsf{D}[p]\right)\leq n$. Now suppose that
$\mathsf{deg}\left(\mathsf{D}[p]\right)=k<n$, so
$\partial^{(k+1)}[\mathsf{D}[p]]=0$. However, note that by [HD.8] and [HD.2],
we can recover $\partial^{(k+1)}[p]$ from $\partial^{(k+1)}[\mathsf{D}[p]]$ by
coping the $i$th term and inserting some zeroes:

$\displaystyle\dfrac{\mathsf{d}\dfrac{\mathsf{d}^{(k+1)}f(u)}{\mathsf{d}u}(x_{0})\cdot
x_{1}\cdot\ldots\cdot
x_{n}}{\mathsf{d}(x_{0},x_{1},\ldots,x_{n})}(a_{0},a_{1},\ldots,a_{n})\cdot(0,a_{i},0,\ldots,0)=\dfrac{\mathsf{d}^{(n)}f(x)}{\mathsf{d}f(x)}(a_{0})\cdot
a_{1}\cdot\ldots\cdot a_{n}$

However since by assumption $\partial^{(k+1)}[\mathsf{D}[p]]=0$, it follows
that $\partial^{(k+1)}[\mathsf{D}[p]]=0$. But this is a contradiction by the
definition of $\mathsf{deg}(p)=n$. So we must have that
$\mathsf{deg}\left(\mathsf{D}[p]\right)=\mathsf{deg}(p)$, as desired. $\Box$

###### Corollary 3.3

For a Cartesian $k$-differential category $\mathbb{X}$, let
$\mathsf{D}\text{-}\mathsf{POLY}[\mathbb{X}]$ be the sub-category of
$\mathsf{D}$-polynomials of $\mathbb{X}$. Then
$\mathsf{D}\text{-}\mathsf{POLY}[\mathbb{X}]$ is a sub-Cartesian
$k$-differential category of $\mathbb{X}$.

###### Example 3.4

Here are the differential polynomials in our main examples:

  1. (i)

Every map in $k\text{-}\mathsf{POLY}$ is a $\mathsf{D}$-polynomial, so
$\mathsf{D}\text{-}\mathsf{POLY}[k\text{-}\mathsf{POLY}]=k\text{-}\mathsf{POLY}$.
However, the $\mathsf{D}$-degree may not necessarily align with a polynomial’s
usual degree. Indeed, consider the case for $k=\mathbb{Z}_{2}$, the integers
module $2$. Then for $p(x)=x^{2}$, we get that $\mathsf{D}[p](x,y)=2xy=0$. So
$x^{2}$ is a $\mathsf{D}$-constant in $\mathbb{Z}_{2}\text{-}\mathsf{POLY}$ so
$\mathsf{deg}(x^{2})=0$, which is clearly different from its usual degree of
$2$. However, if $k$ is an integral domain (which recall means for $r,s\in k$,
if $rs=0$ then $r=0$ or $s=0$) and has characteristic zero (which recall means
that for all $n\in\mathbb{N}$, for $n+1\in k$ we have that $n+1\neq 0$), then
the $\mathsf{D}$-degree does match the usual polynomial degree.

  2. (ii)

The $\mathsf{D}$-polynomials in $\mathsf{SMOOTH}$ are precisely tuples of
usual real polynomial functions, so
$\mathsf{D}\text{-}\mathsf{POLY}[\mathsf{SMOOTH}]=\mathbb{R}\text{-}\mathsf{POLY}$.

  3. (iii)

The $\mathsf{D}$-polynomials in the coKleisli category of a differential
category with finite products correspond precisely to the notion of
polynomials in a differential category as defined by Ehrhard in [13, Sec
4.1.1]. So define $\partial^{(n)}_{A}:\oc A\otimes
A^{\otimes^{n}}\allowbreak\mathrel{\mathop{\hbox
to11.99998pt{\rightarrowfill}}\limits}\oc A$ inductively as
$\partial^{(0)}_{A}=1_{\oc A}$ and
$\partial^{(n+1)}_{A}=\partial_{A}\circ(\partial^{(n)}_{A}\otimes 1_{A})$.
Then $f:\oc A\allowbreak\mathrel{\mathop{\hbox
to11.99998pt{\rightarrowfill}}\limits}B$ is a $\mathsf{D}$-polynomial if and
only if $f\circ\partial^{(n+1)}_{A}=0$. However, in [13, Sec 4.1.1], Ehrhard
uses another formula for the composition of $\mathsf{D}$-polynomials, which
involves positive rationals, and recaptures the notion of linear application
in Differential Linear Logic [27, 4, 17]. Here, by Lemma 3.2, we get that the
usual coKleisli composition of $\mathsf{D}$-polynomials is again a
$\mathsf{D}$-polynomial, and so
$\mathsf{D}\text{-}\mathsf{POLY}[\mathbb{X}_{\oc}]$ is an actual subcategory
of the coKleisli category. While in well-behaved models, the coKleisli
composition and Ehrhard’s composition may correspond, in general, they need
not be equal.

##  4 Taylor Differentials Polynomials

In this section, we introduce the notion of _Taylor differential monomials_
and _Taylor differential polynomials_ of maps in a Cartesian differential
category.

In differential calculus, for a smooth function
$f:\mathbb{R}\allowbreak\mathrel{\mathop{\hbox
to11.99998pt{\rightarrowfill}}\limits}\mathbb{R}$, its $n$-th Taylor monomial
is defined as the $n$-th term in its Taylor series, that is,
$\frac{1}{n!}\cdot f^{(n)}(0)x^{n}$, where $f^{(n)}$ is the $n$-th derivative
of $f$. Then its $n$-th Taylor polynomial is defined as the sum of all $k\leq
n$-th Taylor monomials, that is, $\sum^{n}_{k=0}\frac{1}{k!}\cdot
f^{(k)}(0)x^{k}$. So, how do we generalize these formulas in a Cartesian
differential category? The first thing to address is scalar multiplication by
$\frac{1}{n!}$. So we need to be in a setting where we can scalar multiply by
positive rationals. As such, we will need to assume that in our base
commutative semiring $k$, every $n=1+\ldots+1\in k$ is invertible. This
amounts to saying that $k$ is a $\mathbb{Q}_{\geq 0}$-algebra, where
$\mathbb{Q}_{\geq 0}$ is the semiring of positive rationals. We next need to
address the $x^{n}$ bit. As mentioned above, arbitrary Cartesian differential
categories do not necessarily have a multiplication operation for maps.
Luckily, this issue is solved thanks to the differential combinator. Indeed,
note that
$\partial^{(n)}[f]:\mathbb{R}\times\mathbb{R}^{\times^{n}}\allowbreak\mathrel{\mathop{\hbox
to11.99998pt{\rightarrowfill}}\limits}\mathbb{R}$ is
$\partial^{(n)}[f](x_{0},x_{1},\ldots,x_{n})=f^{(n)}(x_{0})x_{1}\ldots x_{n}$.
So by inserting zero into the first argument and copying the second argument
$n$ times, we get $\partial^{(n)}[f](0,x,\dots,x)=f^{(n)}(0)x^{n}$. So we
recapture the $n$-th Taylor monomial using the differential combinator via
$\frac{1}{n!}\cdot\partial^{(n)}[f](0,x,\dots,x)=\frac{1}{n!}\cdot
f^{(n)}(0)x^{n}$. This is the formula we generalize to define Taylor
differential monomials in the Cartesian differential setting. The sum of these
Taylor differential monomials gives us the Taylor differential polynomials.

For the remainder of this section, we assume that $k$ is a commutative
$\mathbb{Q}_{\geq 0}$-algebra.

###### Definition 4.1

In a Cartesian $k$-differential category, for a map
$f:A\allowbreak\mathrel{\mathop{\hbox to11.99998pt{\rightarrowfill}}\limits}B$
and every $n\in\mathbb{N}$, define
$\mathcal{M}^{(n)}[f]:A\allowbreak\mathrel{\mathop{\hbox
to11.99998pt{\rightarrowfill}}\limits}B$ as the composite:

$\mathcal{M}^{(n)}[f]:=\dfrac{1}{n!}\cdot\partial^{(n)}[f]\circ\langle
0,1_{A},\ldots,1_{A}\rangle$

which in the term calculus is written as:

$\mathcal{M}^{(n)}[f](x)=\dfrac{1}{n!}\cdot\dfrac{\mathsf{d}^{(n)}f(u)}{\mathsf{d}f(u)}(0)\cdot
x\cdot\ldots\cdot x$

and then define $\mathcal{T}^{(n)}[f]:A\allowbreak\mathrel{\mathop{\hbox
to11.99998pt{\rightarrowfill}}\limits}B$ as:

$\mathcal{T}^{(n)}[f]=\sum^{n}_{k=0}\mathcal{M}^{(k)}[f]$

We note that $\mathcal{M}^{(0)}[f]$ is given by evaluating $f$ at $0$, so
$\mathcal{M}^{(0)}[f](a)=f(0)$, while $\mathcal{M}^{(1)}[f]$ is precisely the
linearization of $f$ (also sometimes written as $\mathsf{L}[f]$), which is
$\mathcal{M}^{(1)}[f](a)=\dfrac{\mathsf{d}f(x)}{\mathsf{d}x}(0)\cdot a$ [6,
Prop 3.6].

###### Example 4.2

Here are the Taylor differential monomials/polynomials of maps in our main
examples:

  1. (i)

The $k$-th Taylor $\mathsf{D}$-monomial of a tuple of polynomials $P=\langle
p_{i}(\vec{x})\rangle^{m}_{i=1}:n\allowbreak\mathrel{\mathop{\hbox
to11.99998pt{\rightarrowfill}}\limits}m$ is
$\mathcal{M}^{(k)}[P]=\langle\mathcal{M}^{(k)}[p_{i}](\vec{x})\rangle^{m}_{i=1}$
where $\mathcal{M}^{(k)}[p_{i}](\vec{x})\in k[x_{1},\ldots,x_{n}]$ are the all
the degree $k$ monomials summands of $p_{i}(\vec{x})$. Then the $j$-th Taylor
$\mathsf{D}$-monomial of $P$ is
$\mathcal{T}^{(j)}[P]=\langle\mathcal{T}^{(j)}[p_{i}](\vec{x})\rangle^{m}_{i=1}$
where $\mathcal{T}^{(j)}[p_{i}](\vec{x})\in k[x_{1},\ldots,x_{n}]$ is the sum
of all degree $k\leq j$ monomial summands of $p_{j}(\vec{x})$. In particular,
for $p(x)=\sum^{n}_{k=0}a_{k}x^{k}$, we get that
$\mathcal{M}^{(k)}[p](\vec{x})=a_{k}x^{k}$ and
$\mathcal{T}^{(j)}[p](x)=\sum^{j}_{k=0}a_{k}x^{k}$.

  2. (ii)

For a smooth function $F=\langle
f_{i}\rangle^{m}_{i=1}:\mathbb{R}^{n}\allowbreak\mathrel{\mathop{\hbox
to11.99998pt{\rightarrowfill}}\limits}\mathbb{R}^{m}$, its $k$-th Taylor
$\mathsf{D}$-monomial is
$\mathcal{M}^{(k)}[F](\vec{x})=\langle\mathcal{M}^{(k)}[f_{i}](\vec{x})\rangle^{m}_{i=1}$
where $\mathcal{M}^{(k)}[f_{i}](\vec{x})$ is the usual $k$-th Taylor monomial
of $f_{i}$ in the multivariable case:

$\mathcal{M}^{(k)}[f_{m}](\vec{x})=\sum\limits_{\\{i_{1},\ldots,i_{k}\\}\subseteq\\{1,\ldots,n\\}}\frac{1}{k!}\cdot\frac{\partial^{(k)}f_{m}}{\partial
x_{i_{1}}\ldots\partial x_{i_{k}}}(\vec{0})x_{i_{1}}\ldots x_{i_{k}}$

Then the $j$-th Taylor $\mathsf{D}$-polynomial of $F$ is the tuple of the
usual $j$-th Taylor polynomials of $f_{i}$ in the multivariable case. In
particular, for a smooth function
$f:\mathbb{R}\allowbreak\mathrel{\mathop{\hbox
to11.99998pt{\rightarrowfill}}\limits}\mathbb{R}$, we get precisely that
$\mathcal{M}^{(k)}[f](x)=\frac{1}{k!}\cdot f^{(k)}(0)x^{k}$ and
$\mathcal{T}^{(j)}[f](x)=\sum^{j}_{k=0}\frac{1}{k!}\cdot f^{(k)}(0)x^{k}$.

  3. (iii)

In a differential category, using the contraction and dereliction natural
transformations, we obtain natural transformations of type $\oc
A\allowbreak\mathrel{\mathop{\hbox to11.99998pt{\rightarrowfill}}\limits}\oc
A\otimes A^{\otimes^{n}}$. Post-composing this with the natural transformation
$\partial^{(n)}_{A}:\oc A\otimes
A^{\otimes^{n}}\allowbreak\mathrel{\mathop{\hbox
to11.99998pt{\rightarrowfill}}\limits}\oc A$ gives us the natural
transformation $\mathsf{M}^{(n)}_{A}:\oc A\allowbreak\mathrel{\mathop{\hbox
to11.99998pt{\rightarrowfill}}\limits}\oc A$ as defined in [21, Sec III.E].
Then define the natural transformation $\mathsf{T}^{(n)}_{A}:\oc
A\allowbreak\mathrel{\mathop{\hbox to11.99998pt{\rightarrowfill}}\limits}\oc
A$ as the sum $\mathsf{T}^{(n)}_{A}=\sum^{n}_{k=0}\mathsf{M}^{(k)}_{A}$, as
defined in [13, Sec 3.1]. Then in the coKleisli category, the $n$-th Taylor
$\mathsf{D}$-monomial of a coKleisli map $f:\oc
A\allowbreak\mathrel{\mathop{\hbox to11.99998pt{\rightarrowfill}}\limits}B$ is
worked out to be precisely $\mathcal{M}^{(n)}[f]=f\circ\mathsf{M}^{(n)}_{A}$,
while its $n$-th Taylor $\mathsf{D}$-polynomial is
$\mathcal{T}^{(n)}[f]=f\circ\mathsf{T}^{(n)}_{A}$. The natural transformations
$\mathsf{M}^{(n)}$ and the Taylor $\mathsf{D}$-monomials of coKleisli maps
played a central role in the story of [21], while the natural transformations
$\mathsf{T}^{(n)}$ and the Taylor $\mathsf{D}$-polynomials of coKleisli maps
were studied in detail in [13].

Here are some useful identities about Taylor differential monomials and Taylor
differential polynomials:

###### Lemma 4.3

In a Cartesian $k$-differential category:

  1. (i)

$\mathcal{M}^{(0)}[f]$ is a $\mathsf{D}$-constant;

  2. (ii)

$\mathcal{M}^{(1)}[f]$ is $\mathsf{D}$-linear;

  3. (iii)

$\mathcal{M}^{(n)}[r\cdot f+s\cdot
g]=r\cdot\mathcal{M}^{(n)}[f]+s\cdot\mathcal{M}^{(n)}[g]$;

  4. (iv)

$\mathcal{M}^{(n)}[f](r\cdot a+s\cdot
b)=\frac{1}{n!}\cdot\sum\limits^{n}_{k=0}\frac{r^{k}s^{n-k}}{k!(n-k)!}\cdot\dfrac{\mathsf{d}^{(n+1)}f(x)}{\mathsf{d}x}(0)\cdot\underbrace{a\cdot\ldots\cdot
a}_{\text{$k$-times}}\cdot\underbrace{b\cdot\ldots\cdot
b}_{\text{$n-k$-times}}$

  5. (v)

$\mathcal{M}^{(n)}\left[\langle
f_{0},\ldots,f_{n}\rangle\right]=\left\langle\mathcal{M}^{(n)}[f_{0}],\ldots,\mathcal{M}^{(n)}[f_{n}]\right\rangle$;

  6. (vi)

$\mathcal{M}^{(n)}[g\circ
f](a)=\sum\limits_{n=m_{1}+\ldots+m_{k}}\frac{1}{k!m_{1}!\ldots
m_{k}!}\dfrac{\mathsf{d}^{(k)}g(z)}{\mathsf{d}z}(f(0))\cdot\mathcal{M}^{(m_{1})}[f](a)\cdot\ldots\cdot\mathcal{M}^{(m_{k})}[f](a)$;

  7. (vii)

$\mathcal{M}^{(n)}\left[\mathsf{D}[f]\right](a,b)=\dfrac{\mathsf{d}\mathcal{M}^{(n)}[f](x)}{\mathsf{d}x}(a)\cdot
b$

  8. (viii)

$\dfrac{\mathsf{d}\mathcal{M}^{(n+1)}[f](x)}{\mathsf{d}x}(a)\cdot
b=\frac{1}{n!}\cdot\dfrac{\mathsf{d}^{(n+1)}f(x)}{\mathsf{d}x}(0)\cdot\underbrace{a\cdot\ldots\cdot
a}_{\text{$n$-times}}\cdot b$;

  9. (ix)

$\mathcal{M}^{(n)}[f]$ is a $\mathsf{D}$-polynomial where
$\mathsf{deg}\left(\mathcal{M}^{(n)}[f]\right)=n$ if $\mathcal{M}^{(n)}[f]\neq
0$ and $\mathsf{deg}\left(\mathcal{M}^{(n)}[f]\right)=0$ if
$\mathcal{M}^{(n)}[f]=0$;

  10. (x)

$\mathcal{M}^{(n)}\left[\mathcal{M}^{(n)}[f]\right]=\mathcal{M}^{(n)}[f]$ and
$\mathcal{M}^{(m)}\left[\mathcal{M}^{(n)}[f]\right]=0$ when $m\neq n$;

  11. (xi)

$\mathcal{M}^{(k)}\left[\mathcal{T}^{(n)}[f]\right]=\mathcal{M}^{(k)}[f]$ for
$k\leq n$ and $\mathcal{M}^{(k)}\left[\mathcal{T}^{(n)}[f]\right]=0$ if $n<k$;

  12. (xii)

$\mathcal{T}^{(n)}\left[\mathcal{M}^{(k)}[f]\right]=\mathcal{M}^{(k)}[f]$ for
$k\leq n$ and $\mathcal{T}^{(n)}\left[\mathcal{M}^{(k)}[f]\right]=0$ if $n<k$

  13. (xiii)

$\mathcal{T}^{(n)}\left[\mathcal{T}^{(n)}[f]\right]=\mathcal{T}^{(n)}[f]$, and
also $\mathcal{T}^{(k)}\left[\mathcal{T}^{(n)}[f]\right]=\mathcal{T}^{(k)}[f]$
for $k\leq n$ and
$\mathcal{T}^{(k)}\left[\mathcal{T}^{(n)}[f]\right]=\mathcal{T}^{(n)}[f]$ for
$n<k$;

  14. (xiv)

$\mathcal{T}^{(n)}[f]$ is a $\mathsf{D}$-polynomial where
$\mathsf{deg}\left(\mathcal{T}^{(n)}[f]\right)\leq n$ if
$\mathcal{T}^{(n)}[f]\neq 0$ and
$\mathsf{deg}\left(\mathcal{T}^{(n)}[f]\right)=0$ if $\mathcal{T}^{(n)}[f]=0$

Proof: Now (i) follows from [24, Lem 6.3], while (ii) is given by [24, Lem
3.6.(i)]. It is straightforward to compute that (iii) follows from [HD.1],
(iv) follows from [HD.2] and the binomial theorem, (v) follows from [HD.4],
(vi) follows from [HD.5], while (vii) and (viii) follows from [HD.8]. For
(ix), by Lem 3.2.(i) and (i), we have that $\mathcal{M}^{(0)}[f]$ is a
$\mathsf{D}$-polynomial with $\mathsf{deg}\left(\mathcal{M}^{(0)}[f]\right)=0$
always. For the $n+1$ case, from (viii) we can compute that for $0\leq k\leq
n+1$:

$\displaystyle\dfrac{\mathsf{d}^{(k)}\mathcal{M}^{(n+1)}[f](x)}{\mathsf{d}x}(a)\cdot
b_{1}\cdot\ldots\cdot
b_{k}=\frac{1}{(n+1-k)!}\cdot\dfrac{\mathsf{d}^{(n+1)}f(x)}{\mathsf{d}x}(0)\cdot\underbrace{a\cdot\ldots\cdot
a}_{\text{$n+1-k$-times}}\cdot b_{1}\cdot\ldots\cdot b_{k}$ (1)

So for $k=n+1$, we get that:

$\displaystyle\dfrac{\mathsf{d}^{(n+1)}\mathcal{M}^{(n+1)}[f](x)}{\mathsf{d}x}(a)\cdot
b_{1}\cdot\ldots\cdot
b_{n+1}=\dfrac{\mathsf{d}^{(n+1)}f(x)}{\mathsf{d}x}(0)\cdot
b_{1}\cdot\ldots\cdot b_{n+1}$ (2)

Note that the right-hand side does not depend on the $a$, so it follows that
$\partial^{(n+1)}\left[\mathcal{M}^{(n+1)}[f]\right]$ is $\mathsf{D}$-constant
in its first argument. So we get that
$\partial^{(n+2)}\left[\mathcal{M}^{(n+1)}[f]\right]=0$. Thus
$\mathcal{M}^{(n+1)}[f]$ is a $\mathsf{D}$-polynomial where at least
$\mathsf{deg}\left(\mathcal{M}^{(n+1)}[f]\right)\leq n+1$. If
$\mathcal{M}^{(n+1)}[f]=0$, then since $0$ is a $\mathsf{D}$-constant,
$\mathsf{deg}\left(\mathcal{M}^{(n+1)}[f]\right)=0$. So suppose that
$\mathcal{M}^{(n+1)}[f]\neq 0$. Now suppose that
$\mathsf{deg}\left(\mathcal{M}^{(n+1)}[f]\right)=k<n+1$, then we have that
$\partial^{(k+1)}\left[\mathcal{M}^{(n+1)}[f]\right]=0$. However that from
(1), we get that:

$\displaystyle 0=\frac{1}{(n+1)n\ldots(n+2-k}\cdot
0=\frac{1}{(n+1)n\ldots(n-k)}\cdot\dfrac{\mathsf{d}^{(k+1)}\mathcal{M}^{(n+1)}[f](x)}{\mathsf{d}x}(0)\cdot
a\cdot\ldots\cdot a$
$\displaystyle=\frac{1}{(n+1)n\ldots(n+2-k)}\cdot\frac{1}{(n+1-k)!}\cdot\dfrac{\mathsf{d}^{(n+1)}f(x)}{\mathsf{d}x}(0)\cdot
a\cdot\ldots\cdot a=\mathcal{M}^{(n+1)}[f](a)$

But $\mathcal{M}^{(n+1)}[f](a)\neq 0$, so we get a contradiction. Therefore,
we must also have $n+1\leq\mathsf{deg}\left(\mathcal{M}^{(n+1)}[f]\right)$. So
we get that $\mathsf{deg}\left(\mathcal{M}^{(n+1)}[f]\right)=n+1$ as desired.
Now for (x), the case when $n=0$ clearly holds. For the $n+1$, from (2), we
compute that:

$\displaystyle\mathcal{M}^{(n+1)}\left[\mathcal{M}^{(n+1)}[f]\right](a)=\frac{1}{n!}\cdot\dfrac{\mathsf{d}^{(n+1)}\mathcal{M}^{(n+1)}[f](x)}{\mathsf{d}x}(0)\cdot
a\cdot\ldots\cdot a$
$\displaystyle=\frac{1}{n!}\cdot\dfrac{\mathsf{d}^{(n+1)}f(x)}{\mathsf{d}x}(0)\cdot
a\cdot\ldots\cdot a=\mathcal{M}^{(n+1)}[f](a).$

So
$\mathcal{M}^{(n+1)}\left[\mathcal{M}^{(n+1)}[f]\right]=\mathcal{M}^{(n+1)}[f]$
as desired. On the other hand, suppose that $m\neq n+1$. When $n+1<m$, from
(ix) we get that $\mathcal{M}^{(m)}\left[\mathcal{M}^{(n+1)}[f]\right]=0$.
When $m\leq n+1$, using (1) and [HD.2], we compute that:

$\displaystyle\mathcal{M}^{(m)}\left[\mathcal{M}^{(n+1)}[f]\right](a)=\frac{1}{m!}\cdot\dfrac{\mathsf{d}^{(m)}\mathcal{M}^{(n+1)}[f](x)}{\mathsf{d}x}(0)\cdot
a\cdot\ldots\cdot a$
$\displaystyle=\frac{1}{m!}\cdot\frac{1}{(n+1-m)!}\cdot\dfrac{\mathsf{d}^{(n+1)}f(x)}{\mathsf{d}x}(0)\cdot\underbrace{0\cdot\ldots\cdot
0}_{\text{$n+1-k$-times}}\cdot b_{1}\cdot\ldots\cdot b_{k}=0$

So $\mathcal{M}^{(m)}\left[\mathcal{M}^{(n+1)}[f]\right]=0$ as desired. Then
(xi), (xii), and (xiii) follow from (iii) and (x), while (xiv) follows from
(ix) and Lemma 3.2.(iv). $\Box$

We can also define what we mean by maps being Taylor differential polynomials.

###### Definition 4.4

In a Cartesian $k$-differential category,

  1. (i)

A Taylor $\mathsf{D}$-monomial is a map $m:A\allowbreak\mathrel{\mathop{\hbox
to11.99998pt{\rightarrowfill}}\limits}B$ such that for some $n\in\mathbb{N}$,
$\mathcal{M}^{(n)}[m]=m$;

  2. (ii)

A Taylor $\mathsf{D}$-polynomial is a map
$p:A\allowbreak\mathrel{\mathop{\hbox to11.99998pt{\rightarrowfill}}\limits}B$
such that for some $n\in\mathbb{N}$, $\mathcal{T}^{(n)}[p]=p$.

Note that the $n$ in the definition of Taylor differential
monomials/polynomials is necessarily unique for $f\neq 0$. The terminology is
justified by the fact that by Lemma 3.2.(xiv), every Taylor differential
polynomial is also a differential polynomial. Taylor differential polynomials
are also closed under the Cartesian $k$-differential structure.

###### Lemma 4.5

In a Cartesian $k$-differential category:

  1. (i)

For every $f$, $\mathcal{M}^{(n)}[f]$ is a Taylor $\mathsf{D}$-monomial and
$\mathcal{T}^{(n)}[f]$ is a Taylor $\mathsf{D}$-polynomial;

  2. (ii)

Taylor $\mathsf{D}$-monomials are Taylor $\mathsf{D}$-polynomials;

  3. (iii)

If $f$ is $\mathsf{D}$-linear, then $f$ is a Taylor $\mathsf{D}$-monomial
where $\mathcal{T}^{(1)}[f]=\mathcal{M}^{(1)}[f]=f$;

  4. (iv)

Identity maps and projections maps are Taylor $\mathsf{D}$-monomials;

  5. (v)

If $p:A\allowbreak\mathrel{\mathop{\hbox
to11.99998pt{\rightarrowfill}}\limits}B$ and
$q:A\allowbreak\mathrel{\mathop{\hbox to11.99998pt{\rightarrowfill}}\limits}B$
are Taylor $\mathsf{D}$-polynomials, then $r\cdot p+s\cdot q$ is a Taylor
$\mathsf{D}$-polynomial;

  6. (vi)

If $p_{j}:A\allowbreak\mathrel{\mathop{\hbox
to11.99998pt{\rightarrowfill}}\limits}B_{j}$ are Taylor
$\mathsf{D}$-polynomials, then $\langle p_{0},\ldots,p_{n}\rangle$ is a Taylor
$\mathsf{D}$-polynomial;

  7. (vii)

If $p:A\allowbreak\mathrel{\mathop{\hbox
to11.99998pt{\rightarrowfill}}\limits}B$ and
$q:B\allowbreak\mathrel{\mathop{\hbox to11.99998pt{\rightarrowfill}}\limits}C$
are Taylor $\mathsf{D}$-polynomials, then $q\circ p$ is a Taylor
$\mathsf{D}$-polynomial;

  8. (viii)

If $p:A\allowbreak\mathrel{\mathop{\hbox
to11.99998pt{\rightarrowfill}}\limits}B$ is a Taylor $\mathsf{D}$-polynomial,
then $\mathsf{D}[p]:A\times A\allowbreak\mathrel{\mathop{\hbox
to11.99998pt{\rightarrowfill}}\limits}B$ is a Taylor $\mathsf{D}$-polynomial.

Proof: These follow immediately from the identities in Lemma 3.2. $\Box$

###### Corollary 4.6

For a Cartesian $k$-differential category $\mathbb{X}$, let
$\mathcal{T}\mathsf{D}\text{-}\mathsf{POLY}[\mathbb{X}]$ be the sub-category
of Taylor $\mathsf{D}$-polynomials of $\mathbb{X}$. Then
$\mathcal{T}\mathsf{D}\text{-}\mathsf{POLY}[\mathbb{X}]$ is a sub-Cartesian
$k$-differential category of $\mathbb{X}$ (and of
$\mathsf{D}\text{-}\mathsf{POLY}[\mathbb{X}]$).

###### Example 4.7

Here are the Taylor differential polynomials in our main examples:

  1. (i)

Every map in $k\text{-}\mathsf{POLY}$ is a Taylor $\mathsf{D}$-polynomial, so
we have that
$\mathsf{TD}\text{-}\mathsf{POLY}[k\text{-}\mathsf{POLY}]=k\text{-}\mathsf{POLY}=\mathsf{D}\text{-}\mathsf{POLY}[k\text{-}\mathsf{POLY}]$.
The Taylor $\mathsf{D}$-monomials are the tuples of polynomials whose summands
all have the same degree.

  2. (ii)

The Taylor $\mathsf{D}$-polynomials in $\mathsf{SMOOTH}$ are precisely tuples
of real polynomial functions, so
$\mathsf{TD}\text{-}\mathsf{POLY}[\mathsf{SMOOTH}]=\mathbb{R}\text{-}\mathsf{POLY}=\mathsf{D}\text{-}\mathsf{POLY}[\mathsf{SMOOTH}]$.

  3. (iii)

A coKleisli map $f:\oc A\allowbreak\mathrel{\mathop{\hbox
to11.99998pt{\rightarrowfill}}\limits}B$ is a Taylor $\mathsf{D}$-monomial if
there exists an $n$ such that $f\circ\mathsf{M}^{(n)}_{A}=f$, and a Taylor
$\mathsf{D}$-polynomial if there exists an $n$ such that
$f\circ\mathsf{T}^{(n)}_{A}=f$.

  4. (iv)

In the polynomial and smooth functions examples, the Taylor
$\mathsf{D}$-polynomials and $\mathsf{D}$-polynomials coincide. However, this
is not necessarily true in an arbitrary Cartesian differential category. A
source of counter-examples comes from looking at the $\mathsf{D}$-constants.
Now the only Taylor $\mathsf{D}$-polynomials that are also
$\mathsf{D}$-constants are precisely the maps $c$ which are constant in the
sense that $c\circ 0=c$ (or in other words,
$c=\mathcal{M}^{(0)}[c]=\mathcal{T}^{(0)}[c]$). However, as explained in [24],
there are examples of Cartesian differential categories that have
$\mathsf{D}$-constants that are not constant. Indeed, every _cofree_ Cartesian
differential category [7, 19, 24] have $\mathsf{D}$-constants that are not
constants. Therefore in a cofree Cartesian differential category, there are
$\mathsf{D}$-polynomials that are not Taylor $\mathsf{D}$-polynomials.

##  5 Ultrametric for Taylor Series Convergence

In this section, we introduce a canonical ultrapseudometric for Cartesian
differential categories, which is defined by comparing Taylor differential
monomials of maps. We then show our main result that if this ultrapseudometric
is an ultrametric, the Taylor series of a map converges to said map. For the
remainder of this section, we again assume that $k$ is a commutative
$\mathbb{Q}_{\geq 0}$-algebra.

So let $\mathbb{R}_{\geq 0}$ be the set of positive real numbers. Then recall
that an ultrapseudometric on a set $M$ is a function $\mathsf{d}:M\times
M\allowbreak\mathrel{\mathop{\hbox
to11.99998pt{\rightarrowfill}}\limits}\mathbb{R}_{\geq 0}$ such that: (1)
$\mathsf{d}(x,x)=0$, (2) $\mathsf{d}(x,y)=\mathsf{d}(y,x)$, and (3)
$\mathsf{d}(x,z)\leq\mathsf{max}\\{\mathsf{d}(x,y),\mathsf{d}(y,z)\\}$. This
latter inequality is called the Strong Triangle Inequality. An
ultrapseudometric space is a pair $(M,\mathsf{d})$ consisting of a set $M$ and
an ultrapseudometric $\mathsf{d}$ on $M$. It is important to note that for an
ultrapseudometric, we can have $\mathsf{d}(x,y)=0$ for $x\neq y$.

###### Definition 5.1

In a Cartesian $k$-differential category $\mathbb{X}$, for every homset
$\mathbb{X}(A,B)$, define the function
$\mathsf{d}_{\mathsf{D}}:\mathbb{X}(A,B)\times\mathbb{X}(A,B)\allowbreak\mathrel{\mathop{\hbox
to11.99998pt{\rightarrowfill}}\limits}\mathbb{R}_{\geq 0}$ as follows:

$\displaystyle\mathsf{d}_{\mathsf{D}}(f,g)=\begin{cases}2^{-n}&\text{ where
$n\in\mathbb{N}$ is the smallest natural number such that
$\mathcal{M}^{(n)}[f]\neq\mathcal{M}^{(n)}[g]$}\\\ 0&\text{ if all
$n\in\mathbb{N}$, $\mathcal{M}^{(n)}[f]=\mathcal{M}^{(n)}[g]$}\end{cases}$

We call $\mathsf{d}_{\mathsf{D}}(f,g)$ the $\mathsf{D}$-distance between $f$
and $g$.

###### Proposition 5.2

For every homset of a Cartesian $k$-differential category $\mathbb{X}$,
$\mathsf{d}_{\mathsf{D}}:\mathbb{X}(A,B)\times\mathbb{X}(A,B)\allowbreak\mathrel{\mathop{\hbox
to11.99998pt{\rightarrowfill}}\limits}\mathbb{R}_{\geq 0}$ is a
ultrapseudometric. Moreover:

  1. (i)

Composition is non-expansive, that is,
$\mathsf{d}_{\mathsf{D}}\left(g_{1}\circ f_{1},g_{2}\circ
f_{2}\right)\leq\mathsf{max}\\{\mathsf{d}_{\mathsf{D}}(g_{1},g_{2}),\mathsf{d}_{\mathsf{D}}(f_{1},f_{2})\\}$;

  2. (ii)

The $k$-linear structure is non-expansive, that is,
$\mathsf{d}_{\mathsf{D}}(r\cdot f_{1}+s\cdot g_{1},r\cdot f_{2}+s\cdot
g_{2})\leq\mathsf{max}\\{\mathsf{d}_{\mathsf{D}}(f_{1},f_{2}),\mathsf{d}_{\mathsf{D}}(g_{1},g_{2})\\}$;

  3. (iii)

Pairing is an isometry, that is, $\mathsf{d}_{\mathsf{D}}\left(\langle
f_{0},\ldots,f_{n}\rangle,\langle
g_{0},\ldots,g_{n}\rangle\right)=\mathsf{max}\\{\mathsf{d}_{\mathsf{D}}(f_{0},g_{0}),\ldots,\mathsf{d}_{\mathsf{D}}(f_{n},g_{n})\\}$;

  4. (iv)

Differentiation is non-expansive, that is,
$\mathsf{d}_{\mathsf{D}}(\mathsf{D}[f],\mathsf{D}[g])\leq\mathsf{d}_{\mathsf{D}}(f,g)$

Proof: We first show that $\mathsf{d}_{\mathsf{D}}$ is an ultrapseudometric.
Trivially we have that $\mathsf{d}(x,x)=0$ and
$\mathsf{d}(x,y)=\mathsf{d}(y,x)$. So we only need to check the Strong
Triangle Inequality. So consider $\mathsf{d}_{\mathsf{D}}(f,h)$. If
$\mathsf{d}_{\mathsf{D}}(f,h)=0$, then we are done. So suppose that
$0<\mathsf{d}_{\mathsf{D}}(f,h)=2^{-n}$, which implies that
$\mathcal{M}^{(k)}[f]=\mathcal{M}^{(k)}[g]$ for all $k<n$ and
$\mathcal{M}^{(n)}[f]\neq\mathcal{M}^{(n)}[g]$. Now consider another map $g$.
If $\mathsf{d}_{\mathsf{D}}(f,g)=0$, so
$\mathcal{M}^{(j)}[f]=\mathcal{M}^{(j)}[g]$ for all $j$, it follows that
$\mathsf{d}_{\mathsf{D}}(g,h)=2^{-n}=\mathsf{d}_{\mathsf{D}}(f,h)$. Similarly,
if $\mathsf{d}_{\mathsf{D}}(g,h)=0$ then
$\mathsf{d}_{\mathsf{D}}(f,g)=2^{-n}=\mathsf{d}_{\mathsf{D}}(f,h)$. We cannot
have that $\mathsf{d}_{\mathsf{D}}(f,g)=0=\mathsf{d}_{\mathsf{D}}(g,h)$ since
this would imply that
$\mathcal{M}^{(j)}[f]=\mathcal{M}^{(j)}[g]=\mathcal{M}^{(j)}[h]$ for all $j$,
which is a contradiction. Now suppose that
$\mathsf{d}_{\mathsf{D}}(f,g)=2^{-m}$ and $\mathsf{d}(g,h)=2^{-p}$, which
means that $\mathcal{M}^{(k_{1})}[f]=\mathcal{M}^{(k_{1})}[g]$ for all
$k_{1}<m$ and $\mathcal{M}^{(k_{2})}[g]=\mathcal{M}^{(k_{2})}[h]$ for all
$k_{2}<p$. If $\mathsf{max}\\{2^{-m},2^{-p}\\}<2^{-n}$, then
$n<\mathsf{min}\\{m,p\\}$ which would imply that
$\mathcal{M}^{(n)}[f]=\mathcal{M}^{(n)}[g]=\mathcal{M}^{(n)}[h]$, which is a
contradiction. So we must have that
$2^{-n}\leq\mathsf{max}\\{2^{-m},2^{-p}\\}<2^{-n}$ as desired. So
$\mathsf{d}_{\mathsf{D}}$ is a ultrapseudometric, and thus
$\left(\mathbb{X}(X,Y),\mathsf{d}_{\mathsf{D}}\right)$ is an ultrapseudometric
space. The compatibility of the Cartesian $k$-differential structure and the
ultrapseudometric is straightforward and easily follows from Lemma 4.3. $\Box$

The category of ultrapseudometric spaces and non-expansive maps form a
Cartesian closed category. As such, an alternative way of viewing the
compatibility of the Cartesian $k$-differential structure and the
ultrapseudometric (Prop 5.2.(i)-(iv)) is saying that a Cartesian differential
category is enriched over ultrapseudometric spaces via comparing Taylor
differential monomials.

Now an ultrametric on a set $M$ is a ultrapseudometric $\mathsf{d}:M\times
M\allowbreak\mathrel{\mathop{\hbox
to11.99998pt{\rightarrowfill}}\limits}\mathbb{R}_{\geq 0}$ which also
satisfies that: (4) $\mathsf{d}(x,y)=0$ implies $x=y$. Then an ultrametric
space is a pair $(M,\mathsf{d})$ consisting of a set $M$ and an ultrametric
$\mathsf{d}$ on $M$. In an arbitrary Cartesian differential category, two maps
can have the same Taylor differential monomials (i.e. $\mathsf{D}$-distance of
$0$) but not be equal. Therefore $\mathsf{d}_{\mathsf{D}}$ is usually not an
ultrametric. It becomes an ultrametric when maps are completely determined by
their Taylor differential monomials. When this is the case, we say that a
Cartesian differential category is _Taylor_. This terminology is justified
since, in this Taylor setting, maps are indeed equal to their Taylor series.

###### Definition 5.3

In a Cartesian $k$-differential category, we say that parallel maps
$f:A\allowbreak\mathrel{\mathop{\hbox to11.99998pt{\rightarrowfill}}\limits}B$
and $g:A\allowbreak\mathrel{\mathop{\hbox
to11.99998pt{\rightarrowfill}}\limits}B$ are Taylor-equivalent if for all
$n\in\mathbb{N}$, $\mathcal{M}^{(n)}[f]=\mathcal{M}^{(n)}[g]$. We write $f\sim
g$ if $f$ and $g$ are Taylor-equivalent. Then a Cartesian $k$-differential
category $\mathbb{X}$ is said to be Taylor if $f\sim g$ implies $f=g$.

###### Proposition 5.4

A Cartesian $k$-differential category $\mathbb{X}$ is Taylor if and only if
for every homset, the ultrapseudometric
$\mathsf{d}_{\mathsf{D}}:\mathbb{X}(A,B)\times\mathbb{X}(A,B)\allowbreak\mathrel{\mathop{\hbox
to11.99998pt{\rightarrowfill}}\limits}\mathbb{R}_{\geq 0}$ is an ultrametric.

Proof: Note that by definition of $\mathsf{d}_{\mathsf{D}}$, we have that
$\mathsf{d}_{\mathsf{D}}(f,g)=0$ if and only if $f\sim g$. So the desired
statement follows immediately. $\Box$

Of course, ultrametric spaces and non-expansive maps also form a Cartesian
closed category. Thus, it follows from Prop 5.2.(i)-(iv) that every Taylor
Cartesian differential category is enriched over the category of ultrametric
spaces. We now prove the main objective of this paper:

###### Theorem 5.5

In a Taylor Cartesian $k$-differential category, for every map
$f:A\allowbreak\mathrel{\mathop{\hbox
to11.99998pt{\rightarrowfill}}\limits}B$, the sequence
$\left(\mathcal{T}^{(n)}[f]\right)^{\infty}_{n=0}$ converges to $f$ with
respect to the ultrametric $\mathsf{d}_{\mathsf{D}}$, so we may write:

$\displaystyle f=\sum\limits^{\infty}_{n=0}\mathcal{M}^{(n)}[f]$
$\displaystyle
f(x)=\sum\limits^{\infty}_{n=0}\dfrac{1}{n!}\cdot\dfrac{\mathsf{d}^{(n)}f(u)}{\mathsf{d}f(u)}(0)\cdot
x\cdot\ldots\cdot x$ (3)

Proof: First recall that for all $n\in\mathbb{N}$ and $k\leq n$, by Lemma
4.3.(xi), we have that
$\mathcal{M}^{(k)}\left[\mathcal{T}^{(n)}[f]\right]=\mathcal{M}^{(k)}[f]$. As
such, the smallest possible $m$ for which
$\mathcal{M}^{(m)}\left[\mathcal{T}^{(n)}[f]\right]$ and
$\mathcal{M}^{(m)}[f]$ might be different is $m=n+1$. Thus we have that
$\mathsf{d}_{\mathsf{D}}\left(\mathcal{T}^{(n)}[f],f\right)\leq 2^{-(n+1)}$.
Now let $0<\varepsilon$ be an arbitrary non-zero positive real number. Let $N$
be the smallest natural number such that $2^{-N}\leq\varepsilon$. Then for all
$n\geq N$, we have that
$\mathsf{d}_{\mathsf{D}}\left(\mathcal{T}^{(n)}[f],f\right)\leq
2^{-(n+1)}<2^{-n}\leq 2^{-N}\leq\varepsilon$. So we conclude that
$\left(\mathcal{T}^{(n)}[f]\right)^{\infty}_{n=0}$ converges to $f$. $\Box$

###### Example 5.6

Let’s consider our ultra(pseudo)metric in our main examples:

  1. (i)

In $k\text{-}\mathsf{POLY}$, the $\mathsf{D}$-distance between polynomials is
given by comparing the monomial summands of same degree of the two
polynomials. Since polynomials are completely determined by their monomial
summands, it follows that $k\text{-}\mathsf{POLY}$ is Taylor. Moreover, we
note that this ultrametric for polynomials is precisely the same as the
ultrametric for power series that makes the formal infinite sum converge.

  2. (ii)

In $\mathsf{SMOOTH}$, the $\mathsf{D}$-distance between smooth functions is
given by comparing the usual Taylor expansions of the smooth functions.
However, $\mathsf{SMOOTH}$ is not Taylor since two smooth functions can have
the same Taylor expansion but not be equal. The famous counter-example is the
smooth function $f:\mathbb{R}\allowbreak\mathrel{\mathop{\hbox
to11.99998pt{\rightarrowfill}}\limits}\mathbb{R}$ defined as
$f(x)=e^{\frac{-1}{x^{2}}}$ for $x\neq 0$ and $f(0)=0$. The Taylor series of
$f$ is $0$, so we have that $f\sim 0$. But clearly, $f\neq 0$. On the other
hand, the subcategory of real _entire_ functions is a Taylor Cartesian
differential category.

  3. (iii)

The ultrapseudometric $\mathsf{d}_{\mathsf{D}}$ defined for the coKleisli
category of a differential category with finite products is precisely the same
as the ultrapseudometric defined in [21, Sec III.E]. Moreover, saying that the
coKleisli category is Taylor is precisely the same as saying that the
differential category is Taylor in the sense of [21, Def III.7]. Taylor
differential categories were crucial for the story of developing _codigging_
for Differential Linear Logic in [21]. Examples of Taylor differential
categories can be found in [21, Sec IV].

While not every Cartesian differential category is Taylor, it is always
possible to build one. This follows from the fact that every ultrapseudometric
space can be made into an ultrametric space by quotienting. So let
$(M,\mathsf{d})$ be an ultrapseudometric space. Then we have an equivalence
relation $\sim$ given by $x\sim y$ if and only if $\mathsf{d}(x,y)=0$. Let
$M_{\sim}$ be the set of equivalence classes of $\sim$, so $[x]=\\{y\in
M|x\sim y\\}$. Then $(M_{\sim},\mathsf{d}_{\sim})$ is an ultrametric space
where $\mathsf{d}_{\sim}\left([x],[y]\right)=\mathsf{d}(x,y)$, which is indeed
well-defined. Now for a Cartesian $k$-differential category $\mathbb{X}$,
define the Cartesian $k$-differential category $\mathbb{X}_{\sim}$ as having
objects the same as $\mathbb{X}$, whose homsets are
$\mathbb{X}_{\sim}(A,B)=\mathbb{X}(A,B)_{\sim}$, so maps are equivalence
classes $[f]:A\allowbreak\mathrel{\mathop{\hbox
to11.99998pt{\rightarrowfill}}\limits}B$, and where composition is defined as
$[g]\circ[f]=[g\circ f]$, identity maps are $[1_{A}]$, the product is the same
as in $\mathbb{X}$, projections are $[\pi_{j}]$, the pairing is
$\langle[f_{0}],\ldots,[f_{n}]\rangle=\left[\langle
f_{0},\ldots,f_{n}\rangle\right]$, the $k$-linear structure is
$r\cdot[f]+s\cdot[g]=[r\cdot f+s\cdot g]$, and the differential combinator is
given by $\mathsf{D}\left[[f]\right]=\left[\mathsf{D}[f]\right]$.

###### Lemma 5.7

For a Cartesian $k$-differential category $\mathbb{X}$, $\mathbb{X}_{\sim}$ is
a Taylor Cartesian $k$-differential category.

Proof: That $\mathbb{X}_{\sim}$ is indeed a well-defined Cartesian
$k$-differential category follows from Prop 5.2.(i)-(iv). In fact, this is a
general construction of turning an ultrapseudometric space-enriched category
into an ultrametric space-enriched category. Moreover,
$\mathsf{d}_{\mathsf{D}}$ for $\mathbb{X}_{\sim}$ is precisely the same as
$\mathsf{d}_{\sim}$, which by construction is an ultrametric. So we conclude
that $\mathbb{X}_{\sim}$ is also Taylor. $\Box$

A very natural and important question to ask is, what if there was already
some other established notion of convergence or infinite sum in our Cartesian
differential category for which every map was equal to its Taylor series?
Would the resulting Taylor series for these notions be the same as the Taylor
series given by the ultrametric $\mathsf{d}_{\mathsf{D}}$? Under natural
assumptions, the answer is yes!

In the next section, we consider the algebraic infinite sum case, which is of
high interest in more computer science-related models. We conclude this
section by looking at the case of having another metric which makes the Taylor
series converge. So let’s consider the case when a Cartesian differential
category may have other metrics on its homsets such that the sequence of
Taylor differential polynomials of $f$ converges to $f$ with respect to this
metric. We will show that when this is the case, our starting Cartesian
differential category is Taylor, and therefore Taylor series obtained by
convergences with respect to either metric is the same. So by a metric space
enriched Cartesian $k$-differential category, we mean a Cartesian
$k$-differential category $\mathbb{X}$ such that each homset $\mathbb{X}(A,B)$
comes equipped with a metric
$\mathsf{b}:\mathbb{X}(A,B)\times\mathbb{X}(A,B)\allowbreak\mathrel{\mathop{\hbox
to11.99998pt{\rightarrowfill}}\limits}\mathbb{R}_{\geq 0}$ such that
composition, the $k$-linear structure, the pairing operation, and the
differential combinator are all non-expansive (so similar to the sense of Prop
5.2.(i)-(iv)).

###### Lemma 5.8

In a metric space enriched Cartesian $k$-differential category $\mathbb{X}$,
if for every map $f$, the sequence
$\left(\mathcal{T}^{(n)}[f]\right)^{\infty}_{n=0}$ converges to $f$ with
respect to the metric $\mathsf{b}$, then $\mathbb{X}$ is Taylor.

Proof: Suppose that $f\sim g$, so $\mathcal{M}^{(n)}[f]=\mathcal{M}^{(n)}[g]$
for all $n$, which in turn implies that
$\mathcal{T}^{(n)}[f]=\mathcal{T}^{(n)}[g]$ for all $n$ as well. Consider
$\mathsf{b}(f,g)$. Suppose that $\mathsf{b}(f,g)=\varepsilon\neq 0$. Now since
$\left(\mathcal{T}^{(n)}[f]\right)^{\infty}_{n=0}$ converges to $f$ and
$\left(\mathcal{T}^{(n)}[g]\right)^{\infty}_{n=0}$ converges to $g$ with
respect to the metric $\mathsf{b}$, then there exists an $N_{1}$ and $N_{2}$
such that for all $n\geq N_{1}$ and $m\geq N_{2}$, we have that
$\mathsf{b}\left(f,\mathcal{T}^{(n)}[f]\right)<\frac{\varepsilon}{2}$ and
$\mathsf{b}\left(g,\mathcal{T}^{(n)}[g]\right)<\frac{\varepsilon}{2}$. Taking
$N=\mathsf{max}\\{N_{1},N_{2}\\}$, we get that for all $k\geq N$ that
$\mathsf{b}\left(f,\mathcal{T}^{(k)}[f]\right)<\frac{\varepsilon}{2}$ and
$\mathsf{b}\left(g,\mathcal{T}^{(k)}[g]\right)<\frac{\varepsilon}{2}$. Then by
the triangle inequality, we get that:

$\varepsilon=\mathsf{b}(f,g)\leq\mathsf{b}\left(f,\mathcal{T}^{(k)}[f]\right)+\mathsf{b}\left(\mathcal{T}^{(k)}[f],g\right)=\mathsf{b}\left(f,\mathcal{T}^{(k)}[f]\right)+\mathsf{b}\left(\mathcal{T}^{(k)}[g],g\right)<\frac{\varepsilon}{2}+\frac{\varepsilon}{2}=\varepsilon$

But $\varepsilon<\varepsilon$ is a contradiction, so we must have
$\mathsf{b}(f,g)=0$. Since $\mathsf{b}$ is a metric, this implies that $f=g$.
So we conclude that $\mathbb{X}$ is Taylor. $\Box$

The converse of the above lemma is not true. Even if a Taylor Cartesian
differential category has another metric on its homsets, the sequence of
Taylor differential polynomials may not converge with respect to this other
metric. For example, every Cartesian differential category is metric space
enriched by equipping the homsets with the trivial metric, $\mathsf{b}(x,y)=1$
if $x\neq y$ and $\mathsf{b}(x,y)=0$ if $x=y$. However, a sequence
$(x_{n})^{\infty}_{n=0}$ converges to $x$ with respect to the trivial metric
if and only if it eventually stabilizes to $x$, that is, there is some $N$
such that for all $n\geq N$, $x_{n}=x$. However, there are many examples of
Taylor Cartesian differential categories where the sequence of Taylor
differential polynomials never stabilizes.

##  6 Infinite Sums and Modelling Taylor Expansion

In this section, we consider Cartesian differential categories with countable
infinite sums and show that being Taylor is equivalent to every map being
equal to the infinite sum of its Taylor differential monomials. This implies
that in a setting with countable sums, the notion of Taylor series of a map
given by infinite sums or by convergence via our ultrametric is the same. From
this, we then show that Manzonetto’s notion of _modelling Taylor expansion_ in
a categorical model of the differential $\lambda$-calculus with countable sums
[26] is equivalent to our notion of Taylor.

We begin by discussing Cartesian differential categories with countable sums.
Briefly, recall that a commutative countably complete semiring is a
commutative semiring $k$ with an appropriate notion of arbitrary countable
sums, and such that these countable sums satisfy certain distributivity and
partitions axioms, and that a countably complete $k$-module is a $k$-module
which also has arbitrary countable sums, which again satisfy certain obvious
compatibility axioms (see [20, Chap 23] for more details). Then we define a
left countably complete $k$-linear category to be a category whose homsets are
countably complete $k$-modules, so we can take countable infinite sums of
maps, such that pre-composition preserves these countable sums: $(\sum_{i\in
I}r_{i}\cdot f_{i})\circ x=\sum_{i\in I}r_{i}\cdot f_{i}\circ x$. A map $f$ is
said to be countably $k$-linear if post-composition by $f$ preserves the
countable sums: $f\circ(\sum_{i\in I}r_{i}\cdot x_{i})=\sum_{i\in I}r_{i}\cdot
f\circ x_{i}$. Then a Cartesian left countably complete $k$-linear category is
a left countably complete $k$-linear category with finite products such that
the projections maps are countably $k$-linear. Note that a (Cartesian) left
countably complete $k$-linear category is also a (Cartesian) $k$-linear
category. Then the countably complete version of a Cartesian differential
category is essentially the same but where we upgrade [CD.1] to require that
the differential combinator be countably $k$-linear, and also [CD.2] to asking
that derivatives be countably $k$-linear in their second argument.

###### Definition 6.1

A Cartesian countably complete $k$-differential category is a Cartesian left
countably complete $k$-linear category equipped with a differential combinator
$\mathsf{D}$ such that:

  1. [CD.1+]

$\dfrac{\mathsf{d}\sum\limits_{i\in I}r_{i}\cdot
f_{i}(x)}{\mathsf{d}x}(a)\cdot b=\sum\limits_{i\in
I}r_{i}\cdot\dfrac{\mathsf{d}f_{i}(x)}{\mathsf{d}x}(a)\cdot b$;

  2. [CD.2+]

$\dfrac{\mathsf{d}f(x)}{\mathsf{d}x}(a)\cdot(\sum\limits_{i\in I}r_{i}\cdot
b_{i})=\sum\limits_{i\in
I}r_{i}\cdot\dfrac{\mathsf{d}f(x)}{\mathsf{d}x}(a)\cdot b_{i}$

When we can scalar multiply by positive rationals, there is of course a
natural notion of Taylor series of maps. In what follows, we assume that $k$
is also a commutative $\mathbb{Q}_{\geq 0}$-algebra.

###### Definition 6.2

In a Cartesian countably complete $k$-differential category, for a map
$f:A\allowbreak\mathrel{\mathop{\hbox
to11.99998pt{\rightarrowfill}}\limits}B$, define the map
$\mathcal{T}[f]:A\allowbreak\mathrel{\mathop{\hbox
to11.99998pt{\rightarrowfill}}\limits}B$ as the infinite sum of its Taylor
$\mathsf{D}$-monomials:

$\mathcal{T}[f]=\sum^{\infty}_{n=0}\mathcal{M}^{(n)}[f]$

The map $\mathcal{T}[f]$ is called the Taylor series expansion of $f$.

###### Proposition 6.3

A Cartesian countably complete $k$-differential category is Taylor if and only
if for every map $f$, $\mathcal{T}[f]=f$.

Proof: It is straightforward to see that [CD.1+] also implies that
$\mathcal{M}^{(n)}\left[\sum_{i\in I}r_{i}\cdot g_{i}\right]=\sum_{i\in
I}r_{i}\cdot\mathcal{M}^{(n)}[g_{i}]$. From this and Lemma 4.3.(xi), we get
that $\mathcal{M}^{(n)}\left[\mathcal{T}[f]\right]=\mathcal{M}^{(n)}[f]$. So
$\mathcal{T}[f]\sim f$. Now for the $\Rightarrow$ direction, suppose that we
are in a Taylor setting. Then since $\mathcal{T}[f]\sim f$, it follows that
$\mathcal{T}[f]=f$. Conversely, for the $\Leftarrow$ direction, suppose that
$\mathcal{T}[f]=f$ for all maps $f$. Now consider parallel maps such that
$f\sim g$, which means that $\mathcal{M}^{(n)}[f]=\mathcal{M}^{(n)}[g]$ for
all $n$. This gives us that:

$f=\mathcal{T}[f]=\sum\limits^{\infty}_{n=0}\mathcal{M}^{(n)}[f]=\sum\limits^{\infty}_{n=0}\mathcal{M}^{(n)}[g]=\mathcal{T}[g]=g$

So we conclude that our Cartesian countably complete $k$-differential category
is Taylor. $\Box$

So the above statement tells us that in a Taylor Cartesian differential
category with infinite sums, every map is equal to its Taylor series whether
given via infinite sums of the Taylor differential monomials or the
convergence of the Taylor differential polynomials sequence with respect to
the ultrametric $\mathsf{d}_{\mathsf{D}}$.

We now turn our attention to Manzonetto’s notion of modelling Taylor expansion
in a Cartesian _closed_ differential category (also sometimes called a
differential $\lambda$ category). As mentioned, the categorical semantics of
the differential $\lambda$-calculus is provided by Cartesian _closed_
differential categories. Every model of the differential $\lambda$-calculus
induces a Cartesian closed differential category [8, Thm 4.3], and conversely,
every Cartesian closed differential category induces a model of the
differential $\lambda$-calculus [5, Thm 4.12]. For a more in-depth
introduction to Cartesian closed differential categories and the differential
$\lambda$-calculus, we refer the reader to [5, 26, 8, 6, 14, 9].

In a Cartesian closed category, we denote internal homs by $[A,B]$, the
evaluation maps by ${\epsilon:A\times[A.B]\allowbreak\mathrel{\mathop{\hbox
to11.99998pt{\rightarrowfill}}\limits}B}$, and for a map $f:C\times
A\allowbreak\mathrel{\mathop{\hbox to11.99998pt{\rightarrowfill}}\limits}B$,
we denote its Curry by $\lambda(f):A\allowbreak\mathrel{\mathop{\hbox
to11.99998pt{\rightarrowfill}}\limits}[C,B]$, which recall is the unique map
such that $\epsilon\circ(1_{C}\times\lambda(f))=f$. In the term calculus, we
write as usual:

$\lambda(f)(a)=\lambda x.f(x,a)$

and so $\epsilon(a,\lambda(f)(c))=f(a,c)$, or:

$\left(\lambda x.f(x,a)\right)(c)=f(a,c)$

As explained in [8, Lemma 4.10], there are two equivalent ways of expressing
compatibility between the closed structure and the differential combinator:
one which says that the derivative of a Curry is the Curry of the _partial_
derivative, and the other one which says that evaluation maps are
$\mathsf{D}$-linear in the internal hom argument.

###### Definition 6.4

A Cartesian closed $k$-differential category [19, Def 2.9] is a Cartesian
$k$-differential category whose underlying category is also cartesian closed,
and such that one of the following equivalent axioms hold:

[CD.$\lambda$]

$\dfrac{\mathsf{d}\lambda y.f(x,y)}{\mathsf{d}x}(a)\cdot b=\lambda
y.\dfrac{\mathsf{d}f(x,y)}{\mathsf{d}x}(a)\cdot b$;

[CD.$\epsilon$]

$\dfrac{\mathsf{d}\epsilon(a,j)}{\mathsf{d}j}(f)\cdot g=\epsilon(a,g)$

From this, it follows that in a Cartesian closed $k$-differential category,
the Curry operator is $k$-linear.

###### Lemma 6.5

In a Cartesian closed $k$-differential category, $\lambda(r\cdot f+s\cdot
g)=r\cdot\lambda(f)+s\cdot\lambda(g)$, which in the term calculus is written
as:

$\lambda x.\left(r\cdot f(x,a)+s\cdot g(x,a)\right)=r\cdot\lambda
x.f(x,a)+s\cdot\lambda x.g(x,a)$

Proof: By [CD.$\epsilon$] and [CD.2], we easily compute that:

$\displaystyle\epsilon\left(a,\lambda(r\cdot f+s\cdot g)(c)\right)=(r\cdot
f+s\cdot g)(c,a)=r\cdot f(c,a)+s\cdot g(c,a)$
$\displaystyle=r\cdot\epsilon(a,\lambda(f)(c))+s\cdot\epsilon(a,\lambda(g)(c))=r\cdot\dfrac{\mathsf{d}\epsilon(a,j)}{\mathsf{d}j}(f)\cdot\left(\lambda(f)(c)\right)+s\cdot\dfrac{\mathsf{d}\epsilon(a,j)}{\mathsf{d}j}(f)\cdot\left(\lambda(g)(c)\right)$
$\displaystyle=\dfrac{\mathsf{d}\epsilon(a,j)}{\mathsf{d}j}(h)\cdot\left(r\cdot\lambda(f)(c)+s\cdot\lambda(g)(c)\right)=\epsilon\left(a,\left(r\cdot\lambda(f)+s\cdot\lambda(g)\right)(c)\right)$

Since $\epsilon$ is monic in its second argument, we then get that
$\lambda(r\cdot f+s\cdot
g)(c)=\left(r\cdot\lambda(f)+s\cdot\lambda(g)\right)(c)$. So, we conclude that
the Curry operator is indeed $k$-linear as desired. $\Box$

To help define Taylor expansion in a Cartesian closed differential category,
Manzonetto introduces a $\star$ operation [26, Def 4.7] which takes a map
$f:C\times A\allowbreak\mathrel{\mathop{\hbox
to11.99998pt{\rightarrowfill}}\limits}B$ and a map
$g:C\allowbreak\mathrel{\mathop{\hbox
to11.99998pt{\rightarrowfill}}\limits}A$, and produces a map $f\star g:C\times
A\allowbreak\mathrel{\mathop{\hbox to11.99998pt{\rightarrowfill}}\limits}B$
defined as:

$(f\star g)(c,a)=\dfrac{\mathsf{d}f(c,x)}{\mathsf{d}x}(a)\cdot g(c)$

Successive application of the $\star$ operation is worked out to be:

$\left(\ldots((f\star g)\star g)\ldots)\star
g\right)(c,a)=\dfrac{\mathsf{d}^{(n)}f(c,x)}{\mathsf{d}x}(a)\cdot
g(c)\cdot\ldots\cdot g(c)$

Then in a setting with countable sums, Manzonetto defines Taylor expansion of
the infinite sums of the iterated $\star$ operations. In [26], Manzonetto
worked for convenience in a setting where addition was idempotent. Here, we
provide the definition in the general case where we add back the scalar
multiplication in the Taylor expansion. We also give the unCurry version of
the definition, which is equivalent to the Curry version.

###### Definition 6.6

A Cartesian closed countably complete $k$-differential category is said to
model Taylor expansion [26, Def 5.19] if for every map $f:C\times
A\allowbreak\mathrel{\mathop{\hbox to11.99998pt{\rightarrowfill}}\limits}B$
and a map $g:C\allowbreak\mathrel{\mathop{\hbox
to11.99998pt{\rightarrowfill}}\limits}A$,

$\displaystyle
f(c,g(c))=\sum\limits^{\infty}_{n=0}\frac{1}{n!}\cdot\frac{\mathsf{d}^{(n)}f(c,y)}{\mathsf{d}y}(0)\cdot
g(c)\cdot\ldots\cdot g(c)$ (4)

We conclude with the equivalence of being Taylor and modelling Taylor
expansion. To do so, we first note that in the countably complete setting, the
Curry operator is countably $k$-linear.

###### Lemma 6.7

In a Cartesian closed countably complete $k$-differential category, the
following equality holds: ${\lambda\left(\sum_{i\in I}r_{i}\cdot
f_{i}\right)=\sum_{i\in I}r_{i}\cdot\lambda(f_{i})}$, which in the term
calculus is written as:

$\lambda x.\left(\sum_{i\in I}r_{i}\cdot f_{i}(x,a)\right)=\sum_{i\in
I}r_{i}\cdot\lambda x.f_{i}(x,a)$

Proof: The proof is essentially the same as the proof of Lemma 6.5, but where
we make use of [CD.2+] instead of simply [CD.2]. As such, we leave this as an
exercise for the reader. $\Box$

###### Proposition 6.8

A Cartesian closed countably complete $k$-differential category is Taylor if
and only if it models Taylor expansion.

Proof: For the $\Rightarrow$ direction, since we are in a Taylor setting, by
Prop 6.3 we have that $\mathcal{T}[h]=h$ for all maps $h$. Then for $f:C\times
A\allowbreak\mathrel{\mathop{\hbox to11.99998pt{\rightarrowfill}}\limits}B$,
we compute the Taylor series of its curry $\lambda(f)$ by using Lemma 6.7 to
be:

$\displaystyle\mathcal{T}[\lambda(f)](a)=\sum\limits^{\infty}_{n=0}\frac{1}{n!}\cdot\frac{\mathsf{d}^{(n)}\lambda(f)(y)}{\mathsf{d}y}(0)\cdot
a\cdot\ldots\cdot
a=\sum\limits^{\infty}_{n=0}\frac{1}{n!}\cdot\frac{\mathsf{d}^{(n)}\lambda
x.f(x,y)}{\mathsf{d}y}(0)\cdot a\cdot\ldots\cdot a$
$\displaystyle=\sum\limits^{\infty}_{n=0}\frac{1}{n!}\cdot\lambda
x.\frac{\mathsf{d}^{(n)}f(x,y)}{\mathsf{d}y}(0)\cdot a\cdot\ldots\cdot
a=\lambda
x.\left(\sum\limits^{\infty}_{n=0}\frac{1}{n!}\cdot\frac{\mathsf{d}^{(n)}f(x,y)}{\mathsf{d}y}(0)\cdot
a\cdot\ldots\cdot a\right)$

From this, we then compute that:

$\displaystyle f(c,g(c))=\lambda(f)(g(c))(c)=\mathcal{T}[\lambda(f)](g(c))(c)$
$\displaystyle=\left(\lambda
x.\left(\sum\limits^{\infty}_{n=0}\frac{1}{n!}\cdot\frac{\mathsf{d}^{(n)}f(x,y)}{\mathsf{d}y}(0)\cdot
g(c)\cdot\ldots\cdot
g(c)\right)\right)(c)=\sum\limits^{\infty}_{n=0}\frac{1}{n!}\cdot\frac{\mathsf{d}^{(n)}f(c,y)}{\mathsf{d}y}(0)\cdot
g(c)\cdot\ldots\cdot g(c)$

So we model Taylor expansion as desired. For the $\Leftarrow$ direction, by
Prop 6.3, it suffices to show that for every map
$h:C\allowbreak\mathrel{\mathop{\hbox
to11.99998pt{\rightarrowfill}}\limits}B$, $\mathcal{T}[h]=h$. Now define
$f:C\times C\allowbreak\mathrel{\mathop{\hbox
to11.99998pt{\rightarrowfill}}\limits}B$ as $f=h\circ\pi_{2}$, so
$f(x,y)=h(y)$, and take $g=1_{C}:C\allowbreak\mathrel{\mathop{\hbox
to11.99998pt{\rightarrowfill}}\limits}C$. Then using the modelling Taylor
expansion formula, we compute that:

$h(c)=h(g(c))=f(c,g(c))=\sum\limits^{\infty}_{n=0}\frac{1}{n!}\cdot\frac{\mathsf{d}^{(n)}f(c,y)}{\mathsf{d}y}(0)\cdot
g(c)\cdot\ldots\cdot
g(c)=\sum\limits^{\infty}_{n=0}\frac{1}{n!}\cdot\frac{\mathsf{d}^{(n)}h(y)}{\mathsf{d}x}(0)\cdot
c\cdot\ldots\cdot c=\mathcal{T}[h](c)$

So $\mathcal{T}[h]=h$ as desired. $\Box$

## References

  * [1] R. F. Blute, J. R. B. Cockett, J.-S. P. Lemay, and R. A. G. Seely.  Differential categories revisited.  Applied Categorical Structures, 2020.
  * [2] R. F. Blute, J. R. B. Cockett, and R. A. G. Seely.  Differential categories.  Math. Struct. Comput. Sci., 2006.
  * [3] R. F. Blute, J. R. B. Cockett, and R. A. G. Seely.  Cartesian Differential Categories.  Theory and Applications of Categories, 22(23):622–672, 2009.
  * [4] Pierre Boudes, Fanny He, and Michele Pagani.  A characterization of the taylor expansion of lambda-terms.  In Computer Science Logic 2013 (CSL 2013). Schloss Dagstuhl-Leibniz-Zentrum fuer Informatik, 2013.
  * [5] A. Bucciarelli, T. Ehrhard, and G. Manzonetto.  Categorical models for simply typed resource calculi.  Electronic Notes in Theoretical Computer Science, 265:213–230, 2010\.
  * [6] J. R. B. Cockett and J.-S. P. Lemay.  Linearizing combinators.  Theory and Applications of Categories, 38(13):374–431, 2022.
  * [7] J. R. B. Cockett and R. A. G. Seely.  The Faa di Bruno construction.  Theory and Applications of Categories, 25(15):394–425, 2011.
  * [8] J.R.B. Cockett and J. Gallagher.  Categorical models of the differential $\lambda$-calculus.  Mathematical Structures in Computer Science, 29(10):1513–1555, 2019\.
  * [9] J.R.B Cockett and J.D. Gallagher.  Categorical models of the differential $\lambda$-calculus revisited.  Electronic Notes in Theoretical Computer Science, 325:63–83, 2016\.
  * [10] G. Cruttwell, J. Gallagher, and D. Pronk.  Categorical Semantics of a Simple Differential Programming Language.  Electronic Proceedings in Theoretical Computer Science, 333:289–310, 2021.
  * [11] G. S. H. Cruttwell.  Forms and exterior differentiation in cartesian differential categories.  Theory and Applications of Categories, 28(28):981–1001, 2013.
  * [12] G.S.H. Cruttwell, B. Gavranovic, N. Ghani, P. Wilson, and F. Zanasi.  Categorical Foundations of Gradient-Based Learning.  ESOP 2022, pages 1–28, 2022.
  * [13] T. Ehrhard.  An introduction to differential linear logic: proof-nets, models and antiderivatives.  Math. Struct. Comput. Sci., 2017.
  * [14] T. Ehrhard and L. Regnier.  The differential lambda-calculus.  Theoretical Computer Science, 309(1):1–41, 2003.
  * [15] T. Ehrhard and L. Regnier.  Böhm trees, krivine’s machine and the taylor expansion of lambda-terms.  In Conference on Computability in Europe, pages 186–197. Springer, 2006.
  * [16] T. Ehrhard and L. Regnier.  Differential interaction nets.  Theoretical Computer Science, 364(2), 2006.
  * [17] T. Ehrhard and L. Regnier.  Uniformity and the taylor expansion of ordinary lambda-terms.  Theoretical Computer Science, 403(2-3):347–372, 2008.
  * [18] T. Ehrhard and A. Walch.  Coherent taylor expansion as a bimonad.  arXiv preprint arXiv:2310.01907, 2023.
  * [19] R. Garner and J.-S. P. Lemay.  Cartesian differential categories as skew enriched categories.  Applied Categorical Structures, 29(6):1099–1150, 2021.
  * [20] J. S. Golan.  Semirings and their Applications.  Springer Science & Business Media, 2013.
  * [21] M. Kerjean and J.-S. P. Lemay.  Taylor Expansion as a Monad in Models of DiLL.  In 2023 38th Annual ACM/IEEE Symposium on Logic in Computer Science (LICS), pages 1–13, Boston, MA, USA, 2023. IEEE.
  * [22] J.-S. P. Lemay.  Exponential functions in cartesian differential categories.  Applied Categorical Structures, 29:95–140, 2021.
  * [23] J.-S. P. Lemay.  Jacobians and gradients for cartesian differential categories.  In Kohei Kishida, editor, Proceedings of the Fourth International Conference on Applied Category Theory, Cambridge, United Kingdom, 12-16th July 2021, volume 372 of Electronic Proceedings in Theoretical Computer Science, pages 29–42. Open Publishing Association, 2022\.
  * [24] J.-S. P. Lemay.  Properties and Characterisations of Cofree Cartesian Differential Categories.  arXiv preprint arXiv:2210.13886, 2022.
  * [25] G. Manzonetto and M. Pagani.  Böhm’s theorem for resource lambda calculus through taylor expansion.  In International Conference on Typed Lambda Calculi and Applications, pages 153–168. Springer, 2011.
  * [26] Giulio Manzonetto.  What is a categorical model of the differential and the resource $\lambda$-calculi?  Mathematical Structures in Computer Science, 22(3):451–520, 2012\.
  * [27] M. Pagani and C. Tasson.  The inverse taylor expansion problem in linear logic.  In 2009 24th Annual IEEE Symposium on Logic In Computer Science. IEEE, 2009.