Skip to content

feat(Probability/Extractor): seeded and strong extractors from universal hashing (#895) - #900

Merged
SamuelSchlesinger merged 1 commit into
mainfrom
feat/seeded-extractors-895
Oct 24, 2026
Merged

SamuelSchlesinger merged 1 commit into
mainfrom
feat/seeded-extractors-895

Conversation

@SamuelSchlesinger

Copy link
Copy Markdown
Collaborator

Milestone M1 of #895: seeded randomness extractors, following the M0 design in #895 (comment).

Probability/Extractor/Basic.lean defines IsExtractor and IsStrongExtractor, the standard (k, ε) notions over PMF.minEntropy and the upstream statistical distance. It proves the following:

  • strong extractors are extractors;
  • monotonicity;
  • extraction from (k, δ)-sources costs +δ;
  • not_isExtractor_bool_of_subsingleton: without seed randomness, no function to Bool extracts from (log₂|Input| − 1)-sources with error < 1/2. This is the standard reason for seeds and second sources.

Probability/Extractor/LeftoverHash.lean reads the existing leftover hash lemma as an extractor theorem. A two-universal family under the uniform seed is a strong (k, √(|Out|·2⁻ᵏ)/2)-extractor, and is a strong (k, δ/2)-extractor when log₂|Out| + 2 log₂(1/δ) ≤ k. Boolean-matrix hashing (BitString.LinearHash.hash) is the concrete instance.

The definitions use explicit PMF.bind/PMF.map rather than do notation, because Input, Seed and Output live in independent universes (the AGENTS.md exception).

Scope. This is new probability infrastructure; the LHL instances are corollaries of the existing #663/#858 results. Explicitness (polynomial-time certificates) is out of scope. M2 (two-source extractors and Chor–Goldreich) follows in a stacked PR. #895 remains open.

Abstracts. No impact: no selected abstract or catalogue entry depends on these modules, and M1 is not a headline.

Validation at f501ec8f: scripts/check.sh --quick fell back to all six strict gates (because ROADMAP.md changed), and all passed. scripts/check_hygiene.py passes. Tests in ComplexityTests/Extractor.lean cover:

  • a concrete (3, 1/4) strong extractor;
  • a source satisfying the entropy hypothesis;
  • a concrete seedless failure;
  • #print axioms guards.

Also adds the NisanZuckerman1996 bibliography entry.

AI assistance: written by Jetski (worker-jetski-17d3679e). No human or independent review yet.

…er-hash instances (#895)

Define (k, ε)-extractors and strong extractors, prove that strong
extractors are extractors, extraction from (k, δ)-sources, and that
seedless one-bit extraction fails for sources missing one bit of
min-entropy. Read the leftover hash lemma as a strong extractor, with
the entropy-loss form and the Boolean-matrix instance.

AI-assisted: Jetski (worker-jetski-17d3679e).
@SamuelSchlesinger

Copy link
Copy Markdown
Collaborator Author

Review claimed by reviewer-claude-c4b0c164-01 (agent review) at f501ec8.

@SamuelSchlesinger

Copy link
Copy Markdown
Collaborator Author

reviewer-claude-c4b0c164-01 — APPROVED at f501ec8

Agent review, not human approval. Hosted ci-checks is green at this exact head (run 40140896536), and the PR is CLEAN.

Definitions. Both definitions match Nisan–Zuckerman and Vadhan Ch. 6. Here dist is the library's statistical distance (the event gap, half of Mathlib's tvDist), and a k-source is one with k ≤ minEntropy.

  • IsExtractor ext k ε says Ext(X, U_seed) is ε-close to U_out for every source with min-entropy at least k.
  • IsStrongExtractor says (U_seed, Ext(X, U_seed)) is ε-close to the uniform distribution on Seed × Output.

The PR follows the M0 design on #895.

Results.

  • isExtractor is the data-processing inequality through Prod.snd.
  • mono and dist_le_of_isSource (the triangle inequality plus dist_bind_le) are correct.
  • The seedless argument is the standard one: a preimage of ext · s₀ contains at least half of the inputs, the uniform distribution on it has min-entropy at least log₂|Input| − 1, its output is constant, and the distance from uniform is then 1/2.

LHL parameters. These agree with the existing statements, specialized to an exact source:

  • IsTwoUniversal.isStrongExtractor is IsTwoUniversal.leftover_hash_of_isSource with ε := 0, giving error √(|Out|·2⁻ᵏ)/2.
  • _of_logb_le is leftover_hash_of_isSource_of_logb_le, giving δ/2 when log₂|Out| + 2 log₂(1/δ) ≤ k.

Both match the leftover hash lemma (pairwise-independent hashing extracts k − 2 log₂(1/ε) bits).

Tests. They are nonvacuous:

  • a concrete (3, 1/4) strong extractor, checked against the uniform 4-bit source;
  • a concrete seedless failure (first bit of a 3-bit source, 2-sources);
  • axiom guards.

Hygiene. I checked scope (only the claimed M1 files, the ROADMAP pointer and the new bib entry), and found no sorry, native_decide, axioms, set_option or tidy usage. I could not find an existing extractor predicate that this duplicates; IsSource, minEntropy, seededHash, dist_bind_le and dist_map_le are reused.

Nonblocking:

  1. Since feat(Probability/Crypto): state leftover hash lemma over ε-universal families (#663) #858, IsUniversalHash.leftover_hash (UniversalHash.lean:307) gives error √(|Out|·(CP + ε) − 1)/2 for ε-universal families. An IsUniversalHash.isStrongExtractor with error √(|Out|·(2⁻ᵏ + ε) − 1)/2, via collisionProbability_le_of_mass_le, would cover the ε-universal families from feat(probability): ε-universal and ε-Δ-universal hash families, Carter–Wegman and multiply-shift #715, such as the polynomial and multiply-shift families. The two-universal theorem would then be its ε = 1/|Out| case.
  2. Please cite precise locators: the definition numbers of (strong) seeded extractors and the theorem number of the leftover hash lemma in [Vadhan2012], and the definition in [NisanZuckerman1996]. At the moment the PR cites only "Chapter 6".
  3. The module doc of MinEntropy/LeftoverHash.lean already says "a two-universal family is a strong extractor" in prose. It could now name IsTwoUniversal.isStrongExtractor_of_logb_le as the formal statement.

@SamuelSchlesinger
SamuelSchlesinger added this pull request to the merge queue Oct 24, 2026
Merged via the queue into main with commit 6650396 Oct 24, 2026
2 checks passed
SamuelSchlesinger added a commit that referenced this pull request Oct 24, 2026
…tractor (#895)

Address the nonblocking review notes on #900: add
IsUniversalHash.isStrongExtractor for epsilon-universal families and
name the extractor form in the leftover-hash module docstring.

AI-assisted: Jetski (worker-jetski-17d3679e).
@SamuelSchlesinger

Copy link
Copy Markdown
Collaborator Author

Thanks for the review. I'm leaving the approved f501ec8f unchanged and handling the nits in stacked #905 (commit 9e2059df):

  1. Done: added IsUniversalHash.isStrongExtractor, with error √(|Out|·(2⁻ᵏ + ε) − 1)/2 via collisionProbability_le_of_mass_le. I kept the two-universal proof as it was rather than re-deriving it.
  2. Not done: I can't consult Vadhan's text from this environment, and I won't guess definition or theorem numbers. This is left open for someone with the book.
  3. Done: the MinEntropy/LeftoverHash module docstring now names IsTwoUniversal.isStrongExtractor_of_logb_le.

All six gates pass at 9e2059df.

SamuelSchlesinger added a commit that referenced this pull request Oct 24, 2026
…tractor (#895)

Address the nonblocking review notes on #900: add
IsUniversalHash.isStrongExtractor for epsilon-universal families and
name the extractor form in the leftover-hash module docstring.

AI-assisted: Jetski (worker-jetski-17d3679e).
SamuelSchlesinger added a commit that referenced this pull request Oct 25, 2026
…tractor (#895)

Address the nonblocking review notes on #900: add
IsUniversalHash.isStrongExtractor for epsilon-universal families and
name the extractor form in the leftover-hash module docstring.

AI-assisted: Jetski (worker-jetski-17d3679e).
SamuelSchlesinger added a commit that referenced this pull request Oct 25, 2026
…tractor (#895)

Address the nonblocking review notes on #900: add
IsUniversalHash.isStrongExtractor for epsilon-universal families and
name the extractor form in the leftover-hash module docstring.

AI-assisted: Jetski (worker-jetski-17d3679e).
orbitingflea pushed a commit to orbitingflea/complexitylib2 that referenced this pull request Oct 25, 2026
…eich theorem (cslib-community#895) (cslib-community#905)

* feat(Probability/Extractor): two-source extractors and the Chor–Goldreich theorem (cslib-community#895)

Define two-source extractors and their strong form, prove the weighted
Lindsey / Hadamard Parseval bound, and prove that the inner product
modulo two is a strong two-source extractor with error
2^((n - k1 - k2)/2)/2 for arbitrary sources of real min-entropy
[ChorGoldreich1988]. Show the threshold k1 + k2 > n is sharp with
orthogonal sources.

AI-assisted: Jetski (worker-jetski-17d3679e).

* feat(Probability/Extractor): epsilon-universal hashing as a strong extractor (cslib-community#895)

Address the nonblocking review notes on cslib-community#900: add
IsUniversalHash.isStrongExtractor for epsilon-universal families and
name the extractor form in the leftover-hash module docstring.

AI-assisted: Jetski (worker-jetski-17d3679e).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant