The polynomial time hierarchy (PH) extends beyond P and NP by iterating quantification: Σ₁P = NP, Π₁P = coNP, Σ₂P allows alternating quantifiers, and so on. If P = NP, then PH collapses to P; proving hierarchy separation is an open problem. PH captures the complexity of problems with multiple levels of existential and universal quantification.
Use quantified Boolean formulas (QBF) as examples: existential quantifiers give Σ classes, universal give Π classes. Compare TQBF (true QBF) at different levels.
You know that NP captures problems where a solution can be *verified* in polynomial time — equivalently, problems with an existential polynomial-time witness: "does there exist a certificate y such that V(x, y) accepts?" And coNP captures the complementary problems: "for all certificates y, V(x, y) accepts?" The polynomial hierarchy (PH) generalizes this by stacking alternating existential and universal quantifiers, each ranging over polynomially bounded witnesses.
Define the levels inductively. Σ₀P = Π₀P = P is the base. Σ₁P = NP: there exists a polynomial-time verifiable witness. Π₁P = coNP: for all witnesses, the condition holds. Σ₂P adds another layer: there exists a y₁ such that for all y₂, a polynomial-time condition holds. The canonical example is the problem "does formula φ have a satisfying assignment that remains satisfying even after an adversary flips one variable?" — existential outer quantifier, universal inner quantifier. Π₂P flips the order: for all y₁, there exists y₂ such that... Each level Σₖ₊₁P = NP^(ΣₖP), meaning it is NP with an oracle for the previous level. Intuitively, each step up the hierarchy adds one more round of alternating "guessing and checking."
The hierarchy models a wide class of problems that appear in practice. Minimizing circuit size (minimum circuit size problem) is in Σ₂P. Questions about the existence of Nash equilibria with certain properties, or about second-level optimization (minimize over what remains after an adversary chooses), typically land in Σ₂P or Π₂P. PSPACE, which you will study next, sits above the entire hierarchy: PH ⊆ PSPACE, because TQBF (true quantified Boolean formulas with any number of alternations) is PSPACE-complete, and the hierarchy is exactly the restriction of TQBF to formulas with a bounded number of quantifier blocks.
The key structural fact is the collapse theorem: if any two adjacent levels coincide — if Σₖ = Πₖ for any k, equivalently if Σₖ = Σₖ₊₁ — then the entire hierarchy collapses to that level. In particular, if P = NP, then Σ₁ = Π₁ = Σ₀ = P, and the whole hierarchy collapses to P. This is the sense in which proving P ≠ NP is equivalent to proving the hierarchy does not immediately collapse. Complexity theorists widely believe the hierarchy is strict (infinitely many distinct levels), but no separations have been proved. The hierarchy serves as a refined map of the complexity landscape between P and PSPACE, and placing a problem at a specific level is a precise statement about how much alternating nondeterminism it requires.