Wh y? Because while T ( n ) steps on a 3 computer ma y - - PDF document

wh y because while t n steps on a 3 computer ma y b ecome
SMART_READER_LITE
LIVE PREVIEW

Wh y? Because while T ( n ) steps on a 3 computer ma y - - PDF document

The Class of Languages P If a (deterministic) TM has some M p olynomial p ( n ) suc h that nev er mak es M more than p ( n ) mo v es when presen ted with input of length n , then is said to b e a M TM .


slide-1
SLIDE 1 The Class
  • f
Languages P
  • If
a (deterministic) TM M has some p
  • lynomial
p(n) suc h that M nev er mak es more than p(n) mo v es when presen ted with input
  • f
length n, then M is said to b e a p
  • lynomial-time
TM.
  • P
is the set
  • f
languages that are accepted b y p
  • lynomial-
tim e TM's.
  • Equiv
alen tly , P is the set
  • f
problems that can b e solv ed b y a real computer b y a p
  • lynomial-
time algorithm.

Wh y? Because while T (n) steps
  • n
a computer ma y b ecome T 3 (n) steps
  • n
a TM, T (n) cannot b e a p
  • lynomial
unless T 3 (n) is.

Man y famili ar problems are in P : graph reac habilit y (transitiv e closure), matrix m ultiplication (is this matrix the pro duct
  • f
these
  • ther
t w
  • matrices?),
etc. The Class
  • f
Languages N P
  • A
nondeterministic TM that nev er mak es more than p(n) mo v es in an y sequence
  • f
c hoices for some p
  • lynomial
p) is said to b e a p
  • lynomial-time
NTM.
  • N
P is the set
  • f
languages that are accepted b y p
  • lynomial
  • tim
e NTM's.
  • Man
y problems are in N P but app ear not to b e in P : TSP (is there a tour
  • f
all the no des in a graph with total edge w eigh t
  • k
?), SA T (do es this Bo
  • lean
expression ha v e a satisfying assignmen t
  • f
its v ariables?), CLIQUE (do es this graph ha v e a set
  • f
k no des with edges b et w een ev ery pair?).
  • One
  • f
the great mathematical questions
  • f
  • ur
age: Is there an ything in N P that is not in P ? NP-Complete Problems If w e can't resolv e the \P = N P question, w e can at least demonstrate that certain problems in N P are \hardest," in the sense that if an y
  • ne
  • f
them w ere in P , then P = N P .
  • Called
NP-c
  • mplete
problems.
  • In
tellectual lev erage: eac h NP-complete problem's apparen t dicult y reenforces the b elief that they are all hard. 1
slide-2
SLIDE 2 Metho d for Pro ving NP-complete Problems
  • P
  • lynomial-
tim e reductions (PTR): tak e time that is some p
  • lynomial
in the input size to con v ert instances
  • f
  • ne
problem to instances
  • f
another.

Of course, the same algorithm con v erts non-instances
  • f
  • ne
to non-instances
  • f
the
  • ther.
  • If
P 1 PTR to P 2 , and P 2 is in P , then so is P 1 .

Wh y? Com bine the PTR and P 2 test to get a p
  • lynomial
  • tim
e algorithm for P 1 .
  • Start
b y sho wing every problem in N P has a PTR to SA T (= satisabilit y
  • f
a Bo
  • lean
form ula).

Th us, if SA T is in P , ev erything in N P is in P ; i.e., P = N P !
  • Then,
more problems can b e pro v en NP- complete b y sho wing that SA T PTRs to them, directly ,
  • r
indirectly .

Key p
  • in
t: the comp
  • sition
  • f
an y nite n um b er
  • f
PTR's is a PTR.
  • Don't
forget that y
  • u
also need to sho w the problem is in N P (usually easy , but necessary). Reduction
  • f
An y L in N P to SA T Assume L = L(M ) for some NTM M that is time- b
  • unded
b y p
  • lynomial
p(n).
  • Key
idea: if w ,
  • f
length n, is in L, then there is a sequence
  • f
p(n) + 1 ID's, eac h
  • f
length p(n) + 1, that demonstrates acceptance
  • f
w .

W ell not exactly: the accepting sequence migh t b e shorter. If so, extend ` to allo w
  • `
  • if
  • is
an ID with an accepting state.

Still not exactly: some ID's will b e shorter than p(n) + 1 sym b
  • ls.
P ad those
  • ut
with blanks.
  • No
w, w e can imagine a square arra y
  • f
sym b
  • ls
X ij , for i and j ranging from to p(n), where X ij is the sym b
  • l
in p
  • sition
j
  • f
the ith ID. 2
slide-3
SLIDE 3
  • Giv
en string w , construct a Bo
  • lean
expression that sa ys \these X ij 's represen t an accepting computation
  • f
w .

V ery Imp
  • rtan
t: The construction m ust b e carried
  • ut
in time p
  • lynomial
in n = jw j. In fact, w e need
  • nly
O (1) w
  • rk
p er X ij [or O
  • p
2 (n)
  • total]

Another imp
  • rtan
t principle: The
  • utput
cannot b e longer than the amoun t
  • f
time tak en to generate it, so w e are sa ying that the Bo
  • lean
expression will ha v e O (1) \stu " p er X ij .
  • The
prop
  • sitional
v ariables in the desired expression are named y i;j;Y , whic h w e should in terpret as an assertion that the sym b
  • l
X ij is Y .
  • The
desired expression E (w ) is S ^ M ^ F = starts, mo v es, and nishes righ t. Starts Righ t
  • S
is the AND
  • f
eac h
  • f
the prop er v ariables: y 0;0;q ^ y 0;1;a 1 ^
  • ^
y 0;n;a n ^ y 0;n+1;B ^
  • ^
y 0;p(n);B

Here, q is the start state, w = a 1 ; : : : ; a n , and B is the blank. Mo v es Righ t Key idea: the v alue
  • f
X i;j dep ends
  • nly
  • n
the three sym b
  • ls
ab
  • v
e it, to the northeast, and the north w est.
  • Ho
w ev er, since the comp
  • nen
ts
  • f
a mo v e (next state, new sym b
  • l,
and head direction) m ust come from the same NTM c hoice, w e need rules that sa y: when X i1;j is the state, then all three
  • f
X i;j 1 , X ij , and X i;j +1 are determined from X i1;j 1 , X i1;j , and X i1;j +1 b y
  • ne
c hoice
  • f
mo v e.
  • W
e also ha v e rules that sa y when the head is not near X ij , then X ij = X i1;j .
  • Details
in the reader. The essen tial p
  • in
t is that w e can write an expression for eac h X ij in O (1) time.

Therefore, this expression is O (1) long, indep enden t
  • f
n. 3
slide-4
SLIDE 4 Finishes Righ t Key idea: w e dened the TM to rep eat its ID
  • nce
it accepts, so w e can b e sure the last ID has an accepting state if the TM accepts.
  • F
is therefore the OR
  • f
all v ariables y p(n);j;q where q is an accepting state. Conjunctiv e Normal F
  • rm
W e no w kno w SA T is NP-complete. Ho w ev er, when reducing to
  • ther
problems, it is con v enien t to use a restricted v ersion
  • f
SA T, called 3SA T, where the Bo
  • lean
expression is the AND
  • f
clauses, and eac h clause consists
  • f
exactly 3 liter als.
  • A
literal is a v ariable
  • r
a negated v ariable.

E.g., x
  • r
:y . W e shall sometimes use the common con v en tion where
  • x
represen ts the negation
  • f
x.
  • A
clause is the OR
  • f
literals.

E.g., (x _
  • y
_ z ).

W e shall
  • ften
follo w common con v en tion and use + for _ in clauses, e.g., (x +
  • y
+ z ), and also use juxtap
  • sition
(lik e a m ultipli cation) for ^.
  • An
expression that is the AND
  • f
clauses is in c
  • njunctive
normal form (CNF). CSA T Satisabilit y for CNF expressions is NP complete.
  • The
pro
  • f
(reduction from SA T) is simple, b ecause the expression S ^ M ^ F w e deriv ed is already the pro duct (AND)
  • f
expressions whose size is O (1), i.e., not dep enden t
  • n
n = jw j.
  • First,
w e can push all the :'s do wn the expression un til they apply
  • nly
to v ariables; i.e., an y expression is con v erted to an AND- OR expression
  • f
literals.

Use DeMor gan 's laws: :(E ^ F ) = (:E ) _ (:F ) and :(E _ F ) = (:E ) ^ (:F ).

Changes the size
  • f
the expression b y
  • nly
a constan t factor (b ecause extra :'s and p
  • ssibly
paren theses are in tro duced). 4
slide-5
SLIDE 5
  • Next,
distribute the OR's
  • v
er the AND's, to get a CNF expression.

This pro cess can exp
  • nen
tiate the size
  • f
an expression.

Ho w ev er, since this pro cess
  • nly
needs to b e applied to expressions
  • f
size O (1), the result ma y b e h uge expressions, but expressions whose lengths are indep enden t
  • f
n and therefore still O (1)! 3-CNF and 3SA T
  • A
Bo
  • lean
expression is in 3-CNF if it is the pro duct (AND)
  • f
clauses, and eac h clause consists
  • f
exactly 3 literals.

Example: (x +
  • y
+ z )(
  • x
+ w +
  • z
).
  • The
problem 3SA T is satisabilit y for 3-CNF expressions. Reducing CSA T to 3SA T It w
  • uld
b e nice if there w ere a w a y to turn an y CNF expression in to an equiv alen t 3-CNF expression, but there isn't.
  • T
ric k: w e don't ha v e to turn a CNF expression E in to an equiv alen t 3-CNF expression F , w e just need to kno w that F is satisable if and
  • nly
if E is satisable.
  • W
e turn E in to 3-CNF F in p
  • lynomial
time b y in tro ducing new v ariables.

If the clause is to
  • long,
in tro duce extra v ariables. Example: (u + v + w + x + y + z ) b ecomes (u + v + a)(
  • a
+ w + b)(
  • b
+ x + c)(
  • c
+ y + z ).

A clause
  • f
  • nly
t w
  • ,
lik e (x + y ) can b ecome (x + y + a)(x + y +
  • a).

A clause
  • f
  • ne,
lik e (x) can b ecome (x + a + b)(x + a +
  • b)(x
+
  • a
+ b)(x +
  • a
+
  • b).

See the reader for explanations
  • f
wh y these transformations preserv e satisabilit y , and can b e carried
  • ut
in p
  • lynomial
time.
  • Th
us 3SA T is NP-complete. This problem pla ys a role similar to PCP for pro ving NP- completeness
  • f
problems. 5