source: git/Singular/LIB/sing.lib @ 3939bc

spielwiese
Last change on this file since 3939bc was 3939bc, checked in by Hans Schönemann <hannes@…>, 26 years ago
* hannes: changed res->nres, resu->res git-svn-id: file:///usr/local/Singular/svn/trunk@2009 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 28.6 KB
Line 
1// $Id: sing.lib,v 1.12 1998-05-29 15:02:01 Singular Exp $
2//system("random",787422842);
3//(GMG/BM, last modified 26.06.96)
4///////////////////////////////////////////////////////////////////////////////
5
6version="$Id: sing.lib,v 1.12 1998-05-29 15:02:01 Singular Exp $";
7info="
8LIBRARY:  sing.lib      PROCEDURES FOR SINGULARITIES
9
10 codim (id1, id2);      vector space dimension of of id2/id1 if finite
11 deform(i);             infinitesimal deformations of ideal i
12 dim_slocus(i);         dimension of singular locus of ideal i
13 is_active(f,id);       is poly f an active element mod id? (id ideal/module)
14 is_ci(i);              is ideal i a complete intersection?
15 is_is(i);              is ideal i an isolated singularity?
16 is_reg(f,id);          is poly f a regular element mod id? (id ideal/module)
17 is_regs(i[,id]);       are gen's of ideal i regular sequence modulo id?
18 milnor(i);             milnor number of ideal i; (assume i is ICIS in nf)
19 nf_icis(i);            generic combinations of generators; get ICIS in nf
20 slocus(i);             ideal of singular locus of ideal i
21 spectrum(f,w);         spectrum numbers of w-homogeneous polynomial f
22 Tjurina(i);            SB of Tjurina module of ideal i (assume i is ICIS)
23 tjurina(i);            Tjurina number of ideal i (assume i is ICIS)
24 T1(i);                 T1-module of ideal i
25 T2((i);                T2-module of ideal i
26 T12(i);                T1- and T2-module of ideal i
27";
28
29LIB "inout.lib";
30LIB "random.lib";
31///////////////////////////////////////////////////////////////////////////////
32
33proc deform (ideal id)
34"USAGE:   deform(id); id=ideal or poly
35RETURN:  matrix, columns are kbase of infinitesimal deformations
36EXAMPLE: example deform; shows an example
37"
38{
39   list L=T1(id,"");
40   def K=L[1]; attrib(K,"isSB",1);
41   return(L[2]*kbase(K));
42}
43example
44{ "EXAMPLE:"; echo = 2;
45   ring r   = 32003,(x,y,z),ds;
46   ideal i  = xy,xz,yz;
47   matrix T = deform(i);
48   print(T);
49   print(deform(x3+y5+z2));
50}
51///////////////////////////////////////////////////////////////////////////////
52
53proc dim_slocus (ideal i)
54"USAGE:   dim_slocus(i);  i ideal or poly
55RETURN:  dimension of singular locus of i
56EXAMPLE: example dim_slocus; shows an example
57"
58{
59   return(dim(std(slocus(i))));
60}
61example
62{ "EXAMPLE:"; echo = 2;
63   ring r  = 32003,(x,y,z),ds;
64   ideal i = x5+y6+z6,x2+2y2+3z2;
65   dim_slocus(i);
66}
67///////////////////////////////////////////////////////////////////////////////
68
69proc is_active (poly f, id)
70"USAGE:   is_active(f,id); f poly, id ideal or module
71RETURN:  1 if f is an active element modulo id (i.e. dim(id)=dim(id+f*R^n)+1,
72         if id is a submodule of R^n) resp. 0 if f is not active.
73         The basering may be a quotient ring
74NOTE:    regular parameters are active but not vice versa (id may have embedded
75         components). proc is_reg tests whether f is a regular parameter
76EXAMPLE: example is_active; shows an example
77"
78{
79   if( size(id)==0 ) { return(1); }
80   if( typeof(id)=="ideal" ) { ideal m=f; }
81   if( typeof(id)=="module" ) { module m=f*freemodule(nrows(id)); }
82   return(dim(std(id))-dim(std(id+m)));
83}
84example
85{ "EXAMPLE:"; echo = 2;
86   ring r   =32003,(x,y,z),ds;
87   ideal i  = yx3+y,yz3+y3z;
88   poly f   = x;
89   is_active(f,i);
90   qring q  = std(x4y5);
91   poly f   = x;
92   module m = [yx3+x,yx3+y3x];
93   is_active(f,m);
94}
95///////////////////////////////////////////////////////////////////////////////
96
97proc is_ci (ideal i)
98"USAGE:   is_ci(i); i ideal
99RETURN:  intvec = sequence of dimensions of ideals (j[1],...,j[k]), for
100         k=1,...,size(j), where j is minimal base of i. i is a complete
101         intersection if last number equals nvars-size(i)
102NOTE:    dim(0-ideal) = -1. You may first apply simplify(i,10); in order to
103         delete zeroes and multiples from set of generators
104         printlevel >=0: display comments (default)
105EXAMPLE: example is_ci; shows an example
106"
107{
108   int n; intvec dimvec; ideal id;
109   i=minbase(i);
110   int s = ncols(i);
111   int p = printlevel-voice+3;  // p=printlevel+1 (default: p=1)
112//--------------------------- compute dimensions ------------------------------
113   for( n=1; n<=s; n=n+1 )
114   {
115      id = i[1..n];
116      dimvec[n] = dim(std(id));
117   }
118   n = dimvec[s];
119//--------------------------- output ------------------------------------------
120   if( n+s != nvars(basering) )
121   { dbprint(p,"// no complete intersection"); }
122   if( n+s == nvars(basering) )
123   { dbprint(p,"// complete intersection of dim "+string(n)); }
124   dbprint(p,"// dim-sequence:");
125   return(dimvec);
126}
127example
128{ "EXAMPLE:"; echo = 2;
129   int p      = printlevel;
130   printlevel = 1;                // display comments
131   ring r     = 32003,(x,y,z),ds;
132   ideal i    = x4+y5+z6,xyz,yx2+xz2+zy7;
133   is_ci(i);
134   i          = xy,yz;
135   is_ci(i);
136   printlevel = p;
137}
138///////////////////////////////////////////////////////////////////////////////
139
140proc is_is (ideal i)
141"USAGE:   is_is(id);  id ideal or poly
142RETURN:  intvec = sequence of dimensions of singular loci of ideals
143         generated by id[1]..id[i], k = 1..size(id); dim(0-ideal) = -1;
144         id defines an isolated singularity if last number is 0
145NOTE:    printlevel >=0: display comments (default)
146EXAMPLE: example is_is; shows an example
147"
148{
149  int l; intvec dims; ideal j;
150  int p = printlevel-voice+3;  // p=printlevel+1 (default: p=1)
151//--------------------------- compute dimensions ------------------------------
152   for( l=1; l<=ncols(i); l=l+1 )
153   {
154     j = i[1..l];
155     dims[l] = dim(std(slocus(j)));
156   }
157   dbprint(p,"// dim of singular locus = "+string(dims[size(dims)]),
158             "// isolated singularity if last number is 0 in dim-sequence:");
159   return(dims);
160}
161example
162{ "EXAMPLE:"; echo = 2;
163   int p      = printlevel;
164   printlevel = 1;
165   ring r     = 32003,(x,y,z),ds;
166   ideal i    = x2y,x4+y5+z6,yx2+xz2+zy7;
167   is_is(i);
168   poly f     = xy+yz;
169   is_is(f);
170   printlevel = p;
171}
172///////////////////////////////////////////////////////////////////////////////
173
174proc is_reg (poly f, id)
175"USAGE:   is_reg(f,id); f poly, id ideal or module
176RETURN:  1 if multiplication with f is injective modulo id, 0 otherwise
177NOTE:    let R be the basering and id a submodule of R^n. The procedure checks
178         injectivity of multiplication with f on R^n/id. The basering may be a
179         //**quotient ring
180EXAMPLE: example is_reg; shows an example
181"
182{
183   if( f==0 ) { return(0); }
184   int d,ii;
185   def q = quotient(id,ideal(f));
186   id=std(id);
187   d=size(q);
188   for( ii=1; ii<=d; ii=ii+1 )
189   {
190      if( reduce(q[ii],id)!=0 )
191      { return(0); }
192   }
193   return(1);
194}
195example
196{ "EXAMPLE:"; echo = 2;
197   ring r  = 32003,(x,y),ds;
198   ideal i = x8,y8;
199   ideal j = (x+y)^4;
200   i       = intersect(i,j);
201   poly f  = xy;
202   is_reg(f,i);
203}
204///////////////////////////////////////////////////////////////////////////////
205
206proc is_regs (ideal i, list #)
207"USAGE:   is_regs(i[,id]); i poly, id ideal or module (default: id=0)
208RETURN:  1 if generators of i are a regular sequence modulo id, 0 otherwise
209NOTE:    let R be the basering and id a submodule of R^n. The procedure checks
210         injectivity of multiplication with i[k] on R^n/id+i[1..k-1].
211         The basering may be a quotient ring
212         printlevel >=0: display comments (default)
213         printlevel >=1: display comments during computation
214EXAMPLE: example is_regs; shows an example
215"
216{
217   int d,ii,r;
218   int p = printlevel-voice+3;  // p=printlevel+1 (default: p=1)
219   if( size(#)==0 ) { ideal id; }
220   else { def id=#[1]; }
221   if( size(i)==0 ) { return(0); }
222   d=size(i);
223   if( typeof(id)=="ideal" ) { ideal m=1; }
224   if( typeof(id)=="module" ) { module m=freemodule(nrows(id)); }
225   for( ii=1; ii<=d; ii=ii+1 )
226   {
227      if( p>=2 )
228      { "// checking whether element",ii,"is regular mod 1 ..",ii-1; }
229      if( is_reg(i[ii],id)==0 )
230      {
231        dbprint(p,"// elements 1.."+string(ii-1)+" are regular, " +
232                string(ii)+" is not regular mod 1.."+string(ii-1));
233         return(0);
234      }
235      id=id+i[ii]*m;
236   }
237   if( p>=1 ) { "// elements are a regular sequence of length",d; }
238   return(1);
239}
240example
241{ "EXAMPLE:"; echo = 2;
242   int p      = printlevel;
243   printlevel = 1;
244   ring r1    = 32003,(x,y,z),ds;
245   ideal i    = x8,y8,(x+y)^4;
246   is_regs(i);
247   module m   = [x,0,y];
248   i          = x8,(x+z)^4;;
249   is_regs(i,m);
250   printlevel = p;
251}
252///////////////////////////////////////////////////////////////////////////////
253
254proc milnor (ideal i)
255"USAGE:   milnor(i); i ideal or poly
256RETURN:  Milnor number of i, if i is ICIS (isolated complete intersection
257         singularity) in generic form, resp. -1 if not
258NOTE:    use proc nf_icis to put generators in generic form
259         printlevel >=0: display comments (default)
260EXAMPLE: example milnor; shows an example
261"
262{
263  i = simplify(i,10);     //delete zeroes and multiples from set of generators
264  int n = size(i);
265  int l,q,m_nr;  ideal t;  intvec disc;
266  int p = printlevel-voice+3;  // p=printlevel+1 (default: p=1)
267//---------------------------- hypersurface case ------------------------------
268  if( n==1 or i==0 )
269  {
270     i = std(jacob(i[1]));
271     m_nr = vdim(i);
272     if( m_nr<0 and p>=1 ) { "// no isolated singularity"; }
273     return(m_nr);
274  }
275//------------ isolated complete intersection singularity (ICIS) --------------
276  for( l=n; l>0; l=l-1)
277  {   t      = minor(jacob(i),l);
278      i[l]   = 0;
279      q      = vdim(std(i+t));
280      disc[l]= q;
281      if( q ==-1 )
282      {  if( p>=1 )
283            {  "// not in generic form or no ICIS; use proc nf_icis to put";
284            "// generators in generic form and then try milnor again!";  }
285         return(q);
286      }
287      m_nr = q-m_nr;
288  }
289//---------------------------- change sign ------------------------------------
290  if (m_nr < 0) { m_nr=-m_nr; }
291  if( p>=1 ) { "//sequence of discriminant numbers:",disc; }
292  return(m_nr);
293}
294example
295{ "EXAMPLE:"; echo = 2;
296   int p      = printlevel;
297   printlevel = 1;
298   ring r     = 32003,(x,y,z),ds;
299   ideal j    = x5+y6+z6,x2+2y2+3z2,xyz+yx;
300   milnor(j);
301   poly f     = x7+y7+(x-y)^2*x2y2+z2;
302   milnor(f);
303   printlevel = p;
304}
305///////////////////////////////////////////////////////////////////////////////
306
307proc nf_icis (ideal i)
308"USAGE:   nf_icis(i); i ideal
309RETURN:  ideal = generic linear combination of generators of i if i is an ICIS
310         (isolated complete intersection singularity), return i if not
311NOTE:    this proc is useful in connection with proc milnor
312         printlevel >=0: display comments (default)
313EXAMPLE: example nf_icis; shows an example
314"
315{
316   i = simplify(i,10);  //delete zeroes and multiples from set of generators
317   int p,b = 100,0;
318   int n = size(i);
319   matrix mat=freemodule(n);
320   int P = printlevel-voice+3;  // P=printlevel+1 (default: P=1)
321//---------------------------- test: complete intersection? -------------------
322   intvec sl = is_ci(i);
323   if( n+sl[n] != nvars(basering) )
324   {
325      dbprint(P,"// no complete intersection");
326      return(i);
327   }
328//--------------- test: isolated singularity in generic form? -----------------
329   sl = is_is(i);
330   if ( sl[n] != 0 )
331   {
332      dbprint(P,"// no isolated singularity");
333      return(i);
334   }
335//------------ produce generic linear combinations of generators --------------
336   int prob;
337   while ( sum(sl) != 0 )
338   {  prob=prob+1;
339      p=p-25; b=b+10;
340      i = genericid(i,p,b);          // proc genericid from random.lib
341      sl = is_is(i);
342   }
343   dbprint(P,"// ICIS in generic form after "+string(prob)+" genericity loop(s)");
344   return(i);
345}
346example
347{ "EXAMPLE:"; echo = 2;
348   int p      = printlevel;
349   printlevel = 1;
350   ring r     = 32003,(x,y,z),ds;
351   ideal i    = x3+y4,z4+yx;
352   nf_icis(i);
353   ideal j    = x3+y4,xy,yz;
354   nf_icis(j);
355   printlevel = p;
356}
357///////////////////////////////////////////////////////////////////////////////
358
359proc slocus (ideal i)
360"USAGE:   slocus(i);  i dieal
361RETURN:  ideal of singular locus of i
362NOTE:    this proc considers lower dimensional components as singular
363EXAMPLE: example slocus; shows an example
364"
365{
366  int cod  = nvars(basering)-dim(std(i));
367  i        = i+minor(jacob(i),cod);
368  return(i);
369}
370example
371{ "EXAMPLE:"; echo = 2;
372   ring r  = 32003,(x,y,z),ds;
373   ideal i = x5+y6+z6,x2+2y2+3z2;
374   dim(std(slocus(i)));
375}
376///////////////////////////////////////////////////////////////////////////////
377
378proc spectrum (poly f, intvec w)
379"USAGE:   spectrum(f,w);  f=poly, w=intvec;
380ASSUME:  f is a weighted homogeneous isolated singularity w.r.t. the weights
381         given by w; w must consist of as many positive integers as there
382         are variables of the basering
383COMPUTE: the spectral numbers of the w-homogeneous polynomial f, computed in a
384         ring of charcteristik 0
385RETURN:  intvec  d,s1,...,su  where:
386         d = w-degree(f)  and  si/d = ith spectral-number(f)
387         No return value if basering has parameters or if f is no isolated
388         singularity, displays a warning in this case
389EXAMPLE: example spectrum; shows an example
390"
391{
392   int i,d,W;
393   intvec sp;
394   def r   = basering;
395   if( find(charstr(r),",")!=0 )
396   {
397       "// coefficient field must not have parameters!";
398       return();
399    }
400   ring s  = 0,x(1..nvars(r)),ws(w);
401   map phi = r,maxideal(1);
402   poly f  = phi(f);
403   d       = ord(f);
404   W       = sum(w)-d;
405   ideal k = std(jacob(f));
406   if( vdim(k) == -1 )
407   {
408       "// f is no isolated singuarity!";
409       return();
410    }
411   k = kbase(k);
412   for (i=1; i<=size(k); i++)
413   {
414      sp[i]=W+ord(k[i]);
415   }
416   list L  = sort(sp);
417   sp      = d,L[1];
418   return(sp);
419}
420example
421{ "EXAMPLE:"; echo = 2;
422   ring r;
423   poly f=x3+y5+z2;
424   intvec w=10,6,15;
425   spectrum(f,w);
426   // the spectrum numbers are:
427   // 1/30,7/30,11/30,13/30,17/30,19/30,23/30,29/30
428}
429///////////////////////////////////////////////////////////////////////////////
430
431proc Tjurina (id, list #)
432"USAGE:   Tjurina(id[,<any>]);  id=ideal or poly
433ASSUME:  id=ICIS (isolated complete intersection singularity)
434RETURN:  standard basis of Tjurina-module of id,
435         of type module if id=ideal, resp. of type ideal if id=poly.
436         If a second argument is present (of any type) return a list:
437           [1] = Tjurina number,
438           [2] = k-basis of miniversal deformation,
439           [3] = SB of Tjurina module,
440           [4] = Tjurina module
441DISPLAY: Tjurina number if printlevel >= 0 (default)
442NOTE:    Tjurina number = -1 implies that id is not an ICIS
443EXAMPLE: example Tjurina; shows examples
444"
445{
446//---------------------------- initialisation ---------------------------------
447  def i = simplify(id,10);
448  int tau,n = 0,size(i);
449  if( size(ideal(i))==1 ) { def m=i; }  // hypersurface case
450  else { def m=i*freemodule(n); }       // complete intersection case
451//--------------- compute Tjurina module, Tjurina number etc ------------------
452  def t1 = jacob(i)+m;                  // Tjurina module/ideal
453  def st1 = std(t1);                    // SB of Tjurina module/ideal
454  tau = vdim(st1);                      // Tjurina number
455  dbprint(printlevel-voice+3,"// Tjurina number = "+string(tau));
456  if( size(#)>0 )
457  {
458     def kB = kbase(st1);               // basis of miniversal deformation
459     return(tau,kB,st1,t1);
460  }
461  return(st1);
462}
463example
464{ "EXAMPLE:"; echo = 2;
465   int p      = printlevel;
466   printlevel = 1;
467   ring r     = 0,(x,y,z),ds;
468   poly f     = x5+y6+z7+xyz;        // singularity T[5,6,7]
469   list T     = Tjurina(f,"");
470   show(T[1]);                       // Tjurina number, should be 16
471   show(T[2]);                       // basis of miniversal deformation
472   show(T[3]);                       // SB of Tjurina ideal
473   show(T[4]); "";                   // Tjurina ideal
474   ideal j    = x2+y2+z2,x2+2y2+3z2;
475   show(kbase(Tjurina(j)));          // basis of miniversal deformation
476   hilb(Tjurina(j));                 // Hilbert series of Tjurina module
477   printlevel = p;
478}
479///////////////////////////////////////////////////////////////////////////////
480
481proc tjurina (ideal i)
482"USAGE:   tjurina(id);  id=ideal or poly
483ASSUME:  id=ICIS (isolated complete intersection singularity)
484RETURN:  int = Tjurina number of id
485NOTE:    Tjurina number = -1 implies that id is not an ICIS
486EXAMPLE: example tjurina; shows an example
487"
488{
489   return(vdim(Tjurina(i)));
490}
491example
492{ "EXAMPLE:"; echo = 2;
493   ring r=32003,(x,y,z),(c,ds);
494   ideal j=x2+y2+z2,x2+2y2+3z2;
495   tjurina(j);
496}
497///////////////////////////////////////////////////////////////////////////////
498
499proc T1 (ideal id, list #)
500"USAGE:   T1(id[,<any>]);  id = ideal or poly
501RETURN:  T1(id): of type module/ideal if id is of type ideal/poly.
502         We call T1(id) the T1-module of id. It is a std basis of the
503         presentation of 1st order deformations of P/id, if P is the basering.
504         If a second argument is present (of any type) return a list of
505         3 modules:
506            [1]= T1(id)
507            [2]= generators of normal bundle of id, lifted to P
508            [3]= module of relations of [2], lifted to P
509                 (note: transpose[3]*[2]=0 mod id)
510         The list contains all non-easy objects which must be computed
511         to get T1(id).
512DISPLAY: k-dimension of T1(id) if printlevel >= 0 (default)
513NOTE:    T1(id) itself is usually of minor importance. Nevertheless, from it
514         all relevant information can be obtained. The most important are
515         probably vdim(T1(id)); (which computes the Tjurina number),
516         hilb(T1(id)); and kbase(T1(id));
517         If T1 is called with two argument, then matrix([2])*(kbase([1]))
518         represents a basis of 1st order semiuniversal deformation of id
519         (use proc 'deform', to get this in a direct way).
520         For a complete intersection the proc Tjurina is faster
521EXAMPLE: example T1; shows an example
522"
523{
524   ideal J=simplify(id,10);
525//--------------------------- hypersurface case -------------------------------
526  if( size(J)<2 )
527  {
528     ideal t1  = std(J+jacob(J[1]));
529     module nb = [1]; module pnb;
530     dbprint(printlevel-voice+3,"// dim T1 = "+string(vdim(t1)));
531     if( size(#)>0 )
532     {
533        module st1 = t1*gen(1);
534        attrib(st1,"isSB",1);
535        return(st1,nb,pnb);
536     }
537     return(t1);
538  }
539//--------------------------- presentation of J -------------------------------
540   int rk;
541   def P = basering;
542   module jac, t1;
543   jac  = jacob(J);                 // jacobian matrix of J converted to module
544   list A=nres(J,2);                // compute presentation of J
545   def A(1..2)=A[1..2]; kill A;     // A(2) = 1st syzygy module of J
546//---------- go to quotient ring mod J and compute normal bundle --------------
547   qring  R    = std(J);
548   module jac = fetch(P,jac);
549   module t1  = transpose(fetch(P,A(2)));
550   list B=nres(t1,2,B);             // resolve t1, B(2)=(J/J^2)*=normal_bdl
551   def B(1..2)=B[1..2]; kill B;
552   t1         = modulo(B(2),jac);   // pres. of normal_bdl/trivial_deformations
553   rk=nrows(t1);
554//-------------------------- pull back to basering ----------------------------
555   setring P;
556   t1 = fetch(R,t1)+J*freemodule(rk);  // T1-module, presentation of T1
557   t1 = std(t1);
558   dbprint(printlevel-voice+3,"// dim T1 = "+string(vdim(t1)));
559   if( size(#)>0 )
560   {
561      module B2 = fetch(R,B(2));        // presentation of normal bundle
562      list L = t1,B2,A(2);
563      attrib(L[1],"isSB",1);
564      return(L);
565   }
566   return(t1);
567}
568example
569{ "EXAMPLE:"; echo = 2;
570   int p      = printlevel;
571   printlevel = 1;
572   ring r     = 32003,(x,y,z),(c,ds);
573   ideal i    = xy,xz,yz;
574   module T   = T1(i);
575   vdim(T);                      // Tjurina number = dim_K(T1), should be 3
576   list L=T1(i,"");
577   module kB  = kbase(L[1]);
578   print(L[2]*kB);               // basis of 1st order miniversal deformation
579   show(L[2]);                   // presentation of normal bundle
580   print(L[3]);                  // relations of i
581   print(transpose(L[3])*L[2]);  // should be 0 (mod i)
582   printlevel = p;
583}
584///////////////////////////////////////////////////////////////////////////////
585
586proc T2 (ideal id, list #)
587"USAGE:   T2(id[,<any>]);  id = ideal
588RETURN:  T2(id): T2-module of id . This is a std basis of a presentation of
589         the module of obstructions of R=P/id, if P is the basering.
590         If a second argument is present (of any type) return a list of
591         4 modules and 1 ideal:
592            [1]= T2(id)
593            [2]= standard basis of id (ideal)
594            [3]= module of relations of id (=1st syzygy module of id)
595            [4]= presentation of syz/kos
596            [5]= relations of Hom_P([3]/kos,R), lifted to P
597         The list contains all non-easy objects which must be computed
598         to get T2(id).
599DISPLAY: k-dimension of T2(id) if printlevel >= 0 (default)
600NOTE:    The most important information is probably vdim(T2(id)).
601         Use proc miniversal to get equations of miniversal deformation.
602EXAMPLE: example T2; shows an example
603"
604{
605//--------------------------- initialisation ----------------------------------
606  def P = basering;
607   ideal J = id;
608   module kos,SK,B2,t2;
609   list L;
610   int n,rk;
611//------------------- presentation of non-trivial syzygies --------------------
612   list A=nres(J,2);                      // resolve J, A(2)=syz
613   def A(1..2)=A[1..2]; kill A;
614   kos  = koszul(2,J);                    // module of Koszul relations
615   SK   = modulo(A(2),kos);               // presentation of syz/kos
616   ideal J0 = std(J);                     // standard basis of J
617//?*** sollte bei der Berechnung von res mit anfallen, zu aendern!!
618//---------------------- fetch to quotient ring mod J -------------------------
619   qring R = J0;                          // make P/J the basering
620   module A2' = transpose(fetch(P,A(2))); // dual of syz
621   module t2  = transpose(fetch(P,SK));   // dual of syz/kos
622   list B=nres(t2,2);                     // resolve (syz/kos)*
623   def B(1..2)=B[1..2]; kill B;
624   t2 = modulo(B(2),A2');                 // presentation of T2
625   rk = nrows(t2);
626//---------------------  fetch back to basering -------------------------------
627   setring P;
628   t2 = fetch(R,t2)+J*freemodule(rk);
629   t2 = std(t2);
630   dbprint(printlevel-voice+3,"// dim T2 = "+string(vdim(t2)));
631   if( size(#)>0 )
632   {
633      B2 = fetch(R,B(2));        // generators of Hom_P(syz/kos,R)
634      L  = t2,J0,A(2),SK,B2;
635      return(L);
636   }
637   return(t2);
638}
639example
640{ "EXAMPLE:"; echo = 2;
641   int p      = printlevel;
642   printlevel = 1;
643   ring  r    = 32003,(x,y),(c,dp);
644   ideal j    = x6-y4,x6y6,x2y4-x5y2;
645   module T   = T2(j);
646   vdim(T);
647   hilb(T);"";
648   ring r1    = 0,(x,y,z),dp;
649   ideal id   = xy,xz,yz;
650   list L     = T2(id,"");
651   vdim(L[1]);                           // vdim of T2
652   print(L[3]);                          // syzygy module of id
653   printlevel = p;
654}
655///////////////////////////////////////////////////////////////////////////////
656
657proc T12 (ideal i, list #)
658"USAGE:   T12(i[,any]);  i = ideal
659RETURN:  T12(i): list of 2 modules:
660             std basis of T1-module =T1(i), 1st order deformations
661             std basid of T2-module =T2(i), obstructions of R=P/i
662         If a second argument is present (of any type) return a list of
663         9 modules, matrices, integers:
664             [1]= standard basis of T1-module
665             [2]= standard basis of T2-module
666             [3]= vdim of T1
667             [4]= vdim of T2
668             [5]= matrix, whose cols present infinitesimal deformations
669             [6]= matrix, whose cols are generators of relations of i (=syz(i))
670             [7]= matrix, presenting Hom_P(syz/kos,R), lifted to P
671             [8]= presentation of T1-module, no std basis
672             [9]= presentation of T2-module, no std basis
673DISPLAY: k-dimension of T1 and T2 if printlevel >= 0 (default)
674NOTE:    Use proc miniversal from deform.lib to get miniversal deformation of i,
675         the list contains all objects used by proc miniversal
676EXAMPLE: example T12; shows an example
677"
678{
679//--------------------------- initialisation ----------------------------------
680   int  n,r1,r2,d1,d2;
681   def P = basering;
682   i = simplify(i,10);
683   module jac,t1,t2,sbt1,sbt2;
684   matrix Kos,Syz,SK,kbT1,Sx;
685   list L;
686   ideal  i0 = std(i);
687//-------------------- presentation of non-trivial syzygies -------------------
688   list I= nres(i,2);                           // resolve i
689   Syz  = matrix(I[2]);                         // syz(i)
690   jac = jacob(i);                              // jacobi ideal
691   Kos = koszul(2,i);                           // koszul-relations
692   SK  = modulo(Syz,Kos);                       // presentation of syz/kos
693//--------------------- fetch to quotient ring  mod i -------------------------
694   qring   Ox  = i0;                             // make P/i the basering
695   module Jac = fetch(P,jac);
696   matrix No  = transpose(fetch(P,Syz));        // ker(No) = Hom(syz,Ox)
697   module So  = transpose(fetch(P,SK));         // Hom(syz/kos,R)
698   list resS  = nres(So,2);
699   matrix Sx  = resS[2];
700   list resN  = nres(No,2);
701   matrix Nx  = resN[2];
702   module T2  = modulo(Sx,No);                  // presentation of T2
703   r2         = nrows(T2);
704   module T1  = modulo(Nx,Jac);                 // presentation of T1
705   r1         = nrows(T1);
706//------------------------ pull back to basering ------------------------------
707   setring P;
708   t1   = fetch(Ox,T1)+i*freemodule(r1);
709   t2   = fetch(Ox,T2)+i*freemodule(r2);
710   sbt1 = std(t1);
711   d1   = vdim(sbt1);
712   sbt2 = std(t2);
713   d2   = vdim(sbt2);
714   dbprint(printlevel-voice+3,"// dim T1 = "+string(d1),"// dim T2 = "+string(d2));
715   if  ( size(#)>0)
716   {
717     if (d1>0)
718     {
719       kbT1 = fetch(Ox,Nx)*kbase(sbt1);
720     }
721     else
722     {
723       kbT1 = 0;
724     }
725     Sx   = fetch(Ox,Sx);
726     L = sbt1,sbt2,d1,d2,kbT1,Syz,Sx,t1,t2;
727     return(L);
728   }
729   L = sbt1,sbt2;
730   return(L);
731}
732example
733{ "EXAMPLE:"; echo = 2;
734   int p      = printlevel;
735   printlevel = 1;
736   ring r     = 200,(x,y,z,u,v),(c,ws(4,3,2,3,4));
737   ideal i    = xz-y2,yz2-xu,xv-yzu,yu-z3,z2u-yv,zv-u2;
738                            //a cyclic quotient singularity
739   list L     = T12(i,1);
740   print(L[5]);             //matrix of infin. deformations
741   printlevel = p;
742}
743///////////////////////////////////////////////////////////////////////////////
744proc codim (id1, id2)
745"USAGE:   codim(id1,id2); id1,id2 ideal or module, both must be standard bases
746RETURN:  int, which is:
747         1. the codimension of id2 in id1, i.e. the vectorspace dimension of
748            id1/id2 if id2 is contained in id1 and if this number is finite
749         2. -1 if the dimension of id1/id2 is infinite
750         3. -2 if id2 is not contained in id1,
751COMPUTE: consider the two hilberseries iv1(t) and iv2(t), then, in case 1.,
752         q(t)=(iv2(t)-iv1(t))/(1-t)^n must be rational, and the result is the
753         sum of the coefficients of q(t) (n dimension of basering)
754EXAMPLE: example codim; shows an example
755"
756{
757   intvec iv1, iv2, iv;
758   int i, d1, d2, dd, i1, i2, ia, ie;
759  //--------------------------- check id2 < id1 -------------------------------
760   ideal led = lead(id1);
761   attrib(led, "isSB",1);
762   i = size(NF(lead(id2),led));
763   if ( i > 0 )
764   {
765     return(-2);
766   }
767  //--------------------------- 1. check finiteness ---------------------------
768   i1 = dim(id1);
769   i2 = dim(id2);
770   if (i1 < 0)
771   {
772     if (i2 == 0)
773     {
774       return vdim(id2);
775     }
776     else
777     {
778       return(-1);
779     }
780   }
781   if (i2 != i1)
782   {
783     return(-1);
784   }
785   if (i2 <= 0)
786   {
787     return(vdim(id2)-vdim(id1));
788   }
789 // if (mult(id2) != mult(id1))
790 //{
791 //  return(-1);
792 // }
793  //--------------------------- module ---------------------------------------
794   d1 = nrows(id1);
795   d2 = nrows(id2);
796   dd = 0;
797   if (d1 > d2)
798   {
799     id2=id2,maxideal(1)*gen(d1);
800     dd = -1;
801   }
802   if (d2 > d1)
803   {
804     id1=id1,maxideal(1)*gen(d2);
805     dd = 1;
806   }
807  //--------------------------- compute first hilbertseries ------------------
808   iv1 = hilb(id1,1);
809   i1 = size(iv1);
810   iv2 = hilb(id2,1);
811   i2 = size(iv2);
812  //--------------------------- difference of hilbertseries ------------------
813   if (i2 > i1)
814   {
815     for ( i=1; i<=i1; i=i+1)
816     {
817       iv2[i] = iv2[i]-iv1[i];
818     }
819     ie = i2;
820     iv = iv2;
821   }
822   else
823   {
824     for ( i=1; i<=i2; i=i+1)
825     {
826       iv1[i] = iv2[i]-iv1[i];
827     }
828     iv = iv1;
829     for (ie=i1;ie>=0;ie=ie-1)
830     {
831       if (ie == 0)
832       {
833         return(0);
834       }
835       if (iv[ie] != 0)
836       {
837         break;
838       }
839     }
840   }
841   ia = 1;
842   while (iv[ia] == 0) { ia=ia+1; }
843  //--------------------------- ia <= nonzeros <= ie -------------------------
844   iv1 = iv[ia];
845   for(i=ia+1;i<=ie;i=i+1)
846   {
847     iv1=iv1,iv[i];
848   }
849  //--------------------------- compute second hilbertseries -----------------
850   iv2 = hilb(iv1);
851  //--------------------------- check finitenes ------------------------------
852   i2 = size(iv2);
853   i1 = ie - ia + 1 - i2;
854   if (i1 != nvars(basering))
855   {
856     return(-1);
857   }
858  //--------------------------- compute result -------------------------------
859   i1 = 0;
860   for ( i=1; i<=i2; i=i+1)
861   {
862     i1 = i1 + iv2[i];
863   }
864   return(i1+dd);
865}
866example
867{ "EXAMPLE:"; echo = 2;
868   ring r  = 0,(x,y,z),dp;
869   ideal j = y6,x4;
870   ideal m = x,y;
871   attrib(m,"isSB",1);  //let Singular know that ideals are a standard basis
872   attrib(j,"isSB",1);
873   codim(m,j);          // should be 23 (Milnor number -1 of y7-x5)
874}
Note: See TracBrowser for help on using the repository browser.