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