Download presentation
Presentation is loading. Please wait.
1
Intro to Theory of Computation
LECTURE 23 Last time Recursion theorem Measuring complexity Asymptotic notation Relationship between models Today Relationship between models: deterministic/nondeterministic Class P CS 464 Sofya Raskhodnikova 12/2/2018
2
I-clicker question (frequency: AC)
Let π‘(π) be a function, where π‘ π β₯π. Every 3-tape TM that runs in time O(π‘(π)) can be simulated by a 1-tape TM that runs in time O(π‘(π)) O(π‘( π 2 )) O(π‘( π 3 )) O π‘ π 2 Some 3-tape TMs canβt be simulated by 1-tape TMs t(n)= n log n 3/17/2016
3
Complexity relationships between models: number of tapes
Theorem. Let π‘(π) be a function, where π‘ π β₯π. Every π‘ π time multitape TM has an equivalent π π‘ π time 1-tape TM. 12/2/2018
4
Time complexity of NTMs
The running time a nondeterministic decider π is π‘(π) if on all inputs of length π, NTM π takes at most π(π) steps on the longest nondeterministic branch. 12/2/2018
5
Time complexity of NTMs
Deterministic Nondeterministic π(π) accept accept or reject reject Length of the longest computational branch, even if accepts before 12/2/2018
6
Complexity relationships between models: nondeterminism
Theorem. Let π‘(π) be a function, where π‘ π β₯π. Every π‘ π time nondeterministic TM has an equivalent 2 π π‘ π time 1-tape deterministic TM. Proof: Simulate an NTM by a 3-tape TM. # of leaves β€ π π(π) # of nodes β€ ππ π(π) Time increment the address and simulate from the root to a node: πΆ(π(π)) Total: πΆ(π(π) π π(π) ) = π πΆ π π input π M simulation address accept π(π) reject 12/2/2018
7
Complexity relationships between models: nondeterminism
Theorem. Let π‘(π) be a function, where π‘ π β₯π. Every π‘ π time nondeterministic TM has an equivalent 2 π π‘ π time 1-tape deterministic TM. Proof: So, a 3-tape TM can simulate an NTM in 2 π(π‘ π ) time. Converting to a 1-tape TM at most squares the running time: (2 π(π‘ π ) ) π = 2 π(π π‘ π ) = 2 π(π‘ π ) 12/2/2018
8
Difference in time complexity
At most polynomial difference between deterministic models. At most exponential difference between deterministic and nondeterministic models. all reasonable 12/2/2018
9
The class P P is the class of languages decidable in polynomial time on a deterministic 1-tape TM: π·= π ππΌππΈ π π . The same class even if we substitute another reasonable deterministic model. Roughly the class of problems realistically solvable on a computer. 12/2/2018
10
Examples of languages in P
PATH ={ πΊ,π ,π‘ β£πΊ is a directed graph that has a directed path from π to π‘} RELPRIME = { π₯,π¦ β£π₯ and π¦ are relatively prime} PRIMES ={π₯β£π₯ is a prime number} [2002] Every context-free language (On the board) 12/2/2018
11
Sofya Raskhodnikova; based on slides by Nick Hopper
Recall: Chomsky Normal Form for CFGs Can have a rule πβΞ΅. All remaining rules are of the form π΄β π΅πΆ π΄, π΅, πΆβ π π΄βπ πβΞ£ Cannot have π on the RHS of any rule. Lemma. Any CFG can be converted into an equivalent CFG in Chomsky normal form. Lemma. If G is in Chomsky normal form, any derivation of string w of length π in G has 2πβ1 steps. 12/2/2018 Sofya Raskhodnikova; based on slides by Nick Hopper
12
A decider for a CFL Let L be a CFL generated by a CFG G in CNF
How long does it take? (Exponential time) Idea: use dynamic programming M = `` On input β©π€βͺ, where π€ is a string: Let π=|π€|. Test all derivations with 2πβ1 steps. Accept if any derived π. O.w. reject.ββ (in the book) 12/2/2018
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.