Question #43230

Both P and NP are closed under operation
a) union
b) intersection
c) concatination
d) Kleene

Expert's answer

Answer on Question #43230 – Math – Other

Both P and NP are closed under operation

a) union

b) intersection

c) concatenation

d) Kleene

Solution. Both sets are closed under all four operations. First we will show that NPNP is closed under all four operations.

Assume that L1,L2NPL_1, L_2 \in NP. This means that there are nondeterministic deciders M1M_1 and M2M_2 such that M1M_1 decides L1L_1 in nondeterministic time O(nk1)O(n^{k_1}) and M2M_2 deciders L2L_2 in nondeterministic time O(nk2)O(n^{k_2}).

Intersection:

M=M = "On input ww:

1. Run M1M_1 on ww. If M1M_1 rejected then reject.

2. Else run M2M_2 on ww. If M2M_2 rejected then reject.

3. Else accept."

The longest branch in any computation tree on input ww of length nn is O(nmax(k1,k2))O(n^{\max(k_1, k_2)}). So MM is a poly-time nondeterministic decider for L1L2L_1 \cap L_2.

Union:

M=M = "On input ww:

1. Run M1M_1 on ww. If M1M_1 accepted then accept.

2. Else run M2M_2 on ww. If M2M_2 accepted then accept.

3. Else reject."

The longest branch in any computation tree on input ww of length nn is O(nmax(k1,k2))O(n^{\max(k_1, k_2)}). So MM is a poly-time nondeterministic decider for L1L2L_1 \cup L_2.

Concatenation:

M=M = "On input ww:

1. Nondeterministically split ww into w1,w2w_1, w_2 such that w=w1w2w = w_1 w_2.

2. Run M1M_1 on w1w_1. If M1M_1 rejected then reject.

3. Else run M2M_2 on w2w_2. If M2M_2 rejected then reject.

4. Else accept."

The longest branch in any computation tree on input ww of length nn is O(nmax(k1,k2))O(n^{\max(k_1, k_2)}). So MM is a poly-time nondeterministic decider for L1L2L_1 \circ L_2.

Kleene star:

M=M = "On input ww:

1. If w=ew = e then accept.

2. Nondeterministically select a number mm such that 1mw1 \leq m \leq |w|.

3. Nondeterministically split ww into mm pieces such that w=w1w2wmw = w_1 w_2 \ldots w_m.

4. For all ii, 1im1 \leq i \leq m: run M1M_1 on wiw_i. If M1M_1 rejected then reject.

5. Else (M1M_1 accepted all wiw_i, 1im1 \leq i \leq m), accept."

The total running time is O(nk1+1)O(n^{k_1 + 1}). This means that MM is a poly-time nondeterministic decider for L1L_1^*.

The same construction can be used to prove that PP is closed under all four operations.

Answer: Both sets are closed under all four operations.

www.AssignmentExpert.com


Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

LATEST TUTORIALS
APPROVED BY CLIENTS