source: git/Singular/LIB/primdecint.lib @ 2e7410

spielwiese
Last change on this file since 2e7410 was 2e7410, checked in by Stefan Steidel <steidel@…>, 13 years ago
new libs git-svn-id: file:///usr/local/Singular/svn/trunk@13273 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100755
File size: 40.1 KB
Line 
1////////////////////////////////////////////////////////////////////////////////
2version="$Id: primdecint.lib,v 1.16 2010/06/01 08:01:11 Singular Exp $";
3category = "Commutative Algebra";
4info="
5LIBRARY:  primdecint.lib   primary decomposition over the integers
6
7AUTHORS:  G. Pfister      pfister@mathematik.uni-kl.de
8@*        A. Sadiq        afshanatiq@gmail.com
9@*        S. Steidel      steidel@mathematik.uni-kl.de
10
11NOTE:
12
13  A library for computing the primary decomposition of an ideal in the polynomial
14  ring over the integers, Z[x_1,...,x_n].
15
16PROCEDURES:
17 primdecZ(I);       compute the primary decomposition of I
18 minAssZ(I);        compute the minimal associated primes of I
19 radicalZ(I);       compute the radical of I
20 heightZ(I);        compute the height of I
21 equidimZ(I);       compute the equidimensional part of I
22";
23
24LIB "crypto.lib";
25
26////////////////////////////////////////////////////////////////////////////////
27
28
29proc primdecZ(ideal I, list #)
30"USAGE:  primdecZ(I); I ideal
31NOTE:    If size(#) > 0, then #[1] is the number of available processors for
32         the computation. Parallelization is just applicable using 32-bit Singular
33         version since MP-links are not compatible with 64-bit Singular version.
34RETURN:  a list pr of primary ideals and their associated primes:
35@format
36   pr[i][1]   the i-th primary component,
37   pr[i][2]   the i-th prime component.
38@end format
39EXAMPLE: example primdecZ; shows an example
40"
41{
42   if(size(I)==0){return(list(ideal(0),ideal(0)));}
43
44   
45   //--------------------  Initialize optional parameters  ------------------------
46   if(size(#) > 0)
47   {
48      if(size(#) == 1)
49      {
50         int n = #[1];
51         if((n > 1) && (1 - system("with","MP")))
52         {
53            "========================================================================";
54            "There is no MP available on your system. Since this is necessary to     ";
55            "parallelize the algorithm, the computation will be done without forking.";
56            "========================================================================";
57            n = 1;
58         }
59         ideal TES = 1;
60      }
61      if(size(#) == 2)
62      {
63         int n = #[1];
64         if((n > 1) && (1 - system("with","MP")))
65         {
66            "========================================================================";
67            "There is no MP available on your system. Since this is necessary to     ";
68            "parallelize the algorithm, the computation will be done without forking.";
69            "========================================================================";
70            n = 1;
71         } 
72         ideal TES = #[2];
73      }
74   }
75   else
76   {
77      int n = 1;
78      ideal TES = 1;
79   }
80
81   
82   if(deg(I[1])==0)
83   {
84      ideal J=I;
85   }
86   else
87   {
88      ideal J=stdZ(I);
89   }
90   
91   ideal K,N;
92   def R=basering;
93   number s;
94   list rl=ringlist(R);
95   int i,j,p,m,ex,nu,k_link;
96   list P,B,IS;
97   ideal Q,JJ;
98   ideal TQ=1;
99   if(deg(J[1])==0)
100   {
101      //=== I intersected with Z is not zero
102      list rp=rl;
103      rp[1]=0;
104      //=== q is generator of I intersect Z
105      number q=leadcoef(J[1]);
106      def Rhelp=ring(rp);
107      setring Rhelp;
108      number q=imap(R,q);
109      //=== computes the primes occuring in a generator of I intersect Z
110 
111     
112     
113      list L = primefactors(q);
114     
115
116     
117      list A;
118     
119      ideal J = imap(R,J);
120
121
122     
123      for(j=1;j<=size(L[3]);j++)
124      {
125         if(L[3][j] > 1){ ex = 1; break; }
126
127      }
128     
129      if(printlevel >= 10)
130      {
131         "n = "+string(n);
132         "size(L[3]) = "+string(size(L[3]));
133      }
134
135      int RT = rtimer;
136      if((n > 1) && (n < size(L[3])))
137      {
138
139//-----  Create n1 links l(1),...,l(n1), open all of them and compute  ---------
140//-----  standard basis for the primes L[2],...,L[n + 1].              ---------
141
142         for(i = 1; i <= n; i++)
143         {
144            p=int(L[2][i + 1]);
145            nu=int(L[3][i + 1]);
146            link l(i) = "MPtcp:fork";
147//            link l(i) = "ssi:fork";
148            open(l(i));
149            write(l(i), quote(modp(eval(J), eval(p), eval(nu))));
150         }
151
152         p = int(L[2][1]);
153         nu = int(L[3][1]);
154         int t = timer;
155         A[size(A)+1] = modp(J, p, nu);
156         t = timer - t;
157         if(t > 60) { t = 60; }
158         int i_sleep = system("sh", "sleep "+string(t));
159         
160         j = n + 2;
161 
162         while(j <= size(L[3]) + 1)
163         {
164            for(i = 1; i <= n; i++)
165            {
166               if(status(l(i), "read", "ready"))                         // ask if link l(i) is ready otherwise sleep for t seconds
167               {
168                  A[size(A)+1] = read(l(i));                             // read the result from l(i)
169                 
170                  if(j <= size(L[3]))
171                  {
172                     p=int(L[2][j]);
173                     nu=int(L[3][j]);
174                     write(l(i), quote(modp(eval(J), eval(p), eval(nu))));
175                     j++;
176                  }
177                  else
178                  {
179                     k_link++;
180                     close(l(i));
181                  }
182               }
183            }
184            if(k_link == n)                                              // k_link describes the number of closed links
185            {
186               j++;
187            }
188            i_sleep = system("sh", "sleep "+string(t));
189         }
190
191      }
192      else
193      {
194         for(j=1;j<=size(L[3]);j++)
195         {
196            A[size(A)+1] = modp(J, L[2][j], L[3][j]);
197         }
198      }
199
200     
201      setring R;
202      list A = imap(Rhelp,A);
203      if(printlevel >= 10)
204      {
205         "A is computed in "+string(rtimer - RT)+" seconds.";
206      }
207      for(i=1;i<=size(A);i++)
208      {
209      //=== computes for all p in L the minimal associated primes of IZ/p[variables]
210         p = int(A[i][2]);
211         if(printlevel >= 10)
212         {
213            "p = "+string(p);
214            RT = rtimer;
215         }
216         nu = int(A[i][3]);
217         //=== maximal power of p dividing q, generator of I intersect Z
218         s = p^nu;
219
220         rp[1] = p;
221         def S = ring(rp);
222         setring S;
223         ideal J = imap(R,J);
224         setring R;
225
226         if(nu>1)
227         {
228            //=== p is of multiplicity > 1 in q
229
230            B = A[i][1];
231            for(j=1;j<=size(B);j++)
232            {
233               //=== the minimal associated primes of I
234               K=B[j],p;
235               K=stdZ(K);
236               B[j]=K;
237            }
238            for(j=1;j<=size(B);j++)
239            {
240               K=B[j];
241               //=== compute maximal independent set for KZ/p[variables]
242             
243               setring S;
244               J=imap(R,K);
245               J=simplify(J,2);
246               attrib(J,"isSB",1);
247               IS=maxIndependSet(J);
248               setring R;
249               //=== computing the pseudo primary and extract it
250               N=J,s;
251               N=stdZ(N);
252               Q=extractZ(N,j,IS,B);
253               //=== test for useless primaries
254               if(size(reduce(TES,Q))>0)
255               {
256                  TQ=intersectZ(TQ,Q);
257                  P[size(P)+1]=list(Q,K);
258               }
259            }
260         }
261         else
262         {
263            //=== p is of multiplicity 1 in q we can compute the
264            //=== primary decomposition directly
265
266            B = A[i][1];
267            for(j=1;j<=size(B);j++)
268            {
269               K=B[j][2],p;
270               K=stdZ(K);             
271               Q=B[j][1],p;
272               Q=stdZ(Q);
273               if(size(reduce(TES,Q))>0)
274               {
275                  //TQ=intersectZ(TQ,Q);
276                  P[size(P)+1]=list(Q,K);
277               }
278            }
279            if(ex)
280            {
281               JJ=imap(S,J);
282               JJ=JJ,p;
283               JJ=stdZ(JJ);
284               TQ=intersectZ(TQ,JJ);
285            }
286         }
287         kill S;
288         if(printlevel >= 10)
289         {
290            string(p)+" done in "+string(rtimer - RT)+" seconds.";
291         }
292      }
293     
294      setring R;
295      if(!ex){return(P);}
296      J=stdZ(J);
297      TQ=intersectZ(TQ,TES);   
298      if(size(reduce(TQ,J))!=0)
299      {
300         //=== taking care about embedded components
301         K=stdZ(quotientZ(J,TQ));
302         ideal W=K;
303         m++;
304         while(size(reduce(intersectZ(W,TQ),J))!=0)
305         {
306            //W=stdZ(addIdealZ(I,K^m));
307            W=stdZ(addIdealZ(I,specialPowerZ(K,m)));
308            m++;
309         }
310         list E=primdecZ(W,n,TQ);
311         for(i=1;i<=size(E);i++)
312         {
313            P[size(P)+1]=E[i];
314         }
315      }
316      return(P);
317   }
318
319   //==== the ideal intersected with Z is zero
320   rl[1]=0;
321   def Rhelp=ring(rl);
322   setring Rhelp;
323   ideal J=imap(R,J);
324   J=std(J);
325   //=== the primary decomposition over Q which gives the primary decomposition
326   //=== of I:h for a suitable integer h
327   list pr=primdecGTZ(J);
328   for(i=1;i<=size(pr);i++)
329   {
330      pr[i]=list(std(pr[i][1]),std(pr[i][2]));
331   }
332   setring R;
333   list pr=imap(Rhelp,pr);
334   //=== intersection with Z[variables]
335   for(i=1;i<=size(pr);i++)
336   {
337      pr[i]=list(coefZ(pr[i][1])[1],coefZ(pr[i][2])[1]);
338   }
339   //=== find h in Z such that I is the intersection of I:h and <I,h>
340   //=== and I:h = IQ[variables] intersected with Z[varables]
341   list H =coefZ(J);
342   ideal Y=H[1];
343   int h=H[2];
344   J=J,h;
345   //=== call primary decomposition over Z for <I,h>
346   list M;
347   if(h!=1)
348   {
349       M=primdecZ(J,n,Y);       
350       j=0;
351       //=== remove useless primary ideals
352       while(j<size(M))
353       {
354          j++;
355          M[j][1]=stdZ(M[j][1]);
356          for(i=1;i<=size(pr);i++)
357          {
358             if(size(reduce(pr[i][1],M[j][1]))==0)
359             {
360                M=delete(M,j);
361                j--;
362                break;
363             }
364          }
365      }
366      for(i=1;i<=size(M);i++)
367      {
368         pr[size(pr)+1]=M[i];
369      }
370
371   }
372   return(pr);
373}
374example
375{ "EXAMPLE:";  echo = 2;
376   ring R=integer,(a,b,c,d),dp;
377   ideal I1=9,a,b;
378   ideal I2=3,c;
379   ideal I3=11,2a,7b;
380   ideal I4=13a2,17b4;
381   ideal I5=9c5,6d5;
382   ideal I6=17,a15,b15,c15,d15;
383   ideal I=intersectZ(I1,I2);
384   I=intersectZ(I,I3);
385   I=intersectZ(I,I4);
386   I=intersectZ(I,I5);
387   I=intersectZ(I,I6);
388   primdecZ(I);
389   ideal J=intersectZ(ideal(17,a),ideal(17,a2,b));
390   primdecZ(J);
391   ideal K=intersectZ(ideal(9,a+3),ideal(9,b+3));
392   primdecZ(K);
393}
394
395///////////////////////////////////////////////////////////////////////////////
396
397proc minAssZ(ideal I)
398"USAGE:  minAssZ(I); I ideal
399RETURN:  a list pr of associated primes:
400EXAMPLE: example minAssZ; shows an example
401"
402{
403   if(size(I)==0){return(list(ideal(0)));}
404   if(deg(I[1])==0)
405   {
406      ideal J=I;
407   }
408   else
409   {
410      ideal J=stdZ(I);
411   }
412   ideal K;
413   def R=basering;
414   list rl=ringlist(R);
415   int i,j,p,m;
416   list P,B;
417   if(deg(J[1])==0)
418   {
419      //=== I intersected with Z is not zero
420      list rp=rl;
421      rp[1]=0;
422      number q=leadcoef(J[1]);
423      def Rhelp=ring(rp);
424      setring Rhelp;
425      number q=imap(R,q);
426      //=== computes the primes occuring in a generator of I intersect Z
427      list L=PollardRho(q,5000,1); 
428      for(i=1;i<=size(L);i++)
429      {
430      //=== computes for all p in L the minimal associated primes of IZ/p[variables]
431         p=int(L[i]);
432         setring R;
433         rp[1]=p;
434         def S=ring(rp);
435         setring S;
436         ideal J=imap(R,J);
437         list A=minAssGTZ(J);   
438         setring R;
439         B=imap(S,A);
440         kill S;
441         for(j=1;j<=size(B);j++)
442         {
443            //=== the minimal associated primes of I
444            if(B[j][1]!=1)
445            {
446               K=B[j],p;
447               K=stdZ(K);
448               P[size(P)+1]=K;
449            }
450         }
451         setring Rhelp;
452      }
453      setring R;
454      return(P);
455   }
456   //==== the ideal intersected with Z is zero
457   rl[1]=0;
458   def Rhelp=ring(rl);
459   setring Rhelp;
460   ideal J=imap(R,J);
461   J=std(J);
462   //=== the primary decomposition over Q which gives the primary decomposition
463   //=== of I:h for a suitable integer h
464   list pr=minAssGTZ(J);
465   for(i=1;i<=size(pr);i++)
466   {
467      pr[i]=std(pr[i]);
468   }
469   setring R;
470   list pr=imap(Rhelp,pr);
471   //=== intersection with Z[variables]
472   for(i=1;i<=size(pr);i++)
473   {
474      pr[i]=coefZ(pr[i])[1];
475   }
476   //=== find h in Z such that I is the intersection of I:h and I,h
477   //=== and I:h =IQ[variables] intersected with Z[varables]
478   list H=coefZ(J);
479   int h=H[2];
480   J=J,h;
481   //=== call associated primes over Z for I,h
482   list M;
483   if(h!=1)
484   {
485       M=minAssZ(J);
486       //=== remove non-minimal primes
487       j=0;
488       while(j<size(M))
489       {
490          j++;
491          M[j]=stdZ(M[j]);
492          for(i=1;i<=size(pr);i++)
493          {
494             if(size(reduce(pr[i],M[j]))==0)
495             {
496                M=delete(M,j);
497                j--;
498                break;
499             }
500          }
501      }
502      for(i=1;i<=size(M);i++)
503      {
504         pr[size(pr)+1]=M[i];
505      }
506   }
507   return(pr);
508}
509example
510{ "EXAMPLE:";  echo = 2;
511   ring R=integer,(a,b,c,d),dp;
512   ideal I1=9,a,b;
513   ideal I2=3,c;
514   ideal I3=11,2a,7b;
515   ideal I4=13a2,17b4;
516   ideal I5=9c5,6d5;
517   ideal I6=17,a15,b15,c15,d15;
518   ideal I=intersectZ(I1,I2);
519   I=intersectZ(I,I3);
520   I=intersectZ(I,I4);
521   I=intersectZ(I,I5);
522   I=intersectZ(I,I6);
523   minAssZ(I);
524   ideal J=intersectZ(ideal(17,a),ideal(17,a2,b));
525   minAssZ(J);
526   ideal K=intersectZ(ideal(9,a+3),ideal(9,b+3));
527   minAssZ(K);
528}
529
530///////////////////////////////////////////////////////////////////////////////
531
532proc heightZ(ideal I)
533"USAGE:  heightZ(I); I ideal
534RETURN:  the height of the input ideal
535EXAMPLE: example heightZ; shows an example
536"
537{
538   if(size(I)==0){return(0);}
539   if(deg(I[1])==0)
540   {
541      ideal J=I;
542   }
543   else
544   {
545      ideal J=stdZ(I);
546   }
547   ideal K=1;
548   def R=basering;
549   list rl=ringlist(R);
550   int i,j,p,m;
551   list P;
552   ideal B;
553   if(deg(J[1])==0)
554   {
555      //=== I intersected with Z is not zero
556      m=nvars(R);
557      list rp=rl;
558      rp[1]=0;
559      number q=leadcoef(J[1]);
560      def Rhelp=ring(rp);
561      setring Rhelp;
562      number q=imap(R,q);
563      //=== computes the primes occuring in a generator of I intersect Z
564      list L=PollardRho(q,5000,1); 
565      for(i=1;i<=size(L);i++)
566      {
567      //=== computes for all p in L the std of IZ/p[variables]
568         p=int(L[i]);
569         setring R;
570         rp[1]=p;
571         def S=ring(rp);
572         setring S;
573         ideal J=imap(R,J);
574         j=nvars(R)-dim(std(J));
575         if(j<m){m=j;}   
576         setring Rhelp;
577         kill S;
578      }
579      setring R;
580      return(m+1);
581   }
582   //==== the ideal intersected with Z is zero
583   rl[1]=0;
584   def Rhelp=ring(rl);
585   setring Rhelp;
586   ideal J=imap(R,J);
587   J=std(J);
588   m=nvars(R)-dim(J);
589   //=== the height over Q
590   //=== of I:h for a suitable integer h
591   setring R;
592   //=== find h in Z such that I is the intersection of I:h and I,h
593   //=== and I:h =IQ[variables] intersected with Z[varables]
594   list H=coefZ(J);
595   int h=H[2];
596   J=J,h;
597   //=== call height over Z for I,h
598   if(h!=1)
599   {
600      j=heightZ(J);
601      if(j<m){m=j;}
602   }
603   return(m);
604}
605example
606{ "EXAMPLE:";  echo = 2;
607   ring R=integer,(a,b,c,d),dp;
608   ideal I1=9,a,b;
609   ideal I2=3,c;
610   ideal I3=11,2a,7b;
611   ideal I4=13a2,17b4;
612   ideal I5=9c5,6d5;
613   ideal I6=17,a15,b15,c15,d15;
614   ideal I=intersectZ(I1,I2);
615   I=intersectZ(I,I3);
616   I=intersectZ(I,I4);
617   I=intersectZ(I,I5);
618   I=intersectZ(I,I6);
619   heightZ(I);
620}
621
622///////////////////////////////////////////////////////////////////////////////
623
624proc radicalZ(ideal I)
625"USAGE:  radicalZ(I); I ideal
626RETURN:  the radcal of the input ideal
627EXAMPLE: example radicalZ; shows an example
628"
629{
630   if(size(I)==0){return(ideal(0));}
631   if(deg(I[1])==0)
632   {
633      ideal J=I;
634   }
635   else
636   {
637      ideal J=stdZ(I);
638   }
639   ideal K=1;
640   def R=basering;
641   list rl=ringlist(R);
642   int i,j,p,m;
643   list P;
644   ideal B;
645   if(deg(J[1])==0)
646   {
647      //=== I intersected with Z is not zero
648      list rp=rl;
649      rp[1]=0;
650      number q=leadcoef(J[1]);
651      def Rhelp=ring(rp);
652      setring Rhelp;
653      number q=imap(R,q);
654      //=== computes the primes occuring in a generator of I intersect Z
655      list L=PollardRho(q,5000,1); 
656      for(i=1;i<=size(L);i++)
657      {
658      //=== computes for all p in L the radical of IZ/p[variables]
659         p=int(L[i]);
660         setring R;
661         rp[1]=p;
662         def S=ring(rp);
663         setring S;
664         ideal J=imap(R,J);
665         ideal A=radical(J);   
666         setring R;
667         B=imap(S,A);
668         kill S;
669         B=B,p;
670         B=stdZ(B);
671         K=stdZ(intersectZ(K,B));
672         setring Rhelp;
673      }
674      setring R;
675      return(K);
676   }
677   //==== the ideal intersected with Z is zero
678   rl[1]=0;
679   def Rhelp=ring(rl);
680   setring Rhelp;
681   ideal J=imap(R,J);
682   J=std(J);
683   //=== the radical over Q which gives the radical
684   //=== of I:h for a suitable integer h
685   ideal K=std(radical(J));
686   setring R;
687   K=imap(Rhelp,K);
688   //=== intersection with Z[variables]
689   K=coefZ(K)[1];
690   //=== find h in Z such that I is the intersection of I:h and I,h
691   //=== and I:h =IQ[variables] intersected with Z[varables]
692   list H=coefZ(J);
693   int h=H[2];
694   J=J,h;
695   //=== call radical over Z for I,h
696   if(h!=1)
697   {
698      ideal M=radicalZ(J);
699      K=intersectZ(K,M);
700   }
701   return(K);
702}
703example
704{ "EXAMPLE:";  echo = 2;
705   ring R=integer,(a,b,c,d),dp;
706   ideal I1=9,a,b;
707   ideal I2=3,c;
708   ideal I3=11,2a,7b;
709   ideal I4=13a2,17b4;
710   ideal I5=9c5,6d5;
711   ideal I6=17,a15,b15,c15,d15;
712   ideal I=intersectZ(I1,I2);
713   I=intersectZ(I,I3);
714   I=intersectZ(I,I4);
715   I=intersectZ(I,I5);
716   I=intersectZ(I,I6);
717   radicalZ(I);
718   ideal J=intersectZ(ideal(17,a),ideal(17,a2,b));
719   radicalZ(J);
720}
721
722///////////////////////////////////////////////////////////////////////////////
723
724proc equidimZ(ideal I)
725"USAGE:  equidimZ(I); I ideal
726RETURN:  the part of minimal height
727EXAMPLE: example equidimZ; shows an example
728"
729{
730   if(size(I)==0){return(ideal(0));}
731   if(deg(I[1])==0)
732   {
733      ideal J=I;
734   }
735   else
736   {
737      ideal J=stdZ(I);
738   }
739   int he=heightZ(J);
740   ideal K,N;
741   def R=basering;
742   number s;
743   list rl=ringlist(R);
744   int i,j,p,m,ex;
745   list P,IS,B;
746   ideal Q,JJ,E;
747   ideal TQ=1;
748   if(deg(J[1])==0)
749   {
750      //=== I intersected with Z is not zero
751      list rp=rl;
752      rp[1]=0;
753      //=== generator of I intersect Z
754      number q=leadcoef(J[1]);
755      def Rhelp=ring(rp);
756      setring Rhelp;
757      number q=imap(R,q);
758      number s;
759      //=== computes the primes occuring in a generator of I intersect Z
760      list L=PollardRho(q,5000,1); 
761      list Le;
762      for(i=1;i<=size(L);i++)
763      {
764         L[i]=int(L[i]);
765         p=int(L[i]);
766         j=0;
767         s=q;
768         while((s mod p)==0)
769         {
770            j++;
771            s=s/p;
772         }
773         Le[i]=j;
774      }
775      for(i=1;i<=size(L);i++)
776      {
777      //=== computes for all p in L the minimal associated primes of IZ/p[variables]
778         p=int(L[i]);
779         j=Le[i];
780         setring R;
781         //=== maximal power of p dividing q, generator of I intersect Z
782         s=p^j;
783         rp[1]=p;
784         def S=ring(rp);
785         setring S;
786         ideal J=imap(R,J);
787         J=std(J);
788         if(nvars(R)-dim(J)+1==he)
789         {
790            if(j>1)
791            {
792               //=== p is of multiplicity >1 in q
793               list A=minAssGTZ(J); 
794               j=0;
795               while(j<size(A))
796               {
797                  j++;
798                  if(dim(std(A[j]))!=nvars(R)-he+1)
799                  {
800                     A=delete(A,j);
801                     j--;
802                  }
803               }
804               setring R;
805               B=imap(S,A);
806               for(j=1;j<=size(B);j++)
807               {
808                  //=== the minimal associated primes of I
809                  K=B[j],p;
810                  K=stdZ(K);
811                  B[j]=K;
812               }
813               for(j=1;j<=size(B);j++)
814               {
815                  K=B[j];
816                  //=== compute maximal independent set for KZ/p[variables]
817                  setring S;
818                  J=imap(R,K);
819                  J=simplify(J,2);
820                  attrib(J,"isSB",1);
821                  IS=maxIndependSet(J);
822                  setring R;
823                  //=== computing the pseudo primary and extract it
824                  N=J,s;
825                  N=stdZ(N);
826                  Q=extractZ(N,j,IS,B);
827                  TQ=intersectZ(TQ,Q);         
828               }
829               setring Rhelp;
830            }
831            else
832            {
833               //=== p is of multiplicity 1 in q we can compute the
834               //=== equidimensional part directly
835               ideal E=equidimMax(J);
836               setring R;
837               E=imap(S,E);
838               E=E,p;
839               E=stdZ(E);
840               TQ=intersectZ(TQ,E);
841            }
842            kill S;
843            setring Rhelp;
844         }
845      }
846      setring R;
847      return(TQ);
848   }
849   //==== the ideal intersected with Z is zero
850   rl[1]=0;
851   def Rhelp=ring(rl);
852   setring Rhelp;
853   ideal J=imap(R,J);
854   J=std(J);
855   //=== the equidimensional part over Q which gives the equdimensional part
856   //=== of I:h for a suitable integer h
857   ideal E=1;
858   if(nvars(R)-he==dim(J))
859   {
860      E=std(equidimMax(J));
861   }
862   setring R;
863   ideal  E =imap(Rhelp,E);
864   //=== intersection with Z[variables]
865   E=coefZ(E)[1];
866   //=== find h in Z such that I is the intersection of I:h and I,h
867   //=== and I:h =IQ[variables] intersected with Z[varables]
868   int h =coefZ(J)[2];         
869   J=J,h;
870   //=== call equidimensional part over Z for I,h
871   ideal M;
872   if(h!=1)
873   {
874       M=equidimZ(J); 
875       if(he==heightZ(M))
876       {
877          E=intersectZ(M,E);
878       }   
879   }
880   return(E);
881}
882example
883{ "EXAMPLE:";  echo = 2;
884   ring R=integer,(a,b,c,d),dp;
885   ideal I1=9,a,b;
886   ideal I2=3,c;
887   ideal I3=11,2a,7b;
888   ideal I4=13a2,17b4;
889   ideal I5=9c5,6d5;
890   ideal I6=17,a15,b15,c15,d15;
891   ideal I=intersectZ(I1,I2);
892   I=intersectZ(I,I3);
893   I=intersectZ(I,I4);
894   I=intersectZ(I,I5);
895   I=intersectZ(I,I6);
896   equidimZ(I);
897}
898
899///////////////////////////////////////////////////////////////////////////////
900
901static proc modp(ideal J, int p, int nu)
902
903{
904   
905   def R = basering;
906 
907   list rp = ringlist(R);
908   rp[1] = p;
909   def Rp = ring(rp);
910   setring Rp;
911   ideal J = imap(R,J);
912   if(nu > 1)
913   {
914      //=== p is of multiplicity > 1 in q
915      list A = minAssGTZ(J);
916      setring R;
917     
918      list A = imap(Rp,A);
919
920      return(list(A,p,nu));
921 
922   }
923   
924   else
925   
926   {
927     
928      list A = primdecGTZ(J);
929     
930      setring R;
931     
932      list A = imap(Rp,A);
933     
934      return(list(A,p,nu));
935   
936   }
937
938}
939
940
941////////////////////////////////////////////////////////////////////////////////
942
943static proc coefPrimeZ(ideal I)
944{
945//=== computes the primes occurning in the product of the leading coefficients of I
946   number h=1;
947   int i;
948   for(i=1;i<=size(I);i++)
949   {
950      h=h*leadcoef(I[i]);  //besser machen (gleich zerlegen, nict ausmultiplizieren)
951   }
952   def R=basering;
953   ring Rhelp=0,x,dp;
954   number h=imap(R,h);
955   list L=PollardRho(h,5000,1);
956   for(i=1;i<=size(L);i++){L[i]=int(L[i]);}
957   setring R;
958   return(L);
959}
960
961///////////////////////////////////////////////////////////////////////////////
962
963static proc coefZ(ideal I)
964{
965   //assume === IQ[variables]=<g_1,...,g_s>, Groebner basis, g_i in Z[variables]
966   //=== computes an integer h such that
967   //=== <g_1,...,g_s>Z[variables]:h^infinity = IQ[variables] intersected with Z[variables]
968   //=== returns a list with IQ[variables] intersected with Z[variables] and h
969   int h=1;
970   int i,e;
971   ideal K=1;
972   list L=coefPrimeZ(I);
973   if(size(L)==0){return(list(I,1));}
974   int d=1;
975   while(d!=0)
976   {
977      i++;
978      K=quotientOneZ(I,L[i]);
979      if(size(reduce(K,I))!=0)
980      {
981         h=h*L[i];
982         I=stdZ(K);
983         e=1;
984      }
985      if(i==size(L))
986      {
987         i=0;
988         if(e)
989         {
990            e=0;
991         }
992         else
993         {
994           d=0;
995         }
996      }
997   }
998   if(h<0){h=-h;}
999   return(list(K,h));
1000}
1001
1002///////////////////////////////////////////////////////////////////////////////
1003
1004static proc specialPowerZ(ideal I, int m)
1005{
1006//=== computes the ideal generated by the m-th power of the generators of I
1007   int i;
1008   for(i=1;i<=size(I);i++)
1009   {
1010      I[i]=I[i]^m;
1011   }
1012   return(I);
1013}
1014
1015///////////////////////////////////////////////////////////////////////////////
1016
1017static proc separatorsZ(int j, list B)
1018{
1019//=== computes s such that s is not in B[j] but s is in B[i] for all i!=j
1020   int i,k;
1021   poly s=1;
1022   for(i=1;i<=size(B);i++)
1023   {
1024      if(i!=j)
1025      {
1026         for(k=1;k<=size(B[i]);k++)
1027         {
1028            if(reduce(B[i][k],B[j])!=0)
1029            {
1030               s=s*B[i][k];
1031               break;
1032            }
1033         }
1034      }
1035   }
1036   return(s);
1037}
1038
1039///////////////////////////////////////////////////////////////////////////////
1040
1041static proc extractZ(ideal J, int j, list L, list B)
1042{
1043   //=== P is an associated prime of J, the corresponding primary ideal is computed
1044   //=== L is a list of maximal independent sets for P in Z/p[variables]
1045   def R=basering;
1046   ideal P=B[j];
1047   
1048   //=== first compute a pseudo primary ideal I, radical of I is P
1049   //=== method of Eisenbud
1050   //ideal I=addIdealZ(J,specialPowerZ(P,20)); 
1051 
1052   //=== method of Shimoyama-Yokoyama
1053   poly s=separatorsZ(j,B);   
1054   ideal I=satZ(J,s);
1055   //=== size(L)=0 means P is maximal ideal and I is primary
1056   if(size(L)>0)
1057   {
1058      if(L[1][3]!=0)
1059      {
1060         //=== if u in x is an independent set of L then we compute a Groebnerbasis in Z[u][x-u]
1061         execute("ring S=integer,("+L[1][1]+"),lp;");
1062         ideal I=imap(R,I);
1063         I=stdZ(I);
1064         list rl=ringlist(S);
1065         rl[1]=0;
1066         def Shelp =ring(rl);
1067         setring Shelp;
1068         ideal I=imap(S,I);
1069         I[1]=0;
1070         I=simplify(I,2);
1071         //=== this is our way to obtain the coefficients in Z[u] of the
1072         //=== leading terms of the Groebner basis above
1073         string quotring=prepareQuotientring(nvars(basering)-L[1][3]);
1074         execute(quotring);
1075         ideal I=imap(Shelp,I);
1076         list C;
1077         int i;
1078         for(i=1;i<=size(I);i++)
1079         {
1080            C[i]=leadcoef(I[i]);
1081         }
1082         setring Shelp;
1083         list C=imap(quring,C);
1084
1085         setring R;
1086         list C=imap(Shelp,C);
1087      }
1088      else
1089      {
1090         I=stdZ(I);
1091         list C;
1092         int i;
1093         for(i=1;i<=size(I);i++)
1094         {
1095            C[i]=I[i];
1096         }
1097         list rl=ringlist(R);
1098         rl[1]=0;
1099         def Shelp =ring(rl);
1100
1101      }
1102      poly h=1;
1103      for(i=1;i<=size(C);i++)
1104      {
1105         if(deg(C[i])>0){h=h*C[i];}  //das muss noch besser gemacht werden, nicht ausmultiplizieren!
1106      }
1107      setring Shelp;
1108      poly h=imap(R,h);
1109      ideal fac=factorize(h,1);     
1110      setring R;
1111      ideal fac=imap(Shelp,fac);
1112      for(i=1;i<=size(fac);i++)
1113      {
1114         I=satZ(I,fac[i]);
1115      }
1116   }
1117   I=stdZ(I);
1118   return(I);
1119}
1120///////////////////////////////////////////////////////////////////////////////
1121
1122static proc normalizeZ(ideal I)
1123{
1124//=== if I[1]=q in Z, it replaces all other coeffs of polys in I by there value mod q
1125//=== std should do this automatically and then tis procedure should be removed
1126   if(deg(I[1])>0){return(I);}
1127   int i,j;
1128   number n;
1129   poly p;
1130   for(i=2;i<=size(I);i++)
1131   {
1132      j=1;
1133      while(j<=size(I[i]))
1134      {
1135         n=leadcoef(I[i][j]) mod leadcoef(I[1]);
1136         p=n*leadmonom(I[i][j]);
1137         I[i]=I[i]-I[i][j]+p;
1138         if(p!=0){j++;}
1139      }
1140   }
1141   return(I);
1142}
1143
1144///////////////////////////////////////////////////////////////////////////////
1145
1146static proc satZ(ideal I,poly h)
1147{
1148//=== saturates I by h
1149   ideal J=quotientOneZ(I,h);
1150   while(size(reduce(J,stdZ(I)))!=0)
1151   {
1152       I=J;
1153       J=quotientOneZ(I,h);
1154       J=normalizeZ(J);
1155   }
1156   return(J);
1157}
1158
1159///////////////////////////////////////////////////////////////////////////////
1160
1161static proc prepareQuotientring (int nnp)
1162{
1163//=== this is from primdec.lib, it is static there, should be imported later if it is no more static
1164  ideal @ih,@jh;
1165  int npar=npars(basering);
1166  int @n;
1167
1168  string quotring= "ring quring = ("+charstr(basering);
1169  for(@n=nnp+1;@n<=nvars(basering);@n++)
1170  {
1171     quotring=quotring+",var("+string(@n)+")";
1172     @ih=@ih+var(@n);
1173  }
1174
1175  quotring=quotring+"),(var(1)";
1176  @jh=@jh+var(1);
1177  for(@n=2;@n<=nnp;@n++)
1178  {
1179    quotring=quotring+",var("+string(@n)+")";
1180    @jh=@jh+var(@n);
1181  }
1182  quotring=quotring+"),(C,lp);";
1183
1184  return(quotring);
1185
1186}
1187
1188///////////////////////////////////////////////////////////////////////////////
1189
1190static proc maxIndependSet (ideal j)
1191{
1192 
1193//=== this is from primdec.lib, it is static there, should be imported later if it is no more static
1194  int n,k,di;
1195 
1196  list resu,hilf;
1197  if(size(j)==0)
1198  {
1199     resu[1]=varstr(basering);
1200     resu[2]=ordstr(basering);
1201     resu[3]=0;
1202     return(list(resu));
1203  }
1204  string var1,var2;
1205  list v=indepSet(j,0);
1206
1207  for(n=1;n<=size(v);n++)
1208  {
1209    di=0;
1210    var1="";
1211    var2="";
1212    for(k=1;k<=size(v[n]);k++)
1213    {
1214      if(v[n][k]!=0)
1215      {
1216        di++;
1217        var2=var2+"var("+string(k)+"),";
1218      }
1219      else
1220      {
1221        var1=var1+"var("+string(k)+"),";
1222      }
1223    }
1224    if(di>0)
1225    {
1226      var1=var1+var2;
1227      var1=var1[1..size(var1)-1];
1228      hilf[1]=var1;
1229      hilf[2]="lp";
1230      hilf[3]=di;
1231      resu[n]=hilf;
1232    }
1233    else
1234    {
1235      resu[n]=varstr(basering),ordstr(basering),0;
1236    }
1237  }
1238  return(resu);
1239}
1240
1241///////////////////////////////////////////////////////////////////////////////
1242
1243static proc quotientOneZ(ideal I, poly f)
1244{
1245//=== this is needed because quotient(I,f) does not work properly, should be replaced by quotient later
1246   def R=basering;
1247   int i;
1248   ideal K=intersectZ(I,ideal(f));
1249   //=== K[i]/f; does not work in rings with integer! This should by replaced later
1250   execute("ring Rhelp=0,("+varstr(R)+"),dp;");
1251   ideal K=imap(R,K);
1252   poly f=imap(R,f);
1253   for(i=1;i<=size(K);i++)
1254   {
1255      K[i]=K[i]/f;
1256   }
1257   setring R;
1258   K=imap(Rhelp,K);
1259   return(K);
1260}
1261
1262///////////////////////////////////////////////////////////////////////////////
1263
1264static proc quotientZ(ideal I, ideal J)
1265{
1266//=== this is needed because quotient(I,J) does not work properly, should be replaced by quotient later
1267   int i;
1268   ideal K=quotientOneZ(I,J[1]);
1269   for(i=2;i<=size(J);i++)
1270   {
1271      K=intersectZ(K,quotientOneZ(I,J[i]));
1272   }
1273   return(K);
1274}
1275
1276///////////////////////////////////////////////////////////////////////////////
1277
1278static proc reduceZ(poly f, ideal I)
1279{
1280//=== this is needed because reduce(f,I) does not work properly, should be replaced by reduce later
1281   if(f==0){return(f);}
1282   def R=basering;
1283   execute("ring Rhelp=0,("+varstr(R)+"),dp;");
1284   ideal I=imap(R,I);
1285   poly f=imap(R,f);
1286   int i,j;
1287   poly m;
1288   number n;
1289   while(!i)
1290   {
1291      i=1;
1292      j=0;
1293      while(j<size(I))
1294      {
1295         j++;
1296         m=leadmonom(f)/leadmonom(I[j]);
1297         if(m!=0)
1298         {
1299             n=leadcoef(f) mod leadcoef(I[j]);
1300             if(n==0)
1301             {
1302                 f=f-leadcoef(f)/leadcoef(I[j])*m*I[j];
1303                 if(f==0){setring R;return(0);}
1304                 i=0;
1305                 break;
1306              }
1307              if(n!=leadcoef(f))
1308              {
1309                   f=f+(n-leadcoef(f))/leadcoef(I[j])*m*I[j];
1310                   i=0;
1311                   break;
1312               }
1313
1314          }
1315      }
1316   }
1317   setring R;
1318   f=imap(Rhelp,f);
1319   return(lead(f)+reduceZ(f-lead(f),I));
1320}
1321
1322///////////////////////////////////////////////////////////////////////////////
1323
1324static proc stdZ(ideal I)
1325{
1326//=== this is needed because we want the leading coefficients to be positive
1327//=== otherwhise reduce gives wrong results!   should be replaced later by std
1328   I=simplify(I,2);
1329   I=normalizeZ(I);
1330   ideal J=std(I);
1331   int i;
1332   for(i=1;i<=size(J);i++)
1333   {
1334      if(leadcoef(J[i])<0){J[i]=-J[i];}
1335   }
1336   J=normalizeZ(J);
1337   attrib(J,"isSB",1);
1338   return(J);
1339}
1340
1341///////////////////////////////////////////////////////////////////////////////
1342
1343proc intersectZ(ideal I, ideal J)
1344{
1345//=== this is needed because intersect(I,J) does not work, should be replaced by intersect later
1346   def R = basering;
1347   execute("ring S=integer,(t,"+varstr(R)+"),(dp(1),dp(nvars(R)));");
1348   ideal I=imap(R,I);
1349   ideal J=imap(R,J);
1350   ideal K=addIdealZ(t*I,(1-t)*J);
1351   K=stdZ(K);
1352   int i;
1353   ideal L;
1354   for(i=1;i<=size(K);i++)
1355   {
1356      if(lead(K[i])/t==0){L[size(L)+1]=K[i];}
1357   }
1358   setring R;
1359   ideal L=imap(S,L);
1360   return(L);
1361}
1362
1363///////////////////////////////////////////////////////////////////////////////
1364
1365static proc addIdealZ(ideal I,ideal J)
1366{
1367//=== this is needed because I+J does not work, should be replaced by + later
1368   int i;
1369   for(i=1;i<=size(J);i++)
1370   {
1371      I[size(I)+1]=J[i];
1372   }
1373   return(I);
1374}
1375
1376///////////////////////////////////////////////////////////////////////////////
1377
1378static proc testPrimaryZ(ideal I, list L)
1379{
1380//=== test whether I is the intersection of the primary ideals in L
1381   int i;
1382   ideal K=L[1][1];
1383   for(i=2;i<=size(L);i++)
1384   {
1385      K=intersectZ(K,L[i][1]);
1386   }
1387   i=size(reduce(K,stdZ(I)))+size(reduce(I,stdZ(K)));
1388   if(!i){return(1);}
1389   return(0);
1390}
1391
1392///////////////////////////////////////////////////////////////////////////////
1393
1394/*
1395examples
1396
1397//=== IQ[a,b,c,d,e,f,g] intersect Z[a,b,c,d,e,f,g] = I  (takes some time)
1398ring R1=integer,(a,b,c,d,e,f,g),dp;
1399ideal I=a2+2de+2cf+2bg+a,
1400        2ab+e2+2df+2cg+b,
1401        b2+2ac+2ef+2dg+c,
1402        2bc+2ad+f2+2eg+d,
1403        c2+2bd+2ae+2fg+e,
1404        2cd+2be+2af+g2+f,
1405        d2+2ce+2bf+2ag+g;
1406
1407ring R2=integer,(a,b,c,d,e,f,g),dp;
1408ideal I=181*32003,
1409        a2+2de+2cf+2bg+a,
1410        2ab+e2+2df+2cg+b,
1411        b2+2ac+2ef+2dg+c,
1412        2bc+2ad+f2+2eg+d,
1413        c2+2bd+2ae+2fg+e,
1414        2cd+2be+2af+g2+f,
1415        d2+2ce+2bf+2ag+g;
1416 
1417ring R3=integer,(w,z,y,x),dp;
1418ideal I=xzw+(-y^2+y)*z^2,
1419         (-x^2+x)*w^2+yzw,
1420         ((y^4-2*y^3+y^2)*x-y^4+y^3)*z^3,
1421         y2z2w+(-y*4+2*y^3-y^2)*z3;
1422
1423ring R4=integer,(w,z,y,x),dp;
1424ideal I=-2*yxzw+(-yx-y^2+y)*z^2,
1425         xw^2-yz^2,
1426         (yx^2-(2*y^2+2*y)*x+y^3-2*y^2+y)*z^3,
1427         (-2*y^2+2*y)*z^2*w+(yx-3*y^2-y)*z^3;
1428
1429ring R5=integer,(x,y,z),dp;
1430ideal I=x2-y2-z2,
1431        xy-z2,
1432        y3+xz2-yz2+2z3+xy-z2,
1433        -y2z2+2z4+x2-y2+z2,
1434        y3z9+3y2z10+3yz11+z12-y2z2+2z4;
1435
1436ring R6=integer,(h, l, s, x, y, z),dp;  //takes some time
1437ideal I=hl-l2-4ls+hy,
1438        h2s-6ls3+h2z,
1439        xh2-l2s-h3;
1440
1441ring R7=integer,(x,y,z),dp;
1442ideal I=x2-y2-(z+2)^2,
1443        xy-(z+2)^2,
1444        y3+x*(z+2)^2-y*(z+2)^2+2*(z+2)^3+xy-(z+2)^2,
1445        -y^2*(z+2)^2+2*(z+2)^4+x2-y2+(z+2)^2,
1446        y3z9+3y2z10+3yz11+z12-y2z2+2z4;
1447
1448ring R8=integer,(x,y,z),dp;
1449ideal I=x2-y2-(z+2)^2,
1450        xy-(z+2)^2,
1451        y3+x*(z+2)^2-y*(z+2)^2+2*(z+2)^3+xy-(z+2)^2,
1452        -y^2*(z+2)^2+2*(z+2)^4+x2-y2+(z+2)^2,
1453        y3z9+3y2z10+3yz11+z12-y2z2+2z4;
1454 
1455ring R9=integer,(w,z,y,x),dp;
1456ideal I=630,
1457        ((y^2-y)*x-y^3+y^2)*z^2,
1458        (x-y)*zw,
1459        (x-y^2)*zw+(-y^2+y)*z^2,
1460        (-x^2+x)*w^2+(-yx+y)*zw;
1461
1462ring R10=integer,(w,z,y,x),dp;
1463ideal I=1260,
1464        -yxzw+(-y^2+y)*z^2,
1465        (-x^2+x)*w^2-yxzw,
1466        ((-y^2+y)*x-y^3+2*y^2-y)*z^3,
1467        (y^2-y)*z^2*w+(-y^2+y)*z^2*w+(-y^2+y)*z^3;
1468
1469ring R11=integer,(w,z,y,x),dp;
1470ideal I=(4*y^2*x^2+(4*y^3+4*y^2-y)*x-y^2-y)*z^2,
1471         (x+y+1)*zw+(-4*y^2*x-4*y^3-4*y^2)*z^2,
1472         (-x-2*y^2 - 2*y - 1)*zw + (8*y^3*x + 8*y^4 + 8*y^3 + 2*y^2+y)*z^2,   
1473         ((y^3 + y^2)*x - y^2 - y)*z^2,
1474         (y +1)*zw + (-y^3 -y^2)*z^2,
1475         (x + 1)*zw +(- y^2 -y)*z^2,
1476         (x^2 +x)*w^2 + (-yx - y)*zw;
1477
1478ring R12=integer,(w,z,y,x),dp;
1479ideal I=72,
1480        ((y^3 + y^2)*x - y^2 - y)*z^2,
1481        (y + 1)*zw + (-y^3 -y^2)*z^2,
1482        (x + 1)*zw + (-y^2 -y)*z^2, (x^2 + x)*w^2 + (-yx - y)*zw;
1483
1484ring R13=integer,(w,z,y,x),dp;
1485ideal I= (((12*y+8)*x^2 +(2*y+2)*x)*zw +((-15*y^2 -4*y)*x-4*y^2 -y)*z^2,
1486        -x*w^2 +((-12*y -8)*x+2*y)*zw +(15*y^2+4*y)*z^2,
1487        (81*y^4*x^2 +(-54*y^3 -12*y^2)*x-12*y^3 -3*y^2)*z^3, 
1488        (-24*yx+6*y^2-6*y)*z^2*w + (-81*y^4*x + 81*y^3 + 24*y^2)*z^3,
1489        (48*x^2 + (-30*y + 12)*x - 6*y)*z^2*w + ((81*y^3 -54*y^2 -24*y)*x-21*y^2 -6*y)*z^3,
1490        (-96*yx-18*y^3 +18*y^2-24*y)*z^2*w +(243*y^5*x-243*y^4 +72*y^3+48*y^2)*z^3,
1491         6*y*z^2*w^2 +((576*y+384)*x^2 + (-81*y^3 -306*y^2 -168*y+96)*x+81*y^2-18*y)*z^3*w +((-720*y^2 - 192*y)*x + 450*y^3 - 60*y^2 - 48*y)*z^4);
1492
1493ring R14=integer,(x(1),x(2),x(3),x(4)),dp;
1494ideal I= 181*49^2,
1495         x(4)^4,
1496         x(1)*x(4)^3,
1497         x(1)*x(2)*x(4)^2,
1498         x(2)^2*x(4)^2,
1499         x(2)^2*x(3)*x(4),
1500         x(1)*x(2)*x(3)*x(4),
1501         x(1)*x(3)^2*x(4),
1502         x(3)^3*x(4);
1503
1504 
1505ring R15=integer,(x,y,z),dp;  
1506ideal I=32003*181*64,
1507        ((z^2-z)*y^2 + (z^2 -z)*y)*x; (z*y^3 + z*y^2)*x,
1508        (y^4 - y^2)*x, (z^2 - z)*y*x^2, (y^3 - y^2)*x^2,
1509        (z^3 - z^2)*x^4 + (2*z^3 -2*z^2)*x^3 + (z^3 -z^2)*x^2,
1510        z*y^2*x^2, z*y*x^4 +z*y*x^3,
1511        2*y^2*x^4 +6*y^2*x^3 +6*y^2*x^2 + (y^3 +y^2)*x, z*x^5 + (z^2 +z)*x^4 + (2*z^2 -z)*x^3 + (z^2 -z)*x^2,
1512        y*x^6 + 3*y*x^5 + 3*y*x^4 + y*x^3;
1513
1514
1515ring R16=integer,(x(1),x(2),x(3),x(4),x(5)),dp;
1516ideal I=x(5)^5,
1517        x(1)*x(5)^4,
1518        x(1)*x(2)*x(5)^3,
1519        x(2)^2*x(5)^3,
1520        x(2)^2*x(3)*x(5)^2,
1521        x(1)*x(2)*x(3)*x(5)^2,
1522        x(1)*x(3)^2*x(5)^2, 
1523        x(3)^3*x(5)^2,
1524        x(3)^3*x(4)*x(5),
1525        x(1)*x(3)^2*x(4)*x(5),
1526        x(1)*x(2)*x(3)*x(4)*x(5),
1527        x(2)^2*x(3)*x(4)*x(5),
1528        x(2)^2*x(4)^2*x(5), 
1529        x(1)*x(2)*x(4)^2*x(5),
1530        x(1)*x(4)^3*x(5),
1531        x(4)^4*x(5);
1532      I=intersectZ(I,ideal(64*181,x(1)^2));
1533
1534ring R17=integer,(x,y,z),dp;  
1535ideal I=374,
1536        (z+2)^8-140z6+2622*(z+2)^4-1820*(z+2)^2+169,
1537        17y*(z+2)^4-374*y*(z+2)^2+221y+2z7-281z5+5240z3-3081z,
1538      Â  204y2+136yz3-3128yz+z6-149z4+2739z2+117,
1539        17xz4-374xz2+221x+2z7-281z5+5240z3-3081z,
1540        136xy-136xz-136yz+2z6-281z4+5376z2-3081,
1541        204x2+136xz3-3128xz+z6-149z4+2739z2+117;
1542
1543ring R18=integer,(B,D,F,b,d,f),dp;
1544ideal I=6,
1545        (b-d)*(B-D)-2*F+2,
1546        (b-d)*(B+D-2*F)+2*(B-D),
1547        (b-d)^2-2*(b+d)+f+1,
1548        B^2*b^3-1,
1549        D^2*d^3-1,
1550        F^2*f^3-1;
1551
1552ring R19=integer,(a,b,c,d,e,f),dp;
1553ideal I=24,
1554        2*(f+2)*b+2ec+d2+a2+a,
1555        2*(f+2)*c+2ed+2ba+b,
1556        2*(f+2)*d+e2+2ca+c+b2,
1557        2*(f+2)*e+2da+d+2cb,
1558        (f+2)^2+2ea+e+2db+c2,
1559        2*(f+2)*a+f+2eb+2dc;
1560
1561ring R20=integer,(x,y,z,w,u),dp;
1562ideal I=24,
1563         2x2-2y2+2z2-2w2+2u2-1,
1564         2x3-2y3+2z3-2w3+2u3-1,
1565         2x4-2y4+2z4-2w4+2u4-1,
1566         2x5-2y5+2z5-2w5+2u5-1,
1567         2x6-2y6+2z6-2w6+2u6-1;
1568
1569ring R21=integer,(x,y,z,t,u,v,h),dp;
1570ideal I=66,
1571        2x2+2y2+2z2+2t2+2u2+v2-vh,
1572        xy+yz+2zt+2tu+2uv-uh,
1573        2xz+2yt+2zu+u2+2tv-th,
1574        2xt+2yu+2tu+2zv-zh,
1575        t2+2xv+2yv+2zv-yh,
1576        2x+2y+2z+2t+2u+v-h,
1577        x3+y3+z3+t3+u3+v3;
1578
1579ring R22=integer,(s,p,S,P,T,F,f),dp;  
1580ideal I=35,
1581        2*T-S*s-2*F+2,
1582        8*F*p-4*p*S-2*F*s^2+S*s^2+4*T-2*S*s,
1583        -2*s-4*p+s^2+f+1,
1584        s*T^2-p*s*P-p*S*T-2,
1585        p^3*P^2-1,
1586        F^2*f^3-1;
1587*/
Note: See TracBrowser for help on using the repository browser.