Documentation

CslibFrontier.Probability.PairwiseIndependentHash.ConditionalAveraging

Conditional averaging on retention slices #

A retention slice (Cslib.Probability.RetentionSlice) is the set of frame-conditioned channels A = (a₀, F) that retain a fixed identifier y; its uniform law is the channel law conditioned on retaining y. In the coordinates (F, w) of sliceEquiv, with w ∈ ZMod L ^ H the value at y, an integer matrix g of determinant one and an integer vector c act by the affine move

coordMove g c (F, w) = (g F mod P, g w + c mod L).

Any regular multigraph G on the coordinates transports to a walk on every slice (sliceGraph), with the same spectral expansion (spectralExpansion_sliceGraph). Hence a single spectral-gap bound for G, independent of y, gives conditional averaging: on every slice, the walk of length t contracts the conditional variance by λ(G) ^ (2 t) (expect_walk_pow_sliceGraph_sub_expect_sq_le). The bound for the walk of the preprint's affine moves on frames (the frame-lifted gap) is a hypothesis here; later work supplies it.

Validated variants. The move on a slice refers to y, but it is realized by permutations of the full channel space that do not:

variantMove L g c z (a₀, F) = (g a₀ + c + L z, g F) mod P,

one for each integer wrap vector z. Each variant is a bijection of all channels. Computing x = g w + c over the integers from the representatives w of A.eval y, the wrap test IsValidWrap L g c z (A.eval y) checks that x + L z lies in {0, …, L - 1} ^ H. Exactly one z passes, namely wrap L g c (A.eval y) = -⌊x / L⌋ (isValidWrap_iff), and it lies in the fixed box |z i| ≤ ∑ j, |g i j| + |c i| for every side length (abs_wrap_le). On a channel retaining y, that variant is the affine move (variantMove_wrap_eq). So the sum of the passing variants over any candidate set of wraps is the move (sum_ite_isValidWrap), and the walk of a family of moves on a slice is the average over moves of these sums (walk_sliceGraph_ofPerms_eq).

This formalizes ideas of Section 6 of the OpenAI preprint [OAI26e]: the coordinates and the action (F, w) ↦ (MF, Mw + c) in the proof of Lemma 6.2, and the variants A' = MA + (c + Lz) e₁ᵀ (mod P) with their unique valid wrap zᵢ = -⌊(Mw + c)ᵢ / L⌋ in the proof of Lemma 6.3 (items 1–4 for a single step). The preprint's walk uses the elementary generators of SL_H(ℤ) ⋉ ℤ^H and its gap comes from property (T) (Lemma 6.1); here the walk and its gap are left abstract. Transitivity of the action, the product over several channels, and L^s bounds for s > 2 are not part of this module.

Main definitions #

Main results #

References #

def Cslib.Probability.affineSL {n : Type u_1} [Fintype n] [DecidableEq n] (R : Type u_2) [CommRing R] (g : Matrix.SpecialLinearGroup n ℤ) (c : n → R) :
Equiv.Perm (n → R)

The affine permutation v ↦ g v + c of R ^ n, for an integer matrix g of determinant one reduced into R.

@[simp]
theorem Cslib.Probability.affineSL_apply {n : Type u_1} [Fintype n] [DecidableEq n] (R : Type u_2) [CommRing R] (g : Matrix.SpecialLinearGroup n ℤ) (c v : n → R) :
def Cslib.Probability.coordMove {P H r L : ℕ} (g : Matrix.SpecialLinearGroup (Fin H) ℤ) (c : Fin H → ℤ) :
Equiv.Perm (Frame P H r × (Fin H → ZMod L))

The affine move (F, w) ↦ (g F, g w + c) on slice coordinates: g acts on the frame modulo P and on the box coordinate modulo L.

The inverse of the move by (g, c) is the move by (g⁻¹, -g⁻¹ c).

def Cslib.Probability.sliceGraph {P H r : ℕ} (L : ℕ) [NeZero P] [NeZero L] (hL : L ≤ P) (y : ZMod P) {D : Type u_1} (G : RotationMap (Frame P H r × (Fin H → ZMod L)) D) :

A graph G on slice coordinates, transported to the retention slice of y.

@[simp]
theorem Cslib.Probability.spectralExpansion_sliceGraph {P H r L : ℕ} [NeZero P] [NeZero L] (hL : L ≤ P) (y : ZMod P) {D : Type u_1} [Fintype D] (G : RotationMap (Frame P H r × (Fin H → ZMod L)) D) :

The walk on a slice has the spectral expansion of the walk on coordinates, for every identifier y.

theorem Cslib.Probability.expect_walk_pow_sliceGraph_sub_expect_sq_le {P H r L : ℕ} [NeZero P] [NeZero L] (hL : L ≤ P) {D : Type u_1} [Fintype D] [Nonempty D] (G : RotationMap (Frame P H r × (Fin H → ZMod L)) D) {lam : ℝ} (hG : G.spectralExpansion ≤ lam) (y : ZMod P) (f : RetentionSlice P H r L y → ℝ) (t : ℕ) :
(Finset.univ.expect fun (A : RetentionSlice P H r L y) => (((sliceGraph L hL y G).walk ^ t) f A - Finset.univ.expect fun (B : RetentionSlice P H r L y) => f B) ^ 2) ≤ lam ^ (2 * t) * Finset.univ.expect fun (A : RetentionSlice P H r L y) => (f A - Finset.univ.expect fun (B : RetentionSlice P H r L y) => f B) ^ 2

Conditional averaging. Let G be any regular multigraph on the slice coordinates, for example the walk of affine moves, whose spectral expansion is at most λ. Then on the retention slice of every identifier y, the walk of length t contracts the conditional variance by λ ^ (2 t), uniformly in y; the conditional mean is preserved (expect_walk_pow). The bound λ is the hypothesis that the frame-lifted gap must supply.

Validated variants #

A validated-walk variant: the permutation (a₀, F) ↦ (g a₀ + c + L z, g F) of all channels, modulo P. It does not depend on any identifier.

theorem Cslib.Probability.eval_variantMove {P H r L : ℕ} (g : Matrix.SpecialLinearGroup (Fin H) ℤ) (c z : Fin H → ℤ) (A : FrameChannel P H r) (y : ZMod P) :
((variantMove L g c z) A).eval y = (↑((Matrix.SpecialLinearGroup.map (Int.castRingHom (ZMod P))) g)).mulVec (A.eval y) + fun (i : Fin H) => ↑(c i + ↑L * z i)

A variant acts on the value at every identifier by the same affine map.

def Cslib.Probability.wrapTarget {P H : ℕ} (g : Matrix.SpecialLinearGroup (Fin H) ℤ) (c : Fin H → ℤ) (w : Fin H → ZMod P) :
Fin H → ℤ

The integer vector g w + c, computed from the representatives w of a value.

def Cslib.Probability.IsValidWrap {P H : ℕ} (L : ℕ) (g : Matrix.SpecialLinearGroup (Fin H) ℤ) (c z : Fin H → ℤ) (w : Fin H → ZMod P) :

The wrap test for a variant: g w + c + L z, computed over the integers from the representatives w of the value, lies in {0, …, L - 1} ^ H.

Instances For
    @[instance_reducible]
    instance Cslib.Probability.instDecidableIsValidWrap {P H L : ℕ} (g : Matrix.SpecialLinearGroup (Fin H) ℤ) (c z : Fin H → ℤ) (w : Fin H → ZMod P) :
    def Cslib.Probability.wrap {P H : ℕ} (L : ℕ) (g : Matrix.SpecialLinearGroup (Fin H) ℤ) (c : Fin H → ℤ) (w : Fin H → ZMod P) :
    Fin H → ℤ

    The valid wrap z = -⌊(g w + c) / L⌋.

    theorem Cslib.Probability.isValidWrap_iff {P H L : ℕ} [NeZero L] {g : Matrix.SpecialLinearGroup (Fin H) ℤ} {c z : Fin H → ℤ} {w : Fin H → ZMod P} :
    IsValidWrap L g c z w ↔ z = wrap L g c w

    Uniqueness of the valid wrap: exactly one wrap vector passes the test.

    theorem Cslib.Probability.abs_wrap_le {P H L : ℕ} [NeZero P] [NeZero L] (g : Matrix.SpecialLinearGroup (Fin H) ℤ) (c : Fin H → ℤ) {w : Fin H → ZMod P} (hw : w ∈ retentionBox P H L) (i : Fin H) :
    |wrap L g c w i| ≤ ∑ j : Fin H, |↑g i j| + |c i|

    The wrap box: for a value in the retention box, the valid wrap satisfies |z i| ≤ ∑ j, |g i j| + |c i|, a bound independent of L and P. So finitely many variants per move suffice for every side length.

    theorem Cslib.Probability.variantMove_wrap_eq {P H r L : ℕ} [NeZero P] [NeZero L] (hL : L ≤ P) {y : ZMod P} (g : Matrix.SpecialLinearGroup (Fin H) ℤ) (c : Fin H → ℤ) (A : RetentionSlice P H r L y) :
    (variantMove L g c (wrap L g c ((↑A).eval y))) ↑A = ↑((sliceEquiv hL y).symm ((coordMove g c) ((sliceEquiv hL y) A)))

    The valid variant is the conditional move. On a channel retaining y, the variant with the valid wrap maps it to the channel with coordinates coordMove g c (F, w). In particular it retains y again.

    theorem Cslib.Probability.sum_ite_isValidWrap {P H r L : ℕ} [NeZero P] [NeZero L] (hL : L ≤ P) {y : ZMod P} {M : Type u_1} [AddCommMonoid M] (g : Matrix.SpecialLinearGroup (Fin H) ℤ) (c : Fin H → ℤ) (A : RetentionSlice P H r L y) {Z : Finset (Fin H → ℤ)} (hZ : wrap L g c ((↑A).eval y) ∈ Z) (f : FrameChannel P H r → M) :
    (∑ z ∈ Z, if IsValidWrap L g c z ((↑A).eval y) then f ((variantMove L g c z) ↑A) else 0) = f ↑((sliceEquiv hL y).symm ((coordMove g c) ((sliceEquiv hL y) A)))

    Exactly one variant survives (Lemma 6.3, items 3 and 4, for one step). For a channel retaining y and any candidate set Z of wraps containing the valid one, the sum over Z of the variants passing the wrap test is the value at the conditional move.

    The forward move of a generator (g, c) for b = false, and its inverse for b = true.

    theorem Cslib.Probability.walk_sliceGraph_ofPerms_eq {P H r L : ℕ} [NeZero P] [NeZero L] (hL : L ≤ P) {y : ZMod P} {K : Type u_1} [Fintype K] (σ : K → Matrix.SpecialLinearGroup (Fin H) ℤ × (Fin H → ℤ)) {Z : Finset (Fin H → ℤ)} (hZ : ∀ (k : K) (b : Bool), ∀ w ∈ retentionBox P H L, wrap L (signedMove (σ k) b).1 (signedMove (σ k) b).2 w ∈ Z) (f : FrameChannel P H r → ℝ) (A : RetentionSlice P H r L y) :
    (sliceGraph L hL y (RotationMap.ofPerms fun (k : K) => coordMove (σ k).1 (σ k).2)).walk (fun (B : RetentionSlice P H r L y) => f ↑B) A = Finset.univ.expect fun (kb : K × Bool) => ∑ z ∈ Z, if IsValidWrap L (signedMove (σ kb.1) kb.2).1 (signedMove (σ kb.1) kb.2).2 z ((↑A).eval y) then f ((variantMove L (signedMove (σ kb.1) kb.2).1 (signedMove (σ kb.1) kb.2).2 z) ↑A) else 0

    The conditional walk as an average of valid variants. For a family σ of affine generators, the walk of ofPerms of their moves, transported to the slice of y, applied to a function f of the channel, is the average over generators and directions of the sums of the valid variants.