Turing Machine Contents, Study Guides, Projects, Research of Computer science

Usefull if you are studying about turing machines

Typology: Study Guides, Projects, Research

2024/2025

Uploaded on 06/15/2025

vaishnavi-47
vaishnavi-47 🇺🇸

2 documents

1 / 16

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Scanned by CamScanner
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff

Partial preview of the text

Download Turing Machine Contents and more Study Guides, Projects, Research Computer science in PDF only on Docsity!

TURING MA 4.4. TURING MACHINES Alan Turing introduced a new mathematic Cty, al Mode] . Cal] Machine during the year of 1936. It is mostly used to define lat e "Rua Bes My mee a integer ns. compute integer functio’ h The basic model has a finite control, an input tape that is divig f . ed; cells, and a tape head that scans one cell of the tape at a time, tin, Mareperar re Tape head Finite control Fig.4.13 Turing Machine Model Vv Each cell can hold one of a finite number of tape symbols, Y All other tape symbols extending infinitely to the left and rat hold a special symbol called blank. v Initially the tape head is pointing the leftmost cell that hols the input. ; In one move, the turin I ‘ ne & machine depending upon the symbol sca! by the tape ‘head and the state of finite control. * Itchanges its State. wg wht ‘i ing * It Prints a symbol! on the tape cell scanned, replaci"s Was written there, * Moves its head One cell, to its left or right. y Scanned by CamScanner properties of CFL and Turing Machines 44 Definition ~— A Turing Machine M is a 7-tuple M=(Q, 5, 5; do: B, F) where Q- finite set of states 5 — finite set of input symbols r- finite set of tape symbols 8- transition function mapping the states of finite and tape symbols to states, tape symbols and aioe the head. ement of ie, QX PF Q*P*{L, BY qo = Qis the initial state F cQis the set of final states BE j- is the blank symbol. 4.4.2 Instantancous Description for Turing Machines The ID of a turing machine is defined in terms of the entire input string and the current state. Definition : An ID ofa Turing Machine is a string «By, where B is the present state of M, the entire input string is split as ay, the first symbol of y is the current symbol ‘a’ under R/w head and y has all the subsequent symbols of the input string and the string a is the substring of the input string formed by all the symbols to the left of a. £g. Construct the ID. . R/w head Fig 4.14 Instantaneous Description Scanned by CamScanner a—_ Suppose 8(q, Xi) = (P; Ys R)], and the input string to be processed is X1 Xq-- + Xq ae ane Xp Qi Xn XXQ Xi) YP Kigy ee Xy 4.4.4 Language ofa TM The language accepted by M denoted L(M) is the set of those words in 5* that cause M to enter a final state. L(M) = {w | w in £* and qow a pct, for some p in F and 4), Oy £ FY [1]Design a TM to accept the language L = {0" I" | n 21} [Apr/May-2005] Solution : Given a finite sequence of 0’s and 1’s on its tape. The turing machine is designed using the following way. (i) M replaces the leftmost 0: by x, moves right to the leftmost 1, replacing it by y. : (ii) Then M moves left to find the rightmost x, and moves one cell right to the leftmost 0 and repeats the cycle. (iii) While searching for a 1, if a blank is encountered, then M halts without accepting. (iv) After changing a1 toa y, if M finds no more 0’s, then M checks that no more 1’s remain, accepting the string else not. Assume the set of states Q = {dg 45 Gy I> Ig} r= 0,1} fF =(0. 1, x, y, B} F= {qq} let oq be the initial state and at state Qo» it replaces the leftmost 0 by x, and changes it to q,. Atq,, M searches right for 1’s, skipping over 0’s and y’s. Scanned by CamScanner . . a If M finds a 1, it changes it to y, entering state qp. From gy itseagee ts : Catch : 8 le ty, an x and moves right to change the state to Qo: At qo; if y is encountered, it goes to state q; and check s remain. If the y’s are followed by a B, state 4, is entered and th ta Oy, And for all others, M rejects. ” "ep 0 | x y B qo (q,.x.R) a ~ (q3, y, R) q) (q,, 9, R) (q,, y, L) = (q,. ys R) ~ —& 1G OL) = @xR @yl) - q _ _ _— 3 (43.¥5R) q,,B,R) q4 TT ~ _ - Eg: (i) q0011 xq 011 Fx0q,11 Fxq,0y1 Fq,x0yl Xqo0yl Fxxq,y1 Pay Pxxqyy Pxq,xyy F TADYY PXXY Gy Pxxyyq, i FxxyyB qu. Accepted. (ii) q,0 4 1] xq, 11 Cq,xyl Pr xqoyl PF xyq,! rejected, Scanned by CamScanner : Theory of ~ i ntering state q Fron LC i : = : male qo. Fr n it se, ty IfM finds a 1, it changes it to y, e 2 5 Goo it Sergi ‘ an x and moves right to change the state to qo: iy At qo. ify is encountered, it goes to st 0° remain. If the y’s are followed by And for all others, M rejects. ate 43 and Check . 8 that ho 1 4B, state 44'S entered ang then ag, | Ny “Dtey, 0 | X y B Mo | (4,,.x,R) ~ - (43, y, R) _ 4] %R) yb) 7 @pyR % | (q,, 0, L) ~ q3 C - (dp, x, R) (4), y, L) - (43, y, R) (44, B, R) (i) q,0011 Fxq,011 Fx0q,11 xq, 0y1 Fa,x0y1 xq,0yl Pxxqyl Pxxyq) 1 Pxxqnyy Pxqgxyy XXUoYY Pxxy qay Pxxyyqs PxxyyB q4- Accepted, _ Gi) got F xq. 11 Paqyxyl p XY F xyqy 1 Tejected, Scanned by CamScanner yly Fig. 4.15 Transition diagram for 01", M=(QE, 1,8, 4B, (ay) where Q= {Mos Gy> Ip» 432 a} x = {0,1} r=(0, 1,x, y, B} Qy = Initial state q4 = Final state 8 is given in the table. L: The set of strings with an 2) Design a Turing Machine for the language equal number of 0’s and I's. Solution : iin either 0 oF lL. Assume that the input string may start with 101, 0110 001.9" “ meet ef ant ane , jpothor the input syne (i) Change all 0’s to x’s and all V's pole . blank gyunbol . myveinany ~ ee if it finds the aes m ue wong ic at state do: At Me" vnigh (> ety eT | symbol as ; Scanned by CamScanner -ayqer out Us UoAIB St. Q areys jeury =°b uy = Ob 9yeys fqn x1 oa4 {1‘0}=3 (5b th hb lbp lb by = fe) EXCIIy ({5b} “a pg 4 ‘3 0) =NWL orb Bud Scanned by CamScanner et, ty, Nags e Ohedy mtaedtinte tat accepts the language L = 4 ihe, , hy | | Lahey > SC ownstiietion ts similar to the design of 0&2, YW We have to replace each a by x and b by y and ¢ by z repeat lh: © Ally the Turing Machine is at state Qo: At qos if it finds g ae Steph, & dy v's and moves right with state q, At q, if it finds D's, reply J . NT dy y's and moves right with state q,. At State q,, if it finds o', rp ’ > F Tl it by z, and enters state q; by moving left. At 3, if it finds the lefing X. by skipping z, b, y, a, then it goes to state qo. Repeat the Proves At qo, it finds y. a b c x y Zz B B GpXR = - — @yyR) = - % /@paR) @,y,R — (@pyR) = - a, } - (46 R) (G21) = — — (q,zR) q; | As a,L) (q3, b, L) — (2R) @yy,L) = - % | - - 7 ~ Gy YR) (qq. 2 R) (Gy BA Eg: (i) qgaabbeo EF xqyabbec xaq, bce E xayq,beo Xaybq,cc EF xayq,bzo xaq,ybze Xqjaybze Q3Xaybze f- Xqgaybze xq ybze Fr xxyq,bze f- XXYYqoze 0 A Xxyyzqje KR Xxyyq,2Z fF *XYqny2z A XXq3yyzz I Xq3xyyzz qoyye2 XNyquy2z xxyyqyzz YqZ *xyyZzq.Bo xxyyzz2Bq, Accepted, Scanned by CamScanner ——__—p eM Construct a Turing machine that performs addition op erat; io (Nov Solution : Oe The function is defined as [(xty) =x + y. x is given by 0X y is given by 0” The input is placed on the tape as OX10Y. The sum of thes are performed by replacing the intermediate | by 0 and replacing blank symbol. C ly Ww i the li, The transition table is given as follows : é: 0 1 B qo | (4,0R) (q,,0,R) 9 - q, | (q,,0,R) = (q,; B, L) 4, | (q3,B,R) - _ q, - - _ x=3, y=2, f(xty) (i) qy03102 => q)900100 oF 0q,00100 fF 00q,0100 fF 000q,100 fF 0000q,00 00000q,0 fF 00000q,B 00000q,0B fF 00000Bq, Transition diagram; 010 + Start Scanned by CamScanner O16 Br © old (%) 0} gio’ MB, 6} op syges ye bo SIIB, Fig. 4.21 (m—n) Proper Subtraction _v) Turing Machine, M= (Q,.5, b. 8, dos B, {q,}) ‘where Q = {qos qd: q>> G3; Wy Is 46) == {0,1}: | Scanned by CamScanner