source: git/Singular/LIB/normal.lib @ 1adaa7c

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