22
Journal of Symbolic Computation 42 (2007) 511–532 www.elsevier.com/locate/jsc Computing with toric varieties Helena Verrill a , David Joyner b,* a Math Department, Louisiana St. University, LA, United States b Math Department, US Naval Academy, MD, United States Received 31 October 2004; accepted 8 August 2006 Available online 5 March 2007 Abstract A computer algebra package (written by the second author) is described which deals with both affine and projective toric varieties in any number of dimensions (written in both MAGMA and GAP). Among other things, the package implements the desingularization procedure, constructs some error-correcting codes associated with toric varieties, and computes the Riemann–Roch space of a divisor on a toric variety. c 2007 Elsevier Ltd. All rights reserved. Throughout, let F denote a field. 1. Introduction Let R = F [x 1 ,..., x n ] be a ring in n variables. A binomial relation in R is one of the form x k 1 1 ... x k n n = x 1 1 ... x n n , where k i 0, j 0 are integers. A binomial variety is a subvariety of affine n-space A n F defined by a finite set of binomial equations. Such varieties arise frequently “in nature”. A typical “toric variety” (defined more precisely later) is binomial, 1 though they will be introduced via an a priori independent construction. 1.1. Motivation Toric geometry has several interesting facets. * Corresponding author. E-mail addresses: [email protected] (H. Verrill), [email protected] (D. Joyner). 1 The converse to this statement is in general false: in general, a binomial variety is not normal but a toric variety is. 0747-7171/$ - see front matter c 2007 Elsevier Ltd. All rights reserved. doi:10.1016/j.jsc.2006.08.005

Computing with toric varieties - CORE · 512 H. Verrill, D. Joyner / Journal of Symbolic Computation 42 (2007) 511–532 • It gives a way of constructing an ambient space (a toric

  • Upload
    others

  • View
    1

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Computing with toric varieties - CORE · 512 H. Verrill, D. Joyner / Journal of Symbolic Computation 42 (2007) 511–532 • It gives a way of constructing an ambient space (a toric

Journal of Symbolic Computation 42 (2007) 511–532www.elsevier.com/locate/jsc

Computing with toric varieties

Helena Verrilla, David Joynerb,∗

a Math Department, Louisiana St. University, LA, United Statesb Math Department, US Naval Academy, MD, United States

Received 31 October 2004; accepted 8 August 2006Available online 5 March 2007

Abstract

A computer algebra package (written by the second author) is described which deals with both affine andprojective toric varieties in any number of dimensions (written in both MAGMA and GAP). Among otherthings, the package implements the desingularization procedure, constructs some error-correcting codesassociated with toric varieties, and computes the Riemann–Roch space of a divisor on a toric variety.c© 2007 Elsevier Ltd. All rights reserved.

Throughout, let F denote a field.

1. Introduction

Let R = F[x1, . . . , xn] be a ring in n variables. A binomial relation in R is one of the form

xk11 . . . xkn

n = x`11 . . . x`n

n ,

where ki ≥ 0, ` j ≥ 0 are integers. A binomial variety is a subvariety of affine n-space AnF

defined by a finite set of binomial equations. Such varieties arise frequently “in nature”. A typical“toric variety” (defined more precisely later) is binomial,1 though they will be introduced via ana priori independent construction.

1.1. Motivation

Toric geometry has several interesting facets.

∗ Corresponding author.E-mail addresses: [email protected] (H. Verrill), [email protected] (D. Joyner).

1 The converse to this statement is in general false: in general, a binomial variety is not normal but a toric variety is.

0747-7171/$ - see front matter c© 2007 Elsevier Ltd. All rights reserved.doi:10.1016/j.jsc.2006.08.005

Page 2: Computing with toric varieties - CORE · 512 H. Verrill, D. Joyner / Journal of Symbolic Computation 42 (2007) 511–532 • It gives a way of constructing an ambient space (a toric

512 H. Verrill, D. Joyner / Journal of Symbolic Computation 42 (2007) 511–532

• It gives a way of constructing an ambient space (a toric variety) in which algebraic varietieslive, in the same way that projective space, and weighted projective space are primarilyconsidered as ambient spaces.· Toric varieties are all rational.· Toric varieties are not all projective (i.e., they cannot all be embedded in Pn for some n),

so provide a wider class of algebraic varieties to work with.· Even if a subvariety of a toric variety is projective, it generally is embedded in a toric

variety with affine pieces of much lower dimension than the projective space.· Although all toric varieties are normal, they need not be singular.

• In the case of a toric variety, certain algebraic geometry computations can be reformulatedinto simpler combinatorial problems. For example, there is a “simple” method of resolvingcertain singularities.

• Toric geometry is used to solve certain compactification problems.• Toric geometry is a source of many examples in various areas, e.g., Batyrev’s construction of

pairs of mirror Calabi–Yau threefolds from “reflexive polytopes”.• It has many other applications, e.g., to combinatorical geometry (Ewald, 1996), error-

correcting codes (Joyner, 2004), and connections with non-regular continued fractions(Fulton, 1993).

1.2. Computer programs

Toric geometry very much lends itself to a computational approach. There are a few packagesavailable for working with toric geometry, such as

• · gfan· c program· by Anders Nedergaard Jensen· http://home.imf.au.dk/ajensen/software/gfan/gfan.html· Computes the Grobner fan of a toric ideal· gfan is available as a stand-alone or as part of SAGE (Stein, 2007):

http://sage.scipy.org• · TiGERS

· c program· by Birkett Huber and Rekha Thomas· http://www.math.washington.edu/˜thomas/programs.html· Computes the Grobner fan of a toric ideal· Also some maple available from same site:

http://www.math.washington.edu/˜thomas/program• · part of the singular computer algebra system

· http://www.singular.uni-kl.de/Manual/latest/sing 525.htm#SEC582· Computes the lattice basis using LLL algorithm; the Buchberger algorithm for toric ideals;

algorithms by Conti and Traverso; Pottier; Hosten and Sturmfels; Di Biase and Urbanke;Bigatti, La Scala and Robbiano, for computing the saturation.

• · “CY/4d”· Kreuzer and Skarke· Data base of the classification of all 473,800,776 reflexive polytopes in 4 dimensions. (3

dimensional version also available.)

Page 3: Computing with toric varieties - CORE · 512 H. Verrill, D. Joyner / Journal of Symbolic Computation 42 (2007) 511–532 • It gives a way of constructing an ambient space (a toric

H. Verrill, D. Joyner / Journal of Symbolic Computation 42 (2007) 511–532 513

· http://hep.itp.tuwien.ac.at/˜kreuzer/CY/CYcy.html· this gives a method of constructing different examples of mirror pairs of families of Calabi–

Yau threefolds, especially of interest to physicists.• · “toric”

· Joyner· GAP (The GAP Group, 2006) package and MAGMA (Bosma et al., 1997) programs for

toric varieties.· Examples of the GAP commands are given in this paper. For the MAGMA commands and

more details on toric varieties, see both Joyner and Verrill (2002) (a much longer paper onwhich this one is based) and Joyner (2006a).

Note that all but the last two of the above programs are restricted to the case of affine toricvarieties, (the first two being more from the point of commutative algebra), and the third oneis a fairly specialized situation, and only available as a data base. There is much more to toricgeometry that could be programmed but so far seems not to have been.

2. Cones and semigroups

Let V = Qn having basis f1 = (1, 0, . . . , 0), . . . , fn = (0, . . . , 0, 1). Let L be a latticein V (i.e., a Z-submodule in V which is free of rank n). We identify V and L ⊗Z Q. We use〈 , 〉 to denote the (standard) inner product on V and (abusing notation) the natural pairing onV × V ∗. Hopefully, which is which will be clear from the context. If e1, . . . , en is a basis for L ,let e∗

1, . . . , e∗n denote the dual basis for L∗, where

L∗= Hom(L , Z) = {v ∈ V ∗

| 〈w, v〉 ∈ Z, ∀w ∈ L}

is the dual lattice. If the basis of L has been chosen to be the { fi } then L∗ may be identified withZn .

Example 2.1. If L is the sublattice of Z2 generated by e1 + 2e2 and 2e1 + e2. The lattice L maybe visualized as follows.

Note that the dual is not contained in Z2.

A plain vanilla2 cone in V is a σ of the form

σ = {a1v1 + · · · + amvm | ai ≥ 0},

2 Sorry, couldn’t resist the pun. The point is that though this is the correct and standard definition of a cone, later weshall actually reserve the word “cone” for a special type of cone.

Page 4: Computing with toric varieties - CORE · 512 H. Verrill, D. Joyner / Journal of Symbolic Computation 42 (2007) 511–532 • It gives a way of constructing an ambient space (a toric

514 H. Verrill, D. Joyner / Journal of Symbolic Computation 42 (2007) 511–532

where v1, . . . , vm ∈ V is a given collection of vectors, called generators of σ . (When the vi ’sare linearly independent, some call such a cone a simple cone (Ewald, 1996, pp. 146–147).) Thiscone is also denoted

σ = Q≥0[v1, . . . , vm].

A rational cone is one where v1, . . . , vm ∈ L . A strongly convex cone is one which contains nolines through the origin. A cone generated by linearly independent vectors is necessarily stronglyconvex. The dimension of σ , denoted dim(σ ), is the dimension of the subspace σ + (−σ) of V .

Definition 2.2. A cone of L is a strongly convex rational cone.If σ is a cone then the dual cone is defined by

σ ∗= {w ∈ L∗

⊗ Q | 〈v, w〉 ≥ 0, ∀v ∈ σ },

where L∗ is the dual lattice.

GAP Example 2.3. Let n = 2, L ∼= L∗ ∼= Z2, and suppose σ = Q≥0[e1, 3e1 + 4e2]. To checkif e∗

1 − 7e∗

2 or if 4e∗

1 − 3e∗

2 belongs to σ ∗ in GAP type

LoadPackage( "toric ");InDualCone([1,-7],[[1,0],[3,4]]);InDualCone([4,-3],[[1,0],[3,4]]);

In the first case, GAP returns false and in the second case, true.

2.1. Affine toric varieties

Associate to the dual cone σ ∗ the semigroup

Sσ = σ ∗∩ L∗

= {w ∈ L∗| 〈v, w〉 ≥ 0, ∀v ∈ σ }.

Gordan’s Lemma states that Sσ is finitely generated (a proof may be found in Ewald (1996) forexample). Though L∗ has n generators as a lattice, typically Sσ will have more than n generatorsas a semigroup. If u1, . . . ut ∈ L∗ are semigroup generators of Sσ then we write

Sσ = Z≥0[u1, . . . , ut ],

for brevity.The following question arises: Given a lattice L = Z[v1, . . . , vm] and a cone σ =

Q≥0[w1, . . . , w`], how do you find u1, . . . , un ∈ L∗ such that Sσ = Z≥0[u1, . . . , ut ]? First,find a basis for the dual lattice, L∗, say L∗

= Z[v∗

1 , . . . , v∗m]. Let the list of potential generators

be

G =

{w ∈ L∗

∩ σ ∗| |w| ≤ max

1≤i≤m|v∗

i |

}.

This is a generating set for Sσ (as a semigroup), thanks to the following corollary of Gordan’sLemma (Ewald, 1996, Lemma 3.4).

Lemma 2.4. The set

F =

{w ∈ Sσ

∣∣∣∣∣ for some 0 ≤ ti ≤ 1, w =

∑1≤i≤m

tiv∗

i

}.

contains a complete set of semigroup generators of Sσ .

Page 5: Computing with toric varieties - CORE · 512 H. Verrill, D. Joyner / Journal of Symbolic Computation 42 (2007) 511–532 • It gives a way of constructing an ambient space (a toric

H. Verrill, D. Joyner / Journal of Symbolic Computation 42 (2007) 511–532 515

Proof. This follows from the proof of Gordan’s Lemma. Indeed, the semigroup generators ofSσ will be a subset of the union of the generators of L∗ with the (finitely many) elements inF ∩ L∗. �

Another related question arises: If σ ⊂ Qn is a cone, and B = {v1, . . . , v`} ⊂ L∗⊂ Qn ,

when is B a set of semigroup generators for Sσ ? Note that the following Lemma provides twoconditions which are sufficient for this.

Lemma 2.5. Let B be as above. If

• B ⊂ σ ∗,• Sσ ∩ {w ∈ L∗

| |w| ≤ maxv∈V |v|} ⊂ Z≥0[B],

then B is a set of semigroup generators for Sσ .

Proof. Since F ⊂ Sσ ∩{w ∈ L∗| |w| ≤ maxv∈V |v|}, this follows from the previous lemma. �

GAP Example 2.6. Let n = 2, L = L∗= Z2, and suppose σ = Q≥0[e1, 3e1 + 4e2]. To show

that

Sσ = Z≥0[e1, e2, 2e1 − e2, 3e1 − 2e2, 4e1 − 3e2],

type

gap> LoadPackage( "toric" );gap> DualSemigroupGenerators([[1,0],[3,4]]);[ [ 0, 0 ], [ 0, 1 ], [ 1, 0 ], [ 2, -1 ], [ 3, -2 ], [ 4, -3 ] ]

Let

Rσ = F[Sσ ]

denote the “group algebra” of this semigroup. It is a finitely generated commutative F-algebra.It is in fact integrally closed (Fulton, 1993, page 29).

We may interpret Rσ as a subring of R = F[x1, . . . , xn] as follows: First, identify each e∗

iwith the variable xi . If Sσ is generated as a semigroup by vectors of the form `1e∗

1 + · · · + `ne∗n ,

where `i ∈ Z, then its image in R is generated by monomials of the form x`11 . . . x`n

n .Let

Uσ = Spec Rσ .

This defines an affine toric variety (associated to σ ).

Example 2.7. For the cone in Example 3.2, we compute the dual cone by taking theintersection of the duals of all the one dimensional cones, and obtain that σ∨ is spanned by(0, 0, 1), (1, −1, 0), (1, 0, −1) and (0, 1, 0)

Page 6: Computing with toric varieties - CORE · 512 H. Verrill, D. Joyner / Journal of Symbolic Computation 42 (2007) 511–532 • It gives a way of constructing an ambient space (a toric

516 H. Verrill, D. Joyner / Journal of Symbolic Computation 42 (2007) 511–532

So Uσ is given by Spec(F[y, z, x/y, x/z]) ∼= Spec(F[X, Y, Z , W ]/(X Z − W Y )), where theisomorphism of rings is given by

X 7→ y

Y 7→ z

Z 7→ x/y

W 7→ x/z

So Uσ is an affine threefold in A4 which is a cone over the projective quadric surface X Z = W Y .There is a singular point at the origin.

Remark 2.8 (For Those Less Familiar with Algebraic Geometry). Here the spectrum of a ringR, Spec R, is the set of prime ideals in R (with a certain topology). A basic result we use is thatif f1, . . . fm are a collection of polynomials in variables x1, . . . , xd with coefficients in F , then

Spec(F[x1, . . . , xd ]/( f1, f2, . . . , fm))

is the affine variety in d dimensional space Ad . This can be thought of (at least if the groundfield is algebraically closed) as the set of points where f1 = f2 = · · · = fm = 0. Generally, wewill want to find a way to write an F-algebra in this form, so that we can understand its Specgeometrically.

Roughly speaking, an algebraic variety is given by a collection of affine pieces U1, U2, . . . , Udwhich “glue” together. The affine pieces are given by the zero sets of polynomial equations insome affine spaces An , and the gluings are given by maps

φi, j : Ui→U j

which are defined by ratios of polynomials on open subsets of the Ui .A major advantage of the toric geometry description is that the relationships between the affine

pieces Uσ are simply described by the relationships between the corresponding cones. For a toricvariety this gives an easy way to keep track of the “gluing” data, as we will see in Section 3.

Definition 2.9. A torus (of dimension n, defined over the field F) is a product T = (F×)n ofn copies of F×

= F \ {0} for a field F . There is a natural map T × T →T given by pointwisemultiplication (corresponding to the left action of T on itself). E.g.,

(F×)2× (F×)2

→(F×)2

(a, b) · (c, d) = (ac, bd).

One may also define a toric variety to be a normal variety X over F which contains a torusT = (F×)n as an open dense (in the Zariski topology)3 subset:

T ↪→ X

and such that the natural action of T on T extends to an action on X . In other words, there is amap:

T × X→X,

3 The Zariski topology on an algebraic variety is given by taking closed sets to be defined by the zero sets ofpolynomials.

Page 7: Computing with toric varieties - CORE · 512 H. Verrill, D. Joyner / Journal of Symbolic Computation 42 (2007) 511–532 • It gives a way of constructing an ambient space (a toric

H. Verrill, D. Joyner / Journal of Symbolic Computation 42 (2007) 511–532 517

which restricts to the above map T × T →T ⊂ X . In particular, all toric varieties are normal.This is discussed further in Section 2.3 below.

Example 2.10. Projective space Pn over F is a toric variety, containing (F×)n :

(F×)n ↪→ Pn

(a1, a2, . . . , an) 7→ (1 : a1 : a2 : · · · : an).

The action of T = (F×)n on Pn is given by

(a1, a2, . . . , an) · (b0 : b1 : b2 : · · · : bn) = (b0 : a1b1 : a2b2 : · · · : anbn).

If σ = Q≥0[v1, . . . , vm] is a cone of L = Zn and if σ is generated (as a semigroup) by asubset of a basis of L then we say σ is regular.

Criteria. σ is regular if and only if there are vectors vm+1, . . . , vn such that det(v1, . . . , vn) =

±1.

Suppose σ, σ ′ are cones of L = Zn . If dim(σ ) = dim(σ ′) and if there is a g ∈ GLn(Z) forwhich σ ′

= gσ then we say that the cone σ is isomorphic (or equivalent) to the cone σ ′ andwrite σ ∼= σ ′.

Lemma 2.11. Let σ ⊂ V = Qn be a cone of L = Zn .

• ((Fulton, 1993, page 29), or (Ewald, 1996, ch VI, Section 3)) Uσ is smooth if and only if σ isa regular cone.

• (Ewald, 1996, Theorem 2.11, page 222) Uσ∼= Uσ ′ (as algebraic varieties) if and only if

σ ∼= σ ′ (as cones).• ((Fulton, 1993, page 18), (Ewald, 1996, Theorem 6.1, page 243)) Let φ : L ′

→ L be ahomomorphism of lattices which maps a cone σ ′ of L to a cone σ of L (i.e., φ(σ ′) = σ ).Then the dual φ∗

L : L∗→ (L ′)∗ gives rise to a map φ∗

σ : Sσ → Sσ ′ . This determines a mapφ∗ : Rσ → Rσ ′ , and hence a morphism φ∗

: Uσ ′ → Uσ .

A morphism φ∗: Uσ ′ → Uσ arising as in the above lemma from a homomorphism

φ : L ′→ L be a homomorphism of lattices will be called an affine toric morphism.

Summarizing the construction, we have the following sequence to determine an affine toricvariety. Fix a lattice L in V .

{rational cones} → {comm. semigroups} → {semigroup algebras} → {affine schemes}σ 7−→ Sσ = σ∗

∩ L∗7−→ F[Sσ ] 7−→ Uσ = Spec F[Sσ ].

Using the notion of a “fan”, later we shall see how to, in some cases, patch these together intoa projective version.

Page 8: Computing with toric varieties - CORE · 512 H. Verrill, D. Joyner / Journal of Symbolic Computation 42 (2007) 511–532 • It gives a way of constructing an ambient space (a toric

518 H. Verrill, D. Joyner / Journal of Symbolic Computation 42 (2007) 511–532

Example 2.12. Let n = 2, L = Z2= L∗, and

σ = {ae2 + b(2e1 − e2) | a, b ≥ 0}.

This may be visualized as follows:

In this case, σ ∗ is given by

σ ∗= {xe∗

1 + ye∗

2 | 2x ≥ y ≥ 0}.

This may be visualized as follows:

Therefore the semigroup Sσ = σ ∗∩ L∗ is generated by u1 = e∗

1, u2 = e∗

1 + e∗

2, u3 = e∗

1 + 2e∗

2 .We associate to these generators the monomials x1, x1x2, x1x2

2 , respectively, since me∗

1 +ne∗

2 ↔

xm1 xn

2 . This implies4

F[Sσ ] = F[x1, x1x2, x1x22 ].

In fact,5 this ring is isomorphic to F[x, y, z]/(xz − y2), via the map x 7−→ x1, y 7−→

x1x2, z 7−→ x1x22 , so

Uσ = Spec(F[Sσ ]) = Spec(F[x, y, z]/(xz − y2)),

which is the surface xz − y2= 0. This identity xz − y2

= 0 corresponds to the vector identityu1 + u2 = 2u3, which may be easily verified from the picture above.

How does one (in general) find the equation(s) of the toric variety associated to a cone? One(algebraic) method is to use the following fact.

Lemma 2.13 (Fulton, 1993, page 19, Exercise). If Sσ is generated by u1, . . . , ut then

F[Sσ ] ∼= F[χu1 , . . . , χut ] ∼= F[y1, . . . , yt ]/I,

where χe∗i = xi , 1 ≤ i ≤ t , and where I is the ideal generated by binomials of the form

ya11 . . . yat

t − yb11 . . . ybt

t ,

where ai ≥ 0, b j ≥ 0 are integers satisfying

a1u1 + · · · + at ut = b1u1 + · · · + bt ut . (1)

4 See Lemma 2.13 below for a more rigorous approach.5 Again, see Lemma 2.13 below.

Page 9: Computing with toric varieties - CORE · 512 H. Verrill, D. Joyner / Journal of Symbolic Computation 42 (2007) 511–532 • It gives a way of constructing an ambient space (a toric

H. Verrill, D. Joyner / Journal of Symbolic Computation 42 (2007) 511–532 519

Using this lemma, the determination of I may be reduced to a linear algebra problem (overZ).

Another way to find the equation(s) of the toric variety Uσ is to find a complete (but finite)set of semigroup generators of Sσ , since each generator of I corresponds to a relation (1) for thegenerators of Sσ . This provides, at the very least, a nice geometric interpretation of the generatorsof I , as we saw at the end of Example 2.12 above.

Example 2.14. For another example, take the cone σ spanned by e1 and −2e1 + 3e2.

Then σ ∗∩ L∗ is generated by e2, e1 + e2, and 3e1 + 2e2, corresponding to monomials X =

y, Y = xy, Z = x3 y2, so Uσ is isomorphic to an affine variety in A3 given by equation

Y 3= X Z .

Note, to verify this we just need to check that the map

F[X, Y, Z ]/(Y 3− X Z) → F[y, xy, x3 y2

]

X, Y, Z 7→ y, xy, x3 y2

is an isomorphism.

Lemma 2.15 (Fulton, 1993, Proposition, page 29). A toric variety Uτ is smooth if and only if τ

is generated by a subset of a basis for L.

2.2. Faces and subvarieties

Some, like Ewald (1996), use the convention that ∅, σ are (improper) faces of σ . We shalldefine a face of σ to be either σ itself or a subset of the form H ∩ σ , where H is a “supportinghyperplane of σ” (i.e., a codimension 1 subspace of V for which σ ∩ H 6= ∅ and σ is contained inexactly one of the two half-spaces determined by H ). An edge (or ray) of σ = Q≥0[v1, . . . , vm]

is a 1-dimensional subcomplex of σ of the form Q≥0[vi ].Suppose τ is a face of the cone σ of L . How is the associated toric variety Uτ related to Uσ ?

Lemma 2.16. If τ ⊂ σ is a face then there is a dominant morphism Uτ → Uσ .

Proof. See Section 1.3 in Fulton (1993). �

Example 2.17. Let n = 2, L = Z2= L∗, and

σ = {ae2 + b(2e1 − e2) | a, b ≥ 0}

and let τ = Q≥0 · (2e1 − e2). In fact, if we take u = e∗

1 + 2e∗

2 then τ = u⊥∩ σ . If we represent

x ∈ Uσ by the point x1e1 + x2e2 = (x1, x2) then u(x) = x1x22 (or x1 + 2x2, but this will instead

be written multiplicatively, as x1x22 ).

The dual cone of τ is a half-plane,

τ ∗= {xe∗

1 + ye∗

2 | 2x − y ≥ 0},

Page 10: Computing with toric varieties - CORE · 512 H. Verrill, D. Joyner / Journal of Symbolic Computation 42 (2007) 511–532 • It gives a way of constructing an ambient space (a toric

520 H. Verrill, D. Joyner / Journal of Symbolic Computation 42 (2007) 511–532

so Sτ = τ ∗∩ L∗ is generated as a semigroup by e∗

1 , −e∗

2 , e∗

1 + 2e∗

2 , −e∗

1 − 2e∗

2 . The coordinatering associate to τ is given by

Rτ = F[e∗

1, −e∗

2, e∗

1 + 2e∗

2, −e∗

1 − 2e∗

2] ∼= F[x1, x−12 , x1x2

2 , x−11 x−2

2 ].

The map

(x, y, z, w) 7−→ (x1, x−11 x−2

2 , x−12 , x1x2

2),

defines an isomorphism

Rτ∼= F[x, y, z, w]/(wz2

− x, xy − z2).

(see Lemma 2.13 above). This implies that Uτ is the variety in F4 defined by

wz2= x, xy = z2.

Presumably, we may embed the variety Uσ given by xy = z2 determined in Example 2.12 intox, y, z, w-space and regard Uτ as the dense subvariety x 6= 0 of this. (This condition impliesw 6= 0.)

GAP Example 2.18. (a) Let n = 2, L = L∗= Z2, and suppose σ = Q≥0[e2, 2e1 − e2]. To find

the ideal I defining the quotient ring Rσ = F[x1, x2]/I , type

LoadPackage( "toric" );J:=IdealAffineToricVariety([[0,1],[2,-1]]);GeneratorsOfIdeal(J);

GAP returns

[ -x_2^2+x_1 ]

After “projectivizing”, this is consistent with the above example.(b) Now suppose σ = Q≥0[e1, 3e1 + 4e2]. To find the ideal I defining the quotient ring

Rσ = F[x1, x2]/I , type

LoadPackage( "toric" );J:=IdealAffineToricVariety([[1,0],[3,4]]);GeneratorsOfIdeal(J);

GAP returns

[ -x_2^2+x_1, -x_2^3+x_1^2, -x_2^4+x_1^3 ]

2.3. The dense torus

Let σ ⊂ Qn be a cone in L . In the case τ = {0} ⊂ σ , the dominant morphism Uτ → Uσ

(see Lemma 2.16) maps a torus Uτ∼= F×n into a dense subvariety of Uσ . We shall briefly recall

another way to view this.Let Gm denote the multiplicative algebraic group over F . For each integer k, the map z 7−→ zk

defines an element of Homalg.gp.(Gm, Gm). In fact, each element of Homalg.gp.(Gm, Gm) arisesin this way. Given a lattice L ⊂ Qn , let TL = Homab.gp.(L∗, Gm). By Lemma 2.13, we haveTL ⊂ Uσ . They have the same dimension, so TL must be dense in Uσ .

GAP Example 2.19. Let n = 2, L = L∗= Z2, and suppose σ = Q≥0[e1, 3e1 + 4e2]. To obtain

the rational map (of schemes) TL → Uσ , type

Page 11: Computing with toric varieties - CORE · 512 H. Verrill, D. Joyner / Journal of Symbolic Computation 42 (2007) 511–532 • It gives a way of constructing an ambient space (a toric

H. Verrill, D. Joyner / Journal of Symbolic Computation 42 (2007) 511–532 521

LoadPackage("toric");EmbeddingAffineToricVariety([[1,0],[3,4]]);

GAP returns

[ x_2, x_1, x_1^2/x_4, x_1^3/x_4^2, x_1^4/x_4^3 ]

This means that Uσ is 2-dimensional and a dense embedding of the torus given by

(F×)2→ Uσ ,

(x1, x2) 7−→ (x2, x1, x21 x−1

4 , x31 x−2

4 , x41 x−3

4 ).

3. Fans and toric varieties

3.1. Fans

A fan is a collection of cones which “fit together” well.

Definition 3.1. A fan in L is a set ∆ = {σ } of rational strongly convex polyhedral cones inLQ = L ⊗ Q such that

• if σ ∈ ∆ and τ ⊂ σ is a face of σ then τ ∈ ∆,• if σ1, σ2 ∈ ∆ then σ1 ∩ σ2 is a face of both σ1 and σ2 (and hence belongs to ∆ by the above).

Example 3.2. Picture of a three dimensional cone and its faces:

If V = ∪σ∈∆σ then we call the fan complete.

We shall assume that all fans are finite.

GAP Example 3.3. The Faces command computes all the normals to the faces (i.e.,hyperplanes) of a cone. For example:

gap> Cones:=[[1,0],[1,2]];;gap> Faces(Cones);[ [ 0, 1 ], [ 2, -1 ] ]

This is used in several other functions in the TORIC package.

Example 3.4. Some fans in R2:

Page 12: Computing with toric varieties - CORE · 512 H. Verrill, D. Joyner / Journal of Symbolic Computation 42 (2007) 511–532 • It gives a way of constructing an ambient space (a toric

522 H. Verrill, D. Joyner / Journal of Symbolic Computation 42 (2007) 511–532

In the picture 2-dimensional cones are partially shaded. Note that the cones of dimension 0 and1 are also in the fan.

Example 3.5. Consider the fan given by the two dimensional cone σ spanned by e1 and e1 +2e2,and its faces, where e1, e2 is the standard basis for the lattice N ∼= Z2.

Let e∗

i be the dual basis for L∗. Then we have

σ ∗∩ L∗

= 〈e1, e2, 2e1 − e2〉,

So

F[Sσ ] = F[x, y, x2/y],

where x = ee1 and y = ee2 . If we set X = x, Y = y and Z = x2/y, then we have

F[Sσ ] = F[X, Y, Z ]/(X2− ZY ).

So Uσ is a quadric cone in A2 given by X2− ZY .

For one 1 dimensional face of σ we have

〈e1 + 2e2〉∗

∩ L∗= 〈2e1 − e2, −2e1 + e2, e2〉,

so

U〈e1+2e2〉 = Spec(F[y, x2/y, y/x2])

= Spec(F[X, Y, Z , Z−1]/(X2

− ZY )) = Uσ \ {Z = 0}.

For the other 1 dimensional cone we have

U〈e1〉 = Spec(F[x, y, 1/y]) = Uσ \ {Y = 0}.

For the zero dimensional cone, we get the embedding

(a, b) 7→ (a, b, a2/b) ∈ Uσ .

Page 13: Computing with toric varieties - CORE · 512 H. Verrill, D. Joyner / Journal of Symbolic Computation 42 (2007) 511–532 • It gives a way of constructing an ambient space (a toric

H. Verrill, D. Joyner / Journal of Symbolic Computation 42 (2007) 511–532 523

Example 3.6. P2 is given by the following fan:

If X, Y, Z are the projective coordinates for P2, then we can identify the affine pieces with thepieces with local variables

σ1 : x = X/Z , y = Y/Z ,

σ2 : x−1= Z/X, yx−1

= Y/X,

σ3 : y−1= Z/Y, xy−1

= X/Y,

which are the natural coordinates for the Z 6= 0, X 6= 0 and Y 6= 0 parts of P2 respectively.More generally, Pn can be given as a toric variety. It is “prettier” to take the lattice to be given

by the sublattice of Zn+1 given by

L =

{(a0, a1, a2, . . . , an) ∈ Zn+1

∣∣∣∑ ai = 0}

,

and to take cones σ j spanned by ei − e j for j = 0, . . . , n. So that Uσ j has local coordinatesxi/x j , where

∏nk=0 xk = 1. If Pn is a projective variety with projective coordinates X i , then Uσ

can be identified with the part where X j 6= 0, via a map xi/x j 7→ X i/X j .

Remark 3.7. Some general remarks on how fans can be implemented on a computer.A fan is a set of cones satisfying certain conditions. Each cone σ is specified by a set of

vectors {v1, . . . , vk} ⊂ L:

σ ↔ {v1, . . . , vk}

σ = Q≥0[v1, . . . , vk].

The dimension of σ is the dimension of its vector space span, spanQ{v1, . . . , vk}.Suppose σ ↔ {v1, . . . , vk} and σ ′

↔ {v′

1, . . . , v′

k′} belong to a fan ∆. We observe that if thegenerators vi , v

j ∈ L of σ are chosen to have minimum length then

σ ∩ σ ′↔ {v1, . . . , vk} ∩ {v′

1, . . . , v′

k′}.

We therefore regard a fan ∆ as a set of sets of vectors V satisfying the following conditions:

• any subset of V is in ∆,• if V and V ′ are in ∆ then V ∩ V ′ is in ∆.

Moreover, ∆ is complete if and only if Qn= ∪V ∈∆ ∪v∈V Q≥0[v].

In TORIC a fan is often specified by a list of lists of rays (i.e., the vectors vi in the aboveremark) which determine it.

Page 14: Computing with toric varieties - CORE · 512 H. Verrill, D. Joyner / Journal of Symbolic Computation 42 (2007) 511–532 • It gives a way of constructing an ambient space (a toric

524 H. Verrill, D. Joyner / Journal of Symbolic Computation 42 (2007) 511–532

3.2. Constructing toric varieties from a fan

We have the following recipe to construct a quasi-projective toric variety.

{ fans} → { “fan” of comm. semigps} → { “fan” of semigp algs} → { quasi-proj schemes}∆ 7−→ {Sσ = σ∗

∩ L∗| σ ∈ ∆} 7−→ {F[Sσ ] | σ ∈ ∆} 7−→ X (∆) = {Uσ + gluing maps | σ ∈ ∆}.

Let ∆ be a fan. If τ is a face of both σ1, σ2 ∈ ∆ then Lemma 2.16 gives us mapsφ1 : Uτ → Uσ1 and φ2 : Uτ → Uσ2 . We “glue” the affine “patch” Uσ1 to the affine “patch”Uσ12 the overlap using φ1 ◦φ−1

2 . Define X (∆) to be the “glued scheme” associated to these maps(as in Iitaka, Section 1.12, Iitaka (1982)):

X (∆) =

(∐σ∈∆

)/(gluing).

This is the toric variety associated to ∆.We say X (∆) is regular (or non-singular) if for any cone σ ∈ ∆, the patch Uσ is regular.

(Recall Uσ is regular if and only if σ is a regular cone.) It is known which toric varieties arecomplete (see the lemma below) but, in general, the classification of projective toric varieties isstill an active area of research (e.g., see (Oda, 1985, Section 2.4)).

Lemma 3.8 (Fulton, 1993, Section 2.4). X (∆) is complete (as a variety) if and only if ∆ iscomplete (as a fan).

3.3. The complement of the torus—stars

As mentioned earlier, all toric varieties over F of dimension n contain a torus T as a denseopen subset, so it is the complement X (∆) \ T that distinguishes them (and how it “glues” to T ).

Definition 3.9. The orbit of a point p in an n dimensional toric variety X (∆) with denselyembedded torus T is the subvariety t · x where t ∈ T .

A toric variety decomposes into a disjoint set of orbits. One of the orbits is (F×)n as a subset ofX (∆), and the other orbits form the complement. For example, for P2 we have the decomposition

P2=

{(a : b : c)|abc 6= 0} ∼= (F×)2

∪{(0 : b : c)|bc 6= 0} ∪ {(a : 0 : c)|ac 6= 0} ∪ {(a : b : 0)|ab 6= 0}

∪{(1 : 0 : 0)} ∪ {(0 : 1 : 0)} ∪ {(0 : 0 : 1)}.

The orbits are in one to one correspondence with the cones. For each d dimensional cone thereis a corresponding n − d dimensional orbit.

Definition 3.10. For a d dimensional cone σ in a fan ∆ in N ∼= Zn , the star of σ is defined asfollows. Take any projection π along σ to a lattice Nσ of dimension n − d. In other words, thereis a linear map

π : N→Nσ ,

with ker π = Zσ . This map extends to a map from NQ to (Nσ )Q which we also denote by π .Then define the fan ∆σ in Nσ to be the set of images of all cones τ with σ ≺ τ under theprojection. In other words, the star of σ is

∆σ = {π(τ)|τ ∈ ∆, σ ≺ τ }.

Page 15: Computing with toric varieties - CORE · 512 H. Verrill, D. Joyner / Journal of Symbolic Computation 42 (2007) 511–532 • It gives a way of constructing an ambient space (a toric

H. Verrill, D. Joyner / Journal of Symbolic Computation 42 (2007) 511–532 525

GAP Example 3.11. To compute the star of a cone σ in a fan ∆, use the Star command in theTORIC package.

Consider the fan ∆ determined by the cones

{Q≥0[(2, −1), (1, 0)], Q≥0[(1, 0), (1, 1)], Q≥0[(1, 1), (2, 0)]}

and let σ = Q≥0[(2, −1), (1, 0)]. The star of σ is the set {σ }, since it is a cone of maximaldimension in ∆. This, as well as some other examples, are computed below using GAP.gap> LoadPackage("toric");gap> Cones2:=[[[2,-1],[1,0]],[[1,0],[1,1]],[[1,1],[2,0]]];;gap> Star([[1,0]],Cones2);[ [ [ 1, 0 ] ], [ [ 2, -1 ], [ 1, 0 ] ], [ [ 1, 0 ], [ 1, 1 ] ] ]gap> Star([[1,0],[2,-1]],Cones2);[ [ [ 2, -1 ], [ 1, 0 ] ] ]gap>gap> Cones3:=[ [ [2,0,0],[0,2,0],[0,0,2] ], [ [2,0,0],[0,2,0],[1,1,-2] ] ];;gap> Star([[2,0,0]],Cones3);[ [ [ 2, 0, 0 ] ], [ [ 0, 0, 2 ], [ 2, 0, 0 ] ], [ [ 0, 2, 0 ], [ 2, 0, 0 ] ],

[ [ 1, 1, -2 ], [ 2, 0, 0 ] ], [ [ 2, 0, 0 ], [ 0, 2, 0 ], [ 0, 0, 2 ] ],[ [ 2, 0, 0 ], [ 0, 2, 0 ], [ 1, 1, -2 ] ] ]

gap> Star([[2,0,0],[0,2,0]],Cones3);[ [ [ 0, 2, 0 ], [ 2, 0, 0 ] ], [ [ 2, 0, 0 ], [ 0, 2, 0 ], [ 0, 0, 2 ] ],

[ [ 2, 0, 0 ], [ 0, 2, 0 ], [ 1, 1, -2 ] ] ]

4. Riemann–Roch spaces

In this section, unless stated otherwise, we will assume X is non-singular, so that Weil divisorsand Cartier divisors are the same. (The space of Cartier divisors is the subspace of locallyprincipal Weil divisors.)

4.1. Support functions

This section is based on Chapter 2 of Oda’s book (Oda, 1985).

Definition 4.1. Let ∆ be a fan in a lattice L . A ∆-linear support function is a real valuedfunction

h : |∆|→R,

such that

h : |∆| ∩ N→Z,

and h is linear on all cones σ ∈ ∆.

This means that if σ, τ ∈ ∆, then h|σ and h|τ are linear functions, which are equal on σ ∩ τ .To illustrate a support function on a fan ∆ we can draw lines where the fan has constant value 0,1, 2, and so on, as in the examples in the following pictures:

Page 16: Computing with toric varieties - CORE · 512 H. Verrill, D. Joyner / Journal of Symbolic Computation 42 (2007) 511–532 • It gives a way of constructing an ambient space (a toric

526 H. Verrill, D. Joyner / Journal of Symbolic Computation 42 (2007) 511–532

In the above examples the value of the support function is always positive, but this is notnecessary. Any element of the dual, L∗ gives a support function on any fan ∆ in L .

A support function can be defined by specifying for each cone σ in ∆ an element hσ ∈ L∗

such that

h(n) = 〈n, hσ 〉 (2)

for all n ∈ σ , and such that 〈n, hσ 〉 = 〈n, hτ 〉 for n ∈ τ ≺ σ .

Definition 4.2. For a fan ∆, the set SF(L ,∆) is the set of all ∆-linear support functions.

A support function is determined by its values on the one dimensional cones of a fan. If welet

∆(1) = {σ ∈ ∆| dim σ = 1},

then we have

SF(∆) ∼= Z∆(1). (3)

(See Section 2.1 in Oda (1985).)

Definition 4.3. A support function h on N ∼= Zn is upper convex if

h(n1 + n2) ≤ h(n1) + h(n2).

If in addition

hσ1 6= hσ2 ,

for σ1, σ2 two n dimensional cones in ∆, then h is called strictly upper convex.

Fulton (1993) uses the same terminology but omits the adjective “upper”.

4.2. Divisors and linear systems

Definition 4.4. For an algebraic variety X the group of Weil divisors on X is (roughly) given by

Div(X) = Z[{irreducible subvarieties of X of codimension 1}].

Previously we have mentioned orbits of points in toric varieties. For a cone σ ∈ ∆ we define

orb(σ ) = {unique T −orbit in Uσ which is closed in Uσ },

where as usual closed is with respect to the Zariski topology.For example, for P2, with homogeneous coordinates X, Y, Z , one of the affine pieces

corresponding to a cone is X 6= 0. In this piece the orbit XY Z 6= 0 is not closed, since it isnot defined by the vanishing of any finite set of polynomials. But the subvariety given by thepoint (1 : 0 : 0) is closed and T invariant. In the affine piece XY 6= 0, the unique T invariantdivisor is given by the line Z = 0 (restricted to this piece).

Define a Weil divisor corresponding to σ by:

V (σ ) = closure of orb(σ ). (4)

Page 17: Computing with toric varieties - CORE · 512 H. Verrill, D. Joyner / Journal of Symbolic Computation 42 (2007) 511–532 • It gives a way of constructing an ambient space (a toric

H. Verrill, D. Joyner / Journal of Symbolic Computation 42 (2007) 511–532 527

Definition 4.5. For a toric variety X with dense open torus T , a Weil divisor D is T invariantif D = T · D, where · denotes the natural torus action. The space of T invariant Weil divisors isdenoted T Div(X).

Definition 4.6. For any support function h on a fan ∆ we have a corresponding T invariantdivisor given by

Dh =

∑σ∈∆(1)

h(n(σ ))V (σ ),

where n(σ ) is an element of N which generates σ . (Note, n(σ ) is only defined when σ is onedimensional.)

For further details, see Section 4.2 above, Section 3.3 of Fulton (1993), or Section 2.1 in Oda(1985).

Definition 4.7. For any rational function f on a variety X (i.e., defined by a quotient ofpolynomials), there is a corresponding valuations on divisors given by

v f (D) = order of vanishing of f along D.

If f has a pole along D then the valuation is negative.

Rather than give a proper definition of “order of vanishing”, we give an example below.

Definition 4.8. If f is a rational function on a variety X then there is a corresponding Weildivisor, given by the free abelian group

( f ) =

∑D∈Div(X)

v f (D)D.

A divisor of this form is called a principal divisor.

Definition 4.9. Two Weil divisors D1 and D2 are linearly equivalent, written D1 ∼ D2, if thereis some function f with

( f ) = D1 − D2.

Example 4.10. Any two lines on P2 are linearly equivalent, since if l1(X, Y, Z) and l2(X, Y, Z)

are linear functions defining lines L1 and L2, then(l1l2

)= L1 − L2.

Definition 4.11. If D is a divisor on X , then the complete linear system defined by D is givenby

|D| = {D′∈ Div(X) | D ∼ D′

}.

|D| has the structure of a projective space, the quotient of the vector space of non-zero functionson X by F×.

Page 18: Computing with toric varieties - CORE · 512 H. Verrill, D. Joyner / Journal of Symbolic Computation 42 (2007) 511–532 • It gives a way of constructing an ambient space (a toric

528 H. Verrill, D. Joyner / Journal of Symbolic Computation 42 (2007) 511–532

Linear systems are important because they can be used to define functions from varieties toprojective space. If D1 ∼ D2 ∼ D3 are divisors, locally defined by the vanishing of somepolynomials f1, f2, f3 on some affine piece of a variety, then there is a function given (locally) by

x 7→ ( f1(x) : f2(x) : f3(x)).

The fact that D1 ∼ D2 means that this map can be patched together globally, with the ratiof1(x)/ f2(x) giving the value of the function locally.

Theorem 4.12. Let X be a smooth toric variety. For a support function h on a fan ∆, the linearsystem |Dh | defines a smooth embedding of X (∆) in projective space if and only if h is strictlyupper convex.

This is equivalent to the lemma on page 69 of Fulton (1993).

4.3. An explicit basis for L(D)

Let ∆ be a fan in a lattice L . Denote by τ1, . . . , τn the edges or rays of the fan and let videnote the first (smallest) lattice point along the ray τi . Let Di denote the Weil divisor V (τi ) asin (4), which may be regarded as the closure of the orbit of T acting on the edge τi . Let

PD = {x = (x1, . . . , xn) | 〈x, vi 〉 ≥ −di , ∀1 ≤ i ≤ k}

denote the polytope associated to the Weil divisor D = d1 D1 +· · ·+dk Dk , where Di is as above.When X is non-singular, there is a fairly simple condition which determines whether or not Dis Cartier — see the exercise on page 62 of Fulton (1993). Moreover, there is a fairly simplecondition which tells you whether or not D is ample — see the proof of the proposition on page68 of Fulton (1993).

If F is a topological field, a line bundle on an F-variety X is given by a F-manifold L witha surjective map

π : L→X,

such that the inverse image π−1(x) is a one dimensional vector space over the underlying fieldF .

For a toric variety X (∆), containing an open dense torus T ∼= (F×)n , a line bundleπ : L→X (∆) is called an equivariant line bundle if T acts on L , and for all a ∈ T andall v ∈ L we have

π(a · v) = a · π(v).

We won’t go into sheaves in detail, but all invertible sheaves on (a smooth) toric variety Xare defined by T -invariant Weil divisors. Moreover, certain computations of the cohomology ofinvertible sheaves on X boils down to combinatorial computations. For example, we have resultslike the following.

Theorem 4.13. For a polyhedron P in a lattice L∗, we have a support function h = h P on thetoric variety X (∆(P)), and a corresponding sheaf O(Dh). The space of global sections of thesheaf, H0(X (∆(P)),O(Dh)) is a finite dimensional vector space with basis given by the set oflattice points in P ∩ L∗.

Page 19: Computing with toric varieties - CORE · 512 H. Verrill, D. Joyner / Journal of Symbolic Computation 42 (2007) 511–532 • It gives a way of constructing an ambient space (a toric

H. Verrill, D. Joyner / Journal of Symbolic Computation 42 (2007) 511–532 529

For further details, see Section 3.4 in Fulton (1993) or Lemma 2.3 in Oda (1985).We define the Riemann–Roch space L(D) by

L(D) = Γ (X,O(D)) = H0(X,O(D)).

By Fulton (1993), page 66, we have

L(D) =

⊕u∈PD

F · χu,

where χ = (x1, . . . , xn) and χu is the associated monomial in multi-index notation.

Example 4.14. Let ∆ be the fan generated by

v1 = 2e1 − e2, v2 = −e1 + 2e2, v3 = −e1 − e2.

(In this case, X (∆) is singular.) In the notation above, the divisor D = d1 D1 + d2 D2 + d3 D3 isa Cartier divisor if and only if d1 ≡ d2 ≡ d3 (mod 3) (Fulton, 1993, p. 65). Let

PD = {(x, y) | 〈(x, y), vi 〉 ≥ −di , ∀i}

= {(x, y) | 2x − y ≥ −d1, −x + 2y ≥ −d2, −x − y ≥ −d3}

denote the polytope associated to D. The DivisorPolytope command in toric implements analgorithm which determines the inequalities describing PD in general.

If d1 = d2 = 6 and d3 = 0 then PD is a triangle in the plane with vertices at (−6, −6),(−2, 2), and (2, −2). Note that it remains invariant under the action of G. Moreover, the Gaction on PD ∩ L∗ has 7 singleton orbits (the lattice points (−i, −i), where 0 ≤ i ≤ 6) and 12orbits of size 2. A basis for the Riemann–Roch space L(D) is returned by the toric commands:

gap> LoadPackage("toric");gap> Cones:=[[[2,-1],[-1,2]],[[-1,2],[-1,-1]],[[-1,-1],[2,-1]]];;gap> Div:=[6,6,0];;gap> Rays:=[[2,-1],[-1,2],[-1,-1]];;gap> RR:=RiemannRochBasis(Div,Cones,Rays);[ 1/(x_1^6*x_2^6), 1/(x_1^5*x_2^5), 1/(x_1^5*x_2^4), 1/(x_1^4*x_2^5),

1/(x_1^4*x_2^4), 1/(x_1^4*x_2^3), 1/(x_1^4*x_2^2), 1/(x_1^3*x_2^4),1/(x_1^3*x_2^3), 1/(x_1^3*x_2^2), 1/(x_1^3*x_2), 1/x_1^3, 1/(x_1^2*x_2^4),1/(x_1^2*x_2^3), 1/(x_1^2*x_2^2), 1/(x_1^2*x_2), 1/x_1^2, x_2/x_1^2,x_2^2/x_1^2, 1/(x_1*x_2^3), 1/(x_1*x_2^2), 1/(x_1*x_2), 1/x_1, x_2/x_1,1/x_2^3, 1/x_2^2, 1/x_2, 1, x_1/x_2^2, x_1/x_2, x_1^2/x_2^2 ]

gap>

5. Application to error-correcting codes

Error-correcting codes associated to a toric variety were introduced by Hansen (2002) in thecase of surfaces, and discussed more generally in Joyner (2004), Little and Schenck (2005), Littleand Schwarz (2005) and Ruano (2005).

5.1. Hansen codes

We recall briefly some codes associated to a toric surface, constructed by Hansen (2002).Let F = Fq be a finite field with q elements and let F denote a separable algebraic closure.

Let L be a lattice in Q2 generated by v1, v2 ∈ Z2, P a polytope in Q2, and X (P) the associatedtoric surface. Let PL = P ∩ Z2.

Page 20: Computing with toric varieties - CORE · 512 H. Verrill, D. Joyner / Journal of Symbolic Computation 42 (2007) 511–532 • It gives a way of constructing an ambient space (a toric

530 H. Verrill, D. Joyner / Journal of Symbolic Computation 42 (2007) 511–532

There is a dense embedding of GL(1) × GL(1) into X (P) given as follows. Let TL =

HomZ(L , GL(1)) (which is ∼= GL(1) × GL(1) by sending t = (t1, t2) to m1v1 + m2v2 7−→

e(`)(t) = tm11 tm2

2 ) and let e(`) : TL → F be defined by e(`)(t) = t (`), t ∈ TL .Impose an ordering on the set TL(F) (changing the ordering leads to an equivalent code).

Define the code C = CP ⊂ Fn to be the linear code generated by the vectors

B = {(e(`)(t))t∈TL (F) | ` ∈ L ∩ PL}, (5)

where n = (q − 1)2. In some special cases, the dimension is C is known and an estimate of itsminimum distance can be given (see Theorem 5.1 below).

Hansen gives lower bounds on the minimum distance d of such codes in the cases:(a) P is an isosceles triangle with vertices (0, 0), (a, a), (0, 2a),(b) P is an isosceles triangle with vertices (0, 0), (a, 0), (0, a), or(c) P is a rectangle with vertices (0, 0), (a, 0), (0, b), (a, b),

provided q is “sufficient large”. His precise result is recalled below.

Theorem 5.1 (Hansen, 2002). Let a, b be positive integers. Let P be the polytope defined in(a)–(c) above.

(a) Assume q > 2a + 1. The code C = CP has

n = (q − 1)2, k = (a + 1)2, d = n − 2a(q − 1).

(b) Assume q > a + 1. The code C = CP has

n = (q − 1)2, k = (a + 1)(a + 2)/2, d = n − a(q − 1).

(c) Assume q > max(a, b) + 1. The code C = CP has

n = (q − 1)2, k = (a + 1)(b + 1), d = n − a(q − 1) − b(q − 1) + ab.

GAP Example 5.2. We examine an example of part (b) of Hansen’s theorem.Some of the GAP toric variety procedures have been loaded into the GAP package GUAVA

instead of TORIC.

gap> LoadPackage("guava");gap> Polyb:=[[0,0],[0,1],[1,0],[1,1],[0,2],[1,2],[2,0],[2,1],[0,3],[3,0]];;gap> C:=ToricCode(Polyb,GF(3));a linear [4,4,1]0 code defined by generator matrix over GF(3)gap> Display(GeneratorMat(C));1 1 1 1. 1 . 1. . 1 1. . . 1

5.2. Other toric codes

Though the results in Fulton (1993) apply to toric varieties over C, we shall work over a finitefield Fq having q = pk elements, where p is a prime and k ≥ 1. We assume that the results ofFulton (1993) have analogs over Fq .

Let M ∼= Zn be a lattice in V = Rn and let N ∼= Zn denote its dual. Let ∆ be a fan (of rationalcones, with respect to M) in V and let X = X (∆) denote the toric variety associated to ∆. LetT denote a dense torus in X .

Let D = P1 + · · · + Pn be a positive 1-cycle on X , where the points Pi ∈ X (Fq) are distinct.Let G be a T -invariant divisor on X which does not “meet” D, in the sense that no element of

Page 21: Computing with toric varieties - CORE · 512 H. Verrill, D. Joyner / Journal of Symbolic Computation 42 (2007) 511–532 • It gives a way of constructing an ambient space (a toric

H. Verrill, D. Joyner / Journal of Symbolic Computation 42 (2007) 511–532 531

the support of D intersects any element in the support of G. We write this as

supp(G) ∩ supp(D) = ∅.

Some additional assumptions on G and D shall be made later. Let

L(G) = {0} ∪ { f ∈ Fq(X)× | div( f ) + G ≥ 0}

denote the Riemann–Roch space associated to G. According to Fulton (1993), Section 3.4, thereis a polytope PG in V such that L(G) is spanned by the monomials xa (in multi-index notation),for a ∈ PG ∩ N . Let CL = CL(D, G) denote the code define by

CL = {( f (P1), . . . , f (Pn)) | f ∈ L(G)}.

This is the AG code associated to X , D, and G. The dual code is denoted

C =

{(c1, . . . , cn) ∈ Fn

q

∣∣∣∣∣ n∑i=1

ci f (Pi ) = 0, ∀ f ∈ L(G)

}.

Since TORIC easily computes a basis of L(G), it is easy to compute a generator matrix forCL in GAP. In fact, this was incorporated into the GAP error-correcting codes package GUAVA(Joyner, 2006b). Many examples are given in Joyner (2004), one of which was a new code withbest-known parameters.

6. Betti numbers and Euler characteristics

Let X = X (∆) be an n-dimensional smooth toric variety associated to a fan ∆. Let dkdenote the number of distinct k-dimensional cones in ∆. The TORIC command ConesOfFancomputes the set of such cones and NumberOfConesOfFan computes their cardinality. The kthBetti number of X is the rank of H k(X, Z). Let bk denote the kth Betti number of X . It is known(see Fulton, 1993, Section 4.5) that

b2k =

n∑j=k

(−1) j−k(

jk

)dn− j ,

where di = di (∆) denotes the number of i-dimensional codes in ∆. The TORIC package cancompute these invariants.

Example 6.1. Let ∆ be the fan whose cones of maximal dimension are defined by

σ1 = R≥0(1, 0) + R≥0(0, 1), σ2 = R≥0(0, 1) + R≥0(−1, 0),

σ3 = R≥0(−1, 0) + R≥0(0, −1), σ4 = R≥0(0, −1) + R≥0(1, 0).

The toric variety associated to this fan is X = P1× P1. The TORIC package commands to

compute the Betti numbers b2k are as follows.

gap> RequirePackage("toric");gap> Cones:=[[[1,0],[0,1]],[[0,1],[-1,0]],[[-1,0],[0,-1]],[[0,-1],[1,0]]];gap> BettiNumberToric(Cones,1);gap> BettiNumberToric(Cones,2);gap> EulerCharacteristic(Cones);4

GAP returns b1 = 0 to the first command, betti_number(Cones,1);, and b2 = 2 to thesecond command. The last command tells us that the Euler characteristic of X is 4.

Page 22: Computing with toric varieties - CORE · 512 H. Verrill, D. Joyner / Journal of Symbolic Computation 42 (2007) 511–532 • It gives a way of constructing an ambient space (a toric

532 H. Verrill, D. Joyner / Journal of Symbolic Computation 42 (2007) 511–532

7. Counting points over a finite field

Let X = X (∆) be a smooth toric variety associated to a fan ∆. Let q be a prime power andF = G F(q) denote a field with q elements. It is known (see Fulton, 1993, Section 4.5) that

|X (F)| =

n∑k=0

(q − 1)kdn−k,

where |S| denotes the number of elements in a finite set S. The TORIC package can compute this.

Example 7.1. Let ∆ be the fan whose cones of maximal dimension are defined by

σ1 = R≥0(1, 0) + R≥0(0, 1), σ2 = R≥0(0, 1) + R≥0(−1, 0),

σ3 = R≥0(−1, 0) + R≥0(0, −1), σ4 = R≥0(0, −1) + R≥0(1, 0),

so X (∆) = P1× P1. The TORIC package commands to compute the number of points mod p,

|X (Fp)| are as follows.

gap> RequirePackage("toric");gap> Cones:=[[[1,0],[0,1]],[[0,1],[-1,0]],[[-1,0],[0,-1]],[[0,-1],[1,0]]];gap> CardinalityOfToricVariety(Cones,2);gap> CardinalityOfToricVariety(Cones,3);gap> CardinalityOfToricVariety(Cones,5);

GAP returns |X (F2)| = 9 to the first command, |X (F3)| = 16 to the second command, and|X (F5)| = 36 to the last command.

Acknowledgement

The authors are very grateful for the many helpful suggestions by the anonymous referee.

References

Bosma, W., Cannon, J., Playoust, C., 1997. The MAGMA algebra system, I: The user language. Journal of SymbolicComputation 24, 235–265. See also the MAGMA homepage at http://www.maths.usyd.edu.au:8000/u/magma/.

Ewald, G., 1996. Combinatorial Convexity and Algebraic Geometry. Springer.Fulton, W., 1993. Introduction to Toric Varieties. PUP.The GAP Group, 2006. GAP — Groups, Algorithms, and Programming, Version 4.4, http://www.gap-system.org.Hansen, J.P., 2002. Toric varieties, Hirzebruch surfaces and error-correcting codes. Applicable Algebra in Engineering,

Communication and Computing 13, 289–300.Iitaka, S., 1982. Algebraic Geometry. Springer-Verlag.Joyner, D., 2004. Toric codes over finite fields. AAECC 15, 63–79.Joyner, D., 2006a (package author and maintainer). TORIC package web page http://www.gap-

system.org/Packages/toric.html. MAGMA code http://cadigweb.ew.usna.edu/˜wdj/gap/magma/toric.mag.Joyner D., 2006b (package maintainer). GUAVA package web page http://www.gap-system.org/Packages/guava.html.Joyner, D., Verrill, H., 2002. Notes on toric varieties, 71 pp. Preprint at Math arXiV,

http://front.math.ucdavis.edu/math.AG/0208065.Little, J., Schenck, H., 2005. Toric surface codes and Minkowski sums, SIAM Journal on Discrete Mathematics (in

press). Preprint at Math arXiV. http://front.math.ucdavis.edu/math.AG/0507598.Little, J., Schwarz, R., 2005. On m-dimensional toric codes, Preprint at Math arXiV.

http://front.math.ucdavis.edu/cs.IT/0506102.Oda, T., 1985. Convex Bodies and Algebraic Geometry. Springer-Verlag.Ruano, D., 2005. On the parameters of r-dimensional toric codes, Preprint at Math arXiV

http://front.math.ucdavis.edu/math.AG/0512285.Stein, W., 2007. SAGE: Software for algebra and geometry exploration, Available http://sage.scipy.org/,

http://sage.math.washington.edu/sage/.