Proving that $\sup_{s \in [a,b)}f(s)=\sup_{s \in [a,b)\cap \mathbb{Q}}f(s)$ for right continuous function.

Proposition. Let $[a,b) \subset \mathbb{R},\,a<b$. If $f:[a,b)\to \mathbb{R}$ is right-continuous over $[a,b)$, we have that $$\sup_{s \in [a,b)}f(s)=\sup_{s \in [a,b)\cap \mathbb{Q}}f(s)$$

This fact is used in building the theory of pathwise continuous stochastic processes and most of the sources I've been reading don't provide much justification for it, as they take it for granted. In general, I always thought I saw how it is true, and the proof sketch could be like this: the set of rational numbers $[a,b)\cap \mathbb{Q}$ is dense in $[a,b)$, so the assumption of continuity would make us able to find values of $f$ at rational points arbitrarily close to the supremum of $f$ over $[a,b)$. However, I've not been able to write a proof that goes rigorously and clearly through all the passages. Would be grateful for any help in filling this out.


Suppose $f: [a,b) \to \mathbb R$ is right-continuous.

Let $M=\sup_{x \in [a,b)} f(x)$. Since $[a,b) \cap \mathbb Q \subset [a,b)$, we have $$\sup_{x \in [a,b) \cap \mathbb Q} f(x) \leq M. \qquad \qquad (1)$$

To show $\sup_{x \in [a,b) \cap \mathbb Q} f(x) = M$, let $\varepsilon>0$ be given. Then there is $x_0 \in [a,b)$ so that $$M-\dfrac{\varepsilon}{2}<f(x_0).$$ Since $f$ is right-continuous, there is $\delta_0>0$ so that
$$|f(x)-f(x_0)|< \dfrac{\varepsilon}{2} \text{ for all } x \in [a,b) \text{ satisfying } x_0<x<x_0 + \delta_0$$

Let $\delta_1=\min\{\delta_0, (b-x_0)/2 \}$. Notice $\delta_0 \geq \delta_1>0$ and $(x_0, x_0+\delta_1) \subset [a,b)$.

Since $\mathbb Q $ is dense in $\mathbb R$, there is $x_1 \in \mathbb Q \cap (x_0, x_0+\delta_1) \subset [a,b)$. Since $x_0<x_1<x_0+\delta_1$, we have $$f(x_1)>f(x_0)-\dfrac{\varepsilon}{2}>M-\varepsilon.$$ Since $x_1 \in [a,b)$ and $\varepsilon>0$ is arbitrary, we have $$\sup_{x \in [a,b) \cap \mathbb Q} f(x) \geq M. \qquad \qquad (2)$$ Combining inequalities $(1)$ and $(2)$ shows that we have obtained the following result $$\sup_{x \in [a,b) } f(x)=\sup_{x \in [a,b) \cap \mathbb Q} f(x)$$

Note: The issue that can arise with left- or right-continuous functions on the interval $[a,b]$ is when there is $\epsilon>0$ so that $f(a)>f(x)+\epsilon$ or $f(b) > f(x)+\epsilon$ for all $x \in [a,b]$. In other words, the value of $f$ at the left- or right-endpoint can be an isolated point of $f\left([a,b]\right)$ when the function is left- or right-continuous which poses a problem in this argument when this isolated point of the range happens to be the max of $f$ on $[a,b]$.