1 | // $Id: elim.lib,v 1.10 2000-12-19 14:41:42 anne Exp $ |
---|
2 | // (GMG, last modified 22.06.96) |
---|
3 | /////////////////////////////////////////////////////////////////////////////// |
---|
4 | |
---|
5 | version="$Id: elim.lib,v 1.10 2000-12-19 14:41:42 anne Exp $"; |
---|
6 | category="Commutative Algebra"; |
---|
7 | info=" |
---|
8 | LIBRARY: elim.lib PROCEDURES FOR ELIMINATIOM, SATURATION AND BLOWING UP |
---|
9 | |
---|
10 | PROCEDURES: |
---|
11 | blowup0(j[,s1,s2]); create presentation of blownup ring of ideal j |
---|
12 | elim(id,n,m); variable n..m eliminated from id (ideal/module) |
---|
13 | elim1(id,p); p=product of vars to be eliminated from id |
---|
14 | nselect(id,n[,m]); select generators not containing nth [..mth] variable |
---|
15 | sat(id,j); saturated quotient of ideal/module id by ideal j |
---|
16 | select(id,n[,m]); select generators containing all variables n...m |
---|
17 | select1(id,n[,m]); select generators containing one variable n...m |
---|
18 | (parameters in square brackets [] are optional) |
---|
19 | "; |
---|
20 | |
---|
21 | LIB "inout.lib"; |
---|
22 | LIB "general.lib"; |
---|
23 | LIB "poly.lib"; |
---|
24 | /////////////////////////////////////////////////////////////////////////////// |
---|
25 | |
---|
26 | proc blowup0 (ideal j,list #) |
---|
27 | "USAGE: blowup0(j[,s1,s2]); j ideal, s1,s2 nonempty strings |
---|
28 | CREATE: Create a presentation of the blowup ring of j |
---|
29 | RETURN: no return value |
---|
30 | NOTE: s1 and s2 are used to give names to the blownup ring and the blownup |
---|
31 | ideal (default: s1=\"j\", s2=\"A\") |
---|
32 | Assume R = char,x(1..n),ord is the basering of j, and s1=\"j\", s2=\"A\" |
---|
33 | then the procedure creates a new ring with name Bl_jR |
---|
34 | (equal to R[A,B,...]) |
---|
35 | Bl_jR = char,(A,B,...,x(1..n)),(dp(k),ord) |
---|
36 | with k=ncols(j) new variables A,B,... and ordering wp(d1..dk) if j is |
---|
37 | homogeneous with deg(j[i])=di resp. dp otherwise for these vars. |
---|
38 | If k>26 or size(s2)>1, say s2=\"A()\", the new vars are A(1),...,A(k). |
---|
39 | Let j_ be the kernel of the ring map Bl_jR -> R defined by A(i)->j[i], |
---|
40 | x(i)->x(i), then the quotient ring Bl_jR/j_ is the blowup ring of j |
---|
41 | in R (being isomorphic to R+j+j^2+...). Moreover the procedure creates |
---|
42 | a std basis of j_ with name j_ in Bl_jR. |
---|
43 | This proc uses 'execute' or calls a procedure using 'execute'. |
---|
44 | DISPLAY: printlevel >=0: explain created objects (default) |
---|
45 | EXAMPLE: example blowup0; shows examples |
---|
46 | "{ |
---|
47 | string bsr = nameof(basering); |
---|
48 | def br = basering; |
---|
49 | string cr,vr,o = charstr(br),varstr(br),ordstr(br); |
---|
50 | int n,k,i = nvars(br),ncols(j),0; |
---|
51 | int p = printlevel-voice+3; // p=printlevel+1 (default: p=1) |
---|
52 | //---------------- create coordinate ring of blown up space ------------------- |
---|
53 | if( size(#)==0 ) { #[1] = "j"; #[2] = "A"; } |
---|
54 | if( size(#)==1 ) { #[2] = "A"; } |
---|
55 | if( k<=26 and size(#[2])==1 ) { string nv = A_Z(#[2],k)+","; } |
---|
56 | else { string nv = (#[2])[1]+"(1.."+string(k)+"),"; } |
---|
57 | if( is_homog(j) ) |
---|
58 | { |
---|
59 | intvec v=1; |
---|
60 | for( i=1; i<=k; i=i+1) { v[i+1]=deg(j[i]); } |
---|
61 | string nor = "),(wp(v),"; |
---|
62 | } |
---|
63 | else { string nor = "),(dp(1+k),";} |
---|
64 | execute("ring Bl=("+cr+"),(t,"+nv+vr+nor+o+");"); |
---|
65 | //---------- map to new ring, eliminate and create blown up ideal ------------- |
---|
66 | ideal j=imap(br,j); |
---|
67 | for( i=1; i<=k; i=i+1) { j[i]=var(1+i)-t*j[i]; } |
---|
68 | j=eliminate(j,t); |
---|
69 | v=v[2..size(v)]; |
---|
70 | execute("ring Bl_"+#[1]+bsr+"=("+cr+"),("+nv+vr+nor+o+");"); |
---|
71 | ideal `#[1]+"_"`=imap(Bl,j); |
---|
72 | export basering; |
---|
73 | export `#[1]+"_"`; |
---|
74 | //keepring basering; |
---|
75 | setring br; |
---|
76 | //------------------- some comments about usage and names -------------------- |
---|
77 | dbprint(p,"", |
---|
78 | "// The proc created the ring Bl_"+#[1]+bsr+" (equal to "+bsr+"["+nv[1,size(nv)-1]+"])", |
---|
79 | "// it contains the ideal "+#[1]+"_ , such that", |
---|
80 | "// Bl_"+#[1]+bsr+"/"+#[1]+"_ is the blowup ring", |
---|
81 | "// show(Bl_"+#[1]+bsr+"); shows this ring.", |
---|
82 | "// Make Bl_"+#[1]+bsr+" the basering and see "+#[1]+"_ by typing:", |
---|
83 | " setring Bl_"+#[1]+bsr+";"," "+#[1]+"_;"); |
---|
84 | return(); |
---|
85 | } |
---|
86 | example |
---|
87 | { "EXAMPLE:"; echo = 2; |
---|
88 | ring R=0,(x,y),dp; |
---|
89 | poly f=y2+x3; ideal j=jacob(f); |
---|
90 | blowup0(j); |
---|
91 | show(Bl_jR); |
---|
92 | setring Bl_jR; |
---|
93 | j_;""; |
---|
94 | ring r=32003,(x,y,z),ds; |
---|
95 | blowup0(maxideal(1),"m","T()"); |
---|
96 | show(Bl_mr); |
---|
97 | setring Bl_mr; |
---|
98 | m_; |
---|
99 | kill Bl_jR, Bl_mr; |
---|
100 | } |
---|
101 | /////////////////////////////////////////////////////////////////////////////// |
---|
102 | |
---|
103 | proc elim (id, int n, int m) |
---|
104 | "USAGE: elim(id,n,m); id ideal/module, n,m integers |
---|
105 | RETURNS: ideal/module obtained from id by eliminating variables n..m |
---|
106 | NOTE: no special monomial ordering is required, result is a SB with |
---|
107 | respect to ordering dp (resp. ls) if the first var not to be |
---|
108 | eliminated belongs to a -p (resp. -s) blockordering |
---|
109 | This proc uses 'execute' or calls a procedure using 'execute'. |
---|
110 | EXAMPLE: example elim; shows examples |
---|
111 | " |
---|
112 | { |
---|
113 | //---- get variables to be eliminated and create string for new ordering ------ |
---|
114 | int ii; poly vars=1; |
---|
115 | for( ii=n; ii<=m; ii=ii+1 ) { vars=vars*var(ii); } |
---|
116 | if( n>1 ) { poly p = 1+var(1); } |
---|
117 | else { poly p = 1+var(m+1); } |
---|
118 | if( ord(p)==0 ) { string ordering = "),ls;"; } |
---|
119 | if( ord(p)>0 ) { string ordering = "),dp;"; } |
---|
120 | string mpoly=string(minpoly); |
---|
121 | //-------------- create new ring and map objects to new ring ------------------ |
---|
122 | def br = basering; |
---|
123 | string str = "ring @newr = ("+charstr(br)+"),("+varstr(br)+ordering; |
---|
124 | execute(str); |
---|
125 | if (mpoly!="0") { execute("minpoly="+mpoly+";"); } |
---|
126 | def i = imap(br,id); |
---|
127 | poly vars = imap(br,vars); |
---|
128 | //---------- now eliminate in new ring and map back to old ring --------------- |
---|
129 | i = eliminate(i,vars); |
---|
130 | setring br; |
---|
131 | return(imap(@newr,i)); |
---|
132 | } |
---|
133 | example |
---|
134 | { "EXAMPLE:"; echo = 2; |
---|
135 | ring r=0,(x,y,u,v,w),dp; |
---|
136 | ideal i=x-u,y-u2,w-u3,v-x+y3; |
---|
137 | elim(i,3,4); |
---|
138 | module m=i*gen(1)+i*gen(2); |
---|
139 | m=elim(m,3,4);show(m); |
---|
140 | } |
---|
141 | /////////////////////////////////////////////////////////////////////////////// |
---|
142 | |
---|
143 | proc elim1 (id, poly vars) |
---|
144 | "USAGE: elim1(id,poly); id ideal/module, poly=product of vars to be eliminated |
---|
145 | RETURN: ideal/module obtained from id by eliminating vars occuring in poly |
---|
146 | NOTE: no special monomial ordering is required, result is a SB with |
---|
147 | respect to ordering dp (resp. ls) if the first var not to be |
---|
148 | eliminated belongs to a -p (resp. -s) blockordering |
---|
149 | This proc uses 'execute' or calls a procedure using 'execute'. |
---|
150 | EXAMPLE: example elim1; shows examples |
---|
151 | " |
---|
152 | { |
---|
153 | //---- get variables to be eliminated and create string for new ordering ------ |
---|
154 | int ii; |
---|
155 | for( ii=1; ii<=nvars(basering); ii=ii+1 ) |
---|
156 | { |
---|
157 | if( vars/var(ii)==0 ) { poly p = 1+var(ii); break;} |
---|
158 | } |
---|
159 | if( ord(p)==0 ) { string ordering = "),ls;"; } |
---|
160 | if( ord(p)>0 ) { string ordering = "),dp;"; } |
---|
161 | //-------------- create new ring and map objects to new ring ------------------ |
---|
162 | def br = basering; |
---|
163 | string str = "ring @newr = ("+charstr(br)+"),("+varstr(br)+ordering; |
---|
164 | execute(str); |
---|
165 | def id = fetch(br,id); |
---|
166 | poly vars = fetch(br,vars); |
---|
167 | //---------- now eliminate in new ring and map back to old ring --------------- |
---|
168 | id = eliminate(id,vars); |
---|
169 | setring br; |
---|
170 | return(imap(@newr,id)); |
---|
171 | } |
---|
172 | example |
---|
173 | { "EXAMPLE:"; echo = 2; |
---|
174 | ring r=0,(x,y,t,s,z),dp; |
---|
175 | ideal i=x-t,y-t2,z-t3,s-x+y3; |
---|
176 | elim1(i,ts); |
---|
177 | module m=i*gen(1)+i*gen(2); |
---|
178 | m=elim1(m,st); show(m); |
---|
179 | } |
---|
180 | /////////////////////////////////////////////////////////////////////////////// |
---|
181 | |
---|
182 | proc nselect (id, int n, list#) |
---|
183 | "USAGE: nselect(id,n[,m]); id a module or ideal, n, m integers |
---|
184 | RETURN: generators of id not containing the variable n [up to m] |
---|
185 | EXAMPLE: example nselect; shows examples |
---|
186 | "{ |
---|
187 | int j,k; |
---|
188 | if( size(#)==0 ) { #[1]=n; } |
---|
189 | for( k=1; k<=ncols(id); k=k+1 ) |
---|
190 | { for( j=n; j<=#[1]; j=j+1 ) |
---|
191 | { if( size(id[k]/var(j))!=0) { id[k]=0; break; } |
---|
192 | } |
---|
193 | } |
---|
194 | return(simplify(id,2)); |
---|
195 | } |
---|
196 | example |
---|
197 | { "EXAMPLE:"; echo = 2; |
---|
198 | ring r=0,(x,y,t,s,z),(c,dp); |
---|
199 | ideal i=x-y,y-z2,z-t3,s-x+y3; |
---|
200 | nselect(i,3); |
---|
201 | module m=i*(gen(1)+gen(2)); |
---|
202 | show(m); |
---|
203 | show(nselect(m,3,4)); |
---|
204 | } |
---|
205 | /////////////////////////////////////////////////////////////////////////////// |
---|
206 | |
---|
207 | proc sat (id, ideal j) |
---|
208 | "USAGE: sat(id,j); id=ideal/module, j=ideal |
---|
209 | RETURN: list of an ideal/module [1] and an integer [2]: |
---|
210 | [1] = saturation of id with respect to j (= union_(k=1...) of id:j^k) |
---|
211 | [2] = saturation exponent (= min( k | id:j^k = id:j^(k+1) )) |
---|
212 | NOTE: [1] is a standard basis in the basering |
---|
213 | DISPLAY: saturation exponent during computation if printlevel >=1 |
---|
214 | EXAMPLE: example sat; shows an example |
---|
215 | "{ |
---|
216 | int ii,kk; |
---|
217 | def i=id; |
---|
218 | id=std(id); |
---|
219 | int p = printlevel-voice+3; // p=printlevel+1 (default: p=1) |
---|
220 | while( ii<=size(i) ) |
---|
221 | { |
---|
222 | dbprint(p-1,"// compute quotient "+string(kk+1)); |
---|
223 | i=quotient(id,j); |
---|
224 | for( ii=1; ii<=size(i); ii=ii+1 ) |
---|
225 | { |
---|
226 | if( reduce(i[ii],id,1)!=0 ) break; |
---|
227 | } |
---|
228 | id=std(i); kk=kk+1; |
---|
229 | } |
---|
230 | dbprint(p-1,"// saturation becomes stable after "+string(kk-1)+" iteration(s)",""); |
---|
231 | list L = id,kk-1; |
---|
232 | return (L); |
---|
233 | } |
---|
234 | example |
---|
235 | { "EXAMPLE:"; echo = 2; |
---|
236 | int p = printlevel; |
---|
237 | ring r = 2,(x,y,z),dp; |
---|
238 | poly F = x5+y5+(x-y)^2*xyz; |
---|
239 | ideal j = jacob(F); |
---|
240 | sat(j,maxideal(1)); |
---|
241 | printlevel = 2; |
---|
242 | sat(j,maxideal(2)); |
---|
243 | printlevel = p; |
---|
244 | } |
---|
245 | /////////////////////////////////////////////////////////////////////////////// |
---|
246 | |
---|
247 | proc select (id, int n, list#) |
---|
248 | "USAGE: select(id,n[,m]); id ideal/module, n, m integers |
---|
249 | RETURN: generators of id containing the variable n [all variables up to m] |
---|
250 | NOTE: use 'select1' for selecting generators containing at least one of the |
---|
251 | variables between n and m |
---|
252 | EXAMPLE: example select; shows examples |
---|
253 | "{ |
---|
254 | if( size(#)==0 ) { #[1]=n; } |
---|
255 | int j,k; |
---|
256 | for( k=1; k<=ncols(id); k=k+1 ) |
---|
257 | { for( j=n; j<=#[1]; j=j+1 ) |
---|
258 | { if( size(id[k]/var(j))==0) { id[k]=0; break; } |
---|
259 | } |
---|
260 | } |
---|
261 | return(simplify(id,2)); |
---|
262 | } |
---|
263 | example |
---|
264 | { "EXAMPLE:"; echo = 2; |
---|
265 | ring r=0,(x,y,t,s,z),(c,dp); |
---|
266 | ideal i=x-y,y-z2,z-t3,s-x+y3; |
---|
267 | ideal j=select(i,1); |
---|
268 | j; |
---|
269 | module m=i*(gen(1)+gen(2)); |
---|
270 | m; |
---|
271 | select(m,1,2); |
---|
272 | } |
---|
273 | /////////////////////////////////////////////////////////////////////////////// |
---|
274 | |
---|
275 | proc select1 (id, int n, list#) |
---|
276 | "USAGE: select(id,n[,m]); id ideal/module, n, m integers |
---|
277 | RETURN: generators of id containing the variable n |
---|
278 | [at least one of the variables up to m] |
---|
279 | NOTE: use 'select' for selecting generators containing all the |
---|
280 | variables between n and m |
---|
281 | EXAMPLE: example select1; shows examples |
---|
282 | "{ |
---|
283 | if( size(#)==0 ) { #[1]=n; } |
---|
284 | int j,k; |
---|
285 | execute (typeof(id)+" I;"); |
---|
286 | for( k=1; k<=ncols(id); k=k+1 ) |
---|
287 | { for( j=n; j<=#[1]; j=j+1 ) |
---|
288 | { |
---|
289 | if( size(subst(id[k],var(j),0)) != size(id[k]) ) |
---|
290 | { I=I,id[k]; break; } |
---|
291 | } |
---|
292 | } |
---|
293 | return(simplify(I,2)); |
---|
294 | } |
---|
295 | example |
---|
296 | { "EXAMPLE:"; echo = 2; |
---|
297 | ring r=0,(x,y,t,s,z),(c,dp); |
---|
298 | ideal i=x-y,y-z2,z-t3,s-x+y3; |
---|
299 | ideal j=select1(i,1); |
---|
300 | j; |
---|
301 | module m=i*(gen(1)+gen(2)); |
---|
302 | m; |
---|
303 | select1(m,1,2); |
---|
304 | } |
---|
305 | /////////////////////////////////////////////////////////////////////////////// |
---|