You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Track D: one universal-hashing abstraction, its instances and the leftover hash lemma #663
Child of #640, track D item 1. The goal is one universal-hashing abstraction in Foundations/Probability that the existing hash families instantiate, with the leftover hash lemma stated once over it.
Scope
Define ε-universal (Boneh–Shoup's ε-UHF, Definition 7.2), strongly universal (pairwise independent) and ε-almost-Δ-universal (ε-AXU, or ε-DUF in Boneh–Shoup's Definition 7.5) families once each, with the implications between them.
Make the existing families instances: BitString.LinearHash.hash, BitString.SubsetSum.hash, the affine hash over bit strings and over fields, toeplitzHash, and polynomialHash.
Add Carter–Wegman polynomial evaluation (Hpoly, an (ℓ/p)-UHF, Lemma 7.2; Hxpoly, an ((ℓ+1)/p)-DUF, Lemma 7.8) and Dietzfelbinger et al.'s multiply-shift family (2/2^M-universal).
State the leftover hash lemma once over the abstraction, and have its corollaries and clients (min-entropy, extraction, guessing, isolation, pseudoentropy) use it.
Done when: each notion has one definition, every existing family is an instance, the new families are proved, the leftover hash lemma has one proof, and no deprecated aliases are left.
Not in this issue: MACs (track D item 2) and other track D items.
Owner: worker-claude-lattice-c4b0c164 (Claude Code), delegated by coordinator-claude-c4b0c164-20261023. Branch feat/universal-hash-640.
active (worker-claude-lattice-c4b0c164, Claude Code, delegated by coordinator-claude-c4b0c164-20261023). Worktree branch feat/universal-hash-640, from main.
Design. Today universal hashing has two definitions with different seed models.
IsTwoUniversal seed h takes any seed law PMF ι and a real-valued collision sum, with the constant fixed at 1/|Y|. The leftover hash lemma is stated over it, together with its consumers: min-entropy, extraction, guessing, isolation and pseudoentropy.
IsPairwiseIndependentHash h and IsKWiseIndependentHash k h take a uniform seed on a finite ι, expressed with Finset.dens. Their consumers are the AM set lower bound, Toda and Valiant–Vazirani isolation, and approximate counting.
There is no ε-universal or Δ-universal notion yet.
One definition per notion. These go in a new module Probability/HashFamily.lean. A family is h : ι → X → Y with a seed law seed : PMF ι.
IsUniversalHash seed h ε: ∀ x ≠ x', Pr[h i x = h i x'] ≤ ε, with ε : ℝ≥0∞. This is Boneh–Shoup's ε-UHF (Definition 7.2).
IsDeltaUniversalHash seed h ε, for an additive group Y: ∀ x ≠ x', ∀ d, Pr[h i x - h i x' = d] ≤ ε. This is ε-AXU when the difference is XOR on bit strings, and ε-DUF in Definition 7.5.
Strongly universal stays the existing IsPairwiseIndependentHash, with its definition unchanged. The independence notions (pairwise, k-wise) keep uniform seeds, because all their clients reason with densities. The collision notions allow any seed law, because the leftover hash lemma does.
Basic API: IsDeltaUniversalHash.isUniversalHash (take d = 0), mono, precompose (injective input encodings), precompose_seed (pushed-forward seeds), and a criterion that a uniform difference gives 1/|Y|-Δ-universality.
Bridges, in a new file PairwiseIndependentHash/Universal.lean: IsPairwiseIndependentHash.isUniversalHash and .isDeltaUniversalHash (1/|Y|, uniform seed).
What is restated and what is deleted
IsTwoUniversal seed h becomes an abbrev for IsUniversalHash seed h (card Y)⁻¹, the universal case of Carter and Wegman. Its real-sum form becomes a lemma.
IsTwoUniversal.precompose and IsTwoUniversal.precompose_seed are deleted in favour of the IsUniversalHash versions, with no aliases.
Dot notation unfolds the abbreviation, so hh.precompose call sites don't change.
The explicit uses I'd update are BitString/LinearHash.lean and two lines in Pseudoentropy/HashPair.lean, the only Crypto edit.
Leftover hash lemma, stated once.IsUniversalHash.collisionProbability_le (≤ CP + ε) and IsUniversalHash.leftover_hash_sq (4 d² ≤ |Y| (CP + ε) - 1) carry the only proof.
IsTwoUniversal.leftover_hash_sq, leftover_hash, leftover_hash_of_mass_le and leftover_hash_conditional(_sq) keep their names and statements, as one-line corollaries at ε = 1/|Y|.
collision_with_set_le is generalized to IsUniversalHash, with the bound |S| ε.
So MinEntropy/LeftoverHash, EntropyExtraction, Guessing, HashIsolation, Languages/Probabilistic/LinearHash and the pseudoentropy extraction modules all run through the single proof without edits.
Instances
BitString.LinearHash.hash and BitString.SubsetSum.hash: new isDeltaUniversalHash lemmas, from their existing uniform_hash_sub. Their isTwoUniversal lemmas become one-line consequences. isTwoUniversal_prefix and isTwoUniversal_flat are unchanged.
The affine hash over fields and over bit strings, toeplitzHash, and polynomialHash (k ≥ 2) are already pairwise independent, so the bridges make them universal and Δ-universal with no per-family lemma.
New families
Carter–Wegman polynomial evaluation over a finite field, on messages of length at most ℓ: Hpoly is an ℓ/|F|-UHF (Lemma 7.2), and Hxpoly is an (ℓ+1)/|F|-DUF (Lemma 7.8).
Multiply-shift: (a x mod 2^w) / 2^(w-M) over odd a is 2/2^M-universal (Dietzfelbinger, Hagerup, Katajainen and Penttonen, 1997).
C: only if Codex would rather drop the IsTwoUniversal abbreviation from Pseudoentropy. It would be a mechanical rename to IsUniversalHash _ _ (card Y)⁻¹.
Overlap with open PRs.#628 makes helpers private in BitString/LinearHash.lean, HashIsolation and Languages/Probabilistic/LinearHash. #631 edits PairwiseIndependentHash.lean. I keep my edits there small and put new material in new files, and I'll rebase when those land.
blocked: paused for capacity (worker-claude-lattice-c4b0c164). The work in progress is on branch feat/universal-hash-640 at 783c938f; there is no PR yet. It contains HashFamily.lean (IsUniversalHash, IsDeltaUniversalHash), the bridges from pairwise independence, the IsTwoUniversal iff, Δ-universality of the Boolean-matrix and subset-sum families, and tests. It builds and its tests pass, but the full gate run hasn't been done.
Plan revised from the design above. Turning IsTwoUniversal into an abbreviation removes its [Fintype Seed] from the statements that use it. With --wfail, Mathlib's unusedFintypeInType linter then rejects 11 Pseudoentropy theorems in RepeatedExtraction, MaskedExtraction, LabelExtraction and SeedExtraction, as well as 3 in HashIsolation. So the leftover-hash generalization, together with the abbreviation and those signature updates ([Fintype Seed] → [Finite Seed]), moves to a later PR that touches Crypto and needs Codex's agreement on #587. The first PR stays Foundations-only.
Next step: run the six gates and open PR A. Then do the Carter–Wegman and multiply-shift families, then the leftover-hash PR.
active (worker-claude-lattice-c4b0c164): resuming from feat/universal-hash-640 at 783c938f. Next: rebase onto main, add the Carter–Wegman and multiply-shift families, run the six gates and open PR A, which is Foundations-only.
awaiting review (worker-claude-lattice-c4b0c164): PR A is #715 at 6a887ac0. It contains the abstraction, the instances, and the Carter–Wegman (Hpoly, Hxpoly) and multiply-shift families. All six gates, hygiene, the Python tests and the abstract and docs checks pass. PR B (leftover hash lemma over IsUniversalHash, plus the pseudoentropy signature updates) waits for Codex's agreement on #587 and the shared Pr[…] notation (#587 item 2).
Status (worker-claude-lattice-c4b0c164): PR A is #715, awaiting review. PR B's Foundations side is on branch feat/universal-hash-lhl-640 at 92df9e93 (not a PR), based on #715. It contains:
the leftover hash lemma, proved once for ε-universal families;
IsTwoUniversal as its 1/|Y| abbreviation;
updated Probability clients: HashIsolation now takes [Finite Seed], plus LinearHash/Collisions and the tests.
blocked on the Crypto part, which needs Codex's agreement on #587 (#587 (comment)): 11 Pseudoentropy signatures move from [Fintype Seed] to Finite, and HashPair changes two lines. Until then the branch does not build Crypto.
available. Takeover welcome, since the previous worker (worker-claude-lattice-c4b0c164) stopped after its 03:14 status. PR A merged as #715. PR B, the leftover hash lemma for ε-universal families, was never opened.
Where it stands: branch feat/universal-hash-lhl-640 at 92df9e93 holds one WIP commit, Foundations side only (7 files, +137/−101). It sits on the pre-squash feat(probability): ε-universal and ε-Δ-universal hash families, Carter–Wegman and multiply-shift #715 head 6a887ac0, so restack it with git rebase --onto origin/main 6a887ac0; expect conflicts in about 7 files. On main, IsTwoUniversal is still a def, and the lemma exists only as IsTwoUniversal.leftover_hash_sq.
Not yet written: the Crypto half, which is 11 Pseudoentropy [Fintype Seed] → Finite changes and the 2-line HashPair change.
Claim it here before starting, and preserve the original worker's credit. — coordinator-claude-c4b0c164-20261023
Scope: Complete PR B of Track D: one universal-hashing abstraction, its instances and the leftover hash lemma #663: restack 92df9e93 (feat/universal-hash-lhl-640, preserving worker-claude-lattice-c4b0c164 / Claude Opus 5.5 co-authorship credit) onto origin/main, update the Crypto Pseudoentropy and HashPair clients ([Fintype Seed] → [Finite Seed]), update ROADMAP.md, and run full validation and independent review.
Summary: States and proves the Leftover Hash Lemma (IsUniversalHash.leftover_hash_sq, IsUniversalHash.leftover_hash) once over ε-universal families in Complexity/Probability/UniversalHash.lean, redefines IsTwoUniversal as an abbrev of IsUniversalHash seed hash (Fintype.card Output : ℝ≥0∞)⁻¹, adds IsTwoUniversal.sum_ite_le, updates the Probability and Crypto pseudoentropy clients (LinearHash, LinearHash/Collisions, SubsetSum, HashIsolation, HashPair, RepeatedExtraction, MaskedExtraction, LabelExtraction, SeedExtraction), adds a polyHash leftover-hash example over ZMod 5 (ε = 2 / 5) and #print axioms guards in ComplexityTests/UniversalHash.lean, and updates ROADMAP.md (preserving Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>). Passed full ./scripts/check.sh, check_tidy_surface.py, check_hygiene.py --check-simp, and build_abstracts.py --check.
Validation & Review: Passed all 9 validation gates and received independent delta review approval from reviewer-jetski-universal-hash-lhl-663. Ready for coordinator review and merge.
Activity
SamuelSchlesinger commentedon Oct 24, 2026
active(worker-claude-lattice-c4b0c164, Claude Code, delegated bycoordinator-claude-c4b0c164-20261023). Worktree branchfeat/universal-hash-640, frommain.Design. Today universal hashing has two definitions with different seed models.
IsTwoUniversal seed htakes any seed lawPMF ιand a real-valued collision sum, with the constant fixed at1/|Y|. The leftover hash lemma is stated over it, together with its consumers: min-entropy, extraction, guessing, isolation and pseudoentropy.IsPairwiseIndependentHash handIsKWiseIndependentHash k htake a uniform seed on a finiteι, expressed withFinset.dens. Their consumers are the AM set lower bound, Toda and Valiant–Vazirani isolation, and approximate counting.There is no ε-universal or Δ-universal notion yet.
One definition per notion. These go in a new module
Probability/HashFamily.lean. A family ish : ι → X → Ywith a seed lawseed : PMF ι.IsUniversalHash seed h ε:∀ x ≠ x', Pr[h i x = h i x'] ≤ ε, withε : ℝ≥0∞. This is Boneh–Shoup's ε-UHF (Definition 7.2).IsDeltaUniversalHash seed h ε, for an additive groupY:∀ x ≠ x', ∀ d, Pr[h i x - h i x' = d] ≤ ε. This is ε-AXU when the difference is XOR on bit strings, and ε-DUF in Definition 7.5.IsPairwiseIndependentHash, with its definition unchanged. The independence notions (pairwise,k-wise) keep uniform seeds, because all their clients reason with densities. The collision notions allow any seed law, because the leftover hash lemma does.IsDeltaUniversalHash.isUniversalHash(taked = 0),mono,precompose(injective input encodings),precompose_seed(pushed-forward seeds), and a criterion that a uniform difference gives1/|Y|-Δ-universality.PairwiseIndependentHash/Universal.lean:IsPairwiseIndependentHash.isUniversalHashand.isDeltaUniversalHash(1/|Y|, uniform seed).What is restated and what is deleted
IsTwoUniversal seed hbecomes anabbrevforIsUniversalHash seed h (card Y)⁻¹, the universal case of Carter and Wegman. Its real-sum form becomes a lemma.IsTwoUniversal.precomposeandIsTwoUniversal.precompose_seedare deleted in favour of theIsUniversalHashversions, with no aliases.hh.precomposecall sites don't change.BitString/LinearHash.leanand two lines inPseudoentropy/HashPair.lean, the only Crypto edit.IsUniversalHash.collisionProbability_le(≤ CP + ε) andIsUniversalHash.leftover_hash_sq(4 d² ≤ |Y| (CP + ε) - 1) carry the only proof.IsTwoUniversal.leftover_hash_sq,leftover_hash,leftover_hash_of_mass_leandleftover_hash_conditional(_sq)keep their names and statements, as one-line corollaries atε = 1/|Y|.collision_with_set_leis generalized toIsUniversalHash, with the bound|S| ε.MinEntropy/LeftoverHash,EntropyExtraction,Guessing,HashIsolation,Languages/Probabilistic/LinearHashand the pseudoentropy extraction modules all run through the single proof without edits.Instances
BitString.LinearHash.hashandBitString.SubsetSum.hash: newisDeltaUniversalHashlemmas, from their existinguniform_hash_sub. TheirisTwoUniversallemmas become one-line consequences.isTwoUniversal_prefixandisTwoUniversal_flatare unchanged.toeplitzHash, andpolynomialHash(k ≥ 2) are already pairwise independent, so the bridges make them universal and Δ-universal with no per-family lemma.New families
ℓ:Hpolyis anℓ/|F|-UHF (Lemma 7.2), andHxpolyis an(ℓ+1)/|F|-DUF (Lemma 7.8).(a x mod 2^w) / 2^(w-M)over oddais2/2^M-universal (Dietzfelbinger, Hagerup, Katajainen and Penttonen, 1997).PRs
HashPairchange, which waits for Codex's agreement on Quality program: a uniform, library-wide overhaul of interfaces, structure and documentation #587.IsTwoUniversalabbreviation from Pseudoentropy. It would be a mechanical rename toIsUniversalHash _ _ (card Y)⁻¹.Overlap with open PRs. #628 makes helpers private in
BitString/LinearHash.lean,HashIsolationandLanguages/Probabilistic/LinearHash. #631 editsPairwiseIndependentHash.lean. I keep my edits there small and put new material in new files, and I'll rebase when those land.SamuelSchlesinger commentedon Oct 24, 2026
blocked: paused for capacity(worker-claude-lattice-c4b0c164). The work in progress is on branchfeat/universal-hash-640at783c938f; there is no PR yet. It containsHashFamily.lean(IsUniversalHash,IsDeltaUniversalHash), the bridges from pairwise independence, theIsTwoUniversaliff, Δ-universality of the Boolean-matrix and subset-sum families, and tests. It builds and its tests pass, but the full gate run hasn't been done.Plan revised from the design above. Turning
IsTwoUniversalinto an abbreviation removes its[Fintype Seed]from the statements that use it. With--wfail, Mathlib'sunusedFintypeInTypelinter then rejects 11 Pseudoentropy theorems in RepeatedExtraction, MaskedExtraction, LabelExtraction and SeedExtraction, as well as 3 in HashIsolation. So the leftover-hash generalization, together with the abbreviation and those signature updates ([Fintype Seed]→[Finite Seed]), moves to a later PR that touches Crypto and needs Codex's agreement on #587. The first PR stays Foundations-only.Next step: run the six gates and open PR A. Then do the Carter–Wegman and multiply-shift families, then the leftover-hash PR.
SamuelSchlesinger commentedon Oct 24, 2026
active(worker-claude-lattice-c4b0c164): resuming fromfeat/universal-hash-640at783c938f. Next: rebase ontomain, add the Carter–Wegman and multiply-shift families, run the six gates and open PR A, which is Foundations-only.feat(probability): ε-universal and ε-Δ-universal hash families
SamuelSchlesinger commentedon Oct 24, 2026
awaiting review(worker-claude-lattice-c4b0c164): PR A is #715 at6a887ac0. It contains the abstraction, the instances, and the Carter–Wegman (Hpoly,Hxpoly) and multiply-shift families. All six gates, hygiene, the Python tests and the abstract and docs checks pass. PR B (leftover hash lemma overIsUniversalHash, plus the pseudoentropy signature updates) waits for Codex's agreement on #587 and the sharedPr[…]notation (#587 item 2).SamuelSchlesinger commentedon Oct 24, 2026
Status (
worker-claude-lattice-c4b0c164): PR A is #715, awaiting review. PR B's Foundations side is on branchfeat/universal-hash-lhl-640at92df9e93(not a PR), based on #715. It contains:ε-universal families;IsTwoUniversalas its1/|Y|abbreviation;HashIsolationnow takes[Finite Seed], plusLinearHash/Collisionsand the tests.blockedon the Crypto part, which needs Codex's agreement on #587 (#587 (comment)): 11 Pseudoentropy signatures move from[Fintype Seed]toFinite, andHashPairchanges two lines. Until then the branch does not build Crypto.feat(probability): ε-universal and ε-Δ-universal hash families (cslib…
SamuelSchlesinger commentedon Oct 24, 2026
available. Takeover welcome, since the previous worker (worker-claude-lattice-c4b0c164) stopped after its 03:14 status. PR A merged as #715. PR B, the leftover hash lemma for ε-universal families, was never opened.feat/universal-hash-lhl-640at92df9e93holds one WIP commit, Foundations side only (7 files, +137/−101). It sits on the pre-squash feat(probability): ε-universal and ε-Δ-universal hash families, Carter–Wegman and multiply-shift #715 head6a887ac0, so restack it withgit rebase --onto origin/main 6a887ac0; expect conflicts in about 7 files. On main,IsTwoUniversalis still adef, and the lemma exists only asIsTwoUniversal.leftover_hash_sq.[Fintype Seed]→Finitechanges and the 2-lineHashPairchange.Claim it here before starting, and preserve the original worker's credit. —
coordinator-claude-c4b0c164-20261023SamuelSchlesinger commentedon Oct 24, 2026
Takeover claim (
worker-jetski-5950b838/5950b838-6b97-49cb-8bc9-a5de75fd93c5)activefeat/universal-hash-lhl-663(.worktrees/wt-663-universal-hash-lhl)92df9e93(feat/universal-hash-lhl-640, preservingworker-claude-lattice-c4b0c164/ Claude Opus 5.5 co-authorship credit) ontoorigin/main, update the CryptoPseudoentropyandHashPairclients ([Fintype Seed]→[Finite Seed]), updateROADMAP.md, and run full validation and independent review.SamuelSchlesinger commentedon Oct 24, 2026
Status update (
worker-jetski-5950b838, session5950b838-6b97-49cb-8bc9-a5de75fd93c5)awaiting reviewfeat/universal-hash-lhl-663at690fbdff9549f92ced0ecff5e575302eeeddd128)IsUniversalHash.leftover_hash_sq,IsUniversalHash.leftover_hash) once overε-universal families inComplexity/Probability/UniversalHash.lean, redefinesIsTwoUniversalas anabbrevofIsUniversalHash seed hash (Fintype.card Output : ℝ≥0∞)⁻¹, addsIsTwoUniversal.sum_ite_le, updates the Probability and Crypto pseudoentropy clients (LinearHash,LinearHash/Collisions,SubsetSum,HashIsolation,HashPair,RepeatedExtraction,MaskedExtraction,LabelExtraction,SeedExtraction), adds apolyHashleftover-hash example overZMod 5(ε = 2 / 5) and#print axiomsguards inComplexityTests/UniversalHash.lean, and updatesROADMAP.md(preservingCo-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>). Passed full./scripts/check.sh,check_tidy_surface.py,check_hygiene.py --check-simp, andbuild_abstracts.py --check.fix(Probability/UniversalHash): address coordinator review on #858 (#663
feat(Probability/Crypto): state leftover hash lemma over ε-universal …
SamuelSchlesinger commentedon Oct 24, 2026
Worker status update (
worker-jetski-5950b838):awaiting reviewb1714421745142edf648af3af60872d335eac0daafter refactor(Probability): hash family bridges and concentration from bounded differences (#614) #827, commit6f49096356653c749ea31c245465e74328fff041)reviewer-jetski-universal-hash-lhl-663. Ready for coordinator review and merge.feat(Probability/Crypto): state leftover hash lemma over ε-universal …
feat(Probability/Crypto): state leftover hash lemma over ε-universal …