how much differential structure can we put on countable manifolds? The motivation for this question is that I would like to formulate Lagrangian mechanics in a purely discrete setting (see also my older question at physics.se). Unfortunately several key pieces of machinery, such as Hamilton's least action principle and Noether's theorem, unsurprisingly require differential structure on the manifold of possible physical configurations.
Hence my question: how much differential geometry (or even Riemannian geometry) can one do by putting additional structure on manifolds $M$ locally homeomorphic to $\mathbb{Q}^n$?
Even for $n=1$, I foresee complications, since smooth functions $\gamma:\mathbb{Q}\to \mathbb{Q}$ can be poorly behaved, such as 
$$\gamma(x) = \begin{cases}0, & x<\sqrt{2}\\ 1, & x >\sqrt{2}\end{cases}$$
but perhaps it is possible to avoid such problems by restricting charts to be e.g. smooth functions with all derivatives Lipschitz-continuous, etc?
Of course, this is a very broad question; I'm specifically wondering (i) how much work has been done on this topic? Is there a good reference? Or (ii) is there a fundamental obstruction to the whole approach?
 A: At least in the topological setting, it's very hard to get any sort of manifold theory working over the rational numbers.
The reason is that $\mathbb{Q}^n$ is homeomorphic to $\mathbb{Q}$ for all $n\geq 1$, as is any $\mathbb{Q}^n$-manifold that you might construct.  In fact, every countable, regular, first-countable space without isolated points, and in particular every countable metric space without isolated points, is homeomorphic to $\mathbb{Q}$. See here for a proof.
A: Maybe check out diffeology. Diffeological spaces are generalized smooth spaces that generalize smooth manifolds. The category of smooth manifolds embeds fully and faithfully into the category of diffeological spaces, which has the extremely nice property of being a quasi-topos. You could define the sort of spaces you seem to be interested in as diffeological spaces where each point has an open neighbourhood diffeomorphic to $\mathbb{Q}^n$. I'm no expert on the subject, but there's a recent textbook by Patrick Iglesias-Zemmour.
Alternatively, it might be better to work in the setting of of algebraic geometry, and look at schemes over $\operatorname{Spec}(\mathbb{Q})$ that locally look like the affine space $\mathbb{A}^n_{\mathbb{Q}}$. You can do a surprising amount of differential geometry here in the same way as the usual manifold setting (see for example the book Models for Smooth Infinitesimal Analysis).
