Documentation

CslibFrontier.Privacy.DifferentialPrivacy.Basic

Differential privacy #

A mechanism is a map M : D → PMF R from datasets to output distributions. It is (ε, δ)-differentially private with respect to an adjacency relation Adj on datasets when Pr[M x ∈ S] ≤ exp ε · Pr[M y ∈ S] + δ for every pair of adjacent datasets x, y and every event S ⊆ R [DworkRoth2014, Definition 2.4]. Events are arbitrary sets of outputs, measured by PMF.toOuterMeasure, so no measurable structure on R is needed.

The adjacency relation is a parameter. Dwork and Roth compare databases at ℓ₁ distance at most one (adding or removing one record); Ghosh, Roughgarden and Sundararajan compare databases that coincide in all but one row [GhoshRoughgardenSundararajan2012, §2.1], which is Cslib.Privacy.HammingAdjacent in CslibFrontier.Privacy.DifferentialPrivacy.Hamming. Both are instances. The definition quantifies over ordered pairs, so a symmetric guarantee needs a symmetric Adj.

The pointwise characterization of pure privacy (DifferentiallyPrivate.iff_apply_le) is the likelihood-ratio form used for mechanisms with a countable range [GhoshRoughgardenSundararajan2012, §2.1]. It follows from the hockey-stick characterization (DifferentiallyPrivate.iff_hockeyStick_le, via Cslib.Probability.PMF.hockeyStick): the optimal δ for a fixed factor exp ε is the hockey-stick divergence of M x from M y at exp ε.

Main definitions #

Main results #

References #

def Cslib.Privacy.DifferentiallyPrivate {D : Type u} {R : Type v} (Adj : D → D → Prop) (M : D → PMF R) (ε : ℝ) (δ : ENNReal) :

A mechanism M is (ε, δ)-differentially private with respect to the adjacency relation Adj when, for all adjacent datasets x, y and every event S, Pr[M x ∈ S] ≤ exp ε · Pr[M y ∈ S] + δ [DworkRoth2014, Definition 2.4].

theorem Cslib.Privacy.DifferentiallyPrivate.iff_hockeyStick_le {D : Type u} {R : Type v} {Adj : D → D → Prop} {M : D → PMF R} {ε : ℝ} {δ : ENNReal} :
DifferentiallyPrivate Adj M ε δ ↔ ∀ ⦃x y : D⦄, Adj x y → Probability.PMF.hockeyStick (ENNReal.ofReal (Real.exp ε)) (M x) (M y) ≤ δ

(ε, δ)-differential privacy bounds the hockey-stick divergence of adjacent output distributions at factor exp ε by δ, and conversely.

theorem Cslib.Privacy.DifferentiallyPrivate.iff_apply_le {D : Type u} {R : Type v} {Adj : D → D → Prop} {M : D → PMF R} {ε : ℝ} :
DifferentiallyPrivate Adj M ε 0 ↔ ∀ ⦃x y : D⦄, Adj x y → ∀ (r : R), (M x) r ≤ ENNReal.ofReal (Real.exp ε) * (M y) r

Pure (ε, 0)-differential privacy is the pointwise likelihood-ratio bound M x r ≤ exp ε · M y r [GhoshRoughgardenSundararajan2012, §2.1].

theorem Cslib.Privacy.DifferentiallyPrivate.of_apply_le {D : Type u} {R : Type v} {Adj : D → D → Prop} {M : D → PMF R} {ε : ℝ} (h : ∀ ⦃x y : D⦄, Adj x y → ∀ (r : R), (M x) r ≤ ENNReal.ofReal (Real.exp ε) * (M y) r) :

A pointwise likelihood-ratio bound gives pure differential privacy.

theorem Cslib.Privacy.DifferentiallyPrivate.tsum_mul_le {D : Type u} {R : Type v} {Adj : D → D → Prop} {M : D → PMF R} {ε : ℝ} {δ : ENNReal} (h : DifferentiallyPrivate Adj M ε δ) {x y : D} (hxy : Adj x y) {g : R → ENNReal} (hg : ∀ (r : R), g r ≤ 1) :
∑' (r : R), (M x) r * g r ≤ ENNReal.ofReal (Real.exp ε) * ∑' (r : R), (M y) r * g r + δ

Differential privacy bounds expectations of [0, 1]-valued functions: E[g (M x)] ≤ exp ε · E[g (M y)] + δ for adjacent x, y.

theorem Cslib.Privacy.DifferentiallyPrivate.mono {D : Type u} {R : Type v} {Adj : D → D → Prop} {M : D → PMF R} {ε : ℝ} {δ : ENNReal} {ε' : ℝ} {δ' : ENNReal} (h : DifferentiallyPrivate Adj M ε δ) (hε : ε ≤ ε') (hδ : δ ≤ δ') :
DifferentiallyPrivate Adj M ε' δ'

Differential privacy is monotone in both privacy parameters.

theorem Cslib.Privacy.DifferentiallyPrivate.mono_adj {D : Type u} {R : Type v} {Adj : D → D → Prop} {M : D → PMF R} {ε : ℝ} {δ : ENNReal} {Adj' : D → D → Prop} (h : DifferentiallyPrivate Adj M ε δ) (hAdj : ∀ ⦃x y : D⦄, Adj' x y → Adj x y) :

Differential privacy is antitone in the adjacency relation.

theorem Cslib.Privacy.DifferentiallyPrivate.bind {D : Type u} {R : Type v} {R' : Type w} {Adj : D → D → Prop} {M : D → PMF R} {ε : ℝ} {δ : ENNReal} (h : DifferentiallyPrivate Adj M ε δ) (K : R → PMF R') :
DifferentiallyPrivate Adj (fun (x : D) => (M x).bind K) ε δ

Post-processing: applying any randomized map K to the output of a differentially private mechanism preserves its privacy parameters [DworkRoth2014, Proposition 2.1].

theorem Cslib.Privacy.DifferentiallyPrivate.map {D : Type u} {R : Type v} {R' : Type w} {Adj : D → D → Prop} {M : D → PMF R} {ε : ℝ} {δ : ENNReal} (h : DifferentiallyPrivate Adj M ε δ) (f : R → R') :
DifferentiallyPrivate Adj (fun (x : D) => PMF.map f (M x)) ε δ

Deterministic post-processing preserves differential privacy.

theorem Cslib.Privacy.DifferentiallyPrivate.comp {D : Type u} {R : Type v} {Adj : D → D → Prop} {M : D → PMF R} {ε : ℝ} {δ : ENNReal} {D' : Type u_1} {Adj' : D' → D' → Prop} (h : DifferentiallyPrivate Adj M ε δ) (f : D' → D) (hf : ∀ ⦃x y : D'⦄, Adj' x y → Adj (f x) (f y)) :
DifferentiallyPrivate Adj' (M ∘ f) ε δ

Precomposing a mechanism with a map that sends Adj'-adjacent datasets to Adj-adjacent ones preserves differential privacy.

theorem Cslib.Privacy.DifferentiallyPrivate.trans {D : Type u} {R : Type v} {M : D → PMF R} {Adj₁ Adj₂ : D → D → Prop} {ε₁ ε₂ : ℝ} {δ₁ δ₂ : ENNReal} (h₁ : DifferentiallyPrivate Adj₁ M ε₁ δ₁) (h₂ : DifferentiallyPrivate Adj₂ M ε₂ δ₂) :
DifferentiallyPrivate (Relation.Comp Adj₁ Adj₂) M (ε₁ + ε₂) (δ₁ + ENNReal.ofReal (Real.exp ε₁) * δ₂)

Privacy along the composite of two adjacency relations: if M is (ε₁, δ₁)-private for Adj₁ and (ε₂, δ₂)-private for Adj₂, it is (ε₁ + ε₂, δ₁ + exp ε₁ · δ₂)-private for Relation.Comp Adj₁ Adj₂.