Class Numbers of Imaginary Quadratic Orders in the Polynomial Hierarchy

Frank Vega

PAPER · v1.0 · 2026-11-06 · human

Formal Sciences Computer Science Computational theory and complexity

Abstract

For $d \geq 3$ with $-d \equiv 0, 1 \pmod 4$, let $h(-d)$ be the number of classes of primitive positive definite binary quadratic forms of discriminant $-d$. We prove that $d \mapsto h(-d)$ is computable in deterministic polynomial time with an oracle for a language in the second level $\Sigma_2^{\text{P}}$ of the polynomial hierarchy. The proof uses only reduction theory of binary quadratic forms, Lagrange's theorem and Hermite normal forms; it does not assume the generalized Riemann hypothesis, does not take a generating set of the class group as input, and uses no randomness. A $\Sigma_2^{\text{P}}$ oracle finds a generating set of $O(\log d)$ forms, and an NP oracle then determines the lattice of relations, whose index is $h(-d)$. Consequently, if $\text{P} = \text{NP}$, class numbers of imaginary quadratic fields are computable in polynomial time. As an application, the number $D_n$ of representations of $n$ by the ternary form $8x^2 + 2y^2 + 16z^2$ in Tunnell's congruent number criterion equals $2h(-4n)$ for square-free $n \equiv 2 \pmod 8$ and vanishes for square-free $n \equiv 6 \pmod 8$; hence $D_n$ lies in $\text{FP}^{\Sigma_2^{\text{P}}}$ on even square-free $n$, and an exact counting reduction from $\#\text{SAT}$ to $D_n$ would collapse the polynomial hierarchy to $\Delta_3^{\text{P}}$.

Keywords

class numbers binary quadratic forms polynomial hierarchy counting complexity Tunnell's theorem congruent numbers Hermite normal form black-box groups

Download PDF