Simple Algorithm
Algorithms & Data Structures · Optimal · 28 min

P vs NP: Barriers & Beyond

Relativization, natural proofs, algebrization, and what is actually known.

Nearly nine in ten researchers believe that P ≠ NP, and some of the strongest mathematicians alive have tried to prove it. Why has no one succeeded? Not only because the question is hard: whole families of proof techniques have been proved unable to settle it, and any proof must slip past three such barriers at once.

What you’ll learn

  • State what is known unconditionally: hierarchy theorems, counting bounds, and lower bounds for restricted circuit models (constant depth, monotone, ACC⁰).
  • State and prove the relativization barrier of Baker, Gill and Solovay, including the diagonal construction of an oracle that separates P from NP.
  • Explain the natural-proofs and algebrization barriers, and why Williams's lower bound for ACC⁰ circuits evades all three.
  • Use Ladner's theorem, the polynomial hierarchy and the 2025 simulation of time in square-root space to say what is, and is not, implied about P versus NP.

What is known

To prove P≠NP\mathrm{P} \ne \mathrm{NP} is to prove a lower bound: that no polynomial-time algorithm decides SAT. Lower bounds are where complexity theory is weakest. What it can prove falls into two groups.

Diagonalization. The time hierarchy theorem (Hartmanis & Stearns, 1965) shows that more time decides strictly more problems, so P≠EXP\mathrm{P} \ne \mathrm{EXP}; the space hierarchy theorem gives L≠PSPACE\mathrm{L} \ne \mathrm{PSPACE}, and a nondeterministic version gives NP≠NEXP\mathrm{NP} \ne \mathrm{NEXP}. These separate classes with very different resources, never P from NP.

Circuits. A P vs NP proof could go through circuits: if SAT needs Boolean circuits of superpolynomial size, then P≠NP\mathrm{P} \ne \mathrm{NP}, because every polynomial-time algorithm can be turned into polynomial-size circuits. Shannon (1949) counted circuits and showed that almost every Boolean function of nn inputs needs about 2n/n2^n / n gates. Yet for any explicit function in NP, the best lower bound known for general circuits is only about 3.1 n3.1\,n gates (Li & Yang, 2022), barely above the 3n3n known since the 1980s.

ModelWhat is provedWho
deterministic timeP≠EXP\mathrm{P} \ne \mathrm{EXP}Hartmanis & Stearns, 1965
circuits, almost all functionssize about 2n/n2^n / nShannon, 1949
circuits, explicit functions in NPabout 3.1 n3.1\,n gatesLi & Yang, 2022
constant depth dd (AC⁰)parity needs size exp⁡(Ω(n1/(d−1)))\exp\big(\Omega(n^{1/(d-1)})\big)Furst, Saxe & Sipser; Ajtai; Håstad, 1981–1986
monotone circuits (AND, OR, no NOT)detecting a kk-clique needs size nΩ(k)n^{\Omega(\sqrt{k})}; exponential for large kkRazborov, 1985; Alon & Boppana, 1987
constant depth with counting gates (ACC⁰)NEXP⊈ACC0\mathrm{NEXP} \not\subseteq \mathrm{ACC}^0, later extended to quasi-polynomial nondeterministic timeWilliams, 2011; Murray & Williams, 2018
Strong bounds exist only for restricted models; for general circuits the gap between 3.1 n3.1\,n and "superpolynomial" is the whole problem.
Check your understanding

Monotone circuits for clique need superpolynomial size. Why does that not prove P ≠ NP?

  1. Because clique is not NP-complete
  2. Because monotone lower bounds do not transfer to general circuits: perfect matching, which is in P, also needs superpolynomial monotone circuits
  3. Because the bound holds only for cliques of size 3
  4. Because circuit lower bounds say nothing about algorithms
Show the answer

B. Because monotone lower bounds do not transfer to general circuits: perfect matching, which is in P, also needs superpolynomial monotone circuits

Razborov (1985) showed that perfect matching, a problem in P, needs monotone circuits of size nΩ(log⁡n)n^{\Omega(\log n)}, and Tardos (1988) found a problem in P that needs exponential monotone circuits. Forbidding NOT gates can blow circuits up enormously, so monotone hardness says nothing about general circuits.

Relativization

DerivationProof
  1. NPA  ⊆  NPSPACE  =  PSPACE  ⊆  PA  ⊆  NPA\mathrm{NP}^A \;\subseteq\; \mathrm{NPSPACE} \;=\; \mathrm{PSPACE} \;\subseteq\; \mathrm{P}^A \;\subseteq\; \mathrm{NP}^A

    An oracle that collapses. Let AA be a PSPACE-complete language, such as true quantified Boolean formulas. A nondeterministic machine with oracle AA can be simulated in polynomial space, answering its queries itself, and nondeterministic polynomial space equals PSPACE (Savitch). Every PSPACE problem is then one query to AA away:

  2. LB  =  { 1n:B∩{0,1}n≠∅ }  ∈  NPBL_B \;=\; \{\,1^n : B \cap \{0,1\}^n \ne \varnothing\,\} \;\in\; \mathrm{NP}^B

    A test language for BB. For any oracle BB, let LBL_B contain the strings 1n1^n such that BB contains some string of length nn. A nondeterministic machine guesses such a string and asks the oracle:

  3. MiB(1n) accepts  ⟺  1n∉LBM_i^B(1^n) \text{ accepts} \iff 1^n \notin L_B

    Diagonalize against every polynomial-time machine. List the deterministic oracle machines M1,M2,…M_1, M_2, \dots, with MiM_i running in time nin^i. At stage ii, pick nn larger than every length used so far, with 2n>ni2^n > n^i, and run MiM_i on 1n1^n, answering "no" to every query not yet decided. If MiM_i accepts, put no string of length nn into BB. If it rejects, put into BB one string of length nn that MiM_i never asked about, which exists since it asked fewer than 2n2^n questions.

  4. LB  ∈  NPB∖PBL_B \;\in\; \mathrm{NP}^B \setminus \mathrm{P}^B

    Later stages only add strings longer than any query made so far, so MiM_i's run, and its wrong answer, survive. No polynomial-time machine with oracle BB decides LBL_B:

Diagonalization and simulation, the engines of the hierarchy theorems, treat machines as black boxes, so their proofs relativize. A relativizing proof of P≠NP\mathrm{P} \ne \mathrm{NP} would also prove PA≠NPA\mathrm{P}^A \ne \mathrm{NP}^A, contradicting the first oracle; a relativizing proof of P=NP\mathrm{P} = \mathrm{NP} would contradict the second. Any resolution must use techniques that do not relativize.

Such techniques exist. IP=PSPACE\mathrm{IP} = \mathrm{PSPACE} (Lund, Fortnow, Karloff & Nisan; Shamir, 1990), which says that interactive proofs capture polynomial space, fails relative to some oracle. Its key idea, arithmetization, replaces Boolean formulas by low-degree polynomials over a field and looks inside the computation instead of treating it as a black box.

Natural proofs and algebrization

DerivationProof sketch: a natural proof would break cryptography
  1. Pr⁡s[ fs∈Γ ]  =  0\Pr_s\big[\, f_s \in \Gamma \,\big] \;=\; 0

    Pseudorandom functions lack the property. Fix all but n=kε/2n = k^{\varepsilon/2} input bits of fsf_s. The resulting functions on nn bits still have circuits of size polynomial in kk, hence in nn, so a property useful against P/poly excludes them all:

  2. Pr⁡f[ f∈Γ ]  ≥  2−O(n)\Pr_f\big[\, f \in \Gamma \,\big] \;\ge\; 2^{-O(n)}

    Random functions have it. By largeness, a uniformly random function on nn bits has the property with probability at least 2−O(n)2^{-O(n)}:

  3. size 2O(kε/2)≪2kε,advantage 2−O(kε/2)≫2−kε\text{size } 2^{O(k^{\varepsilon/2})} \ll 2^{k^{\varepsilon}}, \qquad \text{advantage } 2^{-O(k^{\varepsilon/2})} \gg 2^{-k^{\varepsilon}}

    The property becomes a distinguisher. By constructivity, testing membership takes time polynomial in 2n2^n, which is 2O(kε/2)2^{O(k^{\varepsilon/2})}, far below 2kε2^{k^{\varepsilon}}, and its advantage 2−O(kε/2)2^{-O(k^{\varepsilon/2})} is far above 2−kε2^{-k^{\varepsilon}}. That breaks the family's security, a contradiction:

Razborov and Rudich observed that the known circuit lower bounds, including the AC⁰ bounds for parity, are natural. That is why they stop at restricted models: functions computed in AC⁰ are too simple to be pseudorandom, so natural properties can work there, but not against general circuits, if cryptography is secure.

Algebrization (Aaronson & Wigderson, 2009) addresses the techniques that escaped relativization. A proof algebrizes if it stays valid when one machine gets an oracle AA and the other gets A~\tilde{A}, a low-degree polynomial extension of AA over a field: exactly the extra access that arithmetization uses. The known non-relativizing results, such as IP=PSPACE\mathrm{IP} = \mathrm{PSPACE}, algebrize, and Aaronson and Wigderson built oracle pairs showing that algebrizing techniques can settle neither P versus NP nor many related questions.

Between P and NP-complete, and what is at stake

DerivationProof sketch: SAT with slowly growing padding
  1. SATH  =  { ψ 0 1 nH(n)  :  ψ∈SAT, n=∣ψ∣ }\mathrm{SAT}_H \;=\; \big\{\, \psi\,0\,1^{\,n^{H(n)}} \;:\; \psi \in \mathrm{SAT},\ n = \abs{\psi} \,\big\}

    The language. Let M1,M2,…M_1, M_2, \dots list all Turing machines. Define H(n)H(n) as the smallest i<log⁡log⁡ni < \log\log n such that MiM_i decides SATH\mathrm{SAT}_H correctly on every input of length at most log⁡n\log n within i ∣x∣ii\,\abs{x}^i steps, or log⁡log⁡n\log\log n if there is none, and pad SAT accordingly. Checking only inputs of length up to log⁡n\log n keeps HH computable in polynomial time, and SATH∈NP\mathrm{SAT}_H \in \mathrm{NP}:

  2. P≠NP  ⟹  SATH∉P  ⟹  H(n)→∞\mathrm{P} \ne \mathrm{NP} \;\Longrightarrow\; \mathrm{SAT}_H \notin \mathrm{P} \;\Longrightarrow\; H(n) \to \infty

    Not in P. If some MiM_i decided SATH\mathrm{SAT}_H in time i nii\,n^i, then H(n)≤iH(n) \le i for all large nn, so SATH\mathrm{SAT}_H would be SAT with only polynomial padding, and SAT would be in P. Conversely, if SATH∉P\mathrm{SAT}_H \notin \mathrm{P}, every MiM_i eventually fails, so H(n)H(n) grows without bound:

  3. ∣ψ∣H(∣ψ∣)≤nc,  H>2c  ⟹  ∣ψ∣<n\abs{\psi}^{H(\abs{\psi})} \le n^c,\ \ H > 2c \;\Longrightarrow\; \abs{\psi} < \sqrt{n}

    Not NP-complete. If SAT reduced to SATH\mathrm{SAT}_H by a map running in time ncn^c, its outputs would have length at most ncn^c. Once H>2cH > 2c, an output ψ 0 1∣ψ∣H(∣ψ∣)\psi\,0\,1^{\abs{\psi}^{H(\abs{\psi})}} of that length forces ∣ψ∣<n\abs{\psi} < \sqrt{n}, so the map shrinks formulas, and repeating it decides SAT in polynomial time, contradicting P≠NP\mathrm{P} \ne \mathrm{NP}:

The problem Ladner builds is artificial. Natural candidates for this middle ground, such as factoring and graph isomorphism, remain unclassified, and for constraint satisfaction problems no middle ground exists at all (Bulatov; Zhuk, 2017).

Above NP sits the polynomial hierarchy: Σ1=NP\Sigma_1 = \mathrm{NP}, Σ2\Sigma_2 asks "is there an xx such that for every yy a polynomial-time check holds?", and so on, every level inside PSPACE. Resolving P versus NP one way flattens the whole hierarchy; Karp and Lipton (1980) showed that even polynomial-size circuits for SAT would collapse it to its second level.

Check your understanding

If P=NP\mathrm{P} = \mathrm{NP}, what happens to the polynomial hierarchy?

  1. Nothing: only its first level changes
  2. It collapses entirely to P
  3. It collapses to its second level, Σ2\Sigma_2
  4. It becomes equal to PSPACE
Show the answer

B. It collapses entirely to P

Each level is NP with an oracle for the level below. If P=NP\mathrm{P} = \mathrm{NP}, then Σ2=NPNP=NPP=NP=P\Sigma_2 = \mathrm{NP}^{\mathrm{NP}} = \mathrm{NP}^{\mathrm{P}} = \mathrm{NP} = \mathrm{P}, and by induction every level equals P.

DerivationA 2025 advance: time versus space
  1. TIME[t]  ⊆  SPACE[tlog⁡t ]\mathrm{TIME}[t] \;\subseteq\; \mathrm{SPACE}\big[\sqrt{t \log t}\,\big]

    Williams (STOC 2025), building on Cook and Mertz's algorithm for tree evaluation (2024), proved that every multitape Turing machine running in time tt can be simulated in much less space:

  2. SPACE[n]  ⊆  TIME[n2−ε]  ⊆  SPACE[O(n1−ε/2log⁡n)]  =  SPACE[o(n)]\mathrm{SPACE}[n] \;\subseteq\; \mathrm{TIME}[n^{2-\varepsilon}] \;\subseteq\; \mathrm{SPACE}\big[O(n^{1-\varepsilon/2}\sqrt{\log n})\big] \;=\; \mathrm{SPACE}[o(n)]

    Suppose every problem solvable in linear space could be solved in time n2−εn^{2-\varepsilon} for some ε>0\varepsilon > 0. The simulation would then put linear space inside sublinear space:

  3. SPACE[n]  ⊈  TIME[n2−ε]for every ε>0\mathrm{SPACE}[n] \;\not\subseteq\; \mathrm{TIME}[n^{2-\varepsilon}] \quad \text{for every } \varepsilon > 0

    The space hierarchy theorem forbids that, so some problems solvable in linear space need nearly quadratic time on multitape machines: an unconditional lower bound, though far from separating P from NP.

Key takeaways

  • What is proved: hierarchy theorems (P≠EXP\mathrm{P} \ne \mathrm{EXP}), Shannon's count that almost all functions need about 2n/n2^n/n gates, and strong lower bounds for restricted circuits (parity outside AC⁰, monotone clique, NEXP⊈ACC0\mathrm{NEXP} \not\subseteq \mathrm{ACC}^0), but only about 3.1 n3.1\,n gates for explicit functions on general circuits.
  • Relativization: oracles with PA=NPA\mathrm{P}^A = \mathrm{NP}^A and PB≠NPB\mathrm{P}^B \ne \mathrm{NP}^B show that no proof valid relative to every oracle, such as pure diagonalization, can settle P versus NP.
  • Natural proofs: if strong pseudorandom functions exist, no constructive and large property proves superpolynomial circuit lower bounds. Algebrization extends relativization to arithmetized proofs such as IP = PSPACE. Williams's ACC⁰ lower bound, from a faster satisfiability algorithm plus a hierarchy theorem, evades all three barriers.
  • If P ≠ NP, NP-intermediate problems exist (Ladner); if P = NP, the polynomial hierarchy collapses to P. The 2025 simulation of time tt in about t\sqrt{t} space is a rare unconditional advance: linear space contains problems that need nearly quadratic time.

Check yourself

In the interactive lesson these are scored with your confidence, and what you miss comes back for review.

Question 1

Baker, Gill and Solovay built oracles with PA=NPA\mathrm{P}^A = \mathrm{NP}^A and PB≠NPB\mathrm{P}^B \ne \mathrm{NP}^B. What does this imply?

  1. P versus NP is independent of the axioms of set theory
  2. Any proof that settles P versus NP must use techniques that do not relativize
  3. P = NP, since equality holds relative to some oracle
  4. Diagonalization proves nothing in complexity theory
Show the answer

B. Any proof that settles P versus NP must use techniques that do not relativize

A proof whose every step stays valid with an oracle attached would settle the question the same way relative to every oracle, which the two oracles rule out in either direction.

Question 2

Razborov and Rudich call a property of Boolean functions natural when it is…

  1. true of the parity function
  2. constructive (decidable in time polynomial in the truth table's size 2n2^n) and large (shared by a noticeable fraction of all functions)
  3. provable in standard set theory
  4. computable by constant-depth circuits
Show the answer

B. constructive (decidable in time polynomial in the truth table's size 2n2^n) and large (shared by a noticeable fraction of all functions)

Constructivity and largeness are exactly what let a property that is useful against polynomial-size circuits serve as a test that tells random functions from pseudorandom ones, which would break cryptography believed to be secure.

Question 3

If P≠NP\mathrm{P} \ne \mathrm{NP}, what does Ladner's theorem guarantee?

  1. Factoring is neither in P nor NP-complete
  2. Some problem in NP is neither in P nor NP-complete
  3. Every problem in NP is either in P or NP-complete
  4. Graph isomorphism is neither in P nor NP-complete
Show the answer

B. Some problem in NP is neither in P nor NP-complete

Ladner's intermediate problem is SAT with a carefully chosen, slowly growing amount of padding: an artificial problem. Whether natural candidates such as factoring or graph isomorphism are intermediate is open.

Question 4

Williams (2025) showed that a multitape Turing machine running in time tt can be simulated in space O(tlog⁡t)O(\sqrt{t \log t}). Combined with the space hierarchy theorem, what follows?

  1. P≠PSPACE\mathrm{P} \ne \mathrm{PSPACE}
  2. For every ε>0\varepsilon > 0, some problems solvable in linear space cannot be solved in time n2−εn^{2-\varepsilon} on multitape Turing machines
  3. P=PSPACE\mathrm{P} = \mathrm{PSPACE}
  4. Every problem solvable in linear time needs space n\sqrt{n}
Show the answer

B. For every ε>0\varepsilon > 0, some problems solvable in linear space cannot be solved in time n2−εn^{2-\varepsilon} on multitape Turing machines

If linear space fitted in time n2−εn^{2-\varepsilon}, the simulation would put it in space O(n1−ε/2log⁡n)O(n^{1-\varepsilon/2}\sqrt{\log n}), which is o(n)o(n), contradicting the space hierarchy theorem. The gap is polynomial, so P versus PSPACE stays open.

Further reading

  • T. Baker, J. Gill & R. Solovay, "Relativizations of the P =? NP question," SIAM Journal on Computing 4(4) (1975).
  • A. A. Razborov & S. Rudich, "Natural proofs," Journal of Computer and System Sciences 55(1) (1997).
  • S. Aaronson & A. Wigderson, "Algebrization: A new barrier in complexity theory," ACM Transactions on Computation Theory 1(1) (2009).
  • R. Williams, "Nonuniform ACC circuit lower bounds," Journal of the ACM 61(1) (2014); conference version, CCC 2011.
  • S. Arora & B. Barak, Computational Complexity: A Modern Approach (Cambridge University Press, 2009), chapters 3 and 23.