86 CHAPTER 4. ALGORITHMS FOR STABLE IDEALSwhenever the value <strong>of</strong> the integer a 0 equals 0 or the Hilbert polynomial is a constantpolynomial. Hence, in this case we have to remove the monomial x a 00 · x a 11 · . . . · x a 2+1n−2 fromthe set <strong>of</strong> generators. This monomial corresponds to x 3 1 in our example.We now use the code listed in 4.7 to compute the lexicographic ideals to the Hilbertpolynomials <strong>of</strong> Example 2.26.Example 4.8. Let R := K[x 0 , x 1 , x 2 , x 3 ], i.e. n = 3.(i) p(z) = 2z + 1.MuPAD>> compute_L_p(poly(2*z+1,[z]), 3);Output[[1, 0, 0, 0], [0, 2, 0, 0]]Indeed, the two lists [1, 0, 0, 0] and [0, 2, 0, 0] correspond to the monomials x 0 , x 2 1, i.e. L p =(x 0 , x 2 1).(ii) p(z) = 3z + 1.MuPAD>> compute_L_p(poly(3*z+1,[z]), 3);Output[[1, 0, 0, 0], [0, 4, 0, 0], [0, 3, 1, 0]]i.e. the lexicographic ideal L p is generated by x 0 , x 4 1 and x 3 1x 2 .(iii) p(z) = 2z 2 + 2z + 1 and R := K[x 0 , x 1 , x 2 , x 3 , x 4 ], i.e. n = 4.MuPAD>> compute_L_p(poly(2*z^2 + 2*z + 1,[z]), 4);Output[[1, 0, 0, 0, 0], [0, 5, 0, 0, 0], [0, 4, 3, 0, 0], [0, 4, 2, 6, 0]]i.e. L p = (x 0 , x 5 1, x 4 1x 3 2, x 4 1x 2 2x 6 3). As we can see, the lexicographic ideals computed via 4.7equal those <strong>of</strong> Example 2.26.In all <strong>of</strong> these examples, we can enlarge the value <strong>of</strong> n to obtain the specific lexicographicideal in a polynomial ring with more variables. One can see that there will be exactly one
4.4. COMPUTING EXPANSIONS AND CONTRACTIONS 87more variable included into the set <strong>of</strong> generators <strong>of</strong> the unique lexicographic ideal L p if weincrease the value <strong>of</strong> n by 1:(iv) p(z) = 2z 2 + 2z + 1 and R := K[x 0 , x 1 , x 2 , x 3 , x 5 ], i.e. n = 5.MuPAD>> compute_L_p(poly(2*z^2 + 2*z + 1,[z]), 5);Output[[1, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0], [0, 0, 5, 0, 0, 0],[0, 0, 4, 3, 0, 0], [0, 0, 4, 2, 6, 0]]i.e. L p = (x 0 , x 1 , x 5 2, x 4 2x 3 3, x 4 2x 2 3x 6 4).4.4 Computing expansions and contractionsIn the last section <strong>of</strong> Chapter 3, we frequently used expansions and contractions <strong>of</strong> monomialsas one <strong>of</strong> the central tools to prove that all saturated stable ideals with the same Hilbertpolynomial (and the same double saturation) are linked to each other by expansions andcontractions. Furthermore, we saw in Corollary 3.37 that to a given Hilbert polynomialp(z), we can compute all unique lexicographic ideals L H to Hilbert series H(t) associatedto the Hilbert polynomial p(z) from the unique lexicographic ideal L p by expansions andcontractions. Within this section we present the MuPAD source code to compute expansionsand contractions with the computer algebra system.Again we will use lists to encode monomials and a list <strong>of</strong> lists to encode the set <strong>of</strong> generators<strong>of</strong> any stable ideal.MuPAD Source Code 4.9. The procedure below presents a possible implementation <strong>of</strong>the expansion <strong>of</strong> a monomial m ∈ M in a stable ideal I ⊂ R. The input for the procedureis defined to be the set <strong>of</strong> minimal generators M <strong>of</strong> a stable ideal I in descending lexicographicorder, a monomial m, which is expandable in I, and the index n <strong>of</strong> the last variablein R. It returns a list <strong>of</strong> lists encoding the new set <strong>of</strong> minimal generators in lexicographicorder.Input for the procedure compute expansion.◦ M — a list <strong>of</strong> lists encoding the set <strong>of</strong> generators <strong>of</strong> some stable ideal in lexicographicorder◦ m — a list encoding the monomial to be expanded◦ n — the index <strong>of</strong> the last variable <strong>of</strong> the polynomial ring R