# Understanding a limit taken along all non-decreasing rational sequences

In my stochastic processes notes I've come across a proof of Doob's regularity theorem, which takes as trivial a step which I'm not sure is. The proof consists of constructing a cadlag modification of a continuous time Martingale satisfying certain conditions. The step I'm unclear in is showing that the constructed process is cadlag, however this has exposed a general weakness in my understanding of limits, so that is how I'm going to present the question (I include the stochastics tag because I think this kind of question is fairly common in its study).

Suppose $g: D\to \mathbb R$ is a function such that $\lim_{q\downarrow t} g(q)$ exists for each $t\in D\subset \mathbb R$ (Let us assume $D$ is connected). This means that $\lim_{n\to \infty} g(q_n)$ exists for every non-increasing rational sequence $(q_n)$, and moreover that this limit is the same for all such sequences. Now let us define $f:D\to \mathbb R$ by $f(t)=\lim_{q\downarrow t} g(q)$.

What conditions on $g$ do we need to ensure that $f$ right continuous?

In other words, what conditions do we need so that for any $t\in D$ do we have that $\lim_{s\downarrow t}\lim_{q\downarrow s} g(q)=\lim_{q\downarrow t} g(q)$? (here $\lim_{s\downarrow t}$ is the bog standard right limit at $t$). I presume that under the right conditions the argument would go as follows: We first show that $\lim_{q'\downarrow t}\lim_{q\downarrow q'} g(q)=\lim_{q\downarrow t}g(q)$, and then show that $\lim_{s\downarrow t}\lim_{q\downarrow s} g(q)=\lim_{q'\downarrow t}\lim_{q\downarrow q'} g(q)$.

For any sequence of non-increasing rationals $(q_n)$ converging to $t$, and for any $n\in \mathbb N$ and any non-increasing sequence of rationals $(q_{m,n})_{m\in \mathbb N}$ converging to $q_n$ we want to have that $\lim_{n\to \infty}\lim_{m\to \infty}g(q_{m,n})=\lim_{q\downarrow t}g(q)$, which would then prove the first part. Now I believe using the axiom of countable choice we can restructure the countable collection $\{q_{m,n}\}$ into a sequence of non-increasing rationals $(q'_\ell)$ converging to $t$ such that $\lim_{n\to \infty}\lim_{m\to \infty}g(q_{m,n})=\lim_{\ell\to\infty}g(q'_\ell)$, which by our assumption would give the result. I am not firm on the details though, and would appreciate a rigorous elucidation.

The second desired equality, that $\lim_{s\downarrow t}\lim_{q\downarrow s} g(q)=\lim_{q'\downarrow t}\lim_{q\downarrow q'} g(q)$, I think would follow from some type of density argument, but I cannot figure out what conditions would be needed to make such an argument work. The standard $$g(t)=\begin{cases}1 & t\in \mathbb Q \\ 0 & t\notin \mathbb Q\end{cases}$$ shows that there has to be some extra conditions on $g$. The proof which motivated this question is specifically dealing with $g$ being a sample path of a martingale with the property that $t\mapsto \mathbb E[g_t]$ is continuous, but I do not believe this property is relevant for this part of the proof, although I am starting to think that maybe the right continuity of the filtration involved might be used, or something to do with upcrossings. Regardless, I am interested in understanding the general case as I've presented.