Anda di halaman 1dari 18

COOKS THEOREM

DECISION AND OPTIMIZATION PROBLEM

Decision problem has yes or no answer.

Optimization problem requires answer of optimal configuration.

Decision problem are easier than optimization problem.

If we can show a decision problem is hard then it will imply that its
corresponding optimization problem is also hard.

TURING MACHINE

Turing machine consists of a line of cells called "tape" that can be moved
back & forth, an active element called "head" that possesses a property
called "state" & that can change the property known as "color" of the
active cell underneath it, and a set of instructions for how the head
should modify the active cell and move the tape.

The output of every operation in algorithm is uniquely defined is called


deterministic algorithm and machine is called deterministic turing
machine.

If the output of every operation in algorithm is not uniquely defined is


called non-deterministic algorithm and machine is called nondeterministic turing machine.

P CLASS PROBLEM

It contains alldecision problemswhich can be solved by a


deterministic Turing machineusing apolynomialamount of
computation time, orpolynomial time.

"efficiently solvable" or "tractable.

efficient discovery of solutions.

NP CLASS PROBLEM

A non-deterministic machine consists of two phases, the first of


which consists of a guess about the solution which is generated in a
non-deterministic way, while the second consists of a deterministic
algorithm which verifies or rejects the guess as a valid solution to the
problem.

efficient checking of solutions

P can be solved in polynomial time, so it can also be verified in


polynomial time. Therefore P is a subset of NP.

NP COMPLETE

A problem X is NP-Complete if
X is in NP, and

For any problem Y in NP, there is a "reduction" from Y to X: a


polynomial-time algorithm that transforms any instance of Y into an
instance of X such that the answer to the Y-instance is "yes" if and
only if the answer X-instance is "yes".

A problem R is NP-complete if R is the "most difficult" of all NP


problems.

NP HARD

The problem which is reducing another problems output is NP hard


problem.

A problem is NP-hard if solving it in polynomial time would make it


possible to solve all problems in classNPin polynomial time.

Some NP-hard problems are also inNP(these are called "NP-complete


"), some are not.

Satisfiability (SAT)

INSTANCE
A Logical expression containing
variables xi
logical connectors &, |, and !

PROBLEM
Is there an assignment of truth values to each of
the variables such that the expression will
evaluate to true.

COOKS THEOREM

Theorem:
SATISFIABILITY is NP-Complete.

Proof idea.
-- First show that SAT is in NP.
--Then show that every problem in NP is polynomial-time
reducible to SAT.(i.e SAT is NP hard.)

PROOF :

It is easy to see that SAT is in NP.

Simply non-deterministically choose Boolean values for each variable.

Then verify that the expression is true.

Let A be a problem in NP.

Then there is a nondeterministic Turing machine M that decides A in


polynomial time.

Let the run time of M be at most . When M is run, it can access at


most the first cells.

PROOF(CONTINUED)

Represent the execution of M by an array.

Each row contains a configuration of M.

The first row is the initial configuration, with input w.

The sequence of rows represents a computation of M that reaches a


halting state.

We will place the symbol # in the first and last cells of each row, to
help identify the ends of the tape.

Representing a Computation by a Configurations


Table

PROOF(CONTINUED)

In each row, each cell between the #s will contain


--A tape symbol x, or
--A state q, or
--A blank t.

That is, each cell contains one symbol from the set.

We will create a Boolean expression from the table that is satisfiable


if and only if the table represents a valid accepting computation of M.

Example

INPUT(11)

PROOF(CONTINUED)

Our Boolean expression will be of the form


= cell ^start ^ accept ^move;
where
cell true , Every cell contains exactly one symbol.
start true , Row 1 is a valid start configuration.

accept true , One of the rows is a valid accept


configuration.
move true , Each row yields the configuration in the next
row.

These expressions will all be true if and only if the table represents a
valid computation resulting in acceptance.

PROOF(CONTINUED)

The expression cell can contain only one element.

The expression start cells can contain these symbols-

We need to do is to guarantee that accept occurs somewhere in the


table.

The move expression move will take a bit more effort, the legal
moves are left and right. We will consider 2 x 3 windows in the table.

Which Windows are Legal in the


Following Example?

PROOF(CONTINUED)

Then the Boolean expression


= cell ^start ^ accept ^move;
is satisfiable if and only if w is accepted by M.

Therefore, SAT is NP-complete.

Hence proved.