Integers mod n #
Definition of the integers mod n, and the field structure on the integers mod p.
Definitions #
For non-zero n : ℕ, the ring Fin n is equivalent to ZMod n.
Equations
- ZMod.finEquiv 0 = ⋯.elim
- ZMod.finEquiv n.succ = RingEquiv.refl (Fin (n + 1))
Instances For
This lemma works in the case in which ZMod n is not infinite, i.e. n ≠ 0. The version
where a ≠ 0 is addOrderOf_coe'.
This lemma works in the case in which a ≠ 0. The version where
ZMod n is not infinite, i.e. n ≠ 0, is addOrderOf_coe.
Cast an integer modulo n to another semiring.
This function is a morphism if the characteristic of R divides n.
See ZMod.castHom for a bundled version.
Instances For
So-named because the outer coercion is Int.cast into ZMod. For Int.cast into an arbitrary
ring, see ZMod.intCast_cast.
If the characteristic of R divides n, then cast is a homomorphism.
Some specialised simp lemmas which apply when R has characteristic n.
The unique ring isomorphism between ZMod n and a ring R
of characteristic n and cardinality n.
Equations
- ZMod.ringEquiv R h = RingEquiv.ofBijective (ZMod.castHom ⋯ R) ⋯
Instances For
The unique ring isomorphism between ZMod p and a ring R of cardinality a prime p.
If you need any property of this isomorphism, first of all use ringEquivOfPrime_eq_ringEquiv
below (after have : CharP R p := ...) and deduce it by the results about ZMod.ringEquiv.
Equations
- ZMod.ringEquivOfPrime R hp hR = ZMod.ringEquiv R hR
Instances For
Alias of ZMod.natCast_eq_zero_iff.
Alias of the reverse direction of ZMod.intCast_eq_zero_iff_even.
Alias of ZMod.natCast_eq_zero_iff_even.
Alias of the reverse direction of ZMod.natCast_eq_zero_iff_even.
Alias of the reverse direction of ZMod.intCast_eq_one_iff_odd.
Alias of ZMod.natCast_eq_one_iff_odd.
Alias of the reverse direction of ZMod.natCast_eq_one_iff_odd.
Alias of ZMod.natCast_ne_zero_iff_odd.
unitOfCoprime makes an element of (ZMod n)ˣ given
a natural number x and a proof that x is coprime to n
Equations
- ZMod.unitOfCoprime x h = { val := ↑x, inv := (↑x)⁻¹, val_inv := ⋯, inv_val := ⋯ }
Instances For
The Chinese remainder theorem. For a pair of coprime natural numbers, m and n,
the rings ZMod (m * n) and ZMod m × ZMod n are isomorphic.
See Ideal.quotientInfRingEquivPiQuotient for the Chinese remainder theorem for ideals in any
ring.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Any ring homomorphism into ZMod n has a right inverse.
Any ring homomorphism into ZMod n is surjective.
Groups of bounded torsion #
For G a group and n a natural number, G having torsion dividing n
(∀ x : G, n • x = 0) can be derived from Module R G where R has characteristic dividing n.
It is however painful to have the API for such groups G stated in this generality, as R does not
appear anywhere in the lemmas' return type. Instead of writing the API in terms of a general R, we
therefore specialise to the canonical ring of order n, namely ZMod n.
This spelling Module (ZMod n) G has the extra advantage of providing the canonical action by
ZMod n. It is however Type-valued, so we might want to acquire a Prop-valued version in the
future.
This cannot be made an instance because of the [Module (ZMod n) G] argument and the fact that
n only appears in the second argument of SMulMemClass, which is an OutParam.
Equations
- AddSubgroupClass.instZModModule = { toSMul := AddSubgroupClass.instZModSMul, one_smul := ⋯, mul_smul := ⋯, smul_zero := ⋯, smul_add := ⋯, add_smul := ⋯, zero_smul := ⋯ }