# Toric ideals¶

A toric ideal (associated to an integer matrix $$A$$) is an ideal of the form

$\begin{split}I_A = \left< x^u - x^v : u,v \in \ZZ_\geq^n , u-v \in \ker(A) \right>\end{split}$

In other words, it is an ideal generated by irreducible “binomials”, that is, differences of monomials without a common factor. Since the Buchberger algorithm preserves this property, any Groebner basis is then also generated by binomials.

EXAMPLES:

sage: A = matrix([[1,1,1],[0,1,2]])
sage: IA = ToricIdeal(A)
sage: IA.ker()
Free module of degree 3 and rank 1 over Integer Ring
User basis matrix:
[-1  2 -1]
sage: IA
Ideal (-z1^2 + z0*z2) of Multivariate Polynomial
Ring in z0, z1, z2 over Rational Field


Here, the “naive” ideal generated by $$z_0 z_2 - z_1^2$$ does already equal the toric ideal. But that is not true in general! For example, this toric ideal ([ProcSympPureMath62], Example 1.2) is the twisted cubic and cannot be generated by $$2=\dim \ker(A)$$ polynomials:

sage: A = matrix([[3,2,1,0],[0,1,2,3]])
sage: IA = ToricIdeal(A)
sage: IA.ker()
Free module of degree 4 and rank 2 over Integer Ring
User basis matrix:
[-1  1  1 -1]
[-1  2 -1  0]
sage: IA
Ideal (-z1*z2 + z0*z3, -z1^2 + z0*z2, z2^2 - z1*z3) of
Multivariate Polynomial Ring in z0, z1, z2, z3 over Rational Field


The following family of toric ideals is from Example 4.4 of [ProcSympPureMath62]. One can show that $$I_d$$ is generated by one quadric and $$d$$ binomials of degree $$d$$:

sage: I = lambda d: ToricIdeal(matrix([[1,1,1,1,1],[0,1,1,0,0],[0,0,1,1,d]]))
sage: I(2)
Ideal (-z3^2 + z0*z4,
z0*z2 - z1*z3,
z2*z3 - z1*z4) of
Multivariate Polynomial Ring in z0, z1, z2, z3, z4 over Rational Field
sage: I(3)
Ideal (-z3^3 + z0^2*z4,
z0*z2 - z1*z3,
z2*z3^2 - z0*z1*z4,
z2^2*z3 - z1^2*z4) of
Multivariate Polynomial Ring in z0, z1, z2, z3, z4 over Rational Field
sage: I(4)
Ideal (-z3^4 + z0^3*z4,
z0*z2 - z1*z3,
z2*z3^3 - z0^2*z1*z4,
z2^2*z3^2 - z0*z1^2*z4,
z2^3*z3 - z1^3*z4) of
Multivariate Polynomial Ring in z0, z1, z2, z3, z4 over Rational Field


Finally, the example in [GRIN]

sage: A = matrix(ZZ, [ [15,  4, 14, 19,  2,  1, 10, 17],
...                    [18, 11, 13,  5, 16, 16,  8, 19],
...                    [11,  7,  8, 19, 15, 18, 14,  6],
...                    [17, 10, 13, 17, 16, 14, 15, 18] ])
sage: IA = ToricIdeal(A)     # long time
sage: IA.ngens()             # long time
213


TESTS:

sage: A = matrix(ZZ, [[1, 1, 0, 0, -1,  0,  0, -1],
...                   [0, 0, 1, 1,  0, -1, -1,  0],
...                   [1, 0, 0, 1,  1,  1,  0,  0],
...                   [1, 0, 0, 1,  0,  0, -1, -1]])
sage: IA = ToricIdeal(A)
sage: R = IA.ring()
sage: R.inject_variables()
Defining z0, z1, z2, z3, z4, z5, z6, z7
sage: IA == R.ideal([z4*z6-z5*z7, z2*z5-z3*z6, -z3*z7+z2*z4,
...       -z2*z6+z1*z7, z1*z4-z3*z6, z0*z7-z3*z6, -z1*z5+z0*z6, -z3*z5+z0*z4,
...       z0*z2-z1*z3])  # Computed with Maple 12
True


The next example first appeared in Example 12.7 in [GBCP]. It is also used by the Maple 12 help system as example:

sage: A = matrix(ZZ, [[1, 2, 3, 4, 0, 1, 4, 5],
...                   [2, 3, 4, 1, 1, 4, 5, 0],
...                   [3, 4, 1, 2, 4, 5, 0, 1],
...                   [4, 1, 2, 3, 5, 0, 1, 4]])
sage: IA = ToricIdeal(A, 'z1, z2, z3, z4, z5, z6, z7, z8')
sage: R = IA.ring()
sage: R.inject_variables()
Defining z1, z2, z3, z4, z5, z6, z7, z8
sage: IA == R.ideal([z4^4-z6*z8^3, z3^4-z5*z7^3, -z4^3+z2*z8^2,
...       z2*z4-z6*z8, -z4^2*z6+z2^2*z8, -z4*z6^2+z2^3, -z3^3+z1*z7^2,
...       z1*z3-z5*z7, -z3^2*z5+z1^2*z7, z1^3-z3*z5^2])
True


REFERENCES:

 [GRIN] (1, 2) Bernd Sturmfels, Serkan Hosten: GRIN: An implementation of Grobner bases for integer programming, in “Integer Programming and Combinatorial Optimization”, [E. Balas and J. Clausen, eds.], Proceedings of the IV. IPCO Conference (Copenhagen, May 1995), Springer Lecture Notes in Computer Science 920 (1995) 267-276.
 [ProcSympPureMath62] (1, 2) Bernd Sturmfels: Equations defining toric varieties, Algebraic Geometry - Santa Cruz 1995, Proc. Sympos. Pure Math., 62, Part 2, Amer. Math. Soc., Providence, RI, 1997, pp. 437-449.
 [GBCP] Bernd Sturmfels: Grobner Bases and Convex Polytopes AMS University Lecture Series Vol. 8 (01 December 1995)

AUTHORS:

• Volker Braun (2011-01-03): Initial version
class sage.schemes.toric.ideal.ToricIdeal(A, names='z', base_ring=Rational Field, polynomial_ring=None, algorithm='HostenSturmfels')

This class represents a toric ideal defined by an integral matrix.

INPUT:

• A – integer matrix. The defining matrix of the toric ideal.

• names – string (optional). Names for the variables. By default, this is 'z' and the variables will be named z0, z1, ...

• base_ring – a ring (optional). Default: $$\QQ$$. The base ring of the ideal. A toric ideal uses only coefficents $$\pm 1$$.

• polynomial_ring – a polynomial ring (optional). The polynomial ring to construct the ideal in.

You may specify the ambient polynomial ring via the polynomial_ring parameter or via the names and base_ring parameter. A ValueError is raised if you specify both.

• algorithm – string (optional). The algorithm to use. For now, must be 'HostenSturmfels' which is the algorithm proposed by Hosten and Sturmfels in [GRIN].

EXAMPLES:

sage: A = matrix([[1,1,1],[0,1,2]])
sage: ToricIdeal(A)
Ideal (-z1^2 + z0*z2) of Multivariate Polynomial Ring
in z0, z1, z2 over Rational Field


First way of specifying the polynomial ring:

sage: ToricIdeal(A, names='x,y,z', base_ring=ZZ)
Ideal (-y^2 + x*z) of Multivariate Polynomial Ring
in x, y, z over Integer Ring


Second way of specifying the polynomial ring:

sage: R.<x,y,z> = ZZ[]
sage: ToricIdeal(A, polynomial_ring=R)
Ideal (-y^2 + x*z) of Multivariate Polynomial Ring
in x, y, z over Integer Ring


It is an error to specify both:

sage: ToricIdeal(A, names='x,y,z', polynomial_ring=R)
Traceback (most recent call last):
...
ValueError: You must not specify both variable names and a polynomial ring.

A()

Return the defining matrix.

OUTPUT:

An integer matrix.

EXAMPLES:

sage: A = matrix([[1,1,1],[0,1,2]])
sage: IA = ToricIdeal(A)
sage: IA.A()
[1 1 1]
[0 1 2]

ker()

Return the kernel of the defining matrix.

OUTPUT:

The kernel of self.A().

EXAMPLES:

sage: A = matrix([[1,1,1],[0,1,2]])
sage: IA = ToricIdeal(A)
sage: IA.ker()
Free module of degree 3 and rank 1 over Integer Ring
User basis matrix:
[-1  2 -1]

nvariables()

Return the number of variables of the ambient polynomial ring.

OUTPUT:

Integer. The number of columns of the defining matrix A().

EXAMPLES:

sage: A = matrix([[1,1,1],[0,1,2]])
sage: IA = ToricIdeal(A)
sage: IA.nvariables()
3


#### Previous topic

The Chow group of a toric variety

#### Next topic

Morphisms of Toric Varieties