All of the modules considered in this chapter are ambient modules or embedded in such a module. We call an R-module ambient if it has the explicit presentational form Rk/< relations >, where the relations are elements of Rk (and they may be zero or not even determined, initially). Elements of an ambient R-module M are represented explicitly as vectors in Rk, and M is always generated by the k unit vectors. The degree of M is k.
An arbitrary module S may have a representation as a submodule of such an ambient A, which is referred to as its ambient module. Hence the most general definition of a module is as a sub-quotient of a free module. If A has no relations then S is just a submodule of a free module (namely, A). However, in this case, S will often also have an internal representation in presentational form that is essential for much of its fundamental functionality. In any case, the primary representation of elements of such an embedded module S is as vectors in the ambient.
As with vector spaces, there are two basic ways that modules can be defined in Magma: as embedded or reduced modules. A general subquotient as described above is in embedded form, but ambients may also be defined of either reduced or embedded type. The type primarily affects the way submodules and quotient modules are created. Briefly, submodules and quotient modules of embedded modules stay in embedded form (as generally proper submodules of an ambient) whereas submodules or quotients of reduced modules are always returned in presentational form as ambients, with connecting homomorphisms to link them explicitly to the original module. The two types are described in a bit more detail below. For illustration, see the examples at the end of Section Submodules and Quotient Modules.
Embedded modules are created in general via the function EModule, which returns a free embedded module, and in principle mimic the embedded R-spaces (as created by the function RSpace(R, k) in Chapter FREE MODULES). Such modules are always presented with their elements and bases lying in an ambient module Rk/< relations >. The modules are basically implemented as extensions of the multivariate polynomial ideal type (or affine algebra type if non-zero relations are present), where columns are internally added to monomials in a polynomial to represent a vector. Many operations applicable to ideals, including various Gröbner basis operations, naturally extend to such modules.
Starting with an ambient embedded module M=Rk/< relations >, when a submodule S of M is created, the ambient module of S is still M, so the elements of S are represented as elements of Rk (modulo the relations if present); this therefore also applies to elements of any basis of S, including the Gröbner basis of S. Thus S itself may be not ambient and this is the only situation in which non-ambients can occur. Similarly, when a quotient module Q of M is constructed, the elements of Q appear as elements of Rk, while Q simply gains more relations than M, but its generators are usually not minimally reduced.
Reduced modules are created in general via the function RModule, which returns a free reduced module, and are more abstract and mimic the reduced modules with action over fields and Euclidean rings (as created by the function RModule(R, k) in Chapter FREE MODULES). Such modules are always ambient, so always have the abstract form Rn/< relations >, and the relationships between such modules are managed by morphisms lying in the background. The Gröbner basis techniques and properties are also hidden from the user in general.
Starting from a reduced module M=Rk/< relations >, when a submodule S (having s generators (v1, ..., vs)) of M is created, S is generally created as Rs/< relationsS > (where the relations for S are initially unknown and are only computed when needed) and a morphism is stored from S to M, which maps the i-th unit vector of S to vi in M. Similarly, a quotient module Q of M is constructed as another ambient module, usually with minimal generators, and a morphism from M onto Q is stored in the background. All morphisms between modules can be accessed via the function Morphism.
For any module M, there exists an isomorphic reduced presentation module P, which is always ambient, since P is reduced. If M is embedded, then P is a reduced module equivalent to M (and morphisms in the background allow automatic coercion between M and P). Otherwise, M is already reduced so P is simply identical to M. Some functions (such as FreeResolution) always move to the presentation of M, since it is more natural to work only with ambient modules in that context.
Embedded modules are generally preferable when one wishes to work explicitly with Gröbner bases at a very low level, while reduced modules are generally preferable for homological computations since the ambient presentation form is more convenient (particularly for the relevant maps).
Technically, there is little difference in practice between an ambient embedded module and a reduced module, if each module is considered in isolation. The concepts basically refer to how submodules and quotient modules are derived from a given module (and the fact that embedded modules allow non-ambient submodules).
Finally, there is a subclass of reduced modules with the special type ModMPolGrd: these are graded, which means that they are always generated by homogeneous elements (with respect to the relevant grading). The main distinctive of this type is simply that when one creates a submodule or quotient module of a module of type ModMPolGrd, then the generators must be homogeneous, thus ensuring that the new derived module is also graded so will be of type ModMPolGrd also. In the future, more functions will be developed which will take modules of type ModMPolGrd explicitly. Note also that since the type ModMPolGrd ISA ModMPol via the type `ISA' relation, any operation applicable to a module of type ModMPol is also applicable to a module of type ModMPolGrd.