In this section a module refers to a finitely-generated module. A module can be represented in presentational form as the quotient of a free module F = Rm by a submodule S of F (referred to as the relation module), which is a subgroup of F invariant under the R-action. Modules occur naturally in problems involving multivariate polynomials. An ideal in R can itself be considered as a finitely-generated module over R. In geometry, the sheaves of differentials or tangent vectors on an affine scheme are represented by R-modules and those on ordinary or weighted-projective schemes are represented by graded R-modules.
In order to compute effectively with such modules, operations such as element membership, intersection, and computing the presentational form of a submodule are required. A general submodule of F/S is equal to S1/S, where S1 is a submodule of F containing S, and it is necessary to be able to find generators and relations for such an object. In particular, it is necessary to compute a basis for the module of R-relations between the generators of any submodule S of F. These are referred to as syzygies of S (or rather of its given basis).
The definition of the Gröbner basis for an ideal of R can be adapted so as to allow the computation of Gröbner bases for submodules S of a free module F. Then the Gröbner-based methods used for ideals extend to submodules S. Thus a syzygy can be computed using a standard Gröbner method. Using this approach, functions are provided for computing the intersection of a finite number of submodules of a module, the colon ideal of two submodules (with the natural definition), Hilbert series, Hilbert polynomials, and minimal bases of graded modules. Magma supports a variety of monomial orders for modules, including ‘position-over-term’ and ‘term-over-position’ orderings. For computing Gröbner bases of modules, Magma uses an extension of the Faugere F4 algorithm to handle modules (developed in 2004 by A. Steel); this apparently remains the only implementation in any software of such an extension. A variant of this is also present for computing syzygies directly using the F4 method.
Basic operations on modules include:
As an example, we can take the graded module M that represents the locally-free sheaf of differentials on the projective cubic surface X defined by the vanishing of the polynomial f = x3 + y3 + z3 + t3 in ℚ[x,y,z,t]. The module M has a minimal presentation as a quotient of a free module of rank 6, R6. We check that the annihilator of M is precisely the ideal <f>, as it should be for a locally-free sheaf. We compute the first Fitting ideal of M and check that it lies in <f>. Then we compute the second Fitting ideal and its ideal saturation with respect to the maximal ideal of R generated by the 4 variables. The result is the full ideal R. These facts together demonstrate that M defines a locally-free sheaf of rank 2 on the surface X.
R-linear homomorphisms can be defined between modules in a natural way, and are represented internally by matrices giving an R-linear map between the free modules occurring in the reduced forms of the modules. If modules M and N are graded modules then a homomorphism from M to N can be decomposed uniquely into a sum of homogeneous homomorphisms. A homomorphism is homogeneous of weight d if it maps the rth graded piece of M into the (r + d)th graded piece for every r. All of the usual homomorphism operations are available. Kernels, cokernels and images can be computed as sub- or quotient modules of the domain or codomain. There are tests for injectivity or surjectivity.
The set of homomorphisms from M to N, HomR(M,N), has a natural structure as an R-module and Magma can compute it as a module along with a map that takes an element of the module to the actual homomorphism that it represents. If M and N are graded, HomR(M,N) is computed as a graded module where the weight of a homogeneous element corresponds to its weight as a homogeneous homomorphism as defined above. Magma's algorithm for computing Hom-modules is again based on an efficient adaptation of the Faugere F4 algorithm to compute syzygies.
One of the most important objects attached to a module over polynomial ring R is a free resolution of R. Hilbert proved that if we are careful about the bases we choose and we take the syzygy module of a module and the syzygy module of that and so on then, after at most n steps, the syzygy module will be trivial. Here n is the number of variables of R. In the language of homological algebra, this says that M has a free resolution of length n: There is a long exact sequence of R-modules
where the Fi are free modules (some of which may be 0). Computation of free resolutions can be performed by iteratively computing syzygy modules but there is a more efficient way using what is known as the La Scala algorithm. Magma computes free resolutions using an extremely efficient implementation of this.
Free resolutions are particularly significant for graded modules, where they capture a number of invariants of the module. More precisely, in the graded case there are minimal free resolutions where the matrices representing the maps between the Fi have entries that are all homogeneous of positive weight. In that case, the resolution is essentially unique and the Fi can be given gradings by assigning column weights so that the maps in the resolution are all homogeneous of weight 0. The column weights of the Fi in the graded case form an array traditionally referred to as the Betti table of the module. The entries of this array — the Betti numbers — contain much useful information about M.
Magma contains an optimised algorithm to compute a minimal free resolution in the graded case and to compute and return the Betti numbers of the module. This algorithm combines the La Scala resolution algorithm with the Faugere F4 algorithm and was developed by A. Steel in 2005; it actually involves running k separate instances of the F4 algorithm at the same time, where k is the length of the resolution. As an example of its efficiency, in February 2014 Richard Stanley asked for the Betti numbers of the 4x4 magic squares (the semigroup algebra of all 4x4 matrices of nonnegative integers with all row and column sums equal; the algebra has 24 generators of degree one and Krull dimension 10). Magma's F4-based algorithm computes the Betti numbers in only 1700 seconds; this involves reducing 811,620 polynomials of degree up to 20 in 24 variables at 16 different levels to collect all the syzygies and the resulting Betti numbers are:
A related quantity is the Castelnuevo–Mumford regularity of a module that Magma also has a function for (the CM regularity is actually a simple function of the Betti numbers). This invariant is important, for example, in the computation of sheaf cohomology and it is used by the cohomology package in Magma.
Free resolutions and functionality for Hom modules allow the computation of the homological bi-functors ExtRi(M,N) and TorRi(M,N) for pairs of modules, M and N and any i ≥ 0 (they are all zero for i > n). There are user functions to compute these for any (i,M,N).