//SINGULAR Procedure4.6.6 //============================ we need ======================== LIB"elim.lib"; proc prepareSat(ideal i) { int k; poly p=leadcoef(i[1]); for(k=2;k<=size(i);k++) { p=p*leadcoef(i[k]); } return(p); } proc prepareQuotientring(ideal i) "USAGE: prepareQuotientring(i); i standard basis RETURN: a list l of two strings: l[1] to define K[x\u,u ], u a maximal independent set for i l[2] to define K(u)[x\u ], u a maximal independent set for i both rings with lexicographical ordering " { string va,pa; //v describes the independent set u: var(j) is in //u iff v[j]!=0 intvec v=indepSet(i); int k; for(k=1;k<=size(v);k++) { if(v[k]!=0) { pa=pa+"var("+string(k)+"),"; } else { va=va+"var("+string(k)+"),"; } } pa=pa[1..size(pa)-1]; va=va[1..size(va)-1]; string newring ="ring nring=("+charstr(basering)+"),("+va+","+pa+"),lp;"; string quotring ="ring quring=("+charstr(basering)+","+pa+"),("+va+"),lp;"; return(newring,quotring); } //============================================================== proc equidimensional(ideal i) "USAGE: equidimensional(i); i ideal RETURN: list l of two ideals such that intersection(l[1], l[2])=i if there are no embedded primes l[1] is equidimensional and dim(l[1])>dim(l[2]) EXAMPLE: example equidimensional; shows an example " { def BAS = basering; ideal SBi=std(i); int d=dim(SBi); int n=nvars(BAS); int k; list result; //----the trivial cases if ((d==-1)||(n==d)||(n==1)||(d==0)) { result=i,ideal(1); return(result); } //----prepare the quotient ring with respect to a maximal // independent set list quotring=prepareQuotientring(SBi); execute (quotring[1]); //----we use this ring to compute a standard basis of // i*quring which is in i ideal eq=std(imap(BAS,i)); //----pass to the quotient ring with respect to a maximal // independent set execute (quotring[2]); ideal eq=imap(nring,eq); kill nring; //----preparation for saturation poly p=prepareSat(eq); //----back to the original ring setring BAS; poly p=imap(quring,p); ideal eq=imap(quring,eq); kill quring; //----compute the intersection of eq with BAS eq=sat(eq,p)[1]; SBi=std(quotient(i,eq)); if(d>dim(SBi)) { result=eq,SBi; return(result); } result=equidimensional(i); result=intersect(result[1],eq),result[2]; return(result); } ring r = 0,(x,y,z),dp; ideal i = intersect(ideal(x,y,z)^3,ideal(x-y-z)^2, ideal(x-y,x-z)^2); list pr= equidimensional(i); pr; dim(std(pr[1])); dim(std(pr[2])); option(redSB); std(i); std(intersect(pr[1],pr[2]));