Documentation

Complexitylib.Circuits.Shannon

Shannon Bounds #

For N ≥ 6, there exists a Boolean function on N inputs that cannot be computed by any fan-in-2 AND/OR circuit with fewer than 2^N / (5N) gates.

The proof proceeds by a counting (pigeonhole) argument: the number of distinct circuits of a given size is strictly less than the number of Boolean functions, so some function must be hard.

Main results #

The main theorem is shannon_lower_bound_circuit:

theorem shannon_lower_bound_circuit (N : Nat) [NeZero N] (hN : 6 ≤ N) :
    ∃ f : BitString N → Bool,
      ∀ G (c : Circuit Basis.andOr2 N 1 G),
        c.size ≤ 2 ^ N / (5 * N) →
        (fun x => (c.eval x) 0) ≠ f

The statement uses the library's total Circuit.size; for a single-output circuit this is G + 1.

When Basis.andOr2 is known to be complete, this yields a sizeComplexity bound via shannon_sizeComplexity.

Together these establish that worst-case circuit complexity is Θ(2^N / N).

theorem Complexity.shannon_lower_bound_circuit (N : ) [NeZero N] (hN : 6 N) :
∃ (f : BitString NBool), ∀ (G : ) (c : Circuit Basis.andOr2 N 1 G), c.size 2 ^ N / (5 * N) → (fun (x : BitString N) => c.eval x 0) f

Shannon lower bound for circuits: for N ≥ 6, there exists a Boolean function on N inputs that cannot be computed by any fan-in-two AND/OR circuit of total size at most 2^N / (5N).

For a single-output circuit, c.size = G + 1.

Shannon lower bound in terms of sizeComplexity: for N ≥ 6, there exists a Boolean function whose fan-in-2 AND/OR circuit complexity exceeds 2^N / (5N).

Shannon upper bound: for N ≥ 16, every Boolean function on N inputs has fan-in-2 AND/OR circuit complexity at most 18 · 2^N / N.

Combined with shannon_sizeComplexity, this gives Θ(2^N / N).

This is the full-column-library variant (C = 18). The tighter (1 + o(1)) · 2^N / N bound due to Lupanov (1958) uses column grouping and is not yet formalized.