Differential privacy (learning theory) #
This file introduces a small, reusable vocabulary for differential privacy (DP) in TorchLean’s learning-theory layer.
We isolate the core event-wise definition of differential privacy and the closure properties that show up when DP is connected to learning theory, stability, and verification pipelines.
We keep the definition general by parameterizing over:
- an adjacency relation
Adj : α → α → Prop(e.g. “datasets differ in one example”), and - a randomized mechanism
M : α → ProbabilityMeasure β.
Then $(\varepsilon,\delta)$-DP is the standard event-wise bound:
$$ \Pr[M(a)\in S]\leq e^\varepsilon\Pr[M(a')\in S]+\delta $$
for all adjacent $a\sim a'$ and measurable events $S$.
We phrase this in mathlib using ProbabilityMeasure and Measure:
M ais aProbabilityMeasure β, and(M a : Measure β) Sis the probability (as anENNReal) of the eventS.
This makes the definition work uniformly for discrete and continuous outputs, while keeping the measurability side-conditions explicit.
We also include a couple of basic structural lemmas that are easy to reuse downstream (and that are often needed to compose DP facts through a larger construction):
- monotonicity in
δand inε, and - post-processing (measurable mapping of outputs preserves DP).
Typical instantiations #
αis a dataset type,Adjmeans “replace/remove one example”.βis some model or statistic released to the outside world.Mis a randomized training procedure / query mechanism.
In this repository, the stability development (see NN.MLTheory.LearningTheory.Stability.Core) uses
datasets Tensor Z [n], with a Fin n → Z view, for a fixed sample size n. For DP, one can
define Adj in terms of replacing one coordinate.
References #
- Dwork, McSherry, Nissim & Smith (2006), “Calibrating Noise to Sensitivity in Private Data Analysis”.
- Dwork & Roth (2014), “The Algorithmic Foundations of Differential Privacy” (monograph).
- Post-processing is a standard closure property of DP; see, e.g., Dwork–Roth (2014).
Mechanisms #
A randomized mechanism from inputs α to outputs β.
We use ProbabilityMeasure β so probability mass is total ($\mu(\mathrm{univ})=1$) and so that
post-processing can be phrased using ProbabilityMeasure.map (pushforward along a measurable
function).
Instances For
Differential privacy #
$(\varepsilon,\delta)$-differential privacy with respect to an adjacency relation Adj.
This is the standard “event-wise” definition:
for all adjacent inputs $a\sim a'$ and all measurable events $S$,
$$ \Pr[M(a)\in S]\leq e^\varepsilon\Pr[M(a')\in S]+\delta. $$
We write probabilities as measures (M a : Measure β) S so the inequality lives in ENNReal.
The predicate imposes no symmetry on Adj, no nonnegativity condition on ε, and no upper bound
on δ; callers supply the adjacency and budget restrictions needed for their application.
Instances For
A common special case: $\delta=0$ (“pure DP”).
Instances For
$\delta$-monotonicity: if a mechanism is $(\varepsilon,\delta_1)$-DP and $\delta_1\leq\delta_2$, then it is also $(\varepsilon,\delta_2)$-DP.
This small lemma is useful when you:
- prove DP with a “clean” bound, then
- want to reuse it under a slightly looser $\delta$ (e.g. after taking a
sup, or adding a slack term).
$\varepsilon$-monotonicity: privacy at a smaller $\varepsilon$ implies privacy at a larger one.
Together with differentialPrivacy_mono_delta this says the predicate is monotone in the whole
budget $(\varepsilon,\delta)$. That is what lets a pipeline advertise one budget for a step that was
actually proved private at a tighter one, which happens constantly once several mechanisms are
composed and their budgets are rounded to a common value.
The mathematical content is only monotonicity of Real.exp together with monotonicity of
multiplication on ENNReal; we record it as a lemma so callers do not repeat that rewriting inline.
Post-processing #
Post-process a mechanism by applying a measurable function to its output.
In DP folklore: if M is DP, then so is f ∘ M for any (measurable) f that does not look at
the private input. This is called post-processing and is one of the core reasons DP composes
well with downstream pipelines.
Formally, postprocess M f is the pushforward measure (M a).map f for each input a.
Instances For
Post-processing theorem: measurable mappings of outputs preserve DP.
Proof idea (the standard one):
- the probability of an event
Sunder the mapped output is the probability of the preimagef ⁻¹' Sunder the original output; - apply DP for
Mto the measurable setf ⁻¹' S.