This is FourTiTwo.info, produced by Macaulay2, version 1.24.11

FourTiTwo -- Interface for 4ti2
*******************************

Description
===========

Interfaces most of the functionality of the software 4ti2 available at
http://www.4ti2.de/. (The user needs to have 4ti2 installed on his/her
machine.)

A $d\times n$ integral matrix $A$ (with nonnegative entries) specifies a map
from a polynomial ring in d variables to a polynomial ring with n variables by
specifying exponents of the variables indexing its columns. For example, if $A$
is a matrix $$\begin{pmatrix} 3&2&1&0\\ 0&1&2&3 \end{pmatrix}$$ the map from
$k[s,t]$ to $k[a,b,c,d]$ is given by $(s,t) \mapsto \ (s^3,s^2t,st^2,t^3)$.

The toric ideal $I_A$ is the kernel of this map. It is minimally generated by
the 2-minors of the matrix $$\begin{pmatrix} x&y&z\\ y&z&w \end{pmatrix}$$
Given the matrix $A$, one can compute its lattice basis ideal specified by the
integral basis of the lattice $A$, the toric ideal $I_A$, its Groebner bases,
etc. In practice, however, these are nontrivial computational tasks. The
software 4ti2 is very efficient in computing these objects.

For more theoretical details (and more generality), see the standard reference:
B. Sturmfels, Gr\"obner bases and convex polytopes. American Mathematical
Society, University Lectures Series, No 8, Providence, Rhode Island, 1996.

Note for cygwin users: If a problem occurs during package installation and/or
loading, it should be fixed by setting the path inside the file
.Macaulay2/init-FourTiTwo.m2  to whatever folder 4ti2 is installed. For
example, if  4ti2 has been installed in C:/cygwin/4ti2/win32, then the line
inside the init-FourTiTwo.m2 file will look like this:  "path" =>
"C:/cygwin/4ti2/win32/"  . Alternately, the path for 4ti2 may be set when
loading the package using the following command: loadPackage("FourTiTwo",
Configuration=>{"path"=>"C:/cygwin/4ti2/win32/"}) assuming that 4ti2 has been
installed in C:/cygwin/4ti2/win32.

Caveat
======

If the package SimpleDoc is not found when installing FourTiTwo.m2, see
questions and answers 6, 7, and 8 on the Macaulay 2 web site.

Authors
=======

  * Mike Stillman <mike@math.cornell.edu>
  * Josephine Yu <jyu@math.mit.edu>
  * Sonja Petrovic <petrovic@psu.edu>

Version
=======

This documentation describes version 1.0 of FourTiTwo.

Source code
===========

The source code from which this documentation is derived is in the file
FourTiTwo.m2 (see common/share/Macaulay2/FourTiTwo.m2 ).

Exports
=======

  * Functions and commands
      * getMatrix -- reads a matrix from a 4ti2-formatted
        input file
      * putMatrix -- writes a matrix into a file formatted
        for 4ti2
      * toBinomial -- creates a toric ideal from a given set
        of exponents of its generators
      * toricCircuits -- calculates the circuits of the
        toric ideal; invokes "circuits" from 4ti2
      * toricGraver -- calculates the Graver basis of the
        toric ideal; invokes "graver" from 4ti2
      * toricGraverDegrees -- displays the degrees
        of all Graver basis elements for the toric ideal I_A
      * toricGroebner -- calculates a Groebner basis of
        the toric ideal I_A, given A; invokes "groebner" from 4ti2
      * toricMarkov -- calculates a generating set of the
        toric ideal I_A, given A; invokes "markov" from 4ti2
  * Methods
      * "getMatrix(String)" -- see getMatrix, -- reads a
        matrix from a 4ti2-formatted input file
      * hilbertBasis(Matrix) -- calculates the
        Hilbert basis of the cone; invokes "hilbert" from 4ti2
      * "putMatrix(File,Matrix)" -- see putMatrix, -- writes a
        matrix into a file formatted for 4ti2
      * rays(Matrix) -- calculates the extreme rays of
        the cone; invokes "rays" from 4ti2
      * "toBinomial(Matrix,Ring)" -- see toBinomial, --
        creates a toric ideal from a given set of exponents of its generators
      * "toricCircuits(Matrix)" -- see toricCircuits, --
        calculates the circuits of the toric ideal; invokes "circuits" from
        4ti2
      * "toricGraver(Matrix)" -- see toricGraver, --
        calculates the Graver basis of the toric ideal; invokes "graver" from
        4ti2
      * "toricGraver(Matrix,Ring)" -- see toricGraver, --
        calculates the Graver basis of the toric ideal; invokes "graver" from
        4ti2
      * "toricGraverDegrees(Matrix)" -- see toricGraverDegrees,
        -- displays the degrees of all Graver basis
        elements for the toric ideal I_A
      * "toricGroebner(Matrix)" -- see toricGroebner, --
        calculates a Groebner basis of the toric ideal I_A, given A; invokes
        "groebner" from 4ti2
      * "toricGroebner(Matrix,Ring)" -- see toricGroebner,
        -- calculates a Groebner basis of the toric ideal I_A, given A; invokes
        "groebner" from 4ti2
      * "toricMarkov(Matrix)" -- see toricMarkov, --
        calculates a generating set of the toric ideal I_A, given A; invokes
        "markov" from 4ti2
      * "toricMarkov(Matrix,Ring)" -- see toricMarkov, --
        calculates a generating set of the toric ideal I_A, given A; invokes
        "markov" from 4ti2
  * Symbols
      * InputType

For the programmer
==================

The object FourTiTwo, is a package (Macaulay2Doc).

getMatrix -- reads a matrix from a 4ti2-formatted input file
************************************************************

Synopsis
========

  * Usage:
        getMatrix s
  * Inputs:
      * s, a string (Macaulay2Doc), file name
  * Outputs:
      * A, a matrix (Macaulay2Doc),

Description
===========

The file should contain a matrix in the format such as

2 4\break 1 1 1 1\break 1 2 3 4\break

The first two numbers are the numbers of rows and columns.

See also
========

  * putMatrix -- writes a matrix into a file formatted for
    4ti2

Ways to use getMatrix:
======================

  * "getMatrix(String)"

For the programmer
==================

The object getMatrix, is a method function (Macaulay2Doc).

hilbertBasis(Matrix) -- calculates the Hilbert basis of the cone; invokes "hilbert" from 4ti2
*********************************************************************************************

Synopsis
========

  * Function: hilbertBasis (Polyhedra),
  * Usage:
        hilbertBasis(A) or hilbertBasis(A, InputType => "lattice")
  * Inputs:
      * A, a matrix (Macaulay2Doc), defining the cone $\{z : Az =
        0, z \ge 0 \}$
  * Optional inputs (Macaulay2Doc),:
      * InputType => a string (Macaulay2Doc), default value null,
        use the string "lattice" if rows of A specify a lattice basis
      * Precision => an integer (Macaulay2Doc), or a string (Macaulay2Doc),
        default value 32, 32, 64, or "gmp", the
        precision of the integers used during the computation
  * Outputs:
      * B, a matrix (Macaulay2Doc), whose rows form the Hilbert
        basis of the cone $\{z : Az = 0, z \ge 0 \}$ or the cone $\{z A : z
        \text{ is an integral vector and } z A \ge 0 \}$ if InputType =>
        "lattice" is used

Description
===========

+--------------------------------------------+
|i1 : A = matrix "1,1,1,1; 1,2,3,4"          |
|                                            |
|o1 = | 1 1 1 1 |                            |
|     | 1 2 3 4 |                            |
|                                            |
|              2       4                     |
|o1 : Matrix ZZ  <-- ZZ                      |
+--------------------------------------------+
|i2 : B = syz A                              |
|                                            |
|o2 = | 1  2  |                              |
|     | -2 -3 |                              |
|     | 1  0  |                              |
|     | 0  1  |                              |
|                                            |
|              4       2                     |
|o2 : Matrix ZZ  <-- ZZ                      |
+--------------------------------------------+
|i3 : hilbertBasis(transpose B)              |
|                                            |
|o3 = | 3 2 1 0 |                            |
|     | 0 1 2 3 |                            |
|     | 1 1 1 1 |                            |
|                                            |
|              3       4                     |
|o3 : Matrix ZZ  <-- ZZ                      |
+--------------------------------------------+
|i4 : hilbertBasis(A, InputType => "lattice")|
|                                            |
|o4 = | 3 2 1 0 |                            |
|     | 0 1 2 3 |                            |
|     | 1 1 1 1 |                            |
|                                            |
|              3       4                     |
|o4 : Matrix ZZ  <-- ZZ                      |
+--------------------------------------------+

Ways to use this method:
========================

  * hilbertBasis(Matrix) -- calculates the
    Hilbert basis of the cone; invokes "hilbert" from 4ti2

InputType
*********

Description
===========

Put InputType => "lattice" as an argument in the functions toricMarkov and
hilbertBasis

See also
========

  * toricMarkov -- calculates a generating set of the toric
    ideal I_A, given A; invokes "markov" from 4ti2
  * hilbertBasis (Polyhedra) -- computes the Hilbert basis
    of a Cone

Functions with optional argument named InputType:
=================================================

  * "hilbertBasis(Matrix,InputType=>...)" -- see hilbertBasis(Matrix),
    -- calculates the Hilbert basis of the cone;
    invokes "hilbert" from 4ti2
  * "toricMarkov(...,InputType=>...)" -- see toricMarkov, --
    calculates a generating set of the toric ideal I_A, given A; invokes
    "markov" from 4ti2

For the programmer
==================

The object InputType, is a symbol (Macaulay2Doc).

putMatrix -- writes a matrix into a file formatted for 4ti2
***********************************************************

Synopsis
========

  * Usage:
        putMatrix(F,A)
  * Inputs:
      * F, a file (Macaulay2Doc),
      * A, a matrix (Macaulay2Doc),

Description
===========

Write the matrix A in file F in 4ti2 format.

+----------------------------------+
|i1 : A = matrix "1,1,1,1; 1,2,3,4"|
|                                  |
|o1 = | 1 1 1 1 |                  |
|     | 1 2 3 4 |                  |
|                                  |
|              2       4           |
|o1 : Matrix ZZ  <-- ZZ            |
+----------------------------------+
|i2 : s = temporaryFileName()      |
|                                  |
|o2 = /tmp/M2-2568424-0/0          |
+----------------------------------+
|i3 : F = openOut(s)               |
|                                  |
|o3 = /tmp/M2-2568424-0/0          |
|                                  |
|o3 : File                         |
+----------------------------------+
|i4 : putMatrix(F,A)               |
+----------------------------------+
|i5 : close(F)                     |
|                                  |
|o5 = /tmp/M2-2568424-0/0          |
|                                  |
|o5 : File                         |
+----------------------------------+
|i6 : getMatrix(s)                 |
|                                  |
|o6 = | 1 1 1 1 |                  |
|     | 1 2 3 4 |                  |
|                                  |
|              2       4           |
|o6 : Matrix ZZ  <-- ZZ            |
+----------------------------------+

See also
========

  * getMatrix -- reads a matrix from a 4ti2-formatted input
    file

Ways to use putMatrix:
======================

  * "putMatrix(File,Matrix)"

For the programmer
==================

The object putMatrix, is a method function (Macaulay2Doc).

rays(Matrix) -- calculates the extreme rays of the cone; invokes "rays" from 4ti2
*********************************************************************************

Synopsis
========

  * Function: rays (Macaulay2Doc),
  * Usage:
        rays(A)
  * Inputs:
      * A, a matrix (Macaulay2Doc), defining the cone $\{z : Az =
        0, z \ge 0 \}$
  * Optional inputs (Macaulay2Doc),:
      * Precision (missing documentation) => an integer (Macaulay2Doc),
        or a string (Macaulay2Doc), default
        value 64, 32, 64, or "arbitrary", the precision of the integers used
        during the computation
  * Outputs:
      * B, a matrix (Macaulay2Doc), whose rows are the extreme
        rays of the cone $\{z : Az = 0, z \ge 0 \}$

Description
===========

+----------------------------------+
|i1 : A = matrix "1,1,1,1; 1,2,3,4"|
|                                  |
|o1 = | 1 1 1 1 |                  |
|     | 1 2 3 4 |                  |
|                                  |
|              2       4           |
|o1 : Matrix ZZ  <-- ZZ            |
+----------------------------------+
|i2 : B = syz A                    |
|                                  |
|o2 = | 1  2  |                    |
|     | -2 -3 |                    |
|     | 1  0  |                    |
|     | 0  1  |                    |
|                                  |
|              4       2           |
|o2 : Matrix ZZ  <-- ZZ            |
+----------------------------------+
|i3 : rays(transpose B)            |
|                                  |
|o3 = | 0 1 2 3 |                  |
|     | 3 2 1 0 |                  |
|                                  |
|              2       4           |
|o3 : Matrix ZZ  <-- ZZ            |
+----------------------------------+

Ways to use this method:
========================

  * rays(Matrix) -- calculates the extreme rays of the
    cone; invokes "rays" from 4ti2

toBinomial -- creates a toric ideal from a given set of exponents of its generators
***********************************************************************************

Synopsis
========

  * Usage:
        toBinomial(M,R)
  * Inputs:
      * M, a matrix (Macaulay2Doc),
      * R, a ring (Macaulay2Doc), ring with as least as many
        generators as the columns of M
  * Outputs:
      * I, an ideal (Macaulay2Doc),

Description
===========

Equivalent to "output --binomials" in 4ti2. Returns the ideal in the ring R
generated by the binomials corresponding to rows of M.

+-----------------------------------+
|i1 : A = matrix "1,1,1,1; 1,2,3,4" |
|                                   |
|o1 = | 1 1 1 1 |                   |
|     | 1 2 3 4 |                   |
|                                   |
|              2       4            |
|o1 : Matrix ZZ  <-- ZZ             |
+-----------------------------------+
|i2 : B = syz A                     |
|                                   |
|o2 = | 1  2  |                     |
|     | -2 -3 |                     |
|     | 1  0  |                     |
|     | 0  1  |                     |
|                                   |
|              4       2            |
|o2 : Matrix ZZ  <-- ZZ             |
+-----------------------------------+
|i3 : R = QQ[a..d]                  |
|                                   |
|o3 = R                             |
|                                   |
|o3 : PolynomialRing                |
+-----------------------------------+
|i4 : toBinomial(transpose B,R)     |
|                                   |
|               2           3    2  |
|o4 = ideal (- b  + a*c, - b  + a d)|
|                                   |
|o4 : Ideal of R                    |
+-----------------------------------+

Ways to use toBinomial:
=======================

  * "toBinomial(Matrix,Ring)"

For the programmer
==================

The object toBinomial, is a method function (Macaulay2Doc).

toricCircuits -- calculates the circuits of the toric ideal; invokes "circuits" from 4ti2
*****************************************************************************************

Synopsis
========

  * Usage:
        toricCircuits(A)
  * Inputs:
      * A, a matrix (Macaulay2Doc), whose columns parametrize the
        toric variety. The toric ideal $I_A$ is the kernel of the map defined
        by A
  * Optional inputs (Macaulay2Doc),:
      * Precision => an integer (Macaulay2Doc), or a string (Macaulay2Doc),
        default value 64, 32, 64, or "arbitrary", the
        precision of the integers used during the computation
  * Outputs:
      * B, a matrix (Macaulay2Doc), whose rows form the circuits
        of A

Description
===========

The circuits are contained in the Graver basis of $I_A$. In fact, they are
precisely the primitive binomials in the ideal with  minimal support.

+----------------------------------+
|i1 : A = matrix "1,1,1,1; 1,2,3,4"|
|                                  |
|o1 = | 1 1 1 1 |                  |
|     | 1 2 3 4 |                  |
|                                  |
|              2       4           |
|o1 : Matrix ZZ  <-- ZZ            |
+----------------------------------+
|i2 : C = toricCircuits A          |
|                                  |
|o2 = | 0 1  -2 1 |                |
|     | 1 -2 1  0 |                |
|     | 1 0  -3 2 |                |
|     | 2 -3 0  1 |                |
|                                  |
|              4       4           |
|o2 : Matrix ZZ  <-- ZZ            |
+----------------------------------+

The ideal generated by the circuits of A in general differs from the toric
ideal of A. For example:

+-----------------------------------------------------------------------------+
|i3 : R = QQ[a..d]                                                            |
|                                                                             |
|o3 = R                                                                       |
|                                                                             |
|o3 : PolynomialRing                                                          |
+-----------------------------------------------------------------------------+
|i4 : Icircuit = toBinomial(toricCircuits(A), R) -- this is the circuit ideal |
|                                                                             |
|               2           2           3      2     3    2                   |
|o4 = ideal (- c  + b*d, - b  + a*c, - c  + a*d , - b  + a d)                 |
|                                                                             |
|o4 : Ideal of R                                                              |
|-----------------------------------------------------------------------------|
|of A                                                                         |
+-----------------------------------------------------------------------------+
|i5 : I = toBinomial(toricMarkov(A), R)                                       |
|                                                                             |
|               2           2                                                 |
|o5 = ideal (- c  + b*d, - b  + a*c, - b*c + a*d)                             |
|                                                                             |
|o5 : Ideal of R                                                              |
+-----------------------------------------------------------------------------+
|i6 : I==Icircuit                                                             |
|                                                                             |
|o6 = false                                                                   |
+-----------------------------------------------------------------------------+

The two ideals are not the same. There is a minimal generator of I which is not
a circuit:

+-----------------------------------------------+
|i7 : a*d-b*c % I -- this binomial is in I:     |
|                                               |
|o7 = 0                                         |
|                                               |
|o7 : R                                         |
+-----------------------------------------------+
|i8 : a*d-b*c % Icircuit -- but not in Icircuit:|
|                                               |
|o8 = - b*c + a*d                               |
|                                               |
|o8 : R                                         |
+-----------------------------------------------+

Ways to use toricCircuits:
==========================

  * "toricCircuits(Matrix)"

For the programmer
==================

The object toricCircuits, is a method function with options (Macaulay2Doc).

toricGraver -- calculates the Graver basis of the toric ideal; invokes "graver" from 4ti2
*****************************************************************************************

Synopsis
========

  * Usage:
        toricGraver(A) or toricGraver(A,R)
  * Inputs:
      * A, a matrix (Macaulay2Doc), whose columns parametrize the
        toric variety. The toric ideal $I_A$ is the kernel of the map defined
        by A
      * R, a ring (Macaulay2Doc), polynomial ring in which the
        toric ideal $I_A$ should live
  * Optional inputs (Macaulay2Doc),:
      * Precision => an integer (Macaulay2Doc), or a string (Macaulay2Doc),
        default value 32, 32, 64, or "gmp", the
        precision of the integers used during the computation
  * Outputs:
      * B, a matrix (Macaulay2Doc), whose rows give binomials
        that form the Graver basis of the toric ideal of A, or
      * I, an ideal (Macaulay2Doc), whose generators form the
        Graver basis for the toric ideal

Description
===========

The Graver basis for any toric ideal $I_A$ contains (properly) the union of all
reduced Groebner basis of $I_A$. Any element in the Graver basis of the ideal
is called a primitive binomial.

+----------------------------------+
|i1 : A = matrix "1,1,1,1; 1,2,3,4"|
|                                  |
|o1 = | 1 1 1 1 |                  |
|     | 1 2 3 4 |                  |
|                                  |
|              2       4           |
|o1 : Matrix ZZ  <-- ZZ            |
+----------------------------------+
|i2 : toricGraver(A)               |
|                                  |
|o2 = | 1 -2 1  0 |                |
|     | 2 -3 0  1 |                |
|     | 1 -1 -1 1 |                |
|     | 0 1  -2 1 |                |
|     | 1 0  -3 2 |                |
|                                  |
|              5       4           |
|o2 : Matrix ZZ  <-- ZZ            |
+----------------------------------+

If we prefer to store the ideal instead, we may use:

+-------------------------------------------------------------------------+
|i3 : R = QQ[a..d]                                                        |
|                                                                         |
|o3 = R                                                                   |
|                                                                         |
|o3 : PolynomialRing                                                      |
+-------------------------------------------------------------------------+
|i4 : toricGraver(A,R)                                                    |
|                                                                         |
|               2           3    2                   2           3      2 |
|o4 = ideal (- b  + a*c, - b  + a d, - b*c + a*d, - c  + b*d, - c  + a*d )|
|                                                                         |
|o4 : Ideal of R                                                          |
+-------------------------------------------------------------------------+

Note that this last ideal equals the toric ideal $I_A$ since every Graver basis
element is actually in $I_A$.

Ways to use toricGraver:
========================

  * "toricGraver(Matrix)"
  * "toricGraver(Matrix,Ring)"

For the programmer
==================

The object toricGraver, is a method function with options (Macaulay2Doc).

toricGraverDegrees -- displays the degrees of all Graver basis elements for the toric ideal I_A
***********************************************************************************************

Synopsis
========

  * Usage:
        toricGraverDegrees(A)
  * Inputs:
      * A, a matrix (Macaulay2Doc), whose columns parametrize the
        toric variety. The toric ideal $I_A$ is the kernel of the map defined
        by A
  * Optional inputs (Macaulay2Doc),:
      * Precision => an integer (Macaulay2Doc), or a string (Macaulay2Doc),
        default value 32, 32, 64, or "gmp", the
        precision of the integers used during the computation

Description
===========

Equivalent to "output --degrees foo.gra" in 4ti2. Very often the Graver basis
consists of too many binomials, and one is only interested in their degrees. In
this case, instead of looking at the Graver basis of $I_A$, we may just want to
look for the degrees of binomials which show up:

+-------------------------------------------------+
|i1 : A = matrix "1,1,1,1; 1,2,3,4"               |
|                                                 |
|o1 = | 1 1 1 1 |                                 |
|     | 1 2 3 4 |                                 |
|                                                 |
|              2       4                          |
|o1 : Matrix ZZ  <-- ZZ                           |
+-------------------------------------------------+
|i2 : toricGraver(A) -- the Graver basis          |
|                                                 |
|o2 = | 1 -2 1  0 |                               |
|     | 2 -3 0  1 |                               |
|     | 1 -1 -1 1 |                               |
|     | 0 1  -2 1 |                               |
|     | 1 0  -3 2 |                               |
|                                                 |
|              5       4                          |
|o2 : Matrix ZZ  <-- ZZ                           |
+-------------------------------------------------+
|i3 : toricGraverDegrees(A) -- just the degrees   |
|-------------------------------------------------|
|4ti2 version 1.6.10                              |
|Copyright 1998, 2002, 2006, 2015 4ti2 team.      |
|4ti2 comes with ABSOLUTELY NO WARRANTY.          |
|This is free software, and you are welcome       |
|to redistribute it under certain conditions.     |
|For details, see the file COPYING.               |
|-------------------------------------------------|
|Norm = 4,   number of elements = 3               |
|Norm = 6,   number of elements = 2               |
+-------------------------------------------------+

Note that these are all 1-norms of the vectors. Since $I_A$ is homogeneous,
there are 3 binomials of degree 2 (norm 4) and 2 binomials of degree 3 (norm
6).

Here is a more complicated example, where one may not want to see the Graver
basis elements explicitly. The toric ideal I_M is the ideal of the rational
normal scroll S(3,2,3):

+-----------------------------------------------------------------------------+
|i4 : M = matrix "1,1,1,1,1,1,1,1,1,1,1; 1,1,1,1,0,0,0,0,0,0,0;               |
|                                                                             |
|o4 = | 1 1 1 1 1 1 1 1 1 1 1 |                                               |
|     | 1 1 1 1 0 0 0 0 0 0 0 |                                               |
|     | 0 0 0 0 1 1 1 0 0 0 0 |                                               |
|     | 0 0 0 0 0 0 0 1 1 1 1 |                                               |
|     | 1 2 3 4 1 2 3 1 2 3 4 |                                               |
|                                                                             |
|              5       11                                                     |
|o4 : Matrix ZZ  <-- ZZ                                                       |
|-----------------------------------------------------------------------------|
|0,0,0,0,1,1,1,0,0,0,0; 0,0,0,0,0,0,0,1,1,1,1; 1,2,3,4,1,2,3,1,2,3,4"         |
+-----------------------------------------------------------------------------+
|i5 : toricGraverDegrees(M)                                                   |
|-------------------------------------------------                            |
|4ti2 version 1.6.10                                                          |
|Copyright 1998, 2002, 2006, 2015 4ti2 team.                                  |
|4ti2 comes with ABSOLUTELY NO WARRANTY.                                      |
|This is free software, and you are welcome                                   |
|to redistribute it under certain conditions.                                 |
|For details, see the file COPYING.                                           |
|-------------------------------------------------                            |
|Norm = 4,   number of elements = 37                                          |
|Norm = 6,   number of elements = 115                                         |
|Norm = 8,   number of elements = 76                                          |
|Norm = 10,   number of elements = 15                                         |
+-----------------------------------------------------------------------------+

Here is another example where with many Graver basis elements. The following
matrix is a design matrix for a particular statistical model for a 4-node p1
network; see Fienberg-Petrovic-Rinaldo.

+-----------------------------------------------------------------------------+
|i6 : A = matrix "1,0,1,1,0,1,1,0,1,0,0,0,0,0,0,0,0,0;0,1,1,0,0,0,0,0,0,1,0,1,|
|                                                                             |
|              9       18                                                     |
|o6 : Matrix ZZ  <-- ZZ                                                       |
|-----------------------------------------------------------------------------|
|1,0,1,0,0,0;0,0,0,0,1,1,0,0,0,0,1,1,0,0,0,1,0,1;0,0,0,0,0,0,0,1,1,0,0,0,0,1,1|
|-----------------------------------------------------------------------------|
|,0,1,1;0,1,1,0,1,1,0,1,1,0,0,0,0,0,0,0,0,0;1,0,1,0,0,0,0,0,0,0,1,1,0,1,1,0,0,|
|-----------------------------------------------------------------------------|
|0;0,0,0,1,0,1,0,0,0,1,0,1,0,0,0,0,1,1;0,0,0,0,0,0,1,0,1,0,0,0,1,0,1,1,0,1;0,0|
|-----------------------------------------------------------------------------|
|,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1";                                           |
+-----------------------------------------------------------------------------+
|i7 : toricGraverDegrees(A)                                                   |
|-------------------------------------------------                            |
|4ti2 version 1.6.10                                                          |
|Copyright 1998, 2002, 2006, 2015 4ti2 team.                                  |
|4ti2 comes with ABSOLUTELY NO WARRANTY.                                      |
|This is free software, and you are welcome                                   |
|to redistribute it under certain conditions.                                 |
|For details, see the file COPYING.                                           |
|-------------------------------------------------                            |
|Norm = 4,   number of elements = 9                                           |
|Norm = 6,   number of elements = 67                                          |
|Norm = 8,   number of elements = 378                                         |
|Norm = 10,   number of elements = 792                                        |
|Norm = 12,   number of elements = 1800                                       |
|Norm = 14,   number of elements = 1872                                       |
|Norm = 16,   number of elements = 1224                                       |
|Norm = 18,   number of elements = 792                                        |
|Norm = 20,   number of elements = 432                                        |
|Norm = 22,   number of elements = 96                                         |
+-----------------------------------------------------------------------------+

Ways to use toricGraverDegrees:
===============================

  * "toricGraverDegrees(Matrix)"

For the programmer
==================

The object toricGraverDegrees, is a method function with options (Macaulay2Doc).

toricGroebner -- calculates a Groebner basis of the toric ideal I_A, given A; invokes "groebner" from 4ti2
**********************************************************************************************************

Synopsis
========

  * Usage:
        toricGroebner(A) or toricGroebner(A,R)
  * Inputs:
      * A, a matrix (Macaulay2Doc), whose columns parametrize the
        toric variety. The toric ideal $I_A$ is the kernel of the map defined
        by A.
      * R, a ring (Macaulay2Doc), ring with as least as many
        generators as the columns of A
  * Optional inputs (Macaulay2Doc),:
      * Precision => an integer (Macaulay2Doc), or a string (Macaulay2Doc),
        default value 64, 32, 64, or "arbitrary", the
        precision of the integers used during the computation
      * Weights => ..., default value null
  * Outputs:
      * B, a matrix (Macaulay2Doc), whose rows give binomials
        that form a Groebner basis of the toric ideal of A
      * I, an ideal (Macaulay2Doc), whose generators form a
        Groebner basis for the toric ideal

Description
===========

+----------------------------------+
|i1 : A = matrix "1,1,1,1; 1,2,3,4"|
|                                  |
|o1 = | 1 1 1 1 |                  |
|     | 1 2 3 4 |                  |
|                                  |
|              2       4           |
|o1 : Matrix ZZ  <-- ZZ            |
+----------------------------------+
|i2 : toricGroebner(A)             |
|                                  |
|o2 = | -1 1  1  -1 |              |
|     | -1 2  -1 0  |              |
|     | 0  -1 2  -1 |              |
|                                  |
|              3       4           |
|o2 : Matrix ZZ  <-- ZZ            |
+----------------------------------+

Note that the output of the command is a matrix whose rows are the exponents of
the binomials that for a Groebner basis of the toric ideal $I_A$. As a
shortcut, one can ask for the output to be an ideal instead:

+------------------------------------------+
|i3 : R = QQ[a..d]                         |
|                                          |
|o3 = R                                    |
|                                          |
|o3 : PolynomialRing                       |
+------------------------------------------+
|i4 : toricGroebner(A,R)                   |
|                                          |
|                        2         2       |
|o4 = ideal (b*c - a*d, b  - a*c, c  - b*d)|
|                                          |
|o4 : Ideal of R                           |
+------------------------------------------+

4ti2 offers the use of weight vectors representing term orders, as follows:

+----------------------------------------+
|i5 : toricGroebner(A,Weights=>{1,2,3,4})|
|                                        |
|o5 = | -1 1  1  -1 |                    |
|     | -1 2  -1 0  |                    |
|     | 0  -1 2  -1 |                    |
|                                        |
|              3       4                 |
|o5 : Matrix ZZ  <-- ZZ                  |
+----------------------------------------+

Caveat
======

It seems that some versions of 4ti2 do not pick up on the weight vector. It may
be better to run gb computation in M2 directly with specified weights.

Ways to use toricGroebner:
==========================

  * "toricGroebner(Matrix)"
  * "toricGroebner(Matrix,Ring)"

For the programmer
==================

The object toricGroebner, is a method function with options (Macaulay2Doc).

toricMarkov -- calculates a generating set of the toric ideal I_A, given A; invokes "markov" from 4ti2
******************************************************************************************************

Synopsis
========

  * Usage:
        toricMarkov(A) or toricMarkov(A, InputType => "lattice") or toricMarkov(A,R)
  * Inputs:
      * A, a matrix (Macaulay2Doc), whose columns parametrize the
        toric variety; the toric ideal is the kernel of the map defined by A.
        Otherwise, if InputType is set to "lattice", the rows of A are a
        lattice basis and the toric ideal is the saturation of the lattice
        basis ideal.
      * R, a ring (Macaulay2Doc), polynomial ring in which the
        toric ideal $I_A$ should live
  * Optional inputs (Macaulay2Doc),:
      * InputType => a string (Macaulay2Doc), default value null,
        which is the string "lattice" if rows of A specify a lattice basis
      * Precision => an integer (Macaulay2Doc), or a string (Macaulay2Doc),
        default value 64, 32, 64, or "arbitrary", the
        precision of the integers used during the computation
  * Outputs:
      * B, a matrix (Macaulay2Doc), whose rows form a Markov
        Basis of the lattice $\{z : z \text{ is integral and } A z = 0\}$ or
        the lattice spanned by the rows of A if the option InputType =>
        "lattice" is used

Description
===========

Suppose we would like to comput the toric ideal defining the variety
parametrized by the following matrix:

+--------------------------------+
|i1 : A = matrix"1,1,1,1;0,1,2,3"|
|                                |
|o1 = | 1 1 1 1 |                |
|     | 0 1 2 3 |                |
|                                |
|              2       4         |
|o1 : Matrix ZZ  <-- ZZ          |
+--------------------------------+

Since there are 4 columns, the ideal will live in the polynomial ring with 4
variables.

+-----------------------+
|i2 : R = QQ[a..d]      |
|                       |
|o2 = R                 |
|                       |
|o2 : PolynomialRing    |
+-----------------------+
|i3 : M = toricMarkov(A)|
|                       |
|o3 = | 0 1  -2 1 |     |
|     | 1 -2 1  0 |     |
|     | 1 -1 -1 1 |     |
|                       |
|              3       4|
|o3 : Matrix ZZ  <-- ZZ |
+-----------------------+

Note that rows of M are the exponents of minimal generators of $I_A$.  To get
the ideal, we can do the following:

+------------------------------------------------+
|i4 : I = toBinomial(M,R)                        |
|                                                |
|               2           2                    |
|o4 = ideal (- c  + b*d, - b  + a*c, - b*c + a*d)|
|                                                |
|o4 : Ideal of R                                 |
+------------------------------------------------+

Alternately, we might wish to give a lattice basis ideal instead of the matrix
A. The lattice basis will be specified by a matrix, as follows:

+-----------------------------------------------------------------------------+
|i5 : B = syz A                                                               |
|                                                                             |
|o5 = | -1 2  |                                                               |
|     | 2  -3 |                                                               |
|     | -1 0  |                                                               |
|     | 0  1  |                                                               |
|                                                                             |
|              4       2                                                      |
|o5 : Matrix ZZ  <-- ZZ                                                       |
+-----------------------------------------------------------------------------+
|i6 : N = toricMarkov(transpose B, InputType => "lattice")                    |
|                                                                             |
|o6 = | 0 1  -2 1 |                                                           |
|     | 1 -2 1  0 |                                                           |
|     | 1 -1 -1 1 |                                                           |
|                                                                             |
|              3       4                                                      |
|o6 : Matrix ZZ  <-- ZZ                                                       |
+-----------------------------------------------------------------------------+
|i7 : J = toBinomial(N,R) -- toricMarkov(transpose B, R, InputType =>         |
|                                                                             |
|               2           2                                                 |
|o7 = ideal (- c  + b*d, - b  + a*c, - b*c + a*d)                             |
|                                                                             |
|o7 : Ideal of R                                                              |
|-----------------------------------------------------------------------------|
|"lattice")                                                                   |
+-----------------------------------------------------------------------------+

We can see that the two ideals are equal:

+-----------+
|i8 : I == J|
|           |
|o8 = true  |
+-----------+

Also, notice that instead of the sequence of commands above, we could have used
the following:

+------------------------------------------------+
|i9 : toricMarkov(A,R)                           |
|                                                |
|               2           2                    |
|o9 = ideal (- c  + b*d, - b  + a*c, - b*c + a*d)|
|                                                |
|o9 : Ideal of R                                 |
+------------------------------------------------+

Ways to use toricMarkov:
========================

  * "toricMarkov(Matrix)"
  * "toricMarkov(Matrix,Ring)"

For the programmer
==================

The object toricMarkov, is a method function with options (Macaulay2Doc).