Residues of integers and words, and squares in ZMod n #
Candidates for Mathlib.Data.ZMod.Basic: the cast to ZMod n of the least non-negative residue
of an integer (ZMod.natCast_toNat_emod, which is ZMod.natCast_toNat without its hypothesis
0 ≤ z), the cast to ZMod n of the word s x + a for n ∣ 2 ^ 64, as the arithmetic of words
is that modulo 2 ^ 64 (UInt64.natCast_toNat_mul_add), and a residue that is a square in
ZMod n as the residue of the square of a natural number below n
(ZMod.exists_eq_mul_self_mod_of_isSquare), and for odd n and a residue other than 0 as that
of the square of a number from 1 to n / 2 (ZMod.isSquare_natCast_iff_exists_mul_self_mod_eq).
The cast to ZMod n of the least non-negative residue of a modulo n is the cast of a;
ZMod.natCast_toNat without its hypothesis 0 ≤ z.