In my general topology textbook there is the following exercice:
Prove that $\mathbb R$, $\mathbb Z$, $\mathbb Q$, and $\mathbb I$ are regular topological spaces.
My proof
$\mathbb Z$, $\mathbb Q$, and $\mathbb I$ are subspaces of $\mathbb R$, so if $\mathbb R$ is regular, then those subspaces will also be regular.
So, let $A\subseteq \mathbb R$ be a closed subset, and $x \in \mathbb R \setminus A$.
We can write $A = \bigcup_i A_i$, for some index set $i \in I$, where $A_i$ are the connected components of the set $A$.
We can define $\varepsilon = \inf \ \{ |x - \delta|, \delta \in A\}$. Then we have that $x \in (x - \frac{\varepsilon}{2} ,x + \frac{\varepsilon}{2})$, and $\forall i \in I, A_i \subseteq (\inf A_i - \frac{\varepsilon}{2}, \sup A_i + \frac{\varepsilon}{2})$, so we conclude that $A \subseteq \bigcup_i(\inf A_i - \frac{\varepsilon}{2}, \sup A_i + \frac{\varepsilon}{2})$. Is trivial that $\bigcup_i(\inf A_i - \frac{\varepsilon}{2}, \sup A_i + \frac{\varepsilon}{2}) \cap (x - \frac{\varepsilon}{2} ,x + \frac{\varepsilon}{2}) = \emptyset$, thus the set $\mathbb R$ is regular.
So, first of all I would like to know if My proof is correct and if so, is there anything that I can do to improve it?
The one thing that bothers me about this proof is that, in order to define $\varepsilon$, I assumed that $\mathbb R$ is a metric space with $d(x,\delta) := |x - \delta|$. This is a problem because at this point I have not learned about metric spaces because My textbook starts with topological spaces and then moves on to metric spaces. How can I prove this without using any metric and instead use the definitions and axioms of topological spces?
Your proof is correct :)
But it's unnecessary to split $A$ into its path-connected components. It is common to define $dist(x,A) := \inf\limits_{a \in A} |x-a|$ (that's your $\varepsilon$).
It's not necessary to know about metric spaces in a general setting because the only property you're using is completeness of $\mathbb{R}$ (ie, the infimum of a non-empty bounded below set exists).
However, that's a common way of dealing with such problems in metric spaces and general, so your approach was correct :)