Skip to Content
Chapter 7

Circuit complexity: The battlefield

Tomas Reimers 15 minute read

In 1949, Claude Shannon (one year after inventing information theory, a decade after his master’s thesis showed Boolean algebra was circuit design) published a paper on switching circuits  containing a result of almost comical asymmetry. With a page of counting, he showed that almost every Boolean function requires exponentially large circuits: hardness isn’t rare, it’s the overwhelming default, a property of essentially every function you could sample at random. And yet (75 years of effort later) nobody has managed to point at a specific, explicitly described function and prove it needs even 4n4n gates. We can prove that hay is everywhere; we cannot certify a single straw. Understanding how both halves of that sentence can be true at once is this chapter’s job, because this is the battlefield on which P vs NP is expected to be decided — and the 1980s campaign fought here, with its victories and its sudden silence, is the direct subject of the barrier theorems in Part IV.

Three steps:

  1. Why circuits — how a question about algorithms becomes a question about hardware, what P/poly is, and why lower-bounding circuit size is the sanctioned route to P ≠ NP.
  2. Shannon’s counting argument, with every number computed, and the maddening gap between “almost all functions are hard” and “this one is.”
  3. The campaign — the real victories (parity, “is the number of 1-inputs odd?”, and monotone circuits), the techniques that won them, and the wall they all hit in 1987, drawn as a map we’ll need again in Chapter 12.

Why circuits: freezing the algorithm

A Boolean circuit is a finite DAG of AND, OR, and NOT gates wired from nn input bits to one output; its size is its gate count. One circuit computes one function of exactly nn bits — to handle all input lengths, you need a family of circuits, C1,C2,C3,…C_1, C_2, C_3, \ldots, one per length. P/poly is the class of problems solved by polynomial-size circuit families, and it relates to P by a simple compilation. Take any poly-time algorithm and fix the input length to nn: Chapter 2’s tableau construction unrolls the machine — every step becomes a layer of gates, with locality keeping each layer’s wiring bounded — and out drops a polynomial-size circuit. So:

P⊆P/poly\mathbf{P} \subseteq \tip{problems with polynomial-size circuit families}{\mathbf{P/poly}}

which yields the strategy that has organized this field for fifty years. If you prove SAT needs super-polynomial circuits, i.e. SAT ∉ P/poly, then SAT ∉ P (P sits inside P/poly, as just shown), and since SAT is in NP, P ≠ NP. The reduction in difficulty is real, because circuits are so much tamer than algorithms: no halting problem, no unbounded memory, no self-reference — just a finite combinatorial object, gates and wires, the kind of thing you count and corner.

Two honest prices for the tameness. First, P/poly is bigger than P, because the circuit family needn’t be computable — nothing demands that anyone can produce CnC_n from nn. P/poly even contains undecidable problems: take an undecidable question about numbers (“does machine number nn halt?”), ask it only of inputs of length nn, and one hardcoded answer bit per length decides it — the question depends only on the input’s length, so CnC_n may ignore its input and output the baked-in constant. Proving SAT outside P/poly is therefore proving something stronger than P ≠ NP: we’re choosing to attack uphill in exchange for finite weapons. The hill isn’t absurd, though: by the Karp–Lipton theorem , if SAT did have polynomial circuits, Chapter 3’s polynomial hierarchy (the believed-strict tower of alternating ∃/∀ classes) would collapse to its second floor, Σ2p\Sigma_2^p — so the field’s working belief is that the stronger statement is true anyway. Second price: a lower bound must now hold against every possible circuit, including ones no human would design — which is exactly what makes the next section’s gap so cruel.

Before the gap, a calibration: you already know one unconditional lower bound, and its fine print is the fine print of this entire Part. Every algorithms course proves sorting needs Ω(nlog⁡n)\Omega(n \log n) comparisons (read Ω\Omega as “at least order of,” big-O’s lower-bound twin): a comparison-only algorithm is a decision tree, each comparison yields one bit, and distinguishing all n!n! input orders needs log⁡2n!\log_2 n! bits. Real theorem, real exponent — inside the model. Radix sort walks around it by refusing to treat keys as opaque, and nobody calls that a paradox; the bound was always a statement about a bottleneck, not about sorting. Every victory in this Part has that exact shape: unconditional against a restricted model (constant depth, no NOT gates, one inference rule), escapable by computation that refuses the restriction. The prize question is always whether the real computer can refuse.

Why not just prove lower bounds on Turing machines directly?

People did, and the complete haul fits in one paragraph. Crossing-sequence arguments (count what must flow across each tape-cell boundary: Chapter 5’s cut-information, vintage 1965, industrialized in Chapter 10) prove a one-tape machine needs Ω(n2)\Omega(n^2) steps to recognize palindromes. Add a second tape and the technique dies. Paul, Pippenger, Szemerédi and Trotter proved in 1983  that nondeterministic linear time strictly exceeds deterministic linear time — a genuine “P ≠ NP in miniature,” won by dissecting the combinatorial structure of multitape computation — and in forty years nobody has extended it past linear. A later line of work by Fortnow, van Melkebeek, and Williams (surveyed here ) shows SAT cannot run in n1.8n^{1.8} time and tiny (no(1)n^{o(1)}) space simultaneously. All true, all unconditional, all weak: local tape dynamics never seem to see the global hardness of SAT. That is why the field re-represents computation as circuits — not to go around the machine, but to expose its structure to counting and algebra.

Counting hay, certifying no straw

Here is Shannon’s argument, with the numbers computed rather than asserted. The functions of nn bits number 22n2^{2^n} — naming one requires, in general, its entire 2n2^n-bit truth table. A circuit, by contrast, is a short description: a size-ss circuit is specified by listing, for each gate, its type and its two input wires. Each wire has at most n+sn + s possible sources and the type is one of a handful — call it 10 options for type-plus-bookkeeping, a deliberately generous constant — so one gate costs log⁡2(10(n+s)2)\log_2(10(n+s)^2) bits and the whole circuit about s⋅log⁡2(10(n+s)2)s \cdot \log_2(10(n+s)^2). (The figure below computes with exactly this formula.) Descriptions are pigeonholes; count them:

inputs n:
bits to name an arbitrary function of 30 inputs (its truth table): 1.07 Gbit
bits to write down any circuit with n³ gates: 0.885 Mbit
descriptions are pigeonholes: 0.885 Mbit of description can distinguish at most 2^884,695 circuits — a 1-in-2^1.1e+9 sliver of all functions. The rest provably need bigger circuits. Name one such function? Nobody can.
Counting, with real numbers: at n = 30, there are 2^(2^n) functions — naming one takes 2^n = 1.07e+9 bits — but every circuit with n³ = 27,000 gates can be written down in about 884,695 bits. The circuits can cover at most 1 in 2^1.1e+9 functions: almost everything is hard. The bars are log-scaled; the true ratio wouldn't fit in the observable universe.

At n=30n = 30: naming an arbitrary function takes 230≈1092^{30} \approx 10^9 bits, but every circuit of size n3=27,000n^3 = 27{,}000 fits in under 900,000 bits of description. The circuits (all of them together) can therefore cover at most a 1-in-21091\text{-in-}2^{10^9} sliver of the functions. Conclusion, fully rigorous: almost every Boolean function requires circuits of nearly maximal size (the tight threshold, by Shannon’s matching upper-bound construction, is ∼2n/n\sim 2^n/n gates). Hardness is not exotic. Sample a truth table by coin flips and you hold, with overwhelming probability, a function no polynomial circuit can compute.

Couldn’t a cleverer notation dodge the count?

No. Any description language built from finitely many symbols (strings, trees, diagrams, circuits of any topology) offers only exponentially many descriptions of each length, so the same pigeonhole bites in every notation; Kolmogorov’s invariance theorem nails it down, showing that switching description languages changes any object’s shortest description by at most an additive constant, the length of a translator between the languages. Incompressibility is language-independent. You cannot diagram your way off the ocean; a representation only chooses which sliver of shoreline it covers.

The argument is a census, though, and a census names no one — it proves hard functions exist by majority without exhibiting a single one. What we need for P ≠ NP is different in kind: an explicit function (SAT, say — computable, describable, in NP) proven hard.

And the census can never be made to name it: the counted majority is hard precisely because those functions have no short description, while SAT is descriptively trivial (a constant-size program enumerates the satisfiable formulas). The very compressibility that lets us ask about SAT exempts it from every argument of the form “most things are hard, so this thing is.” A proof must exploit SAT’s structure, not its randomness; Chapter 12 turns that observation into a theorem about an entire category of techniques. And there the scoreboard, after 75 years, reads: the best size lower bound for any explicit function against general circuits is a shade over 3n3n gates: currently about 3.1n3.1n (Li and Yang, 2022), up from (3+186)n(3 + \frac{1}{86})n in 2016. (The record-holding functions were built to frustrate gate-elimination arguments — the technique behind every linear bound: show any circuit must waste a gate on some input, fix that input, recurse.) Linear, with a small constant, against a target believed to need exponentials. The gap between the counted and the certified is the central empirical fact about P vs NP: hardness is everywhere and proofs of hardness are almost nowhere, a phrasing Chapter 12 will upgrade from irony to mechanism.

Why is certifying one straw so much harder than counting the hay?

Because of what a lower-bound proof must quantify over. To show a specific function ff needs ss gates, you must show every circuit of size ss — all 2Θ(slog⁡s)2^{\Theta(s \log s)} of them, including bizarre, deeply non-human designs — fails on ff somewhere. The counting argument sidesteps this by never engaging with structure: it compares cardinalities and exits. A per-function proof has no such exit; it needs a reason the specific ff resists computation — some measurable resource that every small circuit lacks and ff demands. Chapter 5’s multiplier bound had exactly that shape (information across a cut); the victories below found such resources for restricted circuits. For general circuits, every proposed “resource” has so far either been too weak to exceed ∼3n\sim 3n or (Chapter 12’s punchline) too strong to be computable itself.

The campaign of the 1980s

If general circuits are too hard, restrict them and fight where you can win — the same strategy that made Chapter 5’s OBDD bound possible. The 1980s ran this playbook against two restrictions and produced the genuine triumphs of the field.

Front one: shallow circuits (AC⁰). Restrict depth: constant layers of AND/OR gates with any fan-in (a gate may take unboundedly many inputs — relaxing the two-wire gates above), NOTs free — the shape of a two- or three-level logic array. The weapon is the random restriction: fix most inputs to random constants, leave a few free — zoom into a small random sub-cube of Chapter 2’s Hamming cube — and watch what each function does there:

OR₁₆
→ constant 1 (dead)
PARITY₁₆
→ PARITY₄ (alive)
shaded = fixed to a random bit · bordered = still free
two 16-input functions: OR (true if ANY input is 1) and PARITY (true if an ODD number are 1).
One random restriction (a real sample: 12 of 16 inputs fixed to random bits), two fates. OR collapses to a constant with probability 1 − 2⁻¹² ≈ 99.98% — one fixed 1 kills it. Parity merely shrinks to parity of whatever survives, always, under every restriction. Håstad's switching lemma turns this into the theorem that constant-depth circuits need exponential size for parity.

An OR is glass: one fixed input drawing a 1 shatters it to the constant true, and surviving means all 12 of the figure’s fixed inputs drew 0 — probability 2−122^{-12}, which is why the figure can call its 1−2−12≈99.98%1 - 2^{-12} \approx 99.98\% death rate exact. An AND is glass the same way. So a bounded stack of ANDs and ORs, hit with successive restrictions, keeps collapsing layer by layer — that’s Håstad’s switching lemma (1986), the quantitative engine making “keeps collapsing” a theorem.

But parity is diamond: fix any inputs however you like, and what remains is parity of the free ones — never constant, every surviving input still decisive. A constant-depth circuit computing parity would have to be glass and diamond at once; the resolution is that it can’t be small. Where does size enter? A random restriction flattens each AND-of-ORs layer only with high probability, and a union bound stretches the guarantee across every gate of a small circuit — but not across exponentially many gates. So small constant-depth circuits collapse to constants under restriction while parity never does, and only enormous circuits escape: parity requires AC⁰ circuits of size 2Ω(n1/(d−1))2^{\Omega(n^{1/(d-1)})} at depth dd. Exponential, explicit, unconditional.

For a concrete taste of why depth matters: a depth-2 circuit is just a CNF formula, and each clause forbids a sub-cube of the Hamming cube (false only at settings falsifying all its mentioned literals, the unmentioned variables left free — that free block is the sub-cube). A forbidden sub-cube always contains neighboring corners unless the clause mentions every variable. But parity’s rejected set has no neighbors at all: flip any single bit and the parity flips. So every forbidden sub-cube must be a single corner, a full-width clause, and rejecting all 2n−12^{n-1} even corners takes all 2n−12^{n-1} of them — half a million clauses at 20 inputs, exact, with no cleverness available. Watch the two axes come apart: parity is the easiest of Chapter 2’s razor-edge cases to solve — it’s one XOR equation, Gaussian elimination’s lunch — and the most expensive function in the cube to describe as a CNF. Easy-to-solve and easy-to-describe are different axes, and parity sits at opposite extremes of them.

Why did the campaign aim at parity in constant depth, of all targets?

Because the AC⁰ attack was invented as an oracle-building tool. Furst, Saxe, and Sipser  (1984) introduced it after noticing that constant-depth circuit bounds convert into oracle worlds. The query behavior of a polynomial-hierarchy machine unrolls into a bounded-depth circuit, so parity’s circuit hardness would construct an oracle separating Chapter 3’s hierarchy from PSPACE. The lower bounds strong enough to finish that job came from Yao (1985) and Håstad (1986); and depth-hierarchy separations (each extra AND/OR layer is provably exponentially more powerful than the last, via the Sipser functions) construct oracles where the hierarchy’s floors are all distinct. This chapter’s campaign and Chapter 11’s oracle constructions are the same mathematics in two costumes — a correspondence still paying out: only in 2015  did Rossman, Servedio, and Tan prove the average-case depth hierarchy that finally makes PH infinite relative to a random oracle.

Then the obvious next step: if parity is the diamond, give the circuit parity gates and ask what’s still hard. Razborov  and Smolensky  (1987) answered with a second weapon: approximate every gate by a low-degree polynomial over a finite field (arithmetic mod a small prime), so that the whole shallow circuit agrees with some low-degree polynomial on all but a small fraction of inputs. Then exhibit a target provably far from every low-degree polynomial — MOD₃ (“is the count of 1-inputs divisible by 3?”) plays that role against parity-equipped circuits, and parity plays it against MOD₃-equipped ones. That gave a second exponential bound, for a second explicit function.

Front two: monotone circuits. Different restriction: full depth allowed, but no NOT gates. In 1985 Razborov proved that clique (“does the graph contain kk mutually connected vertices?” — a monotone function: adding edges never destroys a clique, and any such monotone function is computable by a monotone circuit (OR over the patterns that force a yes), so the restriction is fair and the size question is fair) needs super-polynomial monotone circuits  (soon sharpened to exponential) — a lower bound against an NP-complete problem, with no depth crutch. For one giddy moment this looked like the eve of P ≠ NP: surely NOT gates (which hardware designers barely miss) couldn’t be the difference between exponential and polynomial? It turned out they could be exactly that. Razborov himself then showed perfect matching (a problem squarely in P) also requires super-polynomial monotone circuits, and Tardos exhibited a monotone-vs-general gap that is fully exponential . Monotone hardness says nothing about real hardness; NOT gates are, against all intuition, a superpower. The weapon itself remained interesting — Razborov’s “approximation method” shares with Smolensky’s the shape replace the circuit by a simpler object, then show the target function is far from every simple object — but the road it seemed to open was a painted tunnel.

The map below shows every front, and where each stalled:

AC⁰constant depth, AND/OR/NOT✕ parity excluded — Håstad 1986
AC⁰[p]+ MOD-p counting gates✕ MOD-q excluded — Razborov–Smolensky 1987
THE WALL — 1987
ACC⁰+ MOD-m gates, any fixed mheld out for 24 years… (Chapter 13)
TC⁰+ majority gates (≈ a neural net layer)no superpolynomial bounds known
NC¹log-depth, fan-in 2open
P/polyall polynomial-size circuits — the targetrecord for an explicit function: ~3.1n gates
The restricted-circuit ladder, weakest class at top. The 1980s campaign cleared the first two rungs with random restrictions and polynomial approximations — then stalled for a generation exactly at ACC⁰ (even 'constant depth with mod-6 gates' resisted until 2011, and what broke it is Chapter 13's story). Against the real target, P/poly, the best size bound ever proven for an explicit function is barely above 3n gates.

Study where the campaign stopped. After 1987: parity-with-MOD₆-gates (ACC⁰, constant depth, counting gates for a composite modulus) resisted every technique for twenty-four years (its eventual fall, by a completely different kind of argument, is Chapter 13’s centerpiece). TC⁰ — constant-depth majority gates, which is to say something shaped like a neural network layer — nothing beyond barely superlinear bounds. And against unrestricted P/poly, the 3n3n record stands.

The abruptness is the clue. The same researchers, with the techniques that had just produced exponential bounds, all stopped at the same line within a few years. When a diverse arsenal fails at a common boundary, suspect a reason — a property shared by every weapon in it. The switching lemma and the polynomial method share one: each works by defining a measurable notion of “simple-looking” (collapses under restriction; near a low-degree polynomial), showing all small circuits are simple-looking, and showing the target isn’t. Hold that abstraction up to the light and ask: that test of simple-looking-ness — how expensive is it to run, and how many functions fail it? The answers turn out to form a theorem (proven by Razborov himself, with Rudich) that the entire arsenal of this chapter is structurally incapable of reaching P/poly, for a reason involving, of all things, cryptography. That’s Chapter 12, and we’ll reach it through two more pieces of the campaign: the war on proof length (Chapter 8), and the strange graphs that keep appearing wherever explicit hardness is manufactured (Chapter 9).

Further reading

Last updated on