Berlekamp–Massey uniqueness.
ProvedPRNGSeed.linRec_taps_unique_of_spanaether-catalogmachinelearning
Berlekamp–Massey uniqueness. If the state windows of the stream span
F^L, then at most one tap vector can drive the stream: seed recovery has a
unique answer, so a fingerprinting routine that finds some consistent tap
vector has found the tap vector.
theorem PRNGSeed.linRec_taps_unique_of_span{c d : Fin L → F} (hspan : windowSpan x L = ⊤)
(hc : IsLinRec L c x) (hd : IsLinRec L d x) : c = d := by sorry
Formalization Note Transplanted verbatim from the Aether Catalog source MachineLearning/PRNGSeedRecoveryLFSR.lean; the statement is byte-identical to the source declaration, elaborated with autoImplicit disabled in the platform environment.
Preamble
-- Thm stub generated from MachineLearning/PRNGSeedRecoveryLFSR.lean
import Mathlib
import Definitions.Def_MachineLearning_PRNGSeedRecoveryLFSR
/-
Copyright (c) 2025. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
# Seed Recovery for Linear Feedback Shift Registers
This module formalises the mathematical core of *seed recovery* for the LFSR
family of pseudo-random generators, the first half of the "detect PRNG output
and replace the file by its seed" programme (see
`MachineLearning.PRNGCompressionBound` for the counting-side limits).
An LFSR of order `L` over a commutative ring `F` with tap vector
`c : Fin L → F` produces a stream `x : ℕ → F` obeying
`x (n + L) = ∑ i < L, c i * x (n + i)`.
## Main results
* `lfsrRun` — the generator: run the register from an explicit seed.
* `lfsrRun_isLinRec`, `lfsrRun_of_lt` — the generator does what it claims.
* `IsLinRec.ext_of_agree` — **rigidity**: two streams with the same taps that
agree on one window of length `L` agree forever.
* `IsLinRec.seed_recovery` — **the falsifiability gate**: any stream obeying the
recurrence is *exactly* reproduced by re-running the register from its own
first `L` symbols. Nothing beyond the seed has to be stored.
* `linRec_taps_unique_of_span` — **Berlekamp–Massey uniqueness**: if the first
`L` state windows span `F^L`, the tap vector is uniquely determined by the
stream, so seed recovery has a unique answer.
* `hankel_span_of_taps_unique` — the converse over a field: tap uniqueness
forces the windows to span. Spanning is therefore *exactly* the right
nondegeneracy condition.
## Application keywords
LFSR, linear recurrence, Berlekamp–Massey, seed recovery, PRNG fingerprinting,
stream compression
-/
open Finset
open PRNGSeed
variable {F : Type*} [CommRing F]
variable {L : ℕ} {c init : Fin L → F}
/-! ### Periodic data is seed-compressible -/
variable {F : Type*} [Field F] {L : ℕ} {x : ℕ → F}Formal statement
theorem PRNGSeed.linRec_taps_unique_of_span{c d : Fin L → F} (hspan : windowSpan x L = ⊤)
(hc : IsLinRec L c x) (hd : IsLinRec L d x) : c = d := by sorrySource