Nondeterminis+c ¡TMs ¡
Nondeterminis+c TMs NTM defini*ons Same as determinis+c - - PowerPoint PPT Presentation
Nondeterminis+c TMs NTM defini*ons Same as determinis+c - - PowerPoint PPT Presentation
Nondeterminis+c TMs NTM defini*ons Same as determinis+c TM, but ( q,a ) is a finite set of possible next transi*ons E.g., ( q,a ) = { ( q
NTM ¡defini*ons ¡
- Same ¡as ¡determinis+c ¡TM, ¡but ¡δ(q,a) ¡is ¡a ¡finite ¡
set ¡of ¡possible ¡next ¡transi*ons ¡ ¡
- E.g., ¡ ¡δ(q,a) ¡= ¡{ ¡(q1,b1,D1), ¡(q2,b2,D2), ¡... ¡(qr,br,Dr)} ¡
– cannot ¡write ¡b1, ¡go ¡in ¡direc+on ¡D2, ¡etc. ¡ ¡
- NTM ¡N(w) ¡accepts ¡iff ¡there ¡exists ¡a ¡finite ¡
sequence ¡of ¡choices ¡that ¡result ¡in ¡an ¡accep+ng ¡
- state. ¡
- N(w) ¡may ¡have ¡choice ¡sequences ¡that ¡never ¡
halt, ¡yet ¡s+ll ¡accept ¡w. ¡
NTM ¡variants ¡
- Bells ¡and ¡whistles ¡do ¡not ¡increase ¡NTM ¡power ¡
- if ¡L ¡is ¡accepted ¡by ¡a ¡k-‑tape ¡mul+dimensional ¡... ¡
NTM, ¡then ¡L ¡is ¡accepted ¡by ¡standard ¡1-‑tape ¡NTM ¡
- Henceforth, ¡assume ¡NTMs ¡are ¡standard-‑issue. ¡
Theorem: ¡ ¡NTM ¡ ¡DTM ¡
Theorem: ¡ ¡If ¡L ¡is ¡accepted ¡by ¡a ¡NTM, ¡then ¡L ¡is ¡ also ¡accepted ¡by ¡a ¡DTM. ¡ ¡ ¡ ¡i.e., ¡languages ¡accepted ¡by ¡NTMs ¡are ¡just ¡the ¡ r.e. ¡languages. ¡ ¡(Those ¡accepted ¡by ¡DTMs) ¡ Again, ¡we ¡see ¡that ¡DTMs ¡are ¡a ¡robust ¡model ¡
Simula*on ¡
- Let ¡N ¡be ¡a ¡NTM, ¡create ¡M ¡to ¡simulate ¡N ¡
- Problems: ¡ ¡unlike ¡other ¡simula+ons, ¡M ¡cannot ¡
keep ¡track ¡of ¡ ¡
– states ¡ – head ¡posi+on ¡ – tape ¡contents ¡
Because ¡different ¡possible ¡computa+ons ¡have ¡ different ¡states, ¡head-‑posi+ons, ¡tape ¡contents ¡ SOLUTION: ¡ ¡M ¡tries ¡every ¡possible ¡computa+on ¡
Bounded ¡Nondeterminism ¡
- N ¡has ¡only ¡a ¡finite ¡number ¡of ¡choices ¡at ¡each ¡
- step. ¡
- Let ¡r ¡= ¡maximum ¡number ¡of ¡choices ¡for ¡any ¡
transi+on. ¡ ¡ ¡r ¡= ¡maxq,a ¡|δN(q,a)| ¡
- WLOG ¡assume ¡all ¡transi+ons ¡have ¡r ¡choices. ¡
- Possible ¡runs ¡of ¡N ¡can ¡be ¡viewed ¡as ¡r-‑ary ¡tree: ¡
Possible ¡computa*ons ¡of ¡N(w) ¡
ID0 ¡= ¡$q0w ¡ ID1 ¡ ID2 ¡ ID3 ¡ ID4 ¡ IDr ¡
. ¡ . ¡ . ¡ . ¡
consequence ¡of ¡ taking ¡4th ¡ applicable ¡ transi+on ¡ r ¡branches ¡
ID11 ¡ ID1r ¡
. ¡. ¡. ¡
IDr1 ¡ IDrr ¡
. ¡. ¡. ¡
First ¡move ¡
ID42 ¡ ID425 ¡ ID4251 ¡ ID42519 ¡
State ¡of ¡N’s ¡computa+on ¡aaer ¡ ¡ taking ¡ ¡ ¡4th, ¡2nd, ¡5th, ¡1st, ¡9th ¡choices ¡ ¡
- n ¡first ¡five ¡transi+ons ¡
If ¡N(w) ¡accepts, ¡it ¡does ¡so ¡in ¡finite ¡*me ¡
- = ¡s ¡steps, ¡for ¡some ¡s ¡ ¡(different ¡for ¡different ¡w) ¡
- Some ¡sequence ¡of ¡s ¡nondet ¡choices ¡accept ¡
- Can ¡represent ¡the ¡choices ¡as ¡an ¡r-‑ary ¡
sequence ¡with ¡s ¡places: ¡ ¡a1a2...as ¡where ¡each ¡ ai ¡is ¡in ¡{1,2,...,r} ¡
- M ¡tries ¡every ¡possible ¡sequence, ¡of ¡all ¡
possible ¡lengths ¡
- M ¡essen+ally ¡does ¡a ¡breadth-‑first ¡search ¡of ¡
the ¡tree ¡of ¡possible ¡computa+ons ¡of ¡N. ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡(why ¡not ¡DFS?) ¡
M ¡has ¡three ¡tapes ¡
Tape ¡1 ¡
$ ¡ w ¡ Holds ¡input; ¡ ¡never ¡changes ¡ $ ¡
Tape ¡2 ¡
Holds ¡N’s ¡computa+on ¡for ¡ some ¡possible ¡computa+on ¡ dictated ¡by ¡choices ¡on ¡tape ¡3 ¡ $ ¡ 3 ¡ 7 ¡ 4 ¡
Tape ¡3 ¡
Holds ¡r-‑ary ¡sequence ¡to ¡ control ¡N’s ¡choices ¡
Genera*on ¡of ¡choice ¡sequences ¡
- M ¡uses ¡subrou+ne ¡NewSeq ¡to ¡generate ¡r-‑ary ¡
sequences ¡in ¡lexicographic ¡order ¡on ¡tape ¡3. ¡
- E.g., ¡if ¡r ¡= ¡2, ¡then ¡lex. ¡order ¡is ¡
¡ ¡ ¡1,2,11,12,21,22,111,112,121,122,... ¡
- If ¡NewSeq ¡is ¡called ¡with ¡112 ¡on ¡tape ¡3, ¡it ¡
would ¡replace ¡it ¡with ¡121. ¡
M’s ¡Main ¡program ¡
Ini+alize ¡tape ¡3 ¡with ¡“1” ¡ Copy ¡(tape ¡1 ¡(input ¡w) ¡to ¡tape ¡2) ¡ WHILE ¡TRUE: ¡ ¡Simulate ¡N ¡on ¡tape ¡2 ¡for ¡one ¡more ¡step; ¡ ¡ ¡ ¡/* ¡use ¡tape ¡3 ¡to ¡guide ¡choice ¡(details ¡follow) ¡ ¡IF ¡N ¡accepts, ¡THEN ¡accept, ¡ELSE ¡forward ¡head ¡3 ¡ ¡IF ¡head ¡3 ¡scanning ¡blank ¡symbol ¡ ¡ ¡ ¡ ¡ ¡THEN ¡NewSeq ¡and ¡Copy ¡
Simulate ¡
- If ¡N ¡is ¡in ¡state ¡q, ¡scanning ¡symbol ¡a, ¡ ¡then ¡
execute ¡the ¡nth ¡transi+on ¡for ¡δN(q,a) ¡for ¡N, ¡ where ¡n ¡is ¡symbol ¡scanned ¡on ¡tape ¡3. ¡ DETAIL: ¡ ¡Suppose ¡nth ¡element ¡of ¡δN(q,a) ¡= ¡(p,b,D) ¡ ¡ ¡In ¡M, ¡ ¡ ¡ ¡δM(q,$,a,n) ¡= ¡(p,$,b,n,S,D,R) ¡
tape ¡1 ¡just ¡sits ¡ tape ¡2 ¡ ¡is ¡symbol ¡N ¡scans ¡ tape ¡3 ¡ ¡dictates ¡N’s ¡choice ¡ move ¡head ¡3 ¡to ¡ next ¡choice ¡ move ¡tape ¡2 ¡as ¡N ¡would ¡ change ¡tape ¡2 ¡as ¡N ¡would ¡
Why ¡it ¡works ¡
- M ¡runs ¡N ¡ ¡(over ¡and ¡over ¡and ¡over....) ¡for ¡longer ¡
and ¡longer ¡sequences ¡of ¡nondet ¡choices ¡
- If ¡N(w) ¡accepts, ¡then: ¡
- for ¡some ¡s, ¡there ¡is ¡a ¡sequence ¡of ¡s ¡nondeterminis+c ¡
choices ¡that ¡causes ¡N ¡to ¡accept. ¡
- eventually, ¡M ¡will ¡produce ¡that ¡sequence ¡on ¡tape ¡3, ¡and ¡
simulate ¡the ¡accep+ng ¡computa+on ¡on ¡tape ¡2, ¡and ¡accept ¡
- If ¡N(w) ¡doesn’t ¡accept, ¡then: ¡
- there ¡is ¡no ¡sequence ¡of ¡choices ¡that ¡cause ¡N ¡to ¡accept. ¡
- regardless ¡of ¡what ¡sequence ¡is ¡used, ¡M ¡will ¡not ¡accept ¡
- M ¡will ¡just ¡run ¡forever, ¡hence ¡not ¡accept ¡w ¡
Ques*ons ¡
- If ¡N ¡halts ¡and ¡rejects ¡for ¡some ¡sequence ¡of ¡
choices, ¡what ¡does ¡M ¡do? ¡ ¡Why? ¡
- If ¡N ¡runs ¡in ¡k ¡steps, ¡roughly ¡how ¡many ¡steps ¡
does ¡M ¡take? ¡
Nondeterminis*c ¡Complexity ¡
DEF: ¡ ¡A ¡NTM ¡N ¡is ¡T(n) ¡+me ¡bounded ¡iff ¡for ¡ ¡ every ¡n, ¡for ¡every ¡input ¡w ¡of ¡size ¡n, ¡and ¡for ¡ ¡ every ¡possible ¡sequence ¡of ¡nondeterminis+c ¡ choices, ¡N(w) ¡halts ¡within ¡T(n) ¡transi+ons. ¡
Nondeterminis*c ¡Complexity ¡Classes ¡
N+me(T(n)) ¡= ¡ ¡ ¡ ¡{L ¡| ¡exists ¡a ¡T(n) ¡+me-‑bounded ¡NTM ¡ ¡ ¡ ¡ ¡ ¡accep+ng ¡L} ¡ Nspace(S(n)) ¡= ¡ ¡ ¡ ¡{L ¡| ¡exists ¡a ¡S(n) ¡space-‑bounded ¡NTM ¡ ¡ ¡ ¡ ¡ ¡accep+ng ¡L} ¡
Tape ¡reduc+on, ¡linear ¡speed-‑up, ¡+me ¡& ¡space ¡hierarchies ¡ analagous ¡to ¡determinis+c ¡+me ¡& ¡space ¡complexity ¡ ¡
D*me ¡vs ¡N*me ¡
- D+me(f(n)) ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡N+me(f(n)) ¡
– why? ¡
- N+me(f(n)) ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡D+me(2O(f(n))) ¡
– why? ¡ ¡
⊂ ⊂
⊂
Savitch’s ¡Theorem: ¡ ¡ ¡Nspace(f(n)) ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡Dspace(f(n)2) ¡ ¡
and ¡finally, ¡we ¡define.... ¡
NP ¡= ¡ ¡ ¡ ¡N+me(nk) ¡ ¡ ¡ ¡
∪
k ¡≥ ¡0 ¡
“Nondeterminis+c ¡Polynomial ¡Time” ¡
¡Union ¡over ¡all ¡polynomials ¡p ¡of ¡N+me(p(n))) ¡
P ¡ ¡vs. ¡NP ¡ P ¡ NP ¡
Million-‑dollar ¡ques+on: ¡ ¡Does ¡P ¡= ¡NP ¡? ¡
Why ¡we ¡care ¡
- Languages ¡corresponding ¡to ¡hundreds ¡of ¡
- p+miza+on ¡problems ¡are ¡easily ¡in ¡NP, ¡
unknown ¡if ¡in ¡P ¡
- If ¡P ¡= ¡NP, ¡internet ¡security ¡would ¡fail ¡
Decision ¡problems ¡revisited ¡
- Many ¡op+miza+on ¡problems ¡can ¡be ¡reposed ¡
as ¡decision ¡problems. ¡ ¡ ¡
- TSP: ¡ ¡Given ¡complete ¡undirected ¡graph ¡with ¡
edge ¡weights, ¡find ¡a ¡tour ¡(simple ¡cycle ¡visi+ng ¡ each ¡vertex ¡once) ¡of ¡minimum ¡total ¡weight. ¡
- TSPdec: ¡ ¡{<G>#k ¡| ¡G ¡is ¡a ¡complete ¡undirected ¡
graph ¡with ¡edge ¡weights ¡and ¡there ¡exists ¡a ¡ tour ¡of ¡total ¡weight ¡≤ ¡k ¡} ¡
Focus ¡on ¡Decision ¡Problems ¡
If ¡decision ¡problem ¡is ¡hard, ¡associated ¡
- p+miza+on ¡problem ¡is ¡hard. ¡
Oaen, ¡if ¡decision ¡problem ¡is ¡easy, ¡associated ¡
- p+miza+on ¡problem ¡is ¡easy. ¡
Self-‑reducibility: ¡ ¡when ¡an ¡algorithm ¡for ¡the ¡ decision ¡problem ¡can ¡be ¡used ¡to ¡solve ¡the ¡
- p+miza+on ¡(search) ¡problem ¡
Example: ¡ ¡ ¡TSP ¡
- Given ¡black ¡box ¡for ¡deciding ¡TSPdec. ¡
- Use ¡it ¡to ¡find ¡the ¡weight ¡of ¡minimum ¡tour ¡of ¡a ¡
given ¡graph ¡G ¡
¡Do ¡binary ¡search ¡to ¡find ¡min ¡k ¡ ¡such ¡that ¡ ¡ ¡ ¡<G> ¡# ¡k ¡ ¡is ¡in ¡TSPdec ¡
¡ ¡Let ¡opt ¡be ¡cost ¡of ¡min ¡possible ¡tour ¡
- Now ¡find ¡a ¡tour ¡of ¡weight ¡opt: ¡ ¡
WHILE ¡ ¡G ¡has ¡more ¡than ¡n ¡edges ¡ ¡ ¡FOR ¡each ¡edge ¡e ¡remaining ¡in ¡G ¡ ¡ ¡ ¡IF ¡<(G-‑e)> ¡# ¡opt ¡is ¡in ¡TSPdec ¡THEN ¡ ¡remove ¡e ¡
TSP ¡is ¡in ¡NP ¡
- Given ¡G, ¡k, ¡what ¡is ¡a ¡nondeterminis+c ¡poly-‑
+me ¡algorithm ¡to ¡decide ¡whether ¡or ¡not ¡G ¡has ¡ a ¡tour ¡of ¡cost ¡at ¡most ¡k ¡? ¡
- Guess ¡a ¡tour ¡t, ¡and ¡accept ¡if ¡cost(t) ¡≤ ¡k. ¡
– Time ¡is ¡poly ¡(linear ¡in ¡fact) ¡ – If ¡there ¡is ¡a ¡tour ¡of ¡cost ¡at ¡most ¡k, ¡then ¡there ¡is ¡an ¡ accep+ng ¡computa+on ¡ – If ¡there ¡is ¡no ¡tour ¡of ¡cost ¡at ¡most ¡k, ¡then ¡all ¡ computa+ons ¡reject. ¡