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.
LaplaceMechanism 7 core · 11 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★ 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.
For a real scale parameter and a real evaluation point, the centered Laplace density is .
Definition (Lean source)
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)
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)
Scalar Laplace mechanism is purely differentially private. Given a positive sensitivity bound and a positive privacy level such that the query q changes by at most between any pair of adjacent datasets, releasing q after adding independent Laplace noise of scale satisfies pure -differential privacy: for every adjacent pair, the probability of any measurable event under one release is at most times its probability under the other.
Formal statement
Proof (Lean source)
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)
Vector Laplace mechanism is purely differentially private. Given a positive -sensitivity bound and a positive privacy level such that the coordinatewise absolute differences of the query q sum to at most between any pair of adjacent datasets, releasing q after adding independent Laplace noise of scale to each coordinate satisfies pure -differential privacy: for every adjacent pair, the probability of any measurable event under one release is at most times its probability under the other.
Formal statement
Proof (Lean source)
A fixed-pair approximate measure bound survives deterministic vector-to-scalar post-processing. Given an event-measure bound with allowance δ between the vector-valued measures M d and M d', pushing both measures forward by a measurable scalar map f preserves the same bound and allowance. This raw lemma does not assert probability normalization or quantify over an adjacency relation.
Formal statement
Proof (Lean source)
11 supporting declarations (lemmas, instances)
-
measurable_laplacePDFlemma — The Laplace density with scale b is a measurable function on the real line.Proof (Lean source)
@[fun_prop] lemma measurable_laplacePDF (b : ℝ) : Measurable (laplacePDF b) := by unfold laplacePDF fun_prop -
laplaceMeasure_isProbabilityMeasuretheorem — At every positive scale, the centered Laplace measure has total mass one and therefore defines a probability distribution.Proof (Lean source)
theorem laplaceMeasure_isProbabilityMeasure (b : ℝ) (hb : 0 < b) : IsProbabilityMeasure (laplaceMeasure b) := by refine ⟨?_⟩ rw [laplaceMeasure, withDensity_apply _ MeasurableSet.univ] rw [Measure.restrict_univ] have hdens : (fun x => ofReal (laplacePDF b x)) = fun x => (toNNReal (laplacePDF b x) : ENNReal) := by funext x rw [ENNReal.ofReal_eq_coe_nnreal (laplacePDF_nonneg hb x)] congr 1 ext simp [Real.toNNReal_of_nonneg (laplacePDF_nonneg hb x)] rw [hdens, lintegral_coe_eq_integral] · convert congrArg ofReal (integral_laplacePDF hb) using 1 <;> simp [max_eq_left (laplacePDF_nonneg hb _)] · simpa [Real.toNNReal_of_nonneg, laplacePDF_nonneg hb] using integrable_laplacePDF hb -
laplacePDF_shift_letheorem — Moving the center of a positive-scale Laplace density changes its value at any observation by at most an exponential factor determined by the distance between the old and new centers divided by the scale.hypothesesb u v z :ℝhb :0 < bconclusionProof (Lean source)
theorem laplacePDF_shift_le (b u v z : ℝ) (hb : 0 < b) : laplacePDF b (z - u) ≤ exp (|u - v| / b) * laplacePDF b (z - v) := by have htri : |z - v| - |z - u| ≤ |u - v| := by calc |z - v| - |z - u| ≤ |(z - v) - (z - u)| := abs_sub_abs_le_abs_sub (z - v) (z - u) _ = |u - v| := by congr 1; simp have hexp : exp (-|z - u| / b) ≤ exp (|u - v| / b) * exp (-|z - v| / b) := by rw [← Real.exp_add, Real.exp_le_exp] rw [show |u - v| / b + -|z - v| / b = (|u - v| - |z - v|) / b by ring] exact (div_le_div_iff_of_pos_right hb).2 (by linarith) unfold laplacePDF calc (2 * b)⁻¹ * exp (-|z - u| / b) ≤ (2 * b)⁻¹ * (exp (|u - v| / b) * exp (-|z - v| / b)) := mul_le_mul_of_nonneg_left hexp (by positivity) _ = exp (|u - v| / b) * ((2 * b)⁻¹ * exp (-|z - v| / b)) := by ring -
laplaceMech_isProbabilityMeasuretheorem — Adding positive-scale Laplace noise to a scalar query produces a probability distribution for the release under every dataset.hypothesesD :Type*b :ℝhb :0 < bq :D → ℝd :DconclusionIsProbabilityMeasure (laplaceMech b q d)Proof (Lean source)
theorem laplaceMech_isProbabilityMeasure {D : Type*} (b : ℝ) (hb : 0 < b) (q : D → ℝ) (d : D) : IsProbabilityMeasure (laplaceMech b q d) := by letI : IsProbabilityMeasure (laplaceMeasure b) := laplaceMeasure_isProbabilityMeasure b hb unfold laplaceMech exact Measure.isProbabilityMeasure_map (by fun_prop) -
laplaceMechPi_isProbabilityMeasuretheorem — Adding independent positive-scale Laplace noise in finitely many coordinates produces a probability distribution for the vector release under every dataset.hypothesesconclusionIsProbabilityMeasure (laplaceMechPi b q d)Proof (Lean source)
theorem laplaceMechPi_isProbabilityMeasure {D ι : Type*} [Fintype ι] (b : ℝ) (hb : 0 < b) (q : D → (ι → ℝ)) (d : D) : IsProbabilityMeasure (laplaceMechPi b q d) := by letI : IsProbabilityMeasure (laplaceMeasure b) := laplaceMeasure_isProbabilityMeasure b hb haveI : IsProbabilityMeasure (Measure.pi (fun _ : ι => laplaceMeasure b)) := inferInstance unfold laplaceMechPi exact Measure.isProbabilityMeasure_map (by fun_prop) -
pure_dp_implies_approx_dptheorem — A pure measure bound implies the corresponding approximate measure bound. Given an event-measure bound between M d and M d', adding any nonnegative allowance $\delta$ preserves the inequality with that allowance. This raw fixed-pair lemma does not assert that M consists of probability measures.hypothesesProof (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δ) -
pure_dp_postprocesstheorem — A fixed-pair pure measure bound survives deterministic vector-to-scalar post-processing. Given an event-measure bound between the vector-valued measures M d and M d', pushing both measures forward by a measurable scalar map f preserves the same bound. This raw lemma does not assert probability normalization or quantify over an adjacency relation.hypothesesProof (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).toReal ≤ exp ε * ((M d').map f s).toReal rw [Measure.map_apply hf hs, Measure.map_apply hf hs] exact hM (f ⁻¹' s) (hs.preimage hf) -
laplaceMeasure_integrable_abstheorem — The absolute value of a centered Laplace draw has a finite expectation at every positive scale.Proof (Lean source)
theorem laplaceMeasure_integrable_abs (b : ℝ) (hb : 0 < b) : Integrable (fun x : ℝ => |x|) (laplaceMeasure b) := by rw [laplaceMeasure, integrable_withDensity_iff_integrable_smul' (measurable_laplacePDF b).ennreal_ofReal (ae_of_all _ fun _ => ENNReal.ofReal_lt_top)] simpa only [ENNReal.toReal_ofReal (laplacePDF_nonneg hb _), smul_eq_mul, mul_comm] using integrable_abs_mul_laplacePDF b hb -
laplaceMeasure_integral_abstheorem — The expected absolute value of a centered Laplace draw equals its positive scale.Proof (Lean source)
theorem laplaceMeasure_integral_abs (b : ℝ) (hb : 0 < b) : ∫ x, |x| ∂(laplaceMeasure b) = b := by rw [laplaceMeasure, integral_withDensity_eq_integral_toReal_smul (measurable_laplacePDF b).ennreal_ofReal (ae_of_all _ fun _ => ENNReal.ofReal_lt_top)] simp_rw [ENNReal.toReal_ofReal (laplacePDF_nonneg hb _), smul_eq_mul] let f : ℝ → ℝ := fun x => (2 * b)⁻¹ * (x * exp (-x / b)) rw [show (fun x : ℝ => laplacePDF b x * |x|) = fun x => f |x| by funext x simp only [f, laplacePDF] ring, integral_comp_abs] have hplain : (∫ x in Ioi (0 : ℝ), x * exp (-x / b)) = b ^ 2 := by calc _ = ∫ x in Ioi (0 : ℝ), x ^ ((2 : ℝ) - 1) * exp (-((1 / b) * x)) := by apply setIntegral_congr_fun measurableSet_Ioi intro x hx simp only [show (2 : ℝ) - 1 = 1 by norm_num, Real.rpow_one] rw [show -x / b = -(1 / b * x) by ring] _ = (1 / (1 / b)) ^ (2 : ℝ) * Gamma (2 : ℝ) := Real.integral_rpow_mul_exp_neg_mul_Ioi (by norm_num) (one_div_pos.mpr hb) _ = b ^ 2 := by rw [show Gamma (2 : ℝ) = 1 by norm_num] field_simp [hb.ne'] exact Real.rpow_natCast b 2 have hright : (∫ x in Ioi (0 : ℝ), f x) = (2 * b)⁻¹ * b ^ 2 := by rw [show f = fun x => (2 * b)⁻¹ * (x * exp (-x / b)) by rfl, integral_const_mul, hplain] rw [hright] field_simp [hb.ne'] -
laplacePi_integral_euclidean_norm_letheorem — The expected Euclidean norm of a finite vector of independent centered Laplace draws is at most the number of coordinates times their common positive scale.hypothesesconclusion∫ w, sqrt (∑ i : ι, (w i) ^ 2) ∂(Measure.pi fun _ : ι => laplaceMeasure b)≤ (Fintype.card ι : ℝ) * bProof (Lean source)
theorem laplacePi_integral_euclidean_norm_le {ι : Type*} [Fintype ι] (b : ℝ) (hb : 0 < b) : ∫ w, sqrt (∑ i : ι, (w i) ^ 2) ∂(Measure.pi fun _ : ι => laplaceMeasure b) ≤ (Fintype.card ι : ℝ) * b := by letI : IsProbabilityMeasure (laplaceMeasure b) := laplaceMeasure_isProbabilityMeasure b hb let P : Measure (ι → ℝ) := Measure.pi fun _ : ι => laplaceMeasure b have hcoord (i : ι) : Integrable (fun w : ι → ℝ => |w i|) P := integrable_comp_eval (laplaceMeasure_integrable_abs b hb) have hsum : Integrable (fun w : ι → ℝ => ∑ i : ι, |w i|) P := integrable_finset_sum _ fun i _ => hcoord i have hnorm : Integrable (fun w : ι → ℝ => sqrt (∑ i : ι, (w i) ^ 2)) P := by have hcontinuous : Continuous (fun w : ι → ℝ => sqrt (∑ i : ι, (w i) ^ 2)) := Real.continuous_sqrt.comp (continuous_finset_sum _ fun i _ => (continuous_apply i).pow 2) refine hsum.mono' hcontinuous.aestronglyMeasurable (ae_of_all _ fun w => ?_) rw [Real.norm_of_nonneg (Real.sqrt_nonneg _)] exact sqrt_sum_sq_le_sum_abs w calc ∫ w, sqrt (∑ i : ι, (w i) ^ 2) ∂P ≤ ∫ w, ∑ i : ι, |w i| ∂P := integral_mono hnorm hsum (sqrt_sum_sq_le_sum_abs) _ = ∑ i : ι, ∫ w, |w i| ∂P := integral_finset_sum _ fun i _ => hcoord i _ = ∑ _i : ι, b := by congr 1 with i change (∫ w : ι → ℝ, |w i| ∂Measure.pi (fun _ : ι => laplaceMeasure b)) = b exact (integral_comp_eval (μ := fun _ : ι => laplaceMeasure b) (i := i) (f := fun x : ℝ => |x|) (Continuous.aestronglyMeasurable continuous_abs)).trans (laplaceMeasure_integral_abs b hb) _ = (Fintype.card ι : ℝ) * b := by simp -
laplacePi_integrable_euclidean_normtheorem — The Euclidean norm of finitely many independent centered Laplace draws has a finite expectation whenever their common scale is positive.hypothesesconclusionProof (Lean source)
theorem laplacePi_integrable_euclidean_norm {ι : Type*} [Fintype ι] (b : ℝ) (hb : 0 < b) : Integrable (fun w : ι → ℝ => sqrt (∑ i : ι, (w i) ^ 2)) (Measure.pi fun _ : ι => laplaceMeasure b) := by letI : IsProbabilityMeasure (laplaceMeasure b) := laplaceMeasure_isProbabilityMeasure b hb have hcoord (i : ι) : Integrable (fun w : ι → ℝ => |w i|) (Measure.pi fun _ : ι => laplaceMeasure b) := integrable_comp_eval (laplaceMeasure_integrable_abs b hb) have hsum : Integrable (fun w : ι → ℝ => ∑ i : ι, |w i|) (Measure.pi fun _ : ι => laplaceMeasure b) := integrable_finset_sum _ fun i _ => hcoord i have hcontinuous : Continuous (fun w : ι → ℝ => sqrt (∑ i : ι, (w i) ^ 2)) := Real.continuous_sqrt.comp (continuous_finset_sum _ fun i _ => (continuous_apply i).pow 2) refine hsum.mono' hcontinuous.aestronglyMeasurable (ae_of_all _ fun w => ?_) rw [Real.norm_of_nonneg (Real.sqrt_nonneg _)] exact sqrt_sum_sq_le_sum_abs w
LaplaceKernel 2 core · 2 supporting The existing finite-coordinate mechanism is packaged as a Markov kernel for any measurable query and positive scale. ★ measurable_laplaceMechPi
Measurable finite-product Laplace mechanism
The existing finite-coordinate mechanism is packaged as a Markov kernel for any measurable query and positive scale. Its value at each input is exactly the primary library's mechanism, so measure-kernel composition applies directly.
At a real scale with a positive-scale certificate, a query and its measurability certificate, the finite-product Laplace release depends measurably on its input.
Formal statement
Proof (Lean source)
At a real scale with a positive-scale certificate, a query and its measurability certificate, the finite-coordinate release defines a kernel with the existing mechanism's inputwise measures.
Definition (Lean source)
2 supporting declarations (lemmas, instances)
-
laplaceMechPiKernel_applytheorem — At a real scale with a positive-scale certificate, a query, its measurability certificate, and an input, the kernel equals the existing Laplace mechanism at that input.hypothesesconclusionlaplaceMechPiKernel b hb q hq d = laplaceMechPi b q dProof (Lean source)
@[simp] theorem laplaceMechPiKernel_apply (b : ℝ) (hb : 0 < b) (q : D → ι → ℝ) (hq : Measurable q) (d : D) : laplaceMechPiKernel b hb q hq d = laplaceMechPi b q d := rfl -
laplaceMechPiKernel_isMarkovKernelinstance — At a real scale with a positive-scale certificate, a query and its measurability certificate, the resulting kernel is a Markov kernel.
LaplaceCoordinateMoments 1 core · 8 supporting Every centered coordinate of the existing finite-product mechanism has the scalar Laplace law, zero mean, and exact squared error. ★ laplaceMechPi_integral_coord_sub_sq
Finite-coordinate Laplace release moments
Every centered coordinate of the existing finite-product mechanism has the
scalar Laplace law, zero mean, and exact squared error. An arbitrary real
center yields query displacement squared plus twice the squared noise scale.
The index type is any finite type, including Fin 2.
At a real scale with a positive-scale certificate, a query, an input, a coordinate, and a real center, the released coordinate's squared displacement has expectation equal to the query's squared displacement plus twice the squared scale.
Formal statement
Proof (Lean source)
8 supporting declarations (lemmas, instances)
-
laplaceMechPi_map_centered_coordtheorem — At a real scale with a positive-scale certificate, a query, an input, and a coordinate, subtracting the query from the released coordinate gives exactly the centered scalar Laplace law.hypothesesD :sharedType u_1ι :sharedType u_2b :ℝhb :0 < bq :D → ι → ℝd :Di :ιconclusionProof (Lean source)
theorem laplaceMechPi_map_centered_coord (b : ℝ) (hb : 0 < b) (q : D → ι → ℝ) (d : D) (i : ι) : (laplaceMechPi b q d).map (fun y => y i - q d i) = laplaceMeasure b := by let : IsProbabilityMeasure (laplaceMeasure b) := laplaceMeasure_isProbabilityMeasure b hb rw [laplaceMechPi, Measure.map_map (by fun_prop) (by fun_prop)] have hcancel : (fun y : ι → ℝ => y i - q d i) ∘ (fun z => z + q d) = Function.eval i := by funext z simp [Pi.add_apply] rw [hcancel] exact (measurePreserving_eval (fun _ : ι => laplaceMeasure b) i).map_eq -
laplaceMechPi_integrable_centered_coordtheorem — At a real scale with a positive-scale certificate, a query, an input, and a coordinate, the released-coordinate error is integrable.hypothesesD :sharedType u_1ι :sharedType u_2b :ℝhb :0 < bq :D → ι → ℝd :Di :ιconclusionIntegrable (fun y => y i - q d i) (laplaceMechPi b q d)Proof (Lean source)
theorem laplaceMechPi_integrable_centered_coord (b : ℝ) (hb : 0 < b) (q : D → ι → ℝ) (d : D) (i : ι) : Integrable (fun y => y i - q d i) (laplaceMechPi b q d) := by have h : Integrable (fun x : ℝ => x) ((laplaceMechPi b q d).map (fun y => y i - q d i)) := by rw [laplaceMechPi_map_centered_coord b hb q d i] exact laplaceMeasure_integrable_id b hb exact (integrable_map_measure h.aestronglyMeasurable ((measurable_pi_apply i).sub measurable_const).aemeasurable).mp h -
laplaceMechPi_integral_centered_coordtheorem — At a real scale with a positive-scale certificate, a query, an input, and a coordinate, the released-coordinate error has mean zero.hypothesesD :sharedType u_1ι :sharedType u_2b :ℝhb :0 < bq :D → ι → ℝd :Di :ιconclusion∫ y, y i - q d i ∂laplaceMechPi b q d = 0Proof (Lean source)
theorem laplaceMechPi_integral_centered_coord (b : ℝ) (hb : 0 < b) (q : D → ι → ℝ) (d : D) (i : ι) : ∫ y, y i - q d i ∂laplaceMechPi b q d = 0 := by have hmap := integral_map (μ := laplaceMechPi b q d) (φ := fun y => y i - q d i) (f := fun x : ℝ => x) ((measurable_pi_apply i).sub measurable_const).aemeasurable (by fun_prop) rw [laplaceMechPi_map_centered_coord b hb q d i, laplaceMeasure_integral_id b hb] at hmap exact hmap.symm -
laplaceMechPi_integrable_centered_coord_sqtheorem — At a real scale with a positive-scale certificate, a query, an input, and a coordinate, the squared released-coordinate error is integrable.hypothesesD :sharedType u_1ι :sharedType u_2b :ℝhb :0 < bq :D → ι → ℝd :Di :ιconclusionIntegrable (fun y => (y i - q d i) ^ 2) (laplaceMechPi b q d)Proof (Lean source)
theorem laplaceMechPi_integrable_centered_coord_sq (b : ℝ) (hb : 0 < b) (q : D → ι → ℝ) (d : D) (i : ι) : Integrable (fun y => (y i - q d i) ^ 2) (laplaceMechPi b q d) := by have h : Integrable (fun x : ℝ => x ^ 2) ((laplaceMechPi b q d).map (fun y => y i - q d i)) := by rw [laplaceMechPi_map_centered_coord b hb q d i] exact laplaceMeasure_integrable_sq b hb exact (integrable_map_measure h.aestronglyMeasurable ((measurable_pi_apply i).sub measurable_const).aemeasurable).mp h -
laplaceMechPi_integral_centered_coord_sqtheorem — At a real scale with a positive-scale certificate, a query, an input, and a coordinate, the squared released-coordinate error has expectation exactly twice the squared scale.hypothesesD :sharedType u_1ι :sharedType u_2b :ℝhb :0 < bq :D → ι → ℝd :Di :ιconclusion∫ y, (y i - q d i) ^ 2 ∂laplaceMechPi b q d = 2 * b ^ 2Proof (Lean source)
theorem laplaceMechPi_integral_centered_coord_sq (b : ℝ) (hb : 0 < b) (q : D → ι → ℝ) (d : D) (i : ι) : ∫ y, (y i - q d i) ^ 2 ∂laplaceMechPi b q d = 2 * b ^ 2 := by have hmap := integral_map (μ := laplaceMechPi b q d) (φ := fun y => y i - q d i) (f := fun x : ℝ => x ^ 2) ((measurable_pi_apply i).sub measurable_const).aemeasurable (by fun_prop) rw [laplaceMechPi_map_centered_coord b hb q d i, laplaceMeasure_integral_sq b hb] at hmap exact hmap.symm -
laplaceMechPi_lintegral_centered_coord_sqtheorem — At a real scale with a positive-scale certificate, a query, an input, and a coordinate, the squared released-coordinate error has nonnegative extended expectation exactly twice the squared scale.hypothesesD :sharedType u_1ι :sharedType u_2b :ℝhb :0 < bq :D → ι → ℝd :Di :ιProof (Lean source)
theorem laplaceMechPi_lintegral_centered_coord_sq (b : ℝ) (hb : 0 < b) (q : D → ι → ℝ) (d : D) (i : ι) : ∫⁻ y, ofReal ((y i - q d i) ^ 2) ∂laplaceMechPi b q d = ofReal (2 * b ^ 2) := by rw [← ofReal_integral_eq_lintegral_ofReal (laplaceMechPi_integrable_centered_coord_sq b hb q d i) (ae_of_all _ fun y => sq_nonneg (y i - q d i)), laplaceMechPi_integral_centered_coord_sq b hb q d i] -
laplaceMechPi_integrable_coord_sub_sqtheorem — At a real scale with a positive-scale certificate, a query, an input, a coordinate, and a real center, the released coordinate's squared displacement from that center is integrable.hypothesesD :sharedType u_1ι :sharedType u_2b :ℝhb :0 < bq :D → ι → ℝd :Di :ιc :ℝconclusionIntegrable (fun y => (y i - c) ^ 2) (laplaceMechPi b q d)Proof (Lean source)
theorem laplaceMechPi_integrable_coord_sub_sq (b : ℝ) (hb : 0 < b) (q : D → ι → ℝ) (d : D) (i : ι) (c : ℝ) : Integrable (fun y => (y i - c) ^ 2) (laplaceMechPi b q d) := by let := laplaceMechPi_isProbabilityMeasure b hb q d have hsq := laplaceMechPi_integrable_centered_coord_sq b hb q d i have hlin := (laplaceMechPi_integrable_centered_coord b hb q d i).const_mul (2 * (q d i - c)) have hconst : Integrable (fun _ : ι → ℝ => (q d i - c) ^ 2) (laplaceMechPi b q d) := integrable_const _ refine ((hsq.add hlin).add hconst).congr (ae_of_all _ fun y => ?_) dsimp ring -
laplaceMechPi_lintegral_coord_sub_sqtheorem — At a real scale with a positive-scale certificate, a query, an input, a coordinate, and a real center, the released coordinate's squared displacement has the corresponding exact nonnegative extended moment.hypothesesD :sharedType u_1ι :sharedType u_2b :ℝhb :0 < bq :D → ι → ℝd :Di :ιc :ℝProof (Lean source)
theorem laplaceMechPi_lintegral_coord_sub_sq (b : ℝ) (hb : 0 < b) (q : D → ι → ℝ) (d : D) (i : ι) (c : ℝ) : ∫⁻ y, ofReal ((y i - c) ^ 2) ∂laplaceMechPi b q d = ofReal ((q d i - c) ^ 2 + 2 * b ^ 2) := by rw [← ofReal_integral_eq_lintegral_ofReal (laplaceMechPi_integrable_coord_sub_sq b hb q d i c) (ae_of_all _ fun y => sq_nonneg (y i - c)), laplaceMechPi_integral_coord_sub_sq b hb q d i c]
LaplaceKernelMoments 1 core · 4 supporting A probability input law and a measurable query with a square-integrable selected coordinate give an integrable released-coordinate square and the exact decomposition into input squared displacement plus 2 * b^2. ★ laplaceMechPiKernel_integral_coord_sub_sq
Exact moments under randomized inputs
A probability input law and a measurable query with a square-integrable
selected coordinate give an integrable released-coordinate square and the
exact decomposition into input squared displacement plus 2 * b^2.
Both measure-kernel composition and joint input-release cross terms are covered.
The nonnegative extended identity also holds without any moment assumption.
At a real scale with a positive-scale certificate, a query, its measurability certificate, a probability input law, a coordinate, a square-integrability certificate for that coordinate, and a real center, the release's squared-displacement expectation equals the input squared displacement plus exactly twice the squared noise scale.
Formal statement
Proof (Lean source)
4 supporting declarations (lemmas, instances)
-
laplaceMechPiKernel_lintegral_coord_sub_sqtheorem — At a real scale with a positive-scale certificate, a query, its measurability certificate, a probability input law, a coordinate, and a real center, mixing the release gives the exact nonnegative extended squared-displacement identity, even for infinite input moments.hypothesesD :sharedType u_1ι :sharedType u_2b :ℝhb :0 < bq :D → ι → ℝhq :μ :i :ιc :ℝconclusion∫⁻ y, ofReal ((y i - c) ^ 2) ∂(laplaceMechPiKernel b hb q hq ∘ₘ μ)Proof (Lean source)
theorem laplaceMechPiKernel_lintegral_coord_sub_sq (b : ℝ) (hb : 0 < b) (q : D → ι → ℝ) (hq : Measurable q) (μ : Measure D) [IsProbabilityMeasure μ] (i : ι) (c : ℝ) : ∫⁻ y, ofReal ((y i - c) ^ 2) ∂(laplaceMechPiKernel b hb q hq ∘ₘ μ) = (∫⁻ d, ofReal ((q d i - c) ^ 2) ∂μ) + ofReal (2 * b ^ 2) := by have hy : Measurable (fun y : ι → ℝ => ofReal ((y i - c) ^ 2)) := (((measurable_pi_apply i).sub measurable_const).pow_const 2).ennreal_ofReal have hd : Measurable (fun d => ofReal ((q d i - c) ^ 2)) := ((((measurable_pi_apply i).comp hq).sub measurable_const).pow_const 2).ennreal_ofReal change ∫⁻ y, ofReal ((y i - c) ^ 2) ∂μ.bind (laplaceMechPiKernel b hb q hq) = _ rw [Measure.lintegral_bind (laplaceMechPiKernel b hb q hq).measurable.aemeasurable hy.aemeasurable] simp_rw [laplaceMechPiKernel_apply, laplaceMechPi_lintegral_coord_sub_sq b hb q, ENNReal.ofReal_add (sq_nonneg (q _ i - c)) (mul_nonneg (show (0 : ℝ) ≤ 2 by norm_num) (sq_nonneg b))] rw [lintegral_add_left hd] simp -
laplaceMechPiKernel_integrable_coord_sub_sqtheorem — At a real scale with a positive-scale certificate, a query, its measurability certificate, a probability input law, a coordinate, a square-integrability certificate for that coordinate, and a real center, the mixed release has an integrable squared displacement.hypothesesD :sharedType u_1ι :sharedType u_2b :ℝhb :0 < bq :D → ι → ℝhq :μ :i :ιhqsq :Integrable (fun d => (q d i) ^ 2) μc :ℝconclusionIntegrable (fun y => (y i - c) ^ 2) (laplaceMechPiKernel b hb q hq ∘ₘ μ)Proof (Lean source)
theorem laplaceMechPiKernel_integrable_coord_sub_sq (b : ℝ) (hb : 0 < b) (q : D → ι → ℝ) (hq : Measurable q) (μ : Measure D) [IsProbabilityMeasure μ] (i : ι) (hqsq : Integrable (fun d => (q d i) ^ 2) μ) (c : ℝ) : Integrable (fun y => (y i - c) ^ 2) (laplaceMechPiKernel b hb q hq ∘ₘ μ) := by have hL2 : MemLp (fun d => q d i) 2 μ := (memLp_two_iff_integrable_sq ((measurable_pi_apply i).comp hq).aestronglyMeasurable).mpr hqsq have hin : Integrable (fun d => (q d i - c) ^ 2) μ := (hL2.sub (memLp_const c)).integrable_sq refine ⟨(show Measurable (fun y : ι → ℝ => (y i - c) ^ 2) from ((measurable_pi_apply i).sub measurable_const).pow_const 2).aestronglyMeasurable, ?_⟩ apply (hasFiniteIntegral_iff_ofReal (ae_of_all _ fun y : ι → ℝ => sq_nonneg (y i - c))).mpr rw [laplaceMechPiKernel_lintegral_coord_sub_sq b hb q hq μ i c] exact ENNReal.add_lt_top.mpr ⟨(hasFiniteIntegral_iff_ofReal (ae_of_all _ fun d => sq_nonneg (q d i - c))).mp hin.hasFiniteIntegral, ENNReal.ofReal_lt_top⟩ -
laplaceMechPiKernel_integrable_crosstheorem — At a real scale with a positive-scale certificate, a query, its measurability certificate, a probability input law, a coordinate, a square-integrability certificate for that coordinate, and a real center, the displacement-error cross term is integrable under the joint input-release law.hypothesesD :sharedType u_1ι :sharedType u_2b :ℝhb :0 < bq :D → ι → ℝhq :μ :i :ιhqsq :Integrable (fun d => (q d i) ^ 2) μc :ℝconclusionIntegrable (fun p : D × (ι → ℝ) => (q p.1 i - c) * (p.2 i - q p.1 i)) (μ ⊗ₘ laplaceMechPiKernel b hb q hq)Proof (Lean source)
theorem laplaceMechPiKernel_integrable_cross (b : ℝ) (hb : 0 < b) (q : D → ι → ℝ) (hq : Measurable q) (μ : Measure D) [IsProbabilityMeasure μ] (i : ι) (hqsq : Integrable (fun d => (q d i) ^ 2) μ) (c : ℝ) : Integrable (fun p : D × (ι → ℝ) => (q p.1 i - c) * (p.2 i - q p.1 i)) (μ ⊗ₘ laplaceMechPiKernel b hb q hq) := by have hL2 : MemLp (fun d => q d i) 2 μ := (memLp_two_iff_integrable_sq ((measurable_pi_apply i).comp hq).aestronglyMeasurable).mpr hqsq have hin : Integrable (fun d => q d i - c) μ := (hL2.sub (memLp_const c)).integrable (by norm_num) have hf : Measurable (fun p : D × (ι → ℝ) => (q p.1 i - c) * (p.2 i - q p.1 i)) := (((measurable_pi_apply i).comp (hq.comp measurable_fst)).sub measurable_const).mul (((measurable_pi_apply i).comp measurable_snd).sub ((measurable_pi_apply i).comp (hq.comp measurable_fst))) apply (Measure.integrable_compProd_iff hf.aestronglyMeasurable).mpr constructor · exact ae_of_all _ fun d => (laplaceMechPi_integrable_centered_coord b hb q d i).const_mul (q d i - c) · have habs (d : D) : ∫ y, |y i - q d i| ∂laplaceMechPi b q d = b := by have hmap := integral_map (μ := laplaceMechPi b q d) (φ := fun y => y i - q d i) (f := fun x : ℝ => |x|) ((measurable_pi_apply i).sub measurable_const).aemeasurable (by fun_prop) rw [laplaceMechPi_map_centered_coord b hb q d i, laplaceMeasure_integral_abs b hb] at hmap exact hmap.symm simpa only [laplaceMechPiKernel_apply, norm_mul, Real.norm_eq_abs, integral_const_mul, habs] using hin.norm.mul_const b -
laplaceMechPiKernel_integral_crosstheorem — At a real scale with a positive-scale certificate, a query, its measurability certificate, a probability input law, a coordinate, a square-integrability certificate for that coordinate, and a real center, the displacement-error cross term has integral zero.hypothesesD :sharedType u_1ι :sharedType u_2b :ℝhb :0 < bq :D → ι → ℝhq :μ :i :ιhqsq :Integrable (fun d => (q d i) ^ 2) μc :ℝconclusion∫ p : D × (ι → ℝ), (q p.1 i - c) * (p.2 i - q p.1 i) ∂(μ ⊗ₘ laplaceMechPiKernel b hb q hq)= 0Proof (Lean source)
theorem laplaceMechPiKernel_integral_cross (b : ℝ) (hb : 0 < b) (q : D → ι → ℝ) (hq : Measurable q) (μ : Measure D) [IsProbabilityMeasure μ] (i : ι) (hqsq : Integrable (fun d => (q d i) ^ 2) μ) (c : ℝ) : ∫ p : D × (ι → ℝ), (q p.1 i - c) * (p.2 i - q p.1 i) ∂(μ ⊗ₘ laplaceMechPiKernel b hb q hq) = 0 := by rw [Measure.integral_compProd (laplaceMechPiKernel_integrable_cross b hb q hq μ i hqsq c)] simp only [laplaceMechPiKernel_apply, integral_const_mul, laplaceMechPi_integral_centered_coord b hb q, mul_zero, integral_zero]
LaplaceMean 1 core · 2 supporting Reflection invariance and the exact zero mean of the existing density-defined Laplace measure. ★ laplaceMeasure_integral_id
Centered Laplace mean
Reflection invariance and the exact zero mean of the existing density-defined Laplace measure. Absolute integrability is reused from the primary library. This file is independent of the second-moment proof chain.
At a real scale with a positive-scale certificate, a centered Laplace draw has mean zero.
Formal statement
Proof (Lean source)
2 supporting declarations (lemmas, instances)
-
laplaceMeasure_integrable_idtheorem — At a real scale with a positive-scale certificate, a centered Laplace draw has an integrable signed value.Proof (Lean source)
theorem laplaceMeasure_integrable_id (b : ℝ) (hb : 0 < b) : Integrable (fun x : ℝ => x) (laplaceMeasure b) := by exact (laplaceMeasure_integrable_abs b hb).mono' (by fun_prop) (ae_of_all _ fun x => by simp) -
laplaceMeasure_map_negtheorem — At a real scale, reflecting the centered Laplace measure about zero preserves that measure.Proof (Lean source)
theorem laplaceMeasure_map_neg (b : ℝ) : (laplaceMeasure b).map (fun x : ℝ => -x) = laplaceMeasure b := by ext s hs rw [Measure.map_apply (by fun_prop) hs, laplaceMeasure, withDensity_apply _ (hs.preimage (by fun_prop)), withDensity_apply _ hs] calc (∫⁻ x in (fun x : ℝ => -x) ⁻¹' s, ofReal (laplacePDF b x)) = ∫⁻ x in (fun x : ℝ => -x) ⁻¹' s, ofReal (laplacePDF b (-x)) := by simp only [laplacePDF, abs_neg] _ = ∫⁻ x in s, ofReal (laplacePDF b x) ∂(volume.map (fun x : ℝ => -x)) := (setLIntegral_map hs (measurable_laplacePDF b).ennreal_ofReal (by fun_prop)).symm _ = _ := by rw [Measure.map_neg_eq_self]
LaplaceSecondMoment 1 core · 4 supporting The density-weighted square is integrable, and its integral is exactly twice the squared scale. ★ laplaceMeasure_integral_sq
Exact Laplace second moments
The density-weighted square is integrable, and its integral is exactly twice
the squared scale. Bochner and nonnegative extended-integral interfaces are
provided for the existing laplaceMeasure; no new distribution is defined.
At a real scale with a positive-scale certificate, a centered Laplace draw has second moment exactly twice the squared scale.
Formal statement
Proof (Lean source)
4 supporting declarations (lemmas, instances)
-
integrable_sq_mul_laplacePDFtheorem — At a real scale with a positive-scale certificate, the square times the centered Laplace density is integrable with respect to Lebesgue measure.Proof (Lean source)
theorem integrable_sq_mul_laplacePDF (b : ℝ) (hb : 0 < b) : Integrable (fun x : ℝ => x ^ 2 * laplacePDF b x) := by let f : ℝ → ℝ := fun x => (2 * b)⁻¹ * (x ^ 2 * exp (-x / b)) have hright : IntegrableOn f (Ioi 0) := by have hbase := Real.GammaIntegral_convergent (s := (3 : ℝ)) (by norm_num) have hscaled : IntegrableOn (fun x : ℝ => exp (-(1 / b * x)) * (1 / b * x) ^ ((3 : ℝ) - 1)) (Ioi 0) := (integrableOn_Ioi_comp_mul_left_iff (fun x : ℝ => exp (-x) * x ^ ((3 : ℝ) - 1)) 0 (one_div_pos.mpr hb)).mpr (by simpa using hbase) have hs : IntegrableOn (fun x : ℝ => (2 * b)⁻¹ * (b ^ 2 * (exp (-(1 / b * x)) * (1 / b * x) ^ ((3 : ℝ) - 1)))) (Ioi 0) := (hscaled.const_mul (b ^ 2)).const_mul (2 * b)⁻¹ refine hs.congr_fun ?_ measurableSet_Ioi intro x hx simp only [f, show (3 : ℝ) - 1 = 2 by norm_num, Real.rpow_two] rw [show -(1 / b * x) = -x / b by ring] field_simp [hb.ne'] have hright_abs : IntegrableOn (fun x => f |x|) (Ioi 0) := by refine hright.congr_fun ?_ measurableSet_Ioi intro x hx change f x = f |x| rw [abs_of_pos (by simpa only [mem_Ioi] using hx)] have hall : Integrable (fun x => f |x|) := by have hleft : IntegrableOn (fun x => f |x|) (Iic 0) := by rw [← Measure.map_neg_eq_self (volume : Measure ℝ)] let m : MeasurableEmbedding fun x : ℝ => -x := (Homeomorph.neg ℝ).measurableEmbedding rw [m.integrableOn_map_iff] simp_rw [Function.comp_def, abs_neg, neg_preimage, neg_Iic, neg_zero] exact mpr integrableOn_Ici_iff_integrableOn_Ioi hright_abs rw [← integrableOn_univ] simpa only [Iic_union_Ioi] using hleft.union hright_abs refine hall.congr (ae_of_all _ fun x => ?_) simp only [f, laplacePDF, sq_abs] ring -
integral_sq_mul_exp_neg_div_Ioitheorem — At a real scale with a positive-scale certificate, the positive-half-line quadratic exponential integral equals twice the cubed scale.Proof (Lean source)
theorem integral_sq_mul_exp_neg_div_Ioi (b : ℝ) (hb : 0 < b) : (∫ x : ℝ in Ioi 0, x ^ 2 * exp (-x / b)) = 2 * b ^ 3 := by calc _ = ∫ x : ℝ in Ioi 0, x ^ ((3 : ℝ) - 1) * exp (-((1 / b) * x)) := by apply setIntegral_congr_fun measurableSet_Ioi intro x hx simp only [show (3 : ℝ) - 1 = 2 by norm_num, Real.rpow_two] rw [show -x / b = -(1 / b * x) by ring] _ = (1 / (1 / b)) ^ (3 : ℝ) * Gamma (3 : ℝ) := Real.integral_rpow_mul_exp_neg_mul_Ioi (by norm_num) (one_div_pos.mpr hb) _ = 2 * b ^ 3 := by rw [show Gamma (3 : ℝ) = 2 by norm_num] rw [one_div_one_div, show b ^ (3 : ℝ) = b ^ (3 : ℕ) from Real.rpow_natCast b 3] ring -
laplaceMeasure_integrable_sqtheorem — At a real scale with a positive-scale certificate, a centered Laplace draw has an integrable square.Proof (Lean source)
theorem laplaceMeasure_integrable_sq (b : ℝ) (hb : 0 < b) : Integrable (fun x : ℝ => x ^ 2) (laplaceMeasure b) := by have hnonneg (x : ℝ) : 0 ≤ laplacePDF b x := by unfold laplacePDF positivity rw [laplaceMeasure, integrable_withDensity_iff_integrable_smul' (measurable_laplacePDF b).ennreal_ofReal (ae_of_all _ fun _ => ENNReal.ofReal_lt_top)] simpa only [ENNReal.toReal_ofReal (hnonneg _), smul_eq_mul, mul_comm] using integrable_sq_mul_laplacePDF b hb -
laplaceMeasure_lintegral_sqtheorem — At a real scale with a positive-scale certificate, a centered Laplace draw has nonnegative extended second moment exactly twice the squared scale.hypothesesb :ℝhb :0 < bProof (Lean source)
theorem laplaceMeasure_lintegral_sq (b : ℝ) (hb : 0 < b) : ∫⁻ x : ℝ, ofReal (x ^ 2) ∂laplaceMeasure b = ofReal (2 * b ^ 2) := by rw [← ofReal_integral_eq_lintegral_ofReal (laplaceMeasure_integrable_sq b hb) (ae_of_all _ fun x => sq_nonneg x), laplaceMeasure_integral_sq b hb]