source: git/Singular/LIB/resjung.lib @ 6fe9a5

spielwiese
Last change on this file since 6fe9a5 was 62dc18e, checked in by Hans Schoenemann <hannes@…>, 13 years ago
some format fixes git-svn-id: file:///usr/local/Singular/svn/trunk@13733 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100755
File size: 26.9 KB
Line 
1//
2version="$Id$";
3category="Algebraic Geometry";
4info="
5LIBRARY:  resjung.lib      Resolution of surface singularities (Desingularization)
6                           by Jung's Algorithm
7AUTHORS:  Philipp Renner,   philipp_renner@web.de
8@*        Anne Fruehbis-Krueger, anne@math.uni-hannover.de
9OVERVIEW: This library implements resolution of singularities by Jung's algorithm,
10@*        which is only applicable to surfaces and persues the following strategy:
11@*        1) project surface to the plane
12@*        2) resolve singularities of the branch locus
13@*        3) pull-back the original surface by this resolution morphism
14@*        4) normalize the resulting surface so that the remaining singularities
15@*           are of Hirzebruch-Jung type
16@*        5) resolve Hirzebruch-Jung singularities explicitly
17@*        Currently, the Hirzebruch-Jung singularities are resolved by calling
18@*        the procedure resolve from the library resolve.lib, because this is not
19@*        overly expensive and the original last step of Jung's algorithm is not
20@*        implemented yet.
21REFERENCES:
22[1] Jung, H.: Darstellung der Funktionen eines algebraischen Koerpers zweier unabhaengigen
23Veraenderlichen x,y in der Umgebung x=a, y= b, Journal fuer Reine und Angewandte Mathematik
24133,289-314 (1908)
25@*  (the origin of this method)
26@*[2] J.Kollar: Lectures on Resolution of Singularities, Princeton University Press (2007)
27@*  (contains large overview over various known methods for curves and surfaces as well as
28   a detailed description of the approach in the general case)
29
30PROCEDURES:
31 jungresolve(J,i)  computes a resolution of the surface given by the
32                   ideal J using Jungs Method
33
34 clocus(J)         computes the critical locus of the projection of V(J)
35                   onto the coordinate plane of the last two coordinates
36 embR(C)           computes a strong embedded resolution of the plane curve V(C)
37 jungnormal(J,i)   computes intermediate step in Jung's algorithm
38                   such that all singularities are of Hirzebruch-Jung type
39";
40
41LIB "resolve.lib";
42LIB "mregular.lib";
43LIB "sing.lib";
44LIB "normal.lib";
45LIB "primdec.lib";
46
47//////////////////////////////////////////////////////////////////////////////
48//----------------------------------------------------------------------------
49//Critical locus for the Weierstrass map induced by the noether normalization
50//----------------------------------------------------------------------------
51proc clocus(ideal id)
52"USAGE:  clocus(ideal J);
53@*       J = ideal
54ASSUME:  J  = two dimensional ideal in noether position with respect
55         to the last two variables
56RETURN:  A ring containing the ideal Clocus respresenting the critical
57         locus of the projection V(J)-->C^2 onto the coordinate plane
58         of the last two coordinates
59EXAMPLE: example clocus;  shows an example
60"
61{
62  def A = basering;
63  int n = nvars(A);
64  list l = equidim(id);
65  int i,j;
66  int k = size(l);
67  ideal LastTwo = var(n-1),var(n);
68  ideal lowdim = 1;   //the components of id with dimension smaller 2
69  if(k>1){
70    for(j=1;j<k;j++){
71      lowdim = intersect(lowdim,l[j]);
72    }
73  }
74  //lowdim = radical(lowdim);  // affects performance
75  ideal I = l[size(l)];
76  poly product=1;
77  kill l;
78  for(i=1; i < n-1; i++){
79  //elimination of all variables exept var(i),var(n-1),var(n)
80    intvec v;
81    for(j=1; j < n-1; j++){
82      if(j<>i){
83        v[j]=1;
84      }
85      else{
86        v[j]=0;
87      }
88    }
89    v[size(v)+1]=0;
90    v[size(v)+1]=0;
91    if(defined(ringl)) {kill ringl;}
92    list ringl = ringlist(A);
93    list l;
94    l[1] = "a";
95    l[2] = v;
96    list ll = insert(ringl[3],l);
97    ringl[3]=ll;
98    kill l,ll;
99    def R = ring(ringl); //now x_j > x_i > x_n-1 > x_n forall j != i,n-1,n
100    setring R;
101    ideal J = groebner(fetch(A,I));  //this eliminates the variables
102    setring A;
103    ideal J = fetch(R,J);
104    attrib(J,"isPrincipal",0);
105    if(size(J)==1){
106      attrib(J,"isPrincipal",1);
107    }
108    int index = 1;
109    if(attrib(J,"isPrincipal")==0){
110      setring R;
111      for(j = 1;j<=size(J);j++){   //determines the monic polynomial
112                                   //in var(i) with coefficents in C2
113        if(defined(w)) {kill w;}
114        intvec w = leadexp(J[j]);
115        attrib(w,"isMonic",1);
116        for(k = 1;k<=size(w);k++){
117          if(w[k] <> 0 && k <> i){
118            attrib(w,"isMonic",0);
119            break;
120          }
121        }
122        if(attrib(w,"isMonic")==1){
123          index = j;
124          break;
125        }
126        kill w;
127      }
128      setring A;
129    }
130    product = product*resultant(J[index],diff(J[index],var(i)),var(i));
131                       //Product of the discriminants, which lies in C2
132    kill index,J,v;
133  }
134  ring C2 = 0,(var(n-1),var(n)),dp;
135  setring C2;
136  ideal Clocus = imap(A,product);      //the critical locus is contained in this
137  ideal I = preimage(A,LastTwo,lowdim);
138  Clocus = radical(intersect(Clocus,I));  //radical is necessary since the
139                                          //resultant is not reduced in general
140  export(Clocus);
141  return(C2);
142}
143example
144{"EXAMPLE:";
145   echo = 2;
146   ring R=0,(x,y,z),dp;
147   ideal I=x2-y3z3;
148   list li=clocus(I);
149   def S=li[1];
150   setring S;
151   Clocus;
152}
153///////////////////////////////////////////////////////////////////////////////
154//-----------------------------------------------------------------------------
155// Build the fibre product of the embedded resolution and
156// the coordinate ring of the variety
157//-----------------------------------------------------------------------------
158static proc buildFP(list embR,ideal NoetherN, map phi){
159  def A = basering;
160  int i,j,k;
161  list fibreP;
162  int n = nvars(A);
163  for(i=1;i<=size(embR);i++){
164    if(defined(R)) {kill R;}
165    def R = embR[i];
166    setring R;
167    list temp = ringlist(A);
168// create data for the new ring
169// e.g. if A=K[x_1,..,x_n] and R=K[y_1,..,y_m], K[x_1,..,x_n-2,y_1,..,y_m]
170    for(j = 1; j<= nvars(R);j++){
171       string st = string(var(j));
172       temp[2][n-2+j] = st;
173       kill st;
174    }
175    temp[4]    = BO[1];
176    ideal J = BO[5];        //ideal of the resolution map
177    export(J);
178    int m = size(J);
179    def R2 = ring(temp);
180    kill temp;
181    setring R2;
182    ideal Temp=0;           //defines map from R to R2 which is the inclusion
183    for(k=n-1;k<n-1+nvars(R);k++){
184      Temp = Temp + ideal(var(k));
185    }
186    map f = R,Temp;
187    kill Temp;
188    ideal FibPMI = ideal(0);       //defines the map from A to R2
189    for(k=1;k<=nvars(A)-m;k++){
190      FibPMI=FibPMI+var(k);
191    }
192    FibPMI= FibPMI+ideal(f(J));
193    map FibMap = A,FibPMI;
194    kill f,FibPMI;
195    ideal TotalT = groebner(FibMap(NoetherN));
196    ideal QIdeal = TotalT;
197    export(QIdeal);
198    ideal FibPMap = ideal(FibMap(phi));
199    ideal BMap = FibPMap;
200    export(BMap);
201    fibreP[i] = R2;
202    setring R;
203    kill J,R,R2,m;
204  }
205  return(fibreP);
206}
207
208///////////////////////////////////////////////////////////////////////////////
209//-----------------------------------------------------------------------------
210// embedded resolution for curves -- optimized for our situation
211//-----------------------------------------------------------------------------
212proc embR(ideal C)
213"USAGE:  embR(ideal C);
214@*       C = ideal
215ASSUME:  C  = ideal of plane curve
216RETURN:  a list l of rings
217         l[i] is a ring containing a basic object BO, the result of the
218         resolution.
219THEORY:  Given a plain curve C, an embedded resolution of this curve
220@*         by means of a sequence of blow ups at singular points of C is
221@*         computed such that the resulting total transform consists
222@*         of non-singular components and only has strict normal crossings.
223@*         The result of each blow up is represented by means of
224@*         affine charts and hence also the final result is represented in
225@*         charts, which are collected in a list l of rings. Each ring
226@*         in this list corresponds to one chart. The collection of
227@*         data describing the ambient space, the strict transform, the
228@*         exceptional divisors and the combination of the blow ups
229@*         leading to this chart is contained in the list BO which resides
230@*         in this ring.
231NOTE:      - The best way to look at the data contained in BO is the
232@*           procedure showBO from the library resolve.lib.
233@*         - The algorithm does not touch normal crossings of V(C).
234EXAMPLE: example embR; shows an example
235"
236{
237  ideal J = 1;
238  attrib(J,"iswholeRing",1);
239  list primdec = equidim(C);
240  if(size(primdec)==2){
241// zero dimensional components of the discrimiant curve
242// are smooth an cross normally so they can be ignored
243// in the resolution process
244    ideal Lowdim = radical(primdec[1]);
245  }
246  else{
247    J=radical(C);
248  }
249  kill primdec;
250  list l;
251  list BO = createBO(J,l);
252  kill J,l;
253  list result = resolve2(BO);
254  if(defined(Lowdim)){
255    for(int i = 1;i<=size(result);i++){
256// had zero dimensional components which are now added to the end result
257      if(defined(R)) {kill R;}
258      def R = result[i];
259      setring R;
260      map f = R2,BO[5];
261      BO[2]=BO[2]*f(Lowdim);
262      kill R,f;
263    }
264  }
265  return(result);
266}
267example
268{"EXAMPLE:";
269  echo=2;
270  ring R=0,(x,y),dp;
271  ideal C=x2-y3;
272  list li=embR(C);
273  def S=li[1];
274  setring S;
275  showBO(BO);
276}
277///////////////////////////////////////////////////////////////////////////////
278static proc resolve2(list BO){
279// computes an embedded resolution for the basic object BO
280// and returns a list of rings with BO -- specifically optimized
281// to our situation
282  def H = basering;
283  int i,j,k;
284  setring H;  attrib(BO[2],"smoothC",0);
285  export(BO);
286  list result;
287  result[1]=H;
288  attrib(result[1],"isResolved",0);    // has only simple normal crossings
289  attrib(result[1],"smoothC",0);       // has smooth components
290  int safety=0;                        // number of runs restricted to 30
291  while(1){
292    int count2 = 0;         // counts the number of smooth charts
293    int p = size(result);
294    for(j = 1;j<=p;j++){
295      if(attrib(result[j],"isResolved")==0){
296        if(defined(R)){kill R;}
297        def R = result[j];
298        setring R;
299        if(attrib(result[j],"smoothC")==0){
300// has possibly singular components so choose a singular point and blow up
301          list primdecPC = primdecGTZ(BO[2]);
302          attrib(result[j],"smoothC",1);
303          for(i = 1;i<=size(primdecPC);i++){
304            ideal Sl = groebner(slocus(primdecPC[i][2]));
305            if(deg(NF(1,Sl))!=-1){
306              list primdecSL = primdecGTZ(Sl);
307              for(int h =1;h<=size(primdecSL);h++){
308                attrib(primdecSL[h],"isRational",1);
309              }
310              kill h;
311              if(!defined(index)){int index = 1;}
312              if(defined(blowup)){kill blowup;}
313              list blowup = blowUpBO(BO,primdecSL[index][2],3);
314// if it has only a rational singularity, blow it up,
315// else choose some arbitary singular point
316              if(attrib(primdecSL[1],"isRational")==0){
317// if we blew up a non rational singularity, the exeptional divisors
318// are reduzible, so we need to separate them
319                for(k=1;k<=size(blowup);k++){
320                  def R2=blowup[k];
321                  setring R2;
322                  list L;
323                  for(int l = 1;l<=size(BO[4]);l++){
324                    list primdecED=primdecGTZ(BO[4][l]);
325                    L = L + primdecED;
326                    kill primdecED;
327                  }
328                  kill l;
329                  BO[4] = L;
330                  blowup[k]=R2;
331                  kill L,R2;
332                }
333              }
334              kill primdecSL;
335              list hlp;
336              for(k = 1;k<j;k++){
337                hlp[k]=result[k];
338                attrib(hlp[k],"isResolved",attrib(result[k],"isResolved"));
339                attrib(hlp[k],"smoothC",attrib(result[k],"smoothC"));
340              }
341              for(k =1;k<=size(blowup);k++){
342                hlp[size(hlp)+1]=blowup[k];
343                attrib(hlp[size(hlp)],"isResolved",0);
344                attrib(hlp[size(hlp)],"smoothC",0);
345              }
346              for(k = j+1;k<=size(result);k++){
347                hlp[size(hlp)+1]=result[k];
348                attrib(hlp[size(hlp)],"isResolved",attrib(result[k],"isResolved"));
349                attrib(hlp[size(hlp)],"smoothC",attrib(result[k],"smoothC"));
350              }
351              result = hlp;
352              kill hlp;
353              i=size(primdecPC);
354            }
355            else{
356              attrib(result[j],"smoothC",1);
357            }
358            kill Sl;
359          }
360          kill primdecPC;
361          j=p;
362          break;
363        }
364        else{
365// if it has smooth components, determine all the intersection points
366// and check whether they are snc or not
367          int count = 0;
368          ideal Collect = BO[2];
369          for(i = 1;i<=size(BO[4]);i++){
370            Collect = Collect*BO[4][i];
371          }
372          list primdecSL = primdecGTZ(slocus(Collect));
373          for(k = 1;k<=size(primdecSL);k++){
374             attrib(primdecSL[k],"isRational",1);
375          }
376          if(defined(blowup)){kill blowup;}
377          list blowup = blowUpBO(BO,primdecSL[1][2],3);
378          if(attrib(primdecSL[1],"isRational")==0){
379            for(k=1;k<=size(blowup);k++){
380              def R2=blowup[k];
381              setring R2;
382              list L;
383              for(int l = 1;l<=size(BO[4]);l++){
384                list primdecED=primdecGTZ(BO[4][l]);
385                L = L + primdecED;
386                kill primdecED;
387              }
388              kill l;
389              BO[4] = L;
390              blowup[k]=R2;
391              kill L,R2;
392            }
393          }
394          kill Collect;
395          for(i=1;i<=size(primdecSL);i++){
396            list L = BO[4];
397            L[size(L)+1]=BO[2];
398            for(int l = 1;l<=size(L);l++){
399              if(L[l][1]==1){L=delete(L,l);}
400            }
401            kill l;
402            if(normalCrossing(ideal(0),L,primdecSL[i][2])==0){
403              if(defined(blowup)){kill blowup;}
404              list blowup = blowUpBO(BO,primdecSL[i][2],3);
405              list hlp;
406              for(k = 1;k<j;k++){
407                hlp[k]=result[k];
408                attrib(hlp[k],"isResolved",attrib(result[k],"isResolved"));
409                attrib(hlp[k],"smoothC",attrib(result[k],"smoothC"));
410              }
411              for(k =1;k<=size(blowup);k++){
412                hlp[size(hlp)+1]=blowup[k];
413                attrib(hlp[size(hlp)],"isResolved",0);
414                attrib(hlp[size(hlp)],"smoothC",1);
415              }
416              for(k = j+1;k<=size(result);k++){
417                hlp[size(hlp)+1]=result[k];
418                attrib(hlp[size(hlp)],"isResolved",attrib(result[k],"isResolved"));
419                attrib(hlp[size(hlp)],"smoothC",attrib(result[k],"smoothC"));
420              }
421              result = hlp;
422              kill hlp;
423              j = p;
424              break;
425            }
426            else{
427              count++;
428            }
429            kill L;
430          }
431          if(count == size(primdecSL)){
432            attrib(result[j],"isResolved",1);
433          }
434          kill count,primdecSL;
435        }
436        kill R;
437      }
438      else{
439        count2++;
440      }
441    }
442    if(count2==size(result)){
443      break;
444    }
445    kill count2,p;
446    safety++;
447  }
448  return(result);
449}
450///////////////////////////////////////////////////////////////////////////////
451static proc jungfib(ideal id, int noeth)
452"USAGE:  jungfib(ideal J, int i);
453@*       J = ideal
454@*       i = int
455ASSUME:  J  = two dimensional ideal
456RETURN:  a list l of rings
457         l[i] is a ring containing two Ideals: QIdeal and BMap.
458         BMap defines a birational morphism from V(QIdeal)-->V(J), such that
459         V(QIdeal) has only quasi-ordinary singularities.
460         If i!=0 then it's assumed that J is in noether position with respect
461         to the last two variables.
462         If i=0 the algorithm computes a coordinate change such that J is in
463         noether position.
464EXAMPLE: none, as it is a static procedure
465"
466{
467  int i;
468  if(!defined(noeth)){
469    int noeth = 0;
470  }
471  if(noeth <> 1){print("//WARNING: Noether normalization can make the algorithm unstable");}
472  ideal I = std(radical(id));
473  def A = basering;
474  int n = nvars(A);
475  if(deg(NF(1,groebner(slocus(id)))) == -1){
476    list result;
477    ideal QIdeal = I;
478    ideal BMap = maxideal(1);
479    export(QIdeal);
480    export(BMap);
481    result[1] = A;
482    return(result);
483  }
484  if(char(A) <> 0){ERROR("only works for characterisitc 0");}  //dummy check
485  if(dim(I)<> 2){ERROR("dimension is unequal 2");}  //dummy check
486
487// Noether Normalization
488  if(noeth == 0){
489    if(n==3){
490      int pos = NoetherP_test(I);
491      if(pos ==0){
492        if(size(I) == 1){
493          ideal noethpos = var(1)+var(3),var(2)+var(3),var(3);
494        }
495        else{
496          ideal noethpos = NoetherPosition(I);
497        }
498        map phi = A,noethpos;
499        kill noethpos;
500      }
501      else{
502        ideal NoetherPos = var(pos);
503        for(i = 1;i<=3;i++){
504          if(i<>pos){
505            NoetherPos = NoetherPos + var(i);
506          }
507        }
508        map phi = A,NoetherPos;
509        kill i,pos,NoetherPos;
510      }
511    }
512    else{
513      map phi = A,NoetherPosition(I);
514    }
515    ideal NoetherN = ideal(phi(I));
516//image of id under the NoetherN coordinate change
517  }
518  else{
519    ideal NoetherN = I;
520    map phi = A,maxideal(1);
521  }
522  kill I;
523//Critical Locus
524  def C2 = clocus(NoetherN);
525  setring C2;
526
527//dim of critical locus is 0 then the normalization is an resolution
528  if(dim(Clocus) == 0){
529    setring A;
530    list nor = normal(NoetherN);
531    list result;
532    for(i = 1;i<=size(nor[1]);i++){
533      def R = nor[1][i];
534      setring R;
535      ideal QIdeal = norid;
536      ideal BMap = BMap;
537      export(QIdeal);
538      export(BMap);
539      result[size(result)+1] = R;
540      kill R;
541    }
542    print("This is a resolution.");
543    return(result);
544  }
545
546// dim of critical locus is 1, so compute embedded resolution of the discriminant curve
547  list embRe = embR(Clocus);
548
549// build the fibreproduct
550  setring A;
551  list fibreP = buildFP(embRe,NoetherN,phi);
552// a list of lists, where fibreP[i] contains the information
553// concerning  the i-th chart of the fibrepoduct
554// fibreP[i] is the ring; QIdeal the quotientideal; BMap is the map from A
555  return(fibreP);
556}
557///////////////////////////////////////////////////////////////////////////////
558
559proc jungnormal(ideal id,int noeth)
560"USAGE:  jungnormal(ideal J, int i);
561@*       J = ideal
562@*       i = int
563ASSUME:  J  = two dimensional ideal
564RETURN:  a list l of rings
565         l[k] is a ring containing two Ideals: QIdeal and BMap.
566         BMap defines a birational morphism from V(QIdeal)-->V(J), such that
567         V(QIdeal) has only singularities of Hizebuch-Jung type.
568         If i!=0 then it's assumed that J is in noether position with respect
569         to the last two variables.
570         If i=0 the algorithm computes a coordinate change such that J is in
571         noether position.
572EXAMPLE: example jungnormal; shows an example
573"
574{
575  def A = basering;
576  list fibreP = jungfib(id,noeth);
577  list result;
578  int i,j;
579  for(i =1;i<=size(fibreP);i++){
580    def R1 = fibreP[i];
581    setring R1;
582    map f1 = A,BMap;
583    def nor = normal(QIdeal);
584    for(j = 1;j<=size(nor[1]);j++){
585      def R2 = nor[1][j];
586      setring R2;
587      map f2 = R1,normap;
588      ideal BMap = ideal(f2(f1));
589      ideal QIdeal = norid;
590      export(BMap);
591      export(QIdeal);
592      result[size(result)+1] = R2;
593      setring R1;
594      kill R2;
595    }
596    kill R1;
597  }
598  return(result);
599}
600example
601{"EXAMPLE:";
602   echo = 2;
603   ring R=0,(x,y,z),dp;
604   ideal J=x2+y3z3;
605   list li=jungnormal(J,1);
606   li;
607   def S=li[1];
608   setring S;
609   QIdeal;
610   BMap;
611}
612///////////////////////////////////////////////////////////////////////////////
613
614proc jungresolve(ideal id,int noeth)
615"USAGE:  jungresolve(ideal J, int i);
616@*       J = ideal
617@*       i = int
618ASSUME:  J  = two dimensional ideal
619RETURN:  a list l of rings
620         l[k] is a ring containing two Ideals: QIdeal and BMap.
621         BMap defines a birational morphism from V(QIdeal)-->V(J), such that
622         V(QIdeal) is smooth. For this the algorithm computes first
623         a representation of V(J) with Hirzebruch-Jung singularities
624         and then it currently uses Villamayor's algorithm to resolve
625         these singularities.
626         If i!=0 then it's assumed that J is in noether position with respect
627         to the last two variables.
628         If i=0 the algorithm computes a coordinate change such that J is in
629         noether position.
630EXAMPLE: example jungresolve; shows an example
631"
632{
633  def A = basering;
634  list result;
635  int i,j;
636  list nor = jungnormal(id,noeth);
637  for(i = 1;i<=size(nor);i++){
638    if(defined(R)){kill R;}
639    def R3 = nor[i];
640    setring R3;
641    def R = changeord("dp");
642    setring R;
643    ideal QIdeal = imap(R3,QIdeal);
644    ideal BMap = imap(R3,BMap);
645    map f = A,BMap;
646    if(QIdeal <> 0){
647      list res = resolve(QIdeal);
648      for(j =1;j<=size(res[1]);j++){
649        def R2 = res[1][j];
650        setring R2;
651        if(defined(QIdeal)){kill QIdeal;}
652        if(defined(BMap)){kill BMap;}
653        if(BO[1]<>0){ideal QIdeal = BO[1]+BO[2];}
654        else{ideal QIdeal = BO[2];}
655        map g = R,BO[5];
656        ideal BMap = ideal(g(f));
657        export(QIdeal);
658        export(BMap);
659        result[size(result)+1] = R2;
660        kill R2;
661      }
662      kill res;
663    }
664    else{
665      result[size(result)+1] = nor[i];
666    }
667    kill R,R3;
668  }
669  return(result);
670}
671example
672{"EXAMPLE:";
673   echo = 2;
674   ring R=0,(x,y,z),dp;
675   ideal J=x2+y3z3+y2z5;
676   list li=jungresolve(J,1);
677   li;
678   def S=li[1];
679   setring S;
680   QIdeal;
681   BMap;
682}
683///////////////////////////////////////////////////////////////////////////////
684static proc NoetherP_test(ideal id){
685  def A = basering;
686  list ringA=ringlist(A);
687  int i,j,k;
688  int index = 0;
689  if(size(id)==1 && nvars(A)){  // test if V(id) = C[x,y,z]/<f>
690    list L;
691    intvec v = 1,1,1;
692    L[1] = "lp";
693    L[2] = v;
694    kill v;
695    poly f = id[1];
696    for(i = 1;i<=3;i++){
697      setring A;
698      list l = ringA;  //change ordering to lp and var(i)>var(j) j!=i
699      list vari = ringA[2];
700      string h = vari[1];
701      vari[1] = vari[i];
702      vari[i] = h;
703      l[2] = vari;
704      kill h,vari;
705      l[3][1] = L;
706      def R = ring(l);
707      kill l;
708      setring R;
709      ideal I = imap(A,id);
710      if(defined(v)){kill v;}
711      intvec v = leadexp(I[1]);
712      attrib(v,"isMonic",1);
713      for(k = 2;k<=3;k++){
714// checks whether f is monic in var(i)
715        if(v[k] <> 0 || v[1] == 0){
716          attrib(v,"isMonic",0);
717          j++;
718          break;
719        }
720      }
721      if(attrib(v,"isMonic")==1){
722        index = i;
723        return(index);
724      }
725      kill R;
726    }
727    if(j == 3){
728      return(0);
729    }
730  }
731  else{
732// not yet a test for more variables
733    return(index);
734  }
735}
736/////////////////////////////////////////////////////////////////////////
737//// copied from resolve.lib, deleting parts of procedures which are  ///
738//// not necessary in this setting                                    ///
739/////////////////////////////////////////////////////////////////////////
740static proc normalCrossing(ideal J,list E,ideal V)
741"Internal procedure - no help and no example available
742"
743{
744   int i,d,j;
745   int n=nvars(basering);
746   list E1,E2;
747   ideal K,M,Estd;
748   intvec v,w;
749
750   for(i=1;i<=size(E);i++)
751   {
752      Estd=std(E[i]+J);
753      if(deg(Estd[1])>0)
754      {
755         E1[size(E1)+1]=Estd;
756      }
757   }
758   E=E1;
759   for(i=1;i<=size(E);i++)
760   {
761      v=i;
762      E1[i]=list(E[i],v);
763   }
764   list ll;
765   int re=1;
766
767   while((size(E1)>0)&&(re==1))
768   {
769      K=E1[1][1];
770      v=E1[1][2];
771      attrib(K,"isSB",1);
772      E1=delete(E1,1);
773      d=n-dim(K);
774      M=minor(jacob(K),d)+K;
775      if(deg(std(M+V)[1])>0)
776      {
777         re=0;
778         break;
779      }
780      for(i=1;i<=size(E);i++)
781      {
782         for(j=1;j<=size(v);j++){if(v[j]==i){break;}}
783         if(j<=size(v)){if(v[j]==i){i++;continue;}}
784         Estd=std(K+E[i]);
785         w=v;
786         if(deg(Estd[1])==0){i++;continue;}
787         if(d==n-dim(Estd))
788         {
789            if(deg(std(Estd+V)[1])>0)
790            {
791               re=0;
792               break;
793            }
794         }
795         w[size(w)+1]=i;
796         E2[size(E2)+1]=list(Estd,w);
797      }
798      if(size(E2)>0)
799      {
800         if(size(E1)>0)
801         {
802            E1[size(E1)+1..size(E1)+size(E2)]=E2[1..size(E2)];
803         }
804         else
805         {
806            E1=E2;
807         }
808      }
809      kill E2;
810      list E2;
811   }
812   return(re);
813}
814//////////////////////////////////////////////////////////////////////////////
815
816static proc zariski(ideal id){
817  def A = basering;
818  ideal QIdeal = std(id);
819  ideal BMap= maxideal(1);
820  export(BMap);
821  int i,j;
822  export(QIdeal);
823  if(dim(QIdeal)<>2){
824     print("wrong dimension");
825     list result;
826     return(result);
827  }
828  list result;
829  result[1]= A;
830  attrib(result[1],"isSmooth",0);
831  while(1){
832    if(defined(count)){kill count;}
833    int count =0;
834    for(i = 1;i<= size(result);i++){
835      attrib(result[i],"isSmooth",1);
836      def R = result[i];
837      setring R;
838      if(!defined(Slocus)){
839        if(QIdeal[1] == 0){
840          ideal Slocus = 1;
841        }
842        else{
843          ideal Slocus = std(slocus(QIdeal));
844        }
845      }
846      if(NF(1,Slocus)<>0){
847        attrib(result[i],"isSmooth",0);
848      }
849      else{
850        count++;
851      }
852      kill R;
853    }
854    if(count == size(result)){return(result);}
855    count = 0;
856    list hlp;
857    for(i = 1;i<=size(result);i++){
858      if(attrib(result[i],"isSmooth")==1){
859        hlp[size(hlp)+1] = result[i];
860        attrib(hlp[size(hlp)],"isSmooth",attrib(result[i],"isSmooth"));
861        count++;
862        i++;
863        continue;
864      }
865      def R = result[i];
866      setring R;
867      //print(N1);
868      list nor = normal(QIdeal);
869      //print(N2);
870      for(j = 1;j<= size(nor[1]);j++){
871        def R3 = nor[1][j];
872        setring R3;
873        def R2 = changeord("dp");
874        setring R2;
875        ideal norid = imap(R3,norid);
876        ideal normap = imap(R3,normap);
877        kill R3;
878        map f = R,normap;
879        if(defined(BMap)){kill BMap;}
880        if(defined(QIdeal)){kill QIdeal;}
881        ideal BMap = f(BMap);
882        ideal QIdeal = norid;
883        export(BMap);
884        export(QIdeal);
885        if(QIdeal[1]<> 0){
886          ideal Slocus = slocus(QIdeal);
887          Slocus = std(radical(Slocus));
888        }
889        else{
890          ideal Slocus = 1;
891        }
892        if(NF(1,Slocus)<> 0){
893          list blowup = blowUp(norid,Slocus);
894          for(int k = 1;k<=size(blowup);k++){
895            def R3 = blowup[k];
896            setring R3;
897            ideal QIdeal = sT + aS;
898            map f = R2,bM;
899            ideal BMap = f(BMap);
900            export(BMap);
901            export(QIdeal);
902            hlp[size(hlp)+1] = R3;
903            attrib(hlp[size(hlp)],"isSmooth",0);
904            kill R3;
905          }
906          kill k,blowup;
907        }
908        else{
909          hlp[size(hlp)+1] = R2;
910          attrib(hlp[size(hlp)],"isSmooth",1);
911        }
912        kill R2;
913      }
914      kill R,j,nor;
915    }
916    kill i;
917    if(count == size(result)){
918      return(result);
919    }
920    else{
921      result = hlp;
922      attrib(result,"isSmooth",0);
923      kill hlp;
924    }
925  }
926}
927//////////////////////////////////////////////////////////////////////////////
928// End of copied part and edited part from resolve.lib
929//////////////////////////////////////////////////////////////////////////////
930
Note: See TracBrowser for help on using the repository browser.