It depends on the computations we intended to do with residue classes whether or not the implementation described in the previous section is satisfactory for us.
Probably we are mainly interested in more complex data structures than the residue classes themselves, for example in matrix algebras or matrix groups over a ring such as Z/4Z. For this, we need functions to add, multiply, invert etc. matrices of residue classes. Of course this is not a difficult task, but it requires to write additional GAP code.
And when we have implemented the arithmetic operations for matrices of
residue classes, we might be interested in domain operations such as
computing the order of a matrix group over Z/4Z,
a Sylow 2 subgroup, and so on.
The problem is that a residue class represented as a pair [ k, n ]
is not regarded as a group element by GAP.
We have not yet discussed how a matrix of residue classes shall be
represented, but if we choose the obvious representation of a list of
lists of our residue classes then also this is not a valid group element
in GAP.
Hence we cannot apply the function Group to create a group of residue
classes or a group of matrices of residue classes.
This is because GAP assumes that group elements can be multiplied via
the infix operator * (equivalently, via the operation \*).
Note that in fact the multiplication of two lists [ k_1, n ],
[ k_2, n ] is defined, but we have
[ k_1, n ] * [ k_2, n ] = k_1 * k_2 + n * n, the standard scalar
product of two row vectors of same length.
That is, the multiplication with * is not compatible with the function
reclass_prod introduced in the previous section.
Similarly, ring elements are assumed to be added via the infix operator
+; the addition of residue classes is not compatible with the available
addition of row vectors.
What we have done in the previous section can be described as implementation of a ``standalone'' arithmetic for residue classes. In order to use the machinery of the GAP library for creating higher level objects such as matrices, polynomials, or domains over residue class rings, we have to ``integrate'' this implementation into the GAP library. The key step will be to create a new kind of GAP objects. This will be done in the following sections; there we assume that residue classes and residue class rings are not yet available in GAP; in fact they are available, and their implementation is very close to what is described here.
[Top] [Previous] [Up] [Next] [Index]
GAP 4 manual