Documentation

Complexity.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 #

def Cslib.Circuits.Boolean.modCircuitOfMajority {n : ℕ} {σ : Signature} (φ : Unbounded.signature.Hom σ) (q : ℕ) (M : Circuit σ (n + (n + 2)) 1) :
Circuit σ n 1

MOD_q from majority: the disjunction, over k ≤ n not divisible by q, of "exactly k bits are true".

Instances For
    theorem Cslib.Circuits.Boolean.size_modCircuitOfMajority_le {n : ℕ} {σ : Signature} {φ : Unbounded.signature.Hom σ} {M : Circuit σ (n + (n + 2)) 1} (q : ℕ) :
    (modCircuitOfMajority φ q M).size ≤ 1 + (n + 1) * (2 * (2 + M.size) + 2)

    MOD_q costs n + 1 circuits for "exactly k" and one disjunction.

    MOD_q is four deeper than the majority circuit.

    The circuit computes MOD_q.

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

    Instances For

      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.

      Instances For
        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.

        Instances For

          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.

          Instances For

            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.

            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. Its gates are first made to read their distinct wires with multiplicities (multCircuit), and then replaced 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⁰.