I am following "An Introduction to The Theory of Numbers" by Niven and I am trying to see if I can rephrase the theorems in terms of groups, rings and fields. For example, the theorem $$(a, m) = 1 \Rightarrow a^{\phi(m)} \equiv 1 \pmod{m}$$ can be seen as saying that if $x \in \mathbb{Z}_{m}$ is unit then $x^{\phi(m)} = 1$ (which is obvious because the units form a group of order $\phi(m)$). As another example, rewriting Wilson's theorem this way (and slightly generalizing) turns $$(p - 1)! \equiv -1 \pmod{p}$$ for any prime $p$ into the statement: The product of all units in an integral domain is $-1$.
My question is, how can I do a similar conversion with the statement: $ax \equiv ay \pmod{m}$ if and only if $x \equiv y \pmod{\frac{m}{(a, m)}}$?