Continuity of functions and rational numbers I saw this argument used in a proof, and I don't quite understand it with the $\epsilon - \delta$ definition (it is easier to understand with the sequential criterion). 
If $f: \mathbb{R} \rightarrow \mathbb{R}$ is continuous at any point $a \in \mathbb{R}$, then suppose for any rational number $r$, $f(r)=r$. Clearly, it follows that using the fact that $f$ is continuous, then $f(x) = x$ ($\forall x \in \mathbb{R})$.
What would be the logic behind this argument? I've seen it being used in similar ways on many other proofs. 
 A: Construct a sequence $\left(x_n\right)$ of rational numbers converging to an arbitrary real number, $x$ (the rationals are dense in the reals, so you can always do this). Since $f$ is continuous, then $x_n=f\left(x_n\right)\rightarrow f\left(x\right)$ (continuous functions and limits "commute"). Since limits are unique (this is true for any Hausdorff space), then $f\left(x\right)=x$.
A: Consider irrational $a$; by assumption $f$ is continuous here. Assume, for contradiction, that $f(a) = b \neq a$, and let $\sigma = b - a$ (assume, without loss of generality, that $b > a$).
Now, take any $\epsilon < \dfrac12\sigma$. By continuity, there is a $\delta$ so that 
$$
|f(a) - f(x)| = |b - f(x)| < \epsilon
$$
whenever $|a - x| < \delta$. In particular, for rational $r \in (a - \delta,a+\delta)$, 
$$
|b - r| < \epsilon < \dfrac12 \sigma.
$$
Let $r$ be a rational number in $(a - \delta,a)$, then
$$|b - r| = |b - a + a - r| = b - a + a - r> \sigma > \dfrac12\sigma > \epsilon,$$
and we have our contradiction.
