A confusion about the proof: every open set in $R^1$ is the union of an at most countable collection of disjoint segments. I have met two types of solutions about this question, one is by the partition of the  equivalence relation, and I understand that, and the other is the following:

I don't understand why the disjoint sets by an enumeration of the rational numbers can cover all the irrational numbers. Isn't is a situation that for some irrational number $r$ the two open sets be chosen by $(a,r)$ and $(r,b)$, so it can cover all the rational numbers but does not contain irrational number $r$.
Thank you in advance.
say
EDIT: I am sorry for leaving out the statement "open". I meant to say open set.
 A: The statement is not correct. The set of all irational numbers is a counterexample. What the proof in the OP proves is that every open set is a disjoint union of countably many open intervals. That statement and the proof are correct.
Update 1: I looked at the proof again and I think that the objections by OP are valid. The proof is wrong. Indeed, it is so not only because we may not cover all irrational points in $U$ but also not all rational points there: it could happen that the rational point we are trying to cover is a limit point of the already covered set. In that case the "maximal interval" does not exist.
Update 2: It looks like the answers and comments here contain a correct proof:
Any open subset of $\Bbb R$ is a countable union of disjoint open intervals
Update 3: The proof in OP can be saved if one takes each time the maximal interval $(p_n-a, p_n +b)$ contained in $U$. That interval cannot intersect with any of the previously chosen intervals because those were maximal too. This way we cover all rational points. Then if we take an irrational point, its maximal interval must contain one of the $p_n$, so it must belong to the maximal interval of the $p_n$ and so that point is also covered.
