Chapter 7

NP-Completeness

[71/58%]
Show
LaTeX
Example 7.2

Sat is in NP.

?
Example 7.3

Formulate the following puzzle as a Boolean formula FF, and solve it by determining whether FF is satisfiable:

With five games left in the regular season, the team mathematician reported to the manager of the baseball team A: "We can still make the playoffs if we can beat team BB, and in case team BB beats team CC then team CC beats team DD, and in case we lose to team CC then team DD also beats either team BB or team CC." Later, among the remaining five games, each team won at least one game, but no team won all its remaining games, and there was no tie game. Did team A have any chance to make the playoffs? If so, how?

?
Example 7.4

Formulate the following puzzle as a Boolean formula FF, and solve it by determining whether FF is satisfiable:

Three men named Lewis, Miller, and Nelson fill the positions of accountant, cashier, and manager in the leading department store in the City of NP. The following information about their jobs is known:

  • If Nelson is the cashier, Miller is the manager.

  • If Nelson is the manager, Miller is the accountant.

  • If Miller is not the cashier, Lewis is the manager.

  • If Lewis is the accountant, Nelson is the manager.

What is each man's job?

?
Example 7.5

Hamiltonian Cycle (HC): Given a graph GG, determine whether GG has a Hamiltonian cycle.

HC is in NP.

?
Example 7.6

(Knight's Tour) Find a tour of the 8×88 \times 8 chessboard by a knight which visits each square exactly once and comes back to the starting square.

36334027442946
34372532472643
74393641284530
38358148314225
964135617244958
1455106152571821
6312531623205950
5415621160512219
: Figure 7.1: A knight’s tour.
?
Example 7.7

Vertex Cover (VC): Given a graph GG and a positive integer kk, determine whether GG has a vertex cover of size at most kk.

VC is in NP.

?
Example 7.8

Hitting Set (HS): Given subsets A1,A2,…,AnA_{1}, A_{2}, \ldots , A_{n} of a set SS and an integer kk, determine whether there is a subset A⊆SA \subseteq S of size ∣A∣≤k\left|A\right| \leq k such that A∩Ai≠∅A \cap A_{i} \neq \emptyset for all i=1,…,ni=1, \ldots , n.

HS is in NP.

?
Example 7.9

Formulate the following logical puzzle as an instance of the problem HS and solve it by finding the correct subset.

Three women, Joan, Michelle, and Tracy, made the following statements about their ages.

Joan: "I am 92 years old. I am two years younger than Michelle. I am one year older than Tracy." Michelle: "I am not the youngest. I am three years different from Tracy. Tracy is 25 years old." Tracy: "I am younger than Joan. Joan is 23 years old. Michelle is three years older than Joan." If we know that, among three statements given by each person, exactly two are true. What are their ages?

?
Example 7.10

IS is in NP.

?
Example 7.11

(Eight-Queen Problem) Place eight queens in an 8×88 \times 8 chessboard without them attacking each another. (In the chess game, a queen attacks another piece if they are located in the same row, or in the same column, or in the same diagonal.)

?
Example 7.12

3DM is in NP\mathrm{NP}.

?
Example 7.13

IP is in NP\mathrm{NP}.

?
Example 7.15

Formulate the following logical puzzle as an instance of the problem IP, and solve it by solving the corresponding system of inequalities.

Professor XX presented a colloquium talk in the Department of Complexity. When he started to talk, he noticed that the 15 people of the audience satisfy the following conditions:

  • There were more students than professors.

  • There were more male professors than male students.

  • There were more male students than female students.

  • There was at least one female professor.

Five minutes later, a person rushed into the room. However, the appearance of this person did not change the above four conditions. Is this person a man or a woman, a student or a professor?

?
Example 7.17

Prime is in NP.

?
Example 7.18

Prove that 683 is a prime.

?
Problem 7.1.1

For any set AA, let A′={w#0n∣w is a suffix of some x in A with ∣x∣=n}A^{\prime }=\left\{ w \# 0^{n} \mid w\text{ is a suffix of some }x\text{ in }A\text{ with }\left|x\right|=n\right\} and A′′={w∣w has a suffix x in A}A^{\prime \prime }=\left\{ w \mid w\text{ has a suffix }x\text{ in }A\right\}. Show that if AA is in NP, then A′A^{\prime } and A′′A^{\prime \prime } are also in NP\mathrm{NP}.

?
Problem 7.1.2

For any set B⊆{0,1}∗#{0,1}∗B \subseteq \left\{ 0,1\right\}^{*} \# \left\{ 0,1\right\}^{*}, let prefix⁡(B)={x#u∣x,u∈{0,1}∗,(∃v∈{0,1}∗)x#uv∈B}\operatorname {prefix}(B)=\left\{ x \# u \mid x, u \in \left\{ 0,1\right\}^{*},\left(\exists v \in \left\{ 0,1\right\}^{*}\right) x \# u v \in B \right\}.

?
(a)

Assume that there is a polynomial function pp such that x#y∈Bx \# y \in B implies ∣y∣≤p(∣x∣)\left|y\right| \leq p(\left|x\right|). Show that if B∈NPB \in \mathrm{NP}, then prefix⁡(B)∈NP\operatorname {prefix}(B) \in \mathrm{NP}.

(b)

Show that if A={x∣(∃u)[∣u∣≤p(∣x∣),x#u∈B}A=\left\{ x \mid (\exists u)[\left|u\right| \leq p(\left|x\right|), x \# u \in B\right\} for some polynomial function pp and if prefix⁡(B)∈P\operatorname {prefix}(B) \in P, then A∈PA \in P.

Problem 7.1.3

A function f:{0,1}∗→{0,1}∗f: \left\{ 0,1\right\}^{*} \rightarrow \left\{ 0,1\right\}^{*} is polynomial-time computable if there is a polynomial-time DTM that computes the function ff (i.e., on input xx, it halts in p(∣x∣)p(|x|) moves for some polynomial pp, with the string f(x)f(x) on the output tape). A function f:{0,1}∗→{0,1}∗f: \left\{ 0,1\right\}^{*} \rightarrow \left\{ 0,1\right\}^{*} is polynomially honest if there is a polynomial function pp such that ∣f(x)∣≤p(∣x∣)|f(x)| \leq p(|x|) and ∣x∣≤p(∣f(x)∣)|x| \leq p(|f(x)|) for all x∈{0,1}∗x \in \left\{ 0,1\right\}^{*}. Assume that ff is polynomial-time computable and is polynomially honest.

?
(a)

Assume that ff is one-to-one and onto. Show that if A∈NPA \in \mathrm{NP}, then f(A)∈NPf(A) \in \mathrm{NP} and f−1(A)∈NPf^{-1}(A) \in \mathrm{NP}.

(b)

Show that if P=NPP=\mathrm{NP}, then the following functions are polynomialtime computable:

Max⁡f(u,v)=max⁡{f(x)∣u≤lex x≤lex v},Min⁡f(u,v)=min⁡{f(x)∣u≤lex x≤lex v}, \begin{aligned} \operatorname {Max}_{f}(u, v) & =\max \left\{ f(x) \mid u \leq _{\text{lex }} x \leq _{\text{lex }} v\right\} , \\ \operatorname {Min}_{f}(u, v) & =\min \left\{ f(x) \mid u \leq _{\text{lex }} x \leq _{\text{lex }} v\right\} , \end{aligned}

where ≤lex \leq_{\text{lex }} is the lexicographic ordering on {0,1}∗\left\{ 0,1\right\}^{*}.

Problem 7.1.4

Formulate the following puzzles as instances of problems in NP, and then solve the puzzles by finding the witnesses to the instances:

?
(a)

Six men, A,B,C,D,E\mathrm{A}, \mathrm{B}, \mathrm{C}, \mathrm{D}, \mathrm{E}, and F, are the only members eligible for the offices of President, Vice-President, and Secretary in Club NP. The following preferences of these men are known:

  • A won’t be an officer unless E is President.

  • B won’t serve if he outranks C.

  • B won’t serve with F under any conditions.

  • C won’t serve with both E and F.

  • C won’t serve if F is President or B is Secretary.

  • D won’t serve with C or E unless he outranks them.

  • E won’t be Vice-President.

  • E won’t be Secretary if D is an officer.

  • E won’t serve with A unless F serves too.

  • F won’t serve unless either he or C is President.

How can the three offices be filled satisfying all above conditions?

(b)

Police arrested four men as the suspects of a murder case. They made the following statements when questioned:

John: "Nick did it." Nick: "Bill did it." Dan: "I didn't do it." Bill: "Nick lied when he said I did it."

If exactly one of them is the real murderer and exactly one of the above statements is true, who is the murderer?

(c)

Brown, Jones, and Smith are employed by the village of NP as fireman, policeman, and teacher, though not necessarily respectively. Someone in the village reported that:

  • Brown and the teacher are neighbors.

  • Jones and the teacher are neighbors.

  • Both Brown and Smith are neighbors of the fireman.

  • Both the policeman and the fireman are neighbors of Jones.

  • The men are all neighbors.

However, the truth of the matter is that only two of these statements are true. Can you determine the job which each man holds?

(d)

Both the Smiths and the Taylors have two young sons under eleven. The names of the boys, whose ages rounded off to the nearest year are all different, are Arthur, Bert, Carl, and David. Taking the ages of the boys only to the nearest year, the following statements are true:

  • Arthur is three years younger than his brother.

  • Bert is the oldest.

  • Carl is half as old as one of the Taylor boys.

  • David is five years older than the younger Smith boy.

  • The total ages of the boys in each family differ by the same amount today as they did five years ago.

How old is each boy, and what is each boy's family name?"

Problem 7.1.5

The threshold function Tn,kT_{n, k} is a Boolean function defined as follows:

Tn,k(x1,⋯ ,xn)={1 if there are at least k1 ’s in x1,⋯ ,xn0 otherwise.  T_{n, k}\left(x_{1}, \cdots , x_{n}\right)= \begin{cases} 1 & \text{ if there are at least } k 1 \text{ 's in } x_{1}, \cdots , x_{n} \\ 0 & \text{ otherwise. }\end{cases}
?
(a)

Construct Boolean formulas Fn,kF_{n, k}, using operations ∧,∨,¬\wedge , \vee , \neg, and variables x1,x2,…,xnx_{1}, x_{2}, \ldots , x_{n}, such that it computes the function Tn,kT_{n, k}.

(b)

Show that there exist Boolean formulas Gn,kG_{n, k} using operations ∧,∨\wedge , \vee, ¬\neg, variables x1,x2,…,xnx_{1}, x_{2}, \ldots , x_{n}, and some auxiliary variables y1,…,ymy_{1}, \ldots , y_{m}, such that (i) the length of Gn,kG_{n, k} is bounded by ncn^{c} for some constant c>0c>0, and (ii) an assignment tt satisfies Gn,kG_{n, k} if and only if tt assigns value 1 to at least kk variables in {x1,…,xn}\left\{ x_{1}, \ldots , x_{n}\right\}.

Problem 7.1.6

Prove that the following integers are primes: 293,587,65537,214177293,587,65537,214177.

?
Problem 7.1.7

Show that the following problems are in NP:

?
(a)

Longest Path (LP): Given a graph GG and an integer k>0k>0, determine whether GG has a simple path of at least kk edges. (A path is simple if no vertex appears twice.)

(b)

Traveling Salesman Problem (TSP): Given a complete graph G=(V,E)G=(V, E) with a cost function c:E→Nc: E \rightarrow \mathbf{N}, and an integer kk, determine whether there is a tour (i.e., a Hamiltonian cycle) of GG with the total edge cost bounded by kk.

(c)

Graph Isomorphism (GIso): Given two graphs GG and HH, determine whether GG is isomorphic to HH. (Two graphs G=(V1,E1)G=\left(V_{1}, E_{1}\right) and H=(V2,E2)H=\left(V_{2}, E_{2}\right) are isomorphic if ∣V1∣=∣V2∣\left|V_{1}\right|=\left|V_{2}\right|, and there is a one-to-one, onto mapping f:V1→V2f: V_{1} \rightarrow V_{2} such that {u,v}∈E1\left\{ u, v\right\} \in E_{1} if and only if {f(u),f(v)}∈E2\left\{ f(u), f(v)\right\} \in E_{2}. The function ff is called an isomorphism.)

(d)

Bounded PCP: Given a finite set of ordered pairs (x1,y1),…\left(x_{1}, y_{1}\right), \ldots, (xn,yn)\left(x_{n}, y_{n}\right) of strings over an alphabet Σ\Sigma, and an integer KK (in the unary form 1K1^{K}), determine whether there is a finite sequence of integers (i1,i2,…,im)\left(i_{1}, i_{2}, \ldots , i_{m}\right), with each ij∈{1,…,n}i_{j} \in \left\{ 1, \ldots , n\right\} and m≤Km \leq K, such that

xi1xi2⋯xim=yi1yi2⋯yim. x_{i_{1}} x_{i_{2}} \cdots x_{i_{m}}=y_{i_{1}} y_{i_{2}} \cdots y_{i_{m}}.
(e)

Bounded Tiling: Given a finite number of types t0,t1,…,tnt_{0}, t_{1}, \ldots , t_{n} of colored tiles and an integer KK (in the unary form 1K1^{K}), determine whether it is possible to cover a K×KK \times K square by colored tiles of these types, starting with a tile of type t0t_{0} at the lower left corner. (See Exercise 6 of Section 5.6 for the details of the definition.)

Problem 7.1.8

Let AA be an n×nn \times n integer matrix, and bb an nn-dimensional integer vector. Let α\alpha be the maximum absolute value of integers in AA and bb, and q=max⁡{m,n}q= \max \left\{ m, n\right\}.

?
(a)

Show that if BB is a square submatrix of AA, then ∣det⁡(B)∣≤(αq)q\left|\operatorname {det}(B)\right| \leq (\alpha q)^{q}, where det⁡(B)\operatorname {det}(B) denotes the determinant of matrix BB.

(b)

Show that if rank⁡(A)=r<m\operatorname {rank}(A)=r<m, then there exists a nonzero vector zz such that Az=0A z=0 and the maximum absolute value of integers in zz is bounded by (αq)q(\alpha q)^{q}.

(c)

Assume that Ax≥bA x \geq b has an integer solution xx. Let aia_{i} denote the ii th row of A,biA, b_{i} the ii th component of bb, and eje_{j} the jj th mm dimensional unit vector (i.e., all components of eje_{j} is 0, except that the jj th component is 1). Let xx be a solution for Ax≥bA x \geq b that maximizes the number of elements in the following set:

Ax={ai∣bi≤aix≤bi+(αq)q+1,1≤i≤n}∪{ej∣∣xj∣≤(αq)q,1≤j≤m} \begin{aligned} \mathcal{A}_{x}= & \left\{ a_{i} \mid b_{i} \leq a_{i} x \leq b_{i}+(\alpha q)^{q+1}, 1 \leq i \leq n\right\} \\ & \cup \left\{ e_{j} \mid \left|x_{j}\right| \leq (\alpha q)^{q}, 1 \leq j \leq m\right\} \end{aligned}

Prove that the rank of Ax\mathcal{A}_{x} is mm.

(d)

Use (c) above to prove Lemma 7.14.

Example 7.20

HC ≤mPLP\leq_{m}^{P} \mathrm{LP}.

?
Example 7.21

VC≡mP\mathrm{VC} \equiv_{m}^{P} IS.

?
Example 7.22

GIso ≡mP\equiv_{m}^{P} DGIso.

?
Example 7.23

SAT ≤mP\leq_{m}^{P} CNF-SAT.

?
Example 7.24

VC≤mPIP\mathrm{VC} \leq_{m}^{P} \mathrm{IP}.

?
Example 7.25

3DM≤mPSAT3\mathrm{DM} \leq_{m}^{P} \mathrm{SAT}.

?
Example 7.26

3SAT≤mPVC3\mathrm{SAT} \leq_{m}^{P} \mathrm{VC}.

?
Example 7.27

3SAT≤mpHC3\mathrm{SAT} \leq_{m}^{p} \mathrm{HC}.

?
Problem 7.2.1

Prove that CNF-Sat ≤mP\leq_{m}^{P} 3Sat.

?
Problem 7.2.2

In this exercise, we study an alternative proof for Example 7.25. Let us replace conditions (1) and (2) by condition (3): For every a∈A∪B∪Ca \in A \cup B \cup C, there is a triple w∈W′w \in W^{\prime } such that (i) a∈wa \in w, and (ii) if w′∈W′,w′≠ww^{\prime } \in W^{\prime }, w^{\prime } \neq w then a∉w′a \notin w^{\prime }. Translate this condition into a Boolean formula GG over variables xwx_{w} and show that GG is satisfiable if and only if WW has a threedimensional matching W′W^{\prime }.

?
Problem 7.2.3

Construct the following reductions:

?
(a)

3SAT ≤mp3DM\leq_{m}^{p} 3 \mathrm{DM}.

(b)

VC≤mPHC\mathrm{VC} \leq_{m}^{P} \mathrm{HC}.

(c)

HC≤mP3Sat. \mathrm{HC} \leq_{m}^{P} 3 \mathrm{Sat}_{\text{. }}

(d)

VC≤mPHS\mathrm{VC} \leq_{m}^{P} \mathrm{HS}.

Problem 7.2.4

Consider the following variations of the problem 3Sat:

3Sat-Exactly-One: Given a 3-CNF FF, determine whether there is an assignment tt on variables in FF that assigns value TRUE to exactly one literal in each clause of FF.

3Sat-Not-All: Given a 3-CNF FF, determine whether there is an assignment tt on variables in FF that assigns value TRUE to either one or two literals (but not all three literals) in each clause of FF.

Show that 3Sat, 3Sat-Exact-One and 3Sat-Not-All are polynomial time equivalent under ≤mP\leq_{m}^{P}.

?
Problem 7.2.5

Consider the following problems: Subgraph Isomorphism (SGIso): Given two graphs G1=(V1,E1)G_{1}= \left(V_{1}, E_{1}\right) and G2=(V2,E2)G_{2}=\left(V_{2}, E_{2}\right), determine whether there is a one-to-one mapping f:V1→V2f: V_{1} \rightarrow V_{2} such that, for all u,v∈V1u, v \in V_{1}, {u,v}∈E1\left\{ u, v\right\} \in E_{1} implies {f(u),f(v)}∈E2\left\{ f(u), f(v)\right\} \in E_{2}.

Graph Automorphism (GAuto): Given a graph G=(V,E)G= (V, E), determine whether there is a one-to-one function f:V→Vf: V \rightarrow V other than the identity function such that, for all u,v∈V,{u,v}∈Eu, v \in V,\left\{ u, v\right\} \in E if and only if {f(u),f(v)}∈E\left\{ f(u), f(v)\right\} \in E.

Prove all the polynomial-time reductions you can find among the three problems GIso, SGIso and GAuto.

?
Example 7.28

Show that if P=NPP=\mathrm{NP}, then all nonempty proper subsets AA of Σ∗\Sigma^{*} are NP-complete.

?
Example 7.29

If AA is known to be NP\mathrm{NP}-complete, is A2A^{2} always NP\mathrm{NP}-complete?

?
Example 7.31

In the proof of Cook's theorem, we have used conditions (4.1) −(4.5)-(4.5) on ???-shaped windows over matrix SS to satisfy condition (4). Show that if we, instead, work with ???-shaped windows over matrix SS, then no conditions on these windows can satisfy condition (4). In other words, show that the following relation does not hold for any subset T⊆(Γ′)4T \subseteq \left(\Gamma^{\prime }\right)^{4} :

(∏j=0r(n)∑(a,b,c,d)∈Tyi,j−1,ayi,j,byi,j+1,cyi+1,j,d)=1⟺αi⊢αi+1, \left(\prod _{j=0}^{r(n)} \sum _{(a, b, c, d) \in T} y_{i, j-1, a} y_{i, j, b} y_{i, j+1, c} y_{i+1, j, d}\right)=1 \Longleftrightarrow \alpha _{i} \vdash \alpha _{i+1},

where αi\alpha_{i} denotes the ii th configuration corresponding to the assignments to variables yi,j,ay_{i, j, a}.

?
Example 7.32

Show that, in the proof of Cook's theorem, function f1f_{1} is necessary. That is, no definition of subset TT can make the following true: Fx′=f0f2f3f4F_{x}^{\prime }=f_{0} f_{2} f_{3} f_{4} is satisfiable if and only if x∈L(M)x \in L(M).

?
Example 7.33

In the proof of Cook's theorem, it is possible to remove condition (1), as long as we replace condition (4') by a new condition (4'') over six-square, ???-shaped windows. Find the subconditions over the six-square, ???-shaped windows that make (4′′)\left(4^{\prime \prime }\right) equivalent to condition (4), without the assumption of condition (1).

?
Problem 7.3.1

A Boolean formula which is a product of literals is called an elementary product. A DNF (disjunctive normal form) is a sum of elementary products.

?
(a)

Prove that a DNF Boolean formula can be switched in polynomial time to a CNF formula (with possibly more variables) that preserves satisfiability.

(b)

Prove that if P≠NPP \neq \mathrm{NP}, then there is no polynomial-time algorithm that switches a CNF Boolean formula to a DNF formula, and preserves satisfiability.

Problem 7.3.2

Assume that AA and BB are two NP\mathrm{NP}-complete sets. Show that A∪BA \cup B and A∩BA \cap B are not necessarily NP\mathrm{NP}-complete, if P≠NPP \neq \mathrm{NP}. Is A∪BA \cup B always NP\mathrm{NP}-complete when A∩B=∅A \cap B=\emptyset?

?
Problem 7.3.3

This exercise follows the notations defined in Exercise 3 of Section 7.1.

?
(a)

Show that there exists a polynomial-time computable, polynomially honest function ff such that its range f({0,1}∗)f\left(\left\{ 0,1\right\}^{*}\right) is NPcomplete. [Hint: For any NP\mathrm{NP}-complete set A,fA, f takes an instance xx of AA and a string yy as the input and decides whether yy is a witness to x∈Ax \in A.]

(b)

Define Sf={⟨u,v,y⟩∣y≥lev Min⁡f(u,v)}S_{f}=\left\{ \langle u, v, y\rangle \mid y \geq_{\text{lev }} \operatorname {Min}_{f}(u, v)\right\}. Show that there exists a polynomial-time computable, polynomially honest function ff such that SfS_{f} is NP-complete. [Hint: Design a function like part (a), except that the problem AA is a minimization problem.]

Problem 7.3.4

Assume that P≠NPP \neq \mathrm{NP}. Let AA and BB be two sets that are complete for co−NPc o-\mathrm{NP} (i.e., Aˉ\bar{A} and Bˉ\bar{B} are NP-complete). Is ABA B necessarily in co-NP? Is ABA B necessarily co-NP-complete? Is it possible that ABA B is in PP? Justify your answer.

?
Problem 7.3.5

Suppose that, in the proof of Cook's theorem, we drop condition (1) and replace condition (4′)\left(4^{\prime }\right) by (4‾)(\overline{4}), which specifies some subconditions on five-square windows of one of the four shapes shown in Figure 7.11. Show that no such subconditions on the five-square windows can make (4) equivalent to (4′)\left(4^{\prime }\right).

?
Problem 7.3.6

Consider the alternative proof of Cook's theorem given in Example 7.33. Let T⊆(Γ′)6T \subseteq \left(\Gamma^{\prime }\right)^{6} be the set corresponding to the twelve windows of Figure 7.10; that is, (a,b,c,d,e,g)∈T(a, b, c, d, e, g) \in T if and only if (a,b,c,d,e,g)(a, b, c, d, e, g) is in one of the twelve forms in Figure 7.10, and satisfies the corresponding conditions given in the three cases. Show that if there exists a mapping ϕ:(Γ′)3→(Γ′)3\phi :\left(\Gamma^{\prime }\right)^{3} \rightarrow \left(\Gamma^{\prime }\right)^{3} such that (a,b,c,d,e,g)∈T(a, b, c, d, e, g) \in T if and only if ϕ(a,b,c)=(d,e,g)\phi (a, b, c)= (d, e, g), then L(M)L(M) is in PP.

?
Problem 7.3.7

In this exercise, we consider a different setting for the proof of Cook's theorem. Instead of attaching the state symbol to the tape symbol currently scanned by the tape head, we may define separate Boolean variables to represent the state and the position of the tape head. That is, in addition to variables yi,j,ay_{i, j, a} (for a∈Γa \in \Gamma only), we define, for each i=0,…,r(n)i=0, \ldots , r(n) and each q∈Qq \in Q, a variable Qi,qQ_{i, q} to mean that the state symbol of αi\alpha_{i} is qq, and for each pair (i,j)(i, j), with i,j∈{0,…,r(n)}i, j \in \left\{ 0, \ldots , r(n)\right\}, a variable Hi,jH_{i, j} to mean that, in the configuration αi\alpha_{i}, the tape head is scanning the jj th symbol. To prove Cook's theorem in this setting, then we need to define six Boolean functions g1,…,g6g_{1}, \ldots , g_{6}, such that, for k=1,…,6,gk=1k=1, \ldots , 6, g_{k}=1 if and only if the condition (k)(k) below holds:

(1) For each i=0,…,r(n),αii=0, \ldots , r(n), \alpha_{i} is in exactly one state.

(2) For each i=0,…,r(n)i=0, \ldots , r(n), the head scans exactly one cell in αi\alpha_{i}.

(3) For each i=0,…,r(n)i=0, \ldots , r(n) and each j=0,…,r(n)j=0, \ldots , r(n), the jj th cell of αi\alpha_{i} contains exactly one symbol.

(4) α0\alpha_{0} is the initial configuration of MM on input xx.

(5) αr(n)\alpha_{r(n)} is an accepting configuration.

(6) For each i=0,…,r(n)−1,αi⊢αi+1i=0, \ldots , r(n)-1, \alpha_{i} \vdash \alpha_{i+1}.

Assume that g1,…,g5g_{1}, \ldots , g_{5} satisfy the condition that gk=1g_{k}=1 if and only if condition (k)(k) holds. Also let g6g_{6} be

∏i=0r(n)∏j=0r(n)∏q∈Q∏u∈Γ∑(p,v,D)∈δ(q,u)[(Hˉi,j+Qˉi,q+yˉi,j,u+Hi+1,j+Δ)⋅(Hˉi,j+Qˉi,q+yˉi,j,u+Qi+1,p)⋅(Hˉi,j+Qˉi,q+yˉi,j,u+yi+1,j,v)] \begin{aligned} & \prod _{i=0}^{r(n)} \prod _{j=0}^{r(n)} \prod _{q \in Q} \prod _{u \in \Gamma } \sum _{(p, v, D) \in \delta (q, u)}\left[\left(\bar{H}_{i, j}+\bar{Q}_{i, q}+\bar{y}_{i, j, u}+H_{i+1, j+\Delta }\right)\right. \\ & \left.\cdot \left(\bar{H}_{i, j}+\bar{Q}_{i, q}+\bar{y}_{i, j, u}+Q_{i+1, p}\right) \cdot \left(\bar{H}_{i, j}+\bar{Q}_{i, q}+\bar{y}_{i, j, u}+y_{i+1, j, v}\right)\right] \end{aligned}

where Δ=−1\Delta =-1 if D=LD=L, and Δ=1\Delta =1 if D=RD=R. Find a counterexample to disprove that Gx=∏i=16gi=1G_{x}=\prod_{i=1}^{6} g_{i}=1 if and only if MM accepts xx. Find a new function g6g_{6} satisfying that Gx=1G_{x}=1 if and only if MM accepts xx.

?
Example 7.36

Does the problem VC remain NP-complete if each edge is to be covered by exactly one vertex?

?
Example 7.37

Prove that MCG is NP-complete.

?
Example 7.38

Partition is NP-complete.

?
Example 7.39

Knapsack is NP-complete.

?
Example 7.40

BP is NP-complete.

?
Example 7.41

Show that the following problem is NP-complete: Given positive integers a1,…,ana_{1}, \ldots , a_{n}, determine whether

∫02π(∏i=1ncos⁡(ait))dt≠0 \int _{0}^{2 \pi }\left(\prod _{i=1}^{n} \cos \left(a_{i} t\right)\right) d t \neq 0
?
Example 7.42

SMT is NP-complete.

?
Problem 7.4.1

For each of the following problems, determine whether it is NP\mathrm{NP}-complete or is in PP. If it is NP\mathrm{NP}-complete, find a reduction from a known NP\mathrm{NP} complete problem to it. If it is in PP, find a polynomial-time algorithm for it.

?
(a)

Given a graph GG, two vertices ss and tt in GG and a positive integer kk, determine whether there is a path between ss and tt of length less than or equal to kk.

(b)

Given a graph GG, two vertices ss and tt in GG and a positive integer kk, determine whether there is a path between ss and tt of length greater than or equal to kk.

(c)

Given a directed graph GG, determine whether GG has a cycle of an odd length.

(d)

Given a directed graph GG, determine whether GG has a cycle of an even length.

(e)

Given a graph GG, determine whether GG has a cycle of an odd length.

(f)

Given an edge-weighted complete graph GG, three subsets X1,X2X_{1}, X_{2}, X3X_{3} of vertices and a positive integer kk, determine whether there is a subgraph HH of GG of weight ≤k\leq k that contains a spanning tree for each of X1,X2X_{1}, X_{2} and X3X_{3}. (A spanning tree for a subset X⊆VX \subseteq V is a connected subgraph HH of GG on the vertex set XX that has no cycle.)

(g)

Given a graph G=(V,E)G=(V, E) and a positive integer kk, determine whether there is a subset T⊆ET \subseteq E of at most kk edges such that every vertex in VV is incident with at least one edge in TT.

(h)

Regular Expression Nonequivalence: Given two regular expressions r1r_{1} and r2r_{2} without the Kleene-star operation, determine whether L(r1)≠L(r2)L\left(r_{1}\right) \neq L\left(r_{2}\right).

(i)

Bounded PCP (see Exercise 7(d) of Section 7.1).

(j)

Bounded Tiling (see Exercise 7(e) of Section 7.1).

Problem 7.4.2

Prove that the following variations of the problem VC are NP\mathrm{NP}-complete:

?
(a)

Planar VC: The problem VC restricted to planar graphs. (A planar graph is a graph that can be drawn on the two-dimensional plane such that no two edges cross each other at a non-vertex point.)

(b)

Cubic VC: The problem VC restricted to cubic graphs. (A cubic graph is a graph such that every vertex has degree three.)

(c)

Planar Connected-VC-4: Given a planar graph G=(V,E)G=(V, E) with each vertex in VV having degree at most 4 and an integer k>0k>0, determine whether there is a vertex cover CC of GG of size kk such that the induced subgraph G∣C\left.G\right|_{C} on vertex set CC is connected.

(d)

Given a graph GG, determine whether GG has a vertex cover CC satisfying the following conditions:

  1. The subgraph G∣C\left.G\right|_{C} induced by CC has no isolated point.

  2. Every vertex in CC is adjacent to a vertex not in CC.

Problem 7.4.3

The polar representation of a CNF FF is a bipartite graph GF=(V1,V2,E)G_{F}= \left(V_{1}, V_{2}, E\right), where V1V_{1} is the set of all variables and V2V_{2} is the set of all clauses in FF, and there is an edge in EE between xi∈V1x_{i} \in V_{1} and cj∈V2c_{j} \in V_{2} if and only if the variable xix_{i} appears in the clause cjc_{j} (in the form of xix_{i} or xˉi\bar{x}_{i}). Prove the following statements:

?
(a)

(x+y+zˉ)(xˉ+z+w)(xˉ+z+wˉ)(yˉ+z+u)(yˉ+z+uˉ)(x+y+\bar{z})(\bar{x}+z+w)(\bar{x}+z+\bar{w})(\bar{y}+z+u)(\bar{y}+z+\bar{u}) has a planar polar representation and it is satisfiable if and only if x+y=zx+y=z.

(b)

There exists a 3-CNF formula FF with a planar polar representation and three variables x,yx, y, and zz, such that FF is satisfiable if and only if xy=zx y=z.

(c)

There exists a 3-CNF formula FF with a planar polar representation and three variables x,yx, y, and zz, such that FF is satisfiable if and only if x⊕y=zx \oplus y=z. [Hint: x⊕y=x(xˉ+yˉ)+(xˉ+yˉ)yx \oplus y=x(\bar{x}+\bar{y})+(\bar{x}+\bar{y}) y.]

(d)

The following problem, called Planar Polar-3Sat, is NPcomplete: Given a 3-CNF formula FF with a planar polar representation, determine whether FF is satisfiable or not. [Hint: Applying the fact that x⊕(x⊕y)=yx \oplus (x \oplus y)=y and (x⊕y)⊕y=x(x \oplus y) \oplus y=x to the construction.]

Problem 7.4.4

The nonpolar representation of a CNF FF is a graph GF=(V,E)G_{F}=(V, E), with the vertex set VV consisting of all literals and all clauses in FF, and the edge set EE consisting of all pairs {x,xˉ}\left\{ x, \bar{x}\right\} over all variables xx in FF plus all literal-clause pairs {z,c}\left\{ z, c\right\} such that zz occurs in cc. Prove the following statements:

?
(a)

If the nonpolar representation of a CNF formula FF is planar, then its polar representation must also be planar. However, the converse is not necessarily true.

(b)

The following problem, called Planar Nonpolar-3Sat, is NPcomplete: Given a 3-CNF formula FF with a planar nonpolar representation, determine whether FF is satisfiable or not.

Problem 7.4.5

A (k,ℓ)−CNFF(k, \ell )-C N F F is a CNF such that each clause contains exactly kk literals and each variable occurs in at most ℓ\ell clauses. The problem (k,ℓ)(k, \ell )-Sat is the problem 3SaT restricted to (k,ℓ)(k, \ell )-CNF's. Prove the following results:

?
(a)

For any k>0k>0, every (k,k)(k, k)-CNF FF is satisfiable.

(b)

For any ℓ>0\ell >0, (2, ℓ\ell)-SAT is polynomial-time solvable. (In fact, the problem 2Sat, which is the problem 3Sat restricted to CNF's with at most 2 literals in each clause, is polynomial-time solvable.)

(c)

(3,4)(3,4)-Sat is NP\mathrm{NP}-complete.

Example 7.43

Show that Min-VC is an NP-complete search problem.

?
Example 7.46

TSP is NP-complete.

?
Example 7.47

The problem rr-Approx-TSP is NP-complete for all r>1r>1.

?
Example 7.49

The problem rr-Approx-VC is NP-complete for some r>1r>1.

?
Example 7.51

For each d≥3d \geq 3, the problem rr-Approx-VC- dd is NP-complete for some r>1r>1.

?
Example 7.52

For 1<r<21<r<\sqrt{2}, rr-Approx-BST is NP-complete.

?
Problem 7.5.1

For each of the following search problems, formulate an appropriate decision version of it and show that the decision version and the search version are equivalent under polynomial-time Turing reduciblity.

?
(a)

Max-3Sat.

(b)

The optimization version of KNAPSACK.

(c)

LP (optimization version): Given a graph GG, find a longest simple path in GG.

(d)

Given a positive integer nn, find its largest prime factor.

Problem 7.5.2

For each of the following optimization problems, show that it is NPcomplete:

?
(a)

Given a directed graph, find a minimum subset of edges such that every directed cycle contains at least one edge in the subset.

(b)

Given a directed graph, find a minimum subset of vertices such that every directed cycle contains at least one vertex in the subset.

(c)

Given integers a1,a2,…,an,b1,b2,…,bn,sa_{1}, a_{2}, \ldots , a_{n}, b_{1}, b_{2}, \ldots , b_{n}, s and tt, find x1,x2,…x_{1}, x_{2}, \ldots, xn∈{0,1}x_{n} \in \left\{ 0,1\right\} that maximize the value x1+x2+⋯+xnx_{1}+x_{2}+\cdots +x_{n}, subject to the following constraints:

a1x1+a2x2+⋯+anxn≤s,b1x1+b2x2+⋯+bnxn≤t. \begin{aligned} a_{1} x_{1}+a_{2} x_{2}+\cdots +a_{n} x_{n} & \leq s, \\ b_{1} x_{1}+b_{2} x_{2}+\cdots +b_{n} x_{n} & \leq t. \end{aligned}
(d)

Given a graph, find a wheel of the maximum size. (A wheel of size kk is a subgraph of k+1k+1 vertices, in which kk vertices form a simple cycle and the other vertex is connected to all these kk vertices.)

Problem 7.5.3

Show that for each of the following optimization problems II, there exists an approximation ratio r>1r>1 such that rr-Approx- Π\Pi is NP\mathrm{NP}-complete.

?
(a)

Network SMT: Given a graph G=(V,E)G=(V, E), an edge-weight function w:E→ Nw: E \rightarrow \mathrm{~ N} and a subset P⊆VP \subseteq V, find a connected subgraph with the minimum total edge weight that interconnects vertices in PP.

(b)

Connected-VC: Given a graph GG, find a minimum vertex cover CC such that the subgraph G∣C\left.G\right|_{C} induced by CC is connected.

(c)

TSP with Triangle Inequality: Given a complete graph GG and an distance function d:E→ Nd: E \rightarrow \mathrm{~ N} that satisfies the triangle inequality, find a Hamiltonian cycle with the minimum total distance. (A distance function d:E→Nd: E \rightarrow \mathbf{N} satisfies the triangle inequality if d({a,b})+d({b,c})≥d({a,c})d(\left\{ a, b\right\} )+d(\left\{ b, c\right\} ) \geq d(\left\{ a, c\right\} ) for any three vertices a,b,ca, b, c.)

(d)

TSP with (1,2)(1,2)-Distance: Given a complete graph GG and an edge-weight function d:E→{1,2}d: E \rightarrow \left\{ 1,2\right\}, find a Hamiltonian cycle with the minimum total distance.

Problem 7.5.4

For a graph GG, its edge-square graph G2G^{2} is a graph obtained from GG by replacing each edge {u,v}\left\{ u, v\right\} by a copy of GG, called Gu,vG_{u, v}, and connecting both uu and vv to every vertex in Gu,vG_{u, v}.

?
(a)

Show that rr-Approx-LP is NP-complete for some r>1r>1.

(b)

Show that if the longest simple path in GG has length ℓ\ell, then the longest simple path in G2G^{2} has length at least ℓ2\ell^{2}. Moreover, given a path of length mm in G2G^{2}, a path of length m−1\sqrt{m}-1 in GG can be found in polynomial-time.

(c)

Show that rr-Approx-LP is NP-complete for all r>1r>1.

Problem 7.5.5

Show that for each of the following optimization problems Π\Pi, there exists a constant ε>0\varepsilon >0 such that nεn^{\varepsilon }-Approx- Π\Pi is NP\mathrm{NP}-complete.

?
(a)

Vertex Coloring: Given a graph G=(V,E)G=(V, E), find a coloring of VV (i.e., a function c:V→{1,2,…,m}c: V \rightarrow \left\{ 1,2, \ldots , m\right\}) with the minimum number mm of colors such that no two adjacent vertices have the same color.

(b)

Edge Coloring: Given a graph G=(V,E)G=(V, E), find a coloring of EE (i.e., a function c:E→{1,2,…,m}c: E \rightarrow \left\{ 1,2, \ldots , m\right\}) with the minimum number mm of colors such that no two adjacent edges (edges with a common vertex) have the same color.