Cook's theorem shows that any problem in NP can be reduced in polynomial time to the problem of determining the satisfiability of a Boolean formula. It does so by describing how to construct a Boolean formula from a non-deterministic Turing machine MX that decides a problem X in NP. The formula uses variables to represent the machine's configuration over time, and clauses that enforce it follows the correct transitions. If the string x is accepted, the formula is satisfiable; otherwise it is not. This reduction proves the NP-completeness of the satisfiability problem.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
391 views33 pages
Cooks Theorem
Cook's theorem shows that any problem in NP can be reduced in polynomial time to the problem of determining the satisfiability of a Boolean formula. It does so by describing how to construct a Boolean formula from a non-deterministic Turing machine MX that decides a problem X in NP. The formula uses variables to represent the machine's configuration over time, and clauses that enforce it follows the correct transitions. If the string x is accepted, the formula is satisfiable; otherwise it is not. This reduction proves the NP-completeness of the satisfiability problem.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 33
Cooks Theorem
The Foundation of NP-Completeness
Theoretical Foundations An alphabet ={s 1 ,s 2 , ,s k } is a set of symbols The set * is the set of all strings created using the symbols of . A problem is a subset X* An algorithm A solves X, if given any string x* A accepts x if and only if xX. Decision Problems & Algorithms Decision Problems are Set-Membership Problems The sets are all assumed to be sets of strings Deterministic Algorithms Accept or Reject strings Non-Deterministic Algorithms Accept strings, but generally do not Reject strings The Elements of NP A problem X is an element of NP if there is a non-deterministic polynomial-time algorithm that solves X. All algorithms can be represented as Turing Machines Therefore, each XNP has a Non- Deterministic Turing Machine M X that accepts the elements of X in polynomial time What The Theorem Must Do Given a problem X, and a string x*, create a Boolean expression in polynomial time The Boolean expression must be in CNF form The Boolean expression must be satisfiable if and only if xX We can make use of M X and the polynomial time bound p(n) of M X . The Structure of M X I Any Turing Machine has a State Diagram, and a tape The tape is assumed to be a linear set of squares, each containing a symbol There is a blank symbol b, that occupies any un-accessed squares of the tape The tape extends indefinitely in both directions The Structure of M X II
The strings to be processed by M X are formed from the symbols from the set The symbols of may appear on the tape There may be additional tape-only symbols, taken from the set The blank b and b. The Structure of M X III The set of states is Q There are three distinguished states of Q, q 0 , q y and q n . (q n is not strictly required.) When M X is in state q y or q n , it is halted and no more transitions are possible. q 0 is the start state The Structure of M X IV The set determines the legal transitions The set of tape symbols T={b} QTQT{L,R} If (q i ,s j ,q k ,s l ,L), then when M X is in state q i
and scanning symbol s j on its tape, then it is legal for M to write s l into the current tape square, move one square to the left, and enter state q k The Structure of M X V More than one element of might apply in a given configuration The machine starts in state q 0 with the string x to be recognized on the tape. The read-write head is scanning the leftmost symbol of x (square 1) and blanks appear to the left and to the right of x. The Structure of M X VI Each application of an element of counts as one unit of time and is called a transition To accept x, it must be possible for M X to enter state q y in no more than p(n) transitions, where n is the length of x. It is not necessary for M X to enter q n to reject x.
Starting Position ... ... ... x 1 x 2 x 3 x n
3 1 -1 n 0 2 b b b b b b b b b b b b ... ... ... Read-Write Head Input String Square Number The Transform The accepting sequence of the machine M X
must be modeled in CNF clauses First it is necessary to define the a number of variables representing conditions in M X Then it is necessary to define clauses to represent the legal accepting sequences of M X The Variables Q[i,q k ] where i runs from 0 to p(n) and q k
runs through all states of M X
H[i,j] where I runs from 0 to p(n) and j runs from -p(n) through p(n)+1 S[i,j,s k ] where i runs from 0 to p(n), j runs from -p(n) through p(n)+1, and s k runs through all symbols of T (tape symbols) The Meaning of the Variables Q[i,q j ] means that at time i, M X is in state q j H[i,j] means that at time i, M X is scanning tape square j. Note that in p(n) transitions, the read-write head can move at most distance p(n) from its starting point. S[i,j,s k ] means that at time I, the contents of tape square j is s k .
Clause Groups G1 - Guarantee that at each time i, M X is in one and only one state G2 - Guarantee that at each time i, M X is scanning one and only one tape square G3 - Guarantee that at each time i, there is one and only one symbol in each tape square of the used tape
Clause Groups II G4 - Guarantee that the machine starts in q0 with x properly positioned on the tape and the read-write head properly positioned. G5 - Guarantee that by time p(n) M X has entered q y . G6 - Guarantee that the transitions are applied properly.
Group G1 For each time i, add the clause {Q[i,q 1 ],Q[i,q 2 ], , Q[i,q t ]} where t is the number of states in Q. For each time i, add the set of clauses {Q[i,q k ],Q[i,q j ]} where k and j, taken together run through all pairs of states of Q. If Q has t states then t(t+1)/2 clauses are required for each time i.
G1 Clause Meanings The first part guarantees that at each time i, M X is in at least one state. The second part (with the paired barred variables) guarantees that M X is not in more than one state at time i. The time i runs from 0 through p(n) Group G2 For each time i, add the clause: {H[i,-p(n)],H[i,-p(n)+1],,H[i,p(n)+1]} For each time i, let j and k run through all possible pairs of tape squares from -p(n) to p(n)+1. For each pair (j,k), and each time i, add the clause {H[i,j],H[i,k]}. G2 Clause Meanings The first clause says that M X must be scanning at least one tape square at every time i. The second set of clauses says that M X cannot be scanning more than one tape square at any given time i. Group G3 Let i run through all times from 0 to p(n) and j run through all tape squares from -p(n) through p(n)+1. (There are p(n)*2(p(n)+1) combinations. For each (i,j) add {S[i,j,s 0 ],S[i,j,s 1 ], ,S[i,j,s k ]}, where s 0 ,s 1 , ,s k run through all tape symbols in T. Group G3 Continued Let l and m run through all pairs of tape symbols. If there are k tape symbols, then there are k(k+1)/2 pairs. For each combination (i,j) and each pair (l,m), add the following clause {S[ i,j,l],S[i,j,m]} G3 Clause Meanings G3 Clauses model the behavior of the tape The first set of clauses guarantees that at any time i, each tape square contains at least one tape symbol. We are concerned only about squares numbered from -p(n) through p(n)+1. The second set of clauses guarantees that at any time i, no tape square contains more than one tape symbol. Group G4 Add {Q[0,q 0 ]} Add {H[0,1]} Add {S[0,1,x 1 ]}, {S[0,1,x 2 ]}, ,{S[0,n,x n ]} Add {S[0,0,b]} Add {S[0,n+1,b]}, {S[0,n+2,b]}, , {S[0,p(n)+1,b]} Add {S[0,-1,b]}, {S[0,-2,b]}, , {S[0,-p(n),b]} G4 Clause Meanings The first clause guarantees we start in state 0. The second clause guarantees the read-write head starts with square 1. The next set of clauses guarantees that the input string is on the tape in the correct position at time 0. The final sets of clauses guarantee that at time 0, the rest of the tape is blank. Group G5 Add {Q[p(n),q y ]} Once we enter state q y , no further transitions are allowed. This clause guarantees that we have entered state q y either at some time prior to p(n) or at time p(n). Entering q y causes M X to accept its input. Group G6 Let (q a ,s b ,q c ,s d ,e) be an element of , where e is an element of {L,R}. We need to model the following logical statement in CNF form: If the current time is i and M X is in state q a and M X is scanning tape square j and tape square j contains symbol s b , then at time I+1, M X will be in state q b , tape square j will contain s d and M X will be scanning either square j+1 or j-1 depending on e. Group G6 Continued If P then Q is logically equivalent to ~P OR Q. Assume e=L, then using the variables we get: ~(Q[i,q a ] AND H[i,j] AND S[i,j,s b ]) OR (Q[i+1,q b ] AND H[i+1,j+1] AND S[i+1,j,s d ]) For e=R, ~(Q[i,q a ] AND H[i,j] AND S[i,j,s b ]) OR (Q[i+1,q b ] AND H[i+1,j-1] AND S[i+1,j,s d ]) Deriving CNF Form ~(Q[i,q a ] AND H[i,j] AND S[i,j,s b ]) OR (Q[i+1,q b ] AND H[i+1,j+1] AND S[i+1,j,s d ]) DeMorgans Law: (Q[i,q a ] OR H[i,j] OR S[i,j,s b ]) OR (Q[i+1,q b ] AND H[i+1,j+1] AND S[i+1,j,s d ]) Apply Distributive Law to obtain Three Clauses Final Group e=L {Q[i,q a ], H[i,j], S[i,j,s b ], Q[i+1,q b ]} {Q[i,q a ], H[i,j], S[i,j,s b ], H[i+1,j+1]} {Q[i,q a ], H[i,j], S[i,j,s b ], S[i+1,j,s d ]} e=R {Q[i,q a ], H[i,j], S[i,j,s b ], Q[i+1,q b ]} {Q[i,q a ], H[i,j], S[i,j,s b ], H[i+1,j-1]} {Q[i,q a ], H[i,j], S[i,j,s b ], S[i+1,j,s d ]} G6 The Final Step For each element of , add one three-clause group for each combination of time i, and tape square j. For each element of , we generate 3*p(n)*2(p(n)+1) clauses. Windup The final Boolean Expression is E=G1G2G3G4G5G6 E is satisfiable if and only if M X accepts x=x 1 x 2 x 3 x n E can be constructed from M X and x in polynomial time.
The One Time Passcode (OTP) Is An Authentication Method For Mobile Devices (Smart Phones and Tablets) - OTP Should Be Used When A Corporate Laptop Is Not