This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: Formal Languages and Theory of Computation Homework 5 Solutions 2009.12.21 Note that the solutions have been skipped many details which must be shown on your answer sheets. 7.16 The length of unary representation could be exponential, so the reduction cannot be done in polynomial time. UNARYSSUM is in P since the following algorithm solving it. Input: ( S,t ) , where S = { x 1 ,... ,x k } Variables: Integers i,j,a [0 ..k ][0 ..t ], all initialized to 0 a [0][0] ← 1; for i = 1 to k do for j = 0 to t x i do if a [ i 1][ j ] = 1 then a [ i ][ j + x i ] ← 1; next j next i if a [ k ][ t ] = 1 then accept else reject; 7.17 Since P = NP , every langauge A ∈ P is in NP . The rest part is to prove A is also NPhard. Now we reduce SAT to A . Let M be the TM deciding whether x ∈ SAT in polynomial time. Let f ( x ) = braceleftbigg P A , x ∈ SAT N A , x / ∈ SAT where P A ∈ A and N A / ∈ A . Note that we can use M to decide whether x ∈ SAT in polynomial time. Moreover, P A and N A can be computed in polynomial time in  x  (You should prove this). So we conclude A is also NPhard. 7.24 a. Denote the 3 cnfformula φ as ∧ L j =1 ( l j, 1 ∨ l j, 2 ∨ l j, 3 ). Let A be an negationslash =assignment for φ , then ∀ j ∈ { 1 , 2 ,...,L } , ∃ k ∈ { 1 , 2 , 3 }...
View
Full Document
 Spring '10
 cs
 Trigraph, Computational complexity theory, NPcomplete, polynomial time, History of the Church–Turing thesis

Click to edit the document details