source: git/Singular/LIB/sing.lib @ 457d505

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