A system Ax ≤ b of linear inequalities (whereA is an integer matrix with m rows and n
columns andbis a column vector ofmelements) can be considered a word over the alphabet consisting of the symbols “0”, “1”, “,” and “;” when e.g. we represent its elements in the binary number system, write the matrix row after row, placing a comma after each number and a semicolon after each row. The following properties of systems of linear inequalities are in NP:
Problem 6.4.14 Existence of solution The solution offers itself as an obvious witness of solvability but we must be careful: we must be convinced that if a system of linear equa- tions with integer coefficients has a solution then it has a solution among rational numbers, moreover, even a solution in which the numerators and denominators have only a polynomial number of bits. These facts follow from the elements of the theory of linear programming. Problem 6.4.15 Nonexistence of solution Witnesses for the non-existence of solution can be found using the following fundamental theorem known from linear programming:
Theorem 6.4.6 Farkas Lemma The system Ax≤b of inequalities is unsolvable if and only if the following system of inequalities is solvable: yTA= 0,yTb=−1,y≥0.
In words, this lemma says that a system of linear inequalities is unsolvable if and only if a contradiction can be obtained by a linear combination of the inequalities with nonnegative coefficients.
Using this, a solution of the other system of inequalities given in the lemma (the nonneg- ative coefficients) is a witness of the nonexistence of a solution.
Problem 6.4.16 Existence of an integer solution The solution itself is a witness but we need some reasoning again to limit the size of witnesses, which is more difficult here.
It is not known wheter the non-existence of an integer solution is in NP, i.e., if this fact can be certified by a polynomial length and polynomial time verifiable certificate.
It is important to note that the fundamental problem of linear programming, i.e. looking for the optimum of a linear object function under linear conditions, can be easily reduced to the problem of solvability of systems of linear inequalities. Similarly, the search for optimal solutions can be reduced to the decision of the existence of integer solutions.
For a long time, it was unknown whether the problem of solvability of systems of linear inequalities is in P (the well-known simplex method is not polynomial). The first polynomial algorithm for this problem was the ellipsoid method ofL. G. Khachian (relying on earlier work byShorr, Yudin and Nemirovskii).
The running time of this method led, however, to a very high-degree polynomial; it could not therefore compete in practice with the simplex method which, though is exponential in the worst case, is on average (as shown by experience) much faster than the ellipsoid method. Several polynomial-time linear programming algorithms have been found since; among these, Karmarkar’s method can compete with the simplex method even in practice.
No polynomial algorithm is known for solving systems of linear inequalities in integers; one cannot even hope to find such an algorithm (see the notion of NP-completeness below).
Reviewing the above list of examples, the following observatons can be made.
• For many properties that are in NP, their negation (i.e. the complement of the corre- sponding language) is also in NP. This fact is, however, generally non-trivial; in various branches of mathematics, often the most fundamental theorems assert this for certain languages.
• It is often the case that if some property (language) turns out to be in NP∩co−NP then sooner or later it also turns out to be in P. This happened, for example, with the existence of perfect matchings, planarity, the solution of systems of linear inequalities. Research is very intensive on prime testing. If NP is considered an analog of “recursively enumerable” and P an analog of “recursive” then we can expect that this is always the case. However, there is no proof for this; moreover, this cannot really be expected to be true in full generality.
6.4. EXAMPLES OF LANGUAGES IN NP 103 • With other NP problems, their solution in polynomial time seems hopeless, they are very hard to handle (Hamiltonian cycle, graph coloring, and integer solution of a system of linear inequalities). We cannot prove that these are not in P (we don’t know whether P = NP holds); but still, one can prove a certain exact property of these problems that shows that they are hard. We will turn to this later.
• There are many problems in NP with a naturally corresponding search problem and with the property that if we can solve the decision problem then we can also solve (in a natural manner) the search problem. E.g., if we can decide whether there is a perfect matching in a certain graph then we can search for perfect matching in polynomial time in the following way: we delete edges from the graph as long as a perfect matching still remains in it. When we get stuck, the remaining graph must be a perfect matching. Using similar simple tricks, the search problem corresponding to the existence of Hamiltonian cycles, colorability with 3 colors, etc. can be reduced to the decision problem. This is, however, not always so. E.g., our ability to decide in polynomial time (at least, in some sense) whether a number is a prime was not applicable to the problem of finding a proper divisor.
• A number of NP-problems has a relatedoptimization problemwhich is easier to state, even if it is not an NP-problem by its form. For example, instead of the general matching problem, it is easier to say that the problem is to find out the maximum size of a matching in the graph. In case of the coloring problem, we may want to look for the chromatic number, the smallest number of colors with which the graph is colorable. The solvability of a set of linear inequalities is intimately connected with the problem of finding a solution that maximizes a certain linear form: this is the problem of linear programming. Several other examples come later. If there is a polynomial algorithm solving the optimization problem then it automatically solves the associated NP problem. If there is a polynomial algorithm solving the NP-problem then, using binary search, it provides a polynomial algorithm to solve the associated optimization problem.
There are, of course, interesting problems (languages) also in other non-deterministic complexity classes. The non-deterministic exponential time (NEXPTIME) class can be de- fined as the union of the classes NTIME(2nc
) for all c >0. We can formulate an example in connection with Ramsey’s Theorem. LetGbe a graph; theRamsey numberR(G) belonging to G is the smallestN >0 for which it is the case that no matter how we color the edges of theN-node complete graph with two colors, some color contains a copy ofG. (Ramsey’s Theorem says that such a finite number exists, which is non-trivial.) Let L consist of the
pairs (G, N) for whichR(G)> N. The size of the input (G, N) (ifGis described, say, by its adjacency matrix) isO(|V(G)|2+ logN).
Now, L is in NEXPTIME since the fact (G, N) ∈ L is witnessed by a coloring of the complete graph onN nodes in which no homogenously colored copy ofG; this property can be checked in timeO(N|V(G)|) which is exponential in the size of the input (but not worse). On the other hand, deterministically, we know no better algorithm to decide (G, N)∈ Lthan a double exponential one. The trivial algoritm, which is, unfortunately, the best known, goes over all colorings of the edges of the N-node complete graph, and the number of these is 2N(N−1)/2.