Lecture
ON
Cooks Theorem
V.Radhesyam
Assistant professor
Department of IT:VRSEC
Types of Problems
• Any problem for which answer is 0 or1 is called
decision problem, such algorithm is called decision
algorithm.
• Any problem that involves identification of optimal value
of given cost function is known as optimization
problem, such algorithm is optimization algorithm.
• An algorithm for a given problem is said to be
polynomial time algorithm if its time complexity belongs
O(nk), Where k is an integer.
• An algorithm for a given problem is said to be non
polynomial time algorithm if it is Not a polynomial time
algorithm. Fibonacci series(O(2^n), TSP(n^2 2^n)
Non deterministic Algorithm
• Deterministic machine: It A is array of size n
is a machine that at any j:=choice(1,n)
given state during If A[j]=key then
execution, reading Input
symbol next state is {
known . Algorithms run on Write(j);
deterministic machines Success();
are called Deterministic
algorithms. }
else
• If not such machines are {
called non deterministic Write(0);
machines and such
algorithms are called non Failure()
deterministic algorithms. }
P and NP
• P: The class of decision problems that are
solvable in polynomial time by deterministic
algorithms.
• NP: The class of decision problems that are
solvable in polynomial time by non
deterministic algorithms. NP
P
Reducibility
• If a problem L1 is polynomial time reducible
to L2 we denote as L1<P L2
• If we can convert one instance of problem
L1 in to problem L2.
3x+4 ax2+bx+c
A B
Graph coloring
Problem
D C
Examples
• NP-Complete Problems
– Following are some NP-Complete problems, for which no polynomial
time algorithm is known.
– Determining whether a graph has a Hamiltonian cycle
– Determining whether a Boolean formula is satisfiable
• NP-Hard Problems
– The following problems are NP-Hard
– The circuit-satisfiability problem
– Set Cover
– Vertex Cover
– Travelling Salesman Problem
NP-Hard and NP- Complete
• A decision problem Pi is NP-Hard if every
problem in NP is polynomial time reducible to Pi .
• A decision problem Pi is NP-Complete(NPC) if it
is both NP-Hard and NP.
Q: What does it mean if we can reduce problem P
in to problem Q
P is no harder than Q
Q: What was the first problem shown to be NP-
complete
Boolean satisfibility problem(SAT) by cook
Relation between P,NP,NP-
complete and NP-hard
NP hard
NP
P
NP complete
Boolean satisfibility problem(SAT)
• Clause: Disjunction of literals ( x 1 x2 x
3 ) ( x1 x2 x
3 )
• CNF Conjunctive normal form
( x1 x2 x
3 )
( x1 x2 x
3 )
• It is conjunction of one or more clauses
• SAT : Find the assignment to the variables to
0/1 such that formula is true.
Cooks Theorem
• Cook's theorem, states that the
Boolean satisfiability problem is
NP-complete
• It can be proved in two parts
PART-I
• Assume P=NP
• We need to prove Satisfibility is in P
• We know that Satisfibility is in NP by definition
• Therefore Satisfibility is in P
Cooks Theorem
PART-II
• Assume Satisfibility is in P
• We need to prove P=NP
NP
• This can be further proved as
P NP P
NP P
Cooks Theorem
• The sufficient condition is
• How to obtain nondeterministic
algorithm A and Input I a formula Q (A, I)
Such that Q is Satisfiable iff A has a
succeful termination with input
• This condition can be proved by the
Assumptions.
13
Assumptions on non deterministic
machine model
• The machine on which A is executed is word oriented each word
w bit long it take one unit of time perform Add Sub Mul and so on
• All assignments in A are one of the following forms
<simple variable>:=<simple expression>
<array variable>:=<simple variable>
<simple variable>:=<array variable>
<simple variable>:=choice(s) ;S is finet set
• All variables in A are of type integer or boolean
• A contains no read/write statements
• A contains no constants.