Строительный блокнот  Automata methods and madness 

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 [ 139 ] 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175

NP-Hard Problems

Some problems L are so hard that although we can prove condition (2) of the definition of NP-completeness (every language in AfV reduces to L in polynomial time), we cannot prove condition (1): that L is in J\fV. If so, we call L NP-hard. We have previously used the informal term intractable to refer to problems that appeared to require exponential time. It is generally acceptable to use intractable to mean NP-hard, although in principle there might be some problems that require exponential time even though they are not NP-hard in the formal sense.

A proof that L is NP-hard is sufficient to show that L is very likely to require exponential time, or worse. However, if L is not in AfV, then its apparent difficulty does not support the argument that all NP-complete problems are difficult. That is, it could turn out that V = ЯТ, and yet L still requires exponential time.

this reduction takes some polynomial time p(n). Thus, a string in L of length n is converted to a string x in Pi of length at most p(n).

We also know that there is a polynomial-time reduction of Pi to P2; let this reduction take polynomial time q{rn). Then this reduction transforms x to some string у in P2, taking time at most g(p(n)). Thus, the transformation of w %oy takes time at most p{n) -b q{p{n)), which is a polynomial. We conclude that L is polynomial-time reducible to P2. Since L could be any language in ЯР, we have .shown that all of AfV polynomial-time reduces to P2; i.e., P2 is NP-complete. □

There is one more important theorem to be proven about NP-complete problems: if any one of them is in P, then all oiNV is in V. Since we beheve strongly that there are many problems in MV that are notm V, we thus consider a proof that a problem is NP-complete to be tantamount to a proof that in has no polynomial-time algorithm, and thus has no good computer solution.

Theorem 10.5 : If some NP-complete problem P is in P, then P AP.

PROOF: Suppose P is both NP-complete and in V. Then all languages L in AfV reduce in polynomial-tune to P. If P is in P, then L is in P, as we discussed in Section 10.1.5. □

10.1.7 Exercises for Section 10.1

Exercise 10.1.1: Suppose we make the following changes to the weights of the edges in Fig. 10.1. What would the resulting MWST be?

* a) Change the weight 10 on edge (1,3) to 25.



Other Notions of NP-completeness

The goal of the study of NP-completeness is really Theorem 10.5, that is, the identification of problems P for which their presence in the class P implies P = AP. The definition of NP-complete we have used, which is often called Karp-completeness because it was first used in a fundamental paper on the subject by R. Karp, is adequate to capture every problem that we have reason to believe satisfies Theorem 10.5. However, there are other, broader notions of NP-completeness that also allow us to claim Theorem 10.5.

For instance, S. Cook, in his original paper on the subject, defined a problem P to be NP-complete if, given an oracle for the problem P , i.e., a mechanism that in one unit of time would answer any question about membership of a given string in P. it was possible to recognize any language in jVP in polynomial time. This type of NP-completeness is called Cook-completeness. In a sense, Karp-completeness is the special case whore you ask only one question of the oracle. However, Cook-completeness also allows complementation of the answer; e.g., you might ask the oracle a question and then answer the opposite of what the oracle says. A consequence of Cooks definition is that the complements of NP-complete problems would also be NP-complete. Using the more restricted notion of Karp-completeness, as we do, we are able to make an Important distinction between the NP-complete problems (in the Karp sense) and their complements, in Section 11.1.

b) Instead, change the weight on edge (2,4) to 16.

Exercise 10.1.2: If we modify the graph of Fig. 10.1 by adding an edge of weight 19 between nodes 1 and 4, what is the minimum-weight Hamilton circuit?

*! Exercise 10.1.3: Suppose that there is an NP-complete problem that has a deterministic solution that takes time 0{n°). Note that this function lies between the polynomials and the exponentials, and is in neither class of functions. What could we say about the running time of any problem in AfP?

M Exercise 10.1.4: Consider the graphs whose nodes are grid points in an n-dirnensional cube of side m, that is, the nodes are vectors {i\,i2: in), where each ij is in the range 1 to rn. There is an edge between two nodes if and only if they differ by one in exactly one dimension. For instance, the case n - 2 and m - 2 is a square, n - 3 and тп = 2 is a cube, and n = 2 and m = 3 is the graph shown in Fig. 10.3. Some of these graphs have a Hamilton circuit, and some do not. For instance, the square obviously docs, and the cube does too, although it




Figure 10,3: A graph with n - 2;m = Z

may not be obvious; one is (0,0,0), (0,0,1), (0,1,1), (0,1,0), (1,1,0), (1,1,1), (1,0,1), (1,0,0), and back to (0,0,0). Figure 10,3 has no Hamilton circuit.

a) Prove that Fig. 10.3 has no Hamilton circuit. Hint: Consider what happens when a hypothetical Hamilton circuit passes through the central node. Where can in come firom, and where can it go to, without cutting qH one piece of the graph from the Hamilton circuit?

b) For what values of n and rn is there a Hamilton circuit?

! Exercise 10.1.5: Suppose we have an encoding of context-free grammars using some finite alphabet. Consider the following two languages:

1. Li = {(С,А,В) t (? is a (coded) CFG, A md В are (coded) variables of G, and the sets of terminal strings derived from A and В are the same},

2. L2 - {(G G2) I Gi and G2 are (coded) CFGs, and I(Gi) = LiG-,)}. Answer the following:

* a) Show that ii is polynomial-time reducible to L2, b) Show that L2 is polynomial-time reducible to Li.

* c) What do (a) and (b) say about whether or not Li and L2 are NP-

complete?

Exercise 10.1.6: As classes of languages, P and AlV each have certain closure properties. Show that V is closed under each of the following operations:

a) Reversal.

* b) Union.

*! c) Concatenation. ! d) Closure (star), e) Inverse homomorphism.

0--Q--О



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 [ 139 ] 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175