arXiv:2010.08903v1 [math.AC] 18 Oct 2020 fn eiru ig r bet fmn tde ncombina in studies many of objects are rings semigroup Affine ] eto hw optblt ihthe with compatibility shows 4 Section 4]. via obtained be can This The aeuprcs etr n odaelwrcs etr deno letters case lower boldface and letters case upper face { 1.1. ovrain n epu omnso rf esoso thi of versions using draft on advice on K¨oppe for Matthias comments helpful and conversations aeojcsin objects late Acknowledgements. eae obntra oin.I loepan hi impl their explains also It notions. combinatorial related in3peet h mlmnaino nagrtmfidn st finding an of implementation the presents 3 tion Outline. eadda eeaiainof affine generalization (non-normal) a pointed as any regarded in ideals monomial for pairs th is [6] s affine of over contributions computed effectively main be can the concepts of algebraic One decom irreducible multiplicities. and Stand as primary [6]. on in information case ring contains semigroup that the to generalized and [8], r ae ntento of rings. notion semigroup the on affine based in are ideals monomial for computations olo hsatcei opeetthe present to is article this of goal 0 , 2020 1 SageMath TNADPISO OOILIEL VRNNNRA AFFINE NON-NORMAL OVER IDEALS MONOMIAL OF PAIRS STANDARD , Notation. 2 , ooilieloe one nnnra)afiesemigroup affine (non-normal) pointed a over ideal monomial rmr eopsto famnma da.Telbayexpa library The ideal. monomial a of decomposition mu corresponding primary the ideals, prime associated the provides ehd htalwteotusfo hslbayt ecompat be to library this from outputs the allow that methods inon tion A ahmtc ujc Classification. Subject } · · · BSTRACT eto rvdsbcgon nafiesmgoprns the rings, semigroup affine on background provides 2 Section igo neesis integers of ring A . Macaulay2 SageMath nti ae,asmgopo ongtv neesincludin integers nonnegative of semigroup a paper, this In library epresent We . and ewudlk oepesordeetapeito oLuaMa Laura to appreciation deepest our express to like would We SageMath stdPairs.spyx vrplnma ig,adi ae nagrtm rm[] W [6]. from on based is and rings, polynomial over tnadpairs standard noojcsin objects into stdPairs.spyx standardPairs https://github.com/byeongsuyu/StdPairs EIRUSIN SEMIGROUPS . Z l ongtv elnmesaerpeetdby represented are numbers real nonnegative All . zsolve SageMath rmr 36,6W0 09;Scnay1P5 20M25. 13P25, Secondary 90C90; 68W30, 13F65, Primary .I 1. nrdcdfrmnma dasi oyoilrnsby rings polynomial in ideals monomial for introduced , YOGUYU BYEONGSU Macaulay2 NTRODUCTION mlmnsteagrtm f[]t aclt standard calculate to [6] of algorithms the implements a , in SageMath 1 4ti2 library ucinin function SageMath . using tpiiis n nirdnatirreducible irredundant an and ltiplicities, akg yitouigmtost trans- to methods introducing by package stdPairs.spyx mnainas ementation irr ocmuesadr ar fa of pairs standard compute to library bewt the with ible r ar r obntra structure combinatorial a are pairs ard d nthe on nds mgoprings. emigroup ig Moreover, ring. oiin fmnma das swell as ideals, monomial of positions emtie n etr,respectively. vectors, and matrices te nadpis rpsdi 6 Section [6, in proposed pairs, andard tsadr ar n h associated the and pairs standard at eiru ig hslbaycnbe can library This ring. semigroup Normaliz ae.As,w r rtflto grateful are we Also, paper. s h loihsipeetdhere implemented algorithms The Macaulay2 oilcmuaieagba The algebra. commutative torial standardPairs Normaliz SageMath rmnma das and ideals, monomial ir . stdPairs.spyx sdntdby denoted is 0 g hc systematizes which , mlmne y[4]. by implemented loprovide also e akg of package lse.Sec- classes. ueihfor tusevich func- R ≥ . 0 Bold- . N = 2 BYEONGSU YU

This will be used when we call a cone R≥0A for some d × n A over Z. An arbitrary field is K.

2. AFFINE SEMIGROUP, IDEAL, AND PROPER PAIR AS CLASSES OF SAGEMATH

2.1. Mathematical Background. An affine semigroup is a semigroup of Zd generated by finitely many vectors a1, ··· , an for some n ∈ N. We let A be a d × n matrix whose column vectors are d a1, ··· , an ∈ Z . The set of all nonnegative integer linear combinations of a1, ··· , an, denoted by NA, is an affine semigroup. These columns a1, ··· , an are the generators of the affine semigroup NA; the matrix A is called the generating matrix. Since NA contains 0, an affine semigroup is a commutative monoid. Given a field K, we are concerned with the affine semigroup ring K[NA]. A natural first example is the polynomial ring in d-variables; in this case, A is the d × d identity matrix. We refer to [7, Section 7] for more background on this topic. Throughout this article, we assume that the affine semigroup NA under consideration is pointed, which means that the cone R≥0A does not contain lines. An ideal of an affine semigroup is a set I ⊂ NA such that I + NA ⊆ I. There is a one-to-one correspondence between monomial ideals of K[NA] and ideals of NA. Therefore, the definition of prime, irreducible, and primary ideals of K[NA] can be naturally extended to the ideals of an affine semigroup. The standard monomials of an ideal I ⊂ NA are all elements of NA r I. Let std(I) be a set of all standard monomials with respect to I. A face of an affine semigroup NA is a subsemigroup NF ⊆ NA such that the complement NA r NF is an ideal of NA [7, Definition 7.8]. Equivalently, it is a subsemigroup NF with the property that a + b ∈ NF if and only if a, b ∈ NF. The faces of an affine semigroup form a lattice which is isomorphic to the face lattice of a (real) cone over the affine semigroup [2, 7]. Thus, we may represent a face NF as a submatrix F of A. A pair is a tuple (a, F) of an element a in NA and a face F of NA [6]. A proper pair of an ideal I is a pair (a, F) such that a + NF ⊆ std(I). A pair (a, F) divides (b, G) if there exists ∈ NA such that a + c + NF ⊆ b + NG [6]. The set of all proper pairs of an ideal I is partially ordered ≺ by inclusion. In other words, (a, F) ≺ (b, G) if a + NF ⊂ b + NG. The standard pairs of an ideal I are the maximal elements of the set of all proper pairs of I in this partial order. We denote by Std(I) the set of all standard pairs of an ideal I. We remark that our notation here differs from existing notation for standard pairs over polynomial a a rings. Over the polynomial ring K[x1, x2, ··· , xn], apair isatuple (x ,V ) where x is a monomial a1 a2 an x1 x2 ··· xn for some integer vector a =(a1, a2, ··· , an) and V is a set of variables [4, 8]. From the viewpoint of affine semigroup rings, the polynomial ring is a special case when the underlying affine semigroup is generated by an n×n identity matrix I. Sincethecone R≥0I is a simplicial cone, i.e., every subset of rays form a face, we may interpret V as a face. The following example shows 1 1 0 0 3 2 3 2 the different notations for the standard pairs of a monomial ideal I = hx 1 , x 2 , x 2 , x 3 i in the polynomial ring K[x1, x2, x3]. In Macaulay2, i1 : R = QQ[x,y,z]; i2 : I = monomialIdeal(x*yˆ3*z, x*yˆ2*zˆ2, yˆ3*zˆ2, yˆ2*zˆ3) 3 22 32 23 STANDARD PAIRS OF MONOMIAL IDEALS OVER NON-NORMAL AFFINE SEMIGROUPS IN SageMath 3 o2 = monomialIdeal (x*y z, x*yz,yz,yz) o2 : MonomialIdeal of R i3 : standardPairs I o3 = {{1, {x, z}}, {y, {x, z}}, {1, {x, y}}, {z, {y}}, 2 22 {y z, {x}}, {y z , {}}} o3 : List whereas in the given library stdPairs.spyx in SageMath, sage: load("˜/stdPairs.spyx") Compiling /Users/byeongsuyu/stdPairs.spyx... sage: A = matrix(ZZ,[[1,0,0],[0,1,0],[0,0,1]]) sage: Q = affineMonoid(A) sage: M = matrix(ZZ,[[1,1,0,0],[3,2,3,2],[1,2,2,3]]) sage: I = monomialIdeal(Q,M) sage: I.standardCover() {(): [([[0], [2], [2]]ˆT,[[], [], []])], (1,): [([[0], [0], [1]]ˆT,[[0], [1], [0]])], (0,): [([[0], [2], [1]]ˆT,[[1], [0], [0]])], (0, 2): [([[0], [1], [0]]ˆT,[[1, 0], [0, 0], [0, 1]]), ([[0], [0], [0]]ˆT,[[1, 0], [0, 0], [0, 1]])], (0, 1): [([[0], [0], [0]]ˆT,[[1, 0], [0, 1], [0, 0]])]}

2.2. Classes in stdPairs.spyx. We implement three classes related to affine semigroup, semi- group ideal, and proper pair respectively. This implementation is based on SageMath 9.1 with Python 3.7.3. and 4ti2 package.

2.2.1. Class affineMonoid. This class is constructed by using an integer matrix A. The name follows the convention of SageMath which distinguishes monoid from semigroup. In SageMath, A can be expressed as a 2-dimensional Numpy array or an integer matrix of SageMath. For example, sage: A = matrix(ZZ,[[1,2],[0,2]]) sage: load("stdPairs.spyx") Compiling ./stdPairs.spyx... sage: Q = affineMonoid(A) generates Q as a type of affineMonoid. This class has several member variables and member functions as explained below. • Q.gens stores a matrix generating an affine monoid Q as Numpy.ndarray type. This may not be a minimal generating set of Q. • Q.mingens stores a minimal generating matrix of an affine monoid of Q. • Q.poly is a real cone R≥0Q represented as a type of Polyhedron in SageMath. If one generates Q with True parameter, i.e., 4 BYEONGSU YU

sage: A = matrix(ZZ,[[1,2],[0,2]]) sage: load("stdPairs.spyx") Compiling ./stdPairs.spyx... sage: Q = affineMonoid(A,True) then Q.poly is of a class of Normaliz integral polyhedron. This requires PyNormaliz package. See [5] for more details. • Q.faceLattice is a finite lattice containing all faces of the affine semigroup. A face in the lattice is saved as a tuple storing column numbers of generators A. Q.faceLattice is of type of Finite Lattice Poset in SageMath. For example, sage: Q.faceLattice Finite lattice containing 5 elements with distinguished linear extension sage: Q.faceLattice.list() [(-1,), (), (0,), (1,), (0, 1)] • Q.indexToFace is a dictionary type whose key is a face as a tuple, and whose item is a face as an element of Q.poly. For example, sage: Q.indexToFace {(-1,): A -1-dimensional face of a Polyhedron in ZZˆ2, (): A 0-dimensional face of a Polyhedron in ZZˆ2 defined as the convex hull of 1 vertex, (0,): A 1-dimensional face of a Polyhedron in ZZˆ2 defined as the convex hull of 1 vertex and 1 ray, (1,): A 1-dimensional face of a Polyhedron in ZZˆ2 defined as the convex hull of 1 vertex and 1 ray, (0,1): A 2-dimensional face of a Polyhedron in ZZˆ2 defined as the convex hull of 1 vertex and 2 rays} • Q.integralSupportVectors is a dictionary type whose key is a face F as a tuple and whose item is a set of the integral support functions of facets containing F as a vector form. d An integral support function φH of a facet H is a linear function φH : R → R such that d φH(Z ) = Z, φH(a) ≥ 0 for all column vectors a of generators A, and φH(a)=0 if and only if a ∈ H. By linearity, φH(a) = b · a for some rational vector b. We call b as an integral support vector. Each item of Q.integralSupportVectors returns a matrix whose rows are integral support vectors of facets containing the key. For example, sage: Q.integralSupportVectors {(): array([[ 0, 1], [ 1, -1]]), (0,): array([[0, 1]]), (1,): array([[ 1, -1]]), (0, 1): array([], dtype=float64)} See [6, Definition 2.1] for the precise definition of a (primitive) integral support function. • Q.isEmpty() returns a boolean value indicating whether Q is a trivial affine semigroup or not. A trivial affine semigroup is an empty set as an affine semigroup. • Q.isPointed() returns a boolean value indicating whether Q is a pointed affine semigroup or not. STANDARD PAIRS OF MONOMIAL IDEALS OVER NON-NORMAL AFFINE SEMIGROUPS IN SageMath 5

• Q.isElement(vector b) returns nonnegative integral inhomogeneous solutions (minimal integer solutions) of Ax = b using zsolve in [1]. If b is not an element of an affine semigroup Q, then it returns an empty matrix. • Q.IntersectionOfPairs(vector a, tuple F , vector b, tuple G) gives nonnegative integral inhomogeneous solutions (minimal integer solutions) of u [ F −G ][ v ]= b − a using zsolve in [1], where F and G are submatrices of A corresponding to its tuple forms respectively. This equation has solutions if and only if two pairs (a, F) and (b, G) have a common element. This returns an empty matrix if it has no solution. • Q.Face(tuple index) returns a face as a submatrix of a generator A corresponding to a given tuple index. For example, sage: Q.Face((1,)) array([[2], [2]]) • Q.IndFace(matrix face) returns a face as a tuple of indices of column vectors of a gen- erator A corresponding to a given submatrix face of A. For example, sage: M = matrix(ZZ,[[2],[2]]) sage: Q.IndFace(M) (1,) • Q.primeIdeal(tuple face) returns a prime ideal corresponding to the face represented by face as an object of monomialIdeal. sage: Q.primeIdeal((1,)) An ideal whose generating set is [[1] [0]] • Q.save(string path) saves the given affineMonoid object as a text file. This can be loaded again using load stdPairs(string path), which will be explained in Sec- tion 2.3. If the save is successful, then it returns 1. • Q.hashstring is a string unique for the (mathematically) same affine monoid. Moreover, one can directly compare affine semigroups using the equality operator == in SageMath.

2.2.2. Class monomialIdeal. This class is constructed by an affine semigroup Q and gener- ators of an ideal as a matrix form, say M, which is a 2-dimensional Numpy array or an integer matrix of SageMath. For example, sage: M = matrix(ZZ,[[4,6],[4,6]]) sage: I = monomialIdeal(Q,M) sage: I An ideal whose generating set is [[4] [4]] As shown in the example above, this class stores only minimal generators of the ideal. The member variables and functions are explained below. 6 BYEONGSU YU

• I.gens shows a (minimal) generators of I as a Numpy array form. • I.ambientMonoid stores the ambient affine semigroup of I. • I.isPrincipal() returns a boolean value indicating whether I is principal or not. Like- wise, I.isEmpty(), I.isIrreducible(), I.isPrimary(), I.isPrime(), and I.isRadical() return a boolean value indicating whether I has the properties implied by their name or not. • I.isElement(vector b) returns nonnegative integral inhomogeneous solutions (minimal integer solutions) of Ax = b − a for each generator a of I using zsolve in [1]. If b is an element of ideal, then it returns a list [x, a] for some generator a such that a + AxT = b. Otherwise, it returns an empty matrix. • I.isStdMonomial(vector b) returns a boolean value indicating whether the given vec- tor b is a standard monomial or not. • radicalIdeal(I) returns the radical of I as an monomialIdeal object. • I.standardCover() returns the standard cover of I. The definition of standard cover and algorithms will be given in Section 3.1. • I.overlapClasses() returns the overlap classes of I. An overlap class of an ideal I is a set of standard pairs such that their representing submonoids intersect nontrivially. Moreover, I.maximalOverlapClasses() returns all maximal overlap classes of I. See [6, Section 3] for the detail. • I.associatedPrimes() returns all associated prime ideals of I as a dictionary type in Python. In other words, the function returns a dictionary whose keys are faces of the affine semi- group as tuple form and whose value is a list containing associated prime ideals corresponding to the face in its key. • I.multiplicity(ideal P or face F) returns a multiplicity of an associated prime P over the given ideal I. Also, the method takes the face F (as a tuple) corresponding to a prime ideal P as input instead. • I.irreducibleDecomposition() returns the irredundant irreducible primary decompo- sition of I as a list. Since it takes a lot of time, this library also provides a method which calculates only one irreducible primary component corresponding to a maximal overlap class. This class is I.irreducibleComponent(tuple face, list ov class), where ov class is a maximal overlap class of I and face is a face corresponding to the overlap class ov class. • I.intersect(J) returns an intersection of two ideals I and J as a monomialIdeal object. Likewise, addition +, multiplication ∗, and comparison == are defined between two objects. The following example shows an addition of two monomial ideals in SageMath.

sage: I = monomialIdeal(Q,matrix(ZZ,[[4,6],[4,6]])) sage: J = monomialIdeal(Q,matrix(ZZ,[[5],[0]])) sage: I.intersect(J) An ideal whose generating set is [[9] [4]] sage: I+J An ideal whose generating set is [[5 4] [0 4]] STANDARD PAIRS OF MONOMIAL IDEALS OVER NON-NORMAL AFFINE SEMIGROUPS IN SageMath 7

• I.save(string path) saves the given monomialIdeal object I as a text file. Espe- cially, it saves not only the generators of I, but also its standard cover, overlap classes, associ- ated primes, and irreducible primary decompositions if they were calculated. This can be loaded again using load stdPairs(string path), which will be explained in Section 2.3. If the save is successful, then it returns 1. • I.hashstring is a string unique for the (mathematically) same ideal.

2.2.3. Class properPair. A proper pair (a, F) of an ideal I can be declared in SageMath by specifying an ideal I, a standard monomial a as a matrix form (or Numpy 2D array), and a face F as a tuple. If (a, F) is not proper, then SageMath calls a ValueError. The following example shows two ways of defining a proper pair. sage: I = monomialIdeal(Q,matrix(ZZ,[[4,6],[4,6]])) sage: PP = properPair(np.array([2,0])[np.newaxis].T,(0,),I) sage: PP ([[2], [0]]ˆT,[[1], [0]]) sage: QQ = properPair(np.array([2,0])[np.newaxis].T,(0,),I, True) sage: QQ ([[2], [0]]ˆT,[[1], [0]]) The second line tests whether the pair is a proper pair of the given ideal I or not before generating PP. However, the fourth line generates QQ without such a test. Use the third parameter with True only if the generating pair is proper a priori. In any case, each PP and QQ denotes proper pair 2 1 whose initial monomial is [ 0 ] and whose face is [ 0 ]. The member variables and functions are explained below. We assume that PP denotes a proper pair (a, F). • PP.monomial, PP.face, and PP.ambientIdeal return the initial monomial a (as Numpy 2D array), the face F (as a tuple), and its ambient ideal (as an object of affineMonoid) respectively. • PP.isMaximal() returns a boolean value indicating whether the given pair is maximal with respect to the divisibility of proper pairs of the ambient ideal. • PP.isElement(vector b) returns nonnegative integral inhomogeneous solutions (mini- mal integer solutions) of a + Fx = b using zsolve in [1]. If b is not an element of the submonoid a + NF, then it returns an empty matrix. • divides(pair PP, pair QQ) returns a matrix whose row u is a minimal solution of a + Au + NF = b + NG if PP =(a, F) and QQ =(b, G). The returned value is a nonempty matrix if and only if a pair PP divides a pair QQ. For example, sage: I = monomialIdeal(Q,matrix(ZZ,[[4,6],[4,6]])) sage: PP = properPair(matrix(ZZ,[[2],[0]]),(0,),I) sage: PP ([[2], [0]]ˆT,[[1], [0]]) sage: QQ = properPair(matrix(ZZ,[[2],[0]]),(0,),I,True) sage: QQ ([[2], [0]]ˆT,[[1], [0]]) sage: divides(PP,QQ) [0 0 0] 8 BYEONGSU YU

since PP = QQ. • Like affineMonoid or monomialIdeal, one can directly compare proper pairs using the equality operator == in SageMath. • PP.hashstring is a string unique for the (mathematically) same proper pair.

2.3. Global methods. Global methods are introduced below. • unique monoids(list L), unique ideals(list L), unique pairs(list L) and unique np arrays(list L) receive a list of variables whose type is affineMonoid, monomialIdeal, properPair and numpy 2D array respectively, and return a list of (mathematically) distinct objects. • save cover(dict cover, affineMonoid Q, string path) saves a cover, a dict type object whose keys are faces (as tuple objects) of Q and whose values are a list of pairs (as properPair objects) into a file located in path. Note that all pairs are saved as proper pairs under the empty ideal. If the save is successful, then it returns 1. • load stdPairs(string path) loads an affineMonoid object, an monomialIdeal object, or a cover stored in a file located in path. It is useful for users who want to avoid repeating calculation which was previously done. For example, sage: I = load_stdPairs("/Users/byeongsuyu/ex_ideal.txt") sage: I.ambientMonoid An affine semigroup whose generating set is [[1 1 2 3] [1 2 0 0]] sage: I An ideal whose generating set is [[3 5 6] [2 1 1]] sage: I.irreducibleDecomposition() [An ideal whose generating set is [[3 4 2 3 5] [2 0 4 4 0]], An ideal whose generating set is [[2 3] [0 0]], An ideal whose generating set is [[1 1] [1 2]]] sage: shows that the library loads pre-calculated irreducible decomposition of the given ideal. This save file can be obtained via https://github.com/byeongsuyu/StdPairs.

3. IMPLEMENTATION OF AN ALGORITHM FINDING STANDARD PAIRS

3.1. Case 1: Principal Ideal. A cover of standard monomials of an ideal I is a set of proper pairs of I such that the union of all subsemigroup a + NF corresponding to an element (a, F) of the cover is equal to the set of all standard monomials. The standard cover of an ideal I is a cover of I whose elements are standard pairs. The standard cover of a monomial ideal I is unique by the maximality of standard pairs among all proper pairs of I. A key idea in [6, Section 4] is to STANDARD PAIRS OF MONOMIAL IDEALS OVER NON-NORMAL AFFINE SEMIGROUPS IN SageMath 9 construct covers containing all standard pairs. Once a cover is obtained, we can then produce the standard cover. The following result helps to compute the standard cover in the special case of a principal ideal. Theorem 1 ([6, Theorem 4.1]). Let b, b′ ∈ NA and let G, G′ be faces of A such that G∩G′ = G. There exists an algorithm to compute a finite collection C of pairs over faces of G such that ′ ′ (b + G) r (b + G )= ∪(a,F)∈C (a + F).

The pair difference of the pairs (b, G) and (b′, G′) is a finite collection of pairs over faces of G given by Theorem 1. Corollary 2. Given a principal ideal I = hbi, the pair difference of pairs (0, A) and (b, A) is the standard cover of I.

Proof. Theorem 1 implies that the pair difference is a cover of I. To see it is the standard cover, suppose that the ambient affine semigroup is generated by A = [ a1 ··· an ] . Let (c, F ) be a proper pair in the pair difference. Without loss of generality, we assume that F = [ a1 ··· am ] for some m < n by renumbering indices. By the proof of Theorem 1 in [6], c = A · u where xu ∈ K[Nn] is u a standard monomial such that (x , {x1, ··· , xm}) is a standard pair of some monomial ideal J in K[Nn]. Suppose that there exists (d, G) such that F ⊆ G and d + g = c for some g ∈ G. Since d ∈ NA, d = Aw for some w ∈ Nn. Since A is pointed, w is coordinatewise less than u. w u w Thus, (x , {x1, ··· , xm}) contains (x , {x1, ··· , xm}). Lastly, (x , {x1, ··· , xm}) is a proper v n w+v pair of J, otherwise, there exists x ∈ K[x1, ··· , xm] ⊆ K[N ] such that x ∈ J. Then, g w+v u+v u x x ∈ J =⇒ x ∈ J ∩ (x , {x1, ··· , xm})= ∅ leads to a contradiction. Thus, by maximality of the standard pair, w = u. This implies d = c. Moreover, G = F , other- r u l wise there exists j ∈{1, 2, ··· , n} {1, ··· , m} such that x xj 6∈ J for any l, which implies that u u (x , {x1, ··· , xm, xj}) is a proper pair of J strictly containing a standard pair (x , {x1, ··· , xm}) of J, a contradiction. 

Theorem 1 is implemented as a method pair difference((b, F), (b′, F′)) in the library stdPairs.spyx. Two input arguments should be the type of properPair. It returns the pair difference of pairs (b, F) and (b′, F′) with dictionary type, called Cover. Cover classifies pairs by its faces. For example, the code below shows the pair difference of pairs (0, A) and ((0, 2), A), which are

2 0 2 1 2 1 2 0, , , , , , and ,  0 1 0 2 0 1 0 sage: B = affineMonoid(matrix(ZZ, [[2,0,1],[0,1,1]])) sage: I = monomialIdeal(B, matrix(ZZ,0)) sage: C= properPair(np.array([[0,0]]).T, (0,1,2), I ) sage: D= properPair(np.array([[0,2]]).T, (0,1,2), I ) sage: print(pair_difference(C,D)) {(0,): [([[1], [1]]ˆT,[[2], [0]]), ([[1], [2]]ˆT,[[2], [0]]), ([[0], [1]]ˆT,[[2], [0]]), ([[0], [0]]ˆT,[[2], [0]])]} 10 BYEONGSU YU

By Corollary 2, it is a set of all standard pairs of an ideal I = h(0, 2)i in an affine semigroup N 2 0 1 [ 0 1 1 ]. pair difference((b, F), (b′, F′)) uses standardPairs of Macaulay2 internally to find standard pairs of a polynomial ring, which is implemented by [4]. Briefly, this method pair difference((b, F), (b′, F′)) calculates minimal solution of the integer linear sys- tem u F −F ′ = b′ − b v   using zsolve in 4ti2. The solutions form an ideal J of a polynomial ring in the proof of Theorem 1 on Macaulay2. standardPairs derives standard pairs of J. Lastly, the method pair difference constructs proper pairs based on the standard pairs of J, and classify the proper pairs based on their faces and return the pair difference.

3.2. Case 2: General ideal. [6, Proposition 4.4] gives an algorithm to find the standard cover of non-principal monomial ideals. Proposition 3 ([6, Proposition 4.4]). Let I be a monomial ideal in K[NA]. There is an algorithm whose input is a cover of the standard monomials of I, and whose output is the standard cover of I.

According to the proof of [6, Proposition 4.4], this is achieved by repeating the procedures below.

(1) Input: C0, an initial cover of I. (2) For each (a, F ) ∈ C0, find minimal solutions of (a + RF ) ∩ NA using the primitive integral support functions. (See [6, Lemma 4.2] for the detail.) • If b1, b2, ··· , bm are minimal solutions of (a + RF ) ∩ NA, construct pairs such as (b1, F ), (b2, F ), ··· , (bm, F ) and store them in the variable C1. (3) For each pair (b, F ) ∈ C1, construct (b,G) for any face G which is not strictly contained in F . If (b,G) is a proper pair of I, save (b,G) on the variable C2. (4) If C0 is equal to C2, done. Otherwise, set C0 := C2 and repeat the above process. czero to cone(C0, I) method in stdPairs.spyx implements Item 2 to return C1. It calls minimalHoles(vector a, face F, affine semigroup A) internally, which is the implementation of Lemma 4.2. cone to ctwo(C1, I) method implements Item 3. Since the constructor function of the class properPair checks whether the pair is proper or not, the method cone to ctwo(C1, I) tries to construct proper pairs as a variable in SageMath and record it if it is successful. Lastly, cover to stdPairs( C,I, loopNum=1000) imple- ments the whole procedure Section 3.2. Though Proposition 3 shows that the given procedure terminates with finitely many steps, we set loopNum for safety. loopNum determines how many steps the loop can use for finding standard pairs. The default value is 1000. Now we are ready to find the standard cover of a general ideal I whose minimal generators are hb1, ··· , bni, one can find standard pairs as in [6, Theorem 4.5] described below.

(1) Find the standard cover C of hb1i using pair difference. (2) For i =2 to n: (a) For each pair (b, F ) in C, replace it with elements of the pair difference of pairs (b, F ) and (bi, A). After this process C is a cover of an ideal hb1, b2, ··· , bii. ′ (b) Using an algorithm of Proposition 3 find the standard cover C of hb1, b2, ··· , bii. STANDARD PAIRS OF MONOMIAL IDEALS OVER NON-NORMAL AFFINE SEMIGROUPS IN SageMath 11

(c) Replace C with C′. (3) Return C. The returned value C is now the standard cover of I. stdPairs.spyx implements [6, Theorem 4.5] as a method standardPairs(I). This method has an input I whose type is monomialIdeal. It returns a cover whose type is dictionary, classifying standard pairs by its face. For example, the code below shows that 2 2 2 0110 the standard cover of an ideal generated by 0 1 2 in an affine semigroup NA = N 0011 is h 2 2 2 i h 1111 i 0 0 1 0 0 1 0 0 0, 0 1 , 1 , 0 1 , and 0 , 0 1 . n h 1 1 i h 1 i h 1 1 i h 1 i h 1 1 io sage: Q=affineMonoid(matrix(ZZ,[[0,1,1,0],[0,0,1,1],[1,1,1,1]])) sage: I=monomialIdeal(Q, matrix(ZZ,[[2,2,2],[0,1,2],[2,2,2]])) sage: I.standardCover() It takes a few minutes, depending on the system. Cover for 1 generator was calculated. 2 generators are left. Cover for 2 generators was calculated. 1 generators are left. Cover for 3 generators was calculated. 0 generators are left. {(0, 3): [([[0], [0], [0]]ˆT,[[0, 0], [0, 1], [1, 1]]), ([[1], [1], [1]]ˆT,[[0, 0], [0, 1], [1, 1]]), ([[1], [0], [1]]ˆT,[[0, 0], [0, 1], [1, 1]])]}

4. COMPATIBILITY WITH NORMALIZ PACKAGE IN SAGEMATH AND MACAULAY2

Normaliz is a package in SageMath and Macaulay2 for finding Hilbert bases of rational cones and its normal affine monoid [3]. stdPairs.spyx has methods translating classes in Section 2 into objects in the Normaliz package. If an affine semigroup NA is normal, i.e., d NA = Z ∩R≥0A, then this translation works well. However, if it is not normal, then this translates into the saturation of the given affine semigroup described in Section 2. For SageMath, one can have a polyhedron over Z with the Normaliz package in SageMath by adding an argument True on the constructor of affineMonoid. For example, the code below gives an affineMonoid class variable Q whose member variable Q.poly is a polyhedron over Z with Normaliz. sage: load("stdPairs.spyx") Compiling ./stdPairs.spyx... sage: Q=affineMonoid(matrix(ZZ, [[0,1,1,0],[0,0,1,1],[1,1,1,1]]), True) For Macaulay2, ToMacaulay2( monomialIdeal I) returns a dictionary storing variable of Macaulay2 computations. This dictionary contains affine semigroup ring, a list of generators of an ideal, and a list of standard pairs in Macaulay2. For example, sage: load("stdPairs.spyx") Compiling ./stdPairs.spyx... sage: Q=affineMonoid(matrix(ZZ,[[0,1,1,0],[0,0,1,1],[1,1,1,1]])) sage: I=monomialIdeal(Q, matrix(ZZ,[[2,2,2],[0,1,2],[2,2,2]])) sage: S = ToMacaulay2(I,I.standardCover()) 12 BYEONGSU YU

sage: print(S[’AffineSemigroupRing’]) MonomialSubalgebra{cache => CacheTable{} } generators => {c, a*c, a*b*c, b*c} ring => R sage: print(S[’MonomialIdeal’]) 22 2 2 222 {a c , a b*c,abc} sage: print(S[’StandardCover’]) {{a*c, {c, b*c}}, {a*b*c, {c, b*c}}, {1, {c, b*c}}} In Macaulay2, a type MonomialSubalgebra in the Normaliz package may correspond to an affine semigroup ring. Since Normaliz has no attributes for a monomial ideal of the type MonomialSubalgebra, the ideal is stored as a list of its generators. The standard cover of I is also sent to Macaulay2 as a nested list, similar to the output of the method standardPairs in Macaulay2. Conversely, FromMacaulay( Macaulay2 S) translates monomialSubalgebra object S of Macaulay2 into an affineMonoid object in stdPairs.spyx. For example, sage: R = macaulay2(’ZZ[x,y,z]’) sage: macaulay2("loadPackage Normaliz") Normaliz sage: S=macaulay2(’createMonomialSubalgebra {xˆ2*y, x*z, zˆ3}’) sage: A=FromMacaulay(S) sage: A An affine semigroup whose generating set is [[2 1 0] [1 0 0] [0 1 3]]

REFERENCES [1] 4ti2 team. 4ti2—a software package for algebraic, geometric and combinatorial problems on linear spaces. [2] Winfried Bruns and J¨urgen Herzog. Cohen-Macaulay rings, volume 39 of Cambridge Studies in Advanced Math- ematics. Cambridge University Press, Cambridge, 1993. [3] Winfried Bruns and Bogdan Ichim. Normaliz: algorithms for affine monoids and rational cones. J. Algebra, 324(5):1098–1113, 2010. [4] Serkan Hos¸ten and Gregory G. Smith. Monomial ideals. In Computations in with Macaulay 2, volume 8 of Algorithms Comput. Math., pages 73–100. Springer, Berlin, 2002. [5] Matthias K¨oppe and Jean-Philippe Labb´u. The normaliz backend for polyhedral computations. [6] Laura Matusevich and Byeongsu Yu. Standard pairs for monomial ideals in semigroup rings. preprint, 2020. [7] Ezra Miller and . Combinatorial commutative algebra, volume 227 of Graduate Texts in Mathe- matics. Springer-Verlag, New York, 2005. [8] Bernd Sturmfels, NgˆoViˆet Trung, and Wolfgang Vogel. Bounds on degrees of projective schemes. Math. Ann., 302(3):417–432, 1995.

MATHEMATICS DEPARTMENT,TEXAS A&M UNIVERSITY, COLLEGE STATION, TX 77843 Email address: [email protected]