Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit

EECS 376: Foundations of Computer Science

Fall 2022

Homework 8

We will grade a subset of the assigned questions, to be determined after the deadline, so that we can provide better feedback on the graded questions.

For bonus questions, we will not provide any insight during office hours or Piazza, and we do not guarantee anything about the difficulty of these questions.

We strongly encourage you to typeset your solutions in LATEX.

If you collaborated with someone, you must state their name(s). You must write your own solution for all problems and may not look at any other student’s write-up.

0. If applicable, state the name(s) and uniqname(s) of your collaborator(s).

1. Properties of polytime mapping reductions.

(a) Show that A p A for any language A.

(b) Prove the transitive property for polytime mapping reductions.  That is, prove that if A ≤p B and B ≤p C, then A ≤p C .

(c) Prove that if A ≤p B, then A ≤T B .

(d) Show that there exists languages A,B for which A ≤T  B but not A p  B, where B is neither ∅ nor Σ* .

Hint : There exist languages known to not be in P. Some such languages are

Chess = {(C,n) : }

and

BoundedHalt = {(M,x,k) : }.

2.   (a) Show that the following language is NP-Hard:

k-#SAT = {(φ,k) : φ is a Boolean formula with ≥ k satisfying assignments} Alternate: Show that the following language is NP-Hard:

(b) Consider the following verifier for k-#SAT:

V = on input ((φ,k),c):

1:  Check if c is a sequence of k assignments to the variables of 2:  For each assignment in c, check that it satisfies the formula 3:  If any of the checks fails, reject. Else, accept

 

φ

φ

Does this verifier demonstrate that k-#SAT ∈ NP? Why or why not?

(c) Show an efficient algorithm that given a positive integer k, outputs a Boolean formula that has at least k satisfying assignments.

Hint : You cannot generate a formula that has O(k) variables, as its length would not be polynomial in the size of the input. (Why?)

3. Show that the language VertexCover = {(G,k) : G is an undirected graph that has a vertex cover of size equal to k} is NP-Hard by showing that Clique p VertexCover.

4. Consider the language:

SubgraphIsomorphism = }

Recall that a subgraph G\ = (V\,E\ ) of G = (V,E) is a graph such that V\  ⊆ V and E\  ⊆ E .

A graph G1  is isomorphic to G2  if they differ only in how their vertices are labeled. In other words, we can convert G1  to G2 just by changing labels on the vertices.

Prove that SubgraphIsomorphism is NP-complete.

(a) Prove that SubgraphIsomorphism is in the class NP.

(b) Prove that SubgraphIsomorphism is NP-hard.

5. We can define the language Knapsack as follows:

(                            |V | = |W| = n and there exists indices 

Knapsack = (V,W,n,v,C) : i 1, . . . ,n such that iV [i] ≥ v and  .

(                                                 iW[i] C                      )

This corresponds to the following problem:

• There are n items

• Each item i has a value V (i) and a weight W(i) where V (i) and W(i) are integers

• We have a target value of at least v where v is an integer

• We have a weight capacity limit of at most C where C is an integer

Is it possible to select a subset of the items such that the total value of the subset is at least v but the total weight of the subset is at most C?

(a) Show that Knapsack is in NP.

(b) Now show that Knapsack is NP-Hard and conclude that Knapsack is NP-Complete.

You can use SubsetSum, an NP-Hard language, to do so.

We define the language SubsetSum as follows:

SubsetSum = {(S,k) : S is a list of integers and 3S* S such that  s = k }.

That is, (S,k) ∈ SubsetSum iff there is a subset of numbers in S such that their sum is k .