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 moreTime 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 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 AlgebraIntroduction to Propositional LogicIntroduction to Predicate Logic (First-Order Logic)First-Order Logic SyntaxTerms and Atomic Formulas in FOLVariable Binding and ScopeOpen and Closed Formulas in First-Order LogicVariable Substitution and Capture-Avoidance in First-Order LogicQuantifier Instantiation Rules in First-Order Proof SystemsUniversal Quantification: Meaning and ScopeFree Variables and Bound VariablesSubstitution and Instantiation in Predicate LogicTerms and Atomic FormulasFormulas and Well-Formed ExpressionsStructures and InterpretationsModel Interpretation and SatisfactionInterpretation, Truth, and Satisfaction of FormulasLogical Consequence and EntailmentSoundness Theorem and Validity of Proof SystemsDeductive Reasoning and Formal Proof SystemsFirst-Order ResolutionPropositional ResolutionSemantic Tableaux (Propositional)Semantic Tableaux (First-Order)Decidable Fragments of First-Order LogicGödel's Completeness Theorem for First-Order LogicGödel's Incompleteness TheoremsThe Arithmetical HierarchyTime Hierarchy Theorem

Longest path: 97 steps · 643 total prerequisite topics

Prerequisites (5)

Leads To (1)