D CO thg mo phon gM trong khong gian dg{n) vdi mot h^ng so
288 Tirih nangia
Sa do nay duoc ap dung cho ttog cong t^c, v6i chut it chinh siia tai nhiing cot bien. M5i 6 thuoc cot bien trai cua hoat bang, tijtc
cell[i, 1] vdi 1 < i < t{n), chi c6 hai o thuoc hang tren anh hucing den noi dung cua nọ Cac o thuoc cot bien phai cung tuong tvr nhu vaỵ Trong nhfing trudng hop nay, ta chinh siia so do de mo phong hknh vi cua M trong boi canh aỵ
Doi vdi cac o thuoc hang thuf nhat, do chung khong c6 nhflng o phia tren, nen dudc xvt ly theo each rieng biet. Nhiing o nay chiia hinh thai ban dau, tiic go^icr2 • • o"n, vk ckc cong t^c cho chung dudc dau noi vdi cac bign dau vaọ Theo each nay, cong tac lighth, l,\q^] dmc dau noi vdi bien dau vao ai, bdi vi hinh thai ban dau duoc bat dau bdi trang thai qo vh ky ttr ai ma may doc daoc. Tuong tu, cong tac light[l, duoc noi qua c6ng NOT vdi aị Tiep theo, light{l,2, l], ... ,light[\,n, l ] duoc noi vdi
cac bien dau vao (72, ... , cr„, va light{l, 2,0], ... , light[].,n, 0] dugc
noi qua cac cong NOT vdi cr2, ... Them niia, cac cong tac
light[l,n + 1,0], . . . , light[l, t{n), 0] diidc bat, bdi vi cac o con lai
cua hang thii nhat trong hoat bang tUdng ling vdi nhiing 6 trong (chiia ky tU 0) tren bang. Cuoi cung, tat ca cac cong tac khac cho hang thuf nhat deu t^t.
Bhig each nky ta xay diing diidc mach mo phong may M chc den phep bien đi thii t{n) cua nọ Viec con lai la lua chon mdt trong cac c6ng lam cQng ra cua mach. Theo gia thiet, may A/ chai nhan t i i vao w do dai n neu, ngay sau khi thuc hien phep bien d6i thur t{n), may d trang thai q^, dau doc-ghi d o dau tien tren bani
va d do CO ky tu 0. Bdi the, ta chi dinh c6ng dudc dau noi vdi cong t^c light[t{n), l , ! " ^ ^ ] l^m cQng rạ
Dinh ly dUdc chiJng minh. 0
Nhu vay, b^ng each lien ket dp phiic tap mach rdng vdi do phiJ^ tap thdi gian cua may Turing, Dinh ly 4.3.4 cho ta mot each tiCjl
can kha triin vong doi vdi van de P 7^ NP.
4.3 Mach Boole doi vdi van di P= NP 289
4.3.2 Cach chuTng minh khac cho Dinh ly Cook-Levin Levin
Ngoai viec lien ket do phiic tap mach rong vdi do philc tap thdi gian cua may Turing, Dinh ly 4.3.4 con cho ta mot each chiing minh khac doi vdi Dinh ly Cook-Levin ve bai toan NP-day du dau tien. Ta noi
rang mach Boole la thoa duCdc ngu c6 mot each gan tri nao do cho
cac bien dau vao dg mach cho ket qua 1. Bai toan thoa dUdc doi vdi
mach Boole hay hai todn mach-thoa duCdc {circuit-satisfiability
problem), dudc viet tat la CIRCUIT-SAT, d6i hoi kilm tra xem lieu
mach Boole c6 thoa dUde hay khong. Gia sut
CIRCUIT-SAT = {(C) I C la mach Boole thoa duoc}. Dinh ly 4.3.4 chiing to rang mach Boole cd kha nang mo phong may Turing. Ta sii dung ket qua nay dg chiing minh r^ng CIRCUIT-SAT
la NP-day dụ
Dinh ly 4.3.5 CIRCUIT-SAT la NP-d&y dụ
Chiing minh Dg chiing minh dinh ly nay, ta cin chiing to r^ng
CIRCUIT-SAT thuoc N P va moi ngon ngfl A trong N P deu quy
dan duoc den CIRCUIT-SAT. Dieu thii nhat la ro rkng. Dg chiing minh digu thii hai, ta phai dua ra duoc mOt phep quy dan thdi gian
da thiic / nh^m tUOng ling moi t i i w vdi mot mach Boole C, sao cho tii dang thilc
• • / H = (C) suy ra r^ng:
w e A <=4' C la thoa duoc.
Do ngon ngU A thuoc NP, cho nen doi vdi no cd mot may kiem
chiing thdi gian da thiic V vdi dau vho \h cap {w, c), trong so d6
CO nhUng cap ma chiing cii c trd thanh b^ng chiing chiing to r^ng
290 Tinh nan giai
mo phong V b^ng each sii dung mach diioc xSy dung trong chiing minh Dinh ly 4.3.4. Ta thay the mot so dau vao cua mach bcii x, nhiing ky t u cua w. Nhiing dau vao eon lai cua mach duoc tuong
ling vdi ehiing cii c. Mach thu duoe bang each nay duoe ky hieu b5i
C va la mach ma ta can den.
Neu C la thoa duoc thi mot b^ng chiing ton tai va do do w la thanh vien cua Ạ Nguoe lai, neu w la thanh vien cua A thi doi vdi
no ton tai mot b^ng chiing va vi thg C la thoa duoc.
De chiing to rkng phep quy din nay thtre hien trong thdi gian da
thiic, ta nhan thay rang trong chiing minh Dinh ly 4.3.4, viec xay
dung mach c6 thg duqc hoan thanh trong thdi gian da thiic theo n.
Do thdi gian hoat dong ciia may kiim chiing la n'^ vdi mot hang so
k nao do, cho nen kich c3 cua mach duqc xay dtrng la Ofn^*^]. Cau
triic cua mach kha don gian (c6 tinh lap lai rat cao), bdi vay thdi
gian quy dan la 0[n^'^]. • Nhir vay, ngon ngu: CIRCUIT-SAT dxiac chiing minh true tiep
la NP-day du, khong can thong qua bat cii ngon ngu: NP-day du
nao da biet. Theo nghia nay, Dinh ly 4.3.5 ve tinh NP-day du cua
CIRCUIT-SATdmc chiing minh tuong tu nhu Dinh ly Cook-Levin
v^ SAT Bay gid ta chiing to rkng 3-.SAT la NP-day du nhd tinh
NP-day du cua CIRCUIT-SAT. Co thg coi day nhu mot each chiing
minh khac cua Dinh ly Cook-Levin.
Dinh ly 4.3.6 3-SAT la NP-day dụ
Chiing minh R6 rang 3-SAT thuoc NP. Ta chiing to r^ng moi
ngon ngu: cua N P quy d i n duqc den 3-SAT trong thdi gian da
thiic. Dg lam dieu nay, ta tim each xay dung mot phep quy d i n
thdi gian da thiic til ngon ngit NP-day du CIRCUIT-SAT den ngon
ngii 3-SAT. Phep quy d i n chuygn đi mach C thanh cong thiic ^
sao cho C thoa diioc neu va chi neu 0 thoa dtrqc. Cong thiic 0 chiia * cac bien nhu nhiing bien dau vao va nhiing c6ng cua mach C.
4.3 Mach Boole doi vdi van deP^NP 291
Nom na ma noi, cong thiic 0 mo phong mach C. Phep gan tri d i 0 thoa duqc bao ham phep gan tri dg C thoa duqc. No cung bao gom ca nhiing gia tri tai tiing cong ciia C trong qua trinh tinh toan
tren nhiing gia tri dau vao lỵ Thuc chat, phep gan tri de 0 thoa
duqc "phong doan" toan bq qua trinh tinh toan cua C trgn phep
gan tri thoa duqc cua no va cac cum tuygn ciia 0 kiem soat tinh chuan xac cua qua trinh tinh toan aỵ Thgm nira, cong thiic 0 chiia
cum tuygn nhSm an dinh rang ket qua tinh toan cua C phai la 1.
Ta bat dau xay dung phep quy d i n thdi gian da thiic / tir
CIRCUITS A T den 3-SA T.
Gia sii C la mach chiia cac bien dau who xi,...,xi va cac c5ng
gi,...,gm- Tiit mach C phep quy d i n tao ra mot cong thiic 0 vdi cac bien x i , . . . , x/, ^1,..., 5^. Tiitng bien ciia 0 tuong ling vdi mot
day d i n trong C. Nhiing bien Xi tUOng ling vdi cac day d i n dau vao va nhiing bien gi tiiOng ling vdi cac day d i n tai loi ra ciia c5ng.
Ta ky hieu lai cac bien cua 0 la f i , . . . , vi+rn-
Bay gid ta dien ta cac cum tuygn cua 0. Nqi dung cua cong thiic 0 duqc thg hien ro rang hon b^ng each sii dung cac phep suy dign. Tuy nhign, moi phep suy dign (P —> Q) tuong duong vdi phgp
tuygn (P V Q). Moi edng NOT trong C vdi day d i n vao Vi va day din ra Vj tiiong duong vdi bigu thiic
{Wi Vj) A {vi -^v])
va, tiep den vdi hai cum tuyin
(viVVj) A{v-i\/v]).
Nhan thay r^ing ca hai cum tuygn nay la thoa duqc khi va chi khi
phep gan tri cho cac bien Vi vạ Vj tuong xiing vdi su van hanh chuin
xac cua edng NOT.
Moi c6ng AND trong C, c6 hai dau vao Vi vk Vj vk c6 dau ra Vk,
tuong duong vdi
292 Tinh nan giai
vk tiep den vdi bon cum t u y i n
Tuong tir, m5i c5ng OR trong C, c6 cac dau yho Vi vk Vj vh c6
dau ra Vk, ttrong diiong v6i
{{WiAv-) vi^)A{{v-iAvj) Vk)A{{viAv-) Vk)A{{viAvj) Vk)
\h tiep den vdi bon cum tuyen
{vi V Vj V y^) A {vi V V Vk) A{viy Vj V Vk) A (ij" V V Vk).
Trong tiing trirdng hop, ca bon cum tuygn \h. thoa duoc khi vk chi
khi phep gan t r i cho cac bien Vi,Vj va Vk tUOng xiJng v6i su van hanh chuin xac cua c6ng tucng ufng.
Tiep theo, hoi cua nhiing cum tuygn neu tren va (vm) cho ta
mot cong thiic Boole dildi dang hoi chuin t^c, trong do cum t u y i n
vdi do dai mot (vm) tirong ling vdi day d i n tai loi ra cua cOng rạ
Mot vai cum tuygn trong cong thtic nay c6 do dai nho hdn bạ Ta
CO thg keo dai d i chiing dat diroc do dai can thiet b^ng each lap lai
ckc bien. T h i du, cum tuyen do dai mOt (vm) duqe keo dai thknh
cum tuygn do dai ba tiiong dildng {vm V Vm V (;,„). Den day vife xay
dung cong thiic (j) kgt thuc.
Cuoi cilng, ta c6 doi Idi ban luan ve ket qua xay dung. Neu ton
tai mot phep gan t r i d i C thoa duoc, ta c6 dudc phep gan t r i thoa
dudc doi vdi (p bang each gan cho gi nhiing gia t r i phii hop vdi qua
trinh t m h toan cua C tren phep gan t r i aỵ NgUdc lai, neu ton tai phep gan t r i dg (p thoa dUdc, no cho ta phep gan t r i thoa dUdc dọ vdi C, hdi v i no dign ta toan bo qua trinh tinh toan cua C v6i ket
qua dau ra la 1. Phep quy d t n c6 thg dUdc thuc hien trong thd
gian da thiic, bdi v i (p duoc xay dung kha don gian vk eo do dhi da thiic (tham chi tuyen tinh) theo kich cd cua dau vaọ
Dinh ly duoc ehiing minh. D
Bai tap 2 9 3
Bai tap
4 . 1 Chiing minh r^ng T I M E ( 2 " ) = T I M E ( 2 " + 1 ) . 4 . 2 Chiing minh rang T I M E ( 2 " ) C T I M E ( 2 2 " ) . 4 . 2 Chiing minh rang T I M E ( 2 " ) C T I M E ( 2 2 " ) . 4 . 3 Chiing minh r^ng N T i M E ( n ) C P S .
4 . 4 Chiing minh rang, ngu A eP t h i = P .
4 . 5 Chiing minh r^ng, neu N P = P^'^^ thi N P = c o - N P .
4 . 6 Xet ham dem paD : E* x N —> E*ti* duoc dinh nghia b5i
paD(s, k) = stt"", trong do m = max{0, A; - /} va / la do dai cua s. N h u vay pa5(s, A;) don thuSn dem thgm vao cuoi t i i s
mot luong ky t u mdi jj du d i thu duoc ket qua vdi do dai it
nhat b^ng k. Doi v6i m6i ngon ngiJ A va ham / : N —> N , ngon ngu: PAD[A, /(/)),dUdc dinh nghia nhu sau:
PAD{A, / ( / ) ) = {pai)(s, / ( / ) ) | seAval\hdo dai cua s}.
Hay chiing to r^ng, ngu A thuOc TiME('n^) t h i PAD{A,n'^)
thuoc T i M E ( n ^ ) .
4 . 7 Nh^c l a i r i n g E =^UfcTiME(2"*) vk N E =^UfcNTiME(2"'). Chiing minh rang, ngu E N E thi P 7^ N P . (Co t h i chiing Chiing minh rang, ngu E N E thi P 7^ N P . (Co t h i chiing minh b^ng each sii dung ham dem duoc dinh nghia trong Bki tap 4.6.)
4 . 8 Cho ham dem poO, nhu trong Bai tap 4.6.
ạ Chiing minh r^ng, doi vdi moi ngon ngfl A vh moi s6 t u nhien k, AeP neu va chi neu PAD{A, n'') e P .