// degree-7.m //////////////////////////////////////////////////////////////////
// 
// Benjamin Smith
// INRIA Saclay -- Île-de-France 2009
// 
// Contact: smith@lix.polytechnique.fr
//
// File last updated 15 June 2010
//
// This file is distributed with the article
// "Families of explicitly isogenous Jacobians of variable-separated curves"
//
// This file is an executable Magma program: see
//	http://magma.maths.usyd.edu.au/
// It contains a series of definitions, followed by a series of assertions
// to verify the correctness of the definitions.
// If the assertions are correct, then no output is produced.
// If the assertions no not hold, then executing this file will produce a
// runtime error.
// 
// We define:
//     	k	: The base field: a quadratic imaginary field
//	alpha_7 : A generator of k over QQ
//	K	: A rational function field over k
//	t	: A generator of K over k
//	sigma	: The automorphism of K induced by complex conjugation on k
//     	f_7	: A univariate polynomial over K 
//	g_7 	: A univariate polynomial over K 
//	A_7	: A bivariate polynomial over K
//	B_7	: A bivariate polynomial over K
//	M_6	: A 6x6 matrix over K
//
// The file concludes with an assertion: 
//	f_7(x_1) - g_7(x_2) = A_7(x_1,x_2)B_7(x_1,x_2).
// 
// Briefly, the correspondence V(y_1 - y_2, A_7(x_1,x_2))
// induces an isogeny between the Jacobians of the curves
//     X: P_d(y_1) = f_7(x_1)   and   Y: P_d(y_2) = g_7(x_2) 
// where P_d is the generic monic polynomial of degree d.
//
// The isogeny splits multiplication-by-2 .
//
// The regular differentials on X (resp. Y) 
// have bases of the form 
// 	w_{i,j} = y_1^{i-1}d(x_1^j)/P_d'(y_1)   (on X)
// and
//	w_{i,j}' = y_2^{i-1}d(x_2^j)/P_d'(y_2)  (on Y),
// where (i,j) ranges over the interior integer points of the Newton polygon
// of X and Y, which is { (x,y) in RR^2 : x >= 0, y >= 0, dx + 7y <= 7d }.
//
// The homomorphism of regular differentials induced by the isogeny
// is given by the diagonal block matrix \oplus_i M_j ,
// where M_j is the upper-left jxj submatrix of M_6.
//
// We note that f_7 = 7g, where g is the polynomial defined in \S5.1 
// of Cassou-Nogues and Couveignes, "Factorisations explicites de g(y)-h(z)".

// To navigate through this file, use the following tags:
//	BASEFIELD	: Section defining base field and sigma
//	POLYNOMIALS	: Section defining f_7 and g_7
//	FACTORS		: Section defining A_7 and B_7
//	MATRIX		: Section defining M_6 
//	ASSERTIONS	: Section containing assertions

// Section BASEFIELD ///////////////////////////////////////////////////////////

k := ext< RationalField( ) | Polynomial([2,1,1]) >;
alpha_7 := k.1;
K := FunctionField(k);
t := K.1;
U := PolynomialRing(K);

sigma := hom< K -> K | hom< k -> K | Norm(alpha_7)/alpha_7>, t >;

// Section POLYNOMIALS /////////////////////////////////////////////////////////

f_7 := Polynomial([
  7*alpha_7*t^3, // trailing coefficient
  7*(3*alpha_7 - 2)*t^3 - 7*(alpha_7 + 3)*t^2,
  -7*2*(2*alpha_7 + 3)*t^2,
  -7*(2*alpha_7 + 5)*t^2,
  -7*alpha_7*t,
  -7*alpha_7*t,
  0,
  1 // leading coefficient
]);

g_7 := Polynomial([sigma(c): c in Coefficients(f_7)]);


// Section FACTORS /////////////////////////////////////////////////////////////

R := PolynomialRing(K,2);  
x_1 := R.1;
x_2 := R.2;

A_7 := 	x_1^3 - alpha_7*x_1^2*x_2 + sigma(alpha_7)*x_1*x_2^2 - x_2^3 
	+ (5 + 3*sigma(alpha_7))*t*x_1 - (5 + 3*alpha_7)*t*x_2 
	- (alpha_7 - sigma(alpha_7))*t
;

B_7 := 	x_1^4 + alpha_7*x_1^3*x_2 + -1*x_1^2*x_2^2 + (-4*alpha_7 - 2)*t*x_1^2 
	+ (-alpha_7 - 1)*x_1*x_2^3 + 7*t*x_1*x_2 + (-5*alpha_7 + 1)*t*x_1 
	+ x_2^4 + (4*alpha_7 + 2)*t*x_2^2 + (5*alpha_7 + 6)*t*x_2 + -7*t^2 
;

// Section MATRIX //////////////////////////////////////////////////////////////

M_6 := Matrix(
[
  [
    alpha_7,
    0,
    0,
    0,
    0,
    0
  ],
  [
    0,
    alpha_7,
    0,
    0,
    0,
    0
  ],
  [
    (-6*alpha_7 - 3)*t,
    0,
    -alpha_7 - 1,
    0,
    0,
    0
  ],
  [
    (-4*alpha_7 - 16)*t,
    (-4*alpha_7 - 16)*t,
    0,
    alpha_7,
    0,
    0
  ],
  [
    (35*alpha_7 + 70)*t^2,
    (-10*alpha_7 - 5)*t,
    (-5*alpha_7 + 15)*t,
    0,
    -alpha_7 - 1,
    0
  ],
  [
    (-42*alpha_7 + 126)*t^2,
    (-42*alpha_7 + 63)*t^2,
    (-6*alpha_7 + 18)*t,
    (-12*alpha_7 - 6)*t,
    0,
    -alpha_7 - 1
  ]
]
);

// Section ASSERTIONS //////////////////////////////////////////////////////////

assert (Evaluate(f_7,x_1) - Evaluate(g_7,x_2)) eq A_7*B_7 ;
sigmaM_6 := Matrix(6,6,[sigma(M_6[i][j]): i, j in [1..6]]);
assert M_6*sigmaM_6 eq 2*IdentityMatrix(k,6);

// End of File degree-7.m //////////////////////////////////////////////////////
