# Normal Toric Varieties

## Introduction

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

`AffineNormalToricVariety`

is the toric variety associated to a cone $\sigma$, denoted by $U_{\sigma}$ in David A. Cox, John B. Little, Henry K. Schenck (2011)`NormalToricVariety`

is the toric variety associated to a polyhedral fan $\Sigma$, denoted by $X_{\Sigma}$ in David A. Cox, John B. Little, Henry K. Schenck (2011)

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.

## Constructors

### Affine Toric Varieties

`AffineNormalToricVariety`

— Method`AffineNormalToricVariety(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])
A polyhedral cone in ambient dimension 2
julia> antv = AffineNormalToricVariety(C)
A normal, affine toric variety
```

`NormalToricVariety`

— Method`NormalToricVariety(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])
A polyhedral cone in ambient dimension 2
julia> ntv = NormalToricVariety(C)
A normal, affine toric variety
```

`AffineNormalToricVariety`

— Method`AffineNormalToricVariety(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 = NormalToricVariety(positive_hull([1 0; 0 1]))
A normal, affine toric variety
julia> affineVariety = AffineNormalToricVariety(v)
A normal, affine toric variety
```

### Normal Toric Varieties

`NormalToricVariety`

— Method`NormalToricVariety(rays::Vector{Vector{Int64}}, max_cones::Vector{Vector{Int64}})`

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 = [[1, 2], [2, 3], [3, 4], [4, 1]]
4-element Vector{Vector{Int64}}:
[1, 2]
[2, 3]
[3, 4]
[4, 1]
julia> NormalToricVariety(ray_generators, max_cones)
A normal toric variety
julia> NormalToricVariety(ray_generators, max_cones, non_redundant = true)
A normal toric variety
```

`NormalToricVariety`

— Method`NormalToricVariety(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)
A polyhedron in ambient dimension 2
julia> nf = normal_fan(square)
A polyhedral fan in ambient dimension 2
julia> ntv = NormalToricVariety(nf)
A normal toric variety
```

`NormalToricVariety`

— Method`NormalToricVariety(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)
A polyhedron in ambient dimension 2
julia> ntv = NormalToricVariety(square)
A normal toric variety
```

### Famous Toric Vareties

`affine_space`

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

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

.

**Examples**

```
julia> affine_space(NormalToricVariety, 2)
A normal, affine, 2-dimensional toric variety
```

`del_pezzo_surface`

— Method`del_pezzo_surface(b::Int)`

Constructs the del Pezzo surface with `b`

blowups for `b`

at most 3.

**Examples**

```
julia> del_pezzo_surface(3)
A normal, non-affine, smooth, projective, gorenstein, fano, 2-dimensional toric variety without torusfactor
```

`hirzebruch_surface`

— Method`hirzebruch_surface(r::Int)`

Constructs the r-th Hirzebruch surface.

**Examples**

```
julia> hirzebruch_surface(5)
A normal, non-affine, smooth, projective, gorenstein, non-fano, 2-dimensional toric variety without torusfactor
```

`projective_space`

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

Construct the projective space of dimension `d`

.

**Examples**

```
julia> projective_space(NormalToricVariety, 2)
A normal, non-affine, smooth, projective, gorenstein, fano, 2-dimensional toric variety without torusfactor
```

`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])
A normal, non-affine, simplicial, projective, 2-dimensional toric variety without torusfactor
```

### Further Constructions

`blowup_on_ith_minimal_torus_orbit`

— Method`blowup_on_ith_minimal_torus_orbit(v::AbstractNormalToricVariety, n::Int, coordinate_name::String)`

Return the blowup of the normal toric variety `v`

on its i-th minimal torus orbit.

**Examples**

```
julia> P2 = projective_space(NormalToricVariety, 2)
A normal, non-affine, smooth, projective, gorenstein, fano, 2-dimensional toric variety without torusfactor
julia> bP2 = blowup_on_ith_minimal_torus_orbit(P2, 1, "e")
A normal toric variety
julia> cox_ring(bP2)
Multivariate Polynomial Ring in x2, x3, x1, e over Rational Field graded by
x2 -> [1 0]
x3 -> [0 1]
x1 -> [1 0]
e -> [-1 1]
```

`*`

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

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::AbstractNormalToricVariety, 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::AbstractNormalToricVariety)`

).

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)
A normal, non-affine, smooth, projective, gorenstein, fano, 2-dimensional toric variety without torusfactor
julia> v1 = P2 * P2
A normal toric variety
julia> cox_ring(v1)
Multivariate Polynomial Ring in 6 variables xx1, xx2, xx3, yx1, ..., yx3 over Rational Field graded by
xx1 -> [1 0]
xx2 -> [1 0]
xx3 -> [1 0]
yx1 -> [0 1]
yx2 -> [0 1]
yx3 -> [0 1]
julia> v2 = P2 * P2
A normal toric variety
julia> set_coordinate_names(v2, ["x1", "x2", "x3", "y1", "y2", "y3"])
julia> cox_ring(v2)
Multivariate Polynomial Ring in 6 variables x1, x2, x3, y1, ..., y3 over Rational Field graded by
x1 -> [1 0]
x2 -> [1 0]
x3 -> [1 0]
y1 -> [0 1]
y2 -> [0 1]
y3 -> [0 1]
```

`NormalToricVarietiesFromStarTriangulations`

— Method`NormalToricVarietiesFromStarTriangulations(P::Polyhedron)`

Returns 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])
A polyhedron in ambient dimension 3
julia> (v1, v2) = NormalToricVarietiesFromStarTriangulations(P::Polyhedron)
2-element Vector{NormalToricVariety}:
A normal toric variety
A normal toric variety
julia> stanley_reisner_ideal(v1)
ideal(x2*x4)
julia> stanley_reisner_ideal(v2)
ideal(x1*x3)
```

`NormalToricVarietyFromGLSM`

— Method`NormalToricVarietyFromGLSM(charges::fmpz_mat)`

Witten's Generalized-Sigma models (GLSM) Edward Witten (1988) 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 Huijun Fan, Tyler Jarvis, Yongbin Ruan (2017), which describes this as GIT construction David A. Cox, John B. Little, Henry K. Schenck (2011).

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.

**Examples**

```
julia> charges = [[1, 1, 1]]
1-element Vector{Vector{Int64}}:
[1, 1, 1]
julia> NormalToricVarietyFromGLSM(charges)
1-element Vector{NormalToricVariety}:
A normal toric variety
```

For convenience, we also support:

- NormalToricVarietyFromGLSM(charges::Vector{Vector{Int}})
- NormalToricVarietyFromGLSM(charges::Vector{Vector{fmpz}})

## Properties of Toric Varieties

`has_torusfactor`

— Method`has_torusfactor(v::AbstractNormalToricVariety)`

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::AbstractNormalToricVariety)`

Checks if the normal toric variety `v`

is affine.

**Examples**

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

`is_complete`

— Method`is_complete(v::AbstractNormalToricVariety)`

Checks if the normal toric variety `v`

is complete.

**Examples**

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

`is_fano`

— Method`is_fano(v::AbstractNormalToricVariety)`

Checks if the normal toric variety `v`

is fano.

**Examples**

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

`is_gorenstein`

— Method`is_gorenstein(v::AbstractNormalToricVariety)`

Checks if the normal toric variety `v`

is Gorenstein.

**Examples**

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

`is_simplicial`

— Method`is_simplicial(v::AbstractNormalToricVariety)`

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::AbstractNormalToricVariety)`

Checks if the normal toric variety `v`

is smooth.

**Examples**

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

`is_normal`

— Method`is_normal(v::AbstractNormalToricVariety)`

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::AbstractNormalToricVariety)`

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::AbstractNormalToricVariety)`

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::AbstractNormalToricVariety)`

Decides if the normal toric varieties `v`

is a projective space.

**Examples**

```
julia> F5 = hirzebruch_surface(5)
A normal, non-affine, smooth, projective, gorenstein, non-fano, 2-dimensional toric variety without torusfactor
julia> is_projective_space(F5)
false
julia> is_projective_space(projective_space(NormalToricVariety, 2))
true
```

`is_q_gorenstein`

— Method`is_q_gorenstein(v::AbstractNormalToricVariety)`

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::AbstractNormalToricVariety)`

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)
A normal, non-affine, smooth, projective, gorenstein, fano, 2-dimensional toric variety without torusfactor
julia> affine_open_covering(p2)
3-element Vector{AffineNormalToricVariety}:
A normal, affine toric variety
A normal, affine toric variety
A normal, affine toric variety
```

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

`torusinvariant_cartier_divisor_group`

— Method`torusinvariant_cartier_divisor_group(v::AbstractNormalToricVariety)`

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

.

**Examples**

```
julia> p2 = projective_space(NormalToricVariety, 2)
A normal, non-affine, smooth, projective, gorenstein, fano, 2-dimensional toric variety without torusfactor
julia> torusinvariant_cartier_divisor_group(p2)
GrpAb: Z^3
```

`character_lattice`

— Method`character_lattice(v::AbstractNormalToricVariety)`

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

.

**Examples**

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

`class_group`

— Method`class_group(v::AbstractNormalToricVariety)`

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

.

**Examples**

```
julia> p2 = projective_space(NormalToricVariety, 2);
julia> class_group(p2)
GrpAb: 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::AbstractNormalToricVariety)`

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)
A normal, non-affine, smooth, projective, gorenstein, fano, 2-dimensional toric variety without torusfactor
julia> map_from_torusinvariant_cartier_divisor_group_to_torusinvariant_weil_divisor_group(p2)
Map with following data
Domain:
=======
Abelian group with structure: Z^3
Codomain:
=========
Abelian group with structure: Z^3
```

`map_from_torusinvariant_cartier_divisor_group_to_picard_group`

— Method`map_from_torusinvariant_cartier_divisor_group_to_picard_group(v::AbstractNormalToricVariety)`

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)
A normal, non-affine, smooth, projective, gorenstein, fano, 2-dimensional toric variety without torusfactor
julia> map_from_torusinvariant_cartier_divisor_group_to_picard_group(p2)
Map with following data
Domain:
=======
Abelian group with structure: Z^3
Codomain:
=========
Abelian group with structure: Z
```

`map_from_character_lattice_to_torusinvariant_weil_divisor_group`

— Method`map_from_character_lattice_to_torusinvariant_weil_divisor_group(v::AbstractNormalToricVariety)`

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 with following data
Domain:
=======
Abelian group with structure: Z^2
Codomain:
=========
Abelian group with structure: Z^3
```

`map_from_torusinvariant_weil_divisor_group_to_class_group`

— Method`map_from_torusinvariant_weil_divisor_group_to_class_group(v::AbstractNormalToricVariety)`

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 with following data
Domain:
=======
Abelian group with structure: Z^3
Codomain:
=========
Abelian group with structure: Z
```

`picard_group`

— Method`picard_group(v::AbstractNormalToricVariety)`

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

.

**Examples**

```
julia> p2 = projective_space(NormalToricVariety, 2)
A normal, non-affine, smooth, projective, gorenstein, fano, 2-dimensional toric variety without torusfactor
julia> picard_group(p2)
GrpAb: Z
```

`torusinvariant_weil_divisor_group`

— Method`torusinvariant_weil_divisor_group(v::AbstractNormalToricVariety)`

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

.

**Examples**

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

`torusinvariant_prime_divisors`

— Method`torusinvariant_prime_divisors(v::AbstractNormalToricVariety)`

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}:
A torus-invariant, prime divisor on a normal toric variety
A torus-invariant, prime divisor on a normal toric variety
A torus-invariant, prime divisor on a normal toric variety
```

### Cones and Fans

`fan`

— Method`fan(v::AbstractNormalToricVariety)`

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

.

**Examples**

```
julia> p2 = projective_space(NormalToricVariety, 2)
A normal, non-affine, smooth, projective, gorenstein, fano, 2-dimensional toric variety without torusfactor
julia> fan(p2)
A polyhedral fan in ambient dimension 2
```

`cone`

— Method`cone(v::AffineNormalToricVariety)`

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

.

**Examples**

```
julia> cone(AffineNormalToricVariety(Oscar.positive_hull([1 1; -1 1])))
A polyhedral cone in ambient dimension 2
```

`mori_cone`

— Method`mori_cone(v::NormalToricVariety)`

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

.

**Examples**

```
julia> p2 = projective_space(NormalToricVariety, 2)
A normal, non-affine, smooth, projective, gorenstein, fano, 2-dimensional toric variety without torusfactor
julia> mori = mori_cone(p2)
A 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)
A normal, non-affine, smooth, projective, gorenstein, fano, 2-dimensional toric variety without torusfactor
julia> nef = nef_cone(p2)
A polyhedral cone in ambient dimension 1
julia> dim(nef)
1
```

### Dimensions

`dim`

— Method`dim(v::AbstractNormalToricVariety)`

Return the dimension of the normal toric variety `v`

.

**Examples**

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

`dim_of_torusfactor`

— Method`dim_of_torusfactor(v::AbstractNormalToricVariety)`

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

.

**Examples**

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

`euler_characteristic`

— Method`euler_characteristic(v::AbstractNormalToricVariety)`

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

.

**Examples**

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

`betti_number`

— Method`betti_number(v::AbstractNormalToricVariety, 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 David A. Cox, John B. Little, Henry K. Schenck (2011). Note that this theorem requires that the normal toric variety `v`

is both complete and simplicial.

**Examples**

```
julia> P3 = projective_space(NormalToricVariety, 3)
A normal, non-affine, smooth, projective, gorenstein, fano, 3-dimensional toric variety without torusfactor
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 David A. Cox, John B. Little, Henry K. Schenck (2011)),
- 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::AbstractNormalToricVariety)`

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::AbstractNormalToricVariety, coordinate_names::Vector{String})`

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::AbstractNormalToricVariety)`

).

**Examples**

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

`set_coordinate_names_of_torus`

— Method`set_coordinate_names_of_torus(v::AbstractNormalToricVariety, coordinate_names::Vector{String})`

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

**Examples**

```
julia> F3 = hirzebruch_surface(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::AbstractNormalToricVariety)`

This method returns 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 = AffineNormalToricVariety(C);
julia> coordinate_names(antv)
1-element Vector{String}:
"x1"
```

`coordinate_names_of_torus`

— Method`coordinate_names_of_torus(v::AbstractNormalToricVariety)`

This method returns 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::AbstractNormalToricVariety)`

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

. Note that David A. Cox, John B. Little, Henry K. Schenck (2011) refers to this ring as the "total coordinate ring".

**Examples**

```
julia> p2 = projective_space(NormalToricVariety, 2);
julia> set_coordinate_names(p2, ["y1", "y2", "y3"])
julia> cox_ring(p2)
Multivariate Polynomial Ring in y1, y2, y3 over Rational Field graded by
y1 -> [1]
y2 -> [1]
y3 -> [1]
```

`irrelevant_ideal`

— Method`irrelevant_ideal(v::AbstractNormalToricVariety)`

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::AbstractNormalToricVariety)`

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::AbstractNormalToricVariety)`

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])
A polyhedral cone in ambient dimension 3
julia> antv = AffineNormalToricVariety(C)
A normal, affine toric variety
julia> toric_ideal(antv)
ideal(-x1*x2 + x3*x4)
```

`coordinate_ring_of_torus`

— Method`coordinate_ring_of_torus(v::AbstractNormalToricVariety)`

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 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::AbstractNormalToricVariety)`

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(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::AbstractNormalToricVariety)`

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 David A. Cox, John B. Little, Henry K. Schenck (2011) refers to this ring as the "total coordinate ring".

**Examples**

```
julia> p2 = projective_space(NormalToricVariety, 2);
julia> R, _ = PolynomialRing(QQ, 3);
julia> cox_ring(R, p2)
Multivariate Polynomial Ring in x1, x2, x3 over Rational Field graded by
x1 -> [1]
x2 -> [1]
x3 -> [1]
```

`irrelevant_ideal`

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

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

as an ideal in `R`

.

**Examples**

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

`ideal_of_linear_relations`

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

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, _ = PolynomialRing(QQ, 3);
julia> ngens(ideal_of_linear_relations(R, p2))
2
```

`stanley_reisner_ideal`

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

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, _ = PolynomialRing(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])
A polyhedral cone in ambient dimension 3
julia> antv = AffineNormalToricVariety(C)
A normal, affine toric variety
julia> R, _ = PolynomialRing(QQ, 4);
julia> toric_ideal(R, antv)
ideal(-x1*x2 + x3*x4)
```

`coordinate_ring_of_torus`

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

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::AbstractNormalToricVariety, character::Vector{fmpz})`

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::AbstractNormalToricVariety, character::Vector{fmpz})`

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

.

**Examples**

```
julia> p2 = projective_space(NormalToricVariety, 2);
julia> R, _ = PolynomialRing(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, fmpz_mat})`

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(-x1*x2 + x4^2, x1^2*x2^3 - x3^2*x4)
```

`toric_ideal`

— Method`toric_ideal(pts::fmpz_mat)`

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(x2*x3 - x4^2, -x1*x3 + x2^2*x4, -x1*x4 + x2^3, -x1*x3^2 + x2*x4^3, -x1*x3^3 + x4^5)
```