I'm a computer scientist, not a mathematician, so apologies if I've messed up a lot of things greatly.


I've been reading about [synthetic differential geometry](https://ncatlab.org/nlab/show/synthetic+differential+geometry), and [trying to formalize it in Coq](https://github.com/bollu/diffgeo/blob/master/diffgeo.v). While dealing with the axiomatic specification is quite pleasing, actually constructing a (computable / effective) model of this seems frightfully hard.


The simplest model that I could find comes from [Differential Geometry in Toposes: Ryszard Paweł Kostecki](https://www.fuw.edu.pl/~kostecki/sdg.pdf)  is $\mathbf{Set}^{\mathbb R- \mathbf{Alg}}$: That is, functors from $\mathbb R$ algebras to $\mathbf{ Set}$. This is quite painful to formalize within Coq, and at the end, I don't think what's left will be computable (since the reals are not computable)


My questions are (in descending order of importance)


* How do I get a computable model of SDG, in the sense that, I should at the end of the whole process be abel to use a computable version of (say) the derivative operator within Coq. Is this possible? If yes, what model of synthetic differential geometry is this?
* Does restricting to the case of *discrete* differential geometry make life any easier for me? Is there a study of "synthetic discrete differential geometry"?


**EDIT**: adding more details about what I'm looking for


I know that one can impement differentiable programming languages by using implementations of automatic differentiation. There's a categorical interpretation to this, for example, see [The simple essence of automatic differentiation](https://arxiv.org/abs/1804.00746).


What I'm looking for is a way to perform computational differential *geometry*. So, not only do I want to be able to be able to calculate the *value* of $f'(x\_0)$ at a given $x\_0$, I want to be able to compute the differential of $f$ *as a computable function*. So, for example, I want there to exist an operator $d: (f : M \rightarrow N) \rightarrow (T\_x M \rightarrow T\_{f(x)}N)$.


Ideally, I want this setup such that I can:


* prove things about the operator $d$ within the axiomatic system as laid out by SDG (in Coq).
* Create a computable model that satisfies those axioms (implement the axiomatic system in Coq)
* Finally, extract out runnable Haskell / OCaml code that allows computable access to things like the differential map $d$, such that when I feed it in $f(x) = x +2$, I should get $d f \equiv 1$ ($\equiv$ reasoning between equality of functions extentionally).


I don't know if this is too much of an ask, or indeed, a coherent ask. The goal really for me is to have a verified, computable differential geometry (or at least, discrete differential geometry) library, with proofs that can be done *easily*, which is the whole point of SDG.



Constructing computable synthetic differential geometry?
I still don't quite understand what OP wants, but let me just cite a few papers that I think might be relevant to such questions. First, there are a lot of literature that describe how to work with real numbers in a computationally meaningful way. To give a few examples:


* [Andrej Bauer, Iztok Kavkler, A constructive theory of continuous domains suitable for implementation](https://www.sciencedirect.com/science/article/pii/S0168007208001589)
* [Ulrich Berger, From coinductive proofs to exact real arithmetic: theory and applications](https://arxiv.org/abs/1101.2162)
* [Helmut Schwichtenberg, Constructive analysis with witnesses](http://www.mathematik.uni-muenchen.de/~schwicht/seminars/semws16/constr16.pdf)
* [Michal Konecný, Eike Neumann, Implementing evaluation strategies for continuous real functions](https://arxiv.org/abs/1910.04891)
* [Dirk Pattinson, Mina Mohammadian, Constructive Domains with Classical Witnesses](https://arxiv.org/abs/1910.04948)


I think that ideas presented in these papers can be used to implement a library in a proof assistant with the goal of extracting computable functions on real numbers.


If you really want to work with SDG, I'd like to mention that there are other options. Differential λ-calculus was already mentioned in the comments. I also would like to mention [tangent categories](https://www.mta.ca/uploadedFiles/Community/Bios/Geoff_Cruttwell/sman3.pdf), which generalize both differential categories (which are a categorical model of differential λ-calculus and SDG).


The question is at which level of abstraction you want to work. Differential categories is the simplest setup and tangent categories is the most general since they generalize both differential categories and SDG, but it is also simpler (in some sense) than SDG since it is more abstract. All of these frameworks are abstractions of the usual differential geometry (and also other settings in which the differential operator occurs). The more abstract framework, the more models it has, but it also means that it allows to prove less theorems in specific models.


It seems that you do not really care about other models and wants to work formalize just ordinary differential geometry. If this is true, I'd say it does not make sense to start with a complicated framework such as SDG. Abstract framework does not really help if you care about program extraction since you still need to construct specific models in a proof assistant. They are useful if you want to reason abstractly about such structures.


If you want to implement a library with a program extraction, I'd suggest to start with a direct implementation of real numbers as described in the papers I cited at the beginning (or any other similar paper). Then you can implement an abstract framework on top of that. You will need a concrete model of such a framework anyway if you want to get a concrete implementation of real functions.


