Documentation

HexLLL.Dispatch

The public LLL entry points. lll keeps two paths: the certified external-candidate dispatch (provider → certCheck) and, when no provider candidate certifies, the exact lllNative. Both satisfy the same (δ, 11/20) contract. lll.firstShortVector / lll.shortVectors expose the reduced rows for downstream consumers.

def Hex.lll {n m : Nat} (b : Matrix Int n m) (δ : Rat) ( : 121 / 400 < δ) (hδ' : δ 1) (hn : 1 n) (_hind : b.independent) :

Top-level LLL entry point. Dispatches first to the certified-external path: if LLLProvider.providerAvailable () is true and the candidate passes certCheck B B' U V δ (11/20), the certified B' is returned; otherwise the exact lllNative runs. Both paths satisfy the identical post-condition (isLLLReduced (lll …) δ (11/20), same lattice, the public short-vector bound), so dispatch is invisible to callers and to proofs.

Equations
Instances For

    Install an external LLL acceleration provider from the shared library at path for the rest of this process, returning whether the load succeeded.

    The library must export lean_fplll_lll_reduce (the fpLLL-ffi shim built by scripts/oracle/setup_fplll_ffi.sh); loadProvider dlopens it, resolves that symbol, and points the dispatch at it. Once installed, a lll call whose provider candidate certifies under Hex.certCheck returns the accelerated basis; an absent provider, a load failure, or a rejected candidate all fall through to the exact lllNative. Loading is an explicit action — there is no environment-variable read and no implicit load — and the trust boundary is unchanged: every provider candidate is still checked before use.

    A later successful load replaces the current provider; a failed load leaves the existing state untouched and returns false (writing the dlopen/dlsym diagnostic to stderr) when the library cannot be loaded or does not export the expected symbol.

    Equations
    Instances For

      Whether an external LLL acceleration provider is currently installed in this process (via Hex.lll.loadProvider or a statically-linked provider symbol). When this is false, lll runs the exact lllNative; when it is true, lll attempts the certified external path first. Querying availability is side-effect-free apart from the one-shot static-symbol probe it may trigger.

      Equations
      Instances For
        def Hex.lllNative.firstShortVector {n m : Nat} (b : Matrix Int n m) (δ : Rat) ( : 1 / 4 < δ) (hδ' : δ 1) (hn : 1 n) :

        First row of lllNative's output: the lll.firstShortVector counterpart on the exact native path. It never consults an external provider and takes no b.independent hypothesis, so Mathlib-free callers can use it directly; its short-vector guarantee is lllNative_first_row_norm_sq_le at η = 1/2.

        Equations
        Instances For
          def Hex.lll.firstShortVector {n m : Nat} (b : Matrix Int n m) (δ : Rat) ( : 121 / 400 < δ) (hδ' : δ 1) (hn : 1 n) (hind : b.independent) :

          The first row of the reduced basis: a provably short vector, bounded by the LLL approximation factor relative to any nonzero lattice vector (see lll_first_row_norm_sq_le), not necessarily the shortest lattice vector. Canonical short-vector entry point for downstream callers such as hex-berlekamp-zassenhaus recombination.

          Equations
          Instances For
            def Hex.lllNative.shortVectors {n m : Nat} (b : Matrix Int n m) (δ : Rat) ( : 1 / 4 < δ) (hδ' : δ 1) (hn : 1 n) :

            Full lllNative output as an ordered array of candidate short vectors: the lll.shortVectors counterpart on the exact native path, forgoing the external provider and the b.independent hypothesis.

            Equations
            Instances For
              def Hex.lll.shortVectors {n m : Nat} (b : Matrix Int n m) (δ : Rat) ( : 121 / 400 < δ) (hδ' : δ 1) (hn : 1 n) (hind : b.independent) :

              The full reduced basis viewed as an ordered array of candidate short vectors.

              Equations
              Instances For