Documentation

CslibFrontier.Computability.Probabilistic.DiscreteGaussian1D

Strict-PPT 1-D discrete Gaussian sampler (sampleZ) #

This module constructs the finite-parameter strict probabilistic polynomial-time (IsPPTOn) 1-D discrete Gaussian sampler Cslib.Probability.sampleZ together with explicit statistical-distance (CloseTo) and support-radius certificates, without matrix or determinant dependencies.

On input inp : SampleZInput with rational squared width sSq = s² > 0 and rational center c, each trial draws a uniform integer proposal from the padded interval [⌊c⌋ - R, ⌊c⌋ + R] about ⌊c⌋ (with R = ⌊√⌊t² · s²⌋⌋ + 2), containing the paper's window ℤ ∩ [c - s · t, c + s · t], and accepts via a prec-bit dyadic coin computed by the deterministic fixed-point Machin-π and range-reduced exp(-z) primitives in CslibFrontier.Computability.PolyTime.FixedPointExp. Repeating for at most maxTrials blocks with timeout fallback ⌊c⌋ realizes the capped-trial variant of [GPV08], §4.1, Lemmas 4.2–4.3 (pp. 14–15). The asymptotic ω(log n) endpoint is not formalized here (tracked in #6861 and #1213).

Main definitions #

Main results #

References #

1. SampleZInput, search radius, weight numerator, and sampleZ #

Input specification for the 1-D discrete Gaussian sampler sampleZ.

  • sSq : ℚ

    Rational squared Gaussian width s² > 0.

  • center : ℚ

    Rational center c.

  • tail : ℕ

    Unary tail-cutoff multiplier t.

  • prec : ℕ

    Unary dyadic acceptance-coin precision prec.

  • maxTrials : ℕ

    Unary rejection-trial cap maxTrials.

Instances For
    theorem Cslib.Probability.SampleZInput.enc_mk_inO {γ : Type} {encIn : γ ↪ List Bool} {x0 : γ → ℚ} {T0 S0 : γ → ℕ} {x1 : γ → ℚ} {T1 S1 x2 T2 S2 x3 T3 S3 x4 T4 S4 : γ → ℕ} (h0 : Turing.MultiTapeTM.ComputableInO x0 encIn Turing.MultiTapeTM.encRat T0 S0) (h1 : Turing.MultiTapeTM.ComputableInO x1 encIn Turing.MultiTapeTM.encRat T1 S1) (h2 : Turing.MultiTapeTM.ComputableInO x2 encIn Turing.MultiTapeTM.encUnary T2 S2) (h3 : Turing.MultiTapeTM.ComputableInO x3 encIn Turing.MultiTapeTM.encUnary T3 S3) (h4 : Turing.MultiTapeTM.ComputableInO x4 encIn Turing.MultiTapeTM.encUnary T4 S4) :
    Turing.MultiTapeTM.ComputableInO (fun (x : γ) => { sSq := x0 x, center := x1 x, tail := x2 x, prec := x3 x, maxTrials := x4 x }) encIn enc (fun (x : γ) => T0 x + (T1 x + (T2 x + (T3 x + T4 x)))) fun (x : γ) => S0 x + (S1 x + (S2 x + (S3 x + S4 x)))
    theorem Cslib.Probability.SampleZInput.enc_mk_budget {γ : Type} {encIn : γ ↪ List Bool} {budget : γ → ℕ} {x0 x1 : γ → ℚ} {x2 x3 x4 : γ → ℕ} (h0 : Turing.MultiTapeTM.ComputableInSpace x0 encIn Turing.MultiTapeTM.encRat budget) (h1 : Turing.MultiTapeTM.ComputableInSpace x1 encIn Turing.MultiTapeTM.encRat budget) (h2 : Turing.MultiTapeTM.ComputableInSpace x2 encIn Turing.MultiTapeTM.encUnary budget) (h3 : Turing.MultiTapeTM.ComputableInSpace x3 encIn Turing.MultiTapeTM.encUnary budget) (h4 : Turing.MultiTapeTM.ComputableInSpace x4 encIn Turing.MultiTapeTM.encUnary budget) :
    Turing.MultiTapeTM.ComputableInSpace (fun (x : γ) => { sSq := x0 x, center := x1 x, tail := x2 x, prec := x3 x, maxTrials := x4 x }) encIn enc budget
    theorem Cslib.Probability.SampleZInput.enc_prec_budget {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {S✝ : γ✝ → ℕ} {g✝ : γ✝ → SampleZInput} :
    Turing.MultiTapeTM.ComputableInSpace g✝ encIn✝ enc S✝ → Turing.MultiTapeTM.ComputableInSpace (fun (c : γ✝) => (g✝ c).prec) encIn✝ Turing.MultiTapeTM.encUnary S✝
    theorem Cslib.Probability.SampleZInput.enc_center_budget {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {S✝ : γ✝ → ℕ} {g✝ : γ✝ → SampleZInput} :
    Turing.MultiTapeTM.ComputableInSpace g✝ encIn✝ enc S✝ → Turing.MultiTapeTM.ComputableInSpace (fun (c : γ✝) => (g✝ c).center) encIn✝ Turing.MultiTapeTM.encRat S✝
    theorem Cslib.Probability.SampleZInput.enc_maxTrials_budget {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {S✝ : γ✝ → ℕ} {g✝ : γ✝ → SampleZInput} :
    theorem Cslib.Probability.SampleZInput.enc_sSq_budget {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {S✝ : γ✝ → ℕ} {g✝ : γ✝ → SampleZInput} :
    Turing.MultiTapeTM.ComputableInSpace g✝ encIn✝ enc S✝ → Turing.MultiTapeTM.ComputableInSpace (fun (c : γ✝) => (g✝ c).sSq) encIn✝ Turing.MultiTapeTM.encRat S✝
    @[reducible, inline]

    The tuple of the fields of enc.

    theorem Cslib.Probability.SampleZInput.enc_tail_budget {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {S✝ : γ✝ → ℕ} {g✝ : γ✝ → SampleZInput} :
    Turing.MultiTapeTM.ComputableInSpace g✝ encIn✝ enc S✝ → Turing.MultiTapeTM.ComputableInSpace (fun (c : γ✝) => (g✝ c).tail) encIn✝ Turing.MultiTapeTM.encUnary S✝
    theorem Cslib.Probability.SampleZInput.enc_mk_deg :
    Turing.MultiTapeTM.ComputableInDegree (fun (p : ℚ × ℚ × ℕ × ℕ × ℕ) => { sSq := p.1, center := p.2.1, tail := p.2.2.1, prec := p.2.2.2.1, maxTrials := p.2.2.2.2 }) encFields enc 1 1

    Framing encoding of SampleZInput: binary rationals sSq and center, unary tail, prec, and maxTrials.

    Finite-parameter strict-PPT capped-trial 1-D discrete Gaussian sampler after [GPV08], §4.1, Lemma 4.3 (p. 15). Proposals are drawn uniformly from the padded integer interval [⌊c⌋ - R, ⌊c⌋ + R] about ⌊c⌋ (with R = ⌊√⌊t² · s²⌋⌋ + 2), which contains the paper's window ℤ ∩ [c - s · t, c + s · t]; the asymptotic ω(log n) endpoint is not formalized here (tracked in #6861 and #1213).

    Strict-PPT certificate for the 1-D discrete Gaussian sampler sampleZ.

    2. Distribution analysis of sampleZ via CloseTo #

    theorem Cslib.Probability.closeTo_eval_sampleZ_discreteGaussian (inp : SampleZInput) (hsSq : 0 < inp.sSq) (hs1 : 1 ≤ √↑inp.sSq) (ht : 1 ≤ inp.tail) {ε : ℝ} (hε0 : 0 ≤ ε) (hε : ε ≤ 1 / 2) (hdual : ZLattice.gaussianMass (LinearMap.BilinForm.dualSubmodule (innerₗ ℝ) ZLattice.intLatticeReal) (1 / √↑inp.sSq) 0 - 1 ≤ ε) (hprec : 8 * (2 * inp.tail + 6) ≤ 2 ^ inp.prec) :
    CloseTo (sampleZ inp).eval (ZLattice.discreteGaussianInt √↑inp.sSq ⋯ ↑inp.center) (ENNReal.ofReal ((1 - 1 / (16 * (2 * ↑inp.tail + 6))) ^ inp.maxTrials + (8 * ↑inp.tail + 24) / 2 ^ inp.prec + (1 + ε) / (1 - ε) * (2 * Real.exp (-Real.pi * ↑inp.tail ^ 2))))

    Finite-parameter strict-PPT CloseTo step for sampleZ against discreteGaussianInt under the 1-D dual-mass premise ρ_{1/s}(ℤ* \ {0}) ≤ ε ≤ 1 / 2, after [GPV08], §4.1, Lemmas 4.2–4.3 (pp. 14–15); the asymptotic ω(log n) endpoint is not formalized here (tracked in #6861 and #1213).

    theorem Cslib.Probability.closeTo_eval_sampleZ_discreteGaussian_of_smoothingParameter_le (inp : SampleZInput) (hsSq : 0 < inp.sSq) (hs1 : 1 ≤ √↑inp.sSq) (ht : 1 ≤ inp.tail) {ε : ℝ} (hε : 0 < ε) (hε_le : ε ≤ 1 / 2) (hη : ZLattice.smoothingParameter ZLattice.intLatticeReal ε ≤ √↑inp.sSq) (hprec : 8 * (2 * inp.tail + 6) ≤ 2 ^ inp.prec) :
    CloseTo (sampleZ inp).eval (ZLattice.discreteGaussianInt √↑inp.sSq ⋯ ↑inp.center) (ENNReal.ofReal ((1 - 1 / (16 * (2 * ↑inp.tail + 6))) ^ inp.maxTrials + (8 * ↑inp.tail + 24) / 2 ^ inp.prec + (1 + ε) / (1 - ε) * (2 * Real.exp (-Real.pi * ↑inp.tail ^ 2))))

    Smoothing-parameter (η_ε(ℤ) ≤ √sSq) form of the finite-parameter strict-PPT CloseTo step closeTo_eval_sampleZ_discreteGaussian, after [GPV08], §4.1, Lemmas 4.2–4.3 (pp. 14–15); the asymptotic ω(log n) endpoint is not formalized here (tracked in #6861 and #1213).

    theorem Cslib.Probability.mem_support_sampleZ_abs_sub_le (inp : SampleZInput) (hsSq : 0 < inp.sSq) {z : ℤ} (hz : z ∈ (sampleZ inp).eval.support) :
    |↑z - ↑inp.center| ≤ ↑inp.tail * √↑inp.sSq + 3

    Every point in the support of sampleZ inp lies within (inp.tail : ℝ) * √(inp.sSq) + 3 of inp.center for 0 < inp.sSq (including the timeout fallback inp.center.floor).