  
  [1X2 [33X[0;0YNumerical Semigroups[133X[101X
  
  [33X[0;0YThis chapter describes how to create numerical semigroups in [5XGAP[105X and perform
  some basic tests.[133X
  
  
  [1X2.1 [33X[0;0YGenerating Numerical Semigroups[133X[101X
  
  [33X[0;0YRecalling some definitions from Chapter [14X1[114X.[133X
  
  [33X[0;0YA  numerical semigroup is a subset of the set [22XN[122X of nonnegative integers that
  is closed under addition, contains [22X0[122X and whose complement in [22XN[122X is finite.[133X
  
  [33X[0;0YWe  refer  to  the  elements  in a numerical semigroup that are less than or
  equal to the conductor as [13Xsmall elements[113X of the semigroup.[133X
  
  [33X[0;0YA  [13Xgap[113X  of a numerical semigroup [22XS[122X is a nonnegative integer not belonging to
  [22XS[122X. The [13Xfundamental gaps[113X of [22XS[122X are those gaps that are maximal with respect to
  the partial order induced by division in [22XN[122X.[133X
  
  [33X[0;0YGiven  a  numerical  semigroup  [22XS[122X  and  a  nonzero  element [22Xs[122X in it, one can
  consider  for every integer [22Xi[122X ranging from [22X0[122X to [22Xs-1[122X, the smallest element in
  [22XS[122X  congruent  with  [22Xi[122X  modulo  [22Xs[122X,  say  [22Xw(i)[122X  (this element exists since the
  complement  of  [22XS[122X  in  [22XN[122X  is  finite).  Clearly  [22Xw(0)=0[122X.  The  set [22XAp(S,s)={
  w(0),w(1),..., w(s-1)}[122X is called the [13XApéry set[113X of [22XS[122X with respect to [22Xs[122X.[133X
  
  [33X[0;0YLet  [22Xa,b,c,d[122X  be positive integers such that [22Xa/b < c/d[122X, and let [22XI=[a/b,c/d][122X.
  Then  the  set  [22XS(I)=  N∩ ⋃_n≥ 0 n I[122X is a numerical semigroup. This class of
  numerical  semigroups  coincides with that of sets of solutions to equations
  of  the  form  [22XA  x  mod  B  ≤ C x[122X with [22XA,B,C[122X positive integers. A numerical
  semigroup in this class is said to be [13Xproportionally modular[113X. If [22XC = 1[122X, then
  it is said to be [13Xmodular[113X.[133X
  
  [33X[0;0YThere  are different ways to specify a numerical semigroup [22XS[122X, namely, by its
  generators;  by  its gaps, its fundamental or special gaps by its Apéry set,
  just to name some. In this section we describe functions that may be used to
  specify, in one of these ways, a numerical semigroup in [5XGAP[105X.[133X
  
  [33X[0;0YTo  create  a  numerical semigroup in [5XGAP[105X the function [10XNumericalSemigroup[110X is
  used.[133X
  
  [1X2.1-1 NumericalSemigroup[101X
  
  [29X[2XNumericalSemigroup[102X( [3XRepresentation[103X, [3XList[103X ) [32X function
  
  [33X[0;0Y[10XRepresentation[110X[133X
  
  [33X[0;0YMay   be   [10X"generators"[110X,   [10X"minimalgenerators"[110X,   [10X"modular"[110X,  [10X"propmodular"[110X,
  [10X"elements"[110X, [10X"gaps"[110X, [10X"fundamentalgaps"[110X, [10X"subadditive"[110X or [10X"apery"[110X according to
  whether  the  semigroup is to be given by means of a system of generators, a
  minimal  system  of  generators,  a  condition  of the form [22Xax mod m le x[122X, a
  condition  of  the  form  [22Xax  mod  mle  cx[122X,  a set of all elements up to the
  conductor,  the  set  of  gaps,  the  set  of  fundamental  gaps, a periodic
  subaditive function, or the Apéry set.[133X
  
  [33X[0;0YWhen  no  string is given as first argument it is assumed that the numerical
  semigroup will be given by means of a set of generators.[133X
  
  [33X[0;0Y[10XList[110X[133X
  
  [33X[0;0YWhen  the  semigroup  is  given through a set of generators, this set may be
  given as a list or through its individual elements.[133X
  
  [33X[0;0YThe  set  of  all  elements up to the conductor, the set of gaps, the set of
  fundamental gaps or the Apéry set are given through lists.[133X
  
  [33X[0;0YA  periodic  subadditive function with period [22Xm[122X is given through the list of
  images of the elements, from [22X1[122X to [22Xm[122X. The image of [22Xm[122X has to be [22X0[122X.[133X
  
  [33X[0;0YNumerical  semigroups  generated  by  an  interval  of positive integers and
  embedding  dimension two numerical semigroups are known to be proportionally
  modular,  and  thus  they  are  treated  as  such  (unles the representation
  "minimalgenerators"  is  specified), since membership and other problems are
  solved faster for these semigroups.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27Xs1 := NumericalSemigroup("generators",3,5,7);[127X[104X
    [4X[28X<Numerical semigroup with 3 generators>[128X[104X
    [4X[25Xgap>[125X [27Xs2 := NumericalSemigroup("generators",[3,5,7]);[127X[104X
    [4X[28X<Numerical semigroup with 3 generators>[128X[104X
    [4X[25Xgap>[125X [27Xs1=s2;[127X[104X
    [4X[28Xtrue[128X[104X
    [4X[25Xgap>[125X [27Xs := NumericalSemigroup("minimalgenerators",3,7);[127X[104X
    [4X[28X<Numerical semigroup with 2 generators>[128X[104X
    [4X[25Xgap>[125X [27Xs := NumericalSemigroup("modular",3,5);[127X[104X
    [4X[28X<Modular numerical semigroup satisfying 3x mod 5 <= x >[128X[104X
    [4X[25Xgap>[125X [27Xs1:=NumericalSemigroup("generators",2,5);       [127X[104X
    [4X[28X<Modular numerical semigroup satisfying 5x mod 10 <= x >[128X[104X
    [4X[25Xgap>[125X [27Xs = s1;[127X[104X
    [4X[28Xtrue[128X[104X
    [4X[25Xgap>[125X [27Xs:=NumericalSemigroup(4,5,6);[127X[104X
    [4X[28X<Proportionally modular numerical semigroup satisfying 6x mod 24 <= 2x >[128X[104X
  [4X[32X[104X
  
  [33X[0;0YOnce it is known that a numerical semigroup contains the element [22X1[122X, i.e. the
  semigroup is [22XN[122X, the semigroup is treated as such.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XNumericalSemigroup(1);[127X[104X
    [4X[28X<The numerical semigroup N>[128X[104X
    [4X[25Xgap>[125X [27XNumericalSemigroupByInterval(1/3,1/2);[127X[104X
    [4X[28X<The numerical semigroup N>[128X[104X
    [4X[28X [128X[104X
  [4X[32X[104X
  
  [1X2.1-2 ModularNumericalSemigroup[101X
  
  [29X[2XModularNumericalSemigroup[102X( [3Xa[103X, [3Xb[103X ) [32X function
  
  [33X[0;0YGiven  two  positive  integers  [3Xa[103X  and  [3Xb[103X,  this  function returns a modular
  numerical semigroup satisfying [22Xax mod b le x[122X.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XModularNumericalSemigroup(3,7);[127X[104X
    [4X[28X<Modular numerical semigroup satisfying 3x mod 7 <= x >[128X[104X
  [4X[32X[104X
  
  [1X2.1-3 ProportionallyModularNumericalSemigroup[101X
  
  [29X[2XProportionallyModularNumericalSemigroup[102X( [3Xa[103X, [3Xb[103X, [3Xc[103X ) [32X function
  
  [33X[0;0YGiven  three  positive  integers  [3Xa[103X,  [3Xb[103X  and  [3Xc[103X,  this  function  returns  a
  proportionally modular numerical semigroup satisfying [22Xaxmod b le cx[122X.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XProportionallyModularNumericalSemigroup(3,7,12);[127X[104X
    [4X[28X<Proportionally modular numerical semigroup satisfying 3x mod 7 <= 12x >[128X[104X
  [4X[32X[104X
  
  [33X[0;0YWhen [22Xc=1[122X, the semigroup is seen as a modular numerical semigroup.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XNumericalSemigroup("propmodular",67,98,1);         [127X[104X
    [4X[28X<Modular numerical semigroup satisfying 67x mod 98 <= x >[128X[104X
  [4X[32X[104X
  
  [1X2.1-4 NumericalSemigroupByGenerators[101X
  
  [29X[2XNumericalSemigroupByGenerators[102X( [3XList[103X ) [32X function
  [29X[2XNumericalSemigroupByMinimalGenerators[102X( [3XList[103X ) [32X function
  [29X[2XNumericalSemigroupByMinimalGeneratorsNC[102X( [3XList[103X ) [32X function
  [29X[2XNumericalSemigroupByInterval[102X( [3XList[103X ) [32X function
  [29X[2XNumericalSemigroupByOpenInterval[102X( [3XList[103X ) [32X function
  [29X[2XNumericalSemigroupBySubAdditiveFunction[102X( [3XList[103X ) [32X function
  [29X[2XNumericalSemigroupByAperyList[102X( [3XList[103X ) [32X function
  [29X[2XNumericalSemigroupBySmallElements[102X( [3XList[103X ) [32X function
  [29X[2XNumericalSemigroupByGaps[102X( [3XList[103X ) [32X function
  [29X[2XNumericalSemigroupByFundamentalGaps[102X( [3XList[103X ) [32X function
  
  [33X[0;0YThe  function [2XNumericalSemigroup[102X ([14X2.1-1[114X) is a front-end for these functions.
  The  argument of each of these functions is a list representing an entity of
  the type to which the function's name refers.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27Xs:=NumericalSemigroup(3,11);[127X[104X
    [4X[28X<Modular numerical semigroup satisfying 22x mod 33 <= x >[128X[104X
    [4X[25Xgap>[125X [27XGapsOfNumericalSemigroup(s);[127X[104X
    [4X[28X[ 1, 2, 4, 5, 7, 8, 10, 13, 16, 19 ][128X[104X
    [4X[25Xgap>[125X [27Xt:=NumericalSemigroupByGaps(last);[127X[104X
    [4X[28X<Numerical semigroup>[128X[104X
    [4X[25Xgap>[125X [27Xs=t;[127X[104X
    [4X[28Xtrue[128X[104X
    [4X[28X[128X[104X
    [4X[25Xgap>[125X [27XAperyListOfNumericalSemigroupWRTElement(s,20);;[127X[104X
    [4X[25Xgap>[125X [27Xt:=NumericalSemigroupByAperyList(last);[127X[104X
    [4X[28X<Numerical semigroup>[128X[104X
    [4X[25Xgap>[125X [27Xs=t;[127X[104X
    [4X[28Xtrue[128X[104X
  [4X[32X[104X
  
  
  [1X2.2 [33X[0;0YSome basic tests[133X[101X
  
  [33X[0;0YThis  section  describes some basic tests on numerical semigroups. The first
  described  tests  refer  to what the semigroup is currently known to be (not
  necessarily the way it was created). Then are presented functions to test if
  a  given  list represents the small elements, gaps or the Apéry set (see [14X1.[114X)
  of  a  numerical  semigroup;  to  test  if an integer belongs to a numerical
  semigroup and if a numerical semigroup is a subsemigroup of another one.[133X
  
  [1X2.2-1 IsNumericalSemigroup[101X
  
  [29X[2XIsNumericalSemigroup[102X( [3XNS[103X ) [32X attribute
  [29X[2XIsNumericalSemigroupByGenerators[102X( [3XNS[103X ) [32X attribute
  [29X[2XIsNumericalSemigroupByMinimalGenerators[102X( [3XNS[103X ) [32X attribute
  [29X[2XIsNumericalSemigroupByInterval[102X( [3XNS[103X ) [32X attribute
  [29X[2XIsNumericalSemigroupByOpenInterval[102X( [3XNS[103X ) [32X attribute
  [29X[2XIsNumericalSemigroupBySubAdditiveFunction[102X( [3XNS[103X ) [32X attribute
  [29X[2XIsNumericalSemigroupByAperyList[102X( [3XNS[103X ) [32X attribute
  [29X[2XIsNumericalSemigroupBySmallElements[102X( [3XNS[103X ) [32X attribute
  [29X[2XIsNumericalSemigroupByGaps[102X( [3XNS[103X ) [32X attribute
  [29X[2XIsNumericalSemigroupByFundamentalGaps[102X( [3XNS[103X ) [32X attribute
  [29X[2XIsProportionallyModularNumericalSemigroup[102X( [3XNS[103X ) [32X attribute
  [29X[2XIsModularNumericalSemigroup[102X( [3XNS[103X ) [32X attribute
  
  [33X[0;0Y[3XNS[103X  is a numerical semigroup and these attributes are available (their names
  should be self explanatory).[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27Xs:=NumericalSemigroup(3,7);[127X[104X
    [4X[28X<Modular numerical semigroup satisfying 7x mod 21 <= x >[128X[104X
    [4X[25Xgap>[125X [27XAperyListOfNumericalSemigroupWRTElement(s,30);;[127X[104X
    [4X[25Xgap>[125X [27Xt:=NumericalSemigroupByAperyList(last);[127X[104X
    [4X[28X<Numerical semigroup>[128X[104X
    [4X[25Xgap>[125X [27XIsNumericalSemigroupByGenerators(s);[127X[104X
    [4X[28Xtrue[128X[104X
    [4X[25Xgap>[125X [27XIsNumericalSemigroupByGenerators(t);[127X[104X
    [4X[28Xfalse[128X[104X
    [4X[25Xgap>[125X [27XIsNumericalSemigroupByAperyList(s);[127X[104X
    [4X[28Xfalse[128X[104X
    [4X[25Xgap>[125X [27XIsNumericalSemigroupByAperyList(t);[127X[104X
    [4X[28Xtrue[128X[104X
  [4X[32X[104X
  
  [1X2.2-2 RepresentsSmallElementsOfNumericalSemigroup[101X
  
  [29X[2XRepresentsSmallElementsOfNumericalSemigroup[102X( [3XL[103X ) [32X attribute
  
  [33X[0;0YTests  if  the  list  [3XL[103X  (which  has to be a set) may represent the ``small"
  elements of a numerical semigroup.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XL:=[ 0, 3, 6, 9, 11, 12, 14, 15, 17, 18, 20 ];[127X[104X
    [4X[28X[ 0, 3, 6, 9, 11, 12, 14, 15, 17, 18, 20 ][128X[104X
    [4X[25Xgap>[125X [27XRepresentsSmallElementsOfNumericalSemigroup(L);[127X[104X
    [4X[28Xtrue[128X[104X
    [4X[25Xgap>[125X [27XL:=[ 6, 9, 11, 12, 14, 15, 17, 18, 20 ];[127X[104X
    [4X[28X[ 6, 9, 11, 12, 14, 15, 17, 18, 20 ][128X[104X
    [4X[25Xgap>[125X [27XRepresentsSmallElementsOfNumericalSemigroup(L);[127X[104X
    [4X[28Xfalse[128X[104X
  [4X[32X[104X
  
  [1X2.2-3 RepresentsGapsOfNumericalSemigroup[101X
  
  [29X[2XRepresentsGapsOfNumericalSemigroup[102X( [3XL[103X ) [32X attribute
  
  [33X[0;0YTests  if  the  list  [3XL[103X  may  represent  the  gaps  (see  [14X1.[114X) of a numerical
  semigroup.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27Xs:=NumericalSemigroup(3,7);[127X[104X
    [4X[28X<Modular numerical semigroup satisfying 7x mod 21 <= x >[128X[104X
    [4X[25Xgap>[125X [27XL:=GapsOfNumericalSemigroup(s);[127X[104X
    [4X[28X[ 1, 2, 4, 5, 8, 11 ][128X[104X
    [4X[25Xgap>[125X [27XRepresentsGapsOfNumericalSemigroup(L);[127X[104X
    [4X[28Xtrue[128X[104X
    [4X[25Xgap>[125X [27XL:=Set(List([1..21],i->RandomList([1..50])));[127X[104X
    [4X[28X[ 2, 6, 7, 8, 10, 12, 14, 19, 24, 28, 31, 35, 42, 50 ][128X[104X
    [4X[25Xgap>[125X [27XRepresentsGapsOfNumericalSemigroup(L);[127X[104X
    [4X[28Xfalse[128X[104X
  [4X[32X[104X
  
  [1X2.2-4 IsAperyListOfNumericalSemigroup[101X
  
  [29X[2XIsAperyListOfNumericalSemigroup[102X( [3XL[103X ) [32X function
  
  [33X[0;0YTests  whether  a  list  [3XL[103X  of  integers  may  represent the Apéry list of a
  numerical  semigroup. It returns [9Xtrue[109X when the periodic function represented
  by  [3XL[103X is subadditive (see [2XRepresentsPeriodicSubAdditiveFunction[102X ([14XA.2-1[114X)) and
  the  remainder  of  the division of [10XL[i][110X by the length of [3XL[103X is [10Xi[110X and returns
  [9Xfalse[109X otherwise (the criterium used is the one explained in [Ros96b]).[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XIsAperyListOfNumericalSemigroup([0,21,7,28,14]);[127X[104X
    [4X[28Xtrue[128X[104X
  [4X[32X[104X
  
  [1X2.2-5 IsSubsemigroupOfNumericalSemigroup[101X
  
  [29X[2XIsSubsemigroupOfNumericalSemigroup[102X( [3XS[103X, [3XT[103X ) [32X function
  
  [33X[0;0Y[3XS[103X and [3XT[103X are numerical semigroups. Tests whether [3XT[103X is contained in [3XS[103X.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XS := NumericalSemigroup("modular", 5,53);[127X[104X
    [4X[28X<Modular numerical semigroup satisfying 5x mod 53 <= x >[128X[104X
    [4X[25Xgap>[125X [27XT:=NumericalSemigroup(2,3);[127X[104X
    [4X[28X<Modular numerical semigroup satisfying 3x mod 6 <= x >[128X[104X
    [4X[25Xgap>[125X [27XIsSubsemigroupOfNumericalSemigroup(T,S);[127X[104X
    [4X[28Xtrue[128X[104X
    [4X[25Xgap>[125X [27XIsSubsemigroupOfNumericalSemigroup(S,T);[127X[104X
    [4X[28Xfalse[128X[104X
  [4X[32X[104X
  
  [1X2.2-6 BelongsToNumericalSemigroup[101X
  
  [29X[2XBelongsToNumericalSemigroup[102X( [3Xn[103X, [3XS[103X ) [32X operation
  
  [33X[0;0Y[3Xn[103X  is  an integer and [3XS[103X is a numerical semigroup. Tests whether [3Xn[103X belongs to
  [3XS[103X. [10Xn in S[110X is the short for [10XBelongsToNumericalSemigroup(n,S)[110X.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XS := NumericalSemigroup("modular", 5,53);[127X[104X
    [4X[28X<Modular numerical semigroup satisfying 5x mod 53 <= x >[128X[104X
    [4X[25Xgap>[125X [27XBelongsToNumericalSemigroup(15,S);[127X[104X
    [4X[28Xfalse[128X[104X
    [4X[25Xgap>[125X [27X15 in S;[127X[104X
    [4X[28Xfalse[128X[104X
    [4X[25Xgap>[125X [27XSmallElementsOfNumericalSemigroup(S);[127X[104X
    [4X[28X[ 0, 11, 12, 13, 22, 23, 24, 25, 26, 32, 33, 34, 35, 36, 37, 38, 39, 43 ][128X[104X
    [4X[25Xgap>[125X [27XBelongsToNumericalSemigroup(13,S);[127X[104X
    [4X[28Xtrue[128X[104X
    [4X[25Xgap>[125X [27X13 in S;[127X[104X
    [4X[28Xtrue[128X[104X
  [4X[32X[104X
  
