Suppose that $f$ is a real-valued function on a subset $A$ of $\textbf{R}$. The following are equivalent:
(a) $f$ is continuous on $A$.
(b) if $U$ is an open subset of $\textbf{R}$, then $f^{-1}(U)$ is a relatively open subset of $A$.
MY ATTEMPT
Let us prove the implication $(a)\Rightarrow(b)$ first.
Let $x\in f^{-1}(U)$. We want to prove there is an relatively open subset of $A$ which contains $x$ and is contained in $f^{-1}(U)$.
Indeed, this is the case. if $x\in f^{-1}(U)$, then $f(x)\in U$.
Since $U$ is open, there is a positive real number $\varepsilon > 0$ s.t. $f(x)\in N_{\varepsilon}(f(x))\subseteq U$. But $f$ is continuous. This means that for every $\varepsilon > 0$, there corresponds a $\delta > 0$ s.t. for every $y\in A$ the following implications hold: \begin{align*} y\in N_{\delta}(x)\cap A \Rightarrow f(y)\in N_{\varepsilon}(f(x))\subseteq U \Rightarrow y\in f^{-1}(U) \end{align*}
Hence we conclude that $f^{-1}(U)$ is relatively open because $x\in N_{\delta}(x)\cap A\subseteq f^{-1}(U)$, and we are done.
Let us now try to prove the second implication $(b)\Rightarrow(a)$.
We want to prove the following claim:
\begin{align*} (\forall a\in A)(\forall\varepsilon > 0)(\exists\delta > 0)(\forall x\in A)(x\in N_{\delta}(a)\Rightarrow f(x)\in N_{\varepsilon}(f(a))) \end{align*}
Let $\varepsilon > 0$ and $a\in A$. Then $f^{-1}(N_{\varepsilon}(f(a))) = \mathcal{O}\cap A\supseteq N_{\delta}(a)\cap A$ for some $\delta > 0$, where $\mathcal{O}$ is open.
Hence we conclude that \begin{align*} x\in N_{\delta}(a)\cap A \Rightarrow x\in f^{-1}(N_{\varepsilon}(f(a))) \Rightarrow f(x) \in N_{\varepsilon}(f(a)) \end{align*} and we are done.
Could someone please verify if the wording and reasoning of my solution are correct?
Any contribution is appreciated.