source: git/Singular/LIB/sing.lib @ 18dd47

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