Upgrade to Pro — share decks privately, control downloads, hide ads and more …

SAT (The Cook-Levin Theorem)

Rod Hilton
October 24, 2012

SAT (The Cook-Levin Theorem)

An overview of the Cook-Leven theorem and the Satisfiability Problem, covering how the problem is NP-Complete without reducing any other problem to it

Rod Hilton

October 24, 2012
Tweet

More Decks by Rod Hilton

Other Decks in Technology

Transcript

  1. Stephen Cook Professor, University of Toronto 72 Years Old Leonid

    Levin Professor, Boston University 63 Years Old
  2. What is SAT? Given a formula S of boolean variables

    X = {x1 , x2 … xm } is there an assignment of variables X such that S is true? S1 = (a) ! (b)" S2 = (a ! b ! -c) # (-a ! b ! d)" S3 = (a ! b) # (-a ! c)"
  3. Easy to show SAT in NP If given a certificate

    C of assignments to variables X, it is easy to evaluate the formula and see if it is true. X= { x1 , x2 , x3 }" S = (x1 ! x2 ! -x3 ) # (-x1 ! x2 ! x3 )" C = { x1 =T, x2 =F, x3 =T}" Note: Many different C’s would work. x2 being true satisfies S = (T ! F ! -T) # (-T ! F ! T)" = (T ! F ! F) # ( F ! F ! T)" = T" ✓
  4. Is SAT NP-Complete? Must be in NP ✔ Everything else

    in NP must be reducible to SAT in polynomial time
  5. Can everything in NP be reduced to SAT? If a

    problem/language A is in NP, there’s a Nondeterministic Turing Machine NTMA that recognizes it in polynomial time Can we simulate NTMA using only boolean expressions? Boolean expressions are made up of: ANDs ORs NOTs
  6. Terms A – a language in NP NTMA - Nondeterministic

    Turing Machine that accepts A w - input to NTMA
  7. Assumptions One tape Head does not move left of start

    position Input w is of length n" NTMA runs in p(n) steps" If NTMA accepts w, it does so through a sequence of p(n) configurations The config itself is p(n) in length
  8. NTMA Configuration Snapshot (running on w) # q0" w1" w2"

    …" wn" _" …" _" # state input extra space p(n)"
  9. w on NTMA Tableau # # # # # q0"

    w1" w2" …" wn" _" …" _" # p(n)" if any config (r0w) accepts, the entire tableau accepts # #
  10. “Does the tableau for w on NTMA accept?” “Does NTMA

    accept w?” Non-determinism: if any configuration/row accepts, the whole machine does
  11. Where’s this going, again? We can represent NTMA on w

    as a tableau Solve $ using SAT! Use tableau to construct a boolean expression $ such that: $ is satisfied iff NTMA accepts w"
  12. C0,0" C0,1" …" C0,p(n)" C1,0" C1,1" …" C1,p(n)" ." ."

    ." ." ." ." …" ." ." ." Cp(n),0" Cp(n),1" …" Cp(n),p(n)" There are only so many symbols that could be in Ci,j" " For each symbol s, xi,j,s is true when Ci,j has s in it. We will form $ from x’s
  13. We’re now representing the entire tableau as boolean variables. Our

    expression will be made up of four sub- expressions: " •  $unique "(Exactly one symbol in each cell) •  $start "(The start configuration is valid) •  $move "(All of the transitions are valid) •  $accept "(One of the configurations accepts) $ = $unique # $start # $move # $accept
  14. $unique •  For all i,j < p(n) (each cell Ci,j

    )" – For all possible symbols Y, Z (Y ≠ Z)" •  Take the AND of all (-xi,j,Y ! -xi,j,Z )" In other words, for all pairs of symbols, it’s true that any given cell fails to have one of them (aka: each cell only has one symbol)
  15. $start x0,0,# # x0,1,q0 # x0,2,w1 # x0,3,w2 # …

    " " "# x0,n+1,wn # x0,n+2,_ # …" " "# x0,p(n)-1,_ # x0,p(n),# " " " " " " Ensure that the start state looks exactly as it’s supposed to
  16. $unique •  For all i,j < p(n) (each cell Ci,j

    )" – Take the OR of all xi,j,qaccept" Check each cell to see if it’s the unique symbol for acceptance
  17. $move Trickiest one Look at all of the different 2-row

    “chunks” of the tableau and make sure the top one can lead the bottom one
  18. Suppose NTMA has a transition function & that includes: &(q,A)

    è (p,B,<-) " If machine in state q reads an A, write a B, move left, enter state p"
  19. &(q,A) è (p,B,<-) C" B" A" C" B" A" C"

    q" A" p" C" B" C" B" A" C" B" p" q" A" B" C" B" B" A" B" C" B" B" C"
  20. Constant number of window arrangements to check for any given

    transition Constant number of transitions for NTMA" " We can check if a window is legal in constant time " $move = The AND of all windows with top center cell Ci,j being legal
  21. " $ = $unique # $start # $move # $accept

    Reduced NP Language A to Boolean Satisfiability Problem
  22. $unique "- O(p(n)2) symbols The possible pairs of symbols is

    independent of n, so it’s a constant. The number of cells is p(n) * p(n)" " $start " "- O(p(n)) symbols Simply checking every symbol in a single row of the tableau " $move " "- O(p(n)2) symbols Need to check every “window”, of which there are almost as many as there are cells, p(n) * p(n) " $accept "- O(p(n)2) symbols Need to check each cell for accept symbol, of which there are p(n) * p(n).
  23. Total number of variables: " O(p(n)2 + p(n) + p(n)2

    + p(n)2)" " O(p(n)2) The reduction can be done in polynomial time.
  24. In polynomial time, we can reduce any instance of an

    NP problem into an instance of SAT Success! SAT is NP-Complete!
  25. “[SAT] is a good candidate for an interesting set not

    in [P], and I feel it is worth spending considerable effort trying to prove this conjecture.” “Such a proof would be a major breakthrough in complexity theory”