# Arithmetic Properties of Schemes and Points

This section contains several functions of arithmetic interest, that apply to general schemes defined over the rationals, number fields, or function fields.

## Height

### `HeightOnAmbient(P): Pt -> RngElt`

```magma
Absolute : BoolElt                      Default: false
Precision: RngIntElt                    Default: 30
```

The height of the given point, as a point in the ambient projective space (or affine space). This is the *exponential* height (for the logarithmic height, take `Log`!). By default it is the *relative* height, unless the optional parameter `Absolute` is given. The function works when the ambient space (of the scheme containing $P$) is any affine or projective space (possibly weighted), and the ring of definition of $P$ is contained in the rationals or a number field.

## Restriction of Scalars

### `RestrictionOfScalars(S, F): Sch, Fld -> Sch, MapSch, UserProgram, Map`

### `WeilRestriction(S, F): Sch, Fld -> Sch, MapSch, UserProgram, Map`

```magma
SubfieldMap   : Map                           Default: 
ExtensionBasis: [ FldElt ]                    Default: []
```

Given an affine scheme $S$ whose base ring is a field $K$, the function returns its restriction of scalars from $K$ to $F$. The scheme $S$ must be contained in an affine space. The field $F$ should be either a subfield of $K$, or else isomorphic to a subfield of $K$; in this case the inclusion map may be specified as the optional argument `SubfieldMap`, or otherwise is the same as the map returned by `IsSubfield(F,K)`.

The restriction of scalars $S_{res}$ is a scheme over $F$ satisfying the following functorial property (for point sets): $S_{res}(R) = S(R \otimes_F K)$ for all rings $R \supseteq F$.

Four objects are returned; the first is the scheme $S_{res}$, and the other three are maps of various kinds:

- the natural map of schemes from the base extension $(S_{res})_{\otimes K}$ to $S$,

- a function which takes a point in a point set $S_{res}(R)$ and computes its image under the map $S_{res}(R) \to S(RK)$ (if there is no known relationship between $R$ and $K$ an error results), and

- a map of point sets $S(K) \to S_{res}(F)$.

The result is obtained by direct substitution using the standard basis of $K/F$, or the basis given in ExtensionBasis if this is specified.

## Local Solubility

Let $X$ be a scheme over a number field $K$. One of the fundamental problems in arithmetic geometry is to decide if $X(K)$ is empty. In general, this is a very hard question. One way to arrive at an affirmative answer is to prove that $X(L)$ is empty for some larger field $L$. An important class of such field is formed by *complete local fields*. These are obtained by taking the $p$-adic topology on $K$ associated to a prime ideal $p$ of the ring of integers of $K$ and to consider the topological completion $L$ of $K$ (see [`Completion`](../../GlobalFields/NumberFieldsAndOrders/operation.md#function-rngord-completion1)). There is also a version for $K$ a $1$-dimensional function field, which checks whether there are points defined over the completion of $K$ at a specified place.

### `IsEmpty(Xm): SetPt -> BoolElt, Pt`

```magma
Smooth           : BoolElt                    Default: false
AssumeIrreducible: BoolElt                    Default: false
AssumeNonsingular: BoolElt                    Default: false
verbose          : LocSol                     Default: Verbose : 2
```

Let $X$ be a scheme over a number field $K$ and let $L$ be a completion of $K$ at a finite prime. If $X\!m$ is the point set of $X$ taking values in $L$, this function returns if the point set is empty. If `false` is returned, then (a minimal approximation to) a point is returned.

Setting `AssumeIrreducible := true` tells the system to assume that $X$ is irreducible. This leads to unpredictable results if the components of $X$ have distinct dimensions.

Setting `AssumeNonsingular := true` tells the system to assume that $X$ has no $L$-rational singular points. If there are such points and this flag is set, then an infinite loop can result.

Setting `Smooth := true` tells the system to only consider nonsingular points on $X$. This is only implemented for plane curves. The system will blow up any $L$-rational singular points when encountered and test the desingularized model for solubility. If a point is found, then an approximation may be returned that is indistinguishable from a singular point.

The following classes of schemes are recognized and treated separately :

**(i)**
Hyperelliptic curves over fields with large residue field of odd characteristic. For these fields a generalization by Nils Bruin of an algorithm presented in [[Merriman *et al.*, 1996](../../references.md#cite-merriss)] is used. The complexity of this algorithm is independent of the size of the residue field.

**(ii)**
Hyperelliptic curves over fields with small residue field or residue field of even characteristic. For these fields a depth-first backtracking algorithm is used to construct a solution.

**(iii)**
Nonsingular curves represented by a possibly singular planar model. In this case, a depth-first backtracking algorithm is used to construct a solution. Whenever a tentative solution approximates a rational singularity, that singularity is blown up and the construction is continued on the desingularized model with Hensel’s lemma as a stopping criterion. Use `Smooth := true` to access this option.

**(iv)**
An intersection in ${\bf P}^3$ of a quadratic cone with a singularity at $(0:0:0:1)$ and another quadric. This case (often needed in computations concerning elliptic curves) is handled by testing hyperelliptic curves for local solubility.

**(v)**
General schemes. The system decomposes $X$ into primary components over $K$, which are equidimensional. For each of the components, it tests the singular subscheme for solubility. If a solution is found, this is returned. Otherwise, it tests the scheme itself for solubility using a depth-first backtracking algorithm with Hensel’s lemma as stopping criterion.

Note that to construct a point set over a completion of a number field, one should use `PointSet(X,phi)` where `Kp, phi := Completion(K,p)`. This rather cryptic syntax is due to the fact that, although a completion strictly speaking is an *extension* of $K$, Magma does not recognise this fact and therefore does not allow for automatic coercion into $K_p$. The system has to be presented explicitly with the map $\phi$ from $K$ into $K_p$.

For a description of the algorithms used, see [[Bruin, n.d.](../../references.md#cite-bruin-magmabook)].

### `Example: anf1 (ex-5c78a9)`

Some usage of `IsEmpty` is illustrated below.

```magma
> P2<X,Y,Z> := ProjectiveSpace(Rationals(),2);
> C := Curve(P2,X^2+Y^2);
> IsEmpty(C(pAdicField(2,20)));
false (O(2^2) : O(2^2) : 1 + O(2^20))
> IsEmpty(C(pAdicField(2,20)):Smooth);
true
> K<i> := NumberField(PolynomialRing(Rationals())![1,0,1]);
> CK := BaseChange(C,K);
> p := (1+i)*IntegerRing(K);
> Kp,toKp := Completion(K,p);
> CKp := PointSet(CK,toKp);
> IsEmpty(CKp:Smooth);
false (O(Kp.1^3) : O(Kp.1^3) : 1 + O(Kp.1^100))

```

### `Example: anf2 (ex-aa0142)`

And a simpler example.

```magma
> p := 32003;
> P<x> := PolynomialRing(Rationals());
> C := HyperellipticCurve(p*(x^10+p*x^3-p^2*4710));
> Qp := pAdicField(p);
> time IsEmpty(C(Qp));
true
Time: 0.090

```

### `IsLocallySolvable(X, p): Sch, RngOrdIdl -> BoolElt, Pt`

### `IsLocallySolvable(X, p): Sch, RngIntElt -> BoolElt, Pt`

```magma
Smooth           : BoolElt                    Default: false
AssumeIrreducible: BoolElt                    Default: false
AssumeNonsingular: BoolElt                    Default: false
```

Given a projective scheme $X$ defined over a number field or over the rationals, test if the scheme is locally solvable at the prime ideal $p$ (for number fields) or prime number $p$ (for rationals) indicated. If the scheme is found to have a local point, then `true` is returned together with an approximation to a point. Otherwise, `false` is returned.

The optional parameters have the same meaning as for `IsEmpty` (see above).

For a description of the algorithms used, see [[Bruin, n.d.](../../references.md#cite-bruin-magmabook)].

### `IsLocallySolvable(X, pl): Sch, PlcFunElt -> BoolElt, Pt`

```magma
completion_map: Any                    Default: 0
```

Given an affine or projective scheme $X$ of dimension at least $1$ and defined over an algebraic function field $K$, and a place $pl$ of $K$, returns whether $X$ contains a point defined over the completion of $K$ at $pl$. If the scheme is found to have such local points, then `true` is returned together with an approximation to a point. Otherwise, `false` is returned.

A current restriction is that $K$ must be a simple extension of a (1-D) rational function field. The completion of $K$ and map $m$ from $K$ to that completion are computed. For speed, if the user has already computed this completion data, the completion map $m$ can be passed in via the parameter `completion_map`. Otherwise the parameter is given the default value $0$.

### `Example: Anf Local Solv (ex-ca0503)`

A locally solvable scheme and a non–locally solvable scheme (when considering only non–singular points) are both shown below.

```magma
> P2<X,Y,Z> := ProjectiveSpace(Rationals(),2);
> C := Curve(P2,X^2+Y^2);
> IsLocallySolvable(C,2);
true (O(2^2) : O(2^2) : 1 + O(2^50))
> IsLocallySolvable(C,2:Smooth);
false
> K<i>:=NumberField(PolynomialRing(Rationals())![1,0,1]);
> CK:=BaseChange(C,K);
> p:=(1+i)*IntegerRing(K);
> IsLocallySolvable(BaseChange(C,K),p:Smooth);
true (O($.1^3) : O($.1^3) : 1 + O($.1^100))

```

### `LiftPoint(P, n): Pt, RngIntElt -> Pt`

### `LiftPoint(F, d, P, n): [RngMPolElt], RngIntElt, [FldLocElt], RngIntElt -> SeqEnum`

```magma
Strict: BoolElt                    Default: true
```

```magma
Strict: BoolElt                    Default: false
```

Let $P$ be in $X(L)$, where $X$ is a scheme over the rationals or over a number field and $L$ is a completion of the base field at a finite prime. This routine attempts to lift $P$ to the desired precision $n$ using quadratic newton iteration. This routine only works if $P$ is distinguishable from all singular points on $X$. Note that if $X$ is of positive dimension, then the lift is inherently arbitrary.

Due to limited precision used in the computation, it may be impossible to attain the desired precision exactly. By default this leads to an error. If the user specifies `Strict := false` the system silently returns a lift with maximum attainable precision if the desired precision cannot be reached.

The second form provides the same functionality, but requires all input data to be supplied over $L$. The sequence $F$ should be the defining equations of a scheme over $L$ of dimension $d$. The sequence $P$ should be coordinates of an approximation of a point on that scheme. The returned sequence is a lift of the point described by $P$ to precision $n$, if possible.

In principle, a point returned by `IsEmpty` has sufficient precision for `LiftPoint` to work. However, `IsEmpty` may perform nontrivial operations on the scheme. A nonsingular point on a component of $X$ may be singular on $X$ itself.

### `Example: Anf Lift (ex-ed4659)`

A lift of a point in a non empty pointset is given.

```magma
> P2<X,Y,Z>:=ProjectiveSpace(Rationals(),2);
> C:=Curve(P2,X^2+Y^2-17*Z^2);
> Qp:=pAdicField(2,20);
> bl,P:=IsEmpty(C(Qp));
> LiftPoint(P,15);
(9961 + O(2^15) : O(2^15) : 1 + O(2^20))

```

## Searching for Points

The following intrinsic implements a nontrivial method to search for points on any scheme defined over the rationals.

### `PointSearch(S, H : parameters): Sch[FldRat], RngIntElt -> SeqEnum`

```magma
Dimension: RngIntElt                    Default: 0
Primes   : SeqEnum                      Default: [ ]
OnlyOne  : BoolElt                      Default: false
```

Searches for points on the scheme $S$ up to roughly height $H$. The scheme must be in either an affine space or a non-weighted projective space.

This uses a $p$-adic algorithm: first find points locally modulo a small prime (or two small primes), then lift these $p$-adically, and then see if these give global solutions. Lattice reduction is used at this stage, and this makes the method far more efficient than a naive search, for most schemes. Note that points which reduce to singular points modulo $p$ are not necessarily found.

If `OnlyOne` is `true`, then the computation will terminate as soon as one point is found. The algorithm computes the dimension of the scheme unless `Dimension` is set to a nonzero value.

The algorithm chooses its own primes unless `Primes` is non-empty; either one prime or two can be specified. The algorithm slows down considerably in higher dimension — for threefolds, it can take a few hours to search for points up to height 500 or so. For special types of curves (ternary cubics, intersection of quadrics), efficient search methods are implemented under other names (for instance `Points` and `PointsQI`).

### `Example: Point Count (ex-a468fc)`

```magma
> P<a,b,c,d> := ProjectiveSpace(Rationals(),3);
> S := Scheme (P, a^2*c^2 - b*d^3 + 2*a^2*b*c + a*b^3 - a*b^2*c +
>                 7*a*c^2*d + 4*a*b*d^2);
> Dimension(S);
2
> time PS := PointSearch(S,100);
Time: 9.050
> #PS; // not necessarily exhaustive
67571

```

## Reduction Mod $p$

### `Reduction(X, p): Sch, Any -> Sch`

```magma
ambient: Sch                    Default: false
```

$X$ should be an ordinary projective scheme defined over a field $K$ which should be the rational field or a number field. If $K$ is the rationals then argument $p$ should be a rational prime and if $K$ is a number field, $p$ should be a place or a prime ideal in an order of $K$.

The intrinsic computes and returns the reduction mod $p$ of the *flat closure* of $X$ in projective space over the local ring of $p$. This reduction is a scheme in projective space of dimension $n$ over the residue class field $k_p$ of $p$ where $n$ is the dimension of the projective ambient of $X$.

It is possible to enter the ambient that the user wishes the result to lie in using the `ambient` parameter. The value entered should be an ordinary projective space of dimension $n$ over $k$, a finite field equal to $k_p$.

Note that the flat closure essentially computes a saturation of the ideal $I$ of $X$ with respect to a local parameter $\pi$ of $p$ and takes the reduction of this mod $p$ to give the result (though usually a full colon ideal computation is unnecessary, and a simple reduction of basis elements is checked to give the correct result via Hilbert polynomials). This reduction is guaranteed to be of the same dimension as $X$ and have the same Hilbert polynomial, but it is not “minimised” in any way. For example, it will not necessarily give the reduction of the minimal model of a curve - even an elliptic curve.

### `Reduction(I, p): RngMPol, Any -> RngMPol`

```magma
parent: RngMPol                    Default: false
```

This is a simple variant on the first intrinsic, included for convenience in case the user prefers working with ideals. $I$ should be a homogeneous ideal in a multivariate polynomial ring over $K$, the rational field or a number field. $p$ is as before. Returns the defining ideal of the reduction mod $p$ of the projective scheme defined by $I$.

More precisely, if $K[x_1,\ldots,x_n]$ is the polynomial ring in which $I$ lies, the result lies in $k_p[x_1,\ldots,x_n]$, where $k_p$ is the residue class field of $p$, and can be defined as the reduction mod $p$ of $I \cap O_p[x_1,\ldots,x_n]$, where $O_p$ is the local ring of $p$.

The user may specify the polynomial ring in which the result is to lie by using the `parent` parameter which should be set to a multivariate polynomial ring in $n$ variables over a finite field $k$ equal to $k_p$.

### `Example: Scheme Red Mod P (ex-cbccd6)`

This easy example is a complete intersection of $2$ quadric equations in ${\bf P}^3$ over the rationals which defines a scheme that decomposes into a union of $4$ lines over the algebraic closure. Simply reducing the two given defining quadrics mod $3$ gives a $2$-dimensional scheme defined by a single equation which is not the reduction of the flat closure. The intrinsic gives the correct result (which isn’t hard to find by inspection in this case).

```magma
> P<x,y,z,t> := ProjectiveSpace(Rationals(),3);
> S := Scheme (P, [3*x^2+3*y^2-z^2-t^2,z^2+t^2]);
> Reduction(S,3);
Scheme over GF(3) defined by
$.1^2 + $.2^2,
$.3^2 + $.4^2

```
