Documentation

CslibFrontier.Computability.Circuit.Frontier.NOFFormula

Read-r and fan-in-two formula compilation to multiparty NOF protocols #

Every fan-in-two Boolean formula F : Formula σ n in which each variable appears at most r times (Formula.ReadAtMost r) compiles to a low-depth deterministic (r + 1)-party number-on-forehead (NOF.Protocol) protocol on balanced disjoint blocks of variables, yielding Ω(n log n) leaf-size lower bounds for general fan-in-two Boolean formulas from balanced multiparty NOF discrepancy (Cslib.Communication.NOF.discrepancy) as well as unconditionally via Hoeffding's inequality.

The development combines four ingredients:

  1. Exact Hall balance theorem (exists_nof_partition_of_bag_card_le, exists_disjoint_blocks_avoiding_bags). Given r + 1 bags W_0, …, W_r ⊆ Fin n such that every variable i lies in at most r bags and each bag has size at most (r * n) / (r + 1), Hall's marriage theorem assigns every variable i to a player owner i with i ∉ W_{owner i} and guarantees every player at least n / (r * (r + 1)) variables (tight for every r ≥ 1).

  2. Bottom-up binary-tree chopping and greedy bag packing (exists_nof_protocol_of_readAtMost, exists_nof_protocol_of_formula). Chopping deepest subtrees exceeding leaf budget B ≥ 1 decomposes F into d ≤ F.leafSize / (B + 1) subtrees of leaf weight in [B + 1, 2 B] plus a residual root of weight ≤ 2 B, communicating ≤ F.leafSize / (B + 1) + 1 bits. Greedily assigning each piece to the lightest of r + 1 bags keeps every bag below (F.leafSize + 2 r B) / (r + 1).

  3. General fan-in-two Boolean formulas and balanced NOF discrepancy (exists_nof_protocol_of_formula, one_le_two_pow_mul_nof_discrepancy_of_formula, two_mul_le_two_pow_mul_nof_discrepancy_of_formula, mul_log_le_leafSize_of_balanced_discrepancy). For an arbitrary fan-in-two formula F over any signature σ and Boolean interpretation I, setting r = 4 * F.leafSize / n + 1 leaves at least (3 n + 1) / 4 inputs read at most r times, while chopping at B = n / 8 compiles F to an (r + 1)-party NOF protocol of ≤ 2 r + 1 (O(r)) bits on pairwise disjoint blocks of size n / (4 r). Conditionally on the Babai–Nisan–Szegedy cube discrepancy bound across the balanced regime 1 ≤ r, 4 r + 6 ≤ log₂ n (q = n / (4 r)), this forces n * (Nat.log 2 n - 12) ≤ 16 * F.leafSize.

  4. Probabilistic existence and unconditional Ω(n log n) formula lower bound (exists_balanced_nof_discrepancy, exists_function_mul_log_le_leafSize). Applying Hoeffding's inequality (Cslib.BitString.card_filter_le_abs_sum_mul_signVal_le) and a union bound over all balanced block tuples and cylinder intersections establishes that for every n, a Boolean function f : (Fin n → Bool) → Bool satisfies the balanced BNS cube discrepancy bound and therefore requires n * (Nat.log 2 n - 12) ≤ 16 * F.leafSize for every fan-in-two Boolean formula over any signature σ.

Main definitions #

Main results #

The exact n / (r * (r + 1)) Hall balance theorem, the greedy (r + 1)-bag subtree-chopping compiler for arbitrary fan-in-two Boolean formulas, and the balanced NOF cube discrepancy reduction and Hoeffding existence bound over arbitrary basis signatures are original to this library, building on multiparty NOF discrepancy [CFL83], [BNS92], [Juk12], Hoeffding's inequality [Hoe63], and classical formula lower bounds [Khr71a].

References #

def Cslib.Circuits.Formula.ReadAtMost {σ : Signature} {n : ℕ} (r : ℕ) (F : Formula σ n) :

Every input variable i : Fin n appears at most r times among the leaves of F.

A read-r formula on n variables has at most r * n leaves.

Part 1: Exact Hall balance theorem for (r + 1)-party NOF partitions #

theorem Cslib.Circuits.Frontier.exists_disjoint_blocks_avoiding_bags {n r cap q : ℕ} (L : Finset (Fin n)) (bags : Fin (r + 1) → Finset (Fin n)) (hread : ∀ i ∈ L, {j : Fin (r + 1) | i ∈ bags j}.card ≤ r) (hcap : ∀ (j : Fin (r + 1)), (L ∩ bags j).card ≤ cap) (hq_tot : (r + 1) * q ≤ L.card) (hq_cap : cap + r * q ≤ L.card) :
∃ (X : Fin (r + 1) → Finset (Fin n)), (Pairwise fun (j₁ j₂ : Fin (r + 1)) => Disjoint (X j₁) (X j₂)) ∧ ∀ (j : Fin (r + 1)), X j ⊆ L ∧ (X j).card = q ∧ Disjoint (X j) (bags j)

Subset-restricted Hall balance. Given a pool L : Finset (Fin n) of candidate inputs and r + 1 bags bags : Fin (r + 1) → Finset (Fin n) such that every i ∈ L belongs to at most r bags and each bag contains at most cap elements of L, whenever (r + 1) * q ≤ L.card and cap + r * q ≤ L.card there exist r + 1 pairwise disjoint blocks X j ⊆ L of exact size q with Disjoint (X j) (bags j) for every player j.

theorem Cslib.Circuits.Frontier.exists_nof_partition_of_bag_card_le {n r : ℕ} (hr : 1 ≤ r) (bags : Fin (r + 1) → Finset (Fin n)) (hread : ∀ (i : Fin n), {j : Fin (r + 1) | i ∈ bags j}.card ≤ r) (hcap : ∀ (j : Fin (r + 1)), (bags j).card ≤ r * n / (r + 1)) :
∃ (owner : Fin n → Fin (r + 1)), (∀ (i : Fin n), i ∉ bags (owner i)) ∧ ∀ (j : Fin (r + 1)), n / (r * (r + 1)) ≤ {i : Fin n | owner i = j}.card

Exact Hall balance theorem for (r + 1)-party NOF partitions (min_j |X_j| ≥ n / (r(r+1))). Given 1 ≤ r and r + 1 bags bags : Fin (r + 1) → Finset (Fin n) such that every variable i belongs to at most r bags and each bag has size at most (r * n) / (r + 1), there exists a total assignment owner : Fin n → Fin (r + 1) such that every variable avoids its owner's bag (i ∉ bags (owner i)) and every player owns at least n / (r * (r + 1)) variables.

Part 2: Embedding multiparty block inputs and player views #

noncomputable def Cslib.Circuits.Frontier.embedBlocks {k n : ℕ} {U : Type u_1} (X : Fin k → Finset (Fin n)) (z : Fin n → U) (y : (j : Fin k) → ↥(X j) → U) (i : Fin n) :
U

Embed multiparty block inputs y : ∀ j : Fin k, X j → U into Fin n → U, filling coordinates outside ⋃ j, X j from the background assignment z (selecting the block index via Classical.choose; for pairwise disjoint X, use embedBlocks_of_mem and embedBlocks_of_notMem).

theorem Cslib.Circuits.Frontier.embedBlocks_of_mem {k n : ℕ} {U : Type u_1} {X : Fin k → Finset (Fin n)} (hdisj : Pairwise fun (j₁ j₂ : Fin k) => Disjoint (X j₁) (X j₂)) (z : Fin n → U) (y : (j : Fin k) → ↥(X j) → U) {j : Fin k} {i : Fin n} (hi : i ∈ X j) :
embedBlocks X z y i = y j ⟨i, hi⟩

On i ∈ X j (for pairwise disjoint X), embedBlocks X z y i reads player j's input.

theorem Cslib.Circuits.Frontier.embedBlocks_of_notMem {k n : ℕ} {U : Type u_1} {X : Fin k → Finset (Fin n)} (z : Fin n → U) (y : (j : Fin k) → ↥(X j) → U) {i : Fin n} (hnot : ∀ (j : Fin k), i ∉ X j) :
embedBlocks X z y i = z i

Outside ⋃ j, X j, embedBlocks X z y i equals the background assignment z i.

Part 3: Bottom-up binary formula chopping and greedy bag compilation #

theorem Cslib.Circuits.Frontier.exists_nof_protocol_on_subset {σ : Signature} {n r B q : ℕ} (hB : 1 ≤ B) (I : Interpretation σ Bool) (F : Formula σ n) (hfan : Formula.FanInAtMost 2 F) (L : Finset (Fin n)) (hread : ∀ i ∈ L, Formula.leafSizeIn {i} F ≤ r) (hq_tot : (r + 1) * q ≤ L.card) (hq_cap : (F.leafSize + 2 * r * B) / (r + 1) + r * q ≤ L.card) :
∃ (X : Fin (r + 1) → Finset (Fin n)), (Pairwise fun (j₁ j₂ : Fin (r + 1)) => Disjoint (X j₁) (X j₂)) ∧ (∀ (j : Fin (r + 1)), X j ⊆ L ∧ (X j).card = q) ∧ ∀ (z : Fin n → Bool), ∃ (p : Communication.NOF.Protocol (fun (j : Fin (r + 1)) => ↥(X j) → Bool) Bool), (∀ (y : (i : Fin (r + 1)) → ↥(X i) → Bool), p.run y = F.eval I (embedBlocks X z y)) ∧ p.depth ≤ F.leafSize / (B + 1) + 1

Core compilation lemma on a light-variable subset L : Finset (Fin n): given F.FanInAtMost 2, every i ∈ L read at most r times, chopping budget 1 ≤ B, and block size q satisfying (r + 1) * q ≤ L.card and (F.leafSize + 2 * r * B) / (r + 1) + r * q ≤ L.card, F compiles to a deterministic (r + 1)-party NOF.Protocol of depth ≤ F.leafSize / (B + 1) + 1.

Part 4: Read-r formula compilation, general O(r)-bit formula compilation, and #

Ω(n log n) discrepancy lower bounds

theorem Cslib.Circuits.Frontier.exists_nof_protocol_of_readAtMost {σ : Signature} {n r : ℕ} (hr : 1 ≤ r) (hn : 4 * r ≤ n) (I : Interpretation σ Bool) (F : Formula σ n) (hfan : Formula.FanInAtMost 2 F) (hread : Formula.ReadAtMost r F) :
∃ (X : Fin (r + 1) → Finset (Fin n)), (Pairwise fun (j₁ j₂ : Fin (r + 1)) => Disjoint (X j₁) (X j₂)) ∧ (∀ (j : Fin (r + 1)), (X j).card = n / (2 * r * (r + 1))) ∧ ∀ (z : Fin n → Bool), ∃ (p : Communication.NOF.Protocol (fun (j : Fin (r + 1)) => ↥(X j) → Bool) Bool), (∀ (y : (i : Fin (r + 1)) → ↥(X i) → Bool), p.run y = F.eval I (embedBlocks X z y)) ∧ p.depth ≤ F.leafSize / (n / (4 * r) + 1) + 1 ∧ p.depth ≤ 4 * r ^ 2 + 1

Read-r formula to (r + 1)-party NOF protocol. Every fan-in-two, read-r formula F on n variables (1 ≤ r, 4 * r ≤ n) compiles on pairwise disjoint blocks of size n / (2 * r * (r + 1)) to a deterministic (r + 1)-party NOF.Protocol of depth at most F.leafSize / (n / (4 * r) + 1) + 1 ≤ 4 * r ^ 2 + 1 (O(r) bits when F.leafSize = O(n), and O(1) bits for fixed r).

theorem Cslib.Circuits.Frontier.exists_nof_protocol_of_formula {σ : Signature} {n : ℕ} (hn8 : 8 ≤ n) (I : Interpretation σ Bool) (F : Formula σ n) (hfan : Formula.FanInAtMost 2 F) :
have r := 4 * F.leafSize / n + 1; ∃ (X : Fin (r + 1) → Finset (Fin n)), (Pairwise fun (j₁ j₂ : Fin (r + 1)) => Disjoint (X j₁) (X j₂)) ∧ (∀ (j : Fin (r + 1)), (X j).card = n / (4 * r)) ∧ ∀ (z : Fin n → Bool), ∃ (p : Communication.NOF.Protocol (fun (j : Fin (r + 1)) => ↥(X j) → Bool) Bool), (∀ (y : (i : Fin (r + 1)) → ↥(X i) → Bool), p.run y = F.eval I (embedBlocks X z y)) ∧ p.depth ≤ 2 * r + 1

General fan-in-two formula compilation to an O(r)-bit (r + 1)-party NOF protocol. For any fan-in-two formula F : Formula σ n (8 ≤ n, no read bound assumed), setting r = 4 * F.leafSize / n + 1, there exist r + 1 pairwise disjoint blocks X j each of size n / (4 * r) such that for every background assignment z : Fin n → Bool, F compiles to a deterministic (r + 1)-party NOF.Protocol of depth at most 2 * r + 1.

theorem Cslib.Circuits.Frontier.one_le_two_pow_mul_nof_discrepancy_of_formula {σ : Signature} {n : ℕ} (hn8 : 8 ≤ n) (I : Interpretation σ Bool) {F : Formula σ n} (hfan : Formula.FanInAtMost 2 F) {f : (Fin n → Bool) → Bool} (hcomp : F.Computes I f) :
have r := 4 * F.leafSize / n + 1; ∃ (X : Fin (r + 1) → Finset (Fin n)), (Pairwise fun (j₁ j₂ : Fin (r + 1)) => Disjoint (X j₁) (X j₂)) ∧ (∀ (j : Fin (r + 1)), (X j).card = n / (4 * r)) ∧ ∀ (z : Fin n → Bool), 1 ≤ 2 ^ (2 * r + 1) * Communication.NOF.discrepancy (Probability.PMF.uniformOfFintype ((j : Fin (r + 1)) → ↥(X j) → Bool)) fun (y : (i : Fin (r + 1)) → ↥(X i) → Bool) => f (embedBlocks X z y)

Exact formula discrepancy bound wired directly into Cslib.Communication.NOF.discrepancy: for any fan-in-two formula F computing f (8 ≤ n, r = 4 * F.leafSize / n + 1), some (r + 1)-tuple of pairwise disjoint blocks X j of size n / (4 * r) satisfies 1 ≤ 2 ^ (2 * r + 1) * NOF.discrepancy uniform (fun y => f (embedBlocks X z y)) for every z.

theorem Cslib.Circuits.Frontier.two_mul_le_two_pow_mul_nof_discrepancy_of_formula {σ : Signature} {n : ℕ} (hn8 : 8 ≤ n) (I : Interpretation σ Bool) {F : Formula σ n} (hfan : Formula.FanInAtMost 2 F) {f : (Fin n → Bool) → Bool} {γ : ℝ} (hcorr : 2 * γ * 2 ^ n ≤ |∑ x : Fin n → Bool, BitString.signVal (f x) * BitString.signVal (F.eval I x)|) :
have r := 4 * F.leafSize / n + 1; ∃ (X : Fin (r + 1) → Finset (Fin n)) (z : Fin n → Bool), (Pairwise fun (j₁ j₂ : Fin (r + 1)) => Disjoint (X j₁) (X j₂)) ∧ (∀ (j : Fin (r + 1)), (X j).card = n / (4 * r)) ∧ 2 * γ ≤ 2 ^ (2 * r + 1) * Communication.NOF.discrepancy (Probability.PMF.uniformOfFintype ((j : Fin (r + 1)) → ↥(X j) → Bool)) fun (y : (i : Fin (r + 1)) → ↥(X i) → Bool) => f (embedBlocks X z y)

Distributional / average-case formula discrepancy bound wired directly into Cslib.Communication.NOF.discrepancy: if a fan-in-two formula F (8 ≤ n, r = 4 * F.leafSize / n + 1) has signed correlation at least 2 * γ with f under the uniform distribution on Fin n → Bool, then there exist pairwise disjoint blocks X j of size n / (4 * r) and a background fixing z : Fin n → Bool such that 2 * γ ≤ 2 ^ (2 * r + 1) * NOF.discrepancy uniform (fun y => f (embedBlocks X z y)).

theorem Cslib.Circuits.Frontier.mul_log_le_leafSize_of_balanced_discrepancy {σ : Signature} {n : ℕ} (I : Interpretation σ Bool) {F : Formula σ n} (hfan : Formula.FanInAtMost 2 F) {f : (Fin n → Bool) → Bool} (hcomp : F.Computes I f) (hdisc : ∀ (r : ℕ), 1 ≤ r → 4 * r + 6 ≤ Nat.log 2 n → ∀ (X : Fin (r + 1) → Finset (Fin n)), (Pairwise fun (j₁ j₂ : Fin (r + 1)) => Disjoint (X j₁) (X j₂)) → (∀ (j : Fin (r + 1)), (X j).card = n / (4 * r)) → (Communication.NOF.discrepancy (Probability.PMF.uniformOfFintype ((j : Fin (r + 1)) → ↥(X j) → Bool)) fun (y : (i : Fin (r + 1)) → ↥(X i) → Bool) => f (embedBlocks X (fun (x : Fin n) => false) y)) ^ 2 ^ (r + 1) ≤ (1 - 2 / 2 ^ (r + 1)) ^ (n / (4 * r))) :
n * (Nat.log 2 n - 12) ≤ 16 * F.leafSize

Conditional Ω(n log n) formula leaf-size lower bound from balanced NOF cube discrepancy. Let f : (Fin n → Bool) → Bool satisfy the Babai–Nisan–Szegedy cube discrepancy bound disc(f|_{X, false}) ^ (2 ^ (r + 1)) ≤ (1 - 2 / 2 ^ (r + 1)) ^ (n / (4 * r)) across the balanced regime 1 ≤ r, 4 * r + 6 ≤ Nat.log 2 n on pairwise disjoint variable blocks X of size n / (4 * r). Then every fan-in-two Boolean formula F : Formula σ n over any signature σ and interpretation I computing f satisfies n * (Nat.log 2 n - 12) ≤ 16 * F.leafSize.

Part 5: Probabilistic existence of balanced NOF-hard Boolean functions via Hoeffding #

theorem Cslib.Circuits.Frontier.exists_balanced_nof_discrepancy (n : ℕ) :
∃ (f : (Fin n → Bool) → Bool), ∀ (r : ℕ), 1 ≤ r → 4 * r + 6 ≤ Nat.log 2 n → ∀ (X : Fin (r + 1) → Finset (Fin n)), (Pairwise fun (j₁ j₂ : Fin (r + 1)) => Disjoint (X j₁) (X j₂)) → (∀ (j : Fin (r + 1)), (X j).card = n / (4 * r)) → (Communication.NOF.discrepancy (Probability.PMF.uniformOfFintype ((j : Fin (r + 1)) → ↥(X j) → Bool)) fun (y : (i : Fin (r + 1)) → ↥(X i) → Bool) => f (embedBlocks X (fun (x : Fin n) => false) y)) ^ 2 ^ (r + 1) ≤ (1 - 2 / 2 ^ (r + 1)) ^ (n / (4 * r))

Probabilistic existence of Boolean functions with exponentially small balanced NOF discrepancy. By Hoeffding's inequality (Cslib.BitString.card_filter_le_abs_sum_mul_signVal_le) and a union bound over balanced block tuples X : Fin (r + 1) → Finset (Fin n) and (r + 1)-party cylinder tests φ, for every n : ℕ there exists f : (Fin n → Bool) → Bool satisfying the Babai–Nisan–Szegedy cube discrepancy bound across the balanced regime 1 ≤ r, 4 * r + 6 ≤ Nat.log 2 n.

theorem Cslib.Circuits.Frontier.exists_function_mul_log_le_leafSize (n : ℕ) :
∃ (f : (Fin n → Bool) → Bool), ∀ {σ : Signature} (I : Interpretation σ Bool) {F : Formula σ n}, Formula.FanInAtMost 2 F → F.Computes I f → n * (Nat.log 2 n - 12) ≤ 16 * F.leafSize

Unconditional Ω(n log n) fan-in-two Boolean formula leaf-size lower bound. For every n : ℕ, there exists f : (Fin n → Bool) → Bool such that every fan-in-two Boolean formula F : Formula σ n over any signature σ and interpretation I computing f satisfies n * (Nat.log 2 n - 12) ≤ 16 * F.leafSize.