100 likes | 569 Views
Complements of Languages in NP. Osama Awwad Department of Computer Science Western Michigan University April 3, 2014. Complement classes. In general, if C is a complexity class co-C is the complement class, containing all complements of languages in C L C implies (* - L) co-C
E N D
Complements of Languages in NP Osama Awwad Department of Computer Science Western Michigan University April 3, 2014
Complement classes • In general, if C is a complexity class • co-Cis the complement class, containing all complements of languages in C • L C implies (* - L) co-C • (* - L) C implies L co-C • Some classes closed under complement: • e.g. co-P = P
Co-P = P • Given a polynomial-time TM M for L, we can modify M to accept the complement of L as follows: • Make each accepting state of M a nonaccepting state from which there are no moves. Thus, if M accepts, the new TM (L) will halt without accepting. • Create a new state q, which is the only accepting state in the new TM. For each state-symbol combination that has no move, the new TM enters state q, whereupon it accepts and halts.
Co-NP • NP (nondeterministic polynomial-time): class of problems for which, if the answer is yes, then there's a polynomial-size proof of that fact that you can check in polynomial time. • Co-NP: The set of languages whose complements are in NP
Example • Input: graph G=(V,E) • Does G have a Hamiltonian cycle? • Hamiltonian cycle: cycle visiting each vertex exactly once • If G has a Hamiltonian cycle then let us take a promised Hamiltonian cycle – we can check if this is indeed one in O(n) time! • Hamiltonian cycle is in NP • Does G have no Hamiltonian cycle?
Is it true that CoNP = NP? x L Can we transform this machine: x L x L x L qaccept qreject into this machine? qaccept qreject
NP-Complete and Co-NP • Every language in P has its complement also in P, and therefore in NP. • We believe that none of the NP-complete problems have their complements in NP. no NP-complete problem is in Co-NP. • We believe the complements of NP-complete problems, which are by definition in Co-NP, are not in NP.
NPC Co-NP NP P NP-Complete and Co-NP Co-NPC
NP-Complete and Co-NP • Theorem NP=co-NP if and only if the complement of some NP-complete problem is in NP.
Proof • (Only if): Should NP and Co-NP be the same • Every NP-complete problem L, being in NP, is also in co-NP • The complement of a problem in Co-NP is in NP the complement of L is in NP • (If) • Let P be an NP-complete problem • Suppose Pc is in NP • For each L in NP, there is a polynomial-time reduction of L to P • Lc is polynomial reducible to Pc _ Lc is in NP