V sao cho khong mot sinh vign nao thi hai mon trong ciing mpt • bu6ị Noi dung bai toan bao gom viec xac dinh xem lieu c
Do phiJc tap khong gian
Trong chuong nky ta khao sat do philc tap cua cac bai toan theo
luqng khong gian, tilc dung lirong bo nhd ngoai, duoc sil dung dg giai bai toan. Thdi gian va khong gian la nhiing chi phi dang kg can duoc quan tarn khi t i m kiem Idi giai cua bai toan. Do philc tap khong gian c6 nhieu net dac trung giong nhu do philc tap thdi gian va cung la mOt tigu chuin philc tap duoc sijt dung trong viec phan Idp cac bai toan. Tuong t u nhu khi phan Idp cac bai toan theo do philc tap thdi gian, trong trudng hop nay mo hinh may Turing v l n la mot lira chon thich hop.
Ta bat dau tif dinh nghIa do philc tap khong gian cua cac loai may Turing quen thuoc, trgn co sd quy dinh luqng khong gian can thiet dg may hoan thanh tinh toan trgn mdi dau vao, va tien hanh khao sat quan he giiia do philc tap thdi gian va dO philc tap khong gian cua mot may Turing cho trudc cung nhu quan he ve do philc tap khong gian giQa may Turing tat dinh va may Turing khong tat ^inh. Ket qua khao sat chilng to rang, khac vdi do philc tap thdi gian da thilc, kha nang doan nhan ngon ngii cua may Turing t a t ^inh khong gian da thilc va cua may Turing khong tat dinh khong gian da thilc la nhu nhaụ Cuoi cung, bang each tach rdi khong gian tính toan va khong gian liru trfl d i i lieu dau vao, ta eo may Turing
208 Do phijcc tap khSng gian
3.1 Do phiJc tap khong gian cua cac ^ may Turing may Turing
Trong Muc 1.1.1, khi mo ta nhiing net co ban cua m&y Turing ta nhan thay rang, bang cua may Turing dong vai tro bo nhd ngoki cua maỵ S6 ludng cac o tren bang duoc sii dung tai moi thdi digm trong qua trinh tinh toan se dac trilng cho dp phiic tap khong gian cua maỵ
Bay gid ta Ian ItfOt dinh nghIa do philc tap khong gian doi vdi
tiing loai may Turing quen thuoc.
3.1.1 Do phiJc tap khong gian cua may Turing tat dinh mot bang tat dinh mot bang
Gia sijf A n a mOt may Turing tat dinh mOt bang diJng vdi bang chQ:
vao Ẹ Nhir da biet, qua trinh tinh toan cua may Af tren moi tir vao w e S* la mot qua trinh chuygn d5i cac hinh thai cua may, kg tLf hinh thai ban dau CQ = qow den hinh thai ket thiic C^, tiic \k
qua trinh:
Co I—> C i I - + • • • H-> Ct I—> • • • H-> Ck-i Cfc,
trong do Cj ^ UtqtUt la hinh thai ciia may M tai thcJi digm t trong qua trinh tinh toan tren w, {t = 0,1,..., k).
Ta ky hieu SA/((i;, f) la so o tren bang ma m^y A/ sijf dung tai
thdi digm t \h SM{W) la so toi da cac 6 ma A/ sii dung tai moi thd'
digm trong qua trinh tinh toan trgn t\l vao w. Ta c6: SM{w,t) = \UtVt\,
SM{W) = m&x{sM{w, t) \ = 0,1,... ,k}. K h i do do phiic tap khong gian S M ( « ) ciia may Turing Af duoc x^c
dinh bdi |
SM{n) = max{sA,/('^) w 6 E"}.
3.1 Do phitc tap khong gian cua cac may Turing 209
Mot each hinh thiic, ta c6 t h i dinh nghia do philc tap khong gian cua may Turing nhu saụ
D i n h nghia 3.1.1 Cho Af la mot may Turing tat dinh mot bang diing. Do phiic tap khong gian cua may Turing {space com- plexity of Turing machine) Af la ham s : N —> N , trong do gid tri s{n) la so toi da cac 6 tren bang ma may Af sỉ dung tai moi thdi diim trong qua trinh tinh todn cua may tren hat cii tic vao nao vdi ciing do đi n.
Khi mdy Turing Af c6 do phiic tap khong gian s{n), ta noi rang Af hoat dong trong khong gian s{n) hay Af la mdy Turing khong gian s{n).
Nhu vay, tuong tir nhu doi vdi do phiic tap thdi gian cua may Turing, do phiic tap khong gian dUOc dinh nghia bdi so o trgn bang ma may can sii dung d i thuc hien viec tinh toan "trong trudng hop
xau nhat" vh cung duoc xac dinh mot each tiem can, tiic dugc xac dinh bdi can tren tiem can hoac tot nhat bdi can sdt tiem can. Tuy
nhign, trong nhieu trudng hdp va khi c6 ygu cau, ta c6 the xac dinh mot each chinh xac do phiic tap khong gian cua maỵ
V i du 3.1.1 Ta hay xac dinh do phiic tap khong gian cua may
Turing tat dinh mot bang A, dUdc xay dung trong cac Muc 2.1.1
va 2.1.2 nham khang dinh ngon ngii
L = { 0 ' r | i = 0 , l , 2 , . . . } .
Ta nhac lai rang, qua trinh tinh toan cua may Turing A tren ^ o i txi vao duoc dien ra nhir saụ TriCdc tien, loai bo ngay nhiing
vao khong c6 dang ÓV vdi moi i, j > 0. Tiep den, doi vdi nhiing
vao dang O ' l ^ thuc hien mot quy trinh lap ma moi budc lap bao g6m viec xoa ky t u 0 dau trai va ky t u 1 dau phai cua t i i c6 ^r§n bang cho tdi khi hoac ky t u 0 hoac ky t u 1 khong con nflạ
Cuoi cung, n6u tren bang khong c6 b i t cut ky tir nao ngoM ky t u
trong 0 , t h i chap nhan; ngUOc lai, bdc bọ Tuy nhien, v6i muc dich
tiet kiem thdi gian va khong gian tinh toan, viec loai bo nhOing t i l
khong CO dang 0^1^ diroc tien hknh dong th5i ciing vdi bu6c lap
dau tien.
Trong q u ^ trinh tinh tôn, ro r^ng so o ma mdy c^n sijt dung
khong he tang them va cu: sau m6i budc lap, hai 6 lai diroc giai
phong. Doi v6i moi t i i vao do dai n, tai thdi diSm ban dau mdy sii dung n ọ Hon nfla, doi v6i nhiJng til vao dang Ól^ va dang ca biet 0", tai thdi digm t = n may cung sii dung dung n 6, hdi vi khi ay dau doc-ghi dang 6 o trong ngay sau o chiia ky t i l cuoi ciing cua t\l
vho va 6 dau tien cua bang da duoc giai phong.
Nhu vay, may Turing A c6 do phiic tap khong gian s>i(n) = n,
tutc do phiic tap khong gian tuyen tinh. • V i d u 3.1.2 Cho ham g : {0, l } * —> {0, l } * , dirqc xac dinh
nhtr sau:
ii^ neu w = 1", doi vdi moi n = 0 , 1 , 2 , . . . ,