Documentation

CslibFrontier.Computability.Circuit.Boolean.ModMajority

MOD_q gates from majority gates: ACⁱ[q] ⊆ TCⁱ #

Over a basis containing the unbounded fan-in basis, the MOD_q function on n bits is the disjunction, over the k ≤ n not divisible by q, of "exactly k bits are true", each of which is two thresholds, so two majority gates on padded inputs (modCircuitOfMajority) Chandra, Stockmeyer and Vishkin. With a single majority gate this is a circuit of 8 n + 9 gates and depth five.

A MOD_q gate depends on how often it reads each wire, but only modulo q (for q = 0, only on whether it reads it at all): after aggregating multiplicities (Unbounded.multCircuit), a gate reading N distinct wires is a MOD_q function of at most max q 1 · N bits, wired from its arguments (Unbounded.modMultCircuit). Replacing every gate of a polynomial-size circuit with MOD_q gates, of depth d, gives a polynomial-size circuit with majority gates of depth at most 5 d: ACⁱ[q] ⊆ TCⁱ (ACMod_subset_TC) Vollmer, Chapter 4, in particular AC⁰[q] ⊆ TC⁰ (AC0Mod_subset_TC0).

Main definitions #

Main results #

References #

The count of true arguments that a MOD_q gate sees: whether it is not divisible by q.

The MOD_q gate computes modCount q of the number of its true arguments.

The multiplicity of a wire that matters to a MOD_q gate: modulo q, and for q = 0 whether it is read at all.

The reduced multiplicity modMult q k is at most max q 1.

theorem Cslib.Circuits.Boolean.Unbounded.multWeight_modMult_mod_ne_zero_iff {N : ℕ} (q : ℕ) (mult : Fin N → ℕ) (x : Fin N → Bool) :
multWeight (fun (i : Fin N) => modMult q (mult i)) x % q ≠ 0 ↔ multWeight mult x % q ≠ 0

Reducing multiplicities with modMult keeps divisibility of the weighted count by q.

def Cslib.Circuits.Boolean.Unbounded.expandIndex {N : ℕ} (r : Fin N → ℕ) (j : Fin (∑ i : Fin N, r i)) :
Fin N

The argument of a symmetric gate read by each of its ∑ i, r i copies.

Repeating the ith argument r i times counts it with multiplicity r i.

A circuit with majority gates for each operation of the basis with MOD_q gates and multiplicities: an operation of the unbounded fan-in basis is one gate, and a MOD_q gate is modCircuitOfMajority on its arguments repeated with their multiplicities reduced by modMult.

The circuit of an operation reading N wires has at most 9 + 8 max q 1 · N gates.

The circuit of an operation has depth at most five.

theorem Cslib.Circuits.Boolean.Unbounded.exists_simulation_modGate {τ : Signature} {J : Interpretation τ Bool} (q : ℕ) (impl : (op : MultOp) → Circuit τ (multSignature.Arity op) 1) (himpl : ∀ (op : MultOp), (impl op).Computes J (single (multInterpretation (modCount q) op))) {S D : ℕ → ℕ} (hS : Monotone S) (hD : Monotone D) (hs : ∀ (op : MultOp), (impl op).size ≤ S (multSignature.Arity op)) (hd : ∀ (op : MultOp), (impl op).depth ≤ D (multSignature.Arity op)) {n m : ℕ} (C : Circuit extSignature n m) :
∃ (E : Circuit τ n m), E.eval J = C.eval (extInterpretation (modGate q)) ∧ E.size ≤ C.size * S (n + C.size) ∧ E.depth ≤ D (n + C.size) * C.depth

Gate-by-gate simulation of MOD_q circuits: suppose every operation of the basis with MOD_q gates and multiplicities that reads a wires has a circuit over τ computing it with at most S a gates and depth at most D a, for monotone S and D. Then a circuit with MOD_q gates of n inputs, s gates and depth d has an equivalent circuit over τ with at most s · S (n + s) gates and depth at most D (n + s) · d. Its gates are first made to read their distinct wires with multiplicities (multCircuit), and then replaced.

Majority gates simulate MOD_q gates Vollmer, Chapter 4: a circuit with MOD_q gates of n inputs, s gates and depth d has an equivalent circuit with majority gates of at most s (9 + 8 max q 1 · (n + s)) gates and depth at most 5 d, replacing the gates of multCircuit C by modMultCircuit.

ACⁱ[q] ⊆ TCⁱ Vollmer, Chapter 4: polynomial-size circuits with MOD_q gates of depth O((log n) ^ i) are simulated by polynomial-size circuits with majority gates of depth O((log n) ^ i).

AC⁰[q] ⊆ TC⁰.