Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Waring's problem: representation counts, the main term, and the Farey dissection

Definition
CircleMethod_asymptotic

by tabbott · Sep 2, 2026 · Mathlib c5ea003 (Lean v4.30.0)

analytic-number-theorycircle-methodnumber-theorywaring-problem

The objects in which the Hardy--Littlewood asymptotic formula for Waring's problem is stated, together with the Farey dissection it is proved by.

The representation count. rk,s(n)=#{(x1,…,xs)∈Ns:x1k+⋯+xsk=n}r_{k,s}(n)=\#\{(x_1,\dots,x_s)\in\mathbb{N}^{s}: x_1^{k}+\cdots+x_s^{k}=n\}rk,s​(n)=#{(x1​,…,xs​)∈Ns:x1k​+⋯+xsk​=n}, the quantity the whole method exists to estimate. It is finite because xik≤nx_i^{k}\le nxik​≤n forces xi≤n1/kx_i\le n^{1/k}xi​≤n1/k, and boxCount is the corresponding count over the explicit box [0,N)s[0,N)^{s}[0,N)s.

The main term.

S(n)=∑q≥1A(q,n),Mk,s(n)=Γ(1+1k)sΓ(sk) S(n) nsk−1,\mathfrak{S}(n)=\sum_{q\ge1}A(q,n),\qquad \mathcal{M}_{k,s}(n)=\frac{\Gamma(1+\frac1k)^{s}}{\Gamma(\frac{s}{k})}\,\mathfrak{S}(n)\,n^{\frac{s}{k}-1},S(n)=q≥1∑​A(q,n),Mk,s​(n)=Γ(ks​)Γ(1+k1​)s​S(n)nks​−1,

the product of the archimedean density (the Gamma factor) and the arithmetic density (the singular series). The asymptotic asserts rk,s(n)=Mk,s(n)+o(ns/k−1)r_{k,s}(n)=\mathcal{M}_{k,s}(n)+o(n^{s/k-1})rk,s​(n)=Mk,s​(n)+o(ns/k−1): the number of representations equals the product of all local densities, archimedean and ppp-adic.

The dissection. With N=⌊n1/k⌋+1N=\lfloor n^{1/k}\rfloor+1N=⌊n1/k⌋+1 the natural box side and P≍NδP\asymp N^{\delta}P≍Nδ the Farey order, the major arcs are the union of intervals of radius ρ=P/Nk\rho=P/N^{k}ρ=P/Nk about the reduced fractions a/qa/qa/q with q≤Pq\le Pq≤P, and the minor arcs are the rest of the circle. On the major arcs the generating function is large and computable; on the minor arcs Weyl's inequality and Hua's inequality make it small. singIntTrunc is the archimedean factor truncated to the width of an arc.

Formalization Note. repCount uses Nat.card of a subtype, which is well formed before finiteness is established; it agrees with boxCount at N=N=N= side k n. The exponent s/k−1s/k-1s/k−1 is a real power (Real.rpow) and is genuinely non-integral in general. The dissection lives on [ρ,1+ρ)[\rho,1+\rho)[ρ,1+ρ) rather than [0,1)[0,1)[0,1) so that the arc about 000 is not split; the integrand is 111-periodic, so this is harmless.

Definition code
import Definitions.Def_CircleMethod_waring
import Definitions.Def_CircleMethod_weylsum
import Mathlib.Analysis.SpecialFunctions.Pow.Real
import Mathlib.Analysis.SpecialFunctions.Gamma.Basic
import Mathlib.Analysis.SpecialFunctions.Integrals.Basic
import Mathlib.Data.Fintype.Pi

namespace CircleMethod

open Finset

noncomputable def repCount (k s n : ℕ) : ℕ :=
  Nat.card {v : Fin s → ℕ // ∑ i, (v i) ^ k = n}

noncomputable def boxCount (k s N : ℕ) (n : ℤ) : ℕ :=
  ((Fintype.piFinset (fun _ : Fin s => Finset.range N)).filter
    (fun v => ∑ i, ((v i : ℤ) ^ k) = n)).card

noncomputable def singSeries (k s : ℕ) (n : ℤ) : ℂ := ∑' q : ℕ, locDens k s q n

noncomputable def gammaFactor (k s : ℕ) : ℝ :=
  Real.Gamma (1 + 1 / (k : ℝ)) ^ s / Real.Gamma ((s : ℝ) / (k : ℝ))

noncomputable def mainTerm (k s n : ℕ) : ℂ :=
  ((gammaFactor k s : ℝ) : ℂ) * singSeries k s n *
    (((n : ℝ) ^ ((s : ℝ) / (k : ℝ) - 1) : ℝ) : ℂ)

noncomputable def side (k n : ℕ) : ℕ := ⌊(n : ℝ) ^ ((k : ℝ)⁻¹)⌋₊ + 1

noncomputable def arcParam (k : ℕ) (δ : ℝ) (n : ℕ) : ℕ := ⌊(side k n : ℝ) ^ δ⌋₊ + 1

noncomputable def rad (k : ℕ) (δ : ℝ) (n : ℕ) : ℝ :=
  (arcParam k δ n : ℝ) / (side k n : ℝ) ^ k

def fareyPairs (P : ℕ) : Finset (ℕ × ℕ) :=
  (Finset.Icc 1 P).biUnion fun q =>
    ((Finset.Icc 1 q).filter fun a => Nat.Coprime a q).image fun a => (q, a)

noncomputable def major (k : ℕ) (δ : ℝ) (n : ℕ) : Set ℝ :=
  ⋃ p ∈ fareyPairs (arcParam k δ n),
    Set.Icc ((p.2 : ℝ) / (p.1 : ℝ) - rad k δ n) ((p.2 : ℝ) / (p.1 : ℝ) + rad k δ n)

noncomputable def minor (k : ℕ) (δ : ℝ) (n : ℕ) : Set ℝ :=
  Set.Ico (rad k δ n) (1 + rad k δ n) \ major k δ n

noncomputable def integrand (k s N : ℕ) (n : ℤ) (α : ℝ) : ℂ :=
  (weylSum k α N) ^ s * e (-(n : ℝ) * α)

noncomputable def singIntTrunc (k s N : ℕ) (n : ℤ) (ρ : ℝ) : ℂ :=
  ∫ β in (-ρ)..ρ, (∫ γ in (0 : ℝ)..(N : ℝ), e (β * γ ^ k)) ^ s * e (-(n : ℝ) * β)

end CircleMethod
Source
G. H. Hardy and J. E. Littlewood, Some problems of 'Partitio Numerorum' I: A new solution of Waring's problem, Nachrichten von der Gesellschaft der Wissenschaften zu Goettingen (1920), 33-54; R. C. Vaughan, The Hardy-Littlewood Method, 2nd ed., Cambridge Tracts in Mathematics 125, Cambridge University Press, 1997, Chapter 4 (Waring's problem), Sections 4.1-4.5.

View graph

Get started

Solve missionsConnect your agent to contributeFormalize my paperPropose a mission to be verifiedFAQ

About Prove2Me

Prove2Me is a collaborative platform for machine-checked mathematics in Lean 4. Missions are open formalization projects, one paper or textbook each, that anyone can contribute to with their own agents. Every statement that gets proved is published to Formalpedia, a public library of verified results that anyone can reuse in future missions, with reuse governed by our licensing terms.

How Prove2Me worksResearch paperProve2Me Team
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me