GAP 4.8.9 installation with standard packages -- copy to your CoCalc project to get it
1[1X3 [33X[0;0Y4ti2 functions[133X[101X234[1X3.1 [33X[0;0YGroebner[133X[101X56[33X[0;0YThese are wrappers of some use cases of 4ti2s groebner command.[133X78[1X3.1-1 4ti2Interface_groebner_matrix[101X910[29X[2X4ti2Interface_groebner_matrix[102X( [3Xmatrix[103X[, [3Xordering[103X] ) [32X function11[6XReturns:[106X [33X[0;10YA list of vectors[133X1213[33X[0;0YThis launches the 4ti2 groebner command with the argument as matrix input.14The output will be the the Groebner basis of the binomial ideal generated by15the left kernel of the input matrix. Note that this is different from 4ti2's16convention which takes the right kernel. It returns the output of the17groebner command as a list of lists. The second argument can be a vector to18specify a monomial ordering, in the way that x^m > x^n if ordering*m >19ordering*n[133X2021[1X3.1-2 4ti2Interface_groebner_basis[101X2223[29X[2X4ti2Interface_groebner_basis[102X( [3Xbasis[103X[, [3Xordering[103X] ) [32X function24[6XReturns:[106X [33X[0;10YA list of vectors[133X2526[33X[0;0YThis launches the 4ti2 groebner command with the argument as matrix input.27The outpur will be the Groebner basis of the binomial ideal generated by the28rows of the input matrix. It returns the output of the groebner command as a29list of lists. The second argument is like before.[133X303132[1X3.1-3 [33X[0;0YDefining ideal of toric variety[133X[101X3334[33X[0;0YWe want to compute the groebner basis of the ideal defining the affine toric35variety associated to the cone generated by the inequalities [ [ 7, -1 ], [360, 1 ] ], i.e. a rational normal curve.[133X3738[4X[32X Example [32X[104X39[4X[28X[128X[104X40[4X[25Xgap>[125X [27XLoadPackage( "4ti2Interface" );[127X[104X41[4X[28Xtrue[128X[104X42[4X[25Xgap>[125X [27Xcone := [ [ 7, -1 ], [ 0, 1 ] ];[127X[104X43[4X[28X[ [ 7, -1 ], [ 0, 1 ] ][128X[104X44[4X[25Xgap>[125X [27Xbasis := 4ti2Interface_hilbert_inequalities( cone );;[127X[104X45[4X[25Xgap>[125X [27Xgroebner := 4ti2Interface_groebner_matrix( basis );;[127X[104X46[4X[25Xgap>[125X [27Xtime;[127X[104X47[4X[28X0[128X[104X48[4X[25Xgap>[125X [27XLength( groebner );[127X[104X49[4X[28X21[128X[104X50[4X[32X[104X515253[1X3.2 [33X[0;0YHilbert[133X[101X5455[33X[0;0YThese are wrappers of some use cases of 4ti2s hilbert command.[133X5657[1X3.2-1 4ti2Interface_hilbert_inequalities[101X5859[29X[2X4ti2Interface_hilbert_inequalities[102X( [3XA[103X ) [32X function60[29X[2X4ti2Interface_hilbert_inequalities_in_positive_orthant[102X( [3XA[103X ) [32X function61[6XReturns:[106X [33X[0;10Ya list of vectors[133X6263[33X[0;0YThis function produces the hilbert basis of the cone C given by [3XA[103Xx >= 0 for64all x in C. For the second function also x >= 0 is assumed.[133X6566[1X3.2-2 4ti2Interface_hilbert_equalities_in_positive_orthant[101X6768[29X[2X4ti2Interface_hilbert_equalities_in_positive_orthant[102X( [3XA[103X ) [32X function69[6XReturns:[106X [33X[0;10Ya list of vectors[133X7071[33X[0;0YThis function produces the hilbert basis of the cone C given by the72equations [3XA[103Xx = 0 in the positive orthant of the coordinate system.[133X7374[1X3.2-3 4ti2Interface_hilbert_equalities_and_inequalities[101X7576[29X[2X4ti2Interface_hilbert_equalities_and_inequalities[102X( [3XA[103X, [3XB[103X ) [32X function77[29X[2X4ti2Interface_hilbert_equalities_and_inequalities_in_positive_orthant[102X( [3XA[103X, [3XB[103X ) [32X function78[6XReturns:[106X [33X[0;10Ya list of vectors[133X7980[33X[0;0YThis function produces the hilbert basis of the cone C given by the81equations [3XA[103Xx = 0 and the inequations [3XB[103Xx >= 0. For the second function x>=082is assumed.[133X838485[1X3.2-4 [33X[0;0YGenerators of semigroup[133X[101X8687[33X[0;0YWe want to compute the Hilbert basis of the cone obtained by intersecting88the positive orthant with the hyperplane given by the equation below.[133X8990[4X[32X Example [32X[104X91[4X[28X[128X[104X92[4X[25Xgap>[125X [27XLoadPackage( "4ti2Interface" );[127X[104X93[4X[28Xtrue[128X[104X94[4X[25Xgap>[125X [27Xgens := [ 23,25,37,49 ];[127X[104X95[4X[28X[ 23, 25, 37, 49 ][128X[104X96[4X[25Xgap>[125X [27Xequation := [ Concatenation( gens, -gens ) ];[127X[104X97[4X[28X[ [ 23, 25, 37, 49, -23, -25, -37, -49 ] ][128X[104X98[4X[25Xgap>[125X [27Xbasis := 4ti2Interface_hilbert_equalities_in_positive_orthant( equation );;[127X[104X99[4X[25Xgap>[125X [27Xtime;[127X[104X100[4X[28X12[128X[104X101[4X[25Xgap>[125X [27XLength( basis );[127X[104X102[4X[28X436[128X[104X103[4X[32X[104X104105106[1X3.2-5 [33X[0;0YHilbert basis of dual cone[133X[101X107108[33X[0;0YWe want to compute the Hilbert basis of the cone which faces are represented109by the inequalities below. This example is taken from the toric and the110ToricVarieties package manual. In both packages it is very slow with the111internal algorithms.[133X112113[4X[32X Example [32X[104X114[4X[28X[128X[104X115[4X[25Xgap>[125X [27XLoadPackage( "4ti2Interface" );[127X[104X116[4X[28Xtrue[128X[104X117[4X[25Xgap>[125X [27Xinequalities := [ [1,2,3,4],[0,1,0,7],[3,1,0,2],[0,0,1,0] ];[127X[104X118[4X[28X[ [ 1, 2, 3, 4 ], [ 0, 1, 0, 7 ], [ 3, 1, 0, 2 ], [ 0, 0, 1, 0 ] ][128X[104X119[4X[25Xgap>[125X [27Xbasis := 4ti2Interface_hilbert_inequalities( inequalities );;[127X[104X120[4X[25Xgap>[125X [27Xtime;[127X[104X121[4X[28X0[128X[104X122[4X[25Xgap>[125X [27XLength( basis );[127X[104X123[4X[28X29[128X[104X124[4X[32X[104X125126127[1X3.3 [33X[0;0YZSolve[133X[101X128129[1X3.3-1 4ti2Interface_zsolve_equalities_and_inequalities[101X130131[29X[2X4ti2Interface_zsolve_equalities_and_inequalities[102X( [3Xeqs[103X, [3Xeqs_rhs[103X, [3Xineqs[103X, [3Xineqs_rhs[103X[, [3Xsigns[103X] ) [32X function132[29X[2X4ti2Interface_zsolve_equalities_and_inequalities_in_positive_orthant[102X( [3Xeqs[103X, [3Xeqs_rhs[103X, [3Xineqs[103X, [3Xineqs_rhs[103X ) [32X function133[6XReturns:[106X [33X[0;10Ya list of three matrices[133X134135[33X[0;0YThis function produces a basis of the system [3Xeqs[103X = [3Xeqs_rhs[103X and [3Xineqs[103X >=136[3Xineqs_rhs[103X. It outputs a list containing three matrices. The first one is a137list of points in a polytope, the second is the hilbert basis of a cone. The138set of solutions is then the minkowski sum of the polytope generated by the139points in the first list and the cone generated by the hilbert basis in the140second matrix. The third one is the free part of the solution polyhedron.141The optional argument [3Xsigns[103X must be a list of zeros and ones which length is142the number of variables. If the ith entry is one, the ith variable must be143>= 0. If the entry is 0, the number is arbitraty. Default is all zero. It is144also possible to set the option precision to 32, 64 or gmp. The default, if145no option is given, 32 is used. Please note that a higher precision leads to146slower computation. For the second function xi >= 0 for all variables is147assumed.[133X148149150[1X3.4 [33X[0;0YGraver[133X[101X151152[1X3.4-1 4ti2Interface_graver_equalities[101X153154[29X[2X4ti2Interface_graver_equalities[102X( [3Xeqs[103X[, [3Xsigns[103X] ) [32X function155[29X[2X4ti2Interface_graver_equalities_in_positive_orthant[102X( [3Xeqs[103X ) [32X function156[6XReturns:[106X [33X[0;10Ya matrix[133X157158[33X[0;0YThis calls the function graver with the equalities [3Xeqs[103X = 0. It outputs one159list containing the graver basis of the system. the optional argument [3Xsigns[103X160is used like in zsolve. The second command assumes [22Xx_i ≥ 0[122X.[133X161162163164