Is distance between two sets equal to that between their boundary? I am not sure if the statement below is true. The statement is:
Let $(M,d)$ be a connected metric space and $A, B$ be two nonempty subsets of $M.$ Assume the boundary $\partial A$ and $\partial B$ are nonempty. Suppose that $A\cap B=\emptyset.$ Then
$$d(A,B)=d(\partial A, \partial B).$$
Here $d(E,F):=\inf\{d(x,y)\mid x\in E, y\in F\}, \forall E,F\subset M.$
If the statement is true, how to prove it?  If it is not valid, give a counterexample, and is it valid  if  $(M, d)$ is complete? 
 A: The answer is no. Consider $M=(-\infty,-1)\cup (1,\infty)$ with distance $d(x,y)=|y-x|.$ Let $A=(-2,-1)$ and $B=(1,2).$ It is clear that $d(A,B)=2.$ However $\partial A=\{-2\},$ $\partial B=\{2\},$ and $d(\partial A,\partial B)=d(-2,2)=4.$
A: Take two unit circles in $R^2$, one shifted up by $3$. Connect these circles with vertical lines on their left- and rightmost points. This a complete connected metric space by taking the induced distance of $R^2$ (completeness follows from closedness, connectedness from the lines left and right). If you now take $A$ the upper and $B$ the lower circle both without their right and left points, their distance is $1$, but the distance of their boundaries is 3.
Note however that the answer is yes for path metric spaces, i.e. spaces in which the distance of two points equals the length of the shortest continuous path connecting them (actually, equals the infimum of such paths). 
The proof is easy, just take any points $x,y$ in $A$ and $B$, respectively, take any connecting path, and take two points $x_0, y_0$ in the intersections of this path with the boundaries of $A$ and $B$. Then the same path but restricted only to connect $x_0$ and $y_0$ has shorter length, thus $d(x_0,y_0)< d(x,y)$ and since $x,y$ were arbitrary $d(\partial A, \partial B)\leq d(A,B)$
A: The answer is no even if $M$ is homeomorphic to the unit interval $[0,1]$ and thus as regular as can be.
$M=\{(x,y)\in\mathbb R^2\colon x^2+y^2=1\}\setminus(1/2,1]\times[-1,-1]$ with the euclidean metric
$A=\{(x,y)\in M\colon y<0,\ 0\le x\le 1/2$ and $B=\{(x,y)\in M\colon y>0,\ 0\le x\le 1/2\}$
$d(A,B)<2=d(\{(0,-1)\},\{(0,1)\})=d(\partial A,\partial B)$
