1 short answers a define the following terms and concepts
play

1. Short answers: (a) Define the following terms and concepts: i. - PowerPoint PPT Presentation

2 CS 341 Practice Final 1. Short answers: (a) Define the following terms and concepts: i. Union, intersection, set concatenation, Kleene-star, set CS 341 Practice Final subtraction, complement Answer: Union: S T = { x | x S or x T


  1. 2 CS 341 Practice Final 1. Short answers: (a) Define the following terms and concepts: i. Union, intersection, set concatenation, Kleene-star, set CS 341 Practice Final subtraction, complement Answer: Union: S ∪ T = { x | x ∈ S or x ∈ T } Marvin K. Nakayama Intersection: S ∩ T = { x | x ∈ S and x ∈ T } Computer Science Dept., NJIT Concatenation: S ◦ T = { xy | x ∈ S, y ∈ T } Kleene-star: S ∗ = { w 1 w 2 · · · w k | k ≥ 0 , w i ∈ S ∀ i = 1 , 2 , . . . , k } Subtraction: S − T = { x | x ∈ S, x �∈ T } Complement: S = { x ∈ Ω | x �∈ S } = Ω − S , where Ω is the universe of all elements under consideration. ii. A set S is closed under an operation f Answer: S is closed under f if applying f to members of S always returns a member of S . CS 341 Practice Final 3 CS 341 Practice Final 4 iii. Regular language vii. Church-Turing Thesis Answer: A regular language is defined by a DFA. Answer: The informal notion of algorithm corresponds exactly to a Turing machine that always halts (i.e., a decider). iv. Kleene’s theorem viii. Turing-decidable language Answer: A language is regular if and only if it has a regular expression. Answer: A language A that is decided by a Turing machine; i.e., there is a Turing machine M such that v. Context-free language • M halts and accepts on any input w ∈ A , and Answer: A CFL is defined by a CFG. • M halts and rejects on input input w �∈ A . vi. Chomsky normal form Looping cannot happen. Answer: A CFG is in Chomsky normal form if each of its rules ix. Turing-recognizable language has one of 3 forms: Answer: A language A that is recognized by a Turing machine; or S → ε, A → BC, A → x, i.e., there is a Turing machine M such that • M halts and accepts on any input w ∈ A , and where A, B, C are variables, B and C are not the start variable, x is a terminal, and S is the start variable. • M rejects or loops on any input w �∈ A .

  2. 5 6 CS 341 Practice Final CS 341 Practice Final x. co-Turing-recognizable language xii. Language A is mapping reducible to language B , A ≤ m B Answer: A language whose complement is Turing-recognizable. Answer: • Suppose A is a language defined over alphabet Σ 1 , xi. Countable and uncountable sets and B is a language defined over alphabet Σ 2 . Answer: • Then A ≤ m B means there is a computable function • A set S is countable if it is finite or we can define a f : Σ ∗ 1 → Σ ∗ 2 such that w ∈ A if and only if f ( w ) ∈ B . correspondence between S and the positive integers. f • In other words, we can create a list of all the elements in S and Σ ∗ Σ ∗ each specific element will eventually appear in the list. 2 1 • An uncountable set is a set that is not countable. f B A • A common approach to prove a set is uncountable is by using a diagonalization argument. w ∈ A ⇐ ⇒ f ( w ) ∈ B YES instance for problem A ⇐ ⇒ YES instance for problem B CS 341 Practice Final 7 CS 341 Practice Final 8 xiii. Function f ( n ) is O ( g ( n )) xv. Language A is polynomial-time mapping reducible to language B , A ≤ P B . Answer: There exist constants c and n 0 such that | f ( n ) | ≤ c · g ( n ) for all n ≥ n 0 . Answer: • Suppose A is a language defined over alphabet Σ 1 , xiv. Classes P and NP and B is a language defined over alphabet Σ 2 . Answer: • Then A ≤ P B means ∃ polynomial-time computable function • P is the class of languages that can be decided by a f : Σ ∗ 1 → Σ ∗ 2 such that w ∈ A if and only if f ( w ) ∈ B . deterministic Turing machine in polynomial time. • NP is the class of languages that can be verified in (deterministic) polynomial time. • Equivalently, NP is the class of languages that can be decided by a nondeterministic Turing machine in polynomial time.

  3. 9 10 CS 341 Practice Final CS 341 Practice Final xvi. NP-complete (b) Give the transition functions δ of a DFA, NFA, PDA, Turing machine and nondeterministic Turing machine. Answer: Language B is NP-Complete if B ∈ NP , and for every language A ∈ NP , we have A ≤ P B . Answer: • DFA, δ : Q × Σ → Q , NP A 3 A 4 where Q is the set of states and Σ is the alphabet. A 2 a b B a A 5 b A 1 q 1 q 2 q 3 C a, b Typical approach for proving language C is NP-Complete : • NFA, δ : Q × Σ ε → P ( Q ) , • first show C ∈ NP where Σ ε = Σ ∪ { ε } and P ( Q ) is the power set of Q • then show a known NP-Complete language B satisfies B ≤ P C . 0 , ε 1 1 xvii. NP-hard q 1 q 2 q 3 q 4 0 , 1 Answer: Lang B is NP-hard if A ≤ P B for every lang A ∈ NP . 0 , 1 CS 341 Practice Final 11 CS 341 Practice Final 12 • PDA, δ : Q × Σ ε × Γ ε → P ( Q × Γ ε ) , • Nondeterministic Turing machine, δ : Q × Γ → P ( Q × Γ × { L, R } ) where Γ is the stack alphabet and Γ ε = Γ ∪ { ε } . Stack a, b → c q j b c q i q j c → a, L d d read, pop → push � � c → c, R q i q k Before After • Turing machine, δ : Q × Γ → Q × Γ × { L, R } , c → a, L where Γ is the tape alphabet, L means move tape head one cell q ℓ c → d, R left, and R means move tape head one cell right. Multiple choices when in state q i and read c from tape: Before a b a a � � � � a → b, L q s Tape δ ( q i , c ) = { ( q j , a, L ) , ( q k , c, R ) , ( q ℓ , a, L ) , ( q ℓ , d, R ) } read → write, move After a b b a � � � �

  4. 13 14 CS 341 Practice Final CS 341 Practice Final (c) Explain the “P vs. NP” problem. 2. Recall that A TM = { � M, w � | M is a TM that accepts string w } . Answer: (a) Prove that A TM is undecidable. You may not cite any theorems or corollaries in your proof. • P is the class of languages that can be solved in polynomial time. • NP is the class of languages that can be verified in (deterministic) Overview of Proof: polynomial time. • Suppose A TM is decided by some TM H , taking input � M, w � . • We know that P ⊆ NP , but it is currently unknown accept , if � M, w � ∈ A TM if P = NP or P � = NP . ✟✟✟✟ ✯ − → � M, w � H ❍❍❍❍ reject , if � M, w � �∈ A TM ❥ • Define another TM D using H as a subroutine. D accept accept ❍❍❍❍❍❍❍❍ ✟ ✯ ✟✟✟✟ ✯ ✟✟✟✟✟✟✟✟ − → � M � − → � M, � M �� H ❍❍❍❍ reject reject ❥ ❍ ❥ • What happens when we run D with input � D � ? D accepts � D � iff D doesn’t accept � D � , which is impossible. CS 341 Practice Final 15 CS 341 Practice Final 16 Detailed Proof: (b) Show that A TM is Turing-recognizable. • Suppose there exists a TM H that decides A TM . Answer: The universal TM U recognizes A TM , where U is defined • Consider language as follows: L = { � M � | M is a TM that does not accept � M � } . U = “On input � M, w � , where M is a TM and w is a string: • Now construct a TM D for L using TM H as a subroutine: 1 . Run M on w . D = “On input � M � , where M is a TM: 2 . If M accepts w , accept ; if M rejects w , reject .” 1 . Run H on input � M, � M �� . Note that U only recognizes A TM and does not decide A TM since 2 . If H accepts, reject . If H rejects, accept .” when we run M on w , there is the possibility that M neither • If we run TM D on input � D � , then D accepts � D � if and only if accepts nor rejects w but rather loops on w . D doesn’t accept � D � . • Since this is impossible, TM H must not exist.

Recommend


More recommend