source: git/Singular/LIB/normal.lib @ 62e2d6

spielwiese
Last change on this file since 62e2d6 was 62e2d6, checked in by Gerhard Pfister <pfister@…>, 23 years ago
equidimensionale Zerlegung eingefuegt git-svn-id: file:///usr/local/Singular/svn/trunk@4300 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 34.3 KB
Line 
1///////////////////////////////////////////////////////////////////////////////
2// normal.lib
3// algorithms for computing the normalization based on
4// the criterion of Grauert/Remmert and ideas of De Jong & Vasconcelos
5///////////////////////////////////////////////////////////////////////////////
6
7version="$Id: normal.lib,v 1.22 2000-05-08 15:52:50 pfister Exp $";
8info="
9LIBRARY:  normal.lib     PROCEDURES FOR NORMALIZATION
10AUTHORS:  Gert-Martin Greuel, email: greuel@mathematik.uni-kl.de,
11          Gerhard Pfister, email: pfister@mathematik.uni-kl.de
12
13PROCEDURES:
14 normal(I);             computes the normalization of basering/I
15 HomJJ(L);              presentation of End_R(J) as affine ring, L a list
16";
17
18LIB "general.lib";
19LIB "sing.lib";
20LIB "primdec.lib";
21LIB "elim.lib";
22LIB "presolve.lib";
23LIB "inout.lib";
24///////////////////////////////////////////////////////////////////////////////
25static
26proc isR_HomJR (list Li)
27"USAGE:   isR_HomJR (Li);  Li = list: ideal SBid, ideal J, poly p
28COMPUTE: module Hom_R(J,R) = R:J and compare with R
29ASSUME:  R    = P/SBid,  P = basering
30         SBid = standard basis of an ideal in P,
31         J    = ideal in P containing the polynomial p,
32         p    = nonzero divisor of R
33RETURN:  1 if R = R:J, 0 if not
34EXAMPLE: example isR_HomJR;  shows an example
35"
36{
37   int n, ii;
38 def P = basering;
39   ideal SBid = Li[1];
40   ideal J = Li[2];
41   poly p = Li[3];
42   attrib(SBid,"isSB",1);
43   attrib(p,"isSB",1);
44 qring R    = SBid;
45   ideal J  = fetch(P,J);
46   poly p   = fetch(P,p);
47   ideal f  = quotient(p,J);
48   ideal lp = std(p);
49   n=1;
50   for (ii=1; ii<=size(f); ii++ )
51   {
52      if ( reduce(f[ii],lp) != 0)
53      { n = 0; break; }
54   }
55   return (n);
56 //?spaeter hier einen Test ob Hom(I,R) = Hom(I,I)?
57}
58example
59{"EXAMPLE:";  echo = 2;
60  ring r   = 0,(x,y,z),dp;
61  ideal id = y7-x5+z2;
62  ideal J  = x3,y+z;
63  poly p   = xy;
64  list Li  = std(id),J,p;
65  isR_HomJR (Li);
66
67  ring s   = 0,(t,x,y),dp;
68  ideal id = x2-y2*(y-t);
69  ideal J  = jacob(id);
70  poly p   = J[1];
71  list Li  = std(id),J,p;
72  isR_HomJR (Li);
73}
74///////////////////////////////////////////////////////////////////////////////
75
76proc HomJJ (list Li)
77"USAGE:   HomJJ (Li);  Li = list: ideal SBid, ideal id, ideal J, poly p
78ASSUME:  R    = P/id,  P = basering, a polynomial ring, id an ideal of P,
79         SBid = standard basis of id,
80         J    = ideal of P containing the polynomial p,
81         p    = nonzero divisor of R
82COMPUTE: Endomorphism ring End_R(J)=Hom_R(J,J) with its ring structure where
83         R is the quotient ring of P modulo the standard basis SBid
84RETURN:  a list of two objects
85         _[1]: a polynomial ring, containing two ideals, 'endid' and 'endphi'
86               s.t. _[1]/endid = Hom_R(J,J) and
87               endphi describes the canonical map R -> Hom_R(J,J)
88         _[2]: an integer which is 1 if phi is an isomorphism, 0 if not
89NOTE:    printlevel >=1: display comments (default: printlevel=0)
90EXAMPLE: example HomJJ;  shows an example
91"
92{
93//---------- initialisation ---------------------------------------------------
94
95   int isIso,isPr,isCo,isRe,isEq,ii,jj,q,y;
96   intvec rw,rw1;
97   list L;
98   y = printlevel-voice+2;  // y=printlevel (default: y=0)
99 def P = basering;
100   ideal SBid, id, J = Li[1], Li[2], Li[3];
101   poly p = Li[4];
102   attrib(SBid,"isSB",1);
103   int homo = homog(Li[2]);               //is 1 if id is homogeneous, 0 if not
104
105//---- set attributes for special cases where algorithm can be simplified -----
106   if( homo==1 )
107   {
108      rw = ringweights(P);
109   }
110   if( typeof(attrib(id,"isPrim"))=="int" )
111   {
112      if(attrib(id,"isPrim")==1)  { isPr=1; }
113   }
114   if( typeof(attrib(id,"isIsolatedSingularity"))=="int" )
115   {
116      if(attrib(id,"isIsolatedSingularity")==1) { isIso=1; }
117   }
118   if( typeof(attrib(id,"isCohenMacaulay"))=="int" )
119   {
120      if(attrib(id,"isCohenMacaulay")==1) { isCo=1; }
121   }
122   if( typeof(attrib(id,"isRegInCodim2"))=="int" )
123   {
124      if(attrib(id,"isRegInCodim2")==1) { isRe=1; }
125   }
126   if( typeof(attrib(id,"isEquidimensional"))=="int" )
127   {
128      if(attrib(id,"isEquidimensional")==1) { isEq=1; }
129   }
130//-------------------------- go to quotient ring ------------------------------
131 qring R  = SBid;
132   ideal id = fetch(P,id);
133   ideal J  = fetch(P,J);
134   poly p   = fetch(P,p);
135   ideal f,rf,f2;
136   module syzf;
137
138//---------- computation of p*Hom(J,J) as R-ideal -----------------------------
139   if ( y>=1 )
140   {
141     "// compute p*Hom(J,J) = p*J:J, p a non-zerodivisor";
142     "//   p is equal to:"; "";
143     p;
144     "";
145   }
146   f  = quotient(p*J,J);
147   if ( y>=1 )
148   { "// the module p*Hom(J,J) = p*J:J, p a non-zerodivisor";
149      "// p"; p;
150      "// f=p*J:J";f;
151   }
152   f2 = std(p);
153
154   if(isIso==0)
155   {
156     ideal f1=std(f);
157     attrib(f1,"isSB",1);
158    // if( codim(f1,f2) >= 0 )
159    // {
160    //  dbprint(printlevel-voice+3,"// dimension of non-normal locus is zero");
161    //    isIso=1;
162    // }
163  }
164//---------- Test: Hom(J,J) == R ?, if yes, go home ---------------------------
165
166   rf = interred(reduce(f,f2));       // represents p*Hom(J,J)/p*R = Hom(J,J)/R
167   if ( size(rf) == 0 )
168   {
169      if ( homog(f) && find(ordstr(basering),"s")==0 )
170      {
171         ring newR1 = char(P),(X(1..nvars(P))),(a(rw),dp);
172      }
173      else
174      {
175         ring newR1 = char(P),(X(1..nvars(P))),dp;
176      }
177      ideal endphi = maxideal(1);
178      ideal endid = fetch(P,id);
179      L=substpart(endid,endphi,homo,rw);
180      def lastRing=L[1];
181      setring lastRing;
182
183      attrib(endid,"isCohenMacaulay",isCo);
184      attrib(endid,"isPrim",isPr);
185      attrib(endid,"isIsolatedSingularity",isIso);
186      attrib(endid,"isRegInCodim2",isRe);
187      attrib(endid,"isEqudimensional",isEq);
188      attrib(endid,"isCompleteIntersection",0);
189      attrib(endid,"isRad",0);
190//      export endid;
191//      export endphi;
192//      L = newR1;
193      L=lastRing;
194      L = insert(L,1,1);
195      dbprint(y,"// case R = Hom(J,J)");
196      if(y>=1)
197      {
198         "//   R=Hom(J,J)";
199         "   ";
200         lastRing;
201         "   ";
202         "//   the new ideal";
203         endid;
204         "   ";
205         "//   the old ring";
206         "   ";
207         P;
208         "   ";
209         "//   the old ideal";
210         "   ";
211         setring P;
212         id;
213         "   ";
214         setring lastRing;
215         "//   the map";
216         "   ";
217         endphi;
218         "   ";
219         pause();
220         newline;
221      }
222      setring P;
223      return(L);
224   }
225   if(y>=1)
226   {
227      "// R is not equal to Hom(J,J), we have to try again";
228      pause();
229      newline;
230   }
231//---------- Hom(J,J) != R: create new ring and map form old ring -------------
232// the ring newR1/SBid+syzf will be isomorphic to Hom(J,J) as R-module
233
234   f = p,rf;          // generates pJ:J mod(p), i.e. p*Hom(J,J)/p*R as R-module
235   q = size(f);
236   syzf = syz(f);
237
238   if ( homo==1 )
239   {
240      rw1 = rw,0;
241      for ( ii=2; ii<=q; ii++ )
242      {
243         rw  = rw, deg(f[ii])-deg(f[1]);
244         rw1 = rw1, deg(f[ii])-deg(f[1]);
245      }
246      ring newR1 = char(R),(X(1..nvars(R)),T(1..q)),(a(rw1),dp);
247   }
248   else
249   {
250      ring newR1 = char(R),(X(1..nvars(R)),T(1..q)),dp;
251   }
252
253   map psi1 = P,maxideal(1);
254   ideal SBid = psi1(SBid);
255   attrib(SBid,"isSB",1);
256
257 qring newR = std(SBid);
258   map psi = R,ideal(X(1..nvars(R)));
259   ideal id = psi(id);
260   ideal f = psi(f);
261   module syzf = psi(syzf);
262   ideal pf,Lin,Quad,Q;
263   matrix T,A;
264   list L1;
265
266//---------- computation of Hom(J,J) as affine ring ---------------------------
267// determine kernel of: R[T1,...,Tq] -> J:J >-> R[1/p]=R[t]/(t*p-1),
268// Ti -> fi/p -> t*fi (p=f1=f[1]), to get ring structure. This is of course
269// the same as the kernel of R[T1,...,Tq] -> pJ:J >-> R, Ti -> fi.
270// It is a fact, that the kernel is generated by the linear and the quadratic
271// relations
272
273   pf = f[1]*f;
274   T = matrix(ideal(T(1..q)),1,q);
275   Lin = ideal(T*syzf);
276   if(y>=1)
277   {
278      "// the ring structure of Hom(J,J) as R-algebra";
279      " ";
280      "//   the linear relations";
281      " ";
282      Lin;
283      "   ";
284   }
285   for (ii=2; ii<=q; ii++ )
286   {
287      for ( jj=2; jj<=ii; jj++ )
288      {
289         A = lift(pf,f[ii]*f[jj]);
290         Quad = Quad, ideal(T(jj)*T(ii) - T*A);          // quadratic relations
291      }
292   }
293   if(y>=1)
294   {
295      "//   the quadratic relations";
296      "   ";
297      interred(Quad);
298      pause();
299      newline;
300   }
301   Q = Lin+Quad;
302   Q = subst(Q,T(1),1);
303   Q = interred(reduce(Q,std(0)));
304//---------- reduce number of variables by substitution, if possible ----------
305   if (homo==1)
306   {
307      ring newRing = char(R),(X(1..nvars(R)),T(2..q)),(a(rw),dp);
308   }
309   else
310   {
311      ring newRing = char(R),(X(1..nvars(R)),T(2..q)),dp;
312   }
313
314   ideal endid  = imap(newR,id)+imap(newR,Q);
315   ideal endphi = ideal(X(1..nvars(R)));
316
317   L=substpart(endid,endphi,homo,rw);
318   def lastRing=L[1];
319   setring lastRing;
320   attrib(endid,"isCohenMacaulay",isCo);
321   attrib(endid,"isPrim",isPr);
322   attrib(endid,"isIsolatedSingularity",isIso);
323   attrib(endid,"isRegInCodim2",isRe);
324   attrib(endid,"isEquidimensional",isEq);
325   attrib(endid,"isCompleteIntersection",0);
326   attrib(endid,"isRad",0);
327  // export(endid);
328  // export(endphi);
329   if(y>=1)
330   {
331      "//   the new ring after reduction of the number of variables";
332      "   ";
333      lastRing;
334      "   ";
335      "//   the new ideal";
336      "   ";
337      endid;
338      "   ";
339      "//   the old ring";
340      "   ";
341      P;
342      "   ";
343      "//   the old ideal";
344      "   ";
345      setring P;
346      id;
347      "   ";
348      setring lastRing;
349      "//   the map";
350      "   ";
351      endphi;
352      "   ";
353      pause();
354      newline;
355   }
356   L = lastRing;
357   L = insert(L,0,1);
358   return(L);
359}
360example
361{"EXAMPLE:";  echo = 2;
362  ring r   = 0,(x,y),wp(2,3);
363  ideal id = y^2-x^3;
364  ideal J  = x,y;
365  poly p   = x;
366  list Li = std(id),id,J,p;
367  list L   = HomJJ(Li);
368  def end = L[1];    // defines ring L[1], containing ideals endid and endphi
369  setring end;       // makes end the basering
370  end;
371  endid;             // end/endid is isomorphic to End(r/id) as ring
372  map psi = r,endphi;// defines the canonical map r/id -> End(r/id)
373  psi;
374}
375
376///////////////////////////////////////////////////////////////////////////////
377proc normal(ideal id, list #)
378"USAGE:   normal(i [,choose]);  i a radical ideal, choose empty or 1
379         if choose=1 the normalization of the associated primes is computed
380         (which is sometimes more efficient)
381RETURN:  a list of rings (say nor), in each ring nor[i] are two ideals
382         norid, normap such that the direct sum of the rings nor[i]/norid is
383         the normalization of basering/id; normap gives the normalization map
384         from basering/id to nor[i]/norid (for each i)
385NOTE:    to use the i-th ring type: def R=nor[i]; setring R;
386         increasing printlevel displays more comments (default: printlevel=0)
387COMMENT: Not implemented for local or mixed orderings.
388         If the input ideal i is weighted homogeneous a weighted ordering may
389         be used (qhweight(i); computes weights).
390CAUTION: The proc does not check whether the input is radical, for non radical
391         ideals the output may be wrong (i=radical(i); makes i radical)
392EXAMPLE: example normal; shows an example
393"
394{
395   int i,j,y;
396   string sr;
397   list result,prim,keepresult;
398   y = printlevel-voice+2;
399
400   if ( find(ordstr(basering),"s")+find(ordstr(basering),"M") != 0)
401   {
402     "";
403     "// Not implemented for this ordering,";
404     "// please change to global ordering!";
405     return(result);
406   }
407   if( typeof(attrib(id,"isCompleteIntersection"))=="int" )
408   {
409      if(attrib(id,"isCompleteIntersection")==1)
410      {
411         attrib(id,"isCohenMacaulay",1);
412         attrib(id,"isEquidimensional",1);
413      }
414   }       
415   if( typeof(attrib(id,"isCohenMacaulay"))=="int" )
416   {
417      if(attrib(id,"isCohenMacaulay")==1)
418      {
419         attrib(id,"isEquidimensional",1);
420      }
421   }       
422   if( typeof(attrib(id,"isPrim"))=="int" )
423   {
424      if(attrib(id,"isPrim")==1)
425      {
426         attrib(id,"isEquidimensional",1);
427      }
428   }       
429   if(size(#)==0)
430   {
431      if( typeof(attrib(id,"isEquidimensional"))=="int" )
432      {
433         if(attrib(id,"isEquidimensional")==1)
434         {
435            prim[1]=id;
436         }
437         else
438         {
439            prim=equidim(id);
440         }
441      }
442      else
443      {
444         prim=equidim(id);
445      }
446      if(y>=1)
447      {
448         "// we have ",size(prim),"equidimensional components";
449      }
450   }
451   else
452   { 
453      if( typeof(attrib(id,"isPrim"))=="int" )
454      {
455         if(attrib(id,"isPrim")==1)
456         {
457            prim[1]=id;
458         }
459         else
460         {   
461            prim=minAssPrimes(id);
462         }
463      }
464      else
465      {
466         prim=minAssPrimes(id);
467      }         
468      if(y>=1)
469      {
470         "// we have ",size(prim),"irreducible components";
471      }
472   }
473   for(i=1; i<=size(prim); i++)
474   {
475      if(y>=1)
476      {
477         "// we are in loop ",i;
478      }
479      attrib(prim[i],"isCohenMacaulay",0);
480      if(size(#)!=0)
481      {
482         attrib(prim[i],"isPrim",1);
483      }
484      else
485      {
486         attrib(prim[i],"isPrim",0);
487      }
488      attrib(prim[i],"isRegInCodim2",0);
489      attrib(prim[i],"isIsolatedSingularity",0);
490      attrib(prim[i],"isEquidimensional",1);
491      attrib(prim[i],"isCompleteIntersection",0);
492
493      if( typeof(attrib(id,"isIsolatedSingularity"))=="int" )
494      {
495            if(attrib(id,"isIsolatedSingularity")==1)
496             {attrib(prim[i],"isIsolatedSingularity",1); }
497      }
498
499      if( typeof(attrib(id,"isCompleteIntersection"))=="int" )
500      {
501            if((attrib(id,"isIsolatedSingularity")==1)&&(size(#)==0))
502             {attrib(prim[i],"isIsolatedSingularity",1); }
503      }
504      keepresult=normalizationPrimes(prim[i],maxideal(1));
505      for(j=1;j<=size(keepresult);j++)
506      {
507         result=insert(result,keepresult[j]);
508      }
509      sr = string(size(result));
510   }
511      dbprint(y+1,"
512// 'normal' created a list of "+sr+" ring(s).
513// To see the rings, type (if the name of your list is nor):
514     show( nor);                 
515// To access the 1-st ring and map (and similair for the others), type:
516     def R = nor[1]; setring R;  norid; normap;
517// R/norid is the 1-st ring of the normalization and
518// normap the map from the original basering to R/norid");
519
520      //kill endphi,endid;
521      return(result);
522}
523example
524{ "EXAMPLE:"; echo = 2;
525   ring r=32003,(x,y,z),wp(2,1,2);
526   ideal i=z3-xy4;
527   list nor=normal(i);
528   show(nor);
529   def r1=nor[1];
530   setring r1;
531   norid;
532   normap;
533}
534
535///////////////////////////////////////////////////////////////////////////////
536static
537proc normalizationPrimes(ideal i,ideal ihp, list #)
538"USAGE:   normalizationPrimes(i,ihp[,si]);  i prime ideal, ihp map
539         (partial normalization), si SB of singular locus
540RETURN:  a list of one ring L=R, in  R are two ideals
541         S,M such that R/M is the normalization
542         S is a standardbasis of M
543NOTE:    to use the ring: def r=L[1];setring r;
544         printlevel >= voice+1: display comments (default: printlevel=0)
545EXAMPLE: example normalizationPrimes; shows an example
546"
547{
548   int y = printlevel-voice+2;  // y=printlevel (default: y=0)
549 
550   if(y>=1)
551   {
552     "";
553     "// START a normalization loop with the ideal";  "";
554     i;  "";
555     basering;  "";
556     pause();
557     newline;
558   }
559
560   def BAS=basering;
561   list result,keepresult1,keepresult2;
562   ideal J,SB,MB;
563   int depth,lauf,prdim;
564   int ti=timer;
565
566   if(size(i)==0)
567   {
568      if(y>=1)
569      {
570          "// the ideal was the zero-ideal";
571      }
572         execute "ring newR7="+charstr(basering)+",("+varstr(basering)+"),("
573                      +ordstr(basering)+");";
574         ideal norid=ideal(0);
575         ideal normap=fetch(BAS,ihp);
576         export norid;
577         export normap;
578         result=newR7;
579         setring BAS;
580         return(result);
581   }
582
583   if(y>=1)
584   {
585     "// SB-computation of the input ideal";
586   }
587   
588   list SM=mstd(i);                //here the work starts
589   int dimSM =  dim(SM[1]);
590  // Case: Get an ideal containing a unit
591   if( dimSM == -1)
592   {  "";
593      "      // A unit ideal was found.";
594      "      // Stop with partial result computed so far";"";
595     
596         MB=SM[2];
597         intvec rw;
598         list LL=substpart(MB,ihp,0,rw);
599         def newR6=LL[1];
600         setring newR6;
601         ideal norid=endid;
602         ideal normap=endphi;
603         kill endid,endphi;
604         export norid;
605         export normap;
606         result=newR6;
607         setring BAS;
608         return(result);
609   }
610   
611   if(y>=1)
612   {
613      "//   the dimension is:"; "";
614      dimSM;"";
615   }
616
617   if(size(#)>0)
618   {
619      list JM=mstd(#[1]);
620      if( typeof(attrib(#[1],"isRad"))!="int" )
621      {
622         attrib(JM[2],"isRad",0);
623      }
624   }
625
626   if(attrib(i,"isPrim")==1)
627   {
628      attrib(SM[2],"isPrim",1);
629   }
630   else
631   {
632      attrib(SM[2],"isPrim",0);
633   }
634   if(attrib(i,"isIsolatedSingularity")==1)
635   {
636      attrib(SM[2],"isIsolatedSingularity",1);
637   }
638   else
639   {
640      attrib(SM[2],"isIsolatedSingularity",0);
641   }
642   if(attrib(i,"isCohenMacaulay")==1)
643   {
644      attrib(SM[2],"isCohenMacaulay",1);
645   }
646   else
647   {
648      attrib(SM[2],"isCohenMacaulay",0);
649   }
650   if(attrib(i,"isRegInCodim2")==1)
651   {
652      attrib(SM[2],"isRegInCodim2",1);
653   }
654   else
655   {
656      attrib(SM[2],"isRegInCodim2",0);
657   }
658   if(attrib(i,"isEquidimensional")==1)
659   {
660      attrib(SM[2],"isEquidimensional",1);
661   }
662   else
663   {
664      attrib(SM[2],"isEquidimensional",0);
665   }
666    if(attrib(i,"isCompleteIntersection")==1)
667   {
668      attrib(SM[2],"isCompleteIntersection",1);
669   }
670   else
671   {
672      attrib(SM[2],"isCompleteIntersection",0);
673   }
674
675   //the smooth case
676   if(size(#)>0)
677   {
678      if(dim(JM[1])==-1)
679      {
680         if(y>=1)
681         {
682            "// the ideal was smooth";
683         }
684         MB=SM[2];
685         intvec rw;
686         list LL=substpart(MB,ihp,0,rw);
687         def newR6=LL[1];
688         setring newR6;
689         ideal norid=endid;
690         ideal normap=endphi;
691         kill endid,endphi;
692         export norid;
693         export normap;
694         result=newR6;
695         setring BAS;
696         return(result);
697     }
698   }
699
700   //the zero-dimensional case
701   if((dim(SM[1])==0)&&(homog(SM[2])==1))
702   {
703      if(y>=1)
704      {
705         "// the ideal was zero-dimensional and homogeneous";
706      }
707      MB=maxideal(1);
708      intvec rw;
709      list LL=substpart(MB,ihp,0,rw);
710      def newR5=LL[1];
711      setring newR5;
712      ideal norid=endid;
713      ideal normap=endphi;
714      kill endid,endphi;
715      export norid;
716      export normap;
717      result=newR5;
718      setring BAS;
719      return(result);
720   }
721
722   //the one-dimensional case
723   //in this case it is a line because
724   //it is irreducible and homogeneous
725   if((dim(SM[1])==1)&&(attrib(SM[2],"isPrim")==1)
726        &&(homog(SM[2])==1))
727   {
728      if(y>=1)
729      {
730         "// the ideal defines a line";
731      }
732      MB=SM[2];
733      intvec rw;
734      list LL=substpart(MB,ihp,0,rw);
735      def newR4=LL[1];
736      setring newR4;
737      ideal norid=endid;
738      ideal normap=endphi;
739      kill endid,endphi;
740      export norid;
741      export normap;
742      result=newR4;
743      setring BAS;
744      return(result);
745   }
746
747   //the higher dimensional case
748   //we test first of all CohenMacaulay and
749   //complete intersection
750   if(((size(SM[2])+dim(SM[1]))==nvars(basering))&&(homog(SM[2])==1))
751   {
752      //test for complete intersection
753      attrib(SM[2],"isCohenMacaulay",1);
754      attrib(SM[2],"isCompleteIntersection",1);
755      attrib(SM[2],"isEquidimensional",1);
756      if(y>=1)
757      {
758         "// the ideal is a complete Intersection";
759      }
760   }
761
762   //compute the singular locus+lower dimensional components
763   if(((attrib(SM[2],"isIsolatedSingularity")==0)||(homog(SM[2])==0))
764        &&(size(#)==0))
765   {
766/*
767write (":a normal-fehler" ,
768         "basering:",string(basering),"nvars:", nvars(basering),
769       "dim(SM[1]):",dim(SM[1]),"ncols(jacob(SM[2]))",ncols(jacob(SM[2])),
770       "SM:", SM);
771 
772     pause();
773*/     
774      J=minor(jacob(SM[2]),nvars(basering)-dim(SM[1]));
775      //ti=timer;
776      if(y >=1 )
777      {
778         "// SB of singular locus will be computed";
779      }
780      ideal sin=J+SM[2];
781
782    //kills the embeded components
783
784      list JM=mstd(sin);
785
786      if(y>=1)
787      {
788         "//   the dimension of the singular locus is:";"";
789         dim(JM[1]); "";
790      }
791      attrib(JM[2],"isRad",0);
792      //   timer-ti;
793      attrib(JM[1],"isSB",1);
794      if(dim(JM[1])==-1)
795      {
796         if(y>=1)
797         {
798            "// the ideal is smooth";
799         }
800         MB=SM[2];
801         intvec rw;
802         list LL=substpart(MB,ihp,0,rw);
803         def newR3=LL[1];
804         setring newR3;
805         ideal norid=endid;
806         ideal normap=endphi;
807         kill endid,endphi;
808         export norid;
809         export normap;
810         result=newR3;
811         setring BAS;
812         return(result);
813      }
814      if(dim(JM[1])==0)
815      {
816         attrib(SM[2],"isIsolatedSingularity",1);
817      }
818      if(dim(JM[1])<=dim(SM[1])-2)
819      {
820         attrib(SM[2],"isRegInCodim2",1);
821      }
822   }
823   else
824   {
825     if(size(#)==0)
826     {
827        list JM=maxideal(1),maxideal(1);
828        attrib(JM[1],"isSB",1);
829        attrib(SM[2],"isRegInCodim2",1);
830     }
831   }
832   if((attrib(SM[2],"isRegInCodim2")==1)&&(attrib(SM[2],"isCohenMacaulay")==1))
833   {     
834      if(y>=1)
835      {
836            "// the ideal was CohenMacaulay and regular in codimension 2";
837      }
838      MB=SM[2];
839      intvec rw;
840      list LL=substpart(MB,ihp,0,rw);
841      def newR6=LL[1];
842      setring newR6;
843      ideal norid=endid;
844      ideal normap=endphi;
845      kill endid,endphi;
846      export norid;
847      export normap;
848      result=newR6;
849      setring BAS;
850      return(result);         
851   }
852   //if it is an isolated singularity things are easier
853   if((dim(JM[1])==0)&&(homog(SM[2])==1))
854   {
855      attrib(SM[2],"isIsolatedSingularity",1);
856      ideal SL=simplify(reduce(maxideal(1),SM[1]),2);
857      ideal Ann=quotient(SM[2],SL[1]);
858      ideal qAnn=simplify(reduce(Ann,SM[1]),2);
859
860      if(size(qAnn)==0)
861      {
862         if(y>=1)
863         {
864            "";
865            "//   the ideal rad(J):";
866            "";
867            maxideal(1);
868            newline;
869         }
870         //again test for normality
871         //Hom(I,R)=R
872         list RR;
873         RR=SM[1],SM[2],maxideal(1),SL[1];
874         ti=timer;
875         RR=HomJJ(RR,y);
876         if(RR[2]==0)
877         {
878            def newR=RR[1];
879            setring newR;
880            map psi=BAS,endphi;
881         //   ti=timer;
882            list tluser=normalizationPrimes(endid,psi(ihp));
883
884        //    timer-ti;
885            setring BAS;
886            return(tluser);
887         }
888         MB=SM[2];
889         execute "ring newR7="+charstr(basering)+",("+varstr(basering)+"),("
890                      +ordstr(basering)+");";
891         ideal norid=fetch(BAS,MB);
892         ideal normap=fetch(BAS,ihp);
893         export norid;
894         export normap;
895         result=newR7;
896         // the following 2 lines don't work : nor is not defined
897         //def R = nor[1]; setring R;     //make the 1-st ring the basering
898         //norid; normap;                 //data of the normalization)
899         setring BAS;
900         return(result);
901
902       }
903       else
904       {
905          ideal id=qAnn+SM[2];
906
907          attrib(id,"isCohenMacaulay",0);
908          attrib(id,"isPrim",0);
909          attrib(id,"isIsolatedSingularity",1);
910          attrib(id,"isRegInCodim2",0);
911          attrib(id,"isCompleteIntersection",0);
912          attrib(id,"isEquidimensional",0);
913
914          keepresult1=normalizationPrimes(id,ihp);
915          ideal id1=quotient(SM[2],Ann)+SM[2];
916//          evtl. qAnn nehmen
917//          ideal id=SL[1]+SM[2];
918
919          attrib(id1,"isCohenMacaulay",0);
920          attrib(id1,"isPrim",0);
921          attrib(id1,"isIsolatedSingularity",1);
922          attrib(id1,"isRegInCodim2",0);
923          attrib(id1,"isCompleteIntersection",0);
924          attrib(id1,"isEquidimensional",0);
925
926          keepresult2=normalizationPrimes(id1,ihp);
927
928          for(lauf=1;lauf<=size(keepresult2);lauf++)
929          {
930             keepresult1=insert(keepresult1,keepresult2[lauf]);
931          }
932          return(keepresult1);
933       }
934   }
935
936   //test for non-normality
937   //Hom(I,I)<>R
938   //we can use Hom(I,I) to continue
939
940   ideal SL=simplify(reduce(JM[2],SM[1]),2);
941   ideal Ann=quotient(SM[2],SL[1]);
942   ideal qAnn=simplify(reduce(Ann,SM[1]),2);
943
944   if(size(qAnn)==0)
945   {
946      list RR;
947      list RS;
948      //now we have to compute the radical
949      if(y>=1)
950      {
951         "// radical computation of singular locus";
952      }
953
954      if((attrib(JM[2],"isRad")==0)&&(attrib(SM[2],"isEquidimensional")==0))
955      {
956           //J=radical(JM[2]);
957          J=radical(SM[2]+ideal(SL[1]));
958
959          // evtl. test auf J=SM[2]+ideal(SL[1]) dann schon normal
960      }
961      if((attrib(JM[2],"isRad")==0)&&(attrib(SM[2],"isEquidimensional")==1))
962      {
963          ideal JJ=SM[2]+ideal(SL[1]);
964         // evtl. test auf J=SM[2]+ideal(SL[1]) dann schon normal
965          if(attrib(SM[2],"isCompleteIntersection")==0)
966          {
967            J=equiRadical(JM[2]);
968             //J=equiRadical(JJ);
969          }
970          else
971          {
972             //J=radical(JM[2]);
973             J=quotient(JJ,minor(jacob(JJ),size(JJ)));
974          }
975      }
976      if(y>=1)
977      {
978        "//   radical is equal to:";"";
979        J;
980        "";
981      }
982
983      JM=J,J;
984
985      //evtl. fuer SL[1] anderen Nichtnullteiler aus J waehlen
986      RR=SM[1],SM[2],JM[2],SL[1];
987
988      //   evtl eine geeignete Potenz von JM?
989     if(y>=1)
990     {
991        "// compute Hom(rad(J),rad(J))";
992     }
993
994     RS=HomJJ(RR,y);
995
996      if(RS[2]==1)
997      {
998         def lastR=RS[1];
999         setring lastR;
1000         map psi1=BAS,endphi;
1001         ideal norid=endid;
1002         ideal normap=psi1(ihp);
1003         kill endid,endphi;
1004         export norid;
1005         export normap;
1006         setring BAS;
1007         return(lastR);
1008      }
1009      int n=nvars(basering);
1010      ideal MJ=JM[2];
1011
1012      def newR=RS[1];
1013      setring newR;
1014
1015      map psi=BAS,endphi;
1016      list tluser=
1017             normalizationPrimes(endid,psi(ihp),simplify(psi(MJ)+endid,4));
1018      setring BAS;
1019      return(tluser);
1020   }
1021    // A component with singular locus the whole component found
1022   if( Ann == 1)
1023   {
1024      "// Input appeared not to be a radical ideal!";
1025      "// A (everywhere singular) component with ideal";
1026      "// equal to its Jacobian ideal was found";
1027      "// Procedure will stop with partial result computed so far";"";
1028     
1029         MB=SM[2];
1030         intvec rw;
1031         list LL=substpart(MB,ihp,0,rw);
1032         def newR6=LL[1];
1033         setring newR6;
1034         ideal norid=endid;
1035         ideal normap=endphi;
1036         kill endid,endphi;
1037         export norid;
1038         export normap;
1039         result=newR6;
1040         setring BAS;
1041         return(result);
1042   }
1043   else
1044   {
1045      int equi=attrib(SM[2],"isEquidimensional");
1046      ideal new1=qAnn+SM[2];
1047      execute "ring newR1="+charstr(basering)+",("+varstr(basering)+"),("
1048                      +ordstr(basering)+");";
1049      if(y>=1)
1050      {
1051         "// zero-divisor found";
1052      }
1053      ideal vid=fetch(BAS,new1);
1054      ideal ihp=fetch(BAS,ihp);
1055      attrib(vid,"isCohenMacaulay",0);
1056      attrib(vid,"isPrim",0);
1057      attrib(vid,"isIsolatedSingularity",0);
1058      attrib(vid,"isRegInCodim2",0);
1059      if(equi==1)
1060      {
1061         attrib(vid,"isEquidimensional",1);
1062      }
1063      else
1064      {
1065         attrib(vid,"isEquidimensional",0);
1066      }
1067      attrib(vid,"isCompleteIntersection",0);
1068
1069      keepresult1=normalizationPrimes(vid,ihp);
1070
1071      setring BAS;
1072      ideal new2=quotient(SM[2],Ann)+SM[2];
1073// evtl. qAnn nehmen
1074      execute "ring newR2="+charstr(basering)+",("+varstr(basering)+"),("
1075                      +ordstr(basering)+");";
1076
1077      ideal vid=fetch(BAS,new2);
1078      ideal ihp=fetch(BAS,ihp);
1079      attrib(vid,"isCohenMacaulay",0);
1080      attrib(vid,"isPrim",0);
1081      attrib(vid,"isIsolatedSingularity",0);
1082      attrib(vid,"isRegInCodim2",0);
1083      if(equi==1)
1084      {
1085         attrib(vid,"isEquidimensional",1);
1086      }
1087      else
1088      {
1089         attrib(vid,"isEquidimensional",0);
1090      }
1091      attrib(vid,"isCompleteIntersection",0);
1092
1093      keepresult2=normalizationPrimes(vid,ihp);
1094
1095      setring BAS;
1096      for(lauf=1;lauf<=size(keepresult2);lauf++)
1097      {
1098         keepresult1=insert(keepresult1,keepresult2[lauf]);
1099      }
1100      return(keepresult1);
1101   }
1102}
1103example
1104{ "EXAMPLE:";echo = 2;
1105   //Huneke
1106   ring qr=31991,(a,b,c,d,e),dp;
1107   ideal i=
1108   5abcde-a5-b5-c5-d5-e5,
1109   ab3c+bc3d+a3be+cd3e+ade3,
1110   a2bc2+b2cd2+a2d2e+ab2e2+c2de2,
1111   abc5-b4c2d-2a2b2cde+ac3d2e-a4de2+bcd2e3+abe5,
1112   ab2c4-b5cd-a2b3de+2abc2d2e+ad4e2-a2bce3-cde5,
1113   a3b2cd-bc2d4+ab2c3e-b5de-d6e+3abcd2e2-a2be4-de6,
1114   a4b2c-abc2d3-ab5e-b3c2de-ad5e+2a2bcde2+cd2e4,
1115   b6c+bc6+a2b4e-3ab2c2de+c4d2e-a3cde2-abd3e2+bce5;
1116
1117   list pr=normalizationPrimes(i);
1118   def r1=pr[1];
1119   setring r1;
1120   norid;
1121   normap;
1122}
1123///////////////////////////////////////////////////////////////////////////////
1124static
1125proc substpart(ideal endid, ideal endphi, int homo, intvec rw)
1126
1127"//Repeated application of elimpart to endid, until no variables can be
1128//directy substituded. homo=1 if input is homogeneous, rw contains
1129//original weights, endphi (partial) normalization map";
1130
1131{
1132   def newRing=basering;
1133   int ii,jj;
1134   map phi = basering,maxideal(1);
1135
1136   //endid=diagon(endid);
1137
1138   list Le = elimpart(endid);
1139                                     //this proc and the next loop try to
1140   int q = size(Le[2]);              //substitute as many variables as possible
1141   intvec rw1 = 0;                   //indices of substituted variables
1142   rw1[nvars(basering)] = 0;
1143   rw1 = rw1+1;
1144
1145   while( size(Le[2]) != 0 )
1146   {
1147      endid = Le[1];
1148      map ps = newRing,Le[5];
1149
1150      phi = ps(phi);
1151      for(ii=1;ii<=size(Le[2])-1;ii++)
1152      {
1153         phi=phi(phi);
1154      }
1155      //eingefuegt wegen x2-y2z2+z3
1156      kill ps;
1157
1158      for( ii=1; ii<=size(rw1); ii++ )
1159      {
1160         if( Le[4][ii]==0 )
1161         {
1162            rw1[ii]=0;                             //look for substituted vars
1163         }
1164      }
1165      Le=elimpart(endid);
1166      q = q + size(Le[2]);
1167   }
1168   endphi = phi(endphi);
1169
1170//---------- return -----------------------------------------------------------
1171// in the homogeneous case put weights for the remaining vars correctly, i.e.
1172// delete from rw those weights for which the corresponding entry of rw1 is 0
1173
1174   if (homo==1 && nvars(newRing)-q >1 && size(endid) >0 )
1175   {
1176      jj=1;
1177      for( ii=2; ii<size(rw1); ii++)
1178      {
1179         jj++;
1180         if( rw1[ii]==0 )
1181         {
1182            rw=rw[1..jj-1],rw[jj+1..size(rw)];
1183            jj=jj-1;
1184         }
1185      }
1186      if( rw1[1]==0 ) { rw=rw[2..size(rw)]; }
1187      if( rw1[size(rw1)]==0 ){ rw=rw[1..size(rw)-1]; }
1188
1189      ring lastRing = char(basering),(T(1..nvars(newRing)-q)),(a(rw),dp);
1190   }
1191   else
1192   {
1193      ring lastRing = char(basering),(T(1..nvars(newRing)-q)),dp;
1194   }
1195
1196   ideal lastmap;
1197   q = 1;
1198   for(ii=1; ii<=size(rw1); ii++ )
1199   {
1200      if ( rw1[ii]==1 ) { lastmap[ii] = T(q); q=q+1; }
1201      if ( rw1[ii]==0 ) { lastmap[ii] = 0; }
1202   }
1203   map phi1 = newRing,lastmap;
1204   ideal endid  = phi1(endid);
1205   ideal endphi = phi1(endphi);
1206   export(endid);
1207   export(endphi);
1208   list L = lastRing;
1209   setring newRing;
1210   return(L);
1211}
1212///////////////////////////////////////////////////////////////////////////////
1213static
1214proc diagon(ideal i)
1215{
1216   matrix m;
1217   intvec iv = option(get);
1218   option(redSB);
1219   ideal j=liftstd(jet(i,1),m);
1220   option(set,iv);
1221   return(ideal(matrix(i)*m));
1222}
1223/////////////////////////////////////////////////////////////////////////////
1224/*
1225                           Examples:
1226LIB"normal.lib";
1227//Huneke
1228ring qr=31991,(a,b,c,d,e),dp;
1229ideal i=
12305abcde-a5-b5-c5-d5-e5,
1231ab3c+bc3d+a3be+cd3e+ade3,
1232a2bc2+b2cd2+a2d2e+ab2e2+c2de2,
1233abc5-b4c2d-2a2b2cde+ac3d2e-a4de2+bcd2e3+abe5,
1234ab2c4-b5cd-a2b3de+2abc2d2e+ad4e2-a2bce3-cde5,
1235a3b2cd-bc2d4+ab2c3e-b5de-d6e+3abcd2e2-a2be4-de6,
1236a4b2c-abc2d3-ab5e-b3c2de-ad5e+2a2bcde2+cd2e4,
1237b6c+bc6+a2b4e-3ab2c2de+c4d2e-a3cde2-abd3e2+bce5;
1238
1239int aa=timer;list nor=normal(i);timer-aa;
1240
1241//Vasconcelos
1242ring r=32003,(x,y,z,w,t),dp;
1243ideal i=
1244x2+zw,
1245y3+xwt,
1246xw3+z3t+ywt2,
1247y2w4-xy2z2t-w3t3;
1248
1249//Theo1
1250ring r=32003,(x,y,z),wp(2,3,6);
1251ideal i=zy2-zx3-x6;
1252
1253//Theo1a (CohenMacaulay and regular in codimension 2)
1254ring r=32003,(x,y,z,u),wp(2,3,6,6);
1255ideal i=zy2-zx3-x6+u2;
1256
1257
1258//Theo2
1259ring r=32003,(x,y,z),wp(3,4,12);
1260ideal i=z*(y3-x4)+x8;
1261
1262//Theo2a
1263ring r=32003,(T(1..4)),wp(3,4,12,17);
1264ideal i=
1265T(1)^8-T(1)^4*T(3)+T(2)^3*T(3),
1266T(1)^4*T(2)^2-T(2)^2*T(3)+T(1)*T(4),
1267T(1)^7+T(1)^3*T(2)^3-T(1)^3*T(3)+T(2)*T(4),
1268T(1)^6*T(2)*T(3)+T(1)^2*T(2)^4*T(3)+T(1)^3*T(2)^2*T(4)-T(1)^2*T(2)*T(3)^2+T(4)^2;
1269
1270//Theo3
1271ring r=32003,(x,y,z),wp(3,5,15);
1272ideal i=z*(y3-x5)+x10;
1273
1274
1275//Theo4
1276ring r=32003,(x,y,z),dp;
1277ideal i=(x-y)*(x-z)*(y-z);
1278
1279//Theo5
1280ring r=32003,(x,y,z),wp(2,1,2);
1281ideal i=z3-xy4;
1282
1283//Theo6
1284ring r=32003,(x,y,z),dp;
1285ideal i=x2y2+x2z2+y2z2;
1286
1287ring r=32003,(a,b,c,d,e,f),dp;
1288ideal i=
1289bf,
1290af,
1291bd,
1292ad;
1293
1294//Beispiel, wo vorher Primaerzerlegung schneller
1295//ist CM
1296//Sturmfels
1297ring r=32003,(b,s,t,u,v,w,x,y,z),dp;
1298ideal i=
1299bv+su,
1300bw+tu,
1301sw+tv,
1302by+sx,
1303bz+tx,
1304sz+ty,
1305uy+vx,
1306uz+wx,
1307vz+wy,
1308bvz;
1309
1310//J S/Y
1311ring r=32003,(x,y,z,t),dp;
1312ideal i=
1313x2z+xzt,
1314xyz,
1315xy2-xyt,
1316x2y+xyt;
1317
1318//St_S/Y
1319ring r=32003,(b,s,t,u,v,w,x,y,z),dp;
1320ideal i=
1321wy-vz,
1322vx-uy,
1323tv-sw,
1324su-bv,
1325tuy-bvz;
1326
1327//dauert laenger
1328//Horrocks:
1329ring r=32003,(a,b,c,d,e,f),dp;
1330ideal i=
1331adef-16000be2f+16001cef2,
1332ad2f+8002bdef+8001cdf2,
1333abdf-16000b2ef+16001bcf2,
1334a2df+8002abef+8001acf2,
1335ad2e-8000bde2-7999cdef,
1336acde-16000bce2+16001c2ef,
1337a2de-8000abe2-7999acef,
1338acd2+8002bcde+8001c2df,
1339abd2-8000b2de-7999bcdf,
1340a2d2+9603abde-10800b2e2-9601acdf+800bcef+11601c2f2,
1341abde-8000b2e2-acdf-16001bcef-8001c2f2,
1342abcd-16000b2ce+16001bc2f,
1343a2cd+8002abce+8001ac2f,
1344a2bd-8000ab2e-7999abcf,
1345ab3f-3bdf3,
1346a2b2f-2adf3-16000bef3+16001cf4,
1347a3bf+4aef3,
1348ac3e-10668cde3,
1349a2c2e+10667ade3+16001be4+5334ce3f,
1350a3ce+10669ae3f,
1351bc3d+8001cd3e,
1352ac3d+8000bc3e+16001cd2e2+8001c4f,
1353b2c2d+16001ad4+4000bd3e+12001cd3f,
1354b2c2e-10668bc3f-10667cd2ef,
1355abc2e-cde2f,
1356b3cd-8000bd3f,
1357b3ce-10668b2c2f-10667bd2ef,
1358abc2f-cdef2,
1359a2bce-16000be3f+16001ce2f2,
1360ab3d-8000b4e-8001b3cf+16000bd2f2,
1361ab2cf-bdef2,
1362a2bcf-16000be2f2+16001cef3,
1363a4d-8000a3be+8001a3cf-2ae2f2;
1364
1365
1366ring r=32003,(b,s,t,u,v,w,x,y,z),dp;
1367
1368ideal k=
1369wy-vz,
1370vx-uy,
1371tv-sw,
1372su-bv,
1373tuy-bvz;
1374ideal j=x2y2+x2z2+y2z2;
1375ideal i=mstd(intersect(j,k))[2];
1376
1377//22
1378ring r=32003,(b,s,t,u,v,w,x,y,z),dp;
1379ideal i=
1380wx2y3-vx2y2z+wx2yz2+wy3z2-vx2z3-vy2z3,
1381vx3y2-ux2y3+vx3z2-ux2yz2+vxy2z2-uy3z2,
1382tvx2y2-swx2y2+tvx2z2-swx2z2+tvy2z2-swy2z2,
1383sux2y2-bvx2y2+sux2z2-bvx2z2+suy2z2-bvy2z2,
1384tux2y3-bvx2y2z+tux2yz2+tuy3z2-bvx2z3-bvy2z3;
1385
1386
1387//riemenschneider
1388//33
1389//normal+primary 3
1390//primary 9
1391//radical 1
1392//minAssPrimes 2
1393ring r=32000,(p,q,s,t,u,v,w,x,y,z),wp(1,1,1,1,1,1,2,1,1,1);
1394ideal i=
1395xz,
1396vx,
1397ux,
1398su,
1399qu,
1400txy,
1401stx,
1402qtx,
1403uv2z-uwz,
1404uv3-uvw,
1405puv2-puw;
1406
1407ring r=0,(u,v,w,x,y,z),wp(1,1,1,3,2,1);
1408ideal i=wx,wy,wz,vx,vy,vz,ux,uy,uz,y3-x2;
1409
1410
1411
1412*/
1413
Note: See TracBrowser for help on using the repository browser.