//////////////////////////////////////////////////////////////////// // ntcodes.lib : a library to implement the norm-trace codes // //////////////////////////////////////////////////////////////////// LIB "general.lib"; // LIB "matrix.lib"; // LIB "brnoeth.lib"; proc permute_intvec (intvec L,intvec P) { int s=size(L); int n=size(P); intvec Lord=L; if (s1) { w=v[2..s]; } else { w=0; } } if (i>1) { if (i1) { w=v[1..s-1]; } else { w=0; } } return(w); } proc NTcurve (int p,int r) { // returns the lists li and ti and a ring with the rational points ranged by orbits, tau and auxiliar functions ... // check correctness of parameters if (r<2) { ERROR("field extension must have degree 2 or higher"); } if (prime(p)0) { def base_r=basering; } // local variables int i,j; int ino,iyes; int li,k; intvec lno,lyes; intvec ell,t; intvec perm; intvec Boxes,aux; list L; list S; // general parameters int n=p^(2*r-1); int k1=p^(r-1); int k2=(p^r)-1; int k3=k2-k1; int theta=k2/(p-1); // Boxes for (i=1;i<=k1;i=i+1) { Boxes[i]=k2; } int k4=(k1-1)/(p-1); for (i=1;i<=k4;i=i+1) { aux[i]=p-1; } Boxes=Boxes,aux; Boxes=Boxes,1; // compute li's ring rT=(p^r,a),(T),lp; poly P=T; for (i=1;i0) { setring base_r; } kill rT; int g=(p^(r-1)-1)*((p^r-1)/(p-1)-1)/2; intvec codepars=p,r,n,0,g; L[1]=ell; L[2]=t; L[3]=Boxes; L[4]=Rxy; // L[5]=DC; // L[6]=Rt; L[7]=codepars; print("n="+string(n)); print("g="+string(g)); return(L); } proc root_diagram_NTcode (list L,int m) { // input m --> list DC --> poly P(t) --> ideal f --> Evaluate[i,j] // checks, defs, and compute parameters ... // return L with m,DC,[newring,P(t)],f ( --> algorithm 4.2 ) // check if basering is defined and preserve it int defring=defined(basering); if (defring>0) { def base_r=basering; } list CODE; intvec Boxes=L[3]; int theta=size(Boxes)-1; def Rxy=L[4]; setring Rxy; int p=char(basering); int N=theta*(p-1); N=N+1; int r=1; while (p=n) { ERROR("m is not smaller than the number of rational points"); } if (m<=2*g-2) { ERROR("m is not larger than the Euler characteristic"); } int k1=p^(r-1); int k2=(p^r)-1; int k3=k2-k1; // int theta=k2/(p-1); int k4=(k1-1)/(p-1); list DC; intvec DCi,DCiNO; int i,j,k,s; int beta,gamma,counter; number alpha; for (i=1;i<=theta+1;i=i+1) { DCiNO=0; if (m>=(i-1)*(p^r-1)) { if (m>=(i-1)*(p^r-1)+(p-2)*theta+(p^(r-1))*(theta-1)) { // empty DCi=-1; } else { // theorem 3.5 counter=0; for (beta=0;beta=(i-1)*(p^r-1)+gamma*theta+beta*p^(r-1)) { // no additional condition counter=counter+1; alpha=a^(-beta-gamma*theta); DCiNO[counter]=pardeg(alpha); } } } DCiNO=sort(DCiNO)[1]; // DCiNO=compress_intvec(DCiNO); // print("E("+string(i)+")={"+string(DCiNO)+"}"); s=size(DCiNO); // DCi ... if (i<=k1) { DCi=0..Boxes[i]-1; } else { if (i<=theta) { DCi=0; for (j=2;j<=Boxes[i];j=j+1) { DCi=DCi,(j-1)*theta; } } else { DCi=0; } } for (j=1;j<=s;j=j+1) { DCi=delentryintvec(iiiiv(DCiNO[j],DCi),DCi); } } } else { // full if (i<=k1) { DCi=0..Boxes[i]-1; } else { if (i<=theta) { DCi=0; for (j=2;j<=Boxes[i];j=j+1) { DCi=DCi,(j-1)*theta; } } else { DCi=0; } } } DC[i]=DCi; } // ideal P(t) ... ring Rt=(p^r,a),(t),lp; ideal P; for (i=1;i<=theta+1;i=i+1) { P[i]=1; if (DC[i]<>-1) { s=size(DC[i]); for (j=1;j<=s;j=j+1) { P[i]=P[i]*(t-number(a^(DC[i][j]))); } } } matrix A=coeffs(P,t); int nr=nrows(A); if (nr k=i { for (j=1;j<=Boxes[k];j=j+1) { evaluate[k,j]=number(subst(f[i],x,O[k][j,1],y,O[k][j,2])); } } Evaluate[i]=evaluate; kill evaluate; } export(Evaluate); setring Rt; list Evaluate=imap(Rxy,Evaluate); export(Evaluate); if (defring>0) { setring base_r; } intvec codepars=p,r,n,m,g; CODE[1]=L[1]; CODE[2]=L[2]; CODE[3]=Boxes; CODE[4]=Rxy; CODE[5]=DC; CODE[6]=Rt; CODE[7]=codepars; return(CODE); } proc GB_NTcode (list L) { // requires: NTcode data (DC, rational points, p -or q-, r, theta, m, rings ... // (Evaluate) --> algorithm 4.2 // return groebner basis G (Matrix) // check if basering is defined and preserve it int defring=defined(basering); if (defring>0) { def base_r=basering; } list CODE; intvec Boxes=L[3]; int theta=size(Boxes)-1; list DC=L[5]; def Rt=L[6]; // intvec L[7]=p,r,n,m,g; int p=L[7][1]; int r=L[7][1]; // int n=L[7][1]; // int g=L[7][1]; // int m=L[7][1]; int i,j,k,s; setring Rt; matrix GB[theta+1][theta+1]; // algorithm 4.2 for (i=1;i<=theta+1;i=i+1) { if (DC[i]==-1) { s=0; } else { s=size(DC[i]); } if (s0) { setring base_r; } // update CODE CODE[1]=L[1]; CODE[2]=L[2]; CODE[3]=Boxes; CODE[4]=L[4]; CODE[5]=DC; CODE[6]=Rt; CODE[7]=L[7]; return(CODE); } ;