Suppose but . Then consider this is an open neighborhood containing x, but does not intersect A, thus , contradiction. d(x,A)=0 as desired.
Let d(x,A)=0. Suppose then there exists an open set U containing x, but does not intersect A. By definition of open set, this means there is a basis element (a ball) containing x and contained in U. That is . But this means contradiction. thus as desired.