{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

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

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

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

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

View Full Document
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.
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern