Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FTheoryTools] Unify blowup of singularities among toric varieties and schemes #3519

Merged
2 changes: 1 addition & 1 deletion experimental/Schemes/CoveredProjectiveSchemes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ gluing_morphisms(PG::ProjectiveGluing) = (PG.f, PG.g)
)
C in coverings(Y) || error("covering not listed")
for P in values(projective_patches)
base_scheme(P) in patches(C) || error("base scheme not found in covering")
any(x->x===base_scheme(P), patches(C)) || error("base scheme not found in covering")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this a == vs === issue? Looks like an easy mistake.

end
for (U, V) in keys(gluings(C))
(U, V) in keys(projective_gluings) || error("not all projective gluings were provided")
Expand Down
12 changes: 6 additions & 6 deletions experimental/Schemes/Types.jl
Original file line number Diff line number Diff line change
Expand Up @@ -422,12 +422,12 @@ end
end
end

mutable struct ToricIdealSheafFromCoxRingIdeal{SpaceType, OpenType, OutputType,
RestrictionType
} <: AbsIdealSheaf{
SpaceType, OpenType,
OutputType, RestrictionType
}
@attributes mutable struct ToricIdealSheafFromCoxRingIdeal{SpaceType, OpenType, OutputType,
RestrictionType
} <: AbsIdealSheaf{
SpaceType, OpenType,
OutputType, RestrictionType
}

X::NormalToricVariety
I::MPolyIdeal
Expand Down
24 changes: 12 additions & 12 deletions src/AlgebraicGeometry/Schemes/AffineSchemes/Objects/Properties.jl
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,9 @@ end
# (2.1) MPolyRing in first argument

function is_subscheme(
X::AbsAffineScheme{BRT, RT},
Y::AbsAffineScheme{BRT, RT}
) where {BRT, RT<:MPolyRing}
X::AbsAffineScheme{BRT, <:MPolyRing},
Y::AbsAffineScheme{BRT, <:MPolyRing}
) where {BRT}
return OO(X) === OO(Y)
end

Expand Down Expand Up @@ -138,9 +138,9 @@ end


function is_subscheme(
X::AbsAffineScheme{BRT, RT},
Y::AbsAffineScheme{BRT, RT}
) where {BRT, RT<:MPolyQuoRing}
X::AbsAffineScheme{BRT, <:MPolyQuoRing},
Y::AbsAffineScheme{BRT, <:MPolyQuoRing}
) where {BRT}
R = ambient_coordinate_ring(X)
R === ambient_coordinate_ring(Y) || return false
return issubset(saturated_ideal(defining_ideal(Y)), saturated_ideal(defining_ideal(X)))
Expand Down Expand Up @@ -192,9 +192,9 @@ end


function is_subscheme(
X::AbsAffineScheme{BRT, RT},
Y::AbsAffineScheme{BRT, RT}
) where {BRT, RT<:MPolyLocRing}
X::AbsAffineScheme{BRT, <:MPolyLocRing},
Y::AbsAffineScheme{BRT, <:MPolyLocRing}
) where {BRT}
R = ambient_coordinate_ring(X)
R === ambient_coordinate_ring(Y) || return false
UX = inverted_set(OO(X))
Expand Down Expand Up @@ -257,9 +257,9 @@ end


function is_subscheme(
X::AbsAffineScheme{BRT, RT},
Y::AbsAffineScheme{BRT, RT}
) where {BRT, RT<:MPolyQuoLocRing{<:Any, <:Any, <:Any, <:Any, <:MPolyPowersOfElement}}
X::AbsAffineScheme{BRT, <:MPolyQuoLocRing{<:Any, <:Any, <:Any, <:Any, <:MPolyPowersOfElement}},
Y::AbsAffineScheme{BRT, <:MPolyQuoLocRing{<:Any, <:Any, <:Any, <:Any, <:MPolyPowersOfElement}}
) where {BRT}
R = ambient_coordinate_ring(X)
R === ambient_coordinate_ring(Y) || return false
UX = inverted_set(OO(X))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -448,9 +448,17 @@ Ideal generated by
```
"""
function toric_ideal(R::MPolyRing, antv::AffineNormalToricVariety)
C = cone(pm_object(antv).WEIGHT_CONE)
C = cone(pm_object(antv).WEIGHT_CONE)
HB = matrix(ZZ, hilbert_basis(C))
# If the cone is smooth, the Hilbert basis is itself a basis and the toric
# ideal is zero. We catch this here as 4ti2 is unhappy about some of the
# smooth cones.
if rank(HB) == nrows(HB)
return ideal(R, [R(0)])
else
gens = pm_object(C).CONE_TORIC_IDEAL.BINOMIAL_GENERATORS
return binomial_exponents_to_ideal(R, gens)
end
end


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,9 +228,9 @@ julia> parent(s) == cox_ring(toric_variety(l))
true
```
"""
@attr MPolyDecRingElem{QQFieldElem, QQMPolyRingElem} function generic_section(l::ToricLineBundle)
function generic_section(l::ToricLineBundle)
if length(basis_of_global_sections(l)) == 0
return zero(cox_ring(toric_variety(l)))
end
return sum([rand(Int) * b for b in basis_of_global_sections(l)]);
return sum([rand(Int) * b for b in basis_of_global_sections(l)])
end
9 changes: 9 additions & 0 deletions src/Rings/MPolyMap/MPolyQuo.jl
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,15 @@ function _evaluate_plain(F::MPolyAnyMap{<: MPolyQuoRing}, u)
return evaluate(lift(u), _images(F))
end

function _evaluate_plain(F::MPolyAnyMap{<:MPolyQuoRing, <:MPolyQuoRing}, u)
# This workaround deals with the fact that arithmetic in quotient rings is TERRIBLY slow.
# All the simplify calls make it unusable in this case, probably due to the fact that
# setting `is_reduced` flags does not pay off in such iterative procedures.
A = codomain(F)
v = evaluate(lift(u), lift.(_images(F)))
return simplify(A(v))
end

Comment on lines +113 to +121
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to apologize for this in the comment! Arithmetic in quotients of polynomial rings is dead slow, when you reduce after each step. The art is to be rather lazy, not care about the choice of representative in complicated sequences of basic operations for a while and only reduce occasionally to normal form -- and of course whenever it is necessary to have a normal form as representative. This is precisely the philosophy you are pursuing here.

function _evaluate_general(F::MPolyAnyMap{<: MPolyQuoRing}, u)
if domain(F) === codomain(F) && coefficient_map(F) === nothing
return evaluate(map_coefficients(coefficient_map(F), lift(u),
Expand Down
7 changes: 7 additions & 0 deletions src/Rings/MPolyMap/MPolyRing.jl
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,13 @@ function _evaluate_plain(F::MPolyAnyMap{<: MPolyRing}, u)
return evaluate(u, F.img_gens)
end

# See the comment in MPolyQuo.jl
function _evaluate_plain(F::MPolyAnyMap{<:MPolyRing, <:MPolyQuoRing}, u)
A = codomain(F)
v = evaluate(lift(u), lift.(_images(F)))
return simplify(A(v))
end

function _evaluate_general(F::MPolyAnyMap{<: MPolyRing}, u)
if domain(F) === codomain(F) && coefficient_map(F) === nothing
return evaluate(map_coefficients(coefficient_map(F), u,
Expand Down