source: git/Singular/LIB/normal.lib @ c612a8

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