homework10

# Homework10 - Homework 10 7.1 A true B false C false D true 7.5 No 7.6 Let L1 and L2 be two languages in P and M1 M2 such that L(M1 = L1 and L(M2 =

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

Homework 10 7.1 A. true. B. false. C. false. D. true. 7.5 No. 7.6 Let L1 and L2 be two languages in P, and M1, M2 such that L(M1) = L1 and L(M2) = L2. Union. Construct TM M as follows. On input (w): 1. Run M1 on w. If M1 accepts, M accepts. 2. Run M2 on w. If M2 accepts, M accepts. 3. reject. Note that M accepts if either M1 or M2 does, thus deciding the union of the two languages. Also, Step 1 decides in polynomial time. Likewise Step 2 will be decided in polynomial time. Trivially, so will Step 3. Thus M decides in polynomial time. Concatenation. Construct TM M as follows: On input (w): 1. for i = 0 to |w| 1. Run M1 on w[0,i] 2. Run M2 on w[i+1,|w|] 3. If M1 and M2 accept, then accept 2. reject Note that M accepts only if both halves of w, as split at some point i, are in their respective languages. That is, w[0,i], the substring of w from 0 to i is in L1 and the remainder of the string, w[i+1,|w|] is in L2. Only if there is no split of w in w1,w2 will TM M reject. Thus M decides the concatention of L1 and L2.

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

View Full Document
To show that M is in P, not that the inner loop steps each decide in polynomial time by construction. The summation of their execution times is thus in polynomial time, and the for loop will only increase this execution time by a factor. Thus M is in P. Complement.
This is the end of the preview. Sign up to access the rest of the document.

## This note was uploaded on 04/10/2008 for the course CSE 105 taught by Professor Paturi during the Fall '99 term at UCSD.

### Page1 / 4

Homework10 - Homework 10 7.1 A true B false C false D true 7.5 No 7.6 Let L1 and L2 be two languages in P and M1 M2 such that L(M1 = L1 and L(M2 =

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

View Full Document
Ask a homework question - tutors are online