Documentation

CslibFrontier.Probability.CorrelatedSampling.Grid

Correlated sampling of grid distributions from a finite seed #

A grid distribution on a finite type α with denominator L gives every point a probability that is a multiple of 1 / L; it is described by its counts c x with ∑ x, c x = L (GridDist). Such a distribution is the projection of the uniform distribution on its set of cells {(x, u) : u < c x} in α × Fin L, a set of exactly L cells.

This module gives Holenstein's correlated sampling protocol for grid distributions with a finite shared seed: a uniformly random enumeration σ of α × Fin L. Each party outputs the point of the first of its own cells in the enumeration (gridSample), so it needs only the seed and its own distribution. Under the uniform seed the first element of a set of cells is uniform on that set (toOuterMeasure_first_mem), so each party samples exactly its own distribution (map_gridSample). The parties agree whenever the first cell of the union of their cell sets is common to both, so they disagree with probability at most 2 d_TV(P, Q) (gridSample_disagree_le).

The finite seed is what makes the protocol usable where randomness must be a PMF, as in Cslib.MachineLearning.Replicable.Algorithm. Holenstein's protocol for arbitrary distributions (Cslib.Probability.CorrelatedSampling.seedSample) needs a continuous seed.

Main definitions #

Main results #

References #

@[reducible, inline]

An enumeration of the finite type β, the shared seed of the protocol.

Instances For
    def Cslib.Probability.CorrelatedSampling.first {β : Type u_1} [Fintype β] [DecidableEq β] (σ : Enumeration β) (S : Finset β) (hS : S.Nonempty) :
    β

    The first element of the nonempty set S in the enumeration σ.

    theorem Cslib.Probability.CorrelatedSampling.first_eq_iff {β : Type u_1} [Fintype β] [DecidableEq β] (σ : Enumeration β) {S : Finset β} (hS : S.Nonempty) {b : β} :
    first σ S hS = b ↔ b ∈ S ∧ ∀ (i : Fin (Fintype.card β)), σ i ∈ S → (Equiv.symm σ) b ≤ i

    b is the first element of S in σ exactly when it lies in S and no element of S comes before it.

    theorem Cslib.Probability.CorrelatedSampling.first_mem {β : Type u_1} [Fintype β] [DecidableEq β] (σ : Enumeration β) {S : Finset β} (hS : S.Nonempty) :
    first σ S hS ∈ S
    theorem Cslib.Probability.CorrelatedSampling.first_trans {β : Type u_1} [Fintype β] [DecidableEq β] (σ : Enumeration β) {S : Finset β} (hS : S.Nonempty) (τ : Equiv.Perm β) (hτ : ∀ (b : β), τ b ∈ S ↔ b ∈ S) :
    first (Equiv.trans σ τ) S hS = τ (first σ S hS)

    Relabelling by a permutation τ that preserves S relabels the first element.

    theorem Cslib.Probability.CorrelatedSampling.first_of_subset {β : Type u_1} [Fintype β] [DecidableEq β] (σ : Enumeration β) {S T : Finset β} (hS : S.Nonempty) (hT : T.Nonempty) (hST : S ⊆ T) (h : first σ T hT ∈ S) :
    first σ S hS = first σ T hT

    If the first element of T lies in the subset S, it is also the first element of S.

    theorem Cslib.Probability.CorrelatedSampling.toOuterMeasure_first_mem {β : Type u_1} [Fintype β] [DecidableEq β] (S : Finset β) (hS : S.Nonempty) (R : Set β) [DecidablePred fun (x : β) => x ∈ R] :
    ((PMF.uniformOfFintype (Enumeration β)).toOuterMeasure {σ : Enumeration β | first σ S hS ∈ R}).toReal = ↑{x ∈ S | x ∈ R}.card / ↑S.card

    The first element is uniform. Under a uniformly random enumeration, the first element of S lies in R with probability #(S ∩ R) / #S.

    A grid distribution on α with denominator L: the point x has probability count x / L.

    • count : α → ℕ

      The number of cells of each point.

    • sum_count : ∑ x : α, self.count x = L
    noncomputable def Cslib.Probability.CorrelatedSampling.GridDist.toPMF {α : Type u_1} [Fintype α] {L : ℕ} [NeZero L] (P : GridDist α L) :
    PMF α

    The distribution of a grid distribution.

    theorem Cslib.Probability.CorrelatedSampling.GridDist.toPMF_apply {α : Type u_1} [Fintype α] {L : ℕ} [NeZero L] (P : GridDist α L) (x : α) :
    P.toPMF x = ↑(P.count x) / ↑L
    theorem Cslib.Probability.CorrelatedSampling.GridDist.toPMF_apply_toReal {α : Type u_1} [Fintype α] {L : ℕ} [NeZero L] (P : GridDist α L) (x : α) :
    (P.toPMF x).toReal = ↑(P.count x) / ↑L
    theorem Cslib.Probability.CorrelatedSampling.GridDist.count_le {α : Type u_1} [Fintype α] {L : ℕ} (P : GridDist α L) (x : α) :
    P.count x ≤ L
    def Cslib.Probability.CorrelatedSampling.gridSample {α : Type u_1} [Fintype α] [DecidableEq α] {L : ℕ} [NeZero L] (P : GridDist α L) (σ : Enumeration (α × Fin L)) :
    α

    The party's output for the grid distribution P from the shared enumeration σ: the point of the first cell of P in σ.

    Each party samples its own distribution.

    The parties disagree with probability at most 2 d_TV(P, Q).