Documentation

CslibFrontier.Computability.Circuit.Boolean.WeightedThreshold.ThresholdCounting

Counting depth-two threshold functions and restricting depth-two threshold circuits #

This module formalizes the threshold-function counting bound and the depth-two circuit random-restriction collapse used in the Kane–Williams gate and wire lower bounds for depth-two weighted threshold circuits ([KW16], arXiv:1511.07860v1, Theorem 2.3 and Section 4):

  1. Chow moment injectivity and threshold counting (IsThresholdOver, featureMoment, eq_of_isThresholdOver_of_featureMoment_eq, card_isThresholdOver_le): Every threshold function f : X → Bool over g : ι → X → Bool is uniquely determined among all Boolean functions on X by #{x | f x} and fun j => #{x | f x ∧ g j x}, giving at most (|X| + 1) ^ (|ι| + 1) threshold functions over g.
  2. Counting LTFs and depth-two threshold functions (IsLTF, card_isLTF_le, IsDepthTwoWithGates, card_isDepthTwoWithGates_le): On κ → Bool, there are at most (2 ^ |κ| + 1) ^ (|κ| + 1) LTFs and at most (2 ^ |κ| + 1) ^ ((|κ| + 2) * q + |κ| + 1) functions in IsDepthTwoWithGates q. A fixed real function φ : X → ℝ has at most |X| + 1 upper level sets, at most |X| - 1 of them nonconstant (IsUpperLevelSet, card_isUpperLevelSet_le, card_isUpperLevelSet_nonconst_le); threshold shifts IsThresholdShift of a fixed weight vector are the case of a linear form (card_isThresholdShift_le, card_isThresholdShift_nonconst_le). The original fixed-weight refinement IsDepthTwoOverWeights counts threshold shifts from a fixed finite family W: card_isThresholdShift_le, card_isWeightShift_le, and card_isDepthTwoOverWeights_le; it is monotone in q and W (IsDepthTwoOverWeights.mono, IsDepthTwoOverWeights.mono_weights) and contains the constants (isDepthTwoOverWeights_const). Its per-survivor description costs O(|κ| + log (#W + 1)) bits. This refinement is not attributed to Kane–Williams.
  3. Depth-two circuit collapse under subcube restrictions (embedUpdate, sum_card_filter_embedUpdate, isDepthTwoWithGates_eval_embedUpdate, isDepthTwoWithGates_eval_embedUpdate_const, sum_card_filter_not_forcedToConst_blockLiveSet_le, sum_card_filter_not_forcedToAtMostOne_blockLiveSet_le, sum_circuitUnforcedConstCount_blockLiveSet_le, sum_circuitUnforcedAtMostOneCount_blockLiveSet_le): Under any restriction fixing all inputs outside univ.image emb (emb : κ → Fin n injective), every depth-1 gate satisfying ForcedToAtMostOne collapses to an affine-linear form on κ and is absorbed into the top threshold gate.

Chow moment injectivity and threshold counting over finite feature maps #

def Cslib.Circuits.Boolean.WeightedThreshold.IsThresholdOver {X : Type u_1} {ι : Type u_2} [Fintype ι] (g : ι → X → Bool) (f : X → Bool) :

A Boolean function f : X → Bool is a threshold function over a feature family g : ι → X → Bool if f x = ltfEval a θ (fun j => g j x) for some a : ι → ℝ and θ : ℝ.

Instances For
    @[instance_reducible]
    noncomputable instance Cslib.Circuits.Boolean.WeightedThreshold.instDecidableIsThresholdOver {X : Type u_1} {ι : Type u_2} [Fintype ι] (g : ι → X → Bool) (f : X → Bool) :
    def Cslib.Circuits.Boolean.WeightedThreshold.featureMoment {X : Type u_1} {ι : Type u_2} [Fintype X] (g : ι → X → Bool) (f : X → Bool) :
    Fin (Fintype.card X + 1) × (ι → Fin (Fintype.card X + 1))

    The feature moment vector (generalized Chow parameters) of f : X → Bool with respect to g : ι → X → Bool, recording #{x : X | f x = true} and fun j => #{x : X | f x = true ∧ g j x = true}.

    theorem Cslib.Circuits.Boolean.WeightedThreshold.eq_of_isThresholdOver_of_featureMoment_eq {X : Type u_1} {ι : Type u_2} [Fintype X] [Fintype ι] (g : ι → X → Bool) {f₁ f₂ : X → Bool} (hf₁ : IsThresholdOver g f₁) (hm : featureMoment g f₁ = featureMoment g f₂) :
    f₁ = f₂

    Chow moment injectivity: if f₁ : X → Bool is a threshold function over g : ι → X → Bool and featureMoment g f₁ = featureMoment g f₂, then f₁ = f₂.

    theorem Cslib.Circuits.Boolean.WeightedThreshold.card_isThresholdOver_le {X : Type u_1} {ι : Type u_2} [Fintype X] [DecidableEq X] [Fintype ι] (g : ι → X → Bool) :
    {f : X → Bool | IsThresholdOver g f}.card ≤ (Fintype.card X + 1) ^ (Fintype.card ι + 1)

    At most (|X| + 1) ^ (|ι| + 1) Boolean functions f : X → Bool are threshold functions over g : ι → X → Bool.

    Counting linear threshold functions and depth-two threshold functions #

    A Boolean function f : (κ → Bool) → Bool is a linear threshold function (LTF) if f u = ltfEval a θ u for some a : κ → ℝ and θ : ℝ.

    Instances For
      @[instance_reducible]
      noncomputable instance Cslib.Circuits.Boolean.WeightedThreshold.instDecidableIsLTF {κ : Type u_1} [Fintype κ] (f : (κ → Bool) → Bool) :
      theorem Cslib.Circuits.Boolean.WeightedThreshold.isLTF_iff_isThresholdOver {κ : Type u_1} [Fintype κ] (f : (κ → Bool) → Bool) :
      IsLTF f ↔ IsThresholdOver (fun (j : κ) (u : κ → Bool) => u j) f

      IsLTF is IsThresholdOver for the coordinate projections fun j u => u j.

      theorem Cslib.Circuits.Boolean.WeightedThreshold.isLTF_const {κ : Type u_1} [Fintype κ] (c : Bool) :
      IsLTF fun (x : κ → Bool) => c

      Every constant Boolean function is a linear threshold function.

      theorem Cslib.Circuits.Boolean.WeightedThreshold.card_isLTF_le {κ : Type u_1} [Fintype κ] [DecidableEq κ] :
      {f : (κ → Bool) → Bool | IsLTF f}.card ≤ (2 ^ Fintype.card κ + 1) ^ (Fintype.card κ + 1)

      There are at most (2 ^ |κ| + 1) ^ (|κ| + 1) linear threshold functions on κ → Bool.

      def Cslib.Circuits.Boolean.WeightedThreshold.depthTwoFeatures {κ : Type u_1} (q : ℕ) (g : Fin q → (κ → Bool) → Bool) :
      Fin q ⊕ κ → (κ → Bool) → Bool

      Combined feature map Fin q ⊕ κ → (κ → Bool) → Bool consisting of q bottom functions g : Fin q → (κ → Bool) → Bool together with the |κ| direct coordinate projections.

      A Boolean function f : (κ → Bool) → Bool belongs to IsDepthTwoWithGates q if it is a threshold function over q bottom LTFs g : Fin q → (κ → Bool) → Bool and the |κ| direct input coordinates.

      Instances For
        @[instance_reducible]
        def Cslib.Circuits.Boolean.WeightedThreshold.padFeatures {κ : Type u_1} {q₁ q₂ : ℕ} (g : Fin q₁ → (κ → Bool) → Bool) :
        Fin q₂ → (κ → Bool) → Bool

        Pad q₁ bottom features to q₂ features with constant-false features.

        theorem Cslib.Circuits.Boolean.WeightedThreshold.padFeatures_eq {κ : Type u_1} {q₁ q₂ : ℕ} (g : Fin q₁ → (κ → Bool) → Bool) (r : Fin q₂) :
        (∃ (r' : Fin q₁), padFeatures g r = g r') ∨ padFeatures g r = fun (x : κ → Bool) => false

        Every padded feature is an original feature or the constant false feature.

        theorem Cslib.Circuits.Boolean.WeightedThreshold.IsThresholdOver.padFeatures {κ : Type u_1} [Fintype κ] {q₁ q₂ : ℕ} (hq : q₁ ≤ q₂) {g : Fin q₁ → (κ → Bool) → Bool} {f : (κ → Bool) → Bool} (hf : IsThresholdOver (depthTwoFeatures q₁ g) f) :

        Padding the bottom features with constant-false features preserves threshold functions.

        theorem Cslib.Circuits.Boolean.WeightedThreshold.IsDepthTwoWithGates.mono {κ : Type u_1} [Fintype κ] {q₁ q₂ : ℕ} (hq : q₁ ≤ q₂) {f : (κ → Bool) → Bool} (hf : IsDepthTwoWithGates q₁ f) :

        IsDepthTwoWithGates is monotone in the bottom gate budget q.

        Counting depth-two threshold functions with q bottom LTF gates: there are at most (2 ^ |κ| + 1) ^ ((|κ| + 2) * q + |κ| + 1) functions in IsDepthTwoWithGates q.

        Upper level sets of a fixed real function and threshold shifts #

        g : X → Bool is an upper level set of the real function φ : X → ℝ if g x = decide (τ ≤ φ x) for some threshold τ : ℝ.

        Instances For
          @[instance_reducible]
          noncomputable instance Cslib.Circuits.Boolean.WeightedThreshold.instDecidableIsUpperLevelSet {X : Type u_1} (φ : X → ℝ) (g : X → Bool) :
          theorem Cslib.Circuits.Boolean.WeightedThreshold.eq_of_isUpperLevelSet_of_card_eq {X : Type u_1} [Fintype X] {φ : X → ℝ} {g₁ g₂ : X → Bool} (h₁ : IsUpperLevelSet φ g₁) (h₂ : IsUpperLevelSet φ g₂) (hcard : {x : X | g₁ x = true}.card = {x : X | g₂ x = true}.card) :
          g₁ = g₂

          Upper level sets of a fixed function are nested, so an upper level set is determined by the number of points where it is true.

          A fixed real function φ : X → ℝ has at most |X| + 1 upper level sets.

          theorem Cslib.Circuits.Boolean.WeightedThreshold.card_isUpperLevelSet_nonconst_le {X : Type u_1} [Fintype X] [DecidableEq X] (φ : X → ℝ) :
          {g : X → Bool | IsUpperLevelSet φ g ∧ ∃ (x : X) (y : X), g x ≠ g y}.card ≤ Fintype.card X - 1

          A fixed real function φ : X → ℝ has at most |X| - 1 nonconstant upper level sets.

          def Cslib.Circuits.Boolean.WeightedThreshold.IsThresholdShift {κ : Type u_1} [Fintype κ] (β : κ → ℝ) (g : (κ → Bool) → Bool) :

          g : (κ → Bool) → Bool is a threshold shift of the weight vector β : κ → ℝ if g = ltfEval β τ for some threshold τ : ℝ.

          Instances For
            @[instance_reducible]
            noncomputable instance Cslib.Circuits.Boolean.WeightedThreshold.instDecidableIsThresholdShift {κ : Type u_1} [Fintype κ] (β : κ → ℝ) (g : (κ → Bool) → Bool) :
            theorem Cslib.Circuits.Boolean.WeightedThreshold.isThresholdShift_iff_isUpperLevelSet {κ : Type u_1} [Fintype κ] (β : κ → ℝ) (g : (κ → Bool) → Bool) :
            IsThresholdShift β g ↔ IsUpperLevelSet (fun (u : κ → Bool) => ∑ i : κ, β i * ↑(u i).toNat) g

            Threshold shifts of β are the upper level sets of the linear form u ↦ ∑ i, β i * u i.

            theorem Cslib.Circuits.Boolean.WeightedThreshold.eq_of_isThresholdShift_of_card_eq {κ : Type u_1} [Fintype κ] [DecidableEq κ] {β : κ → ℝ} {g₁ g₂ : (κ → Bool) → Bool} (h₁ : IsThresholdShift β g₁) (h₂ : IsThresholdShift β g₂) (hcard : {u : κ → Bool | g₁ u = true}.card = {u : κ → Bool | g₂ u = true}.card) :
            g₁ = g₂

            Threshold shifts of a fixed weight vector are nested, so a threshold shift is determined by the number of its satisfying assignments.

            A fixed weight vector β : κ → ℝ has at most 2 ^ |κ| + 1 threshold shifts.

            theorem Cslib.Circuits.Boolean.WeightedThreshold.card_isThresholdShift_nonconst_le {κ : Type u_1} [Fintype κ] [DecidableEq κ] (β : κ → ℝ) :
            {g : (κ → Bool) → Bool | IsThresholdShift β g ∧ ∃ (u : κ → Bool) (v : κ → Bool), g u ≠ g v}.card ≤ 2 ^ Fintype.card κ - 1

            A fixed weight vector β : κ → ℝ has at most 2 ^ |κ| - 1 nonconstant threshold shifts.

            def Cslib.Circuits.Boolean.WeightedThreshold.IsWeightShift {κ : Type u_1} [Fintype κ] (W : Finset (κ → ℝ)) (g : (κ → Bool) → Bool) :

            g : (κ → Bool) → Bool is a weight shift over a finite set W : Finset (κ → ℝ) of weight vectors if it is the constant false function or a threshold shift of some β ∈ W.

            Instances For
              @[instance_reducible]
              noncomputable instance Cslib.Circuits.Boolean.WeightedThreshold.instDecidableIsWeightShift {κ : Type u_1} [Fintype κ] (W : Finset (κ → ℝ)) (g : (κ → Bool) → Bool) :
              theorem Cslib.Circuits.Boolean.WeightedThreshold.IsWeightShift.isLTF {κ : Type u_1} [Fintype κ] {W : Finset (κ → ℝ)} {g : (κ → Bool) → Bool} (h : IsWeightShift W g) :

              Every weight shift is a linear threshold function.

              theorem Cslib.Circuits.Boolean.WeightedThreshold.card_isWeightShift_le {κ : Type u_1} [Fintype κ] [DecidableEq κ] (W : Finset (κ → ℝ)) :
              {g : (κ → Bool) → Bool | IsWeightShift W g}.card ≤ (2 ^ Fintype.card κ + 1) * min (W.card + 1) ((2 ^ Fintype.card κ + 1) ^ Fintype.card κ)

              There are at most (2 ^ |κ| + 1) * min (#W + 1) ((2 ^ |κ| + 1) ^ |κ|) weight shifts over W : Finset (κ → ℝ).

              def Cslib.Circuits.Boolean.WeightedThreshold.IsDepthTwoOverWeights {κ : Type u_1} [Fintype κ] (W : Finset (κ → ℝ)) (q : ℕ) (f : (κ → Bool) → Bool) :

              A Boolean function f : (κ → Bool) → Bool belongs to IsDepthTwoOverWeights W q if it is a threshold function over q weight shifts over W and the |κ| direct input coordinates. Unlike IsDepthTwoWithGates q, the bottom weight vectors are drawn from the fixed finite set W; only their thresholds are free.

              Instances For
                @[instance_reducible]
                noncomputable instance Cslib.Circuits.Boolean.WeightedThreshold.instDecidableIsDepthTwoOverWeights {κ : Type u_1} [Fintype κ] (W : Finset (κ → ℝ)) (q : ℕ) (f : (κ → Bool) → Bool) :
                theorem Cslib.Circuits.Boolean.WeightedThreshold.IsDepthTwoOverWeights.mono {κ : Type u_1} [Fintype κ] {W : Finset (κ → ℝ)} {q₁ q₂ : ℕ} (hq : q₁ ≤ q₂) {f : (κ → Bool) → Bool} (hf : IsDepthTwoOverWeights W q₁ f) :

                IsDepthTwoOverWeights W is monotone in the bottom gate budget q.

                theorem Cslib.Circuits.Boolean.WeightedThreshold.IsDepthTwoOverWeights.mono_weights {κ : Type u_1} [Fintype κ] {W₁ W₂ : Finset (κ → ℝ)} (hW : W₁ ⊆ W₂) {q : ℕ} {f : (κ → Bool) → Bool} (hf : IsDepthTwoOverWeights W₁ q f) :

                IsDepthTwoOverWeights W q is monotone in the set W of bottom weight vectors.

                theorem Cslib.Circuits.Boolean.WeightedThreshold.isDepthTwoOverWeights_const {κ : Type u_1} [Fintype κ] (W : Finset (κ → ℝ)) (q : ℕ) (b : Bool) :
                IsDepthTwoOverWeights W q fun (x : κ → Bool) => b

                Every constant Boolean function belongs to IsDepthTwoOverWeights W q.

                theorem Cslib.Circuits.Boolean.WeightedThreshold.card_isDepthTwoOverWeights_le {κ : Type u_1} [Fintype κ] [DecidableEq κ] (W : Finset (κ → ℝ)) (q : ℕ) :
                {f : (κ → Bool) → Bool | IsDepthTwoOverWeights W q f}.card ≤ ((2 ^ Fintype.card κ + 1) * min (W.card + 1) ((2 ^ Fintype.card κ + 1) ^ Fintype.card κ)) ^ q * (2 ^ Fintype.card κ + 1) ^ (q + Fintype.card κ + 1)

                Counting depth-two threshold functions over fixed bottom weight vectors: there are at most ((2 ^ |κ| + 1) * min (#W + 1) ((2 ^ |κ| + 1) ^ |κ|)) ^ q * (2 ^ |κ| + 1) ^ (q + |κ| + 1) functions in IsDepthTwoOverWeights W q. Each bottom gate costs O(|κ| + log #W) bits, compared with the O(|κ| ^ 2) bits of an arbitrary LTF in card_isDepthTwoWithGates_le.

                Embedded subcube completions and collapse of depth-two threshold circuits #

                noncomputable def Cslib.Circuits.Boolean.WeightedThreshold.liftAssign {κ : Type u_1} {ι : Type u_2} [Fintype κ] [DecidableEq ι] (emb : κ → ι) (u : κ → Bool) (i : ι) :

                Lift an assignment u : κ → Bool along emb : κ → ι (false outside univ.image emb).

                noncomputable def Cslib.Circuits.Boolean.WeightedThreshold.embedUpdate {κ : Type u_1} {ι : Type u_2} [Fintype κ] [DecidableEq ι] (emb : κ → ι) (w : ι → Bool) (u : κ → Bool) :
                ι → Bool

                Replace the coordinates of w : ι → Bool inside univ.image emb by u : κ → Bool.

                @[simp]
                theorem Cslib.Circuits.Boolean.WeightedThreshold.liftAssign_emb {κ : Type u_1} {ι : Type u_2} [Fintype κ] [DecidableEq ι] {emb : κ → ι} (hinj : Function.Injective emb) (u : κ → Bool) (j : κ) :
                liftAssign emb u (emb j) = u j
                @[simp]
                theorem Cslib.Circuits.Boolean.WeightedThreshold.embedUpdate_emb {κ : Type u_1} {ι : Type u_2} [Fintype κ] [DecidableEq ι] {emb : κ → ι} (hinj : Function.Injective emb) (w : ι → Bool) (u : κ → Bool) (j : κ) :
                embedUpdate emb w u (emb j) = u j
                @[simp]
                theorem Cslib.Circuits.Boolean.WeightedThreshold.embedUpdate_of_notMem {κ : Type u_1} {ι : Type u_2} [Fintype κ] [DecidableEq ι] {emb : κ → ι} (w : ι → Bool) (u : κ → Bool) {i : ι} (hi : i ∉ Finset.image emb Finset.univ) :
                embedUpdate emb w u i = w i
                noncomputable def Cslib.Circuits.Boolean.WeightedThreshold.embedUpdateSwap {κ : Type u_1} {ι : Type u_2} [Fintype κ] [DecidableEq ι] (emb : κ → ι) (p : (ι → Bool) × (κ → Bool)) :
                (ι → Bool) × (κ → Bool)

                Involution on (ι → Bool) × (κ → Bool) swapping w on univ.image emb with u.

                theorem Cslib.Circuits.Boolean.WeightedThreshold.sum_card_filter_embedUpdate {κ : Type u_1} {ι : Type u_2} [Fintype κ] [DecidableEq κ] [Fintype ι] [DecidableEq ι] {emb : κ → ι} (hinj : Function.Injective emb) (P : (ι → Bool) → Prop) [DecidablePred P] :
                ∑ w : ι → Bool, {u : κ → Bool | P (embedUpdate emb w u)}.card = 2 ^ Fintype.card κ * {w : ι → Bool | P w}.card

                Summing #{u : κ → Bool | P (embedUpdate emb w u)} over all w : ι → Bool equals 2 ^ |κ| * #{w : ι → Bool | P w}.

                theorem Cslib.Circuits.Boolean.WeightedThreshold.sum_mul_embedUpdate {κ : Type u_1} {ι : Type u_2} [Fintype κ] [Fintype ι] [DecidableEq ι] {emb : κ → ι} (hinj : Function.Injective emb) (a : ι → ℝ) (w : ι → Bool) (u : κ → Bool) :
                ∑ i : ι, a i * ↑(embedUpdate emb w u i).toNat = ∑ i ∈ (Finset.image emb Finset.univ)ᶜ, a i * ↑(w i).toNat + ∑ j : κ, a (emb j) * ↑(u j).toNat

                Splitting ∑ i : ι, a i * (embedUpdate emb w u i).toNat into outside and live parts.

                theorem Cslib.Circuits.Boolean.WeightedThreshold.ltfEval_embedUpdate {κ : Type u_1} {ι : Type u_2} [Fintype κ] [Fintype ι] [DecidableEq ι] {emb : κ → ι} (hinj : Function.Injective emb) (a : ι → ℝ) (θ : ℝ) (w : ι → Bool) (u : κ → Bool) :
                ltfEval a θ (embedUpdate emb w u) = ltfEval (fun (j : κ) => a (emb j)) (θ - ∑ i ∈ (Finset.image emb Finset.univ)ᶜ, a i * ↑(w i).toNat) u

                Any LTF ltfEval a θ restricted via embedUpdate emb w is an LTF on κ → Bool.

                theorem Cslib.Circuits.Boolean.WeightedThreshold.isLTF_ltfEval_embedUpdate {κ : Type u_1} {ι : Type u_2} [Fintype κ] [Fintype ι] [DecidableEq ι] {emb : κ → ι} (hinj : Function.Injective emb) (a : ι → ℝ) (θ : ℝ) (w : ι → Bool) :
                IsLTF fun (u : κ → Bool) => ltfEval a θ (embedUpdate emb w u)
                theorem Cslib.Circuits.Boolean.WeightedThreshold.exists_linear_of_forcedToAtMostOne {κ : Type u_1} {ι : Type u_2} [Fintype κ] [DecidableEq ι] {emb : κ → ι} (hinj : Function.Injective emb) {f : (ι → Bool) → Bool} {w : ι → Bool} (hf : ForcedToAtMostOne f (Finset.image emb Finset.univ) w) :
                ∃ (c₀ : ℝ) (d : κ → ℝ), ∀ (u : κ → Bool), ↑(f (embedUpdate emb w u)).toNat = c₀ + ∑ j : κ, d j * ↑(u j).toNat

                Any Boolean function f : (ι → Bool) → Bool satisfying ForcedToAtMostOne f (univ.image emb) w has ((f (embedUpdate emb w u)).toNat : ℝ) = c₀ + ∑ j : κ, d j * (u j).toNat.

                noncomputable def Cslib.Circuits.Boolean.WeightedThreshold.unforcedConstGates {n g : ℕ} (p : Program signature n g) (top : Fin g) (B : Finset (Fin n)) (w : Fin n → Bool) :

                Predecessor gates of top whose depth-1 LTF is not ForcedToConst outside B by w.

                noncomputable def Cslib.Circuits.Boolean.WeightedThreshold.unforcedAtMostOneGates {n g : ℕ} (p : Program signature n g) (top : Fin g) (B : Finset (Fin n)) (w : Fin n → Bool) :

                Predecessor gates of top whose depth-1 LTF is not ForcedToAtMostOne outside B by w.

                noncomputable def Cslib.Circuits.Boolean.WeightedThreshold.circuitUnforcedConstCount {n : ℕ} (c : Circuit signature n 1) (o : Fin 1) (B : Finset (Fin n)) (w : Fin n → Bool) :

                Number of bottom gates of a circuit output o not forced to a constant outside B by w.

                noncomputable def Cslib.Circuits.Boolean.WeightedThreshold.circuitUnforcedAtMostOneCount {n : ℕ} (c : Circuit signature n 1) (o : Fin 1) (B : Finset (Fin n)) (w : Fin n → Bool) :

                Number of bottom gates of o not forced to a function of at most one input outside B.

                Every gate k ∈ gateSupport p top has depth strictly less than p.depths top.

                noncomputable def Cslib.Circuits.Boolean.WeightedThreshold.circuitLiveWeights {κ : Type u_1} [Fintype κ] {n : ℕ} (c : Circuit signature n 1) (o : Fin 1) (emb : κ → Fin n) :
                Finset (κ → ℝ)

                The live weight vectors of a circuit output o along emb : κ → Fin n: the restrictions fun j => inputWeight c.program k (emb j) of the input weight vectors of the bottom gates k ∈ gateSupport c.program top read by the output gate top (empty if o is an input wire). They depend on emb but not on the values of the fixed inputs.

                A circuit output has at most c.size live weight vectors.

                A circuit output has at most c.wireCount live weight vectors: every bottom gate read by the output gate contributes an active gate-to-gate wire.

                Depth-Two Circuit Restriction Collapse over Fixed Weights: for any weighted threshold circuit c : Circuit signature n 1 of depth at most 2 and any injective live-variable embedding emb : κ → Fin n, restricting c outside univ.image emb to w produces a function in IsDepthTwoOverWeights (circuitLiveWeights c o emb) (circuitUnforcedAtMostOneCount c o (univ.image emb) w). The surviving bottom gates keep their weights on the live coordinates; only their thresholds depend on w.

                theorem Cslib.Circuits.Boolean.WeightedThreshold.isDepthTwoWithGates_eval_embedUpdate {κ : Type u_1} [Fintype κ] {n : ℕ} (c : Circuit signature n 1) (hd : c.depth ≤ 2) (o : Fin 1) {emb : κ → Fin n} (hinj : Function.Injective emb) (w : Fin n → Bool) :

                Depth-Two Circuit Restriction Collapse: for any weighted threshold circuit c : Circuit signature n 1 of depth at most 2 and any injective live-variable embedding emb : κ → Fin n, restricting c outside univ.image emb to w produces a function in IsDepthTwoWithGates (circuitUnforcedAtMostOneCount c o (univ.image emb) w).

                Expected unforced gate counts under block-partition random restrictions #

                theorem Cslib.Circuits.Boolean.WeightedThreshold.sum_card_filter_not_forcedToConst_blockLiveSet_le {κ : Type u_1} {τ : Type u_2} [Fintype κ] [DecidableEq κ] [Fintype τ] {n t : ℕ} (c : Circuit signature n t) (G : Finset (Fin c.size)) (blockVar : κ → τ → Fin n) (hinj : ∀ (j₁ : κ) (t₁ : τ) (j₂ : κ) (t₂ : τ), blockVar j₁ t₁ = blockVar j₂ t₂ → j₁ = j₂ ∧ t₁ = t₂) :
                ∑ σ : κ → τ, ∑ w : Fin n → Bool, ↑{k ∈ G | ¬ForcedToConst (ltfEval (inputWeight c.program k) (c.program.lines k).op.threshold) (Combinatorics.LittlewoodOfford.blockLiveSet blockVar σ) w}.card ≤ ↑(Fintype.card (κ → τ)) * 2 ^ n * (4 * (1 / ↑(Fintype.card τ)) * ↑c.size * √↑n)

                Averaging the number of gates k ∈ G whose depth-1 LTF is not ForcedToConst outside blockLiveSet blockVar σ by w, over all block selections σ : κ → τ and assignments w : Fin n → Bool, gives at most |κ → τ| * 2 ^ n * (4 * (1 / |τ|) * c.size * √n), for any set G of gates of c.

                theorem Cslib.Circuits.Boolean.WeightedThreshold.sum_card_filter_not_forcedToAtMostOne_blockLiveSet_le {κ : Type u_1} {τ : Type u_2} [Fintype κ] [DecidableEq κ] [Fintype τ] {n t : ℕ} (c : Circuit signature n t) (G : Finset (Fin c.size)) (blockVar : κ → τ → Fin n) (hinj : ∀ (j₁ : κ) (t₁ : τ) (j₂ : κ) (t₂ : τ), blockVar j₁ t₁ = blockVar j₂ t₂ → j₁ = j₂ ∧ t₁ = t₂) :
                ∑ σ : κ → τ, ∑ w : Fin n → Bool, ↑{k ∈ G | ¬ForcedToAtMostOne (ltfEval (inputWeight c.program k) (c.program.lines k).op.threshold) (Combinatorics.LittlewoodOfford.blockLiveSet blockVar σ) w}.card ≤ ↑(Fintype.card (κ → τ)) * 2 ^ n * (4 * ↑c.wireCount * (1 / ↑(Fintype.card τ)) * √(1 / ↑(Fintype.card τ)))

                Averaging the number of gates k ∈ G whose depth-1 LTF is not ForcedToAtMostOne outside blockLiveSet blockVar σ by w, over all block selections σ : κ → τ and assignments w : Fin n → Bool, gives at most |κ → τ| * 2 ^ n * (4 * c.wireCount * (1 / |τ|) * √(1 / |τ|)), for any set G of gates of c.

                theorem Cslib.Circuits.Boolean.WeightedThreshold.sum_circuitUnforcedConstCount_blockLiveSet_le {κ : Type u_1} {τ : Type u_2} [Fintype κ] [DecidableEq κ] [Fintype τ] {n : ℕ} (c : Circuit signature n 1) (o : Fin 1) (blockVar : κ → τ → Fin n) (hinj : ∀ (j₁ : κ) (t₁ : τ) (j₂ : κ) (t₂ : τ), blockVar j₁ t₁ = blockVar j₂ t₂ → j₁ = j₂ ∧ t₁ = t₂) :
                ∑ σ : κ → τ, ∑ w : Fin n → Bool, ↑(circuitUnforcedConstCount c o (Combinatorics.LittlewoodOfford.blockLiveSet blockVar σ) w) ≤ ↑(Fintype.card (κ → τ)) * 2 ^ n * (4 * (1 / ↑(Fintype.card τ)) * ↑c.size * √↑n)

                Averaging circuitUnforcedConstCount c o (blockLiveSet blockVar σ) w over all block selections σ : κ → τ and assignments w : Fin n → Bool gives at most |κ → τ| * 2 ^ n * (4 * (1 / |τ|) * c.size * √n).

                theorem Cslib.Circuits.Boolean.WeightedThreshold.sum_circuitUnforcedAtMostOneCount_blockLiveSet_le {κ : Type u_1} {τ : Type u_2} [Fintype κ] [DecidableEq κ] [Fintype τ] {n : ℕ} (c : Circuit signature n 1) (o : Fin 1) (blockVar : κ → τ → Fin n) (hinj : ∀ (j₁ : κ) (t₁ : τ) (j₂ : κ) (t₂ : τ), blockVar j₁ t₁ = blockVar j₂ t₂ → j₁ = j₂ ∧ t₁ = t₂) :
                ∑ σ : κ → τ, ∑ w : Fin n → Bool, ↑(circuitUnforcedAtMostOneCount c o (Combinatorics.LittlewoodOfford.blockLiveSet blockVar σ) w) ≤ ↑(Fintype.card (κ → τ)) * 2 ^ n * (4 * ↑c.wireCount * (1 / ↑(Fintype.card τ)) * √(1 / ↑(Fintype.card τ)))

                Averaging circuitUnforcedAtMostOneCount c o (blockLiveSet blockVar σ) w over all block selections σ : κ → τ and assignments w : Fin n → Bool gives at most |κ → τ| * 2 ^ n * (4 * c.wireCount * (1 / |τ|) * √(1 / |τ|)).