Documentation

CslibFrontier.Computability.Circuit.Boolean.WeightedThreshold.RandomRestriction

Random restriction lemmas for linear threshold functions #

This module formalizes the repaired Kane–Williams gate and wire random restriction lemmas for linear threshold functions ([KW16], arXiv:1511.07860v1, Lemma 1.1 and Lemma 3.1; Milestone 3 of #2347).

Given a linear threshold function ltfEval a θ w = decide (θ ≤ ∑ i, a i * (w i).toNat) on ι → Bool with nonzero weight support S = ltfSupport a and a live set B : Finset ι:

References #

Partial-assignment completions and forcing predicates #

def Cslib.Circuits.Boolean.WeightedThreshold.restrictUpdate {ι : Type u_1} [DecidableEq ι] (B : Finset ι) (w u : ι → Bool) :
ι → Bool

Replace the coordinates of w inside the live set B with u, keeping w outside B.

@[simp]
theorem Cslib.Circuits.Boolean.WeightedThreshold.restrictUpdate_of_mem {ι : Type u_1} [DecidableEq ι] {B : Finset ι} (w u : ι → Bool) {i : ι} (hi : i ∈ B) :
restrictUpdate B w u i = u i
@[simp]
theorem Cslib.Circuits.Boolean.WeightedThreshold.restrictUpdate_of_notMem {ι : Type u_1} [DecidableEq ι] {B : Finset ι} (w u : ι → Bool) {i : ι} (hi : i ∉ B) :
restrictUpdate B w u i = w i
def Cslib.Circuits.Boolean.WeightedThreshold.ForcedToConst {ι : Type u_1} [DecidableEq ι] (f : (ι → Bool) → Bool) (B : Finset ι) (w : ι → Bool) :

A Boolean function f : (ι → Bool) → Bool is forced to a constant outside B by w if all completions restrictUpdate B w u take the same Boolean value c.

Instances For
    def Cslib.Circuits.Boolean.WeightedThreshold.ForcedToAtMostOne {ι : Type u_1} [DecidableEq ι] (f : (ι → Bool) → Bool) (B : Finset ι) (w : ι → Bool) :

    A Boolean function f : (ι → Bool) → Bool is forced to a function of at most one input outside B by w if it is forced to a constant or depends on at most one coordinate i₀ ∈ B.

    Instances For
      @[instance_reducible]
      noncomputable instance Cslib.Circuits.Boolean.WeightedThreshold.instDecidableForcedToConst {ι : Type u_1} [DecidableEq ι] (f : (ι → Bool) → Bool) (B : Finset ι) (w : ι → Bool) :
      @[instance_reducible]
      noncomputable instance Cslib.Circuits.Boolean.WeightedThreshold.instDecidableForcedToAtMostOne {ι : Type u_1} [DecidableEq ι] (f : (ι → Bool) → Bool) (B : Finset ι) (w : ι → Bool) :
      theorem Cslib.Circuits.Boolean.WeightedThreshold.ForcedToConst.forcedToAtMostOne {ι : Type u_1} [DecidableEq ι] {f : (ι → Bool) → Bool} {B : Finset ι} {w : ι → Bool} (h : ForcedToConst f B w) :

      Being forced to a constant implies being forced to a function of at most one input.

      theorem Cslib.Circuits.Boolean.WeightedThreshold.forcedToAtMostOne_iff_const_or_literal {ι : Type u_1} [DecidableEq ι] (f : (ι → Bool) → Bool) (B : Finset ι) (w : ι → Bool) :
      ForcedToAtMostOne f B w ↔ ForcedToConst f B w ∨ ∃ i₀ ∈ B, (∀ (u : ι → Bool), f (restrictUpdate B w u) = u i₀) ∨ ∀ (u : ι → Bool), f (restrictUpdate B w u) = !u i₀

      A restricted Boolean function depends on at most one coordinate in B if and only if it is constant or equals a literal u i₀ or !(u i₀) for some i₀ ∈ B.

      Extremal completions and forcing characterizations for linear threshold functions #

      noncomputable def Cslib.Circuits.Boolean.WeightedThreshold.ltfMinAssign {ι : Type u_1} [DecidableEq ι] (a : ι → ℝ) (B : Finset ι) (w : ι → Bool) :
      ι → Bool

      Completion on B minimizing ∑ i, a i * (u i).toNat by setting u i = decide (a i < 0).

      noncomputable def Cslib.Circuits.Boolean.WeightedThreshold.ltfMaxAssign {ι : Type u_1} [DecidableEq ι] (a : ι → ℝ) (B : Finset ι) (w : ι → Bool) :
      ι → Bool

      Completion on B maximizing ∑ i, a i * (u i).toNat by setting u i = decide (0 ≤ a i).

      theorem Cslib.Circuits.Boolean.WeightedThreshold.sum_ltfMinAssign_le_and_le_sum_ltfMaxAssign {ι : Type u_1} [Fintype ι] [DecidableEq ι] (a : ι → ℝ) (B : Finset ι) (w u : ι → Bool) :
      ∑ i : ι, a i * ↑(ltfMinAssign a B w i).toNat ≤ ∑ i : ι, a i * ↑(restrictUpdate B w u i).toNat ∧ ∑ i : ι, a i * ↑(restrictUpdate B w u i).toNat ≤ ∑ i : ι, a i * ↑(ltfMaxAssign a B w i).toNat

      On any completion restrictUpdate B w u, the linear form is bounded below by ltfMinAssign and above by ltfMaxAssign.

      theorem Cslib.Circuits.Boolean.WeightedThreshold.sum_ltfMaxAssign_eq_sum_ltfMinAssign_add {ι : Type u_1} [Fintype ι] [DecidableEq ι] (a : ι → ℝ) (B : Finset ι) (w : ι → Bool) :
      ∑ i : ι, a i * ↑(ltfMaxAssign a B w i).toNat = ∑ i : ι, a i * ↑(ltfMinAssign a B w i).toNat + ∑ i ∈ B ∩ ltfSupport a, |a i|

      The maximum completion sum minus the minimum completion sum on B equals ∑ i ∈ B ∩ ltfSupport a, |a i|.

      theorem Cslib.Circuits.Boolean.WeightedThreshold.not_forcedToConst_ltfEval_iff {ι : Type u_1} [Fintype ι] [DecidableEq ι] (a : ι → ℝ) (θ : ℝ) (B : Finset ι) (w : ι → Bool) :
      ¬ForcedToConst (ltfEval a θ) B w ↔ θ - ∑ i ∈ B ∩ ltfSupport a, |a i| ≤ ∑ i : ι, a i * ↑(ltfMinAssign a B w i).toNat ∧ ∑ i : ι, a i * ↑(ltfMinAssign a B w i).toNat < θ

      ltfEval a θ is not forced to a constant outside B at w if and only if its minimum completion sum on B lies in the half-open interval [θ - ∑ i ∈ B ∩ ltfSupport a, |a i|, θ).

      theorem Cslib.Circuits.Boolean.WeightedThreshold.forcedToAtMostOne_ltfEval_of_card_inter_le_one {ι : Type u_1} [Fintype ι] [DecidableEq ι] (a : ι → ℝ) (θ : ℝ) (B : Finset ι) (hcard : (B ∩ ltfSupport a).card ≤ 1) (w : ι → Bool) :

      If B contains at most one coordinate of ltfSupport a, then ltfEval a θ is forced to a function of at most one input outside B at every w.

      theorem Cslib.Circuits.Boolean.WeightedThreshold.not_forcedToAtMostOne_ltfEval_imp {ι : Type u_1} [Fintype ι] [DecidableEq ι] {a : ι → ℝ} {θ : ℝ} {B : Finset ι} {w : ι → Bool} (h : ¬ForcedToAtMostOne (ltfEval a θ) B w) :
      2 ≤ (B ∩ ltfSupport a).card ∧ ¬ForcedToConst (ltfEval a θ) B w

      If ltfEval a θ is not forced to a function of at most one input outside B at w, then 2 ≤ #(B ∩ ltfSupport a) and ltfEval a θ is not forced to a constant outside B at w.

      Fixed-B LTF restriction bound (repaired Kane–Williams Equation RestrictToBEqn) #

      theorem Cslib.Circuits.Boolean.WeightedThreshold.card_not_forcedToConst_ltfEval_le {ι : Type u_1} [Fintype ι] [DecidableEq ι] (a : ι → ℝ) (θ : ℝ) (B : Finset ι) :
      ↑{w : ι → Bool | ¬ForcedToConst (ltfEval a θ) B w}.card ≤ 2 ^ Fintype.card ι * (2 * ∑ i ∈ B ∩ ltfSupport a, 1 / √↑(ltfWeightRank a i))

      Fixed-B LTF non-forcing bound (repaired Equation (RestrictToBEqn) of Kane–Williams, arXiv:1511.07860v1): for any linear threshold function ltfEval a θ and any live set B : Finset ι, (#{w : ι → Bool | ¬ ForcedToConst (ltfEval a θ) B w} : ℝ) ≤ (2 : ℝ) ^ Fintype.card ι * (2 * ∑ i ∈ B ∩ ltfSupport a, 1 / Real.sqrt (ltfWeightRank a i)).

      theorem Cslib.Circuits.Boolean.WeightedThreshold.card_not_forcedToAtMostOne_ltfEval_le {ι : Type u_1} [Fintype ι] [DecidableEq ι] (a : ι → ℝ) (θ : ℝ) (B : Finset ι) :
      ↑{w : ι → Bool | ¬ForcedToAtMostOne (ltfEval a θ) B w}.card ≤ if 2 ≤ (B ∩ ltfSupport a).card then 2 ^ Fintype.card ι * (2 * ∑ i ∈ B ∩ ltfSupport a, 1 / √↑(ltfWeightRank a i)) else 0

      Fixed-B LTF single-input non-forcing bound: if #(B ∩ ltfSupport a) < 2, no input fails ForcedToAtMostOne (ltfEval a θ) B; otherwise the non-forcing count satisfies the same bound as ForcedToConst.

      Kane–Williams Gate and Wire Random Restriction Lemmas (Lemma 1.1 and Lemma 3.1) #

      theorem Cslib.Circuits.Boolean.WeightedThreshold.sum_card_not_forcedToConst_ltfEval_le {Ω : Type u_1} {ι : Type u_2} [Fintype Ω] [Fintype ι] [DecidableEq ι] (a : ι → ℝ) (θ : ℝ) (B : Ω → Finset ι) {p : ℝ} (hp : ∀ i ∈ ltfSupport a, ↑{ω : Ω | i ∈ B ω}.card ≤ p * ↑(Fintype.card Ω)) :
      ∑ ω : Ω, ↑{w : ι → Bool | ¬ForcedToConst (ltfEval a θ) (B ω) w}.card ≤ ↑(Fintype.card Ω) * 2 ^ Fintype.card ι * (4 * p * √↑(ltfSupport a).card)

      Gate Random Restriction Lemma (Kane–Williams arXiv:1511.07860v1, Lemma 1.1): for any family of live sets B : Ω → Finset ι such that every active coordinate i ∈ ltfSupport a belongs to B ω for at most p * |Ω| choices of ω : Ω, the total number of pairs (ω, w) where ltfEval a θ is not forced to a constant outside B ω at w is at most |Ω| * 2 ^ |ι| * (4 * p * √(#(ltfSupport a))).

      theorem Cslib.Circuits.Boolean.WeightedThreshold.sum_card_not_forcedToAtMostOne_ltfEval_le {Ω : Type u_1} {ι : Type u_2} [Fintype Ω] [Fintype ι] [DecidableEq ι] (a : ι → ℝ) (θ : ℝ) (B : Ω → Finset ι) {p : ℝ} (hp0 : 0 ≤ p) (hp1 : ∀ i ∈ ltfSupport a, ↑{ω : Ω | i ∈ B ω}.card ≤ p * ↑(Fintype.card Ω)) (hp2 : ∀ i ∈ ltfSupport a, ∀ j ∈ (ltfSupport a).erase i, ↑{ω : Ω | i ∈ B ω ∧ j ∈ B ω}.card ≤ p ^ 2 * ↑(Fintype.card Ω)) :
      ∑ ω : Ω, ↑{w : ι → Bool | ¬ForcedToAtMostOne (ltfEval a θ) (B ω) w}.card ≤ ↑(Fintype.card Ω) * 2 ^ Fintype.card ι * (4 * ↑(ltfSupport a).card * p * √p)

      Wire Random Restriction Lemma (Kane–Williams arXiv:1511.07860v1, Lemma 3.1): for any family of live sets B : Ω → Finset ι with 0 ≤ p such that every active coordinate i ∈ ltfSupport a is live for at most p * |Ω| choices of ω : Ω and every distinct pair i, j ∈ ltfSupport a (j ≠ i) is jointly live for at most p ^ 2 * |Ω| choices of ω : Ω, the total number of pairs (ω, w) where ltfEval a θ is not forced to a function of at most one input outside B ω at w is at most |Ω| * 2 ^ |ι| * (4 * #(ltfSupport a) * p * √p).

      Block-partition random restriction corollaries #

      theorem Cslib.Circuits.Boolean.WeightedThreshold.sum_card_not_forcedToConst_blockLiveSet_le {κ : Type u_1} {τ : Type u_2} {ι : Type u_3} [Fintype κ] [DecidableEq κ] [Fintype τ] [Fintype ι] [DecidableEq ι] (blockVar : κ → τ → ι) (hinj : ∀ (j₁ : κ) (t₁ : τ) (j₂ : κ) (t₂ : τ), blockVar j₁ t₁ = blockVar j₂ t₂ → j₁ = j₂ ∧ t₁ = t₂) (a : ι → ℝ) (θ : ℝ) :
      ∑ σ : κ → τ, ↑{w : ι → Bool | ¬ForcedToConst (ltfEval a θ) (Combinatorics.LittlewoodOfford.blockLiveSet blockVar σ) w}.card ≤ ↑(Fintype.card (κ → τ)) * 2 ^ Fintype.card ι * (4 * (1 / ↑(Fintype.card τ)) * √↑(ltfSupport a).card)

      Block-partition Gate Random Restriction Lemma: when blockVar : κ → τ → ι is jointly injective across blocks and slots, averaging ¬ ForcedToConst (ltfEval a θ) (blockLiveSet blockVar σ) w over all choices of one live variable per block σ : κ → τ and w : ι → Bool gives at most |κ → τ| * 2 ^ |ι| * (4 * (1 / |τ|) * √(#(ltfSupport a))).

      theorem Cslib.Circuits.Boolean.WeightedThreshold.sum_card_not_forcedToAtMostOne_blockLiveSet_le {κ : Type u_1} {τ : Type u_2} {ι : Type u_3} [Fintype κ] [DecidableEq κ] [Fintype τ] [Fintype ι] [DecidableEq ι] (blockVar : κ → τ → ι) (hinj : ∀ (j₁ : κ) (t₁ : τ) (j₂ : κ) (t₂ : τ), blockVar j₁ t₁ = blockVar j₂ t₂ → j₁ = j₂ ∧ t₁ = t₂) (a : ι → ℝ) (θ : ℝ) :
      ∑ σ : κ → τ, ↑{w : ι → Bool | ¬ForcedToAtMostOne (ltfEval a θ) (Combinatorics.LittlewoodOfford.blockLiveSet blockVar σ) w}.card ≤ ↑(Fintype.card (κ → τ)) * 2 ^ Fintype.card ι * (4 * ↑(ltfSupport a).card * (1 / ↑(Fintype.card τ)) * √(1 / ↑(Fintype.card τ)))

      Block-partition Wire Random Restriction Lemma: when blockVar : κ → τ → ι is jointly injective across blocks and slots, averaging ¬ ForcedToAtMostOne (ltfEval a θ) (blockLiveSet blockVar σ) w over all σ : κ → τ and w : ι → Bool gives at most |κ → τ| * 2 ^ |ι| * (4 * #(ltfSupport a) * (1 / |τ|) * √(1 / |τ|)).