98 CHAPTER 4. ALGORITHMS FOR STABLE IDEALSend_for;end_for;if cnt = 0 thenreturn(TRUE);else return(FALSE);end_if;end_proc:The use <strong>of</strong> procedures 4.13 and 4.14 is demonstrated by the following short examples – wewill see, how they are used in the context <strong>of</strong> the algorithm to compute all saturated stableideals to a given Hilbert polynomial in the next section.Example 4.15. We consider the ideal I := (x 2 0, x 0 x 1 , x 0 x 2 , x 3 1) ⊂ K[x 0 , x 1 , x 2 , x 3 ].(i) The monomial x 2 1 is contractible in IMuPAD>> test_contractible([[2,0,0,0],[1,1,0,0],[1,0,1,0],[0,3,0,0]],>> [0,2,0,0], 3);OutputTRUEbut it is not expandable in IMuPAD>> test_expandable([[2,0,0,0],[1,1,0,0],[1,0,1,0],[0,3,0,0]],>> [0,2,0,0], 3)OutputFALSEas the above lines suggest.(ii) The monomial x 3 1 is expandable in IMuPAD>> test_expandable([[2,0,0,0],[1,1,0,0],[1,0,1,0],[0,3,0,0]],>> [0,3,0,0], 3)OutputTRUE
4.5. COMPUTING STABLE IDEALS TO A GIVEN HILBERT POLYNOMIAL 99but not contractible in I:MuPAD>> test_contractible([[2,0,0,0],[1,1,0,0],[1,0,1,0],[0,3,0,0]],>> [0,3,0,0], 3)OutputFALSE4.5 Computing stable ideals to a given Hilbert polynomialWithin this section we come to the main result <strong>of</strong> this thesis – the algorithm to computeall saturated stable ideals to a given Hilbert polynomial.In Chapter 3, Theorem 3.32 states that all saturated stable ideals with the same doublesaturation and the same Hilbert polynomial are linked by finite sequences <strong>of</strong> paired contractionsand expansions. In the following we present an algorithm to compute all saturatedstable ideals with the same double saturation and the same Hilbert polynomial as a givensaturated stable ideal I. Since the source code is a little more complicated than that, wepresented in the preceding sections, we first give the algorithm in pseudo code, so that thesingle steps and the ideas behind it become clear.Algorithm 4.16. (Computation <strong>of</strong> all saturated stable ideals with the same Hilbert polynomialand the same double saturation) Let I ⊂ R be a saturated stable ideal. The followingalgorithm computes all saturated stable ideals with the same Hilbert polynomial and thesame double saturation as I.Input. A saturated stable ideal I.1. Set M := {I}.2. Find all contractible monomials m 1 , . . . , m s in I, which contain the last variable x n−1 .For each <strong>of</strong> these monomials, compute the contraction. This provides a set <strong>of</strong> idealsJ 1 , . . . , J s .3. For i = 1, . . . , s repeat the following steps: Find all expandable monomials ˜m 1 , . . . , ˜m tiin J i . For each <strong>of</strong> the monomials ˜m 1 , . . . , ˜m ti , compute the expansion. This providesa set <strong>of</strong> ideals ˜J i1 , . . . , ˜J iki . Include those ideals into the set M, which are not yetcontained in M.4. If no more ideals have been included into the set M within step 3, stop the computation.Otherwise perform step 2 and 3 for each <strong>of</strong> the ideals ˜J i1 , . . . , ˜J iki , i = 1, . . . , s,which have been included into the set M in step 3.