import java.applet.Applet; import java.awt.*; import java.awt.event.*; import java.applet.*; import java.awt.geom.*; import java.math.*; /**This is the wrapper class for the configuration of bixes */ public class BoxConfiguration { Box[] B=new Box[5]; public BoxConfiguration() {} /**This returns the list of centers of the boxes**/ public static Complex[] toComplex(BoxConfiguration Y) { Complex[] Z=new Complex[4]; for(int i=0;i<4;++i) Z[i]=new Complex(Y.B[i].z); return(Z); } /**prints out the box**/ public void print() { System.out.println(""); for(int i=0;i<4;++i) B[i].print(); } /**This copies a box configuration**/ public BoxConfiguration(BoxConfiguration Y) { for(int i=0;i<5;++i) this.B[i]=new Box(Y.B[i]); } /**The initial box for our proof**/ public static BoxConfiguration initialBox() { BoxConfiguration X=new BoxConfiguration(); X.B[0]=initialBox1(); X.B[1]=initialBox0(); X.B[2]=initialBox0(); X.B[3]=initialBox0(); X.B[4]=initialBox2(); return(X); } /**The square [-2,2] x [-2,2] **/ public static Box initialBox0() { Box B=new Box(new Complex(0,0),-2,0,1); B.g=new GaussianInteger(0,0); B.DYADIC=1; return(B); } /**The line segment [0,4]. In this routine, the center is at (2,0), but the Gaussian integer tag is obtained by taking this value and multiplying by 2^{25}**/ public static Box initialBox1() { Box B=new Box(new Complex(2,0),-2,1,1); B.g=new GaussianInteger((int)(Math.pow(2,26)),0); B.DYADIC=1; return(B); } /**The infinite box**/ public static Box initialBox2() { Box B=new Box(new Complex(0,0),0,2,1); B.g=new GaussianInteger(0,0); B.DYADIC=1; return(B); } /**Subdivides one of the square components in quarters**/ public BoxConfiguration subdivide0(int choice,int n) { BoxConfiguration X=new BoxConfiguration(this); X.B[choice]=B[choice].subdivide0(n); for(int i=0;i<4;++i) { if(i!=choice) X.B[i]=new Box(B[i]); } return(X); } /**subdivides the segment factor in half**/ public BoxConfiguration subdivide1(int n) { BoxConfiguration X=new BoxConfiguration(this); X.B[0]=B[0].subdivide1(n); X.B[1]=new Box(B[1]); X.B[2]=new Box(B[2]); X.B[3]=new Box(B[3]); return(X); } public int checkDyadic() { int test=1; for(int i=0;i<5;++i) { if(B[i].DYADIC==0) { test=0; } } return(test); } /**This finds the index of the largest box in the configuration **/ public int minIndex() { int index=-1; int min=1000; for(int i=0;i<4;++i) { if(min>B[i].k) { min=B[i].k; index=i; } } return(index); } /**The returned value d is that they the largest dyadic square/segment in the given configuration has sidelength 2^{-d}**/ public int maxSize() { int d=100; for(int i=0;i<4;++i) { if(d>B[i].k) d=B[i].k; } return(d); } /**This returns 1 if each dyadic square/segment in the configuration is contained in a small square about the relevant point of the configuration W. In practice, W will be the TBP. The abovementioned small square has sidelength 2^{-k}**/ public static int near(int k,Complex[] W,BoxConfiguration X) { if(X.B[0].confine(W[0],k)==0) return(0); if(X.B[1].confine(W[1],k)==0) return(0); if(X.B[2].confine(W[2],k)==0) return(0); if(X.B[3].confine(W[3],k)==0) return(0); return(1); } /**These routines extract thr 128 vertex configurations from a box configuration**/ /**This is the main routine. Here n=0,...,127 **/ public Complex[] getConfiguration(int n) { int[] q=binary7(n); Complex[] Z=new Complex[4]; Z[0]=B[0].getVertex1(q[0]); Z[1]=B[1].getVertex0(q[1],q[2]); Z[2]=B[2].getVertex0(q[3],q[4]); Z[3]=B[3].getVertex0(q[5],q[6]); return(Z); } /**converts the numbers 0,...,127 to binary **/ public static int[] binary7(int n) { int[] x=new int[7]; int m=n; for(int count=0;count<7;++count) { x[6-count]=m%2; m=(m-x[6-count])/2; } return(x); } /**These routines are not used directly in the proof. Rather, they are used in the reporting of how far the proof is progressing. Basically, we keep track of how much of the parameter is eaten away by the program at each state and report this. The last routine computes the volume in a way that avoids roundoff error.**/ public static double volume(BoxConfiguration X) { double[] d=new double[4]; for(int i=0;i<4;++i) d[i]=X.B[i].sidelength(); double v=d[0]*d[0]*d[1]*d[2]*d[2]*d[3]*d[3]; v=v; return(v); } /**Computes the volume as a percentage of the volume of the total configuration space**/ public static double volumePercent(BoxConfiguration X) { double v=volume(X)*Math.pow(2,-13); return(v); } /**This routine computes the volume of a dyadic box in a way that is decoded by the programs in Proof.java**/ public static int volumeLog(BoxConfiguration X) { int log = X.B[0].k; for(int i=1;i<4;++i) log=log+2*X.B[i].k; return(log); } }