$d(x,A)=0\iff $ every neighborhood of $X$ contains a point of $A$ Mendelson, Introduction to Topology, p.52

$(8)$. Let $A$ be a non-empty subset of a metric space $(X,d)$. Let $x\in X$. Prove that $d(x,A)=0$ if, and only if, every nieghborhood $V$ of $x$ contains a point of $A$.

DEFINITION Given a subset $A$ of a metric space $X$, and $x\in X$, the distance of $x$ to $A$ is defined as:
$$d(x,A)=\inf\{d(x,a):a\in A\}$$
COROLLARY 5.9 Let $(X,d)$ be a metric space, $a\in X$ and $A$ a non-empty subset of $X$. Then there is a sequence $\{a_n\}$ of points of $A$ such that $\lim \; d(a,a_n)=d(a,A)$
PROOF
$(\Rightarrow)$ 
Suppose every neighborhood of $x$ contains a point of $A$. We must prove that $\inf\{d(x,a):a\in A\}=0$ But since every neighborhood of $x$ contains a point of $A$, then there is a sequence of points $\{a_n\}$ of $A$ such that $\lim \;a_n=x$. It follows that $\lim \; d(x,a_n)=0$, and since $\{a_n\}\subset A$, $\inf\{d(x,a):a\in A\}=0$ since $d(x,a)\geq 0$ for any $a,x$.
$(\Leftarrow)$ Suppose $d(x,A)=0$. It follows by 5.9 that there is a sequence of points $\{a_n\}$ in $A$ such that  $\lim \; d(x,a_n)=0$. But given a point $a\in X$, the function $f:X\to \Bbb R\;/\;f(x)=d(x,a)$ is continuous (just take $\epsilon =\delta$). Thus $\lim \; d(x,a_n)= d(x,\lim \;a_n)=0$. But $d(x,a)=0\iff x=a$, so $\lim \;a_n=x$. This means that for any neighborhood $V$ of $x$ there exists an $N$ such that $a_n \in V$ whenever $n>N$, so every neighborhood of $x$ contains some $a\in A$.
Is this alright? Is there any gap or circularity I'm missing?
 A: You can get a cleaner proof when you avoid sequences altogether:

Suppose that every neighborhood of $x$ contains a point of $A$.
  Obviously, $d(x,A)\geq 0$. Now let $\epsilon>0$. Then there exists by
  assumption $a\in A$ with $d(x,a)<\epsilon$. Since $\epsilon$ was arbitrary,
  $d(x,A)=0$.
Suppose that $d(x,A)=0$. Let $\epsilon>0$. By assumption, there is
  $a\in A$ with $d(x,a)<\epsilon$. Hence, every open $\epsilon$-ball
  around $x$ contain an element of $A$. Since every neighborhood of $x$
  is a superset of such a ball, we are done.

Afficionados might note that one avoids having to make arbitrary choices in the sequence-free proof. 

Edit: On your own proof. The original proof is correct except for your argument that $\lim d(x,a_n)=0$ implies $\lim a_n=x$. The result is true, but there is a subtle flaw in the argument. You seem to use the sequence characteriation of continuity there, so that $f$ is continuous at $y$ if $f(y_n)$ converges to $f(y)$ whenever $y_n$ converges to $y$. To apply that in your case, you need to assume that the sequence $(a_n)$ is convergent. It is, but that is something you have to prove first. 
A: Your proof is perfectly fine. 
Basically, you have proved $d(x,A)=0$ iff $x\in \overline{A}$ (i.e. every neighborhood of $x$ meets $A$), by using the intermediate equivalence between $x\in \overline{A}$ and the existence of $a_n\in A$ with $a_n\to x$.
As I mentioned in the comments, there is no need to introduce your function $f$, since $d(x,a_n)\to 0$ is equivalent to $\lim a_n=x$. Depending on your definition, this is either a tautology or a triviality. In any case I don't understand the objections in the comments about $\lim a_n$ which might not exist...of course it does, since $d(x,a_n)\to 0$...
