Internal: Shannon Upper Bound Construction #
The Shannon (1949) upper bound: every Boolean function on N variables
can be computed by a fan-in-2 AND/OR circuit of size at most C * 2^N / N,
for a fixed constant C and all sufficiently large 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.
Construction #
Split N inputs into k = ⌊log₂ N⌋ - 1 address variables and
q = N - k data variables. Decompose any f : {0,1}^N → {0,1} as
f(a,y) = ⋁ᵧ [mintermᵧ(data) ∧ colᵧ(addr)] where colᵧ(a) = f(a,y).
Build shared minterm trees for both variable groups, a pattern library
for column functions, AND/OR combining layers. Total ≤ 18 · 2^N / N
gates for N ≥ 16.
Parameters #
Number of address variables: ⌊log₂ N⌋ - 1.
Equations
Instances For
Number of data variables: N - addrBits N.
Instances For
Gate Construction Helpers #
Binary Circuit Composition #
Compose two circuits with a binary AND/OR.
Equations
- One or more equations did not get rendered due to their size.
Instances For
binopCircuit correctly computes the OR of two circuits' outputs.
The output gate of binopCircuit applies OR to wires N + G₁ and
N + G₁ + G₂ + 1, which replicate the output gates of c₁ and c₂.
The proof shows that wire values in the combined circuit agree with
wire values in the original circuits (via binop_wireValue_c₁ and
binop_wireValue_c₂), then combines.
Arithmetic #
Nat.log helpers #
Key identities #
N² ≤ 2^N for N ≥ 16 #
Term-by-term bounds #
Circuit Construction #
Gate construction helper #
Circuit layout #
Section offsets (not private so they can be unfolded after set) #
Cumulative gate offset after Section C of the construction.
Instances For
Cumulative gate offset after Section D of the construction.
Equations
- CircuitComplexity.ShannonUpper.oD kk qq = CircuitComplexity.ShannonUpper.oC qq + (2 ^ (kk + 1) - 4)
Instances For
Cumulative gate offset after Section E of the construction.
Equations
- CircuitComplexity.ShannonUpper.oE kk qq = CircuitComplexity.ShannonUpper.oD kk qq + 2 ^ 2 ^ kk * (2 ^ kk - 1)
Instances For
Cumulative gate offset after Section F of the construction.
Equations
- CircuitComplexity.ShannonUpper.oF kk qq = CircuitComplexity.ShannonUpper.oE kk qq + 2 ^ qq
Instances For
Power-of-2 helpers #
Minterm tree level #
The level (depth from the root) of node j in the selection tree.
Equations
- CircuitComplexity.ShannonUpper.treeLevel j = Nat.log 2 (j + 4) - 1
Instances For
The index of the first node at level l of the selection tree.
Equations
- CircuitComplexity.ShannonUpper.treeBase l = 2 ^ (l + 1) - 4
Instances For
The position of node j within its level of the selection tree.
Equations
Instances For
The index of the parent of a node at level l, position m.
Equations
- CircuitComplexity.ShannonUpper.treeParentIdx l m = CircuitComplexity.ShannonUpper.treeBase (l - 1) + m % 2 ^ l
Instances For
Column pattern encoding #
The Boolean function selecting the addressed column of f. The hypothesis
hkq : k + q = N records that the address and data bits partition the inputs.
Equations
Instances For
The pattern index of the addressed column of f.
Equations
- CircuitComplexity.ShannonUpper.colPatIdx N f k q hkq y = CircuitComplexity.ShannonUpper.encodeCol k (CircuitComplexity.ShannonUpper.colFun N f k q hkq y)
Instances For
Shannon gate array #
Correctness #
colFun reconstruction lemma #
Circuit correctness #
OR chain induction #
The deep wireValue unfolding through all 6 sections (required for
wireValue_andLayer_sem) and the gate array branch analysis make this
the most technically challenging part of the formalization.