  
  [1X11 [33X[0;0YAffine semigroups[133X[101X
  
  [33X[0;0YAn  [13Xaffine  semigroup[113X  [22XS[122X is a finitely generated cancellative monoid that is
  reduced  (no  units other than 0) and is torsion-free ([22Xa s= b s[122X implies [22Xa=b[122X,
  with  [22Xa,b∈ N[122X and [22Xs∈ S[122X). Up to isomorphism any affine semigroup can be viewed
  as  a  finitely generated submonoid of [22XN^k[122X for some positive integer [22Xk[122X. Thus
  affine semigroups are a natural generalization of numerical semigroups.[133X
  
  [33X[0;0YSome of the functions in this chapter may work considerably faster when some
  external package is installed and its use is allowed. When this is the case,
  it  is  referred in the function documentation. We refer the user to Chapter
  [14X13[114X for details on the use of external packages.[133X
  
  
  [1X11.1 [33X[0;0YDefining affine semigroups[133X[101X
  
  [33X[0;0YThe  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 [22XG[122X is a subgroup of [22XZ^k[122X,
  then  [22XS=G∩  N^k[122X  is  an  affine  semigroup (these semigroups are called [13Xfull
  affine  semigroups[113X).  As  [22XG[122X  can  be  represented  by its defining equations
  (homogeneous  and  some of them possibly in congruences), we can represent [22XS[122X
  by  the  defining  equations  of  [22XG[122X; indeed [22XS[122X 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  [22Xx+y≡ 0mod 2, x-2y=0[122X will be represented as [[1,1],[1,-2]] and the
  moduli [2].[133X
  
  [33X[0;0YAs happens with numerical semigroups, there are different ways to specify an
  affine  semigroup [22XS[122X, namely, by means of a system of generators, a system of
  homogeneous  linear  Diophantine equations or a system of homogeneous linear
  Diophantine  inequalities, just to mention some. In this section we describe
  functions  that  may  be  used  to  specify, in one of these ways, an affine
  semigroup in [5XGAP[105X.[133X
  
  [1X11.1-1 AffineSemigroup[101X
  
  [33X[1;0Y[29X[2XAffineSemigroup[102X( [[3XString[103X, ][3XList[103X ) [32X function[133X
  [33X[1;0Y[29X[2XAffineSemigroupByGenerators[102X( [3XList[103X ) [32X function[133X
  
  [33X[0;0Y[10XList[110X  is  a list of n-tuples of nonnegative integers, if the semigroup to be
  created  is  n-dimensional.  The  n-tuples  may  be  given as a list or by a
  sequence  of individual elements. The output is the affine semigroup spanned
  by [10XList[110X.[133X
  
  [33X[0;0Y[10XString[110X  does  not  need  to  be  present.  When  it  is  present, it must be
  [10X"generators"[110X and [10XList[110X must be a list, not a sequence of individual elements.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27Xs1 := AffineSemigroup([1,3],[7,2],[1,5]);[127X[104X
    [4X[28X<Affine semigroup in 2 dimensional space, with 3 generators>[128X[104X
    [4X[25Xgap>[125X [27Xs2 := AffineSemigroup([[1,3],[7,2],[1,5]]);;[127X[104X
    [4X[25Xgap>[125X [27Xs3 := AffineSemigroupByGenerators([1,3],[7,2],[1,5]);;[127X[104X
    [4X[25Xgap>[125X [27Xs4 := AffineSemigroupByGenerators([[1,3],[7,2],[1,5]]);;[127X[104X
    [4X[25Xgap>[125X [27Xs5 := AffineSemigroup("generators",[[1,3],[7,2],[1,5]]);;[127X[104X
    [4X[25Xgap>[125X [27XLength(Set([s1,s2,s3,s4,s5]));[127X[104X
    [4X[28X1[128X[104X
  [4X[32X[104X
  
  [1X11.1-2 AffineSemigroup[101X
  
  [33X[1;0Y[29X[2XAffineSemigroup[102X( [3XString[103X, [3XList[103X ) [32X function[133X
  [33X[1;0Y[29X[2XAffineSemigroupByEquations[102X( [3XList[103X ) [32X function[133X
  
  [33X[0;0Y[10XList[110X  is  a  list  with  two  components. The first represents a matrix with
  integer coefficients, say [22XA=(a_ij)[122X, and so it is a list of lists of integers
  all  with  the  same  length.  The  second  component  is a list of positive
  integers, say [22Xd=(d_i)[122X, which may be empty. The list [22Xd[122X must be of length less
  than or equal to the length of [22XA[122X (number of rows of [22XA[122X).[133X
  
  [33X[0;0YThe  output  is  the  full semigroup of nonnegative integer solutions to the
  system of homogeneous equations[133X
  [33X[0;0Y[22Xa_11x_1+⋯+a_1nx_n≡ 0mod d_1,[122X[133X
  [33X[0;0Y[22X⋯[122X[133X
  [33X[0;0Y[22Xa_k1x_1+⋯+a_knx_n≡ 0mod d_k,[122X[133X
  [33X[0;0Y[22Xa_k+1 1x_1+⋯ +a_k+1 n=0,[122X[133X
  [33X[0;0Y[22X⋯[122X[133X
  [33X[0;0Y[22Xa_m1x_1+⋯+a_mnx_n=0.[122X[133X
  
  [33X[0;0YIf [22Xd[122X is empty, then there will be no equations in congruences.[133X
  
  [33X[0;0YAs  pointed  at  the  beginning  of  the section, the equations [22Xx+y≡ 0mod 2,
  x-2y=0[122X  will  be  represented  as [22XA[122X equal to [[1,1],[1,-2]] and the moduli [22Xd[122X
  equal to [2].[133X
  
  [33X[0;0YIn the second form, [10XString[110X must be [10X"equations"[110X.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27Xs1 := AffineSemigroup("equations",[[[1,1]],[3]]);[127X[104X
    [4X[28X<Affine semigroup>[128X[104X
    [4X[25Xgap>[125X [27Xs2 := AffineSemigroupByEquations([[[-2,1]],[3]]);[127X[104X
    [4X[28X<Affine semigroup>[128X[104X
    [4X[25Xgap>[125X [27Xs1=s2;[127X[104X
    [4X[28Xtrue[128X[104X
  [4X[32X[104X
  
  [1X11.1-3 AffineSemigroup[101X
  
  [33X[1;0Y[29X[2XAffineSemigroup[102X( [3XString[103X, [3XList[103X ) [32X function[133X
  [33X[1;0Y[29X[2XAffineSemigroupByInequalities[102X( [3XList[103X ) [32X function[133X
  
  [33X[0;0Y[10XList[110X  is  a  list  of  lists (a matrix) of integers that represents a set of
  inequalities.[133X
  
  [33X[0;0YReturns the (normal) affine semigroup of nonegative integer solutions of the
  system of inequalities [22XList× Xge 0[122X.[133X
  
  [33X[0;0YIn the second form, [10XString[110X must be [10X"inequalities"[110X.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27Xa1:=AffineSemigroup("inequalities",[[2,-1],[-1,3]]);[127X[104X
    [4X[28X<Affine semigroup>[128X[104X
    [4X[25Xgap>[125X [27Xa2:=AffineSemigroupByInequalities([[2,-1],[-1,3]]);[127X[104X
    [4X[28X<Affine semigroup>[128X[104X
    [4X[25Xgap>[125X [27Xa1=a2;[127X[104X
    [4X[28Xtrue[128X[104X
  [4X[32X[104X
  
  [1X11.1-4 AffineSemigroup[101X
  
  [33X[1;0Y[29X[2XAffineSemigroup[102X( [3XString[103X, [3XList[103X ) [32X function[133X
  [33X[1;0Y[29X[2XAffineSemigroupByPMInequality[102X( [3Xf[103X, [3Xb[103X, [3Xg[103X ) [32X function[133X
  
  [33X[0;0Y[3Xf[103X, [3Xg[103X are lists of integers and [3Xb[103X is a positive integer.[133X
  
  [33X[0;0YReturns  the proportionally modular affine semigroup defined by the [22Xf× X mod
  b ≤ g× X[122X[133X
  
  [33X[0;0YIn the second form, [10XString[110X must be [10X"pmiequality"[110X.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27Xs:=AffineSemigroupByPMInequality([0, 1, 1, 0, -1], 4, [1, 0, -2, -3, 1]); [127X[104X
    [4X[28X<Affine semigroup>[128X[104X
    [4X[25Xgap>[125X [27XMinimalGenerators(s);[127X[104X
    [4X[28X[ [ 0, 0, 0, 0, 2 ], [ 0, 0, 0, 0, 3 ], [ 0, 0, 0, 1, 4 ], [ 0, 0, 0, 2, 7 ], [ 0, 0, 0, 4, 12 ], [ 0, 0, 1, 0, 4 ], [128X[104X
    [4X[28X  [ 0, 0, 1, 0, 5 ], [ 0, 0, 1, 1, 5 ], [ 0, 0, 2, 0, 5 ], [ 0, 0, 2, 0, 6 ], [ 0, 0, 3, 0, 7 ], [ 0, 0, 4, 0, 8 ], [128X[104X
    [4X[28X  [ 0, 1, 0, 0, 1 ], [ 0, 1, 0, 1, 4 ], [ 0, 1, 0, 3, 9 ], [ 0, 1, 1, 0, 2 ], [ 0, 2, 0, 0, 1 ], [ 0, 2, 0, 2, 6 ], [128X[104X
    [4X[28X  [ 0, 3, 0, 1, 3 ], [ 0, 4, 0, 0, 0 ], [ 1, 0, 0, 0, 0 ], [ 1, 0, 0, 0, 1 ], [ 1, 0, 0, 1, 3 ], [ 1, 0, 0, 3, 8 ], [128X[104X
    [4X[28X  [ 1, 0, 1, 0, 1 ], [ 1, 1, 0, 0, 0 ], [ 1, 1, 0, 2, 5 ], [ 1, 2, 0, 1, 2 ], [ 2, 0, 0, 2, 4 ], [ 2, 1, 0, 1, 1 ], [128X[104X
    [4X[28X  [ 2, 3, 1, 0, 0 ], [ 3, 0, 0, 1, 0 ], [ 3, 0, 1, 0, 0 ], [ 4, 2, 2, 0, 0 ], [ 6, 1, 3, 0, 0 ], [ 8, 0, 4, 0, 0 ] ][128X[104X
  [4X[32X[104X
  
  [1X11.1-5 AffineSemigroup[101X
  
  [33X[1;0Y[29X[2XAffineSemigroup[102X( [[3XString[103X, ][3XList[103X ) [32X function[133X
  [33X[1;0Y[29X[2XAffineSemigroupByGaps[102X( [3XList[103X ) [32X function[133X
  
  [33X[0;0YIn  the  first  form,  [10XString[110X  must be [10X"gaps"[110X and [10XList[110X must be a list, not a
  sequence of individual elements.[133X
  
  [33X[0;0YIn  the  second form, [10XList[110X is a list of n-tuples of nonnegative integers, if
  the semigroup to be created is n-dimensional. The n-tuples may be given as a
  list  or  by  a  sequence  of  individual elements. The output is the affine
  semigroup  with  gaps  [10XList[110X.  If  the  given  set  is not a set of gaps of a
  numerical semigroup, then the function raises an error.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27Xgaps := [[1,0,0,0],[1,1,0,0],[2,0,0,0],[2,1,0,0],[5,0,0,0]];;[127X[104X
    [4X[25Xgap>[125X [27Xa1 := AffineSemigroup("gaps", gaps );[127X[104X
    [4X[28X<Affine semigroup>[128X[104X
    [4X[25Xgap>[125X [27Xa2 := AffineSemigroupByGaps( gaps );[127X[104X
    [4X[28X<Affine semigroup>[128X[104X
    [4X[25Xgap>[125X [27Xa1 = a2;[127X[104X
    [4X[28Xtrue[128X[104X
    [4X[25Xgap>[125X [27XGenerators(a1);;[127X[104X
    [4X[25Xgap>[125X [27XSet(last);[127X[104X
    [4X[28X[ [ 0, 0, 0, 1 ], [ 0, 0, 1, 0 ], [ 0, 1, 0, 0 ], [ 1, 0, 0, 1 ], [128X[104X
    [4X[28X  [ 1, 0, 1, 0 ], [ 1, 2, 0, 0 ], [ 2, 0, 0, 1 ], [ 2, 0, 1, 0 ], [128X[104X
    [4X[28X  [ 2, 2, 0, 0 ], [ 3, 0, 0, 0 ], [ 4, 0, 0, 0 ], [ 5, 1, 0, 0 ] ][128X[104X
  [4X[32X[104X
  
  [1X11.1-6 Gaps[101X
  
  [33X[1;0Y[29X[2XGaps[102X( [3XS[103X ) [32X attribute[133X
  
  [33X[0;0Y[3XS[103X  is  an  affine  semigroup, the output is its set of gaps, if this set has
  finitely  many  elements.  Otherwise  the  output is 'fail' and a warning is
  raised. The procedure is inspired in [CFR18][133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27Xa:=AffineSemigroup([[1,0,0,0],[3,1,0,0],[1,2,0,0],[0,0,1,0],[127X[104X
    [4X[25X>[125X [27X[0,2,1,0],[0,1,1,0],[0,0,0,1],[0,2,0,1],[0,1,0,1],[0,3,0,0],[127X[104X
    [4X[25X>[125X [27X[0,5,0,0],[0,4,0,0]]);[127X[104X
    [4X[28X<Affine semigroup in 4 dimensional space, with 12 generators>[128X[104X
    [4X[25Xgap>[125X [27XSet(Gaps(a));[127X[104X
    [4X[28X[ [ 0, 1, 0, 0 ], [ 0, 2, 0, 0 ], [ 1, 1, 0, 0 ], [ 2, 1, 0, 0 ] ][128X[104X
    [4X[25Xgap>[125X [27Xn := AffineSemigroup([1,1],[0,1]);;[127X[104X
    [4X[25Xgap>[125X [27XGaps(n);[127X[104X
    [4X[28X#I  The given affine semigroup has infinitely many gaps[128X[104X
    [4X[28Xfail[128X[104X
  [4X[32X[104X
  
  [1X11.1-7 Genus[101X
  
  [33X[1;0Y[29X[2XGenus[102X( [3XS[103X ) [32X attribute[133X
  
  [33X[0;0Y[3XS[103X  is an affine semigroup, the output is the cardinality of its set of gaps,
  if  this set is finite. Otherwise the output is 'infinite'. The procedure is
  inspired in [CFR18][133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27Xa:=AffineSemigroup([[1,0,0,0],[3,1,0,0],[1,2,0,0],[0,0,1,0],[127X[104X
    [4X[25X>[125X [27X[0,2,1,0],[0,1,1,0],[0,0,0,1],[0,2,0,1],[0,1,0,1],[0,3,0,0],[127X[104X
    [4X[25X>[125X [27X[0,5,0,0]]);[127X[104X
    [4X[28X<Affine semigroup in 4 dimensional space, with 11 generators>[128X[104X
    [4X[25Xgap>[125X [27XGenus(a);[127X[104X
    [4X[28X7[128X[104X
    [4X[25Xgap>[125X [27Xn := AffineSemigroup([1,1],[0,1]);;[127X[104X
    [4X[25Xgap>[125X [27XGenus(n);[127X[104X
    [4X[28X#I  The given affine semigroup has infinitely many gaps[128X[104X
    [4X[28Xinfinity[128X[104X
    [4X[25Xgap>[125X [27Xlast > 10^50;[127X[104X
    [4X[28Xtrue[128X[104X
  [4X[32X[104X
  
  [1X11.1-8 PseudoFrobenius[101X
  
  [33X[1;0Y[29X[2XPseudoFrobenius[102X( [3XS[103X ) [32X attribute[133X
  
  [33X[0;0Y[3XS[103X is an affine semigroup, the output is its set of pseudo-Frobenius vectors,
  that  is,  the  gaps  [22Xg[122X of [3XS[103X such that for every nonzero element [22Xs[122X of [3XS[103X, the
  vector  [22Xg+s[122X is in [3XS[103X. The package will only find pseudo-Frobenius vectors for
  affine semigroups with a finite set of gaps.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27Xa:=AffineSemigroup([[1,0,0,0],[3,1,0,0],[1,2,0,0],[0,0,1,0],[127X[104X
    [4X[25X>[125X [27X[0,2,1,0],[0,1,1,0],[0,0,0,1],[0,2,0,1],[0,1,0,1],[0,3,0,0],[127X[104X
    [4X[25X>[125X [27X[0,5,0,0],[0,4,0,0]]);[127X[104X
    [4X[28X<Affine semigroup in 4 dimensional space, with 12 generators>[128X[104X
    [4X[25Xgap>[125X [27XPseudoFrobenius(a);[127X[104X
    [4X[28X[ [ 0, 2, 0, 0 ], [ 2, 1, 0, 0 ] ][128X[104X
  [4X[32X[104X
  
  [1X11.1-9 SpecialGaps[101X
  
  [33X[1;0Y[29X[2XSpecialGaps[102X( [3XS[103X ) [32X attribute[133X
  
  [33X[0;0Y[3XS[103X  is  an affine semigroup, the output is its set of special gaps of [3XS[103X, that
  is, the gaps [22Xg[122X of [3XS[103X such that [22X[3XS[103X∪{g}[122X is a semigroup. Special gaps can only be
  computed in the package for affine semigroups with finitely many gaps.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27Xa:=AffineSemigroup([[1,0,0,0],[3,1,0,0],[1,2,0,0],[0,0,1,0],[127X[104X
    [4X[25X>[125X [27X[0,2,1,0],[0,1,1,0],[0,0,0,1],[0,2,0,1],[0,1,0,1],[0,3,0,0],[127X[104X
    [4X[25X>[125X [27X[0,5,0,0],[0,4,0,0]]);[127X[104X
    [4X[28X<Affine semigroup in 4 dimensional space, with 12 generators>[128X[104X
    [4X[25Xgap>[125X [27XSpecialGaps(a);[127X[104X
    [4X[28X[ [ 0, 2, 0, 0 ], [ 2, 1, 0, 0 ] ][128X[104X
  [4X[32X[104X
  
  [1X11.1-10 Generators[101X
  
  [33X[1;0Y[29X[2XGenerators[102X( [3XS[103X ) [32X function[133X
  [33X[1;0Y[29X[2XGeneratorsOfAffineSemigroup[102X( [3XS[103X ) [32X function[133X
  
  [33X[0;0Y[3XS[103X is an affine semigroup, the output is a system of generators.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27Xa:=AffineSemigroup([[1,0],[0,1],[1,1]]);[127X[104X
    [4X[28X<Affine semigroup in 2 dimensional space, with 3 generators>[128X[104X
    [4X[25Xgap>[125X [27XGenerators(a);[127X[104X
    [4X[28X[ [ 0, 1 ], [ 1, 0 ], [ 1, 1 ] ][128X[104X
  [4X[32X[104X
  
  [1X11.1-11 MinimalGenerators[101X
  
  [33X[1;0Y[29X[2XMinimalGenerators[102X( [3XS[103X ) [32X function[133X
  [33X[1;0Y[29X[2XMinimalGeneratingSystem[102X( [3XS[103X ) [32X function[133X
  
  [33X[0;0Y[3XS[103X is an affine semigroup, the output is its system of minimal generators.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27Xa:=AffineSemigroup([[1,0],[0,1],[1,1]]);[127X[104X
    [4X[28X<Affine semigroup in 2 dimensional space, with 3 generators>[128X[104X
    [4X[28X  gap> MinimalGenerators(a);[128X[104X
    [4X[28X  [ [ 0, 1 ], [ 1, 0 ] ][128X[104X
    [4X[28X  [128X[104X
  [4X[32X[104X
  
  [1X11.1-12 RemoveMinimalGeneratorFromAffineSemigroup[101X
  
  [33X[1;0Y[29X[2XRemoveMinimalGeneratorFromAffineSemigroup[102X( [3Xn[103X, [3XS[103X ) [32X function[133X
  
  [33X[0;0Y[3XS[103X is an affine semigroup and [3Xn[103X is one if its minimal generators.[133X
  
  [33X[0;0YThe  output  is the affine semigroup [22X[3XS[103X ∖{[3Xn[103X}[122X ([22XS∖{n}[122X is an affine semigroup if
  and only if [22Xn[122X is a minimal generator of [22XS[122X).[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27Xa:=AffineSemigroup([2,0],[0,4]);[127X[104X
    [4X[28X<Affine semigroup in 2 dimensional space, with 2 generators>[128X[104X
    [4X[25Xgap>[125X [27Xb:=RemoveMinimalGeneratorFromAffineSemigroup([2,0],a);Generators(b);[127X[104X
    [4X[28X<Affine semigroup in 2 dimensional space, with 4 generators>[128X[104X
    [4X[28X[ [ 0, 4 ], [ 2, 4 ], [ 4, 0 ], [ 6, 0 ] ][128X[104X
  [4X[32X[104X
  
  [1X11.1-13 AddSpecialGapOfAffineSemigroup[101X
  
  [33X[1;0Y[29X[2XAddSpecialGapOfAffineSemigroup[102X( [3Xg[103X, [3XS[103X ) [32X function[133X
  
  [33X[0;0Y[3XS[103X is an semigroup and [3Xg[103X is a special gap of [3XS[103X.[133X
  
  [33X[0;0YThe  output  is the numerical semigroup [22X[3XS[103X ∪{[3Xg[103X}[122X (see [RGSGGJM03], where it is
  explained why this set is a numerical semigroup).[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27Xs:=AffineSemigroup([[2,0],[3,0],[0,4],[0,5],[1,1]]);[127X[104X
    [4X[28X<Affine semigroup in 2 dimensional space, with 5 generators>[128X[104X
    [4X[25Xgap>[125X [27Xt:=AddSpecialGapOfAffineSemigroup([1,12],s);[127X[104X
    [4X[28X<Affine semigroup in 2 dimensional space, with 6 generators>[128X[104X
    [4X[25Xgap>[125X [27XGaps(s);[127X[104X
    [4X[28X[ [ 0, 1 ], [ 0, 2 ], [ 0, 3 ], [ 0, 6 ], [ 0, 7 ], [ 0, 11 ], [ 1, 0 ], [ 1, 2 ], [ 1, 3 ], [ 1, 4 ],[128X[104X
    [4X[28X[ 1, 7 ], [ 1, 8 ], [ 1, 12 ], [ 2, 1 ], [ 2, 3 ], [ 3, 2 ], [ 4, 3 ] ][128X[104X
    [4X[25Xgap>[125X [27XGaps(t);[127X[104X
    [4X[28X[ [ 0, 1 ], [ 0, 2 ], [ 0, 3 ], [ 0, 6 ], [ 0, 7 ], [ 0, 11 ], [ 1, 0 ], [ 1, 2 ], [ 1, 3 ], [ 1, 4 ],[128X[104X
    [4X[28X[ 1, 7 ], [ 1, 8 ], [ 2, 1 ], [ 2, 3 ], [ 3, 2 ], [ 4, 3 ] ][128X[104X
  [4X[32X[104X
  
  [1X11.1-14 AsAffineSemigroup[101X
  
  [33X[1;0Y[29X[2XAsAffineSemigroup[102X( [3XS[103X ) [32X function[133X
  
  [33X[0;0Y[3XS[103X is a numerical semigroup, the output is [3XS[103X regarded as an affine semigroup.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27Xs:=NumericalSemigroup(1310,1411,1546,1601);[127X[104X
    [4X[28X<Numerical semigroup with 4 generators>[128X[104X
    [4X[25Xgap>[125X [27XMinimalPresentationOfNumericalSemigroup(s);;time;[127X[104X
    [4X[28X2960[128X[104X
    [4X[25Xgap>[125X [27Xa:=AsAffineSemigroup(s);[127X[104X
    [4X[28X<Affine semigroup in 1 dimensional space, with 4 generators>[128X[104X
    [4X[25Xgap>[125X [27XGeneratorsOfAffineSemigroup(a);[127X[104X
    [4X[28X[ [ 1310 ], [ 1411 ], [ 1546 ], [ 1601 ] ][128X[104X
    [4X[25Xgap>[125X [27XMinimalPresentationOfAffineSemigroup(a);;time;[127X[104X
    [4X[28X237972[128X[104X
  [4X[32X[104X
  
  [33X[0;0YIf we use the package [10XSingularInterface[110X, the speed up is considerable.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XNumSgpsUseSingularInterface();[127X[104X
    [4X[28X...[128X[104X
    [4X[25Xgap>[125X [27XMinimalPresentationOfAffineSemigroup(a);;time;[127X[104X
    [4X[28X32[128X[104X
  [4X[32X[104X
  
  [1X11.1-15 IsAffineSemigroup[101X
  
  [33X[1;0Y[29X[2XIsAffineSemigroup[102X( [3XAS[103X ) [32X attribute[133X
  [33X[1;0Y[29X[2XIsAffineSemigroupByGenerators[102X( [3XAS[103X ) [32X attribute[133X
  [33X[1;0Y[29X[2XIsAffineSemigroupByEquations[102X( [3XAS[103X ) [32X attribute[133X
  [33X[1;0Y[29X[2XIsAffineSemigroupByInequalities[102X( [3XAS[103X ) [32X attribute[133X
  
  [33X[0;0Y[3XAS[103X  is  an  affine semigroup and these attributes are available (their names
  should  be self explanatory). They reflect what is currently known about the
  semigroup.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27Xa1:=AffineSemigroup([[3,0],[2,1],[1,2],[0,3]]);[127X[104X
    [4X[28X<Affine semigroup in 2 dimensional space, with 4 generators>[128X[104X
    [4X[25Xgap>[125X [27XIsAffineSemigroupByEquations(a1);[127X[104X
    [4X[28Xfalse[128X[104X
    [4X[25Xgap>[125X [27XIsAffineSemigroupByGenerators(a1);[127X[104X
    [4X[28Xtrue[128X[104X
    [4X[25Xgap>[125X [27Xns := NumericalSemigroup(3,5);[127X[104X
    [4X[28X<Numerical semigroup with 2 generators>[128X[104X
    [4X[25Xgap>[125X [27XIsAffineSemigroup(ns);[127X[104X
    [4X[28Xfalse[128X[104X
    [4X[25Xgap>[125X [27Xas := AsAffineSemigroup(ns);[127X[104X
    [4X[28X<Affine semigroup in 1 dimensional space, with 2 generators>[128X[104X
    [4X[25Xgap>[125X [27XIsAffineSemigroup(as);[127X[104X
    [4X[28Xtrue[128X[104X
  [4X[32X[104X
  
  [1X11.1-16 BelongsToAffineSemigroup[101X
  
  [33X[1;0Y[29X[2XBelongsToAffineSemigroup[102X( [3Xv[103X, [3Xa[103X ) [32X function[133X
  [33X[1;0Y[29X[2X\in[102X( [3Xv[103X, [3Xa[103X ) [32X operation[133X
  
  [33X[0;0Y[3Xv[103X  is a list of nonnegative integers and [3Xa[103X an affine semigroup. Returns true
  if the vector is in the semigroup, and false otherwise.[133X
  
  [33X[0;0YIf  the  semigroup  is  full and its equations are known (either because the
  semigroup  was  defined  by  equations,  or  because  the  user  has  called
  [10XIsFullAffineSemgiroup(a)[110X  and  the  output  was  true),  then  membership is
  performed  by  evaluating  [3Xv[103X  in  the  equations.  The same holds for normal
  semigroups  and  its defining inequalities. If the set of gaps is finite and
  known,  then membership is just checking that [3Xv[103X has nonnegative integers and
  it is not in the set of gaps.[133X
  
  [33X[0;0Y[3X v in a[103X can be used for short.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27Xa:=AffineSemigroup([[2,0],[0,2],[1,1]]);;[127X[104X
    [4X[25Xgap>[125X [27XBelongsToAffineSemigroup([5,5],a);[127X[104X
    [4X[28Xtrue[128X[104X
    [4X[25Xgap>[125X [27XBelongsToAffineSemigroup([1,2],a);[127X[104X
    [4X[28Xfalse[128X[104X
    [4X[25Xgap>[125X [27X[5,5] in a;[127X[104X
    [4X[28Xtrue[128X[104X
    [4X[25Xgap>[125X [27X[1,2] in a;[127X[104X
    [4X[28Xfalse[128X[104X
  [4X[32X[104X
  
  [1X11.1-17 IsFull[101X
  
  [33X[1;0Y[29X[2XIsFull[102X( [3XS[103X ) [32X property[133X
  [33X[1;0Y[29X[2XIsFullAffineSemigroup[102X( [3XS[103X ) [32X property[133X
  
  [33X[0;0Y[3XS[103X is an affine semigroup.[133X
  
  [33X[0;0YReturns  true  if  the  semigroup is full, false otherwise. The semigroup is
  full  if whenever [22Xa,b∈ S[122X and [22Xb-a∈ N^k[122X, then [22Xa-b∈ S[122X, where [22Xk[122X is the dimension
  of [22XS[122X.[133X
  
  [33X[0;0YIf the semigroup is full, then its equations are stored in the semigroup for
  further use.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27Xa:=AffineSemigroup("equations",[[[1,1,1],[0,0,2]],[2,2]]);;[127X[104X
    [4X[25Xgap>[125X [27XIsFull(a);[127X[104X
    [4X[28Xtrue[128X[104X
    [4X[25Xgap>[125X [27XIsFullAffineSemigroup(a);[127X[104X
    [4X[28Xtrue[128X[104X
  [4X[32X[104X
  
  [1X11.1-18 HilbertBasisOfSystemOfHomogeneousEquations[101X
  
  [33X[1;0Y[29X[2XHilbertBasisOfSystemOfHomogeneousEquations[102X( [3Xls[103X, [3Xm[103X ) [32X operation[133X
  
  [33X[0;0Y[3Xls[103X  is a list of lists of integers and [3Xm[103X a list of integers. The elements of
  [3Xls[103X  represent  the  rows  of  a matrix [22XA[122X. The output is a minimal generating
  system  (Hilbert  basis)  of the set of nonnegative integer solutions of the
  system  [22XAx=0[122X where the [22Xk[122X first equations are in the congruences modulo [3Xm[i][103X,
  with [22Xk[122X the length of [3Xm[103X.[133X
  
  [33X[0;0YIf  the  package [10XNormalizInterface[110X has not been loaded, then Contejean-Devie
  algorithm  is  used  [CD94]  instead  (if  this is the case, congruences are
  treated as in [RGS98]).[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XHilbertBasisOfSystemOfHomogeneousEquations([[1,0,1],[0,1,-1]],[2]);[127X[104X
    [4X[28X[ [ 0, 2, 2 ], [ 1, 1, 1 ], [ 2, 0, 0 ] ][128X[104X
  [4X[32X[104X
  
  [33X[0;0YIf  [22XC[122X  is a pointed cone (a cone in [22XQ^k[122X not containing lines and [22X0∈ C[122X), then
  [22XS=C∩  N^k[122X  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  [22XS[122X can be defined as the set of nonnegative
  integer solutions to [22XAx ge 0[122X.[133X
  
  [1X11.1-19 HilbertBasisOfSystemOfHomogeneousInequalities[101X
  
  [33X[1;0Y[29X[2XHilbertBasisOfSystemOfHomogeneousInequalities[102X( [3Xls[103X ) [32X operation[133X
  
  [33X[0;0Y[3Xls[103X  is a list of lists of integers. The elements of [3Xls[103X represent the rows of
  a matrix [22XA[122X. The output is a minimal generating system (Hilbert basis) of the
  set of nonnegative integer solutions to [22XAxge 0[122X.[133X
  
  [33X[0;0YIf  the  package [10XNormalizInterface[110X has not been loaded, then Contejean-Devie
  algorithm is used [CD94] instead (the use of slack variables is described in
  [CAGGB02]).[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XHilbertBasisOfSystemOfHomogeneousInequalities([[2,-3],[0,1]]);[127X[104X
    [4X[28X[ [ 1, 0 ], [ 2, 1 ], [ 3, 2 ] ][128X[104X
  [4X[32X[104X
  
  [1X11.1-20 EquationsOfGroupGeneratedBy[101X
  
  [33X[1;0Y[29X[2XEquationsOfGroupGeneratedBy[102X( [3XM[103X ) [32X function[133X
  
  [33X[0;0Y[3XM[103X  is  a  matrix of integers. The output is a pair [22X[A,m][122X that represents the
  set  of  defining  equations  of  the  group spanned by the rows of [3XM[103X: [22XAx=0∈
  Z_n_1× ⋯ × Z_n_t× Z^k[122X, with [22Xm=[n_1,...,n_t][122X.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XEquationsOfGroupGeneratedBy([[1,2,0],[2,-2,2]]);[127X[104X
    [4X[28X[ [ [ 0, 0, -1 ], [ -2, 1, 3 ] ], [ 2 ] ][128X[104X
  [4X[32X[104X
  
  [1X11.1-21 BasisOfGroupGivenByEquations[101X
  
  [33X[1;0Y[29X[2XBasisOfGroupGivenByEquations[102X( [3XA[103X, [3Xm[103X ) [32X function[133X
  
  [33X[0;0Y[3XA[103X  is  a matrix of integers and [3Xm[103X is a list of positive integers. The output
  is  a  basis  for  the group with defining equations [22XAx=0∈ Z_n_1× ⋯ × Z_n_t×
  Z^k[122X, with [22Xm=[n_1,...,n_t][122X.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XBasisOfGroupGivenByEquations([[0,0,1],[2,-1,-3]],[2]);[127X[104X
    [4X[28X[ [ -1, -2, 0 ], [ -2, 2, -2 ] ][128X[104X
  [4X[32X[104X
  
  
  [1X11.2 [33X[0;0YGluings of affine semigroups[133X[101X
  
  [33X[0;0YLet  [22XS_1[122X  and [22XS_2[122X be two affine semigroups with the same dimension generated
  by  [22XA_1[122X  and [22XA_2[122X, respectively. We say that the affine semigroup [22XS[122X generated
  by the union of [22XA_1[122X and [22XA_2[122X is a gluing of [22XS_1[122X and [22XS_2[122X if [22XG(S_1)∩ G(S_2)=d Z[122X
  ([22XG(⋅)[122X stands for group spanned by) for some [22Xd∈ S_1∩ S_2[122X.[133X
  
  [33X[0;0YThe algorithm used is explained in [RGS99a].[133X
  
  [1X11.2-1 GluingOfAffineSemigroups[101X
  
  [33X[1;0Y[29X[2XGluingOfAffineSemigroups[102X( [3Xa1[103X, [3Xa2[103X ) [32X function[133X
  
  [33X[0;0Y[3Xa1,  a2[103X  are  affine semigroups. Determines if they can be glued, and if so,
  returns the gluing. Otherwise it returns fail.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27Xa1:=AffineSemigroup([[2,0],[0,2]]);[127X[104X
    [4X[28X<Affine semigroup in 2 dimensional space, with 2 generators>[128X[104X
    [4X[25Xgap>[125X [27Xa2:=AffineSemigroup([[1,1]]);[127X[104X
    [4X[28X<Affine semigroup in 2 dimensional space, with 1 generators>[128X[104X
    [4X[25Xgap>[125X [27XGluingOfAffineSemigroups(a1,a2);[127X[104X
    [4X[28X<Affine semigroup in 2 dimensional space, with 3 generators>[128X[104X
    [4X[25Xgap>[125X [27XGenerators(last);[127X[104X
    [4X[28X[ [ 0, 2 ], [ 1, 1 ], [ 2, 0 ] ][128X[104X
  [4X[32X[104X
  
  
  [1X11.3 [33X[0;0YPresentations of affine semigroups[133X[101X
  
  [33X[0;0YA  [13Xminimal presentation[113X of an affine semigroup is defined analogously as for
  numerical  semigroups  (see  Chapter  [14X9.7-2[114X).  We warn the user to take into
  account  that  minimal  generators  are  stored  in a set, and thus might be
  arranged  in  a  different  way  to  the initial input. If a presentation is
  needed  with  a  certain arrangment in the set of generators, or some of the
  generators  are  not  necessarily minimal, then [2XGeneratorsOfKernelCongruence[102X
  ([14X11.3-1[114X) is recommended.[133X
  
  [1X11.3-1 GeneratorsOfKernelCongruence[101X
  
  [33X[1;0Y[29X[2XGeneratorsOfKernelCongruence[102X( [3XM[103X ) [32X operation[133X
  
  [33X[0;0Y[3XM[103X is matrix with nonnegative integer coefficients. The output is a system of
  generators of the congruence [22X{(x,y)∣ xM=yM}[122X.[133X
  
  [33X[0;0YThe  main  difference  with [2XMinimalPresentationOfAffineSemigroup[102X ([14X11.3-4[114X) is
  that  the  matrix [3XM[103X can have repeated columns and these are not treated as a
  set.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XM := [[2,0],[0,2],[1,1]];[127X[104X
    [4X[28X[ [ 2, 0 ], [ 0, 2 ], [ 1, 1 ] ][128X[104X
    [4X[25Xgap>[125X [27XGeneratorsOfKernelCongruence(M);[127X[104X
    [4X[28X[ [ [ 0, 0, 2 ], [ 1, 1, 0 ] ] ][128X[104X
  [4X[32X[104X
  
  [1X11.3-2 CanonicalBasisOfKernelCongruence[101X
  
  [33X[1;0Y[29X[2XCanonicalBasisOfKernelCongruence[102X( [3XM[103X, [3XOrd[103X ) [32X operation[133X
  
  [33X[0;0Y[3XM[103X  is matrix with nonnegative integer coefficients, [3XOrd[103X a term ordering. The
  output is a canonical basis of the congruence [22X{(x,y)∣ xM=yM}[122X (see [RGS99b]).
  This corresponds with the exponents of the Gröbner basis of the kernel ideal
  of the morphism [22Xx_i↦ Y^m_i[122X, with [22Xm_i[122X the [22Xi[122Xth row of [22XM[122X.[133X
  
  [33X[0;0YAccepted  term  orderings  are lexicographic ([10XMonomialLexOrdering()[110X), graded
  lexicographic  ([3XMonomialGrlexOrdering()[103X)  and  reversed graded lexicographic
  ([3XMonomialGrevlexOrdering()[103X).[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XM:=[[3],[5],[7]];;[127X[104X
    [4X[25Xgap>[125X [27XCanonicalBasisOfKernelCongruence(M,MonomialLexOrdering());[127X[104X
    [4X[28X[ [ [ 0, 7, 0 ], [ 0, 0, 5 ] ], [ [ 1, 0, 1 ], [ 0, 2, 0 ] ],[128X[104X
    [4X[28X  [ [ 1, 5, 0 ], [ 0, 0, 4 ] ], [ [ 2, 3, 0 ], [ 0, 0, 3 ] ],[128X[104X
    [4X[28X  [ [ 3, 1, 0 ], [ 0, 0, 2 ] ], [ [ 4, 0, 0 ], [ 0, 1, 1 ] ] ][128X[104X
    [4X[25Xgap>[125X [27XCanonicalBasisOfKernelCongruence(M,MonomialGrlexOrdering());[127X[104X
    [4X[28X[ [ [ 0, 7, 0 ], [ 0, 0, 5 ] ], [ [ 1, 0, 1 ], [ 0, 2, 0 ] ],[128X[104X
    [4X[28X  [ [ 1, 5, 0 ], [ 0, 0, 4 ] ], [ [ 2, 3, 0 ], [ 0, 0, 3 ] ],[128X[104X
    [4X[28X  [ [ 3, 1, 0 ], [ 0, 0, 2 ] ], [ [ 4, 0, 0 ], [ 0, 1, 1 ] ] ][128X[104X
    [4X[25Xgap>[125X [27XCanonicalBasisOfKernelCongruence(M,MonomialGrevlexOrdering());[127X[104X
    [4X[28X[ [ [ 0, 2, 0 ], [ 1, 0, 1 ] ], [ [ 3, 1, 0 ], [ 0, 0, 2 ] ],[128X[104X
    [4X[28X  [ [ 4, 0, 0 ], [ 0, 1, 1 ] ] ][128X[104X
  [4X[32X[104X
  
  [1X11.3-3 GraverBasis[101X
  
  [33X[1;0Y[29X[2XGraverBasis[102X( [3XM[103X ) [32X operation[133X
  
  [33X[0;0Y[3XM[103X is matrix with integer coefficients. The output is a Graver basis for [3XM[103X.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27Xgr:=GraverBasis([[3,5,7]]);[127X[104X
    [4X[28X[ [ -7, 0, 3 ], [ -5, 3, 0 ], [ -4, 1, 1 ], [ -3, -1, 2 ], [ -2, -3, 3 ],[128X[104X
    [4X[28X  [ -1, -5, 4 ], [ -1, 2, -1 ], [ 0, -7, 5 ], [ 0, 7, -5 ], [ 1, -2, 1 ],[128X[104X
    [4X[28X  [ 1, 5, -4 ], [ 2, 3, -3 ], [ 3, 1, -2 ], [ 4, -1, -1 ], [ 5, -3, 0 ],[128X[104X
    [4X[28X  [ 7, 0, -3 ] ][128X[104X
  [4X[32X[104X
  
  [1X11.3-4 MinimalPresentation[101X
  
  [33X[1;0Y[29X[2XMinimalPresentation[102X( [3Xa[103X ) [32X operation[133X
  [33X[1;0Y[29X[2XMinimalPresentationOfAffineSemigroup[102X( [3Xa[103X ) [32X operation[133X
  
  [33X[0;0Y[3Xa[103X is an affine semigroup. The output is a minimal presentation for [3Xa[103X.[133X
  
  [33X[0;0YThere  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  achieved  when  [10XSingularInterface[110X  is  loaded, followed by [10XSingular[110X. 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 generating binomials must be refined, and
  for  this  Rclasses  are  used  (if  [10XNormalizInterface[110X  is  loaded, then the
  factorizations  are  faster).  The  [10X4ti2[110X  implementation  uses [10X4ti2[110X internal
  Gröbner bases and factorizations are done via [10Xzsolve[110X.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27Xa:=AffineSemigroup([2,0],[0,2],[1,1]);;[127X[104X
    [4X[25Xgap>[125X [27XMinimalPresentation(a);[127X[104X
    [4X[28X[ [ [ 0, 2, 0 ], [ 1, 0, 1 ] ] ][128X[104X
    [4X[25Xgap>[125X [27XMinimalPresentationOfAffineSemigroup(a);[127X[104X
    [4X[28X[ [ [ 0, 2, 0 ], [ 1, 0, 1 ] ] ][128X[104X
  [4X[32X[104X
  
  [1X11.3-5 BettiElements[101X
  
  [33X[1;0Y[29X[2XBettiElements[102X( [3Xa[103X ) [32X operation[133X
  [33X[1;0Y[29X[2XBettiElementsOfAffineSemigroup[102X( [3Xa[103X ) [32X operation[133X
  
  [33X[0;0Y[3Xa[103X  is  an  affine  semigroup.  The  output is the set of Betti elements of [3Xa[103X
  (defined as for numerical semigroups).[133X
  
  [33X[0;0YThis function relies on the computation of a minimal presentation.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27Xa:=AffineSemigroup([2,0],[0,2],[1,1]);;[127X[104X
    [4X[25Xgap>[125X [27XBettiElements(a);[127X[104X
    [4X[28X[ [ 2, 2 ] ][128X[104X
    [4X[25Xgap>[125X [27XBettiElementsOfAffineSemigroup(a);[127X[104X
    [4X[28X[ [ 2, 2 ] ][128X[104X
  [4X[32X[104X
  
  [1X11.3-6 ShadedSetOfElementInAffineSemigroup[101X
  
  [33X[1;0Y[29X[2XShadedSetOfElementInAffineSemigroup[102X( [3Xv[103X, [3Xa[103X ) [32X function[133X
  
  [33X[0;0Y[3Xa[103X  is an affine semigroup and [3Xv[103X is an element in [3Xa[103X. This is a translation to
  affine semigroups of [10XShadedSetOfElementInNumericalSemigroup[110X ([14X4.1-5[114X).[133X
  
  [1X11.3-7 IsGeneric[101X
  
  [33X[1;0Y[29X[2XIsGeneric[102X( [3Xa[103X ) [32X property[133X
  [33X[1;0Y[29X[2XIsGenericAffineSemigroup[102X( [3Xa[103X ) [32X property[133X
  
  [33X[0;0Y[3Xa[103X is an affine semigroup.[133X
  
  [33X[0;0YThe same as [10XIsGenericNumericalSemigroup[110X ([14X4.2-2[114X) but for affine semigroups.[133X
  
  [33X[0;0YThis property implies [2XIsUniquelyPresentedAffineSemigroup[102X ([14X11.3-8[114X).[133X
  
  [1X11.3-8 IsUniquelyPresented[101X
  
  [33X[1;0Y[29X[2XIsUniquelyPresented[102X( [3Xa[103X ) [32X property[133X
  [33X[1;0Y[29X[2XIsUniquelyPresentedAffineSemigroup[102X( [3Xa[103X ) [32X property[133X
  
  [33X[0;0Y[3Xa[103X is an affine semigroup.[133X
  
  [33X[0;0YThe  same  as the homonym function for numerical semigroups ([14X4.2-1[114X), but for
  affine semigroups.[133X
  
  [1X11.3-9 DegreesOfPrimitiveElementsOfAffineSemigroup[101X
  
  [33X[1;0Y[29X[2XDegreesOfPrimitiveElementsOfAffineSemigroup[102X( [3Xa[103X ) [32X operation[133X
  
  [33X[0;0Y[3Xa[103X  is  an affine semigroup. The output is the set of primitive elements of [3Xa[103X
  (defined as for numerical semigroups).[133X
  
  [33X[0;0YThis  function  has  three implementations (methods), one using Graver basis
  via   the   Lawrence  lifting  of  [3Xa[103X  and  the  other  (much  faster)  using
  [10XNormalizInterface[110X. Also a [10X4ti2[110X version using its Graver basis computation is
  provided.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27Xa:=AffineSemigroup([2,0],[0,2],[1,1]);;[127X[104X
    [4X[25Xgap>[125X [27XDegreesOfPrimitiveElementsOfAffineSemigroup(a);[127X[104X
    [4X[28X[ [ 0, 2 ], [ 1, 1 ], [ 2, 0 ], [ 2, 2 ] ][128X[104X
  [4X[32X[104X
  
  
  [1X11.4 [33X[0;0YFactorizations in affine semigroups[133X[101X
  
  [33X[0;0YThe  invariants  presented  here  are  defined  as  for numerical semigroups
  (Chapter [14X9.[114X).[133X
  
  [33X[0;0YAs  with  presentations,  the  user  should  take  into account that minimal
  generators  are  stored  in a set, and thus might be arranged in a different
  way to the initial input.[133X
  
  [1X11.4-1 FactorizationsVectorWRTList[101X
  
  [33X[1;0Y[29X[2XFactorizationsVectorWRTList[102X( [3Xv[103X, [3Xls[103X ) [32X operation[133X
  
  [33X[0;0Y[3Xv[103X is a list of nonnegative integers and [3Xls[103X is a list of lists of nonnegative
  integers.  The output is set of factorizations of [3Xv[103X in terms of the elements
  of [3Xls[103X.[133X
  
  [33X[0;0YIf no extra package is loaded, then factorizations are computed recursively;
  and  thus slowly. If [10XNormalizInterface[110X is loaded, then a system of equations
  is   solved   with   Normaliz,  and  the  performance  is  much  better.  If
  [10X4ti2Interface[110X  is  loaded  instead, then factorizations are calculated using
  [10Xzsolve[110X command of [10X4ti2[110X.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XFactorizationsVectorWRTList([5,5],[[2,0],[0,2],[1,1]]);[127X[104X
    [4X[28X[ [ 2, 2, 1 ], [ 1, 1, 3 ], [ 0, 0, 5 ] ][128X[104X
  [4X[32X[104X
  
  [1X11.4-2 Factorizations[101X
  
  [33X[1;0Y[29X[2XFactorizations[102X( [3Xv[103X, [3Xa[103X ) [32X operation[133X
  [33X[1;0Y[29X[2XFactorizations[102X( [3Xa[103X, [3Xv[103X ) [32X operation[133X
  
  [33X[0;0Y[3Xv[103X is a list of nonnegative integers and [3Xa[103X is an affine semigroup. The output
  is set of factorizations of [3Xv[103X in terms of the minimal generators of of [3Xa[103X.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27Xa:=AffineSemigroup([[2,0],[0,2],[1,1]]);[127X[104X
    [4X[28X<Affine semigroup in 2 dimensional space, with 3 generators>[128X[104X
    [4X[25Xgap>[125X [27XFactorizations([5,5],a);[127X[104X
    [4X[28X[ [ 2, 1, 2 ], [ 1, 3, 1 ], [ 0, 5, 0 ] ][128X[104X
    [4X[25Xgap>[125X [27XFactorizations(a,[5,5]);[127X[104X
    [4X[28X[ [ 2, 1, 2 ], [ 1, 3, 1 ], [ 0, 5, 0 ] ][128X[104X
    [4X[25Xgap>[125X [27XMinimalGenerators(a);[127X[104X
    [4X[28X[ [ 0, 2 ], [ 1, 1 ], [ 2, 0 ] ][128X[104X
  [4X[32X[104X
  
  [1X11.4-3 Elasticity[101X
  
  [33X[1;0Y[29X[2XElasticity[102X( [3Xn[103X, [3Xa[103X ) [32X operation[133X
  [33X[1;0Y[29X[2XElasticity[102X( [3Xa[103X, [3Xn[103X ) [32X operation[133X
  [33X[1;0Y[29X[2XElasticityOfFactorizationsElementWRTAffineSemigroup[102X( [3Xn[103X, [3Xa[103X ) [32X function[133X
  
  [33X[0;0Y[3Xa[103X  is  an  affine semigroup and [3Xn[103X an element of [3Xa[103X. The output is the maximum
  length  divided by the minimum length of the factorizations of [3Xn[103X in terms of
  the minimal generating set of [3Xa[103X.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27Xa:=AffineSemigroup([[2,0],[0,2],[1,1]]);;[127X[104X
    [4X[25Xgap>[125X [27XElasticity([5,5],a);[127X[104X
    [4X[28X1[128X[104X
    [4X[25Xgap>[125X [27XElasticity(a,[5,5]);[127X[104X
    [4X[28X1[128X[104X
    [4X[25Xgap>[125X [27XElasticityOfFactorizationsElementWRTAffineSemigroup([5,5],a);[127X[104X
    [4X[28X1[128X[104X
  [4X[32X[104X
  
  [1X11.4-4 Elasticity[101X
  
  [33X[1;0Y[29X[2XElasticity[102X( [3Xa[103X ) [32X operation[133X
  [33X[1;0Y[29X[2XElasticityOfAffineSemigroup[102X( [3Xa[103X ) [32X operation[133X
  
  [33X[0;0Y[3Xa[103X  is an affine semigroup. The output is the elasticity of [3Xa[103X (defined as for
  numerical semigroups).[133X
  
  [33X[0;0YThe  procedure  used  is  based  on  [Phi10],  where  it  is  shown that the
  elasticity  can  be  computed  by  using  circuits.  The  set of circuits is
  calculated using [ES96].[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27Xa:=AffineSemigroup([2,0],[0,2],[1,1]);;[127X[104X
    [4X[25Xgap>[125X [27XElasticity(a);[127X[104X
    [4X[28X1[128X[104X
    [4X[25Xgap>[125X [27XElasticityOfAffineSemigroup(a);[127X[104X
    [4X[28X1[128X[104X
  [4X[32X[104X
  
  [1X11.4-5 DeltaSet[101X
  
  [33X[1;0Y[29X[2XDeltaSet[102X( [3Xa[103X ) [32X operation[133X
  [33X[1;0Y[29X[2XDeltaSetOfAffineSemigroup[102X( [3Xa[103X ) [32X function[133X
  
  [33X[0;0Y[3Xa[103X  is  an affine semigroup. The output is the Delta set of [3Xa[103X (defined as for
  numerical semigroups). The the procedure used is explained in [GSOW17].[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27Xa:=AffineSemigroup([2,0],[0,2],[1,1]);;[127X[104X
    [4X[25Xgap>[125X [27XDeltaSet(a);[127X[104X
    [4X[28X[  ][128X[104X
    [4X[25Xgap>[125X [27Xs:=NumericalSemigroup(10,13,15,47);;[127X[104X
    [4X[25Xgap>[125X [27Xa:=AsAffineSemigroup(s);;[127X[104X
    [4X[25Xgap>[125X [27XDeltaSetOfAffineSemigroup(a);[127X[104X
    [4X[28X[ 1, 2, 3, 5 ][128X[104X
  [4X[32X[104X
  
  [1X11.4-6 CatenaryDegree[101X
  
  [33X[1;0Y[29X[2XCatenaryDegree[102X( [3Xa[103X ) [32X operation[133X
  [33X[1;0Y[29X[2XCatenaryDegreeOfAffineSemigroup[102X( [3Xa[103X ) [32X function[133X
  
  [33X[0;0Y[3Xa[103X is an affine semigroup. The output is the catenary degree of [3Xa[103X (defined as
  for numerical semigroups).[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27Xa:=AffineSemigroup([2,0],[0,2],[1,1]);;[127X[104X
    [4X[25Xgap>[125X [27XCatenaryDegree(a);[127X[104X
    [4X[28X2[128X[104X
    [4X[25Xgap>[125X [27XCatenaryDegreeOfAffineSemigroup(a);[127X[104X
    [4X[28X2[128X[104X
  [4X[32X[104X
  
  [1X11.4-7 EqualCatenaryDegreeOfAffineSemigroup[101X
  
  [33X[1;0Y[29X[2XEqualCatenaryDegreeOfAffineSemigroup[102X( [3Xa[103X ) [32X function[133X
  
  [33X[0;0Y[3Xa[103X  is  an  affine  semigroup.  The  output is the equal catenary degree of [3Xa[103X
  (defined as for numerical semigroups).[133X
  
  [33X[0;0YThis function relies on the results presented in [GSOSRN13].[133X
  
  [1X11.4-8 HomogeneousCatenaryDegreeOfAffineSemigroup[101X
  
  [33X[1;0Y[29X[2XHomogeneousCatenaryDegreeOfAffineSemigroup[102X( [3Xa[103X ) [32X function[133X
  
  [33X[0;0Y[3Xa[103X is an affine semigroup. The output is the homogeneous catenary degree of [3Xa[103X
  (defined as for numerical semigroups).[133X
  
  [33X[0;0YThis function is based on [GSOSRN13].[133X
  
  [1X11.4-9 MonotoneCatenaryDegreeOfAffineSemigroup[101X
  
  [33X[1;0Y[29X[2XMonotoneCatenaryDegreeOfAffineSemigroup[102X( [3Xa[103X ) [32X function[133X
  
  [33X[0;0Y[3Xa[103X  is  an  affine semigroup. The output is the monotone catenary degree of [3Xa[103X
  (defined as for numerical semigroups), computed as explained in [Phi10].[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27Xa:=AffineSemigroup("inequalities",[[2,-1],[-1,3]]);[127X[104X
    [4X[28X<Affine semigroup>[128X[104X
    [4X[25Xgap>[125X [27XGeneratorsOfAffineSemigroup(a);[127X[104X
    [4X[28X[ [ 1, 1 ], [ 1, 2 ], [ 2, 1 ], [ 3, 1 ] ][128X[104X
    [4X[25Xgap>[125X [27XCatenaryDegreeOfAffineSemigroup(a);[127X[104X
    [4X[28X3[128X[104X
    [4X[25Xgap>[125X [27XEqualCatenaryDegreeOfAffineSemigroup(a);[127X[104X
    [4X[28X2[128X[104X
    [4X[25Xgap>[125X [27XHomogeneousCatenaryDegreeOfAffineSemigroup(a);[127X[104X
    [4X[28X3[128X[104X
    [4X[25Xgap>[125X [27XMonotoneCatenaryDegreeOfAffineSemigroup(a);[127X[104X
    [4X[28X3[128X[104X
  [4X[32X[104X
  
  [1X11.4-10 TameDegree[101X
  
  [33X[1;0Y[29X[2XTameDegree[102X( [3Xa[103X ) [32X operation[133X
  [33X[1;0Y[29X[2XTameDegreeOfAffineSemigroup[102X( [3Xa[103X ) [32X operation[133X
  
  [33X[0;0Y[3Xa[103X is an affine semigroup. The output is the tame degree of [3Xa[103X (defined as for
  numerical  semigroups).  If  [3Xa[103X  is  given by equations (or its equations are
  known), then the procedure explained in [GSOW17] is used.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27Xa:=AffineSemigroup([2,0],[0,2],[1,1]);;[127X[104X
    [4X[25Xgap>[125X [27XTameDegree(a);[127X[104X
    [4X[28X2[128X[104X
    [4X[25Xgap>[125X [27XTameDegreeOfAffineSemigroup(a);[127X[104X
    [4X[28X2[128X[104X
  [4X[32X[104X
  
  [1X11.4-11 OmegaPrimality[101X
  
  [33X[1;0Y[29X[2XOmegaPrimality[102X( [3Xv[103X, [3Xa[103X ) [32X operation[133X
  [33X[1;0Y[29X[2XOmegaPrimality[102X( [3Xa[103X, [3Xv[103X ) [32X operation[133X
  [33X[1;0Y[29X[2XOmegaPrimalityOfElementInAffineSemigroup[102X( [3Xv[103X, [3Xa[103X ) [32X operation[133X
  
  [33X[0;0Y[3Xv[103X is a list of nonnegative integers and [3Xa[103X is an affine semigroup. The output
  is the omega primality of [3Xa[103X (defined as for numerical semigroups). Returns 0
  if the element is not in the semigroup.[133X
  
  [33X[0;0YThe  implementation  of this procedure is performed as explained in [BGSG11]
  (also,  if  the semigroup has defining equations, then it takes advantage of
  this fact as explained in this reference).[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27Xa:=AffineSemigroup([2,0],[0,2],[1,1]);;[127X[104X
    [4X[25Xgap>[125X [27XOmegaPrimality(a,[5,5]);[127X[104X
    [4X[28X6[128X[104X
    [4X[25Xgap>[125X [27XOmegaPrimality([5,5],a);[127X[104X
    [4X[28X6[128X[104X
    [4X[25Xgap>[125X [27XOmegaPrimalityOfElementInAffineSemigroup([5,5],a);[127X[104X
    [4X[28X6[128X[104X
  [4X[32X[104X
  
  [1X11.4-12 OmegaPrimality[101X
  
  [33X[1;0Y[29X[2XOmegaPrimality[102X( [3Xa[103X ) [32X operation[133X
  [33X[1;0Y[29X[2XOmegaPrimalityOfAffineSemigroup[102X( [3Xa[103X ) [32X function[133X
  
  [33X[0;0Y[3Xa[103X is an affine semigroup. The output is the omega primality of [3Xa[103X (defined as
  for numerical semigroups).[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27Xa:=AffineSemigroup([2,0],[0,2],[1,1]);;[127X[104X
    [4X[25Xgap>[125X [27XOmegaPrimality(a);[127X[104X
    [4X[28X2[128X[104X
    [4X[25Xgap>[125X [27XOmegaPrimalityOfAffineSemigroup(a);[127X[104X
    [4X[28X2[128X[104X
  [4X[32X[104X
  
