Documentation

CslibFrontier.DataStructure.Dictionary.KickTree.RoundSeed

Case A unbalanced Feistel transfer and concrete Double-Tabulation round-seed parameters #

This module formalizes the Case A 2-round unbalanced Feistel bijection (caseAEquiv), its abstract (1 - δ)-w.h.p. κ-wise distributional transfer (dist_caseA_restrict_le), and the concrete Double-Tabulation + oddMulModWord round-function parameter schedule (quotientPermInd, quotientPermThreshold, reduceBits, reducedDoubleTab) together with its failure-event and Naor–Reingold contraction bounds for CslibFrontier.DataStructure.Dictionary.KickTree.QuotientPerm.

Main definitions #

Main results #

References #

Section 1: Case A 2-round unbalanced Feistel bijection and abstract transfer #

Logarithmic bit-gap threshold (c + 3) * ⌈log₂ (max n 2)⌉ separating Case A (m + gap ≤ a, 2-round unbalanced Feistel) from Case B (a < m + gap, sharded Naor–Reingold).

Round-function pair for the Case A 2-round unbalanced Feistel bijection on Fin (2 ^ a).

  • g₀ : Fin (2 ^ m) → Fin (2 ^ (a - m))

    Round 1 quotient mask Fin (2 ^ m) → Fin (2 ^ (a - m)).

  • g₁ : Fin (2 ^ (a - m)) → Fin (2 ^ m)

    Round 2 bucket mask Fin (2 ^ (a - m)) → Fin (2 ^ m).

def Cslib.DataStructure.Dictionary.KickTree.caseAEquiv {a m : ℕ} (hma : m ≤ a) (r : CaseARounds a m) :
Fin (2 ^ a) ≃ Fin (2 ^ m) × Fin (2 ^ (a - m))

Case A 2-round unbalanced Feistel bijection Fin (2 ^ a) ≃ Fin (2 ^ m) × Fin (2 ^ (a - m)) sending (x_L, x_R) = bitDomainEquiv hma u to (x_L ^^^ g₁ (x_R ^^^ g₀ x_L), x_R ^^^ g₀ x_L).

def Cslib.DataStructure.Dictionary.KickTree.caseAQuot {a m : ℕ} (hma : m ≤ a) (g₀ : Fin (2 ^ m) → Fin (2 ^ (a - m))) (u : Fin (2 ^ a)) :
Fin (2 ^ (a - m))

Case A Round-1 quotient q(u) = x_R ^^^ g₀ x_L : Fin (2 ^ (a - m)).

@[simp]
theorem Cslib.DataStructure.Dictionary.KickTree.caseAEquiv_apply {a m : ℕ} (hma : m ≤ a) (r : CaseARounds a m) (u : Fin (2 ^ a)) :
(caseAEquiv hma r) u = (((FeistelPerm.bitDomainEquiv hma) u).1 ^^^ r.g₁ (caseAQuot hma r.g₀ u), caseAQuot hma r.g₀ u)
@[simp]
theorem Cslib.DataStructure.Dictionary.KickTree.caseAEquiv_symm_apply {a m : ℕ} (hma : m ≤ a) (r : CaseARounds a m) (p : Fin (2 ^ m) × Fin (2 ^ (a - m))) :
(caseAEquiv hma r).symm p = (FeistelPerm.bitDomainEquiv hma).symm (p.1 ^^^ r.g₁ p.2, p.2 ^^^ r.g₀ (p.1 ^^^ r.g₁ p.2))
def Cslib.DataStructure.Dictionary.KickTree.splitBucketAuxEquiv (m b_aux : ℕ) :
Fin (2 ^ (m + b_aux)) ≃ Fin (2 ^ m) × Fin (2 ^ b_aux)

Split Fin (2 ^ (m + b_aux)) ≃ Fin (2 ^ m) × Fin (2 ^ b_aux).

def Cslib.DataStructure.Dictionary.KickTree.caseABucketAux {a m b_aux : ℕ} (hma : m ≤ a) (g₀ : Fin (2 ^ m) → Fin (2 ^ (a - m))) (f₁₂ : Fin (2 ^ (a - m)) → Fin (2 ^ (m + b_aux))) (u : Fin (2 ^ a)) :
Fin (2 ^ m) × Fin (2 ^ b_aux)

Case A combined (bucket, aux) evaluation given Round-1 quotient function g₀ and combined Round-2 (m + b_aux)-bit hash f₁₂ : Fin (2 ^ (a - m)) → Fin (2 ^ (m + b_aux)).

theorem Cslib.DataStructure.Dictionary.KickTree.dens_not_injOn_caseAQuot_le {ι₀ : Type u_1} [Fintype ι₀] [Nonempty ι₀] {a m : ℕ} (hma : m ≤ a) {h₀ : ι₀ → Fin (2 ^ m) → Fin (2 ^ (a - m))} (S : Finset (Fin (2 ^ a))) (hh₀ : Probability.IsPairwiseIndependentHash fun (s₀ : ι₀) (x : ↥(Finset.image (fun (u : Fin (2 ^ a)) => ((FeistelPerm.bitDomainEquiv hma) u).1) S)) => h₀ s₀ ↑x) :
↑{s₀ : ι₀ | ¬Set.InjOn (caseAQuot hma (h₀ s₀)) ↑S}.dens ≤ ↑(S.card * (S.card - 1)) / (2 * 2 ^ (a - m))

Pairwise-independent Round-1 quotient collision bound in Case A (via FeistelPerm.dens_not_injOn_feistelHead_le), requiring pairwise independence only on the active left-coordinate image S.image fun u => (bitDomainEquiv hma u).1.

theorem Cslib.DataStructure.Dictionary.KickTree.isKWiseIndependentHash_caseABucketAux_of_comp {ι₁ : Type u_1} [Fintype ι₁] {a m b_aux κ : ℕ} (hma : m ≤ a) {g₀ : Fin (2 ^ m) → Fin (2 ^ (a - m))} {S : Finset (Fin (2 ^ a))} {h₁₂ : ι₁ → Fin (2 ^ (a - m)) → Fin (2 ^ (m + b_aux))} (hcomp : Probability.IsKWiseIndependentHash κ fun (s₁ : ι₁) (u : ↥S) => h₁₂ s₁ (caseAQuot hma g₀ ↑u)) :
Probability.IsKWiseIndependentHash κ fun (s₁ : ι₁) (u : ↥S) => caseABucketAux hma g₀ (h₁₂ s₁) ↑u
theorem Cslib.DataStructure.Dictionary.KickTree.isKWiseIndependentHash_caseABucketAux_of_injOn {ι₁ : Type u_1} [Fintype ι₁] {a m b_aux κ : ℕ} (hma : m ≤ a) {g₀ : Fin (2 ^ m) → Fin (2 ^ (a - m))} {S : Finset (Fin (2 ^ a))} (hinj : Set.InjOn (caseAQuot hma g₀) ↑S) {h₁₂ : ι₁ → Fin (2 ^ (a - m)) → Fin (2 ^ (m + b_aux))} (hh₁₂ : Probability.IsKWiseIndependentHash κ fun (s₁ : ι₁) (q : ↥(Finset.image (caseAQuot hma g₀) S)) => h₁₂ s₁ ↑q) :
Probability.IsKWiseIndependentHash κ fun (s₁ : ι₁) (u : ↥S) => caseABucketAux hma g₀ (h₁₂ s₁) ↑u

When caseAQuot hma g₀ is injective on S and h₁₂ is κ-wise independent on the active quotient image S.image (caseAQuot hma g₀), the induced (bucket, aux) family on S is exact κ-wise independent (IsKWiseIndependentHash κ).

theorem Cslib.DataStructure.Dictionary.KickTree.dist_caseA_restrict_le {Top : Type u_1} {ι₀ : Type u_2} {ι₁ : Type u_3} [Fintype Top] [Nonempty Top] [Fintype ι₀] [Nonempty ι₀] [Fintype ι₁] [Nonempty ι₁] {a m b_aux : ℕ} (hma : m ≤ a) (h₀ : Top → ι₀ → Fin (2 ^ m) → Fin (2 ^ (a - m))) (h₁₂ : Top → ι₁ → Fin (2 ^ (a - m)) → Fin (2 ^ (m + b_aux))) (S T : Finset (Fin (2 ^ a))) (GoodTop : Set Top) {δ_top δ₁ : ℝ} (hδ₁ : 0 ≤ δ₁) (hδ_top : ((Probability.PMF.uniformOfFintype Top).toOuterMeasure GoodTopᶜ).toReal ≤ δ_top) (hgood₀ : ∀ τ ∈ GoodTop, Probability.IsPairwiseIndependentHash fun (s₀ : ι₀) (x : ↥(Finset.image (fun (u : Fin (2 ^ a)) => ((FeistelPerm.bitDomainEquiv hma) u).1) S)) => h₀ τ s₀ ↑x) (hgood₁₂ : ∀ τ ∈ GoodTop, ∀ (s₀ : ι₀), Set.InjOn (caseAQuot hma (h₀ τ s₀)) ↑S → dist (PMF.map (fun (s₁ : ι₁) (u : ↥T) => caseABucketAux hma (h₀ τ s₀) (h₁₂ τ s₁) ↑u) (Probability.PMF.uniformOfFintype ι₁)) (Probability.PMF.uniformOfFintype (↥T → Fin (2 ^ m) × Fin (2 ^ b_aux))) ≤ δ₁) :
dist ((Probability.PMF.uniformOfFintype Top).bind fun (τ : Top) => (Probability.PMF.uniformOfFintype ι₀).bind fun (s₀ : ι₀) => PMF.map (fun (s₁ : ι₁) (u : ↥T) => caseABucketAux hma (h₀ τ s₀) (h₁₂ τ s₁) ↑u) (Probability.PMF.uniformOfFintype ι₁)) (Probability.PMF.uniformOfFintype (↥T → Fin (2 ^ m) × Fin (2 ^ b_aux))) ≤ δ_top + ↑(S.card * (S.card - 1)) / (2 * 2 ^ (a - m)) + δ₁

Abstract Case A distributional transfer: over a three-stage seed (τ, s₀, s₁) where τ ∈ GoodTop (failure probability ≤ δ_top) makes h₀ τ pairwise independent on the active left-coordinate image of S and h₁₂ τ within δ₁ of uniform whenever caseAQuot hma (h₀ τ s₀) is injective on S, the restriction of caseABucketAux to T is within statistical distance δ_top + (#S * (#S - 1)) / (2 * 2 ^ (a - m)) + δ₁ of uniform.

Section 2: Concrete Double-Tabulation + oddMulModWord parameters and failure bounds #

Number of composed 3-round Naor–Reingold blocks 18 * (c + 2) = O(c) in Case B.

Logarithmic independence order κ = 8 * (c + 3) * ⌈log₂ (max n 2)⌉ = Θ(c log n).

Multiply-shift reduced bit-width R = (c + 5) * ⌈log₂ (max n 4)⌉.

Double-tabulation character bit-width b = max 1 (⌊log₂ n⌋ / 4).

Number of input characters c_tab = 8 * (c + 5) for the shared top-level table.

Code repetition parameter q_tab = 4 * c + 11 in DoubleTabulation.card_not_isKUnique_le.

Number of intermediate characters d_tab = 2 * q_tab * c_tab.

Finite-size capacity threshold N₀(c) = 2 ^ (4 * quotientPermMinB c).

def Cslib.DataStructure.Dictionary.KickTree.reduceBits (s_in R : ℕ) (α : Fin (2 ^ (s_in - 1))) (x : Fin (2 ^ s_in)) :
Fin (2 ^ min s_in R)

Bit-width reduction Fin (2 ^ s_in) → Fin (2 ^ min s_in R) via multiplyShiftReduced.

theorem Cslib.DataStructure.Dictionary.KickTree.val_reduceBits_eq_oddMulModWord {s_in R : ℕ} (hs : 0 < s_in) (α : Fin (2 ^ (s_in - 1))) (x : Fin (2 ^ s_in)) :
↑(reduceBits s_in R α x) = Probability.oddMulModWord s_in ↑α ↑x >>> (s_in - R)

Overflow-free Word-RAM equivalence via ReducedLimbs.oddMulModWord.

Reduced double-tabulation round function Fin (2 ^ s_in) → Fin (2 ^ s_out).

theorem Cslib.DataStructure.Dictionary.KickTree.prob_not_injOn_reduceBits_le {c n s_in : ℕ} (hn : quotientPermThreshold c ≤ n) (X : Finset (Fin (2 ^ s_in))) (hX : X.card ≤ n) :
((Probability.PMF.uniformOfFintype (Fin (2 ^ (s_in - 1)))).toOuterMeasure {α : Fin (2 ^ (s_in - 1)) | Set.InjOn (reduceBits s_in (quotientPermRedBits c n) α) ↑X}ᶜ).toReal ≤ 1 / (16 * ↑n ^ (c + 1))

Multiply-shift reduction non-injectivity bound ≤ 1 / (16 * n ^ (c + 1)) on any #X ≤ n.

theorem Cslib.DataStructure.Dictionary.KickTree.nr_contraction_quotientPerm_le {c n a' : ℕ} (hn : quotientPermThreshold c ≤ n) (ha' : 2 * quotientPermCharBits n ≤ a') :
1 / 2 * (3 * ↑(quotientPermInd c n) ^ 2 / 2 ^ nrHalfLow a') ^ nrRounds c ≤ 1 / (8 * ↑n ^ (c + 2))

Quantitative Naor–Reingold contraction bound ≤ 1 / (8 * n ^ (c + 2)) for nrRounds c blocks whenever 2 * quotientPermCharBits n ≤ a' and quotientPermThreshold c ≤ n.

@[reducible, inline]

Bottom-level simple-tabulation seed bundle for all nrRounds c Case B Naor–Reingold blocks.

Concrete 4-stage Case A statistical-distance bound for caseABucketAux instantiated with reducedDoubleTab over uniform (Top, α₀, BotA₀, α₁, BotA₁₂) (≤ 1 / n ^ (c + 1)), proved via dist_caseA_restrict_le and isKWiseIndependentHash_caseABucketAux_of_injOn.

theorem Cslib.DataStructure.Dictionary.KickTree.prob_doubleTab_bucketLoad_outside_le {c n s_in s_out k_mom : ℕ} (hn : quotientPermThreshold c ≤ n) (hs_in : s_in ≤ quotientPermChars c * quotientPermCharBits n) (hk_pos : 1 ≤ k_mom) (hk_ind : 2 * k_mom ≤ quotientPermInd c n) (S_sh : Finset (Fin (2 ^ s_out) × Fin (2 ^ s_in))) {a_dev : ℝ} (hk_mu : 2 * ↑k_mom ≤ 3 * (↑S_sh.card / 2 ^ s_out)) (ha_dev : 0 < a_dev) :

Concrete double-tabulation 1-round Feistel shard-load tail bound via FeistelPerm.dens_exists_bucketLoad_sub_ge_le.