Documentation

CslibFrontier.Crypto.Game.CloseTo.IntBox

Statistical distance of the integer-box samplers #

sampleIntBox B width factors through the residue sampler ProbComp.sampleModNat width (2 * B + 1), so closeTo_uniform_sampleModNat bounds its distance from the exact uniform law on [-B, B] by (2 * B + 1) / 2 ^ width. The m-coordinate samplers lose at most this much per coordinate. The dyadic centered sampler is exact.

Main results #

theorem Cslib.Probability.closeTo_uniformBox1D_sampleIntBox (B width : ℕ) :
CloseTo (uniformBox1D B) (sampleIntBox B width).eval ((2 * ↑B + 1) / 2 ^ width)

1D box sampler statistical distance. sampleIntBox B width is within (2 * B + 1) / 2 ^ width of the exact uniform distribution uniformBox1D B on [-B, B].

theorem Cslib.Probability.closeTo_uniform_intBox_sampleIntBoxVec (B m width : ℕ) :
CloseTo (PMF.uniformOfFinset (intBox (Fin m) B) ⋯) (sampleIntBoxVec B m width).eval (↑m * ((2 * ↑B + 1) / 2 ^ width))

Multi-coordinate box sampler statistical distance (vector form). sampleIntBoxVec B m width is within m * ((2 * B + 1) / 2 ^ width) of the exact uniform distribution on intBox (Fin m) B = [-B, B]^m.

theorem Cslib.Probability.closeTo_uniform_intBox_sampleIntBoxList (B m width : ℕ) :
CloseTo (PMF.map List.ofFn (PMF.uniformOfFinset (intBox (Fin m) B) ⋯)) (sampleIntBoxList B m width).eval (↑m * ((2 * ↑B + 1) / 2 ^ width))

Multi-coordinate box sampler statistical distance (list form). sampleIntBoxList B m width is within m * ((2 * B + 1) / 2 ^ width) of the encoded uniform distribution on intBox (Fin m) B.

sampleDyadicIntBox width has 0 statistical distance from uniformDyadicIntBox width.