> x(
H/0|DTimes New Romanp5D,0DWo
0DDTahomaew Romanp5D,0DWo
0D" DMonotype Sortsp5D,0DWo
00DCourier Newtsp5D,0DWo
0D1@DLucida Sans Unicode,0DWo
0D"a.
@n?" dd@ @@``pmRd
"# !&'()$%*
*+,-/12/03546789:;<>?ACBDEF?@GIHJKLMNOQPRSUTVWXZ^]_`badefc$ f3f33f3̙@ag4FdFd08,ppp@uʚ;2Nʚ;<4!d!ddЁ
0P<4dddddЁ
0P"___PPT9/0, 2` , % ?O=9iThe Satisfiability ProblemCook s Theorem: An NP-Complete Problem
Restricted SAT: CSAT, 3SATBoolean Expressions&Boolean, or propositional-logic expressions are built from variables and constants using the operators AND, OR, and NOT.
Constants are true and false, represented by 1 and 0, respectively.
We ll use concatenation (juxtaposition) for AND, + for OR, - for NOT, unlike the text.>yy33
Example: Boolean expression33(x+y)(-x + -y) is true only when variables x and y have opposite truth values.
Note: parentheses can be used at will, and are needed to modify the precedence order NOT (highest), AND, OR.&O3i
!The Satisfiability Problem (SAT )("fStudy of boolean functions generally is concerned with the set of truth assignments (assignments of 0 or 1 to each of the variables) that make the function true.
NP-completeness needs only a simpler question (SAT): does there exist a truth assignment making the function true?(Bf Example: SAT
33(x+y)(-x + -y) is satisfiable.
There are, in fact, two satisfying truth assignments:
x=0; y=1.
x=1; y=0.
x(-x) is not satisfiable.@UuU,YSAT as a Language/ProblemAn instance of SAT is a boolean function.
Must be coded in a finite alphabet.
Use special symbols (, ), +, - as themselves.
Represent the i-th variable by symbol x followed by integer i in binary.,m6Example: Encoding for SAT33@(x+y)(-x + -y) would be encoded by the string (x1+x10)(-x1+-x10)A.H#SAT is in NP
,There is a multitape NTM that can decide if a Boolean formula of length n is satisfiable.
The NTM takes O(n2) time along any path.
Use nondeterminism to guess a truth assignment on a second tape.
Replace all variables by guessed truth values.
Evaluate the formula for this assignment.
Accept if true.$-k>
8/Cook s Theorem3f,SAT is NP-complete.
Really a stronger result: formulas may be in conjunctive normal form (CSAT) later.
To prove, we must show how to construct a polytime reduction from each language L in NP to SAT.
Start by assuming the most resticted possible form of NTM for L (next slide).HUUUW, H
)Assumptions About NTM for LOne tape only.
Head never moves left of the initial position.
States and tape symbols are disjoint.
Key Points: States can be named arbitrarily, and the constructions many-tapes-to-one and two-way-infinite-tape-to-one at most square the time.nduZZd
̙9333 More About the NTM M for LLet p(n) be a polynomial time bound for M.
Let w be an input of length n to M.
If M accepts w, it does so through a sequence I0"I1"& "Ip(n) of p(n)+1 ID s.
Assume trivial move from a final state.
Each ID is of length at most p(n)+1, counting the state.(9~(9u
&From ID Sequences to Boolean FunctionsThe Boolean function that the transducer for L will construct from w will have (p(n)+1)2 variables.
Let variable Xij represent the j-th position of the i-th ID in the accepting sequence for w, if there is one.
i and j each range from 0 to p(n).`#W f^#>rX"Picture of Computation as an Arrayi1 Intuition
̙From M and w we construct a boolean formula that forces the X s to represent one of the possible ID sequences of NTM M with input w, if it is to be satisfiable.
It is satisfiable iff some sequence leads to acceptance.(334>p #
<From ID s to Boolean VariablesThe Xij s are not boolean variables; they are states and tape symbols of M.
However, we can represent the value of each Xij by a family of Boolean variables yijA, for each possible state or tape symbol A.
yijA is true if and only if Xij = A.lr#-P_nk2Points to Remember̙$The boolean function has components that depend on n.
These must be of size polynomial in n.
Other pieces depend only on M.
No matter how many states/symbols m has, these are of constant size.
Any logical formula about a set of variables whose size is independent of n can be written somehow.t6u'uEdu6'EdDesigning the Function2We want the Boolean function that describes the Xij s to be satisfiable if and only if the NTM M accepts w.
Four conditions:
Unique: only one symbol per position.
Starts right: initial ID is q0w.
Moves right: each ID follows from the next by a move of M.
Finishes right: M accepts.}u1J33 3333033
,0(UniquexTake the AND over all i, j, Y, and Z of (-yijY+ -yijZ).
That is, it is not possible for Xij to be both symbols Y and Z.Hy,$>+#"Starts RightThe Boolean Function needs to assert that the first ID is the correct one with w = a1& an as input.
X00 = q0.
X0i = ai for i = 1,& , n.
X0i = B (blank) for i = n+1,& , p(n).
Formula is the AND of y0iZ for all i, where Z is the symbol in position i.cHuKT"1s'Finishes RightSomewhere, there must be an accepting state.
Form the OR of Boolean variables yijq, where i and j are arbitrary and q is an accepting state.
Note: differs from text.8O;3NT+Running Time So FarUnique requires O(p2(n)) symbols be written.
Parentheses, signs, propositional variables.
Algorithm is easy, so it takes no more time than O(p2(n)).
Starts Right takes O(p(n)) time.
Finishes Right takes O(p2(n)) time.l---4?A,$Running Time (2)Caveat: Technically, the propositions that are output of the transducer must be coded in a fixed alphabet, e.g., x10011 rather than yijA.
Thus, the time and output length have an additional factor O(log n) because there are O(p2(n)) variables.
But log factors do not affect polynomialsB33[:/Moves Right`Xij = Xi-1,j whenever the state is none of Xi-1,j-1, Xi-1,j, or Xi-1,j+1.
For each i and j, construct a formula that says (in propositional variables) the OR of Xij = Xi-1,j and all yi-1,k,A where A is a state symbol (k = i-1, i, or i+1).
Note: Xij = Xi-1,j is the OR of yijA.yi-1,jA for all symbols A.@ [13# <=2Constraining the Next Symbol0"Moves Right (2)+In the case where the state is nearby, we need to write an expression that:
Picks one of the possible moves of the NTM M.
Enforces the condition that when Xi-1,j is the state, the values of Xi,j-1, Xi,j, and Xi,j+1. are related to Xi-1,j-1, Xi-1,j, and Xi-1,j+1 in a way that reflects the move.LuLP"!
(5Example: Moves Right336"Moves Right (3)For each possible move, express the constraints on the six X s by a Boolean formula.
For each i and j, take the OR over all possible moves.
Take the AND over all i and j.
Small point: for edges (e.g., state at 0), assume invisible symbols are blank.&3D7Running TimeWe have to generate O(p2(n)) Boolean formulas, but each is constructed from the moves of the NTM M, which is fixed in size, independent of the input w.
Takes time O(p2(n)) and generates an output of that length.
Times log n, because variables must be coded in a fixed alphabet.JB-B:.Cook s Theorem FinaleIn time O(p2(n) log n) the transducer produces a boolean formula, the AND of the four components: Unique, Starts, Finishes, and Moves Right.
If M accepts w, the ID sequence gives us a satisfying truth assignment.
If satisfiable, the truth values tell us an accepting computation of M. $,1;=Picture So FarWe have one NP-complete problem: SAT.
In the future, we shall do polytime reductions of SAT to other problems, thereby showing them NP-complete.
Why? If we polytime reduce SAT to X, and X is in P, then so is SAT, and therefore so is all of NP.J3/-,A S O>Conjunctive Normal FormA Boolean formula is in Conjunctive Normal Form (CNF) if it is the AND of clauses.
Each clause is the OR of literals.
A literal is either a variable or the negation of a variable.
Problem CSAT : is a Boolean formula in CNF satisfiable?jfffHf,G Example: CNF
33H(x + -y + z)(-x)(-w + -x + y + z) (& %%ANP-Completeness of CSATThe proof of Cook s theorem can be modified to produce a formula in CNF.
Unique is already the AND of clauses.
Starts Right is the AND of clauses, each with one variable.
Finishes Right is the OR of variables, i.e., a single clause.NI33 330330B:NP-Completeness of CSAT (2)Only Moves Right is a problem, and not much of a problem.
It is the product of formulas for each i and j.
Those formulas are fixed, independent of n.&33C:NP-Completeness of CSAT (3)You can convert any formula to CNF.
It may exponentiate the size of the formula and therefore take time to write down that is exponential in the size of the original formula, but these numbers are all fixed for a given NTM M and independent of n.+
I!k-SATIf a boolean formula is in CNF and every clause consists of exactly k literals, we say the boolean formula is an instance of k-SAT.
Say the formula is in k-CNF.
Example: 3-SAT formula
(x + y + z)(x + -y + z)(x + y + -z)(x + -y + -z)1}ff331,OJ"k-SAT FactsEvery boolean formula has an equivalent CNF formula.
But the size of the CNF formula may be exponential in the size of the original.
Not every boolean formula has a k-SAT equivalent.
2SAT is in P; 3SAT is NP-complete.H5PU5P=,DL$Proof: 2SAT is in P (Sketch)03f
Pick an assignment for some variable, say x = true.
Any clause with x forces the other literal to be true.
Example: (-x + -y) forces y to be false.
Keep seeing what other truth values are forced by variables with known truth values.Bl)Ul33"UP%Proof (2)3fOne of three things can happen:
You reach a contradiction (e.g., z is forced to be both true and false).
You reach a point where no more variables have their truth value forced, but some clauses are not yet made true.
You reach a satisfying truth assignment., u R&Proof (3)3fCase 1: (Contradiction) There can only be a satisfying assignment if you use the other truth value for x.
Simplify the formula by replacing x by this truth value and repeat the process.
Case 3: You found a satisfying assignment, so answer yes. NjP<3dP36S'Proof (4)3fCase 2: (You force values for some variables, but other variables and clauses are not affected).
Adopt these truth values, eliminate the clauses that they satisfy, and repeat.
In Cases 1 and 2 you have spent O(n2) time and have reduced the length of the formula by > 1, so O(n3) total.xaOn3[O#5
W(3SATThis problem is NP-complete.
Clearly it is in NP, since SAT is.
It is not true that every Boolean formula can be converted to an equivalent 3-CNF formula, even if we exponentiate the size of the formula.$.
X)3SAT (2)But we don t need equivalence.
We need to reduce every CNF formula F to some 3-CNF formula that is satisfiable if and only if F is.
Reduction involves introducing new variables into long clauses, so we can split them apart.cq[*Reduction of CSAT to 3SATLet (x1+& +xn) be a clause in some CSAT instance, with n > 4.
Note: the x s are literals, not variables; any of them could be negated variables.
Introduce new variables y1,& ,yn-3 that appear in no other clause.=SB,3O!>
;b#]+$CSAT to 3SAT (2)$Replace (x1+& +xn) by (x1+x2+y1)(x3+y2+ -y1) & (xi+yi-1+ -yi-2) & (xn-2+yn-3+ -yn-4)(xn-1+xn+ -yn-3)
If there is a satisfying assignment of the x s for the CSAT instance, then one of the literals xi must be made true.
Assign yj = true if j < i-1 and yj = false for larger j.z
b/0`-$CSAT to 3SAT (3)We are not done.
We also need to show that if the resulting 3SAT instance is satisfiable, then the original CSAT instance was satisfiable.,M&a.$CSAT to 3SAT (4)2Suppose (x1+x2+y1)(x3+y2+ -y1) & (xn-2+yn-3+ -yn-4)(xn-1+xn+ -yn-3)
is satisfiable, but none of the x s is true.
The first clause forces y1 = true.
Then the second clause forces y2 = true.
And so on & all the y s must be true.
But then the last clause is false.W.3333333333333333333333333G(R5i1e/$CSAT to 3SAT (5)There is a little more to the reduction, for handling clauses of 1 or 2 literals.
Replace (x) by (x+y1+y2) (x+y1+ -y2) (x+ -y1+y2) (x+ -y1+ -y2).
Replace (w+x) by (w+x+y)(w+x+ -y).
Remember: the y s are different variables for each CNF clause.e&3f7-f0CSAT to 3SAT Running TimeThis reduction is surely polynomial.
In fact it is linear in the length of the CSAT instance.
Thus, we have polytime-reduced CSAT to 3SAT.
Since CSAT is NP-complete, so is 3SAT.l>/\
!$
%)*-.13489;<?@DEFK M!N"O#Q$T%U&V'Y(Z)\*_+c-d.g/h0j1l2 ` ̙33` ` ff3333f` 333MMM` f` f` 3>?" dd@,?udd@ w " @ ` n?" dd@ @@``PR @ ` `p>>f(
6p P
T Click to edit Master title style!
!
0`r
RClick to edit Master text styles
Second level
Third level
Fourth level
Fifth level!
S
0\w ``
>*
00y `
@*
0ȁ `
@*Z
Byh@ ? ̙33 Default Design
0zrP
(
0b P
b
P*
0$g b
R*
d
c$ ?
g
0g
@g
RClick to edit Master text styles
Second level
Third level
Fourth level
Fifth level!
S
6 g `P g
P*
6g ` g
R*
H
0h ? ̙330$(
r
Sbpb
r
SĹb `
b
H
0h ? ̙33
`$$(
$r
$ Sh/gP
g
r
$ S0gg
H
$0h ? ̙33
,$(
,r
, S;gP
g
r
, SPJ
@J
H
0h ? ̙33r xbNf::&^ؖĘ2 ƚVŲ$ *'pǴٰzN@" "B$r&F(*+-xd/j1>3\H5468: n<"B>@ACEfG_0:IcKLzNPѨ^R2TVlOh+'00`h
CS154 slidesoJeff UllmanJeffUll96fMicrosoft PowerPointP@У3M@}J@bIG/g .& &&#TNPP2OMi
&
TNPP &&TNPP
&&--&&-$0>$>L$LZ*$*Zh8$8hvF-$FvT$Tb$bp-$p~$~$-$-$$-$$-$-$,$,:
-$
:H$HV&-$&Vd4-$4drB-$BrP$P^-$^k-$ky-$y-$-$-$-$-$-$-$-$'-$'5-$5C-$CQ!-$!Q_/-$/_m=-$=m{K-$K{Y-$Yg-$gu-$u-$-$-$-$-$-$-$-$#-$#1-$1?-$?M-$M[+-$+[i9-$9iwG-$GwU-$Uc-$cq-$q-$-$-$-$-$-$-$-$-$--$-;-$;I-$IW'-$'We5-$5erB-$BrP-$P^-$^l-$lz-$z-$-$-$-$-$$-$-$($(6-$6D-$DR"$"R`0-$0`n>$>n|L-$L|Z$Zh$hv-$v$$$&&&-&$&&-&&
&&-&&&&-$0>$>L$LZ*$*Zh8$8hvF-$FvT$Tb$bp-$p~$~$-$-$$-$$-$-$,$,:
-$
:H$HV&-$&Vd4-$4drB-$BrP$P^-$^k-$ky-$y-$-$-$-$-$-$-$-$'-$'5-$5C-$CQ!-$!Q_/-$/_m=-$=m{K-$K{Y-$Yg-$gu-$u-$-$-$-$-$-$-$-$#-$#1-$1?-$?M-$M[+-$+[i9-$9iwG-$GwU-$Uc-$cq-$q-$-$-$-$-$-$-$-$-$--$-;-$;I-$IW'-$'We5-$5erB-$BrP-$P^-$^l-$lz-$z-$-$-$-$-$$-$-$($(6-$6D-$DR"$"R`0-$0`n>$>n|L-$L|Z$Zh$hv-$v$$$&-
--&&&y&/!v`$vu
O(0!v`$v
f6- @Times New Roman\!v`$v
f6- . 2
f1 .--iyH-- @"Tahomavu
T(0\!v`$v
f6- .
2
CThe "!. .2
C
Satisfiability !
!
. .2
CRProblem! !
2.--Q1-- @"Tahomav
0\!v`$v
f6- .'2
Cooks Theorem: An NP
$
. . 2
_-. .2
n Complete $ . .2
Problem
$. ..2
8Restricted SAT: CSAT, 3SAT
.--"System6
f6
G-&TNPP &՜.+,0
(;On-screen ShowStanford University, CS Dept.gW11 7Times New RomanTahomaMonotype SortsCourier NewLucida Sans UnicodeDefault DesignThe Satisfiability ProblemBoolean ExpressionsExample: Boolean expression"The Satisfiability Problem (SAT )
Example: SATSAT as a Language/ProblemExample: Encoding for SAT
SAT is in NPCooks TheoremAssumptions About NTM for LMore About the NTM M for L'From ID Sequences to Boolean Functions#Picture of Computation as an Array
IntuitionFrom IDs to Boolean VariablesPoints to RememberDesigning the FunctionUnique
Starts RightFinishes RightRunning Time So FarRunning Time (2)Moves RightConstraining the Next SymbolMoves Right (2)Example: Moves RightMoves Right (3)
Running TimeCooks Theorem FinalePicture So FarConjunctive Normal Form
Example: CNFNP-Completeness of CSATNP-Completeness of CSAT (2)NP-Completeness of CSAT (3)k-SATk-SAT FactsProof: 2SAT is in P (Sketch)Proof (2)Proof (3)Proof (4)3SAT3SAT (2)Reduction of CSAT to 3SATCSAT to 3SAT (2)CSAT to 3SAT (3)CSAT to 3SAT (4)CSAT to 3SAT (5)CSAT to 3SAT Running TimeFonts UsedDesign Template
Slide Titles1_WJeffJeff
!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~Root EntrydO)Current UserSummaryInformation(1PowerPoint Document(WDocumentSummaryInformation8Root EntrydO)Current UserPSummaryInformation(1PowerPoint Document(W(_W_Michael GoodrichMichael Goodrich