Documentation

CslibFrontier.Privacy.DifferentialPrivacy.DiscreteLaplace

The geometric mechanism and the discrete Laplace distribution #

The two-sided geometric distribution with ratio α ∈ [0, 1) gives each integer z the mass (1 - α) / (1 + α) · α ^ |z| (twoSidedGeometric). Adding it to the value of a count query is the α-geometric mechanism [GhoshRoughgardenSundararajan2012, Example 2.1]. The masses of neighboring integers differ by a factor of at most α⁻¹, so adding this noise to an integer-valued query q of sensitivity Δ (Sensitivity Adj (fun x => (q x : ℝ)) Δ) is (Δ · ln α⁻¹, 0)-differentially private (differentiallyPrivate_addNoise_twoSidedGeometric).

With α = exp (-1 / t) it is the discrete Laplace distribution with scale t (discreteLaplace, discreteLaplace_apply) [CanonneKamathSteinke2020, Definition 28]. Adding discrete Laplace noise of scale Δ / ε to an integer-valued query of sensitivity Δ is (ε, 0)-private (differentiallyPrivate_addNoise_discreteLaplace) [CanonneKamathSteinke2020, Lemma 29], and for Y with scale 1 / ε the tails are Pr[Y ≥ m] = Pr[Y ≤ -m] = exp (-ε (m - 1)) / (exp ε + 1) for every natural m (discreteLaplace_toOuterMeasure_Ici, discreteLaplace_toOuterMeasure_Iic) [CanonneKamathSteinke2020, Lemma 30]. For the ratio form, twoSidedGeometric_toOuterMeasure_Ici and twoSidedGeometric_toOuterMeasure_Iic give α ^ m / (1 + α), and for m ≠ 0, twoSidedGeometric_toOuterMeasure_le_natAbs gives the two-sided accuracy bound Pr[|Y| ≥ m] = 2 α ^ m / (1 + α).

These distributions have infinite support, so they are ideal laws (PMF ℤ), not programs over finitely many fair coins; the mechanisms are stated at the level of their output distributions. The cost of sampling them exactly is not modelled here.

Main definitions #

Main results #

References #

theorem Cslib.Privacy.hasSum_pow_natAbs {α : ℝ} (h0 : 0 ≤ α) (h1 : α < 1) :
HasSum (fun (z : ℤ) => α ^ z.natAbs) ((1 + α) / (1 - α))

∑ z : ℤ, α ^ |z| = (1 + α) / (1 - α) for α ∈ [0, 1).

theorem Cslib.Privacy.hasSum_mul_pow_natAbs {α : ℝ} (h0 : 0 ≤ α) (h1 : α < 1) :
HasSum (fun (z : ℤ) => (1 - α) / (1 + α) * α ^ z.natAbs) 1

The masses of the two-sided geometric distribution sum to one.

noncomputable def Cslib.Privacy.twoSidedGeometric (α : ℝ) (h0 : 0 ≤ α) (h1 : α < 1) :

The two-sided geometric distribution on ℤ with ratio α ∈ [0, 1): the integer z has mass (1 - α) / (1 + α) · α ^ |z| [GhoshRoughgardenSundararajan2012, Example 2.1].

theorem Cslib.Privacy.twoSidedGeometric_apply {α : ℝ} (h0 : 0 ≤ α) (h1 : α < 1) (z : ℤ) :
(twoSidedGeometric α h0 h1) z = ENNReal.ofReal ((1 - α) / (1 + α) * α ^ z.natAbs)

The mass of z under the two-sided geometric distribution.

theorem Cslib.Privacy.twoSidedGeometric_map_neg {α : ℝ} (h0 : 0 ≤ α) (h1 : α < 1) :

The two-sided geometric distribution is symmetric.

theorem Cslib.Privacy.twoSidedGeometric_toOuterMeasure_Ici {α : ℝ} (h0 : 0 ≤ α) (h1 : α < 1) (m : ℕ) :
(twoSidedGeometric α h0 h1).toOuterMeasure (Set.Ici ↑m) = ENNReal.ofReal (α ^ m / (1 + α))

Upper tail of the two-sided geometric distribution: Pr[Y ≥ m] = α ^ m / (1 + α) for every natural m.

theorem Cslib.Privacy.twoSidedGeometric_toOuterMeasure_Iic {α : ℝ} (h0 : 0 ≤ α) (h1 : α < 1) (m : ℕ) :
(twoSidedGeometric α h0 h1).toOuterMeasure (Set.Iic (-↑m)) = ENNReal.ofReal (α ^ m / (1 + α))

Lower tail of the two-sided geometric distribution: Pr[Y ≤ -m] = α ^ m / (1 + α) for every natural m.

theorem Cslib.Privacy.twoSidedGeometric_toOuterMeasure_le_natAbs {α : ℝ} (h0 : 0 ≤ α) (h1 : α < 1) {m : ℕ} (hm : m ≠ 0) :
(twoSidedGeometric α h0 h1).toOuterMeasure {z : ℤ | m ≤ z.natAbs} = ENNReal.ofReal (2 * α ^ m / (1 + α))

Two-sided tail of the two-sided geometric distribution: Pr[|Y| ≥ m] = 2 α ^ m / (1 + α) for every positive natural m.

noncomputable def Cslib.Privacy.addNoise {D : Type u_1} (q : D → ℤ) (noise : PMF ℤ) (x : D) :

The mechanism releasing the integer-valued query q plus independent noise drawn from noise.

theorem Cslib.Privacy.addNoise_apply {D : Type u_1} (q : D → ℤ) (noise : PMF ℤ) (x : D) (r : ℤ) :
(addNoise q noise x) r = noise (r - q x)

The noisy answer is r exactly when the noise is r - q x.

theorem Cslib.Privacy.addNoise_toOuterMeasure_le_natAbs_sub {D : Type u_1} (q : D → ℤ) (noise : PMF ℤ) (x : D) (m : ℕ) :
(addNoise q noise x).toOuterMeasure {r : ℤ | m ≤ (r - q x).natAbs} = noise.toOuterMeasure {z : ℤ | m ≤ z.natAbs}

The error of the noisy answer has the law of the noise.

theorem Cslib.Privacy.DifferentiallyPrivate.addNoise {D : Type u_1} {Adj : D → D → Prop} {q : D → ℤ} {noise : PMF ℤ} {Δ ε : ℝ} (hq : Sensitivity Adj (fun (x : D) => ↑(q x)) Δ) (hnoise : ∀ (z d : ℤ), |↑d| ≤ Δ → noise z ≤ ENNReal.ofReal (Real.exp ε) * noise (z + d)) :

If shifting the noise by at most Δ changes each mass by a factor of at most exp ε, then adding it to a query of sensitivity Δ is (ε, 0)-differentially private.

theorem Cslib.Privacy.twoSidedGeometric_apply_le {α : ℝ} (h0 : 0 < α) (h1 : α < 1) {Δ : ℝ} (z d : ℤ) (hd : |↑d| ≤ Δ) :
(twoSidedGeometric α ⋯ h1) z ≤ ENNReal.ofReal (Real.exp (Δ * Real.log α⁻¹)) * (twoSidedGeometric α ⋯ h1) (z + d)

Shifting the two-sided geometric distribution by at most Δ changes each mass by a factor of at most α⁻¹ ^ Δ.

theorem Cslib.Privacy.differentiallyPrivate_addNoise_twoSidedGeometric {D : Type u_1} {α : ℝ} {Adj : D → D → Prop} {q : D → ℤ} {Δ : ℝ} (hq : Sensitivity Adj (fun (x : D) => ↑(q x)) Δ) (h0 : 0 < α) (h1 : α < 1) :

The α-geometric mechanism [GhoshRoughgardenSundararajan2012, Example 2.1]: adding two-sided geometric noise with ratio α ∈ (0, 1) to an integer-valued query of sensitivity Δ is (Δ · ln α⁻¹, 0)-differentially private. For a count query (Δ = 1) this is the source's α-differential privacy.

noncomputable def Cslib.Privacy.discreteLaplace (t : ℝ) (ht : 0 < t) :

The discrete Laplace distribution with scale t > 0 [CanonneKamathSteinke2020, Definition 28]: the two-sided geometric distribution with ratio exp (-1 / t).

theorem Cslib.Privacy.discreteLaplace_apply (t : ℝ) (ht : 0 < t) (z : ℤ) :
(discreteLaplace t ht) z = ENNReal.ofReal ((Real.exp (1 / t) - 1) / (Real.exp (1 / t) + 1) * Real.exp (-|↑z| / t))

The discrete Laplace distribution gives z the mass (exp (1 / t) - 1) / (exp (1 / t) + 1) · exp (-|z| / t) [CanonneKamathSteinke2020, Definition 28].

theorem Cslib.Privacy.differentiallyPrivate_addNoise_discreteLaplace {D : Type u_1} {Adj : D → D → Prop} {q : D → ℤ} {Δ : ℝ} (hΔ : 0 < Δ) (hq : Sensitivity Adj (fun (x : D) => ↑(q x)) Δ) {ε : ℝ} (hε : 0 < ε) :
DifferentiallyPrivate Adj (addNoise q (discreteLaplace (Δ / ε) ⋯)) ε 0

Adding discrete Laplace noise of scale Δ / ε to an integer-valued query of sensitivity Δ > 0 is (ε, 0)-differentially private [CanonneKamathSteinke2020, Lemma 29].

theorem Cslib.Privacy.discreteLaplace_toOuterMeasure_Ici {ε : ℝ} (hε : 0 < ε) (m : ℕ) :
(discreteLaplace (1 / ε) ⋯).toOuterMeasure (Set.Ici ↑m) = ENNReal.ofReal (Real.exp (-ε * (↑m - 1)) / (Real.exp ε + 1))

Upper tail of the discrete Laplace distribution with scale 1 / ε: Pr[Y ≥ m] = exp (-ε (m - 1)) / (exp ε + 1) for every natural m [CanonneKamathSteinke2020, Lemma 30].

theorem Cslib.Privacy.discreteLaplace_toOuterMeasure_Iic {ε : ℝ} (hε : 0 < ε) (m : ℕ) :
(discreteLaplace (1 / ε) ⋯).toOuterMeasure (Set.Iic (-↑m)) = ENNReal.ofReal (Real.exp (-ε * (↑m - 1)) / (Real.exp ε + 1))

Lower tail of the discrete Laplace distribution with scale 1 / ε: Pr[Y ≤ -m] = exp (-ε (m - 1)) / (exp ε + 1) for every natural m [CanonneKamathSteinke2020, Lemma 30].

theorem Cslib.Privacy.discreteLaplace_toOuterMeasure_le_natAbs (t : ℝ) (ht : 0 < t) {m : ℕ} (hm : m ≠ 0) :

Two-sided tail of the discrete Laplace distribution with scale t: Pr[|Y| ≥ m] = 2 exp (-m / t) / (1 + exp (-1 / t)) for every positive natural m.

The discrete Laplace distribution with scale t exceeds a ≥ 0 in absolute value with probability at most 2 exp (-a / t).

theorem Cslib.Privacy.discreteLaplace_apply_le (t : ℝ) (ht : 0 < t) {Δ : ℝ} (z d : ℤ) (hd : |↑d| ≤ Δ) :

Shifting the discrete Laplace distribution with scale t by at most Δ changes each mass by a factor of at most exp (Δ / t).