Documentation

Complexity.Computability.Circuit.Boolean.Majority

Parity reduces to majority in constant depth #

Over a basis containing the unbounded fan-in basis (through a meaning-preserving map φ), padding the input with constants turns a circuit for majority on 2 n + 2 bits into every threshold function on n bits (thresholdCircuitOfMajority), two thresholds give "exactly k bits are true" (exactlyCircuitOfMajority), and parity is the disjunction of these for odd k (parityCircuitOfMajority) [CSV84]. The circuit for parity has depth 4 more and size polynomially larger than the circuit for majority, so if majority has polynomial-size constant-depth circuits then so does parity (ConstDepth.parity_mem_of_majority_mem). Over the unbounded fan-in basis itself this contradicts Cslib.Circuits.Boolean.parity_notMem_AC0: majority is not in AC⁰ [FSS84].

Main definitions #

Main results #

References #

def Cslib.Circuits.Boolean.padCircuit {σ : Signature} (φ : Unbounded.signature.Hom σ) (n a : ℕ) :
Circuit σ n (n + (n + 2))

The inputs followed by a copies of true and then copies of false, n + 2 constants in all, read from two constant gates.

Instances For
    def Cslib.Circuits.Boolean.thresholdCircuitOfMajority {n : ℕ} {σ : Signature} (φ : Unbounded.signature.Hom σ) (M : Circuit σ (n + (n + 2)) 1) (k : ℕ) :
    Circuit σ n 1

    The threshold function Th^n_k for k ≤ n + 1, from a circuit M for majority on n + (n + 2) bits.

    Instances For
      def Cslib.Circuits.Boolean.exactlyCircuitOfMajority {n : ℕ} {σ : Signature} (φ : Unbounded.signature.Hom σ) (M : Circuit σ (n + (n + 2)) 1) (k : ℕ) :
      Circuit σ n 1

      Whether exactly k of the bits are true, from a circuit for majority.

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

        Parity from majority: the disjunction, over odd k ≤ n, of "exactly k bits are true".

        Instances For
          @[simp]

          Padding costs two gates, one for each constant.

          Padding has depth at most one.

          A threshold costs the padding and the majority circuit.

          A threshold is one deeper than the majority circuit.

          theorem Cslib.Circuits.Boolean.size_exactlyCircuitOfMajority {n : ℕ} {σ : Signature} {φ : Unbounded.signature.Hom σ} {M : Circuit σ (n + (n + 2)) 1} (k : ℕ) :
          (exactlyCircuitOfMajority φ M k).size = 2 * (2 + M.size) + 2

          "Exactly k" costs two thresholds and two gates.

          "Exactly k" is three deeper than the majority circuit.

          theorem Cslib.Circuits.Boolean.size_parityCircuitOfMajority_le {n : ℕ} {σ : Signature} {φ : Unbounded.signature.Hom σ} {M : Circuit σ (n + (n + 2)) 1} :
          (parityCircuitOfMajority φ M).size ≤ 1 + (n + 1) * (2 * (2 + M.size) + 2)

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

          Parity is four deeper than the majority circuit.

          theorem Cslib.Circuits.Boolean.eval_padCircuit {n : ℕ} {σ : Signature} {φ : Unbounded.signature.Hom σ} {I : Interpretation σ Bool} [φ.Preserves Unbounded.interpretation I] (a : ℕ) (x : BitString n) :
          (padCircuit φ n a).eval I x = Fin.append x fun (j : Fin (n + 2)) => decide (↑j < a)
          theorem Cslib.Circuits.Boolean.eval_thresholdCircuitOfMajority {n : ℕ} {σ : Signature} {φ : Unbounded.signature.Hom σ} {I : Interpretation σ Bool} {M : Circuit σ (n + (n + 2)) 1} [φ.Preserves Unbounded.interpretation I] (hM : M.Computes I (single (majority (n + (n + 2))))) {k : ℕ} (hk : k ≤ n + 1) (x : BitString n) :

          The threshold circuit computes the threshold function.

          theorem Cslib.Circuits.Boolean.eval_exactlyCircuitOfMajority {n : ℕ} {σ : Signature} {φ : Unbounded.signature.Hom σ} {I : Interpretation σ Bool} {M : Circuit σ (n + (n + 2)) 1} [φ.Preserves Unbounded.interpretation I] (hM : M.Computes I (single (majority (n + (n + 2))))) {k : ℕ} (hk : k ≤ n) (x : BitString n) :

          The circuit for "exactly k" decides whether exactly k bits are true.

          The parity circuit computes parity.

          Parity reduces to majority: over a basis containing the unbounded fan-in basis, parity has polynomial-size constant-depth circuits if majority does.