The necessary and sufficient conditions for continuity of a map between topological spaces in terms of the inverse images of open (or closed) sets Can we make the following definition? 

Let $X$ and $Y$ be topological spaces, and let $p$ be a point of $X$. Then a function $f \colon X \to Y$ is continuous at $p$ if, for every open set $V$ in $Y$ such that $f(p) \in V$, there is an open set $U$ in $X$ such that $p \in U$ and $f(U) \subset V$. 

Is this definition the required generalisation of the classical $\varepsilon$ $\delta$ - definition? 
Now can we prove the following theorem? 

Let $X$ and $Y$ be topological spaces, and let $p$ be a point of $X$. Then the function $f \colon X \to Y$ is continuous at $p$ if and only if, for every open (respectively, closed) set $V$ in $Y$ such that $f(p) \in V$, the inverse image $f^{-1}(V)$ is open (respectively, closed)  in $X$. 

Is this statement correct? If so, then how to prove it? 
My Attempt: 

First, suppose that, for every open set $V$ in $Y$ such that $f(p) \in V$, the inverse image $f^{-1}(V)$ is open in $X$. Let us take $U$ to be this inverse image. Then $p \in U$ and 
  $$ f(U) = f \left( f^{-1}(V) \right) \subset V, $$
  as required. 
Conversely, suppose that $f$ is continuous at $p$, and let $V$ be an open set in $Y$ such that $f(p) \in V$. As $f$ is continuous at $p$ and as $V$ is an open set in $Y$ such that $f(p) \in V$, so  there is an open set $U$ in $X$ such that $p \in U$ and $f(U) \subset V$. So we can conclude that $$p \in U \subset f^{-1} \left( f(U) \right) \subset f^{-1}(V), $$ 
  and hence $p \in U \subset f^{-1}(V)$. 

What next? 
 A: Your proposed theprem is not even true in the $\epsilon\delta$ version and with $X=Y=\Bbb R$. Consider
$$ f(x)=\begin{cases}0&x\in \Bbb Q\\x&x\notin\Bbb Q\end{cases}$$
Then $f$ is continuous at $p=0$, but for all open sets $V$ of the form $V=(-a,a)$. the inverse image $V\cup \Bbb Q$ is not open. Same for closed $V$
A: As you may have recognized from the previous two posts (one of them deleted), this is actually quite a subtle question. Let's have a look at the literature, e.g.
Waldmann, "Topology" (Springer, 2014). doi:10.1007/978-3-319-09680-3.
Def. 2.4.1.i states the following: A map $f$ between topological spaces $X$, $Y$ is continuous at $p \in X$ if and only if for every neighborhood $V$ of $f(p)$ in $Y$ the set $f^{-1}(V)$ is a neighborhood of $p$ in $X$.
By definition, $V$ is a neighborhood of $f(p)$ if $f(p) \in \mathring V$ (which implies that the interior $\mathring V$ is nonempty). So we may just as well be asking for $V$ to be an open neighborhood of $f(p)$. Similarly, if $f^{-1}(V)$ is a neighborhood of $p$, then that means that $p$ has an open neighborhood in $X$ contained in $f^{-1}(V)$ (e.g. the interior of $f^{-1}(V)$ in $X$).
Thus, the above definition implies that, if $f$ is continuous at $p$, then for every open neighborhood $V$ of $f(p)$ in $Y$ there exists an open neighborhood $U$ of $p$ in $X$ such that $U \subseteq f^{-1}(V)$. The latter condition is, of course, equivalent to saying that $f(U) \subseteq V$. Thus, the definition of continuity at $p$ you give is implied by the one Waldmann gives.
Conversely, if a function is continuous at $p$ in your sense above, then for any neighborhood $V$ of $f(p)$ we can consider the interior $\mathring V$  -- which is open and contains $f(p)$ -- and then there has to be an open neighborhood $U$ of $p$ with $U \subseteq f^{-1}(\mathring{V})$. But $\mathring{V} \subseteq V$, so $f^{-1}(\mathring{V}) \subseteq f^{-1}(V)$. It follows that $f^{-1}(V)$ is a neighborhood of $p$.
The two definitions are therefore equivalent. In Prop. 2.4.2 Waldmann shows that the map $f$ is continous if and only if it is continuous at every $p \in X$.
Using open balls, it can be shown that the $\varepsilon$-$\delta$ definition is equivalent to your definition (or Waldmann's). For a detailed proof, see Prop. 1.1 in Amann & Escher, "Analysis I" (Birkhäuser, 2005).
I think the confusion came from the fact that, if $f$ is continuous at $p$, then this does in general not imply that $f$ is continuous everywhere---thus $f^{-1}(V)$ need not be open for an open neighborhood $V$ of $f(p)$. But still, $f^{-1}(V)$ contains an open neighborhood of $p$ in $X$.
EDIT:

*

*Please see my comment to Hagen's post as well as my remark right above, regarding your so called "theorem".

*Since you asked for it, I shall give you a proof that your definition is equivalent to the $\varepsilon$-$\delta$ definition:

Let $f \colon D \to \mathbb{R}^m$ with $D \subseteq \mathbb{R}^n$ and $n$, $m$ $\in \mathbb{N}$. Denote by $B^n_\varepsilon (x_0)$ the open ball of radius $\varepsilon$ centered at $x_0 \in \mathbb{R}^n$ and equip $D$ with the subspace topology. Also note that every open neighborhood of a point in $\mathbb{R}^n$ must contain an open ball around that point.
`$\implies$': Let $V \subseteq \mathbb{R}^m$ be any open neighborhood of $f(x_0)$. Then there exists an $\varepsilon >0$ such that $B^m_\varepsilon (f(x_0)) \subseteq V$. Assuming $f$ is continuous at $x_0$ in accordance with your definition, by the definition of the subspace topology on $D$, there exists an open neighborhood $U$ of $x_0$ in $\mathbb{R}^n$ such that $f(U \cap D)$ is contained in $B^m_\varepsilon (f(x_0))$. But then there exists a $\delta > 0$ such that $B^n_\delta (x_0) \subseteq U$. Clearly, $f(B_\delta^n (x_0) \cap D) \subseteq B^m_\varepsilon (f(x_0))$ . In other words (since $V$ was arbitrary), $\forall \varepsilon >0$ $\exists$ $\delta > 0$ $\forall x \in D$ with $|x -x_0|< \delta$ we have $|f(x) - f(x_0)| < \varepsilon$.
`$\impliedby$': Start out with the latter definition.
$\iff$
$\forall \varepsilon >0$ $\exists$ $\delta > 0$ $\forall x \in D \cap B^n_\delta (x_0)$: $f(x) \in B^m_\varepsilon (f(x_0))$.
$\iff$
$\forall \varepsilon >0$ $\exists$ $\delta > 0$: $f(D \cap B^n_\delta (x_0)) \subseteq B^m_\varepsilon (f(x_0))$
$\implies$
For every open neighborhood $V$ of $f(x_0)$ in $\mathbb{R}^m$ there exists an open neighborhood $U$ of $x_0$ in $D$ such that $f(U) \subseteq V$.
