//This document contains the Magma code used for the construction of models of log K3 surfaces of dP5 type in the Ph.D. thesis "Arithmetic of affine del Pezzo surfaces" by Julian Lyczak.
//It can be used to construct other examples as well, but it currently contains the information to output the main examples in the aforementioned thesis, namely those in Section 4.9.2 and 4.9.3. The input for the second family of examples is currently active, the data for the first is in comments.
//====================================================================
//==========================Introduction==============================
//====================================================================
//First we construct a cyclic quintic extension 'K' of the rationals. It would also work over any other base field, but abelian extensions of Q are very well-understood, easy to work with and speed up the computations significantly.
//Next we construct the surface 'DP5' in 'P5' (projective space over the rationals) using an integral generator 'alpha' of K=Q(alpha). This construction also works or alpha not integral, but again it simplifies the construction.
//Then we compute the two hyperplane sections given by 'l1' and 'l2' which consist of 5 conjugate lines on DP5 each.
//After that we check if the equations over Q actually define the model over Z we are interested in. This is usually the case, but technically it could fail for other examples. This could be resolved by some computationally heavy Groebner bases.
//Here we have an additional section to translate the equations of DP5, l1 and l2 to obtain 'DP5shifted', 'l1shifted' and 'l2shifted' in case we want to change our coordinates of DP5 over Z. This section was used for the examples in Section 4.9.2, but not those in Section 4.9.3.
//Finally we print some arithmetical data of this model, the surface DP5 and the affine scheme given by the complement of any geometrically irreducible hyperplane section h=0.
//=====================The splitting field============================
//Let us first determine the splitting field K using the conductor n and a subgroup N of Gal(Qcyc/Q)
//Choose the set of ramified primes. Only include primes 1 mod 5 and possibly the prime 5
//For the examples in Section 4.9.2
//primesofconductor := {11};
//For the examples in Section 4.9.3
primesofconductor := {5};
numberofprimes := #primesofconductor;
&and[(p eq 5 or p mod 5 eq 1) and IsPrime(p): p in primesofconductor];
//Define the conductor and the field K as a subfield of Q(zeta_n). Note that this can be slow if n is composite or big.
n := &*{p eq 5 select p^2 else p :p in primesofconductor};
Qzn := CyclotomicField(n);
subfields := Subfields(Qzn,5);
//If we chose a conducter with multiple prime divisors then there will be several subfields of degree 5 over the rationals.
K := subfields[1,1];
O := MaximalOrder(K);
disc := Discriminant(K);
Qs~~ := PolynomialRing(Rationals());
Ks := PolynomialRing(K);
//Pick an alpha and compute the minimal polynomials of alpha and alpha^2
alpha := a;
IsIntegral(alpha);
Qzn!alpha;
malpha := MinimalPolynomial(alpha);
rts := [r[1]: r in Roots(malpha,K)];
malpha2 := Qs!(&*[sK - r^2 : r in rts]);
//=====================Equations for the surface======================
//We compute the ideal defining (alpha^2, alpha, 1) and its conjugates
R := PolynomialRing(Rationals(),3,"glex");
I := Ideal([x^2-y*z,R!(z^5*Evaluate(malpha,x/z)),R!(z^5*Evaluate(malpha2,y/z))]);
//Next we compute a Groebner basis for polynomial vanishing of order at least 2 at all 5 points.
GBasis := GroebnerBasis(Generators(Saturation(I^2)),5);
Deg5Basis := [];
for gen in GBasis do
deg := Degree(gen);
if deg le 5 then
for gen2 in MonomialsOfDegree(R,5-deg) do
Append(~Deg5Basis,gen*gen2);
end for;
end if;
//print Deg5Basis;
end for;
//We use these quintics to compute a rational map of P2 into P5
P := ProjectiveSpace(Rationals(),2);
P5 := ProjectiveSpace(Rationals(),5);
LinSys := LinearSystem(P, Deg5Basis);
phi := map< P -> P5 | Sections(LinSys) >;
DP5 := Image(phi);
correctequations := &and[&and[IsCoercible(Integers(),coef): coef in Coefficients(equ)] and (LeadingCoefficient(equ)^2 eq 1): equ in GroebnerBasis(DP5)];
//If this return true, then the equations for DP5 over Q are integral and also define the closure of DP5 over Z.
//It seems a byproduct of the implicit choice of monomial ordering and Magma's inner workings that if alpha is integral, then the equations automatically defines X over the integers.
//In any case, one can use the function reduction to compute the equations of the closure of DP5 over Qp to Fp. If the above function returns true, then we can simply reduce the current equations for DP5 modulo p.
//=========================Finding the lines==================================
_ := PolynomialRing(K,3);
linesP2 := Scheme(P,&*[Determinant(Matrix([[rts[i]^2,rts[i],1],[rts[(i mod 5)+1]^2,rts[(i mod 5)+1],1],[r1,r2,r3]])): i in [1..5]]*&*[Determinant(Matrix([[rts[i]^2,rts[i],1],[rts[((i+1) mod 5)+1]^2,rts[((i+1) mod 5)+1],1],[r1,r2,r3]])): i in [1..5]]);
irrcomps := IrreducibleComponents(linesP2);
lines1P2 := irrcomps[1];
lines2P2 := irrcomps[2];
lines1P5 := phi(lines1P2);
lines2P5 := phi(lines2P2);
ics := IrreducibleComponents(linesP5);
l1 := [equ: equ in Equations(lines1P5)| Degree(equ) eq 1][1];
l2 := [equ: equ in Equations(lines2P5)| Degree(equ) eq 1][1];
//=====================The arithmetic of the affine surface============================
//This section assumes that the equations of DP5 over Q are integral and actually define the closure of DP5 over Z, i.e. the boolean 'correctequations' is true.
//Local solubility only has to be checked for l=2, and for l=3, 5 if l splits completely in K and the reduction of DP5 modulo l is singular, i.e. malpha has a double root modulo l.
badprimesforlocalsolubility := {2} join {p: p in [3,5]| disc mod p eq 0 and IsSplit(p,O)};
//We now compute the primes for which the fibres are singular.
badprimessingularfibres := primesofconductor;
discalpha := Integers()!Discriminant(malpha);
discalpharemainingfactors := discalpha;
for p in primesofconductor do
_,discalpharemainingfactors := Valuation(discalpharemainingfactors,p);
end for;
badprimessingularfibres := badprimessingularfibres join {factor[1]: factor in Factorisation(discalpharemainingfactors)};
badprimesinvariantmapsnotconstant := primesofconductor join {p: p in badprimessingularfibres| IsInert(p,O)};
//For such primes p (in particular those that ramify in K) we have that DP5_p admits a birational morphism to the projective plane over F_p.
p := badprimesinvariantmapsnotconstant[1];
DP5modp := Reduction(DP5,p);
divl1modp := Divisor(DP5modp,Scheme(DP5modp,l1));
E4modp := Divisor(DP5modp,Scheme(DP5modp,PrimeFactorisation(divl1modp)[1,1]));
P2modp := ProjectiveSpace(GF(p),2);
rho := map P2modp | RiemannRochBasis(3*E4modp)>;
if IsInvertible(rho) then rhoinv := Inverse(rho); end if;
//===========Change the equation as to make h=u_0 give an obstruction===========
function extendbasis(vec)
n := #vec;
eerstekolom := 0;
for i in [1..n] do
if vec[i] ne 0 then eerstekolom := i; break i; end if;
end for;
SwapElements(~vec,1,eerstekolom);
d := [vec[1]];
t := [];
s := [];
for i in [2..n] do
d[i], t[i-1], s[i-1] := XGCD(d[i-1],vec[i]);
end for;
mat := [[]];
mat[1] := vec;
for i in [2..n] do
tempvec := [0: k in [1..n]];
for j in [1..i-1] do
tempvec[j] := -vec[j]*s[i-1]/d[i-1];
end for;
tempvec[i] := t[i-1];
mat[i] := tempvec;
end for;
mat := Matrix(mat);
SwapColumns(~mat, 1, eerstekolom);
return mat;
end function;
//Make sure that the coefficients of h are coprime.
//For the examples in Section 4.9.2, to make h=u0 give an obstruction
//h := u1 + 4*u3;
//For the examples in Section 4.9.3, we used the equations as they came out of the algorithm
h := u0;
vec := [Integers()!Coefficient(h,v,1): v in [u0,u1,u2,u3,u4,u5]];
mat := extendbasis(vec);
shift := Automorphism(P5,Transpose(mat));
DP5shifted := shift(DP5);
l1shifted := shift(l1);
l2shifted := shift(l2);
//=====================Printing the surface============================
if correctequations then
print " ";
print " ";
print "The minimal polynomial used to define alpha is ", malpha;
print " ";
print "The surface is defined over the integers by", DefiningEquations(DP5);
print "The two geometrically reducible anticanonical sections are defined by", l1, " and ", l2;
print "The fibre of X/Z over a prime l is singular for l in ", badprimessingularfibres;
print " ";
print "The affine surface U/Z is defined as the complement of the geometrically integral zero locus of a linear form h on X/Z. We consider the evaluation map of a cyclic algebra defined using l1/h and a generator of K/Q. The following statements are true for all h.";
print " ";
print "The surface U/Z is locally soluble at all primes, except possiblty for a prime l in ", badprimesforlocalsolubility;
print "The invariant map U(Z_p) -> 1/5Z / Z is identically zero at all primes, except possibly for a prime p in ", badprimesinvariantmapsnotconstant;
else
print " ";
print " ";
print "The minimal polynomial used to define alpha is ", malpha;
print " ";
print "The surface is defined over the rationals by", DefiningEquations(DP5);
print "These equations may define additional irreducible components over the integers.";
print "This might imply that the computed equations l1 and l2, and the set of different types of badprimes are not complete or even correct.";
end if;
~~