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

Other minor improvements for toric varieties #940

Merged
merged 7 commits into from
Jan 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/src/ToricVarieties/NormalToricVarieties.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ NormalToricVariety(P::Polyhedron)
### Famous Toric Vareties

```@docs
toric_affine_space(d::Int)
del_pezzo(b::Int)
hirzebruch_surface(r::Int)
toric_projective_space(d::Int)
Expand Down
18 changes: 12 additions & 6 deletions src/ToricVarieties/NormalToricVarieties/attributes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ export euler_characteristic
@doc Markdown.doc"""
cox_ring(v::AbstractNormalToricVariety)

Return the Cox ring of the normal toric variety `v`.
Computes the Cox ring of the normal toric variety `v`.
Note that [CLS11](@cite) refers to this ring as the "total coordinate ring".

# Examples
```jdoctest
Expand Down Expand Up @@ -179,7 +180,12 @@ function toric_ideal(antv::AffineNormalToricVariety)
end
end
export toric_ideal
toric_ideal(ntv::NormalToricVariety) = toric_ideal(AffineNormalToricVariety(ntv))

function toric_ideal(ntv::NormalToricVariety)
isaffine(ntv) || error("Cannot construct affine toric variety from non-affine input")
return get_attribute!(() -> toric_ideal(AffineNormalToricVariety(ntv)), ntv, :toric_ideal)
end
export toric_ideal


############################
Expand All @@ -203,7 +209,7 @@ GrpAb: Z^2
"""
function character_lattice(v::AbstractNormalToricVariety)
return get_attribute!(v, :character_lattice) do
return abelian_group([0 for i in 1:pm_object(v).FAN_DIM])
return free_abelian_group(dim(fan(v)))
end
end
export character_lattice
Expand All @@ -225,7 +231,7 @@ GrpAb: Z^3
"""
function torusinvariant_divisor_group(v::AbstractNormalToricVariety)
return get_attribute!(v, :torusinvariant_divisor_group) do
return abelian_group([0 for i in 1:pm_object(v).N_RAYS])
return free_abelian_group(nrays(fan(v)))
end
end
export torusinvariant_divisor_group
Expand Down Expand Up @@ -409,8 +415,8 @@ function map_from_cartier_divisor_group_to_torus_invariant_divisor_group(v::Abst

# compute the total map
mapping_matrix = map_for_scalar_products * map_for_difference_of_elements
source = abelian_group(zeros(Int, nrows(mapping_matrix)))
target = abelian_group(zeros(Int, ncols(mapping_matrix)))
source = free_abelian_group(nrows(mapping_matrix))
target = free_abelian_group(ncols(mapping_matrix))
total_map = hom(source, target, mapping_matrix)

# identify the embedding of the cartier_data_group
Expand Down
49 changes: 45 additions & 4 deletions src/ToricVarieties/NormalToricVarieties/constructors.jl
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ function AffineNormalToricVariety(v::NormalToricVariety)
# set variety
variety = AffineNormalToricVariety(pm_object(v), Dict())

# set properties
# set properties of variety
set_attribute!(variety, :isaffine, true)
set_attribute!(variety, :iscomplete, false)
set_attribute!(variety, :isprojective, false)
Expand All @@ -187,6 +187,47 @@ end
# 3: Special constructors
######################

@doc Markdown.doc"""
toric_affine_space(d::Int)

Constructs the (toric) affine space of dimension `d`.

# Examples
```jldoctest
julia> toric_affine_space(2)
A normal, affine, non-complete, 2-dimensional toric variety
```
"""
function toric_affine_space(d::Int)
# construct the cone of the variety
m = zeros(Int, d, d)
for i in 1:d
m[i,i] = 1
end
C = positive_hull(m)

# construct the variety
fan = PolyhedralFan(C)
pmntv = Polymake.fulton.NormalToricVariety(Oscar.pm_object(fan))
variety = NormalToricVariety(pmntv, Dict())

# set known properties
set_attribute!(variety, :isaffine, true)
set_attribute!(variety, :iscomplete, false)
set_attribute!(variety, :isprojective, false)
set_attribute!(variety, :isprojective_space, false)

# set attributes
set_attribute!(variety, :fan, fan)
set_attribute!(variety, :dim, d)
set_attribute!(variety, :dim_of_torusfactor, 0)

# return the variety
return variety
end
export toric_affine_space


@doc Markdown.doc"""
toric_projective_space(d::Int)

Expand Down Expand Up @@ -221,13 +262,13 @@ function toric_projective_space(d::Int)
set_attribute!(variety, :dim, d)
set_attribute!(variety, :dim_of_torusfactor, 0)
set_attribute!(variety, :euler_characteristic, d+1)
set_attribute!(variety, :character_lattice, abelian_group([0 for i in 1:d]))
set_attribute!(variety, :torusinvariant_divisor_group, abelian_group([0 for i in 1:d+1]))
set_attribute!(variety, :character_lattice, free_abelian_group(d))
set_attribute!(variety, :torusinvariant_divisor_group, free_abelian_group(d+1))
set_attribute!(variety, :map_from_cartier_divisor_group_to_torus_invariant_divisor_group, Hecke.identity_map(torusinvariant_divisor_group(variety)))
set_attribute!(variety, :map_from_cartier_divisor_group_to_picard_group, map_from_weil_divisors_to_class_group(variety))
set_attribute!(variety, :stanley_reisner_ideal, ideal([prod(Hecke.gens(cox_ring(variety)))]))
set_attribute!(variety, :irrelevant_ideal, ideal(Hecke.gens(cox_ring(variety))))
betti_numbers = [fmpz(1) for i in 0:d]
betti_numbers = fill(fmpz(1), d+1)
set_attribute!(variety, :betti_number, betti_numbers)

# return the variety
Expand Down