# Two-Selmer Set of a Curve

Let $C: y^2=f(x)$ be a hyperelliptic curve of genus $g$ over a number field $k$. We say $\pi_\delta: D_\delta\rightarrow C$ is a *two-cover* of $C$ if, over an algebraic closure, $\pi_\delta$ is isomorphic as a cover to the pull-back of an embedding of $C$ into its Jacobian along multiplication by $2$. The two-Selmer set classifies the $k$-isomorphism classes of two-covers of $C$ that have points everywhere locally.

The hyperelliptic involution acts on such covers by pull-back: $\iota^*(\pi_\delta)=\pi_\delta\circ\iota$ (apply $\iota$ after $\pi_\delta$). The *fake* two-Selmer set is the set

$$
\{\delta: D_\delta(k_v)\neq \emptyset \text{ for all places }v\text{ of }k\}/\iota^*
$$

If this set is empty, then $C$ has no $k$-rational points. This can happen even if $C$ itself does have points everywhere locally. If the set is non-empty, it gives information about rational points on $C$. See [[Bruin and Stoll, 2009](../../references.md#cite-brusto-twocovdesc)] for the underlying theory as well as a description of an algorithm to compute the set.

## `TwoCoverDescent(C): CrvHyp -> SetEnum, Map, [Map, SeqEnum]`

```magma
Bound      : RngIntElt                    Default: -1
Fields     : SetEnum                      Default: {}
Raw        : BoolElt                      Default: false
PrimeBound : RngIntElt                    Default: 0
PrimeCutoff: RngIntElt                    Default: 0
```

Computes the fake $2$-Selmer set as an abstract set. The map returned as second value can be used to obtain a representation of these abstract elements as elements in an algebra, which allows explicit construction of the corresponding cover.

The optional parameters `Bound`, `Fields` and `Raw` perform the same function as for [`TwoSelmerGroup`](jacobians-number-fields.md#function-twoselmergroup) and we refer to it for their description. The remaining optional parameters are specific to this routine and we describe them here.

`PrimeBound`: Two covers are of very high genus. Hence, according to the Weil bounds, they can have local obstructions at very large good primes. For instance, for genus $2$ one should check all primes up to norm $1153$ and for genus $3$ one should check all primes up to norm $66553$. This is very time consuming. One can use `PrimeBound` to restrict the good primes to be considered to only those whose norm do not exceed the given bound. In principle, this can result in a larger set being returned than the proper two-selmer set.

`PrimeCutoff`: If the curve has bad reduction at some large prime, it can be prohibitively expensive to check the local conditions at this prime. This bound allows a restriction on the norm of bad primes where local conditions are considered. Setting this bound can result in a larger set being returned than the proper two-selmer set.

## `Example: Two-cover descent (ex-4cc57e)`

As an illustration of `TwoCoverDescent`, we give the Magma-code to perform the computations related to the examples in [[Bruin and Stoll, 2009](../../references.md#cite-brusto-twocovdesc)]. First we give some examples of genus $2$ curves that have points everywhere locally, but have an empty $2$-Selmer set and hence have no rational points.

```magma
> Q:=Rationals();
> Qx<x>:=PolynomialRing( Q );
> C:=HyperellipticCurve(2*x^6+x+2);
> Hk,AtoHk:=TwoCoverDescent(C);
> #Hk;
0
> C:=HyperellipticCurve(-x^6+2*x^5+3*x^4-x^3+x^2+x-3);
> Hk,AtoHk:=TwoCoverDescent(C);
> #Hk;
0

```

In the following we consider a curve of genus $2$ that does have rational points. In fact, its Jacobian has Mordell–Weil rank $2$. We compute its two-covers with points everywhere locally. There are two. They both cover an elliptic curve over a quadratic extension. We use `Chabauty` following [[Bruin, 2002](../../references.md#cite-bruin-phdthesis)] to determine the rational points on $C$. First we check that we can represent the fake two-Selmer set of the curve with some nice elements.

```magma
> f:=2*x^6+x^4+3*x^2-2;
> C:=HyperellipticCurve(f);
> Hk,AtoHk:=TwoCoverDescent(C:PrimeBound:=30);
> A<theta>:=Domain(AtoHk);
> deltas:={-1-theta,1-theta};
> {AtoHk(d): d in deltas} eq Hk;
true

```

Next, we determine a factorisation of $f$ into a quartic and a quadratic polynomial.

```magma
> L<alpha>:=NumberField(x^2+x+2);
> LX<X>:=PolynomialRing(L);
> g:=(X^2-1/2)*(X^2-alpha);
> h:=2*(X^2+alpha+1);
> g*h eq Evaluate(f,X);
true

```

For some $\gamma=\gamma(\delta)$, we have that a $2$-cover $D_\delta$ covers the elliptic curve

$$
E:y^2=\gamma\, g(x).
$$

This allows us to translate the question about rational points on $D_\delta$ into a question about L-rational points on E with the additional property that x is rational. We verify that the two values of $\delta$ we found above, correspond to $\gamma=(1-\alpha)/2$.

```magma
> LTHETA<THETA>:=quo<LX|g>;
> j:=hom<A->LTHETA|THETA>;
> gamma:=1/2*(-alpha + 1);
> {Norm(j(delta)):delta in deltas} eq {gamma};
true
> E:=HyperellipticCurve( gamma * g );
> P1:=ProjectiveSpace(Rationals(),1);
> EtoP1:=map<E->P1|[E.1,E.3]>;

```

We present $E$ explicitly as an elliptic curve to Magma

```magma
> P0:=E![1,(1-alpha)/2];
> Eprime,EtoEprime:=EllipticCurve(E,P0);
> Etilde:=EllipticCurve(X^3+(1-alpha)*X^2+(2-9*alpha)*X+(16-2*alpha));
> EprimeToEtilde:=Isomorphism(Eprime,Etilde);
> EtoEtilde:=EtoEprime*EprimeToEtilde;
> EtildeToP1:=Expand(Inverse(EtoEtilde)*EtoP1);

```

We determine a group of finite odd index in $E(L)$.

```magma
> success,MWgrp,MWmap:=PseudoMordellWeilGroup(Etilde);
> success;
true
> MWgrp;
Abelian Group isomorphic to Z/2 + Z
Defined on 2 generators
Relations:
    2*MWgrp.1 = 0

```

We determine the set of $L$-rational points on $E$ that have a ${\mathbb{Q}}$-rational image under `EtildeToP1`.

```magma
> V,R:=Chabauty(MWmap,EtildeToP1:IndexBound:=2);
> V;
{
    0,
    MWgrp.1 - MWgrp.2,
    MWgrp.1,
    -MWgrp.2
}
> R;
4

```

Since we found earlier that in this case, there is only one value of $\gamma$ to consider, we know that any rational point on $C$ must correspond to one of these points on $E$. The correspondence is given by the fact that $E$ and $C$ both cover the $x$-line. We determine these points explicitly.

```magma
> CtoP1 := map< C -> P1 | [C.1,C.3] >;
> pi := Extend( EtildeToP1 );
> { pi( MWmap( v ) ) : v in V };
{ (1 : 1), (-1 : 1) }
> [ RationalPoints( p@@CtoP1 ): p in { P1(Q)| pi( MWmap( v ) ) : v in V } ];
[
    {@ (1 : -2 : 1), (1 : 2 : 1) @},
    {@ (-1 : -2 : 1), (-1 : 2 : 1) @}
]

```
