Consider a function $f$ from a cofinite subset of $\mathbb{Q}$ to $\mathbb{Q}$. As established here and here $f$ extending to a smooth function on a cofinite subset of $\mathbb{R}$ is not sufficient to ensure that $f$ is a rational function. Furthermore, I believe that the stronger condition that all of $f$'s derivatives also map $\mathbb{Q}$ to $\mathbb{Q}$ (which I will call being '$\mathbb{Q}$-closed') is not strong enough to ensure that $f$ is a rational function.
The question is are any of these strengthenings involving extensions of $f$ to $\mathbb{Q_p}$ strong enough to ensure that $f$ is rational (or equal to some rational function on its domain). Specifically these are motivated by the fact that a rational function from $\mathbb{Q}$ to $\mathbb{Q}$ extends to smooth functions in $\mathbb{R}$ and $\mathbb{Q}_p$ and the derivatives of a rational function are fixed algebraically and so are the same in $\mathbb{R}$ and $\mathbb{Q_p}$.
Let $K\in\{\mathbb{R},\mathbb{Q_2},\mathbb{Q_3},... \}$
- $f$ extends to a continuous function (on some cofinite domain) in every $K$.
- $f$ extends to a smooth function (on some cofinite domain) in every $K$.
Write $\partial_Kf$ to mean the derivative of the maximal extension of $f$ to $K$ restricted to $\mathbb{Q}$.
- $\partial^n_Kf$ exists (on some cofinite domain) and is $\mathbb{Q}$-closed for arbitrary $n$ and $K$ (note that the derivatives $f^{(n)}$ in different extensions aren't a priori the same when restricted to $\mathbb{Q}$).
- $\partial_{K_1}\partial_{K_2}...\partial_{K_n}f$ exists (on some cofinite domain) and is $Q$-closed for arbitrary sequences $K_1,K_2,...,K_n$.
- Condition 4 with the additional requirement that $\partial_{K_1}\partial_{K_2}...\partial_{K_n}f=\partial_{K_1^\prime}\partial_{K_2^\prime}...\partial_{K_n^\prime}f$ for any two sequences $K_1,K_2,...,K_n$ and $K_1^\prime,K_2^\prime,...,K_n^\prime$ of the same length.
Or any other conditions of this ilk. I'm also curious if conditions 4 and 5 are equivalent.