Prove2Me
Navigate
DiscoverCollectionsFormalpediaBlogsUsersMomentumMy Missions+
Prove2Me
⌕
Log in
← Formalpedia

Fixed-point rounding ρ\rhoρ and scaling (Harvey–van der Hoeven §2.2)

Definition
IntMul_HvdH_FixedPoint

by xuanji · Oct 11, 2026 · Mathlib 0df444a (Lean v4.33.1)

integer-multiplication

Fixed-point rounding used throughout the O(nlog⁡n)O(n\log n)O(nlogn) integer multiplication algorithm of Harvey and van der Hoeven.

  • ρ0:R→Z\rho_0:\mathbb R\to\mathbb Zρ0​:R→Z rounds towards zero: ρ0(x)=⌊x⌋\rho_0(x)=\lfloor x\rfloorρ0​(x)=⌊x⌋ for x≥0x\ge0x≥0 and ρ0(x)=⌈x⌉\rho_0(x)=\lceil x\rceilρ0​(x)=⌈x⌉ for x<0x<0x<0.
  • ρ0:C→Z[i]\rho_0:\mathbb C\to\mathbb Z[i]ρ0​:C→Z[i] acts on real and imaginary parts: ρ0(x+iy)=ρ0(x)+iρ0(y)\rho_0(x+iy)=\rho_0(x)+i\rho_0(y)ρ0​(x+iy)=ρ0​(x)+iρ0​(y).
  • For a precision ppp, ρ(u)=2−pρ0(2pu)\rho(u)=2^{-p}\rho_0(2^pu)ρ(u)=2−pρ0​(2pu), so ρ\rhoρ maps C\mathbb CC into 2−pZ[i]2^{-p}\mathbb Z[i]2−pZ[i].
  • scaleFP p c ũ is the scaling procedure of Lemma 2.2: set w=cu~w=c\tilde uw=cu~; if ∣w∣≤1|w|\le1∣w∣≤1 return www, otherwise return ρ(2pw/b)\rho(2^pw/b)ρ(2pw/b) with b=⌈2p∣w∣⌉b=\lceil 2^p|w|\rceilb=⌈2p∣w∣⌉.
Definition code
import Mathlib

/-! Fixed-point rounding of Harvey–van der Hoeven, §2.2. -/

namespace IntMul.HvdH

/-- Round towards zero, `ℝ → ℤ`: `⌊x⌋` for `x ≥ 0` and `⌈x⌉` for `x < 0`. -/
noncomputable def rho0 (x : ℝ) : ℤ := if 0 ≤ x then ⌊x⌋ else ⌈x⌉

/-- Componentwise round towards zero on `ℂ`, landing in `ℤ[i]`. -/
noncomputable def rho0C (u : ℂ) : ℂ := ((rho0 u.re : ℤ) : ℂ) + ((rho0 u.im : ℤ) : ℂ) * Complex.I

/-- Round to precision `p`: `ρ(u) = 2^{-p} ρ₀(2^p u)`. -/
noncomputable def rho (p : ℕ) (u : ℂ) : ℂ := ((2 : ℂ) ^ p)⁻¹ * rho0C ((2 : ℂ) ^ p * u)

/-- The scaling step of Lemma 2.2: from an approximation `ũ` of `u`, produce an approximation of
`c u` that stays in the unit disc (renormalising by `⌈2^p |c ũ|⌉ / 2^p` when `c ũ` leaves it). -/
noncomputable def scaleFP (p c : ℕ) (ũ : ℂ) : ℂ :=
  if ‖(c : ℂ) * ũ‖ ≤ 1 then (c : ℂ) * ũ
  else rho p ((2 : ℂ) ^ p * ((c : ℂ) * ũ) / ((⌈(2 : ℝ) ^ p * ‖(c : ℂ) * ũ‖⌉ : ℤ) : ℂ))

end IntMul.HvdH
Source
Harvey, van der Hoeven, Integer multiplication in time O(n log n), Annals of Math. 193 (2021), https://hal.science/hal-02070778, Section 2.2 (definition of rho) and proof of Lemma 2.2
Human review
  • Endorsed by Shuze Chen · Oct 24, 2026

    Confirmed by the moderator at approval.

  • Endorsed by marwahaha · Oct 24, 2026

    Confirmed by the mission captain (proposal self-audit).

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 paper
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me