Documentation

LeanPool.CircuitComplexity.Nondeterminism

Nondeterministic Circuit Complexity Bounds #

Upper bounds on the circuit complexity of existentially quantified Boolean functions.

Given f : BitString (k + m) → Bool, the existential quantification existQuantify f : BitString m → Bool is defined by g(y) = ∃ x ∈ {0,1}^k, f(x ++ y). This models a nondeterministic circuit that guesses the first k input bits.

Definitions (from Circ.Nondeterminism.Defs) #

Main results #

The naive bound is tighter when k is small and f has low complexity; the Shannon bound wins when k is large, regardless of f's complexity.

k + m ≥ 1 whenever m ≥ 1. Enables sizeComplexity on BitString (k + m).

Building-block bounds #

Hardwiring one input does not increase fan-in-2 AND/OR circuit complexity.

Given a circuit of size s computing f, we modify each gate in-place (via restrictGateP): any input that referenced the hardwired variable is redirected using the gate's negation flags to produce the correct constant, without adding extra gates. See Circ.Internal.Nondeterminism for the construction.

The OR of two Boolean functions has circuit complexity bounded by the sum of their individual complexities plus one (for the OR output gate).

Uses ShannonUpper.binopCircuit to compose two circuits side-by-side.

Transport lemma for the base case #

Main results #

Naive upper bound for existential quantification.

If f : BitString (k + m) → Bool has fan-in-2 AND/OR circuit complexity s, then existQuantify f : BitString m → Bool has circuit complexity at most 2^k · (s + 1).

Proof. By induction on k. We prove the tighter statement sizeComplexity + 1 ≤ 2^k · (s + 1), which absorbs the OR-gate overhead at each step.

  • Base case (k = 0): existQuantify is the identity (up to a transport along 0 + m = m), so complexity is preserved.

  • Inductive step (k → k + 1): existQuantify (k+1) f factors as (existQuantify k (f|₀)) OR (existQuantify k (f|₁)) via existQuantify_succ. Restriction preserves complexity; the OR adds one gate; and the inductive hypothesis bounds each branch by 2^k · (s + 1) − 1. After the "+1 trick": (size₁ + size₂ + 1) + 1 = (size₁ + 1) + (size₂ + 1) ≤ 2^(k+1) · (s + 1).

Shannon upper bound for existential quantification.

The quantified function existQuantify f : BitString m → Bool is just an m-input Boolean function, so the Shannon upper bound applies unconditionally. Even if f has exponential circuit complexity, existQuantify f has complexity at most O(2^m / m), which decreases exponentially as more variables are quantified away.

Combined upper bound: the minimum of the naive and Shannon bounds.

When sizeComplexity(f) ≈ 2^(k+m)/2, the Shannon bound 18 · 2^m / m is exponentially better than the naive 2^k · (s + 1), especially for large k.