#     This is the current version of the main file.
# Comment: for merely showing existence of 5-part of III(J/Q),
# maybe it will be enough to do the local computation on
# the easier J(Q)/phitilde(Jtilde(Q)). Suppose I have found the
# rank precisely (for example rank 0) with a 2-descent,
# then I just have to identify an element explicitly in
# the image of all the J(Q_p)/phitilde(Jtilde(Q_p)), to prove
# that it is in the Selmer group.
# Check whether -1,2,5, etc, are 5th powers in each other's Q_p.
# Note: a similar principle might be applicable to just do Ed's
# example in one direction, to get 5-part of Sha (even if not the
# full Selmer group) for his case.

# This file will eventually set up the Kummer map from:
#  y^2 = (5*r/4)*(r^2-3*r*x+3*x^2)^2 + (x-r)^5
#       = (r/4)*(r^2-5*r*x+5*x^2)^2 + x^5 
# The following are of order 5 on the Jacobian:
# T1 = [ (r,G(r)) - infty ] = [ (r,(sqrt(5*r)/2)*r^2) - infty]
# T2 = [ (0,H(0)) - infty ] = [ (0,(sqrt(r)/2)*r^2) - infty]
# where: G(x) = (sqrt(5*r)/2)*(r^2-3*r*x+3*x^2),
# and: H(x) = (sqrt(r)/2)*(r^2-5*r*x+5*x^2).
#
# We might as well just use the case r=4:
# y^2 = 5*(16 - 12*x + 3*x^2)^2 + (x - 4)^5
#     = (16 - 20*x + 5*x^2)^2 + x^5
# The following are of order 5 on the Jacobian:
# T1 = [ (4,G(4)) - infty ] = [ (4, 16*sqrt(5)) - infty]
# T2 = [ (0,H(0)) - infty ] = [ (0, 16) - infty]
# Note that r can be reinserted via a quadratic twist:  
# (x,y) |--> (r*x, sqrt(r)*r^2*y).
#   Note let B_{ij} be the usual biquadratic forms:
# ( B_{ij}(k(D_1),k(D_2)) ) 
#  = ( k_i(D_1 + D_2)*k_j(D_1 - D_2) + k_i(D_1 + D_2)*k_j(D_1 - D_2) ).
#
# Let R_{ij}  = B_{ij}( k(D), k(T_1) )
#    = ( k_i(D + T_1)*k_j(D - T_1) + k_i(D - T_1)*k_j(D + T_1) )
# Let Rd_{ij} = B_{ij}( k(D), k(2*T_1) ),
#    = ( k_i(D + 2*T_1)*k_j(D - 2*T_1) + k_i(D - 2*T_1)*k_j(D + 2*T_1) )
# Similarly:
# Let S_{ij}  = B_{ij}( k(D), k(T_2) )
#    = ( k_i(D + T_2)*k_j(D - T_2) + k_i(D - T_2)*k_j(D + T_2) )
# Let Sd_{ij} = B_{ij}( k(D), k(2*T_2) ),
#    = ( k_i(D + 2*T_2)*k_j(D - 2*T_2) + k_i(D - 2*T_2)*k_j(D + 2*T_2) )
# Then the sum of the orbit of:
# k_i(D)*k_j(D+T_1)*k_k(D-T_1)*k_l(D+2*T_1)*k_m(D-2*T_1)
# over all permutations of i,j,k,l,m gives 5! = 120 terms,
# and this sum is unchanged by: D |--> D + T_1.
# Note that;
# k_i*R_{jk}*Rd_{lm} 
# gives 4 of these terms, and can take:
# k_i*R_{jk}*Rd_{lm} + k_i*R_{jl}*Rd_{km} + k_i*R_{jm}*Rd_{kl}
#    + k_i*R_{kl}*Rd_{jm} + k_i*R_{km}*Rd_{jl} + k_i*R_{lm}*Rd_{jk}
# to give 24 of the terms. The sum as you replace i with i,j,k,l gives
# the entire expression:
#   k_i*R_{jk}*Rd_{lm} + k_i*R_{jl}*Rd_{km} + k_i*R_{jm}*Rd_{kl}
#      + k_i*R_{kl}*Rd_{jm} + k_i*R_{km}*Rd_{jl} + k_i*R_{lm}*Rd_{jk}
# + k_j*R_{ik}*Rd_{lm} + k_j*R_{il}*Rd_{km} + k_j*R_{im}*Rd_{kl}
#      + k_j*R_{kl}*Rd_{im} + k_j*R_{km}*Rd_{il} + k_j*R_{lm}*Rd_{ik}
# + k_k*R_{ji}*Rd_{lm} + k_k*R_{jl}*Rd_{im} + k_k*R_{jm}*Rd_{il}
#      + k_k*R_{il}*Rd_{jm} + k_k*R_{im}*Rd_{jl} + k_k*R_{lm}*Rd_{ji}
#   k_l*R_{jk}*Rd_{im} + k_l*R_{ji}*Rd_{km} + k_l*R_{jm}*Rd_{ki}
#      + k_l*R_{ki}*Rd_{jm} + k_l*R_{km}*Rd_{ji} + k_l*R_{im}*Rd_{jk}
#   k_m*R_{jk}*Rd_{li} + k_m*R_{jl}*Rd_{ki} + k_m*R_{ji}*Rd_{kl}
#      + k_m*R_{kl}*Rd_{ji} + k_m*R_{ki}*Rd_{jl} + k_m*R_{li}*Rd_{jk}
#
# Similarly for S,Sd.
# This should give an enormous system invariant under D |--> D + T_1
# and another invariant under D |--> D + T_2. By tracking coeffs
# of k4^5, ..., I should be able to pick out 8 indep for each,
# and check that all others are dependent on these, and then
# find the intersection, hopefully of dimension 4, to give the map.
# Note: when checking LI, take into account the eqn of the Kummer,
# so maybe replace all occcurrences of k2^2*k4^2 with 4*k1*k2*k4^2,
# so that LI is then transparent.
# I should be able to find a nice version of the map by making
# the initial terms something like: k4^5, k4^4*k3, k4^4*k2, k4^4*k1.
#
# The rest of this file is currently as for pn2 (which I shall change).
#########################################################################
# This file sets up the map between the Kummer surfaces.
#
#
#########################################################################
interface(prettyprint,prettyprint=false):
#########################################################################
# Let C be the curve: 
# C: Y**2 = f6*X**6 + f5*X**5 + f4*X**4 + f3*X**3 + f2*X**2 + f1*X + f0.
#
# For any divisor represented by {(x,y),(u,v)},
# let (k1,k2,k3,k4) be the embedding of the Kummer surface given by: 
# k1 := 1:  k2 := x+u:  k3 := x*u:  k4 := (f0xu-2*y*v)/((x-u)**2):  
# ## where f0xu is: 
# f0xu := 2*f0+f1*(x+u)+2*f2*(x*u)+f3*(x+u)*(x*u) 
#              +2*f4*(x*u)**2+f5*(x+u)*(x*u)**2+2*f6*(x*u)**3:
#
# Then the defining equation of the Kummer surface is given by
# the following homogeneous quartic: kummeqn.
#########################################################################

# R,S,T are as follows:

kumR := k2**2-4*k1*k3:
kumS := -4*k1**3*f0-2*k1**2*k2*f1-4*k1**2*k3*f2-2*k1*k2*k3*f3
-4*k1*k3**2*f4-2*k2*
k3**2*f5-4*k3**3*f6:
kumT := -4*k1**4*f0*f2+k1**4*f1**2-4*k1**3*k2*f0*f3
-2*k1**3*k3*f1*f3-4*k1**2*k2**2
*f0*f4+4*k1**2*k2*k3*f0*f5-4*k1**2*k2*k3*f1*f4-4*k1**2*k3**2*f0*f6+2*k1**2*k3**
2*f1*f5-4*k1**2*k3**2*f2*f4+k1**2*k3**2*f3**2-4*k1*k2**3*f0*f5+8*k1*k2**2*k3*f0
*f6-4*k1*k2**2*k3*f1*f5+4*k1*k2*k3**2*f1*f6-4*k1*k2*k3**2*f2*f5-2*k1*k3**3*f3*
f5-4*k2**4*f0*f6-4*k2**3*k3*f1*f6-4*k2**2*k3**2*f2*f6-4*k2*k3**3*f3*f6-4*k3**4*
f4*f6+k3**4*f5**2:

kummeqngeneral := kumR*k4**2+kumS*k4+kumT:

# For any divisor represented by A = {(x,y),(u,v)},
# let (k1,k2,k3,k4) be the embedding of the Kummer surface given by:
# k1 := 1:  k2 := x+u:  k3 := x*u:  k4 := (f0xu-2*y*v)/((x-u)**2): 
# ## where f0xu is:
# f0xu := 2*f0+f1*(x+u)+2*f2*(x*u)+f3*(x+u)*(x*u)
#              +2*f4*(x*u)**2+f5*(x+u)*(x*u)**2+2*f6*(x*u)**3:
# Similarly let the divisor B = {(x',y'),(u',v')} have the
# Kummer coordinates: (l1,l2,l3,l4).
#
# Then the following 4 x 4 array BBB is such that, projectively:
# ( BBB[i,j] ) = ( k_i(A+B) k_j(A-b) + k_i(A-B) k_j(A+B) )

with(linalg):
BBB := matrix(4,4):
 
BBB[1,1] :=
k1^2*l4^2+k4^2*l1^2+k3^2*l2^2*f5^2+l3^2*k2^2*f5^2-4*l4*k3^2*f6*l1+2*k3*l2*l4*k1
*f5+4*k3*l2*l4*f6*k2-2*l4*k1*k4*l1-4*l3^2*k1*f3*k2*f6+4*l3*k1*l2*f3*k3*f6+8*l3*
k1*f2*k3*f6*l1+4*l3*l4*k1*f6*k3+2*l3*k4*k2*f5*l1-4*k1^2*l3^2*f6*f2-4*l2^2*k1^2*
f6*f0-2*l3*k3*f5^2*k2*l2+8*k3*f6*k2*l3*l2*f4-4*l3^2*k1*f6*k4-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l1+16*l2*f0*f5*k1^2*f2^2*l1-4*l2^2*f6*k1*f1^2*k4+16*l2*f0*f6*k3*f3*
k1*f2*l1-4*f0*f5^2*k3^2*l2*f3*l1+4*f0*k2*f5*k4*l2*f3*l1+16*l2*f0*f5*f2*k1*k4*l1
+8*l2*f1*f5^2*f0*k3*k1*l1+32*l2*f0^2*f6^2*k3*k2*l1+8*l2*f1*f5*f0*f6*k3*k2*l1-4*
f5*k1^2*f1^2*l2*f2*l1+16*l2*f0*f6*k1^2*f1*f2*l1-8*l2*f1*f5*f0*k1^2*f3*l1+16*l2*
f5*f0^2*f6*k2^2*l1+16*f2*f0*f6*k2^2*l2*f3*l1+16*l2^2*f2*f0*f6*k2*k1*f3+16*f2*f0
*f6*k2^2*l2^2*f4-8*f0*f5*f1*k2*k1*f3*l1^2+8*l2*l4*f1*k3^2*f6*f4-4*l4*f5*k2*f1^2
*k1*l1+32*f0*f6*k1^2*f2*l3^2*f4-8*f0*f5^2*k1^2*f2*l3^2+16*f0*f6*k1*k4*l3^2*f4-4
*f0*f5^2*k4*k1*l3^2-4*l3^2*k4*f3^2*k3*f6+8*l3^2*k2*f6*f1*k4*f4:

# We now introduce curve whose Jacobian has C5xC5, then specialise
# the above defining equation and biquadratic forms, and then get
# the two spaces of quintic forms 
# (mod k4*kummeqn, k3*kummeqn, k2*kummeqn, k1*kummeqn).

sex1 := 5*(16 - 12*x + 3*x^2)^2 + (x - 4)^5;
sex2 := (16 - 20*x + 5*x^2)^2 + x^5;
chk := expand(sex1 - sex2);

C := expand( 5*(16 - 12*x + 3*x^2)^2 + (x - 4)^5 );
ff6 := coeff(C,x,6);
ff5 := coeff(C,x,5);
ff4 := coeff(C,x,4);
ff3 := coeff(C,x,3);
ff2 := coeff(C,x,2);
ff1 := coeff(C,x,1);
ff0 := coeff(C,x,0);
kummeqn := 
subs(f6=ff6, f5=ff5, f4=ff4, f3=ff3, f2=ff2, f1=ff1, f0=ff0, kummeqngeneral);

# Q1 = T1 = [ (4,G(4)) - infty ] = [ (4, 16*sqrt(5)) - infty]
# Q1Q1 = 2*Q1 = { (4, 16*sqrt(5)), (4, 16*sqrt(5)) }. 
# Q2 = T2 = [ (0,H(0)) - infty ] = [ (0, 16) - infty]
# Q2Q2 = 2*Q2 = { (0,16), (0,16) }.
# 

# We now get the Kummer coordinates: Q1k1, Q1k2, Q1k3, Q1k4
# for the point of order 5: Q1 := { (4, 16*sqrt(5)), infty }.
Q1k1 := 0;
Q1k2 := 1;
Q1k3 := 4;
Q1k4 := solve( subs( k1=Q1k1, k2 = Q1k2, k3 = Q1k3, kummeqn ) )[1];
chk := simplify( subs( f6=ff6, f5=ff5, f4=ff4, f3=ff3, f2=ff2, f1=ff1, f0=ff0,
             k1=Q1k1, k2=Q1k2, k3=Q1k3, k4=Q1k4, kummeqn ) );

# We now get the Kummer coordinates: Q1Q1k1, Q1Q1k2, Q1Q1k3, Q1Q1k4
# for the point of order 5: Q1Q1 := { (4, 16*sqrt(5)), (4, 16*sqrt(5)) }.
Q1Q1k1 := 1;
Q1Q1k2 := 4 + 4;
Q1Q1k3 := 4*4;
Q1Q1k4 := solve( subs( k1=Q1Q1k1, k2 = Q1Q1k2, k3 = Q1Q1k3, kummeqn ) );
chk := simplify( subs( f6=ff6, f5=ff5, f4=ff4, f3=ff3, f2=ff2, f1=ff1, f0=ff0,
             k1=Q1Q1k1, k2=Q1Q1k2, k3=Q1Q1k3, k4=Q1Q1k4, kummeqn ) );

# We now get the Kummer coordinates: Q2k1, Q2k2, Q2k3, Q2k4
# for the point of order 5: Q2 := { (0, 16), infty }.
Q2k1 := 0;
Q2k2 := 1;
Q2k3 := 0;
Q2k4 := solve( subs( k1=Q2k1, k2 = Q2k2, k3 = Q2k3, kummeqn ) )[1];
chk := simplify( subs( f6=ff6, f5=ff5, f4=ff4, f3=ff3, f2=ff2, f1=ff1, f0=ff0,
             k1=Q2k1, k2=Q2k2, k3=Q2k3, k4=Q2k4, kummeqn ) );

# We now get the Kummer coordinates: Q2Q2k1, Q2Q2k2, Q2Q2k3, Q2Q2k4
# for the point of order 5: Q2Q2 := { (0, 16), (0,16) }.
Q2Q2k1 := 1;
Q2Q2k2 := 0 + 0;
Q2Q2k3 := 0*0;
Q2Q2k4 := solve( subs( k1=Q2Q2k1, k2 = Q2Q2k2, k3 = Q2Q2k3, kummeqn ) );
chk := simplify( subs( f6=ff6, f5=ff5, f4=ff4, f3=ff3, f2=ff2, f1=ff1, f0=ff0,
             k1=Q2Q2k1, k2=Q2Q2k2, k3=Q2Q2k3, k4=Q2Q2k4, kummeqn ) );

# R_{ij}\bigl( k(P) \bigr) &=& B_{ij}\bigl( k(P), k(Q_1) \bigr),
# Rd_{ij}\bigl( k(P) \bigr) &=& B_{ij}\bigl( k(P), k(2*Q_1) \bigr),
# S_{ij}\bigl( k(P) \bigr) &=& B_{ij}\bigl( k(P), k(Q_2) \bigr),
# Sd_{ij}\bigl( k(P) \bigr) &=& B_{ij}\bigl( k(P), k(2*Q_2) \bigr),

R := matrix(4,4);
for ii from 1 to 4 do for jj from 1 to 4 do
  R[ii,jj] := 
      simplify(subs( f6=ff6, f5=ff5, f4=ff4, f3=ff3, f2=ff2, f1=ff1, f0=ff0, 
      l1=Q1k1, l2=Q1k2, l3=Q1k3, l4=Q1k4, BBB[ii,jj] ));
od od;

Rd := matrix(4,4);
for ii from 1 to 4 do for jj from 1 to 4 do
  Rd[ii,jj] := 
      simplify(subs( f6=ff6, f5=ff5, f4=ff4, f3=ff3, f2=ff2, f1=ff1, f0=ff0, 
      l1=Q1Q1k1, l2=Q1Q1k2, l3=Q1Q1k3, l4=Q1Q1k4, BBB[ii,jj] ));
od od;

S := matrix(4,4);
for ii from 1 to 4 do for jj from 1 to 4 do
  S[ii,jj] := 
      simplify(subs( f6=ff6, f5=ff5, f4=ff4, f3=ff3, f2=ff2, f1=ff1, f0=ff0, 
      l1=Q2k1, l2=Q2k2, l3=Q2k3, l4=Q2k4, BBB[ii,jj] ));
od od;

Sd := matrix(4,4);
for ii from 1 to 4 do for jj from 1 to 4 do
  Sd[ii,jj] := 
      simplify(subs( f6=ff6, f5=ff5, f4=ff4, f3=ff3, f2=ff2, f1=ff1, f0=ff0, 
      l1=Q2Q2k1, l2=Q2Q2k2, l3=Q2Q2k3, l4=Q2Q2k4, BBB[ii,jj] ));
od od;

#   kk[i]*R[j,k]*Rd[l,m] + kk[i]*R[j,l]*Rd[k,m] + kk[i]*R[j,m]*Rd[k,l]
#      + kk[i]*R[k,l]*Rd[j,m] + kk[i]*R[k,m]*Rd[j,l] + kk[i]*R[l,m]*Rd[j,k]
# + kk[j]*R[i,k]*Rd[l,m] + kk[j]*R[i,l]*Rd[k,m] + kk[j]*R[i,m]*Rd[k,l]
#      + kk[j]*R[k,l]*Rd[i,m] + kk[j]*R[k,m]*Rd[i,l] + kk[j]*R[l,m]*Rd[i,k]
# + kk[k]*R[j,i]*Rd[l,m] + kk[k]*R[j,l]*Rd[i,m] + kk[k]*R[j,m]*Rd[i,l]
#      + kk[k]*R[i,l]*Rd[j,m] + kk[k]*R[i,m]*Rd[j,l] + kk[k]*R[l,m]*Rd[j,i]
# + kk[l]*R[j,k]*Rd[i,m] + kk[l]*R[j,i]*Rd[k,m] + kk[l]*R[j,m]*Rd[k,i]
#      + kk[l]*R[k,i]*Rd[j,m] + kk[l]*R[k,m]*Rd[j,i] + kk[l]*R[i,m]*Rd[j,k]
# + kk[m]*R[j,k]*Rd[l,i] + kk[m]*R[j,l]*Rd[k,i] + kk[m]*R[j,i]*Rd[k,l]
#      + kk[m]*R[k,l]*Rd[j,i] + kk[m]*R[k,i]*Rd[j,l] + kk[m]*R[l,i]*Rd[j,k]

kk := [k1,k2,k3,k4];
RR := Array(1..4,1..4,1..4,1..4,1..4);
for i from 1 to 4 do for j from 1 to 4 do for k from 1 to 4 do
for l from 1 to 4 do for m from 1 to 4 do
  RR[i,j,k,l,m] := 
  expand( 
   kk[i]*R[j,k]*Rd[l,m] + kk[i]*R[j,l]*Rd[k,m] + kk[i]*R[j,m]*Rd[k,l]
      + kk[i]*R[k,l]*Rd[j,m] + kk[i]*R[k,m]*Rd[j,l] + kk[i]*R[l,m]*Rd[j,k]
 + kk[j]*R[i,k]*Rd[l,m] + kk[j]*R[i,l]*Rd[k,m] + kk[j]*R[i,m]*Rd[k,l]
      + kk[j]*R[k,l]*Rd[i,m] + kk[j]*R[k,m]*Rd[i,l] + kk[j]*R[l,m]*Rd[i,k]
 + kk[k]*R[j,i]*Rd[l,m] + kk[k]*R[j,l]*Rd[i,m] + kk[k]*R[j,m]*Rd[i,l]
      + kk[k]*R[i,l]*Rd[j,m] + kk[k]*R[i,m]*Rd[j,l] + kk[k]*R[l,m]*Rd[j,i]
 + kk[l]*R[j,k]*Rd[i,m] + kk[l]*R[j,i]*Rd[k,m] + kk[l]*R[j,m]*Rd[k,i]
      + kk[l]*R[k,i]*Rd[j,m] + kk[l]*R[k,m]*Rd[j,i] + kk[l]*R[i,m]*Rd[j,k]
 + kk[m]*R[j,k]*Rd[l,i] + kk[m]*R[j,l]*Rd[k,i] + kk[m]*R[j,i]*Rd[k,l]
      + kk[m]*R[k,l]*Rd[j,i] + kk[m]*R[k,i]*Rd[j,l] + kk[m]*R[l,i]*Rd[j,k]
      )
od od od od od;

kk := [k1,k2,k3,k4];
SS := Array(1..4,1..4,1..4,1..4,1..4);
for i from 1 to 4 do for j from 1 to 4 do for k from 1 to 4 do
for l from 1 to 4 do for m from 1 to 4 do
  SS[i,j,k,l,m] := 
  expand( 
   kk[i]*S[j,k]*Sd[l,m] + kk[i]*S[j,l]*Sd[k,m] + kk[i]*S[j,m]*Sd[k,l]
      + kk[i]*S[k,l]*Sd[j,m] + kk[i]*S[k,m]*Sd[j,l] + kk[i]*S[l,m]*Sd[j,k]
 + kk[j]*S[i,k]*Sd[l,m] + kk[j]*S[i,l]*Sd[k,m] + kk[j]*S[i,m]*Sd[k,l]
      + kk[j]*S[k,l]*Sd[i,m] + kk[j]*S[k,m]*Sd[i,l] + kk[j]*S[l,m]*Sd[i,k]
 + kk[k]*S[j,i]*Sd[l,m] + kk[k]*S[j,l]*Sd[i,m] + kk[k]*S[j,m]*Sd[i,l]
      + kk[k]*S[i,l]*Sd[j,m] + kk[k]*S[i,m]*Sd[j,l] + kk[k]*S[l,m]*Sd[j,i]
 + kk[l]*S[j,k]*Sd[i,m] + kk[l]*S[j,i]*Sd[k,m] + kk[l]*S[j,m]*Sd[k,i]
      + kk[l]*S[k,i]*Sd[j,m] + kk[l]*S[k,m]*Sd[j,i] + kk[l]*S[i,m]*Sd[j,k]
 + kk[m]*S[j,k]*Sd[l,i] + kk[m]*S[j,l]*Sd[k,i] + kk[m]*S[j,i]*Sd[k,l]
      + kk[m]*S[k,l]*Sd[j,i] + kk[m]*S[k,i]*Sd[j,l] + kk[m]*S[l,i]*Sd[j,k]
      )
od od od od od;

# Now adjust: (mod k4*kummeqn, k3*kummeqn, k2*kummeqn, k1*kummeqn).
# For each quintic, remove the k2^2*k4^2*k4 term, and then
# the k2^2*k4^2*k3, k2^2*k4^2*k2, k2^2*k4^2*k1 terms.
for i from 1 to 4 do for j from 1 to 4 do for k from 1 to 4 do
for l from 1 to 4 do for m from 1 to 4 do
  RR[i,j,k,l,m] := 
  expand(RR[i,j,k,l,m]-coeff(coeff(RR[i,j,k,l,m],k2,2),k4,3)*k4*kummeqn)
od od od od od;
for i from 1 to 4 do for j from 1 to 4 do for k from 1 to 4 do
for l from 1 to 4 do for m from 1 to 4 do
  RR[i,j,k,l,m] := 
  expand(RR[i,j,k,l,m]
    -coeff(coeff(coeff(RR[i,j,k,l,m],k2,2),k4,2),k3,1)*k3*kummeqn)
od od od od od;
for i from 1 to 4 do for j from 1 to 4 do for k from 1 to 4 do
for l from 1 to 4 do for m from 1 to 4 do
  RR[i,j,k,l,m] := 
  expand(RR[i,j,k,l,m]-coeff(coeff(RR[i,j,k,l,m],k2,3),k4,2)*k2*kummeqn)
od od od od od;
for i from 1 to 4 do for j from 1 to 4 do for k from 1 to 4 do
for l from 1 to 4 do for m from 1 to 4 do
  RR[i,j,k,l,m] := 
  expand(RR[i,j,k,l,m]
    -coeff(coeff(coeff(RR[i,j,k,l,m],k2,2),k4,2),k1,1)*k1*kummeqn)
od od od od od;

for i from 1 to 4 do for j from 1 to 4 do for k from 1 to 4 do
for l from 1 to 4 do for m from 1 to 4 do
  SS[i,j,k,l,m] := 
  expand(SS[i,j,k,l,m]-coeff(coeff(SS[i,j,k,l,m],k2,2),k4,3)*k4*kummeqn)
od od od od od;
for i from 1 to 4 do for j from 1 to 4 do for k from 1 to 4 do
for l from 1 to 4 do for m from 1 to 4 do
  SS[i,j,k,l,m] := 
  expand(SS[i,j,k,l,m]
    -coeff(coeff(coeff(SS[i,j,k,l,m],k2,2),k4,2),k3,1)*k3*kummeqn)
od od od od od;
for i from 1 to 4 do for j from 1 to 4 do for k from 1 to 4 do
for l from 1 to 4 do for m from 1 to 4 do
  SS[i,j,k,l,m] := 
  expand(SS[i,j,k,l,m]-coeff(coeff(SS[i,j,k,l,m],k2,3),k4,2)*k2*kummeqn)
od od od od od;
for i from 1 to 4 do for j from 1 to 4 do for k from 1 to 4 do
for l from 1 to 4 do for m from 1 to 4 do
  SS[i,j,k,l,m] := 
  expand(SS[i,j,k,l,m]
    -coeff(coeff(coeff(SS[i,j,k,l,m],k2,2),k4,2),k1,1)*k1*kummeqn)
od od od od od;


# Step 1. Get the 4 quintic forms l1,l2,l3,l4 of the map, diag as
# 1*k1*k4^4 + 0*k2*k4^4 + 0*k3*k4^4 + 0*k4^5,
# 0*k1*k4^4 + 1*k2*k4^4 + 0*k3*k4^4 + 0*k4^5,
# 0*k1*k4^4 + 0*k2*k4^4 + 1*k3*k4^4 + 0*k4^5,
# 0*k1*k4^4 + 0*k2*k4^4 + 0*k3*k4^4 + 1*k4^5.
# Step 2. Find eq satisfied by l1,l2,l3,l4.
# (if l1,l2,l3 already correct, can map irrat pts of order 3 on C
# to find l4).
# Step 3. Find the linear change in the l's (probably just adjust l4), 
# so that the qn is transparently a Kummer eqn.
# Step 4. Get the correct quadratic twist, using a rank 1 example.

getarr := proc(quinticform);
# This procedure inputs a quintic in k1,k2,k3,k4 and gets array of coeffs.
[ 
coeff(coeff(coeff(coeff(quinticform,k4,5),k3,0),k2,0),k1,0),
coeff(coeff(coeff(coeff(quinticform,k4,4),k3,1),k2,0),k1,0),
coeff(coeff(coeff(coeff(quinticform,k4,4),k3,0),k2,1),k1,0),
coeff(coeff(coeff(coeff(quinticform,k4,4),k3,0),k2,0),k1,1),
coeff(coeff(coeff(coeff(quinticform,k4,3),k3,2),k2,0),k1,0),
coeff(coeff(coeff(coeff(quinticform,k4,3),k3,1),k2,1),k1,0),
coeff(coeff(coeff(coeff(quinticform,k4,3),k3,1),k2,0),k1,1),
coeff(coeff(coeff(coeff(quinticform,k4,3),k3,0),k2,2),k1,0),
coeff(coeff(coeff(coeff(quinticform,k4,3),k3,0),k2,1),k1,1),
coeff(coeff(coeff(coeff(quinticform,k4,3),k3,0),k2,0),k1,2),
coeff(coeff(coeff(coeff(quinticform,k4,2),k3,3),k2,0),k1,0),
coeff(coeff(coeff(coeff(quinticform,k4,2),k3,2),k2,1),k1,0),
coeff(coeff(coeff(coeff(quinticform,k4,2),k3,2),k2,0),k1,1),
coeff(coeff(coeff(coeff(quinticform,k4,2),k3,1),k2,2),k1,0),
coeff(coeff(coeff(coeff(quinticform,k4,2),k3,1),k2,1),k1,1),
coeff(coeff(coeff(coeff(quinticform,k4,2),k3,1),k2,0),k1,2),
coeff(coeff(coeff(coeff(quinticform,k4,2),k3,0),k2,3),k1,0),
coeff(coeff(coeff(coeff(quinticform,k4,2),k3,0),k2,2),k1,1),
coeff(coeff(coeff(coeff(quinticform,k4,2),k3,0),k2,1),k1,2),
coeff(coeff(coeff(coeff(quinticform,k4,2),k3,0),k2,0),k1,3),
coeff(coeff(coeff(coeff(quinticform,k4,1),k3,4),k2,0),k1,0),
coeff(coeff(coeff(coeff(quinticform,k4,1),k3,3),k2,1),k1,0),
coeff(coeff(coeff(coeff(quinticform,k4,1),k3,3),k2,0),k1,1),
coeff(coeff(coeff(coeff(quinticform,k4,1),k3,2),k2,2),k1,0),
coeff(coeff(coeff(coeff(quinticform,k4,1),k3,2),k2,1),k1,1),
coeff(coeff(coeff(coeff(quinticform,k4,1),k3,2),k2,0),k1,2),
coeff(coeff(coeff(coeff(quinticform,k4,1),k3,1),k2,3),k1,0),
coeff(coeff(coeff(coeff(quinticform,k4,1),k3,1),k2,2),k1,1),
coeff(coeff(coeff(coeff(quinticform,k4,1),k3,1),k2,1),k1,2),
coeff(coeff(coeff(coeff(quinticform,k4,1),k3,1),k2,0),k1,3),
coeff(coeff(coeff(coeff(quinticform,k4,1),k3,0),k2,4),k1,0),
coeff(coeff(coeff(coeff(quinticform,k4,1),k3,0),k2,3),k1,1),
coeff(coeff(coeff(coeff(quinticform,k4,1),k3,0),k2,2),k1,2),
coeff(coeff(coeff(coeff(quinticform,k4,1),k3,0),k2,1),k1,3),
coeff(coeff(coeff(coeff(quinticform,k4,1),k3,0),k2,0),k1,4),
coeff(coeff(coeff(coeff(quinticform,k4,0),k3,5),k2,0),k1,0),
coeff(coeff(coeff(coeff(quinticform,k4,0),k3,4),k2,1),k1,0),
coeff(coeff(coeff(coeff(quinticform,k4,0),k3,4),k2,0),k1,1),
coeff(coeff(coeff(coeff(quinticform,k4,0),k3,3),k2,2),k1,0),
coeff(coeff(coeff(coeff(quinticform,k4,0),k3,3),k2,1),k1,1),
coeff(coeff(coeff(coeff(quinticform,k4,0),k3,3),k2,0),k1,2),
coeff(coeff(coeff(coeff(quinticform,k4,0),k3,2),k2,3),k1,0),
coeff(coeff(coeff(coeff(quinticform,k4,0),k3,2),k2,2),k1,1),
coeff(coeff(coeff(coeff(quinticform,k4,0),k3,2),k2,1),k1,2),
coeff(coeff(coeff(coeff(quinticform,k4,0),k3,2),k2,0),k1,3),
coeff(coeff(coeff(coeff(quinticform,k4,0),k3,1),k2,4),k1,0),
coeff(coeff(coeff(coeff(quinticform,k4,0),k3,1),k2,3),k1,1),
coeff(coeff(coeff(coeff(quinticform,k4,0),k3,1),k2,2),k1,2),
coeff(coeff(coeff(coeff(quinticform,k4,0),k3,1),k2,1),k1,3),
coeff(coeff(coeff(coeff(quinticform,k4,0),k3,1),k2,0),k1,4),
coeff(coeff(coeff(coeff(quinticform,k4,0),k3,0),k2,5),k1,0),
coeff(coeff(coeff(coeff(quinticform,k4,0),k3,0),k2,4),k1,1),
coeff(coeff(coeff(coeff(quinticform,k4,0),k3,0),k2,3),k1,2),
coeff(coeff(coeff(coeff(quinticform,k4,0),k3,0),k2,2),k1,3),
coeff(coeff(coeff(coeff(quinticform,k4,0),k3,0),k2,1),k1,4),
coeff(coeff(coeff(coeff(quinticform,k4,0),k3,0),k2,0),k1,5)
];
end;

# The following puts the 1024 Q1-cubics as 1024 rows of coeffs (1024x56 matrix).
Q1arr := [];
for i from 1 to 4 do for j from 1 to 4 do for k from 1 to 4 do
for l from 1 to 4 do for m from 1 to 4 do
  Q1arr := [ op(Q1arr), getarr(RR[i,j,k,l,m]) ];
od od od od od;
Q1mtx := matrix( Q1arr );

Q1mtx := gausselim(Q1mtx);
# The following gives: 12, so that this is a 12-dimensional rowspace.
rank(Q1mtx);

# The following puts the 1024 Q2-cubics as 1024 rows of coeffs (1024x56 matrix).
Q2arr := [];
for i from 1 to 4 do for j from 1 to 4 do for k from 1 to 4 do
for l from 1 to 4 do for m from 1 to 4 do
  Q2arr := [ op(Q2arr), getarr(SS[i,j,k,l,m]) ];
od od od od od;
Q2mtx := matrix( Q2arr );

Q2mtx := gausselim(Q2mtx);
# The following gives: 12, so that this is a 12-dimensional rowspace.
rank(Q2mtx);

# We see that Q1mtx, Q2mtx each have rowspace of dimension 12. 
# We shall now find a basis for the intersections of these rowspaces
# by first finding nullQ1,nullQ2, whose rows are the transposes of
# the bases for the nullspaces of Q1mtx,Q2mtx, then find nullQ1Q2, 
# the matrix obtained by placing the rows of nullQ1 above the rows 
# of nullQ2, and then Q1intQ2, whose rows are the transposes of 
# the basis elts of the nullspace of nullQ1Q2.

QQ1 := nullspace(Q1mtx);
nullQ1 := [];
for i from 1 to nops(QQ1) do nullQ1 := [ op(nullQ1), convert(QQ1[i],list) ] od;
nullQ1 := matrix(nullQ1);

QQ2 := nullspace(Q2mtx);
nullQ2 := [];
for i from 1 to nops(QQ2) do nullQ2 := [ op(nullQ2), convert(QQ2[i],list) ] od;
nullQ2 := matrix(nullQ2);

nullQ1Q2 := 
matrix([op(convert(nullQ1,listlist)), op(convert(nullQ2,listlist))]);

# The following find a matrix whose 4 rows are a basis for the 
# intersection of the rowspace of Q1mtx and the rowspace of Q2mtx. 
nullnullQ1Q2 := nullspace( nullQ1Q2 );
Q1intQ2 := [];
for i from 1 to nops(nullnullQ1Q2) 
  do Q1intQ2 := [ op(Q1intQ2), convert(nullnullQ1Q2[i],list) ] od;
Q1intQ2 := matrix( Q1intQ2 );

# So far, to here. 
getquinticform := proc(arrr)
      arrr[1]*k4^5
    + arrr[2]*k4^4*k3^1
    + arrr[3]*k4^4*k2^1
    + arrr[4]*k4^4*k1^1
    + arrr[5]*k4^3*k3^2
    + arrr[6]*k4^3*k3^1*k2^1
    + arrr[7]*k4^3*k3^1*k1^1
    + arrr[8]*k4^3*k2^2
    + arrr[9]*k4^3*k2^1*k1^1
    + arrr[10]*k4^3*k1^2
    + arrr[11]*k4^2*k3^3
    + arrr[12]*k4^2*k3^2*k2^1
    + arrr[13]*k4^2*k3^2*k1^1
    + arrr[14]*k4^2*k3^1*k2^2
    + arrr[15]*k4^2*k3^1*k2^1*k1^1
    + arrr[16]*k4^2*k3^1*k1^2
    + arrr[17]*k4^2*k2^3
    + arrr[18]*k4^2*k2^2*k1^1
    + arrr[19]*k4^2*k2^1*k1^2
    + arrr[20]*k4^2*k1^3
    + arrr[21]*k4^1*k3^4
    + arrr[22]*k4^1*k3^3*k2^1
    + arrr[23]*k4^1*k3^3*k1^1
    + arrr[24]*k4^1*k3^2*k2^2
    + arrr[25]*k4^1*k3^2*k2^1*k1^1
    + arrr[26]*k4^1*k3^2*k1^2
    + arrr[27]*k4^1*k3^1*k2^3
    + arrr[28]*k4^1*k3^1*k2^2*k1^1
    + arrr[29]*k4^1*k3^1*k2^1*k1^2
    + arrr[30]*k4^1*k3^1*k1^3
    + arrr[31]*k4^1*k2^4
    + arrr[32]*k4^1*k2^3*k1^1
    + arrr[33]*k4^1*k2^2*k1^2
    + arrr[34]*k4^1*k2^1*k1^3
    + arrr[35]*k4^1*k1^4
    + arrr[36]*k3^5
    + arrr[37]*k3^4*k2^1
    + arrr[38]*k3^4*k1^1
    + arrr[39]*k3^3*k2^2
    + arrr[40]*k3^3*k2^1*k1^1
    + arrr[41]*k3^3*k1^2
    + arrr[42]*k3^2*k2^3
    + arrr[43]*k3^2*k2^2*k1^1
    + arrr[44]*k3^2*k2^1*k1^2
    + arrr[45]*k3^2*k1^3
    + arrr[46]*k3^1*k2^4
    + arrr[47]*k3^1*k2^3*k1^1
    + arrr[48]*k3^1*k2^2*k1^2
    + arrr[49]*k3^1*k2^1*k1^3
    + arrr[50]*k3^1*k1^4
    + arrr[51]*k2^5
    + arrr[52]*k2^4*k1^1
    + arrr[53]*k2^3*k1^2
    + arrr[54]*k2^2*k1^3
    + arrr[55]*k2^1*k1^4
    + arrr[56]*k1^5
end;

r1 := getquinticform( convert(Q1intQ2, listlist)[1] );
r2 := getquinticform( convert(Q1intQ2, listlist)[2] );
r3 := getquinticform( convert(Q1intQ2, listlist)[3] );
r4 := getquinticform( convert(Q1intQ2, listlist)[4] );

m := matrix( 
  [ [ coeff(coeff(r1,k1,1),k4,4), coeff(coeff(r1,k2,1),k4,4),
      coeff(coeff(r1,k3,1),k4,4), coeff(r1,k4,5) ],
    [ coeff(coeff(r2,k1,1),k4,4), coeff(coeff(r2,k2,1),k4,4),
      coeff(coeff(r2,k3,1),k4,4), coeff(r2,k4,5) ],
    [ coeff(coeff(r3,k1,1),k4,4), coeff(coeff(r3,k2,1),k4,4),
      coeff(coeff(r3,k3,1),k4,4), coeff(r3,k4,5) ],
    [ coeff(coeff(r4,k1,1),k4,4), coeff(coeff(r4,k2,1),k4,4),
      coeff(coeff(r4,k3,1),k4,4), coeff(r4,k4,5) ] ] );

lmtx := multiply( inverse(m), matrix([ [r1], [r2], [r3], [r4] ]) );
# The following is the diagonalised quintic map. 
l1 := lmtx[1,1]; 
l2 := lmtx[2,1];
l3 := lmtx[3,1];
l4 := lmtx[4,1];

# The following check that Q1, 2*Q1, Q2, 2*Q2 are indeed in the kernel
# of the quintic map (k1,k2,k3,k4) |--> (l1,l2,l3,l4). 
subs(k1=Q1k1,k2=Q1k2,k3=Q1k3,k4=Q1k4, l1);
subs(k1=Q1k1,k2=Q1k2,k3=Q1k3,k4=Q1k4, l2);
subs(k1=Q1k1,k2=Q1k2,k3=Q1k3,k4=Q1k4, l3);
subs(k1=Q1k1,k2=Q1k2,k3=Q1k3,k4=Q1k4, l4);
subs(k1=Q1Q1k1,k2=Q1Q1k2,k3=Q1Q1k3,k4=Q1Q1k4, l1);
subs(k1=Q1Q1k1,k2=Q1Q1k2,k3=Q1Q1k3,k4=Q1Q1k4, l2);
subs(k1=Q1Q1k1,k2=Q1Q1k2,k3=Q1Q1k3,k4=Q1Q1k4, l3);
subs(k1=Q1Q1k1,k2=Q1Q1k2,k3=Q1Q1k3,k4=Q1Q1k4, l4);
subs(k1=Q2k1,k2=Q2k2,k3=Q2k3,k4=Q2k4, l1);
subs(k1=Q2k1,k2=Q2k2,k3=Q2k3,k4=Q2k4, l2);
subs(k1=Q2k1,k2=Q2k2,k3=Q2k3,k4=Q2k4, l3);
subs(k1=Q2k1,k2=Q2k2,k3=Q2k3,k4=Q2k4, l4);
subs(k1=Q2Q2k1,k2=Q2Q2k2,k3=Q2Q2k3,k4=Q2Q2k4, l1);
subs(k1=Q2Q2k1,k2=Q2Q2k2,k3=Q2Q2k3,k4=Q2Q2k4, l2);
subs(k1=Q2Q2k1,k2=Q2Q2k2,k3=Q2Q2k3,k4=Q2Q2k4, l3);
subs(k1=Q2Q2k1,k2=Q2Q2k2,k3=Q2Q2k3,k4=Q2Q2k4, l4);


# 
# Now try to find the quartic satsfied by l1,l2,l3,l4. 

# We hope that this quartic is: (l2^2-4*l1*l3)*l4^2 + terms deg <= 1 in l4. 
# Subtracting k4^16*kummeqn removes k4^18, the highest degree term in k4. 
part1 := expand( (l2^2-4*l1*l3)*l4^2  - k4^16*kummeqn);
# Now extract the k4^17 coefficient of part1.
part1k4to17 := coeff(part1,k4,17);
subs( k1=ll1, k2=ll2, k3=ll3, k4=ll4, part1k4to17 );
# -104*ll2^2*ll3+68*ll2*ll3^2-6976*ll1^2*ll3+384*ll1*ll2^2-444*ll1*ll3^2
# +3328*ll1^2*ll2+1360*ll1*ll2*ll3-13*ll3^3-3072*ll1^3 
part2 := expand( part1 - 
   ( -104*l2^2*l3+68*l2*l3^2-6976*l1^2*l3+384*l1*l2^2-444*l1*l3^2
     +3328*l1^2*l2+1360*l1*l2*l3-13*l3^3-3072*l1^3 )*l4  );
# Now extract the k4^16 coefficient of part2.
part2k4to16 := coeff(part2,k4,16);
subs( k1=ll1, k2=ll2, k3=ll3, k4=ll4, part2k4to16 );
# 13424*ll2^2*ll3^2-10568*ll2*ll3^3+10816*ll2^3*ll3+2648960*ll1^2*ll3^2
# +174080*ll1*ll2^3+121296*ll1*ll3^3-8609792*ll1^3*ll2+16238592*ll1^3*ll3
# +66560*ll1^2*ll2^2+291840*ll1*ll2^2*ll3-521088*ll1*ll2*ll3^2+1691*ll3^4
# +7110656*ll1^4-5587456*ll1^2*ll2*ll3
part3 := expand( part2 -
  ( 13424*l2^2*l3^2-10568*l2*l3^3+10816*l2^3*l3+2648960*l1^2*l3^2
    +174080*l1*l2^3+121296*l1*l3^3-8609792*l1^3*l2+16238592*l1^3*l3
    +66560*l1^2*l2^2+291840*l1*l2^2*l3-521088*l1*l2*l3^2+1691*l3^4
    +7110656*l1^4-5587456*l1^2*l2*l3 ) );

# The above is not divisible by kummeqn, so we have not yet found
# the quartic satisfied by l1,l2,l3,l4. Now try using local power series.
#
# Recall the usual embedding (a0,..,a15) of the Jacobian variety at:
# http://people.maths.ox.ac.uk/flynn/genus2/jacobian.variety/defining.equations
#
# The following 72 quadratic forms eqn(1),..,eqn(72) give a set
# of defining equations for the jacobian variety of the
# curve of genus 2: 
# Y**2 = f6*X**6 + f5*X**5 + f4*X**4 + f3*X**3 + f2*X**2 + f1*X + f0
# using the embedding into projective 15-space give by
# the following functions on the divisor 
#        {(x,y),(u,v)} = (x,y) + (u,v) - infty+ - infty-.
# Note that a0,a3,a4,a5,a10,a11,a12,a13,a14,a15 are even
# and a1,a2,a6,a7,a8,a9 are odd.
# The defining equations have been organised so that 
# eqn(1)..eqn(21) are purely even*even terms
# eqn(22)..eqn(42) have odd*odd and even*even terms
# and eqn(43)..eqn(72) have purely odd*even terms.
#
# a15 := (x-u)**2; a14 := 1; a13 := x + u; a12 := x*u; 
# a11 := x*u*(x+u); a10 := (x*u)**2; a9 := (y-v)/(x-u);
# a8 := (u*y-x*v)/(x-u); a7 := (u**2*y-x**2*v)/(x-u);
# a6 := (u**3*y-x**3*v)/(x-u); a5 := (f0xu-2*y*v)/((x-u)**2);
# a4 := (f1xu-(x+u)*y*v)/((x-u)**2); a3 := (x*u)*a5;
# ## where f0xu, f1xu are
# f0xu := 2*f0+f1*(x+u)+2*f2*(x*u)+f3*(x+u)*(x*u)
#              +2*f4*(x*u)**2+f5*(x+u)*(x*u)**2+2*f6*(x*u)**3;
# f1xu := f0*(x+u)+2*f1*(x*u)+f2*(x+u)*(x*u)+2*f3*(x*u)**2
#              +f4*(x+u)*(x*u)**2+2*f5*(x*u)**3+f6*(x+u)*(x*u)**3;
# a2:=(gxu*y-gux*v)/((x-u)**3); a1:=(hxu*y-hux*v)/((x-u)**3);
# where gxu, gux, hxu, hux are
# gxu := f0*4+f1*(x+3*u)+f2*(2*x*u+2*u**2)+f3*(3*x*u**2+u**3)
#          +f4*(4*x*u**3)+f5*x*(x*u**3+3*u**4)+f6*2*x*(x*u**4+u**5);
# gux := f0*4+f1*(u+3*x)+f2*(2*u*x+2*x**2)+f3*(3*u*x**2+x**3)
#          +f4*(4*u*x**3)+f5*u*(u*x**3+3*x**4)+f6*2*u*(u*x**4+x**5);
# hxu := f0*2*(x+u)+f1*u*(3*x+u)+f2*4*x*u**2+f3*x*u**2*(x+3*u)
#         +f4*2*x*u**3*(x+u)+f5*x*u**4*(3*x+u)+f6*4*x**2*u**5;
# hux := f0*2*(u+x)+f1*x*(3*u+x)+f2*4*u*x**2+f3*u*x**2*(u+3*x)
#          +f4*2*u*x**3*(u+x)+f5*u*x**4*(3*u+x)+f6*4*u**2*x**5;
# a0 :=a5**2;
#
# We shall only requre here three of these.

eqn(8) := -f1*a14**2-f3*a14*a12+2*f4*a13*a12-f5*a12**2-2*a4*a14-2*f4*
a14*a11+a5*a13;
eqn(17) := -a10*a14+a12**2;
eqn(20) := -a12*a13+a11*a14;

# The following removes the 12^2 and a12*a13 terms from eqn(8):
eqnvar := expand( eqn(8) + f5*eqn(17)  + 2*f4*eqn(20) );
a5a13 := expand( a5*a13 - eqnvar );
a5x1plusx2 := simplify(a5a13/a14);
# This gives a5x1plusx2 (which is: a5*(x1+x2)) as:
# a5x1plusx2 := f1*a14+f3*a12+2*a4+f5*a10;
# The following is just by the definition of a3:
a5x1timesx2 := a3;
a5a5 := a0;
# Then (k1,k2,k3,k4) = (a5, a5x1plusx2, a5x1timesx2, a5a5).
#  = (a5, f1*a14+f3*a12+2*a4+f5*a10, a3, a0).
# As usual, let si = ai/a0, for i=0..15.
# Then (k1,k2,k3,k4) = (s5, f1*s14+f3*s12+2*s4+f5*s10, s3, s0).
# We can express each si as a power series in the local parameters s1,s2.

#
# The following is from the file which gives the local power series.
# The following file gives the local power series expansions
# of the local coordinates: s0,..,s15 in terms of the local
# parameters s1,s2 up to terms of degree 3 in f0,..,f6.
# (where si=ai/a0 for all i, where a0,..,a15 are as defined
#  in the file genus2/jacobian.variety/defining.equations)
# This means that: 
#   s3,s4,s5 are given up to (and including) degree 8 in s1,s2,
#   s6,s7,s8,s9 are given up to (and including) degree 9 in s1,s2,
#   s10,...,s15 are given up to (and including) degree 10 in s1,s2. 
# Note that s0,s1,s2 are given exactly, and that the expansions
# of s3,s4,s5 contain terms only of even degree in s1,s2,
# s6,s7,s8,s9 contain terms only of odd degree in s1,s2,
# and s10,..,s15 contain terms only of even degree in s1,s2.
# As a consequence, every power series given in this file
# is o.k. up to and including degree 9 in s1,s2. 


s0 := 1;

s1 := s1;

s2 := s2;

s3 := s1^2-f0*s2^4-f4*s1^4-5*f4^3*s1^8+2*f4^2*s1^6-f2*f5^2*s1^8-5*f2^2*f0*s2^8-
f6^2*f0*s1^8-f6*f3^2*s1^8-f2*f5*f1*s1^4*s2^4-14*f2*f6*f0*s1^4*s2^4-16*f2*f6*f4*
s1^8-4*f2*f5*f0*s1^3*s2^5-4*f2*f0*f4*s1^2*s2^6+3*f6*f5*f1*s1^8+3*f6*f1^2*s1^4*
s2^4+f5*f1*s1^4*s2^2-f5*f3*s1^6+12*f6*f5*f0*s1^7*s2-8*f6*f1*f0*s1^3*s2^5-24*f6*
f1*f4*s1^7*s2+6*f6*f1*f3*s1^6*s2^2-52*f6*f0^2*s1^2*s2^6-40*f6*f0*f4*s1^6*s2^2+
24*f6*f0*f3*s1^5*s2^3-2*f5^2*f1*s1^7*s2-2*f5^2*f0*s1^6*s2^2-2*f5*f1*f0*s1^2*s2^
6-4*f5*f1*f4*s1^6*s2^2-20*f5*f0^2*s1*s2^7-12*f5*f0*f4*s1^5*s2^3+5*f5*f0*f3*s1^4
*s2^4+5*f5*f4*f3*s1^8+2*f1*f0*f3*s2^8-9*f0^2*f4*s2^8-6*f0*f4^2*s1^4*s2^4+4*f2*
f6*s1^6+2*f2*f0*s2^6+8*f6*f1*s1^5*s2+18*f6*f0*s1^4*s2^2+4*f5*f0*s1^3*s2^3+2*f0*
f4*s1^2*s2^4;

s4 := s1*s2-f2^2*f5*s1^4*s2^4+f2*f6*f5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s2^6+4*f0*f3*s1*s2^7-8*f4^2*s1^6*s2^2-4*f4*f3*s1^5*s2
^3+4*f5*s1^5*s2+4*f1*s1*s2^5+4*f4*s1^4*s2^2+4*f3*s1^3*s2^3-2*f2*f5*f3*s1^6*s2^4
-2*f1*f4*f3*s1^4*s2^6+64*f2*f5*f0*s1^3*s2^7+64*f6*f1*f4*s1^7*s2^3;


# Then (k1,k2,k3,k4) = (s5, f1*s14+f3*s12+2*s4+f5*s10, s3, s0).
k1ps := subs(f6=ff6, f5=ff5, f4=ff4, f3=ff3, f2=ff2, f1=ff1, f0=ff0, s5); 
k2ps := expand(subs(f6=ff6, f5=ff5, f4=ff4, f3=ff3, f2=ff2, f1=ff1, f0=ff0,
                  f1*s14+f3*s12+2*s4+f5*s10 ));
k3ps := subs(f6=ff6, f5=ff5, f4=ff4, f3=ff3, f2=ff2, f1=ff1, f0=ff0, s3);
k4ps := subs(f6=ff6, f5=ff5, f4=ff4, f3=ff3, f2=ff2, f1=ff1, f0=ff0, s0);

# The following checks that, as we would expect, 
# the degree 4,6,8,10 terms vanish in kummeqn.
kummeqnps := expand(subs(k1=k1ps, k2=k2ps, k3=k3ps, k4=k4ps, kummeqn));
coeff( subs(s1=z*s1, s2=z*s2, kummeqnps), z, 4 );
coeff( subs(s1=z*s1, s2=z*s2, kummeqnps), z, 6 );
coeff( subs(s1=z*s1, s2=z*s2, kummeqnps), z, 8 );
coeff( subs(s1=z*s1, s2=z*s2, kummeqnps), z, 10 );
coeff( subs(s1=z*s1, s2=z*s2, kummeqnps), z, 12 );

l1ps := expand(subs(k1=k1ps, k2=k2ps, k3=k3ps, k4=k4ps, l1));
l2ps := expand(subs(k1=k1ps, k2=k2ps, k3=k3ps, k4=k4ps, l2));
l3ps := expand(subs(k1=k1ps, k2=k2ps, k3=k3ps, k4=k4ps, l3));
l4ps := expand(subs(k1=k1ps, k2=k2ps, k3=k3ps, k4=k4ps, l4));

part1 := expand( (l2^2-4*l1*l3)*l4^2  - k4^16*kummeqn);
part1ps := expand( subs(k1=k1ps, k2=k2ps, k3=k3ps, k4=k4ps, part1) );
# The following is the initial degree 6 portions of part1ps.
part1psd6 := coeff( subs(s1=z*s1, s2=z*s2, part1ps), z, 6 );
# This gave:
# part1psd6 := -13*s1^6-3072*s2^6-5440*s1^2*s2^4+6656*s1*s2^5
# -860*s1^4*s2^2+2720*s1^3*s2^3+136*s1^5*s2;

# The following are the initial degree 2 portions of l1ps,l2ps,l3ps.
l1psd2 := coeff( subs(s1=z*s1, s2=z*s2, l1ps), z, 2 );
l2psd2 := coeff( subs(s1=z*s1, s2=z*s2, l2ps), z, 2 );
l3psd2 := coeff( subs(s1=z*s1, s2=z*s2, l3ps), z, 2 );
# The above gave: s2^2, 2*s1*s2, s1^2, respectively.
# Hence the following are all zero:
l1psd2*l2psd2^2 - 4*l1psd2^2*l3psd2;
l2psd2^3 - 4*l1psd2*l2psd2*l3psd2;
l2psd2^2*l3psd2 - 4*l1psd2*l3psd2^2;
# (the above is likely why we didn't resolve the quartic before). 
# The following give, respectively: 
# s2^6, s1*s2^5, s1^2*s2^4, s1^3*s2^3, s1^4*s2^2, s1^5*s2, s1^6.
l1psd2^3;
(1/2)*l1psd2^2*l2psd2;
l1psd2^2*l3psd2;
(1/2)*l1psd2*l2psd2*l3psd2;
l1psd2*l3psd2^2;
(1/2)*l2psd2*l3psd2^2;
l3psd2^3;
# We shall now create part2 which makes the degree 6 terms vanish. 
part2ps := part1ps
   - coeff(part1psd6,s2,6)*l1ps^3*l4ps
   - coeff(coeff(part1psd6,s2,5),s1,1)*(1/2)*l1ps^2*l2ps*l4ps
   - coeff(coeff(part1psd6,s2,4),s1,2)*l1ps^2*l3ps*l4ps
   - coeff(coeff(part1psd6,s2,3),s1,3)*(1/2)*l1ps*l2ps*l3ps*l4ps
   - coeff(coeff(part1psd6,s2,2),s1,4)*l1ps*l3ps^2*l4ps
   - coeff(coeff(part1psd6,s2,1),s1,5)*(1/2)*l2ps*l3ps^2*l4ps
   - coeff(part1psd6,s1,6)*l3ps^3*l4ps
   - t1*(l1ps*l2ps^2 - 4*l1ps^2*l3ps)*l4ps
   - t2*(l2ps^3 - 4*l1ps*l2ps*l3ps)*l4ps
   - t3*(l2ps^2*l3ps - 4*l1ps*l3ps^2)*l4ps;
# This was: 
# part2ps := part1ps
# - l4ps*( - 3072*l1ps^3
#          + 3328*l1ps^2*l2ps
#          - 5440*l1ps^2*l3ps
#          + 1360*l1ps*l2ps*l3ps
#          - 860*l1ps*l3ps^2
#          + 68*l2ps*l3ps^2
#          - 13*l3ps^3
#          + t1*(l1ps*l2ps^2 - 4*l1ps^2*l3ps)
#          + t2*(l2ps^3 - 4*l1ps*l2ps*l3ps)
#          + t3*(l2ps^2*l3ps - 4*l1ps*l3ps^2) );
# 
# 
part2 := part1
 - l4*( - 3072*l1^3
        + 3328*l1^2*l2
        - 5440*l1^2*l3
        + 1360*l1*l2*l3
        - 860*l1*l3^2
        + 68*l2*l3^2
        - 13*l3^3
        + t1*(l1*l2^2 - 4*l1^2*l3)
        + t2*(l2^3 - 4*l1*l2*l3)
        + t3*(l2^2*l3 - 4*l1*l3^2) );
part2 := expand(part2);
# 
# 
# 
# 
# 
part2ps := expand(part2ps);
# The following is zero:
part2psd6 := coeff( subs(s1=z*s1, s2=z*s2, part2ps), z, 6 );
# Now focus on the degree 8 part: 
part2psd8 := coeff( subs(s1=z*s1, s2=z*s2, part2ps), z, 8 );
# 
# The following are all zero:
l1psd2^2*l2psd2^2 - 4*l1psd2^3*l3psd2;
l1psd2*l2psd2^3 - 4*l1psd2^2*l2psd2*l3psd2;
l1psd2*l2psd2^2*l3psd2 - 4*l1psd2^2*l3psd2^2;
l2psd2^4 - 4*l1psd2*l2psd2^2*l3psd2;
l2psd2^3*l3psd2 - 4*l1psd2*l2psd2*l3psd2^2;
l2psd2^2*l3psd2^2 - 4*l1psd2*l3psd2^3;
# The following give, respectively: 
# s2^8, s1*s2^7, s1^2*s2^6, s1^3*s2^5, s1^4*s2^4,
# s1^5*s2^3, s1^6*s2^2, s1^7*s2, s1^8.
l1psd2^4;
(1/2)*l1psd2^3*l2psd2;
l1psd2^3*l3psd2;
(1/2)*l1psd2^2*l2psd2*l3psd2;
l1psd2^2*l3psd2^2;
(1/2)*l1psd2*l2psd2*l3psd2^2;
l1psd2*l3psd2^3;
(1/2)*l2psd2*l3psd2^3;
l3psd2^4;
# 

part3ps := part2ps
   - coeff(part2psd8,s2,8)*l1ps^4
   - coeff(coeff(part2psd8,s2,7),s1,1)*(1/2)*l1ps^3*l2ps
   - coeff(coeff(part2psd8,s2,6),s1,2)*l1ps^3*l3ps
   - coeff(coeff(part2psd8,s2,5),s1,3)*(1/2)*l1ps^2*l2ps*l3ps
   - coeff(coeff(part2psd8,s2,4),s1,4)*l1ps^2*l3ps^2
   - coeff(coeff(part2psd8,s2,3),s1,5)*(1/2)*l1ps*l2ps*l3ps^2
   - coeff(coeff(part2psd8,s2,2),s1,6)*l1ps*l3ps^3
   - coeff(coeff(part2psd8,s2,1),s1,7)*(1/2)*l2ps*l3ps^3
   - coeff(part2psd8,s1,8)*l3ps^4
   - t4*(l1ps^2*l2ps^2 - 4*l1ps^3*l3ps)
   - t5*(l1ps*l2ps^3 - 4*l1ps^2*l2ps*l3ps)
   - t6*(l1ps*l2ps^2*l3ps - 4*l1ps^2*l3ps^2)
   - t7*(l2ps^4 - 4*l1ps*l2ps^2*l3ps)
   - t8*(l2ps^3*l3ps - 4*l1ps*l2ps*l3ps^2)
   - t9*(l2ps^2*l3ps^2 - 4*l1ps*l3ps^3);
# This was: 
# part3ps := part2ps
#    - (  (3072*t1+5931008)*l1ps^4
#       + (-7331840+3072*t2-3328*t1)*l1ps^3*l2ps
#       + (14735360-13312*t2+5440*t1+3072*t3)*l1ps^3*l3ps
#       + (-4715008+5440*t2-1360*t1-3328*t3)*l1ps^2*l2ps*l3ps
#       + (4051840-5440*t2+860*t1+5440*t3)*l1ps^2*l3ps^2
#       + (-593152+860*t2-68*t1-1360*t3)*l1ps*l2ps*l3ps^2
#       + (259440-272*t2+13*t1+860*t3)*l1ps*l3ps^3
#       + (-17640+13*t2-68*t3)*l2ps*l3ps^3
#       + (13*t3+3043)*l3ps^4
#       + t4*(l1ps^2*l2ps^2 - 4*l1ps^3*l3ps)
#       + t5*(l1ps*l2ps^3 - 4*l1ps^2*l2ps*l3ps)
#       + t6*(l1ps*l2ps^2*l3ps - 4*l1ps^2*l3ps^2)
#       + t7*(l2ps^4 - 4*l1ps*l2ps^2*l3ps)
#       + t8*(l2ps^3*l3ps - 4*l1ps*l2ps*l3ps^2)
#       + t9*(l2ps^2*l3ps^2 - 4*l1ps*l3ps^3) );

part3 := part2
    - (  (3072*t1+5931008)*l1^4
       + (-7331840+3072*t2-3328*t1)*l1^3*l2
       + (14735360-13312*t2+5440*t1+3072*t3)*l1^3*l3
       + (-4715008+5440*t2-1360*t1-3328*t3)*l1^2*l2*l3
       + (4051840-5440*t2+860*t1+5440*t3)*l1^2*l3^2
       + (-593152+860*t2-68*t1-1360*t3)*l1*l2*l3^2
       + (259440-272*t2+13*t1+860*t3)*l1*l3^3
       + (-17640+13*t2-68*t3)*l2*l3^3
       + (13*t3+3043)*l3^4
       + t4*(l1^2*l2^2 - 4*l1^3*l3)
       + t5*(l1*l2^3 - 4*l1^2*l2*l3)
       + t6*(l1*l2^2*l3 - 4*l1^2*l3^2)
       + t7*(l2^4 - 4*l1*l2^2*l3)
       + t8*(l2^3*l3 - 4*l1*l2*l3^2)
       + t9*(l2^2*l3^2 - 4*l1*l3^3) );
part3 := expand(part3);
# 
# 
# 
part3ps := expand(part3ps);
# The following is zero, as expected. 
part3psd8 := coeff( subs(s1=z*s1, s2=z*s2, part3ps), z, 8 );
# 
# Now consider the degree 10 terms. 
part3psd10 := coeff( subs(s1=z*s1, s2=z*s2, part3ps), z, 10 );
eq0 := coeff( part3psd10, s2, 10);
eq1 := coeff( coeff( part3psd10, s2, 9), s1, 1);
eq2 := coeff( coeff( part3psd10, s2, 8), s1, 2);
eq3 := coeff( coeff( part3psd10, s2, 7), s1, 3);
eq4 := coeff( coeff( part3psd10, s2, 6), s1, 4);
eq5 := coeff( coeff( part3psd10, s2, 5), s1, 5);
eq6 := coeff( coeff( part3psd10, s2, 4), s1, 6);
eq7 := coeff( coeff( part3psd10, s2, 3), s1, 7);
eq8 := coeff( coeff( part3psd10, s2, 2), s1, 8);
eq9 := coeff( coeff( part3psd10, s2, 1), s1, 9);
eq10 := coeff( part3psd10, s1, 10);
subt := solve( {eq0,eq1,eq2,eq3,eq4,eq5,eq6,eq7,eq8,eq9,eq10}, 
               {t1,t2,t3,t4,t5,t6,t7,t8,t9} );
# This gave:
# subt := {t1 = -2944, t2 = 224, t3 = -216, t4 = -1879040, 
# t5 = 225280, t6 = -234240-4*t7, t7 = t7, t8 = 2560, t9 = -1600}; 
expand( subs( op(subt), part3psd10 ) );

part3subt1 := expand( subs( op(subt), part3 ) );
factor( coeff( part3subt1, k4, 17) );
part3subt2 := expand( part3subt1 - simplify(%/(k2^2-4*k1*k3))*k4^15*kummeqn );
factor( coeff( part3subt2, k4, 16) );
part3subt3 := expand( part3subt2 - simplify(%/(k2^2-4*k1*k3))*k4^14*kummeqn );
factor( coeff( part3subt3, k4, 15) );
part3subt4 := expand( part3subt3 - simplify(%/(k2^2-4*k1*k3))*k4^13*kummeqn );
factor( coeff( part3subt4, k4, 14) );
# The following finally forces the value of t7:
t7soln := solve(coeff(%,k3,6));
# This gave: t7soln := -2560;
part3subt := subs( op(subt), part3 );
part3subt := subs( t7 = t7soln, part3subt );
factorsofpart3subt := [factors(part3subt)];
# The following is a constant, proving the part3subt has kummeqn as a factor. 
simplify(factorsofpart3subt[1][2][2][1]/kummeqn);

# 
# Now, subst the following: 
# t1 = -2944, t2 = 224, t3 = -216, t4 = -1879040, t5 = 225280, 
# t6 = -224000, t7 = -2560, t8 = 2560, t9 = -1600,
# into the following: 
quarticl := subs( t1 = -2944, t2 = 224, t3 = -216, t4 = -1879040, t5 = 225280,
                  t6 = -224000, t7 = -2560, t8 = 2560, t9 = -1600,
            (l2^2-4*l1*l3)*l4^2
           - l4*( - 3072*l1^3
                  + 3328*l1^2*l2
                  - 5440*l1^2*l3
                  + 1360*l1*l2*l3
                  - 860*l1*l3^2
                  + 68*l2*l3^2
                  - 13*l3^3
                  + t1*(l1*l2^2 - 4*l1^2*l3)
                  + t2*(l2^3 - 4*l1*l2*l3)
                  + t3*(l2^2*l3 - 4*l1*l3^2) )
           - (  (3072*t1+5931008)*l1^4
              + (-7331840+3072*t2-3328*t1)*l1^3*l2
              + (14735360-13312*t2+5440*t1+3072*t3)*l1^3*l3
              + (-4715008+5440*t2-1360*t1-3328*t3)*l1^2*l2*l3
              + (4051840-5440*t2+860*t1+5440*t3)*l1^2*l3^2
              + (-593152+860*t2-68*t1-1360*t3)*l1*l2*l3^2
              + (259440-272*t2+13*t1+860*t3)*l1*l3^3
              + (-17640+13*t2-68*t3)*l2*l3^3
              + (13*t3+3043)*l3^4
              + t4*(l1^2*l2^2 - 4*l1^3*l3)
              + t5*(l1*l2^3 - 4*l1^2*l2*l3)
              + t6*(l1*l2^2*l3 - 4*l1^2*l3^2)
              + t7*(l2^4 - 4*l1*l2^2*l3)
              + t8*(l2^3*l3 - 4*l1*l2*l3^2)
              + t9*(l2^2*l3^2 - 4*l1*l3^3) ) );

simplify([factors(quarticl)][1][2][2][1]/kummeqn);



quarticll := subs( t1 = -2944, t2 = 224, t3 = -216, t4 = -1879040, t5 = 225280,
                  t6 = -224000, t7 = -2560, t8 = 2560, t9 = -1600,
            (ll2^2-4*ll1*ll3)*ll4^2
           - ll4*( - 3072*ll1^3
                  + 3328*ll1^2*ll2
                  - 5440*ll1^2*ll3
                  + 1360*ll1*ll2*ll3
                  - 860*ll1*ll3^2
                  + 68*ll2*ll3^2
                  - 13*ll3^3
                  + t1*(ll1*ll2^2 - 4*ll1^2*ll3)
                  + t2*(ll2^3 - 4*ll1*ll2*ll3)
                  + t3*(ll2^2*ll3 - 4*ll1*ll3^2) )
           - (  (3072*t1+5931008)*ll1^4
              + (-7331840+3072*t2-3328*t1)*ll1^3*ll2
              + (14735360-13312*t2+5440*t1+3072*t3)*ll1^3*ll3
              + (-4715008+5440*t2-1360*t1-3328*t3)*ll1^2*ll2*ll3
              + (4051840-5440*t2+860*t1+5440*t3)*ll1^2*ll3^2
              + (-593152+860*t2-68*t1-1360*t3)*ll1*ll2*ll3^2
              + (259440-272*t2+13*t1+860*t3)*ll1*ll3^3
              + (-17640+13*t2-68*t3)*ll2*ll3^3
              + (13*t3+3043)*ll3^4
              + t4*(ll1^2*ll2^2 - 4*ll1^3*ll3)
              + t5*(ll1*ll2^3 - 4*ll1^2*ll2*ll3)
              + t6*(ll1*ll2^2*ll3 - 4*ll1^2*ll3^2)
              + t7*(ll2^4 - 4*ll1*ll2^2*ll3)
              + t8*(ll2^3*ll3 - 4*ll1*ll2*ll3^2)
              + t9*(ll2^2*ll3^2 - 4*ll1*ll3^3) ) );

quarticll :=   ll4^2*(ll2^2-4*ll1*ll3)
             + ll4*(3072*ll1^3-3328*ll1^2*ll2-6336*ll1^2*ll3+2944*ll1*ll2^2
                    -464*ll1*ll2*ll3-4*ll1*ll3^2-224*ll2^3+216*ll2^2*ll3
                    -68*ll2*ll3^2+13*ll3^3)
             + (3112960*ll1^4-3153920*ll1^3*ll2-2590720*ll1^3*ll3 
                +1879040*ll1^2*ll2^2-325120*ll1^2*ll2*ll3-22400*ll1^2*ll3^2
                -225280*ll1*ll2^3+213760*ll1*ll2^2*ll3-83200*ll1*ll2*ll3^2
                +19120*ll1*ll3^3+2560*ll2^4-2560*ll2^3*ll3+1600*ll2^2*ll3^2
                +40*ll2*ll3^3-235*ll3^4);

quarticl :=   l4^2*(l2^2-4*l1*l3)
             + l4*(3072*l1^3-3328*l1^2*l2-6336*l1^2*l3+2944*l1*l2^2
                    -464*l1*l2*l3-4*l1*l3^2-224*l2^3+216*l2^2*l3
                    -68*l2*l3^2+13*l3^3)
             + (3112960*l1^4-3153920*l1^3*l2-2590720*l1^3*l3 
                +1879040*l1^2*l2^2-325120*l1^2*l2*l3-22400*l1^2*l3^2
                -225280*l1*l2^3+213760*l1*l2^2*l3-83200*l1*l2*l3^2
                +19120*l1*l3^3+2560*l2^4-2560*l2^3*l3+1600*l2^2*l3^2
                +40*l2*l3^3-235*l3^4);

# The following returns a constant, showing that kummeqn divides quarticl.
chk := simplify([factors(quarticl)][1][2][1][1]/kummeqn);
# The following is an alternative (returns true).
# 
chk1 := divide(quarticl, kummeqn);

# 
# We recall that the following is the general kummer eqn. 
# We wish to recognise the above quarticl as a kummer eqn,
# after a possible linear change in l1,l2,l3,l4. 
# R,S,T are as follows:
# kumR := k2**2-4*k1*k3:
# kumS := -4*k1**3*f0-2*k1**2*k2*f1-4*k1**2*k3*f2-2*k1*k2*k3*f3
# -4*k1*k3**2*f4-2*k2*k3**2*f5-4*k3**3*f6:
# kumT := -4*k1**4*f0*f2+k1**4*f1**2-4*k1**3*k2*f0*f3
# -2*k1**3*k3*f1*f3-4*k1**2*k2**2*f0*f4+4*k1**2*k2*k3*f0*f5
# -4*k1**2*k2*k3*f1*f4-4*k1**2*k3**2*f0*f6+2*k1**2*k3**2*f1*f5
# -4*k1**2*k3**2*f2*f4+k1**2*k3**2*f3**2-4*k1*k2**3*f0*f5
# +8*k1*k2**2*k3*f0*f6-4*k1*k2**2*k3*f1*f5+4*k1*k2*k3**2*f1*f6
# -4*k1*k2*k3**2*f2*f5-2*k1*k3**3*f3*f5-4*k2**4*f0*f6-4*k2**3*k3*f1*f6
# -4*k2**2*k3**2*f2*f6-4*k2*k3**3*f3*f6-4*k3**4*f4*f6+k3**4*f5**2:
# kummeqn := kumR*k4**2+kumS*k4+kumT:

# Note that in the following portion of quarticl: 
# + l4*(3072*l1^3-3328*l1^2*l2-6336*l1^2*l3+2944*l1*l2^2
# -464*l1*l2*l3-4*l1*l3^2-224*l2^3+216*l2^2*l3
# -68*l2*l3^2+13*l3^3)
# there are terms: l1*l2^2*l4, l2^3*l4, l2^2*l3*l4, 
# which do not appear in kummeqn. So, subst:
# l4 = varl4 + u1*l1 + u2*l2 + u3*l3
# 

varquarticll := subs( ll4 = varll4 + u1*ll1 + u2*ll2 + u3*ll3, quarticll );
eqn := coeff( expand(varquarticll), varll4, 1);

eqn1 := coeff(coeff(eqn,ll1,1),ll2,2);
eqn2 := coeff(eqn,ll2,3);
eqn3 := coeff(coeff(eqn,ll2,2),ll3,1);
u1soln := solve(eqn1);
u2soln := solve(eqn2);
u3soln := solve(eqn3);
newquarticll := 
  subs( ll4 = varll4 + u1soln*ll1 + u2soln*ll2 + u3soln*ll3, quarticll );
fff0 := coeff(coeff(newquarticll,varll4,1),ll1,3)/(-4);
fff1 := coeff(coeff(coeff(newquarticll,varll4,1),ll1,2),ll2,1)/(-2);
fff2 := coeff(coeff(coeff(newquarticll,varll4,1),ll1,2),ll3,1)/(-4);
fff3 := 
 coeff(coeff(coeff(coeff(newquarticll,varll4,1),ll1,1),ll2,1),ll3,1)/(-2);
fff4 := coeff(coeff(coeff(newquarticll,varll4,1),ll1,1),ll3,2)/(-4);
fff5 := coeff(coeff(coeff(newquarticll,varll4,1),ll2,1),ll3,2)/(-2);
fff6 := coeff(coeff(newquarticll,varll4,1),ll3,3)/(-4);

chkum := subs( f0=fff0, f1=fff1, f2=fff2, f3=fff3, f4=fff4, f5=fff5, f6=fff6,
                k1=ll1, k2=ll2, k3=ll3, k4=varll4,
               kumR*k4**2+kumS*k4+kumT );
# The following is zero, proving that we now have exactly the 
# form of a Kummer eqn for y^2 = fff6*x^6 + ... + fff0. 
# 
# The following confirms that after replacing ll4 with varll4, 
# the Kummer equation precisely agrees with he new version of the quartic. 
chk := expand(chkum - newquarticll);

newsextic := fff6*x^6 + fff5*x^5 + fff4*x^4 + fff3*x^3 
              + fff2*x^2 + fff1*x + fff0;

newsextic := -13/4*x^6+34*x^5-215*x^4+680*x^3-1360*x^2+1664*x-768;
DD := newsextic;
gg6 := coeff(DD,x,6);
gg5 := coeff(DD,x,5);
gg4 := coeff(DD,x,4);
gg3 := coeff(DD,x,3);
gg2 := coeff(DD,x,2);
gg1 := coeff(DD,x,1);
gg0 := coeff(DD,x,0);
kummeqnD :=
subs(f6=gg6, f5=gg5, f4=gg4, f3=gg3, f2=gg2, f1=gg1, f0=gg0, kummeqngeneral);

l1 := l1;
l2 := l2;
l3 := l3;
# The following adjusts l4, replacing it with varl4, as above. 
varl4 := expand(l4 - u1soln*l1 - u2soln*l2 - u3soln*l3);
l4 := varl4;

# The following confirms that the map (k1,k2,k3,k4) |--> (l1,l2,l3,l4) 
# is indeed from the Kummer of C to the Kummer of D.
kummeqnDkk := subs(k1=kk1,k2=kk2,k3=kk3,k4=kk4, kummeqnD);
chk2 := divide(expand(subs(kk1=l1,kk2=l2,kk3=l3,kk4=l4,kummeqnDkk)),
        expand(kummeqn));

# Our model for C is already quite nice: 
Cnice := C;

# Now get the correct twist and check via 2-descent rank parities. 
# So far, we know that there is a map from the Kummer surface of:  
# C : y^2 = 256-640*x+560*x^2-200*x^3+25*x^4+x^5
# to the Kummer surface of:
# D : y^2 = -13/4*x^6+34*x^5-215*x^4+680*x^3-1360*x^2+1664*x-768  
# Note that C has the point (1,sqrt(2)), so that the quadratic twist:  
# C^(2) : y^2 = 2*(256-640*x+560*x^2-200*x^3+25*x^4+x^5)
# has the point (1,2). 
# Also define:  
# D^(2) : y^2 = 2*(-13/4*x^6+34*x^5-215*x^4+680*x^3-1360*x^2+1664*x-768).
# So, now take { (1,2), infty } on the Jacobian of C^(2),  
# map it to: P = { (1,sqrt(2)), infty } on the Jacobian of C.
#  
Pk1 := 0;
Pk2 := 1;
Pk3 := 1;
Pk4 := solve( subs( k1=Pk1, k2 = Pk2, k3 = Pk3, kummeqn ) )[1];
chk := simplify( subs( f6=ff6, f5=ff5, f4=ff4, f3=ff3, f2=ff2, f1=ff1, f0=ff0,
             k1=Pk1, k2=Pk2, k3=Pk3, k4=Pk4, kummeqn ) );
# The above gave: (0,1,1,1) on the Kummer surface of C. 
# Now put this into the quintic map from the Kummer surface of C 
# to the Kummer surface of D. 
Pl1 := subs( k1 = Pk1, k2 = Pk2, k3 = Pk3, k4 =Pk4, l1 );
Pl2 := subs( k1 = Pk1, k2 = Pk2, k3 = Pk3, k4 =Pk4, l2 );
Pl3 := subs( k1 = Pk1, k2 = Pk2, k3 = Pk3, k4 =Pk4, l3 );
Pl4 := subs( k1 = Pk1, k2 = Pk2, k3 = Pk3, k4 =Pk4, l4 );
# The above gave: ( 45/4, 36, 45, 9397 ) on the Kummer surface of D. 
# 
solve( x^2 - (Pl2/Pl1)*x + (Pl3/Pl1), x );
# The above give: x1 = 8/5+6/5*I, x2 = 8/5-6/5*I as the x-coordinates.
# The final map from D to D^(2) does not affect the x-coordinates. 
# The correct twist should mean that something Q-rational in the
# Jacobian of C^(2) should map to something Q-rational in the 
# Jacobian of D^(2). 
sqrt(subs( x = 8/5+6/5*I, 2*DD ));
# This gives: 3672/125+304/125*I. 
# So that map from the Kummer of C^(2) to the Kummer of D^(2) 
# lifts to the Jacobian, since: 
# { (1,0), infty } |--> { (8/5+6/5*I,3672/125+304/125*I), conjugate }. 
# This means that we already have the correct twist, 
# and the Jacobian of C is (5,5)-isogenous over Q to the Jacobian of DD.

# Note that the above curve D has a Weierstrass point! 
# Try to rewrite so that it obviously has two indep pts order 5,
# and see if I can recognise a family. Also map it back. 
# First convert to quintic form, by mapping the Weierstrass pt to infinity.
DD := -13/4*x^6+34*x^5-215*x^4+680*x^3-1360*x^2+1664*x-768;
factor(%);
# -1/4*(x-2)*(13*x^5-110*x^4+640*x^3-1440*x^2+2560*x-1536)
subs(x=x+2, %);
# -1/4*x*(13*(x+2)^5-110*(x+2)^4+640*(x+2)^3-1440*(x+2)^2+2560*x+3584)
factor(%);
# -1/4*x*(13*x^5+20*x^4+280*x^3+800*x^2+2000*x+1600)
subs(x=1/x,%);
# -1/4/x*(13/x^5+20/x^4+280/x^3+800/x^2+2000/x+1600)
%*x^6;
# -1/4*x^5*(13/x^5+20/x^4+280/x^3+800/x^2+2000/x+1600)
factor(%);
# -13/4-5*x-70*x^2-200*x^3-500*x^4-400*x^5
subs(x=-x,%);
# -13/4+5*x-70*x^2+200*x^3-500*x^4+400*x^5
rr := subs(x=x/10,%)*25*100;
# So, we'll take this as our nicer form of D. 
Dnice := rr;
# rr := -8125+1250*x-1750*x^2+500*x^3-125*x^4+10*x^5 
# We want to write rr in the form:
# constant*(quadratic)^2 + 10*(x-s)^5 
# 
ss := rr - 10*(x-s)^5;
# ss := -8125+1250*x-1750*x^2+500*x^3-125*x^4+10*x^5-10*(x-s)^5; 
ss := expand(ss);
# ss := -8125+1250*x-1750*x^2+500*x^3-125*x^4+50*x^4*s-100*x^3*s^2
# +100*x^2*s^3-50*x*s^4+10*s^5;
# We want s to be chosen so that this is constant*(quadratic in x)^2, 
# so find the discrim in x, and solve for s, which will at least 
# force the quartic in x to have repeated roots.
factor(discrim(ss,x));
# 31250000*(241056640625+4*s^14-101590000*s^7+18885375*s^8-3125500*s^9
# +429550*s^10-46600*s^11+3665*s^12-180*s^13-2110587500*s^5+487215000*s^6
# +74418593750*s^2-27931125000*s^3+8042609375*s^4-184459062500*s)*(s^2-5)^2 
# We see that s := sqrt5 is worth a try.
sqrt5 := RootOf(t^2 - 5);
# sqrt5 := RootOf(_Z^2-5)
factor( rr - 10*(x - sqrt5)^5 );
# 25*(-5+2*RootOf(_Z^2-5))*(x^2+15+4*RootOf(_Z^2-5))^2 
# So, we now see that our curve D can be written as: 
# Dnice : y^2 = 25*(-5+2*sqrt5)*(x^2 + 15+4*sqrt5)^2 + 10*(x - sqrt5)^5
# Of course, since the curve is defined over Q, it can also be written: 
# Dnice : y^2 = 25*(-5-2*sqrt5)*(x^2 + 15-4*sqrt5)^2 + 10*(x + sqrt5)^5
# The points of order 5 in the kernel of the dual isogeny have support:  
# (sqrt5, 5*(5+15+4*sqrt5)*sqrt(-5+2*sqrt5), etc,
# and are defined over the quartic field Q( sqrt(-5+2*sqrt5) ).
# But note that this is just Q(zeta5), where zeta5 is a primitive 5th
# root of unity. 
zeta5 := RootOf(t^4 + t^3 + t^2 + t + 1);
# The following is zero.
simplify( (zeta5 + zeta5^4)^2 + (zeta5 + zeta5^4) - 1 );
# 
solve(x^2 + x - 1);
# 1/2*5^(1/2)-1/2, -1/2-1/2*5^(1/2)
# This following is 5, explicitly giving Q(sqrt5) as a quadratic subfield 
# of Q(zeta5). 
(2*zeta5 + 2*zeta5^4 + 1)^2;
# 
factor( x^2 - (-5 + 2*(2*zeta5 + 2*zeta5^4 + 1)) );
# -(x+1+2*RootOf(_Z^4+_Z^3+_Z^2+_Z+1)+2*RootOf(_Z^4+_Z^3+_Z^2+_Z+1)^3)
#  *(-x+1+2*RootOf(_Z^4+_Z^3+_Z^2+_Z+1)+2*RootOf(_Z^4+_Z^3+_Z^2+_Z+1)^3)
# The above shows that there is a sqrt of -5+2*sqrt5 in Q(zeta5),
# and clearly there is a C5xC5 of point of order 5, which are 
# each individually definied over Q(zeta5), and for which the
# entire C5xC5 is defined over Q. Surely this is the kernel
# of the dual isogeny (easy enough to check, by repeating this
# file on Dnice, and getting back Cnice).
factor(y^2 - subs( x = 2*zeta5 + 2*zeta5^4 + 1, Dnice ));
# -(y+80+160*RootOf(_Z^4+_Z^3+_Z^2+_Z+1)+40*RootOf(_Z^4+_Z^3+_Z^2+_Z+1)^2
# +120*RootOf(_Z^4+_Z^3+_Z^2+_Z+1)^3)*(-y+80+160*RootOf(_Z^4+_Z^3+_Z^2+_Z+1)
# +40*RootOf(_Z^4+_Z^3+_Z^2+_Z+1)^2+120*RootOf(_Z^4+_Z^3+_Z^2+_Z+1)^3)
factor(y^2 - subs( x = -2*zeta5 - 2*zeta5^4 - 1, Dnice ));
# -(-y-40-80*RootOf(_Z^4+_Z^3+_Z^2+_Z+1)-120*RootOf(_Z^4+_Z^3+_Z^2+_Z+1)^2
# +40*RootOf(_Z^4+_Z^3+_Z^2+_Z+1)^3)*(y-40-80*RootOf(_Z^4+_Z^3+_Z^2+_Z+1)
# -120*RootOf(_Z^4+_Z^3+_Z^2+_Z+1)^2+40*RootOf(_Z^4+_Z^3+_Z^2+_Z+1)^3)
# So, we see there are the points of order 5 on the Jacobian:
# DT1 := {(1+2*zeta5+2*zeta5^4, 40*(2+4*zeta5+zeta5^2+3*zeta5^3), infty}
# DT2 := {(-1-2*zeta5-2*zeta5^4, 40*(1+2*zeta5+3*zeta5^2-zeta5^3), infty} 
# The subgroup generated by { (x1,y1), infty } of order 5 is: 
# id, {(x1,y1),infty}, {(x1,y1),(x1,y1)}, {(x1,-y1),(x1,-y1)},{(x1,-y1),infty}. 
# 
# Now, consider the Cassels maps. 
# Our nice models Cnice and Dnice are as follows. 
# Cnice : y^2 = 5*(16 - 12*x + 3*x^2)^2 + (x - 4)^5
#             = (16 - 20*x + 5*x^2)^2 + x^5
# Dnice : y^2 = 25*(-5+2*sqrt5)*(x^2 + 15+4*sqrt5)^2 + 10*(x - sqrt5)^5
#             = 25*(-5-2*sqrt5)*(x^2 + 15-4*sqrt5)^2 + 10*(x + sqrt5)^5
# Let phi be the (5,5)-isogeny from Jac(Cnice) to Jac(Dnice).
# Let phitilde be the dual (5,5)-isogeny from Jac(Dnice) to Jac(Cnice).
# The Cassels map for Jac(Cnice)(Q)/ phitilde( Jac(Dnice)(Q) ) is: 
# Jac(Cnice)(Q)/ phitilde( Jac(Dnice)(Q) )
#    -->  Q(sqrt5)*/( Q(sqrt5)* )^5 x Q*/( Q* )^5
#  : {(x1,y1),(x2,y2)} |--> 
# [ (y1 - sqrt(5)*(16 - 12*x1 + 3*x1^2))*(y2 - sqrt(5)*(16 - 12*x2 + 3*x2^2)),
#   (y1 - (16 - 20*x1 + 5*x1^2))*(y2 - (16 - 20*x2 + 5*x2^2)) ].
# The Cassels map for Jac(Dnice)(Q)/ phi( Jac(Cnice)(Q) ) is: 
# Jac(Dnice)(Q)/ phi( Jac(Cnice)(Q) )
#    -->  Q(sqrt(-5+2*sqrt5))*/( Q(sqrt(-5+2*sqrt5))* )^5 
#             x Q(sqrt(-5-2*sqrt5))*/( Q(sqrt(-5-2*sqrt5))* )^5
#  : {(x1,y1),(x2,y2)} |--> 
# [ (y1 - 5*sqrt(-5+2*sqrt5)*(x1^2 + 15+4*sqrt5))
#   *(y2 - 5*sqrt(-5+2*sqrt5)*(x2^2 + 15+4*sqrt5)),
#    (y1 - 5*sqrt(-5-2*sqrt5)*(x1^2 + 15-4*sqrt5))
#   *(y2 - 5*sqrt(-5-2*sqrt5)*(x2^2 + 15-4*sqrt5)) ].
# (perhaps with a multiplicative translation, since non-monic). 
# As we have already observed, each of the quartic fields 
# Q(sqrt(-5+2*sqrt5)), Q(sqrt(-5-2*sqrt5)) can be taken to be Q(zeta5).
# Note: just to be on the safe side, better to use Cmonic 
# before using the Cassels map, just to avoid confusion about 
# traslations, and to exploit that any element in the image 
# is then in the kernel of the norm map (mod 5th powers),
# except that actually it is the Norm_{Q(zeta5)/Q(sqrt5)} which
# will be a 5th power in Q(sqrt5), when the quintic becomes monic.
# 
# Now consider what happens after a quadratic twist by r.  
Cnicer := r*Cnice;
Cnicer := r*(256-640*x+560*x^2-200*x^3+25*x^4+x^5);
Dnicer := r*Dnice;
Dnicer := r*(-8125+1250*x-1750*x^2+500*x^3-125*x^4+10*x^5);
# Cnicer : y^2 = r*( 5*(16 - 12*x + 3*x^2)^2 + (x - 4)^5 )
#              = r*( (16 - 20*x + 5*x^2)^2 + x^5 )
# Dnicer : y^2 = r*( 25*(-5+2*sqrt5)*(x^2 + 15+4*sqrt5)^2 + 10*(x - sqrt5)^5 )
#              = r*( 25*(-5-2*sqrt5)*(x^2 + 15-4*sqrt5)^2 + 10*(x + sqrt5)^5 )
# Make everything monic: 
Cmon := expand(subs( x = x/r, Cnicer)*r^4);
Cmon := 256*r^5-640*x*r^4+560*x^2*r^3-200*x^3*r^2+25*x^4*r+x^5;
Dmon := expand(subs( x = x/(10*r), Dnicer)*(10*r)^4);
Dmon := -81250000*r^5+1250000*x*r^4-175000*x^2*r^3+5000*x^3*r^2-125*x^4*r+x^5;
# Cmon: y^2 = r*5*(16*r^2 - 12*r*x + 3*x^2)^2 + (x - 4*r)^5
#           = r*(16*r^2 - 20*r*x + 5*x^2)^2 + x^5
# Dmon: y^2= 25*r*(-5+2*sqrt5)*(x^2+(15+4*sqrt5)*100*r^2)^2 + (x-10*sqrt5*r)^5
#          = 25*r*(-5-2*sqrt5)*(x^2+(15-4*sqrt5)*100*r^2)^2 + (x+10*sqrt5*r)^5
# 
# Note that the quadratic twist runs through the isogeny, 
# so we still have (5,5)-isogenies defined over Q
# between Jac(Cmon) and Jac(Dmon).
# 
# Let's see what difference is made by the quadratic twist. 
# The generators of the (5,5) on the Jacobian of Cmon are now: 
# T1 = { (4*r, 16*r^2*sqrt(5*r)), infty }.
# T2 = { (0, 16*r^2*sqrt(r)), infty }.
# As before the kernel of the isogeny <T1,T2> (the subgroup generated
# by T1,T2) is defined over Q. The entire list of 25 elements
# in <T1,T2> would require the quartic field Q( sqrt(5*r), sqrt(r) )
# but elts of <T1> are all defined over the quadratic field Q(sqrt(5*r)) 
# and elts of <T2> are all defined over the quadratic field Q(sqrt(r)). 
# The Cassels map for Jac(Cmon)(Q)/ phitilde( Jac(Dmon)(Q) ) is: 
# Jac(Cmon)(Q)/ phitilde( Jac(Dmon)(Q) )
#    -->  Q(sqrt(5*r))*/( Q(sqrt(5*r))* )^5 x Q(sqrt(r))*/( Q(sqrt(r))* )^5
#  : {(x1,y1),(x2,y2)} |--> 
#[(y1-sqrt(5*r)*(16*r^2-12*x1*r+3*x1^2))*(y2-sqrt(5*r)*(16*r^2-12*x2*r+3*x2^2)),
# (y1-sqrt(r)*(16*r^2-20*x1*r+5*x1^2))*(y2-sqrt(r)*(16*r^2-20*x2*r+5*x2^2))].
# So, this portion of the Selmer group computation would only 
# require working over quadratic number fields. 
# Note that anything in the image must have norm a 5th power in Q. This uses: 
#  (y-sqrt(5*r)*(16*r^2-12*x*r+3*x^2))*(y+sqrt(5*r)*(16*r^2-12*x*r+3*x^2)) 
#    = (x - 4*r)^5,
# (y-sqrt(r)*(16*r^2-20*x*r+5*x^2))*(y+sqrt(r)*(16*r^2-20*x*r+5*x^2))
#    = x^5. 
# 
# For Dmon, note that the generators of the (5,5) are now: 
# DT1 := { (10*sqrt5*r, 2000*r^2*sqrt(10*r*(-5+sqrt5))), infty }
# DT2 := { (-10*sqrt5*r, 2000*r^2*sqrt(10*r*(-5-sqrt5))), infty }
# As before the kernel of the isogeny <DT1,DT2> (the subgroup generated
# by DT1,DT2) is defined over Q. The entire list of 25 elements
# in <DT1,DT2> would require the degree 8 field Q( zeta5, sqrt(r) )
# but <DT1> only requires the quartic field Q(sqrt(r*(-5+2*sqrt5))).
# and <DT2> only requires the quartic field Q(sqrt(r*(-5-2*sqrt5))). 
#  
# The Cassels map for Jac(Dmon)(Q)/ phi( Jac(Cmon)(Q) ) is: 
# Jac(Dmon)(Q)/ phi( Jac(Cmon)(Q) )
#    -->  Q(sqrt(r*(-5+2*sqrt5)))*/( Q(sqrt(r*(-5+2*sqrt5)))* )^5 
#             x Q(sqrt(r*(-5-2*sqrt5)))*/( Q(sqrt(r*(-5-2*sqrt5)))* )^5
#  : {(x1,y1),(x2,y2)} |--> 
# [ (y1 - 5*sqrt(r*(-5+2*sqrt5))*(x1^2 + (15+4*sqrt5)*100*r^2))
#   *(y2 - 5*sqrt(r*(-5+2*sqrt5))*(x2^2 + (15+4*sqrt5)*100*r^2)),
#    (y1 - 5*sqrt(r*(-5-2*sqrt5))*(x1^2 + (15-4*sqrt5)*100*r^2))
#   *(y2 - 5*sqrt(r*(-5-2*sqrt5))*(x2^2 + (15-4*sqrt5)*100*r^2)) ].
# So, this portion of the Selmer group computation would only 
# require working over quartic number fields. 
# Since these are monic, any element in the image 
# is in the kernel of the norm map (mod 5th powers),
# by which we mean that Norm_{Q(sqrt(r*(-5+2*sqrt5)))/Q(sqrt5)} 
# is a 5th power in Q(sqrt5). This uses:
# (y - 5*sqrt(r*(-5+2*sqrt5))*(x^2 + (15+4*sqrt5)*100*r^2))
#    *(y + 5*sqrt(r*(-5+2*sqrt5))*(x^2 + (15+4*sqrt5)*100*r^2))
#  = (x-10*sqrt5*r)^5,   
# (y - 5*sqrt(r*(-5-2*sqrt5))*(x^2 + (15-4*sqrt5)*100*r^2))
#    *(y + 5*sqrt(r*(-5-2*sqrt5))*(x^2 + (15-4*sqrt5)*100*r^2))
#  = (x-10*sqrt5*r)^5,   
#   
# In summary, we should only even need to deal with at 
# worst quartic fields for the entire (5,5)-Selmer group computation,
# even though the complete list of the elts of the kernel
# of the dual isogeny generate a degree 8 number field.
# 
# Note also that, if we merely want to obtain examples of Sha[5]
# over Q, then it might be possible to do this using only
# quadratic number fields. If there is no 5-torsion and the rank is 0 
# (via a 2-descent in Magma) then Jac(Cmon)(Q)/5*Jac(Cmon)(Q) should
# be the trivial group, and so J(Cmon)(Q)/phitilde(Jac(Dmon(Q)))
# should also be the trivial group (being smaller than
# Jac(Cmon)(Q)/5*Jac(Cmon)(Q), since phitilde(Jac(Dmon(Q)))
# contains 5*Jac(Cmon)(Q)). So, there would be an element
# in the 5-part of Sha over Q, if there is a nontrivial element in
#  Q(sqrt(5*r))*/( Q(sqrt(5*r))* )^5 x Q(sqrt(r))*/( Q(sqrt(r))* )^5
# which is mapped to locally (under the Cassels map) for all p.
# Perhaps starts with r=q or r=-q, for q prime, and get conditions
# on q such that there is an element mapped to everywhere locally
# (and so that there is no 5-torsion) and then find an example
# where Magma gives a 2-Selmer bound of 0. 
# Since we are only dealing with quadratic fields, maybe
# a congruence class of primes is possible (see Flynn-Redmond).
# 

# The following are monic versions, which might be better for
# inputting into Magma. As an extra check I should, for lots of 
# values of r, check Magma's 2-Selmer bound on the rank of
# the Jacobians of Cmon and Dmon, which should always have the
# same parity (these are quintics, so Magma will be preforming a
# true, not fake, complete 2-descent). 
# N.B. The file ed/stollsimple shows this is abs simple, using Stoll. 
Cmon := expand(subs( x = x/r, Cnicer)*r^4);
Cmon := 256*r^5-640*x*r^4+560*x^2*r^3-200*x^3*r^2+25*x^4*r+x^5;
Dmon := expand(subs( x = x/(10*r), Dnicer)*(10*r)^4);
Dmon := -81250000*r^5+1250000*x*r^4-175000*x^2*r^3+5000*x^3*r^2-125*x^4*r+x^5;
# 
# _<x> := PolynomialRing(Rationals()); 
# resultlist := [];
# r := 1;
# while r ne 8 do 
# Cmon := 256*r^5-640*x*r^4+560*x^2*r^3-200*x^3*r^2+25*x^4*r+x^5;
# Dmon := -81250000*r^5+1250000*x*r^4-175000*x^2*r^3+5000*x^3*r^2-125*x^4*r+x^5;
# rkCmon := TwoSelmerGroupData( Jacobian( HyperellipticCurve( Cmon ) ) );
# rkDmon := TwoSelmerGroupData( Jacobian( HyperellipticCurve( Dmon ) ) );
# Append( resultlist, [ r, rkCmon, rkDmon ] );
# r := -r;
# Cmon := 256*r^5-640*x*r^4+560*x^2*r^3-200*x^3*r^2+25*x^4*r+x^5;
# Dmon := -81250000*r^5+1250000*x*r^4-175000*x^2*r^3+5000*x^3*r^2-125*x^4*r+x^5;
# rkCmon := TwoSelmerGroupData( Jacobian( HyperellipticCurve( Cmon ) ) );
# rkDmon := TwoSelmerGroupData( Jacobian( HyperellipticCurve( Dmon ) ) );
# Append( resultlist, [ r, rkCmon, rkDmon ] );
# r := -r; 
# r := r + 1; 
# end while; 
# 
# The above gave the following results, which are reassuring, 
# as the 2-Selmer rank bounds have the same parity (indeed are the
# same) for Cmon and Dmon, consistent with the Jacobians
# being isogenous over Q. 
# [ 1, 0, 0 ]
# [ -1, 0, 0 ]
# [ 2, 1, 1 ]
# [ -2, 1, 1 ]
# [ 3, 1, 1 ]
# [ -3, 1, 1 ]
# [ 4, 0, 0 ]
# [ -4, 0, 0 ]
# [ 5, 0, 0 ]
# [ -5, 0, 0 ]
# [ 6, 2, 2 ]
# [ -6, 0, 0 ]
# [ 7, 1, 1 ]
# [ -7, 1, 1 ]
# 
# Note: the case r=1 might be a good choice for performing 
# the entire descent to get a bound. Maybe this case even 
# has 5-part of Sha?
# Maybe also I can exploit the point of order 5 in Jac(Cmon)(Q) 
# for the case r=1. Find its image under the Cassels map.  
# Choose r=p such that we maintain this being in the Selmer group, 
# but such that the 2-Selmer bound on the rank is still 0
# and such that there Jac(Cmon)(Q)[5] is the trivial group. 
# Then there should be 5-part of Sha. 
# Note how it should be possible to keep the 2-Selmer bound on
# the rank still zero, with r equal to a cong class of prime,
# since the theta (root of the quintic) will remain the same for all twists.
# Note how this must induce another element in the Selmer group; 
# does this give some kind of reciprocity result? 
# 
# Here are a few preliminaries for the r=1 case. 
# First find the M's which contain the images of the the Cassels maps  
# (and recall also that the norm of anything in the image is a 5th power, 
# which cuts down further). All of these are in K*/(K*)^5, 
# so the number of generators is the 5-rank of each group.
# The bad primes are: 2,5,infty.
# For Q, <-1,2,5> is just: <2,5> (since -1 is already a 5th power).
# For Q(sqrt5), with ring of integers Z[ (1+sqrt5)/2 ], classno=1,
# unit group generated by -1 (torsion) and (1+sqrt5)/2 (fund unit),
# and can ignore -1 since it is a 5th power.
# 2 is inert (by DT, since x^2-x-1, minpoly of (1+sqrt5)/2, is irred mod 2).
# 5 factors as sqrt5*sqrt5. So, can use: < (1+sqrt5)/2, 2, sqrt5 >.
# Note: these have norms -1,2^2,-5, so it looks to me that we 
# can exclude everything except < (1+sqrt5)/2 >, using the
# fact that norms must be 5th powers in Q.
# For Q(zeta5). Note: for this direction of the isogeny, express
# everything, the forms of the curve, Cassels maps, etc, all 
# in terms of zeta5; use: sqrt5 = 2*zeta5 + 2*zeta5^(-1) + 1,
# so that zeta5 is a root of: x^2 + ((1-sqrt5)/2)*x + 1.  
# Note that the conjugates of zeta5 over Q(sqrt5)) are: zeta5, zeta5^(-1).  
# The ring of integers is Z[zeta5],  classno=1,
# the unit group is generated by -zeta5 (torsion)
# and 1+zeta5 (fund unit), and might as well use zeta5 instead
# of -zeta5, since -1 is a 5th power. Also, 2 is inert
# by DT (since x^4+x^3+x^2+x+1 is irred mod 2), and 
# 5 factors as 5 = (1-zeta5)*(1-zeta5^2)*(1-zeta5^3)*(1-zeta5)^4, 
# and these are all associates (since (1-zeta5^i)/(1-zeta) is
# just 1 + zeta5 + ... + zeta5^{i-1}, which has norm 1 and is a unit).
# So, we can use: <zeta5, 1+zeta5, 2, 1-zeta5>. These have norms over Q:
# 1,1,2^4,5. They have norms Q(zeta5)/Q(sqrt5) given by:
# Norm_{Q(zeta5)/Q(sqrt5)}(zeta5) = zeta5*zeta5^(-1) = 1.  
# Norm_{Q(zeta5)/Q(sqrt5)}(1+zeta5) = (1+zeta5)*(1+zeta5^(-1)) = (3+sqrt5)/2,
# the square of the fundamental unit (1+sqrt(5))/2 in Z[(1+sqrt(5))/2].
# Norm_{Q(zeta5)/Q(sqrt5)}(2) = 2^2.
# Norm_{Q(zeta5)/Q(sqrt5)}(1-zeta5) = (1-zeta5)*(1-zeta5^(-1)) = (5-sqrt5)/2,
# which is the same as: sqrt5*((1-sqrt5)/2).
# so presumably again we can use "norm is a 5th power in Q(sqrt5)"
# to reduce to <zeta5>. 
# In summary, Q, ring of integers Z, use: <2,5>.
# Q(sqrt5), ring of integers Z[(1+sqrt5)/2], use: <(1+sqrt5)/2>. 
# Q(zeta5), ring of integers Z[zeta5], use: <zeta5>.
# Note also that: 
# This seems to give a naive rank bound of 4, even before local arguments,
# since at most 5 indep generators, and subtract 1 for T_2 in J[phi](Q).
# Next step is to find: # Jtilde(Q_p)/phi(J(Q_p)) # J(Q_p)/phitilde(Jtilde(Q_p))
# in terms of # J(Q_p)[phi], # Jtilde(Q_p)[phitilde] and |5|_p^2.
# Most likely (imitating p.111 of Prolegomena): 
#      # Jtilde(Q_p)/phi(J(Q_p)) # J(Q_p)/phitilde(Jtilde(Q_p))
#       = # J[phi](Q_p) # Jtilde[phitilde](Q_p) / |5|_p^2.
# I should classify how this looks for different congruence
# classes of primes. 
# 
# Comment: there are 5^4 5-torsion points over the closure, 
# and so 5^4 - 5^2 = 5^2*(5^2 - 1) members of J[5] which are 
# not in the kernel of phi. These are precisely the preimages
# under phi of the non-identity members of Jtilde[phitilde].
# It follows that there are no other members of J[5](Q), 
# apart from <T2>, since these are the only members of J[phi](Q),
# and any other members of J[5](Q) would map under phi
# to non-identity members of Jtilde[phitilde](Q), of which there are none.
# 
# Comment for later. We shall next look at the case r=1. 
# After this, we might twist by r=p prime, such that:
# p == 1 (mod 8), p == 4 (mod 5), so that x |--> x^5 is onto, 
# and 5 would be a 5th power in Q_p (maybe not needed if that
# turns out not to be in Sha). Maybe also want p to satisfy
# the the quintic f(x) is irred mod p, as that p (inert) 
# is added to M, for the 2-descent. Then p would be square 
# in Q_2,Q_5,R. By the way, note that the class number of the
# quintic field for the complete 2-descent has class number 1, 
# as can be seen using the Magma commands:
# _<x> := PolynomialRing(Rationals());
# K := NumberField( 5*(16 - 12*x + 3*x^2)^2 + (x - 4)^5 );
# ClassNumber(K); 
# 
# Look in detail at the case r=1. 
sqrt5 := RootOf(t^2 - 5);
zeta5 := RootOf(t^4 + t^3 + t^2 + t + 1);
ssqrt5 := 2*zeta5 + 2*zeta5^(-1) + 1;
# Cmon1: y^2 = 5*(16 - 12*x + 3*x^2)^2 + (x - 4)^5
#           = (16 - 20*x + 5*x^2)^2 + x^5
Cmon1 := expand( 5*(16 - 12*x + 3*x^2)^2 + (x - 4)^5 );
# T1 = { (4, 16*sqrt5, infty }.
# T2 = { (0,16), infty }.
# Dmon1: y^2 = 25*(-5+2*sqrt5)*(x^2+(15+4*sqrt5)*100)^2 + (x-10*sqrt5)^5
#            = 25*(-5-2*sqrt5)*(x^2+(15-4*sqrt5)*100)^2 + (x+10*sqrt5)^5
Dmon1 := simplify( 25*(-5-2*sqrt5)*(x^2+(15-4*sqrt5)*100)^2 + (x+10*sqrt5)^5 );
# DT1 := {(10*(1+2*zeta5+2*zeta5^4),4000*(2+4*zeta5+zeta5^2+3*zeta5^3),infty}
# DT2 := {(10*(-1-2*zeta5-2*zeta5^4),4000*(1+2*zeta5+3*zeta5^2-zeta5^3),infty} 
# Note that zeta5 |--> zeta5^(-1) (conj of Q(zeta5) over Q(ssqrt5)) 
# takes DT1 |--> -DT1 and DT2 |--> -DT2, and so has the same effect 
# on anything in <DT1,DT2>. The only way that something in this group 
# could be defined over Q(ssqrt5) would be for it to be 2-torsion, 
# which is only true of the identity in <DT1,DT2>. Hence only the
# trivial subgroup of <DT1,DT2> is defined over Q(ssqrt5), with 
# all nontrivial elements defined over Q(zeta5), but not Q(ssqrt5). 
# Note also that zeta5 |--> zeta5^2 takes DT1 |--> DT2, 
# and takes DT2 |--> -DT1, and so takes <DT1,DT2> to <DT1,DT2>, which 
# shows directly that <DT1,DT2> is defined over Q. 
# 
# qtilde : Jac(Cmon1)(Q)/ phitilde( Jac(Dmon1)(Q) )
#    -->  Q(sqrt(5))*/( Q(sqrt(5))* )^5 x Q*/( Q* )^5
#  : {(x1,y1),(x2,y2)} |--> 
#[(y1-sqrt5*(16-12*x1+3*x1^2))*(y2-sqrt5*(16-12*x2+3*x2^2)),
# (y1-(16-20*x1+5*x1^2))*(y2-(16-20*x2+5*x2^2))].
# The image of qtilde is a subset of: [ <(1+sqrt5)/2>, <2,5> ]. 
# Since (1+sqrt5)/2 = 1/( (1-sqrt5)/2 ) mod 5th powers, 
# it will turn out to be more convenient to take instead: 
# The image of qtilde is a subset of: [ <(1-sqrt5)/2>, <2,5> ]. 
# 
# q : Jac(Dmon1)(Q)/ phi( Jac(Cmon1)(Q) )
#     -->  Q(sqrt((-5+2*sqrt5)))*/( Q(sqrt((-5+2*sqrt5)))* )^5 
#             x Q(sqrt((-5-2*sqrt5)))*/( Q(sqrt((-5-2*sqrt5)))* )^5
#  : {(x1,y1),(x2,y2)} |--> 
#  [ (y1 - 5*sqrt((-5+2*sqrt5))*(x1^2 + (15+4*sqrt5)*100))
#   *(y2 - 5*sqrt((-5+2*sqrt5))*(x2^2 + (15+4*sqrt5)*100)),
#    (y1 - 5*sqrt((-5-2*sqrt5))*(x1^2 + (15-4*sqrt5)*100))
#   *(y2 - 5*sqrt((-5-2*sqrt5))*(x2^2 + (15-4*sqrt5)*100)) ].
zeta5 := RootOf(t^4 + t^3 + t^2 + t + 1);
# The following expresses Q(ssqrt5) explicitly as a subfield of Q(zeta5). 
ssqrt5 := 2*zeta5 + 2*zeta5^(-1) + 1;
factor(x^2 - (-5+2*ssqrt5));
# This gave roots: 1+2*zeta5+2*zeta5^3, -(1+2*zeta5+2*zeta5^3).
# Use the following as the Cassels map on the first component. 
# (y - 5*(1+2*zeta5+2*zeta5^3)*(x^2 + (15+4*(1+2*zeta5+2*zeta5^4))*100))
# The following gives y^2, as we want. 
simplify(
 (y - 5*(1+2*zeta5+2*zeta5^3)*(x^2 + (15+4*(1+2*zeta5+2*zeta5^4))*100))
*(y + 5*(1+2*zeta5+2*zeta5^3)*(x^2 + (15+4*(1+2*zeta5+2*zeta5^4))*100))
- (x-10*(1+2*zeta5+2*zeta5^4))^5 + subs(r=1, Dmon) );
factor(x^2 - (-5-2*ssqrt5));
# This gave roots: 1+2*zeta5+2*zeta5^2, -(1+2*zeta5+2*zeta5^2).
# Use the following as the Cassels map on the second component. 
# (y - 5*(1+2*zeta5+2*zeta5^2)*(x^2 + (15-4*(1+2*zeta5+2*zeta5^4))*100))
# The following gives y^2, as we want. 
simplify(
 (y - 5*(1+2*zeta5+2*zeta5^2)*(x^2 + (15-4*(1+2*zeta5+2*zeta5^4))*100))
*(y + 5*(1+2*zeta5+2*zeta5^2)*(x^2 + (15-4*(1+2*zeta5+2*zeta5^4))*100))
- (x+10*(1+2*zeta5+2*zeta5^4))^5 + subs(r=1, Dmon) );
# So, the Cassels map in this direction becomes: 
# q : Jac(Dmon1)(Q)/ phi( Jac(Cmon1)(Q) )
#    -->  Q(zeta5)*/( Q(zeta5)* )^5 
#             x Q(zeta5)*/( Q(zeta5)* )^5
#  : {(x1,y1),(x2,y2)} |--> 
#  [ (y1 - 5*(1+2*zeta5+2*zeta5^3)*(x1^2 + (15+4*(1+2*zeta5+2*zeta5^4))*100))
#   *(y2 - 5*(1+2*zeta5+2*zeta5^3)*(x2^2 + (15+4*(1+2*zeta5+2*zeta5^4))*100))
#    (y1 - 5*(1+2*zeta5+2*zeta5^2)*(x1^2 + (15-4*(1+2*zeta5+2*zeta5^4))*100))
#   *(y2 - 5*(1+2*zeta5+2*zeta5^2)*(x2^2 + (15-4*(1+2*zeta5+2*zeta5^4))*100)) ]
# The image of q is contained in: [ <zeta5>, <zeta5> ]. 
# But note that zeta5 |--> zeta5^2 takes the first cpt to the second cpt, 
# so in fact that image of q is contained in: < [zeta, zeta^2] >.
# This means our naive bound on the rank (before any local computations) 
# is actually 3, rather than 4.
# 
# Here are a few comments about the extensions of the relevant Q_p. 
# For p not dividing n, [Q_p(zeta_n): Q_p] = [F_p(zeta_n) : F_p]. 
# Note that x^4 + x^3 + x^2 + x + 1 is irred over F_2,
# so: [F_2(zeta5) : F_2] = 4, and so: [Q_2(zeta5) : Q_2] = 4,
# there is no ramification and the residue field F_2(zeta5) has deg 4 over F_2. 
# Q_5(zeta5) = Q_5(1-zeta5) and |1-zeta5|_5 = 5^(-1/4).
# Here [Q_5(zeta5) : Q_5] = 4, completely ramified.
# [Q_2(sqrt5) : Q_2] = 2, no ramification, res field F_2((1-sqrt5)/2) deg 2 
# over F_2 (by this, we mean: F_2 adjoin a root of x^2 - x - 1). 
# Q_5(sqrt5) has |sqrt5|_5 = 5^(-1/2).
# Here [Q_5(sqrt5) : Q_5] = 2, completely ramified.
# For the finite primes, the relevants algebras remain of the same  
# degree and do not split down. 
# Of course R(zeta5) = C. 
# Also, R(sqrt5) = R, so in this case need to consider the two
# embeddings with sqrt5 being positive or negative. 
# 
# T2 = { (0,16), infty } in J[phi](Q).
qtildeT2 := subs(x=0,y=16,[(y-sqrt5*(16-12*x+3*x^2)), (y-(16-20*x+5*x^2))]);
# The above doesn't work, as the second cpt is 0. 
# Instead use that: (y-(16-20*x+5*x^2))*(y+(16-20*x+5*x^2)) = x^5,
# so modulo 5th powers: (y-(16-20*x+5*x^2)) = 1/(y+(16-20*x+5*x^2)).
qtildeT2 := subs(x=0,y=16,[(y-sqrt5*(16-12*x+3*x^2)), 1/(y+(16-20*x+5*x^2))]);
# This gave: 
# qtildeT2 := [16-16*RootOf(_Z^2-5), 1/32].
# But 32 is a 5th power, so mod 5th powers, this is just:
# qtildeT2 := [(1-sqrt5)/2, 1]. 
# 
# We are now ready to consider each of 2,5,infty to get the (5,5)-Selmer bound. 
# We have the usual commutative diagrams. 
# Let J denote Jac(Cmon1) and Jtilde denote Jac(Dmon1). 
# The following literally applies for finite primes (since the extension 
# degrees over Q_p are the same as over Q).
# For infty, should interpret "R(zeta5)" as C and "R(sqrt5)" as R x R, 
# with positive sqrt5 in first cpt and negative sqrt5 in second cpt. 
# 
# 
# Jtilde(Q)/phi(J(Q))    ---q--->    Q(zeta5)*/(Q(zeta5)*)^5 
#                                       x Q(zeta5)*/(Q(zeta5)*)^5
#         |                                   |
#         | j                                 | j_p
#         |                                   |
#         v                                   v
# Jtilde(Q_p)/phi(J(Q_p)) ---q_p---> Q_p(zeta5)*/(Q_p(zeta5)*)^5 
#                                       x Q_p(zeta5)*/(Q_p(zeta5)*)^5
#   
#   
# J(Q)/phitilde(Jtilde(Q)) ---qtilde-> Q(sqrt5)*/(Q(sqrt5)*)^5 x Q*/(Q*)^5 
#         |                                     |
#         | jtilde                              | jtilde_p
#         |                                     |
#         v                                     v
# J(Q_p)/phitilde(Jtilde(Q_p)) --qtilde_p--> Q_p(sqrt5)*/(Q_p(sqrt5)*)^5 
#                                              x Q_p*/(Q_p*)^5
#   
# 
# (Preliminary comment: it looks as if we gain no info at infty,
# since R*/(R*)^5 and C*/(C*)^5 are the trivial group.
# First consider p=2. 
#      # Jtilde(Q_2)/phi(J(Q_2)) # J(Q_2)/phitilde(Jtilde(Q_2))
#       = # J[phi](Q_2) # Jtilde[phitilde](Q_2) / |5|_2^2.
# But note that sqrt5, zeta5 are not in Q_2, and T2 is in 
# J[phi](Q), and so in J[phi](Q_2), so that:
# # J[phi](Q_2) = 5^1 and # Jtilde[phitilde](Q_2) = 5^0. Hence: 
#   # Jtilde(Q_2)/phi(J(Q_2)) # J(Q_2)/phitilde(Jtilde(Q_2)) = 5^1.
# First find the kernel of j_2. 
# Want to know whether or not zeta5 is in (Q_2(zeta5)*)^5.
# Imagine x in Q_2(zeta5) satisfied x^5 = zeta5.
# Then x^20+x^15+x^10+x^5+1 = 0. However:
Factor(x^20+x^15+x^10+x^5+1) mod 2;
# shows that this is irred mod 2 and so irred in Q_2, and this 
# would mean a degree 20 extension of Q_2 contained inside Q_2(zeta5), 
# which is a degree 4 extension of Q_2, a contradiction. 
# Hence j_2 has trivial kernel: [ <1>, <1> ] = < [1,1] >. 
# 
# Now find the kernel of jtilde_2. 
# First see whether or not (1-sqrt5)/2 is in the kernel of the first
# component of jtilde_2. That is, whether (1-sqrt5)/2 is in (Q_2(sqrt5)*)^5.
# Want: ( (x + y*sqrt5)/2 )^5 - (1 - sqrt5)/2 = 0.
ww := simplify( (x + y*sqrt5)^5 - 2^4*(1 - sqrt5) );
# We want to know if there are x,y in Q_2 satisfying the above. 
eq1 := coeff(ww,sqrt5);
eq2 := simplify( ww - eq1*sqrt5 );
# We need eq1,eq2 (in x,y) to have a common soln: 
zz := subs(factor(resultant(eq1,eq2,y)));
# This has a factor: x^5+5*x^3+5*x-1, which clearly has a solution
# in Q_2, by replacing x by 1/x, to solve: 1+5*x^2+5*x^4-x^5
# and then use x=1 and HL to see that this has a soln in Q_2. 
# This only show that there is a value of x for which eq1,eq2 
# have a common factor in y. However, note also that: 
simplify( ( (-1 - sqrt5)/2 )^5 - (1 - sqrt5)/2 );
# gives: -6 - 2*sqrt5, so we not that if: f(x) = x^5 - (1 - sqrt5)/2
# then | f( (-1 - sqrt5)/2 ) |_2 < 1, and:
# | f'( (-1 - sqrt5)/2 ) |_2 = | 5*( (-1 - sqrt5)/2 )^4 |_2 = 1,
# so by HL (1-sqrt5)/2 is in (Q_2(sqrt5)*)^5. 
# Hence (1-sqrt5)/2 is in the kernel of jtilde_2. 
# Also, x^5 - 5 has a soln in Q_2 by x=1 and HL. 
# However, x^5 - 2 does not have a soln in Q_2, using valuations. 
# So, the kernel of jtilde_2 is precisely: [ <(1-sqrt5)/2>, <5> ].
with(padic);
for xx from -17 to 17 do if nops([rootp(y^2 - subs(x=xx*2, Cmon1), 2)]) > 0
then print(xx*2, ifactor(subs(x=xx*2, Cmon1))) fi od;
# The following is the second component of the map qtilde_2.
qq := y-(16-20*x+5*x^2);
[msolve( y^2 - subs(x=-8, Cmon1), 2^30 )][1][1];
ifactor(subs( x=-8, %, qq));
# The above didn't give anything non-identity, so likely we already
# know all of the image of qtilde_2.
for xx from -33 to 33 do if nops([rootp(y^2 - subs(x=xx, Dmon1), 2)]) > 0
then print(xx, ifactor(subs(x=xx, Dmon1))) fi od;
# The following is the first cpt of the map q_2. 
rr := (y - 5*(1+2*zeta5+2*zeta5^3)*(x^2 + (15+4*(1+2*zeta5+2*zeta5^4))*100));
# The following is the second cpt of the map q_2. 
rrr := (y - 5*(1+2*zeta5+2*zeta5^2)*(x^2 + (15-4*(1+2*zeta5+2*zeta5^4))*100));
[msolve( y^2 - subs(x=-2, Dmon1), 2^50 )][1][1];
simplify(subs( x=-2, %, rr));
simplify(subs( x=-2, y=758703353981424, rr));
# In the above, we selected y == 48 (mod 64), rather than y == 16 (mod 64).
# 
# Now have to see whether the above is zeta5*(something in (Q_2(zeta5)*)^5).
simplify(%/zeta5)/32;
% mod 2;
# The above gave: zeta5^2 + zeta5^3. 
simplify(subs( x=-2, y=758703353981424, rrr));
simplify(%/zeta5^2)/32;
% mod 2;
# The above gave: 1 + zeta5^2 + zeta5^3. 
# for i1 from 0 to 1 do for i2 from 0 to 1 do for i3 from 0 to 1 do 
# for i4 from 0 to 1 do                                                
# print( simplify( (i1 + i2*zeta5 + i3*zeta5^2 + i4*zeta5^3)^5 ) mod 2 )
# od od od od;
# The above gives that the following are the 5th powers mod 2: 
# 1, zeta5^2 + zeta5^3, 1 + zeta5^2 + zeta5^3.
# In particular, (1+zeta5^2)^5 = -8 - 5*zeta5^2 - 5*zeta5^3, 
# which is congruent to: zeta5^2 + zeta5^3 mod 2. 
# So, take y in Q_2 to be such that y == 48 (mod 64) and  
# satisfying: y^2 = subs(x=-2, Dmon1) = -2^8*330047 (exists, since 
# -330047 == 1 mod 8). Then { (x,y), infty } is in Jtilde(Q_2)
# and maps under q_2 to [zeta5*k, zeta5^2*l] where k is in Q_2(zeta5) 
# and k == zeta5^2 + zeta5^3 mod 2. Then  | (1+zeta5^2)^5 - k |_2 < 1 and
# | 5(1+zeta5^2)^2 |_2 = 1, so apply HL to see that k is in (Q_2(zeta5)*)^5.
# Similarly l is in (Q_2(zeta5)*)^5. 
# Hence q_2 : { (x,y), infty } |--> [zeta5, zeta5^2]. 
# So not we see that we have all of:
#   # Jtilde(Q_2)/phi(J(Q_2)) = 5^1, with image < [zeta5,zeta5^2] >.
#   # J(Q_2)/phitilde(Jtilde(Q_2)) = 5^0.
# Also, j_2 has trivial kernel and 
# the kernel of jtilde_2 is precisely: [ <(1-sqrt5)/2>, <5> ],
# so that:
# j_2^{-1}( q_2( Jtilde(Q_2)/phi(J(Q_2)) ) ) = < [zeta5,zeta5^2] >. 
# jtilde_2^{-1}( qtilde_2( J(Q_2)/phitilde(Jtilde(Q_2)) ) ) 
#     = [ <(1-sqrt5)/2>, <5> ] = < [(1-sqrt5)/2,1], [1,5] >. 
# At this point, the rank of J(Q) is bounded above by 2.
# 
# Now consider p=5.
#      # Jtilde(Q_5)/phi(J(Q_5)) # J(Q_5)/phitilde(Jtilde(Q_5))
#       = # J[phi](Q_5) # Jtilde[phitilde](Q_5) / |5|_5^2.
# But note that sqrt5, zeta5 are not in Q_5, and T2 is in 
# J[phi](Q), and so in J[phi](Q_5), so that:
# # J[phi](Q_5) = 5^1 and # Jtilde[phitilde](Q_5) = 5^0. Hence: 
#   # Jtilde(Q_5)/phi(J(Q_5)) # J(Q_5)/phitilde(Jtilde(Q_5)) = 5^3.
# First find the kernel of j_5. 
# Want to know whether or not zeta5 is in (Q_5(zeta5)*)^5.
# Imagine x in Q_5(zeta5) satisfied x^5 = zeta5.
# Then: |x|_5 = 1. Also: (x - 1)^5 == x^5 - 1 == zeta5 - 1 (mod 5), 
# and |zeta5 - 1|_5 = 5^(-1/5), but that would force |x-1|_5 = 5^(-1/25)
# which is too much ramification for Q_5(zeta_5). 
# Hence j_5 has trivial kernel: [ <1>, <1> ] = < [1,1] >. 
# 
# Now find the kernel of jtilde_5. 
# First see whether or not (1-sqrt5)/2 is in the kernel of the first
# component of jtilde_5. That is, whether (1-sqrt5)/2 is in (Q_5(sqrt5)*)^5.
ww := simplify( 2*(x + y*sqrt5)^5 - (1 - sqrt5) );
# We want to know if there are x,y in Q_5 satisfying the above. 
eq1 := coeff(ww,sqrt5);
eq2 := simplify( ww - eq1*sqrt5 );
# We need eq1,eq2 (in x,y) to have a common soln: 
zz := subs(x=x/2,factor(resultant(eq1,eq2,y)));
rootp(zz/6250000,5);
# This has no solutions, so no value of x for which eq1,eq2 has
# common factor in y, much less a common soln.
# This can alternatively be seen by noting that: 
#    for i1 from 0 to 4 do for i2 from 0 to 4 do                  
#    print( simplify( (i1 + i2*sqrt5)^5 - (1 - sqrt5)/2 ) ) od od;
# never gives anything congruent to 0 (mod 5), so that 
# x^5 == (1 - sqrt5)/2 has no solutions mod 5. Indeed, this  
# is easy to see directly since, after expanding (i1 + i2*sqrt5)^5 
# we get i1 (mod 5) which can never be == (1 - sqrt5)/2 (mod 5). 
# Hence (1-sqrt5)/2 is not in the kernel of jtilde_5. 
# Also, rootp(x^5-5,2) shows x^5 - 2 has no soln in Q_5,
# and x^5 = 5^i*2^j, for 5 not dividing i, does not have a soln in Q_5, 
# using valuations. 
# So, jtilde_5 has trivial kernel.
# 
# First recall that T2 = { (0,16), infty } in J[phi](Q) and so in J[phi](Q_5).
# qtildeT2 := [(1-sqrt5)/2, 1]. 
# So qtilde_2 : T2 |--> [(1-sqrt5)/2, 1], and this is nontrivial, 
# since it is not in the kernel of jtilde_5. 
# We still require two further generators.
for xx from -17 to 17 do if nops([rootp(y^2 - subs(x=xx, Cmon1), 5)]) > 0
then print(xx, ifactor(subs(x=xx, Cmon1))) fi od;
# The following is the second component of the map qtilde_5.
qq := y-(16-20*x+5*x^2);
[msolve( y^2 - subs(x=3, Cmon1), 5^8 )][1][1];
# The above gave: y = 257412 
rootp( w^5 - subs( x=3, y=257412, qq)/2, 5 ); 
# This has a solution, so this is just 2, mod 5th powers in Q_5,
# so the image of qtilde_5 contains [ ?, 2 ], and so contains
# [1,2], since we already know that [(1-sqrt5)/2, 1] is in the image. 
# Note that something might map to an element of Q_5*/(Q_5*)^5, 
# which is not even in the image of the map jtilde_5,
# so that would potentially give rank 0. 
# Might describe completely: Q_5*/(Q_5*)^5. 
# In fact, all points seem to give elements of <2>, so need to 
# check q_5, and it might be q_5 for which something might
# map to an element of Q_5(zeta5)*/(Q_5(zeta5)*)^5 which 
# is not even in the image of the map j_5. 
# 
for xx from -33 to 33 do if nops([rootp(y^2 - subs(x=xx, Dmon1), 5)]) > 0
then print(xx, ifactor(subs(x=xx, Dmon1))) fi od;
# The following is the first cpt of the map q_5. 
rr := (y - 5*(1+2*zeta5+2*zeta5^3)*(x^2 + (15+4*(1+2*zeta5+2*zeta5^4))*100));
# The following is the second cpt of the map q_5. 
rrr := (y - 5*(1+2*zeta5+2*zeta5^2)*(x^2 + (15-4*(1+2*zeta5+2*zeta5^4))*100));
[msolve( y^2 - subs(x=1, Dmon1), 5^8 )][1][1];
simplify(subs( x=1, %, rr));
simplify(subs( x=-2, y=758703353981424, rr));
# Not yet found the generator on this side. 
# Most likely: should find something d for which:
# d, d*zeta5, d*zeta5^2, d*zeta5^3, d*zeta5^4 are not 5th powers in Q_5(zeta5).
# I should first describe precisely the 5th powers mod some power of 5.
# Maybe also describe completely: Q_5(zeta5)*/(Q_5(zeta5)*)^5.
# 
# arr := {};
# for i1 from 0 to 24 do print(i1);
# for i2 from 0 to 24 do for i3 from 0 to 24 do for i4 from 0 to 24 do
# arr := { op(arr),
# simplify( (i1 + i2*zeta5 + i3*zeta5^2 + i4*zeta5^3)^5 ) mod 5^3  };
# od od od od;
# arr4 := [ op(arr) ]; 
# The array arr4 is enormous and is in the file: ed/arr4 
# We shall reduce this mod 5^2. 
# 
# arr5a := [];
# for i from 1 to nops(arr4) do arr5a := [ op(arr5a), arr4[i] mod 5^2 ] od:
# arr5a := [ op( { op(arr5a) } ) ];
# arr6a := [];
# for i from 1 to nops(arr5a) do
# arr6a := [ op(arr6a), subs(zeta5 = zzet, arr5a[i]) ] od;
# for i from 1 to nops(arr6a) do print( arr6a[i], " " ) od;
# 
# arr5b := [];
# for i from 1 to nops(arr4) do
# arr5b := [ op(arr5b), expand(simplify(zeta5*arr4[i])) mod 5^2 ] od:
# arr5b := [ op( { op(arr5b) } ) ];
# arr6b := [];
# for i from 1 to nops(arr5b) do
# arr6b := [ op(arr6b), subs(zeta5 = zzet, arr5b[i]) ] od;
# for i from 1 to nops(arr6b) do print( arr6b[i], " " ) od;
# 
# arr5c := [];
# for i from 1 to nops(arr4) do
# arr5c := [ op(arr5c), expand(simplify(zeta5^2*arr4[i])) mod 5^2 ] od:
# arr5c := [ op( { op(arr5c) } ) ];
# arr6c := [];
# for i from 1 to nops(arr5c) do
# arr6c := [ op(arr6c), subs(zeta5 = zzet, arr5c[i]) ] od;
# for i from 1 to nops(arr6c) do print( arr6c[i], " " ) od;
# 
# arr5d := [];
# for i from 1 to nops(arr4) do
# arr5d := [ op(arr5d), expand(simplify(zeta5^3*arr4[i])) mod 5^2 ] od:
# arr5d := [ op( { op(arr5d) } ) ];
# arr6d := [];
# for i from 1 to nops(arr5d) do
# arr6d := [ op(arr6d), subs(zeta5 = zzet, arr5d[i]) ] od;
# for i from 1 to nops(arr6d) do print( arr6d[i], " " ) od;
# 
# arr5e := [];
# for i from 1 to nops(arr4) do
# arr5e := [ op(arr5e), expand(simplify(zeta5^4*arr4[i])) mod 5^2 ] od:
# arr5e := [ op( { op(arr5e) } ) ];
# arr6e := [];
# for i from 1 to nops(arr5e) do
# arr6e := [ op(arr6e), subs(zeta5 = zzet, arr5e[i]) ] od;
# for i from 1 to nops(arr6e) do print( arr6e[i], " " ) od;
# 

# The following gives the members of (Q_5(zeta)*)^2 mod 5^2. 
arr6a :=
[
0, 
1, 
7, 
18, 
24, 
5*zeta5^2+15*zeta5+4, 
5*zeta5^2+15*zeta5+6, 
5*zeta5^2+15*zeta5+12, 
5*zeta5^2+15*zeta5+23, 
10*zeta5^2+5*zeta5+3, 
10*zeta5^2+5*zeta5+9, 
10*zeta5^2+5*zeta5+11, 
10*zeta5^2+5*zeta5+17, 
15*zeta5^2+20*zeta5+8, 
15*zeta5^2+20*zeta5+14, 
15*zeta5^2+20*zeta5+16, 
15*zeta5^2+20*zeta5+22, 
20*zeta5^2+10*zeta5+2, 
20*zeta5^2+10*zeta5+13, 
20*zeta5^2+10*zeta5+19, 
20*zeta5^2+10*zeta5+21, 
5*zeta5^3+5*zeta5^2+8, 
5*zeta5^3+5*zeta5^2+14, 
5*zeta5^3+5*zeta5^2+16, 
5*zeta5^3+5*zeta5^2+22, 
5*zeta5^3+10*zeta5+3, 
5*zeta5^3+10*zeta5+9, 
5*zeta5^3+10*zeta5+11, 
5*zeta5^3+10*zeta5+17, 
10*zeta5^3+10*zeta5^2+4, 
10*zeta5^3+10*zeta5^2+6, 
10*zeta5^3+10*zeta5^2+12, 
10*zeta5^3+10*zeta5^2+23, 
10*zeta5^3+20*zeta5+2, 
10*zeta5^3+20*zeta5+13, 
10*zeta5^3+20*zeta5+19, 
10*zeta5^3+20*zeta5+21, 
15*zeta5^3+15*zeta5^2+2, 
15*zeta5^3+15*zeta5^2+13, 
15*zeta5^3+15*zeta5^2+19, 
15*zeta5^3+15*zeta5^2+21, 
15*zeta5^3+5*zeta5+4, 
15*zeta5^3+5*zeta5+6, 
15*zeta5^3+5*zeta5+12, 
15*zeta5^3+5*zeta5+23, 
20*zeta5^3+20*zeta5^2+3, 
20*zeta5^3+20*zeta5^2+9, 
20*zeta5^3+20*zeta5^2+11, 
20*zeta5^3+20*zeta5^2+17, 
20*zeta5^3+15*zeta5+8, 
20*zeta5^3+15*zeta5+14, 
20*zeta5^3+15*zeta5+16, 
20*zeta5^3+15*zeta5+22, 
5*zeta5^3+10*zeta5^2+15*zeta5+2, 
5*zeta5^3+10*zeta5^2+15*zeta5+13, 
5*zeta5^3+10*zeta5^2+15*zeta5+19, 
5*zeta5^3+10*zeta5^2+15*zeta5+21, 
5*zeta5^3+15*zeta5^2+5*zeta5+1, 
5*zeta5^3+15*zeta5^2+5*zeta5+7, 
5*zeta5^3+15*zeta5^2+5*zeta5+18, 
5*zeta5^3+15*zeta5^2+5*zeta5+24, 
5*zeta5^3+15*zeta5^2+20*zeta5+10, 
5*zeta5^3+20*zeta5^2+20*zeta5+4, 
5*zeta5^3+20*zeta5^2+20*zeta5+6, 
5*zeta5^3+20*zeta5^2+20*zeta5+12, 
5*zeta5^3+20*zeta5^2+20*zeta5+23, 
10*zeta5^3+5*zeta5^2+10*zeta5+1, 
10*zeta5^3+5*zeta5^2+10*zeta5+7, 
10*zeta5^3+5*zeta5^2+10*zeta5+18, 
10*zeta5^3+5*zeta5^2+10*zeta5+24, 
10*zeta5^3+5*zeta5^2+15*zeta5+20, 
10*zeta5^3+15*zeta5^2+15*zeta5+3, 
10*zeta5^3+15*zeta5^2+15*zeta5+9, 
10*zeta5^3+15*zeta5^2+15*zeta5+11, 
10*zeta5^3+15*zeta5^2+15*zeta5+17, 
10*zeta5^3+20*zeta5^2+5*zeta5+8, 
10*zeta5^3+20*zeta5^2+5*zeta5+14, 
10*zeta5^3+20*zeta5^2+5*zeta5+16, 
10*zeta5^3+20*zeta5^2+5*zeta5+22, 
15*zeta5^3+5*zeta5^2+20*zeta5+3, 
15*zeta5^3+5*zeta5^2+20*zeta5+9, 
15*zeta5^3+5*zeta5^2+20*zeta5+11, 
15*zeta5^3+5*zeta5^2+20*zeta5+17, 
15*zeta5^3+10*zeta5^2+10*zeta5+8, 
15*zeta5^3+10*zeta5^2+10*zeta5+14, 
15*zeta5^3+10*zeta5^2+10*zeta5+16, 
15*zeta5^3+10*zeta5^2+10*zeta5+22, 
15*zeta5^3+20*zeta5^2+10*zeta5+5, 
15*zeta5^3+20*zeta5^2+15*zeta5+1, 
15*zeta5^3+20*zeta5^2+15*zeta5+7, 
15*zeta5^3+20*zeta5^2+15*zeta5+18, 
15*zeta5^3+20*zeta5^2+15*zeta5+24, 
20*zeta5^3+5*zeta5^2+5*zeta5+2, 
20*zeta5^3+5*zeta5^2+5*zeta5+13, 
20*zeta5^3+5*zeta5^2+5*zeta5+19, 
20*zeta5^3+5*zeta5^2+5*zeta5+21, 
20*zeta5^3+10*zeta5^2+5*zeta5+15, 
20*zeta5^3+10*zeta5^2+20*zeta5+1, 
20*zeta5^3+10*zeta5^2+20*zeta5+7, 
20*zeta5^3+10*zeta5^2+20*zeta5+18, 
20*zeta5^3+10*zeta5^2+20*zeta5+24, 
20*zeta5^3+15*zeta5^2+10*zeta5+4, 
20*zeta5^3+15*zeta5^2+10*zeta5+6, 
20*zeta5^3+15*zeta5^2+10*zeta5+12, 
20*zeta5^3+15*zeta5^2+10*zeta5+23
];

# The following gives the members of zeta*(Q_5(zeta)*)^2 mod 5^2. 
arr6b :=
[
0, 
7*zeta5, 
18*zeta5, 
24*zeta5, 
5*zeta5^3+15*zeta5^2+4*zeta5, 
5*zeta5^3+15*zeta5^2+6*zeta5, 
5*zeta5^3+15*zeta5^2+12*zeta5, 
5*zeta5^3+15*zeta5^2+23*zeta5, 
5*zeta5^3+3*zeta5+10, 
5*zeta5^3+9*zeta5+10, 
5*zeta5^3+11*zeta5+10, 
5*zeta5^3+17*zeta5+10, 
10*zeta5^3+5*zeta5^2+3*zeta5, 
10*zeta5^3+5*zeta5^2+9*zeta5, 
10*zeta5^3+5*zeta5^2+11*zeta5, 
10*zeta5^3+5*zeta5^2+17*zeta5, 
10*zeta5^3+30*zeta5^2+28*zeta5, 
10*zeta5^3+30*zeta5^2+34*zeta5, 
10*zeta5^3+30*zeta5^2+36*zeta5, 
10*zeta5^3+30*zeta5^2+42*zeta5, 
10*zeta5^3+2*zeta5+20, 
10*zeta5^3+13*zeta5+20, 
10*zeta5^3+19*zeta5+20, 
10*zeta5^3+21*zeta5+20, 
15*zeta5^3+20*zeta5^2+8*zeta5, 
15*zeta5^3+20*zeta5^2+14*zeta5, 
15*zeta5^3+20*zeta5^2+16*zeta5, 
15*zeta5^3+20*zeta5^2+22*zeta5, 
15*zeta5^3+45*zeta5^2+33*zeta5, 
15*zeta5^3+45*zeta5^2+39*zeta5, 
15*zeta5^3+45*zeta5^2+66*zeta5, 
15*zeta5^3+45*zeta5^2+72*zeta5, 
15*zeta5^3+4*zeta5+5, 
15*zeta5^3+6*zeta5+5, 
15*zeta5^3+12*zeta5+5, 
15*zeta5^3+23*zeta5+5, 
20*zeta5^3+10*zeta5^2+2*zeta5, 
20*zeta5^3+10*zeta5^2+13*zeta5, 
20*zeta5^3+10*zeta5^2+19*zeta5, 
20*zeta5^3+10*zeta5^2+21*zeta5, 
20*zeta5^3+10*zeta5^2+38*zeta5, 
20*zeta5^3+10*zeta5^2+44*zeta5, 
20*zeta5^3+10*zeta5^2+46*zeta5, 
20*zeta5^3+60*zeta5^2+44*zeta5, 
20*zeta5^3+60*zeta5^2+52*zeta5, 
20*zeta5^3+60*zeta5^2+88*zeta5, 
20*zeta5^3+60*zeta5^2+96*zeta5, 
20*zeta5^3+8*zeta5+15, 
20*zeta5^3+14*zeta5+15, 
20*zeta5^3+16*zeta5+15, 
20*zeta5^3+22*zeta5+15, 
30*zeta5^3+15*zeta5^2+6*zeta5, 
30*zeta5^3+15*zeta5^2+12*zeta5, 
30*zeta5^3+15*zeta5^2+48*zeta5, 
30*zeta5^3+15*zeta5^2+54*zeta5, 
30*zeta5^3+40*zeta5^2+4*zeta5, 
30*zeta5^3+40*zeta5^2+6*zeta5, 
30*zeta5^3+40*zeta5^2+12*zeta5, 
30*zeta5^3+40*zeta5^2+48*zeta5, 
30*zeta5^3+90*zeta5^2+6*zeta5, 
30*zeta5^3+90*zeta5^2+12*zeta5, 
30*zeta5^3+90*zeta5^2+48*zeta5, 
30*zeta5^3+90*zeta5^2+54*zeta5, 
35*zeta5^3+105*zeta5^2+28*zeta5, 
35*zeta5^3+105*zeta5^2+42*zeta5, 
35*zeta5^3+105*zeta5^2+84*zeta5, 
40*zeta5^3+20*zeta5^2+8*zeta5, 
40*zeta5^3+20*zeta5^2+14*zeta5, 
40*zeta5^3+20*zeta5^2+16*zeta5, 
40*zeta5^3+20*zeta5^2+22*zeta5, 
40*zeta5^3+20*zeta5^2+64*zeta5, 
40*zeta5^3+20*zeta5^2+72*zeta5, 
40*zeta5^3+120*zeta5^2+8*zeta5, 
40*zeta5^3+120*zeta5^2+16*zeta5, 
40*zeta5^3+120*zeta5^2+64*zeta5, 
40*zeta5^3+120*zeta5^2+72*zeta5, 
45*zeta5^3+60*zeta5^2+21*zeta5, 
45*zeta5^3+60*zeta5^2+27*zeta5, 
45*zeta5^3+60*zeta5^2+63*zeta5, 
45*zeta5^3+60*zeta5^2+69*zeta5, 
60*zeta5^3+30*zeta5^2+3*zeta5, 
60*zeta5^3+30*zeta5^2+9*zeta5, 
60*zeta5^3+30*zeta5^2+36*zeta5, 
60*zeta5^3+30*zeta5^2+42*zeta5, 
60*zeta5^3+30*zeta5^2+78*zeta5, 
60*zeta5^3+30*zeta5^2+84*zeta5, 
60*zeta5^3+80*zeta5^2+28*zeta5, 
60*zeta5^3+80*zeta5^2+36*zeta5, 
60*zeta5^3+80*zeta5^2+84*zeta5, 
60*zeta5^3+80*zeta5^2+92*zeta5, 
70*zeta5^3+35*zeta5^2+21*zeta5, 
70*zeta5^3+35*zeta5^2+63*zeta5, 
70*zeta5^3+35*zeta5^2+77*zeta5, 
70*zeta5^3+35*zeta5^2+119*zeta5, 
80*zeta5^3+40*zeta5^2+4*zeta5, 
80*zeta5^3+40*zeta5^2+12*zeta5, 
80*zeta5^3+40*zeta5^2+48*zeta5, 
80*zeta5^3+40*zeta5^2+56*zeta5, 
80*zeta5^3+40*zeta5^2+104*zeta5, 
80*zeta5^3+40*zeta5^2+112*zeta5, 
90*zeta5^3+45*zeta5^2+72*zeta5, 
90*zeta5^3+45*zeta5^2+108*zeta5, 
90*zeta5^3+120*zeta5^2+66*zeta5, 
90*zeta5^3+120*zeta5^2+72*zeta5, 
90*zeta5^3+120*zeta5^2+108*zeta5, 
90*zeta5^3+120*zeta5^2+114*zeta5, 
110*zeta5^3+55*zeta5^2+11*zeta5, 
120*zeta5^3+60*zeta5^2+96*zeta5, 
120*zeta5^3+60*zeta5^2+102*zeta5, 
2*zeta5+15+15*zeta5^2, 
3*zeta5+20+20*zeta5^2, 
4*zeta5+10+10*zeta5^2, 
6*zeta5+10+10*zeta5^2, 
8*zeta5+5+5*zeta5^2, 
9*zeta5+20+20*zeta5^2, 
11*zeta5+20+20*zeta5^2, 
12*zeta5+10+10*zeta5^2, 
13*zeta5+15+15*zeta5^2, 
14*zeta5+5+5*zeta5^2, 
16*zeta5+5+5*zeta5^2, 
17*zeta5+20+20*zeta5^2, 
19*zeta5+15+15*zeta5^2, 
21*zeta5+15+15*zeta5^2, 
22*zeta5+5+5*zeta5^2, 
23*zeta5+10+10*zeta5^2, 
5*zeta5^2+4*zeta5+20+20*zeta5^3, 
5*zeta5^2+6*zeta5+20+20*zeta5^3, 
5*zeta5^2+12*zeta5+20+20*zeta5^3, 
5*zeta5^2+23*zeta5+20+20*zeta5^3, 
10*zeta5^2+3*zeta5+15+15*zeta5^3, 
10*zeta5^2+9*zeta5+15+15*zeta5^3, 
10*zeta5^2+11*zeta5+15+15*zeta5^3, 
10*zeta5^2+17*zeta5+15+15*zeta5^3, 
15*zeta5^2+8*zeta5+10+10*zeta5^3, 
15*zeta5^2+14*zeta5+10+10*zeta5^3, 
15*zeta5^2+16*zeta5+10+10*zeta5^3, 
15*zeta5^2+22*zeta5+10+10*zeta5^3, 
20*zeta5^2+2*zeta5+5+5*zeta5^3, 
20*zeta5^2+13*zeta5+5+5*zeta5^3, 
20*zeta5^2+19*zeta5+5+5*zeta5^3, 
20*zeta5^2+21*zeta5+5+5*zeta5^3, 
5*zeta5^3+5*zeta5^2+zeta5+15, 
5*zeta5^3+5*zeta5^2+7*zeta5+15, 
5*zeta5^3+5*zeta5^2+18*zeta5+15, 
5*zeta5^3+5*zeta5^2+24*zeta5+15, 
5*zeta5^3+10*zeta5^2+8*zeta5+20, 
5*zeta5^3+10*zeta5^2+14*zeta5+20, 
5*zeta5^3+10*zeta5^2+16*zeta5+20, 
5*zeta5^3+10*zeta5^2+22*zeta5+20, 
5*zeta5^3+20*zeta5^2+15*zeta5+10, 
10*zeta5^3+10*zeta5^2+zeta5+5, 
10*zeta5^3+10*zeta5^2+7*zeta5+5, 
10*zeta5^3+10*zeta5^2+18*zeta5+5, 
10*zeta5^3+10*zeta5^2+24*zeta5+5, 
10*zeta5^3+15*zeta5^2+5*zeta5+20, 
10*zeta5^3+20*zeta5^2+4*zeta5+15, 
10*zeta5^3+20*zeta5^2+6*zeta5+15, 
10*zeta5^3+20*zeta5^2+12*zeta5+15, 
10*zeta5^3+20*zeta5^2+23*zeta5+15, 
15*zeta5^3+5*zeta5^2+2*zeta5+10, 
15*zeta5^3+5*zeta5^2+13*zeta5+10, 
15*zeta5^3+5*zeta5^2+19*zeta5+10, 
15*zeta5^3+5*zeta5^2+21*zeta5+10, 
15*zeta5^3+10*zeta5^2+20*zeta5+5, 
15*zeta5^3+15*zeta5^2+zeta5+20, 
15*zeta5^3+15*zeta5^2+7*zeta5+20, 
15*zeta5^3+15*zeta5^2+18*zeta5+20, 
15*zeta5^3+15*zeta5^2+24*zeta5+20, 
20*zeta5^3+5*zeta5^2+10*zeta5+15, 
20*zeta5^3+15*zeta5^2+3*zeta5+5, 
20*zeta5^3+15*zeta5^2+9*zeta5+5, 
20*zeta5^3+15*zeta5^2+11*zeta5+5, 
20*zeta5^3+15*zeta5^2+17*zeta5+5, 
20*zeta5^3+20*zeta5^2+zeta5+10, 
20*zeta5^3+20*zeta5^2+7*zeta5+10, 
20*zeta5^3+20*zeta5^2+18*zeta5+10, 
20*zeta5^3+20*zeta5^2+24*zeta5+10, 
zeta5 
];

# The following gives the members of zeta^2*(Q_5(zeta)*)^2 mod 5^2. 
arr6c :=
[
0, 
zeta5^2, 
7*zeta5^2, 
18*zeta5^2, 
24*zeta5^2, 
2*zeta5^2+10*zeta5+20, 
2*zeta5^2+15*zeta5+15*zeta5^3, 
3*zeta5^2+5*zeta5+10, 
3*zeta5^2+20*zeta5+20*zeta5^3, 
4*zeta5^2+10*zeta5+10*zeta5^3, 
4*zeta5^2+15*zeta5+5, 
6*zeta5^2+10*zeta5+10*zeta5^3, 
6*zeta5^2+15*zeta5+5, 
8*zeta5^2+5*zeta5+5*zeta5^3, 
8*zeta5^2+20*zeta5+15, 
9*zeta5^2+5*zeta5+10, 
9*zeta5^2+20*zeta5+20*zeta5^3, 
11*zeta5^2+5*zeta5+10, 
11*zeta5^2+20*zeta5+20*zeta5^3, 
12*zeta5^2+10*zeta5+10*zeta5^3, 
12*zeta5^2+15*zeta5+5, 
13*zeta5^2+10*zeta5+20, 
13*zeta5^2+15*zeta5+15*zeta5^3, 
14*zeta5^2+5*zeta5+5*zeta5^3, 
14*zeta5^2+20*zeta5+15, 
16*zeta5^2+5*zeta5+5*zeta5^3, 
16*zeta5^2+20*zeta5+15, 
17*zeta5^2+5*zeta5+10, 
17*zeta5^2+20*zeta5+20*zeta5^3, 
19*zeta5^2+10*zeta5+20, 
19*zeta5^2+15*zeta5+15*zeta5^3, 
21*zeta5^2+10*zeta5+20, 
21*zeta5^2+15*zeta5+15*zeta5^3, 
22*zeta5^2+5*zeta5+5*zeta5^3, 
22*zeta5^2+20*zeta5+15, 
23*zeta5^2+10*zeta5+10*zeta5^3, 
23*zeta5^2+15*zeta5+5, 
5*zeta5^3+4*zeta5^2+15, 
5*zeta5^3+6*zeta5^2+15, 
5*zeta5^3+12*zeta5^2+15, 
5*zeta5^3+23*zeta5^2+15, 
10*zeta5^3+3*zeta5^2+5, 
10*zeta5^3+9*zeta5^2+5, 
10*zeta5^3+11*zeta5^2+5, 
10*zeta5^3+17*zeta5^2+5, 
15*zeta5^3+8*zeta5^2+20, 
15*zeta5^3+14*zeta5^2+20, 
15*zeta5^3+16*zeta5^2+20, 
15*zeta5^3+22*zeta5^2+20, 
20*zeta5^3+2*zeta5^2+10, 
20*zeta5^3+13*zeta5^2+10, 
20*zeta5^3+19*zeta5^2+10, 
20*zeta5^3+21*zeta5^2+10, 
2*zeta5^2+20*zeta5+5+5*zeta5^3, 
3*zeta5^2+10*zeta5+15+15*zeta5^3, 
4*zeta5^2+5*zeta5+20+20*zeta5^3, 
6*zeta5^2+5*zeta5+20+20*zeta5^3, 
8*zeta5^2+15*zeta5+10+10*zeta5^3, 
9*zeta5^2+10*zeta5+15+15*zeta5^3, 
11*zeta5^2+10*zeta5+15+15*zeta5^3, 
12*zeta5^2+5*zeta5+20+20*zeta5^3, 
13*zeta5^2+20*zeta5+5+5*zeta5^3, 
14*zeta5^2+15*zeta5+10+10*zeta5^3, 
16*zeta5^2+15*zeta5+10+10*zeta5^3, 
17*zeta5^2+10*zeta5+15+15*zeta5^3, 
19*zeta5^2+20*zeta5+5+5*zeta5^3, 
21*zeta5^2+20*zeta5+5+5*zeta5^3, 
22*zeta5^2+15*zeta5+10+10*zeta5^3, 
23*zeta5^2+5*zeta5+20+20*zeta5^3, 
5*zeta5^3+zeta5^2+10+10*zeta5, 
5*zeta5^3+3*zeta5^2+15*zeta5+20, 
5*zeta5^3+7*zeta5^2+10+10*zeta5, 
5*zeta5^3+9*zeta5^2+15*zeta5+20, 
5*zeta5^3+11*zeta5^2+15*zeta5+20, 
5*zeta5^3+17*zeta5^2+15*zeta5+20, 
5*zeta5^3+18*zeta5^2+10+10*zeta5, 
5*zeta5^3+20*zeta5^2+10*zeta5+15, 
5*zeta5^3+24*zeta5^2+10+10*zeta5, 
10*zeta5^3+zeta5^2+20+20*zeta5, 
10*zeta5^3+2*zeta5^2+5*zeta5+15, 
10*zeta5^3+7*zeta5^2+20+20*zeta5, 
10*zeta5^3+13*zeta5^2+5*zeta5+15, 
10*zeta5^3+15*zeta5^2+20*zeta5+5, 
10*zeta5^3+18*zeta5^2+20+20*zeta5, 
10*zeta5^3+19*zeta5^2+5*zeta5+15, 
10*zeta5^3+21*zeta5^2+5*zeta5+15, 
10*zeta5^3+24*zeta5^2+20+20*zeta5, 
15*zeta5^3+zeta5^2+5+5*zeta5, 
15*zeta5^3+4*zeta5^2+20*zeta5+10, 
15*zeta5^3+6*zeta5^2+20*zeta5+10, 
15*zeta5^3+7*zeta5^2+5+5*zeta5, 
15*zeta5^3+10*zeta5^2+5*zeta5+20, 
15*zeta5^3+12*zeta5^2+20*zeta5+10, 
15*zeta5^3+18*zeta5^2+5+5*zeta5, 
15*zeta5^3+23*zeta5^2+20*zeta5+10, 
15*zeta5^3+24*zeta5^2+5+5*zeta5, 
20*zeta5^3+zeta5^2+15+15*zeta5, 
20*zeta5^3+5*zeta5^2+15*zeta5+10, 
20*zeta5^3+7*zeta5^2+15+15*zeta5, 
20*zeta5^3+8*zeta5^2+10*zeta5+5, 
20*zeta5^3+14*zeta5^2+10*zeta5+5, 
20*zeta5^3+16*zeta5^2+10*zeta5+5, 
20*zeta5^3+18*zeta5^2+15+15*zeta5, 
20*zeta5^3+22*zeta5^2+10*zeta5+5, 
20*zeta5^3+24*zeta5^2+15+15*zeta5 
];

# The following gives the members of zeta^3*(Q_5(zeta)*)^2 mod 5^2. 
arr6d :=
[
0, 
zeta^3, 
7*zeta^3, 
18*zeta^3, 
24*zeta^3, 
2*zeta^3+15+15*zeta, 
2*zeta^3+10*zeta^2+20*zeta, 
2*zeta^3+20*zeta^2+10, 
3*zeta^3+20+20*zeta, 
3*zeta^3+5*zeta^2+10*zeta, 
3*zeta^3+10*zeta^2+5, 
4*zeta^3+10+10*zeta, 
4*zeta^3+5*zeta^2+15, 
4*zeta^3+15*zeta^2+5*zeta, 
6*zeta^3+10+10*zeta, 
6*zeta^3+5*zeta^2+15, 
6*zeta^3+15*zeta^2+5*zeta, 
8*zeta^3+5+5*zeta, 
8*zeta^3+15*zeta^2+20, 
8*zeta^3+20*zeta^2+15*zeta, 
9*zeta^3+20+20*zeta, 
9*zeta^3+5*zeta^2+10*zeta, 
9*zeta^3+10*zeta^2+5, 
11*zeta^3+20+20*zeta, 
11*zeta^3+5*zeta^2+10*zeta, 
11*zeta^3+10*zeta^2+5, 
12*zeta^3+10+10*zeta, 
12*zeta^3+5*zeta^2+15, 
12*zeta^3+15*zeta^2+5*zeta, 
13*zeta^3+15+15*zeta, 
13*zeta^3+10*zeta^2+20*zeta, 
13*zeta^3+20*zeta^2+10, 
14*zeta^3+5+5*zeta, 
14*zeta^3+15*zeta^2+20, 
14*zeta^3+20*zeta^2+15*zeta, 
16*zeta^3+5+5*zeta, 
16*zeta^3+15*zeta^2+20, 
16*zeta^3+20*zeta^2+15*zeta, 
17*zeta^3+20+20*zeta, 
17*zeta^3+5*zeta^2+10*zeta, 
17*zeta^3+10*zeta^2+5, 
19*zeta^3+15+15*zeta, 
19*zeta^3+10*zeta^2+20*zeta, 
19*zeta^3+20*zeta^2+10, 
21*zeta^3+15+15*zeta, 
21*zeta^3+10*zeta^2+20*zeta, 
21*zeta^3+20*zeta^2+10, 
22*zeta^3+5+5*zeta, 
22*zeta^3+15*zeta^2+20, 
22*zeta^3+20*zeta^2+15*zeta, 
23*zeta^3+10+10*zeta, 
23*zeta^3+5*zeta^2+15, 
23*zeta^3+15*zeta^2+5*zeta, 
zeta^3+5*zeta+10+10*zeta^2, 
zeta^3+10*zeta+20+20*zeta^2, 
zeta^3+15*zeta+5+5*zeta^2, 
zeta^3+20*zeta+15+15*zeta^2, 
2*zeta^3+15*zeta^2+10*zeta+5, 
2*zeta^3+5*zeta+5*zeta^2+20, 
3*zeta^3+20*zeta^2+5*zeta+15, 
3*zeta^3+15*zeta+15*zeta^2+10, 
4*zeta^3+10*zeta^2+15*zeta+20, 
4*zeta^3+20*zeta+20*zeta^2+5, 
5*zeta^3+10*zeta^2+20*zeta+15, 
6*zeta^3+10*zeta^2+15*zeta+20, 
6*zeta^3+20*zeta+20*zeta^2+5, 
7*zeta^3+5*zeta+10+10*zeta^2, 
7*zeta^3+10*zeta+20+20*zeta^2, 
7*zeta^3+15*zeta+5+5*zeta^2, 
7*zeta^3+20*zeta+15+15*zeta^2, 
8*zeta^3+5*zeta^2+20*zeta+10, 
8*zeta^3+10*zeta+10*zeta^2+15, 
9*zeta^3+20*zeta^2+5*zeta+15, 
9*zeta^3+15*zeta+15*zeta^2+10, 
10*zeta^3+20*zeta^2+15*zeta+5, 
11*zeta^3+20*zeta^2+5*zeta+15, 
11*zeta^3+15*zeta+15*zeta^2+10, 
12*zeta^3+10*zeta^2+15*zeta+20, 
12*zeta^3+20*zeta+20*zeta^2+5, 
13*zeta^3+15*zeta^2+10*zeta+5, 
13*zeta^3+5*zeta+5*zeta^2+20, 
14*zeta^3+5*zeta^2+20*zeta+10, 
14*zeta^3+10*zeta+10*zeta^2+15, 
15*zeta^3+5*zeta^2+10*zeta+20, 
16*zeta^3+5*zeta^2+20*zeta+10, 
16*zeta^3+10*zeta+10*zeta^2+15, 
17*zeta^3+20*zeta^2+5*zeta+15, 
17*zeta^3+15*zeta+15*zeta^2+10, 
18*zeta^3+5*zeta+10+10*zeta^2, 
18*zeta^3+10*zeta+20+20*zeta^2, 
18*zeta^3+15*zeta+5+5*zeta^2, 
18*zeta^3+20*zeta+15+15*zeta^2, 
19*zeta^3+15*zeta^2+10*zeta+5, 
19*zeta^3+5*zeta+5*zeta^2+20, 
20*zeta^3+15*zeta^2+5*zeta+10, 
21*zeta^3+15*zeta^2+10*zeta+5, 
21*zeta^3+5*zeta+5*zeta^2+20, 
22*zeta^3+5*zeta^2+20*zeta+10, 
22*zeta^3+10*zeta+10*zeta^2+15, 
23*zeta^3+10*zeta^2+15*zeta+20, 
23*zeta^3+20*zeta+20*zeta^2+5, 
24*zeta^3+5*zeta+10+10*zeta^2, 
24*zeta^3+10*zeta+20+20*zeta^2, 
24*zeta^3+15*zeta+5+5*zeta^2, 
24*zeta^3+20*zeta+15+15*zeta^2
];

# The following gives the members of zeta^4*(Q_5(zeta)*)^2 mod 5^2. 
arr6e :=
[
0, 
1+zeta5^3+zeta5^2+zeta5, 
7+7*zeta5^3+7*zeta5^2+7*zeta5, 
18+18*zeta5^3+18*zeta5^2+18*zeta5, 
24+24*zeta5^3+24*zeta5^2+24*zeta5, 
2*zeta5^2+2*zeta5^3+7*zeta5+17, 
2*zeta5^2+22*zeta5+22*zeta5^3+7, 
3*zeta5^2+3*zeta5^3+18*zeta5+23, 
3*zeta5^2+13*zeta5+13*zeta5^3+18, 
4*zeta5^2+4*zeta5^3+24*zeta5+14, 
4*zeta5^2+9*zeta5+9*zeta5^3+24, 
6*zeta5^2+6*zeta5^3+zeta5+16, 
6*zeta5^2+11*zeta5+11*zeta5^3+1, 
8*zeta5^2+8*zeta5^3+18*zeta5+13, 
8*zeta5^2+23*zeta5+23*zeta5^3+18, 
9*zeta5^2+9*zeta5^3+24*zeta5+4, 
9*zeta5^2+19*zeta5+19*zeta5^3+24, 
11*zeta5^2+11*zeta5^3+zeta5+6, 
11*zeta5^2+21*zeta5+21*zeta5^3+1, 
12*zeta5^2+12*zeta5^3+7*zeta5+22, 
12*zeta5^2+17*zeta5+17*zeta5^3+7, 
13*zeta5^2+13*zeta5^3+18*zeta5+3, 
13*zeta5^2+8*zeta5+8*zeta5^3+18, 
14*zeta5^2+14*zeta5^3+24*zeta5+19, 
14*zeta5^2+4*zeta5+4*zeta5^3+24, 
16*zeta5^2+16*zeta5^3+zeta5+21, 
16*zeta5^2+6*zeta5+6*zeta5^3+1, 
17*zeta5^2+17*zeta5^3+7*zeta5+12, 
17*zeta5^2+2*zeta5+2*zeta5^3+7, 
19*zeta5^2+19*zeta5^3+24*zeta5+9, 
19*zeta5^2+14*zeta5+14*zeta5^3+24, 
21*zeta5^2+21*zeta5^3+zeta5+11, 
21*zeta5^2+16*zeta5+16*zeta5^3+1, 
22*zeta5^2+22*zeta5^3+7*zeta5+2, 
22*zeta5^2+12*zeta5+12*zeta5^3+7, 
23*zeta5^2+23*zeta5^3+18*zeta5+8, 
23*zeta5^2+3*zeta5+3*zeta5^3+18, 
zeta5^3+6*zeta5+11+11*zeta5^2, 
zeta5^3+11*zeta5+21+21*zeta5^2, 
zeta5^3+16*zeta5+6+6*zeta5^2, 
zeta5^3+21*zeta5+16+16*zeta5^2, 
2*zeta5^3+7*zeta5^2+22+22*zeta5, 
2*zeta5^3+22*zeta5^2+17*zeta5+12, 
3*zeta5^3+13*zeta5^2+23*zeta5+8, 
3*zeta5^3+18*zeta5^2+13+13*zeta5, 
4*zeta5^3+9*zeta5^2+14*zeta5+19, 
4*zeta5^3+24*zeta5^2+9+9*zeta5, 
5*zeta5^3+15*zeta5^2+10*zeta5+20, 
6*zeta5^3+zeta5^2+11+11*zeta5, 
6*zeta5^3+11*zeta5^2+16*zeta5+21, 
7*zeta5^3+2*zeta5+22+22*zeta5^2, 
7*zeta5^3+12*zeta5+17+17*zeta5^2, 
7*zeta5^3+17*zeta5+2+2*zeta5^2, 
7*zeta5^3+22*zeta5+12+12*zeta5^2, 
8*zeta5^3+18*zeta5^2+23+23*zeta5, 
8*zeta5^3+23*zeta5^2+13*zeta5+3, 
9*zeta5^3+19*zeta5^2+4*zeta5+14, 
9*zeta5^3+24*zeta5^2+19+19*zeta5, 
10*zeta5^3+5*zeta5^2+20*zeta5+15, 
11*zeta5^3+zeta5^2+21+21*zeta5, 
11*zeta5^3+21*zeta5^2+6*zeta5+16, 
12*zeta5^3+7*zeta5^2+17+17*zeta5, 
12*zeta5^3+17*zeta5^2+22*zeta5+2, 
13*zeta5^3+8*zeta5^2+3*zeta5+23, 
13*zeta5^3+18*zeta5^2+8+8*zeta5, 
14*zeta5^3+4*zeta5^2+19*zeta5+9, 
14*zeta5^3+24*zeta5^2+4+4*zeta5, 
15*zeta5^3+20*zeta5^2+5*zeta5+10, 
16*zeta5^3+zeta5^2+6+6*zeta5, 
16*zeta5^3+6*zeta5^2+21*zeta5+11, 
17*zeta5^3+2*zeta5^2+12*zeta5+22, 
17*zeta5^3+7*zeta5^2+2+2*zeta5, 
18*zeta5^3+3*zeta5+13+13*zeta5^2, 
18*zeta5^3+8*zeta5+23+23*zeta5^2, 
18*zeta5^3+13*zeta5+8+8*zeta5^2, 
18*zeta5^3+23*zeta5+3+3*zeta5^2, 
19*zeta5^3+14*zeta5^2+9*zeta5+4, 
19*zeta5^3+24*zeta5^2+14+14*zeta5, 
20*zeta5^3+10*zeta5^2+15*zeta5+5, 
21*zeta5^3+zeta5^2+16+16*zeta5, 
21*zeta5^3+16*zeta5^2+11*zeta5+6, 
22*zeta5^3+7*zeta5^2+12+12*zeta5, 
22*zeta5^3+12*zeta5^2+2*zeta5+17, 
23*zeta5^3+3*zeta5^2+8*zeta5+13, 
23*zeta5^3+18*zeta5^2+3+3*zeta5, 
24*zeta5^3+4*zeta5+9+9*zeta5^2, 
24*zeta5^3+9*zeta5+19+19*zeta5^2, 
24*zeta5^3+14*zeta5+4+4*zeta5^2, 
24*zeta5^3+19*zeta5+14+14*zeta5^2, 
2*zeta5+2*zeta5^2+12+12*zeta5^3, 
3*zeta5+3*zeta5^2+8+8*zeta5^3, 
4*zeta5+4*zeta5^2+19+19*zeta5^3, 
6*zeta5+6*zeta5^2+21+21*zeta5^3, 
8*zeta5+8*zeta5^2+3+3*zeta5^3, 
9*zeta5+9*zeta5^2+14+14*zeta5^3, 
11*zeta5+11*zeta5^2+16+16*zeta5^3, 
12*zeta5+12*zeta5^2+2+2*zeta5^3, 
13*zeta5+13*zeta5^2+23+23*zeta5^3, 
14*zeta5+14*zeta5^2+9+9*zeta5^3, 
16*zeta5+16*zeta5^2+11+11*zeta5^3, 
17*zeta5+17*zeta5^2+22+22*zeta5^3, 
19*zeta5+19*zeta5^2+4+4*zeta5^3, 
21*zeta5+21*zeta5^2+6+6*zeta5^3, 
22*zeta5+22*zeta5^2+17+17*zeta5^3, 
23*zeta5+23*zeta5^2+13+13*zeta5^3 
];

# The following produces an array whose entries are of the 
# form: [ x-coord, y-coord, first cpt of Cassels map ], 
# where (x-coord, y-coord) are in Dmon1(Q_5), and the Cassels map q_5
# is being applied to { (x-coord, y-coord), infty } in Jtilde(Q_5). 
# 
arr2 := [];
for xx from -33 to 33 do if nops([rootp(y^2 - subs(x=xx, Dmon1), 5)]) > 0
then subyy := [msolve( y^2 - subs(x=xx, Dmon1), 5^8 )][1][1];
arr2 := [ op(arr2), [xx,subyy,simplify(subs( x=xx, subyy, rr))] ] fi od;

# The following is the image under q_5 of {(1,?), infty}. 
imagex1 := arr2[14][3] mod 5^2;
if imagex1 in arr6a then print(true) fi;
if imagex1 in arr6b then print(true) fi;
if imagex1 in arr6c then print(true) fi;
if imagex1 in arr6d then print(true) fi;
if imagex1 in arr6e then print(true) fi;
# Note that imagex1 is in none of these, and so it is not in any of: 
# (Q_5(zeta5)*)^5, zeta*(Q_5(zeta5)*)^5, zeta^2*(Q_5(zeta5)*)^5, 
#      zeta^3*(Q_5(zeta5)*)^5, zeta^4*(Q_5(zeta5)*)^5.
# So, now we have rank 0, as expected (2-descent also gave bound 0). 
# 
# Here is an overall summary for r=1. 
# qtilde : Jac(Cmon1)(Q)/ phitilde( Jac(Dmon1)(Q) )
#    -->  Q(sqrt(5))*/( Q(sqrt(5))* )^5 x Q*/( Q* )^5
#  : {(x1,y1),(x2,y2)} |-->
# [(y1-sqrt5*(16-12*x1+3*x1^2))*(y2-sqrt5*(16-12*x2+3*x2^2)),
#  (y1-(16-20*x1+5*x1^2))*(y2-(16-20*x2+5*x2^2))].
# The image of qtilde is a subgroup of: 
# < [(1-sqrt5)/2, 1], [1, 2], [1, 5] >.
# qtilde : T2 = { (0,16), infty } |--> [(1-sqrt5)/2, 1].
# Hence: < [(1-sqrt5)/2, 1] > is a subgroup of the image of qtilde.
# 
# q : Jac(Dmon1)(Q)/ phi( Jac(Cmon1)(Q) )
#    -->  Q(zeta5)*/( Q(zeta5)* )^5
#             x Q(zeta5)*/( Q(zeta5)* )^5
# The image of q is a subgroup of < [zeta, zeta^2] >.
# 
#  # Jtilde(Q_2)/phi(J(Q_2)) # J(Q_2)/phitilde(Jtilde(Q_2)) = 5^1.
#  # Jtilde(Q_2)/phi(J(Q_2)) = 5^1, with image under q_5: < [zeta5,zeta5^2] >.
# This was the image of {(-2,y), infty}, with y == 48 (mod 64) under q_5. 
#   # J(Q_2)/phitilde(Jtilde(Q_2)) = 5^0.
# Also, j_2 has trivial kernel and
# the kernel of jtilde_2 is precisely: < [(1-sqrt5)/2, 1], [1, 5] >.
# so that:
# j_2^{-1}( q_2( Jtilde(Q_2)/phi(J(Q_2)) ) ) = < [zeta5,zeta5^2] >.
# jtilde_2^{-1}( qtilde_2( J(Q_2)/phitilde(Jtilde(Q_2)) ) )
#     = [ <(1-sqrt5)/2>, <5> ] = < [(1-sqrt5)/2, 1], [1, 5] >.
# 
#  # Jtilde(Q_5)/phi(J(Q_5)) # J(Q_5)/phitilde(Jtilde(Q_5)) = 5^3.
# j_5 and jtilde_5 have trivial kernel. 
# q_5 : {(1,?), infty} |--> elt not even in the image of j_5.
#  # Jtilde(Q_5)/phi(J(Q_5)) = 5^1.
# qtilde_5 : T2 |--> [(1-sqrt5)/2, 1]. 
# qtilde_5 : {(3,?),infty} |--> [1, 2].
#  # Jtilde(Q_5)/phi(J(Q_5)) = 5^2.
# so that:
# j_5^{-1}( q_5( Jtilde(Q_5)/phi(J(Q_5)) ) ) = < [1, 1] >.
# jtilde_5^{-1}( qtilde_5( J(Q_5)/phitilde(Jtilde(Q_5)) ) )
#  = < [(1-sqrt5)/2, 1], [1, 2] >.  
# 
# Hence:
# j_2^{-1}( q_2( Jtilde(Q_2)/phi(J(Q_2)) ) )
#     intersection j_5^{-1}( q_5( Jtilde(Q_5)/phi(J(Q_5)) ) ) = < [1, 1] >.
# jtilde_2^{-1}( qtilde_2( J(Q_2)/phitilde(Jtilde(Q_2)) ) )
#     intersection jtilde_5^{-1}( qtilde_5( J(Q_5)/phitilde(Jtilde(Q_5)) ) )
#          = < [(1-sqrt5)/2, 1] >. 
# Hence we have rank bound zero. 
# 

# 
# My idea for Sha. Let eps1 be fund unit in Q(sqrt(5*p)) 
# and eps2 be find unit in Q(sqrt(p)). 
# Choose p = 1 or 4 (mod 5), so that p is a qr mod 5,
# forcing T2 = { (0, 16*p^2*sqrt(p)), infty }
# to be in J(Q_5), hopefully mapping to [ eps1, 1 ]
# (or: [ eps1^2, 1], [ eps^3, 1 ], [ eps^4, 1] ). 
# Also, choose p so that eps1 is in (Q_p(sqrt(5*p)*)^5 
# and in (Q_2(sqrt(5*p)*)^5, which seems easy by HL.
# This might find an example, without needing to write a program 
# for finding the (5,5)-Selmer bound. 
# Maybe a similar idea could find Sha for the 25-isogeny
# on y^2 = x^5 + k. 
# 

# The following produces an array: fundunit, whose entries 
# are of the form [n, fund unit of Q(sqrt(n)]. 
# It might not be perfect in every case, but we are working 
# mod 5th powers, so fine as long as the unit is not a 5th power
# (can check carefully afterwards if this suggests a promising example).
# 
N := 1000;
with(numtheory);
fundunit := [ ]; 
for n from 2 to N do
  if mobius(n) <> 0 then 
    sofar := false;
    if n mod 4 =  1 then
      cfrac( evalf( (1 + sqrt(n))/2, 5000 ), 15, 'con' ); 
      con := [ floor(evalf( (1+sqrt(n))/2 )), op(con) ];
      for j from 1 to nops(con) do
        num1 := numer(con[j]);
        den1 := denom(con[j]);
        if sofar = false and abs(num1^2 - n*den1^2) = 1 then
          fundunit := [ op(fundunit), [ n, num1 + den1*RootOf(t^2-n) ] ];
          sofar := true
        fi;
        if sofar = false and (num1 mod 2 = 1) and (den1 mod 2 = 1)
        and abs(num1^2 - n*den1^2) = 4 then
          fundunit := [ op(fundunit), [ n, num1/2 + den1/2*RootOf(t^2-n) ] ];
          sofar := true
        fi
      od;
      cfrac( evalf( sqrt(n), 5000 ), 15, 'con' ); 
      con := [ floor(evalf( sqrt(n) )), op(con) ];
      for j from 1 to nops(con) do
        num1 := numer(con[j]);
        den1 := denom(con[j]);
        if sofar = false and abs(num1^2 - n*den1^2) = 1 then
          fundunit := [ op(fundunit), [ n, num1 + den1*RootOf(t^2-n) ] ];
          sofar := true
        fi;
        if sofar = false and (num1 mod 2 = 1) and (den1 mod 2 = 1)
        and abs(num1^2 - n*den1^2) = 4 then
          fundunit := [ op(fundunit), [ n, num1/2 + den1/2*RootOf(t^2-n) ] ];
          sofar := true
        fi
      od
    else
      cfrac( evalf( sqrt(n), 5000 ), 15, 'con' ); 
      con := [ floor(evalf(sqrt(n))), op(con) ];
      for j from 1 to nops(con) do
        num1 := numer(con[j]);
        den1 := denom(con[j]);
        if sofar = false and abs(num1^2 - n*den1^2) = 1 then
          fundunit := [ op(fundunit), [ n, num1 + den1*RootOf(t^2-n) ] ];
          sofar := true
        fi
      od
    fi
  fi
od;

# Now recall: 
# Cmon: y^2 = r*5*(16*r^2 - 12*r*x + 3*x^2)^2 + (x - 4*r)^5
#           = r*(16*r^2 - 20*r*x + 5*x^2)^2 + x^5
# Dmon: y^2= 25*r*(-5+2*sqrt5)*(x^2+(15+4*sqrt5)*100*r^2)^2 + (x-10*sqrt5*r)^5
#          = 25*r*(-5-2*sqrt5)*(x^2+(15-4*sqrt5)*100*r^2)^2 + (x+10*sqrt5*r)^5
# 
# T1 = { (4*r, 16*r^2*sqrt(5*r)), infty }.
# T2 = { (0, 16*r^2*sqrt(r)), infty }.
# qtilde : Jac(Cmon)(Q)/ phitilde( Jac(Dmon)(Q) )
#    -->  Q(sqrt(5*r))*/( Q(sqrt(5*r))* )^5 x Q(sqrt(r))*/( Q(sqrt(r))* )^5
#  : {(x1,y1),(x2,y2)} |--> 
#[(y1-sqrt(5*r)*(16*r^2-12*x1*r+3*x1^2))*(y2-sqrt(5*r)*(16*r^2-12*x2*r+3*x2^2)),
# (y1-sqrt(r)*(16*r^2-20*x1*r+5*x1^2))*(y2-sqrt(r)*(16*r^2-20*x2*r+5*x2^2))].
# Note that anything in the image must have norm a 5th power in Q. This uses: 
#  (y-sqrt(5*r)*(16*r^2-12*x*r+3*x^2))*(y+sqrt(5*r)*(16*r^2-12*x*r+3*x^2)) 
#    = (x - 4*r)^5,
# (y-sqrt(r)*(16*r^2-20*x*r+5*x^2))*(y+sqrt(r)*(16*r^2-20*x*r+5*x^2))
#    = x^5. 
# Let r = p == 1 or 4 (mod 5), so that p is a qr mod 5. 
# Then Q_5(sqrt(5*p)) = Q_5(sqrt(5)) and Q_5(sqrt(p)) = Q_5. 
# Let w be such that w^2 == p (mod 5). 
# Then T2 = { (0, 16*r^2*sqrt(r)), infty } = { (0, 16*w^5), infty } 
# under the embedding Q(sqrt(p)) --> Q_5 : sqrt(p) |--> w, 
# and T2 = { (0, 16*r^2*sqrt(r)), infty } = { (0, -16*w^5), infty } 
# under the embedding Q(sqrt(p)) --> Q_5 : sqrt(p) |--> -w, 
# qtilde_5 : T2 |--> 
# [ y-sqrt(5*r)*(16*r^2-12*x*r+3*x^2), y+sqrt(r)*(16*r^2-20*x*r+5*x^2) ].
# = [16*r^2*sqrt(r) - 16*r^2*sqrt(r)*sqrt(5), 16*r^2*sqrt(r) + 16*r^2*sqrt(r)]
# = [ (1 - sqrt(5))/2, 1 ].
# Take p == 1 or 4 (mod 5). So, our first requirement is that: 
# (a) (1 - sqrt(5))/2 is the same as eps1^i (fund unit of Q(sqrt(5*p)) 
# mod 5th powers in Q_5(sqrt(5)), for i = 1,2,3,4.
# Also, need 
# (b) eps1 to be in (Q_p(sqrt(5)*)^5, which seems easy by HL. 
#     For example, suff for eqs1 = a + b*sqrt(5*p) to have a odd, b even.
# (c) eps1 to be in (Q_2(sqrt(5)*)^5, which seems easy by HL.
#     For example, suff for eqs1 = a + b*sqrt(5*p) to have a qr mod p.
# 
# The above might be stated as a lemma. 
# 
# The following finds all 5th power powers in Q_5(sqrt(5)) mod 5^3. 
q5power5 := {};
for i1 from 0 to 5^3-1 do for i2 from 0 to 5^3-1 do
  expv := simplify(  (i1 + i2*sqrt5)^5 );
  j2 := coeff(expv, sqrt5);
  j1 := expv - j2*sqrt5;
  jj1 := j1 mod 5^3; 
  jj2 := j2 mod 5^3;
  q5power5 := { op(q5power5), jj1 + jj2*sqrt5 };
od od;
# 
# Let us try r=p=11, the first prime == 1 or 4 (mod 5). 
# From our array fundunit, the fund unit in Q(sqrt(55)) is: 89 + 12*sqrt(55). 
# Let this be denoted by: eps1. 
# Consider Cmon for r=p=11. 
# Of course, 11 is a qr mod 5 (which is why we chose p == 1 or 4 mod 5):
msolve( w^2 = 11, 5^5 );
# The above gave: {w = 3069}, {w = 56}, and we shall use 56. 
# So: eps1 is just 89 + 12*56*sqrt(5) in Q_5(sqrt(5), modulo an easily 
# large enough power of 5.
simplify( (89 + 12*56*sqrt5)*( (1 - sqrt5)/2 )^3 ) mod 5^3;
# The above gave: 68+5*RootOf(_Z^2+120)
if 68 + 5*sqrt5 in q5power5 then print(true) fi;
# The above gave true, which tells us that it is a 5th mod 5^3,
# and that is good enough by HL to be a 5th power in Q_5(sqrt(5)). 
# (note, if we had taken instead w=3069, then we would have
# had simplify( (89 + 12*3069*sqrt5)*( (1 - sqrt5)/2 )^2 ) mod 5^3 a 5th power).
# Let's check what 5th power it is:
for i1 from 0 to 5^3-1 do for i2 from 0 to 5^3-1 do
  expv := simplify(  (i1 + i2*sqrt5)^5 );
  j2 := coeff(expv, sqrt5);
  j1 := expv - j2*sqrt5;
  jj1 := j1 mod 5^3;
  jj2 := j2 mod 5^3;
  if 68 + 5*sqrt5 = jj1 + jj2*sqrt5 then print(i1 + i2*sqrt5) fi;
od od; 
# The first solution is: 23 + 16*sqrt5.
# This tells us that: (23 + 16*sqrt5)^5 == eps1*( (1 - sqrt5)/2 )^3 mod 5^3,
simplify( (23 + 16*sqrt5)^5 - (89 + 12*56*sqrt5)*( (1 - sqrt5)/2 )^3 ) mod 5^3;
# It must then be that also eps1^2*( (1 - sqrt5)/2 ) is a 5th power. 
# Check directly:
simplify( (89 + 12*56*sqrt5)^2*( (1 - sqrt5)/2 ) ) mod 5^3;
# The above gave: 68+75*RootOf(_Z^2+120)
if 68 + 75*sqrt5 in q5power5 then print(true) fi;
# The above gave true.
# Let's check what 5th power it is:
for i1 from 0 to 5^3-1 do for i2 from 0 to 5^3-1 do
  expv := simplify(  (i1 + i2*sqrt5)^5 );
  j2 := coeff(expv, sqrt5);
  j1 := expv - j2*sqrt5;
  jj1 := j1 mod 5^3;
  jj2 := j2 mod 5^3;
  if 68 + 75*sqrt5 = jj1 + jj2*sqrt5 then print(i1 + i2*sqrt5) fi;
od od; 
# The first soln is: 18 + 15*sqrt5:
simplify( (18 + 15*sqrt5)^5 - (89 + 12*56*sqrt5)^2*( (1 - sqrt5)/2 ) ) mod 5^3;
# so that f(x) = x^5 - eps1^2*( (1 - sqrt5)/2 ) has:
# | f( 18 + 15*sqrt5 ) |_5  <= 5^{-3}, and:
# | f'( 18 + 15*sqrt5 ) |_5 = 5^{-1},
# so by HL, f(x) has a soln in Q_5, so that eps1^2*( (1 - sqrt5)/2 ) 
# is in (Q_5(sqrt5)*)^5. It follows that (1 - sqrt5)/2 = eps1^3.
# in Q_5(sqrt5)*/(Q_5(sqrt5)*)^5.
# So, let T2 = { (0, 16*11^2*sqrt(11)), infty } be chosen
# to be: T2_5 = { (0, 16*w^5), infty } in J(Q_5), where w is in Q_5,
# with w^2 = 11 and w == 1 (mod 5). Then:
# qtilde_5 : T2_5 |--> [ eps1^3, 1],
# and so 2*T2_5 |--> [ (eps1^3)^2, 1 ] = [eps1, 1] (mod 5th powers). 
# So far, this tells us that [ eps1, 1] cannot be disqualified 
# by 5-adic arguments.
# If we want to be carefully literal about qtilde_5 then strictly 
# speaking qtilde_5 : T2_5 |--> [(w^5 - w^4*sqrt(55))/2, 1]
# where we are taking approx w = 56 in Q_5 (w^2 = 11 and w == 1 (mod 5).
# Then (adjusting our previous Maple command by absorbing 56*sqrt5
# as sqrt55):
sqrt55 := RootOf(z^2 - 55);
simplify( (56*18 + 15*sqrt55)^5 
    - (89 + 12*sqrt55)^2*( (56^5 - 56^4*sqrt55)/2 ) ) mod 5^3;
# The above shows directly that T2_5 maps to eps1^3.  
# 
 
# 
# Now, let f(x) = x^5 - eps1 = x^5 - (89 + 12*sqrt(55)) over Q_2(sqrt55).
# Then | f(1) |_2 < 1 and | f'(1) |_2 = 1, so soln by HL.
# This means that [ eps1, 1 ] is in the kernel of jtilde_2
# and cannot be disqualified by 2-adic arguments.
# 
# Now, let f(x) = x^5 - eps1 = x^5 - (89 + 12*sqrt(55)) over Q_11(sqrt55).
# Then | f(1) |_11 < 1 and | f'(1) |_11 = 1, so soln by HL.
# This means that [ eps1, 1 ] is in the kernel of jtilde_11
# and cannot be disqualified by 11-adic arguments.
# 
# Clearly nothing can be disqualified at infinity, since R*/(R*)^5 
# is the trivial group and everything is in the kernel of jtilde_infty. 
# 
# This means the [ eps1, 1 ] is in the Selmer group of the (5,5) 
# isogeny, and # J(Q)/phitilde(Jtilde(Q)) is bound above by 5^1.
# On the other hand, J[tilde](Q) and indeed all of J[5](Q) is 
# the trivial group here, so that the (5,5)-Selmer bound
# on the rank is nonzero. 
# 
# The above should be easy to automate, if I wanted to get 
# other examples where the (5,5)-Selmer bound is nonzero. 
# Note also that the y^2 = x^5 + k family might be amenable to similar args. 
# 
# The following in Magma give 2-Selmer bound 0, so it appears 
# that we have 5-part of Sha in this case. 
# Most likely this can be generalised to a congruence class of p, 
# with conditions  
# _<x> := PolynomialRing(Rationals());  
# r := 11;                                                               
# Cmon := 256*r^5-640*x*r^4+560*x^2*r^3-200*x^3*r^2+25*x^4*r+x^5;        
# rkCmon := TwoSelmerGroupData( Jacobian( HyperellipticCurve( Cmon ) ) );
# rkCmon;
# TorsionSubgroup( Jacobian( HyperellipticCurve( Cmon ) ) ); 
# The above gave: 2-Selmer bound of 0 on the rank, and trivial torsion group. 
# Note: this means there cannot be any affine points in J(Q). 
# I might check whether there are affine points everywhere locally.
