The use of the packages NormalizInterface
[GHS14] (an interface to Normalize
[BIRC14]; or in its absence 4ti2Interface
[Gut], and interface to 4ti2
[4t]), SingularInterface
(an interface to Singular
[DGPS12]; or in its absence Singular
[CG12]); or in its absecnce GradedModules
[BGJLLM14] is highly recomended for many of the functions presented in this chapter. However, whenever possible a method not depending on these packages is also provided (though slower). The package tests if the user has downloaded any of the above packages, and if so puts NumSgpsCanUsePackage
to true, where Package
is any of the above.
As mentioned above some methods are specifially implemented to take advantage of several external packages. The following functions can be used in case these packages have not been loaded prior to numericalsgps
.
‣ NumSgpsUse4ti2 ( ) | ( function ) |
Tries to load the package 4ti2Interface
. If the package is available, then it also loads methods implemented using functions in this package.
‣ NumSgpsUse4ti2gap ( ) | ( function ) |
Tries to load the package 4ti2gap
. If the package is available, then it also loads methods implemented using functions in this package.
‣ NumSgpsUseNormalize ( ) | ( function ) |
Tries to load the package NormalizInterface
. If the package is available, then it also loads methods implemented using functions in this package.
‣ NumSgpsUseSingular ( ) | ( function ) |
Tries to load the package singular
. If the package is available, then it also loads methods implemented using functions in this package.
To prevent incompatibilities, the package will not load if SingularInterface
has been already loaded.
‣ NumSgpsUseSingularInterface ( ) | ( function ) |
Tries to load the package SingularInterface
. If the package is available, then it also loads methods implemented using functions in this package.
To prevent incompatibilities, the package will not load if singular
has been already loaded.
‣ NumSgpsUseSingularGradedModules ( ) | ( function ) |
Tries to load the package GradedModules
. If the package is available, then it also loads methods implemented using functions in this package.
It also creates a ring of rationals NumSgpsRationals
.
An affine semigroup S is a finitely generated cancellative monoid that is reduced (no units other than 0) and is torsion-free (a s= b s implies a=b, with a,b∈ N and s∈ S). Up to isomorphisms any affine semigroup can ve viewed as a finitely generated submonoid of N^k for some positive integer k. Thus affine semigroups are a natural generalization of numerical semigroups. The most common way to give an affine semigroup is by any of its systems of generators. As for numerical semigroups, any affine semigroup admits a unique minimal system of generators. A system of generators can be represented as a list of lists of nonnegative integers; all lists in the list having the same length (a matrix actually). If G is a subgroup of Z^k, then S=G∩ N^k is an affine semigroup (these semigroups are call full affine semigroups). As G can be represented by its defining equations (homogeneous and some of them possibly in congruences), we can represent S by the defining equations of G; indeed S is just the set of nonnegative solutions of this system of equations. We can represent the equations as a list of lists of integers, all with the same length. Every list is a row of the matrix of coefficients of the system of equations. For the equations in congruences, if we arrange them so that they are the first ones in the list, we provide the corresponding moduli in a list. So for instance, the equations x+y≡ 0mod 2, x-2y=0 will be represented as [[1,1],[1,-2]] and the moduli [2].
To create an affine semigroup in GAP the function AffineSemigroup
is used.
‣ AffineSemigroup ( Representation, List ) | ( function ) |
Representation
may be "generators"
, "minimalgenerators"
according to whether the semigroup is to be given by means of a system of generators, a minimal system of generators, ...
When no string is given as first argument it is assumed that the numerical semigroup will be given by means of a set of generators.
gap> AffineSemigroup([1,3],[7,2],[1,5]); <Affine semigroup in 2 dimensional space, with 3 generators> gap> a2 := AffineSemigroup("equations",[[[-2,1]],[3]]); <Affine semigroup>
‣ AsAffineSemigroup ( S ) | ( function ) |
S is a numerical semigroup, the output is S regarded as an affine semigroup.
gap> s:=NumericalSemigroup(1310,1411,1546,1601); <Numerical semigroup with 4 generators> gap> MinimalPresentationOfNumericalSemigroup(s);;time; 2960 gap> a:=AsAffineSemigroup(s); <Affine semigroup in 1 dimensional space, with 4 generators> gap> GeneratorsOfAffineSemigroup(a); [ [ 1310 ], [ 1411 ], [ 1546 ], [ 1601 ] ] gap> MinimalPresentationOfAffineSemigroup(a);;time; 237972
If we use the package SingularInterface
, the speed up is considerable.
gap> NumSgpsUseSingularInterface(); ... gap> MinimalPresentationOfAffineSemigroup(a);;time; 32
‣ IsAffineSemigroup ( AS ) | ( attribute ) |
‣ IsAffineSemigroupByGenerators ( AS ) | ( attribute ) |
‣ IsAffineSemigroupByMinimalGenerators ( AS ) | ( attribute ) |
‣ IsAffineSemigroupByEquations ( AS ) | ( attribute ) |
‣ IsAffineSemigroupByInequalities ( AS ) | ( attribute ) |
AS is an affine semigroup and these attributes are available (their names should be self explanatory). They reflect what is currently known about the semigroup.
gap> a1:=AffineSemigroup([[3,0],[2,1],[1,2],[0,3]]); <Affine semigroup in 2 dimensional space, with 4 generators> gap> IsAffineSemigroupByEquations(a1); false gap> IsAffineSemigroupByGenerators(a1); true
‣ BelongsToAffineSemigroup ( v, a ) | ( function ) |
v is a list of nonnegative integers and a an affine semigroup. Returns true if the vector is in the semigroup, and false otherwise.
If the semigroup is full and its equations are known (either because the semigroup was defined by equations, or because the user has called IsFullAffineSemgiroup(a)
and the output was true), then membership is performed by evaluating v in the equations. The same holds for normal semigroups and its defining inequalities.
gap> a:=AffineSemigroup([[2,0],[0,2],[1,1]]);; gap> BelongsToAffineSemigroup([5,5],a); true gap> BelongsToAffineSemigroup([1,2],a); false
‣ IsFullAffineSemigroup ( S ) | ( function ) |
s is an affine semigroup.
Returns true if the semigroup is full, false otherwise. The semigroup is full if whenever a,b∈ S and b-a∈ N^k, then a-b∈ S, where k is the dimension of S.
If the semigroup is full, then its equations are stored in the semigroup for further use.
gap> a:=AffineSemigroup([[2,0],[0,2],[1,1]]);; gap> BelongsToAffineSemigroup([5,5],a); true gap> BelongsToAffineSemigroup([1,2],a); false
‣ HilbertBasisOfSystemOfHomogeneousEquations ( ls, m ) | ( function ) |
ls is a list of lists of integers and m a list of integers. The elements of ls represent the rows of a matrix A. The output is a minimal generating system (Hilbert basis) of the set of nonnegative integer solutions of the sytem Ax=0 where the k first equations are in the congruences modulo m[i], with k the length of m.
If the package NormalizInterface
has not been loaded, then Contejean-Devie algorithm is used [CD94] instead (if this is the case, congruences are treated as in [RG98].
gap> HilbertBasisOfSystemOfHomogeneousEquations([[1,0,1],[0,1,-1]],[2]); [ [ 0, 2, 2 ], [ 1, 1, 1 ], [ 2, 0, 0 ] ]
If C is a pointed cone (a cone in Q^k not containing lines and 0∈ C), then S=C∩ N^k is an affine semigroup (known as normal affine semigroup). So another way to give an affine semigroup is by a set of homogeneous inequalities, and we can represent these inequalities by its coefficients. If we put them in a matrix S can be defined as the set of nonnegative integer solutions to Ax ge 0.
‣ HilbertBasisOfSystemOfHomogeneousInequalities ( ls ) | ( function ) |
ls is a list of lists of integers. The elements of ls represent the rows of a matrix A. The output is a minimal generating system (Hilbert basis) of the set of nonnegative integer solutions to Axge 0.
If the package NormalizInterface
has not been loaded, then Contejean-Devie algorithm is used [CD94] instead (the use of slack variables is described in [CGB02]).
gap> HilbertBasisOfSystemOfHomogeneousInequalities([[2,-3],[0,1]]); [ [ 1, 0 ], [ 2, 1 ], [ 3, 2 ] ]
‣ EquationsOfGroupGeneratedBy ( M ) | ( function ) |
M is a matrix of integers. The output is a pair [A,m] that reperesents the set of defining equations of the group spanned by the rows of M: Ax=0∈ Z_n_1× ⋯ × Z_n_t× Z^k, with m=[n_1,...,n_t].
gap> EquationsOfGroupGeneratedBy([[1,2,0],[2,-2,2]]); [ [ [ 0, 0, -1 ], [ -2, 1, 3 ] ], [ 2 ] ]
‣ BasisOfGroupGivenByEquations ( A, m ) | ( function ) |
A is a matrix of integers and m is a list of positive integers. The output is a basis for the group with defining equations Ax=0∈ Z_n_1× ⋯ × Z_n_t× Z^k, with m=[n_1,...,n_t].
gap> BasisOfGroupGivenByEquations([[0,0,1],[2,-1,-3]],[2]); [ [ -1, -2, 0 ], [ -2, 2, -2 ] ]
Let S_1 and S_2 be two affine semigroups with the same dimension generated by A_1 and A_2, respectively. We say that the affine semigroup S generated by the union of A_1 and A_2 is a gluing of S_1 and S_2 if G(S_1)∩ G(S_2)=d Z (G(⋅) stands for group spanned by) for some d∈ S_1∩ S_2.
The algorithm used is explained in [RG99b].
‣ GluingOfAffineSemigroups ( a1, a2 ) | ( function ) |
a1, a2 are affine semigroups. Determines if they can be glued, and if so, returns the gluing. Otherwise it returns fail.
gap> a1:=AffineSemigroup([[2,0],[0,2]]); <Affine semigroup in 2 dimensional space, with 2 generators> gap> a2:=AffineSemigroup([[1,1]]); <Affine semigroup in 2 dimensional space, with 1 generators> gap> GluingOfAffineSemigroups(a1,a2); <Affine semigroup in 2 dimensional space, with 3 generators> gap> GeneratorsAS(last); [ [ 0, 2 ], [ 1, 1 ], [ 2, 0 ] ]
A minimal presentation of an affine semigoup is defined analogously as for numerical semigroups. The user might take into account that generators are stored in a set, and thus might be arranged in a different way to the intitial input.
‣ GeneratorsOfKernelCongruence ( M ) | ( function ) |
M is matrix with nonnegative integer coefficients. The output is a system of generators of the congruence {(x,y)∣ xM=yM}.
The main differe3nce with MinimalPresentationOfAffineSemigroup
is that the matrix M can have repeated columns and these are not treated as a set.
‣ MinimalPresentationOfAffineSemigroup ( a ) | ( function ) |
a is an affine semigroup. The output is a minimal presentation for a.
There are four methods implemented for this function, depending on the packages loaded. All of them use elimination, and Herzog's correspondence, computing the kernel of a ring homomorphism ([Her70]). The fastest procedure is achived when SingularInterface
is loaded, followed by Singular
. The procedure that does not use external packages uses internal GAP Gröbner basis computations and thus it is slower. Also in this case, from the Gröbner basis, a minimal set of gerating binomials must be refined, and for this Rclasses are used (if NormalizInterface
is loaded, then the factorizations are faster). The 4ti2
implementation uses 4ti2
internal Gröbner bases and factorizations are done via zsolve
.
gap> a:=AffineSemigroup([2,0],[0,2],[1,1]);; gap> MinimalPresentationOfAffineSemigroup(a); [ [ [ 1, 0, 1 ], [ 0, 2, 0 ] ] ] gap> GeneratorsOfAffineSemigroup(a); [ [ 0, 2 ], [ 1, 1 ], [ 2, 0 ] ]
‣ BettiElementsOfAffineSemigroup ( a ) | ( function ) |
a is an affine semigroup. The output is the set of Betti elements of a (defined as for numerical semigroups).
This function relies on the computation of a minimal presentation.
gap> a:=AffineSemigroup([2,0],[0,2],[1,1]);; gap> BettiElementsOfAffineSemigroup(a); [ [ 2, 2 ] ]
‣ ShadedSetOfElementInAffineSemigroup ( v, a ) | ( function ) |
a is an affine semigroup and v is an element in a. This is a translation of ShadedSetOfElementInNumericalSemigroup
(4.1-5) but for affine semigroups.
‣ IsGenericAffineSemigroup ( a ) | ( function ) |
a is an affine semigroup.
The same as IsGenericNumericalSemigroup
(4.2-2) but for affine semigroups.
‣ IsUniquelyPresentedAffineSemigroup ( a ) | ( function ) |
a is an affine semigroup.
The same as IsUniquelyPresentedNumericalSemigroup
(4.2-1) but for affine semigroups.
‣ PrimitiveElementsOfAffineSemigroup ( a ) | ( function ) |
a is an affine semigroup. The output is the set of primitive elements of a (defined as for numerical semigroups).
This function has three implementations (methods), one using Graver basis via the Lawrence lifting of a and the other (much faster) using NormalizInterface
. Also a 4ti2
version using its Graber basis computation is provided.
gap> a:=AffineSemigroup([2,0],[0,2],[1,1]);; gap> PrimitiveElementsOfAffineSemigroup(a); [ [ 0, 2 ], [ 1, 1 ], [ 2, 0 ], [ 2, 2 ] ]
The invariants presented here are defined as for numerical semigroups.
As with presentations, the user should take into account that generators are stored in a set, and thus might be arranged in a different way to the intitial input.
‣ FactorizationsVectorWRTList ( v, ls ) | ( function ) |
v is a list of nonnegative integers and ls is a list of lists of nonnegative integers. The output is set of factorizations of v in terms of the elements of ls.
If no extra package is loaded, then factorizations are computed recursively; and thus slowly. If NormalizInterface
is loaded, then a system of equations is solve with Normaliz, and the performance is much better. If 4ti2Interface
is loaded instead, then factorizations are calculated using zsolve
command of 4ti2
.
gap> FactorizationsVectorWRTList([5,5],[[2,0],[0,2],[1,1]]); [ [ 2, 2, 1 ], [ 1, 1, 3 ], [ 0, 0, 5 ] ]
‣ ElasticityOfAffineSemigroup ( a ) | ( function ) |
a is an affine semigroup. The output is the elasticity of a (defined as for numerical semigroups).
The procedure used is based on [Phi10], where it is shown that the elasticity can be computed by using circuits. The set of circutis is calculated using [ES96].
gap> a:=AffineSemigroup([2,0],[0,2],[1,1]);; gap> ElasticityOfAffineSemigroup(a); 1
‣ CatenaryDegreeOfAffineSemigroup ( a ) | ( function ) |
a is an affine semigroup. The output is the catenary degree of a (defined as for numerical semigroups).
gap> a:=AffineSemigroup([2,0],[0,2],[1,1]);; gap> CatenaryDegreeOfAffineSemigroup(a); 2
‣ EqualCatenaryDegreeOfAffineSemigroup ( a ) | ( function ) |
a is an affine semigroup. The output is the equal catenary degree of a (defined as for numerical semigroups).
This function relies on the results presented in [SO-13].
‣ HomogeneousCatenaryDegreeOfAffineSemigroup ( a ) | ( function ) |
a is an affine semigroup. The output is the homogeneous catenary degree of a (defined as for numerical semigroups).
This function is based on [SO-13].
‣ MonotoneCatenaryDegreeOfAffineSemigroup ( a ) | ( function ) |
a is an affine semigroup. The output is the monotone catenary degree of a (defined as for numerical semigroups), computed as explained in [Phi10].
gap> a:=AffineSemigroup("inequalities",[[2,-1],[-1,3]]); <Affine semigroup> gap> GeneratorsOfAffineSemigroup(a); [ [ 1, 1 ], [ 1, 2 ], [ 2, 1 ], [ 3, 1 ] ] gap> CatenaryDegreeOfAffineSemigroup(a); 3 gap> EqualCatenaryDegreeOfAffineSemigroup(a); 2 gap> HomogeneousCatenaryDegreeOfAffineSemigroup(a); 3 gap> MonotoneCatenaryDegreeOfAffineSemigroup(a); 3
‣ TameDegreeOfAffineSemigroup ( a ) | ( function ) |
a is an affine semigroup. The output is the tame degree of a (defined as for numerical semigroups). If a is given by equations (or its equations are known), then the procedure explained in [Gar14] is used.
gap> a:=AffineSemigroup([2,0],[0,2],[1,1]);; gap> TameDegreeOfAffineSemigroup(a); 2
‣ OmegaPrimalityOfElementInAffineSemigroup ( v, a ) | ( function ) |
v is a list of nonnegative integers and a is an affine semigroup. The output is the omega primality of a (defined as for numerical semigroups). Returns 0 if the element is not in the semigroup.
The implementation of this procedure is performed as explained in [BGG11] (also, if the semigroup has defining equations, then it takes advantage of this fact as explained in this reference).
gap> a:=AffineSemigroup([2,0],[0,2],[1,1]);; gap> OmegaPrimalityOfElementInAffineSemigroup([5,5],a); 6
‣ OmegaPrimalityOfAffineSemigroup ( a ) | ( function ) |
a is an affine semigroup. The output is the omega primality of a (defined as for numerical semigroups).
gap> a:=AffineSemigroup([2,0],[0,2],[1,1]);; gap> OmegaPrimalityOfAffineSemigroup(a); 2
generated by GAPDoc2HTML