source: git/Singular/LIB/sing.lib @ 1f92589

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