Skip to content

Commit

Permalink
[ToricVarieites] Overhaul equality of normal toric varieties
Browse files Browse the repository at this point in the history
  • Loading branch information
HereAround committed Jul 16, 2024
1 parent cc5aa42 commit 538d039
Show file tree
Hide file tree
Showing 11 changed files with 80 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ the affine and non-affine case:
The lattice is always assumed to be the standard lattice $\mathbb{Z}^n$.
Transformations for non-standard lattices will have to be done by the user.

!!! warning
```@docs
Base.:(==)(tv1::NormalToricVariety, tv2::NormalToricVariety)
```


## Constructors

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ Hypersurface model over a concrete base
julia> hypersurface_equation(tuned_t) == new_tate_polynomial
true
julia> base_space(tuned_t) == base_space(t)
julia> base_space(tuned_t) === base_space(t)
true
```
"""
Expand Down
14 changes: 7 additions & 7 deletions experimental/FTheoryTools/test/hypersurface_models.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ h = hypersurface_model(B3, ambient_space_of_fiber, [D1, D2, D3], p; completeness
@testset "Attributes and properties of hypersurface models over concrete base space and fiber ambient space P2" begin
@test parent(hypersurface_equation(h)) == cox_ring(ambient_space(h))
@test dim(base_space(h)) == dim(B3)
@test fiber_ambient_space(h) == ambient_space_of_fiber
@test fiber_ambient_space(h) === ambient_space_of_fiber
@test is_smooth(fiber_ambient_space(h)) == false
@test [string(g) for g in gens(cox_ring(fiber_ambient_space(h)))] == ["x", "y", "z"]
@test toric_variety(calabi_yau_hypersurface(h)) == ambient_space(h)
@test toric_variety(calabi_yau_hypersurface(h)) === ambient_space(h)
@test is_base_space_fully_specified(h) == true
end

Expand All @@ -32,9 +32,9 @@ end
mktempdir() do path
test_save_load_roundtrip(path, h) do loaded
@test hypersurface_equation(h) == hypersurface_equation(loaded)
@test base_space(h) == base_space(loaded)
@test ambient_space(h) == ambient_space(loaded)
@test fiber_ambient_space(h) == fiber_ambient_space(loaded)
@test base_space(h) === base_space(loaded)
@test ambient_space(h) === ambient_space(loaded)
@test fiber_ambient_space(h) === fiber_ambient_space(loaded)
@test is_base_space_fully_specified(h) == is_base_space_fully_specified(loaded)
@test is_partially_resolved(h) == is_partially_resolved(loaded)
end
Expand All @@ -49,7 +49,7 @@ h2 = tune(h, new_poly)
@test h == tune(h, hypersurface_equation(h))
@test hypersurface_equation(h2) == new_poly
@test hypersurface_equation(h2) != hypersurface_equation(h)
@test fiber_ambient_space(h2) == fiber_ambient_space(h)
@test fiber_ambient_space(h2) === fiber_ambient_space(h)
end

B2 = projective_space(NormalToricVariety, 2)
Expand Down Expand Up @@ -104,7 +104,7 @@ h4 = hypersurface_model(auxiliary_base_vars, auxiliary_base_grading, d, ambient_
@testset "Attributes and properties of hypersurface models over concrete base space and fiber ambient space P2" begin
@test parent(hypersurface_equation(h4)) == coordinate_ring(ambient_space(h4))
@test dim(base_space(h4)) == d
@test fiber_ambient_space(h4) == ambient_space_of_fiber_2
@test fiber_ambient_space(h4) === ambient_space_of_fiber_2
@test is_smooth(fiber_ambient_space(h4)) == false
@test is_simplicial(fiber_ambient_space(h4)) == true
@test [string(g) for g in gens(cox_ring(fiber_ambient_space(h4)))] == ["x", "y", "z"]
Expand Down
6 changes: 5 additions & 1 deletion experimental/Schemes/src/IdealSheaves.jl
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,11 @@ end
function ==(I::AbsIdealSheaf, J::AbsIdealSheaf)
I === J && return true
X = space(I)
X == space(J) || return false
if X isa NormalToricVariety
X === space(J) || return false
else
X == space(J) || return false
end
for U in basic_patches(default_covering(X))
is_subset(I(U), J(U)) && is_subset(J(U), I(U)) || return false
end
Expand Down
2 changes: 1 addition & 1 deletion experimental/Schemes/src/ToricBlowups/constructors.jl
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ Ideal generated by
julia> b2P3 = blow_up(P3, I2);
julia> codomain(b2P3) == P3
julia> codomain(b2P3) === P3
true
```
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,62 @@ end



######################
# Equality
######################

@doc raw"""
Base.:(==)(tv1::NormalToricVariety, tv2::NormalToricVariety)
In OSCAR, the `==` operator is reserved to check if two normal toric varieties are identical,
meaning their underlying polyhedral fans are the same. However, this check is computationally
challenging due to several reasons:
- The ray generators might be scaled.
- The ray generators might be stored in different orders.
- The maximal (polyhedral) cones of the polyhedral fan might be stored in different orders.
- If we fall back on polyhedral fan equality, lineality of the cones must also be considered.
To avoid this computational bottleneck, we have designed OSCAR to *not* implement the `==`
method for toric varieties. Instead, using `==` will always raise an error, as shown below.
However, triple equality `===` is supported. This returns `true` if the memory locations of
the two objects in question are identical, and `false` otherwise. We recommend using `===`
instead of `==`.
# Examples
```jldoctest
julia> p2 = projective_space(NormalToricVariety, 2)
Normal toric variety
julia> f2 = hirzebruch_surface(NormalToricVariety, 2)
Normal toric variety
julia> p2 === f2
false
julia> p2 === p2
true
julia> function capture_error_message()
try
p2 == f2
catch e
println(e.msg)
end
end
capture_error_message (generic function with 1 method)
julia> capture_error_message()
Equality of normal toric varieties is not implemented, as computationally very demanding. More details in the documentation.
```
"""
function Base.:(==)(tv1::NormalToricVariety, tv2::NormalToricVariety)
error("Equality of normal toric varieties is not implemented, as computationally very demanding. More details in the documentation.")
end



######################
# Display
######################
Expand Down
2 changes: 1 addition & 1 deletion src/AlgebraicGeometry/ToricVarieties/Proj/constructors.jl
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ function _projectivization_and_total_space(is_proj::Bool, E::Vector{T}) where T

is_proj && length(E) == 1 && return v

@req all(i -> toric_variety(E[i]) == v, eachindex(E)) "The divisors are defined on different toric varieties."
@req all(i -> toric_variety(E[i]) === v, eachindex(E)) "The divisors are defined on different toric varieties."

if is_proj
PF_fiber = normal_fan(simplex(length(E) - 1))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ julia> (t1, x1, t2, x2) = gens(cox_ring(f2));
julia> c = closed_subvariety_of_toric_variety(f2, [t1])
Closed subvariety of a normal toric variety
julia> toric_variety(c) == f2
julia> toric_variety(c) === f2
true
```
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ end
####################################################

function Base.:(==)(tm1::ToricMorphism, tm2::ToricMorphism)
return domain(tm1) == domain(tm2) && codomain(tm1) == codomain(tm2) && grid_morphism(tm1) == grid_morphism(tm2)
return domain(tm1) === domain(tm2) && codomain(tm1) === codomain(tm2) && grid_morphism(tm1) == grid_morphism(tm2)
end

function Base.hash(tm::ToricMorphism, h::UInt)
Expand Down
2 changes: 1 addition & 1 deletion test/AlgebraicGeometry/ToricVarieties/toric_blowdowns.jl
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
@test grid_morphism(bl + bl) == grid_morphism(2 * bl)
@test grid_morphism(bl - bl) == grid_morphism(0 * bl)
@test grid_morphism(bl * toric_identity_morphism(codomain(bl))) == grid_morphism(bl)
@test bl != bl2
@test bl !== bl2
end

S = cox_ring(P2)
Expand Down
2 changes: 1 addition & 1 deletion test/AlgebraicGeometry/ToricVarieties/toric_morphisms.jl
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
end

@testset "Basic attributes of toric morphisms" begin
@test codomain(tm1) == domain(tm2)
@test codomain(tm1) === domain(tm2)
@test matrix(grid_morphism(tm2)) == matrix(ZZ, [[1, 0], [0, 1]])
@test morphism_on_torusinvariant_weil_divisor_group(tm2).map == identity_matrix(ZZ, 4)
@test morphism_on_torusinvariant_cartier_divisor_group(tm2).map == identity_matrix(ZZ, 4)
Expand Down

0 comments on commit 538d039

Please sign in to comment.