next | previous | forward | backward | up | top | index | toc | Macaulay2 web site
FourTiTwo :: FourTiTwo

FourTiTwo -- Interface for 4ti2


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

A d×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


the map from k[s,t] to k[a,b,c,d] is given by (s,t) ↦ (s3,s2t,st2,t3).

The toric ideal IA is the kernel of this map. It is minimally generated by the 2-minors of the matrix


Given the matrix A, one can compute its lattice basis ideal specified by the integral basis of the lattice A, the toric ideal IA, 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öbner 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.


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



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.


  • Functions and commands
    • getMatrix -- reads a matrix from a 4ti2-formatted input file
    • hilbertBasis -- calculates the Hilbert basis of the cone; invokes "hilbert" from 4ti2
    • putMatrix -- writes a matrix into a file formatted for 4ti2
    • rays -- 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; equivalent to "output --binomials" in 4ti2
    • 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; equivalent to "output --degrees foo.gra" in 4ti2
    • 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
  • Symbols