Documentation

CslibFrontier.Computability.Circuit.Boolean.Hierarchy

The circuit size hierarchy #

Changing one value of a Boolean function on n inputs changes its circuit complexity by at most 2 n + 3 (complexity_update_le). Walking from a constant function, which costs exactly one gate (complexity_const), to a hard one, one value at a time, the complexity therefore takes every value up to the complexity of the hard function, up to 2 n + 3 (exists_complexity_mem_Ioc). With Shannon's lower bound [Sha49], every size below 2 ^ n / n is the complexity of some function, up to 2 n + 3, and so more gates allow strictly more languages (SIZE_ssubset). Walking from a constant function to any function f shows that f costs at most 2 ^ n (2 n + 3) + 1 gates (complexity_le_two_pow_mul_add_one).

Main results #

References #

Changing one value of a Boolean function costs at most 2 n + 3 gates.

theorem Cslib.Circuits.Boolean.complexity_ite_mem_le {n : ℕ} (f : BooleanFunction n) (S : Finset (Fin n → Bool)) (c : Bool) :
complexity interpretation (single fun (x : Fin n → Bool) => if x ∈ S then f x else c) ≤ S.card * (2 * n + 3) + 1

Finite override of a constant. Returning f x on a finite set S and the constant c outside S costs at most #S * (2 * n + 3) + 1 gates: start from the constant c and change one value in S at a time.

theorem Cslib.Circuits.Boolean.complexity_mask_le {n : ℕ} (f : BooleanFunction n) (S : Finset (Fin n → Bool)) :
complexity interpretation (single fun (x : Fin n → Bool) => decide (x ∈ S) && f x) ≤ S.card * (2 * n + 3) + 1

Restricting a Boolean function f to S and returning false outside S costs at most #S * (2 * n + 3) + 1 gates (complexity_ite_mem_le with the constant false).

The truth-table bound. A Boolean function on n inputs costs at most 2 ^ n * (2 * n + 3) + 1 gates: start from a constant and change one value at a time.

A Boolean function that depends only on the inputs in s costs at most 2 ^ #s * (2 * #s + 3) + 1 gates.

A constant function costs exactly one gate: a circuit without gates outputs an input.

Every complexity below that of a given function is exceeded by at most 2 n + 3 by the complexity of some function.

theorem Cslib.Circuits.Boolean.SIZE_ssubset {s t : ℕ → ℕ} (hst : s ≤ t) (ht : ∀ (n : ℕ), 1 ≤ t n) (hgap : ∀ᶠ (n : ℕ) in Filter.atTop, s n + (2 * n + 3) ≤ t n) (hs : ∃ᶠ (n : ℕ) in Filter.atTop, ↑(s n) < 2 ^ n / ↑n) :
SIZE s ⊂ SIZE t

The circuit size hierarchy. If s ≤ t, t is positive, eventually s n + 2 n + 3 ≤ t n, and infinitely often s n < 2 ^ n / n, then some language has circuits of size t but not of size s.

theorem Cslib.Circuits.Boolean.SIZE_pow_ssubset {k : ℕ} (hk : 1 ≤ k) :
(SIZE fun (n : ℕ) => (n + 1) ^ k) ⊂ SIZE fun (n : ℕ) => (n + 1) ^ (k + 1)

The polynomial size hierarchy. For k ≥ 1, circuits of size (n + 1) ^ (k + 1) decide strictly more languages than circuits of size (n + 1) ^ k.

theorem Cslib.Circuits.Boolean.SIZE_sub_ssubset_of_isLittleO {T T' : ℕ → ℕ} (hT : ∀ (n : ℕ), n < T n) (hTT' : ∀ (n : ℕ), T n < T' n) (hT' : ∀ᶠ (n : ℕ) in Filter.atTop, ↑(T' n) < 2 ^ n / (100 * ↑n)) (hlog : (fun (n : ℕ) => ↑(T n) * Real.log ↑(T n)) =o[Filter.atTop] fun (n : ℕ) => ↑(T' n)) :
(SIZE fun (n : ℕ) => T n - n) ⊂ SIZE fun (n : ℕ) => T' n - n

The circuit size hierarchy under the draft's hypotheses [AroraBarak07, Theorem 6.17]. If n < T n < T' n for every n, eventually T' n < 2 ^ n / (100 n), and T log T = o(T'), then circuits with T' n vertices decide strictly more languages than circuits with T n vertices.

The draft counts the n input vertices in the size of a circuit, so its SIZE (T(n)) is SIZE (fun n => T n - n) here, under the convention of SIZE: the library's circuits may also use constant gates and need no separate output vertex. The cap 2 ^ n / (100 n) > T'(n) is read eventually, as is standard for asymptotic hypotheses: the literal every-n reading cannot hold for n ≤ 14 and would make the theorem vacuous. The other two bounds are assumed for every n, as printed. The proof reduces to SIZE_ssubset: T log T = o(T') gives the gap of 2 n + 3 gates, and the draft's bound keeps T below Shannon's 2 ^ n / n.