CSE 105
THEORY OF COMPUTATION
Fall 2016 http://cseweb.ucsd.edu/classes/fa16/cse105-abc/
CSE 105 THEORY OF COMPUTATION Fall 2016 - - PowerPoint PPT Presentation
CSE 105 THEORY OF COMPUTATION Fall 2016 http://cseweb.ucsd.edu/classes/fa16/cse105-abc/ This Week Beyond Theory of Computation: Computational Complexity Reading: Sipser Chapter 7 Not covered in final exam Revisit
Fall 2016 http://cseweb.ucsd.edu/classes/fa16/cse105-abc/
–
Computational Complexity
–
Reading: Sipser Chapter 7
–
Not covered in final exam
–
Diagonalization
–
Reduction
RE co-RE Context-free Regular Decidable
algorithmic solution?
–
Decidable problems: Yes, they can be solved by a TM
–
Undecidable problems: No, no algorithmic solution
restricted models of computation:
–
DFA, NFA: Regular languages
–
PDA, CFG: Context Free Languages
–
Decidable: TM
uring Machine (or equivalent)
–
How much time is needed to solve a problem?
–
How much memory is needed to solve a problem?
– Number of steps in the computation
– Number of tape cells used during the computation.
Equivalently, size of largest Ck
–
It is natural to expect computation to take longer as w gets larger
–
We don’t care if the running time (number of steps) is even or odd
–
It is usually enough to know an upper bound on Time(M(w))
–
Maximum running time over all inputs of size n
–
There are constant a,b (independent of n) such that T < a*f(n) + b
–
You can think of b as some fixed startup cost
–
You can think of a as using a slower or faster computer
–
Get bounds on running time that are independent of details of computational model
–
Ignore low level details, for the sake of generality
–
Addition: on input (x,y,i), determine if the ith (binary) digit of x+y is 1
–
Multiplication: on input (x,y,i), determine if the ith (binary) digit of x*y is 1.
–
Addition: on input (x,y,i), determine if the ith (binary) digit of x+y is 1
–
Multiplication: on input (x,y,i), determine if the ith (binary) digit of x*y is 1.
What is the time complexity of Addition? A) T=O(n): You need to add all digits one by one B) T=O(3n): You need to readn 2n input digits and output an n-digit result C) T=1: Addition is a single machine instruction. D) It depends on how clock-speed, etc.
–
Addition: on input (x,y,i), determine if the ith (binary) digit of x+y is 1
–
Multiplication: on input (x,y,i), determine if the ith (binary) digit of x*y is 1.
What is the time complexity of Multiplication? A) T=O(n) because output is 2n digits long B) T=O(n2) as taught in elemntary school C) Somewhere between O(n) and O(n2), exact answer is not known D) It depends on how clock-speed, etc.
–
O(n2)
–
O(n1.585)
–
O(n * log(n) * log(log(n)))
–
O(n * log(n) * exp(log*(n))) What is the complexity of multiplication? A) O(n / log n) B) O(n) C) O(n * log(n)) D) O(n * log(n) * exp(log*(n)))
computation
–
Can be solved in Time = O(n3) for any G
–
Can it be solved in O(n2) for any G?
–
Can it be solved in O(n) for any G?
–
Cannot be solved in time O(n100) ?
–
Cannot be solved in time O(exp(n)) ?
–
Cannot be solved in time O(exp(exp(exp( … exp(n)…))) ?
–
difgerent from L(M1)
–
difgerent from L(M2)
–
difgerent from L(M3)
–
…..
–
difgerent from L(Mk)
–
…..
–
difgerent from L(M1) at <M1>
–
difgerent from L(M2) at <M2>
–
difgerent from L(M3) at <M3>
–
…..
–
difgerent from L(Mk) at <Mk>
–
…..
–
difgerent from L(M1) at <M1>
–
difgerent from L(M2) at <M2>
–
difgerent from L(M3) at <M3>
–
…..
–
difgerent from L(Mk) at <Mk>
–
…..
Question: What can you tell about Diag? A) Diag is in RE, but not in coRE B) Diag is coRE, but not in RE C) Diag is neither in RE nor in coRE D) Diag is decidable E) I don’t know
accept in less than 2|<M>| steps}
–
M(<M>) rejects, or
–
M(<M>) takes more than 2n steps
accept in less than 2|<M>| steps}
Question: What can you say about Diag2? A) Diag2 is in RE, but not in coRE B) Diag2 is coRE, but not in RE C) Diag2 is neither in RE nor in coRE D) Diag2 is decidable
accept in less than 2|<M>| steps}
Question: How Diag2 compare to Diag? A) Diag is a subset of Diag2 B) Diag is a proper subset of Diag2 C) Diag is a superset of Diag2 D) Diag is a proper superset of Diag2
accept in less than 2|<M>| steps}
–
Is there an algorithm deciding Diag2 in time O(n3)?
–
Is there an algorithm deciding Diag2 in time O(2n)?
accept in less than 2|<M>| steps}
–
L(P) = Diag2
–
Time(P(w))<2n for every input of length |w|=n
✔
Yes → w is in Diag2 → either P(w) rejects of T(P(w))>2n Contradiction!
✗
No→ w is not in Diag2 → P(w) accepts (in time <2n). Contradiction!