1 | /////////////////////////////////////////////////////////////////////////////// |
---|
2 | version="version assprimeszerodim.lib 4.1.2.0 Feb_2019 "; // $Id$ |
---|
3 | category="Commutative Algebra"; |
---|
4 | info=" |
---|
5 | LIBRARY: assprimeszerodim.lib associated primes of a zero-dimensional ideal |
---|
6 | |
---|
7 | AUTHORS: N. Idrees nazeranjawwad@gmail.com |
---|
8 | G. Pfister pfister@mathematik.uni-kl.de |
---|
9 | A. Steenpass steenpass@mathematik.uni-kl.de |
---|
10 | S. Steidel steidel@mathematik.uni-kl.de |
---|
11 | |
---|
12 | OVERVIEW: |
---|
13 | |
---|
14 | A library for computing the associated primes and the radical of a |
---|
15 | zero-dimensional ideal in the polynomial ring over the rational numbers, |
---|
16 | Q[x_1,...,x_n], using modular computations. |
---|
17 | |
---|
18 | SEE ALSO: primdec_lib |
---|
19 | |
---|
20 | PROCEDURES: |
---|
21 | zeroRadical(I); computes the radical of I |
---|
22 | assPrimes(I); computes the associated primes of I |
---|
23 | "; |
---|
24 | |
---|
25 | LIB "primdec.lib"; |
---|
26 | LIB "modstd.lib"; |
---|
27 | |
---|
28 | //////////////////////////////////////////////////////////////////////////////// |
---|
29 | |
---|
30 | proc zeroRadical(ideal I, list #) |
---|
31 | "USAGE: zeroRadical(I[, exactness]); I ideal, exactness int |
---|
32 | ASSUME: I is zero-dimensional in Q[variables] |
---|
33 | RETURN: the radical of I |
---|
34 | NOTE: A final test is applied to the result if exactness != 0 (default), |
---|
35 | otherwise no final test is done. |
---|
36 | EXAMPLE: example zeroRadical; shows an example |
---|
37 | " |
---|
38 | { |
---|
39 | /* read optional parameter */ |
---|
40 | int exactness = 1; |
---|
41 | if(size(#) > 0) |
---|
42 | { |
---|
43 | if(size(#) > 1 || typeof(#[1]) != "int") |
---|
44 | { |
---|
45 | ERROR("wrong optional parameter"); |
---|
46 | } |
---|
47 | exactness = #[1]; |
---|
48 | } |
---|
49 | |
---|
50 | /* compute a standard basis if necessary */ |
---|
51 | if (!attrib(I, "isSB")) |
---|
52 | { |
---|
53 | I = modStd(I, exactness); |
---|
54 | } |
---|
55 | |
---|
56 | /* call modular() */ |
---|
57 | // TODO: write deleteUnluckyPrimes_zeroRadical() |
---|
58 | if(exactness) |
---|
59 | { |
---|
60 | ideal F = modular("Assprimeszerodim::zeroRadP", list(I), |
---|
61 | Modstd::primeTest_std, Modular::deleteUnluckyPrimes_default, |
---|
62 | pTest_zeroRadical, finalTest_zeroRadical); |
---|
63 | } |
---|
64 | else |
---|
65 | { |
---|
66 | ideal F = modular("Assprimeszerodim::zeroRadP", list(I), |
---|
67 | Modstd::primeTest_std, Modular::deleteUnluckyPrimes_default, |
---|
68 | pTest_zeroRadical); |
---|
69 | } |
---|
70 | |
---|
71 | /* compute the squarefree parts */ |
---|
72 | poly f; |
---|
73 | int k; |
---|
74 | int i; |
---|
75 | for(i = nvars(basering); i > 0; i--) |
---|
76 | { |
---|
77 | f = gcd(F[i], diff(F[i], var(i))); |
---|
78 | k = k + deg(f); |
---|
79 | F[i] = F[i]/f; |
---|
80 | } |
---|
81 | |
---|
82 | /* return the result */ |
---|
83 | if(k == 0) |
---|
84 | { |
---|
85 | return(I); |
---|
86 | } |
---|
87 | else |
---|
88 | { |
---|
89 | return(modStd(I + F, exactness)); |
---|
90 | } |
---|
91 | } |
---|
92 | example |
---|
93 | { "EXAMPLE:"; echo = 2; |
---|
94 | ring R = 0, (x,y), dp; |
---|
95 | ideal I = xy4-2xy2+x, x2-x, y4-2y2+1; |
---|
96 | zeroRadical(I); |
---|
97 | } |
---|
98 | |
---|
99 | //////////////////////////////////////////////////////////////////////////////// |
---|
100 | |
---|
101 | /* The pTest for zeroRadical(), to be used in modular(). */ |
---|
102 | static proc pTest_zeroRadical(string command, alias list args, |
---|
103 | alias ideal result, int p) |
---|
104 | { |
---|
105 | /* change to characteristic p */ |
---|
106 | def br = basering; |
---|
107 | list lbr = ringlist(br); |
---|
108 | if(typeof(lbr[1]) == "int") |
---|
109 | { |
---|
110 | lbr[1] = p; |
---|
111 | } |
---|
112 | else |
---|
113 | { |
---|
114 | lbr[1][1] = p; |
---|
115 | } |
---|
116 | def rp = ring(lbr); |
---|
117 | setring(rp); |
---|
118 | ideal Ip = fetch(br, args)[1]; |
---|
119 | ideal Fp_result = fetch(br, result); |
---|
120 | |
---|
121 | /* run the command and compare with given result */ |
---|
122 | execute("ideal Fp = "+command+"(Ip);"); |
---|
123 | int i; |
---|
124 | for(i = nvars(br); i > 0; i--) |
---|
125 | { |
---|
126 | if(Fp[i] != Fp_result[i]) |
---|
127 | { |
---|
128 | setring(br); |
---|
129 | return(0); |
---|
130 | } |
---|
131 | } |
---|
132 | setring(br); |
---|
133 | return(1); |
---|
134 | } |
---|
135 | |
---|
136 | //////////////////////////////////////////////////////////////////////////////// |
---|
137 | |
---|
138 | /* The finalTest for zeroRadical, to be used in modular(). */ |
---|
139 | static proc finalTest_zeroRadical(string command, alias list args, |
---|
140 | alias ideal F) |
---|
141 | { |
---|
142 | int i; |
---|
143 | for(i = nvars(basering); i > 0; i--) |
---|
144 | { |
---|
145 | if(reduce(F[i], args[1]) != 0) { return(0); } |
---|
146 | } |
---|
147 | return(1); |
---|
148 | } |
---|
149 | |
---|
150 | //////////////////////////////////////////////////////////////////////////////// |
---|
151 | |
---|
152 | proc assPrimes(def I, list #) |
---|
153 | "USAGE: assPrimes(I[, alg, exactness]); I ideal or module, |
---|
154 | alg string (optional), exactness int (optional) |
---|
155 | - alg = "GTZ": method of Gianni/Trager/Zacharias (default) |
---|
156 | - alg = "EHV": method of Eisenbud/Hunecke/Vasconcelos |
---|
157 | - alg = "Monico": method of Monico |
---|
158 | ASSUME: I is zero-dimensional over Q[variables] |
---|
159 | RETURN: a list of the associated primes of I |
---|
160 | NOTE: A final test is applied to the result if exactness != 0 (default), |
---|
161 | otherwise no final test is done. |
---|
162 | EXAMPLE: example assPrimes; shows an example |
---|
163 | " |
---|
164 | { |
---|
165 | /* read input */ |
---|
166 | if(typeof(I) != "ideal") |
---|
167 | { |
---|
168 | if(typeof(I) != "module") |
---|
169 | { |
---|
170 | ERROR("The first argument must be of type 'ideal' or 'module'."); |
---|
171 | } |
---|
172 | module M = I; |
---|
173 | kill I; |
---|
174 | ideal I = Ann(M); |
---|
175 | kill M; |
---|
176 | } |
---|
177 | |
---|
178 | /* read optional parameters */ |
---|
179 | list defaults = list("GTZ", 1); |
---|
180 | int i; |
---|
181 | for(i = 1; i <= size(defaults); i++) |
---|
182 | { |
---|
183 | if(typeof(#[i]) != typeof(defaults[i])) |
---|
184 | { |
---|
185 | # = insert(#, defaults[i], i-1); |
---|
186 | } |
---|
187 | } |
---|
188 | if(size(#) != size(defaults)) |
---|
189 | { |
---|
190 | ERROR("wrong optional parameters"); |
---|
191 | } |
---|
192 | string alg = #[1]; |
---|
193 | int exactness = #[2]; |
---|
194 | int a; |
---|
195 | if(alg == "GTZ") |
---|
196 | { |
---|
197 | a = 1; |
---|
198 | } |
---|
199 | if(alg == "EHV") |
---|
200 | { |
---|
201 | a = 2; |
---|
202 | } |
---|
203 | if(alg == "Monico") |
---|
204 | { |
---|
205 | a = 3; |
---|
206 | } |
---|
207 | if(a == 0) // alg != "GTZ" && alg != "EHV" && alg != "Monico" |
---|
208 | { |
---|
209 | ERROR("unknown method"); |
---|
210 | } |
---|
211 | |
---|
212 | /* compute a standard basis if necessary */ |
---|
213 | if(printlevel >= 10) { "========== Start modStd =========="; } |
---|
214 | if (!attrib(I, "isSB")) { |
---|
215 | I = modStd(I, exactness); |
---|
216 | } |
---|
217 | if(printlevel >= 10) { "=========== End modStd ==========="; } |
---|
218 | int d = vdim(I); |
---|
219 | if(d == -1) { ERROR("Ideal is not zero-dimensional."); } |
---|
220 | if(homog(I) == 1) { return(list(maxideal(1))); } |
---|
221 | |
---|
222 | /* compute the radical if necessary */ |
---|
223 | ideal J = I; |
---|
224 | int isRad; |
---|
225 | poly f; |
---|
226 | isRad, f = pTestRad(I, d); |
---|
227 | while(!isRad) |
---|
228 | { |
---|
229 | J = zeroRadical(I, exactness); |
---|
230 | J = modStd(J, exactness); |
---|
231 | d = vdim(J); |
---|
232 | isRad, f = pTestRad(J, d); |
---|
233 | } |
---|
234 | I = J; |
---|
235 | kill J; |
---|
236 | |
---|
237 | /* call modular() */ |
---|
238 | if(exactness) |
---|
239 | { |
---|
240 | ideal F = modular("Assprimeszerodim::modpSpecialAlgDep", |
---|
241 | list(I, f, d, a), |
---|
242 | Modstd::primeTest_std, Modular::deleteUnluckyPrimes_default, |
---|
243 | pTest_assPrimes, finalTest_assPrimes); |
---|
244 | } |
---|
245 | else |
---|
246 | { |
---|
247 | ideal F = modular("Assprimeszerodim::modpSpecialAlgDep", |
---|
248 | list(I, f, d, a), |
---|
249 | Modstd::primeTest_std, Modular::deleteUnluckyPrimes_default, |
---|
250 | pTest_assPrimes); |
---|
251 | } |
---|
252 | |
---|
253 | /* compute the components */ |
---|
254 | list result; |
---|
255 | list H = factorize(F[1]); |
---|
256 | for(i = size(H[1])-1; i > 0; i--) |
---|
257 | { |
---|
258 | result[i] = I + ideal(quickSubst(H[1][i+1], f, I)); |
---|
259 | } |
---|
260 | |
---|
261 | /* return the result */ |
---|
262 | return(result); |
---|
263 | } |
---|
264 | example |
---|
265 | { "EXAMPLE:"; echo = 2; |
---|
266 | ring R = 0,(a,b,c,d,e,f),dp; |
---|
267 | ideal I = |
---|
268 | 2fb+2ec+d2+a2+a, |
---|
269 | 2fc+2ed+2ba+b, |
---|
270 | 2fd+e2+2ca+c+b2, |
---|
271 | 2fe+2da+d+2cb, |
---|
272 | f2+2ea+e+2db+c2, |
---|
273 | 2fa+f+2eb+2dc; |
---|
274 | assPrimes(I); |
---|
275 | } |
---|
276 | |
---|
277 | //////////////////////////////////////////////////////////////////////////////// |
---|
278 | |
---|
279 | /* Computes a poly F in Q[T] such that |
---|
280 | * <F> = kernel(Q[T] --> basering, T |-> f), |
---|
281 | * T := last variable in the basering. |
---|
282 | */ |
---|
283 | static proc specialAlgDepEHV(ideal I, poly f) |
---|
284 | { |
---|
285 | def R = basering; |
---|
286 | ring QT = create_ring(ring_list(R)[1], varstr(R, nvars(R)), "dp", "no_minpoly"); |
---|
287 | setring(R); |
---|
288 | map phi = QT, f; |
---|
289 | setring QT; |
---|
290 | ideal F = preimage(R, phi, I); // corresponds to std(I, f-T) in dp(n),dp(1) |
---|
291 | setring(R); |
---|
292 | ideal F = imap(QT, F); |
---|
293 | return(F); |
---|
294 | } |
---|
295 | |
---|
296 | //////////////////////////////////////////////////////////////////////////////// |
---|
297 | |
---|
298 | /* Assume I is zero-dimensional. |
---|
299 | * Computes a poly F in Q[T] such that |
---|
300 | * <F> = kernel(Q[T] --> basering, T |-> f), |
---|
301 | * T := last variable in the basering. |
---|
302 | */ |
---|
303 | static proc specialAlgDepGTZ(ideal I, poly f) |
---|
304 | { |
---|
305 | def R = basering; |
---|
306 | if(nvars(R) > 1) |
---|
307 | { |
---|
308 | def Rlp = changeord(list(list("dp", 1:(nvars(R)-1)), list("dp", 1:1))); |
---|
309 | setring(Rlp); |
---|
310 | poly f = imap(R, f); |
---|
311 | ideal I; |
---|
312 | } |
---|
313 | ideal K = maxideal(1); |
---|
314 | K[nvars(R)] = 2*var(nvars(R))-f; |
---|
315 | map phi = R, K; |
---|
316 | I = phi(I); |
---|
317 | I = std(I); |
---|
318 | ideal F = I[1]; |
---|
319 | if(nvars(R) > 1) |
---|
320 | { |
---|
321 | setring(R); |
---|
322 | ideal F = imap(Rlp, F); |
---|
323 | } |
---|
324 | return(F); |
---|
325 | } |
---|
326 | |
---|
327 | //////////////////////////////////////////////////////////////////////////////// |
---|
328 | |
---|
329 | /* Assume I is zero-dimensional. |
---|
330 | * Computes a poly F in Q[T], the characteristic polynomial of the map |
---|
331 | * basering/I ---> basering/I defined by the multiplication with f, |
---|
332 | * T := last variable in the basering. |
---|
333 | * In case I is radical, it is the same polynomial as in specialAlgDepEHV. |
---|
334 | */ |
---|
335 | static proc specialAlgDepMonico(ideal I, poly f, int d) |
---|
336 | { |
---|
337 | def R = basering; |
---|
338 | int j; |
---|
339 | matrix M[d][d]; |
---|
340 | ideal J = std(I); |
---|
341 | ideal basis = kbase(J); |
---|
342 | poly vars = var(nvars(R)); |
---|
343 | for(j = nvars(R)-1; j > 0; j--) |
---|
344 | { |
---|
345 | vars = var(j)*vars; |
---|
346 | } |
---|
347 | for(j = 1; j <= d; j++) |
---|
348 | { |
---|
349 | M[1..d, j] = coeffs(reduce(f*basis[j], J), basis, vars); |
---|
350 | } |
---|
351 | ring QT = create_ring(ring_list(R)[1], varstr(R, nvars(R)), "dp", "no_minpoly"); |
---|
352 | matrix M = imap(R, M); |
---|
353 | ideal F = det(M-var(1)*freemodule(d)); |
---|
354 | setring(R); |
---|
355 | ideal F = imap(QT, F); |
---|
356 | return(F); |
---|
357 | } |
---|
358 | |
---|
359 | //////////////////////////////////////////////////////////////////////////////// |
---|
360 | |
---|
361 | static proc specialTest(int d, poly p, ideal I) |
---|
362 | { |
---|
363 | //=== computes a poly F in Q[T] such that <F>=kernel(Q[T]--->basering) |
---|
364 | //=== mapping T to p and test if d=deg(F) |
---|
365 | def R = basering; |
---|
366 | ring Rhelp = create_ring(ring_list(R)[1], "T", "dp", "no_minpoly"); |
---|
367 | setring R; |
---|
368 | map phi = Rhelp,p; |
---|
369 | setring Rhelp; |
---|
370 | ideal F = preimage(R,phi,I); |
---|
371 | int e=deg(F[1]); |
---|
372 | setring R; |
---|
373 | return((e==d), fetch(Rhelp, F)[1]); |
---|
374 | } |
---|
375 | |
---|
376 | //////////////////////////////////////////////////////////////////////////////// |
---|
377 | |
---|
378 | /* Assume d = vector space dim(basering/J). |
---|
379 | * Tries to find a (sparse) linear form r such that d = deg(F), where |
---|
380 | * F is a poly in Q[T] such that <F> = kernel(Q[T]-->basering) mapping T to r. |
---|
381 | * If found, returns (1, r, F). If not found, returns (0, 0, 0). |
---|
382 | */ |
---|
383 | static proc findGen(ideal J, int d) |
---|
384 | { |
---|
385 | def R = basering; |
---|
386 | int n = nvars(R); |
---|
387 | int okay; |
---|
388 | poly F; |
---|
389 | |
---|
390 | /* try trivial transformation */ |
---|
391 | poly r = var(n); |
---|
392 | okay, F = specialTest(d, r, J); |
---|
393 | if(okay) |
---|
394 | { |
---|
395 | return(1, r, F); |
---|
396 | } |
---|
397 | |
---|
398 | /* try transformations of the form var(n) + var(i) */ |
---|
399 | int i; |
---|
400 | for(i = 1; i < n; i++) |
---|
401 | { |
---|
402 | okay, F = specialTest(d, r+var(i), J); |
---|
403 | if(okay) |
---|
404 | { |
---|
405 | return(1, r+var(i), F); |
---|
406 | } |
---|
407 | } |
---|
408 | |
---|
409 | /* try transformations of the form var(n) + \sum var(i) */ |
---|
410 | if(n > 2) |
---|
411 | { |
---|
412 | for(i = 1; i < n; i++) |
---|
413 | { |
---|
414 | r = r + var(i); |
---|
415 | okay, F = specialTest(d, r, J); |
---|
416 | if(okay) |
---|
417 | { |
---|
418 | return(1, r, F); |
---|
419 | } |
---|
420 | } |
---|
421 | } |
---|
422 | |
---|
423 | /* try random transformations */ |
---|
424 | int N = 2; // arbitrarily chosen |
---|
425 | for(i = N; i > 0; i--) |
---|
426 | { |
---|
427 | r = randomLast(100)[n]; |
---|
428 | okay, F = specialTest(d, r, J); |
---|
429 | if(okay) |
---|
430 | { |
---|
431 | return(1, r, F); |
---|
432 | } |
---|
433 | } |
---|
434 | |
---|
435 | /* not found */ |
---|
436 | return(0, 0, 0); |
---|
437 | } |
---|
438 | |
---|
439 | //////////////////////////////////////////////////////////////////////////////// |
---|
440 | |
---|
441 | /* Assume d = vector space dim(basering/I). |
---|
442 | * Tests if I is radical over F_p, where p is some randomly chosen prime. |
---|
443 | * If yes, chooses a linear form r such that d = deg(squarefreepart(F)), where |
---|
444 | * F is a poly in Z/p[T] such that <F> = kernel(Z/p[T]-->Z/p[vars(basering)]) |
---|
445 | * mapping T to r. |
---|
446 | * Returns (1, r), if I is radical over F_p, and (0, 0) otherwise. |
---|
447 | */ |
---|
448 | static proc pTestRad(ideal I, int d) |
---|
449 | { |
---|
450 | int N = 2; // Try N random primes. Value of N can be chosen arbitrarily. |
---|
451 | def R = basering; |
---|
452 | list rl = ringlist(R); |
---|
453 | int p; |
---|
454 | int okay; |
---|
455 | int i; |
---|
456 | for(i = N; i > 0; i--) |
---|
457 | { |
---|
458 | p = prime(random(100000000,536870912)); |
---|
459 | |
---|
460 | // change to characteristic p |
---|
461 | if(typeof(rl[1]) == "int") |
---|
462 | { |
---|
463 | rl[1] = p; |
---|
464 | } |
---|
465 | else |
---|
466 | { |
---|
467 | rl[1][1] = p; |
---|
468 | } |
---|
469 | def Rp(i) = ring(rl); |
---|
470 | setring Rp(i); |
---|
471 | ideal I = imap(R, I); |
---|
472 | |
---|
473 | // find and test transformation |
---|
474 | poly r; |
---|
475 | poly F; |
---|
476 | okay, r, F = findGen(I, d); |
---|
477 | if(okay) |
---|
478 | { |
---|
479 | poly f = gcd(F, diff(F, var(1))); |
---|
480 | if(d == deg(F/f)) // F squarefree? |
---|
481 | { |
---|
482 | setring(R); |
---|
483 | return(1, imap(Rp(i), r)); |
---|
484 | } |
---|
485 | } |
---|
486 | setring(R); |
---|
487 | } |
---|
488 | return(0, 0); |
---|
489 | } |
---|
490 | |
---|
491 | //////////////////////////////////////////////////////////////////////////////// |
---|
492 | |
---|
493 | /* Computes an ideal F such that ncols(F) = nvars(basering), |
---|
494 | * < F[i] > = (I intersected with K[var(i)]), and F[i] is monic. |
---|
495 | */ |
---|
496 | static proc zeroRadP(ideal I) |
---|
497 | { |
---|
498 | intvec opt = option(get); |
---|
499 | option(redSB); |
---|
500 | I = std(I); |
---|
501 | ideal F = finduni(I); // F[i] generates I intersected with K[var(i)] |
---|
502 | F = simplify(F, 1); |
---|
503 | option(set, opt); |
---|
504 | return(F); |
---|
505 | } |
---|
506 | |
---|
507 | //////////////////////////////////////////////////////////////////////////////// |
---|
508 | |
---|
509 | static proc quickSubst(poly h, poly r, ideal I) |
---|
510 | { |
---|
511 | //=== assume h is in Q[x_n], r is in Q[x_1,...,x_n], computes h(r) mod I |
---|
512 | attrib(I,"isSB",1); |
---|
513 | int n = nvars(basering); |
---|
514 | poly q = 1; |
---|
515 | int i,j,d; |
---|
516 | intvec v; |
---|
517 | list L; |
---|
518 | for(i = 1; i <= size(h); i++) |
---|
519 | { |
---|
520 | L[i] = list(leadcoef(h[i]),leadexp(h[i])[n]); |
---|
521 | } |
---|
522 | d = L[1][2]; |
---|
523 | i = 0; |
---|
524 | h = 0; |
---|
525 | |
---|
526 | while(i <= d) |
---|
527 | { |
---|
528 | if(L[size(L)-j][2] == i) |
---|
529 | { |
---|
530 | h = reduce(h+L[size(L)-j][1]*q,I); |
---|
531 | j++; |
---|
532 | } |
---|
533 | q = reduce(q*r,I); |
---|
534 | i++; |
---|
535 | } |
---|
536 | return(h); |
---|
537 | } |
---|
538 | |
---|
539 | //////////////////////////////////////////////////////////////////////////////// |
---|
540 | |
---|
541 | /* Simple switch for specialAlgDepEHV, specialAlgDepGTZ, and |
---|
542 | * specialAlgDepMonico. |
---|
543 | */ |
---|
544 | static proc modpSpecialAlgDep(ideal I, poly f, int d, int alg) |
---|
545 | { |
---|
546 | ideal F; |
---|
547 | if(alg == 1) { F = specialAlgDepEHV(I, f); } |
---|
548 | if(alg == 2) { F = specialAlgDepGTZ(I, f); } |
---|
549 | if(alg == 3) { F = specialAlgDepMonico(I, f, d); } |
---|
550 | F = simplify(F, 1); |
---|
551 | return(F); |
---|
552 | } |
---|
553 | |
---|
554 | //////////////////////////////////////////////////////////////////////////////// |
---|
555 | |
---|
556 | /* The pTest for assPrimes(), to be used in modular(). */ |
---|
557 | static proc pTest_assPrimes(string command, alias list args, alias ideal F, |
---|
558 | int p) |
---|
559 | { |
---|
560 | def br = basering; |
---|
561 | list lbr = ringlist(br); |
---|
562 | if(typeof(lbr[1]) == "int") |
---|
563 | { |
---|
564 | lbr[1] = p; |
---|
565 | } |
---|
566 | else |
---|
567 | { |
---|
568 | lbr[1][1] = p; |
---|
569 | } |
---|
570 | def rp = ring(lbr); |
---|
571 | setring(rp); |
---|
572 | list args_p = fetch(br, args); |
---|
573 | ideal F = fetch(br, F); |
---|
574 | execute("ideal Fp = "+command+"(" |
---|
575 | +Tasks::argsToString("args_p", size(args_p))+");"); |
---|
576 | int k = (Fp[1] == F[1]); |
---|
577 | setring br; |
---|
578 | return(k); |
---|
579 | } |
---|
580 | |
---|
581 | //////////////////////////////////////////////////////////////////////////////// |
---|
582 | |
---|
583 | /* The finalTest for assPrimes(), to be used in modular(). */ |
---|
584 | static proc finalTest_assPrimes(string command, alias list args, ideal F) |
---|
585 | { |
---|
586 | F = cleardenom(F[1]); |
---|
587 | if(deg(F[1]) != args[3]) { return(0); } |
---|
588 | if(gcd(F[1], diff(F[1], var(nvars(basering)))) != 1) { return(0); }; |
---|
589 | if(quickSubst(F[1], args[2], args[1]) != 0) { return(0); } |
---|
590 | return(1); |
---|
591 | } |
---|
592 | |
---|
593 | //////////////////////////////////////////////////////////////////////////////// |
---|
594 | |
---|
595 | /* |
---|
596 | Examples: |
---|
597 | ========= |
---|
598 | |
---|
599 | //=== Test for zeroR |
---|
600 | ring R = 0,(x,y),dp; |
---|
601 | ideal I = xy4-2xy2+x, x2-x, y4-2y2+1; |
---|
602 | |
---|
603 | //=== Cyclic_6 |
---|
604 | ring R = 0,x(1..6),dp; |
---|
605 | ideal I = cyclic(6); |
---|
606 | |
---|
607 | //=== Amrhein |
---|
608 | ring R = 0,(a,b,c,d,e,f),dp; |
---|
609 | ideal I = 2fb+2ec+d2+a2+a, |
---|
610 | 2fc+2ed+2ba+b, |
---|
611 | 2fd+e2+2ca+c+b2, |
---|
612 | 2fe+2da+d+2cb, |
---|
613 | f2+2ea+e+2db+c2, |
---|
614 | 2fa+f+2eb+2dc; |
---|
615 | |
---|
616 | //=== Becker-Niermann |
---|
617 | ring R = 0,(x,y,z),dp; |
---|
618 | ideal I = x2+xy2z-2xy+y4+y2+z2, |
---|
619 | -x3y2+xy2z+xyz3-2xy+y4, |
---|
620 | -2x2y+xy4+yz4-3; |
---|
621 | |
---|
622 | //=== Roczen |
---|
623 | ring R = 0,(a,b,c,d,e,f,g,h,k,o),dp; |
---|
624 | ideal I = o+1, k4+k, hk, h4+h, gk, gh, g3+h3+k3+1, |
---|
625 | fk, f4+f, eh, ef, f3h3+e3k3+e3+f3+h3+k3+1, |
---|
626 | e3g+f3g+g, e4+e, dh3+dk3+d, dg, df, de, |
---|
627 | d3+e3+f3+1, e2g2+d2h2+c, f2g2+d2k2+b, |
---|
628 | f2h2+e2k2+a; |
---|
629 | |
---|
630 | //=== FourBodyProblem |
---|
631 | //=== 4 bodies with equal masses, before symmetrisation. |
---|
632 | //=== We are looking for the real positive solutions |
---|
633 | ring R = 0,(B,b,D,d,F,f),dp; |
---|
634 | ideal I = (b-d)*(B-D)-2*F+2, |
---|
635 | (b-d)*(B+D-2*F)+2*(B-D), |
---|
636 | (b-d)^2-2*(b+d)+f+1, |
---|
637 | B^2*b^3-1,D^2*d^3-1,F^2*f^3-1; |
---|
638 | |
---|
639 | //=== Reimer_5 |
---|
640 | ring R = 0,(x,y,z,t,u),dp; |
---|
641 | ideal I = 2x2-2y2+2z2-2t2+2u2-1, |
---|
642 | 2x3-2y3+2z3-2t3+2u3-1, |
---|
643 | 2x4-2y4+2z4-2t4+2u4-1, |
---|
644 | 2x5-2y5+2z5-2t5+2u5-1, |
---|
645 | 2x6-2y6+2z6-2t6+2u6-1; |
---|
646 | |
---|
647 | //=== ZeroDim.example_12 |
---|
648 | ring R = 0, (x, y, z), lp; |
---|
649 | ideal I = 7xy+x+3yz+4y+2z+10, |
---|
650 | x3+x2y+3xyz+5xy+3x+2y3+6y2z+yz+1, |
---|
651 | 3x4+2x2y2+3x2y+4x2z2+xyz+xz2+6y2z+5z4; |
---|
652 | |
---|
653 | //=== ZeroDim.example_27 |
---|
654 | ring R = 0, (w, x, y, z), lp; |
---|
655 | ideal I = -2w2+9wx+9wy-7wz-4w+8x2+9xy-3xz+8x+6y2-7yz+4y-6z2+8z+2, |
---|
656 | 3w2-5wx-3wy-6wz+9w+4x2+2xy-2xz+7x+9y2+6yz+5y+7z2+7z+5, |
---|
657 | 7w2+5wx+3wy-5wz-5w+2x2+9xy-7xz+4x-4y2-5yz+6y-4z2-9z+2, |
---|
658 | 8w2+5wx-4wy+2wz+3w+5x2+2xy-7xz-7x+7y2-8yz-7y+7z2-8z+8; |
---|
659 | |
---|
660 | //=== Cassou_1 |
---|
661 | ring R = 0, (b,c,d,e), dp; |
---|
662 | ideal I = 6b4c3+21b4c2d+15b4cd2+9b4d3+36b4c2+84b4cd+30b4d2+72b4c+84b4d-8b2c2e |
---|
663 | -28b2cde+36b2d2e+48b4-32b2ce-56b2de-144b2c-648b2d-32b2e-288b2-120, |
---|
664 | 9b4c4+30b4c3d+39b4c2d2+18b4cd3+72b4c3+180b4c2d+156b4cd2+36b4d3+216b4c2 |
---|
665 | +360b4cd+156b4d2-24b2c3e-16b2c2de+16b2cd2e+24b2d3e+288b4c+240b4d |
---|
666 | -144b2c2e+32b2d2e+144b4-432b2c2-720b2cd-432b2d2-288b2ce+16c2e2-32cde2 |
---|
667 | +16d2e2-1728b2c-1440b2d-192b2e+64ce2-64de2-1728b2+576ce-576de+64e2 |
---|
668 | -240c+1152e+4704, |
---|
669 | -15b2c3e+15b2c2de-90b2c2e+60b2cde-81b2c2+216b2cd-162b2d2-180b2ce |
---|
670 | +60b2de+40c2e2-80cde2+40d2e2-324b2c+432b2d-120b2e+160ce2-160de2-324b2 |
---|
671 | +1008ce-1008de+160e2+2016e+5184, |
---|
672 | -4b2c2+4b2cd-3b2d2-16b2c+8b2d-16b2+22ce-22de+44e+261; |
---|
673 | |
---|
674 | ================================================================================ |
---|
675 | |
---|
676 | The following timings are conducted on an Intel Xeon X5460 with 4 CPUs, 3.16 GHz |
---|
677 | each, 64 GB RAM under the Gentoo Linux operating system by using the 32-bit |
---|
678 | version of Singular 3-1-1. |
---|
679 | The results of the timinings are summarized in the following table where |
---|
680 | assPrimes* denotes the parallelized version of the algorithm on 4 CPUs and |
---|
681 | (1) approach of Eisenbud, Hunecke, Vasconcelos (cf. specialAlgDepEHV), |
---|
682 | (2) approach of Gianni, Trager, Zacharias (cf. specialAlgDepGTZ), |
---|
683 | (3) approach of Monico (cf. specialAlgDepMonico). |
---|
684 | |
---|
685 | Example | minAssGTZ | assPrimes assPrimes* |
---|
686 | | | (1) (2) (3) (1) (2) (3) |
---|
687 | -------------------------------------------------------------------- |
---|
688 | Cyclic_6 | 5 | 5 10 7 4 7 6 |
---|
689 | Amrhein | 1 | 3 3 5 1 2 21 |
---|
690 | Becker-Niermann | - | 0 0 1 0 0 0 |
---|
691 | Roczen | 0 | 3 2 0 2 4 1 |
---|
692 | FourBodyProblem | - | 139 139 148 96 83 96 |
---|
693 | Reimer_5 | - | 132 128 175 97 70 103 |
---|
694 | ZeroDim.example_12 | 170 | 125 125 125 67 68 63 |
---|
695 | ZeroDim.example_27 | 27 | 215 226 215 113 117 108 |
---|
696 | Cassou_1 | 525 | 112 112 112 56 56 57 |
---|
697 | |
---|
698 | minAssGTZ (cf. primdec_lib) runs out of memory for Becker-Niermann, |
---|
699 | FourBodyProblem and Reimer_5. |
---|
700 | |
---|
701 | ================================================================================ |
---|
702 | |
---|
703 | //=== One component at the origin |
---|
704 | |
---|
705 | ring R = 0, (x,y), dp; |
---|
706 | poly f1 = (y5 + y4x7 + 2x8); |
---|
707 | poly f2 = (y3 + 7x4); |
---|
708 | poly f3 = (y7 + 2x12); |
---|
709 | poly f = f1*f2*f3 + y19; |
---|
710 | ideal I = f, diff(f, x), diff(f, y); |
---|
711 | |
---|
712 | ring R = 0, (x,y), dp; |
---|
713 | poly f1 = (y5 + y4x7 + 2x8); |
---|
714 | poly f2 = (y3 + 7x4); |
---|
715 | poly f3 = (y7 + 2x12); |
---|
716 | poly f4 = (y11 + 2x18); |
---|
717 | poly f = f1*f2*f3*f4 + y30; |
---|
718 | ideal I = f, diff(f, x), diff(f, y); |
---|
719 | |
---|
720 | ring R = 0, (x,y), dp; |
---|
721 | poly f1 = (y15 + y14x7 + 2x18); |
---|
722 | poly f2 = (y13 + 7x14); |
---|
723 | poly f3 = (y17 + 2x22); |
---|
724 | poly f = f1*f2*f3 + y49; |
---|
725 | ideal I = f, diff(f, x), diff(f, y); |
---|
726 | |
---|
727 | ring R = 0, (x,y), dp; |
---|
728 | poly f1 = (y15 + y14x20 + 2x38); |
---|
729 | poly f2 = (y19 + 3y17x50 + 7x52); |
---|
730 | poly f = f1*f2 + y36; |
---|
731 | ideal I = f, diff(f, x), diff(f, y); |
---|
732 | |
---|
733 | //=== Several components |
---|
734 | |
---|
735 | ring R = 0, (x,y), dp; |
---|
736 | poly f1 = (y5 + y4x7 + 2x8); |
---|
737 | poly f2 = (y13 + 7x14); |
---|
738 | poly f = f1*subst(f2, x, x-3, y, y+5); |
---|
739 | ideal I = f, diff(f, x), diff(f, y); |
---|
740 | |
---|
741 | ring R = 0, (x,y), dp; |
---|
742 | poly f1 = (y5 + y4x7 + 2x8); |
---|
743 | poly f2 = (y3 + 7x4); |
---|
744 | poly f3 = (y7 + 2x12); |
---|
745 | poly f = f1*f2*subst(f3, y, y+5); |
---|
746 | ideal I = f, diff(f, x), diff(f, y); |
---|
747 | |
---|
748 | ring R = 0, (x,y), dp; |
---|
749 | poly f1 = (y5 + 2x8); |
---|
750 | poly f2 = (y3 + 7x4); |
---|
751 | poly f3 = (y7 + 2x12); |
---|
752 | poly f = f1*subst(f2,x,x-1)*subst(f3, y, y+5); |
---|
753 | ideal I = f, diff(f, x), diff(f, y); |
---|
754 | */ |
---|
755 | |
---|