This file is indexed.

/usr/share/singular/LIB/reesclos.lib is in singular-data 4.0.3+ds-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
////////////////////////////////////////////////////////////////////////////
version="version reesclos.lib 4.0.0.0 Jun_2013 "; // $Id: 53ae3f0d9c887447ca52755d6ebd614cced1b9bb $
category="Commutative Algebra";

info="
LIBRARY:     reesclos.lib   PROCEDURES TO COMPUTE THE INT. CLOSURE OF AN IDEAL
AUTHOR:      Tobias Hirsch, email: hirsch@math.tu-cottbus.de
             Janko Boehm, email: boehm@mathematik.uni-kl.de
             Magdaleen Marais, email: magdaleen@aims.ac.za

OVERVIEW:
 A library to compute the integral closure of an ideal I in a polynomial ring
 R=k[x(1),...,x(n)] using the Rees Algebra R[It] of I. It computes the integral
 closure of R[It],
 which is a graded subalgebra of R[t]. The degree-k-component is the integral
 closure of the k-th power of I.

 In contrast to the previous version, the library uses 'normal.lib' to compute the
 integral closure of R[It]. This improves the performance considerably.

PROCEDURES:
 ReesAlgebra(I);        computes the Rees Algebra of an ideal I
 normalI(I[,p[,r]]);    computes the integral closure of an ideal I using R[It]
";

LIB "locnormal.lib";       // for HomJJ
LIB "standard.lib";     // for groebner

///////////////////////////////////////////////////////////////////////////////

proc ReesAlgebra (ideal I)
"USAGE:    ReesAlgebra (I); I = ideal
RETURN:   The Rees algebra R[It] as an affine ring, where I is an ideal in R.
          The procedure returns a list containing two rings:
          [1]: a ring, say RR; in the ring an ideal ker such that R[It]=RR/ker

          [2]: a ring, say Kxt; the basering with additional variable t
               containing an ideal mapI that defines the map RR-->Kxt
EXAMPLE:  example ReesAlgebra; shows an example
"
{
  // remember the data of the basering

  def oldring = basering;
  string oldchar = charstr(basering);
  string oldvar  = varstr(basering);
  string oldord  = ordstr(basering);
  int n = ncols(I);
  ideal m = maxideal(1);


  // Create a new ring with variables for each generator of I

  execute ("ring Rees = "+oldchar+",("+oldvar+",U(1.."+string(n)+")),dp");


  // Kxt is the old ring with additional variable t
  // Here I -> t*I, so the generators of I generate the subalgebra R[It] in Kxt

  execute ("ring Kxt = "+oldchar+",("+oldvar+",t),dp");
  ideal I = fetch(oldring,I);
  ideal m = fetch(oldring,m);
  int k;
  for (k=1;k<=n;k++)
  {
    I[k]=t*I[k];
  }


  // Now we map from Rees to Kxt, identity on the original variables, and
  // U(k) -> I[k]

  ideal mapI = m,I;
  map phi = Rees,mapI;
  ideal zero = 0;
  export (mapI);

  // Now the Rees-Algebra is Rees/ker(phi)

  setring Rees;
  ideal ker = preimage(Kxt,phi,zero);
  export (ker);

  list result = Rees,Kxt;

  return(result);

}
example
{
  "EXAMPLE:"; echo=2;
  ring R = 0,(x,y),dp;
  ideal I = x2,xy4,y5;
  list L = ReesAlgebra(I);
  def Rees = L[1];       // defines the ring Rees, containing the ideal ker
  setring Rees;          // passes to the ring Rees
  Rees;
  ker;                   // R[It] is isomorphic to Rees/ker
}


////////////////////////////////////////////////////////////////////////////

static
proc ClosureRees (list L, int useLocNormal)
"USAGE:    ClosureRees (L,useLocNormal); L a list, useLocNormal an integer
ASSUME:   L is a list containing
          - a ring L[1], inside L[1] an ideal ker such that L[1]/ker is
            isomorphic to the Rees Algebra R[It] of an ideal I in k[x]
          - a ring L[2]=k[x,t], inside L[1] an ideal mapI defining the
            map L[1] --> L[2] with image R[It]
RETURN:   quotients of elements of k[x,t] representing generators of the
          integral closure of R[It]. The result of ClosureRees is a list
          images, the first size(images)-1 entries are the numerators of the
          generators, the last one is the universal denominator
"
{
  int dblvl=printlevel-voice+2;   // toggles how much data is printed
                                  // during the procedure

  def Kxt = basering;
  def R(1) = L[1];
  setring R(1);                   // declaration of variables used later
  ideal ker(1)=ker;               // in STEP 2
  if (useLocNormal==1) {
      list preimages1 = locNormal(ker);
      ideal preimagesI=preimages1[1];
      list preimagesL = list(preimagesI[2..size(preimagesI)])+list(preimagesI[1]);
      ideal preimages = ideal(preimagesL[1..size(preimagesL)]);
  } else {
      list nor = normal(ker);
      ideal preimages=nor[2][1];
  }
  setring Kxt;
  map psi=R(1),mapI;              // from ReesAlgebra: the map Rees->Kxt
  ideal images=psi(preimages);
  ideal psii = images[size(images)]*ideal(psi);
  list imagesl = images[1..size(images)];
  list psil =psii[1..size(psii)];
  imagesl=psil+imagesl;
  return(imagesl);
}


////////////////////////////////////////////////////////////////////////////

static
proc ClosurePower(list images, list #)
"USAGE:    ClosurePower (L [,#]); L a list, # an optional list containing an
          integer
ASSUME:   - L is a list containing generators of the closure of R[It] in k[x,t]
            (the first size(L)-1 elements are the numerators, the last one
            is the denominator)
          - if # is given: #[1] is an integer, compute generators for the
                           closure of I, I^2, ..., I^#[1]
RETURN:   the integral closure of I, ... I^#[1]. If # is not given, compute
          the closure of all powers up to the maximum degree in t occurring
          in the closure of R[It] (so this is the last power whose closure is
          not just the sum/product of the smaller powers). The returned
          result is a list of elements of k[x,t] containing generators of the
          closure of the desired powers of I. "
{
  int dblvl=printlevel-voice+2;   // toggles how much data is printed
                                  // during the procedure

  int j,k,d,computepow;                    // some counters
  int pow=0;
  int length = size(images)-1;             // the number of generators
  poly image;
  poly @denominator = images[length+1];     // the universal denominator

  if (size(#)>0)
  {
    pow=#[1];
  }
  computepow=pow;

  if (dblvl>0)
  {
    "";
    "// The generators of the closure of R[It]:";
  }

  intmat m[nvars(basering)-1][1];  // an intvec used for jet and maxdeg1
  intvec tw=m,1;                   // such that t has weight 1 and all
                                   // other variables have weight 0

  // Construct the generators of the closure of R[It] as elements of k[x,t]
  // If # is not given, determine the highest degree pow in t that occurs.

  for (j=1;j<=length;j++)
  {
    images[j] = (images[j]/@denominator); // construct the fraction
    image = images[j];
    if (dblvl>0)
    {
      "generator",j,":",image;
    }

    if (computepow==0)              // #[1] not given or ==0 => compute pow
    {
      if (maxdeg1(image,tw)>pow)    // from poly.lib
      {
        pow=maxdeg1(image,tw);
      }
    }
  }

  if (dblvl>0)
  {
    "";
    if (computepow==0)
    {
      "// Compute the closure up to the given powers of I";
    }
    else
    {
     "// Compute the closure up to the maximal power of t that occurred:",pow;
    }
  }

  // Construct a list consisting of #[1] resp. pow times the zero ideal

  ideal CurrentPower=0;
  list result;
  for (k=1;k<=pow;k++)
  {
    result=insert(result,CurrentPower);
  }

  // For each generator and each k, add its degree-k-coefficient to the #
  // closure of I^k

  for (j=1;j<=length;j++)
  {
    for (k=1;k<=pow;k++)
    {
      image=images[j]-jet(images[j],k-1,tw);
      if (image<>0)
      {
        image=subst(image/t^k,t,0);
        if (image<>0)
        {
          result[k]=result[k]+image;
        }
      }
    }
  }

  if (dblvl>0)
  {
    "";
    "// The 'pure' parts of degrees 1..pow:";
    result;
    "";
  }

  // finally, add the suitable products of generators in lower degrees

  for (k=2;k<=pow;k++)
  {
    for (j=1;j<=(k div 2);j++)
    {
      result[k]=result[k]+result[j]*result[k-j];
    }
  }

  return(result);
}

////////////////////////////////////////////////////////////////////////////

proc normalI(ideal I, list #)
"USAGE:    normalI (I [,p [,r [,l]]]); I an ideal, p, r, and l optional integers
RETURN:   the integral closure of I, ..., I^p, where I is an ideal in the
          polynomial ring R=k[x(1),...x(n)]. If p is not given, or p==0,
          compute the closure of all powers up to the maximum degree in t
          occurring in the closure of R[It] (so this is the last power whose
          closure is not just the sum/product of the smaller). If r
          is given and r==1, normalI starts with a check whether I is already a
          radical ideal.
          If l==1 then locNormal instead of normal is used to compute normalization.
          The result is a list containing the closure of the desired powers of
          I as ideals of the basering.
DISPLAY:  The procedure displays more comments for higher printlevel.
EXAMPLE:  example normalI; shows an example
"
{
  int dblvl=printlevel-voice+2;   // toggles how much data is printed
                                  // during the procedure

  def BAS=basering;               // remember the basering

  // two simple cases: principal ideals and radical ideals are always
  // integrally closed

  if (size(I)<=1)        // includes the case I=(0)
  {
    if (dblvl>0)
    {
      "// Trivial case: I is a principal ideal";
    }
    list result=I;
    if (size(#)>0)
    {
      for (int k=1;k<=#[1]-1;k++)
      {
        result=insert(result,I*result[k],k);
      }
    }
    return(result);
  }

  int testrad=0;      // do the radical check?
  int uselocNormal=0;
  if (size(#)>1)
  {
    testrad=#[2];
    if (size(#)==3) {
                 uselocNormal=#[3];
    }
  }

  if (testrad==1)
  {
    if (dblvl>0)
    {
      "//Check whether I is radical";
    }

    if (size(reduce(radical(I),std(I)))==0)
    {
      if (dblvl>0)
      {
        "//Trivial case: I is a radical ideal";
      }
      list result=I;
      if (size(#)>0)
      {
        for (int k=1;k<=#[1]-1;k++)
        {
          result=insert(result,I*result[k],k);
        }
      }
      return(result);
    }
  }

  // start with the computation of the Rees Algebra R[It] of I

  if (dblvl>0)
  {
    "// We start with the Rees Algebra of I:";
  }

  list Rees = ReesAlgebra(I);
  def R(1)=Rees[1];
  def Kxt=Rees[2];
  setring R(1);

  if (dblvl>0)
  {
    R(1);
    ker;
    "";
    "// Now ClosureRees computes generators for the integral closure";
    "// of R[It] step by step";
  }

  // ClosureRees computes fractions in R[x,t] representing the generators
  // of the closure of R[It] in k[x,t], which is the same as the closure
  // in Q(R[It]).
  // the first size(images)-1 entries are the numerators of the gene-
  // rators, the last entry is the 'universal' denominator

  setring Kxt;
  list images = ClosureRees(Rees,uselocNormal);

  // ClosureRees was done after the first HomJJ-call
  // ==> I is integrally closed, and images consists of the only entry "closed"

  if ((size(images)==1) && (typeof(images[1])=="string"))
  {
    if (dblvl>0)
    {
      "//I is integrally closed!";
    }

    setring BAS;
    list result=I;
    if (size(#)>0)
    {
      for (int k=1;k<=#[1]-1;k++)
      {
        result=insert(result,I*result[k],k);
      }
    }
    return(result);
  }

  // construct the fractions corresponding to the generators of the
  // closure of I and its powers, depending on # (in fact, they will
  // not be real fractions, of course). This is done in ClosurePower.
  list result = ClosurePower(images,#);

  // finally fetch the result to the old basering

  setring BAS;
  list result=fetch(Kxt,result);
  return(result);
}
example
{
  "EXAMPLE:"; echo=2;
  ring R=0,(x,y),dp;
  ideal I = x2,xy4,y5;
  list J = normalI(I);
  I;
  J;                             // J[1] is the integral closure of I
}

/*
LIB"reesclos.lib";


// 1.  x^i,y^i in k[x,y]
//     geht bis i = 19 (800sec), bis i=10 wenige Sekunden,
//     bei i = 20 ueber 1GB Hauptspeicher, in der 9. Iteration no memory
//     (braucht 20 Iterationen)

  ring r = 0,(x,y),dp;
  int i = 6;
  ideal I = x^i,y^i;
  list J = normalI(I);
  I;
  J;


//================================================================


// 2. x^i,y^i,z^i in k[x,y,z]
//    aehnlich wie 1., funktioniert aber nur bis i=5 und dauert dort
//    >1 h


//================================================================


// 3. scheitert in der ersten Iteration beim Radikal
//    Standardbasis des singulaeren Ortes: 7h (in char0),
//    in char(p) viel schneller, obwohl kleine Koeffizienten
//    schon bei Radikal -Test braucht er zu lang (>1h)

  ring r = 0,(x,y,z),dp;
  //ring r = 32003,(x,y,z),dp;

  ideal I = x2+xy3-5z,z3+y2-xzy,x2y3z5+y3-y5;
  list l= ReesAlgebra(I);
  list J = normalI(I);
  I;
  J;

*/