Documentation

Complexity.Computability.Circuit.Boolean.Parity

Circuits for parity #

Chaining x ⊕ y = (x ∨ y) ∧ ¬(x ∧ y) computes the parity of n + 1 bits with 4 n De Morgan gates, 3 n of them AND or OR gates (exists_computes_parity) Jukna, Section 1.6. The number of binary gates is optimal by Schnorr's bound, Cslib.Circuits.Boolean.three_mul_le_cost_of_computes_parity.

Main definitions #

Main results #

References #

Append u ⊕ v = (u ∨ v) ∧ ¬(u ∧ v) to a De Morgan program: four gates, three of them binary, the last of which computes the exclusive or of the wires u and v.

Instances For
    def Cslib.Circuits.Boolean.parityProgram {n : ℕ} (k : ℕ) :
    k < n → Program signature n (4 * k) × Wire n (4 * k)

    A De Morgan program computing the parity of the bits 0, …, k, and its output wire: 4 k gates, 3 k of them binary.

    Instances For

      Parity has circuits with 3 n binary gates. The parity of n + 1 bits has a De Morgan circuit with 3 n AND and OR gates, which matches Schnorr's lower bound, and 4 n gates in all.

      The parity of no bits is computed by one constant gate, which is not binary.

      The circuit complexity of the parity of n + 1 bits is at most 4 n.