-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathrational-points.m
350 lines (294 loc) · 9.99 KB
/
rational-points.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
intrinsic RationalPointsNaive(X::CrvHyp) -> Any
{Input:
X - a hyperelliptic curve
Ouput:
Set - A set of (possibly empty) rational points on the curve X
true or false - Whether the set above is provably all of X(Q)
note - The method that was used to prove the points are X(Q). "Inconclusive"
means the second value is false
This function attempts to compute the set of rational points on the curve by
various methods.}
C,cm:=SimplifiedModel(X);
pointsearch := Set(Setseq(Points(C : Bound:=30000)));
if pointsearch eq {} then
f,_ := HyperellipticPolynomials(C);
if HasPointsEverywhereLocally(f,2) eq false then
shimpoints:={};
shimproven:=true;
shimnotes:="Does Not Have Points Everywhere Locally";
return shimpoints, shimproven, shimnotes;
else
Hk,_ := TwoCoverDescent(C);
if #Hk eq 0 then
shimpoints:={};
shimproven:=true;
shimnotes:="Used Two Cover Descent";
return shimpoints, shimproven, shimnotes;
end if;
end if;
end if;
if Genus(C) eq 2 then
JacC := Jacobian(C);
l,u := RankBounds(JacC);
assert l ge 0 and u ge l;
if u eq 0 then
pointsC:= Set(Setseq(Chabauty0(JacC)));
pointsX:= Set([ Inverse(cm)(P) : P in Setseq(pointsC) ]);
shimpoints:=pointsX;
shimproven:=true;
shimnotes:="Used Magma's Chabauty0()";
return shimpoints, shimproven, shimnotes;
else
shimpoints, shimproven, shimnotes := PullbackPointsFromQuotient(C);
if shimproven eq true then
return shimpoints, shimproven, shimnotes;
else
shimpoints:=Set([ Inverse(cm)(P) : P in Setseq(pointsearch) ]);
shimproven:=false;
shimnotes:="inconclusive";
return shimpoints, shimproven, shimnotes;
end if;
end if;
else
shimpoints, shimproven, shimnotes := PullbackPointsFromQuotient(C);
if shimproven eq true then
shimpoints:=Set([ Inverse(cm)(P) : P in Setseq(pointsearch) ]);
return shimpoints, shimproven, shimnotes;
else
pointsX:= Set([ Inverse(cm)(P) : P in Setseq(pointsearch) ]);
shimpoints:=pointsX;
shimproven:=false;
shimnotes:="inconclusive";
return shimpoints, shimproven, shimnotes;
end if;
end if;
end intrinsic;
intrinsic PullbackPointsWithEquation(proj::MapSch, quotient_points::List) -> SetEnum
{Input:
proj - defining equations for the map X->X/<W>
quotient_points - a list of points on the curve X/<W>
Ouput:
The pullpack of the points quotient_points along proj as a list.}
list:=[* *];
for P in quotient_points do
XPScheme:=Difference(Pullback(proj,Codomain(proj)!Eltseq(P)), BaseScheme(proj));
Pbar,Kinit:=PointsOverSplittingField(XPScheme);
assert #Pbar in {0,2,4};
if #Pbar in {2,4} then
if #Pbar eq 4 then
assert 0 eq 1;
else
assert Dimension(XPScheme) eq 0;
K:=NumberField(AbsolutePolynomial(Kinit));
D:=Domain(proj);
C:=Codomain(proj);
DK:=ChangeRing(D,K);
CK:=ChangeRing(C,K);
eqns:=DefiningEquations(proj);
RK:=Parent(ChangeRing(eqns[1],K));
eqnsK:=[];
for ff in eqns do
ffK:=ChangeRing(ff,RK);
Append(~eqnsK,ffK);
end for;
projK:=map< DK -> CK | eqnsK >;
PKinit:=[ K!a : a in Eltseq(P) ];
XPKScheme:=Difference(Pullback((projK),CK!PKinit), BaseScheme(projK));
Kpoints:=RationalPoints(XPKScheme);
for PK in Setseq(Kpoints) do
Append(~list,PK);
end for;
end if;
else
assert Dimension(XPScheme) eq -1;
PPproj:=ProjectiveClosure(proj);
PPD:=Domain(PPproj);
PPC:=Codomain(PPproj);
XPScheme:=Difference(Pullback(PPproj,PPC!P), BaseScheme(PPproj));
Pbar,Kinit:=PointsOverSplittingField(XPScheme);
assert Pbar eq {XPScheme![0,1,0,0]};
end if;
end for;
return list;
end intrinsic;
intrinsic PullbackPointsFromQuotient(X::CrvHyp) -> Any
{Input:
X - a hyperelliptic curve
Output:
Set - A set of (possibly empty) rational points on the curve X
true or false - Whether the set above is provably all of X(Q)
note - The method that was used to prove the points are X(Q). "Inconclusive"
means the second value is false
The intrinsic computes all quotients X/W of the curve X where W is a group of
automorphisms, if one of the quotients has a finite set of points one can pull
these back to obtain X(Q).}
if Genus(X) lt 2 then
return {}, false, "inconclusive";
end if;
C,cm:=SimplifiedModel(X);
A := Automorphisms(C);
for i in [1..#A] do
G := AutomorphismGroup(C,[A[i]]);
Q,m := CurveQuotient(G);
if Genus(Q) ne 0 and not(IsIsomorphic(Q,C)) then
if Type(Q) eq CrvEll then
if MordellWeilRank(Q) eq 0 then
T,t:=TorsionSubgroup(Q);
ECpts := [ t(x) : x in Set(T) ];
RC := &cat[ Setseq(RationalPoints(Difference(Pullback((m),P), BaseScheme(m)))) : P in ECpts ];
RX := Set([ Inverse(cm)(p) : p in RC ]);
shimpoints:=RX;
shimproven:=true;
shimnotes:="pullback from quotient";
return shimpoints, shimproven, shimnotes;
end if;
else
pts, proven:=RationalPointsAnyGenus(Q);
if proven and Type(pts) eq SetEnum then
RC := &cat[ Setseq(RationalPoints(Difference(Pullback((m),P), BaseScheme(m)))) : P in Setseq(pts) ];
RX := Set([ Inverse(cm)(p) : p in RC ]);
shimpoints:=RX;
shimproven:=true;
shimnotes:="pullback from quotient";
return shimpoints, shimproven, shimnotes;
end if;
end if;
end if;
end for;
shimpoints:={};
shimproven:=false;
shimnotes:="inconclusive";
return shimpoints, shimproven, shimnotes;
end intrinsic;
intrinsic RationalPointsGenus0(C::CrvCon) -> Any
{For a Genus 0 curve, return whether it has a rational point,
also if it is proven and any notes}
shimpoints:=HasRationalPoint(C);
shimproven:=true;
shimnotes:="NA";
return shimpoints, shimproven, shimnotes;
end intrinsic;
intrinsic RationalPointsGenus1(X::Crv) -> Any
{For a genus 1 curve, if it has finitely many rational points then return the
set of points, otherwise the mordell-weil group will be returned as a string}
XG1:=GenusOneModel(X);
MinXG1, psi1:=Minimise(XG1);
XG1_reduced, psi2:=Reduce(MinXG1);
X_reduced:=Curve(XG1_reduced);
locally_sol:=IsLocallySolvable(XG1);
if locally_sol eq true then
pointsearch:=Set(Setseq(Points(X_reduced : Bound:=10000)));
if pointsearch eq {} then
shimpoints:=pointsearch;
shimproven:=false;
shimnotes:="Is Locally Solvable";
else
JacX:=Jacobian(X);
rank:=MordellWeilRank(JacX);
pointsX:=[];
d:=100000;
while #pointsX eq 0 do
d:=d+100000;
pointsX := pointsX cat Setseq(Set(Points(X : Bound:=d)));
end while;
pt:=pointsX[1];
E,em:=EllipticCurve(X,pt);
T,t:=TorsionSubgroup(E);
if rank eq 0 then
pts := [ (t(x)) : x in Set(T) ];
ptsX:=Set(&cat[ Setseq(RationalPoints(Difference(Pullback(em,P), BaseScheme(em)))) : P in pts ]);
assert #ptsX eq #Set(T);
shimpoints:=ptsX;
shimproven:=true;
shimnotes:="pullback of torsion";
else
shimpoints:="has infinitely many points";
shimproven:=true;
shimnotes:= Sprintf("DirectProduct(FPGroup(FreeAbelianGroup(%o)), FPGroup(Group(%o)))", rank, Sprint(GroupName(T)) );
end if;
end if;
else
shimpoints:={};
shimproven:=true;
shimnotes:="Not Locally Solvable";
end if;
return shimpoints, shimproven, shimnotes;
end intrinsic;
intrinsic RationalPointsAnyGenus(X::.) -> Any
{return the points, where they're proved correct and any extra info}
if Genus(X) eq 0 then
return RationalPointsGenus0(X);
elif Genus(X) eq 1 then
return RationalPointsGenus1(X);
else
return RationalPointsNaive(X);
end if;
end intrinsic;
intrinsic HasAdelicPointsAnyGenus(X::.) -> Any
{Return if a curve has points everywhere locally.}
if Genus(X) eq 0 then
if HasRationalPoint(X) then
return true;
else
return false;
end if;
elif Genus(X) eq 1 then
assert Type(X) eq Crv;
assert IsNonsingular(X);
XG1:=GenusOneModel(X);
locally_sol:=IsLocallySolvable(XG1);
return locally_sol;
else
assert Type(X) eq CrvHyp;
C,cm:=SimplifiedModel(X);
f,_ := HyperellipticPolynomials(C);
return HasPointsEverywhereLocally(f,2);
end if;
end intrinsic;
intrinsic ChangeRingMap(map::MapSch,K::.) -> MapSch
{Change the base ring of a map of schemes to K}
D:=Domain(map);
DK:=ChangeRing(D,K);
C:=Codomain(map);
CK:=ChangeRing(C,K);
eqns:= DefiningEquations(map);
eqnsK:=[];
for f in eqns do
Append(~eqnsK,ChangeRing(f,K));
end for;
return map< DK -> CK | eqnsK >;
end intrinsic;
intrinsic CoercePointAnyField(X::.,P::SeqEnum) -> Pt
{Given a point P on the curve over an extension, coerce the
point onto the curve over that extension}
XK:=ChangeRing(X,Parent(P[1]));
return XK!P;
end intrinsic;
intrinsic MapPointAnyField(map::MapSch,P::Pt) -> Pt
{Given a point in the codomain of the map over some extension field, apply the
map to this point. Change parent of point to be rationals if possible}
K:=Parent(Eltseq(P)[1]);
P1:=Domain(ChangeRingMap(map,K))!Eltseq(P);
new_pt:=ChangeRingMap(map,K)(P1);
F:=sub< K | Eltseq(new_pt) >;
CF:=ChangeRing(Codomain(map),F);
FP:=CF!([F!a : a in Eltseq(new_pt)]);
return FP;
end intrinsic;
intrinsic IsHyperellipticAtkinLehner(D::RngIntElt,N::RngIntElt,W::SeqEnum) -> BoolElt
{Check whether Atkin-Lehner is the hyperelliptic one}
list:=GYData(D,N);
if [1,list[5]] eq W then
return true;
else
return false;
end if;
end intrinsic;
intrinsic HyperellipticAtkinLehner(D::RngIntElt, N::RngIntElt) -> SeqEnum
{For discriminant D and level N return the Atkin-Lehner which is the hyperelliptic involution}
for W in AllAtkinLehners(D,N) do
if IsHyperellipticAtkinLehner(D,N,W) then
return W;
end if;
end for;
end intrinsic;