I've seen several places that have simply stated that it's known that P is a subset of the intersection of NP and co-NP. Proofs that show that P is a subset of NP are not hard to find. So to show that it's a subset of the intersection, all that's left to be done is show that P is a subset of co-NP. What might a proof of this be like? Thank you much!
The class P is closed under complementation: if L is a language in P, then the complement of L is also in P. You can see this by taking any polynomial-time decider for L and switching the accept and reject states; this new machine now decides the complement of L and does so in polynomial time.
A language L is in co-NP iff its complement is in NP. So consider any language L ∈ P. The complement of L is also in P, so the complement of L is therefore in NP (because P ⊆ NP). Therefore, L is in co-NP. Consequently, P ⊆ co-NP.
Hope this helps!
Think of it this way. Consider the class co-P. Since P is closed under compliment, P=co-P.
It should also be clear that co-P is a subset of co-NP because P is contained in NP. Since P = co-P, it follows that P is contained in co-NP.
Related
Someone asked me this question and I found I could not answer it even after spending some time re-reading my college textbooks. Specifically, here is the definition of co-NP in many text books:
Definition 1
"a problem A is in co-NP if and only if there is a polynomial time procedure V (·, ·) and a polynomial bound p() such that x ∈ A if and only if ∀y : |y| ≤ p(|x|), V (x, y) = 1"
Doesn't this mean that if A is in co-NP, then it MUST have a certificate (because every y would be a certificate) and therefore, A is also in NP?
With some thoughts, I am not sure the above definition is correct. Given the following definition of NP:
Definition 2
"a decision problem A is in NP if and only if there is a polynomial time
procedure V (·, ·) and a polynomial time bound p() such that x ∈ A if and only if ∃y.|y| ≤ p(|x|) ∧ V (x, y) = 1"
The straightforward definition for co-NP seems to be:
Definition 3
"a decision problem A is in co-NP if and only if there is a polynomial time bound p() such that x ∈ A if and only if ∀y : |y| ≤ p(|x|) there does NOT exist a polynomial time procedure V(.,.) such that V (x, y) = 1"
However, Definition 3 is not equivalent to Definition 1, because V(.,.) can be undecidable. Am I missing anything? Thanks!
Doesn't this mean that if A is in co-NP, then it MUST have a certificate (because every y would be a certificate) and therefore, A is also in NP?
No. V is not a verifier for problem A in the sense of the definition of NP. For V to be a verifier in that sense, we would need to be able to determine x ∈ A by finding a single y such that V(x, y) = 1. With this V, we need to check all possible values of y.
Your proposed "straightforward definition" of co-NP is wrong. For any problem A, we could pick V to be the procedure that ignores its arguments and immediately returns 1. Thus, by your definition, no problems would be in co-NP.
In this case the p is supposed to be a subscript. Is it supposed to mean less than or equal polynomial time?
A ≤p B means that there is a polynomial-time many-one reduction from A to B, i.e., there exists a polynomial-time computable function f such that, for every string x, we have x in A if and only if f(x) in B.
My problem: Define two sets P and Q of words (that is, two problems) such that:
P is undecidable and not semidecidable, Q is undecidable and semidecidable and P ⊂ Q
One example of such sets:
Define Q as the set of turing machines, which halt on empty input. Define P as the set of turing machines, which halt on every input.
Clearly P ⊂ Q and P is undecidable and not semidecidable, but Q is undecidable and semidecidable.
Let L be a language s.t. for every natural n, the number of words of length n in L is n.
The alphabet is {0,1}.
And let's assume that L is NP. Why L-complement is also in NP?
Since L is in NP it is decidable (recursive) and so is its complement L'. Now, L' may or may not be in NP. But we are given that for any string length n, exactly one string belong to L, which means for any string length all but one string belong to L'.
Now, definition of NP says that all "yes" instances of the problem can be solved in polynomial time using a nondeterministic TM. So, given an instance of , we non-deterministically take all words of length n, where n is the length of w, and see if it is in L. As soon as we get the word (such a word is sure to exist as exactly one word of length n belong to L), we see if this word is same as x. If it is not same (and only if it is not same), x in L' and we get this answer in polynomial time making L' an NP problem.
If it is known a-priori that L has the property that there are exactly n words of length n in L, then your statement follows. In fact, this works for any polynomial amount of words in L. In other words, if we allow there to be poly(n) words in L with poly(n) known a-priori, the idea still works. To see this, note that to find all words of length n is L is also in NP since there is a polynomial number of them.
To see if s in {0,1}* is in L-complement, just form the certificate for all words of length |s|, and see if s is one of the words. If s is one of the words, then of course, s is in L, and if s is not one of the words, s is in L-complement.
I have this assignment to prove that this problem:
Finite alphabet £, two strings x,y €
£*, and a positive integer K. Is
there a way to derive the string y
from the string x by a sequence of K
or fewer operations of single symbol
deletion or adjacent symbol
interchange?
is np-complete. I already figured out I have to make transformation from decision version of set covering problem, but I have no clue how to do this. Any help would be appreciated.
It looks like modified Levenshtein distance. Problem can be solved with DP in quadratic time.
Transformation from minimum set cover (MSC) to this string correction problem is described in:
Robert A. Wagner
On the complexity of the Extended String-to-String Correction Problem
1975, Proceedings of seventh annual ACM symposium on Theory of computing
In short with MSC problem:
Given finite sets x_1, ..., x_n, and integer L, does there exists a subset J of {1,...,n} such that |J| <= L, and
union_{j in J} x_j = union all x_i ?
Let w = union all x_i, let t = |w| and r = t^2, and choose symbols Q, R, S not in w.
Take strings:
A = Q^r R x_1 Q^r S^(r+1) ... Q^r R x_n Q^r S^(r+1)
B = R Q^r ... R Q^r w S^(r+1) ... S^(r+1) <- each ... is n times
and
k = (l+1)r - 1 + 2t(r+1)(n-1) + n(n-1)(r+1)^2/2 + (r*n + |x_1 ... x_n| - t)*W_d
[W_d is delete operation weight, can be 1.]
It is shown that string-string correction problems (A,B,k) is satisfiable iff source MSC problem is.
From strings construction it is clear that proof is not trivial :-) But it isn't too complex to manage.
The NP-hardness proof that is mentioned only works for arbitrarily large alphabets.
For finite alphabets, the problem is polynomial-time, see
https://dblp.org/rec/bibtex/journals/tcs/Meister15