source: git/Singular/LIB/nchomolog.lib @ 1b2216

spielwiese
Last change on this file since 1b2216 was 1e1ec4, checked in by Oleksandr Motsak <motsak@…>, 11 years ago
Updated LIBs according to master add: new LIBs from master fix: updated LIBs due to minpoly/(de)numerator changes fix: -> $Id$ fix: Fixing wrong rebase of SW on master (LIBs)
  • Property mode set to 100644
File size: 20.4 KB
Line 
1/////////////////////////////////////////////////////////////////////////////
2version="$Id$";
3category="Noncommutative";
4info="
5LIBRARY:  nchomolog.lib   Procedures for Noncommutative Homological Algebra
6AUTHORS:  Viktor Levandovskyy  levandov@math.rwth-aachen.de,
7@*        Christian Schilli, christian.schilli@rwth-aachen.de,
8@*        Gerhard Pfister, pfister@mathematik.uni-kl.de
9
10OVERVIEW: In this library we present tools of homological algebra for
11finitely presented modules over GR-algebras.
12
13PROCEDURES:
14 ncExt_R(k,M);      computes presentation of Ext^k(M',R), M module, R basering, M'=coker(M)
15 ncHom(M,N);        computes presentation of Hom(M',N'), M,N modules, M'=coker(M), N'=coker(N)
16 coHom(A,k);        computes presentation of Hom(R^k,A), A matrix over basering R
17 contraHom(A,k);    computes presentation of Hom(A,R^k),     A matrix over basering R
18 dmodoublext(M, l); computes presentation of Ext_D^i(Ext_D^i(M,D),D), where D is a basering
19 is_cenBimodule(M); checks whether a module presented by M is Artin-centralizing
20 is_cenSubbimodule(M); checks whether a subbimodule M is Artin-centralizing
21";
22
23LIB "dmod.lib";
24LIB "gkdim.lib";
25LIB "involut.lib";
26LIB "nctools.lib";
27LIB "ncalg.lib";
28LIB "central.lib";
29
30//  ncExt(k,M,N);            Ext^k(M',N'),   M,N modules, M'=coker(M), N'=coker(N)
31//  ncTensorMod(M,N);        Tensor product of modules M'=coker(M), N'=coker(N)
32//  ncTor(k,M,N);            Tor_k(M',N'),   M,N modules, M'=coker(M), N'=coker(N)
33//  tensorMaps(M,N);       tensor product of  matrices
34
35
36/* LOG:
375.12.2012, VL: cleanup, is_cenSubbimodule and is_cenBimodule are added for assume checks;
38added doc for contraHom and coHom; assume check for ncHom etc.
39 */
40
41/* TODO:
42add noncomm examples to important precedures ncHom,
43 */
44
45proc contraHom(matrix M, int s)
46"USAGE:  contraHom(A,k); A matrix, k int
47RETURN:  matrix
48PURPOSE: compute the matrix of a homomorphism Hom(A,R^k), where R is the basering. Let A be a matrix defining a map F1-->F2 of free R-modules, then the matrix of Hom(F2,R^k)-->Hom(F1,R^k) is computed.
49NOTE: if A is matrix of a left (resp. right) R-module homomorphism, then Hom(A,R^k) is a right (resp. left) R-module R-module homomorphism
50EXAMPLE: example contraHom; shows an example.
51SEE ALSO:
52"
53{
54  // also possible: compute with kontrahom from homolog_lib
55  // and warn that the module changes its side
56   int n,m=ncols(M),nrows(M);
57   int a,b,c;
58   matrix R[s*n][s*m];
59   for(b=1; b<=m; b++)
60   {
61      for(a=1; a<=s; a++)
62      {
63         for(c=1; c<=n; c++)
64         {
65            R[(a-1)*n+c,(a-1)*m+b] = M[b,c];
66         }
67      }
68   }
69   return(R);
70}
71example
72{ "EXAMPLE:"; echo = 2;
73  ring A=0,(x,y,z),dp;
74  matrix M[3][3]=1,2,3,
75               4,5,6,
76               7,8,9;
77  module cM = contraHom(M,2);
78  print(cM);
79}
80
81proc coHom(matrix M, int s)
82"USAGE:  coHom(A,k); A matrix, k int
83PURPOSE: compute the matrix of a homomorphism Hom(R^k,A), where R is the basering. Let A be a matrix defining a map F1-->F2 of free R-modules, then the matrix of Hom(R^k,F1)-->Hom(R^k,F2) is computed.
84NOTE: Both A and Hom(A,R^k) are matrices for either left or right R-module homomorphisms
85EXAMPLE: example coHom; shows an example.
86"
87{
88   int n,m=ncols(M),nrows(M);
89   int a,b,c;
90   matrix R[s*m][s*n];
91   for(b=1; b<=s; b++)
92   {
93      for(a=1; a<=m; a++)
94      {
95         for(c=1; c<=n; c++)
96         {
97            R[(a-1)*s+b,(c-1)*s+b] = M[a,c];
98         }
99      }
100   }
101   return(R);
102}
103example
104{ "EXAMPLE:"; echo = 2;
105  ring A=0,(x,y,z),dp;
106  matrix M[3][3]=1,2,3,
107                 4,5,6,
108                 7,8,9;
109  module cM = coHom(M,2);
110  print(cM);
111}
112
113
114proc ncHom(matrix M, matrix N)
115"USAGE:   ncHom(M,N);  M,N modules
116COMPUTE: A presentation of Hom(M',N'), M'=coker(M), N'=coker(N)
117ASSUME: M' is a left module, N' is a centralizing bimodule
118NOTE: ncHom(M,N) is a right module, hence a right presentation matrix
119is returned
120EXAMPLE: example ncHom; shows examples
121"
122{
123  // assume: M is left module; nothing to check
124  // assume: N is centralizing bimodule: to check
125  if ( !is_cenBimodule(N) )
126  {
127    ERROR("Second module in not centralizing.");
128  }
129  // returns a right presentation matrix (for a right module)
130  matrix F  = contraHom(M,nrows(N));
131  matrix B  = coHom(N,ncols(M));
132  matrix C  = coHom(N,nrows(M));
133  def Rbase = basering;
134  def Rop   = opposite(Rbase);
135  setring Rop;
136  matrix Bop = oppose(Rbase, B);
137  matrix Cop = oppose(Rbase, C);
138  matrix Fop = oppose(Rbase, F);
139  matrix Dop = modulo(Fop, Bop);
140  matrix Eop = modulo(Dop, Cop);
141  setring Rbase;
142  matrix E   = oppose(Rop, Eop);
143  kill Rop;
144  return(E);
145}
146example
147{ "EXAMPLE:"; echo = 2;
148  ring A=0,(x,y,z),dp;
149  matrix M[3][3]=1,2,3,
150                 4,5,6,
151                 7,8,9;
152  matrix N[2][2]=x,y,
153                 z,0;
154  module H = ncHom(M,N);
155  print(H);
156}
157
158proc ncHom_alt(matrix M, matrix N)
159{
160  // shorter but potentially slower
161  matrix F = contraHom(M,nrows(N)); // \varphi^*
162  matrix B = coHom(N,ncols(M));     // i
163  matrix C = coHom(N,nrows(M));     // j
164  matrix D = rightModulo(F,B);      // D
165  matrix E = rightModulo(D,C);      // Hom(M,N)
166  return(E);
167}
168example
169{ "EXAMPLE:"; echo = 2;
170  ring A=0,(x,y,z),dp;
171  matrix M[3][3]=1,2,3,
172                 4,5,6,
173                 7,8,9;
174  matrix N[2][2]=x,y,
175                 z,0;
176  module H = ncHom_alt(M,N);
177  print(H);
178}
179
180proc ncHom_R(matrix M)
181"USAGE:   ncHom_R(M);  M a module
182COMPUTE: A presentation of Hom_R(M',R), M'=coker(M)
183ASSUME: M' is a left module
184NOTE: ncHom_R(M) is a right module, hence a right presentation matrix is returned
185EXAMPLE: example ncHom_R;  shows examples
186"
187{
188  // assume: M is left module
189  // returns a right presentation matrix
190  // for a right module
191  matrix F  = transpose(M);
192  def Rbase = basering;
193  def Rop   = opposite(Rbase);
194  setring Rop;
195  matrix Fop = oppose(Rbase, F);
196  matrix Dop = modulo(Fop, std(0)); //ker Hom(A^n,A) -> Hom(A^m,A)
197  matrix Eop = modulo(Dop, std(0)); // its presentation
198  setring Rbase;
199  matrix E   = oppose(Rop, Eop);
200  kill Rop;
201  return(E);
202}
203example
204{ "EXAMPLE:"; echo = 2;
205  ring A=0,(x,t,dx,dt),dp;
206  def W = Weyl(); setring W;
207  matrix M[2][2] =
208    dt,  dx,
209    t*dx,x*dt;
210  module H = ncHom_R(M);
211  print(H);
212  matrix N[2][1] = x,dx;
213  H = ncHom_R(N);
214  print(H);
215}
216
217
218proc is_cenBimodule(module M)
219"USAGE: is_cenBimodule(M);  M module
220COMPUTE: 1, if a module, presented by M can be centralizing in the sense of Artin and 0 otherwise
221NOTE: only one condition for centralizing factor module can be checked algorithmically
222EXAMPLE: example is_cenBimodule;  shows examples
223"
224{
225  // define in a ring R, for a module R: cen(M) ={ m in M: mr = rm for all r in R}
226  // according to the definition, M is a centralizing bimodule <=> M is generated by cen(M)
227  // if basering R is a G-algebra, then prop 6.4 of BGV indicates it's enough to provide
228  // commutation of elements of M with the generators x_i of R
229  // prop 6.4 verbatim generalizes to  R = R'/I for a twosided I.
230  // is M generates submodule, see the proc is_cenSubbimodule
231  // let M be a presentation matrix for P=R*/R*M, then [e_i + M]x_j=x_j[e_i+M]
232  // <=> Mx_j - x_jM in M must hold; thus forall j: Mx_j in M; thus M has to be
233  // closed from the right, that is to be a two-sided submodule indeed
234  // the rest of checks are complicated by now, so do the check only
235  // *the algorithm *//
236  if (isCommutative() ) { return(int(1));}
237  int n = nvars(basering);
238  int ans = 0;
239  int i,j;
240  vector P;
241  module N;
242  if ( attrib(M,"isSB") != 1)
243  {
244    N = std(M);
245  }
246  else
247  {
248    N = M;
249  }
250  // N is std(M) now
251  for(i=1; i<=ncols(M); i++)
252  {
253    P = M[i];
254    if (P!=0)
255    {
256      for(j=1; j<=n; j++)
257      {
258        if ( NF(P*var(j) - var(j)*P, N) != 0)
259        {
260          return(ans);
261        }
262      }
263    }
264  }
265  ans = 1;
266  return(ans);
267}
268example
269{ "EXAMPLE:"; echo = 2;
270  def A = makeUsl2(); setring A;
271  poly p = 4*e*f + h^2-2*h; // generator of the center
272  matrix M[2][2] = p, p^2-7,0,p*(p+1);
273  is_cenBimodule(M); // M is centralizing
274  matrix N[2][2] = p, e*f,h,p*(p+1);
275  is_cenBimodule(N); // N is not centralizing
276}
277
278proc is_cenSubbimodule(module M)
279"USAGE: is_cenSubbimodule(M); M module
280COMPUTE: 1, if a subbimodule, generated by the columns of M is
281centralizing in the sense of Artin and 0 otherwise
282EXAMPLE: example is_cenSubbimodule;  shows examples
283"
284{
285  // note: M in R^m is centralizing subbimodule iff it is generated by vectors,
286  // each nonconstant component of which is central; 2 check: every entry of the
287  // matrix M is central
288  if (isCommutative()) { return(int(1));}
289  return( inCenter(ideal(matrix(M))) );
290}
291example
292{ "EXAMPLE:"; echo = 2;
293  def A = makeUsl2(); setring A;
294  poly p = 4*e*f + h^2-2*h; // generator of the center
295  matrix M[2][2] = p, p^2-7,0,p*(p+1);
296  is_cenSubbimodule(M); // M is centralizing subbimodule
297  matrix N[2][2] = p, e*f,h,p*(p+1);
298  is_cenSubbimodule(N); // N is not centralizing subbimodule
299}
300
301
302proc ncExt(int i, matrix Ps, matrix Ph)
303"USAGE:   Ext(i,M,N);  i int, M,N matrices
304COMPUTE: A presentation of Ext^i(M',N');  for M'=coker(M) and N'=coker(N).
305ASSUME: M' is a left  module, N' is a centralizing bimodule
306NOTE: ncExt(M,N) is a right module, hence a right presentation matrix
307is returned
308EXAMPLE: example ncExt;  shows examples
309"
310{
311  if ( !is_cenBimodule(Ph) )
312  {
313    ERROR("Second module in not centralizing.");
314  }
315
316  if(i==0) { return(module(ncHom(Ps,Ph))); }
317  list Phi   = mres(Ps,i+1);
318  module Im  = coHom(Ph,ncols(Phi[i+1]));
319  module f   = contraHom(matrix(Phi[i+1]),nrows(Ph));
320  module Im1 = coHom(Ph,ncols(Phi[i]));
321  module Im2 = contraHom(matrix(Phi[i]),nrows(Ph));
322  def Rbase = basering;
323  def Rop   = opposite(Rbase);
324  setring Rop;
325  module fop    = oppose(Rbase,f);
326  module Imop   = oppose(Rbase,Im);
327  module Im1op  = oppose(Rbase,Im1);
328  module Im2op  = oppose(Rbase,Im2);
329  module ker_op = modulo(fop,Imop);
330  module ext_op = modulo(ker_op,Im1op+Im2op);
331  //  ext        = prune(ext);
332 // to be discussed and done prune_from_the_left
333  setring Rbase;
334  module ext = oppose(Rop,ext_op);
335  kill Rop;
336  return(ext);
337}
338example
339{ "EXAMPLE:"; echo = 2;
340  ring R     = 0,(x,y),dp;
341  ideal I    = x2-y3;
342  qring S    = std(I);
343  module M   = [-x,y],[-y2,x];
344  module E1  = ncExt(1,M,M);
345  E1;
346}
347
348proc ncExt_R(int i, matrix Ps)
349"USAGE:   ncExt_R(i, M);  i int, M module
350COMPUTE:  a presentation of Ext^i(M',R); for M'=coker(M).
351RETURN:   right module Ext, a presentation of Ext^i(M',R)
352EXAMPLE: example ncExt_R; shows an example
353"{
354  if (i==0)
355  {
356    return(ncHom_R(Ps)); // the rest is not needed
357  }
358  list Phi   = nres(Ps,i+1); // left resolution
359  module f   = transpose(matrix(Phi[i+1])); // transp. because of Hom_R
360  module Im2 = transpose(matrix(Phi[i]));
361  def Rbase = basering;
362  def Rop   = opposite(Rbase);
363  setring Rop;
364  module fop    = oppose(Rbase,f);
365  module Im2op  = oppose(Rbase,Im2);
366  module ker_op = modulo(fop,std(0));
367  module ext_op = modulo(ker_op,Im2op);
368  //  ext        = prune(ext);
369  // to be discussed and done prune_from_the_left
370  // necessary: compute SB!
371  // "Computing SB of Ext";
372//   option(redSB);
373//   option(redTail);
374//   ext_op = std(ext_op);
375//   int dimop = GKdim(ext_op);
376//   printf("Ext has dimension %s",dimop);
377//   if (dimop==0)
378//   {
379//       printf("of K-dimension %s",vdim(ext_op));
380//   }
381  setring Rbase;
382  module ext = oppose(Rop,ext_op); // a right module!
383  kill Rop;
384  return(ext);
385}
386example
387{ "EXAMPLE:"; echo = 2;
388  ring R     = 0,(x,y),dp;
389  poly F    = x2-y2;
390  def A = annfs(F);  setring A; // A is the 2nd Weyl algebra
391  matrix M[1][size(LD)] = LD; // ideal
392  print(M);
393  print(ncExt_R(1,M)); // hence the Ext^1 is zero
394  module E  = ncExt_R(2,M); // define the right module E
395  print(E); // E is in the opposite algebra
396  def Aop = opposite(A);  setring Aop;
397  module Eop = oppose(A,E);
398  module T1  = ncExt_R(2,Eop);
399  setring A;
400  module T1 = oppose(Aop,T1);
401  print(T1); // this is a left module Ext^2(Ext^2(M,A),A)
402  print(M); // it is known that M holonomic implies Ext^2(Ext^2(M,A),A) iso to M
403}
404
405proc nctors(matrix M)
406{
407  // ext^1_A(adj(M),A)
408  def save = basering;
409  matrix MM = M;  // left
410  def sop = opposite(save);
411  setring sop;
412  matrix MM  = oppose(save,MM); // right
413  MM = transpose(MM); // transposed
414  list Phi = nres(MM,2); // i=1
415  module f   = transpose(matrix(Phi[2])); // transp. because of Hom_R
416  module Im2 = transpose(matrix(Phi[1]));
417  setring save;
418  module fop    = oppose(sop,f);
419  module Im2op  = oppose(sop,Im2);
420  module ker_op = modulo(fop,std(0));
421  module ext_op = modulo(ker_op,Im2op);
422  //  matrix E = ncExt_R(1,MM);
423  //  setring save;
424  //  matrix E = oppose(sop,E);
425  return(ext_op);
426}
427
428proc altExt_R(int i, matrix Ps, map Invo)
429  // TODO!!!!!!!!
430  // matrix Ph
431  // work thru Involutions;
432{
433  if(i==0)
434  { // return the formal adjoint
435    matrix Ret   = transpose(Ps);
436    matrix Retop = involution(Ret, Invo);
437    //    "Computing prune of Hom";
438    //    Retop = prune(Retop);
439    //    Retop = std(Retop);
440    return(Retop);
441  }
442  list Phi   = mres(Ps,i+1);
443  //  module Im  = coHom(Ph,ncols(Phi[i+1]));
444  module f   = transpose(matrix(Phi[i+1]));
445  f = involution(f, Invo);
446  //= contraHom(matrix(Phi[i+1]),nrows(Ph));
447  //  module Im1 = coHom(Ph,ncols(Phi[i]));
448  module Im2 = transpose(matrix(Phi[i]));
449  Im2 = involution(Im2, Invo);
450  //contraHom(matrix(Phi[i]),nrows(Ph));
451  module ker_op = modulo(f,std(0));
452  module ext_op = modulo(ker_op,Im2);
453  //  ext        = prune(ext);
454 // to be discussed and done prune_from_the_left
455  // optionally: compute SB!
456  //  "Computing prune of Ext";
457  ext_op = std(ext_op);
458  int dimop = GKdim(ext_op);
459  printf("Ext has dimension %s",dimop);
460  if (dimop==0)
461  {
462      printf("of K-dimension %s",vdim(ext_op));
463  }
464  module ext = involution(ext_op, Invo); // what about transpose?
465  return(ext);
466}
467example
468{ "EXAMPLE:"; echo = 2;
469  ring R     = 0,(x,y),dp;
470  ideal I    = x2-y3;
471  qring S    = std(I);
472  module M   = [-x,y],[-y2,x];
473  module E1  = ncExt(2,M,M);
474  E1;
475}
476
477proc tensorMaps(matrix M, matrix N)
478{
479   int r = ncols(M);
480   int s = nrows(M);
481   int p = ncols(N);
482   int q = nrows(N);
483   int a,b,c,d;
484   matrix R[s*q][r*p];
485   for(b=1;b<=p;b++)
486   {
487      for(d=1;d<=q;d++)
488      {
489         for(a=1;a<=r;a++)
490         {
491            for(c=1;c<=s;c++)
492            {
493               R[(c-1)*q+d,(a-1)*p+b]=M[c,a]*N[d,b];
494            }
495         }
496      }
497   }
498   return(R);
499}
500
501proc ncTensorMod(matrix Phi, matrix Psi)
502{
503   int s=nrows(Phi);
504   int q=nrows(Psi);
505   matrix A=tensorMaps(unitmat(s),Psi);  //I_s tensor Psi
506   matrix B=tensorMaps(Phi,unitmat(q));  //Phi tensor I_q
507   matrix R=concat(A,B);                 //sum of A and B
508   return(R);
509}
510
511
512proc ncTor(int i, matrix Ps, matrix Ph)
513{
514  if(i==0) { return(module(ncTensorMod(Ps,Ph))); }
515                               // the tensor product
516  list Phi   = mres(Ph,i+1);     // a resolution of Ph
517  module Im  = tensorMaps(unitmat(nrows(Phi[i])),Ps);
518  module f   = tensorMaps(matrix(Phi[i]),unitmat(nrows(Ps)));
519  module Im1 = tensorMaps(unitmat(ncols(Phi[i])),Ps);
520  module Im2 = tensorMaps(matrix(Phi[i+1]),unitmat(nrows(Ps)));
521  module ker = modulo(f,Im);
522  module tor = modulo(ker,Im1+Im2);
523  //  tor        = prune(tor);
524  return(tor);
525}
526
527
528static proc Hochschild()
529{
530  ring A    = 0,(x,y),dp;
531  ideal I   = x2-y3;
532  qring B   = std(I);
533  module M  = [-x,y],[-y2,x];
534  ring C    = 0,(x,y,z,w),dp; // x->z, y->w
535  ideal I   = x2-y3,z3-w2;
536  qring Be  = std(I);   //the enveloping algebra
537  matrix AA[1][2]  = x-z,y-w;  //the presentation of the algebra B as Be-module
538  module MM = imap(B,M);
539  module E = ncExt(1,AA,MM);
540  print(E);  //the presentation of the H^1(A,M)
541
542ring A          = 0,(x,y),dp;
543ideal I         = x2-y3;
544qring B         = std(I);
545ring C          = 0,(x,y,z,w),dp;
546ideal I         = x2-y3,z3-w2;
547qring Be        = std(I);   //the enveloping algebra
548matrix AA[1][2] = x-z,y-w;  //the presentation of B as Be-module
549matrix AAA[1][2] = z,w; // equivalent? pres. of B
550print(ncExt(1,AA,AA));  //the presentation of the H^1(A,A)
551print(ncExt(1,AAA,AAA));
552}
553
554static proc Lie()
555{
556// consider U(sl2)* U(sl2)^opp;
557LIB "ncalg.lib";
558ring A = 0,(e,f,h,H,F,E),Dp; // any degree ordering
559int N = 6; // nvars(A);
560matrix @D[N][N];
561@D[1,2] = -h;
562@D[1,3] = 2*e;
563@D[2,3] = -2*f;
564@D[4,5] = 2*F;
565@D[4,6] = -2*E;
566@D[5,6] = H;
567 def AA = nc_algebra(1,@D); setring AA;
568ideal Q = E,F,H;
569poly Z = 4*e*f+h^2-2*h; // center
570poly Zo = 4*F*E+H^2+2*H;  // center opposed
571ideal Qe = Z,Zo;
572//qring B = twostd(Qe);
573//ideal T = e-E,f-F,h-H;
574//ideal T2 = e-H,f-F,h-E;
575//Q = twostd(Q); // U is U(sl2) as left U(sl2)* U(sl2)^opp -- module
576matrix M[1][3] = E,F,H;
577module X0 = ncExt(0,M,M);
578print(X0);
579
580module X1 = ncExt(1,M,M);
581print(X1);
582module X2 = ncExt(2,M,M); // equal to Tor^Z_1(K,K)
583print(X2);
584
585// compute  Tor^Z_1(K,K)
586ring r = 0,(z),dp;
587ideal i = z;
588matrix I[1][1]=z;
589Tor(1,I,I);
590}
591
592
593proc AllExts(module N, list #)
594  // computes and shows everything
595  // assumes we are in the opposite
596  // and N is dual of some M
597  // if # is given, map Invo and Ext_Invo are used
598{
599  int UseInvo = 0;
600  int sl = size(#);
601  if (sl >0)
602  {
603    ideal I = ideal(#[1]);
604    map Invo = basering, I;
605    UseInvo  = 1;
606    "Using the involution";
607  }
608  int nv = nvars(basering);
609  int i,d;
610  module E;
611  list EE;
612  print("--- module:"); print(matrix(N));
613  for (i=1; i<=nv; i++)
614  {
615    if (UseInvo)
616    {
617      E = altExt_R(i,N,Invo);
618    }
619    else
620    {
621      E = ncExt_R(i,N);
622    }
623    printf("--- Ext %s",i);
624    print(matrix(E));
625    EE[i] = E;
626  }
627  return(E);
628}
629
630proc dmodualtest(module M, int n)
631{
632  // computes the "dual" of the "dual" of a d-mod M
633  // where n is the half-number of vars of Weyl algebra
634  // assumed to be basering
635  // returns the difference between M and Ext^n_D(Ext^n_D(M,D),D)
636  def save = basering;
637  setring save;
638  module Md = ncExt_R(n,M); // right module
639  // would be nice to use "prune"!
640  // NO! prune performs left sided operations!!!
641  //  Md = prune(Md);
642  //  print(Md);
643  def saveop = opposite(save);
644  setring saveop;
645  module Mdop = oppose(save,Md); // left module
646  // here we're eligible to use prune
647  Mdop = prune(Mdop);
648  module Mopd = ncExt_R(n,Mdop); // right module
649  setring save;
650  module M2 = oppose(saveop,Mopd);  // left module
651  M2 = prune(M2); // eligible since M2 is a left mod
652  M2 = groebner(M2);
653  ideal tst = M2 - M;
654  tst = groebner(tst);
655  return(tst);
656}
657example
658{ "EXAMPLE:"; echo = 2;
659  ring R   = 0,(x,y),dp;
660  poly F   = x3-y2;
661  def A    = annfs(F);
662  setring A;
663  dmodualtest(LD,2);
664}
665
666
667proc dmodoublext(module M, list #)
668"USAGE:   dmodoublext(M [,i]);  M module, i optional int
669COMPUTE:  a presentation of Ext^i(Ext^i(M,D),D) for basering D
670RETURN:   left module
671NOTE: by default, i is set to the integer part of the half of number of variables of D
672@* for holonomic modules over Weyl algebra, the double ext is known to be holonomic left module
673EXAMPLE: example dmodoublext; shows an example
674"
675{
676  // assume: basering is a Weyl algebra?
677  def save = basering;
678  setring save;
679  // if a list is nonempty and contains an integer N, n = N; otherwise n = nvars/2
680  int n;
681  if (size(#) > 0)
682  {
683    //    if (typeof(#) == "int")
684    //    {
685      n = int(#[1]);
686      //    }
687//     else
688//     {
689//       ERROR("the optional argument expected to have type int");
690//     }
691  }
692  else
693  {
694    n = nvars(save); n = n div 2;
695  }
696  // returns Ext^i_D(Ext^i_D(M,D),D), that is
697  // computes the "dual" of the "dual" of a d-mod M (for n = nvars/2)
698  module Md = ncExt_R(n,M); // right module
699  // no prune yet!
700  def saveop = opposite(save);
701  setring saveop;
702  module Mdop = oppose(save,Md); // left module
703  // here we're eligible to use prune
704  Mdop = prune(Mdop);
705  module Mopd = ncExt_R(n,Mdop); // right module
706  setring save;
707  module M2 = oppose(saveop,Mopd);  // left module
708  kill saveop;
709  M2 = prune(M2); // eligible since M2 is a left mod
710  def M3;
711  if (nrows(M2)==1)
712  {
713    M3 = ideal(M2);
714  }
715  else
716  {
717    M3 = M2;
718  }
719  M3 = groebner(M3);
720  return(M3);
721}
722example
723{ "EXAMPLE:"; echo = 2;
724  ring R   = 0,(x,y),dp;
725  poly F   = x3-y2;
726  def A    = annfs(F);
727  setring A;
728  dmodoublext(LD);
729  LD;
730  // fancier example:
731  setring A;
732  ideal I = Dx*(x2-y3),Dy*(x2-y3);
733  I = groebner(I);
734  print(dmodoublext(I,1));
735  print(dmodoublext(I,2));
736}
737
738static proc part_Ext_R(matrix M)
739{
740  // if i==0
741    matrix Ret = transpose(Ps);
742    def Rbase = basering;
743    def Rop   = opposite(Rbase);
744    setring Rop;
745    module Retop = oppose(Rbase,Ret);
746    module Hm = modulo(Retop,std(0)); // right kernel of transposed
747    //    "Computing prune of Hom";
748    //    Retop = prune(Retop);
749    //    Retop = std(Retop);
750    setring Rbase;
751    Ret = oppose(Rop, Hm);
752    kill Rop;
753    return(Ret);
754// some checkz:
755//  setring Rbase;
756  // ker_op is the right Kernel of f^t:
757  //  module ker = oppose(Rop,ker_op);
758  //  print(f*ker);
759//  module ext = oppose(Rop,ext_op);
760}
Note: See TracBrowser for help on using the repository browser.