Cartesian Differential Kleisli Categories

Cartesian differential categories come equipped with a differential combinator which axiomatizes the fundamental properties of the total derivative from differential calculus. The objective of this paper is to understand when the Kleisli category of a monad is a Cartesian differential category. We introduce Cartesian differential monads, which are monads whose Kleisli category is a Cartesian differential category by way of lifting the differential combinator from the base category. Examples of Cartesian differential monads include tangent bundle monads and reader monads. We give a precise characterization of Cartesian differential categories which are Kleisli categories of Cartesian differential monads using abstract Kleisli categories. We also show that the Eilenberg-Moore category of a Cartesian differential monad is a tangent category.


Introduction
Cartesian differential categories, introduced by Blute, Cockett, and Seely in [6], provide the categorical foundations of multivariable differential calculus.Briefly, a Cartesian differential category (Def 2.2) is a category with finite products that comes equipped with a differential combinator D, which for every map f : A → B produces its derivative D[f ] : A × A → B, satisfying seven axioms that are analogues of the fundamental properties of the total derivative, including the chain rule.Cartesian closed differential categories [10] provide the categorical semantics of Ehrhard and Regnier's differential λ-calculus [15].Cartesian (closed) differential categories have found numerous applications in computer science such as for causal computations [25], differentiable programming languages [1,13], incremental computation [2,4], game theory [19], and for automatic differentiation and machine learning [9,14,27].
There is no shortage of interesting examples of Cartesian (closed) differential categories in the literature.In [5], Bauer et al. provide an Abelian functor calculus model of a Cartesian differential category by considering the homotopy category of the Kleisli category of the chain complex monad.The development of this example was quite important since it steered the theory of Cartesian differential categories into a new field.However, from a certain point of view, the construction of this example is somewhat unexpected since usually Cartesian differential categories are constructed as coKleisli categories.Indeed, important examples of Cartesian differential categories are the coKleisli categories of the comonads of categorical ⋆ The author would like to thank Jonathan Gallagher, Kristine Bauer, Robin Cockett, Geoff Cruttwell, Neil Ghani, and Masahito Hasegawa for useful discussions.For this research, the author was financially supported by an NSERC PDF (456414649), a JSPS PDF (P21746), and an ARC DECRA (DE230100303). 1 Email: js.lemay@mq.edu.aumodels of Differential Linear Logic [6,7], or more generally the coKleisli categories of Cartesian differential comonads [18].In this case, the differential combinator in the coKleisli category is constructed using a natural transformation associated with the comonad.
As such, a natural question to ask is whether it is possible to generate examples of Cartesian differential categories instead as Kleisli categories.The answer is not as straightforward as simply dualizing the construction from the coKleisli story, since the definition of a Cartesian differential category is not self-dual.Furthermore, while some of the necessary underlying structure, specifically the Cartesian left k-structure (Def 2.1), comes for free in the coKleisli setting, they instead require extra assumptions for the Kleisli setting.Therefore, the Kleisli story will instead start with a monad on a Cartesian differential category and lift the differential combinator to its Kleisli category.
Lifting structure to Kleisli categories is always an interesting question in category theory, but it is also an important concept in computer science [8,23,24].Following Moggi's groundbreaking work on the importance of monads for programming languages [22], maps in Kleisli categories are interpreted as effectful programs.Solutions to the lifting problem allow us to extend desirable structures or properties of the base programming language to the effectful programming language, which is always advantageous.By extending the differential combinator to effectful programs, we would be able to apply differential calculus-based techniques and algorithms on effectful programs.
In this paper, we introduce Cartesian differential monads (Def 3.6), which are precisely the kinds of monads on Cartesian differential categories which lift the Cartesian differential structure to their Kleisli category.Concretely, if S = (S, µ, η) is a Cartesian differential monad on a Cartesian differential category X, then its Kleisli category KL(S) is a Cartesian differential category such that the canonical adjoint functors L S : X → KL(S) and R S : KL(S) → X preserve the Cartesian differential structure (Thm 4.2).In particular, this implies that the differential combinator in the Kleisli category KL(S) is the same as the one in the base category X. Type-wise this makes sense since for a map of type A → S(B), which is a map in the Kleisli category, its derivative is of type A × A → S(B), which is still a map in the Kleisli category.However, one must be careful since composition in KL(S) is different from the one in X.In light of this, for a Cartesian differential monad, we ask that both the multiplication µ and unit η be differential linear maps.This allows the differential combinator to behave well with Kleisli composition, so that the differential combinator axioms, in particular the chain rule, hold in the Kleisli category.
We consider two important examples of Cartesian differential monads.The first is the tangent bundle monad (Ex 3.8), which is a canonical monad for any Cartesian differential category which is built using the differential combinator.The maps in the Kleisli category of the tangent bundle monad can be interpreted as generalized vector fields (Ex 4.4), which were studied in [2,4].The second kinds are the reader monads in a Cartesian closed differential category (Ex 3.10).The Kleisli category for a reader monad encodes differentiation in context (Ex 4.6).Furthermore, using Führmann's notion of abstract Kleisli categories [16], we can provide a precise characterization of which Cartesian differential categories are Kleisli categories of Cartesian differential monads (Prop 5.5 & 5.7).
We also consider a slightly more general concept by introducing Kleisli differential combinators (Def 6.1), which provide a direct description of a differential combinator in a Kleisli category.On the one hand, for a monad with a Kleisli differential combinator, its Kleisli category is a Cartesian differential category.On the other hand, every Cartesian differential monad has a canonical Kleisli differential combinator.One slight advantage of Kleisli differential combinators compared to Cartesian differential monads is that the former does not require the base category to be a Cartesian differential category.That said, Cartesian differential monads are much simpler in comparison.However, we will explain how from a monad with a Kleisli differential combinator, we can always construct a Cartesian differential monad whose Kleisli category is precisely the same as the starting monad's.
Lastly, another important question for a monad is what are its algebras and Eilenberg-Moore category.For a Cartesian differential monad, the answer is that its Eilenberg-Moore category is a tangent category (Thm 7.3).While Cartesian differential categories formalize differential calculus over Euclidean spaces, tangent categories, introduced by Cockett and Cruttwell in [11], instead formalize differential calculus over smooth manifolds and their tangent bundles.As such, algebras of a Cartesian differential monad can be interpreted as abstract smooth manifolds.A differential object in a tangent category is an analogue of a Euclidean space, and the subcategory of differential objects is a Cartesian differential category.We show that for a Cartesian differential monad, an algebra is a differential object if and only if its algebra structure is differential linear.Furthermore, the Kleisli category embeds as a Cartesian differential category into the subcategory of differential objects of the Eilenberg-Moore category (Lem 7.7).

Cartesian Differential Categories
In this background section, if only to introduce notation and terminology, we quickly review Cartesian differential categories.In this paper, we will work with Cartesian differential categories relative to a fixed commutative semiring k, as introduced by Garner and the author in [17].When k = N, the semiring of natural numbers, we obtain precisely Blute, Cockett, and Seely's original definition of a Cartesian differential category in [6].For a more in-depth introduction to Cartesian differential categories, we refer the reader to those papers: [6,17].
The underlying structure of a Cartesian differential category is that of a Cartesian left k-linear category, which can be described as a category with finite products which is skew -enriched over the category of kmodules and k-linear maps between them [17].Essentially, this means that each hom-set is a k-module, so in particular, we have zero maps and can take the sum of maps, but also allow for maps which do not preserve zeroes or sums.Maps which do preserve the module structure are called k-linear maps.Cartesian left N-linear categories are the same thing as Cartesian left additive categories [6, Def 1.2.1], and the N-linear maps are precisely the additive maps [6,Def 1.1.1].
In an arbitrary category X, we denote hom-sets by X(A, B), identity maps as 1 A : A → A, and we use the classical notation for composition, •, as opposed to diagrammatic order which was used in other papers on Cartesian differential categories, such as in [6].For a category with finite products, we denote the product by ×, the projections as π j : A 1 × . . .× A n → A j , the pairing operation as −, . . ., − , and we denote the terminal object as * , with the unique map to the terminal object as t A : A → * .
and such that pre-composition preserves the k-linear structure, that is, for suitable maps f : A → B, g : A → B, and x : A ′ → A, and all r, s ∈ R, the following equality holds: A map f : A → B is said to be k-linear if post-composition by f preserves the k-linear structure, that is, for all suitable maps x : A ′ → A and y : A ′ → A, and for all r, s ∈ R, the following equality holds: A Cartesian left k-linear category is a left k-linear category X such that X has finite products2 and all projection maps π j are k-linear maps.
Cartesian differential categories are Cartesian k-linear categories which come equipped with a differential combinator, which is an operator which sends maps to their derivative.The axioms of a differential combinator are analogues of the basic properties of the total derivative from multivariable differential calculus.There are various equivalent ways of stating the axioms of a Cartesian differential category.For this paper, we have chosen the one found in [20,Def 2.6], adapted for the k-linear setting.We also recall the definition of differential linear maps [17,Def 2.7], which are an important kind of map in a Cartesian differential category, and play a key role in the definition of Cartesian differential monads.Definition 2.2 [17, Sec 2.2] A Cartesian k-differential category is a Cartesian left k-linear category X equipped with a differential combinator D, which is a family of functions D : where for a f : A → B, the map D[f ] : A × A → B is called the derivative of f , and such that the following seven axioms hold: There is a sound and complete term logic for Cartesian differential categories [6, Sec 4], which is useful for intuition.So we write: and the axioms of the differential combinator may be rewritten as follows: For a differential linear map, its derivative is simply the starting map evaluated in the second argument: As it will be important below, it is worth mentioning now that every differential linear map is always k-linear [6, Lem 2.2.2.(i)].
Example 2.3 Arguably, the canonical example of a Cartesian differential category is the Lawvere theory of real smooth functions.So let R be the set of real numbers, and define SMOOTH to be the category whose objects are the Euclidean spaces R n and whose maps are smooth functions between them.SMOOTH is a Cartesian R-differential category where the differential combinator is defined as the total derivative of a smooth function.For a smooth function F : R n → R m , which is in fact an m-tuple F = f 1 , . . ., f m of smooth functions f i : R n → R, the derivative D[F ] : R n × R n → R m is defined as:

Cartesian Differential Monads
In this section, we introduce Cartesian differential monads, which we will prove in the next section are monads which lift Cartesian differential structure to their Kleisli categories.If only to introduce notation, recall that a monad on a category X is a triple S := (S, µ, η) consisting of a functor S : X → X, and two natural transformations µ A : SS(A) → S(A), called the multiplication, and η A : A → S(A), called the unit, and such that the following equalities hold: To lift the Cartesian differential structure, we first need the ability to lift the Cartesian k-linear structure.Lifting Cartesian k-linear structure to coKleisli categories is automatic [6,Prop 1.3.3], in the sense that no extra assumption is needed on the comonad.The same is not true for Kleisli categories.Indeed, to lift products to the Kleisli category, one needs that the functor preserves products up to isomorphism, so To lift k-linear structure, one needs that the functor be a k-linear morphism between the hom-sets, and both the multiplication and the unit be k-linear maps.Definition 3.1 Let X and Y be Cartesian left k-linear categories.A strong Cartesian k-linear functor is a functor F : X → Y such that: (i) F preserves products up to isomorphism, that is, t F( * ) : F( * ) → * is an isomorphism, and the canonical natural transformations ω A 1 ,...,An : are natural isomorphisms.(ii) F is a k-linear morphism on hom-sets, that is, the following equality holds: A strict Cartesian k-linear functor is a strong Cartesian k-linear functor such that ω = 1, so in particular we have that Definition 3.2 A Cartesian k-linear monad on a Cartesian left k-linear category X is a monad S such that the underlying functor S is a strong Cartesian k-linear functor, and for all objects A, both η A and µ A are k-linear maps.
It is also useful to note that Cartesian k-linear functors preserve k-linear maps: We may now properly define the notion of a Cartesian differential monad.Essentially, this is a monad whose monad structure is compatible with the differential combinator.So first we define Cartesian differential functors: Definition 3.4 Let X and Y be Cartesian k-differential categories.A strong Cartesian k-differential functor is a strong (resp.strict) Cartesian k-linear functor F : X → Y such that for all maps f : A → B, the following equality holds: Similarly, a strict Cartesian k-differential functor is a strict Cartesian k-linear functor F : X → Y such that for all maps f : We note that Cartesian differential functors preserve differential linear maps: So if f is D-linear, by using ( 6) we easily compute that: So we conclude that F(f ) is also D-linear.
We now define the main novel concept of this paper: S such that the underlying functor S is a strong Cartesian k-differential functor, and for all objects A, both η A and µ A are D-linear maps.
As differential linear maps are always k-linear maps, a Cartesian k-differential monad is also a Cartesian k-linear monad.From a higher category theory point of view, Cartesian differential monads are precisely monads in the (strict) 2-category [26] of Cartesian differential categories, strong cartesian differential functors, and differential linear natural transformations (by which we mean a natural transformation that is differential linear at each component).Here are now some examples of Cartesian differential monads.
Example 3.7 Every Cartesian k-differential category always admits two trivial Cartesian k-differential monads: the identity monad and the constant monad that sends every object to the terminal object.
Example 3.8 Every Cartesian differential category always has yet another Cartesian differential monad provided by its canonical tangent bundle monad.As the name suggests, this monad arises from the fact that every Cartesian differential category is a tangent category (which we review in Sec 7), and that the tangent bundle functor of a tangent category always has a canonical monad structure [11,Prop 3.4].In [21], Manzyuk studied the tangent bundle monad of categorical models of the differential λ-calculus.In [2,3], Alvarez-Picallo and the author studied the tangent bundle monad for Cartesian difference categories, a slight generalization of Cartesian differential categories by adding extra nilpotent structure.So for a Cartesian k-differential category X, its tangent bundle monad [3, Sec 6.1] is the monad T := (T, µ, η) which is defined as follows: In term calculus notation, the tangent bundle on maps is given by: All the necessary requirements that need to be checked for the tangent bundle to be a Cartesian kdifferential monad can be found in [3,Lem 6.4].In particular, in the term calculus, ( 6) is expressed as the equality: which the reader can check for themselves using the term calculus as a good exercise.
Example 3.9 It may also be useful to consider a concrete example of the tangent bundle monad.So consider the Cartesian R-differential category SMOOTH from Ex 2.3.Then the resulting tangent bundle monad (T, µ, η) is given as follows (for all x, y, z, w ∈ R n ): Let us work out what (6) states for a smooth function f : R → R. On the one hand: where f ′ is the derivative of f , and so applying T we get: On the other hand, first applying T we get: and so taking its derivative we then get: Thus, we see that: where note the swapping of the middle two arguments.
Example 3.10 In a Cartesian closed differential category, reader monads are Cartesian differential monads.Briefly, a Cartesian closed k-differential category [17, Def 2.9] is a Cartesian k-differential category X which is also Cartesian closed such that differential combinator is compatible with the closed structure.In the term calculus, this is expressed as: and it is easy to check that, by the left k-linear structure, we have that: we also have that:

Kleisli Categories of Cartesian Differential Monads
In this section, we will now prove that the Kleisli category of a Cartesian differential monad is a Cartesian differential category.As we will be working with Kleisli categories, we will use notation inspired by [7] for Kleisli categories, and use interpretation brackets − to help distinguish between composition in the base category and Kleisli composition.So for a monad S on a category X, let KL(S) denote its Kleisli category, which recall is the category whose objects are the same as X and where a map f : A → B in the Kleisli Lemay category is a map of type f : A → S(B) in the base category, that is, KL(S)(A, B) = X(A, S(B)).The identity maps 1 A : A → S(A) in the Kleisli category is given by the monad unit, so: Composition of Kleisli maps f : A → S(B) and g : B → S(C) is defined as: Let L S : X → KL(S) be the canonical inclusion functor which is defined on objects as L S (A) = A and on maps f : A → B as: Also let R S : KL(S) → X be the right adjoint of L S , which is defined on objects as R S (A) = S(A) and on a Kleisli map f : A → S(B) as: We begin by explaining how for a Cartesian k-linear monad, its Kleisli category is a Cartesian left k-linear category, whose structure is lifted from the base category.(i) The terminal object and product on objects are defined as in X (ii) Projections are defined as The pairing is defined as f 1 , . . ., f n = ω −1 A 1 ,...,An • f 1 , . . ., f n ; (iv) The k-module structure on KL(S)(A, B) is the same as X(A, S(A)), that is, given as follows: ( Proof.It is known (though seemingly folkloric), that if the functor of a monad preserves products up to isomorphism, then the products lift to the Kleisli category.Next, we must show that pre-composition in the Kleisli category preserves the k-linear structure.This follows from the fact that S preserve k-linearity and µ is a k-linear map: So the Kleisli category is indeed a left k-linear category.Lastly, since the projections π j are k-linear in X, and that π j = L S (π j ) , it is straightforward to check that π j are also k-linear in KL(S).So we conclude that the Kleisli category is a Cartesian left k-linear category as desired.Since S preserves the k-linear structure, and both η and µ are k-linear maps, it is clear to see that L S and R S are strict and strong Cartesian k-linear functors respectively.
We now state the main result of this paper that the Kleisli category of a Cartesian differential monad is a Cartesian differential category, by way of lifting the differential combinator to the Kleisli category.Furthermore, a map is differential linear in the Kleisli category if and only if it is differential linear in the base category.(i) The Kleisli category KL(S) is a Cartesian k-differential category where the Cartesian left k-linear structure is defined as in Lemma 4.1 and the differential combinator D S is defined on a Kleisli map f : A → S(B) as follows: (ii) A map f in KL(S) is D S -linear if and only if f is D-linear in X.
(iii) L S : X → KL(S) is a strict Cartesian k-differential functor and R S : KL(S) → X is a strong Cartesian k-differential functor. Proof For [CD.5] we use that µ is D-linear and (6): Lastly, recall that we mentioned that [CD.
Furthermore, since η is D-linear, we compute that: Lastly, using that µ is D-linear and [6, Lem 2.2.2.(vi)] again, it follows from (6) that: So R S is a strong Cartesian k-differential functor as desired.
Example 4.3 Trivially, for the identity monad, its Kleisli category is precisely the starting Cartesian differential category, while for the constant monad, its Kleisli category is equivalent to the terminal category (i.e. the category with one object and only the identity map).
Example 4.4 As explained in [2, Sec 6.2], for the tangent bundle monad, maps in its Kleisli category are interpreted as generalized vector fields.Indeed, if X is a Cartesian k-differential category, then a map in In KL(T), the identity map is 1 A = 1 A , 0 , while composition is given by: and the differential combinator is given by: The fact that, even with this much more complicated composition, the differential combinator still satisfies the chain rule is quite remarkable.Among these maps are the vector fields, in the tangent category sense [11, Def 3.1], which are maps of the form v = 1 A , v 2 : A → A × A. Note that the derivative of a vector field is no longer a vector field.For more details on the Kleisli category of the tangent bundle monad, see [3,Sec 6.3].
Example 4.5 For the tangent bundle monad on SMOOTH, maps in the Kleisi category are smooth functions F : R n → R n × R n where F (x) = (f 1 (x), f 2 (x)) for smooth functions f 1 : R n → R n and f 2 : R n → R n .A vector field is of the form V (x) = (x, v 2 (x)), and these correspond precisely to the vector fields of R n in the classical differential geometry.Let us work out the composition of two vector fields V : R → R and W : R → R, which is: For reader monads, their Kleisli categories capture partial differentiation.First observe that if X is a Cartesian closed k-differential category, then maps in KL(R C ), which are of the form A → [C, A], correspond precisely to maps of the form C × A → B via Currying and unCurrying.As such, the Kleisli category of the reader monad of C is isomorphic to the coKleisli category of the comonad C × −, which is better known as the simple slice category over C, denoted X[C] [7, Sec 2.1].Concretely, X[C] is the category whose objects are the same as X but where X[C](A, B) = X(C × A, B).As explained in [6, Cor 4.5.2], the simple slice category X[C] is again a Cartesian k-differential category but whose differential combinator D C is given by partial differentiation, that is, for a map f : is its partial derivative in only the variable A. In the term calculus: However, the partial derivative of a map f : C × A → B is the same as taking the total derivative of its Curry λ(f ) : A → [C, B] and then unCurrying, that is: As such, the lifting of the differential combinator D to KL(R C ) does indeed recapture the fact that we can define partial differentiation in context C. For more details on partial differentiation in Cartesian differential categories, see [6,7].

Cartesian Differential Abstract Kleisli Categories
The goal of this section is to give a precise characterization of the Cartesian differential categories which are the Kleisli categories of Cartesian differential monads.To achieve this, we use abstract Kleisli categories (sometimes also called thunk-force categories), which were introduced by Führmann in [16].Abstract Kleisli categories provide a direct description of Kleisli categories of monads.For any monad, its Kleisli category is an abstract Kleisli category, and conversely, every abstract Kleisli category is isomorphic to the Kleisli category of a monad.In this section, we introduce the notion of Cartesian differential abstract Kleisli categories, and prove how these correspond to Kleisli categories of Cartesian differential monads.
Definition 5.1 [16, Def 2.1] An abstract Kleisli structure on a category X is a triple (S, ǫ, ϑ) consisting of an endofunctor S : X → X, a natural transformation ǫ A : S(A) → A, and a family of maps ϑ A : A → S(A) (which are not necessarily natural), such that ϑ S(A) : S(A) → SS(A) is a natural transformation and also that the following equalities hold: An abstract Kleisli category is a category X equipped with an abstract Kleisli structure (S, ǫ, ϑ).A map f : A → B is said to be ϑ-natural [16, Def 2.3] (also sometimes called a thunkable map) if the following equality holds: We denote the subcategory of ϑ-natural maps of X by ϑ-nat[X].
The subcategory of ϑ-natural maps has a canonical monad whose Kleisli category is isomorphic to the starting abstract Kleisli category.Lemma 5.2 [16, Sec 2] Let X be an abstract Kleisli category with abstract Kleisli structure (S, ǫ, ϑ).Define the natural transformation δ A : S(A) → SS(A) as δ A = S(ǫ A ). Then S = (S, δ, ϑ) is a monad on ϑ-nat[X] such that the functor G ϑ : X → KL(S), defined on objects as G ϑ (A) = A and on a map f : A → B as: is an isomorphism with inverse G −1 ϑ : KL(S) → X, defined on objects as G ϑ (A) = A and on a Kleisli map f : A → S(A) as: We now wish to equip abstract Kleisli categories with Cartesian differential structure.
Definition 5.3 A Cartesian k-differential abstract Kleisli category is an abstract Kleisli category X with abstract Kleisli structure (S, ǫ, ϑ) such that X is a Cartesian k-differential category where the projection maps π j are ϑ-natural, S is a strong Cartesian k-differential functor, and for every object A, ǫ A and ϑ A are D-linear.
We now explain why the subcategory of ϑ-natural maps is a Cartesian k-differential category.
Lemma 5.4 Let X be a Cartesian k-differential abstract coKleisli category with abstract coKleisli structure (!, ϕ, ϑ).Then ϑ-nat[X] is a sub-Cartesian k-differential category of X.
Proof.It is immediate that the unique map to the terminal object 0 : A → * is always ϑ-natural, and since the projections are ϑ-natural, then the pairing of ϑ-natural maps is again ϑ-natural.Therefore, ϑ-nat[X] does indeed have finite products.Now using that S preserves k-linear structure and that since ϑ A is D-linear it is also k-linear, for any parallel ϑ-natural maps f and g we compute: So ϑ-natural maps are closed under k-linear structure, and we have that ϑ-nat[X] is a sub-Cartesian left k-linear category of X. Lastly, we need to check that the derivative of a ϑ-natural map is again ϑ-natural map.To do so, first observe that by ϑ-naturality of the projections, it follows that: Also recall that by [6, Lem 2.2.2.(vi)], if g and k are D-linear then D Thus since ϑ A is D-linear, we compute:

Lemay
So we conclude that ϑ-nat[X] is a Cartesian k-differential category.
We can now prove that canonical monad on the subcategory of ϑ-natural is a Cartesian differential monad, and in particular that the Kleisli category is isomorphic as a Cartesian differential category to the starting Cartesian differential abstract Kleisli category.Proposition 5.5 Let X be a Cartesian k-differential abstract Kleisli category with differential combinator D and abstract coKleisli structure (!, ϕ, ϑ).Then the monad S, as defined in Lemma 5.2, is a Cartesian k-differential monad on ϑ-nat[X].Furthermore, the isomorphism G ϑ : X → KL(S) is a strict Cartesian k-differential functor (and so is its inverse), thus X ∼ = KL(S) as Cartesian k-differential categories.
Proof.By assumption, S is a strong Cartesian k-differential functor and ϑ A is D-linear.So it remains to explain why δ A is also D-linear.However again by the assumption that ǫ A is D-linear and that, by Lem 3.5, S preserves D-linear maps, it follows that δ A = S(ǫ A ) is D-linear.So S is indeed a Cartesian differential monad.So now we check that G ϑ is a strict Cartesian k-differential functor.Clearly, G ϑ is a strict Cartesian k-linear functor, so it remains to check that: So G ϑ is a strict Cartesian k-differential functor, and therefore so is G −1 ϑ .Thus we conclude that X ∼ = KL(S) are isomorphic as Cartesian k-differential categories.
We now wish to show the converse and explain how every Kleisli category of a Cartesian differential monad is a Cartesian differential abstract Kleisli category.First, let us recall how every Kleisli category for any monad is an abstract Kleisli category: Sec 2] Let S be a monad on a category X. Define the functor S S : KL(S) → KL(S) as the composite S S = L S • R S , explicity, S S is defined on objects as S S (A) = S(A) and on maps as: For every object A, define the maps ǫ A ∈ KL(S)(S(A), A) and ϑ A ∈ KL(S)(A, S(A)) as follows: Then KL(S) is an abstract Kleisli category with abstract Kleisli structure (S S , ǫ, ϑ).
For an arbitrary monad S, ϑ-nat[KL(S)] is not necessarily isomorphic to X.That said, X always embeds in ϑ-nat[KL(S)] since for any map f in X, L S (f ) is ϑ-natural in KL(S).If the monad S is exact, meaning that η A is an equalizer of η S(A) and S(η A ), then we do have the isomorphism ϑ-nat[KL(S)] ∼ = ϑ-nat[KL(S)] [16, Sec 5].For an abstract Kleisli category, the canonical comonad on its subcategory of ϑ-natural maps is exact.Proposition 5.7 Let S be a Cartesian k-differential monad on a Cartesian k-differential category X.Then KL(S) is a Cartesian k-differential abstract Kleisli category with abstract Kleisli structure (S S , ǫ, ϑ) defined as in Lemma 5.6.
Proof.As explained above, since the projections are of the form π j = L S (π j ) , they are ϑ-natural.Furthermore, since S S = L S • R S is the composite of strong Cartesian k-differential functors, it is itself a strong Cartesian k-differential functor.Lastly, since ǫ A and ϑ A are both D-linear in X, since identity maps are D-linear and the composition of D-linear maps is again D-linear [6, Lem 2.2.2.(iii)], by Thm 4.2, ǫ A and ϑ A are D S -linear in KL(S).So we conclude that KL(S) is a Cartesian k-differential abstract Kleisli category, as desired.
Together, Prop 5.5 & 5.7 give us a precise characterization of which Cartesian differential categories are Kleisli categories of Cartesian differential monads.So we conclude with the following: Corollary 5.8 Let Y be a Cartesian k-differential category.Then there exists a Cartesian k-differential monad S on a Cartesian k-differential category X such that Y ∼ = KL(S) are isomorphic as Cartesian k-differential categories if and only if Y is a Cartesian k-differential abstract Kleisli category.

Kleisli Differential Combinators
In theory, it is possible to start with a Cartesian k-linear monad on a Cartesian left k-linear category, one possibly without a differential combinator, and ask when the Kleisli category has a differential combinator.However, we will argue that in practice, this is not necessarily more efficient.Nevertheless, for completeness, let us introduce the notion of a Kleisli differential combinator, which is a direct description of a differential combinator in the Kleisli category of a Cartesian k-linear monad.Definition 6.1 Let S be a Cartesian k-linear monad on a Cartesian left k-linear category X.A Kleisli differential combinator on S is a family of functions B : X(A, B) → X(A × A, S(B)), where for a map is called the Kleisli derivative of f , and such that the following axioms hold: The axioms [KD.1] to [KD.7] of a Kleisli differential combinator are just what the axioms of a differential combinator in the Kleisli category would be but expressed in the base category.As such, a Kleisli differential combinator does indeed give us a differential combinator: Proposition 6.2 Let X be a Cartesian left k-linear category and let S be a Cartesian k-linear monad on X that is equipped with a Kleisli differential combinator B. Then the Kleisli category KL(S) is a Cartesian k-differential category where the Cartesian left k-linear structure is defined as in Lemma 4.1 and the differential combinator D B is defined on a Kleisli map f : A → S(B) as follows: Furthermore, KL(S) is a Cartesian k-differential abstract Kleisli category with abstract Kleisli structure (S S , ǫ, ϑ) defined as in Lemma 5.6.
Proof.The proof that D B is indeed a differential combinator is essentially by brute force calculations, and not necessarily more enlightening for the story of this paper.As such, we will leave it as an exercise for the motivated reader.Using [KD.S], [KD.µ], and [KD.η] it follows that KL(S) is indeed a Cartesian k-differential abstract Kleisli category as well.
Every Cartesian differential monad has a canonical Kleisli differential combinator given by simply composing derivatives by the unit: Proposition 6.3 Let S be a Cartesian k-differential monad on a Cartesian k-differential category X.Then S has a Kleisli differential combinator B S defined on a map f : A → B as: Furthermore, the differential combinators D S and D B S on the Kleisli category are equal: Proof.We leave checking the Kleisli differential combinator axioms as an exercise for the motivated reader, as they are straightforward to check.That the differential combinators are the same follows from the monad axiom: So D B S is precisely D S as desired.
While Kleisli differential combinators allow one to start from a slightly more general setting, we will now explain why they are not necessarily more advantageous than Cartesian differential monads.Indeed, using results from the previous section we can explain why every Kleisli differential combinator induces a Cartesian differential monad whose Kleisli categories are isomorphic.
So let S be a Cartesian k-linear monad on X that is equipped with a Kleisli differential combinator.Then by Prop 5.5 & 5.7, we have a Cartesian differential monad S S on ϑ-nat[KL(S)] such that KL(S) ∼ = KL(S S ) are isomorphic as Cartesian k-differential categories.Thus we could have simply started from a Cartesian differential monad (albeit on a possibly more complicated category).Furthermore, if S is exact, then ϑ-nat[KL(S)] ∼ = X, which implies that X was actually a Cartesian k-differential category to start with and the Kleisli differential combinator is just given by post-composing the differential combinator by the unit.So in conclusion we have that: Lemma 6.4 Let X be a Cartesian left k-linear category and let S be a Cartesian k-linear monad on X that is equipped with a Kleisli differential combinator B. Then there exists a Cartesian k-differential monad S ′ on a Cartesian k-differential category X ′ such that the Kleisli categories KL(S) ∼ = KL(S ′ ) are isomorphic as Cartesian k-differential categories.
For the sake of completeness, here is a trivial example which shows that it is possible to have a Kleisli differential combinator which is not directly induced from a Cartesian differential monad: Example 6.5 Trivially, for any Cartesian left k-linear category, the constant monad has a Kleisli differential combinator which sends any map to zero.The Kleisli category in this case is again simply isomorphic to the terminal category.
It would be interesting to find more examples of Kleisli differential combinators on Cartesian left klinear categories which are not Cartesian k-differential categories.Furthermore, it seems likely that Kleisli differential combinators play a role in the story of [5] and thus could help provide a deeper understanding of what makes this model work.In turn, Kleisli differential combinators could potentially be used to help provide a general construction of differential combinators for homotopy categories of Kleisli categories.

Eilenberg-Moore Categories of Cartesian Differential Monads
Whenever one has a monad, an important question to ask is what the algebras of the monad and what is its Eilenberg-Moore category.In this section, we will explain why for a Cartesian differential monad, its Eilenberg-Moore category is, in fact, a tangent category [11].We will only provide a brief overview of tangent categories, so we invite the reader to see [11] for a more detailed introduction.
Recall that for a monad S on a category X, an S-algebra is a pair (A, α) consisting of an object A and a map α : S(A) → A such that: and that an S-algebra morphism f : (A, α) → (B, β) is a map f : A → B such that: The category of S-algebras and S-algebra morphisms between them is called the Eilenberg-Moore category of S, and is denoted as EM(S).There is a canonical forgetful functor U S : EM(S) → X which is defined on objects as U S (A, α) = A and on maps as U S (f ) = f .It is well-known that if X has finite products, then EM(S) also has finite products where in particular: However if X is a Cartesian left k-linear category, and even if S is a Cartesian k-linear monad, in general, EM(S) may not be a Cartesian left k-linear category.This is because S-algebra morphisms are not necessarily closed under k-linear structure.Indeed, β • S(r  Tangent categories formalize the properties of the tangent bundle on smooth manifolds from classical differential geometry.As such, an object A in a tangent category can be interpreted as a base space, and T(A) as its abstract tangent bundle, where T n (A) is the n-fold fibres of the tangent bundle.The natural transformations all encode essential properties of the tangent bundle such as the natural projection, the fact that fibre is a vector bundle, etc.
Every Cartesian differential category X is a Cartesian tangent category [11,Prop 4.7], where in particular, the tangent bundle functor is defined as in Ex 3.8, T n (A) is the product of n + 1 copies of A, and the rest of the natural transformations are defined as follows: So how can we explain why the Eilenberg-Moore category of a Cartesian differential monad is a tangent category?The answer is again by lifting, where this time we wish to lift the tangent structure of the base category to the Eilenberg-Moore category.
A tangent monad [12, Def 19] on a tangent category is precisely the kind of monad which lifts the tangent structure to its Eilenberg-Moore category.A bit more explicitly, a tangent monad on a tangent category X is a monad S on X which also comes equipped with a natural transformation λ A : ST(A) → TS(A) which is compatible with µ and η, and such that λ is also compatible with the tangent structure in the sense of [11,Def 2.7].By [12,Prop 20], the Eilenberg-Moore category of a tangent monad on a Cartesian tangent category is also a Cartesian tangent category where the tangent bundle on an S-algebra is T(A, α) = (T(A), T(α) • λ A ). Furthermore, the forgetful functor U S : EM(S) → X preserves the Cartesian tangent structure strictly.It turns out that Cartesian differential monads are always tangent monads: Proposition 7.2 Let S be a Cartesian k-differential monad on a Cartesian k-differential category X.Then S is a tangent monad where λ A := ω A,A : ST(A) → TS(A).
Proof.We need to explain why λ is indeed a natural transformation.So we compute: It is also straightforward to check that the necessary identities in [12,Def 19] hold.So we conclude that S is a tangent monad.
Therefore by [12,Prop 20], we have the main result of this section: Theorem 7.3 Let S be a Cartesian k-differential monad on a Cartesian k-differential category X.Then EM(S) is a Cartesian tangent category such that the U S : EM(S) → X preserves the Cartesian tangent structure strictly.In particular, the tangent bundle of an S-algebra is given by: Thus algebras of Cartesian differential monads can be interpreted as abstract smooth manifolds.
Example 7.4 Trivially, for the identity monad, its Eilenberg-Moore category is just the start Cartesian differential category, while for the constant monad, its Eilenberg-Moore category is again equivalent to the terminal category.
Example 7.5 As explained in [2,11], for both Cartesian differential categories and tangent categories, algebras of the tangent bundle monad are not necessarily well studied and somewhat mysterious.Even in specific examples from differential calculus and differential geometry, there does not in general seem to be a precise characterization beyond the categorical definition.Yet, the above theorem tells us that the Eilenberg-Moore category of the tangent bundle monad is always a Cartesian tangent category -which may have interesting consequences in future work.
Example 7.6 In general, it is understood that algebras of reader monads are not easily characterized.However, we now know that for Cartesian closed differential categories, and thus for any model of the differential λ-calculus, the algebras of the reader monads form a tangent category.
In a Cartesian tangent category, there is an important kind of object called a differential object [11, Def 4.8], which are analogues of Euclidean spaces.They are important since the subcategory of differential objects is a Cartesian differential category [11,Thm 4.11].Briefly, a differential object is a commutative monoid A, with binary operation σ : A × A → A and unit ζ : * → A, which also comes equipped a map p : T(A) → A such that the necessary axioms in [11,Def 4.8] hold.In particular, the key feature of a differential object is that T(A) ∼ = A × A. If X is a Cartesian tangent category, let DIFF[X] be the subcategory of differential objects and all maps between them.Then, as mentioned, DIFF[X] is a Cartesian differential category where the derivative of a map f : A → B is defined by the composite of the isomorphism A × A ∼ = T(A) followed by T(f ) followed by p.
In a Cartesian k-differential category X, every object has a canonical and unique differential object structure [11,Prop 4.7] since in particular T So in this case, DIFF[X] = X, and the resulting differential combinator is the same as the starting one.For a Cartesian differential monad, we will now explain how its Kleisli category embeds as a Cartesian k-differential category into the subcategory of differential objects of its Eilenberg-Moore category.For starters, let us describe the differential objects.So let S be a Cartesian k-differential monad on a Cartesian k-differential category X.Since the U S : EM(S) → X preserves the Cartesian tangent structure strictly, it also preserves differential objects.Thus a differential object in EM(S) must also be one in X.However, this implies that an S-algebra (A, α) can have at most one differential object structure given precisely as above.In other words, if: are S-algebra morphisms, then (A, α) is a differential object.Furthermore, the induced isomorphism T(A, α) ∼ = (A, α) × (A, α) must be an equality on the nose, i.e.T(A, α) = (A, α) × (A, α).It easy to check that T(A, α) = (A, α) × (A, α) will actually imply that π 2 , π 1 + π 2 , and 0 are all S-algebra morphisms as desired.So we have that an S-algebra is a differential object if and only if T(A, α) = (A, α) × (A, α).It turns out that this is precisely the case when the S-algebra is differential linear.
Lemma 7.7 Let S be a Cartesian k-differential monad on a Cartesian k-differential category X.Then an S-algebra (A, α) is a differential object in the Eilenberg-Moore category EM(S) if and only if α is D-linear.
As a result, we get that the Cartesian k-differential structure for the subcategory of differential objects is the same as the base Cartesian k-differential category.In particular, this means that the differential combinator lifts to the subcategory of differential objects.Proof.It may be useful to directly workout why if (A, α) and (B, β) are differential object, then for every S-algebra morphism f : (A, α) → (B, β), D[f ] : (A, α) × (A, α) → (B, β) is also an S-algebra morphism.Since α and β are D-linear, we may use [6, Lem 2.2.2.(vi)] and also (6) to compute: So D[f ] : (A, α) × (A, α) → (B, β) is indeed an S-algebra morphism.
We conclude with the statement that for a Cartesian differential monad, the canonical embedding of the Kleisli category into the Eilenberg-Moore category factors through the subcategory of differential objects.Proposition 7.9 Let S be a Cartesian k-differential monad on a Cartesian k-differential category X.Then for every object A, (S(A), µ A ) is a differential object in the Eilenberg-Moore category EM(S).Furthermore, the functor E S : KL(S) → DIFF[EM(S)], defined on objects as E S (A) = (S(A), µ A ) and on maps as E S (f ) = S ( f ) is a strong Cartesian k-differential functor that is full and faithful.
Proof.For any object A, (S(A), µ A ) is always a S-algebra.Since µ A is also assumed to be D-linear, it follows from Lem 7.7 that (S(A), µ A ) is a differential object.So E S is well defined.Since S is a strong Cartesian k-differential functor, it follows that E S is as well, and it is clear that it is full and faithful.

Conclusion
In this paper, we introduced Cartesian differential monads and showed that their Kleisli categories are Cartesian differential categories such that the differential combinator is lifted from the base category to the Kleisli category.However, the requirement that the monad's functor preserves the Cartesian k-linear structure is somewhat of a strong requirement.While some interesting monads do satisfy this requirement, such as tangent bundle monads and reader monads, there are many important monads which do not, such as state monads, continuation monads, and writer monads.Instead, we conjecture that while the Kleisli categories of these monads may not be Cartesian differential categories, their Kleisli categories will still be tangent categories.Indeed, for some of these monads, there is possibly a distributive law between it and the tangent bundle monad, which would lift the tangent structure of the base Cartesian differential category to the Kleisli category.Thus effectful programs may still form a tangent category, further motivating the need for a term calculus for tangent categories and developing "tangent programming languages".
z) (a, 0) • (0, b) = df (x) dx (a) • b [CD.7] d df (x) dx (y)•z d(y,z) (a, b) • (c, d) = d df (x) dx (y)•z d(y,z) (a, c) • (b, d) Briefly, the axioms of a differential combinator are that: [CD.1] the differential combinator is a k-linear morphism, [CD.2] derivatives are k-linear in their second argument, [CD.3] the derivative of identity maps and projections are projections, [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] the derivative is differential linear in its second argument, and lastly [CD.7] is the symmetry of the partial derivatives.Furthermore, as explained in [20, Lem 2.8], it turns out that [CD.4] is in fact redundant and follows from [CD.3] and [CD.5].
a) • b which says that the derivative of a Curry of a map is the Curry of the partial derivative of said map.Every model of the differential λ-calculus [15] induces a Cartesian closed differential category, and conversely, every Cartesian closed differential category gives rise to a model of the differential λ-calculus.Now let [−, −] be the internal hom.Then every object C induces a monad R(C) := [C, −], µ C , η C , called the reader monad, and is defined as follows (using the term calculus):

Lemma 4 . 1
Let S be a Cartesian k-linear monad on a Cartesian left k-linear category X.Then the Kleisli category KL(S) is a Cartesian left k-linear category where: a) The scalar multiplication by r • f = r • f ; (b) The addition by f + g = f + g ; (c) Zero maps by 0 = 0.Furthermore, L S : X → KL(S) is a strict Cartesian k-linear functor and R S : KL(S) → X is a strong Cartesian k-linear functor.

Theorem 4 . 2
Let S be a Cartesian k-differential monad on a Cartesian k-differential category X with differential combinator D. Then: (i) A family of functors T n : X → X (for each n ∈ N), where by convention T 0 = 1 X and T 1 = T is called the tangent bundle functor;(ii) A natural transformation p A : T(A) → A called the projection; (iii) A natural transformation s A : T 2 (A) → T(A) called the sum; (iv) A natural transformation z A : A → T(A) called the zero; (v) A natural transformation ℓ A : T(A) → T 2 (A) called the vertical lift; (vi) A natural transformation c A : T 2 (A) → T(A) called the canonical flip;such that all the necessary axioms in[11, Def 2.3 & 2.8]  hold.

Corollary 7 . 8
Let S be a Cartesian k-differential monad on a Cartesian k-differential category X.Then DIFF[EM(S)] is a Cartesian k-differential category such that the obvious forgetful functor DIFF[EM(S)] → X is a strict Cartesian k-differential functor.So in particular, if (A, α) and (B, β) are differential object, then for every S-algebra morphism f : (A, α) → (B, β), its derivative is also an S-algebra morphism D[f ] : (A, α) × (A, α) → (B, β).
A smooth function F : R n → R m is D-linear if and only if it is R-linear in the classical sense.
. [CD.1] is straightforward to check.To prove [CD.2], [CD.6], and [CD.7], we use the fact that L S preserves the Cartesian left k-linear structure strictly and that g • F S (f ) = g • f .So for [CD.6] we compute: category, even if S is a Cartesian k-differential monad, then the derivative of an S-algebra morphism may not be an S-algebra morphism.So while EM(S) is not necessarily a Cartesian k-differential category, it turns out that it is still a tangent category.So let us briefly recall the necessary structure: