We have observed above how to test if a language is contained in . However, it is still not clear, if it is necessary at all. We know , but we don't know whether it is a proper subset or not. Although it is theoretically possible, but until now noone has found neither its proof nor its disproof, that .
For the disproof one should find a language from such that it can be shown that there are no deterministic Turing machine, which can recognize it in polynomial time.
Strong research efforts were made for the proof or disproof of . This was one of the reason to introduce the concept of -completeness. As a short description, the -complete languages are the most difficult languages of . If only one of them could be proven to be in , then all language from would be so.
We will need the following definition.
Definition (Karp reduction) 8.3.
Let be two languaes. We say that is Karp reducible to (notation: ), if there exists a deterministic Turing machine with polynomial time complexity, such that we have if and only if .
Karp reducibility means that if one has a task to solve, then it can be rewritten easily to another one and if the new task can be solved easily, then the original task can be solved easily, too. The notation also suggests this property.
Karp reduction can be used for comparing languages by complexity. For this we prove some properties of Karp reduction.
Let be three languages. Then 1. (refelxivity), 2. If and , then (transitivity).
1. Let be the Turing machine in the definition of the Karp reduction such that it terminates immediately when it starts and does not change the content of its tape. This Turing machine implements the identical map, i.e. for all input. By definition, this proves the statement.
2. Let and be two Turing machines, which can be used in the definition of Karp reduction according to the relations and and let and be their time complexity of degrees and . Furthermore, let . For this , if , then . Hence, using the definition .
If is the length of , then computes in at most time. The length of is at most the length of the computation of the Turing machine, since a Turing machine can write at most one new symbol on the tape in a step (to be more precise it may write new symbol at every second step), i.e. . The length of the computation of on is at most . Let be the time complexity of . The length of the computation of on an arbitrary input of length is at most , i.e. . Hence, is a Turing machine with polynomial time complexity and satisfies the conditions of the Karp reduction, i.e. . ✓
Restricting the Karp reduction one gets an equivalence relation.
Let and be two languages. We say that and are Karp equivalent (notation ), if and .
The Karp equivalence is really an equivalence relation, i.e. languages 1. ; 2. if , then ; 3. if and , then .
The statements 1 and 3 are simple consequences of the properties 1 and 2 of the Karp reduction and statement 2 follows from the definition, since the relations and hold independently of their order. ✓
Two languages (task) are Karp equivalent, if they can be transformed to each other in polynomial time, i.e. except for a polynomial transformation, their complexity are the same.
By the interpretation of Karp reduction one may expect the next theorem.
Let and be two languages, such that . Then 1. if , then ; 2. if , then .
Let be a Turing machine with polynomial time complexity, which defines the Karp reduction .
Since , thus there exists Turing machine with polynomial time complexity, such that . Let . By the definition of the Karp reduction, , i.e. .
Let and , let be a word of length and let . The length of the computation of on the input is at most and . The length of the computation of on the input is at most , whence, similarly to the proofs of the previous theorems, the time complexity of satisfies , i.e. has polynomial time complexity. This proves the statement of the theorem.
Similarly to the previous part, since , thus there exists a nondeterministic Turing machine with polynomial time complexity, such that . Let . By the definition of the Karp reduction, , i.e. .
Let and , let be a word of length and let . The length of the computation of on the input is at most and . Since thus accepts it in at most time, whence the time complexity of the nondeterministic Turing machine satisfies , i.e. has polynomial time complexity. This proves the statement of the theorem. ✓
The following theorem defines the class of simplest tasks according to the Karp equivalence.
Let be two nontrivial languages (i.e. neither them nor their complements are empty). Then .
It is enough to prove that , since by the symmetry holds, too.
Since is nontrivial, thus there exist words and . Furthermore, since , thus there exists a deterministic Turing machine with polynomial time complexity, such that .
Let and be two Turing machines, which delete their tapes and write the words and on them, accordingly.
Let define the following Turing machine:
Then, for an arbitrary word we have . Since has polynomial, while and have constant time complexity, thus has polynomial time complexity, too. By definition, this is the statement of the theorem. ✓
If a similar statement is true for languages from , then would hold. Assume that one of the languages is , while the other is an arbitrary . Since , this would mean that .
Since is not known, thus it is also unknown whether any two language from are Karp equivalent or not. One can define however a similar property.
1. A language is called -hard, if all language from can be Karp reduced to it. 2. A language is called -complete, if it is from and it is -hard.
A problem is -complete if it is one of the most difficult problem from .
If an -complete language can be proven to belong to , then .
However, it is not obvious at all, that there exists any -complete language. If one can find some, then to prove about another one to be -complete, is enough to check, whether it is from and the original -complete language is Karp reducible to it. (Then, by the transitive property of Karp reduction every language from can be reduced to it.) This idea helped to show for many languages from to be -complete. Some of them are the following.
1. : the language of satisfiable boolean expressions in conjunctive normal form.
2. The set of graphs having a Hamiltonian cycle.
3. The set of colourable graphs.
4. -click problem (the existence of vertices complete subgraph)
5. -vertices covering in a graph.