# Normal Toric Varieties

## Introduction

We introduce two main types of normal toric varieties, distinguishing between the affine and non-affine case:

`AffineNormalToricVariety`

is the type for toric varieties associated to a cone $\sigma$, denoted by $U_{\sigma}$ in [CLS11]`NormalToricVariety`

is the type for toric varieties associated to a polyhedral fan $\Sigma$, denoted by $X_{\Sigma}$ in [CLS11]

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.

## Equality of Normal Toric Varieties

Equality of normal toric varieties is computationally very demanding. We have therefore made special design decisions for the `==`

method.

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 specially designed the `==`

method. It checks if the memory locations of the two objects in question are identical. If so, our `==`

method returns `true`

. Otherwise, it raise an error.

Note that triple equality `===`

(i.e. the check of equal the memory locations) is always supported for normal toric varieties. We recommend using it.

However, if you truly need to check for two normal toric varieties to be mathematically identical, then you will need to add a custom method. This method could look as follows:

```
function slow_equal(tv1::NormalToricVariety, tv2::NormalToricVariety)
tv1 === tv2 && return true
ambient_dim(tv1) == ambient_dim(tv2) || return false
f_vector(tv1) == f_vector(tv2) || return false
return Set(maximal_cones(tv1)) == Set(maximal_cones(tv2))
end
```

Please note that this method `slow_equal`

is not performant, that we currently (summer 2024) have no intentions in adding this function to OSCAR nor to make improvements to its performance. Rather, expect this method to be slow, potentially painfully so.

## Constructors

### Affine Toric Varieties

`affine_normal_toric_variety`

— Method`affine_normal_toric_variety(C::Cone)`

Construct the affine normal toric variety $U_{C}$ corresponding to a polyhedral cone `C`

.

**Examples**

Set `C`

to be the positive orthant in two dimensions.

```
julia> C = positive_hull([1 0; 0 1])
Polyhedral cone in ambient dimension 2
julia> antv = affine_normal_toric_variety(C)
Normal toric variety
```

`normal_toric_variety`

— Method`normal_toric_variety(C::Cone)`

Construct the (affine) normal toric variety $X_{\Sigma}$ corresponding to a polyhedral fan $\Sigma = C$ consisting only of the cone `C`

.

**Examples**

Set `C`

to be the positive orthant in two dimensions.

```
julia> C = positive_hull([1 0; 0 1])
Polyhedral cone in ambient dimension 2
julia> ntv = normal_toric_variety(C)
Normal toric variety
```

`affine_normal_toric_variety`

— Method`affine_normal_toric_variety(v::NormalToricVariety)`

For internal design, we make a strict distinction between normal toric varieties and affine toric varieties. Given an affine, normal toric variety `v`

, this method turns it into an affine toric variety.

**Examples**

```
julia> v = normal_toric_variety(positive_hull([1 0; 0 1]))
Normal toric variety
julia> affineVariety = affine_normal_toric_variety(v)
Normal toric variety
```

### Normal Toric Varieties

`normal_toric_variety`

— Function`normal_toric_variety(C::Cone)`

Construct the (affine) normal toric variety $X_{\Sigma}$ corresponding to a polyhedral fan $\Sigma = C$ consisting only of the cone `C`

.

**Examples**

Set `C`

to be the positive orthant in two dimensions.

```
julia> C = positive_hull([1 0; 0 1])
Polyhedral cone in ambient dimension 2
julia> ntv = normal_toric_variety(C)
Normal toric variety
```

`normal_toric_variety(max_cones::IncidenceMatrix, rays::AbstractCollection[RayVector]; non_redundant::Bool = false)`

Construct a normal toric variety $X$ by providing the rays and maximal cones as vector of vectors. By default, this method assumes that the input is not non-redundant (e.g. that a ray was entered twice by accident). If the user is certain that no redundancy exists in the entered information, one can pass `non_redundant = true`

as third argument. This will bypass these consistency checks. In addition, this will ensure that the order of the rays is not altered by the constructor.

**Examples**

```
julia> ray_generators = [[1,0], [0, 1], [-1, 5], [0, -1]]
4-element Vector{Vector{Int64}}:
[1, 0]
[0, 1]
[-1, 5]
[0, -1]
julia> max_cones = IncidenceMatrix([[1, 2], [2, 3], [3, 4], [4, 1]])
4×4 IncidenceMatrix
[1, 2]
[2, 3]
[3, 4]
[1, 4]
julia> normal_toric_variety(max_cones, ray_generators)
Normal toric variety
julia> normal_toric_variety(max_cones, ray_generators; non_redundant = true)
Normal toric variety
```

`normal_toric_variety(PF::PolyhedralFan)`

Construct the normal toric variety $X_{PF}$ corresponding to a polyhedral fan `PF`

.

**Examples**

Take `PF`

to be the normal fan of the square.

```
julia> square = cube(2)
Polytope in ambient dimension 2
julia> nf = normal_fan(square)
Polyhedral fan in ambient dimension 2
julia> ntv = normal_toric_variety(nf)
Normal toric variety
```

`normal_toric_variety(P::Polyhedron)`

Construct the normal toric variety $X_{\Sigma_P}$ corresponding to the normal fan $\Sigma_P$ of the given polyhedron `P`

.

Note that this only coincides with the projective variety associated to `P`

from the affine relations of the lattice points in `P`

, if `P`

is very ample.

**Examples**

Set `P`

to be a square.

```
julia> square = cube(2)
Polytope in ambient dimension 2
julia> ntv = normal_toric_variety(square)
Normal toric variety
```

### Famous Toric Vareties

The constructors of `del_pezzo_surface`

, `hirzebruch_surface`

, `projective_space`

and `weighted_projective_space`

*always* make a default/standard choice for the grading of the Cox ring.

`affine_space`

— Method`affine_space(::Type{NormalToricVariety}, d::Int)`

Construct the (toric) affine space of dimension `d`

.

**Examples**

```
julia> affine_space(NormalToricVariety, 2)
Normal toric variety
```

`del_pezzo_surface`

— Method`del_pezzo_surface(::Type{NormalToricVariety}, b::Int)`

Constructs the del Pezzo surface with `b`

blowups for `b`

at most 3.

**Examples**

```
julia> del_pezzo_surface(NormalToricVariety, 3)
Normal toric variety
```

`hirzebruch_surface`

— Method`hirzebruch_surface(::Type{NormalToricVariety}, r::Int)`

Construct the `r`

-th Hirzebruch surface.

**Examples**

```
julia> hirzebruch_surface(NormalToricVariety, 5)
Normal toric variety
```

`projective_space`

— Method`projective_space(::Type{NormalToricVariety}, d::Int)`

Construct the projective space of dimension `d`

.

**Examples**

```
julia> projective_space(NormalToricVariety, 2)
Normal toric variety
```

`weighted_projective_space`

— Method`weighted_projective_space(::Type{NormalToricVariety}, w::Vector{T}) where {T <: IntegerUnion}`

Construct the weighted projective space corresponding to the weights `w`

.

**Examples**

```
julia> weighted_projective_space(NormalToricVariety, [2, 3, 1])
Normal toric variety
```

### Constructions based on triangulations

It is possible to associate toric varieties to star triangulations of the lattice points of polyhedrons. Specifically, we can associate to any full star triangulation of the lattice points of the polyhedron in question a toric variety. For this task, we provide the following constructors.

`normal_toric_variety_from_star_triangulation`

— Method`normal_toric_variety_from_star_triangulation(P::Polyhedron)`

Return a toric variety that was obtained from a fine regular star triangulation of the lattice points of the polyhedron P. This is particularly useful when the lattice points of the polyhedron in question admit many triangulations.

**Examples**

```
julia> P = convex_hull([0 0 0; 0 0 1; 1 0 1; 1 1 1; 0 1 1])
Polyhedron in ambient dimension 3
julia> v = normal_toric_variety_from_star_triangulation(P)
Normal toric variety
```

`normal_toric_varieties_from_star_triangulations`

— Method`normal_toric_varieties_from_star_triangulations(P::Polyhedron)`

Return the list of toric varieties obtained from fine regular star triangulations of the polyhedron P. With this we can compute the two phases of the famous conifold transition.

**Examples**

```
julia> P = convex_hull([0 0 0; 0 0 1; 1 0 1; 1 1 1; 0 1 1])
Polyhedron in ambient dimension 3
julia> (v1, v2) = normal_toric_varieties_from_star_triangulations(P)
2-element Vector{NormalToricVariety}:
Normal toric variety
Normal toric variety
julia> stanley_reisner_ideal(v1)
Ideal generated by
x1*x4
julia> stanley_reisner_ideal(v2)
Ideal generated by
x2*x3
```

An application of this functionality exists in the physics. Witten's Generalized-Sigma models (GLSM) [Wit88] originally sparked interest in the physics community in toric varieties. On a mathematical level, this establishes a construction of toric varieties for which a Z^n grading of the Cox ring is provided. See for example [FJR17], which describes this as GIT construction [CLS11].

Explicitly, given the grading of the Cox ring, the map from the group of torus invariant Weil divisors to the class group is known. Under the assumption that the variety in question has no torus factor, we can then identify the map from the lattice to the group of torus invariant Weil divisors as the kernel of the map from the torus invariant Weil divisor to the class group. The latter is a map between free Abelian groups, i.e. is provided by an integer valued matrix. The rows of this matrix are nothing but the ray generators of the fan of the toric variety. It then remains to triangulate these rays, hence in general for a GLSM the toric variety is only unique up to fine regular star triangulations. We provide the following two constructors:

`normal_toric_variety_from_glsm`

— Method`normal_toric_variety_from_glsm(charges::ZZMatrix)`

Return one toric variety with the desired GLSM charges. This can be particularly useful provided that there are many such toric varieties.

**Examples**

```
julia> charges = [[1, 1, 1]]
1-element Vector{Vector{Int64}}:
[1, 1, 1]
julia> normal_toric_variety_from_glsm(charges)
Normal toric variety
```

For convenience, we also support:

`normal_toric_variety_from_glsm(charges::Vector{Vector{Int}})`

`normal_toric_variety_from_glsm(charges::Vector{Vector{ZZRingElem}})`

`normal_toric_varieties_from_glsm`

— Method`normal_toric_varieties_from_glsm(charges::ZZMatrix)`

Return all toric variety with the desired GLSM charges. This computation may take a long time if there are many such toric varieties.

**Examples**

```
julia> charges = [[1, 1, 1]]
1-element Vector{Vector{Int64}}:
[1, 1, 1]
julia> normal_toric_varieties_from_glsm(charges)
1-element Vector{NormalToricVariety}:
Normal toric variety
julia> varieties = normal_toric_varieties_from_glsm(matrix(ZZ, [1 2 3 4 6 0; -1 -1 -2 -2 -3 1]))
1-element Vector{NormalToricVariety}:
Normal toric variety
julia> cox_ring(varieties[1])
Multivariate polynomial ring in 6 variables over QQ graded by
x1 -> [1 -1]
x2 -> [2 -1]
x3 -> [3 -2]
x4 -> [4 -2]
x5 -> [6 -3]
x6 -> [0 1]
```

For convenience, we also support:

`normal_toric_varieties_from_glsm(charges::Vector{Vector{Int}})`

`normal_toric_varieties_from_glsm(charges::Vector{Vector{ZZRingElem}})`

### Further Constructions

`*`

— Method`Base.:*(v::NormalToricVarietyType, w::NormalToricVarietyType)`

Return the Cartesian/direct product of two normal toric varieties `v`

and `w`

.

By default, we prepend an "x" to all homogeneous coordinate names of the first factor `v`

and a "y" to all homogeneous coordinate names of the second factor `w`

. This default can be overwritten by invoking `set_coordinate_names`

after creating the variety (cf. `set_coordinate_names(v::NormalToricVarietyType, coordinate_names::Vector{String})`

).

*Important*: Recall that the coordinate names can only be changed as long as the toric variety in question is not finalized (cf. `is_finalized(v::NormalToricVarietyType)`

).

Crucially, the order of the homogeneous coordinates is not shuffled. To be more specific, assume that `v`

has $n_1$ and `w`

has $n_2$ homogeneous coordinates. Then `v * w`

has $n_1 + n_2$ homogeneous coordinates. The first $n_1$ of these coordinates are those of `v`

and appear in the very same order as they do for `v`

. The remaining $n_2$ homogeneous coordinates are those of `w`

and appear in the very same order as they do for `w`

.

**Examples**

```
julia> P2 = projective_space(NormalToricVariety, 2)
Normal toric variety
julia> v1 = P2 * P2
Normal toric variety
julia> cox_ring(v1)
Multivariate polynomial ring in 6 variables over QQ graded by
xx1 -> [1 0]
xx2 -> [1 0]
xx3 -> [1 0]
yx1 -> [0 1]
yx2 -> [0 1]
yx3 -> [0 1]
julia> v2 = P2 * P2
Normal toric variety
julia> set_coordinate_names(v2, ["x1", "x2", "x3", "y1", "y2", "y3"])
julia> cox_ring(v2)
Multivariate polynomial ring in 6 variables over QQ graded by
x1 -> [1 0]
x2 -> [1 0]
x3 -> [1 0]
y1 -> [0 1]
y2 -> [0 1]
y3 -> [0 1]
```

`projectivization`

— Method`projectivization(E::ToricLineBundle...)`

This function computes the projectivization of a direct sum of line bundles or divisors. Please see [OM78] for more background information.

**Examples**

Let us construct the projective bundles $X=\mathbb{P}(\mathcal{O}_{\mathbb{P}^1}\oplus\mathcal{O}_{\mathbb{P}^1}(1))$ and $Y=\mathbb{P}(\mathcal{O}_{\mathbb{P}^1}\oplus\mathcal{O}_{\mathbb{P}^1}(2))$.

```
julia> P1 = projective_space(NormalToricVariety, 1);
julia> D0 = toric_divisor(P1, [0,0]);
julia> D1 = toric_divisor(P1, [1,0]);
julia> X = projectivization(D0, D1)
Normal toric variety
julia> L0 = toric_line_bundle(P1, [0]);
julia> L1 = toric_line_bundle(P1, [2]);
julia> Y = projectivization(L0, L1)
Normal toric variety
```

`total_space`

— Method`total_space(E::ToricLineBundle...)`

This function computes the total space of a direct sum of line bundles or divisors. Please see [OM78] for more background information.

**Examples**

Let us construct the toric Calabi-Yau varieties given by the total space of $\mathcal{O}_{\mathbb{P}^1}(2)\oplus\mathcal{O}_{\mathbb{P}^1}(-4)$ and $\omega_{\mathbb{P}^2}$.

```
julia> P1 = projective_space(NormalToricVariety, 1);
julia> L1 = toric_line_bundle(P1, [2]);
julia> L2 = toric_line_bundle(P1, [-4]);
julia> X = total_space(L1, L2)
Normal toric variety
julia> degree(canonical_bundle(X))
0
julia> P2 = projective_space(NormalToricVariety, 2);
julia> D = canonical_divisor(P2);
julia> Y = total_space(D)
Normal toric variety
julia> degree(canonical_bundle(Y))
0
```

## Properties of Toric Varieties

`has_torusfactor`

— Method`has_torusfactor(v::NormalToricVarietyType)`

Checks if the normal toric variety `v`

has a torus factor.

**Examples**

```
julia> has_torusfactor(projective_space(NormalToricVariety, 2))
false
```

`is_affine`

— Method`is_affine(v::NormalToricVarietyType)`

Checks if the normal toric variety `v`

is affine.

**Examples**

```
julia> is_affine(projective_space(NormalToricVariety, 2))
false
```

`is_complete`

— Method`is_complete(v::NormalToricVarietyType)`

Checks if the normal toric variety `v`

is complete.

**Examples**

```
julia> is_complete(projective_space(NormalToricVariety, 2))
true
```

`is_fano`

— Method`is_fano(v::NormalToricVarietyType)`

Checks if the normal toric variety `v`

is fano.

**Examples**

```
julia> is_fano(projective_space(NormalToricVariety, 2))
true
```

`is_gorenstein`

— Method`is_gorenstein(v::NormalToricVarietyType)`

Checks if the normal toric variety `v`

is Gorenstein.

**Examples**

```
julia> is_gorenstein(projective_space(NormalToricVariety, 2))
true
```

`is_simplicial`

— Method`is_simplicial(v::NormalToricVarietyType)`

Checks if the normal toric variety `v`

is simplicial. Hence, this function works just as `is_orbifold`

. It is implemented for user convenience.

**Examples**

```
julia> is_simplicial(projective_space(NormalToricVariety, 2))
true
```

`is_smooth`

— Method`is_smooth(v::NormalToricVarietyType)`

Checks if the normal toric variety `v`

is smooth.

**Examples**

```
julia> is_smooth(projective_space(NormalToricVariety, 2))
true
```

`is_normal`

— Method`is_normal(v::NormalToricVarietyType)`

Checks if the normal toric variety `v`

is normal. (This function is somewhat tautological at this point.)

**Examples**

```
julia> is_normal(projective_space(NormalToricVariety, 2))
true
```

`is_orbifold`

— Method`is_orbifold(v::NormalToricVarietyType)`

Checks if the normal toric variety `v`

is an orbifold.

**Examples**

```
julia> is_orbifold(projective_space(NormalToricVariety, 2))
true
```

`is_projective`

— Method`is_projective(v::NormalToricVarietyType)`

Checks if the normal toric variety `v`

is projective, i.e. if the fan of `v`

is the the normal fan of a polytope.

**Examples**

```
julia> is_projective(projective_space(NormalToricVariety, 2))
true
```

`is_projective_space`

— Method`is_projective_space(v::NormalToricVarietyType)`

Decides if the normal toric varieties `v`

is a projective space.

**Examples**

```
julia> F5 = hirzebruch_surface(NormalToricVariety, 5)
Normal toric variety
julia> is_projective_space(F5)
false
julia> is_projective_space(projective_space(NormalToricVariety, 2))
true
```

`is_q_gorenstein`

— Method`is_q_gorenstein(v::NormalToricVarietyType)`

Checks if the normal toric variety `v`

is Q-Gorenstein.

**Examples**

```
julia> is_q_gorenstein(projective_space(NormalToricVariety, 2))
true
```

## Operations for Toric Varieties

### Affine Open Covering

`affine_open_covering`

— Method`affine_open_covering(v::NormalToricVarietyType)`

Compute an affine open cover of the normal toric variety `v`

, i.e. returns a list of affine toric varieties.

**Examples**

```
julia> p2 = projective_space(NormalToricVariety, 2)
Normal toric variety
julia> affine_open_covering(p2)
3-element Vector{AffineNormalToricVariety}:
Normal toric variety
Normal toric variety
Normal toric variety
```

### Characters, Weil Divisors, Cartier Divisors, Class Group and Picard Group

`torusinvariant_cartier_divisor_group`

— Method`torusinvariant_cartier_divisor_group(v::NormalToricVarietyType)`

Return the Cartier divisor group of an abstract normal toric variety `v`

.

**Examples**

```
julia> p2 = projective_space(NormalToricVariety, 2)
Normal toric variety
julia> torusinvariant_cartier_divisor_group(p2)
Z^3
```

`character_lattice`

— Method`character_lattice(v::NormalToricVarietyType)`

Return the character lattice of a normal toric variety `v`

.

**Examples**

```
julia> p2 = projective_space(NormalToricVariety, 2);
julia> character_lattice(p2)
Z^2
```

`class_group`

— Method`class_group(v::NormalToricVarietyType)`

Return the class group of the normal toric variety `v`

.

**Examples**

```
julia> p2 = projective_space(NormalToricVariety, 2);
julia> class_group(p2)
Z
```

`map_from_torusinvariant_cartier_divisor_group_to_torusinvariant_weil_divisor_group`

— Method`map_from_torusinvariant_cartier_divisor_group_to_torusinvariant_weil_divisor_group(v::NormalToricVarietyType)`

Return the embedding of the group of Cartier divisors into the group of torus-invariant Weil divisors of an abstract normal toric variety `v`

.

**Examples**

```
julia> p2 = projective_space(NormalToricVariety, 2)
Normal toric variety
julia> map_from_torusinvariant_cartier_divisor_group_to_torusinvariant_weil_divisor_group(p2)
Map
from Z^3
to Z^3
```

`map_from_torusinvariant_cartier_divisor_group_to_picard_group`

— Method`map_from_torusinvariant_cartier_divisor_group_to_picard_group(v::NormalToricVarietyType)`

Return the map from the Cartier divisors to the Picard group of an abstract normal toric variety `v`

.

**Examples**

```
julia> p2 = projective_space(NormalToricVariety, 2)
Normal toric variety
julia> map_from_torusinvariant_cartier_divisor_group_to_picard_group(p2)
Map
from Z^3
to Z
```

`map_from_character_lattice_to_torusinvariant_weil_divisor_group`

— Method`map_from_character_lattice_to_torusinvariant_weil_divisor_group(v::NormalToricVarietyType)`

Return the map from the character lattice to the group of principal divisors of a normal toric variety `v`

.

**Examples**

```
julia> p2 = projective_space(NormalToricVariety, 2);
julia> map_from_character_lattice_to_torusinvariant_weil_divisor_group(p2)
Map
from Z^2
to Z^3
```

`map_from_torusinvariant_weil_divisor_group_to_class_group`

— Method`map_from_torusinvariant_weil_divisor_group_to_class_group(v::NormalToricVarietyType)`

Return the map from the group of Weil divisors to the class of group of a normal toric variety `v`

.

**Examples**

```
julia> p2 = projective_space(NormalToricVariety, 2);
julia> map_from_torusinvariant_weil_divisor_group_to_class_group(p2)
Map
from Z^3
to Z
```

`picard_group`

— Method`picard_group(v::NormalToricVarietyType)`

Return the Picard group of an abstract normal toric variety `v`

.

**Examples**

```
julia> p2 = projective_space(NormalToricVariety, 2)
Normal toric variety
julia> picard_group(p2)
Z
```

`torusinvariant_weil_divisor_group`

— Method`torusinvariant_weil_divisor_group(v::NormalToricVarietyType)`

Return the torusinvariant divisor group of a normal toric variety `v`

.

**Examples**

```
julia> p2 = projective_space(NormalToricVariety, 2);
julia> torusinvariant_weil_divisor_group(p2)
Z^3
```

`torusinvariant_prime_divisors`

— Method`torusinvariant_prime_divisors(v::NormalToricVarietyType)`

Return the list of all torus invariant prime divisors in a normal toric variety `v`

.

**Examples**

```
julia> p2 = projective_space(NormalToricVariety, 2);
julia> torusinvariant_prime_divisors(p2)
3-element Vector{ToricDivisor}:
Torus-invariant, prime divisor on a normal toric variety
Torus-invariant, prime divisor on a normal toric variety
Torus-invariant, prime divisor on a normal toric variety
```

### Gorenstein and Picard index

`gorenstein_index`

— Method`gorenstein_index(v::NormalToricVarietyType)`

Return the Gorenstein index of a $\mathbb{Q}$-Gorenstein normal toric variety `v`

. This is the smallest positive integer $l$ such that $-l K$ is Cartier, where $K$ is a canonical divisor on `v`

. See exercise 8.3.10 and 8.3.11 in [CLS11] for more details.

**Examples**

```
julia> gorenstein_index(weighted_projective_space(NormalToricVariety, [2,3,5]))
3
```

`picard_index`

— Method`picard_index(v::NormalToricVarietyType)`

Return the index of the Picard group in the class group of a simplicial normal toric variety `v`

. Here, the Picard group embeds as the group of Cartier divisor classes into the class group via `map_from_picard_group_to_class_group`

. See [HHS11] for more details.

**Examples**

```
julia> picard_index(weighted_projective_space(NormalToricVariety, [2,3,5]))
30
```

### Cones and Fans

`polyhedral_fan`

— Method`polyhedral_fan(v::NormalToricVarietyType)`

Return the fan of an abstract normal toric variety `v`

.

**Examples**

```
julia> p2 = projective_space(NormalToricVariety, 2)
Normal toric variety
julia> polyhedral_fan(p2)
Polyhedral fan in ambient dimension 2
```

`cone`

— Method`cone(v::AffineNormalToricVariety)`

Return the cone of the affine normal toric variety `v`

.

**Examples**

```
julia> cone(affine_normal_toric_variety(Oscar.positive_hull([1 1; -1 1])))
Polyhedral cone in ambient dimension 2
```

`weight_cone`

— Method`weight_cone(v::AffineNormalToricVariety)`

Return the dual cone of the affine normal toric variety `v`

.

**Examples**

```
julia> C = positive_hull([1 0; 0 1])
Polyhedral cone in ambient dimension 2
julia> antv = affine_normal_toric_variety(C)
Normal toric variety
julia> weight_cone(antv)
Polyhedral cone in ambient dimension 2
julia> polarize(cone(antv)) == weight_cone(antv)
true
```

`hilbert_basis`

— Method`hilbert_basis(v::AffineNormalToricVariety)`

For an affine toric variety $v$, this returns the Hilbert basis of the cone dual to the cone of $v$.

**Examples**

```
julia> C = positive_hull([-1 1; 1 1])
Polyhedral cone in ambient dimension 2
julia> antv = affine_normal_toric_variety(C)
Normal toric variety
julia> hilbert_basis(antv)
[-1 1]
[ 1 1]
[ 0 1]
```

`mori_cone`

— Method`mori_cone(v::NormalToricVariety)`

Return the mori cone of the normal toric variety `v`

.

**Examples**

```
julia> p2 = projective_space(NormalToricVariety, 2)
Normal toric variety
julia> mori = mori_cone(p2)
Polyhedral cone in ambient dimension 1
julia> dim(mori)
1
```

`nef_cone`

— Method`nef_cone(v::NormalToricVariety)`

Return the nef cone of the normal toric variety `v`

.

**Examples**

```
julia> p2 = projective_space(NormalToricVariety, 2)
Normal toric variety
julia> nef = nef_cone(p2)
Polyhedral cone in ambient dimension 1
julia> dim(nef)
1
```

### Dimensions

`dim`

— Method`dim(v::NormalToricVarietyType)`

Return the dimension of the normal toric variety `v`

.

**Examples**

```
julia> C = Oscar.positive_hull([1 0]);
julia> antv = affine_normal_toric_variety(C);
julia> dim(antv)
1
```

`dim_of_torusfactor`

— Method`dim_of_torusfactor(v::NormalToricVarietyType)`

Return the dimension of the torus factor of the normal toric variety `v`

.

**Examples**

```
julia> C = Oscar.positive_hull([1 0]);
julia> antv = affine_normal_toric_variety(C);
julia> dim_of_torusfactor(antv)
1
```

`euler_characteristic`

— Method`euler_characteristic(v::NormalToricVarietyType)`

Return the Euler characteristic of the normal toric variety `v`

.

**Examples**

```
julia> C = Oscar.positive_hull([1 0]);
julia> antv = affine_normal_toric_variety(C);
julia> euler_characteristic(antv)
1
```

`betti_number`

— Method`betti_number(v::NormalToricVarietyType, i::Int)`

Compute the `i`

-th Betti number of the normal toric variety `v`

. Specifically, this method returns the dimension of the i-th simplicial homology group (with rational coefficients) of `v`

. The employed algorithm is derived from theorem 12.3.12 in [CLS11]. Note that this theorem requires that the normal toric variety `v`

is both complete and simplicial.

**Examples**

```
julia> P3 = projective_space(NormalToricVariety, 3)
Normal toric variety
julia> betti_number(P3,0)
1
julia> betti_number(P3, 1)
0
```

### Rings and ideals

We support the following rings and ideals for toric varieties:

- Cox ring (also termed the "total coordinate ring" in [CLS11]),
- coordinate ring of torus,
- cohomology_ring,
- Chow ring,
- irrelevant ideal,
- Stanley-Reisner ideal,
- ideal of linear relations,
- toric ideal.

Of course, for any of these coordinate names and the coefficient ring have to be chosen. The coefficient ring is fixed to `Q`

. Therefore, the method `coefficient_ring(v::NormalToricVarietyType)`

always return the field of rational numbers. For the coordinate names, we provide the following setter functions:

`set_coordinate_names`

— Method`set_coordinate_names(v::NormalToricVarietyType, coordinate_names::AbstractVector{<:VarName})`

Allows to set the names of the homogeneous coordinates as long as the toric variety in question is not yet finalized (cf. `is_finalized(v::NormalToricVarietyType)`

).

**Examples**

```
julia> C = Oscar.positive_hull([1 0]);
julia> antv = affine_normal_toric_variety(C);
julia> set_coordinate_names(antv, [:u])
julia> coordinate_names(antv)
1-element Vector{String}:
"u"
julia> set_coordinate_names(antv, ["v"])
julia> coordinate_names(antv)
1-element Vector{String}:
"v"
julia> set_coordinate_names(antv, ['w'])
julia> coordinate_names(antv)
1-element Vector{String}:
"w"
```

`set_coordinate_names_of_torus`

— Method`set_coordinate_names_of_torus(v::NormalToricVarietyType, coordinate_names::AbstractVector{<:VarName})`

Allows to set the names of the coordinates of the torus.

**Examples**

```
julia> F3 = hirzebruch_surface(NormalToricVariety, 3);
julia> set_coordinate_names_of_torus(F3, ["u", "v"])
julia> coordinate_names_of_torus(F3)
2-element Vector{String}:
"u"
"v"
```

The following methods allow to etract the chosen coordinates:

`coordinate_names`

— Method`coordinate_names(v::NormalToricVarietyType)`

Return the names of the homogeneous coordinates of the normal toric variety `v`

. The default is `x1, ..., xn`

.

**Examples**

```
julia> C = Oscar.positive_hull([1 0]);
julia> antv = affine_normal_toric_variety(C);
julia> coordinate_names(antv)
1-element Vector{String}:
"x1"
```

`coordinate_names_of_torus`

— Method`coordinate_names_of_torus(v::NormalToricVarietyType)`

Return the names of the coordinates of the torus of the normal toric variety `v`

. The default is `x1, ..., xn`

.

In order to efficiently construct algebraic cycles (elements of the Chox ring), cohomology classes (elements of the cohomology ring), or in order to compare ideals, it is imperative to fix choices of the coordinate names. The default value for coordinate names is `[x1, x2, ... ]`

. The choice of coordinate names is fixed, once one of the above-mentioned rings is computed via one the following methods:

`cox_ring`

— Method`cox_ring(v::NormalToricVarietyType)`

Computes the Cox ring of the normal toric variety `v`

. Note that [CLS11] refers to this ring as the "total coordinate ring". For uniformity with schemes, we also support the function `coordinate_ring`

to refer to the Cox ring.

**Examples**

```
julia> p2 = projective_space(NormalToricVariety, 2);
julia> set_coordinate_names(p2, ["y1", "y2", "y3"])
julia> cox_ring(p2)
Multivariate polynomial ring in 3 variables over QQ graded by
y1 -> [1]
y2 -> [1]
y3 -> [1]
julia> cox_ring(p2) == coordinate_ring(p2)
true
```

`irrelevant_ideal`

— Method`irrelevant_ideal(v::NormalToricVarietyType)`

Return the irrelevant ideal of a normal toric variety `v`

.

**Examples**

```
julia> p2 = projective_space(NormalToricVariety, 2);
julia> length(gens(irrelevant_ideal(p2)))
3
```

`ideal_of_linear_relations`

— Method`ideal_of_linear_relations(v::NormalToricVarietyType)`

Return the ideal of linear relations of the simplicial and complete toric variety `v`

.

**Examples**

```
julia> p2 = projective_space(NormalToricVariety, 2);
julia> ngens(ideal_of_linear_relations(p2))
2
```

`stanley_reisner_ideal`

— Method`stanley_reisner_ideal(v::NormalToricVarietyType)`

Return the Stanley-Reisner ideal of a normal toric variety `v`

.

**Examples**

```
julia> p2 = projective_space(NormalToricVariety, 2);
julia> ngens(stanley_reisner_ideal(p2))
1
```

`toric_ideal`

— Method`toric_ideal(antv::AffineNormalToricVariety)`

Return the toric ideal defining the affine normal toric variety.

**Examples**

Take the cone over the square at height one. The resulting toric variety has one defining equation. In projective space this corresponds to $\mathbb{P}^1\times\mathbb{P}^1$. Note that this cone is self-dual, the toric ideal comes from the dual cone.

```
julia> C = positive_hull([1 0 0; 1 1 0; 1 0 1; 1 1 1])
Polyhedral cone in ambient dimension 3
julia> antv = affine_normal_toric_variety(C)
Normal toric variety
julia> toric_ideal(antv)
Ideal generated by
-x1*x2 + x3*x4
```

`coordinate_ring_of_torus`

— Method`coordinate_ring_of_torus(v::NormalToricVarietyType)`

Computes the coordinate ring of the torus of the normal toric variety `v`

.

**Examples**

```
julia> p2 = projective_space(NormalToricVariety, 2);
julia> set_coordinate_names_of_torus(p2, ["y1", "y2"])
julia> coordinate_ring_of_torus(p2)
Quotient
of multivariate polynomial ring in 4 variables y1, y2, y1_, y2_
over rational field
by ideal (y1*y1_ - 1, y2*y2_ - 1)
```

One can check the status as follows:

`is_finalized`

— Method`is_finalized(v::NormalToricVarietyType)`

Checks if the Cox ring, the coordinate ring of the torus, the cohomology_ring, the Chow ring, the Stanley-Reisner ideal, the irrelevant ideal, the ideal of linear relations or the toric ideal has been cached. If any of these has been cached, then this function returns `true`

and otherwise `false`

.

**Examples**

```
julia> is_finalized(del_pezzo_surface(NormalToricVariety, 3))
false
```

After the variety finalized, one can enforce to obtain the above ideals in different rings. Also, one can opt to compute the above rings with a different choice of coordinate names and different coefficient ring. To this end, onc provides a custom ring (which reflects the desired choice of coordinate names and coefficient ring) as first argument. However, note that the cached ideals and rings are *not* altered.

`cox_ring`

— Method`cox_ring(R::MPolyRing, v::NormalToricVarietyType)`

Computes the Cox ring of the normal toric variety `v`

, in this case by adding the Cox grading to the given ring `R`

. Note that [CLS11] refers to this ring as the "total coordinate ring".

**Examples**

```
julia> p2 = projective_space(NormalToricVariety, 2);
julia> R, _ = polynomial_ring(QQ, 3);
julia> cox_ring(R, p2)
Multivariate polynomial ring in 3 variables over QQ graded by
x1 -> [1]
x2 -> [1]
x3 -> [1]
```

`irrelevant_ideal`

— Method`irrelevant_ideal(R::MPolyRing, v::NormalToricVarietyType)`

Return the irrelevant ideal of a normal toric variety `v`

as an ideal in `R`

.

**Examples**

```
julia> p2 = projective_space(NormalToricVariety, 2);
julia> R, _ = polynomial_ring(QQ, 3);
julia> length(gens(irrelevant_ideal(R, p2)))
3
```

`ideal_of_linear_relations`

— Method`ideal_of_linear_relations(R::MPolyRing, v::NormalToricVarietyType)`

Return the ideal of linear relations of the simplicial and complete toric variety `v`

in the ring R.

**Examples**

```
julia> p2 = projective_space(NormalToricVariety, 2);
julia> R, _ = polynomial_ring(QQ, 3);
julia> ngens(ideal_of_linear_relations(R, p2))
2
```

`stanley_reisner_ideal`

— Method`stanley_reisner_ideal(R::MPolyRing, v::NormalToricVarietyType)`

Return the Stanley-Reisner ideal of a normal toric variety `v`

as an ideal of `R`

.

**Examples**

```
julia> p2 = projective_space(NormalToricVariety, 2);
julia> R, _ = polynomial_ring(QQ, 3);
julia> ngens(stanley_reisner_ideal(R, p2))
1
```

`toric_ideal`

— Method`toric_ideal(R::MPolyRing, antv::AffineNormalToricVariety)`

Return the toric ideal defining the affine normal toric variety as an ideal in `R`

.

**Examples**

Take the cone over the square at height one. The resulting toric variety has one defining equation. In projective space this corresponds to $\mathbb{P}^1\times\mathbb{P}^1$. Note that this cone is self-dual, the toric ideal comes from the dual cone.

```
julia> C = positive_hull([1 0 0; 1 1 0; 1 0 1; 1 1 1])
Polyhedral cone in ambient dimension 3
julia> antv = affine_normal_toric_variety(C)
Normal toric variety
julia> R, _ = polynomial_ring(QQ, 4);
julia> toric_ideal(R, antv)
Ideal generated by
-x1*x2 + x3*x4
```

`coordinate_ring_of_torus`

— Method`coordinate_ring_of_torus(R::MPolyRing, v::NormalToricVarietyType)`

Computes the coordinate ring of the torus of the normal toric variety `v`

in the given polynomial ring `R`

.

Along the same lines, characters can be turned into rational functions:

`character_to_rational_function`

— Method`character_to_rational_function(v::NormalToricVarietyType, character::Vector{ZZRingElem})`

Computes the rational function corresponding to a character of the normal toric variety `v`

.

**Examples**

```
julia> p2 = projective_space(NormalToricVariety, 2);
julia> character_to_rational_function(p2, [-1, 2])
x2^2*x1_
```

`character_to_rational_function`

— Method`character_to_rational_function(R::MPolyRing, v::NormalToricVarietyType, character::Vector{ZZRingElem})`

Computes the rational function corresponding to a character of the normal toric variety `v`

.

**Examples**

```
julia> p2 = projective_space(NormalToricVariety, 2);
julia> R, _ = polynomial_ring(QQ, 4);
julia> character_to_rational_function(R, p2, [-1, 2])
x2^2*x3
```

## Auxiliary Methods

`binomial_exponents_to_ideal`

— Method`binomial_exponents_to_ideal(binoms::Union{AbstractMatrix, ZZMatrix})`

This function converts the rows of a matrix to binomials. Each row $r$ is written as $r=u-v$ with $u, v\ge 0$ by splitting into positive and negative entries. Then the row $r$ corresponds to $x^u-x^v$. The resulting ideal is returned.

**Examples**

```
julia> A = [-1 -1 0 2; 2 3 -2 -1]
2×4 Matrix{Int64}:
-1 -1 0 2
2 3 -2 -1
julia> binomial_exponents_to_ideal(A)
Ideal generated by
-x1*x2 + x4^2
x1^2*x2^3 - x3^2*x4
```

`toric_ideal`

— Method`toric_ideal(pts::ZZMatrix)`

Return the toric ideal generated from the linear relations between the points `pts`

. This is the ideal generated by the set of binomials $\{x^u-x^v\ |\ u, v\in\mathbb{Z}^n_{\ge 0}\ (pts)^T\cdot(u-v) = 0\}$

**Examples**

```
julia> C = positive_hull([-2 5; 1 0]);
julia> H = hilbert_basis(C);
julia> toric_ideal(H)
Ideal generated by
x2*x3 - x4^2
-x1*x3 + x2^2*x4
-x1*x4 + x2^3
-x1*x3^2 + x2*x4^3
-x1*x3^3 + x4^5
```