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 #
Cslib.Circuits.Boolean.parityProgram: a De Morgan program for the parity of the first bits.
Main results #
Cslib.Circuits.Boolean.exists_computes_parity: the parity ofn + 1bits has circuits with3 nbinary gates and4 ngates in all.Cslib.Circuits.Boolean.complexity_parity_le: its circuit complexity is at most4 n.
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
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.