
  (*This file lets the user experiment with the
   inequalities from the paper.

   The example is set to test the inequality
   (-1,1,0,0)<(0,0,0,0), the main inequality
   in the paper.  Here we take n=10 and do
   1000 random checks.  These parameters can
   be changed. After the file is loaded,
   the first 1000 numbers are printed out and
   a LIST of the outcomes of 1000 random trials
   is computed.  The min and max of the LIST is
   then recorded. Both min and max should be
   negative. *)

MOD[k_,n_]:=If[Mod[k,n]<1,Mod[k,n]+n,Mod[k,n]];


IndividualFactor[b0_,b1_,b2_,b3_,X_,k_]:=(
n=Length[X];
i1=MOD[k+b0 ,n];
i2=MOD[k+b1 ,n];
i3=MOD[k+b2 ,n];
i4=MOD[k+b3 ,n];  
(1+X[[i1]]) (1+X[[i2]])-X[[i3]] X[[i4]])

TotalExpression[b0_,b1_,b2_,b3_,X_]:=(
Product[IndividualFactor[b0,b1,b2,b3,X,k],{k,1,Length[X]}])

RandomTest[]:=(
X=Table[Random[],{10}];
TotalExpression[-1,1,0,0,X]-TotalExpression[0,0,0,0,X])

count=0;
LIST={};
Do[{aa=RandomTest[];
LIST=Append[LIST,aa];
Print[count];},{count,1,1000}]
{Min[LIST],Max[LIST]}

