Weakly shrinking functions on compact spaces I have been dealing with this problem for some days without any progress:

"Let $f:K \rightarrow K$ be a weakly shrinking function defined on a compact metric space $K$ (i.e.: $\forall x,y \in K, x \neq y \implies d(f(x), f(y)) \le d(x,y)$); then, prove that $f$ is surjective if and only if $\forall x,y \in K, x \neq y \implies d(f(x), f(y)) = d(x,y)$ (that is, the equality always holds in the definition of weakly shrinking function)"

My Attempt
So far I have only been able to prove that $f$ is uniformly continuous. Also, in trying to show the direction (surjectivity $\implies$ equality) I had the idea to separate the points on which the equality holds from those on which the strict inequality holds into two sets A and B respectively; then, I thought of reaching a contradiction in the two possible cases: B finite (in which case I should use finiteness somehow) and B infinite (in which case I would probably use the existence of a limit point by the characterization of compact sets). However I haven't made any progress in this direction yet.
Any hint on how to proceed or any comment on my idea are highly appreciated as always!
 A: Claim: Given a function $f:K \to K$ which does not increase distances on a compact metric space $(K,d)$, surjectivity is equivalent to preserving distances.
Proof: (a) First suppose $f$ preserves distances but is not surjective,
so there exists $z_0 \in K \setminus f(K)$. Let $K_0=K$. Since $K_1:=f(K)$ is compact, we have
$$\delta:=d(z_0,K_1)>0 \,.$$
For  $n \ge 1$, define inductively $K_n=f(K_{n-1})$ and  $z_n=f(z_{n-1}) \in K_n$.    Then $d(z_{n-1},K_n)=\delta$ for all $n \ge 1$, and for   positive integers $\ell<n$ we have $z_n \in K_{\ell+1}$, so
$$   d(z_\ell,z_n) \ge \delta \,.$$
Thus the sequence $\{z_n\}$ does not have a convergent subsequence, contradicting compactness.
(b) Suppose that $f$ is surjective, and $x_0,y_0 \in K$ are distinct.
Given $\epsilon>0$, there is a finite set $S \subset K$ such that
$\cup_{s \in S} B(s,\epsilon) =K$, where $B(s,\epsilon)$ is the open ball of radius $\epsilon$ centered at $s$. For $n \ge 1$, define inductively
preimages $x_n,y_n$ such that $f(x_n)=x_{n-1}$ and $f(y_n)=y_{n-1}$.
For each $n$, there exist $\tilde{x}_n,  \tilde{y}_n \in S$ such that
$d(\tilde{x}_n,x_n)<\epsilon$ and $d(\tilde{y}_n,y_n)<\epsilon$.
In the infinite sequence $\{(\tilde{x}_n,  \tilde{y}_n) \}_{n \ge 1}$,
some element of the finite set $ S \times S$ must repeat.
Thus there exist $\ell>k>0$  such that
$  (\tilde{x}_k,  \tilde{y}_k)=(\tilde{x}_\ell,  \tilde{y}_\ell) \,,$
so
$$d(x_k,x_\ell)<2\epsilon \quad \mbox{  and} \quad   d(y_k,y_\ell)<2\epsilon \,. $$
Applying $f^{k+1}$, we infer that
$$d(f(x_0),x_{\ell-k-1})<2\epsilon \quad \mbox{  and} \quad   d(f(y_0),y_{\ell-k-1})<2\epsilon \,. $$
Therefore, by the triangle inequality,
$$d(x_{\ell-k-1}, y_{\ell-k-1}) < d(f(x_0),f(y_0))+4\epsilon \,.$$
Applying $f^{\ell-k-1}$ yields that
$$d(x_{0}, y_{0}) < d(f(x_0),f(y_0))+4\epsilon \,.$$
Since $\epsilon>0$ was arbitrary, this proves that
$$d(x_{0}, y_{0}) = d(f(x_0),f(y_0)) \,,$$
so $f$ is distance preserving.
Edit: According to [1], The equivalence in the claim is due to [2].
[1] Hu, Thakyin, and W. A. Kirk. "On local isometries and isometries in metric spaces." In Colloquium Mathematicum, vol. 44, no. 1, pp. 53-57. Institute of Mathematics Polish Academy of Sciences, 1981.
[2] Freudenthal, Hans, and Witold Hurewicz. "Dehnungen, verkürzungen, isometrien." Fundamenta Mathematicae 26, no. 1 (1936): 120-122.
