hw5_sol - Formal Languages and Theory of Computation...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the 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. UNARY-SSUM 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 NP-hard. 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 NP-hard. 7.24 a. Denote the 3 cnf-formula φ 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

{[ snackBarMessage ]}

Page1 / 3

hw5_sol - Formal Languages and Theory of Computation...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online