Stat.Privacy

Differential privacy via the Laplace mechanism: the centered Laplace distribution and its density-ratio bound, scalar and finite-dimensional additive-noise release, pure and approximate ε-differential-privacy guarantees, post-processing closure, and Laplace-noise moment bounds.

Laplace­Mechanism 9 core · 9 supporting This file supplies the classical centred Laplace distribution, its density-ratio bound, scalar and finite-dimensional Laplace mechanisms, and post-processing lemmas. ★ laplaceMech_pure_dp★ laplaceMechPi_pure_dp★ pure_dp_implies_approx_dp★ pure_dp_postprocess★ approx_dp_postprocess

The Laplace mechanism and pure differential privacy

This file supplies the classical centred Laplace distribution, its density-ratio bound, scalar and finite-dimensional Laplace mechanisms, and post-processing lemmas. Dataset types and adjacency relations remain completely abstract.

def laplacePDF reviewed
Causalean.Stat.Privacy

For a real scale parameter and a real evaluation point, the centered Laplace density is (2b)1exp(x/b)(2b)^{-1}\exp(-|x|/b).

Definition (Lean source)
b x :
laplacePDF b x :
(2 * b)⁻¹ * exp (-|x| / b)
Causalean.Stat.Privacy.laplacePDF · Causalean/Stat/Privacy/LaplaceMechanism.lean:29
def laplaceMeasure reviewed
Causalean.Stat.Privacy

For a real scale parameter, the centered Laplace measure is Lebesgue measure weighted by the nonnegative part of the centered Laplace density at that scale.

Definition (Lean source)
b :
laplaceMeasure b :
volume.withDensity (fun x => ofReal (laplacePDF b x))
Causalean.Stat.Privacy.laplaceMeasure · Causalean/Stat/Privacy/LaplaceMechanism.lean:33
def laplaceMech reviewed
Causalean.Stat.Privacy

For a dataset domain, a real noise scale, and a real-valued query on that domain, the scalar Laplace mechanism assigns to each dataset the distribution of the query evaluated at that dataset plus an independent centered Laplace draw with that scale.

Definition (Lean source)
D :
Type*
b :
q :
D → ℝ
laplaceMech b q :
D → Measure
fun d => (laplaceMeasure b).map (fun z => z + q d)
Causalean.Stat.Privacy.laplaceMech · Causalean/Stat/Privacy/LaplaceMechanism.lean:151
theorem laplaceMech_pure_dp reviewed
Causalean.Stat.Privacy

Scalar Laplace mechanism is purely differentially private. Given a positive sensitivity bound Δ\Delta and a positive privacy level ε\varepsilon such that the query q changes by at most Δ\Delta between any pair of adjacent datasets, releasing q after adding independent Laplace noise of scale Δ/ε\Delta/\varepsilon satisfies pure ε\varepsilon-differential privacy: for every adjacent pair, the probability of any measurable event under one release is at most eεe^\varepsilon times its probability under the other.

Formal statement
D :
Type*
Adj :
D → D → Prop
q :
D → ℝ
Δ ε :
:
0 < Δ
:
0 < ε
hsens :
∀ d d'
if
Adj d d'
then
|q d - q d'| ≤ Δ
d d' :
Adj d d'
s :
(laplaceMech (Δ / ε) q d).real s ≤ exp ε * (laplaceMech (Δ / ε) q d').real s
Proof (Lean source)
theorem laplaceMech_pure_dp {D : Type*} (Adj : D → D → Prop) (q : D → ℝ) {Δ ε : ℝ} (hΔ : 0 < Δ) (hε : 0 < ε) (hsens : ∀ d d', Adj d d' → |q d - q d'| ≤ Δ) : ∀ d d', Adj d d' → ∀ s, MeasurableSet s → (laplaceMech (Δ / ε) q d).real s ≤ exp ε * (laplaceMech (Δ / ε) q d').real s := by intro d d' hadd s hs have hb : 0 < Δ / ε := div_pos hΔ hε have hscale : |q d - q d'| / (Δ / ε) ≤ ε := by apply (div_le_iff₀ hb).2 calc |q d - q d'| ≤ Δ := hsens d d' hadd _ = ε * (Δ / ε) := by field_simp have hpdf (x : ℝ) : laplacePDF (Δ / ε) (x - q d) ≤ exp ε * laplacePDF (Δ / ε) (x - q d') := by calc laplacePDF (Δ / ε) (x - q d) ≤ exp (|q d - q d'| / (Δ / ε)) * laplacePDF (Δ / ε) (x - q d') := laplacePDF_shift_le (Δ / ε) (q d) (q d') x hb _ ≤ exp ε * laplacePDF (Δ / ε) (x - q d') := by exact mul_le_mul_of_nonneg_right (Real.exp_le_exp.mpr hscale) (laplacePDF_nonneg hb _) have hmeasure : laplaceMech (Δ / ε) q d ≤ (ofReal (exp ε)) • laplaceMech (Δ / ε) q d' := by rw [laplaceMech_eq_withDensity, laplaceMech_eq_withDensity] let f : ℝ → ENNReal := fun x => ofReal (laplacePDF (Δ / ε) (x - q d')) have hf : Measurable f := ((measurable_laplacePDF (Δ / ε)).comp (by fun_prop)).ennreal_ofReal change volume.withDensity _ ≤ ofReal (exp ε) • volume.withDensity f rw [← withDensity_smul (μ := volume) (ofReal (exp ε)) hf] apply withDensity_mono filter_upwards with x change ofReal (laplacePDF (Δ / ε) (x - q d)) ≤ ofReal (exp ε) * ofReal (laplacePDF (Δ / ε) (x - q d')) rw [← ENNReal.ofReal_mul (Real.exp_pos ε).le] exact ENNReal.ofReal_le_ofReal (hpdf x) have hle := hmeasure s rw [Measure.smul_apply] at hle letI : IsProbabilityMeasure (laplaceMech (Δ / ε) q d) := laplaceMech_isProbabilityMeasure (Δ / ε) hb q d letI : IsProbabilityMeasure (laplaceMech (Δ / ε) q d') := laplaceMech_isProbabilityMeasure (Δ / ε) hb q d' change ((laplaceMech (Δ / ε) q d) s).toRealexp ε * ((laplaceMech (Δ / ε) q d') s).toReal rw [← ENNReal.toReal_ofReal (Real.exp_pos ε).le, ← ENNReal.toReal_mul] · exact ENNReal.toReal_mono (ENNReal.mul_ne_top ENNReal.ofReal_ne_top (measure_ne_top (laplaceMech (Δ / ε) q d') s)) hle
Causalean.Stat.Privacy.laplaceMech_pure_dp · Causalean/Stat/Privacy/LaplaceMechanism.lean:192 · uses laplaceMech
def laplaceMechPi reviewed
Causalean.Stat.Privacy

For a dataset domain, a finite coordinate index set, a real noise scale, and a coordinate-indexed real-valued query on the dataset domain, the finite-dimensional Laplace mechanism assigns to each dataset the distribution obtained by adding independent centered Laplace draws with that scale to all query coordinates.

Definition (Lean source)
D ι :
Type*
b :
q :
D → (ι → ℝ)
laplaceMechPi b q :
D → Measure (ι → ℝ)
fun d => (Measure.pi (fun _ : ι => laplaceMeasure b)).map (fun z => z + q d)
Causalean.Stat.Privacy.laplaceMechPi · Causalean/Stat/Privacy/LaplaceMechanism.lean:250
theorem laplaceMechPi_pure_dp reviewed
Causalean.Stat.Privacy

Vector Laplace mechanism is purely differentially private. Given a positive 1\ell^1-sensitivity bound Δ\Delta and a positive privacy level ε\varepsilon such that the coordinatewise absolute differences of the query q sum to at most Δ\Delta between any pair of adjacent datasets, releasing q after adding independent Laplace noise of scale Δ/ε\Delta/\varepsilon to each coordinate satisfies pure ε\varepsilon-differential privacy: for every adjacent pair, the probability of any measurable event under one release is at most eεe^\varepsilon times its probability under the other.

Formal statement
D ι :
Type*
Adj :
D → D → Prop
q :
D → (ι → ℝ)
Δ ε :
:
0 < Δ
:
0 < ε
hsens :
∀ d d'
if
Adj d d'
then
∑ i, |q d i - q d' i| ≤ Δ
d d' :
Adj d d'
s :
(laplaceMechPi (Δ / ε) q d).real s ≤ exp ε * (laplaceMechPi (Δ / ε) q d').real s
Proof (Lean source)
theorem laplaceMechPi_pure_dp {D ι : Type*} [Fintype ι] (Adj : D → D → Prop) (q : D → (ι → ℝ)) {Δ ε : ℝ} (hΔ : 0 < Δ) (hε : 0 < ε) (hsens : ∀ d d', Adj d d' → ∑ i, |q d i - q d' i| ≤ Δ) : ∀ d d', Adj d d' → ∀ s, MeasurableSet s → (laplaceMechPi (Δ / ε) q d).real s ≤ exp ε * (laplaceMechPi (Δ / ε) q d').real s := by intro d d' hadd s hs have hb : 0 < Δ / ε := div_pos hΔ hε let μ : ι → Measure ℝ := fun i => (laplaceMeasure (Δ / ε)).map (fun z => z + q d i) let ν : ι → Measure ℝ := fun i => (laplaceMeasure (Δ / ε)).map (fun z => z + q d' i) let c : ι → ENNReal := fun i => ofReal (exp (|q d i - q d' i| / (Δ / ε))) letI (i : ι) : IsProbabilityMeasure (μ i) := by dsimp [μ] letI := laplaceMeasure_isProbabilityMeasure (Δ / ε) hb exact Measure.isProbabilityMeasure_map (by fun_prop) letI (i : ι) : IsProbabilityMeasure (ν i) := by dsimp [ν] letI := laplaceMeasure_isProbabilityMeasure (Δ / ε) hb exact Measure.isProbabilityMeasure_map (by fun_prop) have hpi : Measure.pi μ ≤ (∏ i, c i) • Measure.pi ν := pi_le_smul_pi μ ν c (fun i => laplace_shift_measure_le _ _ _ hb) have hsum : (∑ i, |q d i - q d' i| / (Δ / ε)) ≤ ε := by rw [← Finset.sum_div] apply (div_le_iff₀ hb).2 calc (∑ i, |q d i - q d' i|) ≤ Δ := hsens d d' hadd _ = ε * (Δ / ε) := by field_simp have hc : (∏ i, c i) ≤ ofReal (exp ε) := by change (∏ i, ofReal (exp (|q d i - q d' i| / (Δ / ε)))) ≤ _ rw [← ENNReal.ofReal_prod_of_nonneg (fun i _ => (Real.exp_pos _).le), ← Real.exp_sum] exact ENNReal.ofReal_le_ofReal (Real.exp_le_exp.mpr hsum) have hmeasure : laplaceMechPi (Δ / ε) q d ≤ ofReal (exp ε) • laplaceMechPi (Δ / ε) q d' := by rw [laplaceMechPi_eq_pi_shift (hb := hb), laplaceMechPi_eq_pi_shift (hb := hb)] apply hpi.trans rw [Measure.le_iff'] intro t simp only [Measure.smul_apply, smul_eq_mul] change (∏ i, c i) * (Measure.pi ν) t ≤ ofReal (exp ε) * (Measure.pi ν) t gcongr have hle := hmeasure s rw [Measure.smul_apply] at hle letI := laplaceMechPi_isProbabilityMeasure (Δ / ε) hb q d letI := laplaceMechPi_isProbabilityMeasure (Δ / ε) hb q d' change ((laplaceMechPi (Δ / ε) q d) s).toRealexp ε * ((laplaceMechPi (Δ / ε) q d') s).toReal rw [← ENNReal.toReal_ofReal (Real.exp_pos ε).le, ← ENNReal.toReal_mul] exact ENNReal.toReal_mono (ENNReal.mul_ne_top ENNReal.ofReal_ne_top (measure_ne_top (laplaceMechPi (Δ / ε) q d') s)) hle
Causalean.Stat.Privacy.laplaceMechPi_pure_dp · Causalean/Stat/Privacy/LaplaceMechanism.lean:378 · uses laplaceMechPi
theorem pure_dp_implies_approx_dp reviewed
Causalean.Stat.Privacy

Pure DP implies approximate DP. Given a mechanism M satisfying pure ε\varepsilon-differential privacy between releases M d and M d', i.e. the probability of every measurable event under one release is at most eεe^\varepsilon times its probability under the other, adding any nonnegative failure allowance δ\delta to the bound still yields a valid (ε,δ)(\varepsilon,\delta)-approximate differential-privacy guarantee between M d and M d'.

Formal statement
D :
Sort u_2
shared
α :
M :
D → Measure α
d d' :
D
ε δ :
hpure :
∀ s
then
(M d).real s ≤ exp ε * (M d').real s
:
0 ≤ δ
s :
(M d).real s ≤ exp ε * (M d').real s + δ
Proof (Lean source)
theorem pure_dp_implies_approx_dp {α : Type*} [MeasurableSpace α] (M : D → Measure α) (d d' : D) (ε δ : ℝ) (hpure : ∀ s, MeasurableSet s → (M d).real s ≤ exp ε * (M d').real s) (hδ : 0 ≤ δ) : ∀ s, MeasurableSet s → (M d).real s ≤ exp ε * (M d').real s + δ := by intro s hs exact (hpure s hs).trans (le_add_of_nonneg_right hδ)
Causalean.Stat.Privacy.pure_dp_implies_approx_dp · Causalean/Stat/Privacy/LaplaceMechanism.lean:442
theorem pure_dp_postprocess reviewed
Causalean.Stat.Privacy

Post-processing preserves pure differential privacy. Given a vector-valued mechanism M satisfying pure ε\varepsilon-differential privacy between the releases M d and M d', post-processing the release by any measurable scalar summary f again satisfies pure ε\varepsilon-differential privacy, now between the f-summaries of M d and M d'.

Formal statement
D ι :
Type*
M :
D → Measure (ι → ℝ)
d d' :
D
ε :
hM :
∀ s
then
(M d).real s ≤ exp ε * (M d').real s
f :
(ι → ℝ) → ℝ
hf :
s :
((M d).map f).real s ≤ exp ε * ((M d').map f).real s
Proof (Lean source)
theorem pure_dp_postprocess {D ι : Type*} (M : D → Measure (ι → ℝ)) (d d' : D) (ε : ℝ) (hM : ∀ s, MeasurableSet s → (M d).real s ≤ exp ε * (M d').real s) (f : (ι → ℝ) → ℝ) (hf : Measurable f) : ∀ s, MeasurableSet s → ((M d).map f).real s ≤ exp ε * ((M d').map f).real s := by intro s hs change ((M d).map f s).toRealexp ε * ((M d').map f s).toReal rw [Measure.map_apply hf hs, Measure.map_apply hf hs] exact hM (f ⁻¹' s) (hs.preimage hf)
Causalean.Stat.Privacy.pure_dp_postprocess · Causalean/Stat/Privacy/LaplaceMechanism.lean:457
theorem approx_dp_postprocess reviewed
Causalean.Stat.Privacy

Post-processing preserves approximate differential privacy. Given a vector-valued mechanism M obeying an (ε,δ)(\varepsilon,\delta)-approximate DP bound between the releases M d and M d' for every measurable event, with a nonnegative failure allowance δ\delta, post-processing the release by any measurable scalar summary f again satisfies the same (ε,δ)(\varepsilon,\delta)-approximate DP bound, now between the f-summaries of M d and M d'.

Formal statement
D ι :
Type*
M :
D → Measure (ι → ℝ)
d d' :
D
ε δ :
hM :
∀ s
then
(M d).real s ≤ exp ε * (M d').real s + δ
_hδ :
0 ≤ δ
f :
(ι → ℝ) → ℝ
hf :
s :
((M d).map f).real s ≤ exp ε * ((M d').map f).real s + δ
Proof (Lean source)
theorem approx_dp_postprocess {D ι : Type*} (M : D → Measure (ι → ℝ)) (d d' : D) (ε δ : ℝ) (hM : ∀ s, MeasurableSet s → (M d).real s ≤ exp ε * (M d').real s + δ) (_hδ : 0 ≤ δ) (f : (ι → ℝ) → ℝ) (hf : Measurable f) : ∀ s, MeasurableSet s → ((M d).map f).real s ≤ exp ε * ((M d').map f).real s + δ := by intro s hs change ((M d).map f s).toRealexp ε * ((M d').map f s).toReal + δ rw [Measure.map_apply hf hs, Measure.map_apply hf hs] exact hM (f ⁻¹' s) (hs.preimage hf)
Causalean.Stat.Privacy.approx_dp_postprocess · Causalean/Stat/Privacy/LaplaceMechanism.lean:474
9 supporting declarations (lemmas, instances)