1 | // IB/PG/GMG, last modified: 21.7.2000 |
---|
2 | ////////////////////////////////////////////////////////////////////////////// |
---|
3 | version = "$Id: mregular.lib,v 1.6 2001-01-16 13:48:33 Singular Exp $"; |
---|
4 | category="Commutative Algebra"; |
---|
5 | info=" |
---|
6 | LIBRARY: mregular.lib Castelnuovo-Mumford Regularity of CM-Schemes and Curves |
---|
7 | AUTHORS: I.Bermejo, ibermejo@ull.es |
---|
8 | @* Ph.Gimenez, pgimenez@agt.uva.es |
---|
9 | @* G.-M.Greuel, greuel@mathematik.uni-kl.de |
---|
10 | |
---|
11 | OVERVIEW: |
---|
12 | A library for computing the Castelnuovo-Mumford regularity of a subscheme of |
---|
13 | the projective n-space that DOES NOT require the computation of a minimal |
---|
14 | graded free resolution of the saturated ideal defining the subscheme. |
---|
15 | The procedures are based on two papers by Isabel Bermejo and Philippe Gimenez: |
---|
16 | 'On Castelnuovo-Mumford regularity of projective curves' Proc.Amer.Math.Soc. |
---|
17 | 128(5) (2000), and 'Computing the Castelnuovo-Mumford regularity of some |
---|
18 | subschemes of Pn using quotients of monomial ideals', Proceedings of |
---|
19 | MEGA-2000, J. Pure Appl. Algebra (to appear). |
---|
20 | The algorithm assumes the variables to be in Noether position. |
---|
21 | |
---|
22 | PROCEDURES: |
---|
23 | reg_CM(id); regularity of arith. C-M subscheme V(id_sat) of Pn |
---|
24 | reg_curve(id,[,e]); regularity of projective curve V(id_sat) in Pn |
---|
25 | reg_moncurve(li); regularity of projective monomial curve defined by li |
---|
26 | "; |
---|
27 | |
---|
28 | LIB "general.lib"; |
---|
29 | LIB "algebra.lib"; |
---|
30 | LIB "sing.lib"; |
---|
31 | LIB "poly.lib"; |
---|
32 | ////////////////////////////////////////////////////////////////////////////// |
---|
33 | |
---|
34 | proc reg_CM (ideal i) |
---|
35 | " |
---|
36 | USAGE: reg_CM (i); i ideal |
---|
37 | RETURN: an integer, the Castelnuovo-Mumford regularity of i-sat. |
---|
38 | ASSUME: i is a homogeneous ideal of the basering S=K[x(0)..x(n)] where |
---|
39 | the field K is infinite, and S/i-sat is Cohen-Macaulay. |
---|
40 | Assume that K[x(n-d),...,x(n)] is a Noether normalization of S/i-sat |
---|
41 | where d=dim S/i -1. If this is not the case, compute a Noether |
---|
42 | normalization e.g. by using the proc noetherNormal from algebra.lib. |
---|
43 | NOTE: The output is reg(X)=reg(i-sat) where X is the arithmetically |
---|
44 | Cohen-Macaulay subscheme of the projective n-space defined by i. |
---|
45 | If printlevel > 0 (default = 0) additional information is displayed. |
---|
46 | In particular, the value of the regularity of the Hilbert function of |
---|
47 | S/i-sat is given. |
---|
48 | EXAMPLE: example reg_CM; shows some examples |
---|
49 | " |
---|
50 | { |
---|
51 | //--------------------------- initialisation --------------------------------- |
---|
52 | int ii,H,h,d,time,si; |
---|
53 | def r0 = basering; |
---|
54 | int n = nvars(r0)-1; |
---|
55 | string s = "ring r1 = ",charstr(r0),",x(0..n),dp;"; |
---|
56 | execute(s); |
---|
57 | ideal i,j,I,K; |
---|
58 | j = fetch(r0,i); |
---|
59 | //----- Checks saturated ideal, computes saturation if necessary, |
---|
60 | // and computes the initial ideal of the i-sat w.r.t. dp-ordering |
---|
61 | time=rtimer; |
---|
62 | list l=sat(j,maxideal(1)); |
---|
63 | i=l[1]; si=l[2]; |
---|
64 | I=lead(i); |
---|
65 | attrib(I,"isSB",1); |
---|
66 | d=dim(I); |
---|
67 | if ( d == -1 ) |
---|
68 | { |
---|
69 | H=maxdeg1(quotient(lead(std(j)),maxideal(1)))+1; |
---|
70 | "// WARNING from proc reg_CM from lib mregular.lib: |
---|
71 | // your ideal i of S is zero-dimensional! |
---|
72 | // The Castelnuovo-Mumford regularity of i coincides with the |
---|
73 | // regularity of the Hilbert function of S/i and its value is:"; |
---|
74 | return (H); |
---|
75 | } |
---|
76 | //----- Check Noether position |
---|
77 | ideal J=I; |
---|
78 | for ( ii = n-d+1; ii <= n; ii++ ) |
---|
79 | { |
---|
80 | J=subst(J,x(ii),0); |
---|
81 | } |
---|
82 | attrib(J,"isSB",1); |
---|
83 | int dz=dim(J); |
---|
84 | if ( dz != d ) |
---|
85 | { |
---|
86 | "// WARNING from proc reg_CM from lib mregular.lib: |
---|
87 | // the variables are not in Noether position!"; |
---|
88 | return (-1); |
---|
89 | } |
---|
90 | //----- Check Cohen-Macaulay property of S/i-sat |
---|
91 | for ( ii = n-d+2; ii <= n+1; ii++ ) |
---|
92 | { |
---|
93 | K=K+select(I,ii); |
---|
94 | } |
---|
95 | if ( size(K) != 0 ) |
---|
96 | { |
---|
97 | "// WARNING from proc reg_CM from lib mregular.lib: |
---|
98 | // the ring basering/i-sat is NOT Cohen-Macaulay !!"; |
---|
99 | return (-1); |
---|
100 | } |
---|
101 | // Now, compute the regularity! |
---|
102 | s="ring r2 = ",charstr(r0),",x(0..n-d),dp;"; |
---|
103 | execute(s); |
---|
104 | ideal I,qq; |
---|
105 | I = imap(r1,I); |
---|
106 | qq=quotient(I,maxideal(1)); |
---|
107 | H=maxdeg1(qq)+1; // The value of the regularity. |
---|
108 | time=rtimer-time; |
---|
109 | // Additional information: |
---|
110 | dbprint(printlevel-voice+2, |
---|
111 | "// Ideal i of S defining an arithm. Cohen-Macaulay subscheme X of P"+ |
---|
112 | string(n) + ":"); |
---|
113 | dbprint(printlevel-voice+2, |
---|
114 | "// - dimension of X: "+string(d-1)); |
---|
115 | if ( si == 0 ) |
---|
116 | { |
---|
117 | dbprint(printlevel-voice+2,"// - i is saturated: YES"); |
---|
118 | } |
---|
119 | else |
---|
120 | { |
---|
121 | dbprint(printlevel-voice+2,"// - i is saturated: NO"); |
---|
122 | } |
---|
123 | dbprint(printlevel-voice+2, |
---|
124 | "// - regularity of the Hilbert function of S/i-sat: " + string(H-d)); |
---|
125 | dbprint(printlevel-voice+2, |
---|
126 | "// - time for computing reg(X): " + string(time) + " sec."); |
---|
127 | dbprint(printlevel-voice+2, |
---|
128 | "// Castelnuovo-Mumford regularity of X:"); |
---|
129 | return(H); |
---|
130 | } |
---|
131 | example |
---|
132 | { "EXAMPLE:"; echo = 2; |
---|
133 | ring s=0,x(0..5),dp; |
---|
134 | ideal i=x(2)^2-x(4)*x(5),x(1)*x(2)-x(0)*x(5),x(0)*x(2)-x(1)*x(4), |
---|
135 | x(1)^2-x(3)*x(5),x(0)*x(1)-x(2)*x(3),x(0)^2-x(3)*x(4); |
---|
136 | reg_CM(i); |
---|
137 | // Additional information can be obtained as follows: |
---|
138 | printlevel = 1; |
---|
139 | reg_CM(i); |
---|
140 | } |
---|
141 | |
---|
142 | /////////////////////////////////////////////////////////////////////////////// |
---|
143 | /* |
---|
144 | Out-commented examples: |
---|
145 | ring r=0,(x,y,z,t),dp; |
---|
146 | ideal j=x17y14-y31, x20y13, x60-y36z24-x20z20t20; |
---|
147 | reg_CM(j); |
---|
148 | // |
---|
149 | // The polynomial ring in the last variables MUST be a Noether |
---|
150 | // Normalization of basering/ideal: |
---|
151 | ring rr=0,(t,x,y,z),dp; |
---|
152 | ideal j=imap(r,i); |
---|
153 | // The same ideal as before but with a different order of the var. in ring |
---|
154 | reg_CM(j); |
---|
155 | // |
---|
156 | // When S/i-sat is not Cohen-Macaulay, one gets an error message: |
---|
157 | ring r1=0,(x,y,z,t),dp; |
---|
158 | ideal i=y4-t3z, x3t-y2z2, x3y2-t2z3, x6-tz5; |
---|
159 | reg_CM(i); |
---|
160 | // |
---|
161 | // When i is zero-dimensional, one gets an error message but the regularity |
---|
162 | // of the ideal is computed: |
---|
163 | reg_CM(maxideal(4)); |
---|
164 | // |
---|
165 | ring r2=0,(x,y,z,t,w),dp; |
---|
166 | ideal i=xy-zw,x3-yw2,x2z-y2w,y3-xz2,-y2z3+xw4+tw4+w5,-yz4+x2w3+xtw3+xw4, |
---|
167 | -z5+x2tw2+x2w3+yw4; |
---|
168 | reg_CM(i); |
---|
169 | ring r3=0,(x,y,z,t,w,u),dp; |
---|
170 | ideal i=imap(r2,i); |
---|
171 | reg_CM(i); |
---|
172 | // |
---|
173 | // Next example is the defining ideal of the 2nd. Veronesean of P3, a variety |
---|
174 | // in P8 which is arithmetically Cohen-Macaulay: |
---|
175 | ring r4=0,(a,b,c,d,x(0..9)),dp; |
---|
176 | ideal i= x(0)-ab,x(1)-ac,x(2)-ad,x(3)-bc,x(4)-bd,x(5)-cd, |
---|
177 | x(6)-a2,x(7)-b2,x(8)-c2,x(9)-d2; |
---|
178 | ideal ei=eliminate(i,abcd); |
---|
179 | ring r5=0,x(0..9),dp; |
---|
180 | ideal i=imap(r4,ei); |
---|
181 | reg_CM(i); |
---|
182 | // |
---|
183 | // Now let's build a non saturated ideal defining the same subscheme: |
---|
184 | ideal mi=intersect(i,maxideal(3)); |
---|
185 | size(mi); |
---|
186 | reg_CM(mi); |
---|
187 | // The result is the same since both ideals define the same subscheme. |
---|
188 | // |
---|
189 | */ |
---|
190 | ////////////////////////////////////////////////////////////////////////////// |
---|
191 | |
---|
192 | proc reg_curve (ideal i, list #) |
---|
193 | " |
---|
194 | USAGE: reg_curve (i[,e]); i ideal, e integer |
---|
195 | RETURN: an integer, the Castelnuovo-Mumford regularity of i-sat. |
---|
196 | ASSUME: i is a homogeneous ideal of the basering S=K[x(0)..x(n)] where |
---|
197 | the field K is infinite, and it defines a projective curve C in |
---|
198 | the projective n-space (dim(i)=2). We assume that K[x(n-1),x(n)] |
---|
199 | is a Noether normalization of S/i-sat. |
---|
200 | e=0: (default) |
---|
201 | Uses a random choice of an element of K when it is necessary. |
---|
202 | This is absolutly safe (if the element is bad, another random |
---|
203 | choice will be done until a good element is found). |
---|
204 | e=1: Substitutes the random choice of an element of K by a simple |
---|
205 | transcendental field extension of K. |
---|
206 | NOTE: The output is the integer reg(C)=reg(i-sat). |
---|
207 | If printlevel > 0 (default = 0) additional information is displayed. |
---|
208 | In particular, says if C is arithmetically Cohen-Macaulay or not, |
---|
209 | determines in which step of a minimal graded free resolution of i-sat |
---|
210 | the regularity of C is attained, and sometimes gives the value of the |
---|
211 | regularity of the Hilbert function of S/i-sat (otherwise, an upper |
---|
212 | bound is given). |
---|
213 | EXAMPLE: example reg_curve; shows some examples |
---|
214 | " |
---|
215 | { |
---|
216 | //--------------------------- initialisation --------------------------------- |
---|
217 | int d,ii,jj,H,HR,e,dd,h,hh,hm,sK,ts,si,time,ran,rant; |
---|
218 | def r0 = basering; |
---|
219 | int n = nvars(r0)-1; |
---|
220 | if ( size(#) > 0 ) |
---|
221 | { |
---|
222 | e = #[1]; |
---|
223 | } |
---|
224 | string s = "ring r1 = ",charstr(r0),",x(0..n),dp;"; |
---|
225 | execute(s); |
---|
226 | ideal i,j,I,I0,J,K,II,q,qq,m; |
---|
227 | i = fetch(r0,i); |
---|
228 | //----- Checks saturated ideal, computes saturation if necessary, |
---|
229 | // and computes the initial ideal of the i-sat w.r.t. dp-ordering |
---|
230 | time=rtimer; |
---|
231 | list l=sat(i,maxideal(1)); |
---|
232 | i=l[1];si=l[2]; |
---|
233 | I=lead(i); |
---|
234 | attrib(I,"isSB",1); |
---|
235 | d=dim(I); |
---|
236 | //----- Check if the ideal defines a curve |
---|
237 | if ( d != 2 ) |
---|
238 | { |
---|
239 | "// WARNING from proc reg_curve from lib mregular.lib: |
---|
240 | // your ideal does not define a projective curve!"; |
---|
241 | return (-1); |
---|
242 | } |
---|
243 | //----- Check Noether position |
---|
244 | J=subst(I,x(n),0); |
---|
245 | K=subst(J,x(n-1),0); |
---|
246 | attrib(K,"isSB",1); |
---|
247 | int dz=dim(K); |
---|
248 | if ( dz != 2 ) |
---|
249 | { |
---|
250 | "// WARNING from proc reg_curve from lib mregular.lib: |
---|
251 | // the variables are not in Noether position!"; |
---|
252 | return (-1); |
---|
253 | } |
---|
254 | //--------- When S/i-sat is Cohen-Macaulay we can compute regularity: |
---|
255 | K=select(I,n+1); |
---|
256 | K=K+select(I,n); |
---|
257 | sK=size(K); |
---|
258 | s="ring r2 = ",charstr(r0),",x(0..n-2),dp;"; |
---|
259 | if (sK == 0) |
---|
260 | { |
---|
261 | execute(s); |
---|
262 | ideal I,qq; |
---|
263 | I = imap(r1,I); |
---|
264 | qq=quotient(I,maxideal(1)); |
---|
265 | H=maxdeg1(qq)+1; // this is the value of the regularity. |
---|
266 | time=rtimer-time; |
---|
267 | // Additional information: |
---|
268 | dbprint(printlevel-voice+2, |
---|
269 | "// Ideal i of S defining a projective curve C in P" + string(n) + ":"); |
---|
270 | if ( si == 0 ) |
---|
271 | { |
---|
272 | dbprint(printlevel-voice+2,"// - i is saturated: YES"); |
---|
273 | } |
---|
274 | else |
---|
275 | { |
---|
276 | dbprint(printlevel-voice+2,"// - i is saturated: NO"); |
---|
277 | } |
---|
278 | dbprint(printlevel-voice+2, |
---|
279 | "// - C is arithm. Cohen-Macaulay: YES"); |
---|
280 | dbprint(printlevel-voice+2, |
---|
281 | "// - reg(C) attained at the last step of a m.g.f.r. of i-sat: YES"); |
---|
282 | dbprint(printlevel-voice+2, |
---|
283 | "// - regularity of the Hilbert function of S/i-sat: " + string(H-2)); |
---|
284 | dbprint(printlevel-voice+2, |
---|
285 | "// - time for computing reg(C): " + string(time) + " sec."); |
---|
286 | dbprint(printlevel-voice+2, |
---|
287 | "// Castelnuovo-Mumford regularity of C:"); |
---|
288 | return(H); |
---|
289 | } |
---|
290 | //----- Not Cohen-Macaulay case: |
---|
291 | //----- First, determine the associated monomial ideal. |
---|
292 | l=sat(I,maxideal(1)); |
---|
293 | ts=l[2]; |
---|
294 | if (ts != 0) |
---|
295 | { |
---|
296 | if (e != 0) |
---|
297 | { |
---|
298 | s= "ring r4 = (char(r0),a),x(0..n),dp;"; |
---|
299 | execute(s); |
---|
300 | ideal i,I,j,m,K; |
---|
301 | i=imap(r1,i); |
---|
302 | m=nselect(maxideal(1),n+1); |
---|
303 | m[n+1]=a*x(n-1); |
---|
304 | map phi=r4,m; |
---|
305 | j=phi(i); |
---|
306 | I=lead(std(j)); |
---|
307 | K=normalize(I); |
---|
308 | setring r1; |
---|
309 | I=imap(r4,K); |
---|
310 | } |
---|
311 | else |
---|
312 | { |
---|
313 | rant=size(select(I,n+1)); |
---|
314 | while (rant != 0) |
---|
315 | { |
---|
316 | ran=random(-1000,1000); |
---|
317 | m=nselect(maxideal(1),n+1); |
---|
318 | m[n+1]=ran*x(n-1); |
---|
319 | map phi=r1,m; |
---|
320 | j=phi(i); |
---|
321 | I=lead(std(j)); |
---|
322 | rant=size(select(I,n+1)); |
---|
323 | dbprint(printlevel-voice+2,"// (random choice of an element of K)"); |
---|
324 | } |
---|
325 | } |
---|
326 | } |
---|
327 | else |
---|
328 | { |
---|
329 | I=subst(I,x(n),x(n-1)); |
---|
330 | } |
---|
331 | I0 = subst(I,x(n-1),0); // Generators of I which are x(n-1)-free; |
---|
332 | K= select(I,n); // The other generators; |
---|
333 | //--------------- Computation of H=H(E) -------------------- |
---|
334 | s="ring r2 = ",charstr(r0),",x(0..n-2),dp;"; |
---|
335 | execute(s); |
---|
336 | ideal I0,qq,ki,mov; |
---|
337 | I0 = imap(r1,I0); |
---|
338 | qq=quotient(I0,maxideal(1)); |
---|
339 | H=maxdeg1(qq)+1; |
---|
340 | //------------ Computation of HR=H(R)+1 ----------------- |
---|
341 | //First, order elements in K |
---|
342 | s="ring r3 = ",charstr(r0),",(x(n-1),x(n),x(0..n-2)),lp;"; |
---|
343 | execute(s); |
---|
344 | ideal K,KK,ki; |
---|
345 | K=imap(r1,K); |
---|
346 | KK=sort(K)[1]; |
---|
347 | //The first step is different to avoid to compute quotient(I0,max) twice |
---|
348 | ki=subst(KK[1],x(n-1),1); |
---|
349 | dd=leadexp(KK[1])[1]; |
---|
350 | setring r2; |
---|
351 | ki=imap(r3,ki); |
---|
352 | attrib(ki,"isSB",1); |
---|
353 | for (jj=1; jj<= size(qq); jj++) |
---|
354 | { |
---|
355 | if ( reduce(qq[jj],ki)== 0 ) |
---|
356 | { hm=deg(qq[jj]); |
---|
357 | if ( hm > hh) |
---|
358 | { hh = hm; } |
---|
359 | } |
---|
360 | } |
---|
361 | HR=hh+dd; |
---|
362 | //If K has more than 1 element, recursive steps to compute HR |
---|
363 | setring r1; |
---|
364 | if (size(K) != 1) |
---|
365 | { |
---|
366 | setring r2; |
---|
367 | mov=I0+ki; |
---|
368 | setring r3; |
---|
369 | for (ii=2; ii<= size(KK); ii++) |
---|
370 | { |
---|
371 | ki=subst(KK[ii],x(n-1),1); |
---|
372 | dd=leadexp(KK[ii])[1]; |
---|
373 | setring r2; |
---|
374 | qq=quotient(mov,maxideal(1)); |
---|
375 | ki=imap(r3,ki); |
---|
376 | attrib(ki,"isSB",1); |
---|
377 | hh=0; |
---|
378 | for (jj=1; jj<= size(qq); jj++) |
---|
379 | { |
---|
380 | if ( reduce(qq[jj],ki)==0 ) |
---|
381 | { hm=deg(qq[jj]); |
---|
382 | if ( hm > hh) |
---|
383 | { hh = hm; } |
---|
384 | } |
---|
385 | } |
---|
386 | hh=hh+dd; |
---|
387 | if ( hh > HR ) |
---|
388 | { HR=hh; } |
---|
389 | mov=mov+ki; |
---|
390 | setring r3; |
---|
391 | } |
---|
392 | } |
---|
393 | //Now one has HR=H(R)+1 and H=H(E) and one can conclude: |
---|
394 | time=rtimer-time; |
---|
395 | if( HR > H ) |
---|
396 | { |
---|
397 | // Additional information: |
---|
398 | dbprint(printlevel-voice+2, |
---|
399 | "// Ideal i of S defining a projective curve C in P" + string(n) + ":"); |
---|
400 | if ( si == 0 ) |
---|
401 | { |
---|
402 | dbprint(printlevel-voice+2,"// - i is saturated: YES"); |
---|
403 | } |
---|
404 | else |
---|
405 | { |
---|
406 | dbprint(printlevel-voice+2,"// - i is saturated: NO"); |
---|
407 | } |
---|
408 | dbprint(printlevel-voice+2, |
---|
409 | "// - C is arithm. Cohen-Macaulay: NO"); |
---|
410 | dbprint(printlevel-voice+2, |
---|
411 | "// - reg(C) attained at the last step of a m.g.f.r. of i-sat: YES"); |
---|
412 | dbprint(printlevel-voice+2, |
---|
413 | "// - regularity of the Hilbert function of S/i-sat: " + string(HR-1)); |
---|
414 | dbprint(printlevel-voice+2, |
---|
415 | "// - time for computing reg(C): "+ string(time) + " sec."); |
---|
416 | dbprint(printlevel-voice+2, |
---|
417 | "// Castelnuovo-Mumford regularity of C:"); |
---|
418 | return(HR); |
---|
419 | } |
---|
420 | if( HR < H ) |
---|
421 | { |
---|
422 | // Additional information: |
---|
423 | dbprint(printlevel-voice+2, |
---|
424 | "// Ideal i of S defining a projective curve C in P" + string(n) + ":"); |
---|
425 | if ( si == 0 ) |
---|
426 | { |
---|
427 | dbprint(printlevel-voice+2,"// - i is saturated: YES"); |
---|
428 | } |
---|
429 | else |
---|
430 | { |
---|
431 | dbprint(printlevel-voice+2,"// - i is saturated: NO"); |
---|
432 | } |
---|
433 | dbprint(printlevel-voice+2, |
---|
434 | "// - C is arithm. Cohen-Macaulay: NO"); |
---|
435 | dbprint(printlevel-voice+2, |
---|
436 | "// - reg(C) attained at the last step of a m.g.f.r. of i-sat: NO"); |
---|
437 | dbprint(printlevel-voice+2, |
---|
438 | "// - reg(C) attained at the second last step of a m.g.f.r. of i-sat: YES"); |
---|
439 | dbprint(printlevel-voice+2, |
---|
440 | "// - regularity of the Hilbert function of S/i-sat: strictly smaller than " |
---|
441 | + string(H-1)); |
---|
442 | dbprint(printlevel-voice+2, |
---|
443 | "// - time for computing reg(C): " + string(time) + " sec."); |
---|
444 | dbprint(printlevel-voice+2, |
---|
445 | "// Castelnuovo-Mumford regularity of C:"); |
---|
446 | return(H); |
---|
447 | } |
---|
448 | if( HR == H ) |
---|
449 | { |
---|
450 | // Additional information: |
---|
451 | dbprint(printlevel-voice+2, |
---|
452 | "// Ideal i of S defining a projective curve C in P" + string(n) + ":"); |
---|
453 | if ( si == 0 ) |
---|
454 | { |
---|
455 | dbprint(printlevel-voice+2,"// - i is saturated: YES"); |
---|
456 | } |
---|
457 | else |
---|
458 | { |
---|
459 | dbprint(printlevel-voice+2,"// - i is saturated: NO"); |
---|
460 | } |
---|
461 | dbprint(printlevel-voice+2, |
---|
462 | "// - C is arithm. Cohen-Macaulay: NO"); |
---|
463 | dbprint(printlevel-voice+2, |
---|
464 | "// - reg(C) attained at the last step of a m.g.f.r. of i-sat: YES"); |
---|
465 | dbprint(printlevel-voice+2, |
---|
466 | "// - reg(C) attained at the second last step of a m.g.f.r. of i-sat: YES"); |
---|
467 | dbprint(printlevel-voice+2, |
---|
468 | "// - regularity of the Hilbert function of S/i-sat: " + string(HR-1)); |
---|
469 | dbprint(printlevel-voice+2, |
---|
470 | "// - time for computing reg(C): " + string(time) + " sec."); |
---|
471 | dbprint(printlevel-voice+2, |
---|
472 | "// Castelnuovo-Mumford regularity of C:"); |
---|
473 | return(HR); |
---|
474 | } |
---|
475 | } |
---|
476 | example |
---|
477 | { "EXAMPLE:"; echo = 2; |
---|
478 | ring s = 0,(x,y,z,t),dp; |
---|
479 | // 1st example is Ex.2.5 in [Bermejo-Gimenez], Proc.Amer.Math.Soc. 128(5): |
---|
480 | ideal i = x17y14-y31, x20y13, x60-y36z24-x20z20t20; |
---|
481 | reg_curve(i); |
---|
482 | // 2nd example is Ex.2.9 in [Bermejo-Gimenez], Proc.Amer.Math.Soc. 128(5): |
---|
483 | int k=43; |
---|
484 | ideal j=x17y14-y31,x20y13,x60-y36z24-x20z20t20,y41*z^k-y40*z^(k+1); |
---|
485 | reg_curve(j); |
---|
486 | // Additional information can be obtained as follows: |
---|
487 | printlevel = 1; |
---|
488 | reg_curve(j); |
---|
489 | } |
---|
490 | |
---|
491 | /////////////////////////////////////////////////////////////////////////////// |
---|
492 | /* |
---|
493 | Out-commented examples: |
---|
494 | // |
---|
495 | // More examples are obtained changing the value of k in the previous example: |
---|
496 | k=14; |
---|
497 | j=x17y14-y31,x20y13,x60-y36z24-x20z20t20,y41*z^k-y40*z^(k+1); |
---|
498 | reg_curve(j); |
---|
499 | k=22; |
---|
500 | j=x17y14-y31,x20y13,x60-y36z24-x20z20t20,y41*z^k-y40*z^(k+1); |
---|
501 | reg_curve(j); |
---|
502 | k=315; |
---|
503 | j=x17y14-y31,x20y13,x60-y36z24-x20z20t20,y41*z^k-y40*z^(k+1); |
---|
504 | reg_curve(j); |
---|
505 | // If the ideal does not define a curve, one gets an error message: |
---|
506 | ring s1=0,(a,b,c,d,x(0..9)),dp; |
---|
507 | ideal i= x(0)-ab,x(1)-ac,x(2)-ad,x(3)-bc,x(4)-bd,x(5)-cd, |
---|
508 | x(6)-a2,x(7)-b2,x(8)-c2,x(9)-d2; |
---|
509 | ideal ei=eliminate(i,abcd); |
---|
510 | ring s2=0,x(0..9),dp; |
---|
511 | ideal i=imap(s1,ei); |
---|
512 | reg_curve(i); |
---|
513 | // Since this example is Cohen-Macaulay, use reg_CM instead of reg_curve. |
---|
514 | // |
---|
515 | // Be carefull!: the polynomial ring in the last variables MUST be a Noether |
---|
516 | // Normalization of basering/ideal: |
---|
517 | ring s3=0,(t,x,y,z),dp; |
---|
518 | ideal j=imap(s,j); |
---|
519 | reg_curve(j); |
---|
520 | // |
---|
521 | // The following is example in Rk.2.10 in [Bermejo-Gimenez], ProcAMS 128(5): |
---|
522 | setring s; |
---|
523 | ideal h=x2-3xy+5xt,xy-3y2+5yt,xz-3yz,2xt-yt,y2-yz-2yt; |
---|
524 | reg_curve(h); |
---|
525 | // The initial ideal is not saturated but the regularity of the subscheme |
---|
526 | // it defines is the regularity of the saturation and can be computed: |
---|
527 | reg_curve(lead(std(h))); |
---|
528 | // |
---|
529 | // Here is an example where the computation of a m.g.f.r. of I costs a lot: |
---|
530 | ring s4=0,(x,y,z,t,u,a,b),dp; |
---|
531 | ideal i=u-b40,t-a40,x-a23b17,y-a22b18+ab39,z-a25b15; |
---|
532 | ideal ei=eliminate(i,ab); // It takes a few seconds to compute the ideal |
---|
533 | ring s5=0,(x,y,z,t,u),dp; |
---|
534 | ideal i=imap(s4,ei); |
---|
535 | reg_curve(i); // This is very fast. |
---|
536 | // Now you can use mres(i,0) to compute a m.g.f.r. of the ideal! |
---|
537 | // |
---|
538 | // The computation of the m.g.f.r. of the following example did not succeed |
---|
539 | // using the command mres: |
---|
540 | ring s6=0,(x(0..8),s,t),dp; |
---|
541 | ideal i=x(0)-st24,x(1)-s2t23,x(2)-s3t22,x(3)-s9t16,x(4)-s11t14,x(5)-s18t7, |
---|
542 | x(6)-s24t,x(7)-t25,x(8)-s25; |
---|
543 | ideal ei=eliminate(i,st); |
---|
544 | ring s7=0,x(0..8),dp; |
---|
545 | ideal i=imap(s6,ei); |
---|
546 | reg_curve(i); |
---|
547 | // |
---|
548 | */ |
---|
549 | ////////////////////////////////////////////////////////////////////////////// |
---|
550 | |
---|
551 | proc reg_moncurve (list #) |
---|
552 | " |
---|
553 | USAGE: reg_moncurve (a0,...,an) ; ai integers with a0=0 < a1 < ... < an=:d |
---|
554 | RETURN: an integer, the Castelnuovo-Mumford regularity of the projective |
---|
555 | monomial curve C in Pn parametrically defined by: |
---|
556 | x(0)=t^d , x(1)=s^(a1)t^(d-a1), ... , x(n)=s^d. |
---|
557 | ASSUME: a0=0 < a1 < ... < an are integers and the base field is infinite. |
---|
558 | NOTE: The defining ideal I(C) in S is determined using elimination. |
---|
559 | The procedure reg_curve is improved in this case since one |
---|
560 | knows beforehand that the dimension is 2, that the variables are |
---|
561 | in Noether position, that I(C) is prime. |
---|
562 | If printlevel > 0 (default = 0) additional information is displayed. |
---|
563 | In particular, says if C is arithmetically Cohen-Macaulay or not, |
---|
564 | determines in which step of a minimal graded free resolution of I(C) |
---|
565 | the regularity is attained, and sometimes gives the value of the |
---|
566 | regularity of the Hilbert function of S/I(C) (otherwise, an upper |
---|
567 | bound is given). |
---|
568 | EXAMPLE: example reg_moncurve; shows some examples |
---|
569 | " |
---|
570 | { |
---|
571 | //--------------------------- initialisation --------------------------------- |
---|
572 | int ii,jj,H,HR,dd,h,hh,hm,sK,time,ttime; |
---|
573 | int n = size(#)-1; |
---|
574 | //------------------ Check assumptions on integers ------------------------- |
---|
575 | if ( #[1] != 0 ) |
---|
576 | {"// WARNING from proc reg_moncurve from lib mregular.lib: |
---|
577 | // USAGE: your input must be a list of integers a0,a1,...,an such that |
---|
578 | // a0=0 < a1 < a2 < ... < an"; |
---|
579 | return(-1); |
---|
580 | } |
---|
581 | for ( ii=1; ii<= n; ii++ ) |
---|
582 | { |
---|
583 | if ( #[ii] >= #[ii+1] ) |
---|
584 | { |
---|
585 | "// WARNING from proc reg_moncurve from lib mregular.lib: |
---|
586 | // USAGE: your input must be a list of integers a0,a1,...,an such that |
---|
587 | // a0=0 < a1 < a2 < ... < an"; |
---|
588 | return(-1); |
---|
589 | } |
---|
590 | } |
---|
591 | ring r4=0,(x(0..n),s,t),dp; |
---|
592 | ideal param,m,i; |
---|
593 | poly f(0..n); |
---|
594 | for (ii=0;ii<=n;ii++) |
---|
595 | { |
---|
596 | f(ii)=s^(#[n+1]-#[ii+1])*t^(#[ii+1]); |
---|
597 | param=param+f(ii); |
---|
598 | } |
---|
599 | m=subst(maxideal(1),s,0); |
---|
600 | m=simplify(subst(m,t,0),2); |
---|
601 | i=m-param; |
---|
602 | ttime=rtimer; |
---|
603 | i=eliminate(i,st); |
---|
604 | ring r1=0,(x(1..n),x(0)),dp; |
---|
605 | ideal i,I,I0,K; |
---|
606 | i=imap(r4,i); |
---|
607 | ttime=rtimer-ttime; |
---|
608 | time=rtimer; |
---|
609 | I=lead(std(i)); |
---|
610 | attrib(I,"isSB",1); |
---|
611 | I0 = subst(I,x(n),0); |
---|
612 | K= select(I,n); |
---|
613 | sK=size(K); |
---|
614 | ring r2=0,x(1..n-1),dp; |
---|
615 | ideal I0,qq,ki,mov; |
---|
616 | I0 = imap(r1,I0); |
---|
617 | qq=quotient(I0,maxideal(1)); |
---|
618 | H=maxdeg1(qq)+1; |
---|
619 | //------------------ Cohen-Macaulay case ------------ |
---|
620 | if (sK == 0) |
---|
621 | { |
---|
622 | time=rtimer-time; |
---|
623 | // Additional information: |
---|
624 | dbprint(printlevel-voice+2, |
---|
625 | "// Sequence of integers defining a monomial curve C in P" + string(n) + ":"); |
---|
626 | dbprint(printlevel-voice+2, |
---|
627 | "// - time for computing ideal I(C) of S (elimination): " |
---|
628 | + string(ttime) + " sec."); |
---|
629 | dbprint(printlevel-voice+2, |
---|
630 | "// - C is arithm. Cohen-Macaulay: YES"); |
---|
631 | dbprint(printlevel-voice+2, |
---|
632 | "// - reg(C) attained at the last step of a m.g.f.r. of I(C): YES"); |
---|
633 | dbprint(printlevel-voice+2, |
---|
634 | "// - regularity of the Hilbert function of S/I(C): " + string(H-2)); |
---|
635 | dbprint(printlevel-voice+2, |
---|
636 | "// - time for computing reg(C): " + string(time) + " sec."); |
---|
637 | dbprint(printlevel-voice+2, |
---|
638 | "// Castelnuovo-Mumford regularity of C:"); |
---|
639 | return(H); |
---|
640 | } |
---|
641 | //------------ non Cohen-Macaulay case : computation of HR=H(R)+1 ------- |
---|
642 | //First, order elements in K |
---|
643 | ring r3=0,(x(n),x(0),x(1..n-1)),lp; |
---|
644 | ideal K,KK,ki; |
---|
645 | K=imap(r1,K); |
---|
646 | KK=sort(K)[1]; |
---|
647 | //The first step is different to avoid to compute quotient(I0,max) twice |
---|
648 | ki=subst(KK[1],x(n),1); |
---|
649 | dd=leadexp(KK[1])[1]; |
---|
650 | setring r2; |
---|
651 | ki=imap(r3,ki); |
---|
652 | attrib(ki,"isSB",1); |
---|
653 | for (jj=1; jj<= size(qq); jj++) |
---|
654 | { |
---|
655 | if ( reduce(qq[jj],ki)== 0 ) |
---|
656 | { hm=deg(qq[jj]); |
---|
657 | if ( hm > hh) |
---|
658 | { hh = hm; } |
---|
659 | } |
---|
660 | } |
---|
661 | HR=hh+dd; |
---|
662 | //If K has more than 1 element, recursive steps to compute HR |
---|
663 | setring r1; |
---|
664 | if (size(K) != 1) |
---|
665 | { |
---|
666 | setring r2; |
---|
667 | mov=I0+ki; |
---|
668 | setring r3; |
---|
669 | for (ii=2; ii<= size(KK); ii++) |
---|
670 | { |
---|
671 | ki=subst(KK[ii],x(n),1); |
---|
672 | dd=leadexp(KK[ii])[1]; |
---|
673 | setring r2; |
---|
674 | qq=quotient(mov,maxideal(1)); |
---|
675 | ki=imap(r3,ki); |
---|
676 | attrib(ki,"isSB",1); |
---|
677 | hh=0; |
---|
678 | for (jj=1; jj<= size(qq); jj++) |
---|
679 | { |
---|
680 | if ( reduce(qq[jj],ki)==0 ) |
---|
681 | { hm=deg(qq[jj]); |
---|
682 | if ( hm > hh) |
---|
683 | { hh = hm; } |
---|
684 | } |
---|
685 | } |
---|
686 | hh=hh+dd; |
---|
687 | if ( hh > HR ) |
---|
688 | { HR=hh; } |
---|
689 | mov=mov+ki; |
---|
690 | setring r3; |
---|
691 | } |
---|
692 | } |
---|
693 | //Now one has HR=H(R)+1 and H=H(E) and one can conclude: |
---|
694 | time=rtimer-time; |
---|
695 | if( HR > H ) |
---|
696 | { |
---|
697 | // Additional information: |
---|
698 | dbprint(printlevel-voice+2, |
---|
699 | "// Sequence of integers defining a monomial curve C in P"+string(n)+":"); |
---|
700 | dbprint(printlevel-voice+2, |
---|
701 | "// - time for computing ideal I(C) of S (elimination): " |
---|
702 | + string(ttime) + " sec."); |
---|
703 | dbprint(printlevel-voice+2, |
---|
704 | "// - C is arithm. Cohen-Macaulay: NO"); |
---|
705 | dbprint(printlevel-voice+2, |
---|
706 | "// - reg(C) attained at the last step of a m.g.f.r. of I(C): YES"); |
---|
707 | dbprint(printlevel-voice+2, |
---|
708 | "// - regularity of the Hilbert function of S/I(C): " + string(HR-1)); |
---|
709 | dbprint(printlevel-voice+2, |
---|
710 | "// - time for computing reg(C): "+ string(time) + " sec."); |
---|
711 | dbprint(printlevel-voice+2, |
---|
712 | "// Castelnuovo-Mumford regularity of C:"); |
---|
713 | return(HR); |
---|
714 | } |
---|
715 | if( HR < H ) |
---|
716 | { |
---|
717 | // Additional information: |
---|
718 | dbprint(printlevel-voice+2, |
---|
719 | "// Sequence of integers defining a monomial curve C in P"+string(n)+":"); |
---|
720 | dbprint(printlevel-voice+2, |
---|
721 | "// - time for computing ideal I(C) of S (elimination): " |
---|
722 | + string(ttime) + " sec."); |
---|
723 | dbprint(printlevel-voice+2, |
---|
724 | "// - C is arithm. Cohen-Macaulay: NO"); |
---|
725 | dbprint(printlevel-voice+2, |
---|
726 | "// - reg(C) attained at the last step of a m.g.f.r. of I(C): NO"); |
---|
727 | dbprint(printlevel-voice+2, |
---|
728 | "// - reg(C) attained at the second last step of a m.g.f.r. of I(C): YES"); |
---|
729 | dbprint(printlevel-voice+2, |
---|
730 | "// - regularity of the Hilbert function of S/I(C): striclty smaller than " |
---|
731 | + string(H-1)); |
---|
732 | dbprint(printlevel-voice+2, |
---|
733 | "// - time for computing reg(C): " + string(time) + " sec."); |
---|
734 | dbprint(printlevel-voice+2, |
---|
735 | "// Castelnuovo-Mumford regularity of C:"); |
---|
736 | return(H); |
---|
737 | } |
---|
738 | if( HR == H ) |
---|
739 | { |
---|
740 | // Additional information: |
---|
741 | dbprint(printlevel-voice+2, |
---|
742 | "// Sequence of integers defining a monomial curve C in P"+string(n)+":"); |
---|
743 | dbprint(printlevel-voice+2, |
---|
744 | "// - time for computing ideal I(C) of S (elimination): " |
---|
745 | + string(ttime) + " sec."); |
---|
746 | dbprint(printlevel-voice+2, |
---|
747 | "// - C is arithm. Cohen-Macaulay: NO"); |
---|
748 | dbprint(printlevel-voice+2, |
---|
749 | "// - reg(C) attained at the last step of a m.g.f.r. of I(C): YES"); |
---|
750 | dbprint(printlevel-voice+2, |
---|
751 | "// - reg(C) attained at the second last step of a m.g.f.r. of I(C): YES"); |
---|
752 | dbprint(printlevel-voice+2, |
---|
753 | "// - regularity of the Hilbert function of S/I(C): " + string(HR-1)); |
---|
754 | dbprint(printlevel-voice+2, |
---|
755 | "// - time for computing reg(C): " + string(time) + " sec."); |
---|
756 | dbprint(printlevel-voice+2, |
---|
757 | "// Castelnuovo-Mumford regularity of C:"); |
---|
758 | return(HR); |
---|
759 | } |
---|
760 | } |
---|
761 | example |
---|
762 | { "EXAMPLE:"; echo = 2; |
---|
763 | // The 1st example is the twisted cubic: |
---|
764 | reg_moncurve(0,1,2,3); |
---|
765 | // The 2nd. example is the non arithm. Cohen-Macaulay monomial curve in P4 |
---|
766 | // parametrized by: x(0)-s6,x(1)-s5t,x(2)-s3t3,x(3)-st5,x(4)-t6: |
---|
767 | reg_moncurve(0,1,3,5,6); |
---|
768 | // Additional information can be obtained as follows: |
---|
769 | printlevel = 1; |
---|
770 | reg_moncurve(0,1,3,5,6); |
---|
771 | } |
---|
772 | /////////////////////////////////////////////////////////////////////////////// |
---|
773 | /* |
---|
774 | Out-commented examples: |
---|
775 | // |
---|
776 | // The sequence of integers must be strictly increasing |
---|
777 | // and the first integer is 0: |
---|
778 | reg_moncurve(1,4,6,9); |
---|
779 | reg_moncurve(0,3,8,5,23); |
---|
780 | reg_moncurve(0,4,7,7,9); |
---|
781 | // |
---|
782 | // A curve in P3 s.t. the regularity is attained at the last step: |
---|
783 | reg_moncurve(0,2,12,15); |
---|
784 | // |
---|
785 | // A curve in P4 s.t. the regularity attained at the last but one |
---|
786 | // but NOT at the last step: |
---|
787 | reg_moncurve(0,5,9,11,20); |
---|
788 | // |
---|
789 | // A curve in P8 s.t. the m.g.f.r. of the defining ideal could not be obtained |
---|
790 | // by the command mres: |
---|
791 | reg_moncurve(0,1,2,3,9,11,18,24,25); |
---|
792 | // |
---|
793 | // A curve in P11 of degree 37: |
---|
794 | reg_moncurve(0,1,2,7,16,17,25,27,28,30,36,37); |
---|
795 | // It takes some time to compute the eliminated ideal; the computation of |
---|
796 | // the regularity is then rather fast as one can check using proc_curve: |
---|
797 | ring q=0,(s,t,x(0..11)),dp; |
---|
798 | ideal i=x(0)-st36,x(1)-s2t35,x(2)-s7t30,x(3)-s16t21,x(4)-s17t20,x(5)-s25t12 |
---|
799 | x(6)-s27t10,x(7)-s28t9,x(8)-s30t7,x(9)-s36t,x(10)-s37,x(11)-t37; |
---|
800 | ideal ei=eliminate(i,st); |
---|
801 | ring qq=0,x(0..11),dp; |
---|
802 | ideal i=imap(q,ei); |
---|
803 | reg_curve(i,1); |
---|
804 | // |
---|
805 | // A curve in P14 of degree 55: |
---|
806 | reg_moncurve(0,1,2,7,16,17,25,27,28,30,36,37,40,53,55); |
---|
807 | // In the last three examples, the m.g.f.r. could not be obtained using mres. |
---|
808 | // |
---|
809 | */ |
---|
810 | ////////////////////////////////////////////////////////////////////////////// |
---|
811 | |
---|