Show the length of a geodesic is a metric. I'm trying to prove that a connected regular surface $S \subset \mathbb{R}^3$ is a metric space with the function defined by
$$d: S \times S \longrightarrow \mathbb{R}$$
$$(p,q) \mapsto d(p,q) := \inf \{ l(\alpha) \ ; \ \alpha \ is \ a \ piecewise \ C^1 \ curve \ connecting \ p \ and \ q \}$$
I need to show that
(i) $d(p,q) = d(q,p), \forall p, q \in S$;
(ii) $d(p,q) \leq d(p,r) + d(r,q), \forall p, r, q \in S$;
(iii) $d(p,q) \geq 0, \forall p, q \in S$;
(iv) $d(p,q) = 0 \iff p = q$
but my doubt it's only on items $(i)$ and $(ii)$.
How exactly can I prove $(i)$? Intuitively, it is clear that all partial differentiable curve connecting $p$ and $q$ has the same length of all partial differentiable curve connecting $q$ and $p$, but how to show this?
About the item (ii), I tried to prove like this

By the definition of function $d$, $\forall \epsilon > 0, \exists \alpha \ ; \ 
d(p,q) \leq l(\alpha) + \epsilon = \int_p^q ||\alpha ' (t)|| dt + \epsilon = \int_q^r ||\alpha ' (t)|| dt + \int_r^p ||\alpha ' (t)|| dt + \epsilon$, then
$d(p,q) - \int_r^p ||\alpha ' (t)|| dt \leq \int_q^r ||\alpha ' (t)|| dt + \epsilon,$
since $d(p,q) - \int_r^p ||\alpha ' (t)|| dt$ is a lower bound for $\{ l(\alpha) \ ; \ \alpha \ is \ a \ piecewise \ C^1 \ curve \ connecting \ q \ and \ r \}$, we have
$d(p,q) - \int_r^p ||\alpha ' (t)|| dt \leq d(q,r)$, then
$d(p,q) \leq d(q,r) + \int_r^p ||\alpha ' (t)|| dt \leq d(q,r) + \int_r^p ||\alpha ' (t)|| + \epsilon$
$\Longrightarrow d(p,q) - d(q,r) \leq \int_r^p ||\alpha ' (t)|| + \epsilon,$
since $d(p,q) - d(q,r)$ is a lower bound for $\{ l(\alpha) \ ; \ \alpha \ is \ a \ piecewise \ C^1 \ curve \ connecting \ r \ and \ p \}$, we have
$d(p,q) - d(q,r) \leq d(r,p) \Longrightarrow d(p,q) \leq d(q,r) + d(r,p)$

I would like to know if my attempt is correct and how to prove item (i). Thanks in advance!
 A: Not a direct answer (i.e., I haven't carefully checked you argument), but too long for a comment. This is a situation where breaking the proof into two conceptual layers vastly clarifies the argument. :)


*

*If $\alpha:[0, 1] \to S$ is a piecewise-smooth curve joining $p = \alpha(0)$ to $q = \alpha(1)$, the curve $-\alpha:[0, 1] \to S$ defined by $-\alpha(t) = \alpha(1 - t)$ joins $q$ to $p$, and (more-or-less obviously) has the same length as $\alpha$.

*If $\alpha:[0, 1] \to S$ and $\beta:[0, 1]$ are piecewise-smooth curves joining $p = \alpha(0)$ to $q = \alpha(1)$ and $q = \beta(0)$ to $r = \beta(1)$, the "concatenated" curve $\gamma:[0, 1] \to S$ defined by
$$
\gamma(t) = \begin{cases}
  \alpha(2t) & 0 \leq t < \tfrac{1}{2}, \\
  \beta(2t - 1) & \tfrac{1}{2} \leq t \leq 1,
\end{cases}
$$
is piecewise-$C^{1}$, joins $p$ to $r$, and its length (more-or-less obviously) is the sum of the lengths of $\alpha$ and $\beta$.
Properties (i) and (ii) follow immediately from the definition:
(i) The set of lengths of the set of piecewise-$C^{1}$ curves from $p$ to $q$ is identical to the set of lengths of the set of piecewise-$C^{1}$ curves from $q$ to $p$ (so these sets have the same infimum).
(ii) The set of lengths of the set of piecewise-$C^{1}$ curves from $p$ to $r$ contains the set of lengths of piecewise-$C^{1}$ curves from $p$ to $r$ that pass through $q$ (and if $A \subset B$ are non-empty sets of real numbers, then $\inf B \leq \inf A$).
