1 | // $Id: homog.lib,v 1.2 1997-04-28 19:27:18 obachman Exp $ |
---|
2 | //(BM 11/95) |
---|
3 | /////////////////////////////////////////////////////////////////////////////// |
---|
4 | LIBRARY: homog.lib homological algebra porcedures |
---|
5 | ext(<int>,<ideal>); Ext^k(R/I,R), I - ideal in basering R |
---|
6 | Ext(<int>,<mod>,<mod>); Ext^k(M,N), M,N modules |
---|
7 | Hom(<mod>,<mod>); Hom(M,N), M,N modules |
---|
8 | cup1(<mod>); cup: Ext^1(M,M) x Ext^1() --> Ext^2() |
---|
9 | kohom(<mat>,<int>); Hom(R^k,mat) |
---|
10 | kontrahom(<mat>,<int>); Hom(mat,R^k) |
---|
11 | |
---|
12 | LIB "matrix.lib"; |
---|
13 | //============================================================================= |
---|
14 | |
---|
15 | proc ext (int k, ideal I, list #) |
---|
16 | |
---|
17 | COMPUTES: Ext^k(P/I,P); I ideal in the basering P |
---|
18 | USAGE: ext(<int>,<id>[,<any>]); |
---|
19 | SHOWS: degree of Ext^k |
---|
20 | RETURN: Ext (as quotient of a free module) |
---|
21 | or (in case of a third parameter) |
---|
22 | a list of two modules |
---|
23 | [1] = module Ext |
---|
24 | [2] = SB of Ext |
---|
25 | { |
---|
26 | //------------ initialisation ------------------------------------------------- |
---|
27 | module m1,m2,ret,ret0; |
---|
28 | |
---|
29 | //----------------- compute resulution of P/I -------------------------------- |
---|
30 | mres(I,k+1,resI); |
---|
31 | //----------------- apply Hom(_,P) at k-th place ----------------------------- |
---|
32 | m2 = transpose(resI(k+1)); |
---|
33 | m1 = transpose(resI(k)); |
---|
34 | //----------------- ker(m2)/im(m1) ------------------------------------------- |
---|
35 | m2 = simplify(m2,10); |
---|
36 | if (m2[1]==0) { ret = m1; } |
---|
37 | else { ret = modulo(syz(m2),m1); } |
---|
38 | ret0 = std(ret); |
---|
39 | "// degree of Ext^"+string(k)+"(P/I,P):";degree(ret0); |
---|
40 | if (size(#)>0) |
---|
41 | { return(ret,ret0); } |
---|
42 | return(ret); |
---|
43 | } |
---|
44 | example |
---|
45 | { |
---|
46 | "EXAMPLE:"; echo=2; |
---|
47 | ring r=0,(x,y,z),(c,dp); |
---|
48 | ideal I = x2y,y2z,z3x; |
---|
49 | module E = ext(1,I); |
---|
50 | E = ext(2,I); |
---|
51 | E = ext(3,I); |
---|
52 | kbase(std(E)); |
---|
53 | E = ext(4,I); |
---|
54 | } |
---|
55 | |
---|
56 | /////////////////////////////////////////////////////////////////////////////// |
---|
57 | proc Ext (int k, module M, module N, list #) |
---|
58 | |
---|
59 | COMPUTES Ext^k(M,N); M,N modules (quotients of a free one) |
---|
60 | USAGE Ext(<int>,<mod>,<mod>); |
---|
61 | SHOWS degree(Ext) |
---|
62 | RETURN Ext (as quotient of a free one) |
---|
63 | or (in case of a 4th parameter) |
---|
64 | a list of modules: |
---|
65 | [1] = Ext |
---|
66 | [2] = SB of Ext |
---|
67 | { |
---|
68 | //---------- initialisation --------------------------------------------------- |
---|
69 | module A,B,C,M1,M2,ker,imag,extMN,extMN0; |
---|
70 | ideal test1,test2; |
---|
71 | //---------- resolution of M and N ------------------------------------------ |
---|
72 | if (k>0) |
---|
73 | { |
---|
74 | mres(M,k+1,resM); |
---|
75 | M1 = resM(k); |
---|
76 | M2 = resM(k+1); |
---|
77 | test1 = simplify(ideal(M1),10); |
---|
78 | test2 = simplify(ideal(N),10); |
---|
79 | if ((test1[1]==0) or (test2[1]==0)) |
---|
80 | { "//Ext(M,N)=0";return(extMN); |
---|
81 | } |
---|
82 | else |
---|
83 | { |
---|
84 | test1 = simplify(ideal(M2),10); |
---|
85 | if (test1[1]==0) //Ker(Hom(m2,N)) |
---|
86 | { ker = freemodule(ncols(M1)*nrows(N)); |
---|
87 | } |
---|
88 | else |
---|
89 | { |
---|
90 | A = kontrahom(M2,nrows(N)); |
---|
91 | B = kohom(N,ncols(M2)); |
---|
92 | C = intersect(A,B); |
---|
93 | C = reduce(C,std(ideal(0)));C=simplify(C,10); |
---|
94 | ker = lift(A,C)+syz(A); |
---|
95 | } |
---|
96 | imag = kohom(N,ncols(M1)); |
---|
97 | A = kontrahom(M1,nrows(N)); |
---|
98 | imag = imag+A; //im(Hom(m1,M)) |
---|
99 | extMN = modulo(ker,imag); |
---|
100 | extMN0= std(extMN); |
---|
101 | "// degree of Ext^"+string(k)+"(M,N):";degree(extMN0); |
---|
102 | } |
---|
103 | } |
---|
104 | else |
---|
105 | { |
---|
106 | extMN,extMN0 = Hom(M,N,1); |
---|
107 | } |
---|
108 | if (size(#)>0) |
---|
109 | { return(extMN,extMN0); } |
---|
110 | return(extMN ); |
---|
111 | } |
---|
112 | example |
---|
113 | { |
---|
114 | "EXAMPLE:"; echo=2; |
---|
115 | ring r=0,(x,y),(c,dp); |
---|
116 | ideal i=x2-y3; |
---|
117 | qring qr=std(i); |
---|
118 | module M=[-x,y],[-y2,x]; |
---|
119 | module EXT1=Ext(1,M,M); |
---|
120 | } |
---|
121 | //////////////////////////////////////////////////////////////////////////////// |
---|
122 | proc Hom (module M, module N, list #) |
---|
123 | |
---|
124 | |
---|
125 | COMPUTES Hom(M,N); M,N modules (quotients of a free one) |
---|
126 | USAGE Hom(M,N); |
---|
127 | SHOWS degree(Hom) |
---|
128 | RETURN Hom(M,N) (as quotient of a free one) |
---|
129 | or (in case of a 3rd parameter) |
---|
130 | a list of modules: |
---|
131 | [1] = Hom |
---|
132 | [2] = SB of Hom |
---|
133 | { |
---|
134 | //---------- initialisation --------------------------------------------------- |
---|
135 | module A,B,C,ker,imag,homMN,homMN0; |
---|
136 | ideal tes; |
---|
137 | tes = simplify(ideal(M),10); |
---|
138 | if (tes[1]==0) |
---|
139 | { |
---|
140 | "// Hom(ring,N)=N"; |
---|
141 | if (size(#)>0) { return(N,std(N)); } |
---|
142 | return(N); |
---|
143 | } |
---|
144 | tes = simplify(ideal(N),10); |
---|
145 | if (tes[1]==0) |
---|
146 | { |
---|
147 | "// Hom(M,ring)=M^*"; |
---|
148 | homMN = transpose(M); |
---|
149 | if (size(#)>0) { return(homMN,std(homMN));} |
---|
150 | return(homMN); |
---|
151 | } |
---|
152 | B = kohom(N,ncols(M)); |
---|
153 | A = kontrahom(M,nrows(N)); |
---|
154 | C = intersect(A,B); |
---|
155 | C = reduce(C,std(ideal(0)));C=simplify(C,10); |
---|
156 | ker = lift(A,C)+syz(A); //ker(Hom(m,N)) |
---|
157 | imag = kohom(N,ncols(M)); //im(Hom(M,n)) |
---|
158 | homMN = modulo(ker,imag); |
---|
159 | homMN0= std(homMN); |
---|
160 | "// degree of Hom(M,N):";degree(homMN0); |
---|
161 | if (size(#)>0) { return(homMN,homMN0); } |
---|
162 | return(homMN); |
---|
163 | } |
---|
164 | example |
---|
165 | { |
---|
166 | "EXAMPLE:"; echo = 2; |
---|
167 | ring r=0,(x,y),(c,dp); |
---|
168 | ideal i=x2-y3; |
---|
169 | qring q=std(i); |
---|
170 | module M=[-x,y],[-y2,x]; |
---|
171 | module hom=Hom(M,M); |
---|
172 | print(hom); |
---|
173 | //----------------- 2nd example ---------------------------------------------- |
---|
174 | ring s=3,(x,y,z),(c,dp); |
---|
175 | ideal i=x2+y5+z4;i=jacob(i); |
---|
176 | qring rq=std(i); |
---|
177 | matrix M[2][2]=xy,x3,5y,z2,x2; |
---|
178 | matrix N[4][4]=x,y,z,x2,xyx2y,y3,xz2,x2z,z3; |
---|
179 | print(M);print(N); |
---|
180 | print(Hom(M,N)); |
---|
181 | "!!!!!!!!!!!!!!!!!!!!!Abweichung von alter lib!?"; |
---|
182 | } |
---|
183 | //////////////////////////////////////////////////////////////////////////////// |
---|
184 | proc qmod (module M, module N) |
---|
185 | |
---|
186 | USAGE: qmod(<module_M>,<module_N>); |
---|
187 | N a submodule of M, a submodule of e free one |
---|
188 | COMPUTE: presentation S of M/N, i.e. M/N<<--F<--[S], |
---|
189 | F free of rank = size(M), |
---|
190 | RETURNS: module S |
---|
191 | { |
---|
192 | return(lift(M,N)+syz(M)); |
---|
193 | } |
---|
194 | ////////////////////////////////////////////////////////////////////////////// |
---|
195 | proc kontrahom (matrix M, int j) |
---|
196 | |
---|
197 | USAGE: kontrahom(<matrix>,<int>; |
---|
198 | COMPUTES: Hom(M,P^j) |
---|
199 | i.e. Let M be a matrix defining a map: F1 --> F2 |
---|
200 | it computes the matrix of the map: Hom(F2,F)-->Hom(F1,F) |
---|
201 | F free of rank j |
---|
202 | RETURN: matrix: Hom(_,F) |
---|
203 | { |
---|
204 | return(transpose(outer(diag(1,j),M))); |
---|
205 | } |
---|
206 | example |
---|
207 | { |
---|
208 | "EXAMPLE:"; echo=2; |
---|
209 | ring r; |
---|
210 | matrix n[2][3]=x,y,5,z,77,33; |
---|
211 | print(kontrahom(n,3)); |
---|
212 | } |
---|
213 | /////////////////////////////////////////////////////////////////////////////// |
---|
214 | proc kohom (matrix M, int j) |
---|
215 | |
---|
216 | USAGE: kohom(<matrix>,<int>) |
---|
217 | COMPUTES: Hom(P^j,M) |
---|
218 | i.e. Let M be a matrix defining a map: F1 --> F2 |
---|
219 | it computes the matrix of the map: Hom(F,F1)-->Hom(F,F2), |
---|
220 | F free ot rank j |
---|
221 | RETURN: matrix: Hom(F,_) |
---|
222 | { |
---|
223 | return(outer(M,diag(1,j))); |
---|
224 | } |
---|
225 | example |
---|
226 | { |
---|
227 | "EXAMPLE:"; echo=2; |
---|
228 | ring r; |
---|
229 | matrix n[2][3]=x,y,5,z,77,33; |
---|
230 | print(kohom(n,3)); |
---|
231 | } |
---|
232 | /////////////////////////////////////////////////////////////////////////////// |
---|
233 | proc cup1 (module M) |
---|
234 | |
---|
235 | USAGE: cup1(<mod>); |
---|
236 | COMPUTES: cup-product |
---|
237 | Ext^1(M,M) x Ext^1(M,M) ---> Ext^2(M,M) |
---|
238 | ASSUME: all Ext's are of finite dimension |
---|
239 | RETURNS: <matrix> of the associated linear map |
---|
240 | { |
---|
241 | //---------- INITIALISTION ---------------------------------------------------- |
---|
242 | int i,j,f0,f1,f2,f3,e1,e2; |
---|
243 | module M1,M2,A,B,C,ker,ima,ext1,ext2,ext10,ext20; |
---|
244 | matrix cup[1][0]; |
---|
245 | matrix kb1,lift1,kb2; |
---|
246 | ideal tes1,tes2,null; |
---|
247 | //----------------------------------------------------------------------------- |
---|
248 | //take a resolution of M<--F(0)<--- ... <---F(3) |
---|
249 | //apply Hom(-,M) and compute the Ext's |
---|
250 | //----------------------------------------------------------------------------- |
---|
251 | mres(M,3,resM); |
---|
252 | M1 = resM(2); |
---|
253 | M2 = resM(3); |
---|
254 | f0 = nrows(M); |
---|
255 | f1 = ncols(M); |
---|
256 | f2 = ncols(M1); |
---|
257 | f3 = ncols(M2); |
---|
258 | tes1 = simplify(ideal(M),10);tes2=simplify(ideal(M1),10); |
---|
259 | if ((tes1[1]==0) or (tes2[1]==0)) |
---|
260 | { |
---|
261 | dbpri(2,"// Ext == 0 , hence 'cup' is zero-map"); |
---|
262 | return(@cup); |
---|
263 | } |
---|
264 | //------ compute Ext^1 -------------------------------------------------------- |
---|
265 | B = kohom(M,f2); |
---|
266 | A = kontrahom(M1,f0); |
---|
267 | C = intersect(A,B); |
---|
268 | C = reduce(C,std(null));C = simplify(C,10); |
---|
269 | ker = lift(A,C)+syz(A); |
---|
270 | ima = kohom(M,f1); |
---|
271 | ima = ima + kontrahom(M,f0); |
---|
272 | ext1 = modulo(ker,ima); |
---|
273 | degree(std(ker));degree(std(ima));pause; |
---|
274 | ext10 = std(ext1); |
---|
275 | e1 = vdim(ext10); |
---|
276 | dbpri(2,"// vdim (Ext^1) = "+string(e1)); |
---|
277 | if (e1 < 0) |
---|
278 | { |
---|
279 | "// Ext^1 not of finite dimension"; |
---|
280 | return(cup); |
---|
281 | } |
---|
282 | kb1 = kbase(ext10); |
---|
283 | kb1 = matrix(ker)*matrix(kb1,ncols(ker),e1); |
---|
284 | dbpri(2,"// kbase of Ext^1:",kb1); |
---|
285 | //------ compute the liftings of Ext^1 ---------------------------------------- |
---|
286 | C = matrix(A)*kb1; |
---|
287 | if (B[1]!=0) { lift1 =lift(B,C); } |
---|
288 | dbpri(2,"// lift kbase of Ext^1:",lift1);pause; |
---|
289 | //------ compute Ext^2 ------------------------------------------------------- |
---|
290 | B = kohom(M,f3); |
---|
291 | A = kontrahom(M2,f0); |
---|
292 | C = intersect(A,B); |
---|
293 | C = reduce(C,std(null));C = simplify(C,10); |
---|
294 | ker = lift(A,C)+syz(A); |
---|
295 | ima = kohom(M,f2); |
---|
296 | ima = ima + kontrahom(M1,f0); |
---|
297 | ext2 = modulo(ker,ima); |
---|
298 | ext20 = std(ext2); |
---|
299 | e2 = vdim(ext20); |
---|
300 | if (e2<0) |
---|
301 | { |
---|
302 | "// Ext^2 not of finite dimension"; |
---|
303 | return(cup); |
---|
304 | } |
---|
305 | kb2 = kbase(ext20); |
---|
306 | kb2 = matrix(ker)*matrix(kb2,ncols(ker),e2); |
---|
307 | dbpri(2,"// kbase of Ext^2:",kb2); |
---|
308 | //------- compute: cup-products of base-elements ----------------------------- |
---|
309 | for (i=1;i<=e1;i=i++) |
---|
310 | { |
---|
311 | for (j=1;j<=e1;j=j++) |
---|
312 | { |
---|
313 | A = matrix(ideal(lift1[j]),f1,f2); |
---|
314 | B = matrix(ideal(kb1[i]),f0,f1); |
---|
315 | C = B*A; "%";pri(A,B,C);pause; |
---|
316 | A = matrix(ideal(C),f0*f2,1); |
---|
317 | cup= concat(cup,A); |
---|
318 | } |
---|
319 | } |
---|
320 | dbpri(2,"// matrix of cup-products (in Ext^2)",cup); |
---|
321 | //------- comptute: presentation of base-elements ----------------------------- |
---|
322 | "##";print(ker);"$$$$##";print(cup);pause; |
---|
323 | cup = lift(ker,cup); |
---|
324 | cup = liftkb(cup,ext20); |
---|
325 | dbpri(2,"// present cups as linear combination of kbase of Ext^2",cup); |
---|
326 | return(cup); |
---|
327 | } |
---|
328 | example |
---|
329 | { |
---|
330 | "EXAMPLE"; echo=2; printlevel=2; |
---|
331 | ring r = 0,(x,y),(dp,C); |
---|
332 | ideal i = x2-y3; |
---|
333 | qring q = std(i); |
---|
334 | module M= [-x,y],[-y2,x]; |
---|
335 | print(M); |
---|
336 | print(cup1(M)); |
---|
337 | pause; |
---|
338 | ring rr = 32003,(x,y,z),(dp,C); |
---|
339 | ideal I = x4+y3+z2; |
---|
340 | qring o = std(I); |
---|
341 | module M= [x,y,0,z],[y2,-x3,z,0],[z,0,-y,-x3],[0,z,x,-y2]; |
---|
342 | print(M); |
---|
343 | print(cup1(M)); |
---|
344 | } |
---|