# K3 Surfaces

This section describes intrinsics that construct K3 surfaces. It also describes a few intrinsics that can be used to study them, but see Section [Generic Polarised Varieties](pol-var.md#sec-generic) for the general intrinsics that apply to all polarised varieties.

The calculations are based on Altinok’s Riemann–Roch formula [[Altınok, 1998](../../references.md#cite-altinok)] for polarised K3 surfaces with Du Val singularities.

## Creating and Comparing K3 Surfaces

The basic RR data from which a K3 surface can be created comprises an integer, the *genus*, $g \ge -1$ and a basket of (Gorenstein surface) point singularities $B$. The basket $B$ can be created explicitly as a basket using the functions of Section , but a convenient shortcut is provided whereby the basket argument may be given ‘in raw basket format’, that is, as a sequence $B$ of length two sequences, each of the form $[r,a]$, denoting the singularity ${{1}\over{r}}(a,r-a)$.

### `K3Surface(g, B): RngIntElt, GRBskt -> GRK3`

### `K3Surface(g, B): RngIntElt, SeqEnum -> GRK3`

A K3 surface with genus $g$ and basket of singularities $B$ (which may be a basket type or in raw basket format $[[r,a],...]$).

### `K3Copy(X): GRK3 -> GRK3`

A new K3 surface that carries exactly the same data as the K3 surface $X$.

## Accessing the Key Data

### `Genus(X): GRK3 -> RngIntElt`

The genus of the K3 surface $X$; that is, $p_1-1$ where $p_1$ is the coefficient of $t$ in the Hilbert series of $X$.

### `TwoGenus(X): GRK3 -> RngIntElt`

The $2$-genus of the K3 surface $X$; that is, $p_2-1$ where $p_2$ is the coefficient of $t^2$ in the Hilbert series of $X$.

### `SingularRank(X): GRK3 -> RngIntElt`

The sum $\sum (r-1)$ taken over the singularities ${{1}\over{r}}(a,r-a)$ given in the basket of singularities of the K3 surface $X$.

### `AFRNumber(X): GRK3 -> RngIntElt`

The number assigned to the K3 surface $X$ in the low codimension lists of Altinok–Fletcher–Reid.

## Modifying K3 Surfaces

Sometimes it is desirable to add or remove weights from a given K3 surface. There are two intrinsics that allow this to be done (and check that a weight really can be removed). These intrinsics are used systematically in the construction of the K3 database.

### `IncludeWeight(X, w): GRK3, RngIntElt -> GRK3`

Return a new K3 surface that is the same as $X$ but with the positive integer $w$ included among the weights and all other data associated to the embedding adjusted as required.

### `RemoveWeight(X, w): GRK3, RngIntElt -> GRK3`

Return a new K3 surface that is the same as $X$ but with the positive integer $w$ removed from the weights, assuming it appears there and can be removed without destroying the property of the Hilbert numerator being a polynomial. All other data associated to the embedding is adjusted as required.
