source: git/Singular/LIB/normal.lib @ 4d68980

fieker-DuValspielwiese
Last change on this file since 4d68980 was b15ad0, checked in by Gerhard Pfister <pfister@…>, 24 years ago
Hans, now it is correct! git-svn-id: file:///usr/local/Singular/svn/trunk@4309 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.24 2000-05-10 13:05:16 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   attrib(id,"isRadical",1);
401   if ( find(ordstr(basering),"s")+find(ordstr(basering),"M") != 0)
402   {
403     "";
404     "// Not implemented for this ordering,";
405     "// please change to global ordering!";
406     return(result);
407   }
408   if( typeof(attrib(id,"isCompleteIntersection"))=="int" )
409   {
410      if(attrib(id,"isCompleteIntersection")==1)
411      {
412         attrib(id,"isCohenMacaulay",1);
413         attrib(id,"isEquidimensional",1);
414      }
415   }       
416   if( typeof(attrib(id,"isCohenMacaulay"))=="int" )
417   {
418      if(attrib(id,"isCohenMacaulay")==1)
419      {
420         attrib(id,"isEquidimensional",1);
421      }
422   }       
423   if( typeof(attrib(id,"isPrim"))=="int" )
424   {
425      if(attrib(id,"isPrim")==1)
426      {
427         attrib(id,"isEquidimensional",1);
428      }
429   }       
430   if(size(#)==0)
431   {
432      if( typeof(attrib(id,"isEquidimensional"))=="int" )
433      {
434         if(attrib(id,"isEquidimensional")==1)
435         {
436            prim[1]=id;
437         }
438         else
439         {
440            prim=equidim(id);
441         }
442      }
443      else
444      {
445         prim=equidim(id);
446      }
447      if(y>=1)
448      {
449         "// we have ",size(prim),"equidimensional components";
450      }
451   }
452   else
453   { 
454      if( typeof(attrib(id,"isPrim"))=="int" )
455      {
456         if(attrib(id,"isPrim")==1)
457         {
458            prim[1]=id;
459         }
460         else
461         {   
462            prim=minAssPrimes(id);
463         }
464      }
465      else
466      {
467         prim=minAssPrimes(id);
468      }         
469      if(y>=1)
470      {
471         "// we have ",size(prim),"irreducible components";
472      }
473   }
474   for(i=1; i<=size(prim); i++)
475   {
476      if(y>=1)
477      {
478         "// we are in loop ",i;
479      }
480      attrib(prim[i],"isCohenMacaulay",0);
481      if(size(#)!=0)
482      {
483         attrib(prim[i],"isPrim",1);
484      }
485      else
486      {
487         attrib(prim[i],"isPrim",0);
488      }
489      attrib(prim[i],"isRegInCodim2",0);
490      attrib(prim[i],"isIsolatedSingularity",0);
491      attrib(prim[i],"isEquidimensional",1);
492      attrib(prim[i],"isCompleteIntersection",0);
493
494      if( typeof(attrib(id,"isIsolatedSingularity"))=="int" )
495      {
496            if(attrib(id,"isIsolatedSingularity")==1)
497             {attrib(prim[i],"isIsolatedSingularity",1); }
498      }
499
500      if( typeof(attrib(id,"isCompleteIntersection"))=="int" )
501      {
502            if((attrib(id,"isIsolatedSingularity")==1)&&(size(#)==0))
503             {attrib(prim[i],"isIsolatedSingularity",1); }
504      }
505      keepresult=normalizationPrimes(prim[i],maxideal(1));
506      for(j=1;j<=size(keepresult);j++)
507      {
508         result=insert(result,keepresult[j]);
509      }
510      sr = string(size(result));
511   }
512      dbprint(y+1,"
513// 'normal' created a list of "+sr+" ring(s).
514// To see the rings, type (if the name of your list is nor):
515     show( nor);                 
516// To access the 1-st ring and map (and similair for the others), type:
517     def R = nor[1]; setring R;  norid; normap;
518// R/norid is the 1-st ring of the normalization and
519// normap the map from the original basering to R/norid");
520
521      //kill endphi,endid;
522      return(result);
523}
524example
525{ "EXAMPLE:"; echo = 2;
526   ring r=32003,(x,y,z),wp(2,1,2);
527   ideal i=z3-xy4;
528   list nor=normal(i);
529   show(nor);
530   def r1=nor[1];
531   setring r1;
532   norid;
533   normap;
534}
535
536///////////////////////////////////////////////////////////////////////////////
537static
538proc normalizationPrimes(ideal i,ideal ihp, list #)
539"USAGE:   normalizationPrimes(i,ihp[,si]);  i prime ideal, ihp map
540         (partial normalization), si SB of singular locus
541RETURN:  a list of one ring L=R, in  R are two ideals
542         S,M such that R/M is the normalization
543         S is a standardbasis of M
544NOTE:    to use the ring: def r=L[1];setring r;
545         printlevel >= voice+1: display comments (default: printlevel=0)
546EXAMPLE: example normalizationPrimes; shows an example
547"
548{
549   int y = printlevel-voice+2;  // y=printlevel (default: y=0)
550 
551   if(y>=1)
552   {
553     "";
554     "// START a normalization loop with the ideal";  "";
555     i;  "";
556     basering;  "";
557     pause();
558     newline;
559   }
560
561   def BAS=basering;
562   list result,keepresult1,keepresult2;
563   ideal J,SB,MB;
564   int depth,lauf,prdim;
565   int ti=timer;
566
567   if(size(i)==0)
568   {
569      if(y>=1)
570      {
571          "// the ideal was the zero-ideal";
572      }
573         execute "ring newR7="+charstr(basering)+",("+varstr(basering)+"),("
574                      +ordstr(basering)+");";
575         ideal norid=ideal(0);
576         ideal normap=fetch(BAS,ihp);
577         export norid;
578         export normap;
579         result=newR7;
580         setring BAS;
581         return(result);
582   }
583
584   if(y>=1)
585   {
586     "// SB-computation of the input ideal";
587   }
588   
589   list SM=mstd(i);                //here the work starts
590   int dimSM =  dim(SM[1]);
591  // Case: Get an ideal containing a unit
592   if( dimSM == -1)
593   {  "";
594      "      // A unit ideal was found.";
595      "      // Stop with partial result computed so far";"";
596     
597         MB=SM[2];
598         intvec rw;
599         list LL=substpart(MB,ihp,0,rw);
600         def newR6=LL[1];
601         setring newR6;
602         ideal norid=endid;
603         ideal normap=endphi;
604         kill endid,endphi;
605         export norid;
606         export normap;
607         result=newR6;
608         setring BAS;
609         return(result);
610   }
611   
612   if(y>=1)
613   {
614      "//   the dimension is:"; "";
615      dimSM;"";
616   }
617
618   if(size(#)>0)
619   {
620      list JM=mstd(#[1]);
621      if( typeof(attrib(#[1],"isRad"))!="int" )
622      {
623         attrib(JM[2],"isRad",0);
624      }
625   }
626
627   if(attrib(i,"isPrim")==1)
628   {
629      attrib(SM[2],"isPrim",1);
630   }
631   else
632   {
633      attrib(SM[2],"isPrim",0);
634   }
635   if(attrib(i,"isIsolatedSingularity")==1)
636   {
637      attrib(SM[2],"isIsolatedSingularity",1);
638   }
639   else
640   {
641      attrib(SM[2],"isIsolatedSingularity",0);
642   }
643   if(attrib(i,"isCohenMacaulay")==1)
644   {
645      attrib(SM[2],"isCohenMacaulay",1);
646   }
647   else
648   {
649      attrib(SM[2],"isCohenMacaulay",0);
650   }
651   if(attrib(i,"isRegInCodim2")==1)
652   {
653      attrib(SM[2],"isRegInCodim2",1);
654   }
655   else
656   {
657      attrib(SM[2],"isRegInCodim2",0);
658   }
659   if(attrib(i,"isEquidimensional")==1)
660   {
661      attrib(SM[2],"isEquidimensional",1);
662   }
663   else
664   {
665      attrib(SM[2],"isEquidimensional",0);
666   }
667    if(attrib(i,"isCompleteIntersection")==1)
668   {
669      attrib(SM[2],"isCompleteIntersection",1);
670   }
671   else
672   {
673      attrib(SM[2],"isCompleteIntersection",0);
674   }
675
676   //the smooth case
677   if(size(#)>0)
678   {
679      if(dim(JM[1])==-1)
680      {
681         if(y>=1)
682         {
683            "// the ideal was smooth";
684         }
685         MB=SM[2];
686         intvec rw;
687         list LL=substpart(MB,ihp,0,rw);
688         def newR6=LL[1];
689         setring newR6;
690         ideal norid=endid;
691         ideal normap=endphi;
692         kill endid,endphi;
693         export norid;
694         export normap;
695         result=newR6;
696         setring BAS;
697         return(result);
698     }
699   }
700
701   //the zero-dimensional case
702   if((dim(SM[1])==0)&&(homog(SM[2])==1))
703   {
704      if(y>=1)
705      {
706         "// the ideal was zero-dimensional and homogeneous";
707      }
708      MB=maxideal(1);
709      intvec rw;
710      list LL=substpart(MB,ihp,0,rw);
711      def newR5=LL[1];
712      setring newR5;
713      ideal norid=endid;
714      ideal normap=endphi;
715      kill endid,endphi;
716      export norid;
717      export normap;
718      result=newR5;
719      setring BAS;
720      return(result);
721   }
722
723   //the one-dimensional case
724   //in this case it is a line because
725   //it is irreducible and homogeneous
726   if((dim(SM[1])==1)&&(attrib(SM[2],"isPrim")==1)
727        &&(homog(SM[2])==1))
728   {
729      if(y>=1)
730      {
731         "// the ideal defines a line";
732      }
733      MB=SM[2];
734      intvec rw;
735      list LL=substpart(MB,ihp,0,rw);
736      def newR4=LL[1];
737      setring newR4;
738      ideal norid=endid;
739      ideal normap=endphi;
740      kill endid,endphi;
741      export norid;
742      export normap;
743      result=newR4;
744      setring BAS;
745      return(result);
746   }
747
748   //the higher dimensional case
749   //we test first of all CohenMacaulay and
750   //complete intersection
751   if(((size(SM[2])+dim(SM[1]))==nvars(basering))&&(homog(SM[2])==1))
752   {
753      //test for complete intersection
754      attrib(SM[2],"isCohenMacaulay",1);
755      attrib(SM[2],"isCompleteIntersection",1);
756      attrib(SM[2],"isEquidimensional",1);
757      if(y>=1)
758      {
759         "// the ideal is a complete Intersection";
760      }
761   }
762
763   //compute the singular locus+lower dimensional components
764   if(((attrib(SM[2],"isIsolatedSingularity")==0)||(homog(SM[2])==0))
765        &&(size(#)==0))
766   {
767/*
768write (":a normal-fehler" ,
769         "basering:",string(basering),"nvars:", nvars(basering),
770       "dim(SM[1]):",dim(SM[1]),"ncols(jacob(SM[2]))",ncols(jacob(SM[2])),
771       "SM:", SM);
772 
773     pause();
774*/     
775      J=minor(jacob(SM[2]),nvars(basering)-dim(SM[1]));
776      //ti=timer;
777      if(y >=1 )
778      {
779         "// SB of singular locus will be computed";
780      }
781      ideal sin=J+SM[2];
782
783    //kills the embeded components
784
785      list JM=mstd(sin);
786
787      if(y>=1)
788      {
789         "//   the dimension of the singular locus is:";"";
790         dim(JM[1]); "";
791      }
792      attrib(JM[2],"isRad",0);
793      //   timer-ti;
794      attrib(JM[1],"isSB",1);
795      if(dim(JM[1])==-1)
796      {
797         if(y>=1)
798         {
799            "// the ideal is smooth";
800         }
801         MB=SM[2];
802         intvec rw;
803         list LL=substpart(MB,ihp,0,rw);
804         def newR3=LL[1];
805         setring newR3;
806         ideal norid=endid;
807         ideal normap=endphi;
808         kill endid,endphi;
809         export norid;
810         export normap;
811         result=newR3;
812         setring BAS;
813         return(result);
814      }
815      if(dim(JM[1])==0)
816      {
817         attrib(SM[2],"isIsolatedSingularity",1);
818      }
819      if(dim(JM[1])<=dim(SM[1])-2)
820      {
821         attrib(SM[2],"isRegInCodim2",1);
822      }
823   }
824   else
825   {
826     if(size(#)==0)
827     {
828        list JM=maxideal(1),maxideal(1);
829        attrib(JM[1],"isSB",1);
830        attrib(SM[2],"isRegInCodim2",1);
831     }
832   }
833   if((attrib(SM[2],"isRegInCodim2")==1)&&(attrib(SM[2],"isCohenMacaulay")==1))
834   {     
835      if(y>=1)
836      {
837            "// the ideal was CohenMacaulay and regular in codimension 2";
838      }
839      MB=SM[2];
840      intvec rw;
841      list LL=substpart(MB,ihp,0,rw);
842      def newR6=LL[1];
843      setring newR6;
844      ideal norid=endid;
845      ideal normap=endphi;
846      kill endid,endphi;
847      export norid;
848      export normap;
849      result=newR6;
850      setring BAS;
851      return(result);         
852   }
853   //if it is an isolated singularity things are easier
854   if((dim(JM[1])==0)&&(homog(SM[2])==1))
855   {
856      attrib(SM[2],"isIsolatedSingularity",1);
857      ideal SL=simplify(reduce(maxideal(1),SM[1]),2);
858      ideal Ann=quotient(SM[2],SL[1]);
859      ideal qAnn=simplify(reduce(Ann,SM[1]),2);
860
861      if(size(qAnn)==0)
862      {
863         if(y>=1)
864         {
865            "";
866            "//   the ideal rad(J):";
867            "";
868            maxideal(1);
869            newline;
870         }
871         //again test for normality
872         //Hom(I,R)=R
873         list RR;
874         RR=SM[1],SM[2],maxideal(1),SL[1];
875         ti=timer;
876         RR=HomJJ(RR,y);
877         if(RR[2]==0)
878         {
879            def newR=RR[1];
880            setring newR;
881            map psi=BAS,endphi;
882         //   ti=timer;
883            list tluser=normalizationPrimes(endid,psi(ihp));
884
885        //    timer-ti;
886            setring BAS;
887            return(tluser);
888         }
889         MB=SM[2];
890         execute "ring newR7="+charstr(basering)+",("+varstr(basering)+"),("
891                      +ordstr(basering)+");";
892         ideal norid=fetch(BAS,MB);
893         ideal normap=fetch(BAS,ihp);
894         export norid;
895         export normap;
896         result=newR7;
897         // the following 2 lines don't work : nor is not defined
898         //def R = nor[1]; setring R;     //make the 1-st ring the basering
899         //norid; normap;                 //data of the normalization)
900         setring BAS;
901         return(result);
902
903       }
904       else
905       {
906          ideal id=qAnn+SM[2];
907
908          attrib(id,"isCohenMacaulay",0);
909          attrib(id,"isPrim",0);
910          attrib(id,"isIsolatedSingularity",1);
911          attrib(id,"isRegInCodim2",0);
912          attrib(id,"isCompleteIntersection",0);
913          attrib(id,"isEquidimensional",0);
914
915          keepresult1=normalizationPrimes(id,ihp);
916          ideal id1=quotient(SM[2],Ann)+SM[2];
917//          evtl. qAnn nehmen
918//          ideal id=SL[1]+SM[2];
919
920          attrib(id1,"isCohenMacaulay",0);
921          attrib(id1,"isPrim",0);
922          attrib(id1,"isIsolatedSingularity",1);
923          attrib(id1,"isRegInCodim2",0);
924          attrib(id1,"isCompleteIntersection",0);
925          attrib(id1,"isEquidimensional",0);
926
927          keepresult2=normalizationPrimes(id1,ihp);
928
929          for(lauf=1;lauf<=size(keepresult2);lauf++)
930          {
931             keepresult1=insert(keepresult1,keepresult2[lauf]);
932          }
933          return(keepresult1);
934       }
935   }
936
937   //test for non-normality
938   //Hom(I,I)<>R
939   //we can use Hom(I,I) to continue
940
941   ideal SL=simplify(reduce(JM[2],SM[1]),2);
942   ideal Ann=quotient(SM[2],SL[1]);
943   ideal qAnn=simplify(reduce(Ann,SM[1]),2);
944
945   if(size(qAnn)==0)
946   {
947      list RR;
948      list RS;
949      //now we have to compute the radical
950      if(y>=1)
951      {
952         "// radical computation of singular locus";
953      }
954
955      if((attrib(JM[2],"isRad")==0)&&(attrib(SM[2],"isEquidimensional")==0))
956      {
957           //J=radical(JM[2]);
958          J=radical(SM[2]+ideal(SL[1]));
959
960          // evtl. test auf J=SM[2]+ideal(SL[1]) dann schon normal
961      }
962      if((attrib(JM[2],"isRad")==0)&&(attrib(SM[2],"isEquidimensional")==1))
963      {
964          ideal JJ=SM[2]+ideal(SL[1]);
965         // evtl. test auf J=SM[2]+ideal(SL[1]) dann schon normal
966          if(attrib(SM[2],"isCompleteIntersection")==0)
967          {
968            J=equiRadical(JM[2]);
969             //J=equiRadical(JJ);
970          }
971          else
972          {
973             //J=radical(JM[2]);
974             J=quotient(JJ,minor(jacob(JJ),size(JJ)));
975          }
976      }
977      if(y>=1)
978      {
979        "//   radical is equal to:";"";
980        J;
981        "";
982      }
983
984      JM=J,J;
985
986      //evtl. fuer SL[1] anderen Nichtnullteiler aus J waehlen
987      RR=SM[1],SM[2],JM[2],SL[1];
988
989      //   evtl eine geeignete Potenz von JM?
990     if(y>=1)
991     {
992        "// compute Hom(rad(J),rad(J))";
993     }
994
995     RS=HomJJ(RR,y);
996
997      if(RS[2]==1)
998      {
999         def lastR=RS[1];
1000         setring lastR;
1001         map psi1=BAS,endphi;
1002         ideal norid=endid;
1003         ideal normap=psi1(ihp);
1004         kill endid,endphi;
1005         export norid;
1006         export normap;
1007         setring BAS;
1008         return(lastR);
1009      }
1010      int n=nvars(basering);
1011      ideal MJ=JM[2];
1012
1013      def newR=RS[1];
1014      setring newR;
1015
1016      map psi=BAS,endphi;
1017      list tluser=
1018             normalizationPrimes(endid,psi(ihp),simplify(psi(MJ)+endid,4));
1019      setring BAS;
1020      return(tluser);
1021   }
1022    // A component with singular locus the whole component found
1023   if( Ann == 1)
1024   {
1025      "// Input appeared not to be a radical ideal!";
1026      "// A (everywhere singular) component with ideal";
1027      "// equal to its Jacobian ideal was found";
1028      "// Procedure will stop with partial result computed so far";"";
1029     
1030         MB=SM[2];
1031         intvec rw;
1032         list LL=substpart(MB,ihp,0,rw);
1033         def newR6=LL[1];
1034         setring newR6;
1035         ideal norid=endid;
1036         ideal normap=endphi;
1037         kill endid,endphi;
1038         export norid;
1039         export normap;
1040         result=newR6;
1041         setring BAS;
1042         return(result);
1043   }
1044   else
1045   {
1046      int equi=attrib(SM[2],"isEquidimensional");
1047      ideal new1=qAnn+SM[2];
1048      execute "ring newR1="+charstr(basering)+",("+varstr(basering)+"),("
1049                      +ordstr(basering)+");";
1050      if(y>=1)
1051      {
1052         "// zero-divisor found";
1053      }
1054      ideal vid=fetch(BAS,new1);
1055      ideal ihp=fetch(BAS,ihp);
1056      attrib(vid,"isCohenMacaulay",0);
1057      attrib(vid,"isPrim",0);
1058      attrib(vid,"isIsolatedSingularity",0);
1059      attrib(vid,"isRegInCodim2",0);
1060      if(equi==1)
1061      {
1062         attrib(vid,"isEquidimensional",1);
1063      }
1064      else
1065      {
1066         attrib(vid,"isEquidimensional",0);
1067      }
1068      attrib(vid,"isCompleteIntersection",0);
1069
1070      keepresult1=normalizationPrimes(vid,ihp);
1071
1072      setring BAS;
1073      ideal new2=quotient(SM[2],Ann)+SM[2];
1074// evtl. qAnn nehmen
1075      execute "ring newR2="+charstr(basering)+",("+varstr(basering)+"),("
1076                      +ordstr(basering)+");";
1077
1078      ideal vid=fetch(BAS,new2);
1079      ideal ihp=fetch(BAS,ihp);
1080      attrib(vid,"isCohenMacaulay",0);
1081      attrib(vid,"isPrim",0);
1082      attrib(vid,"isIsolatedSingularity",0);
1083      attrib(vid,"isRegInCodim2",0);
1084      if(equi==1)
1085      {
1086         attrib(vid,"isEquidimensional",1);
1087      }
1088      else
1089      {
1090         attrib(vid,"isEquidimensional",0);
1091      }
1092      attrib(vid,"isCompleteIntersection",0);
1093
1094      keepresult2=normalizationPrimes(vid,ihp);
1095
1096      setring BAS;
1097      for(lauf=1;lauf<=size(keepresult2);lauf++)
1098      {
1099         keepresult1=insert(keepresult1,keepresult2[lauf]);
1100      }
1101      return(keepresult1);
1102   }
1103}
1104example
1105{ "EXAMPLE:";echo = 2;
1106   //Huneke
1107   ring qr=31991,(a,b,c,d,e),dp;
1108   ideal i=
1109   5abcde-a5-b5-c5-d5-e5,
1110   ab3c+bc3d+a3be+cd3e+ade3,
1111   a2bc2+b2cd2+a2d2e+ab2e2+c2de2,
1112   abc5-b4c2d-2a2b2cde+ac3d2e-a4de2+bcd2e3+abe5,
1113   ab2c4-b5cd-a2b3de+2abc2d2e+ad4e2-a2bce3-cde5,
1114   a3b2cd-bc2d4+ab2c3e-b5de-d6e+3abcd2e2-a2be4-de6,
1115   a4b2c-abc2d3-ab5e-b3c2de-ad5e+2a2bcde2+cd2e4,
1116   b6c+bc6+a2b4e-3ab2c2de+c4d2e-a3cde2-abd3e2+bce5;
1117
1118   list pr=normalizationPrimes(i);
1119   def r1=pr[1];
1120   setring r1;
1121   norid;
1122   normap;
1123}
1124///////////////////////////////////////////////////////////////////////////////
1125static
1126proc substpart(ideal endid, ideal endphi, int homo, intvec rw)
1127
1128"//Repeated application of elimpart to endid, until no variables can be
1129//directy substituded. homo=1 if input is homogeneous, rw contains
1130//original weights, endphi (partial) normalization map";
1131
1132{
1133   def newRing=basering;
1134   int ii,jj;
1135   map phi = basering,maxideal(1);
1136
1137   //endid=diagon(endid);
1138
1139   list Le = elimpart(endid);
1140                                     //this proc and the next loop try to
1141   int q = size(Le[2]);              //substitute as many variables as possible
1142   intvec rw1 = 0;                   //indices of substituted variables
1143   rw1[nvars(basering)] = 0;
1144   rw1 = rw1+1;
1145
1146   while( size(Le[2]) != 0 )
1147   {
1148      endid = Le[1];
1149      map ps = newRing,Le[5];
1150
1151      phi = ps(phi);
1152      for(ii=1;ii<=size(Le[2])-1;ii++)
1153      {
1154         phi=phi(phi);
1155      }
1156      //eingefuegt wegen x2-y2z2+z3
1157      kill ps;
1158
1159      for( ii=1; ii<=size(rw1); ii++ )
1160      {
1161         if( Le[4][ii]==0 )
1162         {
1163            rw1[ii]=0;                             //look for substituted vars
1164         }
1165      }
1166      Le=elimpart(endid);
1167      q = q + size(Le[2]);
1168   }
1169   endphi = phi(endphi);
1170
1171//---------- return -----------------------------------------------------------
1172// in the homogeneous case put weights for the remaining vars correctly, i.e.
1173// delete from rw those weights for which the corresponding entry of rw1 is 0
1174
1175   if (homo==1 && nvars(newRing)-q >1 && size(endid) >0 )
1176   {
1177      jj=1;
1178      for( ii=2; ii<size(rw1); ii++)
1179      {
1180         jj++;
1181         if( rw1[ii]==0 )
1182         {
1183            rw=rw[1..jj-1],rw[jj+1..size(rw)];
1184            jj=jj-1;
1185         }
1186      }
1187      if( rw1[1]==0 ) { rw=rw[2..size(rw)]; }
1188      if( rw1[size(rw1)]==0 ){ rw=rw[1..size(rw)-1]; }
1189
1190      ring lastRing = char(basering),(T(1..nvars(newRing)-q)),(a(rw),dp);
1191   }
1192   else
1193   {
1194      ring lastRing = char(basering),(T(1..nvars(newRing)-q)),dp;
1195   }
1196
1197   ideal lastmap;
1198   q = 1;
1199   for(ii=1; ii<=size(rw1); ii++ )
1200   {
1201      if ( rw1[ii]==1 ) { lastmap[ii] = T(q); q=q+1; }
1202      if ( rw1[ii]==0 ) { lastmap[ii] = 0; }
1203   }
1204   map phi1 = newRing,lastmap;
1205   ideal endid  = phi1(endid);
1206   ideal endphi = phi1(endphi);
1207   export(endid);
1208   export(endphi);
1209   list L = lastRing;
1210   setring newRing;
1211   return(L);
1212}
1213///////////////////////////////////////////////////////////////////////////////
1214static
1215proc diagon(ideal i)
1216{
1217   matrix m;
1218   intvec iv = option(get);
1219   option(redSB);
1220   ideal j=liftstd(jet(i,1),m);
1221   option(set,iv);
1222   return(ideal(matrix(i)*m));
1223}
1224/////////////////////////////////////////////////////////////////////////////
1225/*
1226                           Examples:
1227LIB"normal.lib";
1228//Huneke
1229ring qr=31991,(a,b,c,d,e),dp;
1230ideal i=
12315abcde-a5-b5-c5-d5-e5,
1232ab3c+bc3d+a3be+cd3e+ade3,
1233a2bc2+b2cd2+a2d2e+ab2e2+c2de2,
1234abc5-b4c2d-2a2b2cde+ac3d2e-a4de2+bcd2e3+abe5,
1235ab2c4-b5cd-a2b3de+2abc2d2e+ad4e2-a2bce3-cde5,
1236a3b2cd-bc2d4+ab2c3e-b5de-d6e+3abcd2e2-a2be4-de6,
1237a4b2c-abc2d3-ab5e-b3c2de-ad5e+2a2bcde2+cd2e4,
1238b6c+bc6+a2b4e-3ab2c2de+c4d2e-a3cde2-abd3e2+bce5;
1239
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.