NP completeness
- Here we use binary string in our problems;
- Call an instance of a problem language, and x ∈ { 0 , 1 } ∗ x\in\{0,1\}^* x∈{ 0,1}∗ means the input of the language x is encoded in binary; A ( X ) = 1 / 0 A(X)=1/0 A(X)=1/0 means there is a verification algorithm A A A that accepts /rejects the language L L L.
- x x x in a language is a certain instance(in binary string), remember!!!
- y y y is one certificate for a instance. A ( x , y ) = 1 A(x,y)=1 A(x,y)=1( A A A is a verification algorithm running in polynomial time) means y y y is a certificate for instance x x x.
1. Definition of P P P
The language L L L could be accept by an algorithm A A A in polynomial time.
2. Definition of NP
2.1 The H A M − C Y C L E HAM-CYCLE HAM−CYCLE problem and verification
-
Verification: A A A verifies c c c is a solution to x x x.
-
HAM-CYCLE: An undirected graph G is hamiltonian if it contains a simple cycle containing every vertex of G.
-
Verifying HAM-CYCLE
2.2 Verifying a language
2.3 The complexity of NP
- Definition: L = { x ∈ { 0 , 1 } ∗ ∣ L=\{x\in\{0,1\}^*| L={ x∈{ 0,1}∗∣ there is a y ∈ { 0 , 1 } ∗ y\in\{0,1\}^* y∈{ 0,1}∗ with ∣ y ∣ = O ( ∣ x ∣ c ) |y|=O(|x|^c) ∣y∣=O(∣x∣c) such that A ( x , y ) = 1 } A(x,y)=1\} A(x,y)=1}
- If L ∈ P L\in P L∈P then L ∈ N P L\in NP L∈NP: we can easily find a verification algorithm for a P class language which runs in polynomial time.
2.4 Polynomial-time reducibility

- L 1 ≤ P L 2 ∧ L 2 ∈ P − − > L 1 ∈ P L_1\le_{P}L_2\land L_2\in P-->L_1\in P L1≤PL2∧