Computer Science 500 Theory of Computation Spring, 2000, April 17 PowerPoint PPT Presentation

presentation player overlay
1 / 18
About This Presentation
Transcript and Presenter's Notes

Title: Computer Science 500 Theory of Computation Spring, 2000, April 17


1
Computer Science 500Theory of ComputationSpring,
2000, April 17 1. Subset Sum 2. PUZZLE (3.
Partition)
2
NP-completedefinition
A language L is NP-complete iff 1) L ? NP
2) L is NP-hard
3
Definition SUBSET_SUM
1. SUBSET_SUM (A,k) A is a set (list) of
integers, s.t. ?B B?A where Sw?B w k
4
Claim SUBSET_SUM is NP-complete
Proof 1) SUBSET_SUM ? NP because I defined it in
S1,p form 2) SUBSET_SUM is NP-hard we will show
3-SAT ltp SUBSET_SUM
5
3-SAT ltp SUBSET_SUM
Define Reduction f 1. f formulas ? P(Z) x
Z 2. f is poly-time computable
Input Boolean formula F in 3-SAT form e.g. F
(a or b or not c) AND ((not a) or b or d) AND
Let C be the number of clauses and N be the
number of variables
Output graph G 3. ? F, F ? 3-SAT ? f(F)
(A,k) ? SUBSET_SUM
6
? f, f(f) (A,k) where A y1T, y1F, y2T,
y2F, yNT, yNF , z1a, z1b, z2a, z2b, zCa,
zCb ?i1ltiltN, yiT 10i Sxi? clause j
10jN yiF 10i Sxi? clause j
10jN ?j1ltjltC, zja 10jN zjb 10jN k
3 S1ltjltC 10jN S1ltiltN 10i
7
A Picture of f
j C 3 2 1
i N 3 2 1
1 0 0 0 0 0 0 0 0 0 0
1
y1T
yNF
0 1 0 0 1 0 0 0 0 0 0
0
z1a z1b zCb k
0 0 0 0 ... 1 0 0 0 0 0 0 0
0
0 0 0 0 ... 1 0 0 0 0 0 0 0
0
1 0 0 0 ... 0 0 0 0 0 0 0 0
0
3 3 3 3 ... 3 1 1 1 1 1 1 1
1
8
Showing the reduction f 3-SAT to SUBSET_SUM is
correct
1. ?f, f ?3-SAT ? f(f) (A,k) ? SUBSET_SUM 2.
?f, f ?3-SAT ? f(f) (A,k) ? SUBSET_SUM
(reduction does not necessarily preserve the size
of the witness set)
9
Showing 1.
Given an assignment, X, define B ?i1ltiltN, if
xi true, let yiT ? B if xi false, let yiF ?
B ?j1ltjltC, if clause j has 1 (distinct) true
literal per clause then both zja, zjb ? B if
clause j has 2 (distinct) true literals per
clause then zja? B if clause j has 3 (distinct)
true literal per clause then neither zja nor zjb
? B
10
Showing 1. ...
Note that Sw?B w k
11
Showing 2.
If f(f) (A,k) ? SUBSET_SUM, then ?B B?A where
Sw?B w k Note that any such set B must be of
the following form ?i1ltiltN, exactly one of yiT
and yiF ? B Define assignment x ?i1ltiltN, if
yiT ? B, then xi true if yiF ? B, then xi
false X will be a satisfying assignment because
the ys satisfy each clause digit of k.
12
HW Problem Sipser 7.26 Sipser describes a game
PUZZLE in which K cards are placed in a box in
one of two orientations flipped around a vertical
axis. There are R rows per card with a hole
either on the left side of the card, right side
of the card, both, or neither. PUZZLE is those
sets of cards that have an set of orientations
that completely covers the bottom of the
box. Show that PUZZLE is NP-complete. Proof As
usual, we need to show 1. PUZZLE is in NP 2.
PUZZLE is NP-hard (1) Given the set of cards
c1 ck, a witness that c1 ck is in PUZZLE is a
sequence of choices (y1, y2 yk) where yi up
or down PUZZLE (c1 ck) ? (y1, y2 yk)
s.t. cards (c1 ck) will cover the bottom of the
box when placed according to orientations (y1, y2
yk)
13
PUZZLE is NP-hard. We show 3-SAT ltp PUZZLE We
will demonstrate a function f 1. f formulas ?
sets of cards such that 2. f is polynomial-time
computable 3. ? ?, ? ? 3-SAT ? f(?) ?
PUZZLE There is a natural correspondence
between a variable xi being true or false and
card ci being up or down Therefore, our reduction
f will create one card ci for every variable
xi There is also a natural correspondence
between a variable satisfying a clause and a card
covering the left side of a row.
Let C be the number of clauses and N be the
number of variables
14
? f, f(f) (c, c1 cN) where
  • Each card has C rows
  • special card c that has holes in and only in
    the left side of each row. (w.l.o.g. we can and
    will assume this card is placed first in the box
    in the up orientation)
  • ?i,j, where 1 lt i lt N, 1 lt j lt C, card ci does
    not have a hole
  • 1) on the left side of row j iff literal xi
    occurs in clause j.
  • 2) on the right side of row j iff literal xi
    occurs in clause j.

15
Showing the reduction f 3-SAT to PUZZLE is
correct
1. ?f, f ?3-SAT ? f(f) (c, c1 cN) ? PUZZLE
2. ?f, f ?3-SAT ? f(f) (c, c1 cN) ? PUZZLE
(reduction does not necessarily preserve the size
of the witness set)
16
Showing 1.
Given an assignment, X, define B ?i1ltiltN, if
xi true, let yi up if xi false, let yi
down Note that ?j1ltjltC, if clause j is
satisfied by literal z, then the card
that corresponds to the variable of z will cover
the jth hole onthe left side of c.
17
Showing 2.
If f(f) (c, c1 cN) ? PUZZLE, then ? (y, y1,
y2 yN) s.t. cards (c, c1 cN) will cover the
bottom of the box when placed according to
orientations (y, y1, y2 yN) Note that we can
assume that y up because, if y down, we
could reverse the orientation of all the
cards. Define assignment x ?i1ltiltN, if yi
up, then xi true if yi down, then xi
false
18
Claim
X, as constructed, will be a satisfying
assignment Proof Let clausej be any of the C
clauses Because the cards cover clause hole j
on the left side of c, there is a card ci such
that ci covers this hole. If ci is in the up
orientation, then xi true and so the literal
xi occurs in clause j and clause j is
satisfied If ci is in the down orientation,
then xi false and so the literal xi occurs
in clause j and clause j is satisfied
Write a Comment
User Comments (0)
About PowerShow.com