% generated by GAPDoc2LaTeX from XML source (Frank Luebeck)
\documentclass[11pt]{report}
\usepackage{a4wide}
\sloppy
\pagestyle{myheadings}
\usepackage{amssymb}
\usepackage[latin1]{inputenc}
\usepackage{makeidx}
\makeindex
\usepackage{color}
\definecolor{DarkOlive}{rgb}{0.1047,0.2412,0.0064}
\definecolor{FireBrick}{rgb}{0.5812,0.0074,0.0083}
\definecolor{RoyalBlue}{rgb}{0.0236,0.0894,0.6179}
\definecolor{RoyalGreen}{rgb}{0.0236,0.6179,0.0894}
\definecolor{RoyalRed}{rgb}{0.6179,0.0236,0.0894}
\definecolor{LightBlue}{rgb}{0.8544,0.9511,1.0000}
\definecolor{Black}{rgb}{0.0,0.0,0.0}
\definecolor{FuncColor}{rgb}{1.0,0.0,0.0}
%% strange name because of pdflatex bug:
\definecolor{Chapter }{rgb}{0.0,0.0,1.0}

\usepackage{fancyvrb}

\usepackage{pslatex}

\usepackage[
        a4paper=true,bookmarks=false,pdftitle={Written with GAPDoc},
        pdfcreator={LaTeX with hyperref package / GAPDoc},
        colorlinks=true,backref=page,breaklinks=true,linkcolor=RoyalBlue,
        citecolor=RoyalGreen,filecolor=RoyalRed,
        urlcolor=RoyalRed,pagecolor=RoyalBlue]{hyperref}

% write page numbers to a .pnr log file for online help
\newwrite\pagenrlog
\immediate\openout\pagenrlog =\jobname.pnr
\immediate\write\pagenrlog{PAGENRS := [}
\newcommand{\logpage}[1]{\protect\write\pagenrlog{#1, \thepage,}}
\newcommand{\Q}{\mathbb{Q}}
\newcommand{\R}{\mathbb{R}}
\newcommand{\C}{\mathbb{C}}
\newcommand{\Z}{\mathbb{Z}}
\newcommand{\N}{\mathbb{N}}
\newcommand{\F}{\mathbb{F}}

\newcommand{\GAP}{\textsf{GAP}}

\newsavebox{\backslashbox}
\sbox{\backslashbox}{\texttt{\symbol{92}}}
\newcommand{\bs}{\usebox{\backslashbox}}

\begin{document}

\logpage{[ 0, 0, 0 ]}
\begin{titlepage}
\begin{center}{\Huge \textbf{ \textsf{Toric} }}\\[1cm]
\hypersetup{pdftitle= \textsf{Toric} }
\markright{\scriptsize \mbox{}\hfill  \textsf{Toric}  \hfill\mbox{}}
{\Large \textbf{  A \textsf{GAP}4 Package for computing with toric varieties ~ }}\\[1cm]
{Version 1.3}\\[1cm]
{March 7, 2006}\\[1cm]
\mbox{}\\[2cm]
{\large \textbf{ David Joyner\\
  ~    }}\\
\hypersetup{pdfauthor= David Joyner\\
  ~    }
\end{center}\vfill

\mbox{}\\
{\mbox{}\\
\small \noindent \textbf{ David Joyner\\
  ~    } --- Email: \href{mailto:// wdj@usna.edu}{\texttt{ wdj@usna.edu}}\\
 --- Homepage: \href{http://cadigweb.ew.usna.edu/~wdj/toric/}{\texttt{http://cadigweb.ew.usna.edu/\~{}wdj/toric/}}\\
 --- Address: \begin{minipage}[t]{8cm}\noindent
 Mathematics Department,\\
 U. S. Naval Academy,\\
 Annapolis, MD,\\
 21402 USA. \end{minipage}
}\\
\end{titlepage}

\newpage\setcounter{page}{2}
{\small 
\section*{Copyright}
\logpage{[ 0, 0, 1 ]}
  {\copyright} 2004-2005 David Joyner. }\\[1cm]
{\small 
\section*{Acknowledgements}
\logpage{[ 0, 0, 2 ]}
  

 The code for the \textsf{toric} package was written during the summer of 2002. It was put into \textsf{GAP} package format in the summer of 2004. \textsf{toric} is released under the GNU General Public License (GPL). This file is part of \textsf{toric}, though as documentation it is released under the GNU Free Documentation
License (see \href{http://www.gnu.org/licenses/licenses.html#FDL}{\texttt{http://www.gnu.org/licenses/licenses.html\#FDL}}). 

 \textsf{toric} is free software; you can redistribute it and/or modify it under the terms of
the GNU General Public License as published by the Free Software Foundation;
either version 2 of the License, or (at your option) any later version. 

 \textsf{toric} is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE. See the GNU General Public License for more details. 

 You should have received a copy of the GNU General Public License along with \textsf{toric}; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite
330, Boston, MA 02111-1307 USA 

 For more details, see \href{http://www.fsf.org/licenses/gpl.html}{\texttt{http://www.fsf.org/licenses/gpl.html}}. 

 

This documentation was prepared with the \textsf{GAPDoc} package of Frank L\"ubeck and Max Neunh\"offer. }\\[1cm]
\newpage

\def\contentsname{Contents\logpage{[ 0, 0, 3 ]}}

\tableofcontents
\newpage

  
\chapter{\textcolor{Chapter }{Introduction}}\logpage{[ 1, 0, 0 ]}
{
 
\section{\textcolor{Chapter }{Introduction to the \textsf{toric} package}}\logpage{[ 1, 1, 0 ]}
{
  

 This manual describes the \textsf{toric} package for working with toric varieties in \textsf{GAP}. Toric varieties can be dealt with more easily than general varieties since
often times questions about a toric variety can be reformulated in terms of
combinatorial geometry. Some coding theory commands related to toric varities
are contained in the error-correcting codes \textsf{GUAVA} package (for example, the command \texttt{ToricCode}). We refer to the \textsf{GUAVA} manual \cite{Gua05} and the expository paper \cite{JV02} for more details. 

 The \textsf{toric} package also contains several commands unrelated to toric varieties (mostly
for list manipulations). These will not be described in this documention but
they are briefly documented in the \texttt{lib/util.gd} file. 

 \textsf{toric} is implemented in the \textsf{GAP} language, and runs on any system supporting \textsf{GAP}4.3 and above. The \textsf{toric} package is loaded with the command 
\begin{verbatim}   gap> LoadPackage( "toric" ); 
\end{verbatim}
 

 Please send bug reports, suggestions and other comments about \textsf{toric} to \href{mailto://support@gap-system.org}{\texttt{support@gap-system.org}}. }

 
\section{\textcolor{Chapter }{Introduction to constructing toric varieties}}\logpage{[ 1, 2, 0 ]}
{
  Rather than sketch the theory of toric varieties, we refer to \cite{JV02} and \cite{F93} for details. However, we briefly describe some terminology and notation. 
\subsection{\textcolor{Chapter }{Generalities}}\logpage{[ 1, 2, 1 ]}
{
  Let $F$ denote a field and $R=F [x_1,...,x_n]$ be a ring in $n$ variables. A \textsc{binomial equation} in $R$ is one of the form 
\[ x_1^{k_1}...x_n^{k_n}=x_1^{\ell_1}...x_n^{\ell_n}, \]
 where $k_i \geq 0,\ \ell_j \geq 0$ are integers. A binomial variety is a subvariety of affine $n$-space $A_F^n$ defined by a finite set of binomial equations (such a variety need not be
normal). A typical ``toric variety'' is binomial, though they will be
introduced via an \emph{a priori} independent construction. The basic idea of the construction is to replace
each such binomial equation as above by a relation in a semigroup contained in
a lattice and replace $R$ by the ``group algebra'' of this semigroup. By the way, a toric variety is
always normal (see for example, \cite{F93}, page 29). }

 
\subsection{\textcolor{Chapter }{Basic combinatorial geometry constructions}}\logpage{[ 1, 2, 2 ]}
{
  Let $Q$ denote the field of rational numbers and $Z$ denote the set of integers. Let $n>1$ denote an integer. 

 Let $V=Q^n$ having basis $f_1=(1,0,...,0)$, ..., $f_n=(0,...,0,1)$. Let $L_0=Z^n\subset V$ be the standard lattice in $V$. We identify $V$ and $L_0\otimes_{Z} Q$. We use $\langle\ ,\ \rangle$ to denote the (standard) inner product on $V$. Let 
\[ L_0^*={\rm Hom}(L_0,Z)=\{ v\in V\ |\ \langle v,w \rangle \in Z, \ \forall w\in
L_0\} \]
 denote the \textsc{dual lattice}, so (fixing the standard basis $e_1^*$,...,$e_n^*$ dual to the $f_1$,...,$f_n$) $L_0^*$ may be identified with $Z^n$. 

 A \textsc{cone} in $V$ is a set $\sigma$ of the form 
\[ \sigma=\{a_1v_1+...+a_mv_m\ |\ a_i\geq 0\}\subset V, \]
 where $v_1,...,v_m \in V$ is a given collection of vectors, called (semigroup) \textsc{generators} of $\sigma$. A \textsc{rational cone} is one where $v_1,...,v_m \in L_0$. A \textsc{strongly convex} cone is one which contains no lines through the origin. 

 \emph{ By abuse of terminology, from now on a \textsc{cone} of $L_0$ is a strongly convex rational cone. } \index{cone} 

 A \textsc{face} of a cone $\sigma$ is either $\sigma$ itself or a subset of the form $H\cap \sigma$, where $H$ is a codimension one subspace of $V$ which intersects the cone non-trivially and such that the cone is contained in
exactly one of the two half-spaces determined by $H$. A \textsc{ray} (or edge) of a cone is a one-dimensional face. \index{ray} Typically, cones are represented in \textsf{toric} by the list of vectors defining their rays. The \textsc{dimension} of a cone is the dimension of the vector space it spans. The \textsf{toric} package can test if a given vector is in a given cone (see \texttt{InsideCone}). 

 If $\sigma$ is a cone then the \textsc{dual cone} is defined by 
\[ \sigma^* =\{w \in L_0^*\otimes Q \ |\ \langle v,w \rangle \geq 0,\ \forall
v\in \sigma\}. \]
 The \textsf{toric} package can test if a vector is in the dual of a given cone (see \texttt{InDualCone}). \index{dual cone} 

 Associate to the dual cone $\sigma^*$ is the semigroup 
\[ S_\sigma =\sigma^*\cap L_0^* =\{w\in L_0^* \ |\ \langle v,w\rangle \geq 0,\
\forall v\in \sigma\}. \]
 Though $L_0^*$ has $n$ generators \emph{as a lattice}, typically $S_\sigma$ will have more than $n$ generators \emph{as a semigroup}. The \textsf{toric} package can compute a minimal list of semigroup generators of $S_\sigma$ (see \texttt{DualSemigroupGenerators}). \index{semigroup associated to cone} 

 A fan is a collection of cones which ``fit together'' well. A \textsc{fan} in $L_0$ is a set $\Delta=\{\sigma \}$ of rational strongly convex cones in $V= L_0 \otimes Q$ such that 
\begin{itemize}
\item  if $\sigma \in \Delta$ and $\tau \subset \sigma$ is a face of $\sigma$ then $\tau \in \Delta$, 
\item  if $\sigma_1, \sigma_2 \in \Delta$ then the intersection $\sigma_1 \cap \sigma_2$ is a face of both $\sigma_1$ and $\sigma_2$ (and hence belongs to $\Delta$). 
\end{itemize}
 In particular, the face of a cone in a fan is a cone is the fan. 

 If $V$ is the (set-theoretic) union of the cones in $\Delta$ then we call the fan \textsc{complete}. We shall assume that all fans are finite. A fan is determined by its list of
maximal cones. \index{fan} 

 \emph{Notation}: A fan $\Delta$ is represented in \textsf{toric} as a set of maximal cones. For example, if $\Delta$ is the fan with maximal cones $\sigma_1=Q_+\cdot f_1+Q_+\cdot (-f_1+f_2)$, $\sigma_2=Q_+\cdot (-f_1+f_2)+Q_+\cdot (-f_1-f_2)$, $\sigma_3=Q_+\cdot (-f_1-f_2)+Q_+\cdot f_1$, then $\Delta$ is represented by $[[[1,0],[-1,1]],[[-1,1],[-1,-1]],[[-1,-1],[1,0]]]$. 

 The \textsf{toric} package can compute all cones in a fan of a given dimension (see \texttt{ConesOfFan}). Moreover, \textsf{toric} can compute the set of all normal vectors to the faces (i.e., hyperplanes) of
a cone (see \texttt{Faces}). 

 The \textsc{star} of a cone $\sigma$ in a fan $\Delta$ is the set $\Delta_\sigma$ of cones in $\Delta$ containing $\sigma$ as a face. The \textsf{toric} package can compute stars (see \texttt{ToricStar}). \index{star} 

 }

 
\subsection{\textcolor{Chapter }{Basic affine toric variety constructions}}\logpage{[ 1, 2, 3 ]}
{
  Let 
\[ R_\sigma = F [S_\sigma] \]
 denote the ``group algebra'' of this semigroup. It is a finitely generated
commutative F-algebra. It is in fact integrally closed (\cite{F93}, page 29). We may interprete $R_\sigma$ as a subring of $R=F [x_1,...,x_n]$ as follows: First, identify each $e_i^*$ with the variable $x_i$. If $S_\sigma$ is generated as a semigroup by vectors of the form $\ell_1 e_1^*+...+\ell_n e_n^*$, where $\ell_i$ is an integer, then its image in $R$ is generated by monomials of the form $x_1^{\ell_1}\dots x_n^{\ell_n}$. The \textsf{toric} package can compute these generating monomials (see \texttt{EmbeddingAffineToricVariety}). See Lemma 2.14 in \cite{JV02} for more details. This embedding can also be used to resolve singularities -
see section 5 of \cite{JV02} for more details. 

 Let 
\[ U_\sigma={\rm Spec}\ R_\sigma. \]
 This defines an \textsc{affine toric variety} (associated to $\sigma$). It is known that the coordinate ring $R_\sigma$ of the affine toric variety $U_\sigma$ has the form $R_\sigma = F[x_1,...,x_n]/J$, where $J$ is an ideal. The \textsf{toric} package can compute generators of this ideal (see \texttt{IdealAffineToricVariety}). \index{affine toric variety} 

 Roughly speaking, the toric variety $X(\Delta)$ associated to the fan $\Delta$ is given by a collection of affine pieces
$U_{\sigma_1},U_{\sigma_2},\dots,U_{\sigma_d}$ which ``glue'' together (where $\Delta = \{\sigma_i\}$). The affine pieces are given by the zero sets of polynomial equations in
some affine spaces and the gluings are given by maps $\phi_{i,j} : U_{\sigma_i} \rightarrow U_{\sigma_j}$ which are defined by ratios of polynomials on open subsets of the
$U_{\sigma_i}$. The \textsf{toric} package does \emph{not} compute these gluings or work directly with these (non-affine) varieties $X(\Delta)$. 

 A cone $\sigma \subset V$ is said to be \textsc{nonsingular} if it is generated by part of a basis for the lattice $L_0$. A fan $\Delta$ of cones is said to be \textsc{nonsingular} if all its cones are nonsingular. It is known that $U_\sigma$ is nonsingular if and only if $\sigma$ is nonsingular (Proposition 2.1 in \cite{F93}). \index{cone, nonsingular} 

 \textsc{Example:} In three dimensions, consider the cones $\sigma_{\epsilon_1,\epsilon_2,\epsilon_3,i,j}$ generated by $(\epsilon_1\cdot 1,\epsilon_2\cdot 1,\epsilon_3\cdot 1)$ and the standard basis vectors $f_i,f_j$, where $\epsilon_i=\pm 1$ and $1\leq i\not= j\leq 3$. There are 8 cones per octant, for a total of 64 cones. Let $\Delta$ denote the fan in $V=Q^3$ determined by these maximal cones. The toric variety $X(\Delta)$ is nonsingular. 

 }

 
\subsection{\textcolor{Chapter }{Riemann-Roch spaces and related constructions}}\logpage{[ 1, 2, 4 ]}
{
  Although the \textsf{toric} package does not work directly with the toric varieties $X(\Delta)$, it can compute objects associated with it. For example, it can compute the
Euler characteristic (see \texttt{EulerCharacteristic}), Betti numbers (see \texttt{BettiNumberToric}), and the number of GF(q)-rational points (see \texttt{CardinalityOfToricVariety}) of $X(\Delta)$, \emph{ provided $\Delta$ is nonsingular.} 

 For an algebraic variety $X$ the group of \textsc{Weil divisors} on $X$ is the abelian group $Div(X)$ generated (additively) by the irreducible subvarieties of X of codimension $1$. For a toric variety $X(\Delta)$ with dense open torus $T$, a Weil divisor D is \textsc{T-invariant} if $D=T\cdot D$. The group of $T$-invariant Weil divisors is denoted $TDiv(X)$. This is finitely generated by an explicitly given finite set of divisors $\{D_1,...,D_r\}$ which correspond naturally to certain cones in $\Delta$ (see \cite{F93} for details). In particular, we may represent such a divisor $D$ in $TDiv(X)$ by an $k$-tuple $(d_1,...,d_k)$ of integers. \index{Weil divisors} 

 Let $\Delta$ denote a fan in $V=Q^n$ with rays (or edges) $\tau_i$, $1\leq i\leq k$, and let $v_i$ denote the first lattice point on $\tau_i$. Associated to the T-invariant Weil divisor $D=d_1D_1+...+d_kD_k$, is the \textsc{polytope} 
\[ P_D = \{ x=(x_1,...,x_n)\ |\ \langle x,v_i \rangle \geq -d_i, \ \forall 1 \leq
i \leq k\}. \]
 The \textsf{toric} package can compute $P_D$ (see \texttt{DivisorPolytope}), as well as the set of all lattice points contained in this polytope (see \texttt{DivisorPolytopeLatticePoints}). Also associated to the $T$-invariant Weil divisor $D=d_1D_1+...+d_kD_k$, is the Riemann-Roch space, $L(D)$. This is a space of functions on $X(\Delta)$ whose zeros and poles are ``controlled'' by $D$ (for a more precise definition, see \cite{F93}). The \textsf{toric} package can compute a basis for $L(D)$ (see \texttt{RiemannRochBasis}), \emph{ provided $\Delta$ is complete and nonsingular.} \index{polytope associated to divisor} }

 }

 }

 
\chapter{\textcolor{Chapter }{Cones and semigroups}}\logpage{[ 2, 0, 0 ]}
{
  
\section{\textcolor{Chapter }{Cones}}\logpage{[ 2, 1, 0 ]}
{
  This section introduces the \textsf{toric} commands which deal with cones and related combinatorial-geometric objects.
Recall, a \textsc{cone} is a strongly convex polyhedral cone (\cite{F93}, page 4). 

\subsection{\textcolor{Chapter }{InsideCone}}
\logpage{[ 2, 1, 1 ]}\nobreak
{\noindent\textcolor{FuncColor}{$\Diamond$\ \texttt{InsideCone( v, L )\index{InsideCone@\texttt{InsideCone}}
\label{InsideCone}
}\hfill{\scriptsize (function)}}\\


 This command returns `true` if the vector \mbox{\texttt{v}} belongs to the interior of the (strongly convex polyhedral) cone generated by
the vectors in \mbox{\texttt{L}}. }

 This procedure does not check if \mbox{\texttt{L}} generates a strongly convex polyhedral cone. 
\begin{Verbatim}[fontsize=\small,frame=single,label=Example]
  gap> L:=[[1,0,0],[1,1,0],[1,1,1],[1,0,1]];; v:=[0,0,1];;
  gap> InsideCone(v,L);
  false
  gap> L:=[[1,0],[3,4]];;
  gap> v:=[1,-7]; InsideCone(v,L);
  [ 1, -7 ]
  false
  gap> v:=[4,-3]; InsideCone(v,L);
  [ 4, -3 ]
  false
  gap> v:=[4,-4]; InsideCone(v,L);
  [ 4, -4 ]
  false
  gap> v:=[4,1]; InsideCone(v,L);
  [ 4, 1 ]
  true
\end{Verbatim}
  

\subsection{\textcolor{Chapter }{InDualCone}}
\logpage{[ 2, 1, 2 ]}\nobreak
{\noindent\textcolor{FuncColor}{$\Diamond$\ \texttt{InDualCone( v, L )\index{InDualCone@\texttt{InDualCone}}
\label{InDualCone}
}\hfill{\scriptsize (function)}}\\


 This command returns `true` if \mbox{\texttt{v}} belongs to the dual of the cone generated by the vectors in \mbox{\texttt{L}}. }

 
\begin{Verbatim}[fontsize=\small,frame=single,label=Example]
  gap> L:=[[1,0,0],[1,1,0],[1,1,1],[1,0,1]];; v:=[0,0,1];;
  gap> InDualCone(v,L);
  true
  gap> L:=[[1,0],[3,4]];
  [ [ 1, 0 ], [ 3, 4 ] ]
  gap> v:=[1,-7]; InDualCone(v,L);
  [ 1, -7 ]
  false
  gap> v:=[4,-3]; InDualCone(v,L);
  [ 4, -3 ]
  true
  gap> v:=[4,-4]; InDualCone(v,L);
  [ 4, -4 ]
  false
  gap> v:=[4,1]; InDualCone(v,L);
  [ 4, 1 ]
  true
\end{Verbatim}
  

\subsection{\textcolor{Chapter }{PolytopeLatticePoints}}
\logpage{[ 2, 1, 3 ]}\nobreak
{\noindent\textcolor{FuncColor}{$\Diamond$\ \texttt{PolytopeLatticePoints( A, Perps )\index{PolytopeLatticePoints@\texttt{PolytopeLatticePoints}}
\label{PolytopeLatticePoints}
}\hfill{\scriptsize (function)}}\\


 \emph{Input}: \mbox{\texttt{Perps}}$=[v_1,...,v_k]$ is the list of ``inward normal" vectors perpendicular to the walls of a
polytope $P$ in the vector space $L_0^*\otimes Q$, \mbox{\texttt{A}}$=[a_1,...,a_k]$ is a k-tuple of integers, where $a_i$ denotes the amount the i-th ``wall" (defined by the normal $v_i$) is shifted from the origin (each $a_i$ is assumed non-negative). \\
 For example, the polytope $P$ with faces \texttt{[x=0, x=a, y=0, y=b]} has \mbox{\texttt{Perps}}$=[[1,0],[-1,0],[0,1],[0,-1]]$ and \mbox{\texttt{A}}$=[0,a,0,b]$. \\
 \emph{Output}: the list of points in $P \cap L_0^*$. }

 
\begin{Verbatim}[fontsize=\small,frame=single,label=Example]
  gap> Perps:=[[1,0],[-1,0],[0,1],[0,-1]];
  [ [ 1, 0 ], [ -1, 0 ], [ 0, 1 ], [ 0, -1 ] ]
  gap> A:=[0,4,0,3];
  [ 0, 4, 0, 3 ]
  gap> PolytopeLatticePoints(A,Perps);
  [ [ 0, 0 ], [ 0, 1 ], [ 0, 2 ], [ 0, 3 ], [ 1, 0 ], [ 1, 1 ], [ 1, 2 ],
    [ 1, 3 ], [ 2, 0 ], [ 2, 1 ], [ 2, 2 ], [ 2, 3 ], [ 3, 0 ], [ 3, 1 ],
    [ 3, 2 ], [ 3, 3 ], [ 4, 0 ], [ 4, 1 ], [ 4, 2 ], [ 4, 3 ] ]
  gap> Length(last);
  20
\end{Verbatim}
  

\subsection{\textcolor{Chapter }{Faces}}
\logpage{[ 2, 1, 4 ]}\nobreak
{\noindent\textcolor{FuncColor}{$\Diamond$\ \texttt{Faces( Rays )\index{Faces@\texttt{Faces}}
\label{Faces}
}\hfill{\scriptsize (function)}}\\


 \emph{Input}: \mbox{\texttt{Rays}} is a list of rays for the fan $\Delta$ \\
 \emph{Output}: All the normals to the faces (hyperplanes of the cone). }

 
\begin{Verbatim}[fontsize=\small,frame=single,label=Example]
  gap> Cones1:=[[[2,-1],[-1,2]],[[-1,2],[-1,-1]],[[-1,-1],[2,-1]]];;
  gap> Faces(Cones1[1]);
  [ [ 1/2, 1 ], [ 2, 1 ] ]
  gap> Faces(Cones1[2]);
  [ [ -2, -1 ], [ -1, 1 ] ]
  gap> Cones2:=[[[ 2,0,0],[0,2,0],[0,0,2]], [[2,0,0], [0,2,0], [2,-2,1],[1,2,-2]]];;
  gap> Faces(Cones2[1]);
  [ [ 0, 0, 1 ], [ 0, 1, 0 ], [ 1, 0, 0 ] ]
  gap> Faces(Cones2[2]);
  [ [ 1/3, 5/6, 1 ], [ 1/2, 0, -1 ], [ 2, 0, 1 ] ]
  gap>
\end{Verbatim}
  

\subsection{\textcolor{Chapter }{ConesOfFan}}
\logpage{[ 2, 1, 5 ]}\nobreak
{\noindent\textcolor{FuncColor}{$\Diamond$\ \texttt{ConesOfFan( Delta, k )\index{ConesOfFan@\texttt{ConesOfFan}}
\label{ConesOfFan}
}\hfill{\scriptsize (function)}}\\


 \emph{Input}: \mbox{\texttt{Delta}} is the fan of cones and \mbox{\texttt{k}} is the dimension of the cones included. \\
 \emph{Output}: The \mbox{\texttt{k}}-dimensional cones in the fan. }

 

\subsection{\textcolor{Chapter }{NumberOfConesOfFan}}
\logpage{[ 2, 1, 6 ]}\nobreak
{\noindent\textcolor{FuncColor}{$\Diamond$\ \texttt{NumberOfConesOfFan( Delta, k )\index{NumberOfConesOfFan@\texttt{NumberOfConesOfFan}}
\label{NumberOfConesOfFan}
}\hfill{\scriptsize (function)}}\\


 \emph{Input}: \mbox{\texttt{Delta}} is the fan of cones in $V=Q^n$and \mbox{\texttt{k}} is the dimension of the cones counted. \\
 \emph{Output}: The number of \mbox{\texttt{k}}-dimensional cones in the fan. }

 Idea: The fan \mbox{\texttt{Delta}} is represented as a set of maximal cones. For each maximal cone, look at the \mbox{\texttt{k}}-dimensional faces obtained by taking $n$ choose \mbox{\texttt{k}} subsets of the rays describing the cone. Certain of these \mbox{\texttt{k}}-subsets yield the desired cones. 
\begin{Verbatim}[fontsize=\small,frame=single,label=Example]
  gap> Delta0:=[ [ [2,0,0],[0,2,0],[0,0,2] ], [ [2,0,0],[0,2,0],[2,-2,1],[1,2,-2] ] ];;
  gap>
  gap> NumberOfConesOfFan(Delta0,2);
  6
  gap> ConesOfFan(Delta0,2);
  [ [ [ 0, 0, 2 ], [ 0, 2, 0 ] ], [ [ 0, 0, 2 ], [ 2, 0, 0 ] ], 
    [ [ 0, 2, 0 ], [ 1, 2, -2 ] ], [ [ 0, 2, 0 ], [ 2, -2, 1 ] ],
    [ [ 0, 2, 0 ], [ 2, 0, 0 ] ], [ [ 1, 2, -2 ], [ 2, -2, 1 ] ] ]
  gap> ConesOfFan(Delta0,1);
  [ [ [ 0, 0, 2 ] ], [ [ 0, 2, 0 ] ], [ [ 1, 2, -2 ] ], 
    [ [ 2, -2, 1 ] ], [ [ 2, 0, 0 ] ] ]
  gap> NumberOfConesOfFan(Delta0,1);
  5
  
\end{Verbatim}
  

\subsection{\textcolor{Chapter }{ToricStar}}
\logpage{[ 2, 1, 7 ]}\nobreak
{\noindent\textcolor{FuncColor}{$\Diamond$\ \texttt{ToricStar( sigma, MaxCones )\index{ToricStar@\texttt{ToricStar}}
\label{ToricStar}
}\hfill{\scriptsize (function)}}\\


 This command computes the star of the cone $\sigma$ in a fan i.e., the cones $\tau$ which have $\sigma$ as a face. The fan is represented by its set of maximal (i.e., highest
dimensional) cones. }

 
\begin{Verbatim}[fontsize=\small,frame=single,label=Example]
  gap> MaxCones:=[ [ [2,0,0],[0,2,0],[0,0,2] ], 
                   [ [2,0,0],[0,2,0],[2,-2,1],[1,2,-2] ] ];;
  gap> #this is the set of maximal cones in the fan Delta
  gap> ToricStar([[1,0]],MaxCones);
  [  ]
  gap> ToricStar([[2,0,0],[0,2,0]],MaxCones);
  [ [ [ 0, 2, 0 ], [ 2, 0, 0 ] ], [ [ 2, 0, 0 ], [ 0, 2, 0 ], [ 0, 0, 2 ] ],
    [ [ 2, 0, 0 ], [ 0, 2, 0 ], [ 2, -2, 1 ], [ 1, 2, -2 ] ] ]
  gap>
  gap> MaxCones:=[ [ [2,0,0],[0,2,0],[0,0,2] ], [ [2,0,0],[0,2,0],[1,1,-2] ] ];;
  gap> ToricStar([[2,0,0],[0,2,0]],MaxCones);
  [ [ [ 0, 2, 0 ], [ 2, 0, 0 ] ], [ [ 2, 0, 0 ], [ 0, 2, 0 ], [ 0, 0, 2 ] ],
    [ [ 2, 0, 0 ], [ 0, 2, 0 ], [ 1, 1, -2 ] ] ]
  gap> ToricStar([[1,0]],MaxCones);
  [  ]
  
\end{Verbatim}
  }

 
\section{\textcolor{Chapter }{Semigroups}}\logpage{[ 2, 2, 0 ]}
{
  

\subsection{\textcolor{Chapter }{DualSemigroupGenerators}}
\logpage{[ 2, 2, 1 ]}\nobreak
{\noindent\textcolor{FuncColor}{$\Diamond$\ \texttt{DualSemigroupGenerators( L )\index{DualSemigroupGenerators@\texttt{DualSemigroupGenerators}}
\label{DualSemigroupGenerators}
}\hfill{\scriptsize (function)}}\\


 \emph{Input}: \mbox{\texttt{L}} is a list of integral $n$-vectors generating a cone $\sigma$. \\
 \emph{Output}: the generators of $S_\sigma$, 

 Idea: let $M$ be the maximum of the absolute values of the coordinates of the \mbox{\texttt{L}}[i]'s, for each vector $v$ in $[1..M]^n$, test if $v$ is in the dual cone $\sigma^*$. If so, add $v$ to list of possible generators. Once this for loop is finished, one can check
this list for redundant generators. The trick is to simply omit those elements
which are of the form $d_1+d_2$, where $d_1$ and $d_2$ are ``small" elements in the integral dual cone. 

 This program is not very efficient and should not be used in ``large
examples'' involving semigroups with ``many'' generators. For example, if you
take \mbox{\texttt{L:=[[1,2,3,4],[0,1,0,7],[3,1,0,2],[0,0,1,0]];}} then \texttt{DualSemigroupGenerators(L);} can exhaust GAP's memory allocation. }

 
\begin{Verbatim}[fontsize=\small,frame=single,label=Example]
  gap> L:=[[1,0],[3,4]];; DualSemigroupGenerators([[1,0],[3,4]]);
  [ [ 0, 0 ], [ 0, 1 ], [ 1, 0 ], [ 2, -1 ], [ 3, -2 ], [ 4, -3 ] ]
  gap> L:=[[1,0,0],[1,1,0],[1,1,1],[1,0,1]];;
  gap> DualSemigroupGenerators(L);
  [ [ 0, 0, 0 ], [ 0, 0, 1 ], [ 0, 1, 0 ], [ 1, -1, 0 ], [ 1, 0, -1 ] ]
  gap>
\end{Verbatim}
  }

 }

 
\chapter{\textcolor{Chapter }{Affine toric varieties}}\logpage{[ 3, 0, 0 ]}
{
  This chapter concerns \textsf{toric} commands which deal with the coordinate rings of affine toric varieties $U_\sigma$. 
\section{\textcolor{Chapter }{Ideals defining affine toric varieties}}\logpage{[ 3, 1, 0 ]}
{
  

\subsection{\textcolor{Chapter }{IdealAffineToricVariety}}
\logpage{[ 3, 1, 1 ]}\nobreak
{\noindent\textcolor{FuncColor}{$\Diamond$\ \texttt{IdealAffineToricVariety( L )\index{IdealAffineToricVariety@\texttt{IdealAffineToricVariety}}
\label{IdealAffineToricVariety}
}\hfill{\scriptsize (function)}}\\


 \emph{Input}: \mbox{\texttt{L}} is a list generating a cone (as in \texttt{DualSemigroupGenerators}). \\
 \emph{Output}: the \textsf{GAP} ideal defining the toric variety associated to the cone generated by the
vectors in \mbox{\texttt{L}}. 

 This computation is not very efficient and should not be used for ideals with
many generators. For example, if you take \mbox{\texttt{L:=[[1,2,3,4],[0,1,0,7],[3,1,0,2],[0,0,1,0]];}} then \texttt{IdealAffineToricVariety(L);} can exhaust GAP's memory allocation. }

 
\begin{Verbatim}[fontsize=\small,frame=single,label=Example]
  gap> J:=IdealAffineToricVariety([[1,0],[3,4]]);
  [ two-sided ideal in PolynomialRing(..., [ x_1, x_2 ]), (3 generators) ]
  gap> GeneratorsOfIdeal(J);
  [ -x_2^2+x_1, -x_2^3+x_1^2, -x_2^4+x_1^3 ]
\end{Verbatim}
 

\subsection{\textcolor{Chapter }{EmbeddingAffineToricVariety}}
\logpage{[ 3, 1, 2 ]}\nobreak
{\noindent\textcolor{FuncColor}{$\Diamond$\ \texttt{EmbeddingAffineToricVariety( L )\index{EmbeddingAffineToricVariety@\texttt{EmbeddingAffineToricVariety}}
\label{EmbeddingAffineToricVariety}
}\hfill{\scriptsize (function)}}\\


 \emph{Input}: \mbox{\texttt{L}} is a list generating a cone (as in \texttt{DualSemigroupGenerators}). \\
 \emph{Output}: the toroidal embedding of $X=Spec$(\texttt{IdealAffineToricVariety(L)}) (given as a list of multinomials). }

 
\begin{Verbatim}[fontsize=\small,frame=single,label=Example]
  gap> phi:=EmbeddingAffineToricVariety([[1,0],[3,4]]);
  [ x_2, x_1, x_1^2/x_4, x_1^3/x_4^2, x_1^4/x_4^3 ]
  gap> L:=[[1,0,0],[1,1,0],[1,1,1],[1,0,1]];;
  gap> phi:=EmbeddingAffineToricVariety(L);
  [ x_3, x_2, x_1/x_5, x_1/x_6 ]
  
\end{Verbatim}
 }

 }

 
\chapter{\textcolor{Chapter }{Toric varieties $X(\Delta)$ }}\logpage{[ 4, 0, 0 ]}
{
  This chapter concerns \textsf{toric} commands which deal with certain objects associated to the (non-affine) toric
varieties $X(\Delta)$. 
\section{\textcolor{Chapter }{Riemann-Roch spaces}}\logpage{[ 4, 1, 0 ]}
{
  Let $\Delta$ denote a complete nonsingular fan. 

\subsection{\textcolor{Chapter }{DivisorPolytope}}
\logpage{[ 4, 1, 1 ]}\nobreak
{\noindent\textcolor{FuncColor}{$\Diamond$\ \texttt{DivisorPolytope( D, Rays )\index{DivisorPolytope@\texttt{DivisorPolytope}}
\label{DivisorPolytope}
}\hfill{\scriptsize (function)}}\\


 \emph{Input}: \mbox{\texttt{Rays}} is the list of smallest integer vectors in the rays for the fan $\Delta$ which determine the Weil divisors of $X(\Delta)$. \\
 \mbox{\texttt{D}} is the list of coefficients for the a Weil divisor. \\
 \emph{Output}: the linear expressions in the affine coordinates of the space of the cone
which must be positive for a point to be in the desired polytope. }

 
\begin{Verbatim}[fontsize=\small,frame=single,label=Example]
  gap> DivisorPolytope([6,6,0],[[2,-1],[-1,2],[-1,-1]]);
  [ 2*x_1-x_2+6, -x_1+2*x_2+6, -x_1-x_2 ]
  
\end{Verbatim}
 See also Example 6.13 in \cite{JV02}. 

\subsection{\textcolor{Chapter }{DivisorPolytopeLatticePoints}}
\logpage{[ 4, 1, 2 ]}\nobreak
{\noindent\textcolor{FuncColor}{$\Diamond$\ \texttt{DivisorPolytopeLatticePoints( D, Delta, Rays )\index{DivisorPolytopeLatticePoints@\texttt{DivisorPolytopeLatticePoints}}
\label{DivisorPolytopeLatticePoints}
}\hfill{\scriptsize (function)}}\\


 \emph{Input}: \mbox{\texttt{Delta}} is the fan \\
 \mbox{\texttt{Rays}} is the \emph{ordered} list of rays for \mbox{\texttt{Delta}} \\
 \mbox{\texttt{D}} is the list of coefficients for a Weil divisor. \\
 \emph{Output}: the list of points in $P_D \cap L_0^*$ which parameterize the elements in the Riemann-Roch space $L(D)$, where $P_D$ is the polytope associated to the divisor $D$ (see \texttt{DivisorPolytope}). }

 
\begin{Verbatim}[fontsize=\small,frame=single,label=Example]
  gap> Div:=[6,6,0];; Rays:=[[2,-1],[-1,2],[-1,-1]];;
  gap> Delta0:=[[[2,-1],[-1,2]],[[-1,2],[-1,-1]],[[-1,-1],[2,-1]]];;
  gap> P_Div:=DivisorPolytopeLatticePoints(Div,Delta0,Rays);
  [ [ -6, -6 ], [ -5, -5 ], [ -5, -4 ], [ -4, -5 ], [ -4, -4 ], [ -4, -3 ],
    [ -4, -2 ], [ -3, -4 ], [ -3, -3 ], [ -3, -2 ], [ -3, -1 ], [ -3, 0 ],
    [ -2, -4 ], [ -2, -3 ], [ -2, -2 ], [ -2, -1 ], [ -2, 0 ], [ -2, 1 ],
    [ -2, 2 ], [ -1, -3 ], [ -1, -2 ], [ -1, -1 ], [ -1, 0 ], [ -1, 1 ],
    [ 0, -3 ], [ 0, -2 ], [ 0, -1 ], [ 0, 0 ], [ 1, -2 ], [ 1, -1 ], [ 2, -2 ] ]
  gap>
  
\end{Verbatim}
  

\subsection{\textcolor{Chapter }{RiemannRochBasis}}
\logpage{[ 4, 1, 3 ]}\nobreak
{\noindent\textcolor{FuncColor}{$\Diamond$\ \texttt{RiemannRochBasis( D, Delta, Rays )\index{RiemannRochBasis@\texttt{RiemannRochBasis}}
\label{RiemannRochBasis}
}\hfill{\scriptsize (function)}}\\


 \emph{Input}: \mbox{\texttt{Delta}} is a complete and nonsingular fan \\
 \mbox{\texttt{D}} is the list of coefficients for the Weil divisor\\
 \mbox{\texttt{Rays}} is a list of rays for the fan used to describe the Weil divisors. \\
 \emph{Output}: A basis (a list of monomials) for the Riemann-Roch space of the divisor
represented by \mbox{\texttt{D}}. }

 For details on how the Weil divisors can be expressed in terms of the rays of
the fan, please see section 3.3 in \cite{F93}. This procedure does not check if the fan is complete and nonsingular. 
\begin{Verbatim}[fontsize=\small,frame=single,label=Example]
  gap> Div:=[6,6,0];; Rays:=[[2,-1],[-1,2],[-1,-1]];;
  gap> Delta:=[[[2,-1],[-1,2]],[[-1,2],[-1,-1]],[[-1,-1],[2,-1]]];;
  gap> RiemannRochBasis(Div,Delta,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 ]
  
\end{Verbatim}
  }

 
\section{\textcolor{Chapter }{Topological invariants}}\logpage{[ 4, 2, 0 ]}
{
  Throughout this section, $X(\Delta)$ \emph{must be non-singular}. 

\subsection{\textcolor{Chapter }{EulerCharacteristic}}
\logpage{[ 4, 2, 1 ]}\nobreak
{\noindent\textcolor{FuncColor}{$\Diamond$\ \texttt{EulerCharacteristic( Delta )\index{EulerCharacteristic@\texttt{EulerCharacteristic}}
\label{EulerCharacteristic}
}\hfill{\scriptsize (function)}}\\


 \emph{Input}: \mbox{\texttt{Delta}} is a nonsingular fan of cones, represented by its list of maximal cones. \\
 \emph{Output}: the Euler characteristic of the toric variety $X(\Delta)$, where $\Delta$ is a fan determined by \mbox{\texttt{Delta}}. }

 
\begin{Verbatim}[fontsize=\small,frame=single,label=Example]
  gap> Cones:=[[[2,-1],[-1,2]],[[-1,2],[-1,-1]],[[-1,-1],[2,-1]]];;
  gap> EulerCharacteristic(Cones);
  3
  
\end{Verbatim}
 Note: $X(\Delta)$ \emph{must be non-singular} here. 

\subsection{\textcolor{Chapter }{BettiNumberToric}}
\logpage{[ 4, 2, 2 ]}\nobreak
{\noindent\textcolor{FuncColor}{$\Diamond$\ \texttt{BettiNumberToric( Delta, k )\index{BettiNumberToric@\texttt{BettiNumberToric}}
\label{BettiNumberToric}
}\hfill{\scriptsize (function)}}\\


 \emph{Input}: \mbox{\texttt{Delta}} represents a nonsingular fan $\Delta$ (represented by maximal cones), \\
 \mbox{\texttt{k}} is an integer. \\
 \emph{Output}: the \mbox{\texttt{k}}-th Betti number of the toric variety $X(\Delta)$. }

 The \texttt{BettiNumberToric} procedure does not check if \mbox{\texttt{Delta}} is nonsingular. It is possible that this procedure outputs nonsense when \mbox{\texttt{Delta}} is not represented by maximal cones or is nonsingular. 
\begin{Verbatim}[fontsize=\small,frame=single,label=Example]
  gap> Cones:=[[[2,-1],[-1,2]],[[-1,2],[-1,-1]],[[-1,-1],[2,-1]]];;
  gap> BettiNumberToric(Cones,1);
  0
  gap> BettiNumberToric(Cones,2);
  1
  gap> Cones:=[[[2,-1],[-1,1]],[[-1,1],[-1,0]],[[-1,0],[2,-1]]];;
  gap> BettiNumberToric(Cones,1);
  0
  gap> BettiNumberToric(Cones,2);
  1
\end{Verbatim}
  Not to be confused with the Betti number of a polycyclically presented torsion
free group, already available in \textsf{GAP}. }

 
\section{\textcolor{Chapter }{Points over a finite field}}\logpage{[ 4, 3, 0 ]}
{
  

\subsection{\textcolor{Chapter }{CardinalityOfToricVariety}}
\logpage{[ 4, 3, 1 ]}\nobreak
{\noindent\textcolor{FuncColor}{$\Diamond$\ \texttt{CardinalityOfToricVariety( Cones, q )\index{CardinalityOfToricVariety@\texttt{CardinalityOfToricVariety}}
\label{CardinalityOfToricVariety}
}\hfill{\scriptsize (function)}}\\


 \emph{Input}: \mbox{\texttt{Cones}} is the list of maximal cones of a fan $\Delta$, \mbox{\texttt{q}} is a prime power. \\
 \emph{Output}: The size of the set of $GF(q)$-rational points of the toric variety $X(\Delta)$. }

 Note: $X(\Delta)$ \emph{must be non-singular} here. 
\begin{Verbatim}[fontsize=\small,frame=single,label=Example]
  gap> Cones:=[[[2,-1],[-1,2]],[[-1,2],[-1,-1]],[[-1,-1],[2,-1]]];;
  gap> CardinalityOfToricVariety(Cones,3);
  13
  gap> CardinalityOfToricVariety(Cones,4);
  21
  gap> CardinalityOfToricVariety(Cones,5);
  31
  gap> CardinalityOfToricVariety(Cones,7);
  57
  
\end{Verbatim}
  }

 }

 \def\bibname{References\logpage{[ "Bib", 0, 0 ]}}

\bibliographystyle{alpha}
\bibliography{toric}

\def\indexname{Index\logpage{[ "Ind", 0, 0 ]}}


\printindex

\newpage
\immediate\write\pagenrlog{["End"], \arabic{page}];}
\immediate\closeout\pagenrlog
\end{document}
