Documentation

CslibFrontier.Computability.Circuit.Boolean.SymAnd.Collapse

Collapsing towers of modular polynomial layers into SYM ∘ AND #

A modular polynomial layer on a finite set T of slots (Circuits.Boolean.ModPolyLayer) has a modulus p and assigns to each slot t an integer polynomial q t of the previous values; it updates slot t to whether q t ≢ 0 (mod p) (ModPolyLayer.step). A list of layers is run from the last to the first (ModPolyLayer.run). These are the stratified modular polynomial circuits of Beigel and Tarui [BeigelTarui1994, Section 2.2], with every slot evaluated at every level.

Collapse. A SYM ∘ AND circuit on top of such a layer, with prime p, collapses into a single SYM ∘ AND circuit (SymAnd.exists_eval_eq_eval_step). With M = p ^ k above the size of the top circuit, the modulus-amplified bits h_t = 1 - p_k(q_t ^ (p - 1)) agree with the layer's outputs modulo M (Polynomial.one_sub_parityAmplifier_eval_pow_modEq). Hence ∑_{S ∈ gates} ∏_{t ∈ S} h_t is a low-degree integer function congruent modulo M to the number of satisfied gates, which is below M (SymAnd.amplifiedCount_modEq). The canonical circuit of that function modulo M (SymAnd.ofLowDegree, with AND multiplicities its subset Möbius coefficients) is the collapsed circuit (SymAnd.collapseStep), and its symmetric gate reads its argument modulo M. This is the inductive step of [BeigelTarui1994, Lemma 2.8] with their Fact 2.7 (Section 2.4).

Iterating over L layers whose primes, slot-polynomial degrees and log₂(|T| + 1) are at most B, starting from a circuit of fan-in at most B and size at most 2 ^ B, gives a SYM ∘ AND circuit of fan-in at most (2B) ^ (5 ^ L) and size at most 2 ^ ((2B) ^ (5 ^ L)) (SymAnd.collapseRun, SymAnd.exists_eval_eq_eval_run). Reading one slot of the tower is the special case SymAnd.exists_eval_eq_run_apply. For a fixed number of layers and B polylogarithmic, this is the quasi-polynomial size and polylogarithmic fan-in of [BeigelTarui1994, Theorem 1.1].

The source states the collapse for one arbitrary modulus m per level, requiring each level polynomial to be 0 or 1 modulo m. Here each level has a prime modulus, and Fermat's little theorem normalizes arbitrary integer values, so no 0/1 promise is needed. Composite moduli reduce to prime moduli through prime-power digits ([BeigelTarui1994, Lemma 2.1]). That reduction, and the passage from ACC⁰ circuits (Circuits.Boolean.AC0Mod) to towers of these layers, are in CslibFrontier.Computability.Circuit.Boolean.SymAnd.ACC0. The collapsed circuit reads all slots of T; restricting the non-input slots to their initial value false and dropping the AND gates that meet them (SymAnd.restrict) gives a circuit over the inputs alone.

Main definitions #

Main results #

References #

A layer of modular polynomial gates on slots T: slot t becomes whether the integer polynomial q t of the previous slot values is nonzero modulo p. Degrees and primality are hypotheses of the theorems using a layer.

  • p : ℕ

    The modulus of the layer.

  • q : T → (T → Bool) → ℤ

    The integer polynomial read by each slot, as a function of the previous slot values.

def Cslib.Circuits.Boolean.ModPolyLayer.step {T : Type u_1} (L : ModPolyLayer T) (v : T → Bool) :
T → Bool

One step: every slot t becomes whether q t v is nonzero modulo p.

def Cslib.Circuits.Boolean.ModPolyLayer.run {T : Type u_1} (Ls : List (ModPolyLayer T)) (v : T → Bool) :
T → Bool

Run a list of layers on v, from the last layer to the first.

@[simp]
theorem Cslib.Circuits.Boolean.ModPolyLayer.run_nil {T : Type u_1} (v : T → Bool) :
run [] v = v

Running no layers returns the input.

@[simp]
theorem Cslib.Circuits.Boolean.ModPolyLayer.run_cons {T : Type u_1} (L : ModPolyLayer T) (Ls : List (ModPolyLayer T)) (v : T → Bool) :
run (L :: Ls) v = L.step (run Ls v)

Running L :: Ls applies L after Ls.

theorem Cslib.Circuits.Boolean.ModPolyLayer.run_append {T : Type u_1} (Ls Ls' : List (ModPolyLayer T)) (v : T → Bool) :
run (Ls ++ Ls') v = run Ls (run Ls' v)

Running Ls ++ Ls' runs Ls after Ls'.

noncomputable def Cslib.Circuits.Boolean.SymAnd.amplifiedCount {T : Type u_1} (C : SymAnd T) (L : ModPolyLayer T) (k : ℕ) (v : T → Bool) :

The modulus-amplified count of C after the layer L: the sum over the gates S of C of ∏_{t ∈ S} (1 - p_k(q_t ^ (p - 1))). Modulo p ^ k it is the number of gates of C satisfied after L (SymAnd.amplifiedCount_modEq).

theorem Cslib.Circuits.Boolean.SymAnd.amplifiedCount_mem_lowDegree {T : Type u_1} (C : SymAnd T) (L : ModPolyLayer T) {D : ℕ} (hq : ∀ (t : T), L.q t ∈ BitString.lowDegree ℤ T D) (k : ℕ) :
C.amplifiedCount L k ∈ BitString.lowDegree ℤ T (C.fanIn * ((2 * k - 1) * ((L.p - 1) * D)))

The amplified count has degree at most C.fanIn * (2k - 1)(p - 1)D when the slot polynomials have degree at most D.

theorem Cslib.Circuits.Boolean.SymAnd.amplifiedCount_modEq {T : Type u_1} (C : SymAnd T) (L : ModPolyLayer T) (hp : Nat.Prime L.p) (k : ℕ) (v : T → Bool) :
C.amplifiedCount L k v ≡ ↑(C.count (L.step v)) [ZMOD ↑(L.p ^ k)]

For a prime modulus, the amplified count is the number of gates of C satisfied after L, modulo p ^ k [BeigelTarui1994, Fact 2.7].

noncomputable def Cslib.Circuits.Boolean.SymAnd.collapseStep {T : Type u_1} [Fintype T] [DecidableEq T] (C : SymAnd T) (L : ModPolyLayer T) (k D : ℕ) :

One explicit collapse step [BeigelTarui1994, Lemma 2.8]: the canonical circuit (SymAnd.ofLowDegree) of the amplified count amplifiedCount C L k modulo p ^ k, up to its degree bound C.fanIn * (2k - 1)(p - 1)D, below the symmetric gate of C.

theorem Cslib.Circuits.Boolean.SymAnd.eval_collapseStep {T : Type u_1} [Fintype T] [DecidableEq T] (C : SymAnd T) (L : ModPolyLayer T) (hp : Nat.Prime L.p) {D : ℕ} (hq : ∀ (t : T), L.q t ∈ BitString.lowDegree ℤ T D) {k : ℕ} (hk : C.size < L.p ^ k) (v : T → Bool) :
(C.collapseStep L k D).eval v = C.eval (L.step v)

What the collapse step computes: C after L, when p is prime, the slot polynomials have degree at most D and C.size < p ^ k.

theorem Cslib.Circuits.Boolean.SymAnd.fanIn_collapseStep_le {T : Type u_1} [Fintype T] [DecidableEq T] (C : SymAnd T) (L : ModPolyLayer T) (k D : ℕ) :
(C.collapseStep L k D).fanIn ≤ C.fanIn * ((2 * k - 1) * ((L.p - 1) * D))

The collapse step has fan-in at most C.fanIn * (2k - 1)(p - 1)D.

theorem Cslib.Circuits.Boolean.SymAnd.size_collapseStep_le {T : Type u_1} [Fintype T] [DecidableEq T] (C : SymAnd T) (L : ModPolyLayer T) (hp : 0 < L.p) (k D : ℕ) :
(C.collapseStep L k D).size ≤ L.p ^ k * (Fintype.card T + 1) ^ (C.fanIn * ((2 * k - 1) * ((L.p - 1) * D)))

The collapse step has at most p ^ k * (|T| + 1) ^ F AND gates, where F = C.fanIn * (2k - 1)(p - 1)D is its fan-in bound.

theorem Cslib.Circuits.Boolean.SymAnd.exists_eval_eq_eval_step {T : Type u_1} [Fintype T] (C : SymAnd T) (L : ModPolyLayer T) (hp : Nat.Prime L.p) {D : ℕ} (hq : ∀ (t : T), L.q t ∈ BitString.lowDegree ℤ T D) {k : ℕ} (hk : C.size < L.p ^ k) :
∃ (C' : SymAnd T), (∀ (v : T → Bool), C'.eval v = C.eval (L.step v)) ∧ C'.fanIn ≤ C.fanIn * ((2 * k - 1) * ((L.p - 1) * D)) ∧ C'.size ≤ L.p ^ k * (Fintype.card T + 1) ^ (C.fanIn * ((2 * k - 1) * ((L.p - 1) * D)))

Collapsing one modular layer [BeigelTarui1994, Lemma 2.8]. Let C be a SYM ∘ AND circuit on slots T and L a layer with prime modulus p whose slot polynomials have degree at most D. If C.size < p ^ k, then some SYM ∘ AND circuit computes C after L, with fan-in at most F = C.fanIn * (2k - 1)(p - 1)D and at most p ^ k * (|T| + 1) ^ F AND gates, where the exponent F is this new fan-in bound. The circuit is SymAnd.collapseStep C L k D.

noncomputable def Cslib.Circuits.Boolean.SymAnd.collapseRun {T : Type u_1} [Fintype T] [DecidableEq T] (C : SymAnd T) :
List (ModPolyLayer T) → ℕ → SymAnd T

The explicit collapse of a tower: collapse the layers of Ls one at a time from the outermost, with k = B + 1 and degree bound B at the first layer and 5 B ^ 5 in place of B afterwards.

theorem Cslib.Circuits.Boolean.SymAnd.eval_collapseRun {T : Type u_1} [Fintype T] [DecidableEq T] (C : SymAnd T) (Ls : List (ModPolyLayer T)) {B : ℕ} (hLs : ∀ L ∈ Ls, Nat.Prime L.p ∧ L.p ≤ B ∧ ∀ (t : T), L.q t ∈ BitString.lowDegree ℤ T B) (hT : Fintype.card T + 1 ≤ 2 ^ B) (hf : C.fanIn ≤ B) (hs : C.size ≤ 2 ^ B) (v : T → Bool) :
(C.collapseRun Ls B).eval v = C.eval (ModPolyLayer.run Ls v)

What the explicit tower collapse computes: under the hypotheses of SymAnd.exists_eval_eq_eval_run, collapseRun C Ls B computes C after running Ls.

theorem Cslib.Circuits.Boolean.SymAnd.fanIn_collapseRun_le {T : Type u_1} [Fintype T] [DecidableEq T] (C : SymAnd T) (Ls : List (ModPolyLayer T)) {B : ℕ} (hLs : ∀ L ∈ Ls, Nat.Prime L.p ∧ L.p ≤ B ∧ ∀ (t : T), L.q t ∈ BitString.lowDegree ℤ T B) (hT : Fintype.card T + 1 ≤ 2 ^ B) (hf : C.fanIn ≤ B) (hs : C.size ≤ 2 ^ B) :
(C.collapseRun Ls B).fanIn ≤ (2 * B) ^ 5 ^ Ls.length

The explicit tower collapse has fan-in at most (2B) ^ (5 ^ L).

theorem Cslib.Circuits.Boolean.SymAnd.size_collapseRun_le {T : Type u_1} [Fintype T] [DecidableEq T] (C : SymAnd T) (Ls : List (ModPolyLayer T)) {B : ℕ} (hLs : ∀ L ∈ Ls, Nat.Prime L.p ∧ L.p ≤ B ∧ ∀ (t : T), L.q t ∈ BitString.lowDegree ℤ T B) (hT : Fintype.card T + 1 ≤ 2 ^ B) (hf : C.fanIn ≤ B) (hs : C.size ≤ 2 ^ B) :
(C.collapseRun Ls B).size ≤ 2 ^ (2 * B) ^ 5 ^ Ls.length

The explicit tower collapse has at most 2 ^ ((2B) ^ (5 ^ L)) AND gates.

theorem Cslib.Circuits.Boolean.SymAnd.exists_eval_eq_eval_run {T : Type u_1} [Fintype T] (C : SymAnd T) (Ls : List (ModPolyLayer T)) {B : ℕ} (hLs : ∀ L ∈ Ls, Nat.Prime L.p ∧ L.p ≤ B ∧ ∀ (t : T), L.q t ∈ BitString.lowDegree ℤ T B) (hT : Fintype.card T + 1 ≤ 2 ^ B) (hf : C.fanIn ≤ B) (hs : C.size ≤ 2 ^ B) :
∃ (C' : SymAnd T), (∀ (v : T → Bool), C'.eval v = C.eval (ModPolyLayer.run Ls v)) ∧ C'.fanIn ≤ (2 * B) ^ 5 ^ Ls.length ∧ C'.size ≤ 2 ^ (2 * B) ^ 5 ^ Ls.length

Collapsing a tower of modular layers [BeigelTarui1994, Lemma 2.8]. Let every layer of Ls have a prime modulus at most B and slot polynomials of degree at most B, with |T| + 1 ≤ 2 ^ B. A SYM ∘ AND circuit of fan-in at most B and size at most 2 ^ B, applied after running Ls, is computed by a single SYM ∘ AND circuit of fan-in at most (2B) ^ (5 ^ L) and size at most 2 ^ ((2B) ^ (5 ^ L)), where L is the number of layers. The circuit is SymAnd.collapseRun C Ls B.

theorem Cslib.Circuits.Boolean.SymAnd.exists_eval_eq_run_apply {T : Type u_1} [Fintype T] (Ls : List (ModPolyLayer T)) (t : T) {B : ℕ} (hLs : ∀ L ∈ Ls, Nat.Prime L.p ∧ L.p ≤ B ∧ ∀ (t : T), L.q t ∈ BitString.lowDegree ℤ T B) (hT : Fintype.card T + 1 ≤ 2 ^ B) :
∃ (C : SymAnd T), (∀ (v : T → Bool), C.eval v = ModPolyLayer.run Ls v t) ∧ C.fanIn ≤ (2 * B) ^ 5 ^ Ls.length ∧ C.size ≤ 2 ^ (2 * B) ^ 5 ^ Ls.length

Every slot of a tower is a SYM ∘ AND circuit. Under the hypotheses of exists_eval_eq_eval_run, slot t after running Ls is computed by a SYM ∘ AND circuit of fan-in at most (2B) ^ (5 ^ L) and size at most 2 ^ ((2B) ^ (5 ^ L)).