Documentation

CslibFrontier.Privacy.DifferentialPrivacy.RandomReconstruction

Reconstruction from random ±1 queries #

A database holds one secret sign per person, d : ι → Bool, read as signVal (d i) ∈ {1, -1}. A ±1 query v : ι → Bool asks for signDot v d = ∑ i, signVal (v i) * signVal (d i), the inner product of the two sign vectors. Dwork and Roth's databases and queries live in {-1, 1} ^ n, and signVal is the identification (false ↦ 1, true ↦ -1). For m queries A : κ → ι → Bool, answers y : κ → ℝ are within α of the truth on at least a 1 / 2 + η fraction of the queries when (1 / 2 + η) m ≤ #{j | |y j - signDot (A j) d| ≤ α} (AnswersWithin A y d α η). The other answers are arbitrary.

Theorem ([DworkRoth2014, Theorem 8.2], with a corrected constant). Draw m ≥ b n uniformly random ±1 queries on n rows. Except with probability at most exp (-n (η b / 4 - ln 3)) over the queries, the following holds for every database d and all answers within α on a 1 / 2 + η fraction: the adversary (reconstructSigned) recovers d in all but fewer than ((⌊α⌋₊ + 1) / η) ^ 2 positions (toOuterMeasure_exists_le_hammingDist_reconstructSigned_le). The adversary outputs any database whose answers are also within α on a 1 / 2 + η fraction; the true database is a candidate. The good event depends only on the queries, so the guarantee holds against every curator, including one that sees the queries before answering. Dwork and Roth credit the attack to Dwork, McSherry and Talwar [DworkRoth2014, §8.3].

The proof follows Dwork and Roth. Two databases c, d that both fit the answers agree with them on a common 2 η fraction of the queries, where |signDot v c - signDot v d| ≤ 2 α. The difference is 2 ∑ i, signVal (v i) z i for the disagreement pattern z : ι → SignType. If z has at least k nonzero entries, the Erdős–Littlewood–Offord bound (Combinatorics.LittlewoodOfford.card_filter_sum_bool_Ico_le_two_pow_div_sqrt), applied to ⌊α⌋₊ + 1 unit windows, bounds the chance that a random query lands in this window by (⌊α⌋₊ + 1) / √(k + 1). That is at most η once k ≥ ((⌊α⌋₊ + 1) / η) ^ 2. Chernoff (Probability.PMF.pi_sum_ge_one_add_mul_of_le_one) bounds the chance that a fixed such z survives m independent queries by exp (-η m / 3). A union bound over the 3 ^ n patterns gives 3 ^ n exp (-η m / 3) (toOuterMeasure_reconstructionFails_le). That is at most Dwork and Roth's exp (-n (η b / 4 - ln 3)).

The constant. Dwork and Roth state (2 α / η) ^ 2 for every α.

Using ⌊α⌋₊ + 1 corrects the source's constant. It is not claimed as a new result.

Differential privacy. The consequence for differential privacy is a standard derivation. It follows Dwork and Roth's remark that if differential privacy is meaningful, then lower bounds for preventing blatant non-privacy also apply to every differentially private mechanism [DworkRoth2014, §8.1]. Fix queries A for which reconstruction does not fail; they exist once 3 ln 3 · n < η m (exists_not_reconstructionFails). Let M be an (ε, δ)-private mechanism for Hamming adjacency whose answers are within α on a 1 / 2 + η fraction with probability at least q on every database. Then (1 + exp ε) (n - ((⌊α⌋₊ + 1) / η) ^ 2) q ≤ n (exp ε + δ) (DifferentiallyPrivate.mul_card_sub_mul_le_of_answersWithin). With probability one this gives ⌊α⌋₊ + 1 ≥ η √(n (1 - δ) / (1 + exp ε)) (DifferentiallyPrivate.exists_forall_card_mul_one_sub_le_of_answersWithin). So linearly many ±1 queries cannot all be answered privately with error o(√n) on a 1 / 2 + η fraction.

Scope: the adversary is not efficient, since it searches all 2 ^ n databases. Dwork and Roth also ignore efficiency here.

Main definitions #

Main results #

References #

noncomputable def Cslib.Privacy.signDot {ι : Type u_1} [Fintype ι] (v d : ι → Bool) :

The answer to the ±1 query v on the database d, both read as sign vectors through signVal: ∑ i, v_i d_i [DworkRoth2014, §8.1].

theorem Cslib.Privacy.signDot_apply {ι : Type u_1} [Fintype ι] (v d : ι → Bool) :
signDot v d = ∑ i : ι, BitString.signVal (v i) * BitString.signVal (d i)

Unfolding signDot.

def Cslib.Privacy.AnswersWithin {ι : Type u_1} {κ : Type u_2} [Fintype ι] [Fintype κ] (A : κ → ι → Bool) (y : κ → ℝ) (d : ι → Bool) (α η : ℝ) :

The answers y to the ±1 queries A are within α of the true answers on d for at least a 1 / 2 + η fraction of the queries. The other answers are arbitrary.

theorem Cslib.Privacy.answersWithin_iff {ι : Type u_1} {κ : Type u_2} [Fintype ι] [Fintype κ] {A : κ → ι → Bool} {y : κ → ℝ} {d : ι → Bool} {α η : ℝ} :
AnswersWithin A y d α η ↔ (1 / 2 + η) * ↑(Fintype.card κ) ≤ ↑{j : κ | |y j - signDot (A j) d| ≤ α}.card

Unfolding AnswersWithin.

theorem Cslib.Privacy.answersWithin_signDot {ι : Type u_1} {κ : Type u_2} [Fintype ι] [Fintype κ] (A : κ → ι → Bool) (d : ι → Bool) {α η : ℝ} (hα : 0 ≤ α) (hη : η ≤ 1 / 2) :
AnswersWithin A (fun (j : κ) => signDot (A j) d) d α η

Exact answers are within any α ≥ 0 on every query, so on a 1 / 2 + η fraction whenever η ≤ 1 / 2.

theorem Cslib.Privacy.AnswersWithin.mono {ι : Type u_1} {κ : Type u_2} [Fintype ι] [Fintype κ] {A : κ → ι → Bool} {y : κ → ℝ} {d : ι → Bool} {α α' η η' : ℝ} (h : AnswersWithin A y d α η) (hα : α ≤ α') (hη : η' ≤ η) :
AnswersWithin A y d α' η'

Fitting answers is monotone: a larger error α and a smaller fraction 1 / 2 + η are easier to meet.

Anti-concentration and the bad event for one pattern #

The attack #

def Cslib.Privacy.ReconstructionFails {ι : Type u_1} {κ : Type u_2} [Fintype ι] [Fintype κ] (A : κ → ι → Bool) (α η : ℝ) :

The queries A fail: two databases at Hamming distance at least ((⌊α⌋₊ + 1) / η) ^ 2 both answer at least a 1 / 2 + η fraction of them to within α, with the same answers y.

theorem Cslib.Privacy.reconstructionFails_iff {ι : Type u_1} {κ : Type u_2} [Fintype ι] [Fintype κ] {A : κ → ι → Bool} {α η : ℝ} :
ReconstructionFails A α η ↔ ∃ (y : κ → ℝ) (c : ι → Bool) (d : ι → Bool), AnswersWithin A y c α η ∧ AnswersWithin A y d α η ∧ ((↑⌊α⌋₊ + 1) / η) ^ 2 ≤ ↑(hammingDist c d)

Unfolding ReconstructionFails.

theorem Cslib.Privacy.toOuterMeasure_reconstructionFails_le {ι : Type u_1} {κ : Type u_2} [Fintype ι] [Fintype κ] [DecidableEq ι] [DecidableEq κ] {α η : ℝ} (hη : 0 < η) :

Random queries rarely fail [DworkRoth2014, proof of Theorem 8.2]. For m uniformly random ±1 queries on n rows, the queries fail with probability at most 3 ^ n exp (-η m / 3): a Chernoff bound for each disagreement pattern and a union bound over the 3 ^ n patterns.

noncomputable def Cslib.Privacy.reconstructSigned {ι : Type u_1} {κ : Type u_2} [Fintype ι] [Fintype κ] (A : κ → ι → Bool) (α η : ℝ) (y : κ → ℝ) :
ι → Bool

The reconstruction adversary of [DworkRoth2014, Theorem 8.2]: given answers y to the ±1 queries A, output a database that answers at least a 1 / 2 + η fraction of them to within α, if there is one (and the all-false database otherwise). It is not efficient: it searches all databases.

theorem Cslib.Privacy.hammingDist_reconstructSigned_lt {ι : Type u_1} {κ : Type u_2} [Fintype ι] [Fintype κ] {A : κ → ι → Bool} {α η : ℝ} (hA : ¬ReconstructionFails A α η) {y : κ → ℝ} {d : ι → Bool} (hd : AnswersWithin A y d α η) :
↑(hammingDist (reconstructSigned A α η y) d) < ((↑⌊α⌋₊ + 1) / η) ^ 2

On queries that do not fail, the adversary errs in fewer than ((⌊α⌋₊ + 1) / η) ^ 2 positions whenever the answers are within α on a 1 / 2 + η fraction.

theorem Cslib.Privacy.toOuterMeasure_exists_le_hammingDist_reconstructSigned_le {ι : Type u_1} {κ : Type u_2} [Fintype ι] [Fintype κ] [DecidableEq ι] [DecidableEq κ] {α η b : ℝ} (hη : 0 < η) (hm : b * ↑(Fintype.card ι) ≤ ↑(Fintype.card κ)) :
(Probability.PMF.uniformOfFintype (κ → ι → Bool)).toOuterMeasure {A : κ → ι → Bool | ∃ (d : ι → Bool) (y : κ → ℝ), AnswersWithin A y d α η ∧ ((↑⌊α⌋₊ + 1) / η) ^ 2 ≤ ↑(hammingDist (reconstructSigned A α η y) d)} ≤ ENNReal.ofReal (Real.exp (-(↑(Fintype.card ι) * (η * b / 4 - Real.log 3))))

[DworkRoth2014, Theorem 8.2], with a corrected constant. Draw m ≥ b n uniformly random ±1 queries on n rows. Except with probability at most exp (-n (η b / 4 - ln 3)) over the queries, the following holds for every database d and all answers y that are within α of the truth on at least a 1 / 2 + η fraction of the queries: the adversary's output differs from d in fewer than ((⌊α⌋₊ + 1) / η) ^ 2 positions. For α ≥ 1 / 2 this implies Dwork and Roth's bound (2 α / η) ^ 2 (toOuterMeasure_exists_lt_hammingDist_reconstructSigned_le_of_half_le). For small α their bound is false (exists_answersWithin_lt_hammingDist).

theorem Cslib.Privacy.toOuterMeasure_exists_lt_hammingDist_reconstructSigned_le_of_half_le {ι : Type u_1} {κ : Type u_2} [Fintype ι] [Fintype κ] [DecidableEq ι] [DecidableEq κ] {α η b : ℝ} (hα : 1 / 2 ≤ α) (hη : 0 < η) (hm : b * ↑(Fintype.card ι) ≤ ↑(Fintype.card κ)) :
(Probability.PMF.uniformOfFintype (κ → ι → Bool)).toOuterMeasure {A : κ → ι → Bool | ∃ (d : ι → Bool) (y : κ → ℝ), AnswersWithin A y d α η ∧ (2 * α / η) ^ 2 < ↑(hammingDist (reconstructSigned A α η y) d)} ≤ ENNReal.ofReal (Real.exp (-(↑(Fintype.card ι) * (η * b / 4 - Real.log 3))))

[DworkRoth2014, Theorem 8.2] in Dwork and Roth's form, for α ≥ 1 / 2. Draw m ≥ b n uniformly random ±1 queries on n rows. Except with probability at most exp (-n (η b / 4 - ln 3)) over the queries, for every database d and all answers y within α on at least a 1 / 2 + η fraction of the queries, the adversary's output agrees with d in all but at most (2 α / η) ^ 2 entries. Here ⌊α⌋₊ + 1 ≤ 2 α. For small α the statement is false (exists_answersWithin_lt_hammingDist).

theorem Cslib.Privacy.exists_not_reconstructionFails {ι : Type u_1} {κ : Type u_2} [Fintype ι] [Fintype κ] {α η : ℝ} (hη : 0 < η) (hm : 3 * Real.log 3 * ↑(Fintype.card ι) < η * ↑(Fintype.card κ)) :
∃ (A : κ → ι → Bool), ¬ReconstructionFails A α η

Good queries exist. If 3 ln 3 · n < η m, some m queries on n rows do not fail: no two databases at Hamming distance at least ((⌊α⌋₊ + 1) / η) ^ 2 answer at least a 1 / 2 + η fraction of them to within α with the same answers.

theorem Cslib.Privacy.DifferentiallyPrivate.mul_card_sub_mul_le_of_answersWithin {ι : Type u_1} {κ : Type u_2} [Fintype ι] [Fintype κ] {R : Type u_3} {M : (ι → Bool) → PMF R} {ε : ℝ} {δ : ENNReal} (h : DifferentiallyPrivate HammingAdjacent M ε δ) (hδ : δ ≠ ⊤) {A : κ → ι → Bool} {α η : ℝ} (hA : ¬ReconstructionFails A α η) (ans : R → κ → ℝ) {q : ℝ} (hq0 : 0 ≤ q) (hq : ∀ (d : ι → Bool), ENNReal.ofReal q ≤ (M d).toOuterMeasure {o : R | AnswersWithin A (ans o) d α η}) :
(1 + Real.exp ε) * (↑(Fintype.card ι) - ((↑⌊α⌋₊ + 1) / η) ^ 2) * q ≤ ↑(Fintype.card ι) * (Real.exp ε + δ.toReal)

Private answers to good ±1 queries are inaccurate. Let A be queries that do not fail (for example from exists_not_reconstructionFails), and let M be (ε, δ)-private for Hamming adjacency on databases of n rows, with outputs from which ans reads answers to the queries. If on every database the answers are within α on at least a 1 / 2 + η fraction of the queries with probability at least q, then (1 + exp ε) (n - ((⌊α⌋₊ + 1) / η) ^ 2) q ≤ n (exp ε + δ). This combines the attack of [DworkRoth2014, Theorem 8.2] with DifferentiallyPrivate.mul_card_sub_mul_le (a standard derivation; see [DworkRoth2014, §8.1]).

theorem Cslib.Privacy.DifferentiallyPrivate.exists_forall_card_mul_one_sub_le_of_answersWithin {ι : Type u_1} {κ : Type u_2} [Fintype ι] [Fintype κ] {α η : ℝ} (hη : 0 < η) (hm : 3 * Real.log 3 * ↑(Fintype.card ι) < η * ↑(Fintype.card κ)) :
∃ (A : κ → ι → Bool), ∀ {R : Type u_4} (M : (ι → Bool) → PMF R) (ε : ℝ) (δ : ENNReal) (ans : R → κ → ℝ), DifferentiallyPrivate HammingAdjacent M ε δ → δ ≠ ⊤ → (∀ (d : ι → Bool), (M d).toOuterMeasure {o : R | AnswersWithin A (ans o) d α η} = 1) → ↑(Fintype.card ι) * (1 - δ.toReal) ≤ ((↑⌊α⌋₊ + 1) / η) ^ 2 * (1 + Real.exp ε)

Linearly many ±1 queries defeat private accuracy. If 3 ln 3 · n < η m, there are m ±1 queries on databases of n rows with the following property. Every (ε, δ)-private mechanism for Hamming adjacency whose answers are within α on at least a 1 / 2 + η fraction of the queries, with probability one on every database, satisfies n (1 - δ) ≤ ((⌊α⌋₊ + 1) / η) ^ 2 (1 + exp ε). So ⌊α⌋₊ + 1 ≥ η √(n (1 - δ) / (1 + exp ε)), and error o(√n) is impossible. This is a standard derivation from [DworkRoth2014, Theorem 8.2] (see [DworkRoth2014, §8.1]).

The constant for small α #

theorem Cslib.Privacy.exists_answersWithin_answersWithin_hammingDist_eq_two {ι : Type u_1} {κ : Type u_2} [Fintype ι] [Fintype κ] {i₁ i₂ : ι} (hi : i₁ ≠ i₂) (A : κ → ι → Bool) (hm : 10 ≤ Fintype.card κ) :
∃ (y : κ → ℝ) (c : ι → Bool) (d : ι → Bool), AnswersWithin A y c 0 (1 / 5) ∧ AnswersWithin A y d 0 (1 / 5) ∧ hammingDist c d = 2

The constant (2 α / η) ^ 2 of [DworkRoth2014, Theorem 8.2] fails at α = 0. Whatever the m ≥ 10 queries on at least two rows, there are answers y and two databases at Hamming distance 2 that both answer at least a 1 / 2 + 1 / 5 fraction of the queries exactly. So no attack reconstructs to within (2 · 0 / η) ^ 2 = 0 positions at η = 1 / 5, for any number of queries. An additive term as in ((⌊α⌋₊ + 1) / η) ^ 2 is needed; see exists_answersWithin_lt_hammingDist for all α with 2 α < η ≤ 1 / 5.

theorem Cslib.Privacy.exists_answersWithin_lt_hammingDist {ι : Type u_1} {κ : Type u_2} [Fintype ι] [Fintype κ] {i₁ i₂ : ι} (hi : i₁ ≠ i₂) (A : κ → ι → Bool) (hm : 10 ≤ Fintype.card κ) {α η : ℝ} (hα : 0 ≤ α) (hη : 0 < η) (hη5 : η ≤ 1 / 5) (hαη : 2 * α < η) (attack : (κ → ℝ) → ι → Bool) :
∃ (d : ι → Bool) (y : κ → ℝ), AnswersWithin A y d α η ∧ (2 * α / η) ^ 2 < ↑(hammingDist (attack y) d)

[DworkRoth2014, Theorem 8.2] fails for small α. Let 0 ≤ α, 0 < η ≤ 1 / 5 and 2 α < η, so that Dwork and Roth's (2 α / η) ^ 2 is below 1. Whatever the m ≥ 10 queries on at least two rows and whatever the attack, some database d has answers within α on a 1 / 2 + η fraction of the queries from which the attack errs in at least one position, more than (2 α / η) ^ 2.