We list below several examples of the usage of the GAP package numericalsgps related to the talks given during the session
We have used NormalizInterface
(links to normaliz
), Singular
(interface to singular
) and SingularInterface
(links to libsing
)
You can install GAP following the instructions in the GAP site
If you want to use a gap together with singular, normaliz and 4ti2, you might also have a look at Sebastian Gustche sebasguts/pedro_complete docker repository
gap> s:=NumericalSemigroup(5,17,19,21);;
gap> O:=CanonicalIdealOfNumericalSemigroup(s);
<Ideal of numerical semigroup>
gap> i:=5+s;
<Ideal of numerical semigroup>
gap> O-(O-i)=i;
true
gap> BlowUpIdealOfNumericalSemigroup(i);
<Ideal of numerical semigroup>
gap> SmallElements(last);
[ 0, 5, 10, 15, 17, 19, 20, 21, 22, 24, 25, 26, 27, 29, 30, 31, 32, 34 ]
gap> AlmostSymmetricNumericalSemigroupsWithFrobeniusNumber(13);
[ <Numerical semigroup>, <Numerical semigroup>, <Numerical semigroup>,
<Numerical semigroup>, <Numerical semigroup>, <Numerical semigroup>,
<Numerical semigroup>, <Numerical semigroup>, <Numerical semigroup>,
<Numerical semigroup>, <Numerical semigroup>, <Numerical semigroup>,
<Numerical semigroup>, <Numerical semigroup>, <Numerical semigroup>,
<Numerical semigroup>, <Numerical semigroup>, <Numerical semigroup>,
<Numerical semigroup>, <Numerical semigroup>, <Numerical semigroup>,
<Numerical semigroup>, <Numerical semigroup>, <Numerical semigroup>,
<Numerical semigroup>, <Numerical semigroup>, <Numerical semigroup>,
<Numerical semigroup>, <Numerical semigroup>, <Numerical semigroup>,
<Numerical semigroup>, <Numerical semigroup> ]
gap> s:=NumericalSemigroup(5,7,9);
<Numerical semigroup with 3 generators>
gap> o:=OverSemigroupsNumericalSemigroup(s);;
gap> Filtered(last, IsSymmetricNumericalSemigroup);
[ <The numerical semigroup N>, <Numerical semigroup>, <Numerical semigroup>,
<Numerical semigroup>, <Numerical semigroup> ]
gap> List(last,MinimalGeneratingSystem);
[ [ 1 ], [ 2, 3 ], [ 2, 5 ], [ 5, 7, 8, 9 ], [ 5, 7, 9, 11 ] ]
gap> IsGradedAssociatedRingNumericalSemigroupBuchsbaum(s);
true
gap> MaximalDenumerantOfNumericalSemigroup(s);
2
gap> Length(TelescopicNumericalSemigroupsWithFrobeniusNumber(17));
5
gap> Length(FreeNumericalSemigroupsWithFrobeniusNumber(17));
7
gap> Length(CompleteIntersectionNumericalSemigroupsWithFrobeniusNumber(17));
7
gap> IsAperySetAlphaRectangular(s);
false
gap> s:=NumericalSemigroup([ 14, 29, 30, 32, 36 ]);
<Numerical semigroup with 5 generators>
gap> i:=[0,2,3]+s;
<Ideal of numerical semigroup>
gap> ReductionNumberIdealNumericalSemigroup(i);
5
gap> I:=[6,9,11]+NumericalSemigroup(6,9,11);;
gap> List([1..7],n->HilbertFunctionOfIdealOfNumericalSemigroup(n,I));
[ 3, 5, 6, 6, 6, 6, 6 ]
You can define functions for particular tasks, for instance:
WilfNumber
Profile of a numerical semigroup
wilfNumberOfNumericalSemigroup:=function(s)
local se, edim, c;
edim:=EmbeddingDimensionOfNumericalSemigroup(s);
c:=ConductorOfNumericalSemigroup(s);
se:=Length(SmallElements(s))-1;
return edim*se-c;
end;
profileOfNumericalSemigroup:=function(s)
local c, m, msg, r, q;
m:=MultiplicityOfNumericalSemigroup(s);
c:=ConductorOfNumericalSemigroup(s);
msg:=MinimalGeneratingSystem(s);
q:=CeilingOfRational(c/m);
r:=q*m-c;
return List([1..q-1],i->Length(Intersection(msg,[i*m-r..(i+1)*m-r])));
end;
gap> l:=List([1..40],_->RandomNumericalSemigroup(10,600));;
gap> Filtered(l, s->wilfNumberOfNumericalSemigroup(s)=0);
[ <Modular numerical semigroup satisfying 6944x mod 26288 <= x >,
<Modular numerical semigroup satisfying 17081x mod 33611 <= x >,
<The numerical semigroup N>, <Modular numerical semigroup satisfying 18877x mod
53119 <= x >, <Modular numerical semigroup satisfying 39825x mod 69561 <= x >,
<Modular numerical semigroup satisfying 93225x mod 97180 <= x > ]
gap> List(last,MinimalGeneratingSystem);
[ [ 53, 496 ], [ 61, 551 ], [ 1 ], [ 121, 439 ], [ 131, 531 ], [ 172, 565 ] ]
We can look at the ration of numericals semigroups having \(q=3\); first define \(q\)
qns:=function(s)
local c, m, msg, r;
m:=MultiplicityOfNumericalSemigroup(s);
c:=ConductorOfNumericalSemigroup(s);
msg:=MinimalGeneratingSystem(s);
return CeilingOfRational(c/m);
end;
Then for instance for genus 25:
gap> l:=NumericalSemigroupsWithGenus(25);;
gap> lq3:=Filtered(l,s->qns(s)=3);;
gap> Length(l)/Length(lq3);
467224/273139
gap> l:= NumericalSemigroupsWithPseudoFrobeniusNumbers([19,21]);;
gap> List(l, MinimalGeneratingSystem);
[ [ 5, 12, 13 ], [ 6, 8, 10, 17 ], [ 6, 11, 14, 16 ], [ 8, 9, 14, 15, 20 ],
[ 8, 10, 12, 14, 15, 17 ], [ 9, 11, 13, 14, 15, 16, 17 ],
[ 10, 12, 13, 14, 15, 16, 17, 18 ], [ 11, 12, 13, 14, 15, 16, 17, 18, 20 ] ]
Let us compute the dual of an ideal of a numerical semigroup
gap> s:=NumericalSemigroup(4,5);;
gap> i:=[0,3]+s;;
gap> s-i;
<Ideal of numerical semigroup>
gap> MinimalGeneratingSystem(s);
[ 4, 5 ]
Hdepth is a tool for computing the multigraded Hilbert depth of a module
Hilbert basis of a cone (we use here NormalizInterface
; that links with normaliz
)
gap> cone:=NmzCone(["integral_closure", [[2,0],[1,1],[0,2]]]);
<a Normaliz cone with long int coefficients>
gap> NmzHilbertBasis(cone);
[ [ 0, 1 ], [ 1, 0 ] ]
Computing the convex hull of a set of points
gap> cone:=NmzCone(["polytope", [[1,0,],[0,1],[0,0],[1,1]]]);
<a Normaliz cone with long int coefficients>
gap> NmzSupportHyperplanes(cone);
[ [ -1, 0, 1 ], [ 0, -1, 1 ], [ 0, 1, 0 ], [ 1, 0, 0 ] ]
and these are the coefficients of the inequalities \(-x\ge 1\), \(-y\ge 1\), \(y\ge 0\) and \(x\ge 0\)
gap> cone:=NmzCone(["polytope", [[2,0,0],[0,3,0],[0,0,5]]]);
<a Normaliz cone with long int coefficients>
gap> NmzSupportHyperplanes(cone);
[ [ -5, -3, -2, 10 ], [ -3, -2, -1, 6 ], [ 8, 5, 3, -15 ] ]
Some methods are implemented in affine-extra.ni
; for instance factorizations (our semigroups are reduced; we ommit the NmzHilbertBasis
component):
n:=Length(ls);
mat:=TransposedMat(Concatenation(ls,[-v]));
cone:=NmzCone(["inhom_equations",mat]);
NmzCompute(cone,"DualMode");
facs:=List(NmzConeProperty(cone,"ModuleGenerators"), f->f{[1..n]});
return facs;
As an example we can compute the atoms of \(\mathcal B(\mathbb Z_2^3)\); and its tame degree
gap> SetInfoLevel(InfoNumSgps,2);
gap> m:=[[0,0,1],[0,1,0],[0,1,1],[1,0,0],[1,0,1],[1,1,0],[1,1,1]];;
gap> a:=AffineSemigroup("equations",[TransposedMat(m),[2,2,2]]);
<Affine semigroup>
gap> GeneratorsOfAffineSemigroup(a);
#I Using normaliz to find the Hilbert basis.
[ [ 0, 0, 0, 0, 0, 0, 2 ], [ 0, 0, 0, 0, 0, 2, 0 ], [ 0, 0, 0, 0, 2, 0, 0 ],
[ 0, 0, 0, 1, 1, 1, 1 ], [ 0, 0, 0, 2, 0, 0, 0 ], [ 0, 0, 1, 0, 1, 1, 0 ],
[ 0, 0, 1, 1, 0, 0, 1 ], [ 0, 0, 2, 0, 0, 0, 0 ], [ 0, 1, 0, 0, 1, 0, 1 ],
[ 0, 1, 0, 1, 0, 1, 0 ], [ 0, 1, 1, 0, 0, 1, 1 ], [ 0, 1, 1, 1, 1, 0, 0 ],
[ 0, 2, 0, 0, 0, 0, 0 ], [ 1, 0, 0, 0, 0, 1, 1 ], [ 1, 0, 0, 1, 1, 0, 0 ],
[ 1, 0, 1, 0, 1, 0, 1 ], [ 1, 0, 1, 1, 0, 1, 0 ], [ 1, 1, 0, 0, 1, 1, 0 ],
[ 1, 1, 0, 1, 0, 0, 1 ], [ 1, 1, 1, 0, 0, 0, 0 ], [ 2, 0, 0, 0, 0, 0, 0 ] ]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[ 5, 5, 0, 5 ], [ 4, 4, 2, 4 ], [ 3, 3, 4, 3 ], [ 2, 2, 6, 2 ],
[ 1, 1, 8, 1 ], [ 0, 0, 10, 0 ] ]
gap> List(last,Sum);
[ 15, 14, 13, 12, 11, 10 ]
For numerical semigroups we can also compute the whole set \(\Delta(S)\)
gap> s:=NumericalSemigroup( 14, 29, 30, 32, 36 );;
gap> DeltaSetOfNumericalSemigroup(s);
[ 1, 4 ]
Some elements in \(\mathbb Z_3\times \mathbb Z_2\) and nonunique factorization invariants
gap> m:=[[2,1],[1,1],[1,0]];
[ [ 2, 1 ], [ 1, 1 ], [ 1, 0 ] ]
# damos los elementos del subgrupo
gap> a:=AffineSemigroup("equations",[TransposedMat(m),[3,2]]);
<Affine semigroup>
#son elementos de Z_2xZ_3
gap> GeneratorsOfAffineSemigroup(a);
[ [ 0, 0, 3 ], [ 0, 2, 1 ], [ 0, 6, 0 ], [ 1, 1, 0 ], [ 2, 0, 2 ],
[ 4, 0, 1 ], [ 6, 0, 0 ] ]
gap> OmegaPrimalityOfAffineSemigroup(a);
6
gap> TameDegreeOfAffineSemigroup(a);
6
gap> CatenaryDegreeOfAffineSemigroup(a);
6
gap> GeneratorsOfAffineSemigroup(a);
[ [ 0, 0, 3 ], [ 0, 2, 1 ], [ 0, 6, 0 ], [ 1, 1, 0 ], [ 2, 0, 2 ],
[ 4, 0, 1 ], [ 6, 0, 0 ] ]
gap> b:=AffineSemigroup(last);
<Affine semigroup in 3 dimensional space, with 7 generators>
gap> [23,24,39] in a; time;
false
0
gap> [23,24,39] in b; time;
false
317
gap> IsFullAffineSemigroup(b);
true
gap> [23,24,39] in b; time;
false
0
Davenport constant of \(\mathbb Z_2^3\)
gap> m:=[[0,0,1],[0,1,0],[0,1,1],[1,0,0],[1,0,1],[1,1,0],[1,1,1]];;
gap> a:=AffineSemigroup("equations",[TransposedMat(m),[2,2,2]]);
<Affine semigroup>
gap> GeneratorsOfAffineSemigroup(a);
#I Using Contejean and Devie algorithm.
[ [ 0, 0, 0, 0, 0, 0, 2 ], [ 0, 0, 0, 0, 0, 2, 0 ],
[ 0, 0, 0, 0, 2, 0, 0 ], [ 0, 0, 0, 1, 1, 1, 1 ],
[ 0, 0, 0, 2, 0, 0, 0 ], [ 0, 0, 1, 0, 1, 1, 0 ],
[ 0, 0, 1, 1, 0, 0, 1 ], [ 0, 0, 2, 0, 0, 0, 0 ],
[ 0, 1, 0, 0, 1, 0, 1 ], [ 0, 1, 0, 1, 0, 1, 0 ],
[ 0, 1, 1, 0, 0, 1, 1 ], [ 0, 1, 1, 1, 1, 0, 0 ],
[ 0, 2, 0, 0, 0, 0, 0 ], [ 1, 0, 0, 0, 0, 1, 1 ],
[ 1, 0, 0, 1, 1, 0, 0 ], [ 1, 0, 1, 0, 1, 0, 1 ],
[ 1, 0, 1, 1, 0, 1, 0 ], [ 1, 1, 0, 0, 1, 1, 0 ],
[ 1, 1, 0, 1, 0, 0, 1 ], [ 1, 1, 1, 0, 0, 0, 0 ],
[ 2, 0, 0, 0, 0, 0, 0 ] ]
gap> Maximum(Set(last, Sum));
4
gap> s:=NumericalSemigroup( 14, 29, 30, 32, 36 );
<Numerical semigroup with 5 generators>
gap> DeltaSetPeriodicityBoundForNumericalSemigroup(s);
3984
gap> DeltaSetPeriodicityStartForNumericalSemigroup(s);
141
gap> DeltaSetOfNumericalSemigroup(s);
[ 1, 4 ]
gap> OmegaPrimalityOfNumericalSemigroup(s);
9
gap> a:=AsAffineSemigroup(s);
<Affine semigroup in 1 dimensional space, with 5 generators>
gap> OmegaPrimalityOfAffineSemigroup(a);
9
We can compute minimal presentations and Apéry sets
gap> s:=NumericalSemigroup( 14, 29, 30, 32, 36 );
<Numerical semigroup with 5 generators>
gap> MinimalPresentationOfNumericalSemigroup(s);
[ [ [ 0, 0, 0, 2, 0 ], [ 2, 0, 0, 0, 1 ] ],
[ [ 0, 0, 2, 0, 0 ], [ 2, 0, 0, 1, 0 ] ],
[ [ 0, 2, 0, 0, 0 ], [ 2, 0, 1, 0, 0 ] ],
[ [ 1, 2, 0, 0, 0 ], [ 0, 0, 0, 0, 2 ] ],
[ [ 7, 0, 0, 0, 0 ], [ 0, 0, 1, 1, 1 ] ] ]
gap> AperyListOfNumericalSemigroup(s);
[ 0, 29, 30, 59, 32, 61, 62, 91, 36, 65, 66, 95, 68, 97 ]
With the use of singular
we can define functions to get free resolutions
LoadPackage("singular");
IdealAndSyzygyModuleOfNumericalSemigroup:=function( s )
local i, p, rel, rgb, msg, pol, ed, sdegree, monomial, candidates, mp,
R,id, ie, vars, mingen, exps, bintopair, dim, zero, syz;
##computes the s degree of a monomial in the semigroup ideal
sdegree:=function(m)
local exp;
exp:=List([1..ed], i->DegreeIndeterminate(m,i));
return exp*msg;
end;
bintopair:=function(p)
local m1,m2, d1, d2;
m1:=LeadingMonomialOfPolynomial(p, MonomialLexOrdering());
m2:=m1-p;
d1:=List([1..ed], i->DegreeIndeterminate(m1,i));;
d2:=List([1..ed], i->DegreeIndeterminate(m2,i));;
return [d1,d2];
end;
msg:=TransposedMat([MinimalGeneratingSystem(s)]);
ed:=Length(msg);
if ed=0 then
return [];
fi;
zero:=List([1..ed],_->0);
dim:=1;
vars:=List([1..ed+dim],i->X(Rationals,i));
R:=PolynomialRing(Rationals,vars);
SetTermOrdering(R,"dp");
SingularSetBaseRing(R);
p:=List([1..ed], i->X(Rationals,i)
-Product(List([1..dim], j->X(Rationals,j+ed)^msg[i][j])));
id:=Ideal(R,p);
ie:=SingularInterface("eliminate",
[id,Product(List([1..dim], j->X(Rationals,j+ed)))],"ideal");
vars:=vars{[1..ed]};
R:=PolynomialRing(Rationals,vars);
SetTermOrdering(R, ["wp",List(msg, m->Sum(m))] );
SingularSetBaseRing(R);
mingen:=GeneratorsOfIdeal(SingularInterface("minbase",[ie],"ideal"));
syz:=SingularInterface("syz",[ie],"module");
Print("Resolution in text: ",
SingularInterface("mres",[ie,0],"resolution"),"\n");
return [mingen, GeneratorsOfLeftOperatorAdditiveGroup(syz)];
end;
And then we can use it in our semigroup
gap> IdealAndSyzygyModuleOfNumericalSemigroup(s);
#I The conversion from Singular to Gap of objects of type "resolution"
#I is not yet implemented. The output is returned as a string.
#I (Your code to convert it will be welcome!)
Resolution in text: x_1^2*x_5-x_4^2,x_1^2*x_4-x_3^2,x_1^2*x_3-x_2^2,x_1*x_2\
^2-x_5^2,x_1^7-x_3*x_4*x_5,x_1^2*x_4*gen(1)-x_1^2*x_5*gen(2)-x_3^2*gen(1)+x\
_4^2*gen(2),x_1^2*x_3*gen(1)-x_1^2*x_5*gen(3)-x_2^2*gen(1)+x_4^2*gen(3),x_1\
^2*x_3*gen(2)-x_1^2*x_4*gen(3)-x_2^2*gen(2)+x_3^2*gen(3),x_1*x_2^2*gen(1)-x\
_1^2*x_5*gen(4)+x_4^2*gen(4)-x_5^2*gen(1),x_1*x_2^2*gen(2)-x_1^2*x_4*gen(4)\
+x_3^2*gen(4)-x_5^2*gen(2),x_1*x_2^2*gen(3)-x_1^2*x_3*gen(4)+x_2^2*gen(4)-x\
_5^2*gen(3),x_1^5*gen(1)+x_1^3*x_4*gen(2)+x_1*x_3*x_4*gen(3)+x_3*x_4*gen(4)\
-x_5*gen(5),x_1^5*gen(2)+x_1^3*x_3*gen(3)+x_1^2*x_3*gen(4)+x_3*x_5*gen(1)-x\
_4*gen(5),x_1^5*gen(3)+x_1^4*gen(4)+x_1^2*x_5*gen(1)+x_4*x_5*gen(2)-x_3*gen\
(5),x_1^6*gen(4)+x_1^4*x_5*gen(1)+x_1^2*x_4*x_5*gen(2)+x_3*x_4*x_5*gen(3)-x\
_2^2*gen(5),x_1^2*x_3*gen(1)-x_1^2*x_4*gen(2)+x_1^2*x_5*gen(3)-x_2^2*gen(1)\
+x_3^2*gen(2)-x_4^2*gen(3),x_1*x_2^2*gen(2)-x_1^2*x_3*gen(4)+x_1^2*x_5*gen(\
6)+x_2^2*gen(4)-x_4^2*gen(6)-x_5^2*gen(2),x_1*x_2^2*gen(3)-x_1^2*x_3*gen(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3*x_4*x_5, x_1^6, 0, 0, 0,
-x_2^2 ] ] ]
Or we can also use SingularInterface
(links with libsing) to get the Betti elements
BettiNumbersOfNumericalSemigroupSing:=function( s )
local i, p, rel, rgb, msg, pol, ed, sdegree, monomial, candidates, mp,
R,id, ie, vars, mingen, exps, bintopair, res;
##computes the s degree of a pol in the semigroup ideal
sdegree:=function(r)
local exp;
exp:=_SI_Plistintvec(SI_leadexp(SI_leadmonom(r)));
return exp*msg;
end;
bintopair:=function(p)
local m1,m2, d1, d2;
m1:=SI_leadmonom(p);
m2:=m1-p;
d1:=_SI_Plistintvec(SI_leadexp(m1));
d2:=_SI_Plistintvec(SI_leadexp(m2));
return [d1{[1..ed]},d2{[1..ed]}];
end;
msg:=MinimalGeneratingSystemOfNumericalSemigroup(s);
ed:=Length(msg);
vars:=List([1..ed+1],i->Concatenation("x",String(i)));
R:=SI_ring(0,vars,[["wp",msg],["dp",1]]);
p:=List([1..ed], i->SI_var(R,i)-SI_var(R,ed+1)^msg[i]);
id:=SI_ideal(p);
ie:= SI_eliminate(id,SI_var(R,ed+1));
vars:=vars{[1..ed]};
R:=SI_ring(0,vars,[["wp",msg]]);
p:=[];
for i in [1..SI_ncols(ie)] do
exps:=bintopair(ie[i]);
Add( p, SI_monomial(R,SI_intvec(exps[1]))-
SI_monomial(R,SI_intvec(exps[2])));
od;
id:=SI_ideal(p);
res:=SI_mres(id,0);
Info(InfoNumSgps,2,res);
return _SI_Matintmat(SI_betti(res));
end;
And an example
gap> s:=NumericalSemigroup(5,7,9);
<Numerical semigroup with 3 generators>
gap> BettiNumbersOfNumericalSemigroupSing(s);
[ [ 1, 0, 0 ], [ 0, 0, 0 ], [ 0, 0, 0 ], [ 0, 0, 0 ], [ 0, 0, 0 ],
[ 0, 0, 0 ], [ 0, 0, 0 ], [ 0, 0, 0 ], [ 0, 0, 0 ], [ 0, 0, 0 ],
[ 0, 0, 0 ], [ 0, 0, 0 ], [ 0, 0, 0 ], [ 0, 1, 0 ], [ 0, 0, 0 ],
[ 0, 0, 0 ], [ 0, 0, 0 ], [ 0, 0, 0 ], [ 0, 0, 0 ], [ 0, 0, 0 ],
[ 0, 0, 0 ], [ 0, 0, 0 ], [ 0, 0, 0 ], [ 0, 0, 0 ], [ 0, 1, 0 ],
[ 0, 0, 0 ], [ 0, 1, 0 ], [ 0, 0, 0 ], [ 0, 0, 0 ], [ 0, 0, 0 ],
[ 0, 0, 1 ], [ 0, 0, 0 ], [ 0, 0, 1 ] ]