import Mathlib /-! # Exact Continuous Hockey-Stick Divergence, Optimal Laplace Profile, # Balle–Wang Analytic Gaussian Mechanism, & Sharp RDP-to-(ε,δ) Conversion This standalone Lean 4 file formalizes Pillar 1 of Wave-6 Track 5 with 0% overlap against `open-streaming-sketching-privacy-frontiers/DifferentialPrivacyBlackwellMinimax.lean`: 1. **Continuous Hockey-Stick Divergence, Neyman–Pearson Equivalence, DPI & Group Privacy (`Section 1`):** - `contHockeyStick α p q := ∫ x, max 0 (p x - α * q x)` on `ℝ`. - Exact Neyman–Pearson threshold event attainment (`contHockeyStick_eq_lrt_event`), exact continuous `(ε, δ)`-DP equivalence (`contEpsDelta_iff_hockeyStick`), exact continuous Markov-kernel data-processing inequality (`contHockeyStick_kernel_dpi`), and exact continuous `k`-group privacy escalation (`contEpsDelta_group_privacy`). 2. **Exact Optimal `(ε, δ)`-DP Profile of the Continuous Laplace Mechanism (`Section 2`):** - `laplacePDF μ b x := (1 / (2 * b)) * exp (-|x - μ| / b)` with `∫ laplacePDF μ b = 1`. - Exact closed-form hockey-stick curve (`laplace_hockeyStick_exact`): `H_{e^ε}(Lap(Δ, b), Lap(0, b)) = max 0 (1 - exp ((ε - Δ / b) / 2))` for all `Δ ≥ 0`, `b > 0`, `ε ≥ 0`, with exact symmetry (`laplace_hockeyStick_symm`), explicit threshold-event sharpness witness, and strict noise reduction over pure-DP calibration (`laplace_exact_beats_pure_calibration`). 3. **Exact Balle–Wang Analytic Gaussian Mechanism Theorem (`Section 3`):** - Standard normal PDF `stdGaussPDF x = (2π)^{-1/2} exp(-x²/2)` and CDF `stdGaussCDF t = ∫ x in Iic t, stdGaussPDF x`. - Complete analytic library for `Φ`: positivity, `< 1`, strict monotonicity, symmetry `Φ(-t) = 1 - Φ(t)`, `Φ(0) = 1/2`, exact derivative `Φ' = φ`, limits `0`/`1`, and exact Mills-ratio / Chernoff tail bounds `Φ(-t) ≤ φ(t)/t` (`stdGaussCDF_neg_le_mills`) and `Φ(-t) ≤ (1/2) exp(-t²/2)` (`stdGaussCDF_neg_le_half_exp`). - **Exact Balle–Wang Theorem (`balle_wang_gaussian_hockeyStick_exact`):** for all `Δ > 0, σ > 0` (`μ = Δ / σ`) and ALL `ε ∈ ℝ` (positive, zero, or negative!), `H_{e^ε}(N(Δ, σ²), N(0, σ²)) = Φ(-ε/μ + μ/2) - e^ε Φ(-ε/μ - μ/2)`, with exact symmetry (`balle_wang_gaussian_symm`) and half-space Neyman–Pearson witness! - Exact closed-form derivatives `∂_μ δ_BW = φ(-ε/μ + μ/2) > 0` (`hasDerivAt_balleWangDelta_mu`) and `∂_ε δ_BW = -e^ε Φ(-ε/μ - μ/2) < 0` (`hasDerivAt_balleWangDelta_eps`). - **Strict Non-Asymptotic Dominance over Classical Dwork–Roth Gaussian Mechanism:** - For `ε ∈ (0, 1]` and `δ ∈ (0, 1/2]`, Balle–Wang strictly beats Dwork–Roth: `δ_BW(ε, ε / √(2 ln(1.25 / δ))) < δ` (`balle_wang_strictly_beats_dwork_roth_small_eps`). - In the high-budget regime `ε > 1` (e.g. `ε ≥ max(8, 4 ln(5/(4δ)))`), classical Dwork–Roth **fails** `(ε, δ)`-DP (`dwork_roth_fails_large_eps`), while Balle–Wang holds with exact `Θ(1/√ε)` scaling for ALL `ε > 0` (`balle_wang_valid_all_eps`). 4. **Exact Continuous Gaussian Rényi Divergence & Sharp Balle et al. (2020) RDP-to-(ε,δ) Conversion (`Section 4`):** - Exact continuous Gaussian Rényi divergence `D_α(N(Δ, σ²) ‖ N(0, σ²)) = α Δ² / (2 σ²)` (`gaussian_renyi_div_exact`). - Sharp pointwise hockey-stick inequality (`sharp_hockeyStick_pointwise_bound`) and **Sharp Balle–Barthe–Gaboardi–Hsu–Sato (2020) RDP-to-(ε,δ) Conversion (`sharp_rdp_to_epsDelta`):** `H_{e^ε}(p, q) ≤ ((α - 1)^{α - 1} / α^α) · exp((α - 1)(D_α(p ‖ q) - ε))`, strictly beating Mironov (2017) by `((α - 1)^{α - 1} / α^α) < 1` (`≤ 1/4` for `α ≥ 2`). -/ noncomputable section open MeasureTheory Real Set Filter Topology namespace ContinuousMechanismDPAndBalleWang /-! ## Helper Lebesgue Change-of-Variables Lemmas on `ℝ` -/ /-- Reflection change of variables on half-lines: `∫_{x ≤ t} f(x) dx = ∫_{y > -t} f(-y) dy`. -/ lemma setIntegral_Iic_eq_Ioi_neg (f : ℝ → ℝ) (t : ℝ) : (∫ x in Iic t, f x) = ∫ y in Ioi (-t), f (-y) := by have h := integral_comp_neg_Ioi (-t) f rw [neg_neg] at h exact h.symm /-- Translation change of variables on right half-lines: `∫_{x > t} f(x + c) dx = ∫_{y > t + c} f(y) dy`. -/ lemma setIntegral_Ioi_comp_add_right (f : ℝ → ℝ) (t c : ℝ) : (∫ x in Ioi t, f (x + c)) = ∫ y in Ioi (t + c), f y := by rw [← integral_indicator measurableSet_Ioi, ← integral_indicator measurableSet_Ioi] rw [← integral_add_right_eq_self (fun y => (Ioi (t + c)).indicator f y) c] refine integral_congr_ae (Eventually.of_forall fun x => ?_) by_cases hx : t < x · have hx' : t + c < x + c := by linarith simp [Set.indicator, hx, hx'] · have hx' : ¬ (t + c < x + c) := by linarith simp [Set.indicator, hx, hx'] /-- Positive scaling change of variables on right half-lines: `∫_{x > t} f(c * x) dx = c⁻¹ * ∫_{y > c * t} f(y) dy` for `c > 0`. -/ lemma setIntegral_Ioi_comp_mul_left (f : ℝ → ℝ) {c : ℝ} (hc : 0 < c) (t : ℝ) : (∫ x in Ioi t, f (c * x)) = c⁻¹ * ∫ y in Ioi (c * t), f y := by rw [← integral_indicator measurableSet_Ioi, ← integral_indicator measurableSet_Ioi] have h1 := Measure.integral_comp_mul_left (fun y => (Ioi (c * t)).indicator f y) c rw [abs_of_pos (inv_pos.mpr hc), smul_eq_mul] at h1 rw [← h1] refine integral_congr_ae (Eventually.of_forall fun x => ?_) by_cases hx : t < x · have hx' : c * t < c * x := mul_lt_mul_of_pos_left hx hc simp [Set.indicator, hx, hx'] · have hx' : ¬ (c * t < c * x) := fun h => hx ((mul_lt_mul_iff_right₀ hc).mp h) simp [Set.indicator, hx, hx'] /-- Reflection + shift invariance on all of `ℝ`: `∫ x, f(c - x) dx = ∫ x, f(x) dx`. -/ lemma integral_comp_sub_left_univ (f : ℝ → ℝ) (c : ℝ) : (∫ x : ℝ, f (c - x)) = ∫ x : ℝ, f x := integral_sub_left_eq_self f volume c /-! ## Section 1: Continuous Hockey-Stick Divergence, Neyman–Pearson Equivalence, DPI, & Group Privacy -/ /-- Continuous hockey-stick divergence `H_α(p, q) = ∫ max(0, p(x) - α q(x)) dx`. -/ def contHockeyStick (α : ℝ) (p q : ℝ → ℝ) : ℝ := ∫ x : ℝ, max 0 (p x - α * q x) /-- Continuous `(ε, δ)`-DP predicate on a pair of probability densities `(p, q)` on `ℝ`. -/ def IsContEpsDeltaPair (ε δ : ℝ) (p q : ℝ → ℝ) : Prop := (∀ S : Set ℝ, MeasurableSet S → (∫ x in S, p x) ≤ Real.exp ε * (∫ x in S, q x) + δ) ∧ (∀ S : Set ℝ, MeasurableSet S → (∫ x in S, q x) ≤ Real.exp ε * (∫ x in S, p x) + δ) lemma integrable_max_zero_sub {α : ℝ} {p q : ℝ → ℝ} (hp : Integrable p) (hq : Integrable q) : Integrable (fun x => max 0 (p x - α * q x)) := (integrable_zero ℝ ℝ volume).sup (hp.sub (hq.const_mul α)) lemma contHockeyStick_nonneg (α : ℝ) (p q : ℝ → ℝ) : 0 ≤ contHockeyStick α p q := by unfold contHockeyStick exact integral_nonneg fun _ => le_max_left _ _ /-- For any measurable set `S`, `∫_S p - α ∫_S q ≤ H_α(p, q)`. -/ theorem contHockeyStick_ge_event {α : ℝ} {p q : ℝ → ℝ} (hp : Integrable p) (hq : Integrable q) {S : Set ℝ} (hS : MeasurableSet S) : (∫ x in S, p x) - α * (∫ x in S, q x) ≤ contHockeyStick α p q := by unfold contHockeyStick have h1 : (∫ x in S, p x) - α * (∫ x in S, q x) = ∫ x in S, (p x - α * q x) := by rw [← integral_const_mul, ← integral_sub hp.integrableOn (hq.const_mul α).integrableOn] rw [h1] have hle1 : (∫ x in S, (p x - α * q x)) ≤ ∫ x in S, max 0 (p x - α * q x) := by refine setIntegral_mono_on (hp.sub (hq.const_mul α)).integrableOn (integrable_max_zero_sub hp hq).integrableOn hS fun x _ => le_max_right _ _ have hle2 : (∫ x in S, max 0 (p x - α * q x)) ≤ ∫ x, max 0 (p x - α * q x) := by refine setIntegral_le_integral (integrable_max_zero_sub hp hq) (Eventually.of_forall fun _ => le_max_left _ _) exact le_trans hle1 hle2 /-- **Neyman–Pearson Exact Attainment:** The threshold event `A_α = {x | α q(x) < p(x)}` attains `∫_{A_α} p - α ∫_{A_α} q = H_α(p, q)`. -/ theorem contHockeyStick_eq_lrt_event {α : ℝ} {p q : ℝ → ℝ} (hp : Integrable p) (hq : Integrable q) (hp_m : Measurable p) (hq_m : Measurable q) : let A : Set ℝ := {x | α * q x < p x} MeasurableSet A ∧ (∫ x in A, p x) - α * (∫ x in A, q x) = contHockeyStick α p q := by intro A have hA : MeasurableSet A := measurableSet_lt (hq_m.const_mul α) hp_m refine ⟨hA, ?_⟩ unfold contHockeyStick have hsub : (∫ x in A, p x) - α * (∫ x in A, q x) = ∫ x in A, (p x - α * q x) := by rw [← integral_const_mul, ← integral_sub hp.integrableOn (hq.const_mul α).integrableOn] rw [hsub] have hind : (fun x => max 0 (p x - α * q x)) = A.indicator (fun x => p x - α * q x) := by ext x by_cases hx : x ∈ A · have hpos : 0 < p x - α * q x := sub_pos.mpr hx simp [hx, max_eq_right hpos.le] · have hle : p x - α * q x ≤ 0 := sub_nonpos.mpr (not_lt.mp hx) simp [hx, max_eq_left hle] rw [hind, integral_indicator hA] /-- **Exact Continuous `(ε, δ)`-DP Equivalence:** A measurable density pair `(p, q)` is `(ε, δ)`-DP iff `max(H_{e^ε}(p, q), H_{e^ε}(q, p)) ≤ δ`. -/ theorem contEpsDelta_iff_hockeyStick {ε δ : ℝ} {p q : ℝ → ℝ} (hp : Integrable p) (hq : Integrable q) (hp_m : Measurable p) (hq_m : Measurable q) : IsContEpsDeltaPair ε δ p q ↔ max (contHockeyStick (Real.exp ε) p q) (contHockeyStick (Real.exp ε) q p) ≤ δ := by constructor · rintro ⟨h1, h2⟩ refine max_le ?_ ?_ · obtain ⟨hA, heq⟩ := contHockeyStick_eq_lrt_event (α := Real.exp ε) hp hq hp_m hq_m linarith [h1 _ hA] · obtain ⟨hB, heq⟩ := contHockeyStick_eq_lrt_event (α := Real.exp ε) hq hp hq_m hp_m linarith [h2 _ hB] · intro hmax have h1 : contHockeyStick (Real.exp ε) p q ≤ δ := le_trans (le_max_left _ _) hmax have h2 : contHockeyStick (Real.exp ε) q p ≤ δ := le_trans (le_max_right _ _) hmax constructor · intro S hS linarith [contHockeyStick_ge_event (α := Real.exp ε) hp hq hS] · intro S hS linarith [contHockeyStick_ge_event (α := Real.exp ε) hq hp hS] /-- **Continuous Data-Processing Inequality (Markov-Kernel Post-Processing Monotonicity):** Pushing forward `(p, q)` through any nonnegative stochastic kernel `K(y, x)` (`∫ y, K y x = 1`) never increases continuous hockey-stick divergence `H_α`. -/ theorem contHockeyStick_kernel_dpi {α : ℝ} {p q : ℝ → ℝ} {K : ℝ → ℝ → ℝ} (hK_nonneg : ∀ y x, 0 ≤ K y x) (hK_stoch : ∀ x, (∫ y, K y x) = 1) (hKp : Integrable (Function.uncurry fun y x => K y x * p x) (volume.prod volume)) (hKq : Integrable (Function.uncurry fun y x => K y x * q x) (volume.prod volume)) (hKmax : Integrable (Function.uncurry fun y x => K y x * max 0 (p x - α * q x)) (volume.prod volume)) : contHockeyStick α (fun y => ∫ x, K y x * p x) (fun y => ∫ x, K y x * q x) ≤ contHockeyStick α p q := by unfold contHockeyStick have hp_int : Integrable (fun y => ∫ x, K y x * p x) := hKp.integral_prod_left have hq_int : Integrable (fun y => ∫ x, K y x * q x) := hKq.integral_prod_left have hmax_int : Integrable (fun y => ∫ x, K y x * max 0 (p x - α * q x)) := hKmax.integral_prod_left have hae_p : ∀ᵐ y ∂volume, Integrable (fun x => K y x * p x) := hKp.prod_right_ae have hae_q : ∀ᵐ y ∂volume, Integrable (fun x => K y x * q x) := hKq.prod_right_ae have hae_m : ∀ᵐ y ∂volume, Integrable (fun x => K y x * max 0 (p x - α * q x)) := hKmax.prod_right_ae have hae_le : (fun y => max 0 ((∫ x, K y x * p x) - α * (∫ x, K y x * q x))) ≤ᵐ[volume] (fun y => ∫ x, K y x * max 0 (p x - α * q x)) := by filter_upwards [hae_p, hae_q, hae_m] with y hyp hyq hymax refine max_le ?_ ?_ · exact integral_nonneg fun x => mul_nonneg (hK_nonneg y x) (le_max_left _ _) · rw [← integral_const_mul, ← integral_sub hyp (hyq.const_mul α)] refine integral_mono (hyp.sub (hyq.const_mul α)) hymax fun x => ?_ have h1 : K y x * p x - α * (K y x * q x) = K y x * (p x - α * q x) := by ring rw [h1] exact mul_le_mul_of_nonneg_left (le_max_right _ _) (hK_nonneg y x) have hstep1 : (∫ y, max 0 ((∫ x, K y x * p x) - α * (∫ x, K y x * q x))) ≤ ∫ y, ∫ x, K y x * max 0 (p x - α * q x) := integral_mono_ae (integrable_max_zero_sub hp_int hq_int) hmax_int hae_le have hswap : (∫ y, ∫ x, K y x * max 0 (p x - α * q x)) = ∫ x, ∫ y, K y x * max 0 (p x - α * q x) := integral_integral_swap hKmax have hcol : (∫ x, ∫ y, K y x * max 0 (p x - α * q x)) = ∫ x, max 0 (p x - α * q x) := by refine integral_congr_ae (Eventually.of_forall fun x => ?_) dsimp only rw [integral_mul_const, hK_stoch x, one_mul] linarith /-- **Continuous `k`-Group Privacy Escalation:** Along any chain `p₀, p₁, ..., p_k` of adjacent `(ε, δ)`-DP densities, `(p₀, p_k)` satisfies `(k ε, δ · ∑_{j=0}^{k-1} e^{j ε})`-DP. -/ theorem contEpsDelta_group_privacy {k : ℕ} {ε δ : ℝ} (P : Fin (k + 1) → ℝ → ℝ) (hadj : ∀ i : Fin k, IsContEpsDeltaPair ε δ (P i.castSucc) (P i.succ)) : IsContEpsDeltaPair ((k : ℝ) * ε) (δ * ∑ j ∈ Finset.range k, Real.exp ((j : ℝ) * ε)) (P 0) (P (Fin.last k)) := by induction k with | zero => simp only [Nat.cast_zero, zero_mul, Finset.range_zero, Finset.sum_empty, mul_zero, Fin.last_zero] exact ⟨fun _ _ => by simp, fun _ _ => by simp⟩ | succ m ih => have hprev := ih (fun i => P i.castSucc) (fun i => hadj i.castSucc) have hlast := hadj (Fin.last m) have hsum : ∑ j ∈ Finset.range (m + 1), Real.exp ((j : ℝ) * ε) = 1 + Real.exp ε * ∑ j ∈ Finset.range m, Real.exp ((j : ℝ) * ε) := by rw [Finset.sum_range_succ'] simp only [Nat.cast_zero, zero_mul, Real.exp_zero, Finset.mul_sum] rw [add_comm] congr 1 refine Finset.sum_congr rfl fun j _ => ?_ rw [← Real.exp_add] congr 1 push_cast; ring have hexp_succ : Real.exp (((m + 1 : ℕ) : ℝ) * ε) = Real.exp ε * Real.exp ((m : ℝ) * ε) := by rw [← Real.exp_add] congr 1 push_cast; ring have hsum_rev : ∑ j ∈ Finset.range (m + 1), Real.exp ((j : ℝ) * ε) = Real.exp ((m : ℝ) * ε) + ∑ j ∈ Finset.range m, Real.exp ((j : ℝ) * ε) := by rw [Finset.sum_range_succ, add_comm] constructor · intro S hS have ha := hprev.1 S hS have hb := hlast.1 S hS simp only [Fin.castSucc_zero, Fin.succ_last] at ha hb have hpos : 0 ≤ Real.exp ((m : ℝ) * ε) := (Real.exp_pos _).le have hmul : Real.exp ((m : ℝ) * ε) * (∫ x in S, P (Fin.last m).castSucc x) ≤ Real.exp ((m : ℝ) * ε) * (Real.exp ε * (∫ x in S, P (Fin.last (m + 1)) x) + δ) := mul_le_mul_of_nonneg_left hb hpos rw [hexp_succ, hsum_rev] nlinarith · intro S hS have ha := hlast.2 S hS have hb := hprev.2 S hS simp only [Fin.castSucc_zero, Fin.succ_last] at ha hb have hpos : 0 ≤ Real.exp ε := (Real.exp_pos _).le have hmul : Real.exp ε * (∫ x in S, P (Fin.last m).castSucc x) ≤ Real.exp ε * (Real.exp ((m : ℝ) * ε) * (∫ x in S, P 0 x) + δ * ∑ j ∈ Finset.range m, Real.exp ((j : ℝ) * ε)) := mul_le_mul_of_nonneg_left hb hpos rw [hexp_succ, hsum] nlinarith /-! ## Section 2: Exact Optimal `(ε, δ)`-DP Profile of the Continuous Laplace Mechanism -/ /-- Continuous Laplace probability density `Lap(μ, b)(x) = (1 / (2 b)) exp(-|x - μ| / b)`. -/ def laplacePDF (μ b x : ℝ) : ℝ := (1 / (2 * b)) * Real.exp (-|x - μ| / b) lemma laplacePDF_pos {μ b : ℝ} (hb : 0 < b) (x : ℝ) : 0 < laplacePDF μ b x := by unfold laplacePDF positivity lemma laplacePDF_nonneg {μ b : ℝ} (hb : 0 < b) (x : ℝ) : 0 ≤ laplacePDF μ b x := (laplacePDF_pos hb x).le lemma measurable_laplacePDF (μ b : ℝ) : Measurable (laplacePDF μ b) := by unfold laplacePDF fun_prop /-- Integrability of `exp(-a x)` on `Ioi t` for `a > 0`. -/ lemma integrableOn_Ioi_exp_neg_mul {a : ℝ} (ha : 0 < a) (t : ℝ) : IntegrableOn (fun x => Real.exp (-a * x)) (Ioi t) := by have hderiv : ∀ x : ℝ, HasDerivAt (fun y => -(1 / a) * Real.exp (-a * y)) (Real.exp (-a * x)) x := by intro x have h1 : HasDerivAt (fun y => -a * y) (-a) x := by simpa using (hasDerivAt_id x).const_mul (-a) have h2 : HasDerivAt (fun y => Real.exp (-a * y)) (Real.exp (-a * x) * (-a)) x := h1.exp refine (h2.const_mul (-(1 / a))).congr_deriv ?_ field_simp [ha.ne'] have htend : Tendsto (fun y => -(1 / a) * Real.exp (-a * y)) atTop (𝓝 0) := by have hlim : Tendsto (fun y => -a * y) atTop atBot := Tendsto.const_mul_atTop_of_neg (neg_lt_zero.mpr ha) tendsto_id simpa using (Real.tendsto_exp_atBot.comp hlim).const_mul (-(1 / a)) exact integrableOn_Ioi_deriv_of_nonneg (by fun_prop) (fun x _ => hderiv x) (fun x _ => (Real.exp_pos _).le) htend /-- Exact right-tail exponential integral `∫_{x > t} exp(-a x) dx = (1/a) exp(-a t)` for `a > 0`. -/ lemma integral_Ioi_exp_neg_mul {a : ℝ} (ha : 0 < a) (t : ℝ) : (∫ x in Ioi t, Real.exp (-a * x)) = (1 / a) * Real.exp (-a * t) := by have hderiv : ∀ x ∈ Ici t, HasDerivAt (fun y => -(1 / a) * Real.exp (-a * y)) (Real.exp (-a * x)) x := by intro x _ have h1 : HasDerivAt (fun y => -a * y) (-a) x := by simpa using (hasDerivAt_id x).const_mul (-a) have h2 : HasDerivAt (fun y => Real.exp (-a * y)) (Real.exp (-a * x) * (-a)) x := h1.exp refine (h2.const_mul (-(1 / a))).congr_deriv ?_ field_simp [ha.ne'] have htend : Tendsto (fun y => -(1 / a) * Real.exp (-a * y)) atTop (𝓝 0) := by have hlim : Tendsto (fun y => -a * y) atTop atBot := Tendsto.const_mul_atTop_of_neg (neg_lt_zero.mpr ha) tendsto_id simpa using (Real.tendsto_exp_atBot.comp hlim).const_mul (-(1 / a)) have hval := integral_Ioi_of_hasDerivAt_of_tendsto' hderiv (integrableOn_Ioi_exp_neg_mul ha t) htend linarith /-- Exact left-tail exponential integral `∫_{x ≤ t} exp(a x) dx = (1/a) exp(a t)` for `a > 0`. -/ lemma integral_Iic_exp_mul {a : ℝ} (ha : 0 < a) (t : ℝ) : (∫ x in Iic t, Real.exp (a * x)) = (1 / a) * Real.exp (a * t) := by rw [setIntegral_Iic_eq_Ioi_neg] have hrew : (fun y : ℝ => Real.exp (a * -y)) = fun y => Real.exp (-a * y) := by ext y; congr 1; ring rw [hrew, integral_Ioi_exp_neg_mul ha (-t)] congr 2; ring lemma integrableOn_Iic_exp_mul {a : ℝ} (ha : 0 < a) (t : ℝ) : IntegrableOn (fun x => Real.exp (a * x)) (Iic t) := by have h1 : Integrable ((Ioi (-t)).indicator (fun y => Real.exp (-a * y))) := (integrable_indicator_iff measurableSet_Ioi).mpr (integrableOn_Ioi_exp_neg_mul ha (-t)) have h2 : Integrable (fun x => (Ioi (-t)).indicator (fun y => Real.exp (-a * y)) (-x)) := h1.comp_neg have heq : (fun x => (Ioi (-t)).indicator (fun y => Real.exp (-a * y)) (-x)) = (Iio t).indicator (fun x => Real.exp (a * x)) := by ext x by_cases hx : x < t · have hgt : -t < -x := by linarith simp [Set.indicator, hx, hgt] · have hng : ¬ (-t < -x) := by linarith simp [Set.indicator, hx, hng] rw [heq, integrable_indicator_iff measurableSet_Iio] at h2 exact h2.congr_set_ae Iio_ae_eq_Iic.symm lemma integrable_laplacePDF (μ : ℝ) {b : ℝ} (hb : 0 < b) : Integrable (laplacePDF μ b) := by have ha : 0 < 1 / b := one_div_pos.mpr hb have hleft : IntegrableOn (laplacePDF μ b) (Iic μ) := by have hmul : IntegrableOn (fun x => ((1 / (2 * b)) * Real.exp (-μ / b)) * Real.exp ((1 / b) * x)) (Iic μ) := (integrableOn_Iic_exp_mul ha μ).const_mul _ refine MeasureTheory.IntegrableOn.congr_fun hmul (fun x hx => ?_) measurableSet_Iic unfold laplacePDF have hle : x - μ ≤ 0 := sub_nonpos.mpr hx rw [abs_of_nonpos hle, mul_assoc, ← Real.exp_add] congr 2; ring have hright : IntegrableOn (laplacePDF μ b) (Ioi μ) := by have hmul : IntegrableOn (fun x => ((1 / (2 * b)) * Real.exp (μ / b)) * Real.exp (-(1 / b) * x)) (Ioi μ) := (integrableOn_Ioi_exp_neg_mul ha μ).const_mul _ refine MeasureTheory.IntegrableOn.congr_fun hmul (fun x hx => ?_) measurableSet_Ioi unfold laplacePDF have hge : 0 ≤ x - μ := sub_nonneg.mpr (le_of_lt hx) rw [abs_of_nonneg hge, mul_assoc, ← Real.exp_add] congr 2; ring have hunion : (Iic μ : Set ℝ) ∪ Ioi μ = univ := Iic_union_Ioi rw [← integrableOn_univ, ← hunion] exact hleft.union hright /-- Exact right-tail mass of `Lap(μ, b)` for `t ≥ μ`: `∫_{x > t} Lap(μ, b)(x) dx = (1/2) exp(-(t - μ)/b)`. -/ lemma integral_Ioi_laplacePDF_ge {μ b t : ℝ} (hb : 0 < b) (ht : μ ≤ t) : (∫ x in Ioi t, laplacePDF μ b x) = (1 / 2) * Real.exp (-(t - μ) / b) := by have ha : 0 < 1 / b := one_div_pos.mpr hb have hcongr : Set.EqOn (laplacePDF μ b) (fun x => ((1 / (2 * b)) * Real.exp (μ / b)) * Real.exp (-(1 / b) * x)) (Ioi t) := by intro x hx dsimp only have hge : 0 ≤ x - μ := sub_nonneg.mpr (le_trans ht (le_of_lt hx)) unfold laplacePDF rw [abs_of_nonneg hge, mul_assoc, ← Real.exp_add] congr 2; ring rw [setIntegral_congr_fun measurableSet_Ioi hcongr, integral_const_mul, integral_Ioi_exp_neg_mul ha t] have h1 : (1 / (2 * b)) * Real.exp (μ / b) * (1 / (1 / b) * Real.exp (-(1 / b) * t)) = (1 / 2) * (Real.exp (μ / b) * Real.exp (-(1 / b) * t)) := by field_simp [hb.ne'] rw [h1, ← Real.exp_add] congr 2; ring /-- Exact left-tail mass of `Lap(μ, b)` for `t ≤ μ`: `∫_{x ≤ t} Lap(μ, b)(x) dx = (1/2) exp((t - μ)/b)`. -/ lemma integral_Iic_laplacePDF_le {μ b t : ℝ} (hb : 0 < b) (ht : t ≤ μ) : (∫ x in Iic t, laplacePDF μ b x) = (1 / 2) * Real.exp ((t - μ) / b) := by have ha : 0 < 1 / b := one_div_pos.mpr hb have hcongr : Set.EqOn (laplacePDF μ b) (fun x => ((1 / (2 * b)) * Real.exp (-μ / b)) * Real.exp ((1 / b) * x)) (Iic t) := by intro x hx dsimp only have hle : x - μ ≤ 0 := sub_nonpos.mpr (le_trans hx ht) unfold laplacePDF rw [abs_of_nonpos hle, mul_assoc, ← Real.exp_add] congr 2; ring rw [setIntegral_congr_fun measurableSet_Iic hcongr, integral_const_mul, integral_Iic_exp_mul ha t] have h1 : (1 / (2 * b)) * Real.exp (-μ / b) * (1 / (1 / b) * Real.exp ((1 / b) * t)) = (1 / 2) * (Real.exp (-μ / b) * Real.exp ((1 / b) * t)) := by field_simp [hb.ne'] rw [h1, ← Real.exp_add] congr 2; ring /-- `Lap(μ, b)` is a normalized probability density: `∫ x, Lap(μ, b)(x) dx = 1`. -/ theorem integral_laplacePDF_eq_one (μ : ℝ) {b : ℝ} (hb : 0 < b) : (∫ x : ℝ, laplacePDF μ b x) = 1 := by have hint := integrable_laplacePDF μ hb have hsplit : (∫ x in Iic μ, laplacePDF μ b x) + (∫ x in Ioi μ, laplacePDF μ b x) = ∫ x, laplacePDF μ b x := by rw [← setIntegral_union (Iic_disjoint_Ioi le_rfl) measurableSet_Ioi hint.integrableOn hint.integrableOn, Iic_union_Ioi, setIntegral_univ] rw [← hsplit, integral_Iic_laplacePDF_le hb le_rfl, integral_Ioi_laplacePDF_ge hb le_rfl] simp norm_num /-- Exact right-tail mass of `Lap(μ, b)` for `t ≤ μ`: `1 - (1/2) exp((t - μ)/b)`. -/ lemma integral_Ioi_laplacePDF_le {μ b t : ℝ} (hb : 0 < b) (ht : t ≤ μ) : (∫ x in Ioi t, laplacePDF μ b x) = 1 - (1 / 2) * Real.exp ((t - μ) / b) := by have hint := integrable_laplacePDF μ hb have hsplit : (∫ x in Iic t, laplacePDF μ b x) + (∫ x in Ioi t, laplacePDF μ b x) = ∫ x, laplacePDF μ b x := by rw [← setIntegral_union (Iic_disjoint_Ioi le_rfl) measurableSet_Ioi hint.integrableOn hint.integrableOn, Iic_union_Ioi, setIntegral_univ] rw [integral_laplacePDF_eq_one μ hb, integral_Iic_laplacePDF_le hb ht] at hsplit linarith /-- **Exact Optimal `(ε, δ)`-DP Curve for the Continuous Laplace Mechanism:** For ALL `Δ ≥ 0`, `b > 0`, and `ε ≥ 0`: `H_{e^ε}(Lap(Δ, b), Lap(0, b)) = max 0 (1 - exp ((ε - Δ / b) / 2))`, with exact sharpness witness event `S* = ((Δ + b ε) / 2, ∞)` whenever `ε < Δ / b`! -/ theorem laplace_hockeyStick_exact {Δ b ε : ℝ} (hΔ : 0 ≤ Δ) (hb : 0 < b) (hε : 0 ≤ ε) : contHockeyStick (Real.exp ε) (laplacePDF Δ b) (laplacePDF 0 b) = max 0 (1 - Real.exp ((ε - Δ / b) / 2)) := by by_cases hregime : Δ / b ≤ ε · have hzero : ∀ x : ℝ, max 0 (laplacePDF Δ b x - Real.exp ε * laplacePDF 0 b x) = 0 := by intro x refine max_eq_left (sub_nonpos.mpr ?_) unfold laplacePDF rw [sub_zero, ← mul_assoc, mul_comm (Real.exp ε), mul_assoc, ← Real.exp_add] refine mul_le_mul_of_nonneg_left (Real.exp_le_exp.mpr ?_) (by positivity) have htri : |x| - |x - Δ| ≤ Δ := by have h1 := abs_sub_abs_le_abs_sub x (x - Δ) have h2 : x - (x - Δ) = Δ := by ring rw [h2, abs_of_nonneg hΔ] at h1 exact h1 have hdiv : (|x| - |x - Δ|) / b ≤ Δ / b := div_le_div_of_nonneg_right htri hb.le have hre : -|x - Δ| / b - (-|x| / b) = (|x| - |x - Δ|) / b := by ring linarith have hrhs : max 0 (1 - Real.exp ((ε - Δ / b) / 2)) = 0 := by refine max_eq_left ?_ have h1 : 1 ≤ Real.exp ((ε - Δ / b) / 2) := Real.one_le_exp (by linarith) linarith unfold contHockeyStick simp_rw [hzero, integral_zero, hrhs] · push Not at hregime let tStar : ℝ := (Δ + b * ε) / 2 have hlt_bε : b * ε < Δ := by have := (lt_div_iff₀ hb).mp hregime linarith have ht0 : 0 ≤ tStar := by dsimp [tStar]; nlinarith have htΔ : tStar ≤ Δ := by dsimp [tStar]; linarith have hchar : ∀ x : ℝ, Real.exp ε * laplacePDF 0 b x < laplacePDF Δ b x ↔ tStar < x := by intro x unfold laplacePDF rw [sub_zero, ← mul_assoc, mul_comm (Real.exp ε), mul_assoc, ← Real.exp_add] rw [mul_lt_mul_iff_right₀ (by positivity : (0 : ℝ) < 1 / (2 * b)), Real.exp_lt_exp] have hiff : ε + -|x| / b < -|x - Δ| / b ↔ b * ε < |x| - |x - Δ| := by constructor · intro h have hm := mul_lt_mul_of_pos_left h hb have h1 : b * (ε + -|x| / b) = b * ε - |x| := by field_simp [hb.ne']; ring have h2 : b * (-|x - Δ| / b) = -|x - Δ| := by field_simp [hb.ne'] linarith · intro h have hd := div_lt_div_of_pos_right h hb have h1 : (b * ε) / b = ε := by field_simp [hb.ne'] have h2 : (|x| - |x - Δ|) / b = -|x - Δ| / b - (-|x| / b) := by ring linarith rw [hiff] dsimp [tStar] by_cases hx0 : x ≤ 0 · rw [abs_of_nonpos hx0, abs_of_nonpos (by linarith : x - Δ ≤ 0)] constructor <;> intro h <;> nlinarith · push Not at hx0 rw [abs_of_pos hx0] by_cases hxΔ : x ≤ Δ · rw [abs_of_nonpos (by linarith : x - Δ ≤ 0)] constructor <;> intro h <;> linarith · push Not at hxΔ rw [abs_of_pos (by linarith : 0 < x - Δ)] constructor <;> intro h <;> linarith obtain ⟨_, heq⟩ := contHockeyStick_eq_lrt_event (α := Real.exp ε) (integrable_laplacePDF Δ hb) (integrable_laplacePDF 0 hb) (measurable_laplacePDF Δ b) (measurable_laplacePDF 0 b) have hset : {x : ℝ | Real.exp ε * laplacePDF 0 b x < laplacePDF Δ b x} = Ioi tStar := by ext x; exact hchar x rw [hset] at heq rw [← heq, integral_Ioi_laplacePDF_le hb htΔ, integral_Ioi_laplacePDF_ge hb ht0] have hexp_eq : Real.exp ε * ((1 / 2) * Real.exp (-(tStar - 0) / b)) = (1 / 2) * Real.exp ((tStar - Δ) / b) := by have h1 : Real.exp ε * ((1 / 2) * Real.exp (-(tStar - 0) / b)) = (1 / 2) * Real.exp (ε + -(tStar - 0) / b) := by rw [← mul_assoc, mul_comm (Real.exp ε), mul_assoc, ← Real.exp_add] rw [h1] congr 2 dsimp [tStar] field_simp [hb.ne'] ring have hexp_simp : (tStar - Δ) / b = (ε - Δ / b) / 2 := by dsimp [tStar] field_simp [hb.ne'] ring have hpos : 0 ≤ 1 - Real.exp ((ε - Δ / b) / 2) := by have hlt : Real.exp ((ε - Δ / b) / 2) ≤ 1 := Real.exp_le_one_iff.mpr (by linarith) linarith rw [hexp_eq, hexp_simp, max_eq_right hpos] ring /-- **Exact Symmetry of Laplace Hockey-Stick Divergence:** -/ theorem laplace_hockeyStick_symm {Δ b ε : ℝ} (hΔ : 0 ≤ Δ) (hb : 0 < b) (hε : 0 ≤ ε) : contHockeyStick (Real.exp ε) (laplacePDF 0 b) (laplacePDF Δ b) = max 0 (1 - Real.exp ((ε - Δ / b) / 2)) := by have hchg : contHockeyStick (Real.exp ε) (laplacePDF 0 b) (laplacePDF Δ b) = contHockeyStick (Real.exp ε) (laplacePDF Δ b) (laplacePDF 0 b) := by unfold contHockeyStick rw [← integral_comp_sub_left_univ (fun x => max 0 (laplacePDF 0 b x - Real.exp ε * laplacePDF Δ b x)) Δ] refine integral_congr_ae (Eventually.of_forall fun x => ?_) dsimp only unfold laplacePDF have h1 : |Δ - x - 0| = |x - Δ| := by rw [sub_zero, ← abs_neg]; congr 1; ring have h2 : |Δ - x - Δ| = |x - 0| := by rw [sub_zero, ← abs_neg]; congr 1; ring rw [h1, h2] rw [hchg, laplace_hockeyStick_exact hΔ hb hε] /-- **Strict Noise Reduction over Pure-DP Calibration:** For any `Δ > 0, ε > 0, δ ∈ (0, 1)`, the exact `(ε, δ)`-DP Laplace scale `b_exact = Δ / (ε - 2 ln(1 - δ))` is strictly smaller than pure-DP `b_pure = Δ / ε` and attains `H_{e^ε}(Lap(Δ, b_exact), Lap(0, b_exact)) = δ` with exact equality! -/ theorem laplace_exact_beats_pure_calibration {Δ ε δ : ℝ} (hΔ : 0 < Δ) (hε : 0 < ε) (hδ0 : 0 < δ) (hδ1 : δ < 1) : let bExact := Δ / (ε - 2 * Real.log (1 - δ)) 0 < bExact ∧ bExact < Δ / ε ∧ contHockeyStick (Real.exp ε) (laplacePDF Δ bExact) (laplacePDF 0 bExact) = δ := by intro bExact have hlog : Real.log (1 - δ) < 0 := Real.log_neg (by linarith) (by linarith) have hden_pos : 0 < ε - 2 * Real.log (1 - δ) := by linarith have hb_pos : 0 < bExact := div_pos hΔ hden_pos have hlt : bExact < Δ / ε := div_lt_div_of_pos_left hΔ hε (by linarith) refine ⟨hb_pos, hlt, ?_⟩ rw [laplace_hockeyStick_exact hΔ.le hb_pos hε.le] have hdiv : Δ / bExact = ε - 2 * Real.log (1 - δ) := by dsimp [bExact] field_simp [hΔ.ne', hden_pos.ne'] rw [hdiv] have harg : (ε - (ε - 2 * Real.log (1 - δ))) / 2 = Real.log (1 - δ) := by ring rw [harg, Real.exp_log (by linarith)] have : 1 - (1 - δ) = δ := by ring rw [this, max_eq_right hδ0.le] /-! ## Section 3: Standard Normal CDF `Φ` & Exact Balle–Wang Analytic Gaussian Mechanism -/ /-- Standard normal probability density `φ(x) = (1 / √(2π)) exp(-x²/2)`. -/ def stdGaussPDF (x : ℝ) : ℝ := (1 / Real.sqrt (2 * Real.pi)) * Real.exp (-(x ^ 2) / 2) /-- Standard normal cumulative distribution function `Φ(t) = ∫_{x ≤ t} φ(x) dx`. -/ def stdGaussCDF (t : ℝ) : ℝ := ∫ x in Iic t, stdGaussPDF x lemma stdGaussPDF_eq_gaussianPDFReal (x : ℝ) : stdGaussPDF x = ProbabilityTheory.gaussianPDFReal 0 1 x := by unfold stdGaussPDF ProbabilityTheory.gaussianPDFReal simp only [NNReal.coe_one, mul_one, sub_zero, one_div] lemma stdGaussPDF_pos (x : ℝ) : 0 < stdGaussPDF x := by unfold stdGaussPDF positivity lemma stdGaussPDF_nonneg (x : ℝ) : 0 ≤ stdGaussPDF x := (stdGaussPDF_pos x).le lemma stdGaussPDF_even (x : ℝ) : stdGaussPDF (-x) = stdGaussPDF x := by unfold stdGaussPDF; simp lemma continuous_stdGaussPDF : Continuous stdGaussPDF := by unfold stdGaussPDF; fun_prop lemma integrable_stdGaussPDF : Integrable stdGaussPDF := by have heq : stdGaussPDF = ProbabilityTheory.gaussianPDFReal 0 1 := funext stdGaussPDF_eq_gaussianPDFReal rw [heq] exact ProbabilityTheory.integrable_gaussianPDFReal 0 1 lemma integral_stdGaussPDF_eq_one : (∫ x : ℝ, stdGaussPDF x) = 1 := by have heq : stdGaussPDF = ProbabilityTheory.gaussianPDFReal 0 1 := funext stdGaussPDF_eq_gaussianPDFReal rw [heq] exact ProbabilityTheory.integral_gaussianPDFReal_eq_one 0 one_ne_zero /-- Exact complement identity `∫_{x > t} φ(x) dx = 1 - Φ(t)`. -/ lemma integral_Ioi_stdGaussPDF (t : ℝ) : (∫ x in Ioi t, stdGaussPDF x) = 1 - stdGaussCDF t := by have hsplit : (∫ x in Iic t, stdGaussPDF x) + (∫ x in Ioi t, stdGaussPDF x) = ∫ x, stdGaussPDF x := by rw [← setIntegral_union (Iic_disjoint_Ioi le_rfl) measurableSet_Ioi integrable_stdGaussPDF.integrableOn integrable_stdGaussPDF.integrableOn, Iic_union_Ioi, setIntegral_univ] rw [integral_stdGaussPDF_eq_one] at hsplit unfold stdGaussCDF linarith /-- Exact symmetry `Φ(-t) = 1 - Φ(t)`. -/ theorem stdGaussCDF_symm (t : ℝ) : stdGaussCDF (-t) = 1 - stdGaussCDF t := by rw [← integral_Ioi_stdGaussPDF] unfold stdGaussCDF rw [setIntegral_Iic_eq_Ioi_neg, neg_neg] refine setIntegral_congr_fun measurableSet_Ioi fun x _ => stdGaussPDF_even x theorem stdGaussCDF_zero : stdGaussCDF 0 = 1 / 2 := by have h := stdGaussCDF_symm 0 rw [neg_zero] at h linarith /-- `Φ(b) - Φ(a) = ∫_a^b φ(x) dx`. -/ lemma stdGaussCDF_sub (a b : ℝ) : stdGaussCDF b - stdGaussCDF a = ∫ x in a..b, stdGaussPDF x := by unfold stdGaussCDF by_cases hab : a ≤ b · have hdisj : Disjoint (Iic a) (Ioc a b) := Iic_disjoint_Ioc le_rfl have hunion : Iic a ∪ Ioc a b = Iic b := Iic_union_Ioc_eq_Iic hab have hadd : (∫ x in Iic a, stdGaussPDF x) + (∫ x in Ioc a b, stdGaussPDF x) = ∫ x in Iic b, stdGaussPDF x := by rw [← setIntegral_union hdisj measurableSet_Ioc integrable_stdGaussPDF.integrableOn integrable_stdGaussPDF.integrableOn, hunion] rw [intervalIntegral.integral_of_le hab] linarith · push Not at hab have hdisj : Disjoint (Iic b) (Ioc b a) := Iic_disjoint_Ioc le_rfl have hunion : Iic b ∪ Ioc b a = Iic a := Iic_union_Ioc_eq_Iic hab.le have hadd : (∫ x in Iic b, stdGaussPDF x) + (∫ x in Ioc b a, stdGaussPDF x) = ∫ x in Iic a, stdGaussPDF x := by rw [← setIntegral_union hdisj measurableSet_Ioc integrable_stdGaussPDF.integrableOn integrable_stdGaussPDF.integrableOn, hunion] rw [intervalIntegral.integral_symm, intervalIntegral.integral_of_le hab.le] linarith /-- Exact derivative `Φ'(t) = φ(t)`. -/ theorem hasDerivAt_stdGaussCDF (t : ℝ) : HasDerivAt stdGaussCDF (stdGaussPDF t) t := by have hfun : stdGaussCDF = fun u => stdGaussCDF 0 + ∫ x in (0 : ℝ)..u, stdGaussPDF x := by ext u linarith [stdGaussCDF_sub 0 u] rw [hfun] have hftc : HasDerivAt (fun u => ∫ x in (0 : ℝ)..u, stdGaussPDF x) (stdGaussPDF t) t := intervalIntegral.integral_hasDerivAt_right (continuous_stdGaussPDF.intervalIntegrable 0 t) (continuous_stdGaussPDF.stronglyMeasurableAtFilter _ _) continuous_stdGaussPDF.continuousAt simpa using hftc.const_add (stdGaussCDF 0) theorem stdGaussCDF_continuous : Continuous stdGaussCDF := continuous_iff_continuousAt.mpr fun t => (hasDerivAt_stdGaussCDF t).continuousAt theorem stdGaussCDF_strictMono : StrictMono stdGaussCDF := strictMono_of_deriv_pos fun t => by rw [(hasDerivAt_stdGaussCDF t).deriv] exact stdGaussPDF_pos t /-- Exact derivative of the standard normal PDF: `φ'(x) = -x φ(x)`. -/ lemma hasDerivAt_stdGaussPDF (x : ℝ) : HasDerivAt stdGaussPDF (-x * stdGaussPDF x) x := by have hsq : HasDerivAt (fun y : ℝ => y ^ 2) (2 * x) x := by simpa using hasDerivAt_pow 2 x have harg : HasDerivAt (fun y : ℝ => -(y ^ 2) / 2) (-x) x := by refine ((hsq.neg).div_const 2).congr_deriv ?_ ring have hexp : HasDerivAt (fun y : ℝ => Real.exp (-(y ^ 2) / 2)) (Real.exp (-(x ^ 2) / 2) * (-x)) x := harg.exp unfold stdGaussPDF refine (hexp.const_mul (1 / Real.sqrt (2 * Real.pi))).congr_deriv ?_ ring /-- Exact Mills-ratio tail bound: for `t > 0`, `Φ(-t) ≤ φ(t) / t`. -/ theorem stdGaussCDF_neg_le_mills {t : ℝ} (ht : 0 < t) : stdGaussCDF (-t) ≤ stdGaussPDF t / t := by rw [stdGaussCDF_symm, ← integral_Ioi_stdGaussPDF] have hderiv : ∀ x : ℝ, HasDerivAt (fun y => -(1 / t) * stdGaussPDF y) ((x / t) * stdGaussPDF x) x := by intro x refine ((hasDerivAt_stdGaussPDF x).const_mul (-(1 / t))).congr_deriv ?_ ring have htend : Tendsto (fun y => -(1 / t) * stdGaussPDF y) atTop (𝓝 0) := by have hlim : Tendsto (fun y : ℝ => -(y ^ 2) / 2) atTop atBot := by have hsq : Tendsto (fun y : ℝ => y ^ 2) atTop atTop := tendsto_pow_atTop (by norm_num : 2 ≠ 0) exact Tendsto.atBot_div_const (by norm_num : (0 : ℝ) < 2) (tendsto_neg_atTop_atBot.comp hsq) have hpdf : Tendsto stdGaussPDF atTop (𝓝 0) := by unfold stdGaussPDF simpa using (Real.tendsto_exp_atBot.comp hlim).const_mul (1 / Real.sqrt (2 * Real.pi)) simpa using hpdf.const_mul (-(1 / t)) have hint_maj : IntegrableOn (fun x => (x / t) * stdGaussPDF x) (Ioi t) := by refine integrableOn_Ioi_deriv_of_nonneg ?_ (fun x _ => hderiv x) (fun x hx => mul_nonneg (div_nonneg (le_trans ht.le (le_of_lt hx)) ht.le) (stdGaussPDF_nonneg x)) htend exact (continuous_stdGaussPDF.const_mul (-(1 / t))).continuousWithinAt have hint_val : (∫ x in Ioi t, (x / t) * stdGaussPDF x) = stdGaussPDF t / t := by have hval := integral_Ioi_of_hasDerivAt_of_tendsto' (fun x _ => hderiv x) hint_maj htend have hsimp : 0 - -(1 / t) * stdGaussPDF t = stdGaussPDF t / t := by ring linarith calc (∫ x in Ioi t, stdGaussPDF x) ≤ ∫ x in Ioi t, (x / t) * stdGaussPDF x := by refine setIntegral_mono_on integrable_stdGaussPDF.integrableOn hint_maj measurableSet_Ioi fun x hx => ?_ have hge : 1 ≤ x / t := (one_le_div ht).mpr (le_of_lt hx) nlinarith [stdGaussPDF_pos x] _ = stdGaussPDF t / t := hint_val /-- `0 < Φ(t)` for all `t ∈ ℝ`. -/ theorem stdGaussCDF_pos (t : ℝ) : 0 < stdGaussCDF t := by have hlt : stdGaussCDF (t - 1) < stdGaussCDF t := stdGaussCDF_strictMono (by linarith) have hnonneg : 0 ≤ stdGaussCDF (t - 1) := setIntegral_nonneg measurableSet_Iic fun x _ => stdGaussPDF_nonneg x linarith /-- `Φ(t) < 1` for all `t ∈ ℝ`. -/ theorem stdGaussCDF_lt_one (t : ℝ) : stdGaussCDF t < 1 := by have h := stdGaussCDF_pos (-t) rw [stdGaussCDF_symm] at h linarith /-- `Φ(t) → 0` as `t → -∞`. -/ theorem tendsto_stdGaussCDF_atBot : Tendsto stdGaussCDF atBot (𝓝 0) := by have hneg : Tendsto (fun t => stdGaussCDF (-t)) atTop (𝓝 0) := by refine squeeze_zero' (Eventually.of_forall fun t => (stdGaussCDF_pos (-t)).le) (eventually_gt_atTop (0 : ℝ) |>.mono fun t ht => stdGaussCDF_neg_le_mills ht) ?_ have hlim : Tendsto (fun y : ℝ => -(y ^ 2) / 2) atTop atBot := by have hsq : Tendsto (fun y : ℝ => y ^ 2) atTop atTop := tendsto_pow_atTop (by norm_num : 2 ≠ 0) exact Tendsto.atBot_div_const (by norm_num : (0 : ℝ) < 2) (tendsto_neg_atTop_atBot.comp hsq) have hpdf : Tendsto stdGaussPDF atTop (𝓝 0) := by unfold stdGaussPDF simpa using (Real.tendsto_exp_atBot.comp hlim).const_mul (1 / Real.sqrt (2 * Real.pi)) have hinv : Tendsto (fun t : ℝ => (1 : ℝ) / t) atTop (𝓝 0) := tendsto_const_nhds.div_atTop tendsto_id have hmul : Tendsto (fun t : ℝ => stdGaussPDF t * (1 / t)) atTop (𝓝 (0 * 0)) := hpdf.mul hinv simpa [div_eq_mul_inv] using hmul have hcomp : Tendsto (fun t => stdGaussCDF (-(-t))) atBot (𝓝 0) := hneg.comp tendsto_neg_atBot_atTop simpa [neg_neg] using hcomp /-- `Φ(t) → 1` as `t → +∞`. -/ theorem tendsto_stdGaussCDF_atTop : Tendsto stdGaussCDF atTop (𝓝 1) := by have h : Tendsto (fun t => 1 - stdGaussCDF (-t)) atTop (𝓝 (1 - 0)) := tendsto_const_nhds.sub (tendsto_stdGaussCDF_atBot.comp tendsto_neg_atTop_atBot) simpa [stdGaussCDF_symm] using h /-- **Exact Gaussian Chernoff Tail Bound:** for all `t ≥ 0`, `Φ(-t) ≤ (1/2) exp(-t²/2)`. -/ theorem stdGaussCDF_neg_le_half_exp {t : ℝ} (ht : 0 ≤ t) : stdGaussCDF (-t) ≤ (1 / 2) * Real.exp (-(t ^ 2) / 2) := by rw [stdGaussCDF_symm, ← integral_Ioi_stdGaussPDF] have hshift : (∫ x in Ioi t, stdGaussPDF x) = ∫ u in Ioi (0 : ℝ), stdGaussPDF (u + t) := by have h := setIntegral_Ioi_comp_add_right stdGaussPDF 0 t simpa using h.symm rw [hshift] have hle : (∫ u in Ioi (0 : ℝ), stdGaussPDF (u + t)) ≤ ∫ u in Ioi (0 : ℝ), Real.exp (-(t ^ 2) / 2) * stdGaussPDF u := by refine setIntegral_mono_on (integrable_stdGaussPDF.comp_add_right t).integrableOn (integrable_stdGaussPDF.const_mul _).integrableOn measurableSet_Ioi fun u hu => ?_ unfold stdGaussPDF have hu0 : 0 < u := hu have hmul : Real.exp (-(t ^ 2) / 2) * ((1 / Real.sqrt (2 * Real.pi)) * Real.exp (-(u ^ 2) / 2)) = (1 / Real.sqrt (2 * Real.pi)) * Real.exp (-(t ^ 2) / 2 + -(u ^ 2) / 2) := by rw [← mul_assoc, mul_comm (Real.exp _), mul_assoc, ← Real.exp_add] rw [hmul] refine mul_le_mul_of_nonneg_left (Real.exp_le_exp.mpr ?_) (by positivity) nlinarith rw [integral_const_mul, integral_Ioi_stdGaussPDF, stdGaussCDF_zero] at hle linarith /-- Shifted Gaussian density `N(m, σ²)` on `ℝ` (parameterized by `m : ℝ, σ > 0`). -/ def gaussPDF (m σ x : ℝ) : ℝ := (1 / σ) * stdGaussPDF ((x - m) / σ) lemma integrable_gaussPDF (m : ℝ) {σ : ℝ} (hσ : 0 < σ) : Integrable (gaussPDF m σ) := by unfold gaussPDF have h1 : Integrable (fun x => stdGaussPDF ((x - m) / σ)) := by have ha : Integrable (fun x => stdGaussPDF (σ⁻¹ * x + (-m / σ))) := (integrable_stdGaussPDF.comp_add_right (-m / σ)).comp_mul_left' (inv_ne_zero hσ.ne') refine ha.congr (Eventually.of_forall fun x => ?_) dsimp only congr 1; field_simp [hσ.ne']; ring exact h1.const_mul (1 / σ) lemma measurable_gaussPDF (m σ : ℝ) : Measurable (gaussPDF m σ) := by unfold gaussPDF stdGaussPDF; fun_prop lemma integral_gaussPDF_eq_one (m : ℝ) {σ : ℝ} (hσ : 0 < σ) : (∫ x : ℝ, gaussPDF m σ x) = 1 := by unfold gaussPDF rw [integral_const_mul] have h1 : (∫ x : ℝ, stdGaussPDF ((x - m) / σ)) = ∫ y : ℝ, stdGaussPDF (y / σ) := integral_sub_right_eq_self (fun y => stdGaussPDF (y / σ)) m have h2 : (∫ y : ℝ, stdGaussPDF (y / σ)) = σ * ∫ u : ℝ, stdGaussPDF u := by have hm := Measure.integral_comp_div stdGaussPDF σ rw [abs_of_pos hσ, smul_eq_mul] at hm exact hm rw [h1, h2, integral_stdGaussPDF_eq_one] field_simp [hσ.ne'] lemma integral_Ioi_gaussPDF (m : ℝ) {σ : ℝ} (hσ : 0 < σ) (t : ℝ) : (∫ x in Ioi t, gaussPDF m σ x) = stdGaussCDF ((m - t) / σ) := by unfold gaussPDF rw [integral_const_mul] have hsub : (∫ x in Ioi t, stdGaussPDF ((x - m) / σ)) = ∫ y in Ioi (t - m), stdGaussPDF (y / σ) := by have h := setIntegral_Ioi_comp_add_right (fun y => stdGaussPDF (y / σ)) t (-m) have heq1 : (fun x => stdGaussPDF ((x + -m) / σ)) = fun x => stdGaussPDF ((x - m) / σ) := by ext x; rw [sub_eq_add_neg] have heq2 : t + -m = t - m := (sub_eq_add_neg t m).symm rw [heq1, heq2] at h exact h have hmul : (∫ y in Ioi (t - m), stdGaussPDF (y / σ)) = σ * ∫ u in Ioi ((t - m) / σ), stdGaussPDF u := by have h := setIntegral_Ioi_comp_mul_left stdGaussPDF (inv_pos.mpr hσ) (t - m) have hrew : (fun y => stdGaussPDF (σ⁻¹ * y)) = fun y => stdGaussPDF (y / σ) := by ext y; rw [div_eq_inv_mul] rw [hrew, inv_inv, ← div_eq_inv_mul] at h exact h rw [hsub, hmul] have hcancel : 1 / σ * (σ * ∫ u in Ioi ((t - m) / σ), stdGaussPDF u) = ∫ u in Ioi ((t - m) / σ), stdGaussPDF u := by field_simp [hσ.ne'] rw [hcancel, integral_Ioi_stdGaussPDF, ← stdGaussCDF_symm] congr 1; ring /-- **Balle–Wang Analytic Gaussian Privacy Profile:** `δ_BW(ε, μ) = Φ(-ε/μ + μ/2) - e^ε Φ(-ε/μ - μ/2)`. -/ def balleWangDelta (ε μ : ℝ) : ℝ := stdGaussCDF (-ε / μ + μ / 2) - Real.exp ε * stdGaussCDF (-ε / μ - μ / 2) /-- **Exact Balle–Wang Analytic Gaussian Mechanism Theorem (ICML 2018, Theorem 8):** For ANY sensitivity `Δ > 0`, noise `σ > 0` (`μ = Δ / σ`), and ANY `ε ∈ ℝ` (positive, zero, or negative!), the exact continuous hockey-stick divergence is: `H_{e^ε}(N(Δ, σ²), N(0, σ²)) = Φ(-ε/μ + μ/2) - e^ε Φ(-ε/μ - μ/2)`, attained by the Neyman–Pearson half-space `S* = (Δ/2 + σ² ε / Δ, ∞)`! -/ theorem balle_wang_gaussian_hockeyStick_exact {Δ σ : ℝ} (hΔ : 0 < Δ) (hσ : 0 < σ) (ε : ℝ) : contHockeyStick (Real.exp ε) (gaussPDF Δ σ) (gaussPDF 0 σ) = balleWangDelta ε (Δ / σ) := by let tStar : ℝ := Δ / 2 + σ ^ 2 * ε / Δ have hchar : ∀ x : ℝ, Real.exp ε * gaussPDF 0 σ x < gaussPDF Δ σ x ↔ tStar < x := by intro x unfold gaussPDF stdGaussPDF have hcpos : 0 < (1 / σ) * (1 / Real.sqrt (2 * Real.pi)) := by positivity have hL : Real.exp ε * ((1 / σ) * ((1 / Real.sqrt (2 * Real.pi)) * Real.exp (-(((x - 0) / σ) ^ 2) / 2))) = ((1 / σ) * (1 / Real.sqrt (2 * Real.pi))) * Real.exp (ε + -(((x - 0) / σ) ^ 2) / 2) := by rw [Real.exp_add]; ring have hR : (1 / σ) * ((1 / Real.sqrt (2 * Real.pi)) * Real.exp (-(((x - Δ) / σ) ^ 2) / 2)) = ((1 / σ) * (1 / Real.sqrt (2 * Real.pi))) * Real.exp (-(((x - Δ) / σ) ^ 2) / 2) := by ring rw [hL, hR, mul_lt_mul_iff_right₀ hcpos, Real.exp_lt_exp] have hdiff : -(((x - Δ) / σ) ^ 2) / 2 - (ε + -(((x - 0) / σ) ^ 2) / 2) = (Δ / σ ^ 2) * (x - tStar) := by dsimp [tStar] field_simp [hΔ.ne', hσ.ne'] ring have hcoeff : 0 < Δ / σ ^ 2 := by positivity constructor · intro h have hpos : 0 < (Δ / σ ^ 2) * (x - tStar) := by linarith have hx : 0 < x - tStar := (mul_pos_iff_of_pos_left hcoeff).mp hpos linarith · intro h have hpos : 0 < (Δ / σ ^ 2) * (x - tStar) := mul_pos hcoeff (sub_pos.mpr h) linarith obtain ⟨_, heq⟩ := contHockeyStick_eq_lrt_event (α := Real.exp ε) (integrable_gaussPDF Δ hσ) (integrable_gaussPDF 0 hσ) (measurable_gaussPDF Δ σ) (measurable_gaussPDF 0 σ) have hset : {x : ℝ | Real.exp ε * gaussPDF 0 σ x < gaussPDF Δ σ x} = Ioi tStar := by ext x; exact hchar x rw [hset] at heq rw [← heq, integral_Ioi_gaussPDF Δ hσ tStar, integral_Ioi_gaussPDF 0 hσ tStar] unfold balleWangDelta have ha : (Δ - tStar) / σ = -ε / (Δ / σ) + (Δ / σ) / 2 := by dsimp [tStar]; field_simp [hΔ.ne', hσ.ne']; ring have hb : (0 - tStar) / σ = -ε / (Δ / σ) - (Δ / σ) / 2 := by dsimp [tStar]; field_simp [hΔ.ne', hσ.ne']; ring rw [ha, hb] /-- **Exact Symmetry of Balle–Wang Gaussian Hockey-Stick Divergence:** -/ theorem balle_wang_gaussian_symm {Δ σ : ℝ} (hΔ : 0 < Δ) (hσ : 0 < σ) (ε : ℝ) : contHockeyStick (Real.exp ε) (gaussPDF 0 σ) (gaussPDF Δ σ) = balleWangDelta ε (Δ / σ) := by have hchg : contHockeyStick (Real.exp ε) (gaussPDF 0 σ) (gaussPDF Δ σ) = contHockeyStick (Real.exp ε) (gaussPDF Δ σ) (gaussPDF 0 σ) := by unfold contHockeyStick rw [← integral_comp_sub_left_univ (fun x => max 0 (gaussPDF 0 σ x - Real.exp ε * gaussPDF Δ σ x)) Δ] refine integral_congr_ae (Eventually.of_forall fun x => ?_) dsimp only unfold gaussPDF have h1 : stdGaussPDF ((Δ - x - 0) / σ) = stdGaussPDF ((x - Δ) / σ) := by rw [← stdGaussPDF_even]; congr 1; ring have h2 : stdGaussPDF ((Δ - x - Δ) / σ) = stdGaussPDF ((x - 0) / σ) := by rw [← stdGaussPDF_even]; congr 1; ring rw [h1, h2] rw [hchg, balle_wang_gaussian_hockeyStick_exact hΔ hσ ε] /-- Exact Gaussian PDF ratio identity `φ(-ε/μ + μ/2) = e^ε φ(-ε/μ - μ/2)`. -/ lemma stdGaussPDF_balleWang_ratio {ε μ : ℝ} (hμ : μ ≠ 0) : stdGaussPDF (-ε / μ + μ / 2) = Real.exp ε * stdGaussPDF (-ε / μ - μ / 2) := by unfold stdGaussPDF rw [← mul_assoc, mul_comm (Real.exp ε), mul_assoc, ← Real.exp_add] congr 2 field_simp [hμ] ring /-- **Exact Closed-Form `μ`-Derivative of Balle–Wang:** `∂/∂μ δ_BW(ε, μ) = φ(-ε/μ + μ/2) > 0` (exact algebraic cancellation of `ε / μ²` terms!). -/ theorem hasDerivAt_balleWangDelta_mu (ε : ℝ) {μ : ℝ} (hμ : μ ≠ 0) : HasDerivAt (fun m => balleWangDelta ε m) (stdGaussPDF (-ε / μ + μ / 2)) μ := by unfold balleWangDelta have hinv : HasDerivAt (fun m : ℝ => -ε / m) (ε / μ ^ 2) μ := by have h0 : HasDerivAt (fun m : ℝ => (-ε) * m⁻¹) ((-ε) * -(μ ^ 2)⁻¹) μ := (hasDerivAt_inv hμ).const_mul (-ε) have hfun : (fun m : ℝ => (-ε) * m⁻¹) = fun m => -ε / m := by ext m; rw [div_eq_mul_inv] rw [hfun] at h0 refine h0.congr_deriv ?_ ring have hhalf : HasDerivAt (fun m : ℝ => m / 2) (1 / 2) μ := by simpa using (hasDerivAt_id μ).div_const 2 have ha : HasDerivAt (fun m : ℝ => -ε / m + m / 2) (ε / μ ^ 2 + 1 / 2) μ := hinv.add hhalf have hb : HasDerivAt (fun m : ℝ => -ε / m - m / 2) (ε / μ ^ 2 - 1 / 2) μ := hinv.sub hhalf have hA := (hasDerivAt_stdGaussCDF (-ε / μ + μ / 2)).comp μ ha have hB := ((hasDerivAt_stdGaussCDF (-ε / μ - μ / 2)).comp μ hb).const_mul (Real.exp ε) refine (hA.sub hB).congr_deriv ?_ have hrat := stdGaussPDF_balleWang_ratio (ε := ε) hμ rw [hrat] ring /-- **Exact Closed-Form `ε`-Derivative of Balle–Wang:** `∂/∂ε δ_BW(ε, μ) = -e^ε Φ(-ε/μ - μ/2) < 0`. -/ theorem hasDerivAt_balleWangDelta_eps {μ : ℝ} (hμ : μ ≠ 0) (ε : ℝ) : HasDerivAt (fun e => balleWangDelta e μ) (-Real.exp ε * stdGaussCDF (-ε / μ - μ / 2)) ε := by unfold balleWangDelta have hlin : HasDerivAt (fun e : ℝ => -e / μ) (-1 / μ) ε := by have h0 : HasDerivAt (fun e : ℝ => (-1 / μ) * e) (-1 / μ) ε := by simpa using (hasDerivAt_id ε).const_mul (-1 / μ) have hfun : (fun e : ℝ => (-1 / μ) * e) = fun e => -e / μ := by ext e; ring rwa [hfun] at h0 have ha : HasDerivAt (fun e : ℝ => -e / μ + μ / 2) (-1 / μ) ε := by simpa using hlin.add_const (μ / 2) have hb : HasDerivAt (fun e : ℝ => -e / μ - μ / 2) (-1 / μ) ε := by simpa using hlin.sub_const (μ / 2) have hA := (hasDerivAt_stdGaussCDF (-ε / μ + μ / 2)).comp ε ha have hB2 := (hasDerivAt_stdGaussCDF (-ε / μ - μ / 2)).comp ε hb have hB := (Real.hasDerivAt_exp ε).mul hB2 refine (hA.sub hB).congr_deriv ?_ dsimp only [Function.comp_apply] have hrat := stdGaussPDF_balleWang_ratio (ε := ε) hμ rw [hrat] ring /-- `δ_BW(ε, μ)` is strictly increasing in `μ > 0` for every `ε ∈ ℝ`. -/ theorem balleWangDelta_strictMono_mu (ε : ℝ) : StrictMonoOn (fun μ => balleWangDelta ε μ) (Ioi 0) := by refine strictMonoOn_of_deriv_pos (convex_Ioi 0) ?_ ?_ · intro μ hμ exact (hasDerivAt_balleWangDelta_mu ε (ne_of_gt hμ)).continuousAt.continuousWithinAt · intro μ hμ rw [interior_Ioi] at hμ rw [(hasDerivAt_balleWangDelta_mu ε (ne_of_gt hμ)).deriv] exact stdGaussPDF_pos _ /-- `δ_BW(ε, μ)` is strictly decreasing in `ε ∈ ℝ` for every `μ > 0`. -/ theorem balleWangDelta_strictAnti_eps {μ : ℝ} (hμ : 0 < μ) : StrictAnti (fun ε => balleWangDelta ε μ) := by refine strictAnti_of_deriv_neg fun ε => ?_ rw [(hasDerivAt_balleWangDelta_eps hμ.ne' ε).deriv] have hpos : 0 < Real.exp ε * stdGaussCDF (-ε / μ - μ / 2) := mul_pos (Real.exp_pos ε) (stdGaussCDF_pos _) linarith /-- **Strict Non-Asymptotic Dominance over Classical Dwork–Roth (`ε ∈ (0, 1]`):** At the classical Dwork–Roth noise calibration `σ_DR = √(2 ln(1.25 / δ)) / ε` (`μ_DR = ε / √(2 ln(1.25 / δ))`), the exact Balle–Wang privacy loss satisfies `δ_BW(ε, μ_DR) < δ` strictly for ALL `ε ∈ (0, 1]` and `δ ∈ (0, 1/2]`! -/ theorem balle_wang_strictly_beats_dwork_roth_small_eps {ε δ : ℝ} (hε0 : 0 < ε) (hε1 : ε ≤ 1) (hδ0 : 0 < δ) (hδ1 : δ ≤ 1 / 2) : let μDR := ε / Real.sqrt (2 * Real.log (5 / (4 * δ))) balleWangDelta ε μDR < δ := by intro μDR have hratio : 5 / 2 ≤ 5 / (4 * δ) := by rw [div_le_div_iff₀ (by norm_num : (0 : ℝ) < 2) (by positivity)] linarith have hexp1_lt : Real.exp 1 < 3 := lt_trans Real.exp_one_lt_d9 (by norm_num) have hexp_half_lt : Real.exp (1 / 2 : ℝ) < 5 / 2 := by have hsq : (Real.exp (1 / 2 : ℝ)) ^ 2 = Real.exp 1 := by rw [sq, ← Real.exp_add]; norm_num nlinarith [Real.exp_pos (1 / 2 : ℝ)] have hlog_ge : (1 / 2 : ℝ) < Real.log (5 / (4 * δ)) := by rw [Real.lt_log_iff_exp_lt (by positivity)] linarith have hc2_pos : 0 < 2 * Real.log (5 / (4 * δ)) := by linarith have hc_gt1 : 1 < Real.sqrt (2 * Real.log (5 / (4 * δ))) := by rw [Real.lt_sqrt (by norm_num)] linarith have hc_pos : 0 < Real.sqrt (2 * Real.log (5 / (4 * δ))) := by linarith have hdrop : balleWangDelta ε μDR < stdGaussCDF (-ε / μDR + μDR / 2) := by unfold balleWangDelta have hpos : 0 < Real.exp ε * stdGaussCDF (-ε / μDR - μDR / 2) := mul_pos (Real.exp_pos ε) (stdGaussCDF_pos _) linarith let c := Real.sqrt (2 * Real.log (5 / (4 * δ))) have hc_sq : c ^ 2 = 2 * Real.log (5 / (4 * δ)) := Real.sq_sqrt hc2_pos.le have hdiv : ε / μDR = c := by dsimp [μDR, c] field_simp [hε0.ne', hc_pos.ne'] let t := c - μDR / 2 have ht_pos : 0 < t := by dsimp [t, μDR] have h1 : ε / c < 1 := (div_lt_one hc_pos).mpr (lt_of_le_of_lt hε1 hc_gt1) linarith have harg : -ε / μDR + μDR / 2 = -t := by have : -ε / μDR = -(ε / μDR) := neg_div _ _ rw [this, hdiv]; dsimp [t]; ring have hchern : stdGaussCDF (-t) ≤ (1 / 2) * Real.exp (-(t ^ 2) / 2) := stdGaussCDF_neg_le_half_exp ht_pos.le have ht2 : Real.log (5 / (4 * δ)) - 1 / 2 ≤ t ^ 2 / 2 := by have hmul : c * μDR = ε := by dsimp [μDR, c]; field_simp [hc_pos.ne'] have hexp : t ^ 2 / 2 = c ^ 2 / 2 - (c * μDR) / 2 + μDR ^ 2 / 8 := by dsimp [t]; ring rw [hexp, hc_sq, hmul] nlinarith [sq_nonneg μDR] have hbound : (1 / 2) * Real.exp (-(t ^ 2) / 2) ≤ (2 / 5) * Real.exp (1 / 2 : ℝ) * δ := by have hexp_le : Real.exp (-(t ^ 2) / 2) ≤ Real.exp (1 / 2 - Real.log (5 / (4 * δ))) := Real.exp_le_exp.mpr (by linarith) have hsimp : Real.exp (1 / 2 - Real.log (5 / (4 * δ))) = Real.exp (1 / 2 : ℝ) * (4 * δ / 5) := by rw [Real.exp_sub, Real.exp_log (by positivity)] field_simp [hδ0.ne'] rw [hsimp] at hexp_le nlinarith have hfinal : (2 / 5) * Real.exp (1 / 2 : ℝ) * δ < δ := by nlinarith rw [harg] at hdrop linarith /-- **Classical Dwork–Roth Breakdown in the High-Budget Regime (`ε > 1`):** Whenever `δ ∈ (0, 1/4]` and `ε ≥ max(8, 4 ln(5/(4δ)))`, the classical Dwork–Roth noise calibration `σ_DR = √(2 ln(1.25/δ))/ε` VIOLATES `(ε, δ)`-DP (`δ_BW(ε, μ_DR) ≥ 3/8 > 1/4 ≥ δ`)! -/ theorem dwork_roth_fails_large_eps {ε δ : ℝ} (hδ0 : 0 < δ) (hδ1 : δ ≤ 1 / 4) (hε_large : 4 * Real.log (5 / (4 * δ)) ≤ ε) (hε_ge : 8 ≤ ε) : let μDR := ε / Real.sqrt (2 * Real.log (5 / (4 * δ))) δ < balleWangDelta ε μDR := by intro μDR have hratio : 5 ≤ 5 / (4 * δ) := by rw [le_div_iff₀ (by positivity)]; linarith have hlog_gt1 : 1 < Real.log (5 / (4 * δ)) := by rw [Real.lt_log_iff_exp_lt (by positivity)] exact lt_of_lt_of_le (lt_trans Real.exp_one_lt_d9 (by norm_num)) hratio let c := Real.sqrt (2 * Real.log (5 / (4 * δ))) have hc2_pos : 0 < 2 * Real.log (5 / (4 * δ)) := by linarith have hc_sq : c ^ 2 = 2 * Real.log (5 / (4 * δ)) := Real.sq_sqrt hc2_pos.le have hc_pos : 0 < c := Real.sqrt_pos.mpr hc2_pos have hμ_pos : 0 < μDR := div_pos (by linarith) hc_pos have hdiv : ε / μDR = c := by dsimp [μDR, c]; field_simp [(by linarith : ε ≠ 0), hc_pos.ne'] have ha_nonneg : 0 ≤ -ε / μDR + μDR / 2 := by have h1 : -ε / μDR = -c := by rw [neg_div, hdiv] rw [h1] have hle : c ^ 2 ≤ ε / 2 := by linarith have h2 : c ≤ ε / (2 * c) := (le_div_iff₀ (by positivity)).mpr (by nlinarith) have h3 : μDR / 2 = ε / (2 * c) := by dsimp [μDR, c]; ring linarith have hPhi_a : 1 / 2 ≤ stdGaussCDF (-ε / μDR + μDR / 2) := by rw [← stdGaussCDF_zero] exact stdGaussCDF_strictMono.monotone ha_nonneg let b := ε / μDR + μDR / 2 have hb_ge4 : 4 ≤ b := by have h1 : b = c + ε / (2 * c) := by dsimp [b]; rw [hdiv]; dsimp [μDR, c]; ring rw [h1] rw [← mul_le_mul_iff_of_pos_right (by positivity : (0 : ℝ) < 2 * c)] field_simp [hc_pos.ne'] nlinarith [sq_nonneg (c - 2)] have hb_pos : 0 < b := by linarith have hb_neg : -ε / μDR - μDR / 2 = -b := by dsimp [b]; ring have hmills : stdGaussCDF (-b) ≤ stdGaussPDF b / b := stdGaussCDF_neg_le_mills hb_pos have hrat : stdGaussPDF (-ε / μDR + μDR / 2) = Real.exp ε * stdGaussPDF b := by have h0 := stdGaussPDF_balleWang_ratio (ε := ε) hμ_pos.ne' rw [hb_neg, stdGaussPDF_even] at h0 exact h0 have hpdf_le : stdGaussPDF (-ε / μDR + μDR / 2) ≤ 1 / 2 := by unfold stdGaussPDF have hexp_le : Real.exp (-((-ε / μDR + μDR / 2) ^ 2) / 2) ≤ 1 := Real.exp_le_one_iff.mpr (by nlinarith [sq_nonneg (-ε / μDR + μDR / 2)]) have hpi : 4 ≤ 2 * Real.pi := by linarith [Real.pi_gt_three] have hsqrt : 2 ≤ Real.sqrt (2 * Real.pi) := by rw [Real.le_sqrt (by norm_num) (by linarith)]; linarith have hinv : 1 / Real.sqrt (2 * Real.pi) ≤ 1 / 2 := one_div_le_one_div_of_le (by norm_num) hsqrt nlinarith [Real.exp_pos (-((-ε / μDR + μDR / 2) ^ 2) / 2)] have hterm2 : Real.exp ε * stdGaussCDF (-ε / μDR - μDR / 2) ≤ 1 / 8 := by rw [hb_neg] calc Real.exp ε * stdGaussCDF (-b) ≤ Real.exp ε * (stdGaussPDF b / b) := mul_le_mul_of_nonneg_left hmills (Real.exp_pos ε).le _ = stdGaussPDF (-ε / μDR + μDR / 2) / b := by rw [← mul_div_assoc, ← hrat] _ ≤ (1 / 2) / 4 := div_le_div₀ (by norm_num) hpdf_le (by norm_num) hb_ge4 _ = 1 / 8 := by norm_num unfold balleWangDelta linarith /-- **Balle–Wang Exact `Θ(1/√ε)` Validity for ALL `ε > 0` (including `ε > 1`):** Taking `μ = √ε` (i.e., `σ = Δ / √ε`), the Analytic Gaussian mechanism achieves `δ_BW(ε, √ε) < (1/2) exp(-ε/8)` for EVERY `ε > 0`! -/ theorem balle_wang_valid_all_eps {ε : ℝ} (hε : 0 < ε) : balleWangDelta ε (Real.sqrt ε) < (1 / 2) * Real.exp (-ε / 8) := by have hsq : Real.sqrt ε ^ 2 = ε := Real.sq_sqrt hε.le have hs_pos : 0 < Real.sqrt ε := Real.sqrt_pos.mpr hε have hdrop : balleWangDelta ε (Real.sqrt ε) < stdGaussCDF (-ε / Real.sqrt ε + Real.sqrt ε / 2) := by unfold balleWangDelta have hpos : 0 < Real.exp ε * stdGaussCDF (-ε / Real.sqrt ε - Real.sqrt ε / 2) := mul_pos (Real.exp_pos ε) (stdGaussCDF_pos _) linarith have harg : -ε / Real.sqrt ε + Real.sqrt ε / 2 = -(Real.sqrt ε / 2) := by field_simp [hs_pos.ne'] nlinarith [hsq] rw [harg] at hdrop have hch := stdGaussCDF_neg_le_half_exp (by positivity : 0 ≤ Real.sqrt ε / 2) have hpow : -((Real.sqrt ε / 2) ^ 2) / 2 = -ε / 8 := by have : (Real.sqrt ε / 2) ^ 2 = ε / 4 := by rw [div_pow, hsq]; norm_num rw [this]; ring rw [hpow] at hch linarith /-! ## Section 4: Exact Continuous Gaussian Rényi DP & Sharp Balle et al. (2020) Conversion -/ /-- Continuous Rényi divergence `D_α(p ‖ q) = (1/(α - 1)) ln ∫ p(x)^α q(x)^(1 - α) dx` (`α > 1`). -/ def contRenyiDiv (α : ℝ) (p q : ℝ → ℝ) : ℝ := Real.log (∫ x : ℝ, (p x) ^ α * (q x) ^ (1 - α)) / (α - 1) /-- **Exact Continuous Gaussian Rényi Divergence:** For all `Δ ∈ ℝ`, `σ > 0`, and `α > 1`: `D_α(N(Δ, σ²) ‖ N(0, σ²)) = α Δ² / (2 σ²)`. -/ theorem gaussian_renyi_div_exact (Δ : ℝ) {σ α : ℝ} (hσ : 0 < σ) (hα : 1 < α) : contRenyiDiv α (gaussPDF Δ σ) (gaussPDF 0 σ) = α * Δ ^ 2 / (2 * σ ^ 2) := by unfold contRenyiDiv have hint_eq : (∫ x : ℝ, (gaussPDF Δ σ x) ^ α * (gaussPDF 0 σ x) ^ (1 - α)) = Real.exp (α * (α - 1) * Δ ^ 2 / (2 * σ ^ 2)) := by have hpoint : ∀ x : ℝ, (gaussPDF Δ σ x) ^ α * (gaussPDF 0 σ x) ^ (1 - α) = Real.exp (α * (α - 1) * Δ ^ 2 / (2 * σ ^ 2)) * gaussPDF (α * Δ) σ x := by intro x unfold gaussPDF stdGaussPDF have hc : 0 < (1 / σ) * (1 / Real.sqrt (2 * Real.pi)) := by positivity have hA : (1 / σ) * ((1 / Real.sqrt (2 * Real.pi)) * Real.exp (-(((x - Δ) / σ) ^ 2) / 2)) = ((1 / σ) * (1 / Real.sqrt (2 * Real.pi))) * Real.exp (-(((x - Δ) / σ) ^ 2) / 2) := by ring have hB : (1 / σ) * ((1 / Real.sqrt (2 * Real.pi)) * Real.exp (-(((x - 0) / σ) ^ 2) / 2)) = ((1 / σ) * (1 / Real.sqrt (2 * Real.pi))) * Real.exp (-(((x - 0) / σ) ^ 2) / 2) := by ring rw [hA, hB, Real.mul_rpow hc.le (Real.exp_pos _).le, Real.mul_rpow hc.le (Real.exp_pos _).le, ← Real.exp_mul, ← Real.exp_mul] have hpow_c : ((1 / σ) * (1 / Real.sqrt (2 * Real.pi))) ^ α * ((1 / σ) * (1 / Real.sqrt (2 * Real.pi))) ^ (1 - α) = (1 / σ) * (1 / Real.sqrt (2 * Real.pi)) := by rw [← Real.rpow_add hc, add_sub_cancel, Real.rpow_one] calc (((1 / σ) * (1 / Real.sqrt (2 * Real.pi))) ^ α * Real.exp (-(((x - Δ) / σ) ^ 2) / 2 * α)) * (((1 / σ) * (1 / Real.sqrt (2 * Real.pi))) ^ (1 - α) * Real.exp (-(((x - 0) / σ) ^ 2) / 2 * (1 - α))) = (((1 / σ) * (1 / Real.sqrt (2 * Real.pi))) ^ α * ((1 / σ) * (1 / Real.sqrt (2 * Real.pi))) ^ (1 - α)) * (Real.exp (-(((x - Δ) / σ) ^ 2) / 2 * α) * Real.exp (-(((x - 0) / σ) ^ 2) / 2 * (1 - α))) := by ring _ = ((1 / σ) * (1 / Real.sqrt (2 * Real.pi))) * Real.exp (-(((x - Δ) / σ) ^ 2) / 2 * α + -(((x - 0) / σ) ^ 2) / 2 * (1 - α)) := by rw [hpow_c, ← Real.exp_add] _ = Real.exp (α * (α - 1) * Δ ^ 2 / (2 * σ ^ 2)) * ((1 / σ) * ((1 / Real.sqrt (2 * Real.pi)) * Real.exp (-(((x - α * Δ) / σ) ^ 2) / 2))) := by have hquad : -(((x - Δ) / σ) ^ 2) / 2 * α + -(((x - 0) / σ) ^ 2) / 2 * (1 - α) = α * (α - 1) * Δ ^ 2 / (2 * σ ^ 2) + -(((x - α * Δ) / σ) ^ 2) / 2 := by field_simp [hσ.ne'] ring rw [hquad, Real.exp_add] ring simp_rw [hpoint, integral_const_mul, integral_gaussPDF_eq_one (α * Δ) hσ, mul_one] rw [hint_eq, Real.log_exp] have hα_ne : α - 1 ≠ 0 := sub_ne_zero.mpr hα.ne' field_simp [hα_ne, hσ.ne'] /-- **Sharp Pointwise Hockey-Stick-to-Rényi Inequality (Balle–Barthe–Gaboardi–Hsu–Sato 2020):** For ALL `α > 1`, `γ > 0`, and `t ≥ 0`: `max 0 (t - γ) ≤ ((α - 1)^(α - 1) / α^α) · γ^(1 - α) · t^α`, with exact equality at `t* = α γ / (α - 1)`! -/ theorem sharp_hockeyStick_pointwise_bound {α γ t : ℝ} (hα : 1 < α) (hγ : 0 < γ) (ht : 0 ≤ t) : max 0 (t - γ) ≤ (((α - 1) ^ (α - 1)) / (α ^ α)) * γ ^ (1 - α) * t ^ α := by have hα0 : 0 < α := by linarith have hα1 : 0 < α - 1 := by linarith refine max_le (by positivity) ?_ by_cases htg : t ≤ γ · exact le_trans (sub_nonpos.mpr htg) (by positivity) · push Not at htg have ht_pos : 0 < t := lt_trans hγ htg let x := t / γ have hx_pos : 0 < x := div_pos ht_pos hγ have hw1 : 0 ≤ 1 / α := by positivity have hw2 : 0 ≤ (α - 1) / α := by positivity have hwsum : 1 / α + (α - 1) / α = 1 := by field_simp [hα0.ne']; ring have hA_nonneg : 0 ≤ (((α - 1) / α) * x) ^ α := by positivity have hamgm := Real.geom_mean_le_arith_mean2_weighted hw1 hw2 hA_nonneg (by norm_num : (0 : ℝ) ≤ 1) hwsum have hlhs : ((((α - 1) / α) * x) ^ α) ^ (1 / α) * (1 : ℝ) ^ ((α - 1) / α) = ((α - 1) / α) * x := by rw [Real.one_rpow, mul_one, ← Real.rpow_mul (by positivity : 0 ≤ ((α - 1) / α) * x), mul_one_div_cancel hα0.ne', Real.rpow_one] rw [hlhs, mul_one] at hamgm have hc_pos : 0 < (α - 1) / α := by positivity have hrew : (((α - 1) / α) * x) ^ α = ((α - 1) / α) * (((α - 1) / α) ^ (α - 1) * x ^ α) := by rw [Real.mul_rpow hc_pos.le hx_pos.le, ← mul_assoc, ← Real.rpow_one_add' hc_pos.le (by linarith)] congr 2; ring rw [hrew] at hamgm have hcancel : x - 1 ≤ (1 / α) * ((α - 1) / α) ^ (α - 1) * x ^ α := by have : ((α - 1) / α) * (x - 1) ≤ ((α - 1) / α) * ((1 / α) * ((α - 1) / α) ^ (α - 1) * x ^ α) := by linarith exact le_of_mul_le_mul_left this hc_pos have hconst : (1 / α) * ((α - 1) / α) ^ (α - 1) = (α - 1) ^ (α - 1) / α ^ α := by rw [Real.div_rpow hα1.le hα0.le] have hαpow : α ^ (α - 1) * α = α ^ α := by rw [mul_comm, ← Real.rpow_one_add' hα0.le (by linarith)]; congr 1; ring rw [one_div, ← div_eq_inv_mul, div_div, hαpow] rw [hconst] at hcancel have hmul := mul_le_mul_of_nonneg_left hcancel hγ.le have hl : γ * (x - 1) = t - γ := by dsimp [x]; field_simp [hγ.ne'] have hr : γ * ((α - 1) ^ (α - 1) / α ^ α * x ^ α) = (α - 1) ^ (α - 1) / α ^ α * γ ^ (1 - α) * t ^ α := by dsimp [x] rw [Real.div_rpow ht_pos.le hγ.le] have hγpow : γ / γ ^ α = γ ^ (1 - α) := by rw [Real.rpow_sub hγ, Real.rpow_one] calc γ * ((α - 1) ^ (α - 1) / α ^ α * (t ^ α / γ ^ α)) = (α - 1) ^ (α - 1) / α ^ α * (γ / γ ^ α) * t ^ α := by ring _ = (α - 1) ^ (α - 1) / α ^ α * γ ^ (1 - α) * t ^ α := by rw [hγpow] linarith /-- The sharp Balle et al. (2020) RDP-to-`(ε, δ)` prefactor `(α - 1)^(α - 1) / α^α` is strictly `< 1` for all `α > 1` (strictly beating Mironov 2017 everywhere!). -/ theorem sharp_rdp_factor_lt_one {α : ℝ} (hα : 1 < α) : (α - 1) ^ (α - 1) / α ^ α < 1 := by have hα0 : 0 < α := by linarith have hα1 : 0 < α - 1 := by linarith rw [div_lt_one (Real.rpow_pos_of_pos hα0 α)] have h1 : (α - 1) ^ (α - 1) < α ^ (α - 1) := Real.rpow_lt_rpow hα1.le (by linarith) hα1 have h2 : α ^ (α - 1) < α ^ α := Real.rpow_lt_rpow_of_exponent_lt hα (by linarith) exact lt_trans h1 h2 /-- For all `α ≥ 2`, the Balle et al. (2020) prefactor is at most `1/4` (≥ 4× tighter than Mironov!). -/ theorem sharp_rdp_factor_le_quarter {α : ℝ} (hα : 2 ≤ α) : (α - 1) ^ (α - 1) / α ^ α ≤ 1 / 4 := by have hα0 : 0 < α := by linarith have hα1 : 1 ≤ α - 1 := by linarith have hbase_pos : 0 < (α - 1) / α := by positivity have hbase_le : (α - 1) / α ≤ 1 := by rw [div_le_one hα0]; linarith have hpow_le : ((α - 1) / α) ^ (α - 1) ≤ (α - 1) / α := by simpa [Real.rpow_one] using Real.rpow_le_rpow_of_exponent_ge hbase_pos hbase_le hα1 have hrew : (α - 1) ^ (α - 1) / α ^ α = ((α - 1) / α) ^ (α - 1) / α := by rw [Real.div_rpow (by linarith) hα0.le, div_div] congr 1 rw [← Real.rpow_add_one hα0.ne'] congr 1; ring rw [hrew] calc ((α - 1) / α) ^ (α - 1) / α ≤ ((α - 1) / α) / α := div_le_div_of_nonneg_right hpow_le hα0.le _ = (α - 1) / α ^ 2 := by rw [div_div, sq] _ ≤ 1 / 4 := by rw [div_le_div_iff₀ (by positivity) (by norm_num)] nlinarith [sq_nonneg (α - 2)] /-- **Sharp Balle–Barthe–Gaboardi–Hsu–Sato (2020) RDP-to-`(ε, δ)` Conversion Theorem:** For any positive integrable densities `p, q`, any Rényi order `α > 1`, and any `ε ∈ ℝ`, `H_{e^ε}(p, q) ≤ ((α - 1)^(α - 1) / α^α) · exp((α - 1)(D_α(p ‖ q) - ε))`. -/ theorem sharp_rdp_to_epsDelta {α ε : ℝ} {p q : ℝ → ℝ} (hα : 1 < α) (hp_pos : ∀ x, 0 < p x) (hq_pos : ∀ x, 0 < q x) (hp : Integrable p) (hq : Integrable q) (hI : Integrable (fun x => (p x) ^ α * (q x) ^ (1 - α))) (hI_pos : 0 < ∫ x : ℝ, (p x) ^ α * (q x) ^ (1 - α)) : contHockeyStick (Real.exp ε) p q ≤ (((α - 1) ^ (α - 1)) / (α ^ α)) * Real.exp ((α - 1) * (contRenyiDiv α p q - ε)) := by unfold contHockeyStick contRenyiDiv have hα1 : 0 < α - 1 := by linarith let C := (α - 1) ^ (α - 1) / α ^ α have hpoint : ∀ x : ℝ, max 0 (p x - Real.exp ε * q x) ≤ (C * (Real.exp ε) ^ (1 - α)) * ((p x) ^ α * (q x) ^ (1 - α)) := by intro x have hqx : 0 < q x := hq_pos x have hpx : 0 < p x := hp_pos x have hrat := sharp_hockeyStick_pointwise_bound hα (Real.exp_pos ε) (div_pos hpx hqx).le have hmul := mul_le_mul_of_nonneg_right hrat hqx.le have hlhs : max 0 (p x / q x - Real.exp ε) * q x = max 0 (p x - Real.exp ε * q x) := by rw [max_mul_of_nonneg _ _ hqx.le, zero_mul, sub_mul, div_mul_cancel₀ _ hqx.ne'] have hrhs : C * (Real.exp ε) ^ (1 - α) * (p x / q x) ^ α * q x = (C * (Real.exp ε) ^ (1 - α)) * ((p x) ^ α * (q x) ^ (1 - α)) := by rw [Real.div_rpow hpx.le hqx.le] have hqpow : q x / (q x) ^ α = (q x) ^ (1 - α) := by rw [Real.rpow_sub hqx, Real.rpow_one] calc C * (Real.exp ε) ^ (1 - α) * ((p x) ^ α / (q x) ^ α) * q x = (C * (Real.exp ε) ^ (1 - α)) * ((p x) ^ α * (q x / (q x) ^ α)) := by ring _ = (C * (Real.exp ε) ^ (1 - α)) * ((p x) ^ α * (q x) ^ (1 - α)) := by rw [hqpow] linarith have hint_le : (∫ x : ℝ, max 0 (p x - Real.exp ε * q x)) ≤ ∫ x : ℝ, (C * (Real.exp ε) ^ (1 - α)) * ((p x) ^ α * (q x) ^ (1 - α)) := integral_mono (integrable_max_zero_sub hp hq) (hI.const_mul _) hpoint rw [integral_const_mul] at hint_le let I := ∫ x : ℝ, (p x) ^ α * (q x) ^ (1 - α) have hexp_eq : (Real.exp ε) ^ (1 - α) * I = Real.exp ((α - 1) * (Real.log I / (α - 1) - ε)) := by have hL : (Real.exp ε) ^ (1 - α) * I = Real.exp (ε * (1 - α) + Real.log I) := by rw [← Real.exp_mul, Real.exp_add, Real.exp_log hI_pos] rw [hL] congr 1 field_simp [hα1.ne'] ring calc (∫ x : ℝ, max 0 (p x - Real.exp ε * q x)) ≤ C * (Real.exp ε) ^ (1 - α) * I := hint_le _ = C * ((Real.exp ε) ^ (1 - α) * I) := by ring _ = C * Real.exp ((α - 1) * (Real.log I / (α - 1) - ε)) := by rw [hexp_eq] end ContinuousMechanismDPAndBalleWang /-! ## Axiom Verification -/ #print axioms ContinuousMechanismDPAndBalleWang.contHockeyStick_ge_event #print axioms ContinuousMechanismDPAndBalleWang.contHockeyStick_eq_lrt_event #print axioms ContinuousMechanismDPAndBalleWang.contEpsDelta_iff_hockeyStick #print axioms ContinuousMechanismDPAndBalleWang.contHockeyStick_kernel_dpi #print axioms ContinuousMechanismDPAndBalleWang.contEpsDelta_group_privacy #print axioms ContinuousMechanismDPAndBalleWang.integral_laplacePDF_eq_one #print axioms ContinuousMechanismDPAndBalleWang.laplace_hockeyStick_exact #print axioms ContinuousMechanismDPAndBalleWang.laplace_hockeyStick_symm #print axioms ContinuousMechanismDPAndBalleWang.laplace_exact_beats_pure_calibration #print axioms ContinuousMechanismDPAndBalleWang.stdGaussCDF_symm #print axioms ContinuousMechanismDPAndBalleWang.stdGaussCDF_zero #print axioms ContinuousMechanismDPAndBalleWang.hasDerivAt_stdGaussCDF #print axioms ContinuousMechanismDPAndBalleWang.stdGaussCDF_strictMono #print axioms ContinuousMechanismDPAndBalleWang.stdGaussCDF_neg_le_mills #print axioms ContinuousMechanismDPAndBalleWang.stdGaussCDF_neg_le_half_exp #print axioms ContinuousMechanismDPAndBalleWang.balle_wang_gaussian_hockeyStick_exact #print axioms ContinuousMechanismDPAndBalleWang.balle_wang_gaussian_symm #print axioms ContinuousMechanismDPAndBalleWang.hasDerivAt_balleWangDelta_mu #print axioms ContinuousMechanismDPAndBalleWang.hasDerivAt_balleWangDelta_eps #print axioms ContinuousMechanismDPAndBalleWang.balleWangDelta_strictMono_mu #print axioms ContinuousMechanismDPAndBalleWang.balleWangDelta_strictAnti_eps #print axioms ContinuousMechanismDPAndBalleWang.balle_wang_strictly_beats_dwork_roth_small_eps #print axioms ContinuousMechanismDPAndBalleWang.dwork_roth_fails_large_eps #print axioms ContinuousMechanismDPAndBalleWang.balle_wang_valid_all_eps #print axioms ContinuousMechanismDPAndBalleWang.gaussian_renyi_div_exact #print axioms ContinuousMechanismDPAndBalleWang.sharp_hockeyStick_pointwise_bound #print axioms ContinuousMechanismDPAndBalleWang.sharp_rdp_factor_lt_one #print axioms ContinuousMechanismDPAndBalleWang.sharp_rdp_factor_le_quarter #print axioms ContinuousMechanismDPAndBalleWang.sharp_rdp_to_epsDelta