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

Time Hierarchy Theorem

Graduate Depth 96 in the knowledge graph ☐ I know this ☆ Set as goal
4topics build on this
643prerequisites beneath it
See this on the map →
Time Complexity and the Class PTuring Machines+3 more→→Time and Space Hierarchy Theorems
separations resource-bounded computability

Core Idea

The time hierarchy theorem states that for reasonable complexity measures, strictly greater time allows a Turing machine to decide strictly more languages. Formally, if f and g are time-constructible functions with f·log(f) = o(g), then DTIME(f) ⊊ DTIME(g). This unconditionally proves P ⊂ EXPTIME and guarantees unbounded growth of computational power with time resources.

How It's Best Learned

Understand the proof using diagonalization: a TM with more time can solve the time-bounded halting problem for TMs with less time, constructing a language not in the smaller class.

Explainer

From your study of Turing machines and time complexity classes, you know that DTIME(f(n)) is the set of languages decidable by a deterministic TM in O(f(n)) steps. A natural question follows immediately: does more time actually buy you more computational power? Could DTIME(n²) and DTIME(n³) be the same class — where the extra time is just wasted? The time hierarchy theorem answers definitively: no. More time strictly expands what can be decided.

The formal statement requires a technical condition: f and g must be time-constructible (a TM can compute f(n) in O(f(n)) steps, so the function is "usable" as a resource bound), and the gap between them must satisfy f(n)·log f(n) = o(g(n)). Under these conditions, DTIME(f) is a *strict subset* of DTIME(g) — there are languages in the larger class that provably cannot be decided in the smaller time bound. The log f factor is a minor technical artifact of simulating one TM on another; in practice the theorem says things like DTIME(n) ⊊ DTIME(n²) ⊊ DTIME(n³) ⊊ ··· and P ⊊ EXPTIME.

The proof uses diagonalization — the same technique Cantor used to prove uncountability, adapted by Turing to prove undecidability, and now applied to complexity. The idea: a TM D with time bound g(n) enumerates all TMs Mᵢ in order, simulates Mᵢ on input ⟨i⟩ for at most f(|i|)·log f(|i|) steps, and does the opposite of what Mᵢ does. D has enough time to run this simulation (because g grows faster than f·log f) and enough time to *not* be fooled by any time-f(n) machine. The language D decides — "all inputs ⟨i⟩ where Mᵢ doesn't accept within the time limit" — cannot be decided in time f(n), because D's own construction ensures it differs from every such machine on at least one input.

The theorem has immediate structural consequences. It guarantees the polynomial hierarchy is infinite *if* the classes are all distinct: P is strictly inside EXP, which is strictly inside doubly-exponential time, and so on without bound. More subtly, it shows that computational power grows continuously with time — there is no "plateau" where extra time stops helping. This is the unconditional separation in complexity theory, requiring no assumption about P vs. NP or any open conjecture.

One important contrast with NP: the time hierarchy theorem gives a separation between *deterministic* time classes. We know DTIME(n) ⊊ DTIME(n²) unconditionally. But the question of whether P ⊊ NP — a separation between deterministic and nondeterministic time — remains open. Diagonalization works cleanly when both sides of the comparison are deterministic; the nondeterministic case resists the same technique, which is part of why P vs. NP is so hard.

Practice Questions 5 questions

Prerequisite Chain

Understanding Zero → The Number Zero → Counting to Five → Counting to 10 → Counting to 20 → Counting a Set of Objects Up to 20 → Cardinality: The Last Number Counted → Matching Numerals to Quantities → Subitizing Small Quantities → Addition Within 10 → Number Bonds to 10 → Addition Within 20 → Doubles and Near Doubles → Doubles Facts Within 10 → Near Doubles Facts Within 20 → Mental Math Strategies for Addition → Mental Math: Adding and Subtracting Tens → Addition Within 100 → Repeated Addition as Multiplication → Multiplication as Equal Groups → Multiplication: Arrays → Basic Multiplication Facts (0s, 1s, 2s, 5s, 10s) → Multiplication Facts Within 100 → Division as Equal Sharing → Division as Grouping (Measurement Division) → Division: Grouping (Repeated Subtraction) Model → Division: Fair Sharing Model → Division as Equal Sharing → Division as Grouping → Basic Division Facts → Division Facts Within 100 → Multiplication and Division Fact Families → Relationship Between Multiplication and Division → Division Facts as Inverse of Multiplication → Remainders and Quotients in Division → Division Word Problems → Multi-Step Word Problems → Solving Multi-Step Word Problems → Multiplication Word Problems → Division Word Problems → Introduction to Long Division → Factors and Multiples → Prime and Composite Numbers → Equivalent Fractions → Relating Fractions and Decimals → Decimal Place Value → Integers and the Number Line → Comparing and Ordering Integers → Absolute Value → Adding Integers → Subtracting Integers → Multiplying Integers → Introduction to Exponents → Order of Operations → Integer Order of Operations → Variable Expressions → The Distributive Property → Variables and Expressions Review → Introduction to Polynomials → Adding and Subtracting Polynomials → Multiplying Polynomials → Factorial → Permutations → Combinations → Counting Principles: Addition and Multiplication Rules → Introduction to Graph Theory → Propositional Logic Foundations → Logical Equivalences → Boolean Algebra → Introduction to Propositional Logic → Introduction to Predicate Logic (First-Order Logic) → First-Order Logic Syntax → Terms and Atomic Formulas in FOL → Variable Binding and Scope → Open and Closed Formulas in First-Order Logic → Variable Substitution and Capture-Avoidance in First-Order Logic → Quantifier Instantiation Rules in First-Order Proof Systems → Universal Quantification: Meaning and Scope → Free Variables and Bound Variables → Substitution and Instantiation in Predicate Logic → Terms and Atomic Formulas → Formulas and Well-Formed Expressions → Structures and Interpretations → Model Interpretation and Satisfaction → Interpretation, Truth, and Satisfaction of Formulas → Logical Consequence and Entailment → Soundness Theorem and Validity of Proof Systems → Deductive Reasoning and Formal Proof Systems → First-Order Resolution → Propositional Resolution → Semantic Tableaux (Propositional) → Semantic Tableaux (First-Order) → Decidable Fragments of First-Order Logic → Gödel's Completeness Theorem for First-Order Logic → Gödel's Incompleteness Theorems → The Arithmetical Hierarchy → Time Hierarchy Theorem

Longest path: 97 steps · 643 total prerequisite topics

Prerequisites (5)

Leads To (1)