HW5ans - Farley Lai,00764474 TheoryofComputation,Homework5...

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

View Full Document Right Arrow Icon
Farley Lai, 00764474 Theory of Computation, Homework 5 7.6 i.) union Without loss of generality, let and be the TMs that decide two languages and in M 1 M 2 L 1 L 2 P. Then we construct a TM that decides the union of and in polynomial time. M L 1 L 2 ”on input M = w 1. Run on . Accept if it accepts. M 1 w 2. Run on . Accept if it accepts. M 2 w 3. Otherwise, reject.” Since stage1 and stage2 both run in polynomial time, TM can decide the union of and M L 1 L 2 in polynomial time. Hence, is closed under union. P ii.) concatenation Without loss of generality, let and be the TMs that decide two languages and in M 1 M 2 L 1 L 2 P. Then we construct a TM that decides the concatenation of and in polynomial time. M L 1 L 2 ”on input M = w 1. For each possible split of w = w w 1 2 a. Run on and run on . Accept if both accept. M 1 w 1 M 2 w 2 2. Otherwise, reject.” Assume the . There are possible splits of at most. Besides, the sum of the time w j j = n ( n ) O w complexities of and is also polynomial. Thus, step1 run in polynomial time and TM M 1 M 2 M can decide the concatenation of and in polynomial time. Hence, is closed under L 1 L 2 P concatenation. iii.) complement Without loss of generality, let be the TM that decides a language in P. Then we construct M L a TM that decides the complement of in polynomial time. M 0 L ”on input M 0 = w 1. Run on M w 2. Accept if it rejects. Otherwise, reject if it accepts.” Since step1 run in polynomial time, TM can decide the complement of in polynomial time. M 0 L Hence, is closed under complement. P
Background image of page 1

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

View Full Document Right Arrow Icon
7.7 i.) union Without loss of generality, let and be the NTMs that decide two languages and N 1 N 2 L 1 L 2 in NP. Then we construct an NTM that decides the union of and in polynomial time. N L 1 L 2 ”on input N = w 1. Run on nondeterministically. Accept if it accepts. N 1 w 2. Run on nondeterministically. Accept if it accepts. N 2 w 3. Otherwise, reject.” Since stage1 and stage2 both run in polynomial time nondeterministically, NTM can decide N the union of and in polynomial time. Hence, is closed under union. L 1 L 2 P N ii.) concatenation Without loss of generality, let and be the NTMs that decide two languages and N 1 N 2 L 1 L 2 in NP. Then we construct an NTM that decides the concatenation of and in polynomial N L 1 L 2 time.
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

Page1 / 6

HW5ans - Farley Lai,00764474 TheoryofComputation,Homework5...

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

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