Finish K-Complexity, Start Time Complexity

Similar documents
Lecture 16: Time Complexity and P vs NP

CS154, Lecture 13: P vs NP

CS154, Lecture 13: P vs NP

TIME COMPLEXITY AND POLYNOMIAL TIME; NON DETERMINISTIC TURING MACHINES AND NP. THURSDAY Mar 20

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY. FLAC (15-453) Spring l. Blum TIME COMPLEXITY AND POLYNOMIAL TIME;

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

CS154, Lecture 12: Kolmogorov Complexity: A Universal Theory of Data Compression

Lecture 13: Foundations of Math and Kolmogorov Complexity

Chapter 7: Time Complexity

q FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY. FLAC (15-453) Spring L. Blum. REVIEW for Midterm 2 TURING MACHINE

Time Complexity (1) CSCI Spring Original Slides were written by Dr. Frederick W Maier. CSCI 2670 Time Complexity (1)

Theory of Computation Time Complexity

CS154, Lecture 15: Cook-Levin Theorem SAT, 3SAT

CISC 4090 Theory of Computation

Time Complexity. CS60001: Foundations of Computing Science

CSE 105 THEORY OF COMPUTATION

CSE 105 THEORY OF COMPUTATION

CS154, Lecture 17: conp, Oracles again, Space Complexity

CSE 105 Theory of Computation

TURING MAHINES

Announcements. Problem Set 7 graded; will be returned at end of lecture. Unclaimed problem sets and midterms moved!

Complexity (Pre Lecture)

CS5371 Theory of Computation. Lecture 19: Complexity IV (More on NP, NP-Complete)

Computational complexity

Harvard CS 121 and CSCI E-121 Lecture 20: Polynomial Time

COMPLEXITY THEORY. PSPACE = SPACE(n k ) k N. NPSPACE = NSPACE(n k ) 10/30/2012. Space Complexity: Savitch's Theorem and PSPACE- Completeness

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

Lecture 17: Cook-Levin Theorem, NP-Complete Problems

Advanced Topics in Theoretical Computer Science

Computability Theory

CSE 105 THEORY OF COMPUTATION

Lecture 20: conp and Friends, Oracles in Complexity Theory

Theory of Computation

NP-Completeness and Boolean Satisfiability

P is the class of problems for which there are algorithms that solve the problem in time O(n k ) for some constant k.

The Class NP. NP is the problems that can be solved in polynomial time by a nondeterministic machine.

Lecture 21: Space Complexity (The Final Exam Frontier?)

Notes for Lecture Notes 2

Lecture 19: Finish NP-Completeness, conp and Friends

CS151 Complexity Theory. Lecture 1 April 3, 2017

Complexity Theory VU , SS The Polynomial Hierarchy. Reinhard Pichler

Outline. Complexity Theory EXACT TSP. The Class DP. Definition. Problem EXACT TSP. Complexity of EXACT TSP. Proposition VU 181.

Friday Four Square! Today at 4:15PM, Outside Gates

CSE 135: Introduction to Theory of Computation NP-completeness

1 Computational Problems

CMPT 710/407 - Complexity Theory Lecture 4: Complexity Classes, Completeness, Linear Speedup, and Hierarchy Theorems

Decidability and Undecidability

Complexity: moving from qualitative to quantitative considerations

CSCE 551 Final Exam, Spring 2004 Answer Key

Computability Theory. CS215, Lecture 6,

Computational Models Lecture 11, Spring 2009

Theory of Computation CS3102 Spring 2015 A tale of computers, math, problem solving, life, love and tragic death

BBM402-Lecture 11: The Class NP

Lecture 6: Oracle TMs, Diagonalization Limits, Space Complexity

1 Showing Recognizability

Time-Space Tradeoffs for SAT

Lecture 2 (Notes) 1. The book Computational Complexity: A Modern Approach by Sanjeev Arora and Boaz Barak;

Definition: conp = { L L NP } What does a conp computation look like?

Complexity Theory Part I

Applied Computer Science II Chapter 7: Time Complexity. Prof. Dr. Luc De Raedt. Institut für Informatik Albert-Ludwigs Universität Freiburg Germany

Theory of Computation CS3102 Spring 2014 A tale of computers, math, problem solving, life, love and tragic death

The Polynomial Hierarchy

1 Circuit Complexity. CS 6743 Lecture 15 1 Fall Definitions

Complexity Theory Part II

MTAT Complexity Theory October 20th-21st, Lecture 7

Theory of Computation

U.C. Berkeley CS278: Computational Complexity Professor Luca Trevisan August 30, Notes for Lecture 1

Lecture Notes: The Halting Problem; Reductions

Introduction to Languages and Computation

satisfiability (sat) Satisfiability unsatisfiability (unsat or sat complement) and validity Any Expression φ Can Be Converted into CNFs and DNFs

6.045: Automata, Computability, and Complexity (GITCS) Class 15 Nancy Lynch

conp, Oracles, Space Complexity

1 Non-deterministic Turing Machine

CSE 105 THEORY OF COMPUTATION

CS154, Lecture 10: Rice s Theorem, Oracle Machines

Could we potentially place A in a smaller complexity class if we consider other computational models?

CS Lecture 28 P, NP, and NP-Completeness. Fall 2008

Announcements. Friday Four Square! Problem Set 8 due right now. Problem Set 9 out, due next Friday at 2:15PM. Did you lose a phone in my office?

NP, polynomial-time mapping reductions, and NP-completeness

Ma/CS 117c Handout # 5 P vs. NP

Turing Machines Part III

Problems, and How Computer Scientists Solve Them Manas Thakur

Computability and Complexity

Intractable Problems [HMU06,Chp.10a]

CP405 Theory of Computation

Polynomial time reduction and NP-completeness. Exploring some time complexity limits of polynomial time algorithmic solutions

Exam Computability and Complexity

Turing Machine Recap

CS6901: review of Theory of Computation and Algorithms

CS 301. Lecture 18 Decidable languages. Stephen Checkoway. April 2, 2018

Computability Theory

Theory of Computation (IX) Yijia Chen Fudan University

Review of Basic Computational Complexity

CSE 555 HW 5 SAMPLE SOLUTION. Question 1.

Intro to Theory of Computation

Welcome to... Problem Analysis and Complexity Theory , 3 VU

P and NP. Or, how to make $1,000,000.

DRAFT. Diagonalization. Chapter 4

Computational Complexity

Transcription:

6.045 Finish K-Complexity, Start Time Complexity 1

Kolmogorov Complexity Definition: The shortest description of x, denoted as d(x), is the lexicographically shortest string <M,w> such that M(w) halts with only x on its tape. Definition: The Kolmogorov complexity of x, denoted as K(x), is d(x). 2

There Exist Incompressible Strings Theorem: For all n, there is an x ϵ {0,1} n such that K(x) n There are incompressible strings of every length Proof: (Number of binary strings of length n) = 2 n but (Number of descriptions of length < n) (Number of binary strings of length < n) = 1 + 2 + 4 + + 2 n-1 = 2 n 1 Therefore, there is at least one n-bit string x that does not have a description of length < n. 3

Random Strings Are Incompressible! Theorem: For all n and c 1, Pr x ϵ {0,1} n[ K(x) n-c ] 1 1/2 c Most strings are highly incompressible Proof: (Number of binary strings of length n) = 2 n but (Number of descriptions of length < n-c) (Number of binary strings of length < n-c) = 2 n-c 1 Hence the probability that a random x satisfies K(x) < n-c is at most (2 n-c 1)/2 n < 1/2 c. 4

Kolmogorov Complexity: Try it! Give short algorithms for generating the strings: 1. 01000110110000010100111001011101110000 2. 123581321345589144233377610987 3. 126241207205040403203628803628800 5

Kolmogorov Complexity: Try it! Give short algorithms for generating the strings: 1. 01000110110000010100111001011101110000 2. 123581321345589144233377610987 3. 126241207205040403203628803628800 6

Kolmogorov Complexity: Try it! Give short algorithms for generating the strings: 1. 01000110110000010100111001011101110000 2. 123581321345589144233377610987 3. 126241207205040403203628803628800 7

Kolmogorov Complexity: Try it! Give short algorithms for generating the strings: 1. 01000110110000010100111001011101110000 2. 123581321345589144233377610987 3. 126241207205040403203628803628800 This seems hard to determine in general. Why? 8

Computing Compressibility? Can an algorithm perform optimal compression? Can algorithms tell us if a given string is compressible? COMPRESS = { (x,c) K(x) c} Theorem: COMPRESS is undecidable! Idea: If decidable, we could design an algorithm that prints the shortest incompressible string of length n But such a string could then be succinctly described, by providing the algorithm code and n in binary! Berry Paradox: The smallest integer that cannot be defined in less than thirteen words. 9

Computing Compressibility? COMPRESS = {(x,c) K(x) c} Theorem: COMPRESS is undecidable! Proof: Suppose it is decidable. Consider the TM: M = On input x ϵ {0,1}*, let N = 2 x. For all y ϵ {0,1}* in lexicographical order, If (y, N) COMPRESS then print y and halt. M(x) prints the lex. first string y with K(y ) > 2 x. <M,x> is a description of y, <M,x> (2 M +1) + x So 2 x < K(y ) c + x. CONTRADICTION for large x! 10

Proving Theorems With K-Complexity Theorem: L = {x x x 0, 1 } is not regular. Proof: Suppose L is recognized by a DFA D. Let n 0 and choose an x 0, 1 n such that K x n Let q x be the state of D reached after reading in x Define a TM M(D, q, n): Find a path P in DFA D of length n that starts from state q and ends in a final state. Print the n-bit string along path P, and halt. Claim: The pair <M,(D, q x, n)> is a description of x! So n K x <M,(D, q x, n)> c + log n CONTRADICTION for large n! 11

Computational Complexity Theory 12

Computational Complexity Theory What can and can t be computed with limited resources on computation, such as time, space, and so on Captures many of the significant issues in practical problem solving The field is rich with important open questions that no one has any idea how to begin answering! We ll start with: Time complexity 13

Very Quick Review of Big-O Let f, g : N N. We say that f(n) O(g(n)) if there are c, n 0 N so that for every integer n n 0 f(n) c g(n) We say g(n) is an upper bound on f(n) if f(n) O(g(n)) 5n 3 + 2n 2 + 22n + 6 O(n 3 ) If c = 6 and n 0 = 10, then 5n 3 + 2n 2 + 22n + 6 cn 3 14

2n 4.1 + 200283n 4 + 2 O(n 4.1 ) 3n log 2 n + 5n log 2 log 2 n O(n log 2 n) n log 10 n 78 O(n log 10 n) log 10 n = log 2 n / log 2 10 O(n log 2 n) O(n log 10 n) O(n log n) Big-O isolates the dominant term of a function 15

A Simpler Big-O Definition Let f, g : N N We say f(n) O(g(n)) if there is a c N so that for all n N, f(n) c g(n) + c 16

Measuring Time Complexity of a TM We measure time complexity by counting the steps taken for a Turing machine to halt on an input Example: Let A = { 0 k 1 k k 0 } Here s a TM for A. On input x of length n: 1. Scan across the tape and reject if x is not of the form 0 i 1 j 2. Repeat the following if both 0s and 1s remain on the tape: Scan across the tape, crossing off a single 0 and a single 1 3. If 0s remain after all 1s have been crossed off, or vice-versa, reject. Otherwise accept. O(n) O(n 2 ) O(n) 17

Let M be a TM that halts on all inputs. (We will only consider decidable languages now!) Definition: The running time or time complexity of M is the function T : N N such that T(n) = maximum number of steps taken by M over all inputs of length n 18

Time-Bounded Complexity Classes Definition: TIME(t(n)) = { L there is a Turing machine M with time complexity O(t(n)) so that L = L(M) } = { L L is a language decided by a Turing machine with c t(n) + c running time } We showed: A = { 0 k 1 k k 0 } TIME(n 2 ) Is there a faster Turing machine? 19

A = { 0 k 1 k k 0 } TIME(n log n) M(w) := If w is not of the form 0*1*, reject. Repeat until all bits of w are crossed out: If (parity of 0 s) (parity of 1 s), reject. Cross out every other 0. Cross out every other 1. Once all bits are crossed out, accept. 00000000000001111111111111 x0x0x0x0x0x0xx1x1x1x1x1x1x xxx0xxx0xxx0xxxx1xxx1xxx1x xxxxxxx0xxxxxxxxxxxx1xxxxx xxxxxxxxxxxxxxxxxxxxxxxxxx 20

A = { 0 k 1 k k 0 } TIME(n log n) M(w) := If w is not of the form 0*1*, reject. Repeat until all bits of w are crossed out: If (parity of 0 s) (parity of 1 s), reject. Cross out every other 0. Cross out every other 1. Once all bits are crossed out, accept. For a fixed w = 0 k 1 k : Let zero i be number of 0s left in w, after iteration i Let ones i be number of 1s left in w, after iteration i Start with zero 0 = k, ones 0 = k Key Observation: zero i+1 = floor(zero i /2), ones i+1 = floor(ones i /2) Number of iterations O log n 21

It can be proved that there is no (one-tape) Turing Machine that can decide A in less than O(n log n) time! Let f(n) = O n log n α n Puzzle: where α n is unbounded. Prove: TIME(f(n)) contains only regular languages(!) For example, TIME(n log log n) contains only regular languages! 22

In particular, define the class REGULAR = {L L is a regular language}. Proposition: REGULAR TIME(n) Assuming the Puzzle is true, then for every f(n) = O n log n α n unbounded, where α n is TIME(f(n)) = TIME(n) A collapse of complexity classes! 23

Two Tapes Can Be More Efficient Theorem: A = { 0 k 1 k k 0 } can be decided in O(n) time with a two-tape TM. Proof Idea: Sweep over all 0s, copy them over on the second tape. Sweep over all 1s. For each 1, cross off a 0 from the second tape. 24

Different models of computation can yield different running times for the same language! Let s revisit some of the key concepts from computability theory 25

Theorem: Let t : N N satisfy t(n) n, for all n. Then every t(n) time multi-tape TM has an equivalent O(t(n) 2 ) time one-tape TM Our simulation of multitape TMs by one-tape TMs achieves this! Corollary: Suppose language A can be decided by a multi-tape TM in p(n) time, for some polynomial p. Then A can also be decided by a one-tape TM in q(n) time, for some polynomial q. 26

Theorem: For every t(n) time multi-tape TM, there is an equivalent O(t(n) 2 ) time one-tape TM 1 0 0 FINITE STATE CONTROL FINITE STATE CONTROL... 1 0 0 # # # 27

Theorem: For every t(n) time multi-tape TM, there is an equivalent O(t(n) 2 ) time one-tape TM 1 0 0 FINITE STATE CONTROL FINITE STATE CONTROL... 1 0 0 # # # 28

Theorem: For every t(n) time multi-tape TM, there is an equivalent O(t(n) 2 ) time one-tape TM 1 0 0 FINITE STATE CONTROL FINITE STATE CONTROL... 1 0 0 # # # 29

Theorem: For every t(n) time multi-tape TM, there is an equivalent O(t(n) 2 ) time one-tape TM t(n) time FINITE STATE CONTROL 1 0 0 O(t(n) 2 ) FINITE STATE CONTROL... 1 0 0 # # # 30

An Efficient Universal TM Theorem: There is a (one-tape) Turing machine U which takes as input: - the code of an arbitrary TM M - an input string w - and a string of t 1s, t > w such that U(M, w, 1 t ) halts in O( M 2 t 2 ) steps and U accepts (M, w, 1 t ) M accepts w in t steps The Universal TM with a Clock Idea: Make a multi-tape TM U that does the above, and runs in O( M t) steps 31

The Time Hierarchy Theorem Intuition: If you get more time to compute, then you can solve strictly more problems. Theorem: For all reasonable f, g : N! N where for all n, g(n) > n 2 f(n) 2, TIME(f(n)) TIME(g(n)) Proof Idea: Diagonalization with a clock Make a TM N that on input M, simulates the TM M on input M for f( M ) steps, then flips the answer. We will show L(N) cannot have time complexity f(n) 32

The Time Hierarchy Theorem Theorem: For reasonable f, g where g(n) > n 2 f(n) 2, TIME(f(n)) TIME(g(n)) Proof Sketch: Define a TM N as follows: N(M) = Compute t = f( M ) Run U(M, M, 1 t ) and output the opposite answer. Claim: L(N) does not have time complexity f(n). Proof: Assume N runs in f(n) time, and L(N ) = L(N). By assumption, N (N ) runs in f( N ) time and outputs the opposite answer of U(N, N, 1 f( N ) ) So N (N ) accepts U(N, N, 1 f( N ) ) rejects N (N ) rejects in f( N ) steps [U is universal] This is a contradiction! 33

The Time Hierarchy Theorem Theorem: For reasonable f, g where g(n) > n 2 f(n) 2, TIME(f(n)) TIME(g(n)) Proof Sketch: Define a TM N as follows: N(M) = Compute t = f( M ) Run U(M, M, 1 t ) and output the opposite answer. So, L(N) does not have time complexity f(n). For what functions g(n) will N run in O(g(n)) time? 1. Compute t = f( M ) in O(g( M )) time [ reasonable ] 2. Simulate U(M, M, 1 t ) in O(g( M )) time Recall: U(M, w, 1 t ) halts in O( M 2 t 2 ) steps Set g(n) so that g( M ) > M 2 f( M ) 2 for all n. QED Remark: Time hierarchy also holds for multitape TMs! 34

A Better Time Hierarchy Theorem Theorem: For reasonable f, g where g(n) > f(n) log 2 f(n), TIME(f(n)) TIME(g(n)) Corollary: TIME(n) TIME(n 2 ) TIME(n 3 ) There is an infinite hierarchy of increasingly more time-consuming problems Question: Are there important everyday problems that are high up in this time hierarchy? A natural problem that needs exactly n 10 time? THIS IS AN OPEN QUESTION! 37

k N P = TIME(n k ) Polynomial Time The analogue of decidability 38

The EXTENDED Church-Turing Thesis Everyone s Intuitive Notion of Efficient Algorithms = Polynomial-Time Turing Machines A controversial thesis! Potential counterexamples include n 100 time algorithms, randomized algorithms, quantum algorithms 39

Nondeterminism and NP The analogue of recognizability 40

Nondeterministic Turing Machines are just like standard TMs, except: 1. The machine may proceed according to several possible transitions (like an NFA) 2. The machine accepts an input string if there exists an accepting computation history for the machine on the string 41

read write move 0 0, R 0 0, R, R q accept, R 0 0, R q reject 42

Definition: A nondeterministic TM is a 7-tuple T = (Q, Σ, Γ,, q 0, q accept, q reject ), where: Q is a finite set of states Σ is the input alphabet, where Σ Γ is the tape alphabet, where Γ and Σ Γ : Q Γ 2 (Q Γ {L,R}) q 0 Q is the start state q accept Q is the accept state q reject Q is the reject state, and q reject q accept 43

Defining Acceptance for NTMs Let N be a nondeterministic Turing machine An accepting computation history for N on w is a sequence of configurations C 0,C 1,,C t where 1. C 0 is the start configuration q 0 w, 2. C t is an accepting configuration, 3. Each configuration C i yields C i+1 Def. N(w) accepts in t time Such a history exists N has time complexity T(n) if for all n, for all inputs of length n and for all histories, N halts in T(n) time 44

Definition: NTIME(t(n)) = { L L is decided by a O(t(n)) time nondeterministic Turing machine } Note: TIME(t(n)) NTIME(t(n)) Is TIME(t(n)) = NTIME(t(n)) for all t(n)? THIS IS AN OPEN QUESTION! What can be done in short NTIME that cannot be done in short TIME? 45

Boolean Formulas logical parentheses operations A satisfying assignment is a setting of the variables that makes the formula true = ( x y) z x = 1, y = 1, z = 1 is a satisfying assignment for Boolean variables (0 or 1) (x y) (z x) 0 0 1 0 46

A Boolean formula is satisfiable if there exists a true/false setting to the variables that makes the formula true YES NO a b c d (x y) x SAT = { is a satisfiable Boolean formula } 47

A 3cnf-formula has the form: (x 1 x 2 x 3 ) (x 4 x 2 x 5 ) (x 3 x 2 x 1 ) literals clauses Ex: (x 1 x 2 x 1 ) (x 3 x 1 ) (x 3 x 2 x 1 ) (x 1 x 2 x 3 ) ( x 4 x 2 x 1 ) (x 3 x 1 x 1 ) (x 1 x 2 x 3 ) (x 3 x 2 x 1 ) 3SAT = { is a satisfiable 3cnf-formula } 48

3SAT = { is a satisfiable 3cnf-formula } Theorem: 3SAT NTIME(n 2 ) Proof Idea: On input : 1. Check if the formula is in 3cnf 2. For each variable v in, nondeterministically substitute either 0 or 1 in place of v ( x y x ) ( 0 y 0 ) ( 1 y 1 ) ( 0 0 0 ) ( 0 1 0 ) 3. Evaluate the formula and accept iff is true 49

NP = NTIME(n k ) k N Nondeterministic Polynomial Time 50

Theorem: L NP There is a constant k and polynomial-time TM V such that L = { x y ϵ Σ* [ y x k and V(x,y) accepts ] } Proof: (1) If L = { x y y x k and V(x,y) accepts } then L NP Given the poly-time TM V, our NP machine for L is: N(x): Nondeterministically guess y. Run V(x,y) (2) If L NP then L = { x y y x k and V(x,y) accepts } Let N be a nondet. poly-time TM that decides L. Define a TM V(x,y) which accepts y encodes an accepting computation history of N on x 51

Moral: A language L is in NP if and only if there are polynomial-length proofs for membership in L 3SAT = { y such that is in 3cnf and y is a satisfying assignment to } SAT = { y such that is a Boolean formula and y is a satisfying assignment to } 52

NP = Problems with the property that, once you have the answer, it is easy to verify the answer SAT is in NP because a satisfying assignment is a polynomial-length proof that a formula is satisfiable When ϵ SAT, I can prove that fact to you with a short proof you can quickly verify 53

The Hamiltonian Path Problem b f e g a d i c h A Hamiltonian path traverses through each node exactly once 55

Assume a reasonable encoding of graphs (example: the adjacency matrix is reasonable) HAMPATH = { (G,s,t) G is a directed graph with a Hamiltonian path from s to t } Theorem: HAMPATH NP A Hamiltonian path P in G from s to t is a proof that (G,s,t) is in HAMPATH Given P (as a permutation on the nodes) can easily check that it is a path through all nodes exactly once 56

The k-clique Problem a d f c b e g k-clique = complete subgraph on k nodes 57

CLIQUE = { (G,k) G is an undirected graph with a k-clique } Theorem: CLIQUE NP A k-clique in G is a proof that (G, k) is in CLIQUE Given a subset S of k nodes from G, we can efficiently check that all possible edges are present between the nodes in S 58

A language is in NP if and only if there are polynomial-length proofs for membership in the language P = the problems that can be efficiently solved NP = the problems where proposed solutions can be efficiently verified Is P = NP? can problem solving be automated? 59

$$$ P = NP? $$$ 60

If P = NP Mathematicians/creators may be out of a job Cryptography as we know it may be impossible In principle, every aspect of daily life could be efficiently and globally optimized life as we know it would be different Conjecture: P NP 61

Next Episode: NP-Complete Problems 62