Documentation

CslibFrontier.Computability.Communication.NIH.Protocol

Multiparty Number-in-Hand Communication Protocols and Multi-Pass Streaming Simulation #

This module formalizes deterministic and public-coin K-player number-in-hand (NIH) communication protocols, the rectangle discrepancy method, Yao's minimax averaging principle, and the reduction from K-part p-pass streaming algorithms to K-player NIH protocols.

Main definitions #

Main results #

inductive Cslib.Communication.NIH.NIHProtocol {ι : Type u} (X : ι → Type v) (Z : Type w) :
Type (max u v w)

A deterministic multi-party number-in-hand (NIH) communication protocol tree for players indexed by ι, with private input types X i and output type Z. At each internal node, player i broadcasts one bit depending only on their own input x i.

def Cslib.Communication.NIH.NIHProtocol.run {ι : Type u} {X : ι → Type v} {Z : Type w} :
NIHProtocol X Z → ((i : ι) → X i) → Z

Execute an NIH protocol on input tuple x : ∀ i, X i.

def Cslib.Communication.NIH.NIHProtocol.depth {ι : Type u} {X : ι → Type v} {Z : Type w} :

Worst-case communication cost (tree depth, i.e. total bits broadcast).

@[simp]
theorem Cslib.Communication.NIH.NIHProtocol.run_output {ι : Type u} {X : ι → Type v} {Z : Type w} (z : Z) (x : (i : ι) → X i) :
(output z).run x = z
@[simp]
theorem Cslib.Communication.NIH.NIHProtocol.run_speak {ι : Type u} {X : ι → Type v} {Z : Type w} (i : ι) (send : X i → Bool) (p₀ p₁ : NIHProtocol X Z) (x : (j : ι) → X j) :
(speak i send p₀ p₁).run x = bif send (x i) then p₁.run x else p₀.run x
@[simp]
theorem Cslib.Communication.NIH.NIHProtocol.depth_output {ι : Type u} {X : ι → Type v} {Z : Type w} (z : Z) :
(output z).depth = 0
@[simp]
theorem Cslib.Communication.NIH.NIHProtocol.depth_speak {ι : Type u} {X : ι → Type v} {Z : Type w} (i : ι) (send : X i → Bool) (p₀ p₁ : NIHProtocol X Z) :
(speak i send p₀ p₁).depth = max p₀.depth p₁.depth + 1
def Cslib.Communication.NIH.NIHProtocol.sendBits {K : ℕ} {X : Fin K → Type u_1} {Z : Type u_2} (i : Fin K) (b : ℕ) :
(X i → BitString b) → (BitString b → NIHProtocol X Z) → NIHProtocol X Z

Player i broadcasts b bits computed from their private input x i.

theorem Cslib.Communication.NIH.NIHProtocol.run_sendBits {K : ℕ} {X : Fin K → Type u_1} {Z : Type u_2} (i : Fin K) (b : ℕ) (enc : X i → BitString b) (cont : BitString b → NIHProtocol X Z) (x : (j : Fin K) → X j) :
(sendBits i b enc cont).run x = (cont (enc (x i))).run x
theorem Cslib.Communication.NIH.NIHProtocol.depth_sendBits_le {K : ℕ} {X : Fin K → Type u_1} {Z : Type u_2} (i : Fin K) (b : ℕ) (enc : X i → BitString b) (cont : BitString b → NIHProtocol X Z) {d : ℕ} (hcont : ∀ (w : BitString b), (cont w).depth ≤ d) :
(sendBits i b enc cont).depth ≤ b + d
def Cslib.Communication.NIH.NIHProtocol.leaves {K : ℕ} {X : Fin K → Type u_1} [(i : Fin K) → Fintype (X i)] [(i : Fin K) → DecidableEq (X i)] :
NIHProtocol X Bool → ((i : Fin K) → Finset (X i)) → List (((i : Fin K) → Finset (X i)) × Bool)

Leaf rectangles and output bits of a deterministic NIHProtocol starting from rectangle R.

theorem Cslib.Communication.NIH.NIHProtocol.leaves_spec {K : ℕ} {X : Fin K → Type u_1} [(i : Fin K) → Fintype (X i)] [(i : Fin K) → DecidableEq (X i)] (prot : NIHProtocol X Bool) (R : (i : Fin K) → Finset (X i)) :
(∀ (x : (i : Fin K) → X i), (∀ (i : Fin K), x i ∈ R i) → ∃ p ∈ prot.leaves R, ∀ (i : Fin K), x i ∈ p.1 i) ∧ (∀ p ∈ prot.leaves R, ∀ (i : Fin K), p.1 i ⊆ R i) ∧ List.Pairwise (fun (p q : ((i : Fin K) → Finset (X i)) × Bool) => Disjoint (Fintype.piFinset p.1) (Fintype.piFinset q.1)) (prot.leaves R) ∧ ∀ p ∈ prot.leaves R, ∀ (x : (i : Fin K) → X i), (∀ (i : Fin K), x i ∈ p.1 i) → prot.run x = p.2
@[reducible, inline]
abbrev Cslib.Communication.NIH.RandNIHProtocol {K : ℕ} (X : Fin K → Type u_1) (Z : Type u_2) :
Type (max u_2 u_1)

A public-coin randomized K-player NIH protocol: a probability distribution over deterministic protocols.

def Cslib.Communication.NIH.RandNIHProtocol.CostLE {K : ℕ} {X : Fin K → Type u_1} {Z : Type u_2} (μ : RandNIHProtocol X Z) (c : ℕ) :

Every deterministic protocol in the support of μ has communication depth at most c.

theorem Cslib.Communication.NIH.RandNIHProtocol.costLE_iff {K : ℕ} {X : Fin K → Type u_1} {Z : Type u_2} {μ : RandNIHProtocol X Z} {c : ℕ} :
μ.CostLE c ↔ ∀ prot ∈ PMF.support μ, prot.depth ≤ c
noncomputable def Cslib.Communication.NIH.detAdv {K : ℕ} {X : Fin K → Type u_1} (D₁ D₀ : PMF ((i : Fin K) → X i)) (prot : NIHProtocol X Bool) :

Distributional distinguishing advantage of a deterministic NIH protocol.

noncomputable def Cslib.Communication.NIH.randAdv {K : ℕ} {X : Fin K → Type u_1} (D₁ D₀ : PMF ((i : Fin K) → X i)) (μ : RandNIHProtocol X Bool) :

Distributional distinguishing advantage of a public-coin randomized NIH protocol.

theorem Cslib.Communication.NIH.discrepancy_of_partition {α : Type u_1} (D₁ D₀ : PMF α) (f : α → Bool) (L : List (Finset α × Bool)) (hcov : ∀ (x : α), ∃ p ∈ L, x ∈ p.1) (hdisj : List.Pairwise (fun (p q : Finset α × Bool) => Disjoint p.1 q.1) L) (hconst : ∀ p ∈ L, ∀ x ∈ p.1, f x = p.2) :
|(D₁.toOuterMeasure {x : α | f x = true}).toReal - (D₀.toOuterMeasure {x : α | f x = true}).toReal| ≤ 1 / 2 * (List.map (fun (p : Finset α × Bool) => |(D₁.toOuterMeasure ↑p.1).toReal - (D₀.toOuterMeasure ↑p.1).toReal|) L).sum

Discrepancy inequality on any finite disjoint partition L on which f is constant.

theorem Cslib.Communication.NIH.discrepancy_method {K : ℕ} {X : Fin K → Type u_1} [(i : Fin K) → Fintype (X i)] [(i : Fin K) → DecidableEq (X i)] (D₁ D₀ : PMF ((i : Fin K) → X i)) (prot : NIHProtocol X Bool) :
detAdv D₁ D₀ prot ≤ 1 / 2 * (List.map (fun (p : ((i : Fin K) → Finset (X i)) × Bool) => |(D₁.toOuterMeasure ↑(Fintype.piFinset p.1)).toReal - (D₀.toOuterMeasure ↑(Fintype.piFinset p.1)).toReal|) (prot.leaves fun (x : Fin K) => Finset.univ)).sum

Rectangle discrepancy bound for any deterministic K-player NIH protocol.

theorem Cslib.Communication.NIH.exists_det_protocol_adv_ge {K : ℕ} {X : Fin K → Type u_1} (D₁ D₀ : PMF ((i : Fin K) → X i)) (μ : RandNIHProtocol X Bool) {c : ℕ} (hcost : μ.CostLE c) :
∃ (prot : NIHProtocol X Bool), prot.depth ≤ c ∧ randAdv D₁ D₀ μ ≤ detAdv D₁ D₀ prot

Yao averaging: every public-coin NIH protocol of cost at most c admits a deterministic protocol of depth at most c with at least as large distributional advantage.

Multi-Player Multi-Pass Streaming Simulation #

def Cslib.Communication.NIH.fullStream {K : ℕ} {X : Fin K → Type u_1} {α : Type u_2} (part : (i : Fin K) → X i → List α) (x : (i : Fin K) → X i) :
List α

Concatenation of K player stream chunks part i (x i).

noncomputable def Cslib.Communication.NIH.toNIHProtocol {σ : Type u_1} {α : Type u_2} {β : Type u_3} {K : ℕ} {X : Fin K → Type u_4} (A : Streaming.MultiPass σ α β) (p M b : ℕ) (enc : σ → BitString b) (hK : 0 < K) (part : (i : Fin K) → X i → List α) (dec : β → Bool) :

K-player NIH protocol simulating p passes of a b-bit streaming algorithm A over fullStream part x and applying decision function dec to the output.

theorem Cslib.Communication.NIH.depth_toNIHProtocol_le {σ : Type u_1} {α : Type u_2} {β : Type u_3} {K : ℕ} {X : Fin K → Type u_4} (A : Streaming.MultiPass σ α β) (p M b : ℕ) (enc : σ → BitString b) (hK : 0 < K) (part : (i : Fin K) → X i → List α) (dec : β → Bool) :
(toNIHProtocol A p M b enc hK part dec).depth ≤ (p * K - 1) * b + 1

The K-player simulation of p passes of a b-bit streaming algorithm has depth at most (p * K - 1) * b + 1.

theorem Cslib.Communication.NIH.run_toNIHProtocol {σ : Type u_1} {α : Type u_2} {β : Type u_3} {K : ℕ} {X : Fin K → Type u_4} (A : Streaming.MultiPass σ α β) {p M b : ℕ} (hp : 0 < p) {enc : σ → BitString b} (henc : Set.InjOn enc (A.reachable p M)) (hK : 0 < K) (part : (i : Fin K) → X i → List α) (dec : β → Bool) {x : (i : Fin K) → X i} (hm : (fullStream part x).length ≤ M) :
(toNIHProtocol A p M b enc hK part dec).run x = dec (A.run p (fullStream part x))

Exact correctness of toNIHProtocol: whenever enc is injective on A.reachable p M and fullStream part x has length at most M, the K-player simulation outputs dec (A.run p (fullStream part x)).