Questions about a proof of a countable set I am studying discrete math right now and came across this example below. The gist of the theorem is simple, but the technicalities are from analysis which I am yet to study. 

Theorem: For any arbitrary function $\displaystyle{f: \mathbb R \to \mathbb R, \ A = \{a \in \mathbb R: \lim_{x \to a}f(x) \text{ exists and }\lim_{x \to a}f(x) \ne f(a)}\}$ is at-most countable.
Proof: Let $I$ be the set of all open subintervals of $\mathbb R$ with rational endpoints. Note, $I$ is countable$^1$. For each rational $r$, let $\displaystyle{A_r = \{a \in \mathbb R: f(a) < r < \lim_{x \to a}f(x) \text{ or }\color{blue}{\lim_{x \to a}f(x) < r < f(a)}}\}$. Clearly, $A = \bigcup A_r.$ Now, fix some $r \in \mathbb Q, \ a \in A_r$ and assume $\displaystyle{\color{green}{f(a) < r < \lim_{x \to a}f(x)}}$. Then$^2$ there's $\delta > 0$ s.t. $a - \delta < y < a + \delta \text{ and } y \ne a \implies f(y) > r.$ Next, pick an $I_a(I_a \in I)$ s.t. $a \in I_a, \ I_a \subseteq (a - \delta, a + \delta)^3.$ Since $f(y) > r$ for any $y \in I_a$ with $y \ne a,$ we see that$^4$ $y \not \in A_r$ for any $y \in I_a - \{a\}.$ In particular, $A_r \cap I_a = \{a\}.$ Thus, a mapping $a \to I_a$ from $A_r \to I$ is injective$^5$.

My questions:
$1$. It's not obvious to me. Divide the reals into subintervals and consider an arbitrary one -- $S = (\frac ab, \frac cd).$  Then $|S| = \frac{bc - ad}{bd} \in \mathbb Q.$ Thus we can correspond a rational number to every rational subinterval. Since any subset of rationals is countable, so is $I$. If it doesn't make sense, how can we show $I$ is countable?
$2$. How do we get $f(y) > r$ here? I looked up the definition of limit, but still cannot work out where the inequality comes from.
$3$. Do we require $I_a \subseteq (a - \delta, a + \delta)$ because this inclusion guarantees $y \in I_a$ ?
$4$. When we say $y \not \in A_r$, are we ignoring the blue bit above? Is green bit above sufficient for describing elements in $A_r$? Why?
$5.$ Not clear on how they showed injectivity. We do have $A_r \cap I_a = \{a\}.$ Does it mean we map the particular $a \in A_r$ to the particular $a \in I_a$?
 A: *

*Your idea doesn't quite work, because two different intervals can have the same length (i.e. your mapping is not injective), so the fact that the set of possible lengths is countable doesn't imply that the set of intervals is countable. However, since each interval corresponds to a unique pair of rational numbers (its endpoints), the result follows from this argument.

*Let $L=\lim_{x\to a}f(x)$. We're assuming $L>r$, so take $\epsilon=L-r$ and apply the definition of limit. The point is that if $y$ is close enough to $a$, then $f(y)$ is close enough to $L$ that it must be above $r$.

*The point here is to choose $I_a$ small enough so that the limit property applies to all its elements (except $a$ itself). This guarantees that no other elements of $I_a$ are in $A_r$.

*This is a "without loss of generality" argument. We could split $A_r$ into two sets $\{a \in \mathbb R: f(a) < r < \lim_{x \to a}f(x)\}$ and $\{a \in \mathbb R: \lim_{x \to a}f(x) < r < f(a)\}$, treat each one separately, then use that the union of two countable sets is countable.

*We map the particular $a \in A_r$ to the whole interval $I_a\in I$. This mapping $A_r\to I$ is injective because each $a$ is mapped to an interval that contains $a$ but does not contain any other elements of $A_r$, so it would be impossible for two different elements of $A_r$ to map to the same interval.
