The ring Z/mZ consists of representatives for the residue classes
of integers modulo m > 1. This online help node and the nodes below it describe the operations in Magma for such rings and their elements.
At any stage during a session, Magma will have at most one copy of Z/mZ present, for any m>1. In other words, different names for the same residue class ring will in fact be different references to the same structure. This saves memory and avoids confusion about different but isomorphic structures.
If m is a prime number, the ring Z/mZ forms a field; however, Magma has special functions for dealing with finite fields. The operations described here should not be used for
finite field calculations: the implementation of finite field arithmetic in Magma takes full advantage of the special structure of finite fields and leads to superior performance.
In addition to the general quotient constructor, a number of abbreviations are provided for computing residue class rings.
Given the ring of integers Z, and an ideal I, create the residue class ring modulo the ideal.Note that Z/I does not give this residue ring, but rather, in compatibility with Z as a number field order, returns the ideal quotient, namely Z itself (see Section Z as a Number Field Order above, and the example in Sections Ideals of Z).
Given the ring of integers Z, and an integer m ≠0, create the residue class ring Z/mZ.
Given an integer greater than zero, create the residue class ring Z/mZ and also returns the map from Z into Z/mZ.
Given a prime integer p construct the residue class field Fp and the map from Z into Fp.
Create the residue class ring Z/mZ, where m is the integer corresponding to the factorization sequence Q. This is more efficient than creating the ring by m alone, since the factorization Q will be stored so it can be reused later.
> p := PreviousPrime(2^16); > p; 65521 > R := ResidueClassRing(p); Residue class ring of integers modulo 65521
Now we try to find an element x in R such that x3 = 23.
> exists(t){x : x in R | x^3 eq 23}; true > t; 12697
Automatic coercion takes place between Z/mZ and Z so that a binary operation like + applied to an element of Z/mZ and an integer will result in a residue class from Z/mZ.
Using !, elements from a prime field GF(p) can be coerced into Z/pZ, and elements from Z/pZ can be coerced into GF(pr). Also, transitions between Z/mZ and Z/nZ can be made using ! provided that m divides n or n divides m. In cases where there is a choice -- such as when an element r from Z/mZ is coerced into Z/nZ with m dividing n -- the result will be the residue class containing the representative for r.
> r := ResidueClassRing(3) ! 5; > r; 2 > ResidueClassRing(6) ! r; 2So the representative 2 of 5 mod 3 is mapped to the residue class 2 mod 6, and not to 5 mod 6.
Given a residue class ring R=Z/mZ, this function returns the common modulus m for the elements of R.
Given a residue class ring R=Z/mZ, this function returns the factorization of the common modulus m for the elements of R.
Given R=Z/mZ, create the abelian group of integers modulo m under addition. This returns the finite additive abelian group A (of order m) together with a map from A to the ring Z/mZ, sending A.1 to 1.
Given R=Z/mZ, create the multiplicative group of R as an abelian group. This returns an (additive) abelian group A of order φ(m), together with a map from A to R.
Given R, the ring of integers modulo m or an ideal of it, and an element n of R create the ideal of R generated by n.
Create the enumerated set consisting of the elements of the residue class ring R.
Ring homomorphisms with domain Z/mZ are completely determined by the image of 1. As usual, we require our homomorphisms to map 1 to 1. Therefore, the general homomorphism constructor with domain Z/mZ needs no arguments.
Given a residue class ring R, and a ring S, create a homomorphism from R to S, determined by f(1R) = 1S. Note that it is the responsibility of the user that the map defines a homomorphism!