This tutorial is probably also available as a Jupyter notebook in the demo folder in the polymake source and on github.

Different versions of this tutorial: latest release, release 4.0, release 3.6, release 3.5, release 3.4, nightly master

This short tutorial explains the scripts and computations used in the note "Defect Polytopes and Counter-Examples With polymake" (Joswig and Paffenholz).

The scripts referenced in the paper are contained in this file . Save this file to a local directory and include them into a running polymake session via


at the polymake prompt. The scripts use either Normaliz or LattE for the computation of the normalized volume and the Erhhart polynomial of a face of a polytope. A listing of the function ct_invariant is here, the function f_poly_coeff is here, and the r-fold pyramids can be constructed with the script found here.

Let P be a lattice polytope, i.e. a polytope whose vertices are contained in Zd, and let F(P) be the set of non-empty faces of P, including P itself. Further, we let FP(k) be the set of k-dimensional faces of P. For t∈N we define a function ct via

ct(P)  : =   d
(-1)d-k (k+t)!


F FP(k) 
lvol(F)  ,
where lvol(F) is the normalized volume of F in the lattice Zd∩aff(F). For smooth polytopes P the invariant c1(P) is a function that records the degree of homogeneity of a certain rational function, the A-determinant, where A:=P∩Zd is the set of lattice points in P. See e.g. the book of Gelfand, Kapranov and Zelevinsky for more details. A smooth polytope is a defect polytope if c1(P)=0.

In the following we consider some conjectures about this invariant contained in the paper “Projective duality of toric manifolds and defect polytopes” by S. Di Rocco (Proc. Lond. Math. Soc., III. Ser. , 2006, 93, pages 85-104).

We use the following script to compute ct(P) for a polytope P. It takes two arguments: the polytope as the first, and the parameter t as the second argument.

sub ct_invariant {
 my ($P, $t) = @_;
 my $v = $P->VERTICES;
 my $hd = $P->HASSE_DIAGRAM;
 my $sign = 1;
 my $c = new Integer(0);

 for (my $d = $P->DIM; $d > 0; --$d) {
  foreach (@{$hd->nodes_of_dim($d)}) {
   my $F = new Polytope(VERTICES=>
   my $vol = $F->LATTICE_VOLUME;
   $c += $sign*fac($d+$t)/fac($d)*$vol;

  $sign = -$sign;

 $c += $sign*fac($t)*$P->N_VERTICES;
 return $c;

(You can either paste this into the shell, or save it to a file and load it via script<filename> in the shell.) We can use this for some simple calculations:

polytope > $S = simplex(2);
polytope > $P = prism($S);
polytope > print $P->SMOOTH;
polytope > print ct_invariant($P,1);

We have first defined a 2-dimensional standard unit simplex in the variable $S and then stroed the prism over $S in the variable $P. We compute that $P is a smooth polytope with c1(P)=0. Another interesting example is the hypersimplex Δ(3,6). This polytope is not simple, so also not smooth.

polytope > print ct_invariant(hypersimplex(3,6),1);

Nevertheless, c1 is still positive. Note that the value given in the paper of Di Rocco is not correct. Conj. 4 in that paper asks whether this is true for any polytope. We can use polymake to disprove this.

Polytopes with Negative c<sub>1</sub>

A lattice pyramid over a polytope P is the polytope obtained by taking the convex hull of P embedded at height 0 in Rd+1 together with a vertex of P embeeded at height 1. Repeating this r times gives the r-fold pyramid. The following script does this in polymake:

sub r_fold_pyr {
 my ($P, $r) = @_;
 for (; $r>0; --$r) {
  $P = lattice_pyramid($P);
 return $P;

We can apply this to the 3-dimensional standard unit cube:

polytope > $C=cube(3,0);
polytope > print ct_invariant($C,0);
polytope > print ct_invariant($C,1);
polytope > print ct_invariant(r_fold_pyr($C,1),1);
polytope > print ct_invariant(r_fold_pyr($C,2),2);
polytope > print ct_invariant(r_fold_pyr($C,3),3);

Convolutions of Ehrhart Polynomials

We further define a polynomial f(P,t) via

f(P,t)  : =   d
F FP(k) 
|ZFtF|= d

F F(P) 
(k+1)!ehr(F,t)t(d-k) ,

In polymake, we can compute the coefficients of the F-polynomial with the following script:

sub f_poly_coeff {
 my ($P) = @_;
 my $d = $P->DIM;
 my $v = $P->VERTICES;
 my $hd = $P->HASSE_DIAGRAM;
 my $sign = 1;
 my $f = new Vector<Integer>($d+1);

 for (my $k = $d;  $k > 0; --$k) {
  foreach (@{$hd->nodes_of_dim($k)}) {
   my $q = new Polytope(VERTICES=>
   my $h = (zero_vector<Rational>($d-$k))
   $f += $sign*fac($k+1)*$h;
  $sign = -$sign;

 $f += $sign*$P->N_VERTICES
 return $f; 

Here ehr(F,t) is the Ehrhart polynomial of F, and the coefficients of f(P,t) are integral, as k!\ehr(F,k) has integral coefficients for any k-dimensional lattice polytope. The returned vector lists the coefficients of the polynomial with increasing degree, i.e., the last entry is the leading coefficient of the polynomial.

Conj. 5 in the paper of Di Rocco asks whether all coefficients of this polynomial are non-negative. We start out with the $3$-dimensional unit cube stored in $C.

polytope > print f_poly_coeff($C);
24 36 24 4
polytope > print f_poly(lattice_pyramid($C));
120 192 114 32 -1

It is not hard to see that the leading coefficient of this polynomial coincides with c1(P). Looking at iterated pyramids, by re-using our function r\_fold\_pyr, we obtain:

polytope > print f_poly_coeff(r_fold_pyr($C,3));
5040 9060 5538 1698 188 -3 0
polytope > print f_poly_coeff(r_fold_pyr($C,5));
362880 717696 491304 163056 28086 1490 -15 0 0

We are not aware of an example where another but the leading coefficient of the polynomial is negative.

Cayley polytopes

It is finally asked in the paper of di Rocco whether c1(P)=0 implies that P is a strict Cayley polytope. A strict Cayley polytope is a polytope that is affinely isomorphic to

Q0★…★ Qk=conv(Q0×{e0},… , Qk×{ek})

where ej is a lattice basis of Zk+1 and Q0, … , Qk are strictly isomorphic lattice polytopes in Rm (i.e. having the same normal fan) such that dim(aff(Q0, … , Qk))=m. This is not true, as the example of a two-fold pyramid over the unit square shows:

polytope > $Q=cube(2,0);
polytope > print ct_invariant(r_fold_pyr($Q,2),1);

However, in the above definition for a Cayley polytope we could drop the condition that all factors have the same normal fan. With this slightly more general notion the $2$-fold lattice pyramid over the $0/1$-square is a non-strict Cayley polytope of two segments and two points. On the other hand, it is known that the set of lattice points of a defect polytope is contained in two parallel hyperplanes with distance one, so any defect polytope is always a non-strict Cayley polytope over a segment.


We could show with how little effort it is possible to address quite specific problems in toric geometry with the software system polymake. In fact, we answered three open questions by providing and verifying explicit examples.

  • user_guide/tutorials/a_determinants.txt
  • Last modified: 2019/01/29 21:46
  • (external edit)