source: git/Singular/LIB/nchomolog.lib @ 2c957af

fieker-DuValspielwiese
Last change on this file since 2c957af was 1992ae, checked in by Hans Schönemann <hannes@…>, 19 years ago
*hannes: involution.lib -> involut.lib git-svn-id: file:///usr/local/Singular/svn/trunk@8342 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 10.2 KB
Line 
1version="$Id: nchomolog.lib,v 1.3 2005-06-07 10:24:46 Singular Exp $";
2category="Noncommutative";
3info="
4LIBRARY:  nchomolog.lib   Procedures for Noncommutative Homological Algebra
5AUTHORS:  Viktor Levandovskyy  levandov@mathematik.uni-kl.de,
6Gerhard Pfister, pfister@mathematik.uni-kl.de
7
8PROCEDURES:
9 ncExt_R(k,M);            Ext^k(M',R),    M module, R basering, M'=coker(M)
10 ncExt(k,M,N);            Ext^k(M',N'),   M,N modules, M'=coker(M), N'=coker(N)
11 ncHom(M,N);              Hom(M',N'),     M,N modules, M'=coker(M), N'=coker(N)
12 coHom(A,k);            Hom(R^k,A),     A matrix over basering R
13 contraHom(A,k);        Hom(A,R^k),     A matrix over basering R
14 tensorMaps(M,N);       tensor product of  matrices
15 ncTensorMod(M,N);        Tensor product of modules M'=coker(M), N'=coker(N)
16 ncTor(k,M,N);            Tor_k(M',N'),   M,N modules, M'=coker(M), N'=coker(N)
17";
18
19LIB "gkdim.lib";
20LIB "involut.lib";
21
22proc contraHom(matrix M, int s)
23{
24   int n,m=ncols(M),nrows(M);
25   int a,b,c;
26   matrix R[s*n][s*m];
27   for(b=1; b<=m; b++)
28   {
29      for(a=1; a<=s; a++)
30      {
31         for(c=1; c<=n; c++)
32         {
33            R[(a-1)*n+c,(a-1)*m+b] = M[b,c];
34         }
35      }
36   }
37   return(R);
38}
39example
40{ "EXAMPLE:"; echo = 2;
41  ring A=0,(x,y,z),dp;
42  matrix M[3][3]=1,2,3,
43               4,5,6,
44               7,8,9;
45  module cM = contraHom(M,2);
46  print(cM);
47}
48
49proc coHom(matrix M, int s)
50{
51   int n,m=ncols(M),nrows(M);
52   int a,b,c;
53   matrix R[s*m][s*n];
54   for(b=1; b<=s; b++)
55   {
56      for(a=1; a<=m; a++)
57      {
58         for(c=1; c<=n; c++)
59         {
60            R[(a-1)*s+b,(c-1)*s+b] = M[a,c];
61         }
62      }
63   }
64   return(R);
65}
66example
67{ "EXAMPLE:"; echo = 2;
68  ring A=0,(x,y,z),dp;
69  matrix M[3][3]=1,2,3,
70                 4,5,6,
71                 7,8,9;
72  module cM = coHom(M,2);
73  print(cM);
74}
75
76proc ncHom(matrix M, matrix N)
77"USAGE:   ncHom(M,N);  M,N modules
78COMPUTE: A presentation of Hom(M',N'), M'=coker(M), N'=coker(N)
79ASSUME: M' is a left module, N' is a centralizing bimodule
80NOTE: ncHom(M,N) is a right module, hence a right presentation matrix
81is returned
82EXAMPLE: example ncHom;  shows examples
83"
84{
85  // assume: M is left module
86  // assume: N is centralizing bimodule
87  // returns a right presentation matrix
88  // for a right module
89  matrix F  = contraHom(M,nrows(N));
90  matrix B  = coHom(N,ncols(M));
91  matrix C  = coHom(N,nrows(M));
92  def Rbase = basering;
93  def Rop   = opposite(Rbase);
94  setring Rop;
95  matrix Bop = oppose(Rbase, B);
96  matrix Cop = oppose(Rbase, C);
97  matrix Fop = oppose(Rbase, F);
98  matrix Dop = modulo(Fop, Bop);
99  matrix Eop = modulo(Dop, Cop);
100  setring Rbase;
101  matrix E   = oppose(Rop, Eop);
102  kill Rop;
103  return(E);
104}
105example
106{ "EXAMPLE:"; echo = 2;
107  ring A=0,(x,y,z),dp;
108  matrix M[3][3]=1,2,3,
109                 4,5,6,
110                 7,8,9;
111  matrix N[2][2]=x,y,
112                 z,0;
113  module H = ncHom(M,N);
114  print(H);
115}
116
117proc ncExt(int i, matrix Ps, matrix Ph)
118"USAGE:   Ext(i,M,N);  i int, M,N modules
119COMPUTE: A presentation of Ext^i(M',N');  for M'=coker(M) and N'=coker(N).
120NOTE: ncExt(M,N) is a right module, hence a right presentation matrix
121is returned
122EXAMPLE: example ncExt;  shows examples
123"
124{
125  if(i==0) { return(module(ncHom(Ps,Ph))); }
126  list Phi   = mres(Ps,i+1);
127  module Im  = coHom(Ph,ncols(Phi[i+1]));
128  module f   = contraHom(matrix(Phi[i+1]),nrows(Ph));
129  module Im1 = coHom(Ph,ncols(Phi[i]));
130  module Im2 = contraHom(matrix(Phi[i]),nrows(Ph));
131  def Rbase = basering;
132  def Rop   = opposite(Rbase);
133  setring Rop;
134  module fop    = oppose(Rbase,f);
135  module Imop   = oppose(Rbase,Im);
136  module Im1op  = oppose(Rbase,Im1);
137  module Im2op  = oppose(Rbase,Im2);
138  module ker_op = modulo(fop,Imop);
139  module ext_op = modulo(ker_op,Im1op+Im2op);
140  //  ext        = prune(ext);
141 // to be discussed and done prune_from_the_left
142  setring Rbase;
143  module ext = oppose(Rop,ext_op);
144  kill Rop;
145  return(ext);
146}
147example
148{ "EXAMPLE:"; echo = 2;
149  ring R     = 0,(x,y),dp;
150  ideal I    = x2-y3;
151  qring S    = std(I);
152  module M   = [-x,y],[-y2,x];
153  module E1  = ncExt(1,M,M);
154  E1;
155}
156
157
158proc ncExt_R(int i, matrix Ps)
159"USAGE:   ncExt_R(i, M);  i int, M module
160COMPUTE:  a presentation of Ext^i(M',R); for M'=coker(M).
161RETURN:   right module Ext, a presentation of Ext^i(M',R)
162EXAMPLE: example ncExt_R; shows an example
163"
164{
165  if (i==0)
166  { // return the formal adjoint (== the dual)
167    matrix Ret = transpose(Ps);
168    def Rbase = basering;
169    def Rop   = opposite(Rbase);
170    setring Rop;
171    module Retop = oppose(Rbase,Ret);
172    //    "Computing prune of Hom";
173    //    Retop = prune(Retop);
174    //    Retop = std(Retop);
175    setring Rbase;
176    Ret = oppose(Rop, Retop);
177    kill Rop;
178    return(Ret);
179  }
180  list Phi   = mres(Ps,i+1);
181  module f   = transpose(matrix(Phi[i+1]));
182  module Im2 = transpose(matrix(Phi[i]));
183  def Rbase = basering;
184  def Rop   = opposite(Rbase);
185  setring Rop;
186  module fop    = oppose(Rbase,f);
187  module Im2op  = oppose(Rbase,Im2);
188  module ker_op = modulo(fop,std(0));
189  module ext_op = modulo(ker_op,Im2op);
190  //  ext        = prune(ext);
191  // to be discussed and done prune_from_the_left
192  // necessary: compute SB!
193  // "Computing SB of Ext";
194  option(redSB);
195  option(redTail);
196  ext_op = std(ext_op);
197  int dimop = GKdim(ext_op);
198  printf("Ext has dimension %s",dimop);
199  if (dimop==0)
200  {
201      printf("of K-dimension %s",vdim(ext_op));
202  }
203  setring Rbase;
204  module ext = oppose(Rop,ext_op); // a right module!
205  kill Rop;
206  return(ext);
207}
208example
209{ "EXAMPLE:"; echo = 2;
210  ring R     = 0,(x,y),dp;
211  ideal I    = x2-y3;
212  qring S    = std(I);
213  module M   = [-x,y],[-y2,x];
214  module E1  = ncExt(1,M,M);
215  E1;
216}
217
218proc altExt_R(int i, matrix Ps, map Invo)
219  // TODO!!!!!!!!
220  // matrix Ph
221  // work thru Involutions;
222{
223  if(i==0)
224  { // return the formal adjoint
225    matrix Ret   = transpose(Ps);
226    matrix Retop = involution(Ret, Invo);
227    //    "Computing prune of Hom";
228    //    Retop = prune(Retop);
229    //    Retop = std(Retop);
230    return(Retop);
231  }
232  list Phi   = mres(Ps,i+1);
233  //  module Im  = coHom(Ph,ncols(Phi[i+1]));
234  module f   = transpose(matrix(Phi[i+1]));
235  f = involution(f, Invo);
236  //= contraHom(matrix(Phi[i+1]),nrows(Ph));
237  //  module Im1 = coHom(Ph,ncols(Phi[i]));
238  module Im2 = transpose(matrix(Phi[i]));
239  Im2 = involution(Im2, Invo);
240  //contraHom(matrix(Phi[i]),nrows(Ph));
241  module ker_op = modulo(f,std(0));
242  module ext_op = modulo(ker_op,Im2);
243  //  ext        = prune(ext);
244 // to be discussed and done prune_from_the_left
245  // optionally: compute SB!
246  //  "Computing prune of Ext";
247  ext_op = std(ext_op);
248  int dimop = GKdim(ext_op);
249  printf("Ext has dimension %s",dimop);
250  if (dimop==0)
251  {
252      printf("of K-dimension %s",vdim(ext_op));
253  }
254  module ext = involution(ext_op, Invo); // what about transpose?
255  return(ext);
256}
257example
258{ "EXAMPLE:"; echo = 2;
259  ring R     = 0,(x,y),dp;
260  ideal I    = x2-y3;
261  qring S    = std(I);
262  module M   = [-x,y],[-y2,x];
263  module E1  = ncExt(1,M,M);
264  E1;
265}
266
267proc tensorMaps(matrix M, matrix N)
268{
269   int r = ncols(M);
270   int s = nrows(M);
271   int p = ncols(N);
272   int q = nrows(N);
273   int a,b,c,d;
274   matrix R[s*q][r*p];
275   for(b=1;b<=p;b++)
276   {
277      for(d=1;d<=q;d++)
278      {
279         for(a=1;a<=r;a++)
280         {
281            for(c=1;c<=s;c++)
282            {
283               R[(c-1)*q+d,(a-1)*p+b]=M[c,a]*N[d,b];
284            }
285         }
286      }
287   }
288   return(R);
289}
290
291proc ncTensorMod(matrix Phi, matrix Psi)
292{
293   int s=nrows(Phi);
294   int q=nrows(Psi);
295   matrix A=tensorMaps(unitmat(s),Psi);  //I_s tensor Psi
296   matrix B=tensorMaps(Phi,unitmat(q));  //Phi tensor I_q
297   matrix R=concat(A,B);                 //sum of A and B
298   return(R);
299}
300
301
302proc ncTor(int i, matrix Ps, matrix Ph)
303{
304  if(i==0) { return(module(ncTensorMod(Ps,Ph))); }
305                               // the tensor product
306  list Phi   = mres(Ph,i+1);     // a resolution of Ph
307  module Im  = tensorMaps(unitmat(nrows(Phi[i])),Ps);
308  module f   = tensorMaps(matrix(Phi[i]),unitmat(nrows(Ps)));
309  module Im1 = tensorMaps(unitmat(ncols(Phi[i])),Ps);
310  module Im2 = tensorMaps(matrix(Phi[i+1]),unitmat(nrows(Ps)));
311  module ker = modulo(f,Im);
312  module tor = modulo(ker,Im1+Im2);
313  //  tor        = prune(tor);
314  return(tor);
315}
316
317proc Hochschild()
318{
319  ring A    = 0,(x,y),dp;
320  ideal I   = x2-y3;
321  qring B   = std(I);
322  module M  = [-x,y],[-y2,x];
323  ring C    = 0,(x,y,z,w),dp; // x->z, y->w
324  ideal I   = x2-y3,z3-w2;
325  qring Be  = std(I);   //the enveloping algebra
326  matrix AA[1][2]  = x-z,y-w;  //the presentation of the algebra B as Be-module
327  module MM = imap(B,M);
328  module E = ncExt(1,AA,MM);
329  print(E);  //the presentation of the H^1(A,M)
330
331
332ring A          = 0,(x,y),dp;
333ideal I         = x2-y3;
334qring B         = std(I);
335ring C          = 0,(x,y,z,w),dp;
336ideal I         = x2-y3,z3-w2;
337qring Be        = std(I);   //the enveloping algebra
338matrix AA[1][2] = x-z,y-w;  //the presentation of B as Be-module
339matrix AAA[1][2] = z,w; // equivalent? pres. of B
340print(ncExt(1,AA,AA));  //the presentation of the H^1(A,A)
341print(ncExt(1,AAA,AAA));
342}
343
344proc Lie()
345{
346// consider U(sl2)* U(sl2)^opp;
347LIB "ncalg.lib";
348ring A = 0,(e,f,h,H,F,E),Dp; // any degree ordering
349int N = 6; // nvars(A);
350matrix @D[N][N];
351@D[1,2] = -h;
352@D[1,3] = 2*e;
353@D[2,3] = -2*f;
354@D[4,5] = 2*F;
355@D[4,6] = -2*E;
356@D[5,6] = H;
357ncalgebra(1,@D);
358ideal Q = E,F,H;
359poly Z = 4*e*f+h^2-2*h; // center
360poly Zo = 4*F*E+H^2+2*H;  // center opposed
361ideal Qe = Z,Zo;
362//qring B = twostd(Qe);
363//ideal T = e-E,f-F,h-H;
364//ideal T2 = e-H,f-F,h-E;
365//Q = twostd(Q); // U is U(sl2) as left U(sl2)* U(sl2)^opp -- module
366matrix M[1][3] = E,F,H;
367module X0 = ncExt(0,M,M);
368print(X0);
369
370module X1 = ncExt(1,M,M);
371print(X1);
372module X2 = ncExt(2,M,M); // equal to Tor^Z_1(K,K)
373print(X2);
374
375
376// compute  Tor^Z_1(K,K)
377
378ring r = 0,(z),dp;
379ideal i = z;
380matrix I[1][1]=z;
381Tor(1,I,I);
382}
383
384
385proc AllExts(module N, list #)
386  // computes and shows everything
387  // assumes we are in the opposite
388  // and N is dual of some M
389  // if # is given, map Invo and Ext_Invo are used
390{
391  int UseInvo = 0;
392  int sl = size(#);
393  if (sl >0)
394  {
395    ideal I = ideal(#[1]);
396    map Invo = basering, I;
397    UseInvo  = 1;
398    "Using the involution";
399  }
400  int nv = nvars(basering);
401  int i,d;
402  module E;
403  list EE;
404  print("--- module:"); print(matrix(N));
405  for (i=1; i<=nv; i++)
406  {
407    if (UseInvo)
408    {
409      E = altExt_R(i,N,Invo);
410    }
411    else
412    {
413      E = ncExt_R(i,N);
414    }
415    printf("--- Ext %s",i);
416    print(matrix(E));
417    EE[i] = E;
418  }
419  //  return(E);
420}
Note: See TracBrowser for help on using the repository browser.