Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Complexity Theory in Toc

Download as ps, pdf, or txt
Download as ps, pdf, or txt
You are on page 1of 3

U.C.

Berkeley | CS278: Computational Complexity Le ture 1


Professor Lu a Trevisan January 17, 2001
Last revised January 21, 2001

Le ture 1

This ourse assumes CS170, or equivalent, as a prerequisite. We will assume that the
reader is familiar with the notions of algorithm and running time, as well as with basi
notions of dis rete math and probability.
A main obje tive of theoreti al omputer s ien e is to understand the amount of re-
sour es (time, memory, ommuni ation, randomness , : : : ) needed to solve omputational
problems that we are about. While the design and analysis of algorithms puts upper
bounds on su h amounts, omputational omplexity theory is mostly on erned with lower
bounds; that is we look for negative results showing that ertain problems require a lot of
time, memory, et ., to be solved. In parti ular, we are interested in infeasible problems,
that is omputational problems that require impossibly large resour es to be solved, even
on instan es of moderate size. It is very hard to show that a parti ular problem is infeasible,
and in fa t for a lot of interesting problems the question of their feasibility is still open.
Another major line of work in omplexity is in understanding the relations between di erent
omputational problems and between di erent \modes" of omputation. For example what
is the relative power of algorithms using randomness and deterministi algorithms, what is
the relation between worst- ase and average- ase omplexity, how easier an we make an
optimization problem if we only look for approximate solutions, and so on. It is in this
dire tion that we nd the most beautiful, and often surprising, known results in omplexity
theory.
Before going any further, let us be more pre ise in saying what a omputational problem
is, and let us de ne some important lasses of omputational problems. Then we will see a
parti ular in arnation of the notion of \redu tion," the main tool in omplexity theory, and
we will introdu e NP- ompleteness, one of the great su ess stories of omplexity theory.

Computational Problems

In a omputational problem, we are given an input that, without loss of generality, we assume
to be en oded over the alphabet f0; 1g, and we want to return in output a solution satisfying
some property: a omputational problem is then des ribed by the property that the output
has to satisfy given the input.
In this ourse we will deal with four types of omputational problems: de ision problems,
sear h problems, optimization problems, and ounting problems.1 For the moment, we will
dis uss de ision and sear h problem.
In a de ision problem, given an input x 2 f0; 1g , we are required to give a YES/NO
answer. That is, in a de ision problem we are only asked to verify whether the input
satis es a ertain property. An example of de ision problem is the 3- oloring problem:
given an undire ted graph, determine whether there is a way to assign a \ olor" hosen
1
This distin tion is useful and natural, but it is also arbitrary: in fa t every problem an be seen as a
sear h problem
Notes for Le ture 1: January 17, 2001 2

from f1; 2; 3g to ea h vertex in su h a way that no two adja ent verti es have the same
olor.
A onvenient way to spe ify a de ision problem is to give the set L  f0; 1g of inputs
for whi h the answer is YES. A subset of f0; 1g is also alled a language, so, with the
previous onvention, every de ision problem an be spe i ed using a language (and every
language spe i es a de ision problem). For example, if we all 3COL the subset of f0; 1g
ontaining (des riptions of) 3- olorable graphs, then 3COL is the language that spe i es
the 3- oloring problem. From now on, we will talk about de ision problems and languages
inter hangeably.
In a sear h problem, given an input x 2 f0; 1g we want to ompute some answer
y 2 f0; 1g
 that is in some relation to x, if su h a y exists. Thus, a sear h problem

is spe i ed by a relation R  f0; 1g  f0; 1g , where (x; y) 2 R if and only if y is an
admissible answer given x.
Consider for example the sear h version of the 3- oloring problem: here given an undi-
re ted graph G = (V ; E ) we want to nd, if it exists, a oloring : V ! f1; 2; 3g of the
verti es, su h that for every (u; v) 2 V we have (u) 6= (v). This is di erent (and more de-
manding) than the de ision version, be ause beyond being asked to determine whether su h
a exists, we are also asked to onstru t it, if it exists. Formally, the 3- oloring problem is
spe i ed by the relation R3COL that ontains all the pairs (G; ) where G is a 3- olorable
graph and is a valid 3- oloring of G.

P and NP

In most of this ourse, we will study the asymptoti omplexity of problems. Instead of
onsidering, say, the time required to solve 3- oloring on graphs with 10; 000 nodes on some
parti ular model of omputation, we will ask what is the best asymptoti running time of
an algorithm that solves 3- oloring on all instan es. In fa t, we will be mu h less ambitious,
and we will just ask whether there is a \feasible" asymptoti algorithm for 3- oloring. Here
feasible refers more to the rate of growth than to the running time of spe i instan es of
reasonable size.
A standard onvention is to all an algorithm \feasible" if it runs in polynomial time,
i.e. if there is some polynomial p su h that the algorithm runs in time at most p(n) on
inputs of length n.
We denote by P the lass of de ision problems that are solvable in polynomial time.
We say that a sear h problem de ned by a relation R is a NP sear h problem if the
relation is eÆ iently omputable and su h that solutions, if they exist, are short. Formally,
R is an NP sear h problem if there is a polynomial time algorithm that, given x and y ,

de ides whether (x; y) 2 R, and if there is a polynomial p su h that if (x; y) 2 R then


jyj  p(jxj).

We say that a de ision problem L is an NP de ision problem if there is some NP relation


R su h that x 2 L if and only if there is a y su h that (x; y ) 2 R. Equivalently, a de ision

problem L is an NP de ision problem if there is a polynomial time algorithm V (; ) and


a polynomial p su h that x 2 L if and only if there is a y, jyj  p(jxj) su h that V (x; y)
a epts.
We denote by NP the lass of NP de ision problems.
Notes for Le ture 1: January 17, 2001 3

Redu tions

Let A and B be two de ision problems. We say that A redu es to B , denoted A  B , if


there is a polynomial time omputable fun tion f su h that x 2 A if and only if f (x)inB .
Two immediate observations: if A  B and B is in P, then also A 2 P ( onversely, if
A  B , and A 62 P then also B 62 P); if A  B and B  C , then also A  C .

NP- ompleteness

A de ision problem A is NP-hard if for every problem L 2 NP we have L  A. A de ision


problem A is NP- omplete if it is NP- omplete and it belongs to NP.
It is a simple observation that if A is NP- omplete, then A is solvable in polynomial
time if and only if P = NP.

An NP- omplete problem

Consider the following de ision problem, that we all U : we are given in input (M ; x; t; l)
where M is a Turing ma hine, x 2 f0; 1g is a possible input, and t and l are integers
en oded in unary2, and the problem is to determine whether there is a y 2 f0; 1g , jyj  l,
su h that M (x; y) a epts in  t steps.
It is immediate to see that U is in NP. One an de ne a pro edure VU that on input
(M ; x; t; l) and y a epts if and only if jyj  l, and M (x; y) a epts in at most t steps.
Let L be an NP de ision problem. Then there are algorithm VL , and polynomials TL
and pL , su h that x 2 L if and only if there is y, jyj  pL (jxj) su h that VL (x; y) a epts;
furthermore VL runs in time at most TL (jxj + jyj). We give a redu tion from L to U .
The redu tion maps x into the instan e f (x) = (VL ; x; TL (jxj + pL (jxj)); pL (jx)). Just by
applying the de nitions, we an see that x 2 L if and only f (x) 2 U .

2
The \unary" en oding of an integer n is a sequen e of n ones.

You might also like