Lemma: Let $m$ and $n$ be positive integers with $m \leq n$. If $r$ is the remainder of dividing $n$ by $m$, then $(n,m) = (m,r)$.
The proof is given as follows:
We have by the division algorithm that $n = sm + r$ with $0 \leq r < m$. Suppose that $d = (n,m)$ and $e = (m, r)$. Since $r = n - sm$ and $d \mid n,$ $d \mid m$ we have $d \mid n - sm = r$.
The part I don't understand is how $d \mid n - sm = r$ is equivalent to $r = n - sm.$
It seems as if it is saying $n$ is the same as $d \mid n$.