source: git/Singular/LIB/deform.lib

spielwiese
Last change on this file was 594560, checked in by Hans Schoenemann <hannes@…>, 15 months ago
call std in many places only if attribute isSB is not set
  • Property mode set to 100644
File size: 30.2 KB
Line 
1//////////////////////////////////////////////////////////////////////////////
2version="version deform.lib 4.3.1.3 Jan_2023 "; // $Id$
3category="Singularities";
4info="
5LIBRARY:  deform.lib    Miniversal Deformation of Singularities and Modules
6AUTHOR:   Bernd Martin, email: martin@math.tu-cottbus.de
7
8PROCEDURES:
9 versal(Fo[,d,any])        miniversal deformation of isolated singularity Fo
10 mod_versal(Mo,I,[,d,any]) miniversal deformation of module Mo modulo ideal I
11 lift_kbase(N,M);          lifting N into standard kbase of M
12 lift_rel_kb(N,M[,kbM,p])  relative lifting N into a kbase of M
13";
14
15LIB "inout.lib";
16LIB "general.lib";
17LIB "matrix.lib";
18LIB "homolog.lib";
19LIB "sing.lib";
20///////////////////////////////////////////////////////////////////////////////
21
22proc versal (ideal Fo,list #)
23"USAGE:   versal(Fo[,d,any]); Fo=ideal, d=int, any=list
24COMPUTE: miniversal deformation of Fo up to degree d (default d=100),
25RETURN: list L of 4 rings:
26         L[1] extending the basering Po by new variables given by
27          \"A,B,..\" (deformation parameters); the new variables precede
28         the old ones, the ordering is the product of \"ls\" and \"ord(Po)\" @*
29         L[2] = L[1]/Fo extending Qo=Po/Fo, @*
30         L[3] = the embedding ring of the versal base space, @*
31         L[4] = L[1]/Js extending L[3]/Js. @*
32      In the ring L[1] the following matrices are stored:
33         @*Js  = giving the versal base space (obstructions),
34         @*Fs  = giving the versal family of Fo,
35         @*Rs  = giving the lifting of Ro=syz(Fo).
36
37      If d is defined (!=0), it computes up to degree d.
38      @*If 'any' is defined and any[1] is no string, interactive version.
39      @*Otherwise 'any' is interpreted as a list of predefined strings:
40      \"my\",\"param\",\"order\",\"out\": @*
41      (\"my\" internal prefix, \"param\" is a letter (e.g. \"A\") for the
42      name of the first parameter or (e.g. \"A(\") for index parameter
43      variables, \"order\" ordering string for ring extension), \"out\" name
44      of output file).
45NOTE:   printlevel < 0        no additional output,
46        printlevel >=0,1,2,.. informs you, what is going on;
47        this proc uses 'execute'.
48EXAMPLE:example versal; shows an example
49"
50{
51//------- prepare -------------------------------------------------------------
52  string str,@param,@order,@my,@out,@degrees;
53  int @d,d_max,@t1,t1',@t2,@colR,ok_ann,@smooth,@noObstr,@size,@j;
54  int p    = printlevel-voice+3;
55  int time = timer;
56  intvec @iv,@jv,@is_qh,@degr;
57  d_max    = 100;
58  @my = ""; @param="A"; @order="ds"; @out="no";
59  @size    = size(#);
60  if( @size>0 ) { if (#[1]>0) { d_max = #[1];} }
61  if( @size>1 )
62  { if(typeof(#[2])!="string")
63    { string @active;
64      @my,@param,@order,@out = interact1();
65    }
66    else
67    { @my = #[2];
68      if (@size>2) {@param = #[3];}
69      if (@size>3) {@order = #[4];}
70      if (@size>4) {@out   = #[5];}
71    }
72  }
73  if (ord_test(basering)==-1) {  Fo   = minbase(Fo);}
74  else                        {  Fo   =interred(Fo);}
75  @is_qh      = qhweight(Fo);
76  int    @rowR= size(Fo);
77  def    Po   = basering;
78setring  Po;
79  poly   X_s  = product(maxideal(1));
80//-------  reproduce T_12 -----------------------------------------------------
81  list   Ls   = T_12(Fo,1);
82  matrix Ro   = Ls[6];                         // syz(i)
83  matrix InfD = Ls[5];                         // matrix of inf. deformations
84  matrix PreO = Ls[7];                         // representation of (Syz/Kos)*
85  module PreO'= std(PreO);
86  module PreT = Ls[2];                         // representation of modT_2 (sb)
87  if(dim(PreT)==0)
88  {
89    matrix kbT_2 = kbase(PreT);                 // kbase of T_2
90  }
91  else
92  {
93    matrix kbT_2 ;                              // kbase of T_2 : empty
94  }
95  @t1 = Ls[3];                                 // vdim of T_1
96  @t2 = Ls[4];                                 // vdim of T_2
97  kill Ls;
98  t1' = @t1;
99  if( @t1==0) { dbprint(p,"// rigid!"); return(list());}
100  if( @t2==0) { @smooth=1; dbprint(p,"// smooth base space");}
101  dbprint(p,"// ready: T_1 and T_2");
102  @colR = ncols(Ro);
103//-----  test: quasi-homogeneous, choice of inf. def.--------------------------
104  @degrees = homog_test(@is_qh,matrix(Fo),InfD);
105  @jv = 1..@t1;
106  if (@degrees!="")
107  { dbprint(p-1,"// T_1 is quasi-homogeneous represented with weight-vector",
108    @degrees);
109  }
110  if (defined(@active))
111  { "// matrix of infinitesimal deformations:";print(InfD);
112    "// weights of infinitesimal deformations (  empty ='not qhomog'):";
113     @degrees;
114     matrix dummy;
115     InfD,dummy,t1' = interact2(InfD,@jv);kill dummy;
116  }
117 //---- create new rings and objects ------------------------------------------
118  list list_of_rings=get_rings(Fo,t1',1,@order,@param);
119  def myPx= list_of_rings[1];
120  def myQx= list_of_rings[2];
121  def myOx= list_of_rings[3];
122  def mySo= list_of_rings[4];
123  kill list_of_rings;
124  setring myPx;
125  @jv=0; @jv[t1']=0; @jv=@jv+1; @jv[nvars(basering)]=0;
126                                               //weight-vector for calculating
127                                               //rel-jet with resp to def-para
128  ideal  Io   = imap(Po,Fo);
129  ideal  J,m_J,tid;     attrib(J,"isSB",1);
130  matrix Fo   = matrix(Io);                   //initial equations
131  matrix homF = kohom(Fo,@colR);
132  matrix Ro   = imap(Po,Ro);
133  matrix homR = transpose(Ro);
134  matrix homFR= concat(homR,homF);
135  module hom' = std(homFR);
136  matrix Js[1][@t2];
137  matrix F_R,Fs,Rs,Fn,Rn;
138  export Js,Fs,Rs;
139  matrix Mon[t1'][1]=maxideal(1);
140  Fn  = transpose(imap(Po,InfD)*Mon);         //infinitesimal deformations
141  Fs  = Fo + Fn;
142  dbprint(p-1,"// infinitesimal deformation: Fs: ",Fs);
143  Rn  = (-1)*lift(Fo,Fs*Ro);                  //infinit. relations
144  Rs  = Ro + Rn;
145  F_R = Fs*Rs;
146  tid = 0 + ideal(F_R);
147  if (tid[1]==0) {d_max=1;}                   //finished ?
148 setring myOx;
149  matrix Fs,Rs,Cup,Cup',F_R,homFR,New,Rn,Fn;
150  module hom';
151  ideal  null,tid;  attrib(null,"isSB",1);
152 setring myQx;
153  poly X_s = imap(Po,X_s);
154  matrix Cup,Cup',MASS;
155  ideal  tid,null;               attrib(null,"isSB",1);
156  ideal  J,m_J;                  attrib(J,"isSB",1);
157                                 attrib(m_J,"isSB",1);
158  matrix PreO = imap(Po,PreO);
159  module PreO'= imap(Po,PreO');  attrib(PreO',"isSB",1);
160  module PreT = imap(Po,PreT);   attrib(PreT,"isSB",1);
161  matrix kbT_2 = imap(Po,kbT_2);
162  matrix Mon  = fetch(myPx,Mon);
163  matrix F_R  = fetch(myPx,F_R);
164  matrix Js[1][@t2];
165//------- start the loop ------------------------------------------------------
166   for (@d=2;@d<=d_max;@d=@d+1)
167   {
168     if( @t1==0) {break};
169     dbprint(p,"// start computation in degree "+string(@d)+".");
170     dbprint(p-3,">>> TIME = "+string(timer-time));
171     dbprint(p-3,"==> memory = "+string(kmemory())+"k");
172//------- compute obstruction-vector  -----------------------------------------
173     if (@smooth) { @noObstr=1;}
174     else
175     { Cup = jet(F_R,@d,@jv);
176       Cup = matrix(reduce(ideal(Cup),m_J),@colR,1);
177       Cup = jet(Cup,@d,@jv);
178     }
179//------- express obstructions in kbase of T_2  -------------------------------
180     if ( @noObstr==0 )
181     {  Cup' = reduce(Cup,PreO');
182        tid  = simplify(ideal(Cup'),10);
183        if(tid[1]!=0)
184        {  dbprint(p-4,"// *");
185           Cup=Cup-Cup';
186        }
187        Cup   = lift(PreO,Cup);
188        MASS  = lift_rel_kb(Cup,PreT,kbT_2,X_s);
189        dbprint(p-3,"// next MASSEY-products:",MASS-jet(MASS,@d-1,@jv));
190        if    (MASS==transpose(Js))
191              { @noObstr=1;dbprint(p-1,"// no obstruction"); }
192         else { @noObstr=0; }
193      }
194//------- obtain equations of base space --------------------------------------
195      if ( @noObstr==0 )
196      { Js = transpose(MASS);
197        dbprint(p-2,"// next equation of base space:",
198        simplify(ideal(Js),10));
199        setring myPx;
200        Js   = imap(myQx,Js);
201        degBound = @d+1;
202        J    = std(ideal(Js));
203        m_J  = std(J*ideal(Mon));
204        degBound = 0;
205//--------------- obtain new base-ring ----------------------------------------
206        if(defined(myOx)) {kill myOx;}
207        attrib(J,"isSB",1); // J is a degBound-SB (deg @d)
208        qring myOx = J;
209        matrix Fs,Rs,F_R,Cup,Cup',homFR,New,Rn,Fn;
210        module hom';
211        ideal  null,tid;  attrib(null,"isSB",1);
212      }
213//---------------- lift equations F and relations R ---------------------------
214      setring myOx;
215      Fs    = fetch(myPx,Fs);
216      Rs    = fetch(myPx,Rs);
217      F_R   = Fs*Rs;
218      F_R   = matrix(reduce(ideal(F_R),null));
219      tid   = 0 + ideal(F_R);
220      if (tid[1]==0) { dbprint(p-1,"// finished"); break;}
221      Cup   = (-1)*transpose(jet(F_R,@d,@jv));
222      homFR = fetch(myPx,homFR);
223      hom'  = fetch(myPx,hom');  attrib(hom',"isSB",1);
224      Cup'  = simplify(reduce(Cup,hom'),10);
225      tid   = simplify(ideal(Cup'),10);
226      if (tid[1]!=0)
227      {  dbprint(p-4,"// #");
228         Cup=Cup-Cup';
229      }
230      New   = lift(homFR,Cup);
231      Rn    = matrix(ideal(New[1+@rowR..nrows(New),1]),@rowR,@colR);
232      Fn    = matrix(ideal(New[1..@rowR,1]),1,@rowR);
233      Fs    = Fs+Fn;
234      Rs    = Rs+Rn;
235      F_R   = Fs*Rs;
236      tid   = 0+reduce(ideal(F_R),null);
237//---------------- fetch results into other rings -----------------------------
238      setring myPx;
239      Fs    = fetch(myOx,Fs);
240      Rs    = fetch(myOx,Rs);
241      F_R   = Fs*Rs;
242      setring myQx;
243      F_R = fetch(myPx,F_R);
244      m_J = fetch(myPx,m_J);  attrib(m_J,"isSB",1);
245      J   = fetch(myPx,J);    attrib(J,"isSB",1);
246      Js  = fetch(myPx,Js);
247      tid = fetch(myOx,tid);
248      if (tid[1]==0) { dbprint(p-1,"// finished");break;}
249   }
250//---------  end loop and final output ----------------------------------------
251   setring myPx;
252   if (@out!="no")
253   {  string out = @out+"_"+string(@d);
254      "// writing file "+out+" with matrix Js, matrix Fs, matrix Rs ready
255      for reading in rings "+myPx+" or "+myQx;
256      write(out,"matrix Js[1][",@t2,"]=",Js,";matrix Fs[1][",@rowR,"]=",Fs,
257      ";matrix Rs[",@rowR,"][",@colR,"]=",Rs,";");
258   }
259   dbprint(p-3,">>> TIME = "+string(timer-time));
260   if (@is_qh != 0)
261   { @degr = qhweight(ideal(Js));
262     @degr = @degr[1..t1'];
263     dbprint(p-1,"// quasi-homogeneous weights of miniversal base",@degr);
264   }
265   dbprint(p-1,
266   "// ___ Equations of miniversal base space ___",Js,
267   "// ___ Equations of miniversal total space ___",Fs);
268   dbprint(p,"","
269// 'versal' returned a list, say L, of four rings. In L[1] are stored:
270//   as matrix Fs: Equations of total space of the miniversal deformation,
271//   as matrix Js: Equations of miniversal base space,
272//   as matrix Rs: syzygies of Fs mod Js.
273// To access these data, type
274     def Px=L[1]; setring Px; print(Fs); print(Js); print(Rs);
275
276// L[2] = L[1]/Fo extending Qo=Po/Fo,
277// L[3] = the embedding ring of the versal base space,
278// L[4] = L[1]/Js extending L[3]/Js.
279");
280   return(list(myPx,myQx,mySo,myOx));
281}
282example
283{ "EXAMPLE:"; echo = 2;
284   int p          = printlevel;
285   printlevel     = 0;
286   ring r1        = 0,(x,y,z,u,v),ds;
287   matrix m[2][4] = x,y,z,u,y,z,u,v;
288   ideal Fo       = minor(m,2);
289                    // cone over rational normal curve of degree 4
290   list L=versal(Fo);
291   L;
292   def Px=L[1];
293   setring Px;
294   // ___ Equations of miniversal base space ___:
295   Js;"";
296   // ___ Equations of miniversal total space ___:
297   Fs;"";
298}
299///////////////////////////////////////////////////////////////////////////////
300
301proc mod_versal(matrix Mo, ideal I, list #)
302"USAGE:   mod_versal(Mo,Io[,d,any]); Io=ideal, Mo=module, d=int, any =list
303COMPUTE: miniversal deformation of coker(Mo) over Qo=Po/Io, Po=basering;
304RETURN:  list L of 4 rings:
305         L[1] extending the basering Po by new variables given by
306          \"A,B,..\" (deformation parameters); the new variables precede
307         the old ones, the ordering is the product of \"ls\" and \"ord(Po)\" @*
308         L[2] = L[1]/Io extending Qo, @*
309         L[3] = the embedding ring of the versal base space, @*
310         L[4] = L[1]/(Io+Js) ring of the versal deformation of coker(Ms). @*
311      In the ring L[1] the following matrices are stored:
312         @*Js  = giving the versal base space (obstructions),
313         @*Fs  = giving the versal family of Mo,
314         @*Rs  = giving the lifting of syzygies Lo=syz(Mo).
315      If d is defined (!=0), it computes up to degree d.
316      @*If 'any' is defined and any[1] is no string, interactive version.
317      @*Otherwise 'any' is interpreted as a list of predefined strings:
318      \"my\",\"param\",\"order\",\"out\": @*
319      (\"my\" internal prefix, \"param\" is a letter (e.g. \"A\") for the
320      name of the first parameter or (e.g. \"A(\") for index parameter
321      variables, \"order\" ordering string for ring extension), \"out\" name
322      of output file).
323NOTE:   printlevel < 0        no additional output,
324        printlevel >=0,1,2,.. informs you, what is going on,
325        this proc uses 'execute'.
326EXAMPLE:example mod_versal; shows an example
327"
328{
329//------- prepare -------------------------------------------------------------
330  intvec save_opt=option(get);
331  option(cancelunit);
332  string str,@param,@order,@my,@out,@degrees;
333  int @d,d_max,f0,f1,f2,e1,e1',e2,ok_ann,@smooth,@noObstr,@size,@j;
334  int p    = printlevel-voice+3;
335  int time = timer;
336  intvec @iv,@jv,@is_qh,@degr;
337  d_max    = 100;
338  @my = ""; @param="A"; @order="ds"; @out="no";
339  @size = size(#);
340  if( @size>0 ) { d_max = #[1]; }
341  if( @size>1 )
342  { if(typeof(#[2])!="string")
343    { string @active;
344      @my,@param,@order,@out = interact1();
345    }
346    else
347    { @my = #[2];
348      if (@size>2) {@param = #[3];}
349      if (@size>3) {@order = #[4];}
350      if (@size>4) {@out   = #[5];}
351    }
352  }
353  @is_qh      = qhweight(I);
354  def    Po   = basering;
355 setring Po;
356  poly   X_s = product(maxideal(1));
357//-------- compute Ext's ------------------------------------------------------
358         I   = std(I);
359 qring   Qo  = I;
360  matrix Mo  = fetch(Po,Mo);
361  list   Lo  = compute_ext(Mo,p);
362         f0,f1,f2,e1,e2,ok_ann=Lo[1];
363  matrix Ls,kb1,lift1 = Lo[2],Lo[3],Lo[4];
364  matrix kb2,C',D' = Lo[5][2],Lo[5][3],Lo[5][5];
365  module ex2,Co,Do = Lo[5][1],Lo[5][4],Lo[5][6];
366  kill Lo;
367  dbprint(p,"// ready: Ext1 and Ext2");
368//-----  test: quasi-homogeneous, choice of inf. def.--------------------------
369  @degrees = homog_test(@is_qh,Mo,kb1);
370  e1' = e1;  @jv = 1..e1;
371  if (@degrees != "")
372  { dbprint(p-1,"// Ext1 is quasi-homogeneous represented: "+@degrees);
373  }
374  if (defined(@active))
375  { "// kbase of Ext1:";
376    print(kb1);
377    "// weights of kbase of Ext1 ( empty = 'not qhomog')";@degrees;
378    kb1,lift1,e1' = interact2(kb1,@jv,lift1);
379  }
380//-------- get new rings and objects ------------------------------------------
381  setring Po;
382  list list_of_rings=get_rings(I,e1',0,@order,@param);
383  def ooPx= list_of_rings[1];
384  def ooQx= list_of_rings[2];
385  def ooOx= list_of_rings[3];
386  def ooSo= list_of_rings[4];
387  kill list_of_rings;
388  setring ooPx;
389  ideal  J,m_J;
390  ideal  I_J  = imap(Po,I);
391  ideal  Io   = I_J;
392  matrix Mon[e1'][1] = maxideal(1);
393  matrix Ms   = imap(Qo,Mo);
394  matrix Ls   = imap(Qo,Ls);
395  matrix Js[1][e2];
396  setring ooQx;
397  ideal  J,I_J,tet,null;              attrib(null,"isSB",1);
398  ideal  m_J  = fetch(ooPx,m_J);   attrib(m_J,"isSB",1);
399  @jv=0;  @jv[e1] = 0; @jv = @jv+1;   @jv[nvars(ooPx)] = 0;
400  matrix Ms   = imap(Qo,Mo);          export(Ms);
401  matrix Ls   = imap(Qo,Ls);          export(Ls);
402  matrix Js[e2][1];                   export(Js);
403  matrix MASS;
404  matrix Mon  = fetch(ooPx,Mon);
405  matrix Mn,Ln,ML,Cup,Cup',Lift;
406  matrix C'   = imap(Qo,C');
407  module Co   = imap(Qo,Co);          attrib(Co,"isSB",1);
408  module ex2  = imap(Qo,ex2);         attrib(ex2,"isSB",1);
409  matrix D'   = imap(Qo,D');
410  module Do   = imap(Qo,Do);          attrib(Do,"isSB",1);
411  matrix kb2  = imap(Qo,kb2);
412  matrix kb1  = imap(Qo,kb1);
413  matrix lift1= imap(Qo,lift1);
414  poly   X_s  = imap(Po,X_s);
415  intvec intv = e1',e1,f0,f1,f2;
416         Ms,Ls= get_inf_def(Ms,Ls,kb1,lift1,X_s);
417  kill   kb1,lift1;
418  dbprint(p-1,"// infinitesimal extension",Ms);
419//----------- start the loop --------------------------------------------------
420  for (@d=2;@d<=d_max;@d=@d+1)
421  {
422    dbprint(p-3,">>> time = "+string(timer-time));
423    dbprint(p-3,"==> memory = "+string(memory(0)/1000)+
424                ",  allocated = "+string(memory(1)/1000));
425    dbprint(p,"// start deg = "+string(@d));
426//-------- get obstruction ----------------------------------------------------
427    Cup  = matrix(ideal(Ms*Ls),f0*f2,1);
428    Cup  = jet(Cup,@d,@jv);
429    Cup  = reduce(ideal(Cup),m_J);
430    Cup  = jet(Cup,@d,@jv);
431//-------- express obstruction in kbase ---------------------------------------
432    Cup' = reduce(Cup,Do);
433    tet  = simplify(ideal(Cup'),10);
434    if (tet[1]!=0)
435    { dbprint(p-4,"// *");
436      Cup = Cup-Cup';
437    }
438    Cup  = lift(D',Cup);
439    if (ok_ann)
440    { MASS = lift_rel_kb(Cup,ex2,kb2,X_s);}
441    else
442    { MASS = reduce(Cup,ex2);}
443    dbprint(p-3,"// next MATRIC-MASSEY-products",
444    MASS-jet(MASS,@d-1,@jv));
445    if   ( MASS==transpose(Js))
446         { @noObstr = 1;dbprint(p-1,"//no obstruction"); }
447    else { @noObstr = 0; }
448//-------- obtain equations of base space -------------------------------------
449    if (@noObstr == 0)
450    { Js = MASS;
451      dbprint(p-2,"// next equation of base space:",simplify(ideal(Js),10));
452      setring ooPx;
453      Js = imap(ooQx,Js);
454      degBound=@d+1;
455      J   = std(ideal(Js));
456      m_J = std(ideal(Mon)*J);
457      degBound=0;
458      I_J = Io,J;                attrib(I_J,"isSB",1);
459//-------- obtain new base ring -----------------------------------------------
460      if (defined(ooOx)) {kill ooOx;}
461      qring ooOx = I_J;
462      ideal null,tet;            attrib(null,"isSB",1);
463      matrix Ms  = imap(ooQx,Ms);
464      matrix Ls  = imap(ooQx,Ls);
465      matrix Mn,Ln,ML,Cup,Cup',Lift;
466      matrix C'  = imap(Qo,C');
467      module Co  = imap(Qo,Co);   attrib(Co,"isSB",1);
468      module ex2 = imap(Qo,ex2);  attrib(ex2,"isSB",1);
469      matrix kb2 = imap(Qo,kb2);
470      poly   X_s = imap(Po,X_s);
471    }
472//-------- get lifts ----------------------------------------------------------
473    setring ooOx;
474    ML  = matrix(reduce(ideal(Ms*Ls),null),f0,f2);
475    Cup = matrix(ideal(ML),f0*f2,1);
476    Cup = jet(Cup,@d,@jv);
477    Cup'= reduce(Cup,Co);
478    tet = simplify(ideal(Cup'),10);
479    if (tet[1]!=0)
480    { dbprint(p-4,"// #");
481     Cup = Cup-Cup';
482    }
483    Lift = lift(C',Cup);
484    Mn   = matrix(ideal(Lift),f0,f1);
485    Ln   = matrix(ideal(Lift[f0*f1+1..nrows(Lift),1]),f1,f2);
486    Ms   = Ms-Mn;
487    Ls   = Ls-Ln;
488    dbprint(p-3,"// next extension of Mo",Mn);
489    dbprint(p-3,"// next extension of syz(Mo)",Ln);
490    ML   = reduce(ideal(Ms*Ls),null);
491//--------- test: finished ----------------------------------------------------
492    tet  = simplify(ideal(ML),10);
493    if (tet[1]==0) { dbprint(p-1,"// finished in degree ",@d);}
494//---------fetch results into Qx and Px ---------------------------------------
495    setring ooPx;
496    Ms   = fetch(ooOx,Ms);
497    Ls   = fetch(ooOx,Ls);
498   setring ooQx;
499    Ms   = fetch(ooOx,Ms);
500    Ls   = fetch(ooOx,Ls);
501    ML   = Ms*Ls;
502    ML   = matrix(reduce(ideal(ML),null),f0,f2);
503    tet  = imap(ooOx,tet);
504    if (tet[1]==0) { break;}
505  }
506//------- end of loop, final output -------------------------------------------
507  if (@out != "no")
508  { string out = @out+"_"+string(@d);
509    "// writing file '"+out+"' with matrix Js, matrix Ms, matrix Ls
510    ready for reading in rings qqPx or qqQx";
511    write(out,"matrix Js[1][",e2,"]=",Js,";matrix Ms[",f0,"][",f1,"]=",Ms,
512    ";matrix Ls[",f1,"][",f2,"]=",Ls,";");
513  }
514  dbprint(p-3,">>> TIME = "+string(timer-time));
515  if (@is_qh != 0)
516  { @degr = qhweight(ideal(Js));
517    @degr = @degr[1..e1'];
518    dbprint(p-1,"// quasi-homogeneous weights of miniversal base",@degr);
519  }
520  dbprint(p,"
521// 'mod_versal' returned a list, say L, of four rings. In L[2] are stored:
522//   as matrix Ms: presentation matrix of the deformed module,
523//   as matrix Ls: lifted syzygies,
524//   as matrix Js:  Equations of total space of miniversal deformation
525// To access these data, type
526     def Qx=L[2]; setring Qx; print(Ms); print(Ls); print(Js);
527");
528  option(set,save_opt);
529  return(list(ooPx,ooQx,ooSo,ooOx));
530}
531example
532{ "EXAMPLE:"; echo = 2;
533  int p = printlevel;
534  printlevel = 1;
535  ring  Ro = 0,(x,y),wp(3,4);
536  ideal Io = x4+y3;
537  matrix Mo[2][2] = x2,y,-y2,x2;
538  list L = mod_versal(Mo,Io);
539  def Qx=L[2]; setring Qx;
540  print(Ms);
541  print(Ls);
542  print(Js);
543  printlevel = p;
544  if (defined(Px)) {kill Px,Qx,So;}
545}
546///////////////////////////////////////////////////////////////////////////////
547proc compute_ext(matrix Mo,int p)
548"
549Sub-procedure: obtain Ext1 and Ext2 and other objects used by mod_versal
550"
551{
552   int    l,f0,f1,f2,f3,e1,e2,ok_ann;
553   module Co,Do,ima,ex1,ex2;
554   matrix M0,M1,M2,ker,kb1,lift1,kb2,A,B,C,D;
555//------- resM ---------------------------------------------------------------
556   list resM = nres(Mo,3);
557   M0 = resM[1];
558   M1 = resM[2];
559   M2 = resM[3];   kill resM;
560   f0 = nrows(M0);
561   f1 = ncols(M0);
562   f2 = ncols(M1);
563   f3 = ncols(M2);
564//------ compute Ext^2  ------------------------------------------------------
565   B    = kohom(M0,f3);
566   A    = kontrahom(M2,f0);
567   D    = modulo(A,B);
568   Do   = std(D);
569   ima  = kohom(M0,f2),kontrahom(M1,f0);
570   ex2  = modulo(D,ima);
571   ex2  = std(ex2);
572   e2   = vdim(ex2);
573   kb2  = kbase(ex2);
574      dbprint(p,"// vdim (Ext^2) = "+string(e2));
575//------ test: max = Ann(Ext2) -----------------------------------------------
576   for (l=1;l<=e2;l=l+1)
577   { ok_ann = ok_ann+ord(kb2[l]);
578   }
579   if (ok_ann==0)
580   {  e2 =nrows(ex2);
581      dbprint(p,"// Ann(Ext2) is maximal");
582   }
583//------ compute Ext^1 -------------------------------------------------------
584   B     = kohom(M0,f2);
585   A     = kontrahom(M1,f0);
586   ker   = modulo(A,B);
587   ima   = kohom(M0,f1),kontrahom(M0,f0);
588   ex1   = modulo(ker,ima);
589   ex1   = std(ex1);
590   e1    = vdim(ex1);
591      dbprint(p,"// vdim (Ext^1) = "+string(e1));
592   kb1   = kbase(ex1);
593   kb1   = ker*kb1;
594   C     = concat(A,B);
595   Co    = std(C);
596//------ compute the liftings of Ext^1 ---------------------------------------
597   lift1 = A*kb1;
598   lift1 = lift(B,lift1);
599   intvec iv = f0,f1,f2,e1,e2,ok_ann;
600   list   L' = ex2,kb2,C,Co,D,Do;
601   return(iv,M1,kb1,lift1,L');
602}
603///////////////////////////////////////////////////////////////////////////////
604static proc get_rings(ideal Io,int e1,int switch, list #)
605"
606Sub-procedure: creating ring-extensions, returned as a list of 4 rings
607"
608{
609   def Po = basering;
610   string my;
611   string my_ord = "ds";
612   string my_var = "A";
613   if (size(#)>1)
614   {
615     my_ord = #[1];
616     my_var = #[2];
617   }
618   def my_Px=extendring(e1,my_var,my_ord);
619   setring my_Px;
620   ideal Io  = imap(Po,Io);
621   attrib(Io,"isSB",1);
622   qring my_Qx = Io;
623   if (switch)
624   {
625     setring my_Px;
626     qring my_Ox = std(ideal(0));
627   }
628   else
629   {
630     def my_Ox = my_Qx;
631   }
632   def my_So=defring(charstr(Po),e1,my_var,my_ord);
633   setring my_So;
634   list erg=list(my_Px,my_Qx,my_Ox,my_So);
635   return(erg);
636}
637///////////////////////////////////////////////////////////////////////////////
638proc get_inf_def(list #)
639"
640Sub-procedure: compute infinitesimal family of a module and its syzygies
641               from a kbase of Ext1 and its lifts
642"
643{
644  matrix Ms  = #[1];
645  matrix Ls  = #[2];
646  matrix kb1 = #[3];
647  matrix li1 = #[4];
648  int   e1,f0,f1,f2;
649  poly X_s     = #[5];
650  e1 = ncols(kb1);
651  f0 = nrows(Ms);
652  f1 = nrows(Ls);
653  f2 = ncols(Ls);
654  int  l;
655  for (l=1;l<=e1;l=l+1)
656  {
657     Ms = Ms + var(l)*matrix(ideal(kb1[l]),f0,f1);
658     Ls = Ls - var(l)*matrix(ideal(li1[l]),f1,f2);
659  }
660  return(Ms,Ls);
661}
662//////////////////////////////////////////////////////////////////////////////
663proc lift_rel_kb (module N, module M, list #)
664"USAGE:   lift_rel_kb(N,M[,kbaseM,p]);
665ASSUME:  [p a monomial ] or the product of all variables
666         N, M modules of same rank, M depending only on variables not in p
667         and vdim(M) is finite in this ring,
668         [ kbaseM the kbase of M in the subring given by variables not in p ] @*
669         warning: these assumptions are not checked by the procedure
670RETURN:  matrix A, whose j-th columns present the coeff's of N[j] in kbaseM,
671         i.e. kbaseM*A = reduce(N,std(M))
672EXAMPLE: example lift_rel_kb;  shows examples
673"
674{
675  poly p = product(maxideal(1));
676  if (!attrib(M,"isSB")) { M = std(M);}
677  if (size(#)>0) { p=#[2]; module kbaseM=#[1];}
678  else
679  { if (vdim(M)<=0) { "// vdim(M) not finite";return(A);}
680    module kbaseM = kbase(M);
681  }
682  N = reduce(N,M);
683  matrix A;
684  if (simplify(N,10)[1]==[0]) {return(A);}
685  A = coeffs(N,kbaseM,p);
686  return(A);
687}
688example
689{
690  "EXAMPLE:"; echo=2;
691  ring r=0,(A,B,x,y),dp;
692  module M      = [x2,xy],[xy,y3],[y2],[0,x];
693  module kbaseM = [1],[x],[xy],[y],[0,1],[0,y],[0,y2];
694  poly f=xy;
695  module N = [AB,BBy],[A3xy+x4,AB*(1+y2)];
696  matrix A = lift_rel_kb(N,M,kbaseM,f);
697  print(A);
698  "TEST:";
699  print(matrix(kbaseM)*A-matrix(reduce(N,std(M))));
700}
701///////////////////////////////////////////////////////////////////////////////
702proc lift_kbase (def N,def M)
703"USAGE:   lift_kbase(N,M); N,M=poly/ideal/vector/module
704RETURN:  matrix A, coefficient matrix expressing N as linear combination of
705         k-basis of M. Let the k-basis have k elements and size(N)=c columns.
706         Then A satisfies:
707             matrix(reduce(N,std(M)),k,c) = matrix(kbase(std(M)))*A
708ASSUME:  dim(M)=0 and the monomial ordering is a well ordering or the last
709         block of the ordering is c or C
710EXAMPLE: example lift_kbase; shows an example
711"
712{
713  return(lift_rel_kb(N,M));
714}
715example
716{"EXAMPLE:";     echo=2;
717  ring R=0,(x,y),ds;
718  module M=[x2,xy],[y2,xy],[0,xx],[0,yy];
719  module N=[x3+xy,x],[x,x+y2];
720  print(M);
721  module kb=kbase(std(M));
722  print(kb);
723  print(N);
724  matrix A=lift_kbase(N,M);
725  print(A);
726  matrix(reduce(N,std(M)),nrows(kb),ncols(A)) - matrix(kbase(std(M)))*A;
727}
728
729
730///////////////////////////////////////////////////////////////////////////////
731proc interact1 ()
732"
733Sub_procedure: asking for and reading your input-strings
734"
735{
736 string my = "@";
737 string str,out,my_ord,my_var;
738 my_ord = "ds";
739 my_var = "A";
740 "INPUT: name of output-file (ENTER = no output, do not use \"my\"!)";
741   str = read("");
742   if (size(str)>1)
743   { out = str[1..size(str)-1];}
744   else
745   { out = "no";}
746 "INPUT: prefix-string of ring-extension (ENTER = '@')";
747   str = read("");
748   if ( size(str) > 1 )
749   { my = str[1..size(str)-1]; }
750 "INPUT:parameter-string
751   (give a letter corresponding to first new variable followed by the next letters,
752   or 'T('       - a letter + '('  - getting a string of indexed variables)
753   (ENTER = A) :";
754   str = read("");
755   if (size(str)>1) { my_var=str[1..size(str)-1]; }
756 "INPUT:order-string (local or weighted!) (ENTER = ds) :";
757   str = read("");
758   if (size(str)>1) { my_ord=str[1..size(str)-1]; }
759   if( find(my_ord,"s")+find(my_ord,"w") == 0 )
760   { "// ordering must be an local! changed into 'ds'";
761     my_ord = "ds";
762   }
763   return(my,my_var,my_ord,out);
764}
765///////////////////////////////////////////////////////////////////////////////
766proc interact2 (matrix A, intvec col_vec, list #)
767"
768Sub-procedure: asking for and reading your input
769"
770{
771  module B,C;
772  matrix D;
773  int flag;
774  if (size(#)>0) { D=#[1];flag=1;}
775  int t1 = ncols(A);
776  ">>Do you want all deformations? (ENTER=yes)";
777  string str = read("");
778  if ((size(str)>1) and (str<>"yes"))
779  { ">> Choose columns of the matrix";
780    ">> (Enter = all columns)";
781    "INPUT (number of columns to use as integer-list 'i_1,i_2,.. ,i_t' ):";
782    string columnes = read("");
783
784// improved: CL
785// ==========================================================
786// old:   if (size(columnes)<2) {columnes=string(col_vec);}
787//        t1 = size(columnes)/2;
788// new:
789    if (columnes=="")
790    {
791      intvec vvvv=1..ncols(A);
792    }
793    else
794    {
795      execute("intvec vvvv="+columnes);
796    }
797    t1=size(vvvv);
798// ==========================================================
799
800    int l,l1;
801    for (l=1;l<=t1;l=l+1)
802    {
803      l1=vvvv[l];
804      B[l] = A[l1];
805      if(flag) { C[l]=D[l1];}
806    }
807    A = matrix(B,nrows(A),ncols(B));
808    D = matrix(C,nrows(D),ncols(C));
809  }
810  return(A,D,t1);
811}
812///////////////////////////////////////////////////////////////////////////////
813proc negative_part(intvec iv)
814"
815RETURNS intvec of indices of jv having negative entries (or iv, if non)
816"
817{
818   intvec jv;
819   int    l,k;
820   for (l=1;l<=size(iv);l=l+1)
821   { if (iv[l]<0)
822     {  k = k+1;
823        jv[k]=l;
824     }
825   }
826   if (jv==0) {jv=1; dbprint(printlevel-1,"// empty negative part, return all ");}
827   return(jv);
828}
829///////////////////////////////////////////////////////////////////////////////
830proc find_ord(matrix A, intvec w_vec)
831"
832Sub-proc: return martix ord(a_ij) with respect to weight_vec, or
833          0 if A non-qh
834"
835{
836  int @r = nrows(A);
837  int @c = ncols(A);
838  int i,j;
839  def br = basering;
840  def nr=changeord(list(list("wp",w_vec)));
841  setring nr;
842  matrix A    = imap(br,A);
843  intmat degA[@r][@c];
844  if (homog(ideal(A)))
845  { for (i=1;i<=@r;i=i+1)
846    { for(j=1;j<=@c;j=j+1)
847      {  degA[i,j]=ord(A[i,j]); }
848    }
849  }
850  setring br;
851  if (defined(nr)) { kill nr; }
852  return(degA);
853}
854///////////////////////////////////////////////////////////////////////////////
855proc homog_test(intvec w_vec, matrix Mo, matrix A)
856"
857Sub proc: return relative weight string of columns of A with respect
858          to the given w_vec and to Mo, or \"\" if not qh
859    NOTE: * means weight is not determined
860"
861{
862  int k,l;
863  intvec tv;
864  string @nv;
865  int @r = nrows(A);
866  int @c = ncols(A);
867  A = concat(matrix(ideal(Mo),@r,1),A);
868  intmat a = find_ord(A,w_vec);
869  intmat b[@r][@c];
870  for (l=1;l<=@c;l=l+1)
871  {
872    for (k=1;k<=@r;k=k+1)
873    {  if (A[k,l+1]!=0)
874       { b[k,l] = a[k,l+1]-a[k,1];}
875    }
876    tv = 0;
877    for (k=1;k<=@r;k=k+1)
878    {  if (A[k,l+1]*A[k,1]!=0)
879       {tv = tv,b[k,l];}
880    }
881    if (size(tv)>1)
882    { k = tv[2];
883      tv = tv[2..size(tv)];
884      tv = tv -k;
885      if (tv==0) { @nv = @nv+string(-k)+",";}
886      else {return("");}
887    }
888    else { @nv = @nv+"*,";}
889  }
890  @nv = @nv[1..size(@nv)-1];
891  return(@nv);
892}
893///////////////////////////////////////////////////////////////////////////////
894proc homog_t(intvec d_vec, matrix Fo, matrix A)
895"
896Sub-procedure: Computing relative (with respect to flatten(Fo)) weight_vec
897               of columns of A (return zero if Fo or A not qh)
898"
899{
900   Fo = matrix(Fo,nrows(A),1);
901   A  = concat(Fo,A);
902   A  = transpose(A);
903   def br = basering;
904   def nr=changeord(list(list("wp",d_vec)));
905   setring nr;
906   module A = fetch(br,A);
907   intvec dv;
908   int l = homog(A) ;
909   if (l==0)
910   {
911     setring br;
912     kill Top::nr;
913     if (defined(nr)) { kill nr; }
914     return(l);
915   }
916   dv = attrib(A,"isHomog");
917   l  = dv[1];
918   dv = dv[2..size(dv)];
919   dv = dv-l;
920 setring br;
921   kill Top::nr;
922   if (defined(nr)) { kill nr; }
923   return(dv);
924}
925///////////////////////////////////////////////////////////////////////////////
Note: See TracBrowser for help on using the repository browser.