--The scripts below take as input a simplicial complex together with a one-critical bifiltration --then build the associated chain complex. Uses the Macaulay2 pacakge SimplicialComplexes loadPackage "SimplicialComplexes" --Turn a row vector into a list. rvectTolist = (M)->(apply(rank source M, i->M_(0,i))) --For every face, we need to assign it the multidegree --in which it appears. In these examples we work with a Z^2 grading. AllFaces=(SC)->(apply((dim D)+2, i->(rvectTolist faces(i,SC)))) WeightedFaces = (SC, W)->(FF=flatten AllFaces(SC); FW=flatten W; apply(#FF, i->({FF#i, FW#i}))) --Build the ith differential. Use the differential from the simplicial complex, --and the hash table with the weightings. WD = (SC,W,i)->(Fi = faces(i,SC); Fim = faces(i-1,SC); f=rank source Fi; g=rank source Fim; apply(g,m->(apply(f,n->(if ((CCSC.dd_i)_(m,n) !=0) then (y_1^(HT#(Fi_(0,n))#0- HT#(Fim_(0,m))#0)*y_2^(HT#(Fi_(0,n))#1-HT#(Fim_(0,m))#1))*((CCSC.dd_i)_(m,n)) else 0_R1))))) ---Build the chain complex for a bifiltration. BuildCC2 =(SC,W)->(R1=R[y_1,y_2]; CCSC = chainComplex SC; d = dim(SC)+1; HT=hashTable WeightedFaces(SC,W); listdiffs=apply(d, i->(WD(SC,W,i+1))); S=ZZ/31991[x_1,x_2, Degrees=>{{1,0},{0,1}}]; tidyup=map(S,R1, matrix{{x_1,x_2}}); listdiffsS=apply(listdiffs, i->apply(i, j->apply(j, k->tidyup k))); diffs1 = apply(listdiffsS, i->(matrix i)**S); --Top differential has target ZZ^n instead of R1^n, just tensor --everything together Clist = apply(W, j->directSum(apply(j, i->S^{-i}))); diffs2 = apply((#Clist-1), i->(map(Clist_i, Clist_(i+1), diffs1#i))); chainComplex(diffs2)) --The next scripts build a chain complex, and then we compute a minimal presentation --of the first homology for the bifiltration in Example 3.24 of arXiv 1708.07390 i1 : R=ZZ/31991[a..f]; -- I is the monomial ideal of the non-edges i2 : I = monomialIdeal (a*c,a*d,a*e,b*d,b*e,c*f,d*f); -- W is a list of lists: the first list stores the entry degrees of the vertices, -- the second list the entry degrees of the edges -- and the third list the entry degrees of the faces. -- Vertices, edges and faces are ordered by lexicographical order. i3 : W={{{1,1},{0,0},{0,0},{1,0},{0,0},{0,0}}, {{1,2},{1,2},{2,2},{0,2},{1,0},{0,1},{1,0},{2,0}}, {{2,2},{3,1}}}; --Build the simplicial complex i4 : K=simplicialComplex I; i5 : AllFaces K; -- Build the chain complex i6 : Kcomplex=BuildCC2(K,W); --Compute a minimal presentation of the first homology of the chain complex i7 : prune(HH_1(Kcomplex)) o7 = cokernel {1, 1} | x_1^2 0 | {1, 2} | 0 x_1 | {2, 2} | 0 0 | 3 o7 : S-module, quotient of S --For brevity we only include below the ouput of the computation of the minimal presentation of the module. --Note that the command {\tt Kcomplex=BuildCC2(K,W);} gives the same chain complex as the previous example. --The next section shows how to compute the Hilbert function and series, and display the Hilbert function as a table. --Input M a bigraded module. Output is a 6x6 grid displaying --(low degree) values of the bigraded Hilbert function, and the --bigraded Hilbert series. Specific to the 2D case. Also for --the 3 valuse I in {{x_1},{x_2},{x_1,x_2}} compute H^0_I(M). Dis = (M)->(print matrix table(6,6, T=(i,j)->hilbertFunction({5-i,j},M)); print hilbertSeries M; print "H^0_I(M) for all associated primes"; R=ring(M); Vlist=rvectTolist vars(R); AllPrimes = drop((subsets Vlist),1); --get all subsets of vars, drop the empty one H0I=apply(AllPrimes, i-> saturate(0_M, ideal(i))); --compute H^0_I(M) for all associated primes scan(#AllPrimes, i->(print AllPrimes_i; PHOI = prune H0I_i; print PHOI; if PHOI =!=0_M then print hilbertSeries H0I_i))) ---Example 3.24 i22 : Dis HH_1 Kcomplex | 0 0 1 1 1 1 | | 0 0 1 1 1 1 | | 0 0 1 1 1 1 | | 0 1 2 2 2 2 | | 0 1 2 2 2 2 | | 0 0 0 0 0 0 | 2 3 T T + T T - T T 0 1 0 1 0 1 ------------------ (1 - T )(1 - T ) 1 0 H^0_I(M) for all associated primes {x } 1 cokernel {1, 1} | x_1^2 0 | {1, 2} | 0 x_1 | 2 3 2 2 T T + T T - T T - T T 0 1 0 1 0 1 0 1 ------------------------- (1 - T )(1 - T ) 1 0 {x } 2 0 {x , x } 1 2 0 ---Example 3.25 i23 : Dis HH_1 C | 0 0 1 1 1 1 | | 0 0 1 1 1 1 | | 0 0 1 1 1 1 | | 0 1 2 2 2 2 | | 0 1 2 1 1 1 | | 0 0 0 0 0 0 | 2 3 3 2 3 T T + T T - T T - T T + T T 0 1 0 1 0 1 0 1 0 1 -------------------------------- (1 - T )(1 - T ) 1 0 H^0_I(M) for all associated primes {x } 1 cokernel {1, 1} | x_1^2 0 0 | {1, 2} | 0 x_2 x_1 | 2 3 2 2 3 2 3 T T + T T - T T - T T - T T + T T 0 1 0 1 0 1 0 1 0 1 0 1 --------------------------------------- (1 - T )(1 - T ) 1 0 {x } 2 cokernel {1, 2} | x_2 x_1 | 2 2 2 3 2 3 T T - T T - T T + T T 0 1 0 1 0 1 0 1 ------------------------- (1 - T )(1 - T ) 1 0 {x , x } 1 2 cokernel {1, 2} | x_2 x_1 | 2 2 2 3 2 3 T T - T T - T T + T T 0 1 0 1 0 1 0 1 ------------------------- (1 - T )(1 - T ) 1 0 --Notice that the submodule of H_1 annihilated by x_2 and the --submodule annihilated by x_1,x_2 are the same, which makes --sense since this submodule is isomorphic to R/x_1,x_2. ---Example 3.29 o16 : M=S^{{-1,-1}}++S^{{-2,-2}} o16 : S-module, free, degrees {{1, 1}, {2, 2}} i17 : M=S^{{-1,-1}}++S^{{-2,-2}}; i17 : Dis(M) | 0 1 2 2 2 2 | | 0 1 2 2 2 2 | | 0 1 2 2 2 2 | | 0 1 2 2 2 2 | | 0 1 1 1 1 1 | | 0 0 0 0 0 0 | 2 2 T T + T T 0 1 0 1 ---------------- (1 - T )(1 - T ) 1 0 H^0_I(M) for all associated primes {x } 1 0 {x } 2 0 {x , x } 1 2 0 --Since M is a free module, there only submodule supported --on the (possible) associated primes is the 0 submodule. i19 : N=S^{{-2,-2}}++S^{{-2,-2}}++((coker matrix{{x_2}})**S^{{-1,-1}}) ++((coker gens ideal(x_1))**S^{{-1,-2}}) o19 = cokernel {2, 2} | 0 0 | {2, 2} | 0 0 | {1, 1} | x_2 0 | {1, 2} | 0 x_1 | i20 : Dis(N) | 0 1 2 2 2 2 | | 0 1 2 2 2 2 | | 0 1 2 2 2 2 | | 0 1 2 2 2 2 | | 0 1 1 1 1 1 | | 0 0 0 0 0 0 | 2 2 T T + T T 0 1 0 1 ---------------- (1 - T )(1 - T ) 1 0 H^0_I(M) for all associated primes {x } 1 cokernel {1, 2} | x_1 | 2 2 2 T T - T T 0 1 0 1 ---------------- (1 - T )(1 - T ) 1 0 {x } 2 cokernel {1, 1} | x_2 | 2 T T - T T 0 1 0 1 ---------------- (1 - T )(1 - T ) 1 0 {x , x } 1 2 0 --The modules M and N have the same Hilbert function and multigraded Hilbert series, but the local cohomology distinguishes them. --We close by showing one way to compute the rank of the module, using the reduction to a line of the last section of arXiv 1708.07390 -- Script to change from a Z^2 graded ring to a singly graded ring. RestrictLine2 = (U)->(V = vars ring U; n=rank source V; A = ZZ/31991[a_1..a_n]; W = vars A; L = apply(n, i->(V_(0,i)=>W_(0,i))); Uzgraded = A**(matrix MatToList sub(U, L)); firstVar = matrix{apply(n, i->a_1)}; diagonalIdeal = ideal(firstVar-W); diagonalVar = coker mingens diagonalIdeal; Udiag = coker(Uzgraded)**diagonalVar; hilbertPolynomial Udiag) -- Script to take a multigraded module U, and return the --same module over a Z graded ring A with the same number --of variables, then restrict to the diagonal and return --hilbertPolynomial which is of the form rP_0, r = rk(M). --NEED TO HAVE INPUT U A MATRIX (use presentation U if U --is a module to get the presentation matrix). Calls the --script MatToList to fix grading issues. MatToList = (AMAT)->(s = rank source AMAT; t = rank target AMAT; apply(t, i->(apply(s, j->(AMAT_(i,j)))))) --For the modules in Example 4.54 we compute: i1 : RestrictLine2 presentation N o1 = 2*P 0 o1 : ProjectiveHilbertPolynomial i2 : RestrictLine2 presentation M o2 = 2*P 0 o2 : ProjectiveHilbertPolynomial --So the modules have both rank 2, as was expected.