Function: genus2red
Section: elliptic_curves
C-Name: genus2red
Prototype: GDG
Help: genus2red(PQ,{p}): let PQ be a polynomial P, resp. a vector [P,Q] of
 polynomials, with rational coefficients.  Determines the reduction at p > 2
 of the (proper, smooth) hyperelliptic curve C/Q of genus 2 defined by
 y^2 = P, resp. y^2 + Q*y = P. More precisely, determines the special fiber X_p
 of the minimal regular model X of C over Z.
Doc: Let $PQ$ be a polynomial $P$, resp. a vector $[P,Q]$ of polynomials, with
 rational coefficients.
 Determines the reduction at $p > 2$ of the (proper, smooth) genus~2
 curve $C/\Q$, defined by the hyperelliptic equation $y^{2} = P(x)$, resp.
 $y^{2} + Q(x)*y = P(x)$.
 (The special fiber $X_{p}$ of the minimal regular model $X$ of $C$ over $\Z$.)

 If $p$ is omitted, determines the reduction type for all (odd) prime
 divisors of the discriminant.

 \noindent This function was rewritten from an implementation of Liu's
 algorithm by Cohen and Liu (1994), \kbd{genus2reduction-0.3}, see
 \url{https://www.math.u-bordeaux.fr/~liu/G2R/}.

 \misctitle{CAVEAT} The function interface may change: for the
 time being, it returns $[N,\var{FaN}, [P_{m}, Q_{m}], V]$
 where $N$ is either the local conductor at $p$ or the
 global conductor, \var{FaN} is its factorization, $y^{2} +Q_{m}\*y= P_{m}$
 defines a
 minimal model over $\Z$ and $V$ describes the reduction type at the
 various considered~$p$. Unfortunately, the program is not complete for
 $p = 2$, and we may return the odd part of the conductor only: this is the
 case if the factorization includes the (impossible) term $2^{-1}$; if the
 factorization contains another power of $2$, then this is the exact local
 conductor at $2$ and $N$ is the global conductor.

 \bprog
 ? default(debuglevel, 1);
 ? genus2red(x^6 + 3*x^3 + 63, 3)
 (potential) stable reduction: [1, []]
 reduction at p: [III{9}] page 184, [3, 3], f = 10
 %1 = [59049, Mat([3, 10]), x^6 + 3*x^3 + 63, [3, [1, []],
        ["[III{9}] page 184", [3, 3]], Vecsmall([0, 0, 2])]]
 ? [N, FaN, T, V] = genus2red([x^2-x, x^3-x^2-1]); \\ X1(13), global reduction
 p = 13
 (potential) stable reduction: [5, [Mod(0, 13), Mod(0, 13)]]
 reduction at p: [I{0}-II-0] page 159, [], f = 2
 ? N
 %3 = 169
 ? FaN
 %4 = Mat([13, 2])   \\ in particular, good reduction at 2 !
 ? T
 %5 = [-x^5 - x^3 + x^2 - x, x^3 + x^2 + 1]
 ? V
 %6 = [[13, [5, [Mod(0, 13), Mod(0, 13)]], ["[I{0}-II-0] page 159", []],
            Vecsmall([1, 0, 1])]]
 @eprog\noindent
 We now first describe the format of the vector $V = V_{p}$ in the case where
 $p$ was specified (local reduction at~$p$): it is a quadruple $[p, \var{stable},
 \var{red}, \var{pic}]$. The component $\var{stable} = [\var{type}, \var{vecj}]$ contains
 information about the stable reduction after a field extension;
 depending on \var{type}s, the stable reduction is

 \item 1: smooth (i.e. the curve has potentially good reduction). The
       Jacobian $J(C)$ has potentially good reduction.

 \item 2: an elliptic curve $E$ with an ordinary double point; \var{vecj}
 contains $j$ mod $p$, the modular invariant of $E$. The (potential)
 semi-abelian reduction of $J(C)$ is the extension of an elliptic curve (with
 modular invariant $j$ mod $p$) by a torus.

 \item 3: a projective line with two ordinary double points. The Jacobian
 $J(C)$ has potentially multiplicative reduction.

 \item 4: the union of two projective lines crossing transversally at three
 points. The Jacobian $J(C)$ has potentially multiplicative reduction.

 \item 5: the union of two elliptic curves $E_{1}$ and $E_{2}$ intersecting
 transversally at one point; \var{vecj} contains their modular invariants
 $j_{1}$ and $j_{2}$, which may live in a quadratic extension of $\F_{p}$
 and need not be distinct. The Jacobian $J(C)$ has potentially good reduction,
 isomorphic to the product of the reductions of $E_{1}$ and $E_{2}$.

 \item 6: the union of an elliptic curve $E$ and a projective line which has
 an ordinary double point, and these two components intersect transversally
 at one point; \var{vecj} contains $j$ mod $p$, the modular invariant of $E$.
 The (potential) semi-abelian reduction of $J(C)$ is the extension of an
 elliptic curve (with modular invariant $j$ mod $p$) by a torus.

 \item 7: as in type 6, but the two components are both singular. The
 Jacobian $J(C)$ has potentially multiplicative reduction.

 The component $\var{red} = [\var{NUtype}, \var{neron}]$ contains two data
 concerning the reduction at $p$ without any ramified field extension.

 The \var{NUtype} is a \typ{STR} describing the reduction at $p$ of $C$,
 following Namikawa-Ueno, \emph{The complete classification of fibers in
 pencils of curves of genus two}, Manuscripta Math., vol. 9, (1973), pages
 143-186. The reduction symbol is followed by the corresponding page number
 or page range in this article.

 The second datum \var{neron} is the group of connected components (over an
 algebraic closure of $\F_{p}$) of the N\'eron model of $J(C)$, given as a
 finite abelian group (vector of elementary divisors).
 \smallskip
 If $p = 2$, the \var{red} component may be omitted altogether (and
 replaced by \kbd{[]}, in the case where the program could not compute it.
 When $p$ was not specified, $V$ is the vector of all $V_{p}$, for all
 considered $p$.

 The component $\var{pic}$ is \typ{VECSMALL} with $3$ components
 $[r_a,r_t,r_u]$ describing the Picard group of the curve: $r_a$ is the Abelian
 rank, $r_t$ is the toric rank, and $r_u$ is the unipotent rank.

 \misctitle{Notes about Namikawa-Ueno types}

 \item A lower index is denoted between braces: for instance,
  \kbd{[I\obr2\cbr-II-5]} means \kbd{[I\_2-II-5]}.

 \item If $K$ and $K'$ are Kodaira symbols for singular fibers of elliptic
 curves, then \kbd{[$K$-$K'$-m]} and \kbd{[$K'$-$K$-m]} are the same.

 We define a total ordering on Kodaira symbol by fixing $\kbd{I} < \kbd{I*} <
 \kbd{II} < \kbd{II*}, \dots$. If the reduction type is the same, we order by
 the number of components, e.g. $\kbd{I}_{2} < \kbd{I}_{4}$, etc.
 Then we normalize our output so that $K \leq K'$.

 \item \kbd{[$K$-$K'$-$-1$]}  is \kbd{[$K$-$K'$-$\alpha$]} in the notation of
 Namikawa-Ueno.

 \item The figure \kbd{[2I\_0-m]} in Namikawa-Ueno, page 159, must be denoted
 by \kbd{[2I\_0-(m+1)]}.
