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

spielwiese
Last change on this file since 62fc6a was 62fc6a, checked in by Gert-Martin Greuel <greuel@…>, 23 years ago
* GMG: cosmetics git-svn-id: file:///usr/local/Singular/svn/trunk@4382 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 35.0 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.26 2000-05-23 22:57:52 greuel 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]);        //dimension of variety to normalize
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      //JM[1] SB os singular locus, JM[2]=minbasis of singular locus
787      //SM[1] SB of irreducible component, SM[2] minbasis
788      if(y>=1)
789      {
790         "//   the dimension of the singular locus is:";"";
791         dim(JM[1]); "";
792      }
793      attrib(JM[2],"isRad",0);
794      //   timer-ti;
795      attrib(JM[1],"isSB",1);
796      if(dim(JM[1])==-1)
797      {
798         if(y>=1)
799         {
800            "// the ideal is smooth";
801         }
802         MB=SM[2];
803         intvec rw;
804         list LL=substpart(MB,ihp,0,rw);
805         def newR3=LL[1];
806         setring newR3;
807         ideal norid=endid;
808         ideal normap=endphi;
809         kill endid,endphi;
810         export norid;
811         export normap;
812         result=newR3;
813         setring BAS;
814         return(result);
815      }
816      if(dim(JM[1])==0)
817      {
818         attrib(SM[2],"isIsolatedSingularity",1);
819      }
820      if(dim(JM[1])<=dim(SM[1])-2)
821      {
822         attrib(SM[2],"isRegInCodim2",1);
823      }
824   }
825   else
826   {
827     if(size(#)==0)
828     {
829        list JM=maxideal(1),maxideal(1);
830        attrib(JM[1],"isSB",1);
831        attrib(SM[2],"isRegInCodim2",1);
832     }
833   }
834   if((attrib(SM[2],"isRegInCodim2")==1)&&(attrib(SM[2],"isCohenMacaulay")==1))
835   {     
836      if(y>=1)
837      {
838            "// the ideal was CohenMacaulay and regular in codimension 2";
839      }
840      MB=SM[2];
841      intvec rw;
842      list LL=substpart(MB,ihp,0,rw);
843      def newR6=LL[1];
844      setring newR6;
845      ideal norid=endid;
846      ideal normap=endphi;
847      kill endid,endphi;
848      export norid;
849      export normap;
850      result=newR6;
851      setring BAS;
852      return(result);         
853   }
854   //if it is an isolated singularity things are easier
855   //JM ideal of singular locus, SM ideal of variety
856   if((dim(JM[1])==0)&&(homog(SM[2])==1))            //isolated sing. case
857   {
858      attrib(SM[2],"isIsolatedSingularity",1);
859      ideal SL=simplify(reduce(maxideal(1),SM[1]),2); 
860           //vars not contained in ideal
861      ideal Ann=quotient(SM[2],SL[1]);
862      ideal qAnn=simplify(reduce(Ann,SM[1]),2);
863     
864      //qAnn=0 ==> the first var(=SL[1]) not contained in SM is a nzd of R/SM
865      if(size(qAnn)==0)
866      {
867         if(y>=1)
868         {
869            "";
870            "//   the ideal rad(J):";
871            "";
872            maxideal(1);
873            newline;
874         }
875         //again test for normality
876         //Hom(I,R)=R
877         list RR;
878         RR=SM[1],SM[2],maxideal(1),SL[1];
879         ti=timer;
880         RR=HomJJ(RR,y);
881         if(RR[2]==0)
882         {
883            def newR=RR[1];
884            setring newR;
885            map psi=BAS,endphi;
886         //   ti=timer;
887            list tluser=normalizationPrimes(endid,psi(ihp));
888
889        //    timer-ti;
890            setring BAS;
891            return(tluser);
892         }
893         MB=SM[2];
894         execute("ring newR7="+charstr(basering)+",("+varstr(basering)+"),("
895                      +ordstr(basering)+");");
896         ideal norid=fetch(BAS,MB);
897         ideal normap=fetch(BAS,ihp);
898         export norid;
899         export normap;
900         result=newR7;
901         // the following 2 lines don't work : nor is not defined
902         //def R = nor[1]; setring R;     //make the 1-st ring the basering
903         //norid; normap;                 //data of the normalization)
904         setring BAS;
905         return(result);
906
907       }
908      //Now the case where qAnn!=0, i.e.SL[1] is a zero divisor of R/SM
909      //and we have found a splitting: id and id1
910      //id=qAnn+SM[2] defines components of R/SM in the complement of V(SL[1])
911      //id1 defines components of R/SM in the complement of V(id)
912      //?????instead of id1 we can take SL[1]+Ann+SM[2]???????????
913       else
914       {
915          ideal id=qAnn+SM[2];
916
917          attrib(id,"isCohenMacaulay",0);
918          attrib(id,"isPrim",0);
919          attrib(id,"isIsolatedSingularity",1);
920          attrib(id,"isRegInCodim2",0);
921          attrib(id,"isCompleteIntersection",0);
922          attrib(id,"isEquidimensional",0);
923
924          keepresult1=normalizationPrimes(id,ihp);
925          ideal id1=quotient(SM[2],Ann)+SM[2];
926//          evtl. qAnn statt Ann nehmen
927//          ideal id=SL[1]+SM[2];
928
929          attrib(id1,"isCohenMacaulay",0);
930          attrib(id1,"isPrim",0);
931          attrib(id1,"isIsolatedSingularity",1);
932          attrib(id1,"isRegInCodim2",0);
933          attrib(id1,"isCompleteIntersection",0);
934          attrib(id1,"isEquidimensional",0);
935
936          keepresult2=normalizationPrimes(id1,ihp);
937
938          for(lauf=1;lauf<=size(keepresult2);lauf++)
939          {
940             keepresult1=insert(keepresult1,keepresult2[lauf]);
941          }
942          return(keepresult1);
943       }
944   }
945
946   //test for non-normality
947   //Hom(I,I)<>R
948   //we can use Hom(I,I) to continue
949
950   ideal SL=simplify(reduce(JM[2],SM[1]),2);
951   ideal Ann=quotient(SM[2],SL[1]);
952   ideal qAnn=simplify(reduce(Ann,SM[1]),2);
953
954   if(size(qAnn)==0)
955   {
956      list RR;
957      list RS;
958      //now we have to compute the radical
959      if(y>=1)
960      {
961         "// radical computation of singular locus";
962      }
963
964      if((attrib(JM[2],"isRad")==0)&&(attrib(SM[2],"isEquidimensional")==0))
965      {
966           //J=radical(JM[2]);
967          J=radical(SM[2]+ideal(SL[1]));
968
969          // evtl. test auf J=SM[2]+ideal(SL[1]) dann schon normal
970      }
971      if((attrib(JM[2],"isRad")==0)&&(attrib(SM[2],"isEquidimensional")==1))
972      {
973          ideal JJ=SM[2]+ideal(SL[1]);
974         // evtl. test auf J=SM[2]+ideal(SL[1]) dann schon normal
975          if(attrib(SM[2],"isCompleteIntersection")==0)
976          {
977            J=equiRadical(JM[2]);
978             //J=equiRadical(JJ);
979          }
980          else
981          {
982             //J=radical(JM[2]);
983             J=quotient(JJ,minor(jacob(JJ),size(JJ)));
984          }
985      }
986      if(y>=1)
987      {
988        "//   radical is equal to:";"";
989        J;
990        "";
991      }
992
993      JM=J,J;
994
995      //evtl. fuer SL[1] anderen Nichtnullteiler aus J waehlen
996      RR=SM[1],SM[2],JM[2],SL[1];
997
998      //   evtl eine geeignete Potenz von JM?
999     if(y>=1)
1000     {
1001        "// compute Hom(rad(J),rad(J))";
1002     }
1003
1004     RS=HomJJ(RR,y);
1005
1006      if(RS[2]==1)
1007      {
1008         def lastR=RS[1];
1009         setring lastR;
1010         map psi1=BAS,endphi;
1011         ideal norid=endid;
1012         ideal normap=psi1(ihp);
1013         kill endid,endphi;
1014         export norid;
1015         export normap;
1016         setring BAS;
1017         return(lastR);
1018      }
1019      int n=nvars(basering);
1020      ideal MJ=JM[2];
1021
1022      def newR=RS[1];
1023      setring newR;
1024
1025      map psi=BAS,endphi;
1026      list tluser=
1027             normalizationPrimes(endid,psi(ihp),simplify(psi(MJ)+endid,4));
1028      setring BAS;
1029      return(tluser);
1030   }
1031    // A component with singular locus the whole component found
1032   if( Ann == 1)
1033   {
1034      "// Input appeared not to be a radical ideal!";
1035      "// A (everywhere singular) component with ideal";
1036      "// equal to its Jacobian ideal was found";
1037      "// Procedure will stop with partial result computed so far";"";
1038     
1039         MB=SM[2];
1040         intvec rw;
1041         list LL=substpart(MB,ihp,0,rw);
1042         def newR6=LL[1];
1043         setring newR6;
1044         ideal norid=endid;
1045         ideal normap=endphi;
1046         kill endid,endphi;
1047         export norid;
1048         export normap;
1049         result=newR6;
1050         setring BAS;
1051         return(result);
1052   }
1053   else
1054   {
1055      int equi=attrib(SM[2],"isEquidimensional");
1056      ideal new1=qAnn+SM[2];
1057      execute("ring newR1="+charstr(basering)+",("+varstr(basering)+"),("
1058                      +ordstr(basering)+");");
1059      if(y>=1)
1060      {
1061         "// zero-divisor found";
1062      }
1063      ideal vid=fetch(BAS,new1);
1064      ideal ihp=fetch(BAS,ihp);
1065      attrib(vid,"isCohenMacaulay",0);
1066      attrib(vid,"isPrim",0);
1067      attrib(vid,"isIsolatedSingularity",0);
1068      attrib(vid,"isRegInCodim2",0);
1069      if(equi==1)
1070      {
1071         attrib(vid,"isEquidimensional",1);
1072      }
1073      else
1074      {
1075         attrib(vid,"isEquidimensional",0);
1076      }
1077      attrib(vid,"isCompleteIntersection",0);
1078
1079      keepresult1=normalizationPrimes(vid,ihp);
1080
1081      setring BAS;
1082      ideal new2=quotient(SM[2],Ann)+SM[2];
1083// evtl. qAnn nehmen
1084      execute("ring newR2="+charstr(basering)+",("+varstr(basering)+"),("
1085                      +ordstr(basering)+");");
1086
1087      ideal vid=fetch(BAS,new2);
1088      ideal ihp=fetch(BAS,ihp);
1089      attrib(vid,"isCohenMacaulay",0);
1090      attrib(vid,"isPrim",0);
1091      attrib(vid,"isIsolatedSingularity",0);
1092      attrib(vid,"isRegInCodim2",0);
1093      if(equi==1)
1094      {
1095         attrib(vid,"isEquidimensional",1);
1096      }
1097      else
1098      {
1099         attrib(vid,"isEquidimensional",0);
1100      }
1101      attrib(vid,"isCompleteIntersection",0);
1102
1103      keepresult2=normalizationPrimes(vid,ihp);
1104
1105      setring BAS;
1106      for(lauf=1;lauf<=size(keepresult2);lauf++)
1107      {
1108         keepresult1=insert(keepresult1,keepresult2[lauf]);
1109      }
1110      return(keepresult1);
1111   }
1112}
1113example
1114{ "EXAMPLE:";echo = 2;
1115   //Huneke
1116   ring qr=31991,(a,b,c,d,e),dp;
1117   ideal i=
1118   5abcde-a5-b5-c5-d5-e5,
1119   ab3c+bc3d+a3be+cd3e+ade3,
1120   a2bc2+b2cd2+a2d2e+ab2e2+c2de2,
1121   abc5-b4c2d-2a2b2cde+ac3d2e-a4de2+bcd2e3+abe5,
1122   ab2c4-b5cd-a2b3de+2abc2d2e+ad4e2-a2bce3-cde5,
1123   a3b2cd-bc2d4+ab2c3e-b5de-d6e+3abcd2e2-a2be4-de6,
1124   a4b2c-abc2d3-ab5e-b3c2de-ad5e+2a2bcde2+cd2e4,
1125   b6c+bc6+a2b4e-3ab2c2de+c4d2e-a3cde2-abd3e2+bce5;
1126
1127   list pr=normalizationPrimes(i);
1128   def r1=pr[1];
1129   setring r1;
1130   norid;
1131   normap;
1132}
1133///////////////////////////////////////////////////////////////////////////////
1134static
1135proc substpart(ideal endid, ideal endphi, int homo, intvec rw)
1136
1137"//Repeated application of elimpart to endid, until no variables can be
1138//directy substituded. homo=1 if input is homogeneous, rw contains
1139//original weights, endphi (partial) normalization map";
1140
1141{
1142   def newRing=basering;
1143   int ii,jj;
1144   map phi = basering,maxideal(1);
1145
1146   //endid=diagon(endid);
1147
1148   list Le = elimpart(endid);
1149                                     //this proc and the next loop try to
1150   int q = size(Le[2]);              //substitute as many variables as possible
1151   intvec rw1 = 0;                   //indices of substituted variables
1152   rw1[nvars(basering)] = 0;
1153   rw1 = rw1+1;
1154
1155   while( size(Le[2]) != 0 )
1156   {
1157      endid = Le[1];
1158      map ps = newRing,Le[5];
1159
1160      phi = ps(phi);
1161      for(ii=1;ii<=size(Le[2])-1;ii++)
1162      {
1163         phi=phi(phi);
1164      }
1165      //eingefuegt wegen x2-y2z2+z3
1166      kill ps;
1167
1168      for( ii=1; ii<=size(rw1); ii++ )
1169      {
1170         if( Le[4][ii]==0 )
1171         {
1172            rw1[ii]=0;                             //look for substituted vars
1173         }
1174      }
1175      Le=elimpart(endid);
1176      q = q + size(Le[2]);
1177   }
1178   endphi = phi(endphi);
1179
1180//---------- return -----------------------------------------------------------
1181// in the homogeneous case put weights for the remaining vars correctly, i.e.
1182// delete from rw those weights for which the corresponding entry of rw1 is 0
1183
1184   if (homo==1 && nvars(newRing)-q >1 && size(endid) >0 )
1185   {
1186      jj=1;
1187      for( ii=2; ii<size(rw1); ii++)
1188      {
1189         jj++;
1190         if( rw1[ii]==0 )
1191         {
1192            rw=rw[1..jj-1],rw[jj+1..size(rw)];
1193            jj=jj-1;
1194         }
1195      }
1196      if( rw1[1]==0 ) { rw=rw[2..size(rw)]; }
1197      if( rw1[size(rw1)]==0 ){ rw=rw[1..size(rw)-1]; }
1198
1199      ring lastRing = char(basering),(T(1..nvars(newRing)-q)),(a(rw),dp);
1200   }
1201   else
1202   {
1203      ring lastRing = char(basering),(T(1..nvars(newRing)-q)),dp;
1204   }
1205
1206   ideal lastmap;
1207   q = 1;
1208   for(ii=1; ii<=size(rw1); ii++ )
1209   {
1210      if ( rw1[ii]==1 ) { lastmap[ii] = T(q); q=q+1; }
1211      if ( rw1[ii]==0 ) { lastmap[ii] = 0; }
1212   }
1213   map phi1 = newRing,lastmap;
1214   ideal endid  = phi1(endid);
1215   ideal endphi = phi1(endphi);
1216   export(endid);
1217   export(endphi);
1218   list L = lastRing;
1219   setring newRing;
1220   return(L);
1221}
1222///////////////////////////////////////////////////////////////////////////////
1223static
1224proc diagon(ideal i)
1225{
1226   matrix m;
1227   intvec iv = option(get);
1228   option(redSB);
1229   ideal j=liftstd(jet(i,1),m);
1230   option(set,iv);
1231   return(ideal(matrix(i)*m));
1232}
1233/////////////////////////////////////////////////////////////////////////////
1234/*
1235                           Examples:
1236LIB"normal.lib";
1237//Huneke
1238ring qr=31991,(a,b,c,d,e),dp;
1239ideal i=
12405abcde-a5-b5-c5-d5-e5,
1241ab3c+bc3d+a3be+cd3e+ade3,
1242a2bc2+b2cd2+a2d2e+ab2e2+c2de2,
1243abc5-b4c2d-2a2b2cde+ac3d2e-a4de2+bcd2e3+abe5,
1244ab2c4-b5cd-a2b3de+2abc2d2e+ad4e2-a2bce3-cde5,
1245a3b2cd-bc2d4+ab2c3e-b5de-d6e+3abcd2e2-a2be4-de6,
1246a4b2c-abc2d3-ab5e-b3c2de-ad5e+2a2bcde2+cd2e4,
1247b6c+bc6+a2b4e-3ab2c2de+c4d2e-a3cde2-abd3e2+bce5;
1248
1249
1250//Vasconcelos
1251ring r=32003,(x,y,z,w,t),dp;
1252ideal i=
1253x2+zw,
1254y3+xwt,
1255xw3+z3t+ywt2,
1256y2w4-xy2z2t-w3t3;
1257
1258//Theo1
1259ring r=32003,(x,y,z),wp(2,3,6);
1260ideal i=zy2-zx3-x6;
1261
1262//Theo1a (CohenMacaulay and regular in codimension 2)
1263ring r=32003,(x,y,z,u),wp(2,3,6,6);
1264ideal i=zy2-zx3-x6+u2;
1265
1266
1267//Theo2
1268ring r=32003,(x,y,z),wp(3,4,12);
1269ideal i=z*(y3-x4)+x8;
1270
1271//Theo2a
1272ring r=32003,(T(1..4)),wp(3,4,12,17);
1273ideal i=
1274T(1)^8-T(1)^4*T(3)+T(2)^3*T(3),
1275T(1)^4*T(2)^2-T(2)^2*T(3)+T(1)*T(4),
1276T(1)^7+T(1)^3*T(2)^3-T(1)^3*T(3)+T(2)*T(4),
1277T(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;
1278
1279//Theo3
1280ring r=32003,(x,y,z),wp(3,5,15);
1281ideal i=z*(y3-x5)+x10;
1282
1283
1284//Theo4
1285ring r=32003,(x,y,z),dp;
1286ideal i=(x-y)*(x-z)*(y-z);
1287
1288//Theo5
1289ring r=32003,(x,y,z),wp(2,1,2);
1290ideal i=z3-xy4;
1291
1292//Theo6
1293ring r=32003,(x,y,z),dp;
1294ideal i=x2y2+x2z2+y2z2;
1295
1296ring r=32003,(a,b,c,d,e,f),dp;
1297ideal i=
1298bf,
1299af,
1300bd,
1301ad;
1302
1303//Beispiel, wo vorher Primaerzerlegung schneller
1304//ist CM
1305//Sturmfels
1306ring r=32003,(b,s,t,u,v,w,x,y,z),dp;
1307ideal i=
1308bv+su,
1309bw+tu,
1310sw+tv,
1311by+sx,
1312bz+tx,
1313sz+ty,
1314uy+vx,
1315uz+wx,
1316vz+wy,
1317bvz;
1318
1319//J S/Y
1320ring r=32003,(x,y,z,t),dp;
1321ideal i=
1322x2z+xzt,
1323xyz,
1324xy2-xyt,
1325x2y+xyt;
1326
1327//St_S/Y
1328ring r=32003,(b,s,t,u,v,w,x,y,z),dp;
1329ideal i=
1330wy-vz,
1331vx-uy,
1332tv-sw,
1333su-bv,
1334tuy-bvz;
1335
1336//dauert laenger
1337//Horrocks:
1338ring r=32003,(a,b,c,d,e,f),dp;
1339ideal i=
1340adef-16000be2f+16001cef2,
1341ad2f+8002bdef+8001cdf2,
1342abdf-16000b2ef+16001bcf2,
1343a2df+8002abef+8001acf2,
1344ad2e-8000bde2-7999cdef,
1345acde-16000bce2+16001c2ef,
1346a2de-8000abe2-7999acef,
1347acd2+8002bcde+8001c2df,
1348abd2-8000b2de-7999bcdf,
1349a2d2+9603abde-10800b2e2-9601acdf+800bcef+11601c2f2,
1350abde-8000b2e2-acdf-16001bcef-8001c2f2,
1351abcd-16000b2ce+16001bc2f,
1352a2cd+8002abce+8001ac2f,
1353a2bd-8000ab2e-7999abcf,
1354ab3f-3bdf3,
1355a2b2f-2adf3-16000bef3+16001cf4,
1356a3bf+4aef3,
1357ac3e-10668cde3,
1358a2c2e+10667ade3+16001be4+5334ce3f,
1359a3ce+10669ae3f,
1360bc3d+8001cd3e,
1361ac3d+8000bc3e+16001cd2e2+8001c4f,
1362b2c2d+16001ad4+4000bd3e+12001cd3f,
1363b2c2e-10668bc3f-10667cd2ef,
1364abc2e-cde2f,
1365b3cd-8000bd3f,
1366b3ce-10668b2c2f-10667bd2ef,
1367abc2f-cdef2,
1368a2bce-16000be3f+16001ce2f2,
1369ab3d-8000b4e-8001b3cf+16000bd2f2,
1370ab2cf-bdef2,
1371a2bcf-16000be2f2+16001cef3,
1372a4d-8000a3be+8001a3cf-2ae2f2;
1373
1374
1375ring r=32003,(b,s,t,u,v,w,x,y,z),dp;
1376
1377ideal k=
1378wy-vz,
1379vx-uy,
1380tv-sw,
1381su-bv,
1382tuy-bvz;
1383ideal j=x2y2+x2z2+y2z2;
1384ideal i=mstd(intersect(j,k))[2];
1385
1386//22
1387ring r=32003,(b,s,t,u,v,w,x,y,z),dp;
1388ideal i=
1389wx2y3-vx2y2z+wx2yz2+wy3z2-vx2z3-vy2z3,
1390vx3y2-ux2y3+vx3z2-ux2yz2+vxy2z2-uy3z2,
1391tvx2y2-swx2y2+tvx2z2-swx2z2+tvy2z2-swy2z2,
1392sux2y2-bvx2y2+sux2z2-bvx2z2+suy2z2-bvy2z2,
1393tux2y3-bvx2y2z+tux2yz2+tuy3z2-bvx2z3-bvy2z3;
1394
1395
1396//riemenschneider
1397//33
1398//normal+primary 3
1399//primary 9
1400//radical 1
1401//minAssPrimes 2
1402ring r=32000,(p,q,s,t,u,v,w,x,y,z),wp(1,1,1,1,1,1,2,1,1,1);
1403ideal i=
1404xz,
1405vx,
1406ux,
1407su,
1408qu,
1409txy,
1410stx,
1411qtx,
1412uv2z-uwz,
1413uv3-uvw,
1414puv2-puw;
1415
1416ring r=0,(u,v,w,x,y,z),wp(1,1,1,3,2,1);
1417ideal i=wx,wy,wz,vx,vy,vz,ux,uy,uz,y3-x2;
1418
1419
1420
1421*/
1422
Note: See TracBrowser for help on using the repository browser.