[9558c5f] | 1 | LIB "tst.lib"; |
---|
| 2 | tst_init(); |
---|
| 3 | |
---|
| 4 | |
---|
| 5 | //====================== Exercise 3.1 ============================= |
---|
| 6 | proc is_reg_sequence (ideal I) |
---|
| 7 | "USAGE: is_reg_sequence(I); I ideal, |
---|
| 8 | RETURN: 1 if the given (ordered) list of generators for I is a |
---|
| 9 | regular sequence; |
---|
| 10 | 0 otherwise. |
---|
| 11 | " |
---|
| 12 | { |
---|
| 13 | int i; |
---|
| 14 | ideal J; |
---|
| 15 | while(i<size(I)) |
---|
| 16 | { |
---|
| 17 | i++; |
---|
| 18 | if (size(reduce(quotient(J,I[i]),J))!=0) |
---|
| 19 | { |
---|
| 20 | return(0); |
---|
| 21 | } |
---|
| 22 | J = groebner(J+I[i]); |
---|
| 23 | } |
---|
| 24 | if (size(reduce(1,J))==0) { return(0); } |
---|
| 25 | return(1); |
---|
| 26 | } |
---|
| 27 | |
---|
| 28 | ring R = 0, (x,y,z), dp; |
---|
| 29 | ideal I = (x-1)*z, (x-1)*y, x; |
---|
| 30 | is_reg_sequence (I); |
---|
| 31 | //-> 0 |
---|
| 32 | I = (x-1)*z, x, (x-1)*y; |
---|
| 33 | is_reg_sequence (I); |
---|
| 34 | //-> 1 |
---|
| 35 | |
---|
| 36 | |
---|
| 37 | kill R; |
---|
| 38 | //====================== Exercise 3.2 ============================= |
---|
| 39 | if (not(defined(isCM))){ LIB "homolog.lib"; } |
---|
| 40 | ring R1 = 0, (x,y,z), dp; |
---|
| 41 | ideal I = xy, yz, xz; |
---|
| 42 | ring R1_loc = 0, (x,y,z), ds; |
---|
| 43 | ideal I = imap(R1,I); // ideal generated by I in localized ring |
---|
| 44 | isCM(I); |
---|
| 45 | |
---|
| 46 | ring R2 = 0, (s,t,x,y,z,w), dp; |
---|
| 47 | ideal I = x-s4, y-s3t, z-st3, w-t4; |
---|
| 48 | ideal IC = eliminate(I,st); |
---|
| 49 | ring R2_loc = 0, (x,y,z,w), ds; |
---|
| 50 | ideal IC = imap(R2,IC); |
---|
| 51 | isCM(IC); |
---|
| 52 | |
---|
| 53 | |
---|
| 54 | kill R1,R1_loc,R2,R2_loc; |
---|
| 55 | //====================== Exercise 3.3 ============================= |
---|
| 56 | proc truncate(module phi, int d) |
---|
| 57 | "USAGE: truncate(phi,d); phi module, d int |
---|
| 58 | ASSUME: phi comes assigned with an admissible degree vector as an |
---|
| 59 | attribute |
---|
| 60 | RETURN: module |
---|
| 61 | NOTE: Output is a presentation matrix for the truncation of |
---|
| 62 | coker(phi) at d. |
---|
| 63 | " |
---|
| 64 | { |
---|
| 65 | if ( typeof(attrib(phi,"isHomog"))=="string" ) |
---|
| 66 | { |
---|
| 67 | ERROR("No admissible degree vector assigned"); |
---|
| 68 | } |
---|
| 69 | else |
---|
| 70 | { |
---|
| 71 | intvec v=attrib(phi,"isHomog"); |
---|
| 72 | } |
---|
| 73 | int s = nrows(phi); |
---|
| 74 | int i,m,dummy; |
---|
| 75 | module L; |
---|
| 76 | for (i=1; i<=s; i++) |
---|
| 77 | { |
---|
| 78 | if (d>v[i]) |
---|
| 79 | { |
---|
| 80 | L = L+maxideal(d-v[i])*gen(i); |
---|
| 81 | } |
---|
| 82 | else |
---|
| 83 | { |
---|
| 84 | L = L+gen(i); |
---|
| 85 | } |
---|
| 86 | } |
---|
| 87 | L = modulo(L,phi); |
---|
| 88 | L = prune(L); |
---|
| 89 | if (size(L)==0) {return(L);} |
---|
| 90 | |
---|
| 91 | // it only remains to set the degrees for L: |
---|
| 92 | // ------------------------------------------ |
---|
| 93 | m = v[1]; |
---|
| 94 | for(i=2; i<=size(v); i++) |
---|
| 95 | { |
---|
| 96 | if(v[i]<m) |
---|
| 97 | { |
---|
| 98 | m = v[i]; |
---|
| 99 | } |
---|
| 100 | } |
---|
| 101 | dummy = homog(L); |
---|
| 102 | intvec vv = attrib(L,"isHomog"); |
---|
| 103 | if (d>m) |
---|
| 104 | { |
---|
| 105 | vv = vv+d; |
---|
| 106 | } |
---|
| 107 | else |
---|
| 108 | { |
---|
| 109 | vv = vv+m; |
---|
| 110 | } |
---|
| 111 | attrib(L,"isHomog",vv); |
---|
| 112 | return(L); |
---|
| 113 | } |
---|
| 114 | |
---|
| 115 | proc CM_regularity (module phi) |
---|
| 116 | "USAGE: CM_regularity(phi); phi module |
---|
| 117 | ASSUME: phi comes assigned with an admissible degree vector as an |
---|
| 118 | attribute |
---|
| 119 | RETURN: integer |
---|
| 120 | NOTE: Output is the Castelnuovo-Mumford regularity of coker(phi). |
---|
| 121 | " |
---|
| 122 | { |
---|
| 123 | if ( typeof(attrib(phi,"isHomog"))=="string" ) |
---|
| 124 | { |
---|
| 125 | ERROR("No admissible degree vector assigned"); |
---|
| 126 | } |
---|
| 127 | def L = mres(phi,0); |
---|
| 128 | intmat BeL = betti(L); |
---|
| 129 | int r = nrows(module(matrix(BeL))); |
---|
| 130 | int shift = attrib(BeL,"rowShift"); // See Section 3.4 |
---|
| 131 | return(r+shift-1); |
---|
| 132 | } |
---|
| 133 | |
---|
| 134 | ring R = 0, (w,x,y,z), dp; |
---|
| 135 | module I = [xz,0,-w,-1,0], [-yz2,y2, 0,-w,0], [y2z,0,-z2,0,-x], |
---|
| 136 | [y3,0,-yz,-x,0], [-z3,yz,0,0,-w], [-yz2,y2,0,-w,0], |
---|
| 137 | [0,0,-wy2+xz2,-y2,x2]; |
---|
| 138 | homog(I); |
---|
| 139 | CM_regularity(I); |
---|
| 140 | //-> 3 |
---|
| 141 | def T2 = mres(truncate(I,2),0); |
---|
| 142 | print (betti(T2),"betti"); |
---|
| 143 | //-> 0 1 2 3 |
---|
| 144 | //-> ------------------------------ |
---|
| 145 | //-> 2: 19 36 23 6 |
---|
| 146 | //-> 3: - - 1 - |
---|
| 147 | //-> ------------------------------ |
---|
| 148 | //-> total: 19 36 24 6 |
---|
| 149 | |
---|
| 150 | def T3 = mres(truncate(I,3),0); |
---|
| 151 | print (betti(T3),"betti"); |
---|
| 152 | //-> 0 1 2 3 |
---|
| 153 | //-> ------------------------------ |
---|
| 154 | //-> 3: 40 91 71 19 |
---|
| 155 | //-> ------------------------------ |
---|
| 156 | //-> total: 40 91 71 19 |
---|
| 157 | |
---|
| 158 | |
---|
| 159 | kill R; |
---|
| 160 | //====================== Exercise 3.4 ============================= |
---|
| 161 | //===== Procedures are stored in the library file sol_3_4.lib ====== |
---|
| 162 | //================================================================== |
---|
| 163 | LIB "sol_3_4.lib"; |
---|
| 164 | example ker_Mod; |
---|
| 165 | example Ext_Mod; |
---|
| 166 | |
---|
| 167 | |
---|
| 168 | //====================== Exercise 3.5 ============================= |
---|
| 169 | ring S = 32003, x(0..4), dp; |
---|
| 170 | resolution kos = nres(maxideal(1),0); |
---|
| 171 | print(betti(kos),"betti"); |
---|
| 172 | matrix alpha0 = random(32002,10,5); |
---|
| 173 | matrix pres = module(alpha0)+kos[4]; |
---|
| 174 | matrix dir = transpose(pres); |
---|
| 175 | resolution fdir = mres(dir,2); |
---|
| 176 | print(betti(fdir),"betti"); |
---|
| 177 | if (not(defined(flatten))) { LIB "matrix.lib"; } |
---|
| 178 | ideal I = flatten(fdir[2]); |
---|
| 179 | resolution FI = mres(I,0); |
---|
| 180 | print(betti(FI),"betti"); |
---|
| 181 | |
---|
| 182 | ring S1 = 32003, x(0..4), dp; |
---|
| 183 | resolution kos = nres(maxideal(1),0); |
---|
| 184 | betti(kos); |
---|
| 185 | matrix gammatilde = random(32002,20,19); |
---|
| 186 | matrix kos1 = matrix(kos[1]); |
---|
| 187 | matrix kos2 = kos[2]; |
---|
| 188 | if (not(defined(dsum))){ LIB"matrix.lib"; } |
---|
| 189 | matrix kos2pluskos1pluskos1 = dsum(kos2,kos1,kos1); |
---|
| 190 | module delta = kos2pluskos1pluskos1*gammatilde; |
---|
| 191 | attrib(delta,"isHomog",intvec(-1,-1,-1,-1,-1,-1,-1)); |
---|
| 192 | resolution fdelta = mres(delta,0); |
---|
| 193 | print(betti(fdelta),"betti"); |
---|
| 194 | //-> 0 1 2 3 4 5 |
---|
| 195 | //-> ------------------------------------------ |
---|
| 196 | //-> -1: 7 19 25 15 3 - |
---|
| 197 | //-> 0: - - - 2 3 1 |
---|
| 198 | //-> ------------------------------------------ |
---|
| 199 | //-> total: 7 19 25 17 6 1 |
---|
| 200 | |
---|
| 201 | matrix psi = matrix(fdelta[3]); |
---|
| 202 | matrix talpha1 = random(32002,3,15); |
---|
| 203 | matrix zero[3][2]; |
---|
| 204 | talpha1 = concat(talpha1,zero); |
---|
| 205 | matrix kos5 = kos[5]; |
---|
| 206 | matrix tphi = transpose(dsum(kos5,kos5,kos5)); |
---|
| 207 | matrix talpha1tilde = talpha1*transpose(psi); |
---|
| 208 | matrix talpha0 = lift(tphi,talpha1tilde); |
---|
| 209 | |
---|
| 210 | matrix dir = transpose(concat(psi,transpose(talpha0))); |
---|
| 211 | resolution fdir = mres(dir,2); |
---|
| 212 | print(betti(fdir),"betti"); |
---|
| 213 | ideal I = groebner(flatten(fdir[2])); |
---|
| 214 | resolution FI = mres(I,0); |
---|
| 215 | print(betti(FI),"betti"); |
---|
| 216 | // ---------- Check Smoothness ------------ |
---|
| 217 | int codimI = nvars(S1)-dim(I); |
---|
| 218 | nvars(S1) - dim(groebner(minor(jacob(I),codimI) + I)); |
---|
| 219 | //-> 5 |
---|
| 220 | // ---------------------------------------- |
---|
| 221 | |
---|
| 222 | tst_status(1);$ |
---|
| 223 | |
---|