Integers mod n
#
Definition of the integers mod n, and the field structure on the integers mod p.
Definitions #
val a
is a natural number defined as:
- for
a : ZMod 0
it is the absolute value ofa
- for
a : ZMod n
with0 < n
it is the least natural number in the equivalence class
See ZMod.valMinAbs
for a variant that takes values in the integers.
Equations
- ZMod.val = Int.natAbs
- ZMod.val = Fin.val
Instances For
Alias of ZMod.val_natCast
.
Alias of ZMod.val_natCast_of_lt
.
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
.
Alias of ZMod.natCast_self
.
Alias of ZMod.natCast_self'
.
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 coercion is Nat.cast
into ZMod
. For Nat.cast
into an arbitrary ring,
see ZMod.natCast_val
.
Alias of ZMod.natCast_zmod_val
.
So-named because the coercion is Nat.cast
into ZMod
. For Nat.cast
into an arbitrary ring,
see ZMod.natCast_val
.
Alias of ZMod.natCast_rightInverse
.
Alias of ZMod.natCast_zmod_surjective
.
So-named because the outer coercion is Int.cast
into ZMod
. For Int.cast
into an arbitrary
ring, see ZMod.intCast_cast
.
Alias of ZMod.intCast_zmod_cast
.
So-named because the outer coercion is Int.cast
into ZMod
. For Int.cast
into an arbitrary
ring, see ZMod.intCast_cast
.
Alias of ZMod.intCast_rightInverse
.
Alias of ZMod.intCast_surjective
.
Alias of ZMod.natCast_val
.
Alias of ZMod.intCast_cast
.
If the characteristic of R
divides n
, then cast
is a homomorphism.
The canonical ring homomorphism from ZMod n
to a ring of characteristic dividing n
.
See also ZMod.lift
for a generalized version working in AddGroup
s.
Equations
- ZMod.castHom h R = { toFun := ZMod.cast, map_one' := ⋯, map_mul' := ⋯, map_zero' := ⋯, map_add' := ⋯ }
Instances For
Some specialised simp lemmas which apply when R
has characteristic n
.
Alias of ZMod.cast_natCast'
.
Alias of ZMod.cast_intCast'
.
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.ringEquivCongr_intCast
.
Alias of ZMod.intCast_eq_intCast_iff
.
Alias of ZMod.intCast_eq_intCast_iff'
.
Alias of ZMod.val_intCast
.
Alias of ZMod.natCast_eq_natCast_iff
.
Alias of ZMod.natCast_eq_natCast_iff'
.
Alias of ZMod.intCast_zmod_eq_zero_iff_dvd
.
Alias of ZMod.intCast_eq_intCast_iff_dvd_sub
.
Alias of ZMod.natCast_zmod_eq_zero_iff_dvd
.
Alias of ZMod.coe_intCast
.
Alias of ZMod.intCast_mod
.
Alias of ZMod.ker_intCastAddHom
.
Alias of ZMod.natCast_toNat
.
Alias of ZMod.natCast_mod
.
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
Equivalence between the units of ZMod n
and
the subtype of terms x : ZMod n
for which x.val
is coprime to n
Equations
- ZMod.unitsEquivCoprime = { toFun := fun (x : (ZMod n)ˣ) => ⟨↑x, ⋯⟩, invFun := fun (x : { x : ZMod n // x.val.Coprime n }) => ZMod.unitOfCoprime (↑x).val ⋯, left_inv := ⋯, right_inv := ⋯ }
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
Alias of ZMod.natCast_natAbs_valMinAbs
.
Equations
- ⋯ = ⋯
Equations
- ⋯ = ⋯
Any ring homomorphism into ZMod n
has a right inverse.
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 = Function.Injective.module (ZMod n) (AddSubmonoidClass.subtype K) ⋯ ⋯