Documentation

TauCeti.Data.ZMod.Units

Units and coprimality over ZMod d #

Results connecting unit and coprimality data over ZMod d, independent of one another:

theorem Int.isUnit_intCast_iff_gcd_eq_one {d : ℕ} {a : ℤ} :
IsUnit ↑a ↔ a.gcd ↑d = 1

An integer is a unit mod d exactly when it is coprime to d. The Int.gcd form is what consumers of Nat.Coprime want; ZMod.coe_int_isUnit_iff_isCoprime states the same equivalence with IsCoprime over ℤ on the right, in the opposite argument order.

theorem TauCeti.eq_comp_unitsMap_of_comp_unitsMap_eq {G : Type u_1} [MulOne G] {p M M' N' : ℕ} [NeZero M'] (hpM : p ∣ M) (hMN' : M ∣ N') (hN'M' : N' ∣ M') {χM : (ZMod M)ˣ →* G} {χ₀ : (ZMod (M / p))ˣ →* G} (hcomp : χM = χ₀.comp (ZMod.unitsMap ⋯)) {χ' : (ZMod N')ˣ →* G} (h : χ'.comp (ZMod.unitsMap hN'M') = χM.comp (ZMod.unitsMap ⋯)) :
χ' = (χ₀.comp (ZMod.unitsMap ⋯)).comp (ZMod.unitsMap ⋯)

A lowered unit homomorphism is determined at the smaller modulus. If χM is pulled back from χ₀ modulo M / p, and χ' modulo N' agrees with χM after restriction to the units modulo a common multiple M', then χ' is itself pulled back from χ₀, along N' / p. ZMod.unitsMap is surjective onto the units of a divisor, so the restriction can be cancelled.

theorem TauCeti.comp_unitsMap_eq_comp_unitsMap_of_comp_mul_left {G : Type u_1} [MulOne G] {p N L : ℕ} (hpN : p ∣ N) {χ : (ZMod N)ˣ →* G} {χ₀ : (ZMod (N / p))ˣ →* G} (hcomp : χ = χ₀.comp (ZMod.unitsMap ⋯)) :
χ.comp (ZMod.unitsMap ⋯) = (χ₀.comp (ZMod.unitsMap ⋯)).comp (ZMod.unitsMap ⋯)

A lowered unit homomorphism stays lowered after restricting to a multiple. If χ modulo N is pulled back from χ₀ modulo N / p, then restricting χ to the units modulo N * L is again a pull-back of χ₀, now along N * L / p. Both sides collapse to one ZMod.unitsMap by ZMod.unitsMap_comp.

theorem IsCoprime.exists_int_lifts {d : ℕ} {a c : ZMod d} (hac : IsCoprime a c) :
∃ (a₀ : ℤ) (c₀ : ℤ), ↑a₀ = a ∧ ↑c₀ = c ∧ IsCoprime a₀ c₀

Coprime residues modulo d lift to coprime integers: if a and c are coprime in ZMod d, there are integers a₀, c₀ reducing to a, c with IsCoprime a₀ c₀.

theorem ZMod.exists_unitOfCoprime_eq {d : ℕ} [NeZero d] (u : (ZMod d)ˣ) :
∃ (m : ℕ) (hm : m.Coprime d), unitOfCoprime m hm = u

Every unit of ZMod d is ZMod.unitOfCoprime of a natural number coprime to d. A property of all units may therefore be checked on the units of this shape.

theorem ZMod.unitOfCoprime_mul {d m n : ℕ} (hm : m.Coprime d) (hn : n.Coprime d) :

ZMod.unitOfCoprime is multiplicative in its numerator.

A unit of ZMod d generates ZMod d as an additive group.