[proofplan]
We prove both directions directly from the domain-relative $\varepsilon$-$\delta$ definition of continuity at $a$. In the forward direction, an open interval containing $f(a)$ contains a symmetric interval around $f(a)$, and continuity sends sufficiently nearby points of $E$ into that smaller interval. In the reverse direction, we test the assumed neighbourhood condition on the particular interval $(f(a)-\varepsilon,f(a)+\varepsilon)$ to recover the $\varepsilon$-$\delta$ condition.
[/proofplan]
[step:Send a sufficiently small relative neighbourhood of $a$ into a given interval around $f(a)$]
Assume that $f$ is continuous at $a$. Let $V \subset \mathbb{R}$ be an open interval with $f(a) \in V$. Since $V$ is an open interval containing $f(a)$, there exists $\varepsilon > 0$ such that
\begin{align*}
(f(a)-\varepsilon,f(a)+\varepsilon) \subset V.
\end{align*}
By continuity of $f$ at $a$, applied to this $\varepsilon$, there exists $r > 0$ such that for every $x \in E$,
\begin{align*}
|x-a| < r \implies |f(x)-f(a)| < \varepsilon.
\end{align*}
Now let $x \in E \cap (a-r,a+r)$. Then $x \in E$ and $|x-a| < r$, so $|f(x)-f(a)| < \varepsilon$. Hence
\begin{align*}
f(x) \in (f(a)-\varepsilon,f(a)+\varepsilon) \subset V.
\end{align*}
Therefore $x \in f^{-1}(V)$. Since $x$ was arbitrary,
\begin{align*}
E \cap (a-r,a+r) \subset f^{-1}(V).
\end{align*}
[guided]
Assume that $f$ is continuous at $a$. We must prove the stated neighbourhood property for an arbitrary open interval $V \subset \mathbb{R}$ satisfying $f(a) \in V$.
The first task is to convert the interval condition into the kind of numerical tolerance that appears in the $\varepsilon$-$\delta$ definition of continuity. Because $V$ is an open interval and $f(a) \in V$, there exists a symmetric interval around $f(a)$ contained in $V$. Thus we may choose $\varepsilon > 0$ such that
\begin{align*}
(f(a)-\varepsilon,f(a)+\varepsilon) \subset V.
\end{align*}
Now use continuity of $f: E \to \mathbb{R}$ at the point $a \in E$. This is continuity relative to the domain $E$: for this chosen $\varepsilon > 0$, there exists $r > 0$ such that every $x \in E$ with $|x-a| < r$ satisfies
\begin{align*}
|f(x)-f(a)| < \varepsilon.
\end{align*}
We claim this same $r$ gives the required inclusion. Let $x \in E \cap (a-r,a+r)$. Then $x \in E$, and membership in the interval $(a-r,a+r)$ is exactly the inequality $|x-a| < r$. Therefore the continuity implication gives
\begin{align*}
|f(x)-f(a)| < \varepsilon.
\end{align*}
This inequality is equivalent to
\begin{align*}
f(x) \in (f(a)-\varepsilon,f(a)+\varepsilon).
\end{align*}
Since this smaller interval is contained in $V$, we obtain $f(x) \in V$, which means precisely that $x \in f^{-1}(V)$. Hence every element of $E \cap (a-r,a+r)$ belongs to $f^{-1}(V)$, so
\begin{align*}
E \cap (a-r,a+r) \subset f^{-1}(V).
\end{align*}
[/guided]
[/step]
[step:Recover the epsilon-delta condition from the interval condition]
Conversely, assume that for every open interval $V \subset \mathbb{R}$ with $f(a) \in V$, there exists $r > 0$ such that
\begin{align*}
E \cap (a-r,a+r) \subset f^{-1}(V).
\end{align*}
Let $\varepsilon > 0$ be arbitrary, and define the open interval $V \subset \mathbb{R}$ by
\begin{align*}
V := (f(a)-\varepsilon,f(a)+\varepsilon).
\end{align*}
Then $f(a) \in V$, so the assumed neighbourhood condition gives $r > 0$ such that
\begin{align*}
E \cap (a-r,a+r) \subset f^{-1}(V).
\end{align*}
If $x \in E$ and $|x-a| < r$, then $x \in E \cap (a-r,a+r)$, hence $x \in f^{-1}(V)$. Therefore $f(x) \in V$, which is equivalent to
\begin{align*}
|f(x)-f(a)| < \varepsilon.
\end{align*}
Since this holds for every $\varepsilon > 0$, $f$ is continuous at $a$.
[/step]