Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

(1.15), (1.23) — the basis reduction algorithm terminates and returns a reduced basis for L

Proved
LLLFactor.Reduction.algorithm_terminates

by mikedeng1 · Oct 6, 2026 · Mathlib 0df444a (Lean v4.33.1)

algorithmlattice-basis-reductionlllp2o-batch-pfp2ap2o-gran-per-chapterp2o-plan-paperp2o-v1termination

Let n≥1n\ge1n≥1 and let b1,…,bnb_1,\dots,b_nb1​,…,bn​ be a basis of Rn\mathbb R^nRn, spanning the lattice L=∑iZbiL=\sum_i\mathbb Z b_iL=∑i​Zbi​. Run the basis reduction algorithm (1.15) from the state (b,2)(b,2)(b,2). Then:

  1. the algorithm terminates: there is no infinite sequence of states s0=(b,2),s1,s2,…s_0=(b,2),s_1,s_2,\dotss0​=(b,2),s1​,s2​,… in which each st+1s_{t+1}st+1​ arises from sts_tst​ by one step;
  2. it does not get stuck: at every reachable state (b′,k)(b',k)(b′,k) with k≤nk\le nk≤n some step applies;
  3. its output is a reduced basis for LLL: at every reachable state (b′,n+1)(b',n+1)(b′,n+1), the vectors b1′,…,bn′b'_1,\dots,b'_nb1′​,…,bn′​ form a basis for LLL that is reduced in the sense of (1.4)–(1.5).

In the paper's words: "(1.15) We shall now describe an algorithm that transforms a given basis b1,b2,…,bnb_1,b_2,\dots,b_nb1​,b2​,…,bn​ for a lattice LLL into a reduced one. … This finishes the description of the algorithm. Below we shall prove that the algorithm terminates." The proof is (1.23). Together with (1.6)–(1.12), which bound the vectors of a reduced basis, this theorem is what makes reduced bases computable and is the engine of the factoring algorithm of Sect. 3.

Formalization Note. Every choice the algorithm leaves open (the nearest integer at a tie) is quantified over, so the theorem covers every implementation of the text of (1.15). Item 2 rules out a vacuous reading of item 1.

Preamble
import Mathlib
import Definitions.Def_LLLFactor_Reduction_Algorithm
Formal statement
namespace LLLFactor.Reduction

theorem algorithm_terminates {n : ℕ} (hn : 0 < n) (b : Fin n → LLLFactor.RedBasis.Vec n)
    (hb : LinearIndependent ℝ b) :
    (¬ ∃ s : ℕ → State n, s 0 = (b, 2) ∧ ∀ t, Step (s t) (s (t + 1))) ∧
    (∀ s : State n, Reachable b s → s.2 ≤ n → ∃ s' : State n, Step s s') ∧
    (∀ s : State n, Reachable b s → s.2 = n + 1 →
      LLLFactor.RedBasis.IsBasisFor s.1 (LLLFactor.RedBasis.latticeOf b) ∧ LLLFactor.RedBasis.IsReduced s.1) := by sorry

end LLLFactor.Reduction
Source
Lenstra, Lenstra, Lovász, Factoring polynomials with rational coefficients, Math. Ann. 261 (1982), pp. 518–522, (1.15) and (1.23)
Human review
  • Endorsed by Shuze Chen · Oct 6, 2026

    Confirmed by the moderator at approval.

  • Endorsed by mikedeng1 · Oct 6, 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 paperProve2Me Team
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me