By the principle of subset extensionality and the definition of common divisors, it suffices to show that for all d:\mathbb {Z}^+ we have
(d\mid m \land d\mid n)\Longleftrightarrow
(d\mid m'\land d\mid n)
\text {.}
In the forward direction, we assume that d divides both m and n, and we need to show that d divides m'.
We may therefore assume a,b:\mathbb {Z} such that
a\cdot d = m,
b\cdot d = n\text {.}
By our congruence assumption, we have n\mid m-m' and hence we may further assume some c:\mathbb {Z} such that cn=m-m' and therefore m = cn+m'\text {.}
Calculating with our assumptions, we have
\begin {aligned}
a\cdot d &= m
\\
&= c\cdot n + m'
\\
&= c\cdot b\cdot d + m'\text {,}
\end {aligned}
and so
\begin {aligned}
m' &= a\cdot d - c\cdot b \cdot d
\\
&= d\cdot (a - c\cdot b)\text {.}
\end {aligned}
Therefore we have d\mid m'.
The backwards direction is analogous to the above.