source: git/Singular/LIB/sing.lib @ 80a0f0

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