Verification: "$A\subseteq\mathbb{R}$, $f: A\to \mathbb{R}$, then $f$ is cont. iff $f^{-1}(O)$ open in $A$, $\forall O \subseteq \mathbb{R}$ open" Hope everything is going well for everyone. I am hoping to get some feedback here concerning the accuracy, cohesiveness, and superfluousness of my attempt at the following problem. Also, please criticize my proof writing as much as possible; I really value scrutiny.
Problem
For non-empty $A \subseteq \mathbb{R}$, let $f:A \to \mathbb{R}$ be a function. Proof that $f$ is continuous if and only if for every $O \subseteq \mathbb{R}$, the preimage $f^{-1}(O)$ is open relative to $A$.
Definitions
Open Relative to: If $A \subseteq B \subseteq \mathbb{R}$, then $A$ is called relatively open in $B$ if $\forall x \in A$, $\exists \delta > 0$ such that $\mathcal{B}_{\delta}(x) \cap B \subseteq A$.
Continuous: For non-empty $A \subseteq \mathbb{R}$, let $f:A \to \mathbb{R}$ be a function. $f$ is continuous at $x \in A$ if for every $\epsilon > 0$, there exists $\delta > 0$ such that $A \cap \mathcal{B}_{\delta}(x) \subseteq f^{-1}(\mathcal{B}_{\epsilon}(f(x)))$.
Attempt
$\text{   }$ ($\Longrightarrow$) Let $f : A \subseteq \mathbb{R} \to \mathbb{R}$ be continuous. We want to show that $f^{-1}(O)$ is open relative to $A$.
$\text{   }$ Consider an arbitrary open set $O \subseteq \mathbb{R}$. For all $x' \in f^{-1}(O)$, we have that $f(x') \in O$, and since $O$ is open, this means that $\forall f(x') \in O$, $\exists \epsilon > 0$ such that $\mathcal{B}_{\epsilon}(f(x')) \subseteq O$. That $\mathcal{B}_{\epsilon}(f(x')) \subseteq O$ implies $f^{-1}(\mathcal{B}_{\epsilon}(f(x'))) \subseteq f^{-1}(O)$. We know that $f^{-1}(O) \subseteq A$, so we have  $f^{-1}(\mathcal{B}_{\epsilon}(f(x'))) \subseteq f^{-1}(O) \subseteq A$. Since $f$ is continuous at $x \in A$ we have $\forall \epsilon > 0$, $\exists \delta > 0$ such that $\mathcal{B}_{\delta}(x) \cap A \subseteq f^{-1}(\mathcal{B}_{\epsilon}(f(x)))$. This means that $\forall x' \in f^{-1}(O)$, $\exists \delta > 0$ such that
$$\mathcal{B}_{\delta}(x') \cap A \subseteq f^{-1}(\mathcal{B}_{\epsilon}(f(x'))) \subseteq f^{-1}(O)$$
which provides us with the relationship $\mathcal{B}_{\delta}(x') \cap A \subseteq f^{-1}(O)$. Since $O \subseteq \mathbb{R}$ was arbitrary, we have that $f^{-1}(O)$ is open relative to $A$ for any $O \subseteq \mathbb{R}$.
$\text{   }$ ($\Longleftarrow$) Let $O \subseteq \mathbb{R}$ be an arbitrary open set and let $f^{-1}(O)$ be open in $A \subseteq \mathbb{R}$. We want to show that $f$ is continuous at $x \in A$.
$\text{   }$ Assume for the sake of contradition that $f$ is not continuous at $x \in A$, i.e. $\exists \epsilon > 0$, such that $\forall \delta > 0$ we have $\mathcal{B}_{\delta}(x) \cap A \nsubseteq f^{-1}(\mathcal{B}_{\epsilon}(f(x)))$.
$\text{   }$  Given that $f^{-1}(O)$ be open in $A$, we have that $\forall x \in f^{-1}(O)$, $\exists \delta > 0$ such that $\mathcal{B}_{\delta}(x) \cap A \subseteq f^{-1}(O)$. That $O$ is open implies that for each $f(x) \in O$, $\exists \epsilon > 0$ such that $\mathcal{B}_{\epsilon}(f(x)) \subseteq O$. Taking the preimage of both sides, we get that $f^{-1}(\mathcal{B}_{\epsilon}(f(x))) \subseteq f^{-1}(O)$. Since $f^{-1}(\mathcal{B}_{\epsilon}(f(x)))$ is also open, we know that for all $x' \in f^{-1}(\mathcal{B}_{\epsilon}(f(x)))$, $\exists \delta > 0$ such that $\mathcal{B}_{\delta}(x') \subseteq f^{-1}(\mathcal{B}_{\epsilon}(f(x)))$, which means $\mathcal{B}_{\delta}(x') \cap A \subseteq f^{-1}(\mathcal{B}_{\epsilon}(f(x)))$, a contradiction since we assumed that for all values of $\delta > 0$, $\mathcal{B}_{\delta}(x) \cap A \nsubseteq  f^{-1}(\mathcal{B}_{\epsilon}(f(x)))$. Thus, $f$ is continuous at $x \in A$.
Questions
Is this true, should I phrase it alternatively, and is it really necessary to mention?: "We know that $f^{-1}(O) \subseteq A$, so we have  $f^{-1}(\mathcal{B}_{\epsilon}(f(x'))) \subseteq f^{-1}(O) \subseteq A$."
Are there inaccuracies present in this statement: "...we know that for all $x' \in f^{-1}(\mathcal{B}_{\epsilon}(f(x)))$, $\exists \delta > 0$ such that $\mathcal{B}_{\delta}(x') \subseteq f^{-1}(\mathcal{B}_{\epsilon}(f(x)))$, which means $\mathcal{B}_{\delta}(x') \cap A \subseteq f^{-1}(\mathcal{B}_{\epsilon}(f(x)))$, a contradiction since we assumed that for all values of $\delta > 0$, $\mathcal{B}_{\delta}(x) \cap A \nsubseteq f^{-1}(\mathcal{B}_{\epsilon}(f(x)))$."
 A: The $\Leftarrow$ direction does not need a proof by contradiction: To see that $f$ is continuous at $x \in A$: consider $N_\epsilon(f(x))$ which is an open subset of $\Bbb R$, so by assumption $f^{-1}[N_\epsilon(f(x))]$ is open in $A$ and contains $x$. So by the definition of being relatively open, there is some $\delta >0$ so that $(x \in ) N_\delta(x) \cap A \subseteq f^{-1}[N_\epsilon(f(x)]$ and so we're done showing continuity at $x$. Much shorter and more direct.
A: Here I provide an alternative way to phrase the proof which you can compare with.
Let us prove the implication $(\Rightarrow)$ first.
Let $f:(X,d_{X})\to(Y,d_{Y})$ be continuous function between metric spaces.
Moreover, let us also consider an open set $\mathcal{O}\subseteq Y$. We must prove that $f^{-1}(\mathcal{O})$ is also open.
More precisely, this is equivalent to prove that every point $x\in f^{-1}(\mathcal{O})$ is an interior point.
Indeed, this is the case. Since $x\in f^{-1}(\mathcal{O})$, we can conclude that $f(x)\in\mathcal{O}$.
But it is also known that $\mathcal{O}$ is open. Consequently, there corresponds an open ball $N_{\varepsilon}(f(x))\subseteq\mathcal{O}$.
On the other hand, $f$ is continuous. This means there corresponds an open ball $N_{\delta}(x)\subseteq X$ such that
\begin{align*}
a\in N_{\delta}(x) \Rightarrow f(a)\in N_{\varepsilon}(f(x))\subseteq\mathcal{O} \Rightarrow a\in f^{-1}(\mathcal{O})
\end{align*}
In other words, we have just proven that $x$ is an interior point, because $N_{\delta}(x)\subseteq f^{-1}(\mathcal{O})$.
We may now prove the implication $(\Leftarrow)$
Take an $\varepsilon > 0$ and some $x\in X$, which we can associate to the open ball $N_{\varepsilon}(f(x))$.
Based on the proposed assumption, we know that $f^{-1}(N_{\varepsilon}(f(x)))$ is open.
Therefore there exists a $\delta > 0$ such that $N_{\delta}(x)\subseteq f^{-1}(N_{\varepsilon}(f(x))$.
Gathering all results, we can conclude that for every $\varepsilon > 0$ and $x\in X$, there corresponds a $\delta > 0$ such that
\begin{align*}
a\in N_{\delta}(x) \Rightarrow a\in f^{-1}(N_{\varepsilon}(f(x))) \Rightarrow f(a) \in N_{\varepsilon}(f(x))
\end{align*}
and $f$ is continuous.
Hopefully this helps!
