Changeset 24f458 in git
- Timestamp:
- Feb 12, 2004, 10:54:06 AM (20 years ago)
- Branches:
- (u'spielwiese', '8e0ad00ce244dfd0756200662572aef8402f13d5')
- Children:
- 56ae4f7d3475c8a359c53899f648c760bbf91fc7
- Parents:
- e5b6d23c31318491b9f16c63a82fe33cafc3e9bf
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/LIB/primdec.lib
re5b6d2 r24f458 1 1 /////////////////////////////////////////////////////////////////////////////// 2 version="$Id: primdec.lib,v 1.10 1 2002-01-21 09:30:10Singular Exp $";2 version="$Id: primdec.lib,v 1.102 2004-02-12 09:54:06 Singular Exp $"; 3 3 category="Commutative Algebra"; 4 4 info=" … … 15 15 @* The procedures are implemented to be used in characteristic 0. 16 16 @* They also work in positive characteristic >> 0. 17 @* In small characteristic and for algebraic extensions, primdecGTZ and 18 minAssGTZ may not terminate, while primdecSY and minAssChar may not give 19 a complete decomposition. 17 @* In small characteristic and for algebraic extensions, primdecGTZ 18 may not terminate. 20 19 Algorithms for the computation of the radical based on the ideas of 21 20 Krick, Logar and Kemper (implementation by Gerhard Pfister). 22 21 23 22 PROCEDURES: 23 Ann(M); annihilator of R^n/M, R=basering, M in R^n 24 24 primdecGTZ(I); complete primary decomposition via Gianni,Trager,Zacharias 25 25 primdecSY(I...); complete primary decomposition via Shimoyama-Yokoyama … … 43 43 LIB "inout.lib"; 44 44 LIB "matrix.lib"; 45 LIB "triang.lib"; 45 46 /////////////////////////////////////////////////////////////////////////////// 46 47 // … … 144 145 /////////////////////////////////////////////////////////////////////////////// 145 146 146 static proc minSat(ideal inew, ideal h) 147 148 proc minSat(ideal inew, ideal h) 147 149 { 148 150 int i,k; … … 372 374 list l = factor(p); 373 375 l; 374 375 } 376 377 376 } 378 377 379 378 /////////////////////////////////////////////////////////////////////////////// … … 424 423 } 425 424 /////////////////////////////////////////////////////////////////////////////// 426 427 425 428 426 proc primaryTest (ideal i, poly p) … … 736 734 } 737 735 def P=basering; 738 int i,j,k,m,q,d ;736 int i,j,k,m,q,d,o; 739 737 int n=nvars(basering); 740 738 ideal s,t,u,sact; 741 739 poly ni; 742 740 string minp,gnir,va; 743 list sa,keep ;741 list sa,keep,rp,keep1; 744 742 for(i=1;i<=size(l)/2;i++) 745 743 { … … 756 754 if(size(l[2*i])==0) 757 755 { 758 s=factorize(l[2*i-1][1],1); 756 s=factorize(l[2*i-1][1],1); //vermeiden!!! 759 757 t=l[2*i-1]; 760 758 m=size(t); … … 766 764 while(va[j]!=","){j--;} 767 765 va=va[1..j-1]; 768 gnir="ring RL=("+string(char(P))+","+string(var(n))+"),("+va+"), dp;";766 gnir="ring RL=("+string(char(P))+","+string(var(n))+"),("+va+"),lp;"; 769 767 execute(gnir); 770 768 minpoly=leadcoef(imap(P,ni)); 771 769 ideal act; 772 770 ideal t=imap(P,t); 771 773 772 for(k=2;k<=m;k++) 774 773 { 775 774 act=factorize(t[k],1); 776 if(size(act)>1) 777 { 778 779 break; 780 } 775 if(size(act)>1){break;} 781 776 } 782 777 setring P; 783 778 sact=imap(RL,act); 784 kill RL; 779 785 780 if(size(sact)>1) 786 781 { … … 790 785 l[2*i]=primaryTest(sa[1],sa[1][1]); 791 786 } 787 if((size(sact)==1)&&(m==2)) 788 { 789 l[2*i]=l[2*i-1]; 790 attrib(l[2*i],"isSB",1); 791 } 792 if((size(sact)==1)&&(m>2)) 793 { 794 setring RL; 795 option(redSB); 796 t=std(t); 797 798 list sp=zero_decomp(t,0,0); 799 800 setring P; 801 rp=imap(RL,sp); 802 for(o=1;o<=size(rp);o++) 803 { 804 rp[o]=interred(simplify(rp[o],1)+ideal(ni)); 805 } 806 l[2*i-1]=rp[1]; 807 l[2*i]=rp[2]; 808 rp=delete(rp,1); 809 rp=delete(rp,1); 810 keep1=keep1+rp; 811 option(noredSB); 812 } 813 kill RL; 792 814 } 793 815 } … … 804 826 } 805 827 } 828 l=l+keep1; 806 829 return(l); 807 830 } … … 809 832 /////////////////////////////////////////////////////////////////////////////// 810 833 811 staticproc zero_decomp (ideal j,ideal ser,int @wr,list #)834 proc zero_decomp (ideal j,ideal ser,int @wr,list #) 812 835 "USAGE: zero_decomp(j,ser,@wr); j,ser ideals, @wr=0 or 1 813 836 (@wr=0 for primary decomposition, @wr=1 for computaion of associated … … 841 864 842 865 attrib(j,"isSB",1); 866 843 867 if(vdim(j)==deg(j[1])) 844 868 { … … 906 930 //with the factors new ideals (hopefully the primary decomposition) 907 931 //are created 908 909 932 if(size(act[1])>1) 910 933 { … … 922 945 { 923 946 primary[2*@k-1]=std(j,act[1][@k]^act[2][@k]); 947 924 948 } 925 949 else … … 933 957 else 934 958 { 959 935 960 primary[2*@k] = primaryTest(primary[2*@k-1],act[1][@k]); 961 936 962 } 937 963 } … … 960 986 primary=splitPrimary(primary,ser,@wr,act); 961 987 } 962 primary=splitCharp(primary); 988 989 if((voice>=6)&&(char(basering)<=181)) 990 { 991 primary=splitCharp(primary); 992 } 993 994 if((@wr==2)&&(npars(basering)>0)&&(voice>=6)&&(char(basering)>0)) 995 { 996 //the prime decomposition of Yokoyama in characteristic p 997 list ke,ek; 998 @k=0; 999 while(@k<size(primary)/2) 1000 { 1001 @k++; 1002 if(size(primary[2*@k])==0) 1003 { 1004 ek=insepDecomp(primary[2*@k-1]); 1005 primary=delete(primary,2*@k); 1006 primary=delete(primary,2*@k-1); 1007 @k--; 1008 } 1009 ke=ke+ek; 1010 } 1011 for(@k=1;@k<=size(ke);@k++) 1012 { 1013 primary[size(primary)+1]=ke[@k]; 1014 primary[size(primary)+1]=ke[@k]; 1015 } 1016 } 1017 1018 if(voice>=8){primary=extF(primary)}; 1019 963 1020 //test whether all ideals in the decomposition are primary and 964 1021 //in general position 965 1022 //if not after a random coordinate transformation of the last 966 1023 //variable the corresponding ideal is decomposed again. 967 1024 if((npars(basering)>0)&&(voice>=8)) 1025 { 1026 poly randp; 1027 for(zz=1;zz<nvars(basering);zz++) 1028 { 1029 randp=randp 1030 +(random(0,5)*par(1)^2+random(0,5)*par(1)+random(0,5))*var(zz); 1031 } 1032 randp=randp+var(nvars(basering)); 1033 } 968 1034 @k=0; 969 1035 while(@k<(size(primary)/2)) … … 974 1040 for(zz=1;zz<size(primary[2*@k-1])-1;zz++) 975 1041 { 1042 attrib(primary[2*@k-1],"isSB",1); 976 1043 if(vdim(primary[2*@k-1])==deg(primary[2*@k-1][zz])) 977 1044 { … … 994 1061 jmap2=maxideal(1); 995 1062 @qht=primary[2*@k-1]; 1063 if((npars(basering)>0)&&(voice>=10)) 1064 { 1065 jmap[size(jmap)]=randp; 1066 } 996 1067 997 1068 for(@n=2;@n<=size(primary[2*@k-1]);@n++) … … 1027 1098 psi1=@P,jmap2; 1028 1099 @qh=phi(@qht); 1029 if(npars(@P)>0) 1030 { 1031 @ri= "ring @Phelp =" 1032 +string(char(@P))+", 1033 ("+varstr(@P)+","+parstr(@P)+",@t),(C,dp);"; 1034 } 1035 else 1036 { 1037 @ri= "ring @Phelp =" 1038 +string(char(@P))+",("+varstr(@P)+",@t),(C,dp);"; 1039 } 1040 execute(@ri); 1041 ideal @qh=homog(imap(@P,@qht),@t); 1042 1043 ideal @qh1=std(@qh); 1044 @hilb=hilb(@qh1,1); 1045 @ri= "ring @Phelp1 =" 1046 +string(char(@P))+",("+varstr(@Phelp)+"),(C,lp);"; 1047 execute(@ri); 1048 ideal @qh=homog(imap(@P,@qh),@t); 1049 kill @Phelp; 1050 @qh=std(@qh,@hilb); 1051 @qh=subst(@qh,@t,1); 1052 setring @P; 1053 @qh=imap(@Phelp1,@qh); 1054 kill @Phelp1; 1055 @qh=clearSB(@qh); 1056 attrib(@qh,"isSB",1); 1100 1101 //=================== the new part ============================ 1102 1103 @qh=groebner(@qh); 1104 1105 //============================================================= 1106 // if(npars(@P)>0) 1107 // { 1108 // @ri= "ring @Phelp =" 1109 // +string(char(@P))+", 1110 // ("+varstr(@P)+","+parstr(@P)+",@t),(C,dp);"; 1111 // } 1112 // else 1113 // { 1114 // @ri= "ring @Phelp =" 1115 // +string(char(@P))+",("+varstr(@P)+",@t),(C,dp);"; 1116 // } 1117 // execute(@ri); 1118 // ideal @qh=homog(imap(@P,@qht),@t); 1119 // 1120 // ideal @qh1=std(@qh); 1121 // @hilb=hilb(@qh1,1); 1122 // @ri= "ring @Phelp1 =" 1123 // +string(char(@P))+",("+varstr(@Phelp)+"),(C,lp);"; 1124 // execute(@ri); 1125 // ideal @qh=homog(imap(@P,@qh),@t); 1126 // kill @Phelp; 1127 // @qh=std(@qh,@hilb); 1128 // @qh=subst(@qh,@t,1); 1129 // setring @P; 1130 // @qh=imap(@Phelp1,@qh); 1131 // kill @Phelp1; 1132 // @qh=clearSB(@qh); 1133 // attrib(@qh,"isSB",1); 1134 //============================================================= 1135 1057 1136 ser1=phi1(ser); 1137 1058 1138 @lh=zero_decomp (@qh,phi(ser1),@wr); 1059 // @lh=zero_decomp (@qh,psi(ser),@wr); 1139 1060 1140 1061 1141 kill lres0; … … 1075 1155 else 1076 1156 { 1077 //act=factor(@qh[1]); 1078 //if(2*size(act[1])==size(@lh)) 1079 //{ 1080 1081 // for(@n=1;@n<=size(act[1]);@n++) 1082 // { 1083 // @f=act[1][@n]^act[2][@n]; 1084 // ser1=psi(@f); 1085 // lres0[2*@n-1]=interred(primary[2*@k-1]+psi1(ser1)); 1086 // helpprim=@lh[2*@n]; 1087 // ser1=psi(helpprim); 1088 // lres0[2*@n]=psi1(ser1); 1089 // } 1090 // } 1091 // else 1092 // { 1093 lres1=psi(@lh); 1094 lres0=psi1(lres1); 1095 //} 1157 1158 lres1=psi(@lh); 1159 lres0=psi1(lres1); 1096 1160 } 1097 if(npars(@P)>0) 1161 1162 //=================== the new part ============================ 1163 1164 primary=delete(primary,2*@k-1); 1165 primary=delete(primary,2*@k-1); 1166 @k--; 1167 if(size(lres0)==2) 1098 1168 { 1099 @ri= "ring @Phelp =" 1100 +string(char(@P))+", 1101 ("+varstr(@P)+","+parstr(@P)+",@t),(C,dp);"; 1169 lres0[2]=groebner(lres0[2]); 1102 1170 } 1103 1171 else 1104 1172 { 1105 @ri= "ring @Phelp =" 1106 +string(char(@P))+",("+varstr(@P)+",@t),(C,dp);"; 1107 } 1108 execute(@ri); 1109 list @lvec; 1110 list @lr=imap(@P,lres0); 1111 ideal @lr1; 1112 1113 if(size(@lr)==2) 1114 { 1115 @lr[2]=homog(@lr[2],@t); 1116 @lr1=std(@lr[2]); 1117 @lvec[2]=hilb(@lr1,1); 1118 } 1119 else 1120 { 1121 for(@n=1;@n<=size(@lr)/2;@n++) 1173 for(@n=1;@n<=size(lres0)/2;@n++) 1122 1174 { 1123 if(specialIdealsEqual( @lr[2*@n-1],@lr[2*@n])==1)1175 if(specialIdealsEqual(lres0[2*@n-1],lres0[2*@n])==1) 1124 1176 { 1125 @lr[2*@n-1]=homog(@lr[2*@n-1],@t); 1126 @lr1=std(@lr[2*@n-1]); 1127 @lvec[2*@n-1]=hilb(@lr1,1); 1128 @lvec[2*@n]=@lvec[2*@n-1]; 1177 lres0[2*@n-1]=groebner(lres0[2*@n-1]); 1178 lres0[2*@n]=lres0[2*@n-1]; 1179 attrib(lres0[2*@n],"isSB",1); 1129 1180 } 1130 1181 else 1131 1182 { 1132 @lr[2*@n-1]=homog(@lr[2*@n-1],@t); 1133 @lr1=std(@lr[2*@n-1]); 1134 @lvec[2*@n-1]=hilb(@lr1,1); 1135 @lr[2*@n]=homog(@lr[2*@n],@t); 1136 @lr1=std(@lr[2*@n]); 1137 @lvec[2*@n]=hilb(@lr1,1); 1138 1139 } 1140 } 1141 } 1142 @ri= "ring @Phelp1 =" 1143 +string(char(@P))+",("+varstr(@Phelp)+"),(C,lp);"; 1144 execute(@ri); 1145 list @lr=imap(@Phelp,@lr); 1146 1147 kill @Phelp; 1148 if(size(@lr)==2) 1149 { 1150 @lr[2]=std(@lr[2],@lvec[2]); 1151 @lr[2]=subst(@lr[2],@t,1); 1152 1153 } 1154 else 1155 { 1156 for(@n=1;@n<=size(@lr)/2;@n++) 1157 { 1158 if(specialIdealsEqual(@lr[2*@n-1],@lr[2*@n])==1) 1159 { 1160 @lr[2*@n-1]=std(@lr[2*@n-1],@lvec[2*@n-1]); 1161 @lr[2*@n-1]=subst(@lr[2*@n-1],@t,1); 1162 @lr[2*@n]=@lr[2*@n-1]; 1163 attrib(@lr[2*@n],"isSB",1); 1164 } 1165 else 1166 { 1167 @lr[2*@n-1]=std(@lr[2*@n-1],@lvec[2*@n-1]); 1168 @lr[2*@n-1]=subst(@lr[2*@n-1],@t,1); 1169 @lr[2*@n]=std(@lr[2*@n],@lvec[2*@n]); 1170 @lr[2*@n]=subst(@lr[2*@n],@t,1); 1183 lres0[2*@n-1]=groebner(lres0[2*@n-1]); 1184 lres0[2*@n]=groebner(lres0[2*@n]); 1171 1185 } 1172 1186 } 1173 1187 } 1174 kill @lvec; 1175 setring @P; 1176 lres0=imap(@Phelp1,@lr); 1177 kill @Phelp1; 1178 for(@n=1;@n<=size(lres0);@n++) 1179 { 1180 lres0[@n]=clearSB(lres0[@n]); 1181 attrib(lres0[@n],"isSB",1); 1182 } 1183 1184 primary[2*@k-1]=lres0[1]; 1185 primary[2*@k]=lres0[2]; 1186 @s=size(primary)/2; 1187 for(@n=1;@n<=size(lres0)/2-1;@n++) 1188 { 1189 primary[2*@s+2*@n-1]=lres0[2*@n+1]; 1190 primary[2*@s+2*@n]=lres0[2*@n+2]; 1191 } 1192 @k--; 1188 primary=primary+lres0; 1189 1190 //============================================================= 1191 // if(npars(@P)>0) 1192 // { 1193 // @ri= "ring @Phelp =" 1194 // +string(char(@P))+", 1195 // ("+varstr(@P)+","+parstr(@P)+",@t),(C,dp);"; 1196 // } 1197 // else 1198 // { 1199 // @ri= "ring @Phelp =" 1200 // +string(char(@P))+",("+varstr(@P)+",@t),(C,dp);"; 1201 // } 1202 // execute(@ri); 1203 // list @lvec; 1204 // list @lr=imap(@P,lres0); 1205 // ideal @lr1; 1206 // 1207 // if(size(@lr)==2) 1208 // { 1209 // @lr[2]=homog(@lr[2],@t); 1210 // @lr1=std(@lr[2]); 1211 // @lvec[2]=hilb(@lr1,1); 1212 // } 1213 // else 1214 // { 1215 // for(@n=1;@n<=size(@lr)/2;@n++) 1216 // { 1217 // if(specialIdealsEqual(@lr[2*@n-1],@lr[2*@n])==1) 1218 // { 1219 // @lr[2*@n-1]=homog(@lr[2*@n-1],@t); 1220 // @lr1=std(@lr[2*@n-1]); 1221 // @lvec[2*@n-1]=hilb(@lr1,1); 1222 // @lvec[2*@n]=@lvec[2*@n-1]; 1223 // } 1224 // else 1225 // { 1226 // @lr[2*@n-1]=homog(@lr[2*@n-1],@t); 1227 // @lr1=std(@lr[2*@n-1]); 1228 // @lvec[2*@n-1]=hilb(@lr1,1); 1229 // @lr[2*@n]=homog(@lr[2*@n],@t); 1230 // @lr1=std(@lr[2*@n]); 1231 // @lvec[2*@n]=hilb(@lr1,1); 1232 // 1233 // } 1234 // } 1235 // } 1236 // @ri= "ring @Phelp1 =" 1237 // +string(char(@P))+",("+varstr(@Phelp)+"),(C,lp);"; 1238 // execute(@ri); 1239 // list @lr=imap(@Phelp,@lr); 1240 // 1241 // kill @Phelp; 1242 // if(size(@lr)==2) 1243 // { 1244 // @lr[2]=std(@lr[2],@lvec[2]); 1245 // @lr[2]=subst(@lr[2],@t,1); 1246 // 1247 // } 1248 // else 1249 // { 1250 // for(@n=1;@n<=size(@lr)/2;@n++) 1251 // { 1252 // if(specialIdealsEqual(@lr[2*@n-1],@lr[2*@n])==1) 1253 // { 1254 // @lr[2*@n-1]=std(@lr[2*@n-1],@lvec[2*@n-1]); 1255 // @lr[2*@n-1]=subst(@lr[2*@n-1],@t,1); 1256 // @lr[2*@n]=@lr[2*@n-1]; 1257 // attrib(@lr[2*@n],"isSB",1); 1258 // } 1259 // else 1260 // { 1261 // @lr[2*@n-1]=std(@lr[2*@n-1],@lvec[2*@n-1]); 1262 // @lr[2*@n-1]=subst(@lr[2*@n-1],@t,1); 1263 // @lr[2*@n]=std(@lr[2*@n],@lvec[2*@n]); 1264 // @lr[2*@n]=subst(@lr[2*@n],@t,1); 1265 // } 1266 // } 1267 // } 1268 // kill @lvec; 1269 // setring @P; 1270 // lres0=imap(@Phelp1,@lr); 1271 // kill @Phelp1; 1272 // for(@n=1;@n<=size(lres0);@n++) 1273 // { 1274 // lres0[@n]=clearSB(lres0[@n]); 1275 // attrib(lres0[@n],"isSB",1); 1276 // } 1277 // 1278 // primary[2*@k-1]=lres0[1]; 1279 // primary[2*@k]=lres0[2]; 1280 // @s=size(primary)/2; 1281 // for(@n=1;@n<=size(lres0)/2-1;@n++) 1282 // { 1283 // primary[2*@s+2*@n-1]=lres0[2*@n+1]; 1284 // primary[2*@s+2*@n]=lres0[2*@n+2]; 1285 // } 1286 // @k--; 1287 //============================================================= 1193 1288 } 1194 1289 } … … 1205 1300 pr; 1206 1301 } 1302 /////////////////////////////////////////////////////////////////////////////// 1303 proc extF(list l,list #) 1304 { 1305 //zero_dimensional primary decomposition after finite field extension 1306 def R=basering; 1307 int p=char(R); 1308 1309 if((p==0)||(p>13)||(npars(R)>0)){return(l);} 1310 1311 int ex=3; 1312 if(size(#)>0){ex=#[1];} 1313 1314 list peek,peek1; 1315 while(size(l)>0) 1316 { 1317 if(size(l[2])==0) 1318 { 1319 peek[size(peek)+1]=l[1]; 1320 } 1321 else 1322 { 1323 peek1[size(peek1)+1]=l[1]; 1324 peek1[size(peek1)+1]=l[2]; 1325 } 1326 l=delete(l,1); 1327 l=delete(l,1); 1328 } 1329 if(size(peek)==0){return(peek1);} 1330 1331 string gnir="ring RH=("+string(p)+"^"+string(ex)+",a),("+varstr(R)+"),lp;"; 1332 execute(gnir); 1333 string mp="minpoly="+string(minpoly)+";"; 1334 gnir="ring RL=("+string(p)+",a),("+varstr(R)+"),lp;"; 1335 execute(gnir); 1336 execute(mp); 1337 list L=imap(R,peek); 1338 list pr, keep; 1339 int i; 1340 for(i=1;i<=size(L);i++) 1341 { 1342 attrib(L[i],"isSB",1); 1343 pr=zero_decomp(L[i],0,0); 1344 keep=keep+pr; 1345 } 1346 for(i=1;i<=size(keep);i++) 1347 { 1348 keep[i]=simplify(keep[i],1); 1349 } 1350 mp="poly pp="+string(minpoly)+";"; 1351 1352 string gnir1="ring RS="+string(p)+",("+varstr(R)+",a),lp;"; 1353 execute(gnir1); 1354 execute(mp); 1355 list L=imap(RL,keep); 1356 1357 for(i=1;i<=size(L);i++) 1358 { 1359 L[i]=eliminate(L[i]+ideal(pp),a); 1360 } 1361 i=0; 1362 int j; 1363 while(i<size(L)/2-1) 1364 { 1365 i++; 1366 j=i; 1367 while(j<size(L)/2) 1368 { 1369 j++; 1370 if(idealsEqual(L[2*i-1],L[2*j-1])) 1371 { 1372 L=delete(L,2*j-1); 1373 L=delete(L,2*j-1); 1374 j--; 1375 } 1376 } 1377 } 1378 setring R; 1379 list re=imap(RS,L); 1380 re=re+peek1; 1381 1382 return(extF(re,ex+1)); 1383 } 1384 1385 /////////////////////////////////////////////////////////////////////////////// 1386 proc zeroSp(ideal i) 1387 { 1388 //preparation for the separable closure 1389 //decomposition into ideals of special type 1390 //i.e. the minimal polynomials of every variable mod i are irreducible 1391 //returns a list of 2 lists: rr=pe,qe 1392 //the ideals in pe[l] are special, their special elements are in qe[l] 1393 //pe[l] is a dp-Groebnerbasis 1394 //the radical of the intersection of the pe[l] is equal to the radical of i 1395 1396 def R=basering; 1397 1398 //i has to be a reduced groebner basis 1399 ideal F=finduni(i); 1400 1401 int j,k,l,ready; 1402 list fa; 1403 fa[1]=factorize(F[1],1); 1404 poly te,ti; 1405 ideal tj; 1406 //avoid factorization of the same polynomial 1407 for(j=2;j<=size(F);j++) 1408 { 1409 for(k=1;k<=j-1;k++) 1410 { 1411 ti=F[k]; 1412 te=subst(ti,var(k),var(j)); 1413 if(te==F[j]) 1414 { 1415 tj=fa[k]; 1416 fa[j]=subst(tj,var(k),var(j)); 1417 ready=1; 1418 break; 1419 } 1420 } 1421 if(!ready) 1422 { 1423 fa[j]=factorize(F[j],1); 1424 } 1425 ready=0; 1426 } 1427 execute( "ring P=("+charstr(R)+"),("+varstr(R)+"),(C,dp);"); 1428 ideal i=imap(R,i); 1429 if(npars(basering)==0) 1430 { 1431 ideal J=fglm(R,i); 1432 } 1433 else 1434 { 1435 ideal J=groebner(i); 1436 } 1437 list fa=imap(R,fa); 1438 list qe=J; //collects a dp-Groebnerbasis of the special ideals 1439 list keep=ideal(0); //collects the special elements 1440 1441 list re,em,ke; 1442 ideal K,L; 1443 1444 for(j=1;j<=nvars(basering);j++) 1445 { 1446 for(l=1;l<=size(qe);l++) 1447 { 1448 for(k=1;k<=size(fa[j]);k++) 1449 { 1450 L=std(qe[l],fa[j][k]); 1451 K=keep[l],fa[j][k]; 1452 if(deg(L[1])>0) 1453 { 1454 re[size(re)+1]=L; 1455 ke[size(ke)+1]=K; 1456 } 1457 } 1458 } 1459 qe=re; 1460 re=em; 1461 keep=ke; 1462 ke=em; 1463 } 1464 1465 setring R; 1466 list qe=imap(P,keep); 1467 list pe=imap(P,qe); 1468 for(l=1;l<=size(qe);l++) 1469 { 1470 qe[l]=simplify(qe[l],2); 1471 } 1472 list rr=pe,qe; 1473 return(rr); 1474 } 1475 /////////////////////////////////////////////////////////////////////////////// 1476 1477 proc zeroSepClos(ideal I,ideal F) 1478 { 1479 //computes the separable closure of the special ideal I 1480 //F is the set of special elements of I 1481 //returns the separable closure sc(I) of I and an intvec v 1482 //such that sc(I)=preimage(frobenius definde by v) 1483 //i.e. var(i)----->var(i)^(p^v[i]) 1484 1485 if(homog(I)==1){return(maxideal(1));} 1486 1487 //assume F[i] irreducible in I and depending only on var(i) 1488 1489 def R=basering; 1490 int n=nvars(R); 1491 int p=char(R); 1492 intvec v; 1493 v[n]=0; 1494 int i,k; 1495 list l; 1496 1497 for(i=1;i<=n;i++) 1498 { 1499 l[i]=sep(F[i],i); 1500 F[i]=l[i][1]; 1501 if(l[i][2]>k){k=l[i][2];} 1502 } 1503 1504 if(k==0){return(list(I,v));} //the separable case 1505 ideal m; 1506 1507 for(i=1;i<=n;i++) 1508 { 1509 m[i]=var(i)^(p^l[i][2]); 1510 v[i]=l[i][2]; 1511 } 1512 map phi=R,m; 1513 ideal J=preimage(R,phi,I); 1514 return(list(J,v)); 1515 } 1516 /////////////////////////////////////////////////////////////////////////////// 1517 1518 proc insepDecomp(ideal i) 1519 { 1520 //decomposes i into special ideals 1521 //computes the prime decomposition of the special ideals 1522 //and transforms it back to a decomposition of i 1523 1524 def R=basering; 1525 list pr=zeroSp(i); 1526 int l,k; 1527 list re,wo,qr; 1528 ideal m=maxideal(1); 1529 ideal K; 1530 map phi=R,m; 1531 int p=char(R); 1532 intvec op=option(get); 1533 1534 for(l=1;l<=size(pr[1]);l++) 1535 { 1536 wo=zeroSepClos(pr[1][l],pr[2][l]); 1537 for(k=1;k<=nvars(basering);k++) 1538 { 1539 m[k]=var(k)^(p^wo[2][k]); 1540 } 1541 phi=R,m; 1542 qr=decomp(wo[1],2); 1543 1544 option(redSB); 1545 for(k=1;k<=size(qr)/2;k++) 1546 { 1547 K=qr[2*k]; 1548 K=phi(K); 1549 K=groebner(K); 1550 re[size(re)+1]=zeroRad(K); 1551 } 1552 option(noredSB); 1553 } 1554 option(set,op); 1555 return(re); 1556 } 1557 1558 1207 1559 /////////////////////////////////////////////////////////////////////////////// 1208 1560 … … 1613 1965 } 1614 1966 1615 1616 1617 1967 static proc primT(ideal i) 1968 { 1969 //assumes that all generators of i are irreducible 1970 //i is standard basis 1971 1972 attrib(i,"isSB",1); 1973 int j=size(i); 1974 int k; 1975 while(j>0) 1976 { 1977 if(deg(i[j])>1){break;} 1978 j--; 1979 } 1980 if(j==0){return(1);} 1981 if(deg(i[j])==vdim(i)){return(1);} 1982 return(0); 1983 } 1618 1984 1619 1985 … … 1628 1994 list q=simplifyIdeal(i); 1629 1995 list re=maxideal(1); 1630 int j,a ;1996 int j,a,k; 1631 1997 intvec op=option(get); 1632 1998 map phi=P,q[2]; 1633 1999 1634 i=groebner(q[1]); 2000 if(npars(P)==0){option(redSB);} 2001 2002 i=std(q[1]); 2003 if(dim(i)==-1){re=ideal(1);return(re);} 2004 if((dim(i)==0)&&(npars(P)==0)) 2005 { 2006 int di=vdim(i); 2007 execute ("ring gnir=("+charstr(P)+"),("+varstr(P)+"),lp;"); 2008 ideal J=interred(imap(P,i)); 2009 attrib(J,"isSB",1); 2010 if(vdim(J)!=di) 2011 { 2012 J=fglm(P,i); 2013 } 2014 list pr=triangMH(J,2); 2015 list qr,re; 2016 2017 for(k=1;k<=size(pr);k++) 2018 { 2019 if(primT(pr[k])) 2020 { 2021 re[size(re)+1]=pr[k]; 2022 } 2023 else 2024 { 2025 attrib(pr[k],"isSB",1); 2026 qr=decomp(pr[k],2); 2027 for(j=1;j<=size(qr)/2;j++) 2028 { 2029 re[size(re)+1]=qr[2*j]; 2030 } 2031 } 2032 } 2033 setring P; 2034 re=imap(gnir,re); 2035 option(set,op); 2036 return(phi(re)); 2037 } 2038 1635 2039 if((size(#)==0)||(dim(i)==0)) 1636 2040 { 1637 2041 re[1]=decomp(i,2); 1638 2042 re=union(re); 2043 option(set,op); 1639 2044 return(phi(re)); 1640 2045 } 1641 1642 option(redSB);1643 2046 1644 2047 q=facstd(i); … … 1983 2386 ideal i = intersect(ideal(z),ideal(x,y),ideal(x2,z2),ideal(x5,y5,z5)); 1984 2387 equidimMax(i); 2388 } 2389 /////////////////////////////////////////////////////////////////////////////// 2390 static proc islp() 2391 { 2392 string s=ordstr(basering); 2393 int n=find(s,"lp"); 2394 if(!n){return(0);} 2395 int k=find(s,","); 2396 string t=s[k+1..size(s)]; 2397 int l=find(t,","); 2398 t=s[1..k-1]; 2399 int m=find(t,","); 2400 if(l+m){return(0);} 2401 return(1); 2402 } 2403 /////////////////////////////////////////////////////////////////////////////// 2404 2405 proc algeDeco(ideal i, int w) 2406 { 2407 //reduces primery decomposition over algebraic extensions to 2408 //the other cases 2409 def R=basering; 2410 int n=nvars(R); 2411 string mp="poly p="+string(minpoly)+";"; 2412 string gnir="ring RH="+string(char(R))+",("+varstr(R)+","+string(par(1)) 2413 +"),dp;"; 2414 execute(gnir); 2415 execute(mp); 2416 ideal i=imap(R,i); 2417 i=i,p; 2418 list pr; 2419 int j; 2420 2421 if(w==0) 2422 { 2423 pr=decomp(i); 2424 } 2425 if(w==1) 2426 { 2427 pr=prim_dec(i,1); 2428 pr=reconvList(pr); 2429 } 2430 if(w==2) 2431 { 2432 pr=minAssPrimes(i); 2433 } 2434 2435 gnir="ring RS="+string(char(R))+",("+varstr(RH) 2436 +"),(dp("+string(n)+"),lp);"; 2437 execute(gnir); 2438 list pr=imap(RH,pr); 2439 ideal K; 2440 for(j=1;j<=size(pr);j++) 2441 { 2442 K=groebner(pr[j]); 2443 K=K[2..size(K)]; 2444 pr[j]=K; 2445 } 2446 setring R; 2447 list pr=imap(RS,pr); 2448 list re; 2449 if(w==2) 2450 { 2451 re=pr; 2452 } 2453 else 2454 { 2455 re=convList(pr); 2456 } 2457 return(re); 1985 2458 } 1986 2459 … … 2004 2477 ideal peek=i; 2005 2478 ideal ser,tras; 2479 int isS=(attrib(i,"isSB")==1); 2006 2480 2007 2481 if(size(#)>0) … … 2036 2510 { 2037 2511 ltras=i,i; 2512 attrib(ltras[1],"isSB",1); 2038 2513 } 2039 2514 tras=ltras[1]; 2515 attrib(tras,"isSB",1); 2040 2516 if(dim(tras)==0) 2041 2517 { … … 2073 2549 //---------------------------------------------------------------- 2074 2550 2551 int lp=islp(); 2552 2075 2553 execute("ring gnir = ("+charstr(basering)+"),("+varstr(basering)+"),(C,lp);"); 2076 2554 op=option(get); … … 2081 2559 if(homo==1) 2082 2560 { 2083 if( (ordstr(@P)[1]!="(C,lp)")&&(ordstr(@P)[3]!="(C,lp)"))2561 if(!lp) 2084 2562 { 2085 2563 ideal @j=std(fetch(@P,i),@hilb,@w); … … 2093 2571 else 2094 2572 { 2095 ideal @j=groebner(fetch(@P,i)); 2573 if(lp&&isS) 2574 { 2575 ideal @j=fetch(@P,i); 2576 attrib(@j,"isSB",1); 2577 } 2578 else 2579 { 2580 ideal @j=groebner(fetch(@P,i)); 2581 } 2096 2582 } 2097 2583 option(set,op); … … 2214 2700 op=option(get); 2215 2701 option(redSB); 2702 2216 2703 list gprimary= zero_decomp(@j,ser,@wr); 2217 2704 option(set,op); … … 2854 3341 2855 3342 /////////////////////////////////////////////////////////////////////////////// 2856 staticproc zeroRad(ideal I,list #)3343 proc zeroRad(ideal I,list #) 2857 3344 "USAGE: zeroRad(I) , I a zero-dimensional ideal 2858 3345 RETURN: the radical of I … … 2889 3376 F[i]=powerCoeffs(F[i],k-l[i][2]); 2890 3377 } 3378 2891 3379 string cR="ring @R="+string(p)+",("+parstr(R)+","+varstr(R)+"),dp;"; 2892 3380 execute(cR); 2893 3381 ideal F=imap(R,F); 3382 2894 3383 string nR="ring @S="+string(p)+",(y(1..m),"+varstr(R)+","+parstr(R)+"),dp;"; 2895 3384 execute(nR); 2896 3385 2897 3386 ideal G=fetch(@R,F); //G[i](t(1)^(p^-k),...,t(m)^(p^-k),x(i))=sep(F[i]) 3387 2898 3388 ideal I=imap(R,I); 2899 3389 ideal J=I+G; 3390 poly el=1; 2900 3391 k=p^k; 2901 3392 for(i=1;i<=m;i++) 2902 3393 { 2903 3394 J=J,var(i)^k-var(m+n+i); 2904 } 2905 J=eliminate(J,y(1..m)); 2906 3395 el=el*y(i); 3396 } 3397 3398 J=eliminate(J,el); 2907 3399 setring R; 2908 3400 ideal J=imap(@S,J); … … 2913 3405 ring R=(5,t),(x,y),dp; 2914 3406 ideal I=x^5-t,y^5-t; 2915 zero radp(I);3407 zeroRad(I); 2916 3408 } 2917 3409 … … 3258 3750 /////////////////////////////////////////////////////////////////////////////// 3259 3751 3260 staticproc Ann(module M)3752 proc Ann(module M) 3261 3753 { 3262 3754 M=prune(M); //to obtain a small embedding … … 4137 4629 4138 4630 U[size(U)]=")"; // we compute the extractor of I (w.r.t. U) 4139 execute("ring RAU= "+charstr(basering)+",("+A+U+",(dp("+string(a)+"),dp);");4631 execute("ring RAU=("+charstr(basering)+"),("+A+U+",(dp("+string(a)+"),dp);"); 4140 4632 ideal I=imap(R,SI); 4141 4633 //I=std(I,hv); // the standard basis in (R[U])[A] … … 4436 4928 ); 4437 4929 } 4438 return(convList(decomp(i))); 4930 if(minpoly!=0) 4931 { 4932 return(algeDeco(i,0)); 4933 ERROR( 4934 "// Not implemented yet for algebraic extensions.Simulate the ring extension by adding the minpoly to the ideal" 4935 ); 4936 } 4937 return(convList(decomp(i))); 4439 4938 } 4440 4939 example … … 4463 4962 if c=3, minAssGTZ and facstd are used. 4464 4963 @end format 4465 Due to a bug in the factorization, the result may be not completely4466 decomposed in small characteristic.4467 4964 EXAMPLE: example primdecSY; shows an example 4468 4965 " … … 4475 4972 } 4476 4973 i=simplify(i,2); 4477 if ( i[1]==0)4478 { 4479 list L=list(ideal( 0),ideal(0));4974 if ((i[1]==0)||(i[1]==1)) 4975 { 4976 list L=list(ideal(i[1]),ideal(i[1])); 4480 4977 return(list(L)); 4481 } 4978 } 4979 if(minpoly!=0) 4980 { 4981 return(algeDeco(i,1)); 4982 } 4482 4983 if (size(#)==1) 4483 4984 { return(prim_dec(i,#[1])); } … … 4499 5000 minAssGTZ(i,1); i ideal does not use the factorizing Groebner 4500 5001 RETURN: a list, the minimal associated prime ideals of i. 4501 NOTE: Designed for characteristic 0, works also in char k > 0 if it4502 terminates, may result in an infinite loop in small characteristic.5002 NOTE: Designed for characteristic 0, works also in char k > 0 based 5003 on an algorithm of Yokoyama 4503 5004 EXAMPLE: example minAssGTZ; shows an example 4504 5005 " … … 4510 5011 ); 4511 5012 } 4512 if(size(#)==0) 5013 if(minpoly!=0) 5014 { 5015 return(algeDeco(i,2)); 5016 ERROR( 5017 "// Not implemented for algebraic extensions. Simulate the ring extension by adding the minpoly to the ideal" 5018 ); 5019 } 5020 if(size(#)==0) 4513 5021 { 4514 5022 return(minAssPrimes(i,1)); … … 4620 5128 4621 5129 option(redSB); 4622 list pr=facstd(i); 5130 list pr=i; 5131 if (!homog(i)) 5132 { 5133 pr=facstd(i); 5134 } 4623 5135 option(set,op); 4624 5136 int s=size(pr); … … 5011 5523 time=timer; list pr =primdecSY(gls); timer-time; 5012 5524 time=timer; ideal ra =radical(gls); timer-time;size(pr); 5525 LIB"all.lib"; 5526 5527 ring R=0,(a,b,c,d,e,f),dp; 5528 ideal I=cyclic(6); 5529 minAssGTZ(I); 5530 5531 5532 ring S=(2,a,b),(x,y),lp; 5533 ideal I=x8-b,y4+a; 5534 minAssGTZ(I); 5535 5536 ring S1=2,(x,y,a,b),lp; 5537 ideal I=x8-b,y4+a; 5538 minAssGTZ(I); 5539 5540 5541 ring S2=(2,z),(x,y),dp; 5542 minpoly=z2+z+1; 5543 ideal I=y3+y+1,x4+x+1; 5544 primdecGTZ(I); 5545 minAssGTZ(I); 5546 5547 ring S3=2,(x,y,z),dp; 5548 ideal I=y3+y+1,x4+x+1,z2+z+1; 5549 primdecGTZ(I); 5550 minAssGTZ(I); 5551 5552 5553 ring R1=2,(x,y,z),lp; 5554 ideal I=y6+y5+y3+y2+1,x4+x+1,z2+z+1; 5555 primdecGTZ(I); 5556 minAssGTZ(I); 5557 5558 5559 ring R2=(2,z),(x,y),lp; 5560 minpoly=z3+z+1; 5561 ideal I=y2+y+(z2+z+1),x4+x+1; 5562 primdecGTZ(I); 5563 minAssGTZ(I); 5564 5013 5565 */
Note: See TracChangeset
for help on using the changeset viewer.