Commit e70e754d authored by Gonzalo Tornaría's avatar Gonzalo Tornaría

cleanup, use FrobeniusStructure, and cache frob structures for R1

parent 54eefa3e
......@@ -8,7 +8,7 @@ Attach("Grp.m");
declare type Modularity;
declare attributes Modularity :
R1, gal, rho, VGs, VHs, Vs, auts;
R1, discR1, frobR1, gal, rho, VGs, VHs, Vs, auts;
// ASSUME
// i. rho : Gal(R1) -~-> G, a subgroup inside Sp(4,2)
......@@ -34,8 +34,18 @@ intrinsic ModNew (R1 :: FldNum, rho :: Map) -> Modularity
Vs[VG] := VG`abelian;
end for;
discR1 := Discriminant(MaximalOrder(R1));
frobR1 := AssociativeArray();
for p in PrimesUpTo(10000) do
if discR1 mod p ne 0 then
frobR1[p] := FrobeniusStructure(R1, p);
end if;
end for;
m := New(Modularity);
m`R1 := R1;
m`discR1 := discR1;
m`frobR1 := frobR1;
m`gal := gal;
m`rho := rho;
m`VGs := VGs;
......@@ -295,12 +305,6 @@ end intrinsic;
/////////////////////////
// sorted degrees for a factorization (from high to low)
degrees := func<fact | Reverse(Sort([AbsoluteDegree(f[1]): f in fact]))>;
// return sorted degrees of factorization of pol mod p
factpat := func<pol,p | degrees(Factorization(ChangeRing(pol,GF(p))))>;
// turn a list of pairs <data,num> into a list repeating data num times
untally := func<fs | [f[1] : j in [1..f[2]], f in fs]>;
function tr(g)
return g[1,5]+g[2,6]+g[3,7]+g[4,8];
......@@ -312,30 +316,6 @@ end function;
ZZ := Integers();
function show_classes(pi, phi)
gal2 := Domain(pi);
assert Domain(phi) eq gal2;
tl := AssociativeArray();
for c in ConjugacyClasses(gal2) do
x := < CycleStructure(pi(c[3])) @ untally,
CycleStructure(c[3]) @ untally >;
if not IsDefined(tl, x) then
tl[x] := <0,0>;
end if;
t := ZZ!tr(phi(c[3]));
tl[x][t+1] +:= 1; //c[2];
end for;
return tl;
end function;
function frobenius_classes(pi : no_order:=false, only_order:=false)
gal2 := Domain(pi);
ans := AssociativeArray();
......@@ -343,13 +323,13 @@ function frobenius_classes(pi : no_order:=false, only_order:=false)
for c in ConjugacyClasses(gal2) do
if no_order then
x := CycleStructure(c[3]) @ untally;
x := CycleStructure(c[3]);
elif only_order then
x := < Order(pi(c[3])),
CycleStructure(c[3]) @ untally >;
CycleStructure(c[3]) >;
else
x := < CycleStructure(pi(c[3])) @ untally,
CycleStructure(c[3]) @ untally >;
x := < CycleStructure(pi(c[3])),
CycleStructure(c[3]) >;
end if;
if not IsDefined(ans, x) then
......@@ -381,29 +361,17 @@ intrinsic ModPrimes(m :: Modularity, R2 :: FldNum,
no_order := false, only_order := false,
check_frob := false) -> []
{ .. }
//F := AbsoluteField(R2);
//f2 := DefiningPolynomial(F);
ZR1 := MaximalOrder(m`R1);
ZR2 := MaximalOrder(R2);
discR1 := Discriminant(m`R1);
//tl := show_classes(proj, phi);
fc := frobenius_classes(proj : no_order:=no_order, only_order:=only_order);
if &and [tr(phi(x)) eq 0 : x in fc[a], a in Keys(fc)] then
// a cocycle with all traces equal to 0 is ok
return 1;
end if;
//print [<a,tl[a]> : a in Keys(tl)];
/*
if &and [tl[a,1] ne 0 : a in Keys(tl)] then
return 1;
end if;
*/
for p in PrimesUpTo(PrimeBound) do
if discR1 mod p eq 0 then
if m`discR1 mod p eq 0 then
continue;
end if;
pat1 := degrees(Factorization(p*ZR1));
pat2 := degrees(Factorization(p*ZR2));
pat1 := m`frobR1[p];
pat2 := FrobeniusStructure(R2, p);
if no_order then
pat := pat2;
elif only_order then
......@@ -412,7 +380,6 @@ intrinsic ModPrimes(m :: Modularity, R2 :: FldNum,
pat := < pat1, pat2 >;
end if;
if debug then printf "%o, %o, ", p, pat; end if;
//if not pat in Keys(tl) then
if not pat in Keys(fc) then
if debug then print " not in this extension (?)"; end if;
if not keep_going then return p; end if;
......@@ -436,21 +403,9 @@ intrinsic ModPrimes(m :: Modularity, R2 :: FldNum,
if debug then
print [<tr(phi(c)),tr1(phi(c))> : c in all_classes];
end if;
// <#bad_classes, #all_classes-#bad_classes>; end if;
end if;
//elif tl[pat][1] eq 0 then
// if debug then print tl[pat], " ***"; end if;
// return p;
//elif tl[pat][2] ne 0 then
// if debug then print tl[pat], " ?"; end if;
//else
// if debug then print tl[pat], " "; end if;
//end if;
end for;
return 0; // placeholder
//return f2;
//return [];
return 0; // BAD COCYCLE
end intrinsic;
//////////////////////////////////////////////////
//
// Some useful functions for frobenius
//
// Author: Gonzalo Tornaría <tornaria@cmat.edu.uy>
//
//////////////////////////////////////////////////
// turn a list of pairs <data,num> into a list repeating data num times
function untally(fs)
return [f[1] : j in [1..f[2]], f in fs] @ Sort @ Reverse;
end function;
// turn a list with repeats into a list of pairs <data, num>
function tally(xs)
return [ <x, Multiplicity(xs,x)> : x in Set(xs) ] @ Sort @ Reverse;
end function;
// turn a factorization into a list of factor degrees
function degrees(fact)
return [<Degree(f[1]), f[2]> : f in fact] @ untally;
end function;
intrinsic FrobeniusStructure(K::FldNum[FldNum], p::RngIntElt) -> []
{ Cycle structure of Frobenius at p in GaloisGroup(AbsoluteField(K)) }
return FrobeniusStructure(AbsoluteField(K), p);
end intrinsic;
intrinsic FrobeniusStructure(K::FldNum[FldRat], p::RngIntElt) -> []
{ The cycle structure of the Frobenius at p in GaloisGroup(K) }
return FrobeniusStructure(DefiningPolynomial(K), p);
end intrinsic;
intrinsic FrobeniusStructure(f::RngUPolElt, p::RngIntElt : prec:=0) -> []
{ The cycle structure of the Frobenius at p in GaloisGroup(f) }
disc := Discriminant(f);
require disc ne 0 : "defining polynomial must be separable";
if GF(p) ! disc ne 0 then
// separable mod p
f_p := ChangeRing(f, GF(p));
else
// not separable mod p
if prec eq 0 then
// this seems to work in practice
prec := 1 + Valuation(disc, p);
end if;
f_p := ChangeRing(f, pAdicRing(p,prec));
end if;
try
fact := Factorization(f_p);
catch e
printf "\n\nERROR: factoring [%o] p=%o, prec=%o\n\n",
f, p, prec;
return FrobeniusStructure(f,p:prec:=prec+20);
end try;
// safety -- should work anyway (?)
assert &and [ f[2] eq 1 : f in fact];
return fact @ degrees @ tally;
end intrinsic;
intrinsic FrobeniusOrder(K::FldNum[FldNum], p::RngIntElt) -> []
{ Order of the Frobenius at p in GaloisGroup(AbsoluteField(K)) }
return FrobeniusOrder(AbsoluteField(K), p);
end intrinsic;
intrinsic FrobeniusOrder(K::FldNum[FldRat], p::RngIntElt) -> []
{ Order of the Frobenius at p in GaloisGroup(K) }
return FrobeniusOrder(DefiningPolynomial(K), p);
end intrinsic;
intrinsic FrobeniusOrder(f::RngUPolElt, p::RngIntElt) -> RngIntElt
{ Order of the Frobenius at p in GaloisGroup(f) }
return Lcm([x[1] : x in FrobeniusStructure(f, p)]);
end intrinsic;
{
Frob.m
}
{
+lib/lib.spec
Modularity.m
GrpExt.m
Grp.m
}
t0 := Cputime();
Attach("Modularity.m");
Attach("GrpExt.m");
Attach("Grp.m");
AttachSpec("mod.spec");
load "ex.m";
load "ex-277.m";
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment