92 CHAPTER 4. ALGORITHMS FOR STABLE IDEALSif m[i] - M[j][i] > 0 thendel:= del union {1};elif m[i] - M[j][i] < 0 thendel:= del union {-1};end_if;end_for;if contains(del, 1) = FALSE orcontains(del, -1) = FALSE thenInd:= Ind union {j};end_if;end_for;v:= 0;for ind in Ind doM[ind-v]:= null();v:= v+1;end_for;return(M);end_proc:The above procedure only uses the original definition <strong>of</strong> the contraction <strong>of</strong> a monomial.Again, as in 4.9, we wish to guarantee that the set <strong>of</strong> monomials returned by the algorithmis again a set <strong>of</strong> minimal generators. Hence, we first include m into the set M (note thatsince we contract m, m itself is not an element <strong>of</strong> the input set M) and then check if anymonomial m ′ to the left <strong>of</strong> m is divisible by m. If this is the case, we can remove m ′ fromM.Again, we consider a few examples:Example 4.12. Let R := K[x 0 , x 1 , x 2 , x 3 , x 4 ], i.e. n = 4.(i) Consider the ideal I 1 := (x 2 0, x 0 x 1 , x 0 x 2 , x 0 x 3 , x 5 1, x 4 1x 3 2, x 4 1x 2 2x 6 3). Contraction <strong>of</strong> x 0 ispossible and providesMuPAD>> compute_contraction([[2,0,0,0,0],[1,1,0,0,0],[1,0,1,0,0],>> [1,0,0,1,0],[0,5,0,0,0],[0,4,3,0,0],>> [0,4,2,6,0]],>> [1,0,0,0,0], 4);Output[[1, 0, 0, 0, 0], [0, 5, 0, 0, 0], [0, 4, 3, 0, 0], [0, 4, 2, 6, 0]]
4.4. COMPUTING EXPANSIONS AND CONTRACTIONS 93i.e. the ideal (x 0 , x 5 1, x 4 1x 3 2, x 4 1x 2 2x 6 3).(ii) Contraction <strong>of</strong> x 4 1x 3 2 in I 2 := (x 0 , x 5 1, x 4 1x 4 2, x 4 1x 3 2x 3 , x 4 1x 2 2x 6 3) providesMuPAD>> compute_contraction([[1,0,0,0,0],[0,5,0,0,0],[0,4,4,0,0],>> [0,4,3,1,0],[0,4,2,6,0]],>> [0,4,3,0,0], 4);Output[[1, 0, 0, 0, 0], [0, 5, 0, 0, 0], [0, 4, 3, 0, 0], [0, 4, 2, 6, 0]]which is the same ideal we obtained in (i).(iii) As a last example, we consider I 3the monomial x 4 1x 2 2.MuPAD:= (x 0 , x 5 1, x 4 1x 3 2, x 4 1x 2 2x 3 ), where we can contract>> compute_contraction([[1,0,0,0,0],[0,5,0,0,0],[0,4,3,0,0],>> [0,4,2,1,0]],>> [0,4,2,0,0], 4);Output[[1, 0, 0, 0, 0], [0, 5, 0, 0, 0], [0, 4, 2, 0, 0]]The output ideal is (x 0 , x 5 1, x 4 1x 2 ), where not only the monomial x 4 1x 2 2x 3 has been removedfrom the set <strong>of</strong> generators <strong>of</strong> I 3 , but also x 4 1x 3 2, which is no longer a minimal generator,since it is divisible by x 4 1x 2 2.Note that within the procedures 4.9 and 4.11, we did not check whether the monomials areexpandable or contractible in the ideal generated by the set M. Hence, we should only apply4.9 and 4.11 to ideals I and monomials m, where we know that m is expandable respectivelycontractible in the ideal I. In most cases, we know that the monomials considered areexpandable or contractible – in the last section <strong>of</strong> Chapter 3, we frequently used the factthat for instance the first monomial (with respect to the lexicographic order) containingthe last variable x n−1 in a set <strong>of</strong> minimal generators <strong>of</strong> a saturated stable ideal is alwayscontractible (see Lemma 3.17 and Remark 3.18). Hence, under this special conditions, thereis no need to check for contractibility. Later, we will be interested to get all expandablemonomials in a given set <strong>of</strong> minimal generators <strong>of</strong> a saturated stable ideal. Thus, in thiscase we need a procedure to check for the expandability <strong>of</strong> a given monomial. For the sake<strong>of</strong> completeness, we do not only state the code to check for the expandability, but also forthe contractibility <strong>of</strong> some monomial. We will make use <strong>of</strong> these procedures later.