FLAC (15-45) Spring 214 - L. Blum THURSDAY APRIL 15-45 REVIEW or Midterm 2 FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY TUESDAY April 8 Deinition: A Turing Machine is a 7-tuple T = (Q, Σ, Γ,, q, q accept, q reject ), where: Q is a inite set o states Σ is the input alphabet, where Σ Γ is the tape alphabet, where Γ and Σ Γ : Q Γ Q Γ {L,R} q Q is the start state q accept Q is the accept state q reject Q is the reject state, and q reject q accept TURING MACHINE FINITE STATE q CONTROL I N P U T INFINITE TAPE CONFIGURATIONS 111q 7 11 q 7 1 1 1 1 1 COMPUTATION HISTORIES An accepting computation history is a sequence o conigurations C 1,C 2,,C k, where 1. C 1 is the start coniguration, C 1 =q w 2. C k is an accepting coniguration, C k =uq accept v. Each C i ollows rom C i-1 via the transition unction A rejecting computation history is a sequence o conigurations C 1,C 2,,C k, where 1. C 1 is the start coniguration, 2. C k is a rejecting coniguration, C k =uq reject v. Each C i ollows rom C i-1 1
FLAC (15-45) Spring 214 - L. Blum We can encode a TM as a string o s and 1s M accepts w i and only i there is an accepting computation history that starts with C 1 =q w n states n 1 m 1 k 1 s 1 t 1 r 1 u 1 m tape symbols (irst k are input symbols) start state accept state reject state blank symbol ( (p,a), (q,b,l) ) = p 1 a 1 q 1 b 1 NB. We assume a given convention o describing TMs by strings in Σ*. We may assume that any string in Σ* describes some TM: Either the string describes a TM by the convention, or i the string is gibberish at some point then the machine just halts i/when a computation gets to that point. A language is called Turing-recognizable or semi-decidable or recursively enumerable (r.e.) i some TM recognizes it A language is called decidable or recursive i some TM decides it Languages over {,1} semi-decidable (r.e.) decidable (recursive) is undecidable: (proo by contradiction) Assume machine H decides H( (M,w) ) = Accept Reject i M accepts w i M does not accept w Construct a new TM D as ollows: on input M, run H on (M,M) and output the opposite o H is undecidable: (proo by contradiction) Assume machine H decides H( (M,w) ) = Accept Reject i M accepts w i M does not accept w Construct a new TM D as ollows: on input M, run H on (M,M) and output the opposite o H D( M ) = Reject Accept i M accepts M i.e. i H(M,M) accepts i M does not accept M i.e. i H(M,M) rejects D( M D ) = Reject Accept i MD accepts DM i MD does not accept DM 2
FLAC (15-45) Spring 214 - L. Blum is undecidable: (constructive proo & subtle) Assume machine H SEMI-DECIDES H( (M,w) ) = Accept i M accepts w Rejects or Loops otherwise Construct a new TM as ollows: on input M, run H on (M,M) and output the opposite o H whenever possible. ( M ) = Reject i M accepts M (i.e. i H( M, M ) = Accept) Accept i M rejects M (i.e. i H( M, M ) = Reject) Loops i M loops on M (i.e. i H( M, M ) loops) Note: There is no contradiction here! loops on We can eectively construct an instance which does not belong to (namely, (, ) ) but H ails to tell us that. THE RECURSION THEOREM Theorem: Let T be a Turing machine that computes a unction t : Σ* Σ* Σ*. There is a Turing machine R that computes a unction r : Σ* Σ*, where or every w Given T: THEN R: (a,b) w r(w) = t(r, w) T R t(a,b) t(r,w) Recursion Theorem: A Turing machine can obtain its own description, and compute with it We can use the operation: Obtain your own description in pseudocode! Given a computable t, we can get a computable r such that r(w) = t(<r>,w) where <R> is a description o r INSIGHT: T (or t) is really R (or r) A NOTE ON SELF REFERENCE Suppose in general we want to design a program that prints its own description. How? Print this sentence. Print two copies o the ollowing (the stu inside quotes), and put the second copy in quotes: Print two copies o the ollowing (the stu inside quotes), and put the second copy in quotes: = B = P <B> THAT PRINTS <itself> Theorem: There is a computable unction q : Σ* Σ*, where or any string w, q(w) is the description o a TM P w that on any input, prints out w and then accepts w Q <P w > TM Q computes q s P w w
FLAC (15-45) Spring 214 - L. Blum THAT PRINTS <itself> Theorem: is undecidable Proo (using the recursion theorem): Inormally <M> B w P <M> M Assume to the contrary, D decides Construct machine R such that On input w: 1. Obtains, via the recursion theorem, its own description R w P <B> <B> B w P <B> B 2. Runs D on (R,w) and lips the output Running R on input w does the opposite o what D says it should! Theorem: is undecidable Proo (using the recursion theorem) Formally 1. Assume to the contrary that D decides 2. Let T(M, w) = opposite o D(M, w). Obtain by the Recursion Theorem, machine R so that R(w) = T(R, w) Then, R(w) accepts T(R, w) accepts D(R, w) rejects by by 2 R(w) does not accept by 1 MIN TM = {<M> M is a minimal TM, wrt <M> } Theorem: MIN TM is not RE. Proo (using the Recursion Theorem): Inormally Assume E enumerates MIN TM Construct machine R such that on input w: 1. Obtains its own description <R> 2. Runs E until a machine D appears with a longer description than o R. Simulate D on w Contradiction. Why? MIN TM = {<M> M is a minimal TM, wrt <M> } Theorem: MIN TM is not RE. Proo (using the Recursion Theorem): Formally Assume E enumerates MIN TM Let T E (x, w) = D(w) where <D> is irst in E s enumeration s.t. <D> > x By the Recursion Theorem, there is a TM R such that: R(w) = T E (<R>, w) = D(w) where <D> is irst in E s enumeration s.t. <D> > <R> Contradiction. Why? Let : Σ* Σ* be a computable unction such that w A (w) B Σ* A B Σ* A m B Say: A is Mapping Reducible to B Write: A m B (also, A m B (why?) ) 4
FLAC (15-45) Spring 214 - L. Blum Let : Σ* Σ* be a computable unction such that w A (w) B Σ* A B Σ* HALT TM = { (M,w) M is a TM that halts on string w } Σ* Σ* A m B A m HALT TM TM HALT TM So, i B is (semi) decidable, then so is A (And i B is (semi) decidable, then so is A) : (M,w) (M, w) where M (s) = M(s) i M(s) accepts, Loops otherwise So, (M, w) (M, w) HALT TM s Σ* E TM = { M M is a TM and L(M) = } REG TM = { M M is a TM and L(M) is regular} Σ* Σ* Σ* Σ* m REG TM m E TM E TM REG TM : (M,w) M w where M w (s) = M(w) i s = w, Loops otherwise So, (M, w) M w E TM s Σ* s Σ* : (M,w) M w where M w (s) = accept i s = n 1 n, M(w) otherwise So, (M, w) M w REG TM E TM = { M M is a TM and L(M) = } EQ TM = {( M, N) M, N are TMs and L(M) =L(N)} ALL PDA = { P P is a PDA and L(P) = Σ* } Σ* Σ* Σ* Σ* E TM E TM m EQ TM EQ TM A m ALL PDA TM ALL PDA s Σ* : M (M, M ) where M (s) = Loops So, M E TM (M, M ) EQ TM : (M,w) PDA P w where s Σ* P w (s) = accept i s is NOT an accepting computation o M(w) So, (M, w ) P w ALL PDA 5
FLAC (15-45) Spring 214 - L. Blum FPCP = { P P is a set o dominos with a match starting with the irst domino } Σ* Σ* PCP = { P P is a set o dominos with a match } Σ* Σ* m FPCP FPCP m PCP PCP Construct : (M,w) P (M,w) such that Construct : (M,w) P (M,w) such that (M, w ) P (M,w) FPCP (M, w ) P (M,w) PCP HALT TM = { (M,w) M is a TM that halts on string w } E TM = { M M is a TM and L(M) = } REG TM = { M M is a TM and L(M) is regular} EQ TM = {(M, N) M, N are TMs and L(M) =L(N)} ALL PDA = { P P is a PDA and L(P) = Σ* } PCP = { P P is a set o dominos with a match } ALL UNDECIDABLE Use Reductions to Prove HALT TM = { (M,w) M is a TM that halts on string w } E TM = { M M is a TM and L(M) = } E TM REG TM = { M M is a TM and L(M) is regular} EQ TM = {(M, N) M, N are TMs and L(M) =L(N)} EQ TM ALL PDA = { P P is a PDA and L(P) = Σ* } ALL PDA PCP = { P P is a set o dominos with a match } ALL UNDECIDABLE Use Reductions to Prove Which are SEMI-DECIDABLE? Then L is undecidable RICE S THEOREM Let L be a language over Turing machines. Assume that L satisies the ollowing properties: 1. For any TMs M 1 and M 2, where L(M 1 ) = L(M 2 ), M 1 L i and only i M 2 L 2. There are TMs M 1 and M 2, where M 1 L and M 2 L EXTREMELY POWERFUL! Then L is undecidable RICE S THEOREM Let L be a language over Turing machines. Assume that L satisies the ollowing properties: 1. For any TMs M 1 and M 2, where L(M 1 ) = L(M 2 ), M 1 L i and only i M 2 L 2. There are TMs M 1 and M 2, where M 1 L and M 2 L FIN TM = { M M is a TM and L(M) is E TM = { M M is inite} a TM and L(M) = } REG TM = { M M is a TM and L(M) is regular} 6
FLAC (15-45) Spring 214 - L. Blum Proo: Show L is undecidable Show: is mapping reducible to L Proo: Show L is undecidable Show: is mapping reducible to L Σ* L Σ* Σ* L Σ* (M,w) (M,w) M 1 (M,w) (M,w) M 2 Proo: RICE S THEOREM Deine M to be a TM that never halts Assume, WLOG, that M L Why? Let M 1 L (such M 1 exists, by assumption) Show is mapping reducible to L : Map (M, w) M w where M w (s) = accepts i both M(w) and M 1 (s) accept loops otherwise What is the language o M w? is mapping reducible to L Σ* L Σ* (M,w) (M,w) M w M 1 M w M QED Corollary: The ollowing are undecidable. E TM = { M M is a TM and L(M) = } REG TM = {M M is TM and L(M) is regular} FINITE STATE q YES? CONTROL ORACLE TMs Is (M,w) in? YES FIN TM = {M M is a TM and L(M) is inite} DEC TM = {M M is a TM and L(M) is decidable} I N P U T INFINITE TAPE 7
FLAC (15-45) Spring 214 - L. Blum A Turing Reduces to B We say A is decidable in B i there is an oracle TM M with oracle B that decides A A T B T VERSUS m Theorem: I A m B then A T B But in general, the converse doesn t hold! Proo: I A m B then there is a computable unction : Σ* Σ*, where or every w, w A (w) B We can thus use an oracle or B to decide A T is transitive Theorem: HALT TM T HALT TM Theorem: HALT TM m HALT TM WHY? THE ARITHMETIC HIERARCHY = { decidable sets } (sets = ) = { semi-decidable sets } n+1 = { sets semi-decidable in some B } n n+1 n = { sets decidable in some B } n = { complements o sets in n } Deinition: A decidable predicate R(x,y) is some proposition about x and y 1, where there is a TM M such that or all x, y, R(x,y) is TRUE M(x,y) accepts R(x,y) is FALSE M(x,y) rejects We say M decides the predicate R. Semidecidable Languages = Decidable Languages Co-semidecidable Languages EXAMPLES: R(x,y) = x + y is less than 1 R(<N>,y) = N halts on y in at most 1 steps Kleene s T predicate, T(<M>, x, y): M accepts x in y steps. 1. x, y are positive integers or elements o * 8
FLAC (15-45) Spring 214 - L. Blum Theorem: A language A is semi-decidable i and only i there is a decidable predicate R(x, y) such that:a = { x y R(x,y) } Proo: (1) I A = { x y R(x,y) } then A is semi-decidable Because we can enumerate over all y s (2) I A is semi-decidable, then A = { x y R(x,y) } Let M semi-decide A and Let R <M> (x,y) be the Kleene T- predicate: T(<M>, x, y): TM M accepts x in y steps (y interpreted as an integer) R <M> is a decidable predicate (why?) So x A i and only i y R <M> (x,y) is true. Theorem = { semi-decidable sets } = o the orm { x y R(x,y) } = { complements o semi-decidable sets } = o the orm { x y R(x,y) } = { decidable sets } 1 = Where R is a decidable predicate Theorem = { sets semi-decidable in some semi-dec. B } = o the orm { x y 1 y 2 R(x,y 1,y 2 ) } = { complements o sets} = o the orm { x y 1 y 2 R(x,y 1,y 2 ) } = Theorem n = { x y1 y 2 y Qy n R(x,y 1,,y n ) } n = { x y 1 y 2 y Qy n R(x,y 1,,y n ) } n = n n Where R is a decidable predicate Where R is a decidable predicate Example = o the orm { x y R(x,y) } We know that is in Decidable predicate Why? Show it can be described in this orm: = { <(M,w)> t [M accepts w in t steps] } decidable predicate = { <(M,w)> t T (<M>, w, t )} = { <(M,w)> v (v is an accepting computation history o M on w} Semidecidable = Decidable Co-semidecidable 9
FLAC (15-45) Spring 214 - L. Blum Example Example = o the orm { x y R(x,y) } Show that EMPTY (ie, E TM ) = { M L(M) = } is in EMPTY = { M wt [M doesn t accept w in t steps] } = o the orm { x y R(x,y) } Show that EMPTY (ie, E TM ) = { M L(M) = } is in EMPTY = { M wt [ T(<M>, w, t) ] } two quantiiers?? decidable predicate two quantiiers?? decidable predicate THE PAIRING FUNCTION Theorem. There is a 1-1 and onto computable unction <, >: Σ* x Σ* Σ* and computable unctions and : Σ* Σ* such that z = <w, t> (z) = w and (z) = t EMPTY EMPTY = { M wt [M doesn t accept w in t steps] = } 2 EMPTY = { M z[m doesn t accept (z) in (z) steps]} 1 Semidecidable EMPTY = { M z[ T(<M>, (z), (z) ) ] } Co-semidecidable Decidable Example = o the orm { x yz R(x,y,z) } Show that TOTAL = { M M halts on all inputs } is in TOTAL = { M w t [M halts on w in t steps] } Example = o the orm { x yz R(x,y,z) } Show that TOTAL = { M M halts on all inputs } is in TOTAL = { M w t [ T(<M>, w, t) ] } decidable predicate decidable predicate 1
FLAC (15-45) Spring 214 - L. Blum TOTAL Example = o the orm { x yz R(x,y,z) } 2 Show that FIN = { M L(M) is inite } is in Semidecidable = EMPTY Decidable Co-semidecidable FIN = { M nwt [Either w < n, or M doesn t accept w in t steps] } FIN = { M nwt ( w < n T(<M>,w, t) )} decidable predicate COF FIN TOTAL FIN TOTAL Semidecidable = EMPTY Co-semidecidable Semidecidable = EMPTY Co-semidecidable Decidable Decidable REG DEC FIN TOTAL FIN TOTAL Semidecidable = EMPTY Co-semidecidable Semidecidable = EMPTY Co-semidecidable Decidable Decidable 11
FLAC (15-45) Spring 214 - L. Blum CFL FIN TOTAL Each is m-complete or its level in hierachy and cannot go lower (by next Theorem, which shows the hierarchy does not collapse). Semidecidable = EMPTY Co-semidecidable Decidable ORACLES not all powerul The ollowing problem cannot be decided, even by a TM with an oracle or the Halting Problem: SUPERHALT = { (M,x) M, with an oracle or the Halting Problem, halts on x} Can use diagonalization here! Suppose H decides SUPERHALT (with oracle) Deine D(X) = i H(X,X) accepts (with oracle) then LOOP, else ACCEPT. D(D) halts H(D,D) accepts D(D) loops ORACLES not all powerul Theorem: The arithmetic hierarchy is strict. That is, the nth level contains a language that isn t in any o the levels below n. Proo IDEA: Same idea as the previous slide. SUPERHALT = HALT = { (M,x) M halts on x}. SUPERHALT 1 = { (M,x) M, with an oracle or the Halting Problem, halts on x} SUPERHALT n = { (M,x) M, with an oracle or SUPERHALT n-1, halts on x} Theorem: 1. The hierarchy is strict 2. Each o the is m-complete or its class. Proo Idea. 1. Let,1 =, n+1 = {(M,x) M is an oracle machine with oracle and M accepts x} Then, n n - n Theorem: 1. The hierarchy is strict 2. Each o the is m-complete or its class. Proo. 2. Eg to show FIN is m-complete or Need to show FIN = { M n x t ( x <n or a) FIN M does not accept x in t 2 steps)} b) For A then A m FIN 12
FLAC (15-45) Spring 214 - L. Blum For A, A={ x yz R(x,y,z)} FIN = { M L(M) is inite } Σ* Σ* For A, A={ x yz R(x,y,z)} FIN = { M L(M) is inite } Σ* Σ* A FIN A FIN : x M x Given input w: For each y o length w or less, look or z such that R(x,y,z)}. I ound or all such y, Accept. Otherwise keep on running. I x A, then yz R(x,y,z)}, so when w > y, M x keeps on running, so M x FIN. I x A, then yz R(x,y,z)}, so M x recognizes Σ* CAN WE QUANTIFY HOW MUCH INFORMATION IS IN A STRING? A = 1111111111111111 B = 1111111111111111111 Idea: The more we can compress a string, the less inormation it contains. KOLMOGOROV COMPLEXITY Deinition: Let x in {,1}*. The shortest description o x, denoted as d(x), is the lexicographically shortest string <M,w> s.t. M(w) halts with x on tape. Use pairing unction to code <M,w> Deinition: The Kolmogorov complexity o x, denoted as K(x), is d(x). KOLMOGOROV COMPLEXITY Theorem: There is a ixed c so that or all x in {,1}*, K(x) x + c The amount o inormation in x isn t much more than x Proo: Deine M = On w, halt. On any string x, M(x) halts with x on its tape! This implies K(x) <M,x> M + x + 1 c + x (Note: M is ixed or all x. So M is constant) REPETITIVE STRINGS Theorem: There is a ixed c so that or all x in {,1}*, K(xx) K(x) + c The inormation in xx isn t much more than that in x Proo: Let N = On <M,w>, let s=m(w). Print ss. Let <M,w > be the shortest description o x. Then <N,<M,w >> is a description o xx Thereore K(xx) <N,<M,w >> N + K(x) + 1 c + K(x) 1
FLAC (15-45) Spring 214 - L. Blum REPETITIVE STRINGS Corollary: There is a ixed c so that or all n, and all x {,1}*, K(x n ) K(x) + c log 2 n The inormation in x n isn t much more than that in x Proo: An intuitive way to see this: Deine M: On <x, n>, print x or n times. Now take <M,<x,n>> as a description o x n. In binary, n takes O(log n) bits to write down, so we have K(x) + O(log n) as an upper bound on K(x n ). REPETITIVE STRINGS Corollary: There is a ixed c so that or all n, and all x {,1}*, K(x n ) K(x) + c log 2 n The inormation in x n isn t much more than that in x Recall: A = 1111111111111111 For w = (1) n, K(w) K(1) + c log 2 n CONCATENATION o STRINGS Theorem: There is a ixed c so that or all x, y in {,1}*, K(xy) K(x) + K(y) + c Better: K(xy) logk(x) +K(x) + K(y) + c INCOMPRESSIBLE STRINGS Theorem: For all n, there is an x {,1} n such that K(x) n There are incompressible strings o every length Proo: (Number o binary strings o length n) = 2 n (Number o descriptions o length < n) (Number o binary strings o length < n) = 2 n 1. Thereore: there s at least one n-bit string that doesn t have a description o length < n INCOMPRESSIBLE STRINGS Theorem: For all n and c, Pr x {,1}^n [ K(x) n-c ] 1/2 c Most strings are airly incompressible Proo: (Number o binary strings o length n) = 2 n (Number o descriptions o length < n-c) (Number o binary strings o length < n-c) = 2 n-c 1. So the probability that a random x has K(x) < n-c is at most (2 n-c 1)/2 n < 1/2 c. DETERMINING COMPRESSIBILITY Can an algorithm help us compress strings? Can an algorithm tell us when a string is compressible? COMPRESS = {(x,c) K(x) c} Theorem: COMPRESS is undecidable! Berry Paradox: The irst string whose shortest description cannot be written in less than iteen words. 14
FLAC (15-45) Spring 214 - L. Blum DETERMINING COMPRESSIBILITY COMPRESS = {(x,n) K(x) n} Theorem: COMPRESS is undecidable! Proo: M = On input x {,1}*, Interpret x as integer n. ( x log n) Find irst y {,1}* in lexicographical order, s.t. (y,n) COMPRESS, then print y and halt. M(x) prints the irst string y* with K(y*) > n. Thus <M,x> describes y*, and <M,x> c + log n So n < K(y*) c + log n. CONTRADICTION! DETERMINING COMPRESSIBILITY Theorem: K is not computable Proo: M = On input x {,1}*, Interpret x as integer n. ( x log n) Find irst y {,1}* in lexicographical order, s. t. K(y) >n, then print y and halt. M(x) prints the irst string y* with K(y*) > n. Thus <M,x> describes y*, and <M,x> c + log n So n < K(y*) c + log n. CONTRADICTION! DETERMINING COMPRESSIBILITY What about other measures o compressibility? For example: the smallest DFA that recognizes {x} the shortest grammar in Chomsky normal orm that generates the language {x} SO WHAT CAN YOU DO WITH THIS? Many results in mathematics can be proved very simply using incompressibility. Theorem: There are ininitely many primes. IDEA: Finitely many primes can compress everything! Proo: Suppose not. Let p 1,, p k be the primes. Let x be incompressible. Think o n = x as integer. Then there are e i s.t. n = p 1 e1 p k ek For all i, e i log n, so e i log log n Can describe n (and x) with k log log n + c bits! But x was incompressible CONTRADICTION! Deinition: Let M be a TM that halts on all inputs. The running time or time complexity o M is a unction : N N, where (n) is the maximum number o steps that M uses on any input o length n. Deinition: TIME(t(n)) = { L L is a language decided by a O(t(n)) time Turing Machine } P = TIME(n k ) k N Deinition: A Non-Deterministic TM is a 7-tuple T = (Q, Σ, Γ,, q, q accept, q reject ), where: Q is a inite set o states Σ is the input alphabet, where Σ Γ is the tape alphabet, where Γ and Σ Γ : Q Γ 2 (Q Γ {L,R}) q Q is the start state q accept Q is the accept state q reject Q is the reject state, and q reject q accept 15
FLAC (15-45) Spring 214 - L. Blum Theorem: L NP i there exists a poly-time Turing machine V with L = { x y [ y = poly( x ) and V(x,y) accepts ] } Deinition: NTIME(t(n)) = { L L is decided by a O(t(n))-time non-deterministic Turing machine } TIME(t(n)) NTIME(t(n)) NP = NTIME(n k ) k N Proo: (1) I L = { x y y = poly( x ) and V(x,y) accepts } then L NP Non-deterministically guess y and then run V(x,y) (2) I L NP then L = { x y y = poly( x ) and V(x,y) accepts } Let N be a non-deterministic poly-time TM that decides L, deine V(x,y) to accept i y is an accepting computation history o N on x A language is in NP i and only i there exist polynomial-length proos or membership to the language P = the problems that can be eiciently solved NP = the problems where proposed solutions can be eiciently veriied P = NP? Can Problem Solving Be Automated? $$$ A Clay Institute Millennium Problem POLY-TIME REDUCIBILITY : Σ* Σ* is a polynomial time computable unction i some poly-time Turing machine M, on every input w, halts with just (w) on its tape Language A is polynomial time reducible to language B, written A P B, i there is a polytime computable unction : Σ* Σ* such that: w A (w) B is called a polynomial time reduction o A to B Theorem: I A P B and B P, then A P SAT = { (y)[ y is a satisying assignment to and is a boolean ormula ] } SAT = { (y)[y is a satisying assignment to and is in cn ] } Theorem (Cook-Levin): SAT and -SAT are NP-complete 1. SAT NP: A satisying assignment is a proo that a ormula is satisiable! 2. SAT is NP-hard: Every language in NP can be polytime reduced to SAT (complex ormula) Corollary: SAT P i and only i P = NP 16
FLAC (15-45) Spring 214 - L. Blum Assume a reasonable encoding o graphs (example: the adjacency matrix is reasonable) (x 1 x 1 x 2 ) (x 1 x 2 x 2 ) (x 1 x 2 x 2 ) x 1 x 2 x 2 CLIQUE = { (G,k) G is an undirected graph with a k-clique } Theorem: CLIQUE is NP-Complete (1) CLIQUE NP (2) SAT P CLIQUE c l a u s e x 1 x 1 x 1 x 2 x 2 x 2 #nodes = (# clauses) k = #clauses (x 1 x 1 x 2 ) (x 1 x 2 x 2 ) (x 1 x 2 x 2 ) Variables and negations o variables VERTEX-COVER = { (G,k) G is an undirected graph with a k-node vertex cover } x 1 x 1 x 2 x 2 Theorem: VERTEX-COVER is NP-Complete (1) VERTEX-COVER NP (2) SAT P VERTEX-COVER x 1 clauses x 1 x 1 x 1 x 2 x 2 x 2 x 2 x 2 k = 2(#clauses) + (#variables) HAMPATH = { (G,s,t) G is an directed graph with a Hamilton path rom s to t} Theorem: HAMPATH is NP-Complete (1) HAMPATH NP (2) SAT P HAMPATH Proo is in Sipser, Chapter 7.5 17
FLAC (15-45) Spring 214 - L. Blum UHAMPATH = { (G,s,t) G is an undirected graph with a Hamilton path rom s to t} Theorem: UHAMPATH is NP-Complete (1) UHAMPATH NP (2) HAMPATH P UHAMPATH SUBSETSUM = { (S, t) S is multiset o integers and or some Y S, we have y Y y = t } Theorem: SUBSETSUM is NP-Complete (1) SUBSETSUM NP (2) SAT P SUBSETSUM HW Let G denote a graph, and s and t denote nodes. SHORTEST PATH = {(G, s, t, k) G has a simple path o length < k rom s to t } LONGEST PATH = {(G, s, t, k) G has a simple path o length > k rom s to t } WWW.FLAC.WS Good Luck on Midterm 2! WHICH IS EASY? WHICH IS HARD? Justiy (see Sipser 7.21) 18