---
title: "K3 Surfaces"
canonical: "https://docs.magma-maths.org/v2.30-1/AlgebraicGeometry/HilbertSeriesOfPolarisedVarieties/k3.html"
source: "https://docs.magma-maths.org/v2.30-1/AlgebraicGeometry/HilbertSeriesOfPolarisedVarieties/k3.md"
part: "Algebraic Geometry"
chapter: "Hilbert Series of Polarised Varieties"
breadcrumbs:
  - {"title": "Magma Handbook", "source": "https://docs.magma-maths.org/v2.30-1/index.md"}
  - {"title": "Algebraic Geometry", "source": "https://docs.magma-maths.org/v2.30-1/AlgebraicGeometry/index-algebraic-geometry.md"}
  - {"title": "Hilbert Series of Polarised Varieties", "source": "https://docs.magma-maths.org/v2.30-1/AlgebraicGeometry/HilbertSeriesOfPolarisedVarieties/index-hilbert-series-of-polarised-varieties.md"}
prev: {"title": "Subcanonical Curves", "source": "https://docs.magma-maths.org/v2.30-1/AlgebraicGeometry/HilbertSeriesOfPolarisedVarieties/subcan.md"}
next: {"title": "Weil Polynomials", "source": "https://docs.magma-maths.org/v2.30-1/AlgebraicGeometry/HilbertSeriesOfPolarisedVarieties/weilpoly.md"}
intrinsics:
  - {"name": "K3Surface", "signature": "K3Surface(g, B): RngIntElt, GRBskt -> GRK3"}
  - {"name": "K3Surface", "signature": "K3Surface(g, B): RngIntElt, SeqEnum -> GRK3"}
  - {"name": "K3Copy", "signature": "K3Copy(X): GRK3 -> GRK3"}
  - {"name": "Genus", "signature": "Genus(X): GRK3 -> RngIntElt"}
  - {"name": "TwoGenus", "signature": "TwoGenus(X): GRK3 -> RngIntElt"}
  - {"name": "SingularRank", "signature": "SingularRank(X): GRK3 -> RngIntElt"}
  - {"name": "AFRNumber", "signature": "AFRNumber(X): GRK3 -> RngIntElt"}
  - {"name": "IncludeWeight", "signature": "IncludeWeight(X, w): GRK3, RngIntElt -> GRK3"}
  - {"name": "RemoveWeight", "signature": "RemoveWeight(X, w): GRK3, RngIntElt -> GRK3"}
---

<a id="k3"></a>
<a id="sec-k3"></a>
# 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](https://docs.magma-maths.org/v2.30-1/AlgebraicGeometry/HilbertSeriesOfPolarisedVarieties/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 [[Alt98](https://docs.magma-maths.org/v2.30-1/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 [Baskets of Singularities](https://docs.magma-maths.org/v2.30-1/AlgebraicGeometry/HilbertSeriesOfPolarisedVarieties/baskets.md#sec-baskets), 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)$.

<a id="function-k3surface-rngintelt-grbskt"></a>
### `K3Surface(g, B): RngIntElt, GRBskt -> GRK3`

<a id="function-k3surface-rngintelt-seqenum"></a>
### `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],...]$).

<a id="function-k3copy-grk3"></a>
### `K3Copy(X): GRK3 -> GRK3`

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

## Accessing the Key Data

<a id="function-genus-grk3"></a>
### `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$.

<a id="function-twogenus-grk3"></a>
### `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$.

<a id="function-singularrank-grk3"></a>
### `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$.

<a id="function-afrnumber-grk3"></a>
### `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.

<a id="function-includeweight-grk3-rngintelt"></a>
### `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.

<a id="function-removeweight-grk3-rngintelt"></a>
### `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.
