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
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.
Equations
Instances For
So-named because the outer coercion is Int.cast
into ZMod
. For Int.cast
into an arbitrary
ring, see ZMod.int_cast_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 (_ : n ∣ n) R) (_ : Function.Bijective ⇑(ZMod.castHom (_ : n ∣ n) R))
Instances For
Equations
- (_ : Nontrivial (ZMod n)) = (_ : Nontrivial (ZMod n))
Equations
- ZMod.nontrivial' = (_ : Nontrivial (ZMod 0))
Equations
- ZMod.instInvZMod n = { inv := ZMod.inv n }
unitOfCoprime
makes an element of (ZMod n)ˣ
given
a natural number x
and a proof that x
is coprime to n
Equations
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
Equations
- ZMod.subsingleton_units = (_ : Subsingleton (ZMod 2)ˣ)
valMinAbs x
returns the integer in the same equivalence class as x
that is closest to 0
,
The result will be in the interval (-n/2, n/2]
.
Equations
Instances For
Equations
- (_ : Subsingleton (ZMod n →+* R)) = (_ : Subsingleton (ZMod n →+* R))
Equations
- (_ : Subsingleton (ZMod n ≃+* R)) = (_ : Subsingleton (ZMod n ≃+* R))