Documentation

CslibFrontier.Privacy.DifferentialPrivacy.AboveThreshold

AboveThreshold and the sparse vector technique with discrete Laplace noise #

AboveThreshold [DworkRoth2014, Algorithm 1] answers a stream of sensitivity-Δ queries f₁, f₂, … against a public threshold T. It draws a noisy threshold T̂ = T + ρ once, then for each query draws fresh noise νᵢ and halts at the first i with fᵢ(D) + νᵢ ≥ T̂, reporting ⊤ there and ⊥ before. Its privacy cost does not grow with the number of queries [DworkRoth2014, Theorem 3.23].

Here the noise is integer-valued, from the discrete Laplace distribution [CanonneKamathSteinke2020, Definition 28], and the results are discrete-noise analogues of Dwork and Roth's theorems for continuous Lap (2 / ε) and Lap (4 / ε) noise. The queries and threshold are real-valued; only the noise is discrete.

The output is the index of the first reported ⊤ (some i), or none when no query is reported; this is equivalent to Dwork and Roth's stream ⊥ ⋯ ⊥ ⊤. Because the stream of answers before halting is always ⊥ ⋯ ⊥, a deterministic analyst choosing the next query adaptively from the answers so far fixes the queries in advance, so a fixed list of queries loses no generality. A randomized analyst is a mixture of deterministic ones over its coins, and each run halts after reading a finite prefix of an infinite stream; neither reduction is formalized here.

Sparse [DworkRoth2014, Algorithm 2] restarts AboveThreshold after each reported ⊤, c times, on an adaptively chosen stream. Within a round the analyst sees only ⊥s, so the queries of a round are a function of the earlier rounds' outputs: sparse ρ ν T qs c runs c rounds of adaptive composition, the round after history h running AboveThreshold on the queries qs h. With discrete Laplace noise of scales 2 c Δ / ε and 4 c Δ / ε it is (ε, 0)-private (differentiallyPrivate_sparse_discreteLaplace), the δ = 0 case of [DworkRoth2014, Theorem 3.25]. A fixed stream fs, each round continuing on the unconsumed queries, is the instance sparseStream fs.

Main definitions #

Main results #

References #

noncomputable def Cslib.Privacy.aboveThresholdAux (ν : PMF ℤ) (T : ℝ) :

AboveThreshold against a fixed noisy threshold T̂: draw ν for the first answer a, report index 0 if a + ν ≥ T̂, and otherwise continue with the remaining answers.

noncomputable def Cslib.Privacy.aboveThreshold (ρ ν : PMF ℤ) (T : ℝ) (as : List ℝ) :

AboveThreshold [DworkRoth2014, Algorithm 1] on the list of query answers as with public threshold T: draw ρ once, compare each noisy answer a + ν with T + ρ, and return the index of the first answer reported above threshold, or none.

noncomputable def Cslib.Privacy.aboveThresholdMechanism {D : Type u_1} (ρ ν : PMF ℤ) (T : ℝ) (fs : List (D → ℝ)) (x : D) :

AboveThreshold as a mechanism: on dataset x it runs on the answers f x of the queries fs.

theorem Cslib.Privacy.aboveThresholdAux_apply_le {ν : PMF ℤ} {c : ENNReal} {s : ℤ} (hc : 1 ≤ c) (hν : ∀ (v : ℤ), ν v ≤ c * ν (v + 2 * s)) {as bs : List ℝ} (hab : List.Forall₂ (fun (a b : ℝ) => a - ↑s ≤ b ∧ b ≤ a + ↑s) as bs) (T : ℝ) (o : Option ℕ) :
(aboveThresholdAux ν T as) o ≤ c * (aboveThresholdAux ν (T + ↑s) bs) o

The change of variables in the proof of [DworkRoth2014, Theorem 3.23], for a fixed noisy threshold: if each answer in bs is at least the corresponding answer in as minus s, and shifting the query noise by 2 s changes its masses by at most c ≥ 1, then raising the threshold by s changes each output probability by at most c.

theorem Cslib.Privacy.DifferentiallyPrivate.aboveThresholdMechanism {D : Type u_1} {Adj : D → D → Prop} {ρ ν : PMF ℤ} {T : ℝ} {fs : List (D → ℝ)} {s : ℤ} {ε₁ ε₂ : ℝ} (hε₂ : 0 ≤ ε₂) (hfs : ∀ f ∈ fs, Sensitivity Adj f ↑s) (hρ : ∀ (r : ℤ), ρ r ≤ ENNReal.ofReal (Real.exp ε₁) * ρ (r + s)) (hν : ∀ (v : ℤ), ν v ≤ ENNReal.ofReal (Real.exp ε₂) * ν (v + 2 * s)) :

AboveThreshold is (ε₁ + ε₂, 0)-differentially private for queries of sensitivity s whenever shifting the threshold noise by s changes its masses by at most exp ε₁ and shifting the query noise by 2 s changes them by at most exp ε₂. This generalizes [DworkRoth2014, Theorem 3.23], which takes Lap (2 / ε) and Lap (4 / ε) noise, and follows its proof.

theorem Cslib.Privacy.differentiallyPrivate_aboveThreshold_discreteLaplace {D : Type u_1} {Adj : D → D → Prop} {T : ℝ} {fs : List (D → ℝ)} {Δ : ℕ} (hΔ : 0 < Δ) (hfs : ∀ f ∈ fs, Sensitivity Adj f ↑Δ) {ε : ℝ} (hε : 0 < ε) :
DifferentiallyPrivate Adj (aboveThresholdMechanism (discreteLaplace (2 * ↑Δ / ε) ⋯) (discreteLaplace (4 * ↑Δ / ε) ⋯) T fs) ε 0

AboveThreshold with discrete Laplace noise: for queries of sensitivity Δ ≥ 1 (an integer), threshold noise of scale 2 Δ / ε and query noise of scale 4 Δ / ε give (ε, 0)-differential privacy, however many queries are asked. This is the discrete-noise analogue of [DworkRoth2014, Theorem 3.23].

The accuracy condition of [DworkRoth2014, Definition 3.9] for the answers as, threshold T and slack α: every answer reported below threshold is at most T + α, and the answer reported above threshold, if any, is at least T - α.

theorem Cslib.Privacy.ThresholdAccurate.length_le {T α : ℝ} {as : List ℝ} {i : ℕ} (h : ThresholdAccurate T α as (some i)) (has : ∀ (j : ℕ) (hj : j + 1 < as.length), as[j] < T - α) :
as.length ≤ i + 1

An accurate output does not halt early [DworkRoth2014, proof of Theorem 3.24]: if every answer before the last is below T - α, a reported index is the last one.

theorem Cslib.Privacy.aboveThresholdAux_toOuterMeasure_not_thresholdAccurate_le (ν : PMF ℤ) {T r α₁ α₂ : ℝ} (hr : |r| ≤ α₁) (as : List ℝ) :
(aboveThresholdAux ν (T + r) as).toOuterMeasure {o : Option ℕ | ¬ThresholdAccurate T (α₁ + α₂) as o} ≤ ↑as.length * ν.toOuterMeasure {v : ℤ | α₂ < |↑v|}

For a noisy threshold within α₁ of T, AboveThreshold fails to be (α₁ + α₂)-accurate with probability at most k · Pr[|ν| > α₂] on k answers.

theorem Cslib.Privacy.aboveThreshold_toOuterMeasure_not_thresholdAccurate_le (ρ ν : PMF ℤ) (T : ℝ) {α₁ α₂ : ℝ} (as : List ℝ) :
(aboveThreshold ρ ν T as).toOuterMeasure {o : Option ℕ | ¬ThresholdAccurate T (α₁ + α₂) as o} ≤ ρ.toOuterMeasure {r : ℤ | α₁ < |↑r|} + ↑as.length * ν.toOuterMeasure {v : ℤ | α₂ < |↑v|}

AboveThreshold on k answers fails to be (α₁ + α₂)-accurate with probability at most Pr[|ρ| > α₁] + k · Pr[|ν| > α₂] [DworkRoth2014, proof of Theorem 3.24].

theorem Cslib.Privacy.aboveThreshold_discreteLaplace_toOuterMeasure_not_thresholdAccurate_le {ε β : ℝ} (hε : 0 < ε) (hβ : 0 < β) (hβ1 : β ≤ 1) (T : ℝ) (as : List ℝ) :
(aboveThreshold (discreteLaplace (2 / ε) ⋯) (discreteLaplace (4 / ε) ⋯) T as).toOuterMeasure {o : Option ℕ | ¬ThresholdAccurate T (8 * (Real.log (↑as.length + 1) + Real.log (2 / β)) / ε) as o} ≤ ENNReal.ofReal β

Accuracy of AboveThreshold with discrete Laplace noise (scales 2 / ε and 4 / ε): on k answers it is α-accurate except with probability at most β, for α = 8 (ln (k + 1) + ln (2 / β)) / ε and 0 < β ≤ 1. This is the discrete-noise analogue of [DworkRoth2014, Theorem 3.24], with k + 1 in place of k.

theorem Cslib.Privacy.aboveThreshold_discreteLaplace_toOuterMeasure_not_accurate_le {ε β : ℝ} (hε : 0 < ε) (hβ : 0 < β) (hβ1 : β ≤ 1) (T : ℝ) (as : List ℝ) (has : ∀ (j : ℕ) (hj : j + 1 < as.length), as[j] < T - 8 * (Real.log (↑as.length + 1) + Real.log (2 / β)) / ε) :
(aboveThreshold (discreteLaplace (2 / ε) ⋯) (discreteLaplace (4 / ε) ⋯) T as).toOuterMeasure {o : Option ℕ | ¬(ThresholdAccurate T (8 * (Real.log (↑as.length + 1) + Real.log (2 / β)) / ε) as o ∧ ∀ (i : ℕ), o = some i → as.length ≤ i + 1)} ≤ ENNReal.ofReal β

The accuracy theorem [DworkRoth2014, Theorem 3.24] for discrete Laplace noise of scales 2 / ε and 4 / ε and sensitivity-1 queries: if every answer before the last is below T - α, then except with probability β the output is α-accurate and, if it reports an index, reports the last one, for α = 8 (ln (k + 1) + ln (2 / β)) / ε on k answers and 0 < β ≤ 1.

The number of queries consumed by a run of AboveThreshold on n remaining queries that returned o.

The position in the query stream after the AboveThreshold runs recorded in history (most recent first).

noncomputable def Cslib.Privacy.sparse {D : Type u_1} (ρ ν : PMF ℤ) (T : ℝ) (qs : List (Option ℕ) → List (D → ℝ)) (c : ℕ) :
D → PMF (List (Option ℕ))

Sparse [DworkRoth2014, Algorithm 2] with cutoff c on an adaptively chosen stream, as c-fold adaptive composition of AboveThreshold: the round after the history h (the indices reported by the earlier rounds, most recent first) restarts AboveThreshold, with fresh threshold noise, on the queries qs h. The transcript lists the index reported by each round, most recent first. Within a round the analyst sees only ⊥s, so a deterministic analyst's queries for a round depend only on the earlier rounds' outputs.

def Cslib.Privacy.sparseStream {D : Type u_1} (fs : List (D → ℝ)) (history : List (Option ℕ)) :
List (D → ℝ)

The queries of each round of Sparse on the fixed stream fs: the round continues on the queries not yet consumed by the earlier rounds.

theorem Cslib.Privacy.mem_of_mem_sparseStream {D : Type u_1} {fs : List (D → ℝ)} {history : List (Option ℕ)} {f : D → ℝ} (hf : f ∈ sparseStream fs history) :
f ∈ fs

Every query of a round of Sparse on a fixed stream belongs to the stream.

theorem Cslib.Privacy.DifferentiallyPrivate.sparse {D : Type u_1} {Adj : D → D → Prop} {ρ ν : PMF ℤ} {T : ℝ} {qs : List (Option ℕ) → List (D → ℝ)} {s : ℤ} {ε₁ ε₂ : ℝ} (hε₂ : 0 ≤ ε₂) (hqs : ∀ (history : List (Option ℕ)), ∀ f ∈ qs history, Sensitivity Adj f ↑s) (hρ : ∀ (r : ℤ), ρ r ≤ ENNReal.ofReal (Real.exp ε₁) * ρ (r + s)) (hν : ∀ (v : ℤ), ν v ≤ ENNReal.ofReal (Real.exp ε₂) * ν (v + 2 * s)) (c : ℕ) :
DifferentiallyPrivate Adj (Privacy.sparse ρ ν T qs c) (↑c * (ε₁ + ε₂)) 0

Sparse with cutoff c is (c (ε₁ + ε₂), 0)-private when each AboveThreshold round is (ε₁ + ε₂, 0)-private, by basic adaptive composition; this follows the proof of [DworkRoth2014, Theorem 3.25] for δ = 0.

theorem Cslib.Privacy.differentiallyPrivate_sparse_discreteLaplace {D : Type u_1} {Adj : D → D → Prop} {T : ℝ} {qs : List (Option ℕ) → List (D → ℝ)} {Δ : ℕ} (hΔ : 0 < Δ) (hqs : ∀ (history : List (Option ℕ)), ∀ f ∈ qs history, Sensitivity Adj f ↑Δ) {c : ℕ} (hc : 0 < c) {ε : ℝ} (hε : 0 < ε) :
DifferentiallyPrivate Adj (sparse (discreteLaplace (2 * ↑c * ↑Δ / ε) ⋯) (discreteLaplace (4 * ↑c * ↑Δ / ε) ⋯) T qs c) ε 0

Sparse with cutoff c ≥ 1 on an adaptively chosen stream, with discrete Laplace noise of scales 2 c Δ / ε and 4 c Δ / ε, is (ε, 0)-differentially private for queries of sensitivity Δ ≥ 1 (an integer); the δ = 0 case of [DworkRoth2014, Theorem 3.25], with discrete noise.

theorem Cslib.Privacy.differentiallyPrivate_sparse_sparseStream_discreteLaplace {D : Type u_1} {Adj : D → D → Prop} {T : ℝ} {fs : List (D → ℝ)} {Δ : ℕ} (hΔ : 0 < Δ) (hfs : ∀ f ∈ fs, Sensitivity Adj f ↑Δ) {c : ℕ} (hc : 0 < c) {ε : ℝ} (hε : 0 < ε) :
DifferentiallyPrivate Adj (sparse (discreteLaplace (2 * ↑c * ↑Δ / ε) ⋯) (discreteLaplace (4 * ↑c * ↑Δ / ε) ⋯) T (sparseStream fs) c) ε 0

Sparse on a fixed stream of queries of sensitivity Δ ≥ 1, each round continuing on the unconsumed queries, with discrete Laplace noise of scales 2 c Δ / ε and 4 c Δ / ε, is (ε, 0)-differentially private.