$\textbf{Problem:}$ Let $f:(X,d_1)\rightarrow (Y,d_2)$ a continuous function and $B \subseteq Y$. Consider the set : $$ A =\{ x \in X \vert d_2(f(x),Y-B)>0 \} $$ Prove that : $\forall x \in A : d_1(x,X-A)>0$.
My proof is based on demonstrating the following result:
$\textbf{Lemma:}$ Let $(X,d)$ a metric space and $A\subseteq X$. Prove that the set : $$ A^{*}=\{ a \in X \vert d(a,A) >0 \} $$ is open.
$\textbf{Proof:}$
Let $a \in A^{*}$, so $d(a,A)>0$. Then exists $n \in \mathbb{N}$ such that : $$ \dfrac{1}{n} < d(a,A) $$ Consider $r=d(a,A)-\dfrac{1}{n}>0$, let's prove that $B(a;r) \subseteq A^{*}$.
Let $x \in B(a;r) \implies d(x,a)<r$, let's consider $b \in A$, so :
$$ d(a,A) \leq d(a,b) \leq d(a,x)+d(x,b) <r+d(x,b) $$ $$ \frac{1}{n} < d(x,b) $$
As this inequality is valid for any $b \in A$, we have to : $$ 0<\dfrac{1}{n} \leq d(x,A) $$ So $x \in A^{*}$ and so $A$ is open.
In the problem, the set :
$$A^{*}=\{y \in Y \vert d_2(y,Y-B)>0 \}$$
is open in $Y$. And $A=f^{-1}(A^{*})$ so $A$ is open in $X$($X-A$ is closed).
Then if $x\in A \implies x\notin X-A=\overline{X-A} \implies d_1(x,X-A)>0$
Is correct?, thanks!
You can indeed conclude by showing that $A$ is open. Here is an alternative proof of the fact that $A$ is open :
Consider $g(y)=d_1(y,Y-B)$. Then, for $y_1, y_2$ you have that for $z\in Y-B$, $$g(y_2)=d(y_2,Y_B)\leq d(y_2,z)\leq d(y_2, y_1)+d(y_1,z)$$ so as it is true for all $z\in Y-B$ you have $$g(y_2)-g(y_1)\leq d(y_1,y_2)$$ and $$|g(y_2)-g(y_1)|\leq d(y_1,y_2)$$ by symmetry.
So $g$ is $1$-Lipschitz, so continuous. Then, $A=(g\circ f>0)$ is open as an inverse image of an open set by a continuous function.