Chapter 7 Introduction to Computational Complexity
Complexity of Computation Growth Rates: linear polynomial exponential Well-behaved functions that are used to dominate resource consumption. SPACE: # of tape cells (invariant of # of tapes) vs. input: S(n) TIME: # of steps (≥ 2 tapes, (T²(n) for one tape)) vs. input: T(n) Constant factor speedups (by grouping symbols into blocks) means that only asymptotic behavior is important. So constant factors are irrelevant. n2n²2n²n² + 3n + 7n³n³2ⁿ2ⁿ , 10¹ ⁵ 10020,00010,307100, 10³ ⁰ 10002,000,0001,003,0071,000,000, 10³ ⁰ ¹
Tape-Compression Definition: L is computable in space S(n) if it is accepted by a DTM which never requires more than S(|w|) cells on any input w. (Don’t include read-only input tape.) Lemma: If L is computable in space S(n), then L is computable in space cS(n) for any c > 0. Proof (sketch): Let M be an S(n) space-bounded machine accepting L. Represent the contents of two adjacent cells of M’s work tape by a single symbol (square size of work tape alphabet). Using an enhanced finite control, keep track of individual moves within each pair of cells. This uses only half the space, ½S(n). Continue by induction to obtain any c.
Speed-Up Definition: L is computable in time T(n) if it is accepted by a DTM which never requires more than T(|w|) steps on any input w. (Let’s insist than T is at least linear, i.e. T(n) ≥ n.) Lemma: If L is computable in super-linear time T(n), then L is computable in time cT(n) for any c > 0. Proof (sketch): Let M be a T(n) time-bounded machine accepting L. Compress the contents of two cells of the input tape to the work tape in one pass. (Using a larger alphabet, as before). When entering this cell pair from the right or left, anticipate in an enhanced finite control the finitely many behaviors of M on the pair, and which direction it exits from.
Space and Time Hierarchies If S₁(n) ≥ log n and lim S₁(n) ∕ S₂(n) = 0 as n → ∞, then 1.DSPACE(S₁(n)) ⊊ DSPACE(S₂(n)) 2.NSPACE(S₁(n)) ⊊ NSPACE(S₂(n)) If T₁(n) ≥ n and inf T₁(n) log T₁(n) ∕ T₂(n) = 0 as n → ∞, then 1.DTIME(T₁(n)) ⊊ DTIME(T₂(n)) 2.NTIME(T₁(n)) ⊊ NTIME(T₂(n)) REG = DSPACE(1) ⊈ DTIME(n) CFL ⊆ DTIME(n³)
Relationships Between Deterministic and Non- Deterministic Classes Time(f(n)) ⊆ NTime(f(n)) ⊆ Space(f(n)) ⊆ NSpace(f(n)) ⊆ Time(c f(n) ) trivial Fact: NTime(f(n)) Space(f(n)): Proof (sketch): Each branch in the computation tree has length at most f(n), so we can reuse the space f(n) to simulate each possible run. Can be depth-first because of bound f(n). Fact: NSpace(f(n)) Time(c f(n) ): Proof (sketch): Draw configuration graph – the size will be exponential in the space bound f(n). Search for a path from the start vertex to a halting configuration. This single source reachability problem is linear in the number of nodes.
Complexity Classes Resource-bounded classes closed under nesting (subroutines), not just composition (pipelines). polynomials – n k : polytime = Ptime = P logarithms – log k n : logspace = Lspace = L Introduce non-determinism: NCSPACE NPSPACE CSPACE ⊊ L ⊆ NL ⊆ P ⊆ NP ⊆ PSPACE = = finite automaton Savitch’s Theorem follows from c log(n) = n k corollary
Scale Invariance Fact: Only polynomials p satisfy p[O(n)] = O(p(n)) where p[O(n)] = {p(f(n)) : for any f(n) ∈ O(n)}. Proof: A polynomial f(n) is O(n d ) for its degree d, so f[O(n)] = [O(n)] d = [O(cn) d ] = [O(c d n d )] = O(n d ). For the other direction, let f(n) = n h(n) and show that h(n) = log n f(n) is O(1).
Known and Unknown Results L = computable by a log-space machine SL = computable by a symmetric L-machine NL = non-deterministically computable in L Completeness: hardest problem in each class SL:undirected graph reachability NL:directed graph reachability Known!: NL = co-NL; SL = L Unknown:NL = L?NP = co-NP?P = NP? Reduction: relative hardness for problems
Reductions and Completeness Definition: L ≤ L' means L is reducible to L' x ∈ L ⇔ f(x) ∈ L', where f is ‘easy’ Facts:L' ∈ P ⇒ L ∈ P L' ∈ NP ⇒ L ∈ NP Define: L′ is NP-hard if for all L ∈ NP, L ≤ L′ Define: L′ is NP-complete if L′ is also in NP Fact: If L is NP-complete and L ∈ P, then P = NP
Problems with Unknown Status Primality ∈ NP ∩ co-NP, but actually in P! Factoring ∈ NP ∩ co-NP. Is it in P? Transitive closure ∈ NL = co-NL. Is it in L? Isomorphism: when are two graphs the same Canonization: to compute a unique invariant Quantum computation: any effect?