source: git/Singular/LIB/reesclos.lib @ f8c998c

fieker-DuValspielwiese
Last change on this file since f8c998c was f84dfa, checked in by Janko Boehm <boehm@…>, 10 years ago
Fixed minor bug in reesclos.lib
  • Property mode set to 100644
File size: 12.0 KB
Line 
1////////////////////////////////////////////////////////////////////////////
2version="version reesclos.lib 4.0.0.0 Jun_2013 "; // $Id$
3category="Commutative Algebra";
4
5info="
6LIBRARY:     reesclos.lib   PROCEDURES TO COMPUTE THE INT. CLOSURE OF AN IDEAL
7AUTHOR:      Tobias Hirsch, email: hirsch@math.tu-cottbus.de
8             Janko Boehm, email: boehm@mathematik.uni-kl.de
9             Magdaleen Marais, email: magdaleen@aims.ac.za
10
11OVERVIEW:
12 A library to compute the integral closure of an ideal I in a polynomial ring
13 R=k[x(1),...,x(n)] using the Rees Algebra R[It] of I. It computes the integral
14 closure of R[It],
15 which is a graded subalgebra of R[t]. The degree-k-component is the integral
16 closure of the k-th power of I.
17
18 In contrast to the previous version, the library uses 'normal.lib' to compute the
19 integral closure of R[It]. This improves the performance considerably.
20
21PROCEDURES:
22 ReesAlgebra(I);        computes the Rees Algebra of an ideal I
23 normalI(I[,p[,r]]);    computes the integral closure of an ideal I using R[It]
24";
25
26LIB "normal.lib";       // for HomJJ
27LIB "standard.lib";     // for groebner
28
29///////////////////////////////////////////////////////////////////////////////
30
31proc ReesAlgebra (ideal I)
32"USAGE:    ReesAlgebra (I); I = ideal
33RETURN:   The Rees algebra R[It] as an affine ring, where I is an ideal in R.
34          The procedure returns a list containing two rings:
35          [1]: a ring, say RR; in the ring an ideal ker such that R[It]=RR/ker
36
37          [2]: a ring, say Kxt; the basering with additional variable t
38               containing an ideal mapI that defines the map RR-->Kxt
39EXAMPLE:  example ReesAlgebra; shows an example
40"
41{
42  // remember the data of the basering
43
44  def oldring = basering;
45  string oldchar = charstr(basering);
46  string oldvar  = varstr(basering);
47  string oldord  = ordstr(basering);
48  int n = ncols(I);
49  ideal m = maxideal(1);
50
51
52  // Create a new ring with variables for each generator of I
53
54  execute ("ring Rees = "+oldchar+",("+oldvar+",U(1.."+string(n)+")),dp");
55
56
57  // Kxt is the old ring with additional variable t
58  // Here I -> t*I, so the generators of I generate the subalgebra R[It] in Kxt
59
60  execute ("ring Kxt = "+oldchar+",("+oldvar+",t),dp");
61  ideal I = fetch(oldring,I);
62  ideal m = fetch(oldring,m);
63  int k;
64  for (k=1;k<=n;k++)
65  {
66    I[k]=t*I[k];
67  }
68
69
70  // Now we map from Rees to Kxt, identity on the original variables, and
71  // U(k) -> I[k]
72
73  ideal mapI = m,I;
74  map phi = Rees,mapI;
75  ideal zero = 0;
76  export (mapI);
77
78  // Now the Rees-Algebra is Rees/ker(phi)
79
80  setring Rees;
81  ideal ker = preimage(Kxt,phi,zero);
82  export (ker);
83
84  list result = Rees,Kxt;
85
86  return(result);
87
88}
89example
90{
91  "EXAMPLE:"; echo=2;
92  ring R = 0,(x,y),dp;
93  ideal I = x2,xy4,y5;
94  list L = ReesAlgebra(I);
95  def Rees = L[1];       // defines the ring Rees, containing the ideal ker
96  setring Rees;          // passes to the ring Rees
97  Rees;
98  ker;                   // R[It] is isomorphic to Rees/ker
99}
100
101
102////////////////////////////////////////////////////////////////////////////
103
104static
105proc ClosureRees (list L)
106"USAGE:    ClosureRees (L); L a list
107ASSUME:   L is a list containing
108          - a ring L[1], inside L[1] an ideal ker such that L[1]/ker is
109            isomorphic to the Rees Algebra R[It] of an ideal I in k[x]
110          - a ring L[2]=k[x,t], inside L[1] an ideal mapI defining the
111            map L[1] --> L[2] with image R[It]
112RETURN:   quotients of elements of k[x,t] representing generators of the
113          integral closure of R[It]. The result of ClosureRees is a list
114          images, the first size(images)-1 entries are the numerators of the
115          generators, the last one is the universal denominator
116"
117{
118  int dblvl=printlevel-voice+2;   // toggles how much data is printed
119                                  // during the procedure
120
121  def Kxt = basering;
122  def R(1) = L[1];
123  setring R(1);                   // declaration of variables used later
124  ideal ker(1)=ker;               // in STEP 2
125  list nor = normal(ker);
126  list preimages=nor[2];
127  setring Kxt;
128  map psi=R(1),mapI;              // from ReesAlgebra: the map Rees->Kxt
129  ideal images=(psi(preimages))[1];
130  ideal psii = images[size(images)]*ideal(psi);
131  list imagesl = images[1..size(images)];
132  list psil =psii[1..size(psii)];
133  imagesl=psil+imagesl;
134  return(imagesl);
135}
136
137
138////////////////////////////////////////////////////////////////////////////
139
140static
141proc ClosurePower(list images, list #)
142"USAGE:    ClosurePower (L [,#]); L a list, # an optional list containing an
143          integer
144ASSUME:   - L is a list containing generators of the closure of R[It] in k[x,t]
145            (the first size(L)-1 elements are the numerators, the last one
146            is the denominator)
147          - if # is given: #[1] is an integer, compute generators for the
148                           closure of I, I^2, ..., I^#[1]
149RETURN:   the integral closure of I, ... I^#[1]. If # is not given, compute
150          the closure of all powers up to the maximum degree in t occurring
151          in the closure of R[It] (so this is the last power whose closure is
152          not just the sum/product of the smaller powers). The returned
153          result is a list of elements of k[x,t] containing generators of the
154          closure of the desired powers of I. "
155{
156  int dblvl=printlevel-voice+2;   // toggles how much data is printed
157                                  // during the procedure
158
159  int j,k,d,computepow;                    // some counters
160  int pow=0;
161  int length = size(images)-1;             // the number of generators
162  poly image;
163  poly @denominator = images[length+1];     // the universal denominator
164
165  if (size(#)>0)
166  {
167    pow=#[1];
168  }
169  computepow=pow;
170
171  if (dblvl>0)
172  {
173    "";
174    "// The generators of the closure of R[It]:";
175  }
176
177  intmat m[nvars(basering)-1][1];  // an intvec used for jet and maxdeg1
178  intvec tw=m,1;                   // such that t has weight 1 and all
179                                   // other variables have weight 0
180
181  // Construct the generators of the closure of R[It] as elements of k[x,t]
182  // If # is not given, determine the highest degree pow in t that occurs.
183
184  for (j=1;j<=length;j++)
185  {
186    images[j] = (images[j]/@denominator); // construct the fraction
187    image = images[j];
188    if (dblvl>0)
189    {
190      "generator",j,":",image;
191    }
192
193    if (computepow==0)              // #[1] not given or ==0 => compute pow
194    {
195      if (maxdeg1(image,tw)>pow)    // from poly.lib
196      {
197        pow=maxdeg1(image,tw);
198      }
199    }
200  }
201
202  if (dblvl>0)
203  {
204    "";
205    if (computepow==0)
206    {
207      "// Compute the closure up to the given powers of I";
208    }
209    else
210    {
211     "// Compute the closure up to the maximal power of t that occured:",pow;
212    }
213  }
214
215  // Construct a list consisting of #[1] resp. pow times the zero ideal
216
217  ideal CurrentPower=0;
218  list result;
219  for (k=1;k<=pow;k++)
220  {
221    result=insert(result,CurrentPower);
222  }
223
224  // For each generator and each k, add its degree-k-coefficient to the #
225  // closure of I^k
226
227  for (j=1;j<=length;j++)
228  {
229    for (k=1;k<=pow;k++)
230    {
231      image=images[j]-jet(images[j],k-1,tw);
232      if (image<>0)
233      {
234        image=subst(image/t^k,t,0);
235        if (image<>0)
236        {
237          result[k]=result[k]+image;
238        }
239      }
240    }
241  }
242
243  if (dblvl>0)
244  {
245    "";
246    "// The 'pure' parts of degrees 1..pow:";
247    result;
248    "";
249  }
250
251  // finally, add the suitable products of generators in lower degrees
252
253  for (k=2;k<=pow;k++)
254  {
255    for (j=1;j<=(k div 2);j++)
256    {
257      result[k]=result[k]+result[j]*result[k-j];
258    }
259  }
260
261  return(result);
262}
263
264////////////////////////////////////////////////////////////////////////////
265
266proc normalI(ideal I, list #)
267"USAGE:    normalI (I [,p[,r]]); I an ideal, p and r optional integers
268RETURN:   the integral closure of I, ..., I^p, where I is an ideal in the
269          polynomial ring R=k[x(1),...x(n)]. If p is not given, or p==0,
270          compute the closure of all powers up to the maximum degree in t
271          occurring in the closure of R[It] (so this is the last power whose
272          closure is not just the sum/product of the smaller). If r
273          is given and r==1, normalI starts with a check whether I is already a
274          radical ideal.
275          The result is a list containing the closure of the desired powers of
276          I as ideals of the basering.
277DISPLAY:  The procedure displays more comments for higher printlevel.
278EXAMPLE:  example normalI; shows an example
279"
280{
281  int dblvl=printlevel-voice+2;   // toggles how much data is printed
282                                  // during the procedure
283
284  def BAS=basering;               // remember the basering
285
286  // two simple cases: principal ideals and radical ideals are always
287  // integrally closed
288
289  if (size(I)<=1)        // includes the case I=(0)
290  {
291    if (dblvl>0)
292    {
293      "// Trivial case: I is a principal ideal";
294    }
295    list result=I;
296    if (size(#)>0)
297    {
298      for (int k=1;k<=#[1]-1;k++)
299      {
300        result=insert(result,I*result[k],k);
301      }
302    }
303    return(result);
304  }
305
306  int testrad=0;      // do the radical check?
307  if (size(#)>1)
308  {
309    testrad=#[2];
310  }
311
312  if (testrad==1)
313  {
314    if (dblvl>0)
315    {
316      "//Check whether I is radical";
317    }
318
319    if (size(reduce(radical(I),std(I)))==0)
320    {
321      if (dblvl>0)
322      {
323        "//Trivial case: I is a radical ideal";
324      }
325      list result=I;
326      if (size(#)>0)
327      {
328        for (int k=1;k<=#[1]-1;k++)
329        {
330          result=insert(result,I*result[k],k);
331        }
332      }
333      return(result);
334    }
335  }
336
337  // start with the computation of the Rees Algebra R[It] of I
338
339  if (dblvl>0)
340  {
341    "// We start with the Rees Algebra of I:";
342  }
343
344  list Rees = ReesAlgebra(I);
345  def R(1)=Rees[1];
346  def Kxt=Rees[2];
347  setring R(1);
348
349  if (dblvl>0)
350  {
351    R(1);
352    ker;
353    "";
354    "// Now ClosureRees computes generators for the integral closure";
355    "// of R[It] step by step";
356  }
357
358  // ClosureRees computes fractions in R[x,t] representing the generators
359  // of the closure of R[It] in k[x,t], which is the same as the closure
360  // in Q(R[It]).
361  // the first size(images)-1 entries are the numerators of the gene-
362  // rators, the last entry is the 'universal' denominator
363
364  setring Kxt;
365  list images = ClosureRees(Rees);
366
367  // ClosureRees was done after the first HomJJ-call
368  // ==> I is integrally closed, and images consists of the only entry "closed"
369
370  if ((size(images)==1) && (typeof(images[1])=="string"))
371  {
372    if (dblvl>0)
373    {
374      "//I is integrally closed!";
375    }
376
377    setring BAS;
378    list result=I;
379    if (size(#)>0)
380    {
381      for (int k=1;k<=#[1]-1;k++)
382      {
383        result=insert(result,I*result[k],k);
384      }
385    }
386    return(result);
387  }
388
389  // construct the fractions corresponding to the generators of the
390  // closure of I and its powers, depending on # (in fact, they will
391  // not be real fractions, of course). This is done in ClosurePower.
392  list result = ClosurePower(images,#);
393
394  // finally fetch the result to the old basering
395
396  setring BAS;
397  list result=fetch(Kxt,result);
398  return(result);
399}
400example
401{
402  "EXAMPLE:"; echo=2;
403  ring R=0,(x,y),dp;
404  ideal I = x2,xy4,y5;
405  list J = normalI(I);
406  I;
407  J;                             // J[1] is the integral closure of I
408}
409
410/*
411LIB"reesclos.lib";
412
413
414// 1.  x^i,y^i in k[x,y]
415//     geht bis i = 19 (800sec), bis i=10 wenige Sekunden,
416//     bei i = 20 ueber 1GB Hauptspeicher, in der 9. Iteration no memory
417//     (braucht 20 Iterationen)
418
419  ring r = 0,(x,y),dp;
420  int i = 6;
421  ideal I = x^i,y^i;
422  list J = normalI(I);
423  I;
424  J;
425
426
427//================================================================
428
429
430// 2. x^i,y^i,z^i in k[x,y,z]
431//    aehnlich wie 1., funktioniert aber nur bis i=5 und dauert dort
432//    >1 h
433
434
435//================================================================
436
437
438// 3. scheitert in der ersten Iteration beim Radikal
439//    Standardbasis des singulaeren Ortes: 7h (in char0),
440//    in char(p) viel schneller, obwohl kleine Koeffizienten
441//    schon bei Radikal -Test braucht er zu lang (>1h)
442
443  ring r = 0,(x,y,z),dp;
444  //ring r = 32003,(x,y,z),dp;
445
446  ideal I = x2+xy3-5z,z3+y2-xzy,x2y3z5+y3-y5;
447  list l= ReesAlgebra(I);
448  list J = normalI(I);
449  I;
450  J;
451
452*/
453
Note: See TracBrowser for help on using the repository browser.