How is the $ inf $ defined in a metric space? In my lecture  notes:
definition:
In a metric space $(X,d)$ the distance $d(p,E)$ from a point $p \in X$ and a subset $E\subseteq X$ is defined as:  $d(p,E)=inf\{d(p,x)| x \in E\}$
Proposition: Let $(X,d)$ be a metric space and let $E\subseteq X$,
$p\in Cl(E)$ if and only if $d(p,E)=0$
proof:
By definition of $ inf$ there exists a sequence $p_n$ in $E$ such that
$\lim_{n\to\infty} d(p_n,p)=0$.
So $p$ is the limit of a sequence in $E$ iff  $p\in Cl(E)$
I am having trouble with the first part, how is  the $inf$ in a metric space defined and how is it proved that the definition applied to $d(p,E)$ is equivalent to the existence of that converging sequence?
I was trying to use this one
$y=inf(X)  $iff $  \forall \varepsilon >0,  \exists x \in X$ such that $y\leq x \leq y+ \varepsilon$
The problem is that it is valid for $\mathbb{R}$, and couldn't generalized to a metric space.
 A: The infimum $\inf\{d(p,x):x\in E\}$ is just the ordinary infimum of a set of non-negative real numbers. It doesn’t matter that the real numbers happen to have been obtained as distances in some metric space: this is still just a set of real numbers, and since it’s bounded below (by $0$), it must have an infimum.
If $d(p,E)=0$, i.e., if $\inf\{d(p,x):x\in E\}=0$, then by the definition of infimum for each $n\in\Bbb Z^+$ there is an $x_n\in E$ such that $d(p,x_n)<\frac1n$, which by definition means that $\lim_\limits{n\to\infty}d(p,x_n)=0$.
Added: To prove the proposition, suppose first that $p\in\operatorname{cl}E$. Then for each $n\in\Bbb Z^+$ there is an $x_n\in B_d\left(p,\frac1n\right)\cap E$, where $B_d(y,r)$ is the open ball of $d$-radius $r$ centred at $y$; clearly this means that $d(p,x_n)<\frac1n$.
Let $D=\{d(p,x):x\in E\}$; $d(p,x)\ge 0$ for each $x\in E$, so $0$ is a lower bound for $D$, so $D$ has an infimum, say $\alpha$. By definition $\alpha$ is a lower bound for $D$, and if $\beta$ is any lower bound for $D$, then $\beta\le\alpha$, so $0\le\alpha$. Suppose that $\alpha>0$; then there is an $n\in\Bbb Z^+$ such that $\frac1n<\alpha$. But then $d(p,x_n)<\frac1n<\alpha$, and $\alpha$ isn’t a lower bound for $D$ (since certainly $d(p,x_n)\in D$). Thus, $\inf D=0$.
(Note that the sequence $\langle x_n:n\in\Bbb Z^+\rangle$ does converge to $p$, though we don’t actually need to use this fact explicitly.)
For the other direction, suppose that $p\notin\operatorname{cl}E$. Then there is an $r>0$ such that $B_d(p,r)\cap E=\varnothing$. Thus, $d(p,x)\ge r$ for each $x\in E$, $r$ is a lower bound for $D=\{d(p,x):x\in E\}$, and by definition $\inf D\ge r$ and hence $\inf D>0$.
A: The set $\{d(p,x)\mid x\in E\}$ is a set of non-negative real numbers. So, $\inf\{d(p,x)\mid x\in E\}$ is simply the infimum of a subset of $\Bbb R$.
