Khrapchenko's bound #
Khrapchenko's theorem says that a De Morgan formula (see
Complexity/Computability/Circuit/Boolean/Formula.lean) that
is true on a set A of inputs and false on a set B has leaf size at least
|E(A, B)| ^ 2 / (|A| |B|), where E(A, B) are the pairs of A × B at Hamming distance one
(Formula.sq_card_hammingEdges_le, stated without division) [Khr71b],
Jukna, Section 6.8. An input leaf can only separate along its own coordinate, so its
edges form a matching; a binary gate splits one side, and the Cauchy–Schwarz inequality makes the
measure subadditive; a negation exchanges the sides.
If every input of A has at least s₁ neighbors in B and every input of B has at least s₀
neighbors in A, a formula separating them has leaf size at least s₀ s₁
(Formula.mul_le_leafSize). So "at least k of n bits" needs leaf size k (n + 1 - k)
(mul_le_leafSize_of_computes_threshold) and majority needs leaf size ⌊(n + 1) ^ 2 / 4⌋
(sq_div_four_le_leafSize_of_computes_majority) [Khr71b], and the parity of n bits,
which changes with every bit, needs leaf size n ^ 2 (sq_le_leafSize_of_computes_parity)
[Khr71a].
Splitting the bits in halves, x ⊕ y = (x ∧ ¬y) ∨ (¬x ∧ y) gives formulas of leaf size exactly
n ^ 2 when n is a power of two (isLeast_leafSize_parity_two_pow).
Since a formula of depth d has at most 2 ^ d leaves, formulas for parity have depth at least
2 log₂ n (two_mul_log_le_depth_of_computes_parity). Here the depth counts negations; for the
textbook bound, where negations are free, see
Complexity/Computability/Circuit/Boolean/KhrapchenkoDepth.lean: the
formula depth of the parity of 2 ^ k bits is exactly 2 k (formulaDepth_parity_two_pow).
Main definitions #
Cslib.Circuits.Boolean.parityFormula: formulas for parity of leaf size4 ^ kon2 ^ kbits.
Main results #
Cslib.Circuits.Formula.sq_card_hammingEdges_le: Khrapchenko's bound.Cslib.Circuits.Formula.mul_le_leafSize: the bound in terms of neighbor counts.Cslib.Circuits.Boolean.mul_le_leafSize_of_computes_threshold: formulas for the threshold functionTh^n_khave leaf size at leastk (n + 1 - k).Cslib.Circuits.Boolean.sq_div_four_le_leafSize_of_computes_majority: formulas for the majority ofnbits have leaf size at least⌊(n + 1) ^ 2 / 4⌋.Cslib.Circuits.Boolean.sq_le_leafSize_of_computes_parity: formulas for parity have leaf size at leastn ^ 2.Cslib.Circuits.Boolean.isLeast_leafSize_parity_two_pow: the least leaf size of a formula for the parity of2 ^ kbits is(2 ^ k) ^ 2.
References #
Khrapchenko's theorem #
Khrapchenko's bound. A De Morgan formula that is true on A and false on B has leaf
size at least |E(A, B)| ^ 2 / (|A| |B|), where E(A, B) are the pairs at Hamming distance
one.
If every input of a nonempty A has at least s₁ neighbors in B and every input of B has
at least s₀ neighbors in A, a De Morgan formula that is true on A and false on B has leaf
size at least s₀ s₁.
Threshold functions #
Khrapchenko's bound for threshold functions. A De Morgan formula computing "at least k of
the n bits are true" has leaf size at least k (n + 1 - k).
Khrapchenko's bound for majority. A De Morgan formula computing the majority of n bits
has leaf size at least ⌊(n + 1) ^ 2 / 4⌋ = ⌊(n + 1) / 2⌋ ⌈(n + 1) / 2⌉.
Parity #
Formulas for parity #
The parity of the a + b consecutive bits from o on is the exclusive or of the parities of
the first a and the last b of them.
The formula parityFormula k o computes the parity of the 2 ^ k bits from o on.
The formula parityFormula k o has leaf size 4 ^ k.