Given a metric space $(X,d)$, an element $x_0 \in X$ an a non-empty subset $A \subset X$, we define the distance from $x_0$ to $A$ as $$d(x_0,A) := \inf\{d(x_0,a) : a \in A\}.$$
Now, in $\mathbb{R}$ with the usual distance we have $A := (1,2]$ and $x_0 := 1$, then $d(1,A) = 0.$
My question is, how you can take $a = 1 \notin A$ to conclude $d(1,1)=0$?
Is the reason that you consider $1$ is the lower limit of $A$? So you should define $d(x_0,A) := d(x_0,\inf A)$, right?