----------------------------------------------------------------- -- Preamble ----------------------------------------------------------------- newPackage( "CharToric", Version => "1.1", Date => "April 20, 2015", Authors => {{Name => "Martin Helmer", Email => "martin.helmer2@gmail.com", HomePage => "http://publish.uwo.ca/~mhelmer2/"}}, Headline => "Computes CSM classes, Segre classes and the Euler Char.", DebuggingMode => false, Reload => true ) needsPackage "NormalToricVarieties"; --Exported functions/variables export{ EulerToric, CSMToric, ChowRing, CheckSmooth, mult } mult=method(TypicalValue=>ZZ); mult:=RayMatrix->( r:=rank RayMatrix; return multr(RayMatrix,r); ) ChowRing=method(TypicalValue=>QuotientRing); ChowRing NormalToricVariety:=TorVar->( --assert isSimplicial TorVar; --assert isComplete TorVar; --First build Chow ring, need Stanley-Reisner Ideal (SR) and the ideal -- generated by the linear relations of the rays (J) --See Cox, Little, Schenck Th. 12.5.3 and comments after proof R:=ring(TorVar); A:=0; --For simplical toric var. Lemma 3.5 of Euler characteristic of coherent sheaves on simplicial torics via the Stanley-Reisner ring -- (and probally other sources) tell us that the SR ideal is the Alexander --dual of the toric irrelevant ideal SR:=dual monomialIdeal TorVar; F:=fan TorVar; Fd:=dim(F); --Build ideal generated by linear relations of the rays Jl:={}; for j from 0 to dim(F)-1 do( Jl=append (Jl,sum(0..((length rays(TorVar))-1), i->(((rays TorVar)_i)_j)*(gens R)_i )); ); J:=ideal(Jl); --Chow ring if isSmooth(TorVar) then( --if smooth our Chow ring should be over ZZ C:=ZZ[gens R, Degrees=>degrees R, Heft=>heft R]; A=C/substitute(SR+J,C); ) else (A=R/(SR+J);); --Generators (as a ring) of the quotient ring representation of the chow ring corespond to --the divisors associated to the rays in the fan Theorem 12.5.3. Cox, Little, Schenck and --comments above return A; ); EulerToric=method(TypicalValue => RingElement,Options => {CheckSmooth=>true}); EulerToric NormalToricVariety :=opts->TorVar->( A:=ChowRing(TorVar); return EulerToric(A,TorVar,CheckSmooth=>opts.CheckSmooth); ); EulerToric (QuotientRing, NormalToricVariety) :=opts->(A,TorVar)->( --For Euler we need only the zero dimensional part of csm, so just calculate that part L:=gens(A); Trays:=rays TorVar; csm0:=0_A; Rmat:=0; prodj:=0; Ssets:=0; indsubsets:=0; dimTorVar:=dim(TorVar); TorVarIsSmooth:=false; if opts.CheckSmooth==true then TorVarIsSmooth=isSmooth(TorVar); if TorVarIsSmooth then( indsubsets=subsets((0..numgens(A)-1),dimTorVar); Ssets=for l in indsubsets list L_l; csm0=sum(0..(length(Ssets)-1),j-> product(Ssets_j)); ) else( indsubsets=subsets((0..numgens(A)-1),dimTorVar); Ssets=for l in indsubsets list L_l; --csm0=sum(0..(length(Ssets)-1),j-> mult(transpose matrix Trays_(indsubsets_j))*product(Ssets_j)); for j from 0 to length(Ssets)-1 do( Rmat=transpose matrix Trays_(indsubsets_j); prodj=product(Ssets_j); if prodj!=0 then( csm0=csm0+ mult(Rmat)*prodj; ); ); ); (m,c):=coefficients(csm0); Echar:=(sum entries c)_0; <<"Euler Charcteristic = "< RingElement,Options => {CheckSmooth=>true}); CSMToric NormalToricVariety :=opts->TorVar->( A:=ChowRing(TorVar); return CSMToric(A,TorVar,CheckSmooth=>opts.CheckSmooth); ); CSMToric (QuotientRing, NormalToricVariety) :=opts->(A,TorVar)->( --Generators (as a ring) of the quotient ring representation of the chow ring corespond to --the divisors associated to the rays in the fan Theorem 12.5.3. Cox, Little, Schenck and --comments above L:=gens(A); Trays:=rays TorVar; csm:=1_A; Rmat:=0; prodj:=0; --The following implements the method described --in Barthel, Brasselet, and Fieseler. --Lemma 12.5.2 of Cox, Little, Schenck is used to find the chow ring class of the --orbit closure from divisors --if the toric variety is smooth the multiplicity is 1. Ssets:=0; indsubsets:=0; TorVarIsSmooth:=false; if opts.CheckSmooth==true then TorVarIsSmooth=isSmooth(TorVar); if TorVarIsSmooth then( for i from 1 to dim(TorVar) do( indsubsets=subsets((0..numgens(A)-1),i); Ssets=for l in indsubsets list L_l; csm=csm+sum(0..(length(Ssets)-1),j-> product(Ssets_j)); ); ) else( for i from 1 to dim(TorVar) do( indsubsets=subsets((0..numgens(A)-1),i); Ssets=for l in indsubsets list L_l; --csm=csm+sum(0..(length(Ssets)-1),j-> mult(transpose matrix Trays_(indsubsets_j))*product(Ssets_j)); for j from 0 to length(Ssets)-1 do( Rmat=transpose matrix Trays_(indsubsets_j); prodj=product(Ssets_j); if prodj!=0 then( csm=csm+ mult(Rmat)*prodj; ); ); ); ); <<"csm = "<( m:=RayMatrix; if m==0 then return 0; if (numRows(m)==1 or numColumns(m)==1) then( return 1); --r:=rank m; if r"MGB"); ); if r"MGB"); ); if numRows(m)==numColumns(m) then( mymult:=abs(determinant(m,Strategy =>Cofactor)); --<false); time EulerToric(A,PP,CheckSmooth=>false); /// TEST /// {* restart needsPackage "CharToric" needsPackage "NormalToricVarieties" *} PP8=projectiveSpace(8); PP6=projectiveSpace(6); PP5=projectiveSpace(5); PP2=projectiveSpace(2); --PP5xPP6 time A=ChowRing(PP5**PP6) time CSMToric (A,PP5**PP6) time EulerToric(A,PP5**PP6) time CSMToric (A,PP5**PP6,CheckSmooth=>false) time EulerToric(A,PP5**PP6,CheckSmooth=>false) --PP5xPP8 time A=ChowRing(PP5**PP8) time CSMToric (A,PP5**PP8) time EulerToric (A,PP5**PP8) time CSMToric (A,PP5**PP8,CheckSmooth=>false) time EulerToric (A,PP5**PP8,CheckSmooth=>false) --PP8xPP8 time A=ChowRing(PP8**PP8) time CSMToric (A,PP8**PP8) time EulerToric (A,PP8**PP8) time CSMToric (A,PP8**PP8,CheckSmooth=>false) time EulerToric (A,PP8**PP8,CheckSmooth=>false) --PP5xPP5xPP5 time A=ChowRing(PP5**PP5**PP5) time CSMToric (A,PP5**PP5**PP5); time EulerToric (A,PP5**PP5**PP5) time CSMToric (A,PP5**PP5**PP5,CheckSmooth=>false); time EulerToric (A,PP5**PP5**PP5,CheckSmooth=>false) --PP5xPP5xPP6 time A=ChowRing(PP5**PP5**PP6) time CSMToric (A,PP5**PP5**PP6); time EulerToric (A,PP5**PP5**PP6) time CSMToric (A,PP5**PP5**PP6,CheckSmooth=>false); time EulerToric (A,PP5**PP5**PP6,CheckSmooth=>false) /// TEST /// {* restart needsPackage "CharToric" needsPackage "NormalToricVarieties" *} sF1=smoothFanoToricVariety(6,123); sF2=smoothFanoToricVariety(6,423); sF3=smoothFanoToricVariety(6,1007); --Smooth Fano 1 time A=ChowRing(sF1) time CSMToric(A,sF1); time EulerToric(A,sF1); time CSMToric(A,sF1,CheckSmooth=>false); time EulerToric(A,sF1,CheckSmooth=>false); --Smooth Fano 2 time A=ChowRing(sF2) time CSMToric(A,sF2); time EulerToric(A,sF2); time CSMToric(A,sF2,CheckSmooth=>false); time EulerToric(A,sF2,CheckSmooth=>false); --Smooth fano 3 time A=ChowRing(sF3) time CSMToric(A,sF3); time EulerToric(A,sF3); time CSMToric(A,sF3,CheckSmooth=>false); time EulerToric(A,sF3,CheckSmooth=>false); /// TEST /// {* restart needsPackage "CharToric" needsPackage "NormalToricVarieties" *} hiz=hirzebruchSurface 23 time csm=CSMToric hiz /// TEST /// {* restart needsPackage "CharToric" needsPackage "NormalToricVarieties" *} PP=projectiveSpace(12); rP=rays(PP) m=transpose matrix(rP_{0..2,5..9}) j= groebnerBasis(transpose groebnerBasis(m)); time( for i from 0 to 2^13 do( --abs(determinant(j,Strategy =>Cofactor)); j= groebnerBasis(transpose groebnerBasis(m)); abs(determinant(j,Strategy =>Cofactor)); ); ) ///