A topic in the Open Knowledge Graph — a free, open map of 15,290 topics and the order to learn them in.

Time and Space Hierarchy Theorems

Graduate Depth 101 in the knowledge graph I know this Set as goal
3topics build on this
738prerequisites beneath it
See this on the map →
Space Complexity: PSPACE, L, and NLTime Complexity and the Class P+3 moreSpace Hierarchy Theorem
hierarchy lower-bounds separations

Core Idea

The time hierarchy theorem states that if f(n) log f(n) < g(n), then DTIME(f(n)) ⊊ DTIME(g(n)): more time provably allows computation of strictly harder problems. Space hierarchy is analogous. These theorems rigorously separate complexity classes and show that the complexity landscape has unbounded 'height'—no single complexity class contains all computable languages.

Explainer

You already know complexity classes like P and EXPTIME, and that DTIME(f(n)) is the class of problems solvable in O(f(n)) time. A natural question is whether these classes are genuinely distinct — does having more time *actually* let you solve harder problems? The time hierarchy theorem answers yes, rigorously. If g(n) grows faster than f(n) log f(n), then DTIME(g(n)) strictly contains DTIME(f(n)): problems exist that require roughly g(n) steps but cannot be solved in f(n) steps. As a corollary, P ⊊ EXPTIME — exponential time is provably more powerful than polynomial time.

The proof uses diagonalization, the same technique behind the undecidability of the halting problem. Construct a machine D that, on input ⟨M, 1n⟩, simulates M for g(n) steps and does the opposite of whatever M would do. If any machine M in DTIME(f(n)) could solve the same problem as D, we get a contradiction when we feed D its own description. The log factor in the condition f(n) log f(n) < g(n) is a technical overhead needed for the universal TM simulation. For the space hierarchy theorem, the condition is simpler — f(n) = o(g(n)) suffices — because space can be reused and the simulation overhead is smaller.

These theorems are foundational because without them, the complexity hierarchy could collapse. Perhaps P = EXPTIME, or every problem solvable in space n is also solvable in space log n. The hierarchy theorems rule this out: the complexity landscape is genuinely infinite, with strict containments at every level of increased resources. This gives complexity theory its structure — there is no "maximum" class of tractable problems, and no single resource bound captures all of computation.

An important subtlety is what the hierarchy theorems do *not* prove. They separate DTIME classes by time, but they cannot separate P from NP, or NP from PSPACE. Those separations require *lower bounds* — proofs that specific problems require a certain amount of resources — and such lower bounds remain largely elusive. The hierarchy theorems are unconditional separations achieved by the clever diagonalization construction, whereas most separations in complexity theory (like P ≠ NP) require reasoning about the structure of actual computational problems, a far harder task.

Practice Questions 5 questions

Prerequisite Chain

Understanding ZeroThe Number ZeroCounting to FiveCounting to 10Counting to 20Counting a Set of Objects Up to 20Cardinality: The Last Number CountedMatching Numerals to QuantitiesSubitizing Small QuantitiesAddition Within 10Number Bonds to 10Addition Within 20Doubles and Near DoublesDoubles Facts Within 10Near Doubles Facts Within 20Mental Math Strategies for AdditionMental Math: Adding and Subtracting TensAddition Within 100Repeated Addition as MultiplicationMultiplication as Equal GroupsMultiplication: ArraysBasic Multiplication Facts (0s, 1s, 2s, 5s, 10s)Multiplication Facts Within 100Division as Equal SharingDivision as Grouping (Measurement Division)Division: Grouping (Repeated Subtraction) ModelDivision: Fair Sharing ModelDivision as Equal SharingDivision as GroupingBasic Division FactsDivision Facts Within 100Multiplication and Division Fact FamiliesRelationship Between Multiplication and DivisionDivision Facts as Inverse of MultiplicationRemainders and Quotients in DivisionDivision Word ProblemsMulti-Step Word ProblemsSolving Multi-Step Word ProblemsMultiplication Word ProblemsDivision Word ProblemsIntroduction to Long DivisionFactors and MultiplesPrime and Composite NumbersEquivalent FractionsRelating Fractions and DecimalsDecimal Place ValueIntegers and the Number LineComparing and Ordering IntegersAbsolute ValueAdding IntegersSubtracting IntegersMultiplying IntegersIntroduction to ExponentsOrder of OperationsInteger Order of OperationsVariable ExpressionsThe Distributive PropertyVariables and Expressions ReviewIntroduction to PolynomialsAdding and Subtracting PolynomialsMultiplying PolynomialsFactorialPermutationsCombinationsCounting Principles: Addition and Multiplication RulesIntroduction to Graph TheoryPropositional Logic FoundationsLogical EquivalencesBoolean AlgebraBoolean Type and Truth ValuesComparison Operators and Boolean TestsLogical Operators and Boolean AlgebraBoolean Algebra and Fundamental LawsLogic Gates FundamentalsImplementing Boolean Functions with GatesKarnaugh Map SimplificationCombinational Circuit DesignFlip-Flops and LatchesFinite State Machines (FSMs)Deterministic Finite Automata (DFA)Nondeterministic Finite Automata (NFA)Two-Way Finite AutomataNFA to DFA Conversion (Subset Construction)DFA Properties and Minimization AlgorithmsRegular Languages: Definition and CharacterizationContext-Free Grammars (CFGs)Pushdown Automata (PDA)Equivalence of CFGs and Pushdown AutomataClosure Properties of Context-Free LanguagesLimitations of Context-Free LanguagesPumping Lemma for Context-Free LanguagesTuring MachinesVariants of Turing Machines and EquivalenceNondeterministic Time Complexity and NPThe P vs. NP ProblemComplexity Class P: Polynomial TimeComplexity Class NP: Nondeterministic Polynomial TimeNP-Completeness and Cook-Levin TheoremThe Cook-Levin TheoremBoolean Satisfiability, Cook-Levin, and ReductionsExponential Time HypothesisTime and Space Hierarchy Theorems

Longest path: 102 steps · 738 total prerequisite topics

Prerequisites (5)

Leads To (1)