The pure integer-arithmetic LLL reducer. LLLState carries only the
integer basis, scaled Gram-Schmidt coefficients ν, and Gram
determinants d; lllNative runs the fuel-bounded d/ν loop, the
trusted exact reducer at the classical η = 1/2.
Integer-only state for later LLL reduction steps. The proof-facing fields
connect the stored Gram determinants and scaled coefficients to the executable
Gram-Schmidt integer data for b.
The current integer basis, as a matrix of row vectors.
The integer scaled Gram-Schmidt coefficients of
b.The leading Gram determinants of
b(d[k]fork ≤ n).
Instances For
Correctness predicate for the proof-facing interpretation of an executable
LLLState. Keeping this separate lets core state updates remain purely
computational; Mathlib-side modules can prove preservation when they need the
Gram-Schmidt interpretation.
Instances For
Targeted matrix entry update for LLL's integer coefficient state.
Uses Vector.modify rather than M.set i ((M.get i).set j x) so the
underlying Array.modify swap-with-placeholder runs the inner row update
in place when M is uniquely owned, avoiding the forced row copy that
set i (… set j …) triggers via a lean_inc on the borrowed row.
Equations
Instances For
Closed form for the entry-wise size-reduction sweep: folding the update
row ← row.set l' (outerK l' − r · outerJ l') over the first jVal indices
replaces exactly the entries below jVal by outerK − r · outerJ and leaves the
rest of base untouched. Reading position l afterwards gives the reduced value
when l.val < jVal and the original base.get l otherwise.
Swap adjacent rows k - 1 and k, updating the stored scaled coefficients
and Gram determinants with the integer formulas from the LLL specification.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Size reduction leaves the stored Gram determinants unchanged.
Size reduction preserves the Gram-Schmidt basis of the state basis matrix.
Recover a single rational Gram-Schmidt coefficient from the integer state. This exists for the proof layer; later executable code continues to work over the stored integer data.
Instances For
Unfold the termination potential through the state's Gram-determinant
certificate. The product only ranges over d₁, ..., dₙ₋₁, so later
termination proofs do not need to reason about dₙ.
Initial LLLState constructor: build the integer state directly from a
basis matrix. The ν field is the integral scaled Gram-Schmidt coefficient
matrix and the d field is the leading Gram-determinant vector.
Takes no independence hypothesis: the construction is purely executable, and the
resulting state is even Valid unconditionally (see
HexLLLMathlib.LLLState.ofBasis_valid). b.independent enters only in the
theorems about the reducer's output (lllNative_isLLLReduced and the
short-vector bounds), never in building the state. Mathlib-free callers
(benchmarks, fixture emitters, BHKS projected-row computation) use it directly.
Equations
- Hex.Internal.LLLState.ofBasis b = { b := b, ν := (Hex.GramSchmidt.Int.data b).ν, d := (Hex.GramSchmidt.Int.data b).d }
Instances For
Fuel-bounded outer LLL loop, dispatched by lllAux.
At row k, the loop size-reduces the current row, checks the integer
Lovasz condition, and either advances to k + 1 or swaps adjacent rows and
continues from the previous position.
The fuel = 0 branch returns the current basis as the total fallback for a
pipeline-unreachable case: issue #6567 tracks the fuel-sufficiency theorem
showing that lllFuel is enough for public pipeline calls.
Equations
- One or more equations did not get rendered due to their size.
- Hex.Internal.lllLoop s k δ hδ hδ' hk hkn 0 = s.b
Instances For
lllLoop preserves the generated lattice: every iteration is either a
sizeReduce (preserved by sizeReduce_memLattice_iff) or an adjacent swap
(preserved by swapStep_memLattice_iff).
Outer LLL loop, dispatched by lll.
Compatibility wrapper preserving the original lllAux signature while the
executable recursion is structurally bounded by lllFuel.
Equations
- Hex.Internal.lllAux s k δ hδ hδ' hk hkn = Hex.Internal.lllLoop s k δ hδ hδ' hk hkn (Hex.Internal.lllFuel s)
Instances For
Native (non-dispatched) executable LLL entry point. Builds the canonical
integer state via LLLState.ofBasis and dispatches to lllAux.
This is the body the public lll runs by default; its output achieves the
classical size-reduction bound |μ| ≤ 1/2 (η = 1/2), so its short-vector
guarantee uses α = 1/(δ − 1/4) with the classical precondition 1/4 < δ.
Equations
- Hex.lllNative b δ hδ hδ' hn = Hex.Internal.lllAux (Hex.Internal.LLLState.ofBasis b) 1 δ hδ hδ' Hex.lllNative._proof_1 hn
Instances For
121/400 < δ implies 1/4 < δ: relays the public lll (η = 11/20)
precondition through to the native body (η = 1/2).