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/0A(X)=1/0A(X)=1/0 means there is a verification algorithm AAA that accepts /rejects the language LLL.
- xxx in a language is a certain instance(in binary string), remember!!!
- yyy is one certificate for a instance. A(x,y)=1A(x,y)=1A(x,y)=1(AAA is a verification algorithm running in polynomial time) means yyy is a certificate for instance xxx.
1. Definition of PPP
The language LLL could be accept by an algorithm AAA in polynomial time.
2. Definition of NP
2.1 The HAM−CYCLEHAM-CYCLEHAM−CYCLE problem and verification
-
Verification: AAA verifies ccc is a solution to xxx.
-
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∈PL\in PL∈P then L∈NPL\in NPL∈NP: we can easily find a verification algorithm for a P class language which runs in polynomial time.
2.4 Polynomial-time reducibility

- L1≤PL2∧L2∈P−−>L1∈PL_1\le_{P}L_2\land L_2\in P-->L_1\in PL1≤PL2